From a00690fbde468f406f67c2ccca58c3dbd4311a71 Mon Sep 17 00:00:00 2001 From: Mischa Date: Fri, 24 Jul 2026 19:38:05 +0200 Subject: [PATCH 1/8] feat(post): unhide lat/lng fields, style the location-details panel Removes the CSS rule hiding data[lat]/data[lng] and adds styling for the new 'More location details' disclosure, search results list, map preview container, and mismatch-flag state. --- themes/intotheeast/css/style.css | 106 ++++++++++++++++++++++++++++++- 1 file changed, 103 insertions(+), 3 deletions(-) diff --git a/themes/intotheeast/css/style.css b/themes/intotheeast/css/style.css index f8b6d55..1755786 100644 --- a/themes/intotheeast/css/style.css +++ b/themes/intotheeast/css/style.css @@ -833,9 +833,109 @@ body::after { color: var(--color-ink); } -/* Hide GPS coordinate fields — filled by JS, not user-facing */ -.post-form-wrap .form-field:has(input[name="data[lat]"]), -.post-form-wrap .form-field:has(input[name="data[lng]"]) { display: none !important; } +/* "More location details" disclosure — search + map preview for setting an + entry's coordinates without live GPS. Mirrors .more-options's disclosure + look (post-form.css); the lat/lng fields (relocated here by JS) and the + lookup button reuse this file's existing .btn-action/.form-status/ + .field-invalid conventions unmodified. */ +.location-details { + margin-bottom: var(--space-5); + border: 1px solid var(--color-border); + border-radius: var(--radius-md); + background: var(--color-canvas); +} +.location-details__summary { + cursor: pointer; + padding: 0.875rem 1rem; + min-height: 44px; + display: flex; + align-items: center; + font-family: var(--font-ui); + font-size: var(--text-sm); + font-weight: 600; + color: var(--color-ink); + list-style: none; + user-select: none; +} +.location-details__summary::-webkit-details-marker { display: none; } +.location-details__summary::before { + content: '▸'; + margin-right: var(--space-2); + color: var(--color-ink-muted); + transition: transform 0.15s; +} +.location-details[open] .location-details__summary::before { transform: rotate(90deg); } +.location-details[open] .location-details__summary { border-bottom: 1px solid var(--color-border); } +.location-details > .form-field { padding: 0 1rem; } +.location-details > .form-field:first-of-type { padding-top: var(--space-4); } +.location-details > .form-field:last-of-type { padding-bottom: var(--space-2); } +.location-details__body { padding: 1rem; } + +.location-search-row { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; } + +.location-search-hint { + font-size: var(--text-sm); + color: var(--color-ink-muted); + margin-top: var(--space-2); +} +.location-search-hint:empty { display: none; } + +.location-search-results { + list-style: none; + margin: var(--space-3) 0 0; + padding: 0; + border: 1px solid var(--color-border); + border-radius: var(--radius-md); + overflow: hidden; +} +.location-search-results:empty { display: none; margin: 0; border: none; } +.location-search-results li + li { border-top: 1px solid var(--color-border); } +.location-search-results button { + display: block; + width: 100%; + text-align: left; + padding: 0.75rem 1rem; + min-height: 44px; + background: var(--color-canvas); + border: none; + font-family: var(--font-ui); + font-size: var(--text-sm); + color: var(--color-ink); + cursor: pointer; +} +.location-search-results button:hover, +.location-search-results button:focus-visible { background: var(--color-paper); } + +.location-map { + position: relative; + width: 100%; + height: 240px; + margin-top: var(--space-4); + border-radius: var(--radius-md); + overflow: hidden; + background: var(--color-paper); +} +.location-map .maplibregl-canvas { border-radius: var(--radius-md); } + +.location-pin { + width: 44px; + height: 44px; + border-radius: 50%; + background: var(--color-accent); + border: 3px solid #fff; + box-shadow: 0 1px 6px rgba(0, 0, 0, 0.5); + cursor: grab; +} +.location-pin:active { cursor: grabbing; } + +/* Mismatch flag: a typed lat/lng that doesn't (yet) parse to a valid pin. */ +.location-field--mismatch { border-color: var(--color-error) !important; outline-color: var(--color-error) !important; } +.location-field-note { + display: block; + font-size: var(--text-sm); + color: var(--color-error); + margin-top: var(--space-1); +} /* Grav form field inputs */ .post-form-wrap .form-field { margin-bottom: var(--space-5); } From 52e9fbadf2c84b068c10e603e1fb5d5dad5f0231 Mon Sep 17 00:00:00 2001 From: Mischa Date: Fri, 24 Jul 2026 19:38:10 +0200 Subject: [PATCH 2/8] refactor(map): extract MAP_STYLE into a shared map-style.js module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Single source of truth for the MapLibre style URL, shared between maplibre-utils.js (multi-marker/GPX maps) and the new location-map.js preview module — no behavior change. --- themes/intotheeast/js/map.js | 14 +++++++------- themes/intotheeast/js/maplibre-utils.js | 3 ++- themes/intotheeast/js/src/map-style.js | 4 ++++ 3 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 themes/intotheeast/js/src/map-style.js diff --git a/themes/intotheeast/js/map.js b/themes/intotheeast/js/map.js index a9eb2f0..430de37 100644 --- a/themes/intotheeast/js/map.js +++ b/themes/intotheeast/js/map.js @@ -1,5 +1,5 @@ -(()=>{var jm=Object.create;var Jp=Object.defineProperty;var $m=Object.getOwnPropertyDescriptor;var Zm=Object.getOwnPropertyNames;var Gm=Object.getPrototypeOf,Hm=Object.prototype.hasOwnProperty;var xa=(w,S)=>()=>(S||w((S={exports:{}}).exports,S),S.exports);var Xm=(w,S,F,K)=>{if(S&&typeof S=="object"||typeof S=="function")for(let E of Zm(S))!Hm.call(w,E)&&E!==F&&Jp(w,E,{get:()=>S[E],enumerable:!(K=$m(S,E))||K.enumerable});return w};var Kp=(w,S,F)=>(F=w!=null?jm(Gm(w)):{},Xm(S||!w||!w.__esModule?Jp(F,"default",{value:w,enumerable:!0}):F,w));var Qp=xa((Xc,Wc)=>{(function(w,S){typeof Xc=="object"&&typeof Wc<"u"?Wc.exports=S():typeof define=="function"&&define.amd?define(S):(w=typeof globalThis<"u"?globalThis:w||self,w.maplibregl=S())})(Xc,function(){"use strict";var w={},S={};function F(E,p,ue){if(S[E]=ue,E==="index"){var pe="var sharedModule = {}; ("+S.shared+")(sharedModule); ("+S.worker+")(sharedModule);",De={};return S.shared(De),S.index(w,De),typeof window<"u"&&w.setWorkerUrl(window.URL.createObjectURL(new Blob([pe],{type:"text/javascript"}))),w}}F("shared",["exports"],function(E){"use strict";function p(i,t,r,a){return new(r||(r=Promise))(function(l,h){function d(v){try{g(a.next(v))}catch(x){h(x)}}function f(v){try{g(a.throw(v))}catch(x){h(x)}}function g(v){var x;v.done?l(v.value):(x=v.value,x instanceof r?x:new r(function(A){A(x)})).then(d,f)}g((a=a.apply(i,t||[])).next())})}function ue(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}typeof SuppressedError=="function"&&SuppressedError;var pe=De;function De(i,t){this.x=i,this.y=t}De.prototype={clone:function(){return new De(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,t){return this.clone()._rotateAround(i,t)},matMult:function(i){return this.clone()._matMult(i)},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(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var t=i.x-this.x,r=i.y-this.y;return t*t+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,t){return Math.atan2(this.x*t-this.y*i,this.x*i+this.y*t)},_matMult:function(i){var t=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=t,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var t=Math.cos(i),r=Math.sin(i),a=r*this.x+t*this.y;return this.x=t*this.x-r*this.y,this.y=a,this},_rotateAround:function(i,t){var r=Math.cos(i),a=Math.sin(i),l=t.y+a*(this.x-t.x)+r*(this.y-t.y);return this.x=t.x+r*(this.x-t.x)-a*(this.y-t.y),this.y=l,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},De.convert=function(i){return i instanceof De?i:Array.isArray(i)?new De(i[0],i[1]):i};var se=ue(pe),X=Mt;function Mt(i,t,r,a){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(a-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=t,this.p2x=r,this.p2y=a}Mt.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,t){if(t===void 0&&(t=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,a=0;a<8;a++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)l?d=r:f=r,r=.5*(f-d)+d;return r},solve:function(i,t){return this.sampleCurveY(this.solveCurveX(i,t))}};var yt=ue(X);let Ct,li;function Pt(){return Ct==null&&(Ct=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Ct}function zt(){if(li==null&&(li=!1,Pt())){let t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let a=0;a<5*5;a++){let l=4*a;t.fillStyle=`rgb(${l},${l+1},${l+2})`,t.fillRect(a%5,Math.floor(a/5),1,1)}let r=t.getImageData(0,0,5,5).data;for(let a=0;a<5*5*4;a++)if(a%4!=3&&r[a]!==a){li=!0;break}}}return li||!1}function jt(i,t,r,a){let l=new yt(i,t,r,a);return h=>l.solve(h)}let xe=jt(.25,.1,.25,1);function Se(i,t,r){return Math.min(r,Math.max(t,i))}function Me(i,t,r){let a=r-t,l=((i-t)%a+a)%a+t;return l===t?r:l}function He(i,...t){for(let r of t)for(let a in r)i[a]=r[a];return i}let ye=1;function ve(i,t,r){let a={};for(let l in i)a[l]=t.call(this,i[l],l,i);return a}function Fe(i,t,r){let a={};for(let l in i)t.call(this,i[l],l,i)&&(a[l]=i[l]);return a}function ge(i){return Array.isArray(i)?i.map(ge):typeof i=="object"&&i?ve(i,ge):i}let Ke={};function we(i){Ke[i]||(typeof console<"u"&&console.warn(i),Ke[i]=!0)}function Ye(i,t,r){return(r.y-i.y)*(t.x-i.x)>(t.y-i.y)*(r.x-i.x)}function ht(i){return typeof WorkerGlobalScope<"u"&&i!==void 0&&i instanceof WorkerGlobalScope}let Ne=null;function rt(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}let Qe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function ft(i,t,r,a,l){return p(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");let h=new VideoFrame(i,{timestamp:0});try{let d=h?.format;if(!d||!d.startsWith("BGR")&&!d.startsWith("RGB"))throw new Error(`Unrecognized format ${d}`);let f=d.startsWith("BGR"),g=new Uint8ClampedArray(a*l*4);if(yield h.copyTo(g,function(v,x,A,D,M){let z=4*Math.max(-x,0),B=(Math.max(0,A)-A)*D*4+z,q=4*D,$=Math.max(0,x),ne=Math.max(0,A);return{rect:{x:$,y:ne,width:Math.min(v.width,x+D)-$,height:Math.min(v.height,A+M)-ne},layout:[{offset:B,stride:q}]}}(i,t,r,a,l)),f)for(let v=0;vht(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,et=function(i,t){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){let a=Bt(i.url);if(a)return a(i,t);if(ht(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,targetMapId:Vt},t)}if(!(/^file:/.test(r=i.url)||/^file:/.test(ui())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(a,l){return p(this,void 0,void 0,function*(){let h=new Request(a.url,{method:a.method||"GET",body:a.body,credentials:a.credentials,headers:a.headers,cache:a.cache,referrer:ui(),signal:l.signal});a.type!=="json"||h.headers.has("Accept")||h.headers.set("Accept","application/json");let d=yield fetch(h);if(!d.ok){let v=yield d.blob();throw new gt(d.status,d.statusText,a.url,v)}let f;f=a.type==="arrayBuffer"||a.type==="image"?d.arrayBuffer():a.type==="json"?d.json():d.text();let g=yield f;if(l.signal.aborted)throw At();return{data:g,cacheControl:d.headers.get("Cache-Control"),expires:d.headers.get("Expires")}})}(i,t);if(ht(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,mustQueue:!0,targetMapId:Vt},t)}var r;return function(a,l){return new Promise((h,d)=>{var f;let g=new XMLHttpRequest;g.open(a.method||"GET",a.url,!0),a.type!=="arrayBuffer"&&a.type!=="image"||(g.responseType="arraybuffer");for(let v in a.headers)g.setRequestHeader(v,a.headers[v]);a.type==="json"&&(g.responseType="text",!((f=a.headers)===null||f===void 0)&&f.Accept||g.setRequestHeader("Accept","application/json")),g.withCredentials=a.credentials==="include",g.onerror=()=>{d(new Error(g.statusText))},g.onload=()=>{if(!l.signal.aborted)if((g.status>=200&&g.status<300||g.status===0)&&g.response!==null){let v=g.response;if(a.type==="json")try{v=JSON.parse(g.response)}catch(x){return void d(x)}h({data:v,cacheControl:g.getResponseHeader("Cache-Control"),expires:g.getResponseHeader("Expires")})}else{let v=new Blob([g.response],{type:g.getResponseHeader("Content-Type")});d(new gt(g.status,g.statusText,a.url,v))}},l.signal.addEventListener("abort",()=>{g.abort(),d(At())}),g.send(a.body)})}(i,t)};function vt(i){if(!i||i.indexOf("://")<=0||i.indexOf("data:image/")===0||i.indexOf("blob:")===0)return!0;let t=new URL(i),r=window.location;return t.protocol===r.protocol&&t.host===r.host}function Ut(i,t,r){r[i]&&r[i].indexOf(t)!==-1||(r[i]=r[i]||[],r[i].push(t))}function ut(i,t,r){if(r&&r[i]){let a=r[i].indexOf(t);a!==-1&&r[i].splice(a,1)}}class ci{constructor(t,r={}){He(this,r),this.type=t}}class di extends ci{constructor(t,r={}){super("error",He({error:t},r))}}class Kt{on(t,r){return this._listeners=this._listeners||{},Ut(t,r,this._listeners),this}off(t,r){return ut(t,r,this._listeners),ut(t,r,this._oneTimeListeners),this}once(t,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},Ut(t,r,this._oneTimeListeners),this):new Promise(a=>this.once(t,a))}fire(t,r){typeof t=="string"&&(t=new ci(t,r||{}));let a=t.type;if(this.listens(a)){t.target=this;let l=this._listeners&&this._listeners[a]?this._listeners[a].slice():[];for(let f of l)f.call(this,t);let h=this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[];for(let f of h)ut(a,f,this._oneTimeListeners),f.call(this,t);let d=this._eventedParent;d&&(He(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),d.fire(t))}else t instanceof di&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,r){return this._eventedParent=t,this._eventedParentData=r,this}}var oe={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},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:{},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_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"}},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:"enum",default:"mercator",values:{mercator:{},globe:{}}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","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:"number",default:335,minimum:0,maximum:359,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:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",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"}},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"}}};let Xi=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function kr(i,t){let r={};for(let a in i)a!=="ref"&&(r[a]=i[a]);return Xi.forEach(a=>{a in t&&(r[a]=t[a])}),r}function Et(i,t){if(Array.isArray(i)){if(!Array.isArray(t)||i.length!==t.length)return!1;for(let r=0;r`:i.itemType.kind==="value"?"array":`array<${t}>`}return i.kind}let R=[Pr,Ee,_t,at,Si,yr,Ji,k(st),on,Zr,j];function V(i,t){if(t.kind==="error")return null;if(i.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!V(i.itemType,t.itemType))&&(typeof i.N!="number"||i.N===t.N))return null}else{if(i.kind===t.kind)return null;if(i.kind==="value"){for(let r of R)if(!V(r,t))return null}}return`Expected ${I(i)} but found ${I(t)} instead.`}function Y(i,t){return t.some(r=>r.kind===i.kind)}function ee(i,t){return t.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}function re(i,t){return i.kind==="array"&&t.kind==="array"?i.itemType.kind===t.itemType.kind&&typeof i.N=="number":i.kind===t.kind}let H=.96422,he=.82521,me=4/29,le=6/29,Te=3*le*le,Je=le*le*le,tt=Math.PI/180,Lt=180/Math.PI;function dt(i){return(i%=360)<0&&(i+=360),i}function Rt([i,t,r,a]){let l,h,d=vi((.2225045*(i=Dt(i))+.7168786*(t=Dt(t))+.0606169*(r=Dt(r)))/1);i===t&&t===r?l=h=d:(l=vi((.4360747*i+.3850649*t+.1430804*r)/H),h=vi((.0139322*i+.0971045*t+.7141733*r)/he));let f=116*d-16;return[f<0?0:f,500*(l-d),200*(d-h),a]}function Dt(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function vi(i){return i>Je?Math.pow(i,1/3):i/Te+me}function hi([i,t,r,a]){let l=(i+16)/116,h=isNaN(t)?l:l+t/500,d=isNaN(r)?l:l-r/200;return l=1*$t(l),h=H*$t(h),d=he*$t(d),[wt(3.1338561*h-1.6168667*l-.4906146*d),wt(-.9787684*h+1.9161415*l+.033454*d),wt(.0719453*h-.2289914*l+1.4052427*d),a]}function wt(i){return(i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055)<0?0:i>1?1:i}function $t(i){return i>le?i*i*i:Te*(i-me)}function oi(i){return parseInt(i.padEnd(2,i),16)/255}function Ei(i,t){return Ii(t?i/100:i,0,1)}function Ii(i,t,r){return Math.min(Math.max(t,i),r)}function ji(i){return!i.some(Number.isNaN)}let qn={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]};class Zt{constructor(t,r,a,l=1,h=!0){this.r=t,this.g=r,this.b=a,this.a=l,h||(this.r*=l,this.g*=l,this.b*=l,l||this.overwriteGetter("rgb",[t,r,a,l]))}static parse(t){if(t instanceof Zt)return t;if(typeof t!="string")return;let r=function(a){if((a=a.toLowerCase().trim())==="transparent")return[0,0,0,0];let l=qn[a];if(l){let[d,f,g]=l;return[d/255,f/255,g/255,1]}if(a.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(a)){let d=a.length<6?1:2,f=1;return[oi(a.slice(f,f+=d)),oi(a.slice(f,f+=d)),oi(a.slice(f,f+=d)),oi(a.slice(f,f+d)||"ff")]}if(a.startsWith("rgb")){let d=a.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){let[f,g,v,x,A,D,M,z,B,q,$,ne]=d,J=[x||" ",M||" ",q].join("");if(J===" "||J===" /"||J===",,"||J===",,,"){let ie=[v,D,B].join(""),ce=ie==="%%%"?100:ie===""?255:0;if(ce){let _e=[Ii(+g/ce,0,1),Ii(+A/ce,0,1),Ii(+z/ce,0,1),$?Ei(+$,ne):1];if(ji(_e))return _e}}return}}let h=a.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(h){let[d,f,g,v,x,A,D,M,z]=h,B=[g||" ",x||" ",D].join("");if(B===" "||B===" /"||B===",,"||B===",,,"){let q=[+f,Ii(+v,0,100),Ii(+A,0,100),M?Ei(+M,z):1];if(ji(q))return function([$,ne,J,ie]){function ce(_e){let Re=(_e+$/30)%12,it=ne*Math.min(J,1-J);return J-it*Math.max(-1,Math.min(Re-3,9-Re,1))}return $=dt($),ne/=100,J/=100,[ce(0),ce(8),ce(4),ie]}(q)}}}(t);return r?new Zt(...r,!1):void 0}get rgb(){let{r:t,g:r,b:a,a:l}=this,h=l||1/0;return this.overwriteGetter("rgb",[t/h,r/h,a/h,l])}get hcl(){return this.overwriteGetter("hcl",function(t){let[r,a,l,h]=Rt(t),d=Math.sqrt(a*a+l*l);return[Math.round(1e4*d)?dt(Math.atan2(l,a)*Lt):NaN,d,r,h]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Rt(this.rgb))}overwriteGetter(t,r){return Object.defineProperty(this,t,{value:r}),r}toString(){let[t,r,a,l]=this.rgb;return`rgba(${[t,r,a].map(h=>Math.round(255*h)).join(",")},${l})`}}Zt.black=new Zt(0,0,0,1),Zt.white=new Zt(1,1,1,1),Zt.transparent=new Zt(0,0,0,0),Zt.red=new Zt(1,0,0,1);class Ys{constructor(t,r,a){this.sensitivity=t?r?"variant":"case":r?"accent":"base",this.locale=a,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,r){return this.collator.compare(t,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Qs{constructor(t,r,a,l,h){this.text=t,this.image=r,this.scale=a,this.fontStack=l,this.textColor=h}}class ur{constructor(t){this.sections=t}static fromString(t){return new ur([new Qs(t,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(t=>t.text.length!==0||t.image&&t.image.name.length!==0)}static factory(t){return t instanceof ur?t:ur.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}}class cr{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof cr)return t;if(typeof t=="number")return new cr([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(let r of t)if(typeof r!="number")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new cr(t)}}toString(){return JSON.stringify(this.values)}}let zu=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class vr{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof vr)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let r=0;r=0&&i<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof r=="number"&&r>=0&&r<=255?a===void 0||typeof a=="number"&&a>=0&&a<=1?null:`Invalid rgba value [${[i,t,r,a].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof a=="number"?[i,t,r,a]:[i,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function vn(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof Zt||i instanceof Ys||i instanceof ur||i instanceof cr||i instanceof vr||i instanceof hr)return!0;if(Array.isArray(i)){for(let t of i)if(!vn(t))return!1;return!0}if(typeof i=="object"){for(let t in i)if(!vn(i[t]))return!1;return!0}return!1}function xi(i){if(i===null)return Pr;if(typeof i=="string")return _t;if(typeof i=="boolean")return at;if(typeof i=="number")return Ee;if(i instanceof Zt)return Si;if(i instanceof Ys)return Ki;if(i instanceof ur)return yr;if(i instanceof cr)return on;if(i instanceof vr)return j;if(i instanceof hr)return Zr;if(Array.isArray(i)){let t=i.length,r;for(let a of i){let l=xi(a);if(r){if(r===l)continue;r=st;break}r=l}return k(r||st,t)}return Ji}function wa(i){let t=typeof i;return i===null?"":t==="string"||t==="number"||t==="boolean"?String(i):i instanceof Zt||i instanceof ur||i instanceof cr||i instanceof vr||i instanceof hr?i.toString():JSON.stringify(i)}class zr{constructor(t,r){this.type=t,this.value=r}static parse(t,r){if(t.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!vn(t[1]))return r.error("invalid value");let a=t[1],l=xi(a),h=r.expectedType;return l.kind!=="array"||l.N!==0||!h||h.kind!=="array"||typeof h.N=="number"&&h.N!==0||(l=h),new zr(l,a)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class _i{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}let Wa={string:_t,number:Ee,boolean:at,object:Ji};class Br{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let a,l=1,h=t[0];if(h==="array"){let f,g;if(t.length>2){let v=t[1];if(typeof v!="string"||!(v in Wa)||v==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);f=Wa[v],l++}else f=st;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return r.error('The length argument to "array" must be a positive integer literal',2);g=t[2],l++}a=k(f,g)}else{if(!Wa[h])throw new Error(`Types doesn't contain name = ${h}`);a=Wa[h]}let d=[];for(;lt.outputDefined())}}let eo={"to-boolean":at,"to-color":Si,"to-number":Ee,"to-string":_t};class Lr{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let a=t[0];if(!eo[a])throw new Error(`Can't parse ${a} as it is not part of the known types`);if((a==="to-boolean"||a==="to-string")&&t.length!==2)return r.error("Expected one argument.");let l=eo[a],h=[];for(let d=1;d4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:Vn(r[0],r[1],r[2],r[3]),!a))return new Zt(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new _i(a||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(let a of this.args){r=a.evaluate(t);let l=cr.parse(r);if(l)return l}throw new _i(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(let a of this.args){r=a.evaluate(t);let l=vr.parse(r);if(l)return l}throw new _i(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(let a of this.args){if(r=a.evaluate(t),r===null)return 0;let l=Number(r);if(!isNaN(l))return l}throw new _i(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return ur.fromString(wa(this.args[0].evaluate(t)));case"resolvedImage":return hr.fromString(wa(this.args[0].evaluate(t)));default:return wa(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}let Bu=["Unknown","Point","LineString","Polygon"];class Ja{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},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"?Bu[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(t){let r=this._parseColorCache[t];return r||(r=this._parseColorCache[t]=Zt.parse(t)),r}}class xn{constructor(t,r,a=[],l,h=new lr,d=[]){this.registry=t,this.path=a,this.key=a.map(f=>`[${f}]`).join(""),this.scope=h,this.errors=d,this.expectedType=l,this._isConstant=r}parse(t,r,a,l,h={}){return r?this.concat(r,a,l)._parse(t,h):this._parse(t,h)}_parse(t,r){function a(l,h,d){return d==="assert"?new Br(h,[l]):d==="coerce"?new Lr(h,[l]):l}if(t!==null&&typeof t!="string"&&typeof t!="boolean"&&typeof t!="number"||(t=["literal",t]),Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let l=t[0];if(typeof l!="string")return this.error(`Expression name must be a string, but found ${typeof l} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let h=this.registry[l];if(h){let d=h.parse(t,this);if(!d)return null;if(this.expectedType){let f=this.expectedType,g=d.type;if(f.kind!=="string"&&f.kind!=="number"&&f.kind!=="boolean"&&f.kind!=="object"&&f.kind!=="array"||g.kind!=="value")if(f.kind!=="color"&&f.kind!=="formatted"&&f.kind!=="resolvedImage"||g.kind!=="value"&&g.kind!=="string")if(f.kind!=="padding"||g.kind!=="value"&&g.kind!=="number"&&g.kind!=="array")if(f.kind!=="variableAnchorOffsetCollection"||g.kind!=="value"&&g.kind!=="array"){if(this.checkSubtype(f,g))return null}else d=a(d,f,r.typeAnnotation||"coerce");else d=a(d,f,r.typeAnnotation||"coerce");else d=a(d,f,r.typeAnnotation||"coerce");else d=a(d,f,r.typeAnnotation||"assert")}if(!(d instanceof zr)&&d.type.kind!=="resolvedImage"&&this._isConstant(d)){let f=new Ja;try{d=new zr(d.type,d.evaluate(f))}catch(g){return this.error(g.message),null}}return d}return this.error(`Unknown expression "${l}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(t===void 0?"'undefined' value invalid. Use null instead.":typeof t=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,r,a){let l=typeof t=="number"?this.path.concat(t):this.path,h=a?this.scope.concat(a):this.scope;return new xn(this.registry,this._isConstant,l,r||null,h,this.errors)}error(t,...r){let a=`${this.key}${r.map(l=>`[${l}]`).join("")}`;this.errors.push(new Ai(a,t))}checkSubtype(t,r){let a=V(t,r);return a&&this.error(a),a}}class ln{constructor(t,r){this.type=r.type,this.bindings=[].concat(t),this.result=r}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(let r of this.bindings)t(r[1]);t(this.result)}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);let a=[];for(let h=1;h=a.length)throw new _i(`Array index out of bounds: ${r} > ${a.length-1}.`);if(r!==Math.floor(r))throw new _i(`Array index must be an integer, but found ${r} instead.`);return a[r]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class io{constructor(t,r){this.type=at,this.needle=t,this.haystack=r}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let a=r.parse(t[1],1,st),l=r.parse(t[2],2,st);return a&&l?Y(a.type,[at,_t,Ee,Pr,st])?new io(a,l):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${I(a.type)} instead`):null}evaluate(t){let r=this.needle.evaluate(t),a=this.haystack.evaluate(t);if(!a)return!1;if(!ee(r,["boolean","string","number","null"]))throw new _i(`Expected first argument to be of type boolean, string, number or null, but found ${I(xi(r))} instead.`);if(!ee(a,["string","array"]))throw new _i(`Expected second argument to be of type array or string, but found ${I(xi(a))} instead.`);return a.indexOf(r)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class Un{constructor(t,r,a){this.type=Ee,this.needle=t,this.haystack=r,this.fromIndex=a}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);let a=r.parse(t[1],1,st),l=r.parse(t[2],2,st);if(!a||!l)return null;if(!Y(a.type,[at,_t,Ee,Pr,st]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${I(a.type)} instead`);if(t.length===4){let h=r.parse(t[3],3,Ee);return h?new Un(a,l,h):null}return new Un(a,l)}evaluate(t){let r=this.needle.evaluate(t),a=this.haystack.evaluate(t);if(!ee(r,["boolean","string","number","null"]))throw new _i(`Expected first argument to be of type boolean, string, number or null, but found ${I(xi(r))} instead.`);let l;if(this.fromIndex&&(l=this.fromIndex.evaluate(t)),ee(a,["string"])){let h=a.indexOf(r,l);return h===-1?-1:[...a.slice(0,h)].length}if(ee(a,["array"]))return a.indexOf(r,l);throw new _i(`Expected second argument to be of type array or string, but found ${I(xi(a))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class ro{constructor(t,r,a,l,h,d){this.inputType=t,this.type=r,this.input=a,this.cases=l,this.outputs=h,this.otherwise=d}static parse(t,r){if(t.length<5)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return r.error("Expected an even number of arguments.");let a,l;r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);let h={},d=[];for(let v=2;vNumber.MAX_SAFE_INTEGER)return D.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof z=="number"&&Math.floor(z)!==z)return D.error("Numeric branch labels must be integer values.");if(a){if(D.checkSubtype(a,xi(z)))return null}else a=xi(z);if(h[String(z)]!==void 0)return D.error("Branch labels must be unique.");h[String(z)]=d.length}let M=r.parse(A,v,l);if(!M)return null;l=l||M.type,d.push(M)}let f=r.parse(t[1],1,st);if(!f)return null;let g=r.parse(t[t.length-1],t.length-1,l);return g?f.type.kind!=="value"&&r.concat(1).checkSubtype(a,f.type)?null:new ro(a,l,f,h,d,g):null}evaluate(t){let r=this.input.evaluate(t);return(xi(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}}class Ka{constructor(t,r,a){this.type=t,this.branches=r,this.otherwise=a}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return r.error("Expected an odd number of arguments.");let a;r.expectedType&&r.expectedType.kind!=="value"&&(a=r.expectedType);let l=[];for(let d=1;dr.outputDefined())&&this.otherwise.outputDefined()}}class Aa{constructor(t,r,a,l){this.type=t,this.input=r,this.beginIndex=a,this.endIndex=l}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);let a=r.parse(t[1],1,st),l=r.parse(t[2],2,Ee);if(!a||!l)return null;if(!Y(a.type,[k(st),_t,st]))return r.error(`Expected first argument to be of type array or string, but found ${I(a.type)} instead`);if(t.length===4){let h=r.parse(t[3],3,Ee);return h?new Aa(a.type,a,l,h):null}return new Aa(a.type,a,l)}evaluate(t){let r=this.input.evaluate(t),a=this.beginIndex.evaluate(t),l;if(this.endIndex&&(l=this.endIndex.evaluate(t)),ee(r,["string"]))return[...r].slice(a,l).join("");if(ee(r,["array"]))return r.slice(a,l);throw new _i(`Expected first argument to be of type array or string, but found ${I(xi(r))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function Ya(i,t){let r=i.length-1,a,l,h=0,d=r,f=0;for(;h<=d;)if(f=Math.floor((h+d)/2),a=i[f],l=i[f+1],a<=t){if(f===r||tt))throw new _i("Input is not a number.");d=f-1}return 0}class jn{constructor(t,r,a){this.type=t,this.input=r,this.labels=[],this.outputs=[];for(let[l,h]of a)this.labels.push(l),this.outputs.push(h)}static parse(t,r){if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");let a=r.parse(t[1],1,Ee);if(!a)return null;let l=[],h=null;r.expectedType&&r.expectedType.kind!=="value"&&(h=r.expectedType);for(let d=1;d=f)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',v);let A=r.parse(g,x,h);if(!A)return null;h=h||A.type,l.push([f,A])}return new jn(h,a,l)}evaluate(t){let r=this.labels,a=this.outputs;if(r.length===1)return a[0].evaluate(t);let l=this.input.evaluate(t);if(l<=r[0])return a[0].evaluate(t);let h=r.length;return l>=r[h-1]?a[h-1].evaluate(t):a[Ya(r,l)].evaluate(t)}eachChild(t){t(this.input);for(let r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function vl(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Lu=xl;function xl(i,t,r,a){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(a-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=t,this.p2x=r,this.p2y=a}xl.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,t){if(t===void 0&&(t=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,a=0;a<8;a++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)l?d=r:f=r,r=.5*(f-d)+d;return r},solve:function(i,t){return this.sampleCurveY(this.solveCurveX(i,t))}};var Ru=vl(Lu);function bn(i,t,r){return i+r*(t-i)}function Ea(i,t,r){return i.map((a,l)=>bn(a,t[l],r))}let Yi={number:bn,color:function(i,t,r,a="rgb"){switch(a){case"rgb":{let[l,h,d,f]=Ea(i.rgb,t.rgb,r);return new Zt(l,h,d,f,!1)}case"hcl":{let[l,h,d,f]=i.hcl,[g,v,x,A]=t.hcl,D,M;if(isNaN(l)||isNaN(g))isNaN(l)?isNaN(g)?D=NaN:(D=g,d!==1&&d!==0||(M=v)):(D=l,x!==1&&x!==0||(M=h));else{let ne=g-l;g>l&&ne>180?ne-=360:g180&&(ne+=360),D=l+r*ne}let[z,B,q,$]=function([ne,J,ie,ce]){return ne=isNaN(ne)?0:ne*tt,hi([ie,Math.cos(ne)*J,Math.sin(ne)*J,ce])}([D,M??bn(h,v,r),bn(d,x,r),bn(f,A,r)]);return new Zt(z,B,q,$,!1)}case"lab":{let[l,h,d,f]=hi(Ea(i.lab,t.lab,r));return new Zt(l,h,d,f,!1)}}},array:Ea,padding:function(i,t,r){return new cr(Ea(i.values,t.values,r))},variableAnchorOffsetCollection:function(i,t,r){let a=i.values,l=t.values;if(a.length!==l.length)throw new _i(`Cannot interpolate values of different length. from: ${i.toString()}, to: ${t.toString()}`);let h=[];for(let d=0;dtypeof x!="number"||x<0||x>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);l={name:"cubic-bezier",controlPoints:v}}}if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(h=r.parse(h,2,Ee),!h)return null;let f=[],g=null;a==="interpolate-hcl"||a==="interpolate-lab"?g=Si:r.expectedType&&r.expectedType.kind!=="value"&&(g=r.expectedType);for(let v=0;v=x)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',D);let z=r.parse(A,M,g);if(!z)return null;g=g||z.type,f.push([x,z])}return re(g,Ee)||re(g,Si)||re(g,on)||re(g,j)||re(g,k(Ee))?new Qi(g,a,l,h,f):r.error(`Type ${I(g)} is not interpolatable.`)}evaluate(t){let r=this.labels,a=this.outputs;if(r.length===1)return a[0].evaluate(t);let l=this.input.evaluate(t);if(l<=r[0])return a[0].evaluate(t);let h=r.length;if(l>=r[h-1])return a[h-1].evaluate(t);let d=Ya(r,l),f=Qi.interpolationFactor(this.interpolation,l,r[d],r[d+1]),g=a[d].evaluate(t),v=a[d+1].evaluate(t);switch(this.operator){case"interpolate":return Yi[this.type.kind](g,v,f);case"interpolate-hcl":return Yi.color(g,v,f,"hcl");case"interpolate-lab":return Yi.color(g,v,f,"lab")}}eachChild(t){t(this.input);for(let r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function Qa(i,t,r,a){let l=a-r,h=i-r;return l===0?0:t===1?h/l:(Math.pow(t,h)-1)/(Math.pow(t,l)-1)}class es{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expectected at least one argument.");let a=null,l=r.expectedType;l&&l.kind!=="value"&&(a=l);let h=[];for(let f of t.slice(1)){let g=r.parse(f,1+h.length,a,void 0,{typeAnnotation:"omit"});if(!g)return null;a=a||g.type,h.push(g)}if(!a)throw new Error("No output type");let d=l&&h.some(f=>V(l,f.type));return new es(d?st:a,h)}evaluate(t){let r,a=null,l=0;for(let h of this.args)if(l++,a=h.evaluate(t),a&&a instanceof hr&&!a.available&&(r||(r=a.name),a=null,l===this.args.length&&(a=r)),a!==null)break;return a}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function ts(i,t){return i==="=="||i==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function bl(i,t,r,a){return a.compare(t,r)===0}function $n(i,t,r){let a=i!=="=="&&i!=="!=";return class Yp{constructor(h,d,f){this.type=at,this.lhs=h,this.rhs=d,this.collator=f,this.hasUntypedArgument=h.type.kind==="value"||d.type.kind==="value"}static parse(h,d){if(h.length!==3&&h.length!==4)return d.error("Expected two or three arguments.");let f=h[0],g=d.parse(h[1],1,st);if(!g)return null;if(!ts(f,g.type))return d.concat(1).error(`"${f}" comparisons are not supported for type '${I(g.type)}'.`);let v=d.parse(h[2],2,st);if(!v)return null;if(!ts(f,v.type))return d.concat(2).error(`"${f}" comparisons are not supported for type '${I(v.type)}'.`);if(g.type.kind!==v.type.kind&&g.type.kind!=="value"&&v.type.kind!=="value")return d.error(`Cannot compare types '${I(g.type)}' and '${I(v.type)}'.`);a&&(g.type.kind==="value"&&v.type.kind!=="value"?g=new Br(v.type,[g]):g.type.kind!=="value"&&v.type.kind==="value"&&(v=new Br(g.type,[v])));let x=null;if(h.length===4){if(g.type.kind!=="string"&&v.type.kind!=="string"&&g.type.kind!=="value"&&v.type.kind!=="value")return d.error("Cannot use collator to compare non-string types.");if(x=d.parse(h[3],3,Ki),!x)return null}return new Yp(g,v,x)}evaluate(h){let d=this.lhs.evaluate(h),f=this.rhs.evaluate(h);if(a&&this.hasUntypedArgument){let g=xi(d),v=xi(f);if(g.kind!==v.kind||g.kind!=="string"&&g.kind!=="number")throw new _i(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${g.kind}, ${v.kind}) instead.`)}if(this.collator&&!a&&this.hasUntypedArgument){let g=xi(d),v=xi(f);if(g.kind!=="string"||v.kind!=="string")return t(h,d,f)}return this.collator?r(h,d,f,this.collator.evaluate(h)):t(h,d,f)}eachChild(h){h(this.lhs),h(this.rhs),this.collator&&h(this.collator)}outputDefined(){return!0}}}let Fu=$n("==",function(i,t,r){return t===r},bl),wl=$n("!=",function(i,t,r){return t!==r},function(i,t,r,a){return!bl(0,t,r,a)}),Al=$n("<",function(i,t,r){return t",function(i,t,r){return t>r},function(i,t,r,a){return a.compare(t,r)>0}),Nu=$n("<=",function(i,t,r){return t<=r},function(i,t,r,a){return a.compare(t,r)<=0}),El=$n(">=",function(i,t,r){return t>=r},function(i,t,r,a){return a.compare(t,r)>=0});class Ta{constructor(t,r,a){this.type=Ki,this.locale=a,this.caseSensitive=t,this.diacriticSensitive=r}static parse(t,r){if(t.length!==2)return r.error("Expected one argument.");let a=t[1];if(typeof a!="object"||Array.isArray(a))return r.error("Collator options argument must be an object.");let l=r.parse(a["case-sensitive"]!==void 0&&a["case-sensitive"],1,at);if(!l)return null;let h=r.parse(a["diacritic-sensitive"]!==void 0&&a["diacritic-sensitive"],1,at);if(!h)return null;let d=null;return a.locale&&(d=r.parse(a.locale,1,_t),!d)?null:new Ta(l,h,d)}evaluate(t){return new Ys(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}class no{constructor(t,r,a,l,h){this.type=_t,this.number=t,this.locale=r,this.currency=a,this.minFractionDigits=l,this.maxFractionDigits=h}static parse(t,r){if(t.length!==3)return r.error("Expected two arguments.");let a=r.parse(t[1],1,Ee);if(!a)return null;let l=t[2];if(typeof l!="object"||Array.isArray(l))return r.error("NumberFormat options argument must be an object.");let h=null;if(l.locale&&(h=r.parse(l.locale,1,_t),!h))return null;let d=null;if(l.currency&&(d=r.parse(l.currency,1,_t),!d))return null;let f=null;if(l["min-fraction-digits"]&&(f=r.parse(l["min-fraction-digits"],1,Ee),!f))return null;let g=null;return l["max-fraction-digits"]&&(g=r.parse(l["max-fraction-digits"],1,Ee),!g)?null:new no(a,h,d,f,g)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class is{constructor(t){this.type=yr,this.sections=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let a=t[1];if(!Array.isArray(a)&&typeof a=="object")return r.error("First argument must be an image or text section.");let l=[],h=!1;for(let d=1;d<=t.length-1;++d){let f=t[d];if(h&&typeof f=="object"&&!Array.isArray(f)){h=!1;let g=null;if(f["font-scale"]&&(g=r.parse(f["font-scale"],1,Ee),!g))return null;let v=null;if(f["text-font"]&&(v=r.parse(f["text-font"],1,k(_t)),!v))return null;let x=null;if(f["text-color"]&&(x=r.parse(f["text-color"],1,Si),!x))return null;let A=l[l.length-1];A.scale=g,A.font=v,A.textColor=x}else{let g=r.parse(t[d],1,st);if(!g)return null;let v=g.type.kind;if(v!=="string"&&v!=="value"&&v!=="null"&&v!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");h=!0,l.push({content:g,scale:null,font:null,textColor:null})}}return new is(l)}evaluate(t){return new ur(this.sections.map(r=>{let a=r.content.evaluate(t);return xi(a)===Zr?new Qs("",a,null,null,null):new Qs(wa(a),null,r.scale?r.scale.evaluate(t):null,r.font?r.font.evaluate(t).join(","):null,r.textColor?r.textColor.evaluate(t):null)}))}eachChild(t){for(let r of this.sections)t(r.content),r.scale&&t(r.scale),r.font&&t(r.font),r.textColor&&t(r.textColor)}outputDefined(){return!1}}class ao{constructor(t){this.type=Zr,this.input=t}static parse(t,r){if(t.length!==2)return r.error("Expected two arguments.");let a=r.parse(t[1],1,_t);return a?new ao(a):r.error("No image name provided.")}evaluate(t){let r=this.input.evaluate(t),a=hr.fromString(r);return a&&t.availableImages&&(a.available=t.availableImages.indexOf(r)>-1),a}eachChild(t){t(this.input)}outputDefined(){return!1}}class so{constructor(t){this.type=Ee,this.input=t}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);let a=r.parse(t[1],1);return a?a.type.kind!=="array"&&a.type.kind!=="string"&&a.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${I(a.type)} instead.`):new so(a):null}evaluate(t){let r=this.input.evaluate(t);if(typeof r=="string")return[...r].length;if(Array.isArray(r))return r.length;throw new _i(`Expected value to be of type string or array, but found ${I(xi(r))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}let Gr=8192;function qu(i,t){let r=(180+i[0])/360,a=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,l=Math.pow(2,t.z);return[Math.round(r*l*Gr),Math.round(a*l*Gr)]}function oo(i,t){let r=Math.pow(2,t.z);return[(l=(i[0]/Gr+t.x)/r,360*l-180),(a=(i[1]/Gr+t.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90)];var a,l}function wn(i,t){i[0]=Math.min(i[0],t[0]),i[1]=Math.min(i[1],t[1]),i[2]=Math.max(i[2],t[0]),i[3]=Math.max(i[3],t[1])}function un(i,t){return!(i[0]<=t[0]||i[2]>=t[2]||i[1]<=t[1]||i[3]>=t[3])}function qt(i,t,r){let a=i[0]-t[0],l=i[1]-t[1],h=i[0]-r[0],d=i[1]-r[1];return a*d-h*l==0&&a*h<=0&&l*d<=0}function rs(i,t,r,a){return(l=[a[0]-r[0],a[1]-r[1]])[0]*(h=[t[0]-i[0],t[1]-i[1]])[1]-l[1]*h[0]!=0&&!(!Cl(i,t,r,a)||!Cl(r,a,i,t));var l,h}function Vu(i,t,r){for(let a of r)for(let l=0;l(l=i)[1]!=(d=f[g+1])[1]>l[1]&&l[0]<(d[0]-h[0])*(l[1]-h[1])/(d[1]-h[1])+h[0]&&(a=!a)}var l,h,d;return a}function Uu(i,t){for(let r of t)if(Zn(i,r))return!0;return!1}function Tl(i,t){for(let r of i)if(!Zn(r,t))return!1;for(let r=0;r0&&f<0||d<0&&f>0}function lo(i,t,r){let a=[];for(let l=0;lr[2]){let l=.5*a,h=i[0]-r[0]>l?-a:r[0]-i[0]>l?a:0;h===0&&(h=i[0]-r[2]>l?-a:r[2]-i[0]>l?a:0),i[0]+=h}wn(t,i)}function Il(i,t,r,a){let l=Math.pow(2,a.z)*Gr,h=[a.x*Gr,a.y*Gr],d=[];for(let f of i)for(let g of f){let v=[g.x+h[0],g.y+h[1]];Sl(v,t,r,l),d.push(v)}return d}function kl(i,t,r,a){let l=Math.pow(2,a.z)*Gr,h=[a.x*Gr,a.y*Gr],d=[];for(let g of i){let v=[];for(let x of g){let A=[x.x+h[0],x.y+h[1]];wn(t,A),v.push(A)}d.push(v)}if(t[2]-t[0]<=l/2){(f=t)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(let g of d)for(let v of g)Sl(v,t,r,l)}var f;return d}class An{constructor(t,r){this.type=at,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(vn(t[1])){let a=t[1];if(a.type==="FeatureCollection"){let l=[];for(let h of a.features){let{type:d,coordinates:f}=h.geometry;d==="Polygon"&&l.push(f),d==="MultiPolygon"&&l.push(...f)}if(l.length)return new An(a,{type:"MultiPolygon",coordinates:l})}else if(a.type==="Feature"){let l=a.geometry.type;if(l==="Polygon"||l==="MultiPolygon")return new An(a,a.geometry)}else if(a.type==="Polygon"||a.type==="MultiPolygon")return new An(a,a)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(r,a){let l=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(a.type==="Polygon"){let f=lo(a.coordinates,h,d),g=Il(r.geometry(),l,h,d);if(!un(l,h))return!1;for(let v of g)if(!Zn(v,f))return!1}if(a.type==="MultiPolygon"){let f=Dl(a.coordinates,h,d),g=Il(r.geometry(),l,h,d);if(!un(l,h))return!1;for(let v of g)if(!Uu(v,f))return!1}return!0}(t,this.geometries);if(t.geometryType()==="LineString")return function(r,a){let l=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(a.type==="Polygon"){let f=lo(a.coordinates,h,d),g=kl(r.geometry(),l,h,d);if(!un(l,h))return!1;for(let v of g)if(!Tl(v,f))return!1}if(a.type==="MultiPolygon"){let f=Dl(a.coordinates,h,d),g=kl(r.geometry(),l,h,d);if(!un(l,h))return!1;for(let v of g)if(!ju(v,f))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Ml=class{constructor(i=[],t=(r,a)=>ra?1:0){if(this.data=i,this.length=this.data.length,this.compare=t,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(i){this.data.push(i),this._up(this.length++)}pop(){if(this.length===0)return;let i=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),i}peek(){return this.data[0]}_up(i){let{data:t,compare:r}=this,a=t[i];for(;i>0;){let l=i-1>>1,h=t[l];if(r(a,h)>=0)break;t[i]=h,i=l}t[i]=a}_down(i){let{data:t,compare:r}=this,a=this.length>>1,l=t[i];for(;i=0)break;t[i]=t[h],i=h}t[i]=l}};function $u(i,t,r,a,l){Pl(i,t,r,a||i.length-1,l||Zu)}function Pl(i,t,r,a,l){for(;a>r;){if(a-r>600){var h=a-r+1,d=t-r+1,f=Math.log(h),g=.5*Math.exp(2*f/3),v=.5*Math.sqrt(f*g*(h-g)/h)*(d-h/2<0?-1:1);Pl(i,t,Math.max(r,Math.floor(t-d*g/h+v)),Math.min(a,Math.floor(t+(h-d)*g/h+v)),l)}var x=i[t],A=r,D=a;for(Ca(i,r,t),l(i[a],x)>0&&Ca(i,r,a);A0;)D--}l(i[r],x)===0?Ca(i,r,D):Ca(i,++D,a),D<=t&&(r=D+1),t<=D&&(a=D-1)}}function Ca(i,t,r){var a=i[t];i[t]=i[r],i[r]=a}function Zu(i,t){return it?1:0}function ns(i,t){if(i.length<=1)return[i];let r=[],a,l;for(let h of i){let d=Hu(h);d!==0&&(h.area=Math.abs(d),l===void 0&&(l=d<0),l===d<0?(a&&r.push(a),a=[h]):a.push(h))}if(a&&r.push(a),t>1)for(let h=0;h1?(v=t[g+1][0],x=t[g+1][1]):M>0&&(v+=A/this.kx*M,x+=D/this.ky*M)),A=this.wrap(r[0]-v)*this.kx,D=(r[1]-x)*this.ky;let z=A*A+D*D;z180;)t-=360;return t}}function Rl(i,t){return t[0]-i[0]}function as(i){return i[1]-i[0]+1}function en(i,t){return i[1]>=i[0]&&i[1]i[1])return[null,null];let r=as(i);if(t){if(r===2)return[i,null];let l=Math.floor(r/2);return[[i[0],i[0]+l],[i[0]+l,i[1]]]}if(r===1)return[i,null];let a=Math.floor(r/2)-1;return[[i[0],i[0]+a],[i[0]+a+1,i[1]]]}function ho(i,t){if(!en(t,i.length))return[1/0,1/0,-1/0,-1/0];let r=[1/0,1/0,-1/0,-1/0];for(let a=t[0];a<=t[1];++a)wn(r,i[a]);return r}function po(i){let t=[1/0,1/0,-1/0,-1/0];for(let r of i)for(let a of r)wn(t,a);return t}function ss(i){return i[0]!==-1/0&&i[1]!==-1/0&&i[2]!==1/0&&i[3]!==1/0}function fo(i,t,r){if(!ss(i)||!ss(t))return NaN;let a=0,l=0;return i[2]t[2]&&(a=i[0]-t[2]),i[1]>t[3]&&(l=i[1]-t[3]),i[3]=a)return a;if(un(l,h)){if(os(i,t))return 0}else if(os(t,i))return 0;let d=1/0;for(let f of i)for(let g=0,v=f.length,x=v-1;g0;){let g=d.pop();if(g[0]>=h)continue;let v=g[1],x=t?50:100;if(as(v)<=x){if(!en(v,i.length))return NaN;if(t){let A=Tt(i,v,r,a);if(isNaN(A)||A===0)return A;h=Math.min(h,A)}else for(let A=v[0];A<=v[1];++A){let D=Wu(i[A],r,a);if(h=Math.min(h,D),h===0)return 0}}else{let A=co(v,t);Ht(d,h,a,i,f,A[0]),Ht(d,h,a,i,f,A[1])}}return h}function Sa(i,t,r,a,l,h=1/0){let d=Math.min(h,l.distance(i[0],r[0]));if(d===0)return d;let f=new Ml([[0,[0,i.length-1],[0,r.length-1]]],Rl);for(;f.length>0;){let g=f.pop();if(g[0]>=d)continue;let v=g[1],x=g[2],A=t?50:100,D=a?50:100;if(as(v)<=A&&as(x)<=D){if(!en(v,i.length)&&en(x,r.length))return NaN;let M;if(t&&a)M=Xu(i,v,r,x,l),d=Math.min(d,M);else if(t&&!a){let z=i.slice(v[0],v[1]+1);for(let B=x[0];B<=x[1];++B)if(M=En(r[B],z,l),d=Math.min(d,M),d===0)return d}else if(!t&&a){let z=r.slice(x[0],x[1]+1);for(let B=v[0];B<=v[1];++B)if(M=En(i[B],z,l),d=Math.min(d,M),d===0)return d}else M=fi(i,v,r,x,l),d=Math.min(d,M)}else{let M=co(v,t),z=co(x,a);Tn(f,d,l,i,r,M[0],z[0]),Tn(f,d,l,i,r,M[0],z[1]),Tn(f,d,l,i,r,M[1],z[0]),Tn(f,d,l,i,r,M[1],z[1])}}return d}function go(i){return i.type==="MultiPolygon"?i.coordinates.map(t=>({type:"Polygon",coordinates:t})):i.type==="MultiLineString"?i.coordinates.map(t=>({type:"LineString",coordinates:t})):i.type==="MultiPoint"?i.coordinates.map(t=>({type:"Point",coordinates:t})):[i]}class Cn{constructor(t,r){this.type=Ee,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(vn(t[1])){let a=t[1];if(a.type==="FeatureCollection")return new Cn(a,a.features.map(l=>go(l.geometry)).flat());if(a.type==="Feature")return new Cn(a,go(a.geometry));if("type"in a&&"coordinates"in a)return new Cn(a,go(a))}return r.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(r,a){let l=r.geometry(),h=l.flat().map(g=>oo([g.x,g.y],r.canonical));if(l.length===0)return NaN;let d=new uo(h[0][1]),f=1/0;for(let g of a){switch(g.type){case"Point":f=Math.min(f,Sa(h,!1,[g.coordinates],!1,d,f));break;case"LineString":f=Math.min(f,Sa(h,!1,g.coordinates,!0,d,f));break;case"Polygon":f=Math.min(f,Da(h,!1,g.coordinates,d,f))}if(f===0)return f}return f}(t,this.geometries);if(t.geometryType()==="LineString")return function(r,a){let l=r.geometry(),h=l.flat().map(g=>oo([g.x,g.y],r.canonical));if(l.length===0)return NaN;let d=new uo(h[0][1]),f=1/0;for(let g of a){switch(g.type){case"Point":f=Math.min(f,Sa(h,!0,[g.coordinates],!1,d,f));break;case"LineString":f=Math.min(f,Sa(h,!0,g.coordinates,!0,d,f));break;case"Polygon":f=Math.min(f,Da(h,!0,g.coordinates,d,f))}if(f===0)return f}return f}(t,this.geometries);if(t.geometryType()==="Polygon")return function(r,a){let l=r.geometry();if(l.length===0||l[0].length===0)return NaN;let h=ns(l,0).map(g=>g.map(v=>v.map(x=>oo([x.x,x.y],r.canonical)))),d=new uo(h[0][0][0][1]),f=1/0;for(let g of a)for(let v of h){switch(g.type){case"Point":f=Math.min(f,Da([g.coordinates],!1,v,d,f));break;case"LineString":f=Math.min(f,Da(g.coordinates,!0,v,d,f));break;case"Polygon":f=Math.min(f,Yt(v,g.coordinates,d,f))}if(f===0)return f}return f}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}let Gn={"==":Fu,"!=":wl,">":Ou,"<":Al,">=":El,"<=":Nu,array:Br,at:to,boolean:Br,case:Ka,coalesce:es,collator:Ta,format:is,image:ao,in:io,"index-of":Un,interpolate:Qi,"interpolate-hcl":Qi,"interpolate-lab":Qi,length:so,let:ln,literal:zr,match:ro,number:Br,"number-format":no,object:Br,slice:Aa,step:jn,string:Br,"to-boolean":Lr,"to-color":Lr,"to-number":Lr,"to-string":Lr,var:Nt,within:An,distance:Cn};class xr{constructor(t,r,a,l){this.name=t,this.type=r,this._evaluate=a,this.args=l}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,r){let a=t[0],l=xr.definitions[a];if(!l)return r.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0);let h=Array.isArray(l)?l[0]:l.type,d=Array.isArray(l)?[[l[1],l[2]]]:l.overloads,f=d.filter(([v])=>!Array.isArray(v)||v.length===t.length-1),g=null;for(let[v,x]of f){g=new xn(r.registry,Ia,r.path,null,r.scope);let A=[],D=!1;for(let M=1;M{return D=A,Array.isArray(D)?`(${D.map(I).join(", ")})`:`(${I(D.type)}...)`;var D}).join(" | "),x=[];for(let A=1;A{r=t?r&&Ia(a):r&&a instanceof zr}),!!r&&ka(i)&&Ma(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function ka(i){if(i instanceof xr&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||/^filter-/.test(i.name))||i instanceof An||i instanceof Cn)return!1;let t=!0;return i.eachChild(r=>{t&&!ka(r)&&(t=!1)}),t}function Hn(i){if(i instanceof xr&&i.name==="feature-state")return!1;let t=!0;return i.eachChild(r=>{t&&!Hn(r)&&(t=!1)}),t}function Ma(i,t){if(i instanceof xr&&t.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(a=>{r&&!Ma(a,t)&&(r=!1)}),r}function ls(i){return{result:"success",value:i}}function Xn(i){return{result:"error",value:i}}function Wn(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function Fl(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function xo(i){return!!i.expression&&i.expression.interpolated}function Ft(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function us(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Ju(i){return i}function Ol(i,t){let r=t.type==="color",a=i.stops&&typeof i.stops[0][0]=="object",l=a||!(a||i.property!==void 0),h=i.type||(xo(t)?"exponential":"interval");if(r||t.type==="padding"){let x=r?Zt.parse:cr.parse;(i=or({},i)).stops&&(i.stops=i.stops.map(A=>[A[0],x(A[1])])),i.default=x(i.default?i.default:t.default)}if(i.colorSpace&&(d=i.colorSpace)!=="rgb"&&d!=="hcl"&&d!=="lab")throw new Error(`Unknown color space: "${i.colorSpace}"`);var d;let f,g,v;if(h==="exponential")f=ql;else if(h==="interval")f=cs;else if(h==="categorical"){f=Nl,g=Object.create(null);for(let x of i.stops)g[x[0]]=x[1];v=typeof i.stops[0][0]}else{if(h!=="identity")throw new Error(`Unknown function type "${h}"`);f=Vl}if(a){let x={},A=[];for(let z=0;zz[0]),evaluate:({zoom:z},B)=>ql({stops:D,base:i.base},t,z).evaluate(z,B)}}if(l){let x=h==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:x,interpolationFactor:Qi.interpolationFactor.bind(void 0,x),zoomStops:i.stops.map(A=>A[0]),evaluate:({zoom:A})=>f(i,t,A,g,v)}}return{kind:"source",evaluate(x,A){let D=A&&A.properties?A.properties[i.property]:void 0;return D===void 0?Jn(i.default,t.default):f(i,t,D,g,v)}}}function Jn(i,t,r){return i!==void 0?i:t!==void 0?t:r!==void 0?r:void 0}function Nl(i,t,r,a,l){return Jn(typeof r===l?a[r]:void 0,i.default,t.default)}function cs(i,t,r){if(Ft(r)!=="number")return Jn(i.default,t.default);let a=i.stops.length;if(a===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[a-1][0])return i.stops[a-1][1];let l=Ya(i.stops.map(h=>h[0]),r);return i.stops[l][1]}function ql(i,t,r){let a=i.base!==void 0?i.base:1;if(Ft(r)!=="number")return Jn(i.default,t.default);let l=i.stops.length;if(l===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[l-1][0])return i.stops[l-1][1];let h=Ya(i.stops.map(x=>x[0]),r),d=function(x,A,D,M){let z=M-D,B=x-D;return z===0?0:A===1?B/z:(Math.pow(A,B)-1)/(Math.pow(A,z)-1)}(r,a,i.stops[h][0],i.stops[h+1][0]),f=i.stops[h][1],g=i.stops[h+1][1],v=Yi[t.type]||Ju;return typeof f.evaluate=="function"?{evaluate(...x){let A=f.evaluate.apply(void 0,x),D=g.evaluate.apply(void 0,x);if(A!==void 0&&D!==void 0)return v(A,D,d,i.colorSpace)}}:v(f,g,d,i.colorSpace)}function Vl(i,t,r){switch(t.type){case"color":r=Zt.parse(r);break;case"formatted":r=ur.fromString(r.toString());break;case"resolvedImage":r=hr.fromString(r.toString());break;case"padding":r=cr.parse(r);break;default:Ft(r)===t.type||t.type==="enum"&&t.values[r]||(r=void 0)}return Jn(r,i.default,t.default)}xr.register(Gn,{error:[{kind:"error"},[_t],(i,[t])=>{throw new _i(t.evaluate(i))}],typeof:[_t,[st],(i,[t])=>I(xi(t.evaluate(i)))],"to-rgba":[k(Ee,4),[Si],(i,[t])=>{let[r,a,l,h]=t.evaluate(i).rgb;return[255*r,255*a,255*l,h]}],rgb:[Si,[Ee,Ee,Ee],_o],rgba:[Si,[Ee,Ee,Ee,Ee],_o],has:{type:at,overloads:[[[_t],(i,[t])=>yo(t.evaluate(i),i.properties())],[[_t,Ji],(i,[t,r])=>yo(t.evaluate(i),r.evaluate(i))]]},get:{type:st,overloads:[[[_t],(i,[t])=>vo(t.evaluate(i),i.properties())],[[_t,Ji],(i,[t,r])=>vo(t.evaluate(i),r.evaluate(i))]]},"feature-state":[st,[_t],(i,[t])=>vo(t.evaluate(i),i.featureState||{})],properties:[Ji,[],i=>i.properties()],"geometry-type":[_t,[],i=>i.geometryType()],id:[st,[],i=>i.id()],zoom:[Ee,[],i=>i.globals.zoom],"heatmap-density":[Ee,[],i=>i.globals.heatmapDensity||0],"line-progress":[Ee,[],i=>i.globals.lineProgress||0],accumulated:[st,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Ee,Dn(Ee),(i,t)=>{let r=0;for(let a of t)r+=a.evaluate(i);return r}],"*":[Ee,Dn(Ee),(i,t)=>{let r=1;for(let a of t)r*=a.evaluate(i);return r}],"-":{type:Ee,overloads:[[[Ee,Ee],(i,[t,r])=>t.evaluate(i)-r.evaluate(i)],[[Ee],(i,[t])=>-t.evaluate(i)]]},"/":[Ee,[Ee,Ee],(i,[t,r])=>t.evaluate(i)/r.evaluate(i)],"%":[Ee,[Ee,Ee],(i,[t,r])=>t.evaluate(i)%r.evaluate(i)],ln2:[Ee,[],()=>Math.LN2],pi:[Ee,[],()=>Math.PI],e:[Ee,[],()=>Math.E],"^":[Ee,[Ee,Ee],(i,[t,r])=>Math.pow(t.evaluate(i),r.evaluate(i))],sqrt:[Ee,[Ee],(i,[t])=>Math.sqrt(t.evaluate(i))],log10:[Ee,[Ee],(i,[t])=>Math.log(t.evaluate(i))/Math.LN10],ln:[Ee,[Ee],(i,[t])=>Math.log(t.evaluate(i))],log2:[Ee,[Ee],(i,[t])=>Math.log(t.evaluate(i))/Math.LN2],sin:[Ee,[Ee],(i,[t])=>Math.sin(t.evaluate(i))],cos:[Ee,[Ee],(i,[t])=>Math.cos(t.evaluate(i))],tan:[Ee,[Ee],(i,[t])=>Math.tan(t.evaluate(i))],asin:[Ee,[Ee],(i,[t])=>Math.asin(t.evaluate(i))],acos:[Ee,[Ee],(i,[t])=>Math.acos(t.evaluate(i))],atan:[Ee,[Ee],(i,[t])=>Math.atan(t.evaluate(i))],min:[Ee,Dn(Ee),(i,t)=>Math.min(...t.map(r=>r.evaluate(i)))],max:[Ee,Dn(Ee),(i,t)=>Math.max(...t.map(r=>r.evaluate(i)))],abs:[Ee,[Ee],(i,[t])=>Math.abs(t.evaluate(i))],round:[Ee,[Ee],(i,[t])=>{let r=t.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[Ee,[Ee],(i,[t])=>Math.floor(t.evaluate(i))],ceil:[Ee,[Ee],(i,[t])=>Math.ceil(t.evaluate(i))],"filter-==":[at,[_t,st],(i,[t,r])=>i.properties()[t.value]===r.value],"filter-id-==":[at,[st],(i,[t])=>i.id()===t.value],"filter-type-==":[at,[_t],(i,[t])=>i.geometryType()===t.value],"filter-<":[at,[_t,st],(i,[t,r])=>{let a=i.properties()[t.value],l=r.value;return typeof a==typeof l&&a{let r=i.id(),a=t.value;return typeof r==typeof a&&r":[at,[_t,st],(i,[t,r])=>{let a=i.properties()[t.value],l=r.value;return typeof a==typeof l&&a>l}],"filter-id->":[at,[st],(i,[t])=>{let r=i.id(),a=t.value;return typeof r==typeof a&&r>a}],"filter-<=":[at,[_t,st],(i,[t,r])=>{let a=i.properties()[t.value],l=r.value;return typeof a==typeof l&&a<=l}],"filter-id-<=":[at,[st],(i,[t])=>{let r=i.id(),a=t.value;return typeof r==typeof a&&r<=a}],"filter->=":[at,[_t,st],(i,[t,r])=>{let a=i.properties()[t.value],l=r.value;return typeof a==typeof l&&a>=l}],"filter-id->=":[at,[st],(i,[t])=>{let r=i.id(),a=t.value;return typeof r==typeof a&&r>=a}],"filter-has":[at,[st],(i,[t])=>t.value in i.properties()],"filter-has-id":[at,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[at,[k(_t)],(i,[t])=>t.value.indexOf(i.geometryType())>=0],"filter-id-in":[at,[k(st)],(i,[t])=>t.value.indexOf(i.id())>=0],"filter-in-small":[at,[_t,k(st)],(i,[t,r])=>r.value.indexOf(i.properties()[t.value])>=0],"filter-in-large":[at,[_t,k(st)],(i,[t,r])=>function(a,l,h,d){for(;h<=d;){let f=h+d>>1;if(l[f]===a)return!0;l[f]>a?d=f-1:h=f+1}return!1}(i.properties()[t.value],r.value,0,r.value.length-1)],all:{type:at,overloads:[[[at,at],(i,[t,r])=>t.evaluate(i)&&r.evaluate(i)],[Dn(at),(i,t)=>{for(let r of t)if(!r.evaluate(i))return!1;return!0}]]},any:{type:at,overloads:[[[at,at],(i,[t,r])=>t.evaluate(i)||r.evaluate(i)],[Dn(at),(i,t)=>{for(let r of t)if(r.evaluate(i))return!0;return!1}]]},"!":[at,[at],(i,[t])=>!t.evaluate(i)],"is-supported-script":[at,[_t],(i,[t])=>{let r=i.globals&&i.globals.isSupportedScript;return!r||r(t.evaluate(i))}],upcase:[_t,[_t],(i,[t])=>t.evaluate(i).toUpperCase()],downcase:[_t,[_t],(i,[t])=>t.evaluate(i).toLowerCase()],concat:[_t,Dn(st),(i,t)=>t.map(r=>wa(r.evaluate(i))).join("")],"resolved-locale":[_t,[Ki],(i,[t])=>t.evaluate(i).resolvedLocale()]});class hs{constructor(t,r){var a;this.expression=t,this._warningHistory={},this._evaluator=new Ja,this._defaultValue=r?(a=r).type==="color"&&us(a.default)?new Zt(0,0,0,0):a.type==="color"?Zt.parse(a.default)||null:a.type==="padding"?cr.parse(a.default)||null:a.type==="variableAnchorOffsetCollection"?vr.parse(a.default)||null:a.default===void 0?null:a.default:null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(t,r,a,l,h,d){return this._evaluator.globals=t,this._evaluator.feature=r,this._evaluator.featureState=a,this._evaluator.canonical=l,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=d,this.expression.evaluate(this._evaluator)}evaluate(t,r,a,l,h,d){this._evaluator.globals=t,this._evaluator.feature=r||null,this._evaluator.featureState=a||null,this._evaluator.canonical=l,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=d||null;try{let f=this.expression.evaluate(this._evaluator);if(f==null||typeof f=="number"&&f!=f)return this._defaultValue;if(this._enumValues&&!(f in this._enumValues))throw new _i(`Expected value to be one of ${Object.keys(this._enumValues).map(g=>JSON.stringify(g)).join(", ")}, but found ${JSON.stringify(f)} instead.`);return f}catch(f){return this._warningHistory[f.message]||(this._warningHistory[f.message]=!0,typeof console<"u"&&console.warn(f.message)),this._defaultValue}}}function ps(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in Gn}function Kn(i,t){let r=new xn(Gn,Ia,[],t?function(l){let h={color:Si,string:_t,number:Ee,enum:_t,boolean:at,formatted:yr,padding:on,resolvedImage:Zr,variableAnchorOffsetCollection:j};return l.type==="array"?k(h[l.value]||st,l.length):h[l.type]}(t):void 0),a=r.parse(i,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return a?ls(new hs(a,t)):Xn(r.errors)}class Yn{constructor(t,r){this.kind=t,this._styleExpression=r,this.isStateDependent=t!=="constant"&&!Hn(r.expression)}evaluateWithoutErrorHandling(t,r,a,l,h,d){return this._styleExpression.evaluateWithoutErrorHandling(t,r,a,l,h,d)}evaluate(t,r,a,l,h,d){return this._styleExpression.evaluate(t,r,a,l,h,d)}}class Qn{constructor(t,r,a,l){this.kind=t,this.zoomStops=a,this._styleExpression=r,this.isStateDependent=t!=="camera"&&!Hn(r.expression),this.interpolationType=l}evaluateWithoutErrorHandling(t,r,a,l,h,d){return this._styleExpression.evaluateWithoutErrorHandling(t,r,a,l,h,d)}evaluate(t,r,a,l,h,d){return this._styleExpression.evaluate(t,r,a,l,h,d)}interpolationFactor(t,r,a){return this.interpolationType?Qi.interpolationFactor(this.interpolationType,t,r,a):0}}function bo(i,t){let r=Kn(i,t);if(r.result==="error")return r;let a=r.value.expression,l=ka(a);if(!l&&!Wn(t))return Xn([new Ai("","data expressions not supported")]);let h=Ma(a,["zoom"]);if(!h&&!Fl(t))return Xn([new Ai("","zoom expressions not supported")]);let d=Pa(a);return d||h?d instanceof Ai?Xn([d]):d instanceof Qi&&!xo(t)?Xn([new Ai("",'"interpolate" expressions cannot be used with this property')]):ls(d?new Qn(l?"camera":"composite",r.value,d.labels,d instanceof Qi?d.interpolation:void 0):new Yn(l?"constant":"source",r.value)):Xn([new Ai("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class ea{constructor(t,r){this._parameters=t,this._specification=r,or(this,Ol(this._parameters,this._specification))}static deserialize(t){return new ea(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Pa(i){let t=null;if(i instanceof ln)t=Pa(i.result);else if(i instanceof es){for(let r of i.args)if(t=Pa(r),t)break}else(i instanceof jn||i instanceof Qi)&&i.input instanceof xr&&i.input.name==="zoom"&&(t=i);return t instanceof Ai||i.eachChild(r=>{let a=Pa(r);a instanceof Ai?t=a:!t&&a?t=new Ai("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&a&&t!==a&&(t=new Ai("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function ds(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(let t of i.slice(1))if(!ds(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}let fs={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function wo(i){if(i==null)return{filter:()=>!0,needGeometry:!1};ds(i)||(i=ms(i));let t=Kn(i,fs);if(t.result==="error")throw new Error(t.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,a,l)=>t.value.evaluate(r,a,{},l),needGeometry:Ul(i)}}function Ku(i,t){return it?1:0}function Ul(i){if(!Array.isArray(i))return!1;if(i[0]==="within"||i[0]==="distance")return!0;for(let t=1;t"||t==="<="||t===">="?Ao(i[1],i[2],t):t==="any"?(r=i.slice(1),["any"].concat(r.map(ms))):t==="all"?["all"].concat(i.slice(1).map(ms)):t==="none"?["all"].concat(i.slice(1).map(ms).map(Pi)):t==="in"?za(i[1],i.slice(2)):t==="!in"?Pi(za(i[1],i.slice(2))):t==="has"?Ba(i[1]):t!=="!has"||Pi(Ba(i[1]));var r}function Ao(i,t,r){switch(i){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,i,t]}}function za(i,t){if(t.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(r=>typeof r!=typeof t[0])?["filter-in-large",i,["literal",t.sort(Ku)]]:["filter-in-small",i,["literal",t]]}}function Ba(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Pi(i){return["!",i]}function Sn(i){let t=typeof i;if(t==="number"||t==="boolean"||t==="string"||i==null)return JSON.stringify(i);if(Array.isArray(i)){let l="[";for(let h of i)l+=`${Sn(h)},`;return`${l}]`}let r=Object.keys(i).sort(),a="{";for(let l=0;la.maximum?[new Ae(t,r,`${r} is greater than the maximum value ${a.maximum}`)]:[]}function gs(i){let t=i.valueSpec,r=mi(i.value.type),a,l,h,d={},f=r!=="categorical"&&i.value.property===void 0,g=!f,v=Ft(i.value.stops)==="array"&&Ft(i.value.stops[0])==="array"&&Ft(i.value.stops[0][0])==="object",x=pr({key:i.key,value:i.value,valueSpec:i.styleSpec.function,validateSpec:i.validateSpec,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(M){if(r==="identity")return[new Ae(M.key,M.value,'identity function may not have a "stops" property')];let z=[],B=M.value;return z=z.concat(La({key:M.key,value:B,valueSpec:M.valueSpec,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec,arrayElementValidator:A})),Ft(B)==="array"&&B.length===0&&z.push(new Ae(M.key,B,"array must have at least one stop")),z},default:function(M){return M.validateSpec({key:M.key,value:M.value,valueSpec:t,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec})}}});return r==="identity"&&f&&x.push(new Ae(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||x.push(new Ae(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!xo(i.valueSpec)&&x.push(new Ae(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(g&&!Wn(i.valueSpec)?x.push(new Ae(i.key,i.value,"property functions not supported")):f&&!Fl(i.valueSpec)&&x.push(new Ae(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!v||i.value.property!==void 0||x.push(new Ae(i.key,i.value,'"property" property is required')),x;function A(M){let z=[],B=M.value,q=M.key;if(Ft(B)!=="array")return[new Ae(q,B,`array expected, ${Ft(B)} found`)];if(B.length!==2)return[new Ae(q,B,`array length 2 expected, length ${B.length} found`)];if(v){if(Ft(B[0])!=="object")return[new Ae(q,B,`object expected, ${Ft(B[0])} found`)];if(B[0].zoom===void 0)return[new Ae(q,B,"object stop key must have zoom")];if(B[0].value===void 0)return[new Ae(q,B,"object stop key must have value")];if(h&&h>mi(B[0].zoom))return[new Ae(q,B[0].zoom,"stop zoom values must appear in ascending order")];mi(B[0].zoom)!==h&&(h=mi(B[0].zoom),l=void 0,d={}),z=z.concat(pr({key:`${q}[0]`,value:B[0],valueSpec:{zoom:{}},validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec,objectElementValidators:{zoom:Eo,value:D}}))}else z=z.concat(D({key:`${q}[0]`,value:B[0],valueSpec:{},validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec},B));return ps(Rr(B[1]))?z.concat([new Ae(`${q}[1]`,B[1],"expressions are not allowed in function stops.")]):z.concat(M.validateSpec({key:`${q}[1]`,value:B[1],valueSpec:t,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec}))}function D(M,z){let B=Ft(M.value),q=mi(M.value),$=M.value!==null?M.value:z;if(a){if(B!==a)return[new Ae(M.key,$,`${B} stop domain type must match previous stop domain type ${a}`)]}else a=B;if(B!=="number"&&B!=="string"&&B!=="boolean")return[new Ae(M.key,$,"stop domain value must be a number, string, or boolean")];if(B!=="number"&&r!=="categorical"){let ne=`number expected, ${B} found`;return Wn(t)&&r===void 0&&(ne+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ae(M.key,$,ne)]}return r!=="categorical"||B!=="number"||isFinite(q)&&Math.floor(q)===q?r!=="categorical"&&B==="number"&&l!==void 0&&qnew Ae(`${i.key}${a.key}`,i.value,a.message));let r=t.value.expression||t.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new Ae(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!Hn(r))return[new Ae(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!Hn(r))return[new Ae(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!Ma(r,["zoom","feature-state"]))return[new Ae(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!ka(r))return[new Ae(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function tn(i){let t=i.key,r=i.value,a=i.valueSpec,l=[];return Array.isArray(a.values)?a.values.indexOf(mi(r))===-1&&l.push(new Ae(t,r,`expected one of [${a.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(a.values).indexOf(mi(r))===-1&&l.push(new Ae(t,r,`expected one of [${Object.keys(a.values).join(", ")}], ${JSON.stringify(r)} found`)),l}function To(i){return ds(Rr(i.value))?ta(or({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):_s(i)}function _s(i){let t=i.value,r=i.key;if(Ft(t)!=="array")return[new Ae(r,t,`array expected, ${Ft(t)} found`)];let a=i.styleSpec,l,h=[];if(t.length<1)return[new Ae(r,t,"filter array must have at least 1 element")];switch(h=h.concat(tn({key:`${r}[0]`,value:t[0],valueSpec:a.filter_operator,style:i.style,styleSpec:i.styleSpec})),mi(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&mi(t[1])==="$type"&&h.push(new Ae(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&h.push(new Ae(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(l=Ft(t[1]),l!=="string"&&h.push(new Ae(`${r}[1]`,t[1],`string expected, ${l} found`)));for(let d=2;d{v in r&&t.push(new Ae(a,r[v],`"${v}" is prohibited for ref layers`))}),l.layers.forEach(v=>{mi(v.id)===f&&(g=v)}),g?g.ref?t.push(new Ae(a,r.ref,"ref cannot reference another ref layer")):d=mi(g.type):t.push(new Ae(a,r.ref,`ref layer "${f}" not found`))}else if(d!=="background")if(r.source){let g=l.sources&&l.sources[r.source],v=g&&mi(g.type);g?v==="vector"&&d==="raster"?t.push(new Ae(a,r.source,`layer "${r.id}" requires a raster source`)):v!=="raster-dem"&&d==="hillshade"?t.push(new Ae(a,r.source,`layer "${r.id}" requires a raster-dem source`)):v==="raster"&&d!=="raster"?t.push(new Ae(a,r.source,`layer "${r.id}" requires a vector source`)):v!=="vector"||r["source-layer"]?v==="raster-dem"&&d!=="hillshade"?t.push(new Ae(a,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):d!=="line"||!r.paint||!r.paint["line-gradient"]||v==="geojson"&&g.lineMetrics||t.push(new Ae(a,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new Ae(a,r,`layer "${r.id}" must specify a "source-layer"`)):t.push(new Ae(a,r.source,`source "${r.source}" not found`))}else t.push(new Ae(a,r,'missing required property "source"'));return t=t.concat(pr({key:a,value:r,valueSpec:h.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${a}.type`,value:r.type,valueSpec:h.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:r,objectKey:"type"}),filter:To,layout:g=>pr({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":v=>Do(or({layerType:d},v))}}),paint:g=>pr({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":v=>ys(or({layerType:d},v))}})}})),t}function In(i){let t=i.value,r=i.key,a=Ft(t);return a!=="string"?[new Ae(r,t,`string expected, ${a} found`)]:[]}let vs={promoteId:function({key:i,value:t}){if(Ft(t)==="string")return In({key:i,value:t});{let r=[];for(let a in t)r.push(...In({key:`${i}.${a}`,value:t[a]}));return r}}};function Ra(i){let t=i.value,r=i.key,a=i.styleSpec,l=i.style,h=i.validateSpec;if(!t.type)return[new Ae(r,t,'"type" is required')];let d=mi(t.type),f;switch(d){case"vector":case"raster":return f=pr({key:r,value:t,valueSpec:a[`source_${d.replace("-","_")}`],style:i.style,styleSpec:a,objectElementValidators:vs,validateSpec:h}),f;case"raster-dem":return f=function(g){var v;let x=(v=g.sourceName)!==null&&v!==void 0?v:"",A=g.value,D=g.styleSpec,M=D.source_raster_dem,z=g.style,B=[],q=Ft(A);if(A===void 0)return B;if(q!=="object")return B.push(new Ae("source_raster_dem",A,`object expected, ${q} found`)),B;let $=mi(A.encoding)==="custom",ne=["redFactor","greenFactor","blueFactor","baseShift"],J=g.value.encoding?`"${g.value.encoding}"`:"Default";for(let ie in A)!$&&ne.includes(ie)?B.push(new Ae(ie,A[ie],`In "${x}": "${ie}" is only valid when "encoding" is set to "custom". ${J} encoding found`)):M[ie]?B=B.concat(g.validateSpec({key:ie,value:A[ie],valueSpec:M[ie],validateSpec:g.validateSpec,style:z,styleSpec:D})):B.push(new Ae(ie,A[ie],`unknown property "${ie}"`));return B}({sourceName:r,value:t,style:i.style,styleSpec:a,validateSpec:h}),f;case"geojson":if(f=pr({key:r,value:t,valueSpec:a.source_geojson,style:l,styleSpec:a,validateSpec:h,objectElementValidators:vs}),t.cluster)for(let g in t.clusterProperties){let[v,x]=t.clusterProperties[g],A=typeof v=="string"?[v,["accumulated"],["get",g]]:v;f.push(...ta({key:`${r}.${g}.map`,value:x,validateSpec:h,expressionContext:"cluster-map"})),f.push(...ta({key:`${r}.${g}.reduce`,value:A,validateSpec:h,expressionContext:"cluster-reduce"}))}return f;case"video":return pr({key:r,value:t,valueSpec:a.source_video,style:l,validateSpec:h,styleSpec:a});case"image":return pr({key:r,value:t,valueSpec:a.source_image,style:l,validateSpec:h,styleSpec:a});case"canvas":return[new Ae(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return tn({key:`${r}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:l,validateSpec:h,styleSpec:a})}}function Io(i){let t=i.value,r=i.styleSpec,a=r.light,l=i.style,h=[],d=Ft(t);if(t===void 0)return h;if(d!=="object")return h=h.concat([new Ae("light",t,`object expected, ${d} found`)]),h;for(let f in t){let g=f.match(/^(.*)-transition$/);h=h.concat(g&&a[g[1]]&&a[g[1]].transition?i.validateSpec({key:f,value:t[f],valueSpec:r.transition,validateSpec:i.validateSpec,style:l,styleSpec:r}):a[f]?i.validateSpec({key:f,value:t[f],valueSpec:a[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new Ae(f,t[f],`unknown property "${f}"`)])}return h}function ko(i){let t=i.value,r=i.styleSpec,a=r.sky,l=i.style,h=Ft(t);if(t===void 0)return[];if(h!=="object")return[new Ae("sky",t,`object expected, ${h} found`)];let d=[];for(let f in t)d=d.concat(a[f]?i.validateSpec({key:f,value:t[f],valueSpec:a[f],style:l,styleSpec:r}):[new Ae(f,t[f],`unknown property "${f}"`)]);return d}function Mo(i){let t=i.value,r=i.styleSpec,a=r.terrain,l=i.style,h=[],d=Ft(t);if(t===void 0)return h;if(d!=="object")return h=h.concat([new Ae("terrain",t,`object expected, ${d} found`)]),h;for(let f in t)h=h.concat(a[f]?i.validateSpec({key:f,value:t[f],valueSpec:a[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new Ae(f,t[f],`unknown property "${f}"`)]);return h}function Po(i){let t=[],r=i.value,a=i.key;if(Array.isArray(r)){let l=[],h=[];for(let d in r)r[d].id&&l.includes(r[d].id)&&t.push(new Ae(a,r,`all the sprites' ids must be unique, but ${r[d].id} is duplicated`)),l.push(r[d].id),r[d].url&&h.includes(r[d].url)&&t.push(new Ae(a,r,`all the sprites' URLs must be unique, but ${r[d].url} is duplicated`)),h.push(r[d].url),t=t.concat(pr({key:`${a}[${d}]`,value:r[d],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return t}return In({key:a,value:r})}let xs={"*":()=>[],array:La,boolean:function(i){let t=i.value,r=i.key,a=Ft(t);return a!=="boolean"?[new Ae(r,t,`boolean expected, ${a} found`)]:[]},number:Eo,color:function(i){let t=i.key,r=i.value,a=Ft(r);return a!=="string"?[new Ae(t,r,`color expected, ${a} found`)]:Zt.parse(String(r))?[]:[new Ae(t,r,`color expected, "${r}" found`)]},constants:$l,enum:tn,filter:To,function:gs,layer:So,object:pr,source:Ra,light:Io,sky:ko,terrain:Mo,projection:function(i){let t=i.value,r=i.styleSpec,a=r.projection,l=i.style,h=Ft(t);if(t===void 0)return[];if(h!=="object")return[new Ae("projection",t,`object expected, ${h} found`)];let d=[];for(let f in t)d=d.concat(a[f]?i.validateSpec({key:f,value:t[f],valueSpec:a[f],style:l,styleSpec:r}):[new Ae(f,t[f],`unknown property "${f}"`)]);return d},string:In,formatted:function(i){return In(i).length===0?[]:ta(i)},resolvedImage:function(i){return In(i).length===0?[]:ta(i)},padding:function(i){let t=i.key,r=i.value;if(Ft(r)==="array"){if(r.length<1||r.length>4)return[new Ae(t,r,`padding requires 1 to 4 values; ${r.length} values found`)];let a={type:"number"},l=[];for(let h=0;h[]}})),i.constants&&(r=r.concat($l({key:"constants",value:i.constants,style:i,styleSpec:t,validateSpec:ia}))),zo(r)}function Hr(i){return function(t){return i({...t,validateSpec:ia})}}function zo(i){return[].concat(i).sort((t,r)=>t.line-r.line)}function Fr(i){return function(...t){return zo(i.apply(this,t))}}br.source=Fr(Hr(Ra)),br.sprite=Fr(Hr(Po)),br.glyphs=Fr(Hr(Zl)),br.light=Fr(Hr(Io)),br.sky=Fr(Hr(ko)),br.terrain=Fr(Hr(Mo)),br.layer=Fr(Hr(So)),br.filter=Fr(Hr(To)),br.paintProperty=Fr(Hr(ys)),br.layoutProperty=Fr(Hr(Do));let kn=br,Yu=kn.light,Qu=kn.sky,Gl=kn.paintProperty,Hl=kn.layoutProperty;function Bo(i,t){let r=!1;if(t&&t.length)for(let a of t)i.fire(new di(new Error(a.message))),r=!0;return r}class ra{constructor(t,r,a){let l=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;let d=new Int32Array(this.arrayBuffer);t=d[0],this.d=(r=d[1])+2*(a=d[2]);for(let g=0;g=A[z+0]&&l>=A[z+1])?(f[M]=!0,d.push(x[M])):f[M]=!1}}}}_forEachCell(t,r,a,l,h,d,f,g){let v=this._convertToCellCoord(t),x=this._convertToCellCoord(r),A=this._convertToCellCoord(a),D=this._convertToCellCoord(l);for(let M=v;M<=A;M++)for(let z=x;z<=D;z++){let B=this.d*z+M;if((!g||g(this._convertFromCellCoord(M),this._convertFromCellCoord(z),this._convertFromCellCoord(M+1),this._convertFromCellCoord(z+1)))&&h.call(this,t,r,a,l,B,d,f,g))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let t=this.cells,r=3+this.cells.length+1+1,a=0;for(let d=0;d=0)continue;let d=i[h];l[h]=wr[r].shallow.indexOf(h)>=0?d:na(d,t)}i instanceof Error&&(l.message=i.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(l.$name=r),l}function aa(i){if(Xl(i))return i;if(Array.isArray(i))return i.map(aa);if(typeof i!="object")throw new Error("can't deserialize object of type "+typeof i);let t=Lo(i)||"Object";if(!wr[t])throw new Error(`can't deserialize unregistered class ${t}`);let{klass:r}=wr[t];if(!r)throw new Error(`can't deserialize unregistered class ${t}`);if(r.deserialize)return r.deserialize(i);let a=Object.create(r.prototype);for(let l of Object.keys(i)){if(l==="$name")continue;let h=i[l];a[l]=wr[t].shallow.indexOf(l)>=0?h:aa(h)}return a}class Ro{constructor(){this.first=!0}update(t,r){let a=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=a,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=a,!0):(this.lastFloorZoom>a?(this.lastIntegerZoom=a+1,this.lastIntegerZoomTime=r):this.lastFloorZoomi>=128&&i<=255,"Hangul Jamo":i=>i>=4352&&i<=4607,Khmer:i=>i>=6016&&i<=6143,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Katakana:i=>i>=12448&&i<=12543,Kanbun:i=>i>=12688&&i<=12703,"CJK Strokes":i=>i>=12736&&i<=12783,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"Private Use Area":i=>i>=57344&&i<=63743,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function Fo(i){for(let t of i)if(No(t.charCodeAt(0)))return!0;return!1}function ec(i){for(let t of i)if(!sa(t.charCodeAt(0)))return!1;return!0}function Oo(i){let t=i.map(r=>{try{return new RegExp(`\\p{sc=${r}}`,"u").source}catch{return null}}).filter(r=>r);return new RegExp(t.join("|"),"u")}let tc=Oo(["Arab","Dupl","Mong","Ougr","Syrc"]);function sa(i){return!tc.test(String.fromCodePoint(i))}let Wl=Oo(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function No(i){return!(i!==746&&i!==747&&(i<4352||!(It["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||It["CJK Compatibility"](i)||It["CJK Strokes"](i)||!(!It["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||It["Enclosed CJK Letters and Months"](i)||It["Ideographic Description Characters"](i)||It.Kanbun(i)||It.Katakana(i)&&i!==12540||!(!It["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!It["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||It["Vertical Forms"](i)||It["Yijing Hexagram Symbols"](i)||/\p{sc=Cans}/u.test(String.fromCodePoint(i))||/\p{sc=Hang}/u.test(String.fromCodePoint(i))||Wl.test(String.fromCodePoint(i)))))}function Jl(i){return!(No(i)||function(t){return!!(It["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||It["General Punctuation"](t)&&(t===8214||t===8224||t===8225||t===8240||t===8241||t===8251||t===8252||t===8258||t===8263||t===8264||t===8265||t===8273)||It["Letterlike Symbols"](t)||It["Number Forms"](t)||It["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||t===9003||t>=9085&&t<=9114||t>=9150&&t<=9165||t===9167||t>=9169&&t<=9179||t>=9186&&t<=9215)||It["Control Pictures"](t)&&t!==9251||It["Optical Character Recognition"](t)||It["Enclosed Alphanumerics"](t)||It["Geometric Shapes"](t)||It["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||It["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||It["CJK Symbols and Punctuation"](t)||It.Katakana(t)||It["Private Use Area"](t)||It["CJK Compatibility Forms"](t)||It["Small Form Variants"](t)||It["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}(i))}let ic=Oo(["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 qo(i){return ic.test(String.fromCodePoint(i))}function rc(i,t){return!(!t&&qo(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||It.Khmer(i))}function nc(i){for(let t of i)if(qo(t.charCodeAt(0)))return!0;return!1}let dr=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(i){this.pluginStatus=i.pluginStatus,this.pluginURL=i.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(i){this.applyArabicShaping=i.applyArabicShaping,this.processBidirectionalText=i.processBidirectionalText,this.processStyledBidirectionalText=i.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class ti{constructor(t,r){this.zoom=t,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Ro,this.transition={})}isSupportedScript(t){return function(r,a){for(let l of r)if(!rc(l.charCodeAt(0),a))return!1;return!0}(t,dr.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let t=this.zoom,r=t-Math.floor(t),a=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*a}:{fromScale:.5,toScale:1,t:1-(1-a)*r}}}class oa{constructor(t,r){this.property=t,this.value=r,this.expression=function(a,l){if(us(a))return new ea(a,l);if(ps(a)){let h=bo(a,l);if(h.result==="error")throw new Error(h.value.map(d=>`${d.key}: ${d.message}`).join(", "));return h.value}{let h=a;return l.type==="color"&&typeof a=="string"?h=Zt.parse(a):l.type!=="padding"||typeof a!="number"&&!Array.isArray(a)?l.type==="variableAnchorOffsetCollection"&&Array.isArray(a)&&(h=vr.parse(a)):h=cr.parse(a),{kind:"constant",evaluate:()=>h}}}(r===void 0?t.specification.default:r,t.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(t,r,a){return this.property.possiblyEvaluate(this,t,r,a)}}class ws{constructor(t){this.property=t,this.value=new oa(t,void 0)}transitioned(t,r){return new Kl(this.property,this.value,r,He({},t.transition,this.transition),t.now)}untransitioned(){return new Kl(this.property,this.value,null,{},0)}}class As{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return ge(this._values[t].value.value)}setValue(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new ws(this._values[t].property)),this._values[t].value=new oa(this._values[t].property,r===null?void 0:ge(r))}getTransition(t){return ge(this._values[t].transition)}setTransition(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new ws(this._values[t].property)),this._values[t].transition=ge(r)||void 0}serialize(){let t={};for(let r of Object.keys(this._values)){let a=this.getValue(r);a!==void 0&&(t[r]=a);let l=this.getTransition(r);l!==void 0&&(t[`${r}-transition`]=l)}return t}transitioned(t,r){let a=new Fa(this._properties);for(let l of Object.keys(this._values))a._values[l]=this._values[l].transitioned(t,r._values[l]);return a}untransitioned(){let t=new Fa(this._properties);for(let r of Object.keys(this._values))t._values[r]=this._values[r].untransitioned();return t}}class Kl{constructor(t,r,a,l,h){this.property=t,this.value=r,this.begin=h+l.delay||0,this.end=this.begin+l.duration||0,t.specification.transition&&(l.delay||l.duration)&&(this.prior=a)}possiblyEvaluate(t,r,a){let l=t.now||0,h=this.value.possiblyEvaluate(t,r,a),d=this.prior;if(d){if(l>this.end)return this.prior=null,h;if(this.value.isDataDriven())return this.prior=null,h;if(l=1)return 1;let v=g*g,x=v*g;return 4*(g<.5?x:3*(g-v)+x-.75)}(f))}}return h}}class Fa{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,r,a){let l=new Na(this._properties);for(let h of Object.keys(this._values))l._values[h]=this._values[h].possiblyEvaluate(t,r,a);return l}hasTransition(){for(let t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class Oa{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return this._values[t].value!==void 0}getValue(t){return ge(this._values[t].value)}setValue(t,r){this._values[t]=new oa(this._values[t].property,r===null?void 0:ge(r))}serialize(){let t={};for(let r of Object.keys(this._values)){let a=this.getValue(r);a!==void 0&&(t[r]=a)}return t}possiblyEvaluate(t,r,a){let l=new Na(this._properties);for(let h of Object.keys(this._values))l._values[h]=this._values[h].possiblyEvaluate(t,r,a);return l}}class Xr{constructor(t,r,a){this.property=t,this.value=r,this.parameters=a}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,r,a,l){return this.property.evaluate(this.value,this.parameters,t,r,a,l)}}class Na{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class $e{constructor(t){this.specification=t}possiblyEvaluate(t,r){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(r)}interpolate(t,r,a){let l=Yi[this.specification.type];return l?l(t,r,a):t}}class nt{constructor(t,r){this.specification=t,this.overrides=r}possiblyEvaluate(t,r,a,l){return new Xr(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(r,null,{},a,l)}:t.expression,r)}interpolate(t,r,a){if(t.value.kind!=="constant"||r.value.kind!=="constant")return t;if(t.value.value===void 0||r.value.value===void 0)return new Xr(this,{kind:"constant",value:void 0},t.parameters);let l=Yi[this.specification.type];if(l){let h=l(t.value.value,r.value.value,a);return new Xr(this,{kind:"constant",value:h},t.parameters)}return t}evaluate(t,r,a,l,h,d){return t.kind==="constant"?t.value:t.evaluate(r,a,l,h,d)}}class Es extends nt{possiblyEvaluate(t,r,a,l){if(t.value===void 0)return new Xr(this,{kind:"constant",value:void 0},r);if(t.expression.kind==="constant"){let h=t.expression.evaluate(r,null,{},a,l),d=t.property.specification.type==="resolvedImage"&&typeof h!="string"?h.name:h,f=this._calculate(d,d,d,r);return new Xr(this,{kind:"constant",value:f},r)}if(t.expression.kind==="camera"){let h=this._calculate(t.expression.evaluate({zoom:r.zoom-1}),t.expression.evaluate({zoom:r.zoom}),t.expression.evaluate({zoom:r.zoom+1}),r);return new Xr(this,{kind:"constant",value:h},r)}return new Xr(this,t.expression,r)}evaluate(t,r,a,l,h,d){if(t.kind==="source"){let f=t.evaluate(r,a,l,h,d);return this._calculate(f,f,f,r)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(r.zoom)-1},a,l),t.evaluate({zoom:Math.floor(r.zoom)},a,l),t.evaluate({zoom:Math.floor(r.zoom)+1},a,l),r):t.value}_calculate(t,r,a,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:a,to:r}}interpolate(t){return t}}class Ts{constructor(t){this.specification=t}possiblyEvaluate(t,r,a,l){if(t.value!==void 0){if(t.expression.kind==="constant"){let h=t.expression.evaluate(r,null,{},a,l);return this._calculate(h,h,h,r)}return this._calculate(t.expression.evaluate(new ti(Math.floor(r.zoom-1),r)),t.expression.evaluate(new ti(Math.floor(r.zoom),r)),t.expression.evaluate(new ti(Math.floor(r.zoom+1),r)),r)}}_calculate(t,r,a,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:a,to:r}}interpolate(t){return t}}class Vo{constructor(t){this.specification=t}possiblyEvaluate(t,r,a,l){return!!t.expression.evaluate(r,null,{},a,l)}interpolate(){return!1}}class c{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let r in t){let a=t[r];a.specification.overridable&&this.overridableProperties.push(r);let l=this.defaultPropertyValues[r]=new oa(a,void 0),h=this.defaultTransitionablePropertyValues[r]=new ws(a);this.defaultTransitioningPropertyValues[r]=h.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=l.possiblyEvaluate({})}}}Ve("DataDrivenProperty",nt),Ve("DataConstantProperty",$e),Ve("CrossFadedDataDrivenProperty",Es),Ve("CrossFadedProperty",Ts),Ve("ColorRampProperty",Vo);let e="-transition";class n extends Kt{constructor(t,r){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},t.type!=="custom"&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!=="background"&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),r.layout&&(this._unevaluatedLayout=new Oa(r.layout)),r.paint)){this._transitionablePaint=new As(r.paint);for(let a in t.paint)this.setPaintProperty(a,t.paint[a],{validate:!1});for(let a in t.layout)this.setLayoutProperty(a,t.layout[a],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Na(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return t==="visibility"?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,r,a={}){r!=null&&this._validate(Hl,`layers.${this.id}.layout.${t}`,t,r,a)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,r):this.visibility=r)}getPaintProperty(t){return t.endsWith(e)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,r,a={}){if(r!=null&&this._validate(Gl,`layers.${this.id}.paint.${t}`,t,r,a))return!1;if(t.endsWith(e))return this._transitionablePaint.setTransition(t.slice(0,-11),r||void 0),!1;{let l=this._transitionablePaint._values[t],h=l.property.specification["property-type"]==="cross-faded-data-driven",d=l.value.isDataDriven(),f=l.value;this._transitionablePaint.setValue(t,r),this._handleSpecialPaintPropertyUpdate(t);let g=this._transitionablePaint._values[t].value;return g.isDataDriven()||d||h||this._handleOverridablePaintPropertyUpdate(t,f,g)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,r,a){return!1}isHidden(t){return!!(this.minzoom&&t=this.maxzoom)||this.visibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,r){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,r)}serialize(){let t={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&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),Fe(t,(r,a)=>!(r===void 0||a==="layout"&&!Object.keys(r).length||a==="paint"&&!Object.keys(r).length))}_validate(t,r,a,l,h={}){return(!h||h.validate!==!1)&&Bo(this,t.call(kn,{key:r,layerType:this.type,objectKey:a,value:l,styleSpec:oe,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let t in this.paint._values){let r=this.paint.get(t);if(r instanceof Xr&&Wn(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}let s={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class o{constructor(t,r){this._structArray=t,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class u{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,r){return t._trim(),r&&(t.isTransferred=!0,r.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){let r=Object.create(this.prototype);return r.arrayBuffer=t.arrayBuffer,r.length=t.length,r.capacity=t.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_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(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function m(i,t=1){let r=0,a=0;return{members:i.map(l=>{let h=s[l.type].BYTES_PER_ELEMENT,d=r=_(r,Math.max(t,h)),f=l.components||1;return a=Math.max(a,h),r+=h*f,{name:l.name,type:l.type,components:f,offset:d}}),size:_(r,Math.max(a,t)),alignment:t}}function _(i,t){return Math.ceil(i/t)*t}class y extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r){let a=this.length;return this.resize(a+1),this.emplace(a,t,r)}emplace(t,r,a){let l=2*t;return this.int16[l+0]=r,this.int16[l+1]=a,t}}y.prototype.bytesPerElement=4,Ve("StructArrayLayout2i4",y);class b extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a){let l=this.length;return this.resize(l+1),this.emplace(l,t,r,a)}emplace(t,r,a,l){let h=3*t;return this.int16[h+0]=r,this.int16[h+1]=a,this.int16[h+2]=l,t}}b.prototype.bytesPerElement=6,Ve("StructArrayLayout3i6",b);class T extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,l){let h=this.length;return this.resize(h+1),this.emplace(h,t,r,a,l)}emplace(t,r,a,l,h){let d=4*t;return this.int16[d+0]=r,this.int16[d+1]=a,this.int16[d+2]=l,this.int16[d+3]=h,t}}T.prototype.bytesPerElement=8,Ve("StructArrayLayout4i8",T);class C extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,l,h,d){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,a,l,h,d)}emplace(t,r,a,l,h,d,f){let g=6*t;return this.int16[g+0]=r,this.int16[g+1]=a,this.int16[g+2]=l,this.int16[g+3]=h,this.int16[g+4]=d,this.int16[g+5]=f,t}}C.prototype.bytesPerElement=12,Ve("StructArrayLayout2i4i12",C);class P extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,l,h,d){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,a,l,h,d)}emplace(t,r,a,l,h,d,f){let g=4*t,v=8*t;return this.int16[g+0]=r,this.int16[g+1]=a,this.uint8[v+4]=l,this.uint8[v+5]=h,this.uint8[v+6]=d,this.uint8[v+7]=f,t}}P.prototype.bytesPerElement=8,Ve("StructArrayLayout2i4ub8",P);class L extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r){let a=this.length;return this.resize(a+1),this.emplace(a,t,r)}emplace(t,r,a){let l=2*t;return this.float32[l+0]=r,this.float32[l+1]=a,t}}L.prototype.bytesPerElement=8,Ve("StructArrayLayout2f8",L);class O extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,a,l,h,d,f,g,v,x){let A=this.length;return this.resize(A+1),this.emplace(A,t,r,a,l,h,d,f,g,v,x)}emplace(t,r,a,l,h,d,f,g,v,x,A){let D=10*t;return this.uint16[D+0]=r,this.uint16[D+1]=a,this.uint16[D+2]=l,this.uint16[D+3]=h,this.uint16[D+4]=d,this.uint16[D+5]=f,this.uint16[D+6]=g,this.uint16[D+7]=v,this.uint16[D+8]=x,this.uint16[D+9]=A,t}}O.prototype.bytesPerElement=20,Ve("StructArrayLayout10ui20",O);class U extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,a,l,h,d,f,g,v,x,A,D){let M=this.length;return this.resize(M+1),this.emplace(M,t,r,a,l,h,d,f,g,v,x,A,D)}emplace(t,r,a,l,h,d,f,g,v,x,A,D,M){let z=12*t;return this.int16[z+0]=r,this.int16[z+1]=a,this.int16[z+2]=l,this.int16[z+3]=h,this.uint16[z+4]=d,this.uint16[z+5]=f,this.uint16[z+6]=g,this.uint16[z+7]=v,this.int16[z+8]=x,this.int16[z+9]=A,this.int16[z+10]=D,this.int16[z+11]=M,t}}U.prototype.bytesPerElement=24,Ve("StructArrayLayout4i4ui4i24",U);class Z extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,a){let l=this.length;return this.resize(l+1),this.emplace(l,t,r,a)}emplace(t,r,a,l){let h=3*t;return this.float32[h+0]=r,this.float32[h+1]=a,this.float32[h+2]=l,t}}Z.prototype.bytesPerElement=12,Ve("StructArrayLayout3f12",Z);class G extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){let r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint32[1*t+0]=r,t}}G.prototype.bytesPerElement=4,Ve("StructArrayLayout1ul4",G);class W extends u{_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(t,r,a,l,h,d,f,g,v){let x=this.length;return this.resize(x+1),this.emplace(x,t,r,a,l,h,d,f,g,v)}emplace(t,r,a,l,h,d,f,g,v,x){let A=10*t,D=5*t;return this.int16[A+0]=r,this.int16[A+1]=a,this.int16[A+2]=l,this.int16[A+3]=h,this.int16[A+4]=d,this.int16[A+5]=f,this.uint32[D+3]=g,this.uint16[A+8]=v,this.uint16[A+9]=x,t}}W.prototype.bytesPerElement=20,Ve("StructArrayLayout6i1ul2ui20",W);class N extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,l,h,d){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,a,l,h,d)}emplace(t,r,a,l,h,d,f){let g=6*t;return this.int16[g+0]=r,this.int16[g+1]=a,this.int16[g+2]=l,this.int16[g+3]=h,this.int16[g+4]=d,this.int16[g+5]=f,t}}N.prototype.bytesPerElement=12,Ve("StructArrayLayout2i2i2i12",N);class Q extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,l,h){let d=this.length;return this.resize(d+1),this.emplace(d,t,r,a,l,h)}emplace(t,r,a,l,h,d){let f=4*t,g=8*t;return this.float32[f+0]=r,this.float32[f+1]=a,this.float32[f+2]=l,this.int16[g+6]=h,this.int16[g+7]=d,t}}Q.prototype.bytesPerElement=16,Ve("StructArrayLayout2f1f2i16",Q);class te extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,l,h,d){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,a,l,h,d)}emplace(t,r,a,l,h,d,f){let g=16*t,v=4*t,x=8*t;return this.uint8[g+0]=r,this.uint8[g+1]=a,this.float32[v+1]=l,this.float32[v+2]=h,this.int16[x+6]=d,this.int16[x+7]=f,t}}te.prototype.bytesPerElement=16,Ve("StructArrayLayout2ub2f2i16",te);class ae extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,a){let l=this.length;return this.resize(l+1),this.emplace(l,t,r,a)}emplace(t,r,a,l){let h=3*t;return this.uint16[h+0]=r,this.uint16[h+1]=a,this.uint16[h+2]=l,t}}ae.prototype.bytesPerElement=6,Ve("StructArrayLayout3ui6",ae);class fe extends u{_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(t,r,a,l,h,d,f,g,v,x,A,D,M,z,B,q,$){let ne=this.length;return this.resize(ne+1),this.emplace(ne,t,r,a,l,h,d,f,g,v,x,A,D,M,z,B,q,$)}emplace(t,r,a,l,h,d,f,g,v,x,A,D,M,z,B,q,$,ne){let J=24*t,ie=12*t,ce=48*t;return this.int16[J+0]=r,this.int16[J+1]=a,this.uint16[J+2]=l,this.uint16[J+3]=h,this.uint32[ie+2]=d,this.uint32[ie+3]=f,this.uint32[ie+4]=g,this.uint16[J+10]=v,this.uint16[J+11]=x,this.uint16[J+12]=A,this.float32[ie+7]=D,this.float32[ie+8]=M,this.uint8[ce+36]=z,this.uint8[ce+37]=B,this.uint8[ce+38]=q,this.uint32[ie+10]=$,this.int16[J+22]=ne,t}}fe.prototype.bytesPerElement=48,Ve("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",fe);class be extends u{_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(t,r,a,l,h,d,f,g,v,x,A,D,M,z,B,q,$,ne,J,ie,ce,_e,Re,it,Be,Pe,Xe,Ue){let qe=this.length;return this.resize(qe+1),this.emplace(qe,t,r,a,l,h,d,f,g,v,x,A,D,M,z,B,q,$,ne,J,ie,ce,_e,Re,it,Be,Pe,Xe,Ue)}emplace(t,r,a,l,h,d,f,g,v,x,A,D,M,z,B,q,$,ne,J,ie,ce,_e,Re,it,Be,Pe,Xe,Ue,qe){let de=32*t,We=16*t;return this.int16[de+0]=r,this.int16[de+1]=a,this.int16[de+2]=l,this.int16[de+3]=h,this.int16[de+4]=d,this.int16[de+5]=f,this.int16[de+6]=g,this.int16[de+7]=v,this.uint16[de+8]=x,this.uint16[de+9]=A,this.uint16[de+10]=D,this.uint16[de+11]=M,this.uint16[de+12]=z,this.uint16[de+13]=B,this.uint16[de+14]=q,this.uint16[de+15]=$,this.uint16[de+16]=ne,this.uint16[de+17]=J,this.uint16[de+18]=ie,this.uint16[de+19]=ce,this.uint16[de+20]=_e,this.uint16[de+21]=Re,this.uint16[de+22]=it,this.uint32[We+12]=Be,this.float32[We+13]=Pe,this.float32[We+14]=Xe,this.uint16[de+30]=Ue,this.uint16[de+31]=qe,t}}be.prototype.bytesPerElement=64,Ve("StructArrayLayout8i15ui1ul2f2ui64",be);class ze extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){let r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.float32[1*t+0]=r,t}}ze.prototype.bytesPerElement=4,Ve("StructArrayLayout1f4",ze);class Oe extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,a){let l=this.length;return this.resize(l+1),this.emplace(l,t,r,a)}emplace(t,r,a,l){let h=3*t;return this.uint16[6*t+0]=r,this.float32[h+1]=a,this.float32[h+2]=l,t}}Oe.prototype.bytesPerElement=12,Ve("StructArrayLayout1ui2f12",Oe);class Ie extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,a){let l=this.length;return this.resize(l+1),this.emplace(l,t,r,a)}emplace(t,r,a,l){let h=4*t;return this.uint32[2*t+0]=r,this.uint16[h+2]=a,this.uint16[h+3]=l,t}}Ie.prototype.bytesPerElement=8,Ve("StructArrayLayout1ul2ui8",Ie);class Ce extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r){let a=this.length;return this.resize(a+1),this.emplace(a,t,r)}emplace(t,r,a){let l=2*t;return this.uint16[l+0]=r,this.uint16[l+1]=a,t}}Ce.prototype.bytesPerElement=4,Ve("StructArrayLayout2ui4",Ce);class Ze extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){let r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint16[1*t+0]=r,t}}Ze.prototype.bytesPerElement=2,Ve("StructArrayLayout1ui2",Ze);class ct extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,a,l){let h=this.length;return this.resize(h+1),this.emplace(h,t,r,a,l)}emplace(t,r,a,l,h){let d=4*t;return this.float32[d+0]=r,this.float32[d+1]=a,this.float32[d+2]=l,this.float32[d+3]=h,t}}ct.prototype.bytesPerElement=16,Ve("StructArrayLayout4f16",ct);class ke extends o{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 se(this.anchorPointX,this.anchorPointY)}}ke.prototype.size=20;class Le extends W{get(t){return new ke(this,t)}}Ve("CollisionBoxArray",Le);class ot extends o{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(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}ot.prototype.size=48;class ii extends fe{get(t){return new ot(this,t)}}Ve("PlacedSymbolArray",ii);class xt extends o{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(t){this._structArray.uint32[this._pos4+12]=t}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]}}xt.prototype.size=64;class St extends be{get(t){return new xt(this,t)}}Ve("SymbolInstanceArray",St);class ri extends ze{getoffsetX(t){return this.float32[1*t+0]}}Ve("GlyphOffsetArray",ri);class zi extends b{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}Ve("SymbolLineVertexArray",zi);class Or extends o{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]}}Or.prototype.size=12;class ni extends Oe{get(t){return new Or(this,t)}}Ve("TextAnchorOffsetArray",ni);class er extends o{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]}}er.prototype.size=8;class $i extends Ie{get(t){return new er(this,t)}}Ve("FeatureIndexArray",$i);class Bi extends y{}class Zi extends y{}class Wr extends y{}class la extends C{}class Cs extends P{}class ua extends L{}class Ar extends O{}class Ds extends U{}class Uo extends Z{}class Er extends G{}class Tr extends N{}class cn extends te{}class Nr extends ae{}class ki extends Ce{}let Li=m([{name:"a_pos",components:2,type:"Int16"}],4),{members:fr}=Li;class kt{constructor(t=[]){this.segments=t}prepareSegment(t,r,a,l){let h=this.segments[this.segments.length-1];return t>kt.MAX_VERTEX_ARRAY_LENGTH&&we(`Max vertices per segment is ${kt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!h||h.vertexLength+t>kt.MAX_VERTEX_ARRAY_LENGTH||h.sortKey!==l)&&(h={vertexOffset:r.length,primitiveOffset:a.length,vertexLength:0,primitiveLength:0},l!==void 0&&(h.sortKey=l),this.segments.push(h)),h}get(){return this.segments}destroy(){for(let t of this.segments)for(let r in t.vaos)t.vaos[r].destroy()}static simpleSegment(t,r,a,l){return new kt([{vertexOffset:t,primitiveOffset:r,vertexLength:a,primitiveLength:l,vaos:{},sortKey:0}])}}function Mn(i,t){return 256*(i=Se(Math.floor(i),0,255))+Se(Math.floor(t),0,255)}kt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Ve("SegmentVector",kt);let ca=m([{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 ha={exports:{}},Yl={exports:{}};Yl.exports=function(i,t){var r,a,l,h,d,f,g,v;for(a=i.length-(r=3&i.length),l=t,d=3432918353,f=461845907,v=0;v>>16)*d&65535)<<16)&4294967295)<<15|g>>>17))*f+(((g>>>16)*f&65535)<<16)&4294967295)<<13|l>>>19))+((5*(l>>>16)&65535)<<16)&4294967295))+((58964+(h>>>16)&65535)<<16);switch(g=0,r){case 3:g^=(255&i.charCodeAt(v+2))<<16;case 2:g^=(255&i.charCodeAt(v+1))<<8;case 1:l^=g=(65535&(g=(g=(65535&(g^=255&i.charCodeAt(v)))*d+(((g>>>16)*d&65535)<<16)&4294967295)<<15|g>>>17))*f+(((g>>>16)*f&65535)<<16)&4294967295}return l^=i.length,l=2246822507*(65535&(l^=l>>>16))+((2246822507*(l>>>16)&65535)<<16)&4294967295,l=3266489909*(65535&(l^=l>>>13))+((3266489909*(l>>>16)&65535)<<16)&4294967295,(l^=l>>>16)>>>0};var ac=Yl.exports,Ql={exports:{}};Ql.exports=function(i,t){for(var r,a=i.length,l=t^a,h=0;a>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(h)|(255&i.charCodeAt(++h))<<8|(255&i.charCodeAt(++h))<<16|(255&i.charCodeAt(++h))<<24))+((1540483477*(r>>>16)&65535)<<16),l=1540483477*(65535&l)+((1540483477*(l>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),a-=4,++h;switch(a){case 3:l^=(255&i.charCodeAt(h+2))<<16;case 2:l^=(255&i.charCodeAt(h+1))<<8;case 1:l=1540483477*(65535&(l^=255&i.charCodeAt(h)))+((1540483477*(l>>>16)&65535)<<16)}return l=1540483477*(65535&(l^=l>>>13))+((1540483477*(l>>>16)&65535)<<16),(l^=l>>>15)>>>0};var hn=ac,eu=Ql.exports;ha.exports=hn,ha.exports.murmur3=hn,ha.exports.murmur2=eu;var Ss=ue(ha.exports);class qa{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,r,a,l){this.ids.push(Is(t)),this.positions.push(r,a,l)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let r=Is(t),a=0,l=this.ids.length-1;for(;a>1;this.ids[d]>=r?l=d:a=d+1}let h=[];for(;this.ids[a]===r;)h.push({index:this.positions[3*a],start:this.positions[3*a+1],end:this.positions[3*a+2]}),a++;return h}static serialize(t,r){let a=new Float64Array(t.ids),l=new Uint32Array(t.positions);return ks(a,l,0,a.length-1),r&&r.push(a.buffer,l.buffer),{ids:a,positions:l}}static deserialize(t){let r=new qa;return r.ids=t.ids,r.positions=t.positions,r.indexed=!0,r}}function Is(i){let t=+i;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:Ss(String(i))}function ks(i,t,r,a){for(;r>1],h=r-1,d=a+1;for(;;){do h++;while(i[h]l);if(h>=d)break;pa(i,h,d),pa(t,3*h,3*d),pa(t,3*h+1,3*d+1),pa(t,3*h+2,3*d+2)}d-r`u_${l}`),this.type=a}setUniform(t,r,a){t.set(a.constantOr(this.value))}getBinding(t,r,a){return this.type==="color"?new fh(t,r):new tu(t,r)}}class Ms{constructor(t,r){this.uniformNames=r.map(a=>`u_${a}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=t.tlbr}setUniform(t,r,a,l){let h=l==="u_pattern_to"?this.patternTo:l==="u_pattern_from"?this.patternFrom:l==="u_pixel_ratio_to"?this.pixelRatioTo:l==="u_pixel_ratio_from"?this.pixelRatioFrom:null;h&&t.set(h)}getBinding(t,r,a){return a.substr(0,9)==="u_pattern"?new dh(t,r):new tu(t,r)}}class Pn{constructor(t,r,a,l){this.expression=t,this.type=a,this.maxValue=0,this.paintVertexAttributes=r.map(h=>({name:`a_${h}`,type:"Float32",components:a==="color"?2:1,offset:0})),this.paintVertexArray=new l}populatePaintArray(t,r,a,l,h){let d=this.paintVertexArray.length,f=this.expression.evaluate(new ti(0),r,{},l,[],h);this.paintVertexArray.resize(t),this._setPaintValue(d,t,f)}updatePaintArray(t,r,a,l){let h=this.expression.evaluate({zoom:0},a,l);this._setPaintValue(t,r,h)}_setPaintValue(t,r,a){if(this.type==="color"){let l=sc(a);for(let h=t;h`u_${f}_t`),this.type=a,this.useIntegerZoom=l,this.zoom=h,this.maxValue=0,this.paintVertexAttributes=r.map(f=>({name:`a_${f}`,type:"Float32",components:a==="color"?4:2,offset:0})),this.paintVertexArray=new d}populatePaintArray(t,r,a,l,h){let d=this.expression.evaluate(new ti(this.zoom),r,{},l,[],h),f=this.expression.evaluate(new ti(this.zoom+1),r,{},l,[],h),g=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(g,t,d,f)}updatePaintArray(t,r,a,l){let h=this.expression.evaluate({zoom:this.zoom},a,l),d=this.expression.evaluate({zoom:this.zoom+1},a,l);this._setPaintValue(t,r,h,d)}_setPaintValue(t,r,a,l){if(this.type==="color"){let h=sc(a),d=sc(l);for(let f=t;f`#define HAS_UNIFORM_${l}`))}return t}getBinderAttributes(){let t=[];for(let r in this.binders){let a=this.binders[r];if(a instanceof Pn||a instanceof rn)for(let l=0;l!0){this.programConfigurations={};for(let l of t)this.programConfigurations[l.id]=new mh(l,r,a);this.needsUpload=!1,this._featureMap=new qa,this._bufferOffset=0}populatePaintArrays(t,r,a,l,h,d){for(let f in this.programConfigurations)this.programConfigurations[f].populatePaintArrays(t,r,l,h,d);r.id!==void 0&&this._featureMap.add(r.id,a,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,r,a,l){for(let h of a)this.needsUpload=this.programConfigurations[h.id].updatePaintArrays(t,this._featureMap,r,h,l)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(let r in this.programConfigurations)this.programConfigurations[r].upload(t);this.needsUpload=!1}}destroy(){for(let t in this.programConfigurations)this.programConfigurations[t].destroy()}}function Kd(i,t){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"]}[i]||[i.replace(`${t}-`,"").replace(/-/g,"_")]}function gh(i,t,r){let a={color:{source:L,composite:ct},number:{source:ze,composite:L}},l=function(h){return{"line-pattern":{source:Ar,composite:Ar},"fill-pattern":{source:Ar,composite:Ar},"fill-extrusion-pattern":{source:Ar,composite:Ar}}[h]}(i);return l&&l[r]||a[t][r]}Ve("ConstantBinder",jo),Ve("CrossFadedConstantBinder",Ms),Ve("SourceExpressionBinder",Pn),Ve("CrossFadedCompositeBinder",da),Ve("CompositeExpressionBinder",rn),Ve("ProgramConfiguration",mh,{omit:["_buffers"]}),Ve("ProgramConfigurationSet",Ua);let bi=8192,oc=Math.pow(2,14)-1,_h=-oc-1;function ja(i){let t=bi/i.extent,r=i.loadGeometry();for(let a=0;ad.x+1||gd.y+1)&&we("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function $a(i,t){return{type:i.type,id:i.id,properties:i.properties,geometry:t?ja(i):[]}}function iu(i,t,r,a,l){i.emplaceBack(2*t+(a+1)/2,2*r+(l+1)/2)}class lc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Zi,this.indexArray=new Nr,this.segments=new kt,this.programConfigurations=new Ua(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,a){let l=this.layers[0],h=[],d=null,f=!1;l.type==="circle"&&(d=l.layout.get("circle-sort-key"),f=!d.isConstant());for(let{feature:g,id:v,index:x,sourceLayerIndex:A}of t){let D=this.layers[0]._featureFilter.needGeometry,M=$a(g,D);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom),M,a))continue;let z=f?d.evaluate(M,{},a):void 0,B={id:v,properties:g.properties,type:g.type,sourceLayerIndex:A,index:x,geometry:D?M.geometry:ja(g),patterns:{},sortKey:z};h.push(B)}f&&h.sort((g,v)=>g.sortKey-v.sortKey);for(let g of h){let{geometry:v,index:x,sourceLayerIndex:A}=g,D=t[x].feature;this.addFeature(g,v,x,a),r.featureIndex.insert(D,v,x,A,this.index)}}update(t,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,a)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,fr),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,r,a,l){for(let h of r)for(let d of h){let f=d.x,g=d.y;if(f<0||f>=bi||g<0||g>=bi)continue;let v=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),x=v.vertexLength;iu(this.layoutVertexArray,f,g,-1,-1),iu(this.layoutVertexArray,f,g,1,-1),iu(this.layoutVertexArray,f,g,1,1),iu(this.layoutVertexArray,f,g,-1,1),this.indexArray.emplaceBack(x,x+1,x+2),this.indexArray.emplaceBack(x,x+3,x+2),v.vertexLength+=4,v.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,{},l)}}function yh(i,t){for(let r=0;r1){if(uc(i,t))return!0;for(let a=0;a1?r:r.sub(t)._mult(l)._add(t))}function bh(i,t){let r,a,l,h=!1;for(let d=0;dt.y!=l.y>t.y&&t.x<(l.x-a.x)*(t.y-a.y)/(l.y-a.y)+a.x&&(h=!h)}return h}function Ps(i,t){let r=!1;for(let a=0,l=i.length-1;at.y!=d.y>t.y&&t.x<(d.x-h.x)*(t.y-h.y)/(d.y-h.y)+h.x&&(r=!r)}return r}function tf(i,t,r){let a=r[0],l=r[2];if(i.xl.x&&t.x>l.x||i.yl.y&&t.y>l.y)return!1;let h=Ye(i,t,r[0]);return h!==Ye(i,t,r[1])||h!==Ye(i,t,r[2])||h!==Ye(i,t,r[3])}function $o(i,t,r){let a=t.paint.get(i).value;return a.kind==="constant"?a.value:r.programConfigurations.get(t.id).getMaxValue(i)}function ru(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function nu(i,t,r,a,l){if(!t[0]&&!t[1])return i;let h=se.convert(t)._mult(l);r==="viewport"&&h._rotate(-a);let d=[];for(let f=0;fTh(q,B))}(v,g),M=A?x*f:x;for(let z of l)for(let B of z){let q=A?B:Th(B,g),$=M,ne=au([],[B.x,B.y,0,1],g);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?$*=ne[3]/d.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&($*=d.cameraToCenterDistance/ne[3]),Yd(D,q,$))return!0}return!1}}function Th(i,t){let r=au([],[i.x,i.y,0,1],t);return new se(r[0]/r[3],r[1]/r[3])}class Ch extends lc{}let Dh;Ve("HeatmapBucket",Ch,{omit:["layers"]});var sf={get paint(){return Dh=Dh||new c({"heatmap-radius":new nt(oe.paint_heatmap["heatmap-radius"]),"heatmap-weight":new nt(oe.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new $e(oe.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Vo(oe.paint_heatmap["heatmap-color"]),"heatmap-opacity":new $e(oe.paint_heatmap["heatmap-opacity"])})}};function pc(i,{width:t,height:r},a,l){if(l){if(l instanceof Uint8ClampedArray)l=new Uint8Array(l.buffer);else if(l.length!==t*r*a)throw new RangeError(`mismatched image size. expected: ${l.length} but got: ${t*r*a}`)}else l=new Uint8Array(t*r*a);return i.width=t,i.height=r,i.data=l,i}function Sh(i,{width:t,height:r},a){if(t===i.width&&r===i.height)return;let l=pc({},{width:t,height:r},a);dc(i,l,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,t),height:Math.min(i.height,r)},a),i.width=t,i.height=r,i.data=l.data}function dc(i,t,r,a,l,h){if(l.width===0||l.height===0)return t;if(l.width>i.width||l.height>i.height||r.x>i.width-l.width||r.y>i.height-l.height)throw new RangeError("out of range source coordinates for image copy");if(l.width>t.width||l.height>t.height||a.x>t.width-l.width||a.y>t.height-l.height)throw new RangeError("out of range destination coordinates for image copy");let d=i.data,f=t.data;if(d===f)throw new Error("srcData equals dstData, so image is already copied");for(let g=0;g{t[i.evaluationKey]=g;let v=i.expression.evaluate(t);l.data[d+f+0]=Math.floor(255*v.r/v.a),l.data[d+f+1]=Math.floor(255*v.g/v.a),l.data[d+f+2]=Math.floor(255*v.b/v.a),l.data[d+f+3]=Math.floor(255*v.a)};if(i.clips)for(let d=0,f=0;d80*r){f=1/0,g=1/0;let x=-1/0,A=-1/0;for(let D=r;Dx&&(x=M),z>A&&(A=z)}v=Math.max(x-f,A-g),v=v!==0?32767/v:0}return Ho(h,d,r,f,g,v,0),d}function Ph(i,t,r,a,l){let h;if(l===function(d,f,g,v){let x=0;for(let A=f,D=g-v;A0)for(let d=t;d=t;d-=a)h=Lh(d/a|0,i[d],i[d+1],h);return h&&su(h,h.next)&&(Wo(h),h=h.next),h}function Za(i,t){if(!i)return i;t||(t=i);let r,a=i;do if(r=!1,a.steiner||!su(a,a.next)&&yi(a.prev,a,a.next)!==0)a=a.next;else{if(Wo(a),a=t=a.prev,a===a.next)break;r=!0}while(r||a!==t);return t}function Ho(i,t,r,a,l,h,d){if(!i)return;!d&&h&&function(g,v,x,A){let D=g;do D.z===0&&(D.z=mc(D.x,D.y,v,x,A)),D.prevZ=D.prev,D.nextZ=D.next,D=D.next;while(D!==g);D.prevZ.nextZ=null,D.prevZ=null,function(M){let z,B=1;do{let q,$=M;M=null;let ne=null;for(z=0;$;){z++;let J=$,ie=0;for(let _e=0;_e0||ce>0&&J;)ie!==0&&(ce===0||!J||$.z<=J.z)?(q=$,$=$.nextZ,ie--):(q=J,J=J.nextZ,ce--),ne?ne.nextZ=q:M=q,q.prevZ=ne,ne=q;$=J}ne.nextZ=null,B*=2}while(z>1)}(D)}(i,a,l,h);let f=i;for(;i.prev!==i.next;){let g=i.prev,v=i.next;if(h?df(i,a,l,h):pf(i))t.push(g.i,i.i,v.i),Wo(i),i=v.next,f=v.next;else if((i=v)===f){d?d===1?Ho(i=ff(Za(i),t),t,r,a,l,h,2):d===2&&mf(i,t,r,a,l,h):Ho(Za(i),t,r,a,l,h,1);break}}}function pf(i){let t=i.prev,r=i,a=i.next;if(yi(t,r,a)>=0)return!1;let l=t.x,h=r.x,d=a.x,f=t.y,g=r.y,v=a.y,x=lh?l>d?l:d:h>d?h:d,M=f>g?f>v?f:v:g>v?g:v,z=a.next;for(;z!==t;){if(z.x>=x&&z.x<=D&&z.y>=A&&z.y<=M&&Bs(l,f,h,g,d,v,z.x,z.y)&&yi(z.prev,z,z.next)>=0)return!1;z=z.next}return!0}function df(i,t,r,a){let l=i.prev,h=i,d=i.next;if(yi(l,h,d)>=0)return!1;let f=l.x,g=h.x,v=d.x,x=l.y,A=h.y,D=d.y,M=fg?f>v?f:v:g>v?g:v,q=x>A?x>D?x:D:A>D?A:D,$=mc(M,z,t,r,a),ne=mc(B,q,t,r,a),J=i.prevZ,ie=i.nextZ;for(;J&&J.z>=$&&ie&&ie.z<=ne;){if(J.x>=M&&J.x<=B&&J.y>=z&&J.y<=q&&J!==l&&J!==d&&Bs(f,x,g,A,v,D,J.x,J.y)&&yi(J.prev,J,J.next)>=0||(J=J.prevZ,ie.x>=M&&ie.x<=B&&ie.y>=z&&ie.y<=q&&ie!==l&&ie!==d&&Bs(f,x,g,A,v,D,ie.x,ie.y)&&yi(ie.prev,ie,ie.next)>=0))return!1;ie=ie.nextZ}for(;J&&J.z>=$;){if(J.x>=M&&J.x<=B&&J.y>=z&&J.y<=q&&J!==l&&J!==d&&Bs(f,x,g,A,v,D,J.x,J.y)&&yi(J.prev,J,J.next)>=0)return!1;J=J.prevZ}for(;ie&&ie.z<=ne;){if(ie.x>=M&&ie.x<=B&&ie.y>=z&&ie.y<=q&&ie!==l&&ie!==d&&Bs(f,x,g,A,v,D,ie.x,ie.y)&&yi(ie.prev,ie,ie.next)>=0)return!1;ie=ie.nextZ}return!0}function ff(i,t){let r=i;do{let a=r.prev,l=r.next.next;!su(a,l)&&zh(a,r,r.next,l)&&Xo(a,l)&&Xo(l,a)&&(t.push(a.i,r.i,l.i),Wo(r),Wo(r.next),r=i=l),r=r.next}while(r!==i);return Za(r)}function mf(i,t,r,a,l,h){let d=i;do{let f=d.next.next;for(;f!==d.prev;){if(d.i!==f.i&&xf(d,f)){let g=Bh(d,f);return d=Za(d,d.next),g=Za(g,g.next),Ho(d,t,r,a,l,h,0),void Ho(g,t,r,a,l,h,0)}f=f.next}d=d.next}while(d!==i)}function gf(i,t){return i.x-t.x}function _f(i,t){let r=function(l,h){let d=h,f=l.x,g=l.y,v,x=-1/0;do{if(g<=d.y&&g>=d.next.y&&d.next.y!==d.y){let B=d.x+(g-d.y)*(d.next.x-d.x)/(d.next.y-d.y);if(B<=f&&B>x&&(x=B,v=d.x=d.x&&d.x>=D&&f!==d.x&&Bs(gv.x||d.x===v.x&&yf(v,d)))&&(v=d,z=B)}d=d.next}while(d!==A);return v}(i,t);if(!r)return t;let a=Bh(r,i);return Za(a,a.next),Za(r,r.next)}function yf(i,t){return yi(i.prev,i,t.prev)<0&&yi(t.next,i,i.next)<0}function mc(i,t,r,a,l){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*l|0)|i<<8))|i<<4))|i<<2))|i<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-a)*l|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function vf(i){let t=i,r=i;do(t.x=(i-d)*(h-f)&&(i-d)*(a-f)>=(r-d)*(t-f)&&(r-d)*(h-f)>=(l-d)*(a-f)}function xf(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!function(r,a){let l=r;do{if(l.i!==r.i&&l.next.i!==r.i&&l.i!==a.i&&l.next.i!==a.i&&zh(l,l.next,r,a))return!0;l=l.next}while(l!==r);return!1}(i,t)&&(Xo(i,t)&&Xo(t,i)&&function(r,a){let l=r,h=!1,d=(r.x+a.x)/2,f=(r.y+a.y)/2;do l.y>f!=l.next.y>f&&l.next.y!==l.y&&d<(l.next.x-l.x)*(f-l.y)/(l.next.y-l.y)+l.x&&(h=!h),l=l.next;while(l!==r);return h}(i,t)&&(yi(i.prev,i,t.prev)||yi(i,t.prev,t))||su(i,t)&&yi(i.prev,i,i.next)>0&&yi(t.prev,t,t.next)>0)}function yi(i,t,r){return(t.y-i.y)*(r.x-t.x)-(t.x-i.x)*(r.y-t.y)}function su(i,t){return i.x===t.x&&i.y===t.y}function zh(i,t,r,a){let l=lu(yi(i,t,r)),h=lu(yi(i,t,a)),d=lu(yi(r,a,i)),f=lu(yi(r,a,t));return l!==h&&d!==f||!(l!==0||!ou(i,r,t))||!(h!==0||!ou(i,a,t))||!(d!==0||!ou(r,i,a))||!(f!==0||!ou(r,t,a))}function ou(i,t,r){return t.x<=Math.max(i.x,r.x)&&t.x>=Math.min(i.x,r.x)&&t.y<=Math.max(i.y,r.y)&&t.y>=Math.min(i.y,r.y)}function lu(i){return i>0?1:i<0?-1:0}function Xo(i,t){return yi(i.prev,i,i.next)<0?yi(i,t,i.next)>=0&&yi(i,i.prev,t)>=0:yi(i,t,i.prev)<0||yi(i,i.next,t)<0}function Bh(i,t){let r=gc(i.i,i.x,i.y),a=gc(t.i,t.x,t.y),l=i.next,h=t.prev;return i.next=t,t.prev=i,r.next=l,l.prev=r,a.next=r,r.prev=a,h.next=a,a.prev=h,a}function Lh(i,t,r,a){let l=gc(i,t,r);return a?(l.next=a.next,l.prev=a,a.next.prev=l,a.next=l):(l.prev=l,l.next=l),l}function Wo(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function gc(i,t,r){return{i,x:t,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function _c(i,t,r){let a=r.patternDependencies,l=!1;for(let h of t){let d=h.paint.get(`${i}-pattern`);d.isConstant()||(l=!0);let f=d.constantOr(null);f&&(l=!0,a[f.to]=!0,a[f.from]=!0)}return l}function yc(i,t,r,a,l){let h=l.patternDependencies;for(let d of t){let f=d.paint.get(`${i}-pattern`).value;if(f.kind!=="constant"){let g=f.evaluate({zoom:a-1},r,{},l.availableImages),v=f.evaluate({zoom:a},r,{},l.availableImages),x=f.evaluate({zoom:a+1},r,{},l.availableImages);g=g&&g.name?g.name:g,v=v&&v.name?v.name:v,x=x&&x.name?x.name:x,h[g]=!0,h[v]=!0,h[x]=!0,r.patterns[d.id]={min:g,mid:v,max:x}}}return r}class vc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Wr,this.indexArray=new Nr,this.indexArray2=new ki,this.programConfigurations=new Ua(t.layers,t.zoom),this.segments=new kt,this.segments2=new kt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,a){this.hasPattern=_c("fill",this.layers,r);let l=this.layers[0].layout.get("fill-sort-key"),h=!l.isConstant(),d=[];for(let{feature:f,id:g,index:v,sourceLayerIndex:x}of t){let A=this.layers[0]._featureFilter.needGeometry,D=$a(f,A);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom),D,a))continue;let M=h?l.evaluate(D,{},a,r.availableImages):void 0,z={id:g,properties:f.properties,type:f.type,sourceLayerIndex:x,index:v,geometry:A?D.geometry:ja(f),patterns:{},sortKey:M};d.push(z)}h&&d.sort((f,g)=>f.sortKey-g.sortKey);for(let f of d){let{geometry:g,index:v,sourceLayerIndex:x}=f;if(this.hasPattern){let A=yc("fill",this.layers,f,this.zoom,r);this.patternFeatures.push(A)}else this.addFeature(f,g,v,a,{});r.featureIndex.insert(t[v].feature,g,v,x,this.index)}}update(t,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,a)}addFeatures(t,r,a){for(let l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,a)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,hf),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),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(t,r,a,l,h){for(let d of ns(r,500)){let f=0;for(let M of d)f+=M.length;let g=this.segments.prepareSegment(f,this.layoutVertexArray,this.indexArray),v=g.vertexLength,x=[],A=[];for(let M of d){if(M.length===0)continue;M!==d[0]&&A.push(x.length/2);let z=this.segments2.prepareSegment(M.length,this.layoutVertexArray,this.indexArray2),B=z.vertexLength;this.layoutVertexArray.emplaceBack(M[0].x,M[0].y),this.indexArray2.emplaceBack(B+M.length-1,B),x.push(M[0].x),x.push(M[0].y);for(let q=1;q>3}if(l--,a===1||a===2)h+=i.readSVarint(),d+=i.readSVarint(),a===1&&(t&&f.push(t),t=[]),t.push(new Cf(h,d));else{if(a!==7)throw new Error("unknown command "+a);t&&t.push(t[0].clone())}}return t&&f.push(t),f},Ls.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var t=i.readVarint()+i.pos,r=1,a=0,l=0,h=0,d=1/0,f=-1/0,g=1/0,v=-1/0;i.pos>3}if(a--,r===1||r===2)(l+=i.readSVarint())f&&(f=l),(h+=i.readSVarint())v&&(v=h);else if(r!==7)throw new Error("unknown command "+r)}return[d,g,f,v]},Ls.prototype.toGeoJSON=function(i,t,r){var a,l,h=this.extent*Math.pow(2,r),d=this.extent*i,f=this.extent*t,g=this.loadGeometry(),v=Ls.types[this.type];function x(M){for(var z=0;z>3;l=d===1?a.readString():d===2?a.readFloat():d===3?a.readDouble():d===4?a.readVarint64():d===5?a.readVarint():d===6?a.readSVarint():d===7?a.readBoolean():null}return l}(r))}qh.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var t=this._pbf.readVarint()+this._pbf.pos;return new If(this._pbf,t,this.extent,this._keys,this._values)};var Mf=Nh;function Pf(i,t,r){if(i===3){var a=new Mf(r,r.readVarint()+r.pos);a.length&&(t[a.name]=a)}}fa.VectorTile=function(i,t){this.layers=i.readFields(Pf,{},t)},fa.VectorTileFeature=Oh,fa.VectorTileLayer=Nh;let zf=fa.VectorTileFeature.types,xc=Math.pow(2,13);function Jo(i,t,r,a,l,h,d,f){i.emplaceBack(t,r,2*Math.floor(a*xc)+d,l*xc*2,h*xc*2,Math.round(f))}class bc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new la,this.centroidVertexArray=new Bi,this.indexArray=new Nr,this.programConfigurations=new Ua(t.layers,t.zoom),this.segments=new kt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,a){this.features=[],this.hasPattern=_c("fill-extrusion",this.layers,r);for(let{feature:l,id:h,index:d,sourceLayerIndex:f}of t){let g=this.layers[0]._featureFilter.needGeometry,v=$a(l,g);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom),v,a))continue;let x={id:h,sourceLayerIndex:f,index:d,geometry:g?v.geometry:ja(l),properties:l.properties,type:l.type,patterns:{}};this.hasPattern?this.features.push(yc("fill-extrusion",this.layers,x,this.zoom,r)):this.addFeature(x,x.geometry,d,a,{}),r.featureIndex.insert(l,x.geometry,d,f,this.index,!0)}}addFeatures(t,r,a){for(let l of this.features){let{geometry:h}=l;this.addFeature(l,h,l.index,r,a)}}update(t,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,a)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Tf),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Ef.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,r,a,l,h){for(let d of ns(r,500)){let f={x:0,y:0,vertexCount:0},g=0;for(let z of d)g+=z.length;let v=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let z of d){if(z.length===0||Lf(z))continue;let B=0;for(let q=0;q=1){let ne=z[q-1];if(!Bf($,ne)){v.vertexLength+4>kt.MAX_VERTEX_ARRAY_LENGTH&&(v=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let J=$.sub(ne)._perp()._unit(),ie=ne.dist($);B+ie>32768&&(B=0),Jo(this.layoutVertexArray,$.x,$.y,J.x,J.y,0,0,B),Jo(this.layoutVertexArray,$.x,$.y,J.x,J.y,0,1,B),f.x+=2*$.x,f.y+=2*$.y,f.vertexCount+=2,B+=ie,Jo(this.layoutVertexArray,ne.x,ne.y,J.x,J.y,0,0,B),Jo(this.layoutVertexArray,ne.x,ne.y,J.x,J.y,0,1,B),f.x+=2*ne.x,f.y+=2*ne.y,f.vertexCount+=2;let ce=v.vertexLength;this.indexArray.emplaceBack(ce,ce+2,ce+1),this.indexArray.emplaceBack(ce+1,ce+2,ce+3),v.vertexLength+=4,v.primitiveLength+=2}}}}if(v.vertexLength+g>kt.MAX_VERTEX_ARRAY_LENGTH&&(v=this.segments.prepareSegment(g,this.layoutVertexArray,this.indexArray)),zf[t.type]!=="Polygon")continue;let x=[],A=[],D=v.vertexLength;for(let z of d)if(z.length!==0){z!==d[0]&&A.push(x.length/2);for(let B=0;Bbi)||i.y===t.y&&(i.y<0||i.y>bi)}function Lf(i){return i.every(t=>t.x<0)||i.every(t=>t.x>bi)||i.every(t=>t.y<0)||i.every(t=>t.y>bi)}let Vh;Ve("FillExtrusionBucket",bc,{omit:["layers","features"]});var Rf={get paint(){return Vh=Vh||new c({"fill-extrusion-opacity":new $e(oe["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new nt(oe["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new $e(oe["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new $e(oe["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Es(oe["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new nt(oe["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new nt(oe["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new $e(oe["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Ff extends n{constructor(t){super(t,Rf)}createBucket(t){return new bc(t)}queryRadius(){return ru(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(t,r,a,l,h,d,f,g){let v=nu(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),d.angle,f),x=this.paint.get("fill-extrusion-height").evaluate(r,a),A=this.paint.get("fill-extrusion-base").evaluate(r,a),D=function(z,B,q,$){let ne=[];for(let J of z){let ie=[J.x,J.y,0,1];au(ie,ie,B),ne.push(new se(ie[0]/ie[3],ie[1]/ie[3]))}return ne}(v,g),M=function(z,B,q,$){let ne=[],J=[],ie=$[8]*B,ce=$[9]*B,_e=$[10]*B,Re=$[11]*B,it=$[8]*q,Be=$[9]*q,Pe=$[10]*q,Xe=$[11]*q;for(let Ue of z){let qe=[],de=[];for(let We of Ue){let Ge=We.x,lt=We.y,Jt=$[0]*Ge+$[4]*lt+$[12],Wt=$[1]*Ge+$[5]*lt+$[13],Ti=$[2]*Ge+$[6]*lt+$[14],Jr=$[3]*Ge+$[7]*lt+$[15],Fi=Ti+_e,Ci=Jr+Re,ir=Jt+it,rr=Wt+Be,nr=Ti+Pe,gi=Jr+Xe,Di=new se((Jt+ie)/Ci,(Wt+ce)/Ci);Di.z=Fi/Ci,qe.push(Di);let Gi=new se(ir/gi,rr/gi);Gi.z=nr/gi,de.push(Gi)}ne.push(qe),J.push(de)}return[ne,J]}(l,A,x,g);return function(z,B,q){let $=1/0;vh(q,B)&&($=Uh(q,B[0]));for(let ne=0;ner.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new Cs,this.layoutVertexArray2=new ua,this.indexArray=new Nr,this.programConfigurations=new Ua(t.layers,t.zoom),this.segments=new kt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,a){this.hasPattern=_c("line",this.layers,r);let l=this.layers[0].layout.get("line-sort-key"),h=!l.isConstant(),d=[];for(let{feature:f,id:g,index:v,sourceLayerIndex:x}of t){let A=this.layers[0]._featureFilter.needGeometry,D=$a(f,A);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom),D,a))continue;let M=h?l.evaluate(D,{},a):void 0,z={id:g,properties:f.properties,type:f.type,sourceLayerIndex:x,index:v,geometry:A?D.geometry:ja(f),patterns:{},sortKey:M};d.push(z)}h&&d.sort((f,g)=>f.sortKey-g.sortKey);for(let f of d){let{geometry:g,index:v,sourceLayerIndex:x}=f;if(this.hasPattern){let A=yc("line",this.layers,f,this.zoom,r);this.patternFeatures.push(A)}else this.addFeature(f,g,v,a,{});r.featureIndex.insert(t[v].feature,g,v,x,this.index)}}update(t,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,a)}addFeatures(t,r,a){for(let l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,a)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Vf)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Nf),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,r,a,l,h){let d=this.layers[0].layout,f=d.get("line-join").evaluate(t,{}),g=d.get("line-cap"),v=d.get("line-miter-limit"),x=d.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(let A of r)this.addLine(A,t,f,g,v,x);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,h,l)}addLine(t,r,a,l,h,d){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let $=0;$=2&&t[g-1].equals(t[g-2]);)g--;let v=0;for(;v0;if(Re&&$>v){let Xe=D.dist(M);if(Xe>2*x){let Ue=D.sub(D.sub(M)._mult(x/Xe)._round());this.updateDistance(M,Ue),this.addCurrentVertex(Ue,B,0,0,A),M=Ue}}let Be=M&&z,Pe=Be?a:f?"butt":l;if(Be&&Pe==="round"&&(ceh&&(Pe="bevel"),Pe==="bevel"&&(ce>2&&(Pe="flipbevel"),ce100)ne=q.mult(-1);else{let Xe=ce*B.add(q).mag()/B.sub(q).mag();ne._perp()._mult(Xe*(it?-1:1))}this.addCurrentVertex(D,ne,0,0,A),this.addCurrentVertex(D,ne.mult(-1),0,0,A)}else if(Pe==="bevel"||Pe==="fakeround"){let Xe=-Math.sqrt(ce*ce-1),Ue=it?Xe:0,qe=it?0:Xe;if(M&&this.addCurrentVertex(D,B,Ue,qe,A),Pe==="fakeround"){let de=Math.round(180*_e/Math.PI/20);for(let We=1;We2*x){let Ue=D.add(z.sub(D)._mult(x/Xe)._round());this.updateDistance(D,Ue),this.addCurrentVertex(Ue,q,0,0,A),D=Ue}}}}addCurrentVertex(t,r,a,l,h,d=!1){let f=r.y*l-r.x,g=-r.y-r.x*l;this.addHalfVertex(t,r.x+r.y*a,r.y-r.x*a,d,!1,a,h),this.addHalfVertex(t,f,g,d,!0,-l,h),this.distance>jh/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,r,a,l,h,d))}addHalfVertex({x:t,y:r},a,l,h,d,f,g){let v=.5*(this.lineClips?this.scaledDistance*(jh-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(h?1:0),(r<<1)+(d?1:0),Math.round(63*a)+128,Math.round(63*l)+128,1+(f===0?0:f<0?-1:1)|(63&v)<<2,v>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);let x=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,x),g.primitiveLength++),d?this.e2=x:this.e1=x}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,r){this.distance+=t.dist(r),this.updateScaledDistance()}}let $h,Zh;Ve("LineBucket",wc,{omit:["layers","patternFeatures"]});var Gh={get paint(){return Zh=Zh||new c({"line-opacity":new nt(oe.paint_line["line-opacity"]),"line-color":new nt(oe.paint_line["line-color"]),"line-translate":new $e(oe.paint_line["line-translate"]),"line-translate-anchor":new $e(oe.paint_line["line-translate-anchor"]),"line-width":new nt(oe.paint_line["line-width"]),"line-gap-width":new nt(oe.paint_line["line-gap-width"]),"line-offset":new nt(oe.paint_line["line-offset"]),"line-blur":new nt(oe.paint_line["line-blur"]),"line-dasharray":new Ts(oe.paint_line["line-dasharray"]),"line-pattern":new Es(oe.paint_line["line-pattern"]),"line-gradient":new Vo(oe.paint_line["line-gradient"])})},get layout(){return $h=$h||new c({"line-cap":new $e(oe.layout_line["line-cap"]),"line-join":new nt(oe.layout_line["line-join"]),"line-miter-limit":new $e(oe.layout_line["line-miter-limit"]),"line-round-limit":new $e(oe.layout_line["line-round-limit"]),"line-sort-key":new nt(oe.layout_line["line-sort-key"])})}};class $f extends nt{possiblyEvaluate(t,r){return r=new ti(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(t,r)}evaluate(t,r,a,l){return r=He({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(t,r,a,l)}}let uu;class Zf extends n{constructor(t){super(t,Gh),this.gradientVersion=0,uu||(uu=new $f(Gh.paint.properties["line-width"].specification),uu.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){let r=this.gradientExpression();this.stepInterpolant=!!function(a){return a._styleExpression!==void 0}(r)&&r._styleExpression.expression instanceof jn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,r){super.recalculate(t,r),this.paint._values["line-floorwidth"]=uu.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new wc(t)}queryRadius(t){let r=t,a=Hh($o("line-width",this,r),$o("line-gap-width",this,r)),l=$o("line-offset",this,r);return a/2+Math.abs(l)+ru(this.paint.get("line-translate"))}queryIntersectsFeature(t,r,a,l,h,d,f){let g=nu(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),d.angle,f),v=f/2*Hh(this.paint.get("line-width").evaluate(r,a),this.paint.get("line-gap-width").evaluate(r,a)),x=this.paint.get("line-offset").evaluate(r,a);return x&&(l=function(A,D){let M=[];for(let z=0;z=3){for(let q=0;q0?t+2*i:i}let Gf=m([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Hf=m([{name:"a_projected_pos",components:3,type:"Float32"}],4);m([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let Xf=m([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);m([{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"}]);let Xh=m([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Wf=m([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Jf(i,t,r){return i.sections.forEach(a=>{a.text=function(l,h,d){let f=h.layout.get("text-transform").evaluate(d,{});return f==="uppercase"?l=l.toLocaleUpperCase():f==="lowercase"&&(l=l.toLocaleLowerCase()),dr.applyArabicShaping&&(l=dr.applyArabicShaping(l)),l}(a.text,t,r)}),i}m([{name:"triangle",components:3,type:"Uint16"}]),m([{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"}]),m([{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"}]),m([{type:"Float32",name:"offsetX"}]),m([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),m([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);let Yo={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"};var wi=24,Wh=Xt,Jh=function(i,t,r,a,l){var h,d,f=8*l-a-1,g=(1<>1,x=-7,A=r?l-1:0,D=r?-1:1,M=i[t+A];for(A+=D,h=M&(1<<-x)-1,M>>=-x,x+=f;x>0;h=256*h+i[t+A],A+=D,x-=8);for(d=h&(1<<-x)-1,h>>=-x,x+=a;x>0;d=256*d+i[t+A],A+=D,x-=8);if(h===0)h=1-v;else{if(h===g)return d?NaN:1/0*(M?-1:1);d+=Math.pow(2,a),h-=v}return(M?-1:1)*d*Math.pow(2,h-a)},Kh=function(i,t,r,a,l,h){var d,f,g,v=8*h-l-1,x=(1<>1,D=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=a?0:h-1,z=a?1:-1,B=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(f=isNaN(t)?1:0,d=x):(d=Math.floor(Math.log(t)/Math.LN2),t*(g=Math.pow(2,-d))<1&&(d--,g*=2),(t+=d+A>=1?D/g:D*Math.pow(2,1-A))*g>=2&&(d++,g/=2),d+A>=x?(f=0,d=x):d+A>=1?(f=(t*g-1)*Math.pow(2,l),d+=A):(f=t*Math.pow(2,A-1)*Math.pow(2,l),d=0));l>=8;i[r+M]=255&f,M+=z,f/=256,l-=8);for(d=d<0;i[r+M]=255&d,M+=z,d/=256,v-=8);i[r+M-z]|=128*B};function Xt(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}Xt.Varint=0,Xt.Fixed64=1,Xt.Bytes=2,Xt.Fixed32=5;var Ac=4294967296,Yh=1/Ac,Qh=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function zn(i){return i.type===Xt.Bytes?i.readVarint()+i.pos:i.pos+1}function Rs(i,t,r){return r?4294967296*t+(i>>>0):4294967296*(t>>>0)+(i>>>0)}function ep(i,t,r){var a=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));r.realloc(a);for(var l=r.pos-1;l>=i;l--)r.buf[l+a]=r.buf[l]}function Kf(i,t){for(var r=0;r>>8,i[r+2]=t>>>16,i[r+3]=t>>>24}function tp(i,t){return(i[t]|i[t+1]<<8|i[t+2]<<16)+(i[t+3]<<24)}Xt.prototype={destroy:function(){this.buf=null},readFields:function(i,t,r){for(r=r||this.length;this.pos>3,h=this.pos;this.type=7&a,i(l,t,this),this.pos===h&&this.skip(a)}return t},readMessage:function(i,t){return this.readFields(i,t,this.readVarint()+this.pos)},readFixed32:function(){var i=cu(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=tp(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=cu(this.buf,this.pos)+cu(this.buf,this.pos+4)*Ac;return this.pos+=8,i},readSFixed64:function(){var i=cu(this.buf,this.pos)+tp(this.buf,this.pos+4)*Ac;return this.pos+=8,i},readFloat:function(){var i=Jh(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Jh(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var t,r,a=this.buf;return t=127&(r=a[this.pos++]),r<128?t:(t|=(127&(r=a[this.pos++]))<<7,r<128?t:(t|=(127&(r=a[this.pos++]))<<14,r<128?t:(t|=(127&(r=a[this.pos++]))<<21,r<128?t:function(l,h,d){var f,g,v=d.buf;if(f=(112&(g=v[d.pos++]))>>4,g<128||(f|=(127&(g=v[d.pos++]))<<3,g<128)||(f|=(127&(g=v[d.pos++]))<<10,g<128)||(f|=(127&(g=v[d.pos++]))<<17,g<128)||(f|=(127&(g=v[d.pos++]))<<24,g<128)||(f|=(1&(g=v[d.pos++]))<<31,g<128))return Rs(l,f,h);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(r=a[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var i=this.readVarint()+this.pos,t=this.pos;return this.pos=i,i-t>=12&&Qh?function(r,a,l){return Qh.decode(r.subarray(a,l))}(this.buf,t,i):function(r,a,l){for(var h="",d=a;d239?4:x>223?3:x>191?2:1;if(d+D>l)break;D===1?x<128&&(A=x):D===2?(192&(f=r[d+1]))==128&&(A=(31&x)<<6|63&f)<=127&&(A=null):D===3?(g=r[d+2],(192&(f=r[d+1]))==128&&(192&g)==128&&((A=(15&x)<<12|(63&f)<<6|63&g)<=2047||A>=55296&&A<=57343)&&(A=null)):D===4&&(g=r[d+2],v=r[d+3],(192&(f=r[d+1]))==128&&(192&g)==128&&(192&v)==128&&((A=(15&x)<<18|(63&f)<<12|(63&g)<<6|63&v)<=65535||A>=1114112)&&(A=null)),A===null?(A=65533,D=1):A>65535&&(A-=65536,h+=String.fromCharCode(A>>>10&1023|55296),A=56320|1023&A),h+=String.fromCharCode(A),d+=D}return h}(this.buf,t,i)},readBytes:function(){var i=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,i);return this.pos=i,t},readPackedVarint:function(i,t){if(this.type!==Xt.Bytes)return i.push(this.readVarint(t));var r=zn(this);for(i=i||[];this.pos127;);else if(t===Xt.Bytes)this.pos=this.readVarint()+this.pos;else if(t===Xt.Fixed32)this.pos+=4;else{if(t!==Xt.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(i,t){this.writeVarint(i<<3|t)},realloc:function(i){for(var t=this.length||16;t268435455||i<0?function(t,r){var a,l;if(t>=0?(a=t%4294967296|0,l=t/4294967296|0):(l=~(-t/4294967296),4294967295^(a=~(-t%4294967296))?a=a+1|0:(a=0,l=l+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(h,d,f){f.buf[f.pos++]=127&h|128,h>>>=7,f.buf[f.pos++]=127&h|128,h>>>=7,f.buf[f.pos++]=127&h|128,h>>>=7,f.buf[f.pos++]=127&h|128,f.buf[f.pos]=127&(h>>>=7)}(a,0,r),function(h,d){var f=(7&h)<<4;d.buf[d.pos++]|=f|((h>>>=3)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h)))))}(l,r)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(!!i)},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var t=this.pos;this.pos=function(a,l,h){for(var d,f,g=0;g55295&&d<57344){if(!f){d>56319||g+1===l.length?(a[h++]=239,a[h++]=191,a[h++]=189):f=d;continue}if(d<56320){a[h++]=239,a[h++]=191,a[h++]=189,f=d;continue}d=f-55296<<10|d-56320|65536,f=null}else f&&(a[h++]=239,a[h++]=191,a[h++]=189,f=null);d<128?a[h++]=d:(d<2048?a[h++]=d>>6|192:(d<65536?a[h++]=d>>12|224:(a[h++]=d>>18|240,a[h++]=d>>12&63|128),a[h++]=d>>6&63|128),a[h++]=63&d|128)}return h}(this.buf,i,this.pos);var r=this.pos-t;r>=128&&ep(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Kh(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Kh(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var t=i.length;this.writeVarint(t),this.realloc(t);for(var r=0;r=128&&ep(r,a,this),this.pos=r-1,this.writeVarint(a),this.pos+=a},writeMessage:function(i,t,r){this.writeTag(i,Xt.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(i,t){t.length&&this.writeMessage(i,Kf,t)},writePackedSVarint:function(i,t){t.length&&this.writeMessage(i,Yf,t)},writePackedBoolean:function(i,t){t.length&&this.writeMessage(i,tm,t)},writePackedFloat:function(i,t){t.length&&this.writeMessage(i,Qf,t)},writePackedDouble:function(i,t){t.length&&this.writeMessage(i,em,t)},writePackedFixed32:function(i,t){t.length&&this.writeMessage(i,im,t)},writePackedSFixed32:function(i,t){t.length&&this.writeMessage(i,rm,t)},writePackedFixed64:function(i,t){t.length&&this.writeMessage(i,nm,t)},writePackedSFixed64:function(i,t){t.length&&this.writeMessage(i,am,t)},writeBytesField:function(i,t){this.writeTag(i,Xt.Bytes),this.writeBytes(t)},writeFixed32Field:function(i,t){this.writeTag(i,Xt.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(i,t){this.writeTag(i,Xt.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(i,t){this.writeTag(i,Xt.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(i,t){this.writeTag(i,Xt.Fixed64),this.writeSFixed64(t)},writeVarintField:function(i,t){this.writeTag(i,Xt.Varint),this.writeVarint(t)},writeSVarintField:function(i,t){this.writeTag(i,Xt.Varint),this.writeSVarint(t)},writeStringField:function(i,t){this.writeTag(i,Xt.Bytes),this.writeString(t)},writeFloatField:function(i,t){this.writeTag(i,Xt.Fixed32),this.writeFloat(t)},writeDoubleField:function(i,t){this.writeTag(i,Xt.Fixed64),this.writeDouble(t)},writeBooleanField:function(i,t){this.writeVarintField(i,!!t)}};var Ec=ue(Wh);let Tc=3;function sm(i,t,r){i===1&&r.readMessage(om,t)}function om(i,t,r){if(i===3){let{id:a,bitmap:l,width:h,height:d,left:f,top:g,advance:v}=r.readMessage(lm,{});t.push({id:a,bitmap:new Go({width:h+2*Tc,height:d+2*Tc},l),metrics:{width:h,height:d,left:f,top:g,advance:v}})}}function lm(i,t,r){i===1?t.id=r.readVarint():i===2?t.bitmap=r.readBytes():i===3?t.width=r.readVarint():i===4?t.height=r.readVarint():i===5?t.left=r.readSVarint():i===6?t.top=r.readSVarint():i===7&&(t.advance=r.readVarint())}let ip=Tc;function rp(i){let t=0,r=0;for(let d of i)t+=d.w*d.h,r=Math.max(r,d.w);i.sort((d,f)=>f.h-d.h);let a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}],l=0,h=0;for(let d of i)for(let f=a.length-1;f>=0;f--){let g=a[f];if(!(d.w>g.w||d.h>g.h)){if(d.x=g.x,d.y=g.y,h=Math.max(h,d.y+d.h),l=Math.max(l,d.x+d.w),d.w===g.w&&d.h===g.h){let v=a.pop();f=0&&a>=t&&pu[this.text.charCodeAt(a)];a--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)}substring(t,r){let a=new Os;return a.text=this.text.substring(t,r),a.sectionIndex=this.sectionIndex.slice(t,r),a.sections=this.sections,a}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,r)=>Math.max(t,this.sections[r].scale),0)}addTextSection(t,r){this.text+=t.text,this.sections.push(el.forText(t.scale,t.fontStack||r));let a=this.sections.length-1;for(let l=0;l=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function hu(i,t,r,a,l,h,d,f,g,v,x,A,D,M,z){let B=Os.fromFeature(i,l),q;A===E.ah.vertical&&B.verticalizePunctuation();let{processBidirectionalText:$,processStyledBidirectionalText:ne}=dr;if($&&B.sections.length===1){q=[];let ce=$(B.toString(),Dc(B,v,h,t,a,M));for(let _e of ce){let Re=new Os;Re.text=_e,Re.sections=B.sections;for(let it=0;it<_e.length;it++)Re.sectionIndex.push(0);q.push(Re)}}else if(ne){q=[];let ce=ne(B.text,B.sectionIndex,Dc(B,v,h,t,a,M));for(let _e of ce){let Re=new Os;Re.text=_e[0],Re.sectionIndex=_e[1],Re.sections=B.sections,q.push(Re)}}else q=function(ce,_e){let Re=[],it=ce.text,Be=0;for(let Pe of _e)Re.push(ce.substring(Be,Pe)),Be=Pe;return Be0&&Bn>Ni&&(Ni=Bn)}else{let jr=Re[Ot.fontStack],Mi=jr&&jr[ai];if(Mi&&Mi.rect)Us=Mi.rect,pi=Mi.metrics;else{let Bn=_e[Ot.fontStack],sl=Bn&&Bn[ai];if(!sl)continue;pi=sl.metrics}Cr=(Di-Ot.scale)*wi}Kr?(ce.verticalizable=!0,ar.push({glyph:ai,imageName:dn,x:lt,y:Jt+Cr,vertical:Kr,scale:Ot.scale,fontStack:Ot.fontStack,sectionIndex:Qt,metrics:pi,rect:Us}),lt+=fn*Ot.scale+de):(ar.push({glyph:ai,imageName:dn,x:lt,y:Jt+Cr,vertical:Kr,scale:Ot.scale,fontStack:Ot.fontStack,sectionIndex:Qt,metrics:pi,rect:Us}),lt+=pi.advance*Ot.scale+de)}ar.length!==0&&(Wt=Math.max(lt-de,Wt),pm(ar,0,ar.length-1,Jr,Ni)),lt=0;let Ur=Pe*Di+Ni;Oi.lineOffset=Math.max(Ni,Gi),Jt+=Ur,Ti=Math.max(Ur,Ti),++Fi}var Ci;let ir=Jt-Qo,{horizontalAlign:rr,verticalAlign:nr}=Sc(Xe);(function(gi,Di,Gi,Oi,ar,Ni,Ur,gr,Ot){let Qt=(Di-Gi)*ar,ai=0;ai=Ni!==Ur?-gr*Oi-Qo:(-Oi*Ot+.5)*Ur;for(let Cr of gi)for(let pi of Cr.positionedGlyphs)pi.x+=Qt,pi.y+=ai})(ce.positionedLines,Jr,rr,nr,Wt,Ti,Pe,ir,Be.length),ce.top+=-nr*ir,ce.bottom=ce.top+ir,ce.left+=-rr*Wt,ce.right=ce.left+Wt}(ie,t,r,a,q,d,f,g,A,v,D,z),!function(ce){for(let _e of ce)if(_e.positionedGlyphs.length!==0)return!1;return!0}(J)&&ie}let pu={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},um={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},cm={40:!0};function ap(i,t,r,a,l,h){if(t.imageName){let d=a[t.imageName];return d?d.displaySize[0]*t.scale*wi/h+l:0}{let d=r[t.fontStack],f=d&&d[i];return f?f.metrics.advance*t.scale+l:0}}function sp(i,t,r,a){let l=Math.pow(i-t,2);return a?i=0,v=0;for(let A=0;Av){let x=Math.ceil(h/v);l*=x/d,d=x}return{x1:a,y1:l,x2:a+h,y2:l+d}}function cp(i,t,r,a,l,h){let d=i.image,f;if(d.content){let q=d.content,$=d.pixelRatio||1;f=[q[0]/$,q[1]/$,d.displaySize[0]-q[2]/$,d.displaySize[1]-q[3]/$]}let g=t.left*h,v=t.right*h,x,A,D,M;r==="width"||r==="both"?(M=l[0]+g-a[3],A=l[0]+v+a[1]):(M=l[0]+(g+v-d.displaySize[0])/2,A=M+d.displaySize[0]);let z=t.top*h,B=t.bottom*h;return r==="height"||r==="both"?(x=l[1]+z-a[0],D=l[1]+B+a[2]):(x=l[1]+(z+B-d.displaySize[1])/2,D=x+d.displaySize[1]),{image:d,top:x,right:A,bottom:D,left:M,collisionPadding:f}}let tl=255,pn=128,ga=tl*pn;function hp(i,t){let{expression:r}=t;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new ti(i+1))};if(r.kind==="source")return{kind:"source"};{let{zoomStops:a,interpolationType:l}=r,h=0;for(;hd.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=hc([]),this.placementViewportMatrix=hc([]);let r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=hp(this.zoom,r["text-size"]),this.iconSizeData=hp(this.zoom,r["icon-size"]);let a=this.layers[0].layout,l=a.get("symbol-sort-key"),h=a.get("symbol-z-order");this.canOverlap=Ic(a,"text-overlap","text-allow-overlap")!=="never"||Ic(a,"icon-overlap","icon-allow-overlap")!=="never"||a.get("text-ignore-placement")||a.get("icon-ignore-placement"),this.sortFeaturesByKey=h!=="viewport-y"&&!l.isConstant(),this.sortFeaturesByY=(h==="viewport-y"||h==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,a.get("symbol-placement")==="point"&&(this.writingModes=a.get("text-writing-mode").map(d=>E.ah[d])),this.stateDependentLayerIds=this.layers.filter(d=>d.isStateDependent()).map(d=>d.id),this.sourceID=t.sourceID}createArrays(){this.text=new Mc(new Ua(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new Mc(new Ua(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new ri,this.lineVertexArray=new zi,this.symbolInstances=new St,this.textAnchorOffsets=new ni}calculateGlyphDependencies(t,r,a,l,h){for(let d=0;d0)&&(d.value.kind!=="constant"||d.value.value.length>0),x=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,A=h.get("symbol-sort-key");if(this.features=[],!v&&!x)return;let D=r.iconDependencies,M=r.glyphDependencies,z=r.availableImages,B=new ti(this.zoom);for(let{feature:q,id:$,index:ne,sourceLayerIndex:J}of t){let ie=l._featureFilter.needGeometry,ce=$a(q,ie);if(!l._featureFilter.filter(B,ce,a))continue;let _e,Re;if(ie||(ce.geometry=ja(q)),v){let Be=l.getValueAndResolveTokens("text-field",ce,a,z),Pe=ur.factory(Be),Xe=this.hasRTLText=this.hasRTLText||gm(Pe);(!Xe||dr.getRTLTextPluginStatus()==="unavailable"||Xe&&dr.isParsed())&&(_e=Jf(Pe,l,ce))}if(x){let Be=l.getValueAndResolveTokens("icon-image",ce,a,z);Re=Be instanceof hr?Be:hr.fromString(Be)}if(!_e&&!Re)continue;let it=this.sortFeaturesByKey?A.evaluate(ce,{},a):void 0;if(this.features.push({id:$,text:_e,icon:Re,index:ne,sourceLayerIndex:J,geometry:ce.geometry,properties:q.properties,type:fm[q.type],sortKey:it}),Re&&(D[Re.name]=!0),_e){let Be=d.evaluate(ce,{},a).join(","),Pe=h.get("text-rotation-alignment")!=="viewport"&&h.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(E.ah.vertical)>=0;for(let Xe of _e.sections)if(Xe.image)D[Xe.image.name]=!0;else{let Ue=Fo(_e.toString()),qe=Xe.fontStack||Be,de=M[qe]=M[qe]||{};this.calculateGlyphDependencies(Xe.text,de,Pe,this.allowVerticalPlacement,Ue)}}}h.get("symbol-placement")==="line"&&(this.features=function(q){let $={},ne={},J=[],ie=0;function ce(Be){J.push(q[Be]),ie++}function _e(Be,Pe,Xe){let Ue=ne[Be];return delete ne[Be],ne[Pe]=Ue,J[Ue].geometry[0].pop(),J[Ue].geometry[0]=J[Ue].geometry[0].concat(Xe[0]),Ue}function Re(Be,Pe,Xe){let Ue=$[Pe];return delete $[Pe],$[Be]=Ue,J[Ue].geometry[0].shift(),J[Ue].geometry[0]=Xe[0].concat(J[Ue].geometry[0]),Ue}function it(Be,Pe,Xe){let Ue=Xe?Pe[0][Pe[0].length-1]:Pe[0][0];return`${Be}:${Ue.x}:${Ue.y}`}for(let Be=0;BeBe.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((q,$)=>q.sortKey-$.sortKey)}update(t,r,a){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,r,this.layers,a),this.icon.programConfigurations.updatePaintArrays(t,r,this.layers,a))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,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(t,r){let a=this.lineVertexArray.length;if(t.segment!==void 0){let l=t.dist(r[t.segment+1]),h=t.dist(r[t.segment]),d={};for(let f=t.segment+1;f=0;f--)d[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:h},f>0&&(h+=r[f-1].dist(r[f]));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(t,r){let a=t.placedSymbolArray.get(r),l=a.vertexStartIndex+4*a.numGlyphs;for(let h=a.vertexStartIndex;hl[f]-l[g]||h[g]-h[f]),d}addToSortKeyRanges(t,r){let a=this.sortKeyRanges[this.sortKeyRanges.length-1];a&&a.sortKey===r?a.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let r of this.symbolInstanceIndexes){let a=this.symbolInstances.get(r);this.featureSortOrder.push(a.featureIndex),[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex].forEach((l,h,d)=>{l>=0&&d.indexOf(l)===h&&this.addIndicesForPlacedSymbol(this.text,l)}),a.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,a.verticalPlacedTextSymbolIndex),a.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.placedIconSymbolIndex),a.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let pp,dp;Ve("SymbolBucket",Ns,{omit:["layers","collisionBoxArray","features","compareText"]}),Ns.MAX_GLYPHS=65535,Ns.addDynamicAttributes=kc;var zc={get paint(){return dp=dp||new c({"icon-opacity":new nt(oe.paint_symbol["icon-opacity"]),"icon-color":new nt(oe.paint_symbol["icon-color"]),"icon-halo-color":new nt(oe.paint_symbol["icon-halo-color"]),"icon-halo-width":new nt(oe.paint_symbol["icon-halo-width"]),"icon-halo-blur":new nt(oe.paint_symbol["icon-halo-blur"]),"icon-translate":new $e(oe.paint_symbol["icon-translate"]),"icon-translate-anchor":new $e(oe.paint_symbol["icon-translate-anchor"]),"text-opacity":new nt(oe.paint_symbol["text-opacity"]),"text-color":new nt(oe.paint_symbol["text-color"],{runtimeType:Si,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new nt(oe.paint_symbol["text-halo-color"]),"text-halo-width":new nt(oe.paint_symbol["text-halo-width"]),"text-halo-blur":new nt(oe.paint_symbol["text-halo-blur"]),"text-translate":new $e(oe.paint_symbol["text-translate"]),"text-translate-anchor":new $e(oe.paint_symbol["text-translate-anchor"])})},get layout(){return pp=pp||new c({"symbol-placement":new $e(oe.layout_symbol["symbol-placement"]),"symbol-spacing":new $e(oe.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new $e(oe.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new nt(oe.layout_symbol["symbol-sort-key"]),"symbol-z-order":new $e(oe.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new $e(oe.layout_symbol["icon-allow-overlap"]),"icon-overlap":new $e(oe.layout_symbol["icon-overlap"]),"icon-ignore-placement":new $e(oe.layout_symbol["icon-ignore-placement"]),"icon-optional":new $e(oe.layout_symbol["icon-optional"]),"icon-rotation-alignment":new $e(oe.layout_symbol["icon-rotation-alignment"]),"icon-size":new nt(oe.layout_symbol["icon-size"]),"icon-text-fit":new $e(oe.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new $e(oe.layout_symbol["icon-text-fit-padding"]),"icon-image":new nt(oe.layout_symbol["icon-image"]),"icon-rotate":new nt(oe.layout_symbol["icon-rotate"]),"icon-padding":new nt(oe.layout_symbol["icon-padding"]),"icon-keep-upright":new $e(oe.layout_symbol["icon-keep-upright"]),"icon-offset":new nt(oe.layout_symbol["icon-offset"]),"icon-anchor":new nt(oe.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new $e(oe.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new $e(oe.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new $e(oe.layout_symbol["text-rotation-alignment"]),"text-field":new nt(oe.layout_symbol["text-field"]),"text-font":new nt(oe.layout_symbol["text-font"]),"text-size":new nt(oe.layout_symbol["text-size"]),"text-max-width":new nt(oe.layout_symbol["text-max-width"]),"text-line-height":new $e(oe.layout_symbol["text-line-height"]),"text-letter-spacing":new nt(oe.layout_symbol["text-letter-spacing"]),"text-justify":new nt(oe.layout_symbol["text-justify"]),"text-radial-offset":new nt(oe.layout_symbol["text-radial-offset"]),"text-variable-anchor":new $e(oe.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new nt(oe.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new nt(oe.layout_symbol["text-anchor"]),"text-max-angle":new $e(oe.layout_symbol["text-max-angle"]),"text-writing-mode":new $e(oe.layout_symbol["text-writing-mode"]),"text-rotate":new nt(oe.layout_symbol["text-rotate"]),"text-padding":new $e(oe.layout_symbol["text-padding"]),"text-keep-upright":new $e(oe.layout_symbol["text-keep-upright"]),"text-transform":new nt(oe.layout_symbol["text-transform"]),"text-offset":new nt(oe.layout_symbol["text-offset"]),"text-allow-overlap":new $e(oe.layout_symbol["text-allow-overlap"]),"text-overlap":new $e(oe.layout_symbol["text-overlap"]),"text-ignore-placement":new $e(oe.layout_symbol["text-ignore-placement"]),"text-optional":new $e(oe.layout_symbol["text-optional"])})}};class fp{constructor(t){if(t.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:Pr,this.defaultValue=t}evaluate(t){if(t.formattedSection){let r=this.defaultValue.property.overrides;if(r&&r.hasOverride(t.formattedSection))return r.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Ve("FormatSectionOverride",fp,{omit:["defaultValue"]});class fu extends n{constructor(t){super(t,zc)}recalculate(t,r){if(super.recalculate(t,r),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"){let a=this.layout.get("text-writing-mode");if(a){let l=[];for(let h of a)l.indexOf(h)<0&&l.push(h);this.layout._values["text-writing-mode"]=l}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,r,a,l){let h=this.layout.get(t).evaluate(r,{},a,l),d=this._unevaluatedLayout._values[t];return d.isDataDriven()||ps(d.value)||!h?h:function(f,g){return g.replace(/{([^{}]+)}/g,(v,x)=>f&&x in f?String(f[x]):"")}(r.properties,h)}createBucket(t){return new Ns(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let t of zc.paint.overridableProperties){if(!fu.hasPaintOverride(this.layout,t))continue;let r=this.paint.get(t),a=new fp(r),l=new hs(a,r.property.specification),h=null;h=r.value.kind==="constant"||r.value.kind==="source"?new Yn("source",l):new Qn("composite",l,r.value.zoomStops),this.paint._values[t]=new Xr(r.property,h,r.parameters)}}_handleOverridablePaintPropertyUpdate(t,r,a){return!(!this.layout||r.isDataDriven()||a.isDataDriven())&&fu.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,r){let a=t.get("text-field"),l=zc.paint.properties[r],h=!1,d=f=>{for(let g of f)if(l.overrides&&l.overrides.hasOverride(g))return void(h=!0)};if(a.value.kind==="constant"&&a.value.value instanceof ur)d(a.value.value.sections);else if(a.value.kind==="source"){let f=v=>{h||(v instanceof zr&&xi(v.value)===yr?d(v.value.sections):v instanceof is?d(v.sections):v.eachChild(f))},g=a.value;g._styleExpression&&f(g._styleExpression.expression)}return h}}let mp;var _m={get paint(){return mp=mp||new c({"background-color":new $e(oe.paint_background["background-color"]),"background-pattern":new Ts(oe.paint_background["background-pattern"]),"background-opacity":new $e(oe.paint_background["background-opacity"])})}};class ym extends n{constructor(t){super(t,_m)}}let gp;var vm={get paint(){return gp=gp||new c({"raster-opacity":new $e(oe.paint_raster["raster-opacity"]),"raster-hue-rotate":new $e(oe.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new $e(oe.paint_raster["raster-brightness-min"]),"raster-brightness-max":new $e(oe.paint_raster["raster-brightness-max"]),"raster-saturation":new $e(oe.paint_raster["raster-saturation"]),"raster-contrast":new $e(oe.paint_raster["raster-contrast"]),"raster-resampling":new $e(oe.paint_raster["raster-resampling"]),"raster-fade-duration":new $e(oe.paint_raster["raster-fade-duration"])})}};class xm extends n{constructor(t){super(t,vm)}}class bm extends n{constructor(t){super(t,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=t}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 wm{constructor(t){this._methodToThrottle=t,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=()=>{}}}let Bc=63710088e-1;class _a{constructor(t,r){if(isNaN(t)||isNaN(r))throw new Error(`Invalid LngLat object: (${t}, ${r})`);if(this.lng=+t,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new _a(Me(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){let r=Math.PI/180,a=this.lat*r,l=t.lat*r,h=Math.sin(a)*Math.sin(l)+Math.cos(a)*Math.cos(l)*Math.cos((t.lng-this.lng)*r);return Bc*Math.acos(Math.min(h,1))}static convert(t){if(t instanceof _a)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new _a(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new _a(Number("lng"in t?t.lng:t.lon),Number(t.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 [, ]")}}let _p=2*Math.PI*Bc;function yp(i){return _p*Math.cos(i*Math.PI/180)}function vp(i){return(180+i)/360}function xp(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function bp(i,t){return i/yp(t)}function Lc(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class il{constructor(t,r,a=0){this.x=+t,this.y=+r,this.z=+a}static fromLngLat(t,r=0){let a=_a.convert(t);return new il(vp(a.lng),xp(a.lat),bp(r,a.lat))}toLngLat(){return new _a(360*this.x-180,Lc(this.y))}toAltitude(){return this.z*yp(Lc(this.y))}meterInMercatorCoordinateUnits(){return 1/_p*(t=Lc(this.y),1/Math.cos(t*Math.PI/180));var t}}function wp(i,t,r){var a=2*Math.PI*6378137/256/Math.pow(2,r);return[i*a-2*Math.PI*6378137/2,t*a-2*Math.PI*6378137/2]}class Rc{constructor(t,r,a){if(!function(l,h,d){return!(l<0||l>25||d<0||d>=Math.pow(2,l)||h<0||h>=Math.pow(2,l))}(t,r,a))throw new Error(`x=${r}, y=${a}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=r,this.y=a,this.key=rl(0,t,t,r,a)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,r,a){let l=(d=this.y,f=this.z,g=wp(256*(h=this.x),256*(d=Math.pow(2,f)-d-1),f),v=wp(256*(h+1),256*(d+1),f),g[0]+","+g[1]+","+v[0]+","+v[1]);var h,d,f,g,v;let x=function(A,D,M){let z,B="";for(let q=A;q>0;q--)z=1<1?"@2x":"").replace(/{quadkey}/g,x).replace(/{bbox-epsg-3857}/g,l)}isChildOf(t){let r=this.z-t.z;return r>0&&t.x===this.x>>r&&t.y===this.y>>r}getTilePoint(t){let r=Math.pow(2,this.z);return new se((t.x*r-this.x)*bi,(t.y*r-this.y)*bi)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Ap{constructor(t,r){this.wrap=t,this.canonical=r,this.key=rl(t,r.z,r.z,r.x,r.y)}}class Vr{constructor(t,r,a,l,h){if(t= z; overscaledZ = ${t}; z = ${a}`);this.overscaledZ=t,this.wrap=r,this.canonical=new Rc(a,+l,+h),this.key=rl(r,t,a,l,h)}clone(){return new Vr(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);let r=this.canonical.z-t;return t>this.canonical.z?new Vr(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Vr(t,this.wrap,t,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(t,r){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);let a=this.canonical.z-t;return t>this.canonical.z?rl(this.wrap*+r,t,this.canonical.z,this.canonical.x,this.canonical.y):rl(this.wrap*+r,t,t,this.canonical.x>>a,this.canonical.y>>a)}isChildOf(t){if(t.wrap!==this.wrap)return!1;let r=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ>r&&t.canonical.y===this.canonical.y>>r}children(t){if(this.overscaledZ>=t)return[new Vr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,a=2*this.canonical.x,l=2*this.canonical.y;return[new Vr(r,this.wrap,r,a,l),new Vr(r,this.wrap,r,a+1,l),new Vr(r,this.wrap,r,a,l+1),new Vr(r,this.wrap,r,a+1,l+1)]}isLessThan(t){return this.wrapt.wrap)&&(this.overscaledZt.overscaledZ)&&(this.canonical.xt.canonical.x)&&this.canonical.ythis.max&&(this.max=A),A=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(t+1)}unpack(t,r,a){return t*this.redFactor+r*this.greenFactor+a*this.blueFactor-this.baseShift}getPixels(){return new qr({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,r,a){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let l=r*this.dim,h=r*this.dim+this.dim,d=a*this.dim,f=a*this.dim+this.dim;switch(r){case-1:l=h-1;break;case 1:h=l+1}switch(a){case-1:d=f-1;break;case 1:f=d+1}let g=-r*this.dim,v=-a*this.dim;for(let x=d;x=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class Cp{constructor(t,r,a,l,h){this.type="Feature",this._vectorTileFeature=t,t._z=r,t._x=a,t._y=l,this.properties=t.properties,this.id=h}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(t){this._geometry=t}toJSON(){let t={geometry:this.geometry};for(let r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(t[r]=this[r]);return t}}class Dp{constructor(t,r){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new ra(bi,16,0),this.grid3D=new ra(bi,16,0),this.featureIndexArray=new $i,this.promoteId=r}insert(t,r,a,l,h,d){let f=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(a,l,h);let g=d?this.grid3D:this.grid;for(let v=0;v=0&&A[3]>=0&&g.insert(f,A[0],A[1],A[2],A[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new fa.VectorTile(new Ec(this.rawTileData)).layers,this.sourceLayerCoder=new Tp(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,r,a,l){this.loadVTLayers();let h=t.params||{},d=bi/t.tileSize/t.scale,f=wo(h.filter),g=t.queryGeometry,v=t.queryPadding*d,x=Ip(g),A=this.grid.query(x.minX-v,x.minY-v,x.maxX+v,x.maxY+v),D=Ip(t.cameraQueryGeometry),M=this.grid3D.query(D.minX-v,D.minY-v,D.maxX+v,D.maxY+v,(q,$,ne,J)=>function(ie,ce,_e,Re,it){for(let Pe of ie)if(ce<=Pe.x&&_e<=Pe.y&&Re>=Pe.x&&it>=Pe.y)return!0;let Be=[new se(ce,_e),new se(ce,it),new se(Re,it),new se(Re,_e)];if(ie.length>2){for(let Pe of Be)if(Ps(ie,Pe))return!0}for(let Pe=0;Pe(J||(J=ja(ie)),ce.queryIntersectsFeature(g,ie,_e,J,this.z,t.transform,d,t.pixelPosMatrix)))}return z}loadMatchingFeature(t,r,a,l,h,d,f,g,v,x,A){let D=this.bucketLayerIDs[r];if(d&&!function(q,$){for(let ne=0;ne=0)return!0;return!1}(d,D))return;let M=this.sourceLayerCoder.decode(a),z=this.vtLayers[M].feature(l);if(h.needGeometry){let q=$a(z,!0);if(!h.filter(new ti(this.tileID.overscaledZ),q,this.tileID.canonical))return}else if(!h.filter(new ti(this.tileID.overscaledZ),z))return;let B=this.getId(z,M);for(let q=0;q{let f=t instanceof Na?t.get(d):null;return f&&f.evaluate?f.evaluate(r,a,l):f})}function Ip(i){let t=1/0,r=1/0,a=-1/0,l=-1/0;for(let h of i)t=Math.min(t,h.x),r=Math.min(r,h.y),a=Math.max(a,h.x),l=Math.max(l,h.y);return{minX:t,minY:r,maxX:a,maxY:l}}function Am(i,t){return t-i}function kp(i,t,r,a,l){let h=[];for(let d=0;d=a&&A.x>=a||(x.x>=a?x=new se(a,x.y+(a-x.x)/(A.x-x.x)*(A.y-x.y))._round():A.x>=a&&(A=new se(a,x.y+(a-x.x)/(A.x-x.x)*(A.y-x.y))._round()),x.y>=l&&A.y>=l||(x.y>=l?x=new se(x.x+(l-x.y)/(A.y-x.y)*(A.x-x.x),l)._round():A.y>=l&&(A=new se(x.x+(l-x.y)/(A.y-x.y)*(A.x-x.x),l)._round()),g&&x.equals(g[g.length-1])||(g=[x],h.push(g)),g.push(A)))))}}return h}Ve("FeatureIndex",Dp,{omit:["rawTileData","sourceLayerCoder"]});class ya extends se{constructor(t,r,a,l){super(t,r),this.angle=a,l!==void 0&&(this.segment=l)}clone(){return new ya(this.x,this.y,this.angle,this.segment)}}function Mp(i,t,r,a,l){if(t.segment===void 0||r===0)return!0;let h=t,d=t.segment+1,f=0;for(;f>-r/2;){if(d--,d<0)return!1;f-=i[d].dist(h),h=i[d]}f+=i[d].dist(i[d+1]),d++;let g=[],v=0;for(;fa;)v-=g.shift().angleDelta;if(v>l)return!1;d++,f+=x.dist(A)}return!0}function Pp(i){let t=0;for(let r=0;rv){let z=(v-g)/M,B=Yi.number(A.x,D.x,z),q=Yi.number(A.y,D.y,z),$=new ya(B,q,D.angleTo(A),x);return $._round(),!d||Mp(i,$,f,d,t)?$:void 0}g+=M}}function Tm(i,t,r,a,l,h,d,f,g){let v=zp(a,h,d),x=Bp(a,l),A=x*d,D=i[0].x===0||i[0].x===g||i[0].y===0||i[0].y===g;return t-A=0&&ie=0&&ce=0&&D+v<=x){let _e=new ya(ie,ce,ne,z);_e._round(),a&&!Mp(i,_e,h,a,l)||M.push(_e)}}A+=$}return f||M.length||d||(M=Lp(i,A/2,r,a,l,h,d,!0,g)),M}Ve("Anchor",ya);let qs=mr;function Rp(i,t,r,a){let l=[],h=i.image,d=h.pixelRatio,f=h.paddedRect.w-2*qs,g=h.paddedRect.h-2*qs,v={x1:i.left,y1:i.top,x2:i.right,y2:i.bottom},x=h.stretchX||[[0,f]],A=h.stretchY||[[0,g]],D=(de,We)=>de+We[1]-We[0],M=x.reduce(D,0),z=A.reduce(D,0),B=f-M,q=g-z,$=0,ne=M,J=0,ie=z,ce=0,_e=B,Re=0,it=q;if(h.content&&a){let de=h.content,We=de[2]-de[0],Ge=de[3]-de[1];(h.textFitWidth||h.textFitHeight)&&(v=up(i)),$=mu(x,0,de[0]),J=mu(A,0,de[1]),ne=mu(x,de[0],de[2]),ie=mu(A,de[1],de[3]),ce=de[0]-$,Re=de[1]-J,_e=We-ne,it=Ge-ie}let Be=v.x1,Pe=v.y1,Xe=v.x2-Be,Ue=v.y2-Pe,qe=(de,We,Ge,lt)=>{let Jt=gu(de.stretch-$,ne,Xe,Be),Wt=_u(de.fixed-ce,_e,de.stretch,M),Ti=gu(We.stretch-J,ie,Ue,Pe),Jr=_u(We.fixed-Re,it,We.stretch,z),Fi=gu(Ge.stretch-$,ne,Xe,Be),Ci=_u(Ge.fixed-ce,_e,Ge.stretch,M),ir=gu(lt.stretch-J,ie,Ue,Pe),rr=_u(lt.fixed-Re,it,lt.stretch,z),nr=new se(Jt,Ti),gi=new se(Fi,Ti),Di=new se(Fi,ir),Gi=new se(Jt,ir),Oi=new se(Wt/d,Jr/d),ar=new se(Ci/d,rr/d),Ni=t*Math.PI/180;if(Ni){let Ot=Math.sin(Ni),Qt=Math.cos(Ni),ai=[Qt,-Ot,Ot,Qt];nr._matMult(ai),gi._matMult(ai),Gi._matMult(ai),Di._matMult(ai)}let Ur=de.stretch+de.fixed,gr=We.stretch+We.fixed;return{tl:nr,tr:gi,bl:Gi,br:Di,tex:{x:h.paddedRect.x+qs+Ur,y:h.paddedRect.y+qs+gr,w:Ge.stretch+Ge.fixed-Ur,h:lt.stretch+lt.fixed-gr},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Oi,pixelOffsetBR:ar,minFontScaleX:_e/d/Xe,minFontScaleY:it/d/Ue,isSDF:r}};if(a&&(h.stretchX||h.stretchY)){let de=Fp(x,B,M),We=Fp(A,q,z);for(let Ge=0;Ge0&&(B=Math.max(10,B),this.circleDiameter=B)}else{let D=!((A=d.image)===null||A===void 0)&&A.content&&(d.image.textFitWidth||d.image.textFitHeight)?up(d):{x1:d.left,y1:d.top,x2:d.right,y2:d.bottom};D.y1=D.y1*f-g[0],D.y2=D.y2*f+g[2],D.x1=D.x1*f-g[3],D.x2=D.x2*f+g[1];let M=d.collisionPadding;if(M&&(D.x1-=M[0]*f,D.y1-=M[1]*f,D.x2+=M[2]*f,D.y2+=M[3]*f),x){let z=new se(D.x1,D.y1),B=new se(D.x2,D.y1),q=new se(D.x1,D.y2),$=new se(D.x2,D.y2),ne=x*Math.PI/180;z._rotate(ne),B._rotate(ne),q._rotate(ne),$._rotate(ne),D.x1=Math.min(z.x,B.x,q.x,$.x),D.x2=Math.max(z.x,B.x,q.x,$.x),D.y1=Math.min(z.y,B.y,q.y,$.y),D.y2=Math.max(z.y,B.y,q.y,$.y)}t.emplaceBack(r.x,r.y,D.x1,D.y1,D.x2,D.y2,a,l,h)}this.boxEndIndex=t.length}}class Cm{constructor(t=[],r=(a,l)=>al?1:0){if(this.data=t,this.length=this.data.length,this.compare=r,this.length>0)for(let a=(this.length>>1)-1;a>=0;a--)this._down(a)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;let t=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:r,compare:a}=this,l=r[t];for(;t>0;){let h=t-1>>1,d=r[h];if(a(l,d)>=0)break;r[t]=d,t=h}r[t]=l}_down(t){let{data:r,compare:a}=this,l=this.length>>1,h=r[t];for(;t=0)break;r[t]=r[d],t=d}r[t]=h}}function Dm(i,t=1,r=!1){let a=1/0,l=1/0,h=-1/0,d=-1/0,f=i[0];for(let M=0;Mh)&&(h=z.x),(!M||z.y>d)&&(d=z.y)}let g=Math.min(h-a,d-l),v=g/2,x=new Cm([],Sm);if(g===0)return new se(a,l);for(let M=a;MA.d||!A.d)&&(A=M,r&&console.log("found best %d after %d probes",Math.round(1e4*M.d)/1e4,D)),M.max-A.d<=t||(v=M.h/2,x.push(new Vs(M.p.x-v,M.p.y-v,v,i)),x.push(new Vs(M.p.x+v,M.p.y-v,v,i)),x.push(new Vs(M.p.x-v,M.p.y+v,v,i)),x.push(new Vs(M.p.x+v,M.p.y+v,v,i)),D+=4)}return r&&(console.log(`num probes: ${D}`),console.log(`best distance: ${A.d}`)),A.p}function Sm(i,t){return t.max-i.max}function Vs(i,t,r,a){this.p=new se(i,t),this.h=r,this.d=function(l,h){let d=!1,f=1/0;for(let g=0;gl.y!=z.y>l.y&&l.x<(z.x-M.x)*(l.y-M.y)/(z.y-M.y)+M.x&&(d=!d),f=Math.min(f,xh(l,M,z))}}return(d?1:-1)*Math.sqrt(f)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}var Ri;E.aq=void 0,(Ri=E.aq||(E.aq={}))[Ri.center=1]="center",Ri[Ri.left=2]="left",Ri[Ri.right=3]="right",Ri[Ri.top=4]="top",Ri[Ri.bottom=5]="bottom",Ri[Ri["top-left"]=6]="top-left",Ri[Ri["top-right"]=7]="top-right",Ri[Ri["bottom-left"]=8]="bottom-left",Ri[Ri["bottom-right"]=9]="bottom-right";let va=7,Fc=Number.POSITIVE_INFINITY;function Op(i,t){return t[1]!==Fc?function(r,a,l){let h=0,d=0;switch(a=Math.abs(a),l=Math.abs(l),r){case"top-right":case"top-left":case"top":d=l-va;break;case"bottom-right":case"bottom-left":case"bottom":d=-l+va}switch(r){case"top-right":case"bottom-right":case"right":h=-a;break;case"top-left":case"bottom-left":case"left":h=a}return[h,d]}(i,t[0],t[1]):function(r,a){let l=0,h=0;a<0&&(a=0);let d=a/Math.SQRT2;switch(r){case"top-right":case"top-left":h=d-va;break;case"bottom-right":case"bottom-left":h=-d+va;break;case"bottom":h=-a+va;break;case"top":h=a-va}switch(r){case"top-right":case"bottom-right":l=-d;break;case"top-left":case"bottom-left":l=d;break;case"left":l=a;break;case"right":l=-a}return[l,h]}(i,t[0])}function Np(i,t,r){var a;let l=i.layout,h=(a=l.get("text-variable-anchor-offset"))===null||a===void 0?void 0:a.evaluate(t,{},r);if(h){let f=h.values,g=[];for(let v=0;vD*wi);x.startsWith("top")?A[1]-=va:x.startsWith("bottom")&&(A[1]+=va),g[v+1]=A}return new vr(g)}let d=l.get("text-variable-anchor");if(d){let f;f=i._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[l.get("text-radial-offset").evaluate(t,{},r)*wi,Fc]:l.get("text-offset").evaluate(t,{},r).map(v=>v*wi);let g=[];for(let v of d)g.push(v,Op(v,f));return new vr(g)}return null}function Oc(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Im(i,t,r,a,l,h,d,f,g,v,x){let A=h.textMaxSize.evaluate(t,{});A===void 0&&(A=d);let D=i.layers[0].layout,M=D.get("icon-offset").evaluate(t,{},x),z=Vp(r.horizontal),B=d/24,q=i.tilePixelRatio*B,$=i.tilePixelRatio*A/24,ne=i.tilePixelRatio*f,J=i.tilePixelRatio*D.get("symbol-spacing"),ie=D.get("text-padding")*i.tilePixelRatio,ce=function(de,We,Ge,lt=1){let Jt=de.get("icon-padding").evaluate(We,{},Ge),Wt=Jt&&Jt.values;return[Wt[0]*lt,Wt[1]*lt,Wt[2]*lt,Wt[3]*lt]}(D,t,x,i.tilePixelRatio),_e=D.get("text-max-angle")/180*Math.PI,Re=D.get("text-rotation-alignment")!=="viewport"&&D.get("symbol-placement")!=="point",it=D.get("icon-rotation-alignment")==="map"&&D.get("symbol-placement")!=="point",Be=D.get("symbol-placement"),Pe=J/2,Xe=D.get("icon-text-fit"),Ue;a&&Xe!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Ue=cp(a,r.vertical,Xe,D.get("icon-text-fit-padding"),M,B)),z&&(a=cp(a,z,Xe,D.get("icon-text-fit-padding"),M,B)));let qe=(de,We)=>{We.x<0||We.x>=bi||We.y<0||We.y>=bi||function(Ge,lt,Jt,Wt,Ti,Jr,Fi,Ci,ir,rr,nr,gi,Di,Gi,Oi,ar,Ni,Ur,gr,Ot,Qt,ai,Cr,pi,Us){let dn=Ge.addToLineVertexArray(lt,Jt),fn,Kr,jr,Mi,Bn=0,sl=0,Zp=0,Gp=0,Gc=-1,Hc=-1,Ln={},Hp=Ss("");if(Ge.allowVerticalPlacement&&Wt.vertical){let Hi=Ci.layout.get("text-rotate").evaluate(Qt,{},pi)+90;jr=new yu(ir,lt,rr,nr,gi,Wt.vertical,Di,Gi,Oi,Hi),Fi&&(Mi=new yu(ir,lt,rr,nr,gi,Fi,Ni,Ur,Oi,Hi))}if(Ti){let Hi=Ci.layout.get("icon-rotate").evaluate(Qt,{}),$r=Ci.layout.get("icon-text-fit")!=="none",Ga=Rp(Ti,Hi,Cr,$r),an=Fi?Rp(Fi,Hi,Cr,$r):void 0;Kr=new yu(ir,lt,rr,nr,gi,Ti,Ni,Ur,!1,Hi),Bn=4*Ga.length;let Ha=Ge.iconSizeData,mn=null;Ha.kind==="source"?(mn=[pn*Ci.layout.get("icon-size").evaluate(Qt,{})],mn[0]>ga&&we(`${Ge.layerIds[0]}: Value for "icon-size" is >= ${tl}. Reduce your "icon-size".`)):Ha.kind==="composite"&&(mn=[pn*ai.compositeIconSizes[0].evaluate(Qt,{},pi),pn*ai.compositeIconSizes[1].evaluate(Qt,{},pi)],(mn[0]>ga||mn[1]>ga)&&we(`${Ge.layerIds[0]}: Value for "icon-size" is >= ${tl}. Reduce your "icon-size".`)),Ge.addSymbols(Ge.icon,Ga,mn,Ot,gr,Qt,E.ah.none,lt,dn.lineStartIndex,dn.lineLength,-1,pi),Gc=Ge.icon.placedSymbolArray.length-1,an&&(sl=4*an.length,Ge.addSymbols(Ge.icon,an,mn,Ot,gr,Qt,E.ah.vertical,lt,dn.lineStartIndex,dn.lineLength,-1,pi),Hc=Ge.icon.placedSymbolArray.length-1)}let Xp=Object.keys(Wt.horizontal);for(let Hi of Xp){let $r=Wt.horizontal[Hi];if(!fn){Hp=Ss($r.text);let an=Ci.layout.get("text-rotate").evaluate(Qt,{},pi);fn=new yu(ir,lt,rr,nr,gi,$r,Di,Gi,Oi,an)}let Ga=$r.positionedLines.length===1;if(Zp+=qp(Ge,lt,$r,Jr,Ci,Oi,Qt,ar,dn,Wt.vertical?E.ah.horizontal:E.ah.horizontalOnly,Ga?Xp:[Hi],Ln,Gc,ai,pi),Ga)break}Wt.vertical&&(Gp+=qp(Ge,lt,Wt.vertical,Jr,Ci,Oi,Qt,ar,dn,E.ah.vertical,["vertical"],Ln,Hc,ai,pi));let Pm=fn?fn.boxStartIndex:Ge.collisionBoxArray.length,zm=fn?fn.boxEndIndex:Ge.collisionBoxArray.length,Bm=jr?jr.boxStartIndex:Ge.collisionBoxArray.length,Lm=jr?jr.boxEndIndex:Ge.collisionBoxArray.length,Rm=Kr?Kr.boxStartIndex:Ge.collisionBoxArray.length,Fm=Kr?Kr.boxEndIndex:Ge.collisionBoxArray.length,Om=Mi?Mi.boxStartIndex:Ge.collisionBoxArray.length,Nm=Mi?Mi.boxEndIndex:Ge.collisionBoxArray.length,nn=-1,xu=(Hi,$r)=>Hi&&Hi.circleDiameter?Math.max(Hi.circleDiameter,$r):$r;nn=xu(fn,nn),nn=xu(jr,nn),nn=xu(Kr,nn),nn=xu(Mi,nn);let Wp=nn>-1?1:0;Wp&&(nn*=Us/wi),Ge.glyphOffsetArray.length>=Ns.MAX_GLYPHS&&we("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Qt.sortKey!==void 0&&Ge.addToSortKeyRanges(Ge.symbolInstances.length,Qt.sortKey);let qm=Np(Ci,Qt,pi),[Vm,Um]=function(Hi,$r){let Ga=Hi.length,an=$r?.values;if(an?.length>0)for(let Ha=0;Ha=0?Ln.right:-1,Ln.center>=0?Ln.center:-1,Ln.left>=0?Ln.left:-1,Ln.vertical||-1,Gc,Hc,Hp,Pm,zm,Bm,Lm,Rm,Fm,Om,Nm,rr,Zp,Gp,Bn,sl,Wp,0,Di,nn,Vm,Um)}(i,We,de,r,a,l,Ue,i.layers[0],i.collisionBoxArray,t.index,t.sourceLayerIndex,i.index,q,[ie,ie,ie,ie],Re,g,ne,ce,it,M,t,h,v,x,d)};if(Be==="line")for(let de of kp(t.geometry,0,0,bi,bi)){let We=Tm(de,J,_e,r.vertical||z,a,24,$,i.overscaling,bi);for(let Ge of We)z&&km(i,z.text,Pe,Ge)||qe(de,Ge)}else if(Be==="line-center"){for(let de of t.geometry)if(de.length>1){let We=Em(de,_e,r.vertical||z,a,24,$);We&&qe(de,We)}}else if(t.type==="Polygon")for(let de of ns(t.geometry,0)){let We=Dm(de,16);qe(de[0],new ya(We.x,We.y,0))}else if(t.type==="LineString")for(let de of t.geometry)qe(de,new ya(de[0].x,de[0].y,0));else if(t.type==="Point")for(let de of t.geometry)for(let We of de)qe([We],new ya(We.x,We.y,0))}function qp(i,t,r,a,l,h,d,f,g,v,x,A,D,M,z){let B=function(ne,J,ie,ce,_e,Re,it,Be){let Pe=ce.layout.get("text-rotate").evaluate(Re,{})*Math.PI/180,Xe=[];for(let Ue of J.positionedLines)for(let qe of Ue.positionedGlyphs){if(!qe.rect)continue;let de=qe.rect||{},We=ip+1,Ge=!0,lt=1,Jt=0,Wt=(_e||Be)&&qe.vertical,Ti=qe.metrics.advance*qe.scale/2;if(Be&&J.verticalizable&&(Jt=Ue.lineOffset/2-(qe.imageName?-(wi-qe.metrics.width*qe.scale)/2:(qe.scale-1)*wi)),qe.imageName){let Ot=it[qe.imageName];Ge=Ot.sdf,lt=Ot.pixelRatio,We=mr/lt}let Jr=_e?[qe.x+Ti,qe.y]:[0,0],Fi=_e?[0,0]:[qe.x+Ti+ie[0],qe.y+ie[1]-Jt],Ci=[0,0];Wt&&(Ci=Fi,Fi=[0,0]);let ir=qe.metrics.isDoubleResolution?2:1,rr=(qe.metrics.left-We)*qe.scale-Ti+Fi[0],nr=(-qe.metrics.top-We)*qe.scale+Fi[1],gi=rr+de.w/ir*qe.scale/lt,Di=nr+de.h/ir*qe.scale/lt,Gi=new se(rr,nr),Oi=new se(gi,nr),ar=new se(rr,Di),Ni=new se(gi,Di);if(Wt){let Ot=new se(-Ti,Ti-Qo),Qt=-Math.PI/2,ai=wi/2-Ti,Cr=new se(5-Qo-ai,-(qe.imageName?ai:0)),pi=new se(...Ci);Gi._rotateAround(Qt,Ot)._add(Cr)._add(pi),Oi._rotateAround(Qt,Ot)._add(Cr)._add(pi),ar._rotateAround(Qt,Ot)._add(Cr)._add(pi),Ni._rotateAround(Qt,Ot)._add(Cr)._add(pi)}if(Pe){let Ot=Math.sin(Pe),Qt=Math.cos(Pe),ai=[Qt,-Ot,Ot,Qt];Gi._matMult(ai),Oi._matMult(ai),ar._matMult(ai),Ni._matMult(ai)}let Ur=new se(0,0),gr=new se(0,0);Xe.push({tl:Gi,tr:Oi,bl:ar,br:Ni,tex:de,writingMode:J.writingMode,glyphOffset:Jr,sectionIndex:qe.sectionIndex,isSDF:Ge,pixelOffsetTL:Ur,pixelOffsetBR:gr,minFontScaleX:0,minFontScaleY:0})}return Xe}(0,r,f,l,h,d,a,i.allowVerticalPlacement),q=i.textSizeData,$=null;q.kind==="source"?($=[pn*l.layout.get("text-size").evaluate(d,{})],$[0]>ga&&we(`${i.layerIds[0]}: Value for "text-size" is >= ${tl}. Reduce your "text-size".`)):q.kind==="composite"&&($=[pn*M.compositeTextSizes[0].evaluate(d,{},z),pn*M.compositeTextSizes[1].evaluate(d,{},z)],($[0]>ga||$[1]>ga)&&we(`${i.layerIds[0]}: Value for "text-size" is >= ${tl}. Reduce your "text-size".`)),i.addSymbols(i.text,B,$,f,h,d,v,t,g.lineStartIndex,g.lineLength,D,z);for(let ne of x)A[ne]=i.text.placedSymbolArray.length-1;return 4*B.length}function Vp(i){for(let t in i)return i[t];return null}function km(i,t,r,a){let l=i.compareText;if(t in l){let h=l[t];for(let d=h.length-1;d>=0;d--)if(a.dist(h[d])>4;if(l!==1)throw new Error(`Got v${l} data when expected v1.`);let h=Up[15&a];if(!h)throw new Error("Unrecognized array type.");let[d]=new Uint16Array(t,2,1),[f]=new Uint32Array(t,4,1);return new Nc(f,d,h,t)}constructor(t,r=64,a=Float64Array,l){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=a,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;let h=Up.indexOf(this.ArrayType),d=2*t*this.ArrayType.BYTES_PER_ELEMENT,f=t*this.IndexArrayType.BYTES_PER_ELEMENT,g=(8-f%8)%8;if(h<0)throw new Error(`Unexpected typed array class: ${a}.`);l&&l instanceof ArrayBuffer?(this.data=l,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+f+g,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+d+f+g),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+f+g,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+h]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=t)}add(t,r){let a=this._pos>>1;return this.ids[a]=a,this.coords[this._pos++]=t,this.coords[this._pos++]=r,a}finish(){let t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return qc(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,r,a,l){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:h,coords:d,nodeSize:f}=this,g=[0,h.length-1,0],v=[];for(;g.length;){let x=g.pop()||0,A=g.pop()||0,D=g.pop()||0;if(A-D<=f){for(let q=D;q<=A;q++){let $=d[2*q],ne=d[2*q+1];$>=t&&$<=a&&ne>=r&&ne<=l&&v.push(h[q])}continue}let M=D+A>>1,z=d[2*M],B=d[2*M+1];z>=t&&z<=a&&B>=r&&B<=l&&v.push(h[M]),(x===0?t<=z:r<=B)&&(g.push(D),g.push(M-1),g.push(1-x)),(x===0?a>=z:l>=B)&&(g.push(M+1),g.push(A),g.push(1-x))}return v}within(t,r,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:l,coords:h,nodeSize:d}=this,f=[0,l.length-1,0],g=[],v=a*a;for(;f.length;){let x=f.pop()||0,A=f.pop()||0,D=f.pop()||0;if(A-D<=d){for(let q=D;q<=A;q++)$p(h[2*q],h[2*q+1],t,r)<=v&&g.push(l[q]);continue}let M=D+A>>1,z=h[2*M],B=h[2*M+1];$p(z,B,t,r)<=v&&g.push(l[M]),(x===0?t-a<=z:r-a<=B)&&(f.push(D),f.push(M-1),f.push(1-x)),(x===0?t+a>=z:r+a>=B)&&(f.push(M+1),f.push(A),f.push(1-x))}return g}}function qc(i,t,r,a,l,h){if(l-a<=r)return;let d=a+l>>1;jp(i,t,d,a,l,h),qc(i,t,r,a,d-1,1-h),qc(i,t,r,d+1,l,1-h)}function jp(i,t,r,a,l,h){for(;l>a;){if(l-a>600){let v=l-a+1,x=r-a+1,A=Math.log(v),D=.5*Math.exp(2*A/3),M=.5*Math.sqrt(A*D*(v-D)/v)*(x-v/2<0?-1:1);jp(i,t,r,Math.max(a,Math.floor(r-x*D/v+M)),Math.min(l,Math.floor(r+(v-x)*D/v+M)),h)}let d=t[2*r+h],f=a,g=l;for(nl(i,t,a,r),t[2*l+h]>d&&nl(i,t,a,l);fd;)g--}t[2*a+h]===d?nl(i,t,a,g):(g++,nl(i,t,g,l)),g<=r&&(a=g+1),r<=g&&(l=g-1)}}function nl(i,t,r,a){Vc(i,r,a),Vc(t,2*r,2*a),Vc(t,2*r+1,2*a+1)}function Vc(i,t,r){let a=i[t];i[t]=i[r],i[r]=a}function $p(i,t,r,a){let l=i-r,h=t-a;return l*l+h*h}var Uc;E.bg=void 0,(Uc=E.bg||(E.bg={})).create="create",Uc.load="load",Uc.fullLoad="fullLoad";let vu=null,al=[],jc=1e3/60,$c="loadTime",Zc="fullLoadTime",Mm={mark(i){performance.mark(i)},frame(i){let t=i;vu!=null&&al.push(t-vu),vu=t},clearMetrics(){vu=null,al=[],performance.clearMeasures($c),performance.clearMeasures(Zc);for(let i in E.bg)performance.clearMarks(E.bg[i])},getPerformanceMetrics(){performance.measure($c,E.bg.create,E.bg.load),performance.measure(Zc,E.bg.create,E.bg.fullLoad);let i=performance.getEntriesByName($c)[0].duration,t=performance.getEntriesByName(Zc)[0].duration,r=al.length,a=1/(al.reduce((h,d)=>h+d,0)/r/1e3),l=al.filter(h=>h>jc).reduce((h,d)=>h+(d-jc)/jc,0);return{loadTime:i,fullLoadTime:t,fps:a,percentDroppedFrames:l/(r+l)*100,totalFrames:r}}};E.$=class extends T{},E.A=zs,E.B=Qu,E.C=function(i){if(Ne==null){let t=i.navigator?i.navigator.userAgent:null;Ne=!!i.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Ne},E.D=$e,E.E=Kt,E.F=class{constructor(i,t){this.target=i,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new wm(()=>this.process()),this.subscription=function(r,a,l,h){return r.addEventListener(a,l,!1),{unsubscribe:()=>{r.removeEventListener(a,l,!1)}}}(this.target,"message",r=>this.receive(r)),this.globalScope=ht(self)?i:window}registerMessageHandler(i,t){this.messageHandlers[i]=t}sendAsync(i,t){return new Promise((r,a)=>{let l=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[l]={resolve:r,reject:a},t&&t.signal.addEventListener("abort",()=>{delete this.resolveRejects[l];let f={id:l,type:"",origin:location.origin,targetMapId:i.targetMapId,sourceMapId:this.mapId};this.target.postMessage(f)},{once:!0});let h=[],d=Object.assign(Object.assign({},i),{id:l,sourceMapId:this.mapId,origin:location.origin,data:na(i.data,h)});this.target.postMessage(d,{transfer:h})})}receive(i){let t=i.data,r=t.id;if(!(t.origin!=="file://"&&location.origin!=="file://"&&t.origin!=="resource://android"&&location.origin!=="resource://android"&&t.origin!==location.origin||t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type===""){delete this.tasks[r];let a=this.abortControllers[r];return delete this.abortControllers[r],void(a&&a.abort())}if(ht(self)||t.mustQueue)return this.tasks[r]=t,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,t)}}process(){if(this.taskQueue.length===0)return;let i=this.taskQueue.shift(),t=this.tasks[i];delete this.tasks[i],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(i,t)}processTask(i,t){return p(this,void 0,void 0,function*(){if(t.type===""){let l=this.resolveRejects[i];return delete this.resolveRejects[i],l?void(t.error?l.reject(aa(t.error)):l.resolve(aa(t.data))):void 0}if(!this.messageHandlers[t.type])return void this.completeTask(i,new Error(`Could not find a registered handler for ${t.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));let r=aa(t.data),a=new AbortController;this.abortControllers[i]=a;try{let l=yield this.messageHandlers[t.type](t.sourceMapId,r,a);this.completeTask(i,null,l)}catch(l){this.completeTask(i,l)}})}completeTask(i,t,r){let a=[];delete this.abortControllers[i];let l={id:i,type:"",sourceMapId:this.mapId,origin:location.origin,error:t?na(t):null,data:na(r,a)};this.target.postMessage(l,{transfer:a})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},E.G=Vt,E.H=function(){var i=new zs(16);return zs!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},E.I=Cc,E.J=function(i,t,r){var a,l,h,d,f,g,v,x,A,D,M,z,B=r[0],q=r[1],$=r[2];return t===i?(i[12]=t[0]*B+t[4]*q+t[8]*$+t[12],i[13]=t[1]*B+t[5]*q+t[9]*$+t[13],i[14]=t[2]*B+t[6]*q+t[10]*$+t[14],i[15]=t[3]*B+t[7]*q+t[11]*$+t[15]):(l=t[1],h=t[2],d=t[3],f=t[4],g=t[5],v=t[6],x=t[7],A=t[8],D=t[9],M=t[10],z=t[11],i[0]=a=t[0],i[1]=l,i[2]=h,i[3]=d,i[4]=f,i[5]=g,i[6]=v,i[7]=x,i[8]=A,i[9]=D,i[10]=M,i[11]=z,i[12]=a*B+f*q+A*$+t[12],i[13]=l*B+g*q+D*$+t[13],i[14]=h*B+v*q+M*$+t[14],i[15]=d*B+x*q+z*$+t[15]),i},E.K=function(i,t,r){var a=r[0],l=r[1],h=r[2];return i[0]=t[0]*a,i[1]=t[1]*a,i[2]=t[2]*a,i[3]=t[3]*a,i[4]=t[4]*l,i[5]=t[5]*l,i[6]=t[6]*l,i[7]=t[7]*l,i[8]=t[8]*h,i[9]=t[9]*h,i[10]=t[10]*h,i[11]=t[11]*h,i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15],i},E.L=Eh,E.M=function(i,t){let r={};for(let a=0;a{let t=window.document.createElement("video");return t.muted=!0,new Promise(r=>{t.onloadstart=()=>{r(t)};for(let a of i){let l=window.document.createElement("source");vt(a)||(t.crossOrigin="Anonymous"),l.src=a,t.appendChild(l)}})},E.a4=function(){return ye++},E.a5=Le,E.a6=Ns,E.a7=wo,E.a8=$a,E.a9=Cp,E.aA=function(i){if(i.type==="custom")return new bm(i);switch(i.type){case"background":return new ym(i);case"circle":return new af(i);case"fill":return new wf(i);case"fill-extrusion":return new Ff(i);case"heatmap":return new of(i);case"hillshade":return new uf(i);case"line":return new Zf(i);case"raster":return new xm(i);case"symbol":return new fu(i)}},E.aB=ge,E.aC=function(i,t){if(!i)return[{command:"setStyle",args:[t]}];let r=[];try{if(!Et(i.version,t.version))return[{command:"setStyle",args:[t]}];Et(i.center,t.center)||r.push({command:"setCenter",args:[t.center]}),Et(i.zoom,t.zoom)||r.push({command:"setZoom",args:[t.zoom]}),Et(i.bearing,t.bearing)||r.push({command:"setBearing",args:[t.bearing]}),Et(i.pitch,t.pitch)||r.push({command:"setPitch",args:[t.pitch]}),Et(i.sprite,t.sprite)||r.push({command:"setSprite",args:[t.sprite]}),Et(i.glyphs,t.glyphs)||r.push({command:"setGlyphs",args:[t.glyphs]}),Et(i.transition,t.transition)||r.push({command:"setTransition",args:[t.transition]}),Et(i.light,t.light)||r.push({command:"setLight",args:[t.light]}),Et(i.terrain,t.terrain)||r.push({command:"setTerrain",args:[t.terrain]}),Et(i.sky,t.sky)||r.push({command:"setSky",args:[t.sky]}),Et(i.projection,t.projection)||r.push({command:"setProjection",args:[t.projection]});let a={},l=[];(function(d,f,g,v){let x;for(x in f=f||{},d=d||{})Object.prototype.hasOwnProperty.call(d,x)&&(Object.prototype.hasOwnProperty.call(f,x)||Mr(x,g,v));for(x in f)Object.prototype.hasOwnProperty.call(f,x)&&(Object.prototype.hasOwnProperty.call(d,x)?Et(d[x],f[x])||(d[x].type==="geojson"&&f[x].type==="geojson"&&Qr(d,f,x)?Gt(g,{command:"setGeoJSONSourceData",args:[x,f[x].data]}):Wi(x,f,g,v)):_r(x,f,g))})(i.sources,t.sources,l,a);let h=[];i.layers&&i.layers.forEach(d=>{"source"in d&&a[d.source]?r.push({command:"removeLayer",args:[d.id]}):h.push(d)}),r=r.concat(l),function(d,f,g){f=f||[];let v=(d=d||[]).map(sn),x=f.map(sn),A=d.reduce(yn,{}),D=f.reduce(yn,{}),M=v.slice(),z=Object.create(null),B,q,$,ne,J;for(let ie=0,ce=0;ie@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,a,l,h)=>{let d=l||h;return t[a]=!d||d.toLowerCase(),""}),t["max-age"]){let r=parseInt(t["max-age"],10);isNaN(r)?delete t["max-age"]:t["max-age"]=r}return t},E.ab=function(i,t){let r=[];for(let a in i)a in t||r.push(a);return r},E.ac=Se,E.ad=function(i,t,r){var a=Math.sin(r),l=Math.cos(r),h=t[0],d=t[1],f=t[2],g=t[3],v=t[4],x=t[5],A=t[6],D=t[7];return t!==i&&(i[8]=t[8],i[9]=t[9],i[10]=t[10],i[11]=t[11],i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15]),i[0]=h*l+v*a,i[1]=d*l+x*a,i[2]=f*l+A*a,i[3]=g*l+D*a,i[4]=v*l-h*a,i[5]=x*l-d*a,i[6]=A*l-f*a,i[7]=D*l-g*a,i},E.ae=function(i){var t=new zs(16);return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],t},E.af=au,E.ag=function(i,t){let r=0,a=0;if(i.kind==="constant")a=i.layoutSize;else if(i.kind!=="source"){let{interpolationType:l,minZoom:h,maxZoom:d}=i,f=l?Se(Qi.interpolationFactor(l,t,h,d),0,1):0;i.kind==="camera"?a=Yi.number(i.minSize,i.maxSize,f):r=f}return{uSizeT:r,uSize:a}},E.ai=function(i,{uSize:t,uSizeT:r},{lowerSize:a,upperSize:l}){return i.kind==="source"?a/pn:i.kind==="composite"?Yi.number(a/pn,l/pn,r):t},E.aj=kc,E.ak=function(i,t,r,a){let l=t.y-i.y,h=t.x-i.x,d=a.y-r.y,f=a.x-r.x,g=d*h-f*l;if(g===0)return null;let v=(f*(i.y-r.y)-d*(i.x-r.x))/g;return new se(i.x+v*h,i.y+v*l)},E.al=kp,E.am=yh,E.an=hc,E.ao=function(i){let t=1/0,r=1/0,a=-1/0,l=-1/0;for(let h of i)t=Math.min(t,h.x),r=Math.min(r,h.y),a=Math.max(a,h.x),l=Math.max(l,h.y);return[t,r,a,l]},E.ap=wi,E.ar=Ic,E.as=function(i,t){var r=t[0],a=t[1],l=t[2],h=t[3],d=t[4],f=t[5],g=t[6],v=t[7],x=t[8],A=t[9],D=t[10],M=t[11],z=t[12],B=t[13],q=t[14],$=t[15],ne=r*f-a*d,J=r*g-l*d,ie=r*v-h*d,ce=a*g-l*f,_e=a*v-h*f,Re=l*v-h*g,it=x*B-A*z,Be=x*q-D*z,Pe=x*$-M*z,Xe=A*q-D*B,Ue=A*$-M*B,qe=D*$-M*q,de=ne*qe-J*Ue+ie*Xe+ce*Pe-_e*Be+Re*it;return de?(i[0]=(f*qe-g*Ue+v*Xe)*(de=1/de),i[1]=(l*Ue-a*qe-h*Xe)*de,i[2]=(B*Re-q*_e+$*ce)*de,i[3]=(D*_e-A*Re-M*ce)*de,i[4]=(g*Pe-d*qe-v*Be)*de,i[5]=(r*qe-l*Pe+h*Be)*de,i[6]=(q*ie-z*Re-$*J)*de,i[7]=(x*Re-D*ie+M*J)*de,i[8]=(d*Ue-f*Pe+v*it)*de,i[9]=(a*Pe-r*Ue-h*it)*de,i[10]=(z*_e-B*ie+$*ne)*de,i[11]=(A*ie-x*_e-M*ne)*de,i[12]=(f*Be-d*Xe-g*it)*de,i[13]=(r*Xe-a*Be+l*it)*de,i[14]=(B*J-z*ce-q*ne)*de,i[15]=(x*ce-A*J+D*ne)*de,i):null},E.at=Oc,E.au=Sc,E.av=Nc,E.aw=function(){let i={},t=oe.$version;for(let r in oe.$root){let a=oe.$root[r];if(a.required){let l=null;l=r==="version"?t:a.type==="array"?[]:{},l!=null&&(i[r]=l)}}return i},E.ax=Ro,E.ay=ui,E.az=function(i){i=i.slice();let t=Object.create(null);for(let r=0;r25||a<0||a>=1||r<0||r>=1)},E.bc=function(i,t){return i[0]=t[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=t[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=t[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},E.bd=class extends b{},E.be=Bc,E.bf=Mm,E.bh=gt,E.bi=function(i,t){mt.REGISTERED_PROTOCOLS[i]=t},E.bj=function(i){delete mt.REGISTERED_PROTOCOLS[i]},E.bk=function(i,t){let r={};for(let l=0;lqe*wi)}let Be=d?"center":r.get("text-justify").evaluate(v,{},i.canonical),Pe=r.get("symbol-placement")==="point"?r.get("text-max-width").evaluate(v,{},i.canonical)*wi:1/0,Xe=()=>{i.bucket.allowVerticalPlacement&&Fo(ie)&&(z.vertical=hu(B,i.glyphMap,i.glyphPositions,i.imagePositions,x,Pe,h,Re,"left",_e,$,E.ah.vertical,!0,D,A))};if(!d&&it){let Ue=new Set;if(Be==="auto")for(let de=0;dep(void 0,void 0,void 0,function*(){if(i.byteLength===0)return createImageBitmap(new ImageData(1,1));let t=new Blob([new Uint8Array(i)],{type:"image/png"});try{return createImageBitmap(t)}catch(r){throw new Error(`Could not load image because of ${r.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),E.e=He,E.f=i=>new Promise((t,r)=>{let a=new Image;a.onload=()=>{t(a),URL.revokeObjectURL(a.src),a.onload=null,window.requestAnimationFrame(()=>{a.src=Qe})},a.onerror=()=>r(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."));let l=new Blob([new Uint8Array(i)],{type:"image/png"});a.src=i.byteLength?URL.createObjectURL(l):Qe}),E.g=Bt,E.h=(i,t)=>et(He(i,{type:"json"}),t),E.i=ht,E.j=di,E.k=ci,E.l=(i,t)=>et(He(i,{type:"arrayBuffer"}),t),E.m=et,E.n=function(i){return new Ec(i).readFields(sm,[])},E.o=Go,E.p=rp,E.q=c,E.r=Yu,E.s=vt,E.t=Bo,E.u=kn,E.v=oe,E.w=we,E.x=function([i,t,r]){return t+=90,t*=Math.PI/180,r*=Math.PI/180,{x:i*Math.cos(t)*Math.sin(r),y:i*Math.sin(t)*Math.sin(r),z:i*Math.cos(r)}},E.y=Yi,E.z=ti}),F("worker",["./shared"],function(E){"use strict";class p{constructor(k){this.keyCache={},k&&this.replace(k)}replace(k){this._layerConfigs={},this._layers={},this.update(k,[])}update(k,I){for(let V of k){this._layerConfigs[V.id]=V;let Y=this._layers[V.id]=E.aA(V);Y._featureFilter=E.a7(Y.filter),this.keyCache[V.id]&&delete this.keyCache[V.id]}for(let V of I)delete this.keyCache[V],delete this._layerConfigs[V],delete this._layers[V];this.familiesBySource={};let R=E.bk(Object.values(this._layerConfigs),this.keyCache);for(let V of R){let Y=V.map(le=>this._layers[le.id]),ee=Y[0];if(ee.visibility==="none")continue;let re=ee.source||"",H=this.familiesBySource[re];H||(H=this.familiesBySource[re]={});let he=ee.sourceLayer||"_geojsonTileLayer",me=H[he];me||(me=H[he]=[]),me.push(Y)}}}class ue{constructor(k){let I={},R=[];for(let re in k){let H=k[re],he=I[re]={};for(let me in H){let le=H[+me];if(!le||le.bitmap.width===0||le.bitmap.height===0)continue;let Te={x:0,y:0,w:le.bitmap.width+2,h:le.bitmap.height+2};R.push(Te),he[me]={rect:Te,metrics:le.metrics}}}let{w:V,h:Y}=E.p(R),ee=new E.o({width:V||1,height:Y||1});for(let re in k){let H=k[re];for(let he in H){let me=H[+he];if(!me||me.bitmap.width===0||me.bitmap.height===0)continue;let le=I[re][he].rect;E.o.copy(me.bitmap,ee,{x:0,y:0},{x:le.x+1,y:le.y+1},me.bitmap)}}this.image=ee,this.positions=I}}E.bl("GlyphAtlas",ue);class pe{constructor(k){this.tileID=new E.S(k.tileID.overscaledZ,k.tileID.wrap,k.tileID.canonical.z,k.tileID.canonical.x,k.tileID.canonical.y),this.uid=k.uid,this.zoom=k.zoom,this.pixelRatio=k.pixelRatio,this.tileSize=k.tileSize,this.source=k.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=k.showCollisionBoxes,this.collectResourceTiming=!!k.collectResourceTiming,this.returnDependencies=!!k.returnDependencies,this.promoteId=k.promoteId,this.inFlightDependencies=[]}parse(k,I,R,V){return E._(this,void 0,void 0,function*(){this.status="parsing",this.data=k,this.collisionBoxArray=new E.a5;let Y=new E.bm(Object.keys(k.layers).sort()),ee=new E.bn(this.tileID,this.promoteId);ee.bucketLayerIDs=[];let re={},H={featureIndex:ee,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:R},he=I.familiesBySource[this.source];for(let wt in he){let $t=k.layers[wt];if(!$t)continue;$t.version===1&&E.w(`Vector tile source "${this.source}" layer "${wt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let oi=Y.encode(wt),Ei=[];for(let Ii=0;Ii<$t.length;Ii++){let ji=$t.feature(Ii),qn=ee.getId(ji,wt);Ei.push({feature:ji,id:qn,index:Ii,sourceLayerIndex:oi})}for(let Ii of he[wt]){let ji=Ii[0];ji.source!==this.source&&E.w(`layer.source = ${ji.source} does not equal this.source = ${this.source}`),ji.minzoom&&this.zoom=ji.maxzoom||ji.visibility!=="none"&&(De(Ii,this.zoom,R),(re[ji.id]=ji.createBucket({index:ee.bucketLayerIDs.length,layers:Ii,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:oi,sourceID:this.source})).populate(Ei,H,this.tileID.canonical),ee.bucketLayerIDs.push(Ii.map(qn=>qn.id)))}}let me=E.aF(H.glyphDependencies,wt=>Object.keys(wt).map(Number));this.inFlightDependencies.forEach(wt=>wt?.abort()),this.inFlightDependencies=[];let le=Promise.resolve({});if(Object.keys(me).length){let wt=new AbortController;this.inFlightDependencies.push(wt),le=V.sendAsync({type:"GG",data:{stacks:me,source:this.source,tileID:this.tileID,type:"glyphs"}},wt)}let Te=Object.keys(H.iconDependencies),Je=Promise.resolve({});if(Te.length){let wt=new AbortController;this.inFlightDependencies.push(wt),Je=V.sendAsync({type:"GI",data:{icons:Te,source:this.source,tileID:this.tileID,type:"icons"}},wt)}let tt=Object.keys(H.patternDependencies),Lt=Promise.resolve({});if(tt.length){let wt=new AbortController;this.inFlightDependencies.push(wt),Lt=V.sendAsync({type:"GI",data:{icons:tt,source:this.source,tileID:this.tileID,type:"patterns"}},wt)}let[dt,Rt,Dt]=yield Promise.all([le,Je,Lt]),vi=new ue(dt),hi=new E.bo(Rt,Dt);for(let wt in re){let $t=re[wt];$t instanceof E.a6?(De($t.layers,this.zoom,R),E.bp({bucket:$t,glyphMap:dt,glyphPositions:vi.positions,imageMap:Rt,imagePositions:hi.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):$t.hasPattern&&($t instanceof E.bq||$t instanceof E.br||$t instanceof E.bs)&&(De($t.layers,this.zoom,R),$t.addFeatures(H,this.tileID.canonical,hi.patternPositions))}return this.status="done",{buckets:Object.values(re).filter(wt=>!wt.isEmpty()),featureIndex:ee,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:vi.image,imageAtlas:hi,glyphMap:this.returnDependencies?dt:null,iconMap:this.returnDependencies?Rt:null,glyphPositions:this.returnDependencies?vi.positions:null}})}}function De(j,k,I){let R=new E.z(k);for(let V of j)V.recalculate(R,I)}class se{constructor(k,I,R){this.actor=k,this.layerIndex=I,this.availableImages=R,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(k,I){return E._(this,void 0,void 0,function*(){let R=yield E.l(k.request,I);try{return{vectorTile:new E.bt.VectorTile(new E.bu(R.data)),rawData:R.data,cacheControl:R.cacheControl,expires:R.expires}}catch(V){let Y=new Uint8Array(R.data),ee=`Unable to parse the tile at ${k.request.url}, `;throw ee+=Y[0]===31&&Y[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${V.message}`,new Error(ee)}})}loadTile(k){return E._(this,void 0,void 0,function*(){let I=k.uid,R=!!(k&&k.request&&k.request.collectResourceTiming)&&new E.bv(k.request),V=new pe(k);this.loading[I]=V;let Y=new AbortController;V.abort=Y;try{let ee=yield this.loadVectorTile(k,Y);if(delete this.loading[I],!ee)return null;let re=ee.rawData,H={};ee.expires&&(H.expires=ee.expires),ee.cacheControl&&(H.cacheControl=ee.cacheControl);let he={};if(R){let le=R.finish();le&&(he.resourceTiming=JSON.parse(JSON.stringify(le)))}V.vectorTile=ee.vectorTile;let me=V.parse(ee.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[I]=V,this.fetching[I]={rawTileData:re,cacheControl:H,resourceTiming:he};try{let le=yield me;return E.e({rawTileData:re.slice(0)},le,H,he)}finally{delete this.fetching[I]}}catch(ee){throw delete this.loading[I],V.status="done",this.loaded[I]=V,ee}})}reloadTile(k){return E._(this,void 0,void 0,function*(){let I=k.uid;if(!this.loaded||!this.loaded[I])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");let R=this.loaded[I];if(R.showCollisionBoxes=k.showCollisionBoxes,R.status==="parsing"){let V=yield R.parse(R.vectorTile,this.layerIndex,this.availableImages,this.actor),Y;if(this.fetching[I]){let{rawTileData:ee,cacheControl:re,resourceTiming:H}=this.fetching[I];delete this.fetching[I],Y=E.e({rawTileData:ee.slice(0)},V,re,H)}else Y=V;return Y}if(R.status==="done"&&R.vectorTile)return R.parse(R.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(k){return E._(this,void 0,void 0,function*(){let I=this.loading,R=k.uid;I&&I[R]&&I[R].abort&&(I[R].abort.abort(),delete I[R])})}removeTile(k){return E._(this,void 0,void 0,function*(){this.loaded&&this.loaded[k.uid]&&delete this.loaded[k.uid]})}}class X{constructor(){this.loaded={}}loadTile(k){return E._(this,void 0,void 0,function*(){let{uid:I,encoding:R,rawImageData:V,redFactor:Y,greenFactor:ee,blueFactor:re,baseShift:H}=k,he=V.width+2,me=V.height+2,le=E.b(V)?new E.R({width:he,height:me},yield E.bw(V,-1,-1,he,me)):V,Te=new E.bx(I,le,R,Y,ee,re,H);return this.loaded=this.loaded||{},this.loaded[I]=Te,Te})}removeTile(k){let I=this.loaded,R=k.uid;I&&I[R]&&delete I[R]}}function Mt(j,k){if(j.length!==0){yt(j[0],k);for(var I=1;I=Math.abs(re)?I-H+re:re-H+I,I=H}I+R>=0!=!!k&&j.reverse()}var Ct=E.by(function j(k,I){var R,V=k&&k.type;if(V==="FeatureCollection")for(R=0;R>31}function ht(j,k){for(var I=j.loadGeometry(),R=j.type,V=0,Y=0,ee=I.length,re=0;rej},ft=Math.fround||(je=new Float32Array(1),j=>(je[0]=+j,je[0]));var je;let bt=3,pt=5,At=6;class mt{constructor(k){this.options=Object.assign(Object.create(Qe),k),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(k){let{log:I,minZoom:R,maxZoom:V}=this.options;I&&console.time("total time");let Y=`prepare ${k.length} points`;I&&console.time(Y),this.points=k;let ee=[];for(let H=0;H=R;H--){let he=+Date.now();re=this.trees[H]=this._createTree(this._cluster(re,H)),I&&console.log("z%d: %d clusters in %dms",H,re.numItems,+Date.now()-he)}return I&&console.timeEnd("total time"),this}getClusters(k,I){let R=((k[0]+180)%360+360)%360-180,V=Math.max(-90,Math.min(90,k[1])),Y=k[2]===180?180:((k[2]+180)%360+360)%360-180,ee=Math.max(-90,Math.min(90,k[3]));if(k[2]-k[0]>=360)R=-180,Y=180;else if(R>Y){let le=this.getClusters([R,V,180,ee],I),Te=this.getClusters([-180,V,Y,ee],I);return le.concat(Te)}let re=this.trees[this._limitZoom(I)],H=re.range(gt(R),ui(ee),gt(Y),ui(V)),he=re.data,me=[];for(let le of H){let Te=this.stride*le;me.push(he[Te+pt]>1?Bt(he,Te,this.clusterProps):this.points[he[Te+bt]])}return me}getChildren(k){let I=this._getOriginId(k),R=this._getOriginZoom(k),V="No cluster with the specified id.",Y=this.trees[R];if(!Y)throw new Error(V);let ee=Y.data;if(I*this.stride>=ee.length)throw new Error(V);let re=this.options.radius/(this.options.extent*Math.pow(2,R-1)),H=Y.within(ee[I*this.stride],ee[I*this.stride+1],re),he=[];for(let me of H){let le=me*this.stride;ee[le+4]===k&&he.push(ee[le+pt]>1?Bt(ee,le,this.clusterProps):this.points[ee[le+bt]])}if(he.length===0)throw new Error(V);return he}getLeaves(k,I,R){let V=[];return this._appendLeaves(V,k,I=I||10,R=R||0,0),V}getTile(k,I,R){let V=this.trees[this._limitZoom(k)],Y=Math.pow(2,k),{extent:ee,radius:re}=this.options,H=re/ee,he=(R-H)/Y,me=(R+1+H)/Y,le={features:[]};return this._addTileFeatures(V.range((I-H)/Y,he,(I+1+H)/Y,me),V.data,I,R,Y,le),I===0&&this._addTileFeatures(V.range(1-H/Y,he,1,me),V.data,Y,R,Y,le),I===Y-1&&this._addTileFeatures(V.range(0,he,H/Y,me),V.data,-1,R,Y,le),le.features.length?le:null}getClusterExpansionZoom(k){let I=this._getOriginZoom(k)-1;for(;I<=this.options.maxZoom;){let R=this.getChildren(k);if(I++,R.length!==1)break;k=R[0].properties.cluster_id}return I}_appendLeaves(k,I,R,V,Y){let ee=this.getChildren(I);for(let re of ee){let H=re.properties;if(H&&H.cluster?Y+H.point_count<=V?Y+=H.point_count:Y=this._appendLeaves(k,H.cluster_id,R,V,Y):Y1,me,le,Te;if(he)me=Vt(I,H,this.clusterProps),le=I[H],Te=I[H+1];else{let Lt=this.points[I[H+bt]];me=Lt.properties;let[dt,Rt]=Lt.geometry.coordinates;le=gt(dt),Te=ui(Rt)}let Je={type:1,geometry:[[Math.round(this.options.extent*(le*Y-R)),Math.round(this.options.extent*(Te*Y-V))]],tags:me},tt;tt=he||this.options.generateId?I[H+bt]:this.points[I[H+bt]].id,tt!==void 0&&(Je.id=tt),ee.features.push(Je)}}_limitZoom(k){return Math.max(this.options.minZoom,Math.min(Math.floor(+k),this.options.maxZoom+1))}_cluster(k,I){let{radius:R,extent:V,reduce:Y,minPoints:ee}=this.options,re=R/(V*Math.pow(2,I)),H=k.data,he=[],me=this.stride;for(let le=0;leI&&(dt+=H[Dt+pt])}if(dt>Lt&&dt>=ee){let Rt,Dt=Te*Lt,vi=Je*Lt,hi=-1,wt=((le/me|0)<<5)+(I+1)+this.points.length;for(let $t of tt){let oi=$t*me;if(H[oi+2]<=I)continue;H[oi+2]=I;let Ei=H[oi+pt];Dt+=H[oi]*Ei,vi+=H[oi+1]*Ei,H[oi+4]=wt,Y&&(Rt||(Rt=this._map(H,le,!0),hi=this.clusterProps.length,this.clusterProps.push(Rt)),Y(Rt,this._map(H,oi)))}H[le+4]=wt,he.push(Dt/dt,vi/dt,1/0,wt,-1,dt),Y&&he.push(hi)}else{for(let Rt=0;Rt1)for(let Rt of tt){let Dt=Rt*me;if(!(H[Dt+2]<=I)){H[Dt+2]=I;for(let vi=0;vi>5}_getOriginZoom(k){return(k-this.points.length)%32}_map(k,I,R){if(k[I+pt]>1){let ee=this.clusterProps[k[I+At]];return R?Object.assign({},ee):ee}let V=this.points[k[I+bt]].properties,Y=this.options.map(V);return R&&Y===V?Object.assign({},Y):Y}}function Bt(j,k,I){return{type:"Feature",id:j[k+bt],properties:Vt(j,k,I),geometry:{type:"Point",coordinates:[(R=j[k],360*(R-.5)),et(j[k+1])]}};var R}function Vt(j,k,I){let R=j[k+pt],V=R>=1e4?`${Math.round(R/1e3)}k`:R>=1e3?Math.round(R/100)/10+"k":R,Y=j[k+At],ee=Y===-1?{}:Object.assign({},I[Y]);return Object.assign(ee,{cluster:!0,cluster_id:j[k+bt],point_count:R,point_count_abbreviated:V})}function gt(j){return j/360+.5}function ui(j){let k=Math.sin(j*Math.PI/180),I=.5-.25*Math.log((1+k)/(1-k))/Math.PI;return I<0?0:I>1?1:I}function et(j){let k=(180-360*j)*Math.PI/180;return 360*Math.atan(Math.exp(k))/Math.PI-90}function vt(j,k,I,R){let V=R,Y=k+(I-k>>1),ee,re=I-k,H=j[k],he=j[k+1],me=j[I],le=j[I+1];for(let Te=k+3;TeV)ee=Te,V=Je;else if(Je===V){let tt=Math.abs(Te-Y);ttR&&(ee-k>3&&vt(j,k,ee,R),j[ee+2]=V,I-ee>3&&vt(j,ee,I,R))}function Ut(j,k,I,R,V,Y){let ee=V-I,re=Y-R;if(ee!==0||re!==0){let H=((j-I)*ee+(k-R)*re)/(ee*ee+re*re);H>1?(I=V,R=Y):H>0&&(I+=ee*H,R+=re*H)}return ee=j-I,re=k-R,ee*ee+re*re}function ut(j,k,I,R){let V={id:j??null,type:k,geometry:I,tags:R,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(k==="Point"||k==="MultiPoint"||k==="LineString")ci(V,I);else if(k==="Polygon")ci(V,I[0]);else if(k==="MultiLineString")for(let Y of I)ci(V,Y);else if(k==="MultiPolygon")for(let Y of I)ci(V,Y[0]);return V}function ci(j,k){for(let I=0;I0&&(ee+=R?(V*me-he*Y)/2:Math.sqrt(Math.pow(he-V,2)+Math.pow(me-Y,2))),V=he,Y=me}let re=k.length-3;k[2]=1,vt(k,0,re,I),k[re+2]=1,k.size=Math.abs(ee),k.start=0,k.end=k.size}function Xi(j,k,I,R){for(let V=0;V1?1:I}function Gt(j,k,I,R,V,Y,ee,re){if(R/=k,Y>=(I/=k)&&ee=R)return null;let H=[];for(let he of j){let me=he.geometry,le=he.type,Te=V===0?he.minX:he.minY,Je=V===0?he.maxX:he.maxY;if(Te>=I&&Je=R)continue;let tt=[];if(le==="Point"||le==="MultiPoint")_r(me,tt,I,R,V);else if(le==="LineString")Mr(me,tt,I,R,V,!1,re.lineMetrics);else if(le==="MultiLineString")Qr(me,tt,I,R,V,!1);else if(le==="Polygon")Qr(me,tt,I,R,V,!0);else if(le==="MultiPolygon")for(let Lt of me){let dt=[];Qr(Lt,dt,I,R,V,!0),dt.length&&tt.push(dt)}if(tt.length){if(re.lineMetrics&&le==="LineString"){for(let Lt of tt)H.push(ut(he.id,le,Lt,he.tags));continue}le!=="LineString"&&le!=="MultiLineString"||(tt.length===1?(le="LineString",tt=tt[0]):le="MultiLineString"),le!=="Point"&&le!=="MultiPoint"||(le=tt.length===3?"Point":"MultiPoint"),H.push(ut(he.id,le,tt,he.tags))}}return H.length?H:null}function _r(j,k,I,R,V){for(let Y=0;Y=I&&ee<=R&&Ui(k,j[Y],j[Y+1],j[Y+2])}}function Mr(j,k,I,R,V,Y,ee){let re=Wi(j),H=V===0?sn:yn,he,me,le=j.start;for(let dt=0;dtI&&(me=H(re,Rt,Dt,hi,wt,I),ee&&(re.start=le+he*me)):$t>R?oi=I&&(me=H(re,Rt,Dt,hi,wt,I),Ei=!0),oi>R&&$t<=R&&(me=H(re,Rt,Dt,hi,wt,R),Ei=!0),!Y&&Ei&&(ee&&(re.end=le+he*me),k.push(re),re=Wi(j)),ee&&(le+=he)}let Te=j.length-3,Je=j[Te],tt=j[Te+1],Lt=V===0?Je:tt;Lt>=I&&Lt<=R&&Ui(re,Je,tt,j[Te+2]),Te=re.length-3,Y&&Te>=3&&(re[Te]!==re[0]||re[Te+1]!==re[1])&&Ui(re,re[0],re[1],re[2]),re.length&&k.push(re)}function Wi(j){let k=[];return k.size=j.size,k.start=j.start,k.end=j.end,k}function Qr(j,k,I,R,V,Y){for(let ee of j)Mr(ee,k,I,R,V,Y,!1)}function Ui(j,k,I,R){j.push(k,I,R)}function sn(j,k,I,R,V,Y){let ee=(Y-k)/(R-k);return Ui(j,Y,I+(V-I)*ee,1),ee}function yn(j,k,I,R,V,Y){let ee=(Y-I)/(V-I);return Ui(j,k+(R-k)*ee,Y,1),ee}function Ae(j,k){let I=[];for(let R=0;R0&&k.size<(V?ee:R))return void(I.numPoints+=k.length/3);let re=[];for(let H=0;Hee)&&(I.numSimplified++,re.push(k[H],k[H+1])),I.numPoints++;V&&function(H,he){let me=0;for(let le=0,Te=H.length,Je=Te-2;le0===he)for(let le=0,Te=H.length;le24)throw new Error("maxZoom should be in the 0-24 range");if(I.promoteId&&I.generateId)throw new Error("promoteId and generateId cannot be used together.");let V=function(Y,ee){let re=[];if(Y.type==="FeatureCollection")for(let H=0;H1&&console.time("creation"),Je=this.tiles[Te]=Pr(k,I,R,V,he),this.tileCoords.push({z:I,x:R,y:V}),me)){me>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",I,R,V,Je.numFeatures,Je.numPoints,Je.numSimplified),console.timeEnd("creation"));let Ei=`z${I}`;this.stats[Ei]=(this.stats[Ei]||0)+1,this.total++}if(Je.source=k,Y==null){if(I===he.indexMaxZoom||Je.numPoints<=he.indexMaxPoints)continue}else{if(I===he.maxZoom||I===Y)continue;if(Y!=null){let Ei=Y-I;if(R!==ee>>Ei||V!==re>>Ei)continue}}if(Je.source=null,k.length===0)continue;me>1&&console.time("clipping");let tt=.5*he.buffer/he.extent,Lt=.5-tt,dt=.5+tt,Rt=1+tt,Dt=null,vi=null,hi=null,wt=null,$t=Gt(k,le,R-tt,R+dt,0,Je.minX,Je.maxX,he),oi=Gt(k,le,R+Lt,R+Rt,0,Je.minX,Je.maxX,he);k=null,$t&&(Dt=Gt($t,le,V-tt,V+dt,1,Je.minY,Je.maxY,he),vi=Gt($t,le,V+Lt,V+Rt,1,Je.minY,Je.maxY,he),$t=null),oi&&(hi=Gt(oi,le,V-tt,V+dt,1,Je.minY,Je.maxY,he),wt=Gt(oi,le,V+Lt,V+Rt,1,Je.minY,Je.maxY,he),oi=null),me>1&&console.timeEnd("clipping"),H.push(Dt||[],I+1,2*R,2*V),H.push(vi||[],I+1,2*R,2*V+1),H.push(hi||[],I+1,2*R+1,2*V),H.push(wt||[],I+1,2*R+1,2*V+1)}}getTile(k,I,R){k=+k,I=+I,R=+R;let V=this.options,{extent:Y,debug:ee}=V;if(k<0||k>24)return null;let re=1<1&&console.log("drilling down to z%d-%d-%d",k,I,R);let he,me=k,le=I,Te=R;for(;!he&&me>0;)me--,le>>=1,Te>>=1,he=this.tiles[Ji(me,le,Te)];return he&&he.source?(ee>1&&(console.log("found parent tile z%d-%d-%d",me,le,Te),console.time("drilling down")),this.splitTile(he.source,me,le,Te,k,I,R),ee>1&&console.timeEnd("drilling down"),this.tiles[H]?Ai(this.tiles[H],Y):null):null}}function Ji(j,k,I){return 32*((1<{le.properties=Je;let tt={};for(let Lt of Te)tt[Lt]=H[Lt].evaluate(me,le);return tt},ee.reduce=(Je,tt)=>{le.properties=tt;for(let Lt of Te)me.accumulated=Je[Lt],Je[Lt]=he[Lt].evaluate(me,le)},ee}(k)).load((yield this._pendingData).features):(V=yield this._pendingData,new Si(V,k.geojsonVtOptions)),this.loaded={};let Y={};if(R){let ee=R.finish();ee&&(Y.resourceTiming={},Y.resourceTiming[k.source]=JSON.parse(JSON.stringify(ee)))}return Y}catch(Y){if(delete this._pendingRequest,E.bB(Y))return{abandoned:!0};throw Y}var V})}getData(){return E._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(k){let I=this.loaded;return I&&I[k.uid]?super.reloadTile(k):this.loadTile(k)}loadAndProcessGeoJSON(k,I){return E._(this,void 0,void 0,function*(){let R=yield this.loadGeoJSON(k,I);if(delete this._pendingRequest,typeof R!="object")throw new Error(`Input data given to '${k.source}' is not a valid GeoJSON object.`);if(Ct(R,!0),k.filter){let V=E.bC(k.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(V.result==="error")throw new Error(V.value.map(ee=>`${ee.key}: ${ee.message}`).join(", "));R={type:"FeatureCollection",features:R.features.filter(ee=>V.value.evaluate({zoom:0},ee))}}return R})}loadGeoJSON(k,I){return E._(this,void 0,void 0,function*(){let{promoteId:R}=k;if(k.request){let V=yield E.h(k.request,I);return this._dataUpdateable=Ki(V.data,R)?yr(V.data,R):void 0,V.data}if(typeof k.data=="string")try{let V=JSON.parse(k.data);return this._dataUpdateable=Ki(V,R)?yr(V,R):void 0,V}catch{throw new Error(`Input data given to '${k.source}' is not a valid GeoJSON object.`)}if(!k.dataDiff)throw new Error(`Input data given to '${k.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${k.source}`);return function(V,Y,ee){var re,H,he,me;if(Y.removeAll&&V.clear(),Y.remove)for(let le of Y.remove)V.delete(le);if(Y.add)for(let le of Y.add){let Te=st(le,ee);Te!=null&&V.set(Te,le)}if(Y.update)for(let le of Y.update){let Te=V.get(le.id);if(Te==null)continue;let Je=!le.removeAllProperties&&(((re=le.removeProperties)===null||re===void 0?void 0:re.length)>0||((H=le.addOrUpdateProperties)===null||H===void 0?void 0:H.length)>0);if((le.newGeometry||le.removeAllProperties||Je)&&(Te=Object.assign({},Te),V.set(le.id,Te),Je&&(Te.properties=Object.assign({},Te.properties))),le.newGeometry&&(Te.geometry=le.newGeometry),le.removeAllProperties)Te.properties={};else if(((he=le.removeProperties)===null||he===void 0?void 0:he.length)>0)for(let tt of le.removeProperties)Object.prototype.hasOwnProperty.call(Te.properties,tt)&&delete Te.properties[tt];if(((me=le.addOrUpdateProperties)===null||me===void 0?void 0:me.length)>0)for(let{key:tt,value:Lt}of le.addOrUpdateProperties)Te.properties[tt]=Lt}}(this._dataUpdateable,k.dataDiff,R),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(k){return E._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(k){return this._geoJSONIndex.getClusterExpansionZoom(k.clusterId)}getClusterChildren(k){return this._geoJSONIndex.getChildren(k.clusterId)}getClusterLeaves(k){return this._geoJSONIndex.getLeaves(k.clusterId,k.limit,k.offset)}}class Zr{constructor(k){this.self=k,this.actor=new E.F(k),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(I,R)=>{if(this.externalWorkerSourceTypes[I])throw new Error(`Worker source with name "${I}" already registered.`);this.externalWorkerSourceTypes[I]=R},this.self.addProtocol=E.bi,this.self.removeProtocol=E.bj,this.self.registerRTLTextPlugin=I=>{if(E.bD.isParsed())throw new Error("RTL text plugin already registered.");E.bD.setMethods(I)},this.actor.registerMessageHandler("LDT",(I,R)=>this._getDEMWorkerSource(I,R.source).loadTile(R)),this.actor.registerMessageHandler("RDT",(I,R)=>E._(this,void 0,void 0,function*(){this._getDEMWorkerSource(I,R.source).removeTile(R)})),this.actor.registerMessageHandler("GCEZ",(I,R)=>E._(this,void 0,void 0,function*(){return this._getWorkerSource(I,R.type,R.source).getClusterExpansionZoom(R)})),this.actor.registerMessageHandler("GCC",(I,R)=>E._(this,void 0,void 0,function*(){return this._getWorkerSource(I,R.type,R.source).getClusterChildren(R)})),this.actor.registerMessageHandler("GCL",(I,R)=>E._(this,void 0,void 0,function*(){return this._getWorkerSource(I,R.type,R.source).getClusterLeaves(R)})),this.actor.registerMessageHandler("LD",(I,R)=>this._getWorkerSource(I,R.type,R.source).loadData(R)),this.actor.registerMessageHandler("GD",(I,R)=>this._getWorkerSource(I,R.type,R.source).getData()),this.actor.registerMessageHandler("LT",(I,R)=>this._getWorkerSource(I,R.type,R.source).loadTile(R)),this.actor.registerMessageHandler("RT",(I,R)=>this._getWorkerSource(I,R.type,R.source).reloadTile(R)),this.actor.registerMessageHandler("AT",(I,R)=>this._getWorkerSource(I,R.type,R.source).abortTile(R)),this.actor.registerMessageHandler("RMT",(I,R)=>this._getWorkerSource(I,R.type,R.source).removeTile(R)),this.actor.registerMessageHandler("RS",(I,R)=>E._(this,void 0,void 0,function*(){if(!this.workerSources[I]||!this.workerSources[I][R.type]||!this.workerSources[I][R.type][R.source])return;let V=this.workerSources[I][R.type][R.source];delete this.workerSources[I][R.type][R.source],V.removeSource!==void 0&&V.removeSource(R)})),this.actor.registerMessageHandler("RM",I=>E._(this,void 0,void 0,function*(){delete this.layerIndexes[I],delete this.availableImages[I],delete this.workerSources[I],delete this.demWorkerSources[I]})),this.actor.registerMessageHandler("SR",(I,R)=>E._(this,void 0,void 0,function*(){this.referrer=R})),this.actor.registerMessageHandler("SRPS",(I,R)=>this._syncRTLPluginState(I,R)),this.actor.registerMessageHandler("IS",(I,R)=>E._(this,void 0,void 0,function*(){this.self.importScripts(R)})),this.actor.registerMessageHandler("SI",(I,R)=>this._setImages(I,R)),this.actor.registerMessageHandler("UL",(I,R)=>E._(this,void 0,void 0,function*(){this._getLayerIndex(I).update(R.layers,R.removedIds)})),this.actor.registerMessageHandler("SL",(I,R)=>E._(this,void 0,void 0,function*(){this._getLayerIndex(I).replace(R)}))}_setImages(k,I){return E._(this,void 0,void 0,function*(){this.availableImages[k]=I;for(let R in this.workerSources[k]){let V=this.workerSources[k][R];for(let Y in V)V[Y].availableImages=I}})}_syncRTLPluginState(k,I){return E._(this,void 0,void 0,function*(){if(E.bD.isParsed())return E.bD.getState();if(I.pluginStatus!=="loading")return E.bD.setState(I),I;let R=I.pluginURL;if(this.self.importScripts(R),E.bD.isParsed()){let V={pluginStatus:"loaded",pluginURL:R};return E.bD.setState(V),V}throw E.bD.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${R}`)})}_getAvailableImages(k){let I=this.availableImages[k];return I||(I=[]),I}_getLayerIndex(k){let I=this.layerIndexes[k];return I||(I=this.layerIndexes[k]=new p),I}_getWorkerSource(k,I,R){if(this.workerSources[k]||(this.workerSources[k]={}),this.workerSources[k][I]||(this.workerSources[k][I]={}),!this.workerSources[k][I][R]){let V={sendAsync:(Y,ee)=>(Y.targetMapId=k,this.actor.sendAsync(Y,ee))};switch(I){case"vector":this.workerSources[k][I][R]=new se(V,this._getLayerIndex(k),this._getAvailableImages(k));break;case"geojson":this.workerSources[k][I][R]=new on(V,this._getLayerIndex(k),this._getAvailableImages(k));break;default:this.workerSources[k][I][R]=new this.externalWorkerSourceTypes[I](V,this._getLayerIndex(k),this._getAvailableImages(k))}}return this.workerSources[k][I][R]}_getDEMWorkerSource(k,I){return this.demWorkerSources[k]||(this.demWorkerSources[k]={}),this.demWorkerSources[k][I]||(this.demWorkerSources[k][I]=new X),this.demWorkerSources[k][I]}}return E.i(self)&&(self.worker=new Zr(self)),Zr}),F("index",["exports","./shared"],function(E,p){"use strict";var ue="4.7.1";let pe,De,se={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:c=>new Promise((e,n)=>{let s=requestAnimationFrame(e);c.signal.addEventListener("abort",()=>{cancelAnimationFrame(s),n(p.c())})}),getImageData(c,e=0){return this.getImageCanvasContext(c).getImageData(-e,-e,c.width+2*e,c.height+2*e)},getImageCanvasContext(c){let e=window.document.createElement("canvas"),n=e.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("failed to create canvas 2d context");return e.width=c.width,e.height=c.height,n.drawImage(c,0,0,c.width,c.height),n},resolveURL:c=>(pe||(pe=document.createElement("a")),pe.href=c,pe.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(De==null&&(De=matchMedia("(prefers-reduced-motion: reduce)")),De.matches)}};class X{static testProp(e){if(!X.docStyle)return e[0];for(let n=0;n{window.removeEventListener("click",X.suppressClickInternal,!0)},0)}static getScale(e){let n=e.getBoundingClientRect();return{x:n.width/e.offsetWidth||1,y:n.height/e.offsetHeight||1,boundingClientRect:n}}static getPoint(e,n,s){let o=n.boundingClientRect;return new p.P((s.clientX-o.left)/n.x-e.clientLeft,(s.clientY-o.top)/n.y-e.clientTop)}static mousePos(e,n){let s=X.getScale(e);return X.getPoint(e,s,n)}static touchPos(e,n){let s=[],o=X.getScale(e);for(let u=0;u{yt&&zt(yt),yt=null,Pt=!0},Ct.onerror=()=>{li=!0,yt=null},Ct.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(c){let e,n,s,o;c.resetRequestQueue=()=>{e=[],n=0,s=0,o={}},c.addThrottleControl=y=>{let b=s++;return o[b]=y,b},c.removeThrottleControl=y=>{delete o[y],m()},c.getImage=(y,b,T=!0)=>new Promise((C,P)=>{Mt.supported&&(y.headers||(y.headers={}),y.headers.accept="image/webp,*/*"),p.e(y,{type:"image"}),e.push({abortController:b,requestParameters:y,supportImageRefresh:T,state:"queued",onError:L=>{P(L)},onSuccess:L=>{C(L)}}),m()});let u=y=>p._(this,void 0,void 0,function*(){y.state="running";let{requestParameters:b,supportImageRefresh:T,onError:C,onSuccess:P,abortController:L}=y,O=T===!1&&!p.i(self)&&!p.g(b.url)&&(!b.headers||Object.keys(b.headers).reduce((G,W)=>G&&W==="accept",!0));n++;let U=O?_(b,L):p.m(b,L);try{let G=yield U;delete y.abortController,y.state="completed",G.data instanceof HTMLImageElement||p.b(G.data)?P(G):G.data&&P({data:yield(Z=G.data,typeof createImageBitmap=="function"?p.d(Z):p.f(Z)),cacheControl:G.cacheControl,expires:G.expires})}catch(G){delete y.abortController,C(G)}finally{n--,m()}var Z}),m=()=>{let y=(()=>{for(let b of Object.keys(o))if(o[b]())return!0;return!1})()?p.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:p.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let b=n;b0;b++){let T=e.shift();T.abortController.signal.aborted?b--:u(T)}},_=(y,b)=>new Promise((T,C)=>{let P=new Image,L=y.url,O=y.credentials;O&&O==="include"?P.crossOrigin="use-credentials":(O&&O==="same-origin"||!p.s(L))&&(P.crossOrigin="anonymous"),b.signal.addEventListener("abort",()=>{P.src="",C(p.c())}),P.fetchPriority="high",P.onload=()=>{P.onerror=P.onload=null,T({data:P})},P.onerror=()=>{P.onerror=P.onload=null,b.signal.aborted||C(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."))},P.src=L})}(jt||(jt={})),jt.resetRequestQueue();class xe{constructor(e){this._transformRequestFn=e}transformRequest(e,n){return this._transformRequestFn&&this._transformRequestFn(e,n)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function Se(c){var e=new p.A(3);return e[0]=c[0],e[1]=c[1],e[2]=c[2],e}var Me,He=function(c,e,n){return c[0]=e[0]-n[0],c[1]=e[1]-n[1],c[2]=e[2]-n[2],c};Me=new p.A(3),p.A!=Float32Array&&(Me[0]=0,Me[1]=0,Me[2]=0);var ye=function(c){var e=c[0],n=c[1];return e*e+n*n};function ve(c){let e=[];if(typeof c=="string")e.push({id:"default",url:c});else if(c&&c.length>0){let n=[];for(let{id:s,url:o}of c){let u=`${s}${o}`;n.indexOf(u)===-1&&(n.push(u),e.push({id:s,url:o}))}}return e}function Fe(c,e,n){let s=c.split("?");return s[0]+=`${e}${n}`,s.join("?")}(function(){var c=new p.A(2);p.A!=Float32Array&&(c[0]=0,c[1]=0)})();class ge{constructor(e,n,s,o){this.context=e,this.format=s,this.texture=e.gl.createTexture(),this.update(n,o)}update(e,n,s){let{width:o,height:u}=e,m=!(this.size&&this.size[0]===o&&this.size[1]===u||s),{context:_}=this,{gl:y}=_;if(this.useMipmap=!!(n&&n.useMipmap),y.bindTexture(y.TEXTURE_2D,this.texture),_.pixelStoreUnpackFlipY.set(!1),_.pixelStoreUnpack.set(1),_.pixelStoreUnpackPremultiplyAlpha.set(this.format===y.RGBA&&(!n||n.premultiply!==!1)),m)this.size=[o,u],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||p.b(e)?y.texImage2D(y.TEXTURE_2D,0,this.format,this.format,y.UNSIGNED_BYTE,e):y.texImage2D(y.TEXTURE_2D,0,this.format,o,u,0,this.format,y.UNSIGNED_BYTE,e.data);else{let{x:b,y:T}=s||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||p.b(e)?y.texSubImage2D(y.TEXTURE_2D,0,b,T,y.RGBA,y.UNSIGNED_BYTE,e):y.texSubImage2D(y.TEXTURE_2D,0,b,T,o,u,y.RGBA,y.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&y.generateMipmap(y.TEXTURE_2D)}bind(e,n,s){let{context:o}=this,{gl:u}=o;u.bindTexture(u.TEXTURE_2D,this.texture),s!==u.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=u.LINEAR),e!==this.filter&&(u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,e),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,s||e),this.filter=e),n!==this.wrap&&(u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,n),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,n),this.wrap=n)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}function Ke(c){let{userImage:e}=c;return!!(e&&e.render&&e.render())&&(c.data.replace(new Uint8Array(e.data.buffer)),!0)}class we extends p.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new p.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:n,promiseResolve:s}of this.requestors)s(this._getImagesForIds(n));this.requestors=[]}}getImage(e){let n=this.images[e];if(n&&!n.data&&n.spriteData){let s=n.spriteData;n.data=new p.R({width:s.width,height:s.height},s.context.getImageData(s.x,s.y,s.width,s.height).data),n.spriteData=null}return n}addImage(e,n){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,n)&&(this.images[e]=n)}_validate(e,n){let s=!0,o=n.data||n.spriteData;return this._validateStretch(n.stretchX,o&&o.width)||(this.fire(new p.j(new Error(`Image "${e}" has invalid "stretchX" value`))),s=!1),this._validateStretch(n.stretchY,o&&o.height)||(this.fire(new p.j(new Error(`Image "${e}" has invalid "stretchY" value`))),s=!1),this._validateContent(n.content,n)||(this.fire(new p.j(new Error(`Image "${e}" has invalid "content" value`))),s=!1),s}_validateStretch(e,n){if(!e)return!0;let s=0;for(let o of e){if(o[0]{let o=!0;if(!this.isLoaded())for(let u of e)this.images[u]||(o=!1);this.isLoaded()||o?n(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:n})})}_getImagesForIds(e){let n={};for(let s of e){let o=this.getImage(s);o||(this.fire(new p.k("styleimagemissing",{id:s})),o=this.getImage(s)),o?n[s]={data:o.data.clone(),pixelRatio:o.pixelRatio,sdf:o.sdf,version:o.version,stretchX:o.stretchX,stretchY:o.stretchY,content:o.content,textFitWidth:o.textFitWidth,textFitHeight:o.textFitHeight,hasRenderCallback:!!(o.userImage&&o.userImage.render)}:p.w(`Image "${s}" 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 n}getPixelSize(){let{width:e,height:n}=this.atlasImage;return{width:e,height:n}}getPattern(e){let n=this.patterns[e],s=this.getImage(e);if(!s)return null;if(n&&n.position.version===s.version)return n.position;if(n)n.position.version=s.version;else{let o={w:s.data.width+2,h:s.data.height+2,x:0,y:0},u=new p.I(o,s);this.patterns[e]={bin:o,position:u}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){let n=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new ge(e,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){let e=[];for(let u in this.patterns)e.push(this.patterns[u].bin);let{w:n,h:s}=p.p(e),o=this.atlasImage;o.resize({width:n||1,height:s||1});for(let u in this.patterns){let{bin:m}=this.patterns[u],_=m.x+1,y=m.y+1,b=this.getImage(u).data,T=b.width,C=b.height;p.R.copy(b,o,{x:0,y:0},{x:_,y},{width:T,height:C}),p.R.copy(b,o,{x:0,y:C-1},{x:_,y:y-1},{width:T,height:1}),p.R.copy(b,o,{x:0,y:0},{x:_,y:y+C},{width:T,height:1}),p.R.copy(b,o,{x:T-1,y:0},{x:_-1,y},{width:1,height:C}),p.R.copy(b,o,{x:0,y:0},{x:_+T,y},{width:1,height:C})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let n of e){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;let s=this.getImage(n);s||p.w(`Image with ID: "${n}" was not found`),Ke(s)&&this.updateImage(n,s)}}}let Ye=1e20;function ht(c,e,n,s,o,u,m,_,y){for(let b=e;b-1);y++,u[y]=_,m[y]=b,m[y+1]=Ye}for(let _=0,y=0;_65535)throw new Error("glyphs > 65535 not supported");if(s.ranges[u])return{stack:e,id:n,glyph:o};if(!this.url)throw new Error("glyphsUrl is not set");if(!s.requests[u]){let _=rt.loadGlyphRange(e,u,this.url,this.requestManager);s.requests[u]=_}let m=yield s.requests[u];for(let _ in m)this._doesCharSupportLocalGlyph(+_)||(s.glyphs[+_]=m[+_]);return s.ranges[u]=!0,{stack:e,id:n,glyph:m[n]||null}})}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&/\p{Ideo}|\p{sc=Hang}|\p{sc=Hira}|\p{sc=Kana}/u.test(String.fromCodePoint(e))}_tinySDF(e,n,s){let o=this.localIdeographFontFamily;if(!o||!this._doesCharSupportLocalGlyph(s))return;let u=e.tinySDF;if(!u){let _="400";/bold/i.test(n)?_="900":/medium/i.test(n)?_="500":/light/i.test(n)&&(_="200"),u=e.tinySDF=new rt.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:o,fontWeight:_})}let m=u.draw(String.fromCharCode(s));return{id:s,bitmap:new p.o({width:m.width||60,height:m.height||60},m.data),metrics:{width:m.glyphWidth/2||24,height:m.glyphHeight/2||24,left:m.glyphLeft/2+.5||0,top:m.glyphTop/2-27.5||-8,advance:m.glyphAdvance/2||24,isDoubleResolution:!0}}}}rt.loadGlyphRange=function(c,e,n,s){return p._(this,void 0,void 0,function*(){let o=256*e,u=o+255,m=s.transformRequest(n.replace("{fontstack}",c).replace("{range}",`${o}-${u}`),"Glyphs"),_=yield p.l(m,new AbortController);if(!_||!_.data)throw new Error(`Could not load glyph range. range: ${e}, ${o}-${u}`);let y={};for(let b of p.n(_.data))y[b.id]=b;return y})},rt.TinySDF=class{constructor({fontSize:c=24,buffer:e=3,radius:n=8,cutoff:s=.25,fontFamily:o="sans-serif",fontWeight:u="normal",fontStyle:m="normal"}={}){this.buffer=e,this.cutoff=s,this.radius=n;let _=this.size=c+4*e,y=this._createCanvas(_),b=this.ctx=y.getContext("2d",{willReadFrequently:!0});b.font=`${m} ${u} ${c}px ${o}`,b.textBaseline="alphabetic",b.textAlign="left",b.fillStyle="black",this.gridOuter=new Float64Array(_*_),this.gridInner=new Float64Array(_*_),this.f=new Float64Array(_),this.z=new Float64Array(_+1),this.v=new Uint16Array(_)}_createCanvas(c){let e=document.createElement("canvas");return e.width=e.height=c,e}draw(c){let{width:e,actualBoundingBoxAscent:n,actualBoundingBoxDescent:s,actualBoundingBoxLeft:o,actualBoundingBoxRight:u}=this.ctx.measureText(c),m=Math.ceil(n),_=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(u-o))),y=Math.min(this.size-this.buffer,m+Math.ceil(s)),b=_+2*this.buffer,T=y+2*this.buffer,C=Math.max(b*T,0),P=new Uint8ClampedArray(C),L={data:P,width:b,height:T,glyphWidth:_,glyphHeight:y,glyphTop:m,glyphLeft:0,glyphAdvance:e};if(_===0||y===0)return L;let{ctx:O,buffer:U,gridInner:Z,gridOuter:G}=this;O.clearRect(U,U,_,y),O.fillText(c,U,U+m);let W=O.getImageData(U,U,_,y);G.fill(Ye,0,C),Z.fill(0,0,C);for(let N=0;N0?fe*fe:0,Z[ae]=fe<0?fe*fe:0}}ht(G,0,0,b,T,b,this.f,this.v,this.z),ht(Z,U,U,_,y,b,this.f,this.v,this.z);for(let N=0;N1&&(y=e[++_]);let T=Math.abs(b-y.left),C=Math.abs(b-y.right),P=Math.min(T,C),L,O=u/s*(o+1);if(y.isDash){let U=o-Math.abs(O);L=Math.sqrt(P*P+U*U)}else L=o-Math.sqrt(P*P+O*O);this.data[m+b]=Math.max(0,Math.min(255,L+128))}}}addRegularDash(e){for(let _=e.length-1;_>=0;--_){let y=e[_],b=e[_+1];y.zeroLength?e.splice(_,1):b&&b.isDash===y.isDash&&(b.left=y.left,e.splice(_,1))}let n=e[0],s=e[e.length-1];n.isDash===s.isDash&&(n.left=s.left-this.width,s.right=n.right+this.width);let o=this.width*this.nextRow,u=0,m=e[u];for(let _=0;_1&&(m=e[++u]);let y=Math.abs(_-m.left),b=Math.abs(_-m.right),T=Math.min(y,b);this.data[o+_]=Math.max(0,Math.min(255,(m.isDash?T:-T)+128))}}addDash(e,n){let s=n?7:0,o=2*s+1;if(this.nextRow+o>this.height)return p.w("LineAtlas out of space"),null;let u=0;for(let _=0;_{n.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[mt]}numActive(){return Object.keys(this.active).length}}let Vt=Math.floor(se.hardwareConcurrency/2),gt,ui;function et(){return gt||(gt=new Bt),gt}Bt.workerCount=p.C(globalThis)?Math.max(Math.min(Vt,3),1):1;class vt{constructor(e,n){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=n;let s=this.workerPool.acquire(n);for(let o=0;o{n.remove()}),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,n){for(let s of this.actors)s.registerMessageHandler(e,n)}}function Ut(){return ui||(ui=new vt(et(),p.G),ui.registerMessageHandler("GR",(c,e,n)=>p.m(e,n))),ui}function ut(c,e){let n=p.H();return p.J(n,n,[1,1,0]),p.K(n,n,[.5*c.width,.5*c.height,1]),p.L(n,n,c.calculatePosMatrix(e.toUnwrapped()))}function ci(c,e,n,s,o,u){let m=function(C,P,L){if(C)for(let O of C){let U=P[O];if(U&&U.source===L&&U.type==="fill-extrusion")return!0}else for(let O in P){let U=P[O];if(U.source===L&&U.type==="fill-extrusion")return!0}return!1}(o&&o.layers,e,c.id),_=u.maxPitchScaleFactor(),y=c.tilesIn(s,_,m);y.sort(di);let b=[];for(let C of y)b.push({wrappedTileID:C.tileID.wrapped().key,queryResults:C.tile.queryRenderedFeatures(e,n,c._state,C.queryGeometry,C.cameraQueryGeometry,C.scale,o,u,_,ut(c.transform,C.tileID))});let T=function(C){let P={},L={};for(let O of C){let U=O.queryResults,Z=O.wrappedTileID,G=L[Z]=L[Z]||{};for(let W in U){let N=U[W],Q=G[W]=G[W]||{},te=P[W]=P[W]||[];for(let ae of N)Q[ae.featureIndex]||(Q[ae.featureIndex]=!0,te.push(ae))}}return P}(b);for(let C in T)T[C].forEach(P=>{let L=P.feature,O=c.getFeatureState(L.layer["source-layer"],L.id);L.source=L.layer.source,L.layer["source-layer"]&&(L.sourceLayer=L.layer["source-layer"]),L.state=O});return T}function di(c,e){let n=c.tileID,s=e.tileID;return n.overscaledZ-s.overscaledZ||n.canonical.y-s.canonical.y||n.wrap-s.wrap||n.canonical.x-s.canonical.x}function Kt(c,e,n){return p._(this,void 0,void 0,function*(){let s=c;if(c.url?s=(yield p.h(e.transformRequest(c.url,"Source"),n)).data:yield se.frameAsync(n),!s)return null;let o=p.M(p.e(s,c),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in s&&s.vector_layers&&(o.vectorLayerIds=s.vector_layers.map(u=>u.id)),o})}class oe{constructor(e,n){e&&(n?this.setSouthWest(e).setNorthEast(n):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof p.N?new p.N(e.lng,e.lat):p.N.convert(e),this}setSouthWest(e){return this._sw=e instanceof p.N?new p.N(e.lng,e.lat):p.N.convert(e),this}extend(e){let n=this._sw,s=this._ne,o,u;if(e instanceof p.N)o=e,u=e;else{if(!(e instanceof oe))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(oe.convert(e)):this.extend(p.N.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(p.N.convert(e)):this;if(o=e._sw,u=e._ne,!o||!u)return this}return n||s?(n.lng=Math.min(o.lng,n.lng),n.lat=Math.min(o.lat,n.lat),s.lng=Math.max(u.lng,s.lng),s.lat=Math.max(u.lat,s.lat)):(this._sw=new p.N(o.lng,o.lat),this._ne=new p.N(u.lng,u.lat)),this}getCenter(){return new p.N((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 p.N(this.getWest(),this.getNorth())}getSouthEast(){return new p.N(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(e){let{lng:n,lat:s}=p.N.convert(e),o=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=s&&s<=this._ne.lat&&o}static convert(e){return e instanceof oe?e:e&&new oe(e)}static fromLngLat(e,n=0){let s=360*n/40075017,o=s/Math.cos(Math.PI/180*e.lat);return new oe(new p.N(e.lng-o,e.lat-s),new p.N(e.lng+o,e.lat+s))}adjustAntiMeridian(){let e=new p.N(this._sw.lng,this._sw.lat),n=new p.N(this._ne.lng,this._ne.lat);return new oe(e,e.lng>n.lng?new p.N(n.lng+360,n.lat):n)}}class Xi{constructor(e,n,s){this.bounds=oe.convert(this.validateBounds(e)),this.minzoom=n||0,this.maxzoom=s||24}validateBounds(e){return Array.isArray(e)&&e.length===4?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){let n=Math.pow(2,e.z),s=Math.floor(p.O(this.bounds.getWest())*n),o=Math.floor(p.Q(this.bounds.getNorth())*n),u=Math.ceil(p.O(this.bounds.getEast())*n),m=Math.ceil(p.Q(this.bounds.getSouth())*n);return e.x>=s&&e.x=o&&e.y{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return p.e({},this._options)}loadTile(e){return p._(this,void 0,void 0,function*(){let n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),s={request:this.map._requestManager.transformRequest(n,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};s.request.collectResourceTiming=this._collectResourceTiming;let o="RT";if(e.actor&&e.state!=="expired"){if(e.state==="loading")return new Promise((u,m)=>{e.reloadPromise={resolve:u,reject:m}})}else e.actor=this.dispatcher.getActor(),o="LT";e.abortController=new AbortController;try{let u=yield e.actor.sendAsync({type:o,data:s},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,u)}catch(u){if(delete e.abortController,e.aborted)return;if(u&&u.status!==404)throw u;this._afterTileLoadWorkerResponse(e,null)}})}_afterTileLoadWorkerResponse(e,n){if(n&&n.resourceTiming&&(e.resourceTiming=n.resourceTiming),n&&this.map._refreshExpiredTiles&&e.setExpiryData(n),e.loadVectorData(n,this.map.painter),e.reloadPromise){let s=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(s.resolve).catch(s.reject)}}abortTile(e){return p._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}}))})}unloadTile(e){return p._(this,void 0,void 0,function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class Et extends p.E{constructor(e,n,s,o){super(),this.id=e,this.dispatcher=s,this.setEventedParent(o),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=p.e({type:"raster"},n),p.e(this,p.M(n,["url","scheme","tileSize"]))}load(){return p._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new p.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let e=yield Kt(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,e&&(p.e(this,e),e.bounds&&(this.tileBounds=new Xi(e.bounds,this.minzoom,this.maxzoom)),this.fire(new p.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new p.k("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new p.j(e))}})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return p.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return p._(this,void 0,void 0,function*(){let n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{let s=yield jt.getImage(this.map._requestManager.transformRequest(n,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(s&&s.data){this.map._refreshExpiredTiles&&s.cacheControl&&s.expires&&e.setExpiryData({cacheControl:s.cacheControl,expires:s.expires});let o=this.map.painter.context,u=o.gl,m=s.data;e.texture=this.map.painter.getTileTexture(m.width),e.texture?e.texture.update(m,{useMipmap:!0}):(e.texture=new ge(o,m,u.RGBA,{useMipmap:!0}),e.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE,u.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(s){if(delete e.abortController,e.aborted)e.state="unloaded";else if(s)throw e.state="errored",s}})}abortTile(e){return p._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)})}unloadTile(e){return p._(this,void 0,void 0,function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)})}hasTransition(){return!1}}class Gt extends Et{constructor(e,n,s,o){super(e,n,s,o),this.type="raster-dem",this.maxzoom=22,this._options=p.e({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox",this.redFactor=n.redFactor,this.greenFactor=n.greenFactor,this.blueFactor=n.blueFactor,this.baseShift=n.baseShift}loadTile(e){return p._(this,void 0,void 0,function*(){let n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),s=this.map._requestManager.transformRequest(n,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{let o=yield jt.getImage(s,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(o&&o.data){let u=o.data;this.map._refreshExpiredTiles&&o.cacheControl&&o.expires&&e.setExpiryData({cacheControl:o.cacheControl,expires:o.expires});let m=p.b(u)&&p.U()?u:yield this.readImageNow(u),_={type:this.type,uid:e.uid,source:this.id,rawImageData:m,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||e.state==="expired"){e.actor=this.dispatcher.getActor();let y=yield e.actor.sendAsync({type:"LDT",data:_});e.dem=y,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(o){if(delete e.abortController,e.aborted)e.state="unloaded";else if(o)throw e.state="errored",o}})}readImageNow(e){return p._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&p.V()){let n=e.width+2,s=e.height+2;try{return new p.R({width:n,height:s},yield p.W(e,-1,-1,n,s))}catch{}}return se.getImageData(e,1)})}_getNeighboringTiles(e){let n=e.canonical,s=Math.pow(2,n.z),o=(n.x-1+s)%s,u=n.x===0?e.wrap-1:e.wrap,m=(n.x+1+s)%s,_=n.x+1===s?e.wrap+1:e.wrap,y={};return y[new p.S(e.overscaledZ,u,n.z,o,n.y).key]={backfilled:!1},y[new p.S(e.overscaledZ,_,n.z,m,n.y).key]={backfilled:!1},n.y>0&&(y[new p.S(e.overscaledZ,u,n.z,o,n.y-1).key]={backfilled:!1},y[new p.S(e.overscaledZ,e.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},y[new p.S(e.overscaledZ,_,n.z,m,n.y-1).key]={backfilled:!1}),n.y+10&&p.e(u,{resourceTiming:o}),this.fire(new p.k("data",Object.assign(Object.assign({},u),{sourceDataType:"metadata"}))),this.fire(new p.k("data",Object.assign(Object.assign({},u),{sourceDataType:"content"})))}catch(s){if(this._pendingLoads--,this._removed)return void this.fire(new p.k("dataabort",{dataType:"source"}));this.fire(new p.j(s))}})}loaded(){return this._pendingLoads===0}loadTile(e){return p._(this,void 0,void 0,function*(){let n=e.actor?"RT":"LT";e.actor=this.actor;let s={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};e.abortController=new AbortController;let o=yield this.actor.sendAsync({type:n,data:s},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(o,this.map.painter,n==="RT")})}abortTile(e){return p._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0})}unloadTile(e){return p._(this,void 0,void 0,function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:e.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 p.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Mr=p.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Wi extends p.E{constructor(e,n,s,o){super(),this.id=e,this.dispatcher=s,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(o),this.options=n}load(e){return p._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new p.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{let n=yield jt.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,n&&n.data&&(this.image=n.data,e&&(this.coordinates=e),this._finishLoading())}catch(n){this._request=null,this._loaded=!0,this.fire(new p.j(n))}})}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new p.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;let n=e.map(p.Z.fromLngLat);this.tileID=function(o){let u=1/0,m=1/0,_=-1/0,y=-1/0;for(let P of o)u=Math.min(u,P.x),m=Math.min(m,P.y),_=Math.max(_,P.x),y=Math.max(y,P.y);let b=Math.max(_-u,y-m),T=Math.max(0,Math.floor(-Math.log(b)/Math.LN2)),C=Math.pow(2,T);return new p.a1(T,Math.floor((u+_)/2*C),Math.floor((m+y)/2*C))}(n),this.minzoom=this.maxzoom=this.tileID.z;let s=n.map(o=>this.tileID.getTilePoint(o)._round());return this._boundsArray=new p.$,this._boundsArray.emplaceBack(s[0].x,s[0].y,0,0),this._boundsArray.emplaceBack(s[1].x,s[1].y,p.X,0),this._boundsArray.emplaceBack(s[3].x,s[3].y,0,p.X),this._boundsArray.emplaceBack(s[2].x,s[2].y,p.X,p.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new p.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let e=this.map.painter.context,n=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Mr.members)),this.boundsSegments||(this.boundsSegments=p.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new ge(e,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let s=!1;for(let o in this.tiles){let u=this.tiles[o];u.state!=="loaded"&&(u.state="loaded",u.texture=this.texture,s=!0)}s&&this.fire(new p.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return p._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Qr extends Wi{constructor(e,n,s,o){super(e,n,s,o),this.roundZoom=!0,this.type="video",this.options=n}load(){return p._(this,void 0,void 0,function*(){this._loaded=!1;let e=this.options;this.urls=[];for(let n of e.urls)this.urls.push(this.map._requestManager.transformRequest(n,"Source").url);try{let n=yield p.a3(this.urls);if(this._loaded=!0,!n)return;this.video=n,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(n){this.fire(new p.j(n))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let n=this.video.seekable;en.end(0)?this.fire(new p.j(new p.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let e=this.map.painter.context,n=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Mr.members)),this.boundsSegments||(this.boundsSegments=p.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new ge(e,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let s=!1;for(let o in this.tiles){let u=this.tiles[o];u.state!=="loaded"&&(u.state="loaded",u.texture=this.texture,s=!0)}s&&this.fire(new p.k("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 Ui extends Wi{constructor(e,n,s,o){super(e,n,s,o),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(u=>!Array.isArray(u)||u.length!==2||u.some(m=>typeof m!="number"))||this.fire(new p.j(new p.a2(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new p.j(new p.a2(`sources.${e}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new p.j(new p.a2(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new p.j(new p.a2(`sources.${e}`,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 p.j(new p.a2(`sources.${e}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){return p._(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 p.j(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(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let n=this.map.painter.context,s=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,Mr.members)),this.boundsSegments||(this.boundsSegments=p.a0.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new ge(n,this.canvas,s.RGBA,{premultiply:!0});let o=!1;for(let u in this.tiles){let m=this.tiles[u];m.state!=="loaded"&&(m.state="loaded",m.texture=this.texture,o=!0)}o&&this.fire(new p.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}let sn={},yn=c=>{switch(c){case"geojson":return _r;case"image":return Wi;case"raster":return Et;case"raster-dem":return Gt;case"vector":return kr;case"video":return Qr;case"canvas":return Ui}return sn[c]},Ae="RTLPluginLoaded";class or extends p.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Ut()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(n=>{throw this.status="error",n})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return p._(this,arguments,void 0,function*(n,s=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=se.resolveURL(n),!this.url)throw new Error(`requested url ${n} is invalid`);if(this.status==="unavailable"){if(!s)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return p._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new p.k(Ae))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Ai=null;function lr(){return Ai||(Ai=new or),Ai}class Pr{constructor(e,n){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=p.a4(),this.uses=0,this.tileSize=n,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(e){let n=e+this.timeAdded;nu.getLayer(b)).filter(Boolean);if(y.length!==0){_.layers=y,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map(b=>y.filter(T=>T.id===b)[0]));for(let b of y)m[b.id]=_}}return m}(e.buckets,n.style),this.hasSymbolBuckets=!1;for(let o in this.buckets){let u=this.buckets[o];if(u instanceof p.a6){if(this.hasSymbolBuckets=!0,!s)break;u.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let o in this.buckets){let u=this.buckets[o];if(u instanceof p.a6&&u.hasRTLText){this.hasRTLText=!0,lr().lazyLoad();break}}this.queryPadding=0;for(let o in this.buckets){let u=this.buckets[o];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(o).queryRadius(u))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new p.a5}unloadVectorData(){for(let e in this.buckets)this.buckets[e].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(e){return this.buckets[e.id]}upload(e){for(let s in this.buckets){let o=this.buckets[s];o.uploadPending()&&o.upload(e)}let n=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new ge(e,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new ge(e,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,n,s,o,u,m,_,y,b,T){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:o,cameraQueryGeometry:u,scale:m,tileSize:this.tileSize,pixelPosMatrix:T,transform:y,params:_,queryPadding:this.queryPadding*b},e,n,s):{}}querySourceFeatures(e,n){let s=this.latestFeatureIndex;if(!s||!s.rawTileData)return;let o=s.loadVTLayers(),u=n&&n.sourceLayer?n.sourceLayer:"",m=o._geojsonTileLayer||o[u];if(!m)return;let _=p.a7(n&&n.filter),{z:y,x:b,y:T}=this.tileID.canonical,C={z:y,x:b,y:T};for(let P=0;Ps)o=!1;else if(n)if(this.expirationTime{this.remove(e,u)},s)),this.data[o].push(u),this.order.push(o),this.order.length>this.max){let m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let n=this.data[e].shift();return n.timeout&&clearTimeout(n.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),n.value}getByKey(e){let n=this.data[e];return n?n[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,n){if(!this.has(e))return this;let s=e.wrapped().key,o=n===void 0?0:this.data[s].indexOf(n),u=this.data[s][o];return this.data[s].splice(o,1),u.timeout&&clearTimeout(u.timeout),this.data[s].length===0&&delete this.data[s],this.onRemove(u.value),this.order.splice(this.order.indexOf(s),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(e){let n=[];for(let s in this.data)for(let o of this.data[s])e(o.value)||n.push(o);for(let s of n)this.remove(s.value.tileID,s)}}class _t{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,n,s){let o=String(n);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][o]=this.stateChanges[e][o]||{},p.e(this.stateChanges[e][o],s),this.deletedStates[e]===null){this.deletedStates[e]={};for(let u in this.state[e])u!==o&&(this.deletedStates[e][u]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][o]===null){this.deletedStates[e][o]={};for(let u in this.state[e][o])s[u]||(this.deletedStates[e][o][u]=null)}else for(let u in s)this.deletedStates[e]&&this.deletedStates[e][o]&&this.deletedStates[e][o][u]===null&&delete this.deletedStates[e][o][u]}removeFeatureState(e,n,s){if(this.deletedStates[e]===null)return;let o=String(n);if(this.deletedStates[e]=this.deletedStates[e]||{},s&&n!==void 0)this.deletedStates[e][o]!==null&&(this.deletedStates[e][o]=this.deletedStates[e][o]||{},this.deletedStates[e][o][s]=null);else if(n!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][o])for(s in this.deletedStates[e][o]={},this.stateChanges[e][o])this.deletedStates[e][o][s]=null;else this.deletedStates[e][o]=null;else this.deletedStates[e]=null}getState(e,n){let s=String(n),o=p.e({},(this.state[e]||{})[s],(this.stateChanges[e]||{})[s]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){let u=this.deletedStates[e][n];if(u===null)return{};for(let m in u)delete o[m]}return o}initializeTileState(e,n){e.setFeatureState(this.state,n)}coalesceChanges(e,n){let s={};for(let o in this.stateChanges){this.state[o]=this.state[o]||{};let u={};for(let m in this.stateChanges[o])this.state[o][m]||(this.state[o][m]={}),p.e(this.state[o][m],this.stateChanges[o][m]),u[m]=this.state[o][m];s[o]=u}for(let o in this.deletedStates){this.state[o]=this.state[o]||{};let u={};if(this.deletedStates[o]===null)for(let m in this.state[o])u[m]={},this.state[o][m]={};else for(let m in this.deletedStates[o]){if(this.deletedStates[o][m]===null)this.state[o][m]={};else for(let _ of Object.keys(this.deletedStates[o][m]))delete this.state[o][m][_];u[m]=this.state[o][m]}s[o]=s[o]||{},p.e(s[o],u)}if(this.stateChanges={},this.deletedStates={},Object.keys(s).length!==0)for(let o in e)e[o].setFeatureState(s,n)}}class at extends p.E{constructor(e,n,s){super(),this.id=e,this.dispatcher=s,this.on("data",o=>this._dataHandler(o)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((o,u,m,_)=>{let y=new(yn(u.type))(o,u,m,_);if(y.id!==o)throw new Error(`Expected Source id to be ${o} instead of ${y.id}`);return y})(e,n,s,this),this._tiles={},this._cache=new Ee(0,o=>this._unloadTile(o)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new _t,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}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(let e in this._tiles){let n=this._tiles[e];if(n.state!=="loaded"&&n.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,n,s){return p._(this,void 0,void 0,function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,n,s)}catch(o){e.state="errored",o.status!==404?this._source.fire(new p.j(o,{tile:e})):this.update(this.transform,this.terrain)}})}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new p.k("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(let n in this._tiles){let s=this._tiles[n];s.upload(e),s.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(Si).map(e=>e.key)}getRenderableIds(e){let n=[];for(let s in this._tiles)this._isIdRenderable(s,e)&&n.push(this._tiles[s]);return e?n.sort((s,o)=>{let u=s.tileID,m=o.tileID,_=new p.P(u.canonical.x,u.canonical.y)._rotate(this.transform.angle),y=new p.P(m.canonical.x,m.canonical.y)._rotate(this.transform.angle);return u.overscaledZ-m.overscaledZ||y.y-_.y||y.x-_.x}).map(s=>s.tileID.key):n.map(s=>s.tileID).sort(Si).map(s=>s.key)}hasRenderableParent(e){let n=this.findLoadedParent(e,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(e,n){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(n||!this._tiles[e].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(let e in this._tiles)this._tiles[e].state!=="errored"&&this._reloadTile(e,"reloading")}}_reloadTile(e,n){return p._(this,void 0,void 0,function*(){let s=this._tiles[e];s&&(s.state!=="loading"&&(s.state=n),yield this._loadTile(s,e,n))})}_tileLoaded(e,n,s){e.timeAdded=se.now(),s==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(n,e),this.getSource().type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new p.k("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){let n=this.getRenderableIds();for(let o=0;o1||(Math.abs(m)>1&&(Math.abs(m+y)===1?m+=y:Math.abs(m-y)===1&&(m-=y)),u.dem&&o.dem&&(o.dem.backfillBorder(u.dem,m,_),o.neighboringTiles&&o.neighboringTiles[b]&&(o.neighboringTiles[b].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,n,s,o){for(let u in this._tiles){let m=this._tiles[u];if(o[u]||!m.hasData()||m.tileID.overscaledZ<=n||m.tileID.overscaledZ>s)continue;let _=m.tileID;for(;m&&m.tileID.overscaledZ>n+1;){let b=m.tileID.scaledTo(m.tileID.overscaledZ-1);m=this._tiles[b.key],m&&m.hasData()&&(_=b)}let y=_;for(;y.overscaledZ>n;)if(y=y.scaledTo(y.overscaledZ-1),e[y.key]){o[_.key]=_;break}}}findLoadedParent(e,n){if(e.key in this._loadedParentTiles){let s=this._loadedParentTiles[e.key];return s&&s.tileID.overscaledZ>=n?s:null}for(let s=e.overscaledZ-1;s>=n;s--){let o=e.scaledTo(s),u=this._getLoadedTile(o);if(u)return u}}findLoadedSibling(e){return this._getLoadedTile(e)}_getLoadedTile(e){let n=this._tiles[e.key];return n&&n.hasData()?n:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){let n=Math.ceil(e.width/this._source.tileSize)+1,s=Math.ceil(e.height/this._source.tileSize)+1,o=Math.floor(n*s*(this._maxTileCacheZoomLevels===null?p.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),u=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,o):o;this._cache.setMaxSize(u)}handleWrapJump(e){let n=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,n){let s={};for(let o in this._tiles){let u=this._tiles[o];u.tileID=u.tileID.unwrapTo(u.tileID.wrap+n),s[u.tileID.key]=u}this._tiles=s;for(let o in this._timers)clearTimeout(this._timers[o]),delete this._timers[o];for(let o in this._tiles)this._setTileReloadTimer(o,this._tiles[o])}}_updateCoveredAndRetainedTiles(e,n,s,o,u,m){let _={},y={},b=Object.keys(e),T=se.now();for(let C of b){let P=e[C],L=this._tiles[C];if(!L||L.fadeEndTime!==0&&L.fadeEndTime<=T)continue;let O=this.findLoadedParent(P,n),U=this.findLoadedSibling(P),Z=O||U||null;Z&&(this._addTile(Z.tileID),_[Z.tileID.key]=Z.tileID),y[C]=P}this._retainLoadedChildren(y,o,s,e);for(let C in _)e[C]||(this._coveredTiles[C]=!0,e[C]=_[C]);if(m){let C={},P={};for(let L of u)this._tiles[L.key].hasData()?C[L.key]=L:P[L.key]=L;for(let L in P){let O=P[L].children(this._source.maxzoom);this._tiles[O[0].key]&&this._tiles[O[1].key]&&this._tiles[O[2].key]&&this._tiles[O[3].key]&&(C[O[0].key]=e[O[0].key]=O[0],C[O[1].key]=e[O[1].key]=O[1],C[O[2].key]=e[O[2].key]=O[2],C[O[3].key]=e[O[3].key]=O[3],delete P[L])}for(let L in P){let O=P[L],U=this.findLoadedParent(O,this._source.minzoom),Z=this.findLoadedSibling(O),G=U||Z||null;if(G){C[G.tileID.key]=e[G.tileID.key]=G.tileID;for(let W in C)C[W].isChildOf(G.tileID)&&delete C[W]}}for(let L in this._tiles)C[L]||(this._coveredTiles[L]=!0)}}update(e,n){if(!this._sourceLoaded||this._paused)return;let s;this.transform=e,this.terrain=n,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?s=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(T=>new p.S(T.canonical.z,T.wrap,T.canonical.z,T.canonical.x,T.canonical.y)):(s=e.coveringTiles({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:n}),this._source.hasTile&&(s=s.filter(T=>this._source.hasTile(T)))):s=[];let o=e.coveringZoomLevel(this._source),u=Math.max(o-at.maxOverzooming,this._source.minzoom),m=Math.max(o+at.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let T={};for(let C of s)if(C.canonical.z>this._source.minzoom){let P=C.scaledTo(C.canonical.z-1);T[P.key]=P;let L=C.scaledTo(Math.max(this._source.minzoom,Math.min(C.canonical.z,5)));T[L.key]=L}s=s.concat(Object.values(T))}let _=s.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,_&&this.fire(new p.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let y=this._updateRetainedTiles(s,o);Ji(this._source.type)&&this._updateCoveredAndRetainedTiles(y,u,m,o,s,n);for(let T in y)this._tiles[T].clearFadeHold();let b=p.ab(this._tiles,y);for(let T of b){let C=this._tiles[T];C.hasSymbolBuckets&&!C.holdingForFade()?C.setHoldDuration(this.map._fadeDuration):C.hasSymbolBuckets&&!C.symbolFadeFinished()||this._removeTile(T)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(let e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,n){var s;let o={},u={},m=Math.max(n-at.maxOverzooming,this._source.minzoom),_=Math.max(n+at.maxUnderzooming,this._source.minzoom),y={};for(let b of e){let T=this._addTile(b);o[b.key]=b,T.hasData()||nthis._source.maxzoom){let P=b.children(this._source.maxzoom)[0],L=this.getTile(P);if(L&&L.hasData()){o[P.key]=P;continue}}else{let P=b.children(this._source.maxzoom);if(o[P[0].key]&&o[P[1].key]&&o[P[2].key]&&o[P[3].key])continue}let C=T.wasRequested();for(let P=b.overscaledZ-1;P>=m;--P){let L=b.scaledTo(P);if(u[L.key])break;if(u[L.key]=!0,T=this.getTile(L),!T&&C&&(T=this._addTile(L)),T){let O=T.hasData();if((O||!(!((s=this.map)===null||s===void 0)&&s.cancelPendingTileRequestsWhileZooming)||C)&&(o[L.key]=L),C=T.wasRequested(),O)break}}}return o}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let e in this._tiles){let n=[],s,o=this._tiles[e].tileID;for(;o.overscaledZ>0;){if(o.key in this._loadedParentTiles){s=this._loadedParentTiles[o.key];break}n.push(o.key);let u=o.scaledTo(o.overscaledZ-1);if(s=this._getLoadedTile(u),s)break;o=u}for(let u of n)this._loadedParentTiles[u]=s}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(let e in this._tiles){let n=this._tiles[e].tileID,s=this._getLoadedTile(n);this._loadedSiblingTiles[n.key]=s}}_addTile(e){let n=this._tiles[e.key];if(n)return n;n=this._cache.getAndRemove(e),n&&(this._setTileReloadTimer(e.key,n),n.tileID=e,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,n)));let s=n;return n||(n=new Pr(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(n,e.key,n.state)),n.uses++,this._tiles[e.key]=n,s||this._source.fire(new p.k("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(e,n){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);let s=n.getExpiryTimeout();s&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},s))}_removeTile(e){let n=this._tiles[e];n&&(n.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}_dataHandler(e){let n=e.sourceDataType;e.dataType==="source"&&n==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType==="source"&&n==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,n,s){let o=[],u=this.transform;if(!u)return o;let m=s?u.getCameraQueryGeometry(e):e,_=e.map(O=>u.pointCoordinate(O,this.terrain)),y=m.map(O=>u.pointCoordinate(O,this.terrain)),b=this.getIds(),T=1/0,C=1/0,P=-1/0,L=-1/0;for(let O of y)T=Math.min(T,O.x),C=Math.min(C,O.y),P=Math.max(P,O.x),L=Math.max(L,O.y);for(let O=0;O=0&&N[1].y+W>=0){let Q=_.map(ae=>Z.getTilePoint(ae)),te=y.map(ae=>Z.getTilePoint(ae));o.push({tile:U,tileID:Z,queryGeometry:Q,cameraQueryGeometry:te,scale:G})}}return o}getVisibleCoordinates(e){let n=this.getRenderableIds(e).map(s=>this._tiles[s].tileID);for(let s of n)s.posMatrix=this.transform.calculatePosMatrix(s.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if(Ji(this._source.type)){let e=se.now();for(let n in this._tiles)if(this._tiles[n].fadeEndTime>=e)return!0}return!1}setFeatureState(e,n,s){this._state.updateState(e=e||"_geojsonTileLayer",n,s)}removeFeatureState(e,n,s){this._state.removeFeatureState(e=e||"_geojsonTileLayer",n,s)}getFeatureState(e,n){return this._state.getState(e=e||"_geojsonTileLayer",n)}setDependencies(e,n,s){let o=this._tiles[e];o&&o.setDependencies(n,s)}reloadTilesForDependencies(e,n){for(let s in this._tiles)this._tiles[s].hasDependency(e,n)&&this._reloadTile(s,"reloading");this._cache.filter(s=>!s.hasDependency(e,n))}}function Si(c,e){let n=Math.abs(2*c.wrap)-+(c.wrap<0),s=Math.abs(2*e.wrap)-+(e.wrap<0);return c.overscaledZ-e.overscaledZ||s-n||e.canonical.y-c.canonical.y||e.canonical.x-c.canonical.x}function Ji(c){return c==="raster"||c==="image"||c==="video"}at.maxOverzooming=10,at.maxUnderzooming=3;class st{constructor(e,n){this.reset(e,n)}reset(e,n){this.points=e||[],this._distances=[0];for(let s=1;s0?(o-m)/_:0;return this.points[u].mult(1-y).add(this.points[n].mult(y))}}function Ki(c,e){let n=!0;return c==="always"||c!=="never"&&e!=="never"||(n=!1),n}class yr{constructor(e,n,s){let o=this.boxCells=[],u=this.circleCells=[];this.xCellCount=Math.ceil(e/s),this.yCellCount=Math.ceil(n/s);for(let m=0;mthis.width||o<0||n>this.height)return[];let y=[];if(e<=0&&n<=0&&this.width<=s&&this.height<=o){if(u)return[{key:null,x1:e,y1:n,x2:s,y2:o}];for(let b=0;b0}hitTestCircle(e,n,s,o,u){let m=e-s,_=e+s,y=n-s,b=n+s;if(_<0||m>this.width||b<0||y>this.height)return!1;let T=[];return this._forEachCell(m,y,_,b,this._queryCellCircle,T,{hitTest:!0,overlapMode:o,circle:{x:e,y:n,radius:s},seenUids:{box:{},circle:{}}},u),T.length>0}_queryCell(e,n,s,o,u,m,_,y){let{seenUids:b,hitTest:T,overlapMode:C}=_,P=this.boxCells[u];if(P!==null){let O=this.bboxes;for(let U of P)if(!b.box[U]){b.box[U]=!0;let Z=4*U,G=this.boxKeys[U];if(e<=O[Z+2]&&n<=O[Z+3]&&s>=O[Z+0]&&o>=O[Z+1]&&(!y||y(G))&&(!T||!Ki(C,G.overlapMode))&&(m.push({key:G,x1:O[Z],y1:O[Z+1],x2:O[Z+2],y2:O[Z+3]}),T))return!0}}let L=this.circleCells[u];if(L!==null){let O=this.circles;for(let U of L)if(!b.circle[U]){b.circle[U]=!0;let Z=3*U,G=this.circleKeys[U];if(this._circleAndRectCollide(O[Z],O[Z+1],O[Z+2],e,n,s,o)&&(!y||y(G))&&(!T||!Ki(C,G.overlapMode))){let W=O[Z],N=O[Z+1],Q=O[Z+2];if(m.push({key:G,x1:W-Q,y1:N-Q,x2:W+Q,y2:N+Q}),T)return!0}}}return!1}_queryCellCircle(e,n,s,o,u,m,_,y){let{circle:b,seenUids:T,overlapMode:C}=_,P=this.boxCells[u];if(P!==null){let O=this.bboxes;for(let U of P)if(!T.box[U]){T.box[U]=!0;let Z=4*U,G=this.boxKeys[U];if(this._circleAndRectCollide(b.x,b.y,b.radius,O[Z+0],O[Z+1],O[Z+2],O[Z+3])&&(!y||y(G))&&!Ki(C,G.overlapMode))return m.push(!0),!0}}let L=this.circleCells[u];if(L!==null){let O=this.circles;for(let U of L)if(!T.circle[U]){T.circle[U]=!0;let Z=3*U,G=this.circleKeys[U];if(this._circlesCollide(O[Z],O[Z+1],O[Z+2],b.x,b.y,b.radius)&&(!y||y(G))&&!Ki(C,G.overlapMode))return m.push(!0),!0}}}_forEachCell(e,n,s,o,u,m,_,y){let b=this._convertToXCellCoord(e),T=this._convertToYCellCoord(n),C=this._convertToXCellCoord(s),P=this._convertToYCellCoord(o);for(let L=b;L<=C;L++)for(let O=T;O<=P;O++)if(u.call(this,e,n,s,o,this.xCellCount*O+L,m,_,y))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,n,s,o,u,m){let _=o-e,y=u-n,b=s+m;return b*b>_*_+y*y}_circleAndRectCollide(e,n,s,o,u,m,_){let y=(m-o)/2,b=Math.abs(e-(o+y));if(b>y+s)return!1;let T=(_-u)/2,C=Math.abs(n-(u+T));if(C>T+s)return!1;if(b<=y||C<=T)return!0;let P=b-y,L=C-T;return P*P+L*L<=s*s}}function on(c,e,n,s,o){let u=p.H();return e?(p.K(u,u,[1/o,1/o,1]),n||p.ad(u,u,s.angle)):p.L(u,s.labelPlaneMatrix,c),u}function Zr(c,e,n,s,o){if(e){let u=p.ae(c);return p.K(u,u,[o,o,1]),n||p.ad(u,u,-s.angle),u}return s.glCoordMatrix}function j(c,e,n,s){let o;s?(o=[c,e,s(c,e),1],p.af(o,o,n)):(o=[c,e,0,1],Lt(o,o,n));let u=o[3];return{point:new p.P(o[0]/u,o[1]/u),signedDistanceFromCamera:u,isOccluded:!1}}function k(c,e){return .5+c/e*.5}function I(c,e){return c.x>=-e[0]&&c.x<=e[0]&&c.y>=-e[1]&&c.y<=e[1]}function R(c,e,n,s,o,u,m,_,y,b,T,C,P,L,O){let U=s?c.textSizeData:c.iconSizeData,Z=p.ag(U,n.transform.zoom),G=[256/n.width*2+1,256/n.height*2+1],W=s?c.text.dynamicLayoutVertexArray:c.icon.dynamicLayoutVertexArray;W.clear();let N=c.lineVertexArray,Q=s?c.text.placedSymbolArray:c.icon.placedSymbolArray,te=n.transform.width/n.transform.height,ae=!1;for(let fe=0;feMath.abs(n.x-e.x)*s?{useVertical:!0}:(c===p.ah.vertical?e.yn.x)?{needsFlipping:!0}:null}function ee(c,e,n,s,o,u,m,_,y,b,T){let C=n/24,P=e.lineOffsetX*C,L=e.lineOffsetY*C,O;if(e.numGlyphs>1){let U=e.glyphStartIndex+e.numGlyphs,Z=e.lineStartIndex,G=e.lineStartIndex+e.lineLength,W=V(C,_,P,L,s,e,T,c);if(!W)return{notEnoughRoom:!0};let N=j(W.first.point.x,W.first.point.y,m,c.getElevation).point,Q=j(W.last.point.x,W.last.point.y,m,c.getElevation).point;if(o&&!s){let te=Y(e.writingMode,N,Q,b);if(te)return te}O=[W.first];for(let te=e.glyphStartIndex+1;te0?N.point:function(ae,fe,be,ze,Oe,Ie){return re(ae,fe,be,1,Oe,Ie)}(c.tileAnchorPoint,W,Z,0,u,c),te=Y(e.writingMode,Z,Q,b);if(te)return te}let U=Te(C*_.getoffsetX(e.glyphStartIndex),P,L,s,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,c,T);if(!U||c.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};O=[U]}for(let U of O)p.aj(y,U.point,U.angle);return{}}function re(c,e,n,s,o,u){let m=c.add(c.sub(e)._unit()),_=o!==void 0?j(m.x,m.y,o,u.getElevation).point:he(m.x,m.y,u).point,y=n.sub(_);return n.add(y._mult(s/y.mag()))}function H(c,e,n){let s=e.projectionCache;if(s.projections[c])return s.projections[c];let o=new p.P(e.lineVertexArray.getx(c),e.lineVertexArray.gety(c)),u=he(o.x,o.y,e);if(u.signedDistanceFromCamera>0)return s.projections[c]=u.point,s.anyProjectionOccluded=s.anyProjectionOccluded||u.isOccluded,u.point;let m=c-n.direction;return function(_,y,b,T,C){return re(_,y,b,T,void 0,C)}(n.distanceFromAnchor===0?e.tileAnchorPoint:new p.P(e.lineVertexArray.getx(m),e.lineVertexArray.gety(m)),o,n.previousVertex,n.absOffsetX-n.distanceFromAnchor+1,e)}function he(c,e,n){let s=c+n.translation[0],o=e+n.translation[1],u;return!n.pitchWithMap&&n.projection.useSpecialProjectionForSymbols?(u=n.projection.projectTileCoordinates(s,o,n.unwrappedTileID,n.getElevation),u.point.x=(.5*u.point.x+.5)*n.width,u.point.y=(.5*-u.point.y+.5)*n.height):(u=j(s,o,n.labelPlaneMatrix,n.getElevation),u.isOccluded=!1),u}function me(c,e,n){return c._unit()._perp()._mult(e*n)}function le(c,e,n,s,o,u,m,_,y){if(_.projectionCache.offsets[c])return _.projectionCache.offsets[c];let b=n.add(e);if(c+y.direction=o)return _.projectionCache.offsets[c]=b,b;let T=H(c+y.direction,_,y),C=me(T.sub(n),m,y.direction),P=n.add(C),L=T.add(C);return _.projectionCache.offsets[c]=p.ak(u,b,P,L)||b,_.projectionCache.offsets[c]}function Te(c,e,n,s,o,u,m,_,y){let b=s?c-e:c+e,T=b>0?1:-1,C=0;s&&(T*=-1,C=Math.PI),T<0&&(C+=Math.PI);let P,L=T>0?u+o:u+o+1;_.projectionCache.cachedAnchorPoint?P=_.projectionCache.cachedAnchorPoint:(P=he(_.tileAnchorPoint.x,_.tileAnchorPoint.y,_).point,_.projectionCache.cachedAnchorPoint=P);let O,U,Z=P,G=P,W=0,N=0,Q=Math.abs(b),te=[],ae;for(;W+N<=Q;){if(L+=T,L=m)return null;W+=N,G=Z,U=O;let ze={absOffsetX:Q,direction:T,distanceFromAnchor:W,previousVertex:G};if(Z=H(L,_,ze),n===0)te.push(G),ae=Z.sub(G);else{let Oe,Ie=Z.sub(G);Oe=Ie.mag()===0?me(H(L+T,_,ze).sub(Z),n,T):me(Ie,n,T),U||(U=G.add(Oe)),O=le(L,Oe,Z,u,m,U,n,_,ze),te.push(U),ae=O.sub(U)}N=ae.mag()}let fe=ae._mult((Q-W)/N)._add(U||G),be=C+Math.atan2(Z.y-G.y,Z.x-G.x);return te.push(fe),{point:fe,angle:y?be:0,path:te}}let Je=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function tt(c,e){for(let n=0;n=1;xt--)Le.push(ct.path[xt]);for(let xt=1;xtSt.signedDistanceFromCamera<=0)?[]:xt.map(St=>St.point)}let ii=[];if(Le.length>0){let xt=Le[0].clone(),St=Le[0].clone();for(let ri=1;ri=Ie.x&&St.x<=Ce.x&&xt.y>=Ie.y&&St.y<=Ce.y?[Le]:St.xCe.x||St.yCe.y?[]:p.al([Le],Ie.x,Ie.y,Ce.x,Ce.y)}for(let xt of ii){Ze.reset(xt,.25*Oe);let St=0;St=Ze.length<=.5*Oe?1:Math.ceil(Ze.paddedLength/ot)+1;for(let ri=0;rij(o.x,o.y,s,n.getElevation))}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let n=[],s=1/0,o=1/0,u=-1/0,m=-1/0;for(let T of e){let C=new p.P(T.x+dt,T.y+dt);s=Math.min(s,C.x),o=Math.min(o,C.y),u=Math.max(u,C.x),m=Math.max(m,C.y),n.push(C)}let _=this.grid.query(s,o,u,m).concat(this.ignoredGrid.query(s,o,u,m)),y={},b={};for(let T of _){let C=T.key;if(y[C.bucketInstanceId]===void 0&&(y[C.bucketInstanceId]={}),y[C.bucketInstanceId][C.featureIndex])continue;let P=[new p.P(T.x1,T.y1),new p.P(T.x2,T.y1),new p.P(T.x2,T.y2),new p.P(T.x1,T.y2)];p.am(n,P)&&(y[C.bucketInstanceId][C.featureIndex]=!0,b[C.bucketInstanceId]===void 0&&(b[C.bucketInstanceId]=[]),b[C.bucketInstanceId].push(C.featureIndex))}return b}insertCollisionBox(e,n,s,o,u,m){(s?this.ignoredGrid:this.grid).insert({bucketInstanceId:o,featureIndex:u,collisionGroupID:m,overlapMode:n},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,n,s,o,u,m){let _=s?this.ignoredGrid:this.grid,y={bucketInstanceId:o,featureIndex:u,collisionGroupID:m,overlapMode:n};for(let b=0;b=this.screenRightBoundary||othis.screenBottomBoundary}isInsideGrid(e,n,s,o){return s>=0&&e=0&&nthis.projectAndGetPerspectiveRatio(s,Oe.x,Oe.y,o,b));be=ze.some(Oe=>!Oe.isOccluded),fe=ze.map(Oe=>Oe.point)}else be=!0;return{box:p.ao(fe),allPointsOccluded:!be}}}function Dt(c,e,n){return e*(p.X/(c.tileSize*Math.pow(2,n-c.tileID.overscaledZ)))}class vi{constructor(e,n,s,o){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?n:-n))):o&&s?1:0,this.placed=s}isHidden(){return this.opacity===0&&!this.placed}}class hi{constructor(e,n,s,o,u){this.text=new vi(e?e.text:null,n,s,u),this.icon=new vi(e?e.icon:null,n,o,u)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class wt{constructor(e,n,s){this.text=e,this.icon=n,this.skipFade=s}}class $t{constructor(){this.invProjMatrix=p.H(),this.viewportMatrix=p.H(),this.circles=[]}}class oi{constructor(e,n,s,o,u){this.bucketInstanceId=e,this.featureIndex=n,this.sourceLayerIndex=s,this.bucketIndex=o,this.tileID=u}}class Ei{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let n=++this.maxGroupID;this.collisionGroups[e]={ID:n,predicate:s=>s.collisionGroupID===n}}return this.collisionGroups[e]}}function Ii(c,e,n,s,o){let{horizontalAlign:u,verticalAlign:m}=p.au(c);return new p.P(-(u-.5)*e+s[0]*o,-(m-.5)*n+s[1]*o)}class ji{constructor(e,n,s,o,u,m){this.transform=e.clone(),this.terrain=s,this.collisionIndex=new Rt(this.transform,n),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=o,this.retainedQueryData={},this.collisionGroups=new Ei(u),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=m,m&&(m.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){let n=this.terrain;return n?(s,o)=>n.getElevation(e,s,o):null}getBucketParts(e,n,s,o){let u=s.getBucket(n),m=s.latestFeatureIndex;if(!u||!m||n.id!==u.layerIds[0])return;let _=s.collisionBoxArray,y=u.layers[0].layout,b=u.layers[0].paint,T=Math.pow(2,this.transform.zoom-s.tileID.overscaledZ),C=s.tileSize/p.X,P=s.tileID.toUnwrapped(),L=this.transform.calculatePosMatrix(P),O=y.get("text-pitch-alignment")==="map",U=y.get("text-rotation-alignment")==="map",Z=Dt(s,1,this.transform.zoom),G=this.collisionIndex.mapProjection.translatePosition(this.transform,s,b.get("text-translate"),b.get("text-translate-anchor")),W=this.collisionIndex.mapProjection.translatePosition(this.transform,s,b.get("icon-translate"),b.get("icon-translate-anchor")),N=on(L,O,U,this.transform,Z),Q=null;if(O){let ae=Zr(L,O,U,this.transform,Z);Q=p.L([],this.transform.labelPlaneMatrix,ae)}this.retainedQueryData[u.bucketInstanceId]=new oi(u.bucketInstanceId,m,u.sourceLayerIndex,u.index,s.tileID);let te={bucket:u,layout:y,translationText:G,translationIcon:W,posMatrix:L,unwrappedTileID:P,textLabelPlaneMatrix:N,labelToScreenMatrix:Q,scale:T,textPixelRatio:C,holdingForFade:s.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:p.ag(u.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(u.sourceID)};if(o)for(let ae of u.sortKeyRanges){let{sortKey:fe,symbolInstanceStart:be,symbolInstanceEnd:ze}=ae;e.push({sortKey:fe,symbolInstanceStart:be,symbolInstanceEnd:ze,parameters:te})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:u.symbolInstances.length,parameters:te})}attemptAnchorPlacement(e,n,s,o,u,m,_,y,b,T,C,P,L,O,U,Z,G,W,N){let Q=p.aq[e.textAnchor],te=[e.textOffset0,e.textOffset1],ae=Ii(Q,s,o,te,u),fe=this.collisionIndex.placeCollisionBox(n,P,y,b,T,_,m,Z,C.predicate,N,ae);if((!W||this.collisionIndex.placeCollisionBox(W,P,y,b,T,_,m,G,C.predicate,N,ae).placeable)&&fe.placeable){let be;if(this.prevPlacement&&this.prevPlacement.variableOffsets[L.crossTileID]&&this.prevPlacement.placements[L.crossTileID]&&this.prevPlacement.placements[L.crossTileID].text&&(be=this.prevPlacement.variableOffsets[L.crossTileID].anchor),L.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[L.crossTileID]={textOffset:te,width:s,height:o,anchor:Q,textBoxScale:u,prevAnchor:be},this.markUsedJustification(O,Q,L,U),O.allowVerticalPlacement&&(this.markUsedOrientation(O,U,L),this.placedOrientations[L.crossTileID]=U),{shift:ae,placedGlyphBoxes:fe}}}placeLayerBucketPart(e,n,s){let{bucket:o,layout:u,translationText:m,translationIcon:_,posMatrix:y,unwrappedTileID:b,textLabelPlaneMatrix:T,labelToScreenMatrix:C,textPixelRatio:P,holdingForFade:L,collisionBoxArray:O,partiallyEvaluatedTextSize:U,collisionGroup:Z}=e.parameters,G=u.get("text-optional"),W=u.get("icon-optional"),N=p.ar(u,"text-overlap","text-allow-overlap"),Q=N==="always",te=p.ar(u,"icon-overlap","icon-allow-overlap"),ae=te==="always",fe=u.get("text-rotation-alignment")==="map",be=u.get("text-pitch-alignment")==="map",ze=u.get("icon-text-fit")!=="none",Oe=u.get("symbol-z-order")==="viewport-y",Ie=Q&&(ae||!o.hasIconData()||W),Ce=ae&&(Q||!o.hasTextData()||G);!o.collisionArrays&&O&&o.deserializeCollisionBoxes(O);let Ze=this._getTerrainElevationFunc(this.retainedQueryData[o.bucketInstanceId].tileID),ct=(ke,Le,ot)=>{var ii,xt;if(n[ke.crossTileID])return;if(L)return void(this.placements[ke.crossTileID]=new wt(!1,!1,!1));let St=!1,ri=!1,zi=!0,Or=null,ni={box:null,placeable:!1,offscreen:null},er={box:null,placeable:!1,offscreen:null},$i=null,Bi=null,Zi=null,Wr=0,la=0,Cs=0;Le.textFeatureIndex?Wr=Le.textFeatureIndex:ke.useRuntimeCollisionCircles&&(Wr=ke.featureIndex),Le.verticalTextFeatureIndex&&(la=Le.verticalTextFeatureIndex);let ua=Le.textBox;if(ua){let Er=ki=>{let Li=p.ah.horizontal;if(o.allowVerticalPlacement&&!ki&&this.prevPlacement){let fr=this.prevPlacement.placedOrientations[ke.crossTileID];fr&&(this.placedOrientations[ke.crossTileID]=fr,Li=fr,this.markUsedOrientation(o,Li,ke))}return Li},Tr=(ki,Li)=>{if(o.allowVerticalPlacement&&ke.numVerticalGlyphVertices>0&&Le.verticalTextBox){for(let fr of o.writingModes)if(fr===p.ah.vertical?(ni=Li(),er=ni):ni=ki(),ni&&ni.placeable)break}else ni=ki()},cn=ke.textAnchorOffsetStartIndex,Nr=ke.textAnchorOffsetEndIndex;if(Nr===cn){let ki=(Li,fr)=>{let kt=this.collisionIndex.placeCollisionBox(Li,N,P,y,b,be,fe,m,Z.predicate,Ze);return kt&&kt.placeable&&(this.markUsedOrientation(o,fr,ke),this.placedOrientations[ke.crossTileID]=fr),kt};Tr(()=>ki(ua,p.ah.horizontal),()=>{let Li=Le.verticalTextBox;return o.allowVerticalPlacement&&ke.numVerticalGlyphVertices>0&&Li?ki(Li,p.ah.vertical):{box:null,offscreen:null}}),Er(ni&&ni.placeable)}else{let ki=p.aq[(xt=(ii=this.prevPlacement)===null||ii===void 0?void 0:ii.variableOffsets[ke.crossTileID])===null||xt===void 0?void 0:xt.anchor],Li=(kt,Mn,ca)=>{let ha=kt.x2-kt.x1,Yl=kt.y2-kt.y1,ac=ke.textBoxScale,Ql=ze&&te==="never"?Mn:null,hn=null,eu=N==="never"?1:2,Ss="never";ki&&eu++;for(let qa=0;qaLi(ua,Le.iconBox,p.ah.horizontal),()=>{let kt=Le.verticalTextBox;return o.allowVerticalPlacement&&(!ni||!ni.placeable)&&ke.numVerticalGlyphVertices>0&&kt?Li(kt,Le.verticalIconBox,p.ah.vertical):{box:null,occluded:!0,offscreen:null}}),ni&&(St=ni.placeable,zi=ni.offscreen);let fr=Er(ni&&ni.placeable);if(!St&&this.prevPlacement){let kt=this.prevPlacement.variableOffsets[ke.crossTileID];kt&&(this.variableOffsets[ke.crossTileID]=kt,this.markUsedJustification(o,kt.anchor,ke,fr))}}}if($i=ni,St=$i&&$i.placeable,zi=$i&&$i.offscreen,ke.useRuntimeCollisionCircles){let Er=o.text.placedSymbolArray.get(ke.centerJustifiedTextSymbolIndex),Tr=p.ai(o.textSizeData,U,Er),cn=u.get("text-padding");Bi=this.collisionIndex.placeCollisionCircles(N,Er,o.lineVertexArray,o.glyphOffsetArray,Tr,y,b,T,C,s,be,Z.predicate,ke.collisionCircleDiameter,cn,m,Ze),Bi.circles.length&&Bi.collisionDetected&&!s&&p.w("Collisions detected, but collision boxes are not shown"),St=Q||Bi.circles.length>0&&!Bi.collisionDetected,zi=zi&&Bi.offscreen}if(Le.iconFeatureIndex&&(Cs=Le.iconFeatureIndex),Le.iconBox){let Er=Tr=>this.collisionIndex.placeCollisionBox(Tr,te,P,y,b,be,fe,_,Z.predicate,Ze,ze&&Or?Or:void 0);er&&er.placeable&&Le.verticalIconBox?(Zi=Er(Le.verticalIconBox),ri=Zi.placeable):(Zi=Er(Le.iconBox),ri=Zi.placeable),zi=zi&&Zi.offscreen}let Ar=G||ke.numHorizontalGlyphVertices===0&&ke.numVerticalGlyphVertices===0,Ds=W||ke.numIconVertices===0;Ar||Ds?Ds?Ar||(ri=ri&&St):St=ri&&St:ri=St=ri&&St;let Uo=ri&&Zi.placeable;if(St&&$i.placeable&&this.collisionIndex.insertCollisionBox($i.box,N,u.get("text-ignore-placement"),o.bucketInstanceId,er&&er.placeable&&la?la:Wr,Z.ID),Uo&&this.collisionIndex.insertCollisionBox(Zi.box,te,u.get("icon-ignore-placement"),o.bucketInstanceId,Cs,Z.ID),Bi&&St&&this.collisionIndex.insertCollisionCircles(Bi.circles,N,u.get("text-ignore-placement"),o.bucketInstanceId,Wr,Z.ID),s&&this.storeCollisionData(o.bucketInstanceId,ot,Le,$i,Zi,Bi),ke.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(o.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[ke.crossTileID]=new wt(St||Ie,ri||Ce,zi||o.justReloaded),n[ke.crossTileID]=!0};if(Oe){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");let ke=o.getSortedSymbolIndexes(this.transform.angle);for(let Le=ke.length-1;Le>=0;--Le){let ot=ke[Le];ct(o.symbolInstances.get(ot),o.collisionArrays[ot],ot)}}else for(let ke=e.symbolInstanceStart;ke=0&&(e.text.placedSymbolArray.get(_).crossTileID=u>=0&&_!==u?0:s.crossTileID)}markUsedOrientation(e,n,s){let o=n===p.ah.horizontal||n===p.ah.horizontalOnly?n:0,u=n===p.ah.vertical?n:0,m=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex];for(let _ of m)e.text.placedSymbolArray.get(_).placedOrientation=o;s.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(s.verticalPlacedTextSymbolIndex).placedOrientation=u)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let n=this.prevPlacement,s=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;let o=n?n.symbolFadeChange(e):1,u=n?n.opacities:{},m=n?n.variableOffsets:{},_=n?n.placedOrientations:{};for(let y in this.placements){let b=this.placements[y],T=u[y];T?(this.opacities[y]=new hi(T,o,b.text,b.icon),s=s||b.text!==T.text.placed||b.icon!==T.icon.placed):(this.opacities[y]=new hi(null,o,b.text,b.icon,b.skipFade),s=s||b.text||b.icon)}for(let y in u){let b=u[y];if(!this.opacities[y]){let T=new hi(b,o,!1,!1);T.isHidden()||(this.opacities[y]=T,s=s||b.text.placed||b.icon.placed)}}for(let y in m)this.variableOffsets[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.variableOffsets[y]=m[y]);for(let y in _)this.placedOrientations[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.placedOrientations[y]=_[y]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");s?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:e)}updateLayerOpacities(e,n){let s={};for(let o of n){let u=o.getBucket(e);u&&o.latestFeatureIndex&&e.id===u.layerIds[0]&&this.updateBucketOpacities(u,o.tileID,s,o.collisionBoxArray)}}updateBucketOpacities(e,n,s,o){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();let u=e.layers[0],m=u.layout,_=new hi(null,0,!1,!1,!0),y=m.get("text-allow-overlap"),b=m.get("icon-allow-overlap"),T=u._unevaluatedLayout.hasValue("text-variable-anchor")||u._unevaluatedLayout.hasValue("text-variable-anchor-offset"),C=m.get("text-rotation-alignment")==="map",P=m.get("text-pitch-alignment")==="map",L=m.get("icon-text-fit")!=="none",O=new hi(null,0,y&&(b||!e.hasIconData()||m.get("icon-optional")),b&&(y||!e.hasTextData()||m.get("text-optional")),!0);!e.collisionArrays&&o&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(o);let U=(G,W,N)=>{for(let Q=0;Q0,be=this.placedOrientations[W.crossTileID],ze=be===p.ah.vertical,Oe=be===p.ah.horizontal||be===p.ah.horizontalOnly;if(N>0||Q>0){let Ce=hr(ae.text);U(e.text,N,ze?Vn:Ce),U(e.text,Q,Oe?Vn:Ce);let Ze=ae.text.isHidden();[W.rightJustifiedTextSymbolIndex,W.centerJustifiedTextSymbolIndex,W.leftJustifiedTextSymbolIndex].forEach(Le=>{Le>=0&&(e.text.placedSymbolArray.get(Le).hidden=Ze||ze?1:0)}),W.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(W.verticalPlacedTextSymbolIndex).hidden=Ze||Oe?1:0);let ct=this.variableOffsets[W.crossTileID];ct&&this.markUsedJustification(e,ct.anchor,W,be);let ke=this.placedOrientations[W.crossTileID];ke&&(this.markUsedJustification(e,"left",W,ke),this.markUsedOrientation(e,ke,W))}if(fe){let Ce=hr(ae.icon),Ze=!(L&&W.verticalPlacedIconSymbolIndex&&ze);W.placedIconSymbolIndex>=0&&(U(e.icon,W.numIconVertices,Ze?Ce:Vn),e.icon.placedSymbolArray.get(W.placedIconSymbolIndex).hidden=ae.icon.isHidden()),W.verticalPlacedIconSymbolIndex>=0&&(U(e.icon,W.numVerticalIconVertices,Ze?Vn:Ce),e.icon.placedSymbolArray.get(W.verticalPlacedIconSymbolIndex).hidden=ae.icon.isHidden())}let Ie=Z&&Z.has(G)?Z.get(G):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let Ce=e.collisionArrays[G];if(Ce){let Ze=new p.P(0,0);if(Ce.textBox||Ce.verticalTextBox){let ct=!0;if(T){let ke=this.variableOffsets[te];ke?(Ze=Ii(ke.anchor,ke.width,ke.height,ke.textOffset,ke.textBoxScale),C&&Ze._rotate(P?this.transform.angle:-this.transform.angle)):ct=!1}if(Ce.textBox||Ce.verticalTextBox){let ke;Ce.textBox&&(ke=ze),Ce.verticalTextBox&&(ke=Oe),qn(e.textCollisionBox.collisionVertexArray,ae.text.placed,!ct||ke,Ie.text,Ze.x,Ze.y)}}if(Ce.iconBox||Ce.verticalIconBox){let ct=!!(!Oe&&Ce.verticalIconBox),ke;Ce.iconBox&&(ke=ct),Ce.verticalIconBox&&(ke=!ct),qn(e.iconCollisionBox.collisionVertexArray,ae.icon.placed,ke,Ie.icon,L?Ze.x:0,L?Ze.y:0)}}}}if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);if(e.bucketInstanceId in this.collisionCircleArrays){let G=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=G.invProjMatrix,e.placementViewportMatrix=G.viewportMatrix,e.collisionCircleArray=G.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTimee}setStale(){this.stale=!0}}function qn(c,e,n,s,o,u){s&&s.length!==0||(s=[0,0,0,0]);let m=s[0]-dt,_=s[1]-dt,y=s[2]-dt,b=s[3]-dt;c.emplaceBack(e?1:0,n?1:0,o||0,u||0,m,_),c.emplaceBack(e?1:0,n?1:0,o||0,u||0,y,_),c.emplaceBack(e?1:0,n?1:0,o||0,u||0,y,b),c.emplaceBack(e?1:0,n?1:0,o||0,u||0,m,b)}let Zt=Math.pow(2,25),Ys=Math.pow(2,24),Qs=Math.pow(2,17),ur=Math.pow(2,16),cr=Math.pow(2,9),zu=Math.pow(2,8),vr=Math.pow(2,1);function hr(c){if(c.opacity===0&&!c.placed)return 0;if(c.opacity===1&&c.placed)return 4294967295;let e=c.placed?1:0,n=Math.floor(127*c.opacity);return n*Zt+e*Ys+n*Qs+e*ur+n*cr+e*zu+n*vr+e}let Vn=0;function vn(){return{isOccluded:(c,e,n)=>!1,getPitchedTextCorrection:(c,e,n)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(c,e,n,s){throw new Error("Not implemented.")},translatePosition:(c,e,n,s)=>function(o,u,m,_,y=!1){if(!m[0]&&!m[1])return[0,0];let b=y?_==="map"?o.angle:0:_==="viewport"?-o.angle:0;if(b){let T=Math.sin(b),C=Math.cos(b);m=[m[0]*C-m[1]*T,m[0]*T+m[1]*C]}return[y?m[0]:Dt(u,m[0],o.zoom),y?m[1]:Dt(u,m[1],o.zoom)]}(c,e,n,s),getCircleRadiusCorrection:c=>1}}class xi{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,n,s,o,u){let m=this._bucketParts;for(;this._currentTileIndex_.sortKey-y.sortKey));this._currentPartIndex!this._forceFullPlacement&&se.now()-o>2;for(;this._currentPlacementIndex>=0;){let m=n[e[this._currentPlacementIndex]],_=this.placement.collisionIndex.transform.zoom;if(m.type==="symbol"&&(!m.minzoom||m.minzoom<=_)&&(!m.maxzoom||m.maxzoom>_)){if(this._inProgressLayer||(this._inProgressLayer=new xi(m)),this._inProgressLayer.continuePlacement(s[m.source],this.placement,this._showCollisionBoxes,m,u))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}let zr=512/p.X/2;class _i{constructor(e,n,s){this.tileID=e,this.bucketInstanceId=s,this._symbolsByKey={};let o=new Map;for(let u=0;u({x:Math.floor(y.anchorX*zr),y:Math.floor(y.anchorY*zr)})),crossTileIDs:m.map(y=>y.crossTileID)};if(_.positions.length>128){let y=new p.av(_.positions.length,16,Uint16Array);for(let{x:b,y:T}of _.positions)y.add(b,T);y.finish(),delete _.positions,_.index=y}this._symbolsByKey[u]=_}}getScaledCoordinates(e,n){let{x:s,y:o,z:u}=this.tileID.canonical,{x:m,y:_,z:y}=n.canonical,b=zr/Math.pow(2,y-u),T=(_*p.X+e.anchorY)*b,C=o*p.X*zr;return{x:Math.floor((m*p.X+e.anchorX)*b-s*p.X*zr),y:Math.floor(T-C)}}findMatches(e,n,s){let o=this.tileID.canonical.ze)}}class Wa{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Br{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let n=Math.round((e-this.lng)/360);if(n!==0)for(let s in this.indexes){let o=this.indexes[s],u={};for(let m in o){let _=o[m];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+n),u[_.tileID.key]=_}this.indexes[s]=u}this.lng=e}addBucket(e,n,s){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let u=0;ue.overscaledZ)for(let _ in m){let y=m[_];y.tileID.isChildOf(e)&&y.findMatches(n.symbolInstances,e,o)}else{let _=m[e.scaledTo(Number(u)).key];_&&_.findMatches(n.symbolInstances,e,o)}}for(let u=0;u{n[s]=!0});for(let s in this.layerIndexes)n[s]||delete this.layerIndexes[s]}}let Lr=(c,e)=>p.t(c,e&&e.filter(n=>n.identifier!=="source.canvas")),Bu=p.aw();class Ja extends p.E{constructor(e,n={}){super(),this._rtlPluginLoaded=()=>{for(let s in this.sourceCaches){let o=this.sourceCaches[s].getSource().type;o!=="vector"&&o!=="geojson"||this.sourceCaches[s].reload()}},this.map=e,this.dispatcher=new vt(et(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",(s,o)=>this.getGlyphs(s,o)),this.dispatcher.registerMessageHandler("GI",(s,o)=>this.getImages(s,o)),this.imageManager=new we,this.imageManager.setEventedParent(this),this.glyphManager=new rt(e._requestManager,n.localIdeographFontFamily),this.lineAtlas=new At(256,512),this.crossTileSymbolIndex=new eo,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new p.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",p.ay()),lr().on(Ae,this._rtlPluginLoaded),this.on("data",s=>{if(s.dataType!=="source"||s.sourceDataType!=="metadata")return;let o=this.sourceCaches[s.sourceId];if(!o)return;let u=o.getSource();if(u&&u.vectorLayerIds)for(let m in this._layers){let _=this._layers[m];_.source===u.id&&this._validateLayer(_)}})}loadURL(e,n={},s){this.fire(new p.k("dataloading",{dataType:"style"})),n.validate=typeof n.validate!="boolean"||n.validate;let o=this.map._requestManager.transformRequest(e,"Style");this._loadStyleRequest=new AbortController;let u=this._loadStyleRequest;p.h(o,this._loadStyleRequest).then(m=>{this._loadStyleRequest=null,this._load(m.data,n,s)}).catch(m=>{this._loadStyleRequest=null,m&&!u.signal.aborted&&this.fire(new p.j(m))})}loadJSON(e,n={},s){this.fire(new p.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,se.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,n.validate=n.validate!==!1,this._load(e,n,s)}).catch(()=>{})}loadEmpty(){this.fire(new p.k("dataloading",{dataType:"style"})),this._load(Bu,{validate:!1})}_load(e,n,s){var o;let u=n.transformStyle?n.transformStyle(s,e):e;if(!n.validate||!Lr(this,p.u(u))){this._loaded=!0,this.stylesheet=u;for(let m in u.sources)this.addSource(m,u.sources[m],{validate:!1});u.sprite?this._loadSprite(u.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(u.glyphs),this._createLayers(),this.light=new je(this.stylesheet.light),this.sky=new pt(this.stylesheet.sky),this.map.setTerrain((o=this.stylesheet.terrain)!==null&&o!==void 0?o:null),this.fire(new p.k("data",{dataType:"style"})),this.fire(new p.k("style.load"))}}_createLayers(){let e=p.az(this.stylesheet.layers);this.dispatcher.broadcast("SL",e),this._order=e.map(n=>n.id),this._layers={},this._serializedLayers=null;for(let n of e){let s=p.aA(n);s.setEventedParent(this,{layer:{id:n.id}}),this._layers[n.id]=s}}_loadSprite(e,n=!1,s=void 0){let o;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(u,m,_,y){return p._(this,void 0,void 0,function*(){let b=ve(u),T=_>1?"@2x":"",C={},P={};for(let{id:L,url:O}of b){let U=m.transformRequest(Fe(O,T,".json"),"SpriteJSON");C[L]=p.h(U,y);let Z=m.transformRequest(Fe(O,T,".png"),"SpriteImage");P[L]=jt.getImage(Z,y)}return yield Promise.all([...Object.values(C),...Object.values(P)]),function(L,O){return p._(this,void 0,void 0,function*(){let U={};for(let Z in L){U[Z]={};let G=se.getImageCanvasContext((yield O[Z]).data),W=(yield L[Z]).data;for(let N in W){let{width:Q,height:te,x:ae,y:fe,sdf:be,pixelRatio:ze,stretchX:Oe,stretchY:Ie,content:Ce,textFitWidth:Ze,textFitHeight:ct}=W[N];U[Z][N]={data:null,pixelRatio:ze,sdf:be,stretchX:Oe,stretchY:Ie,content:Ce,textFitWidth:Ze,textFitHeight:ct,spriteData:{width:Q,height:te,x:ae,y:fe,context:G}}}}return U})}(C,P)})}(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(u=>{if(this._spriteRequest=null,u)for(let m in u){this._spritesImagesIds[m]=[];let _=this._spritesImagesIds[m]?this._spritesImagesIds[m].filter(y=>!(y in u)):[];for(let y of _)this.imageManager.removeImage(y),this._changedImages[y]=!0;for(let y in u[m]){let b=m==="default"?y:`${m}:${y}`;this._spritesImagesIds[m].push(b),b in this.imageManager.images?this.imageManager.updateImage(b,u[m][y],!1):this.imageManager.addImage(b,u[m][y]),n&&(this._changedImages[b]=!0)}}}).catch(u=>{this._spriteRequest=null,o=u,this.fire(new p.j(o))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.k("data",{dataType:"style"})),s&&s(o)})}_unloadSprite(){for(let e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.k("data",{dataType:"style"}))}_validateLayer(e){let n=this.sourceCaches[e.source];if(!n)return;let s=e.sourceLayer;if(!s)return;let o=n.getSource();(o.type==="geojson"||o.vectorLayerIds&&o.vectorLayerIds.indexOf(s)===-1)&&this.fire(new p.j(new Error(`Source layer "${s}" does not exist on source "${o.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e,n=!1){let s=this._serializedAllLayers();if(!e||e.length===0)return Object.values(n?p.aB(s):s);let o=[];for(let u of e)if(s[u]){let m=n?p.aB(s[u]):s[u];o.push(m)}return o}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};let n=Object.keys(this._layers);for(let s of n){let o=this._layers[s];o.type!=="custom"&&(e[s]=o.serialize())}return e}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(let e in this.sourceCaches)if(this.sourceCaches[e].hasTransition())return!0;for(let e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;let n=this._changed;if(n){let o=Object.keys(this._updatedLayers),u=Object.keys(this._removedLayers);(o.length||u.length)&&this._updateWorkerLayers(o,u);for(let m in this._updatedSources){let _=this._updatedSources[m];if(_==="reload")this._reloadSource(m);else{if(_!=="clear")throw new Error(`Invalid action ${_}`);this._clearSource(m)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let m in this._updatedPaintProps)this._layers[m].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}let s={};for(let o in this.sourceCaches){let u=this.sourceCaches[o];s[o]=u.used,u.used=!1}for(let o of this._order){let u=this._layers[o];u.recalculate(e,this._availableImages),!u.isHidden(e.zoom)&&u.source&&(this.sourceCaches[u.source].used=!0)}for(let o in s){let u=this.sourceCaches[o];!!s[o]!=!!u.used&&u.fire(new p.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:o}))}this.light.recalculate(e),this.sky.recalculate(e),this.z=e.zoom,n&&this.fire(new p.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let n in this.sourceCaches)this.sourceCaches[n].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,n){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,n={}){var s;this._checkLoaded();let o=this.serialize();if(e=n.transformStyle?n.transformStyle(o,e):e,((s=n.validate)===null||s===void 0||s)&&Lr(this,p.u(e)))return!1;(e=p.aB(e)).layers=p.az(e.layers);let u=p.aC(o,e),m=this._getOperationsToPerform(u);if(m.unimplemented.length>0)throw new Error(`Unimplemented: ${m.unimplemented.join(", ")}.`);if(m.operations.length===0)return!1;for(let _ of m.operations)_();return this.stylesheet=e,this._serializedLayers=null,!0}_getOperationsToPerform(e){let n=[],s=[];for(let o of e)switch(o.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":n.push(()=>this.addLayer.apply(this,o.args));break;case"removeLayer":n.push(()=>this.removeLayer.apply(this,o.args));break;case"setPaintProperty":n.push(()=>this.setPaintProperty.apply(this,o.args));break;case"setLayoutProperty":n.push(()=>this.setLayoutProperty.apply(this,o.args));break;case"setFilter":n.push(()=>this.setFilter.apply(this,o.args));break;case"addSource":n.push(()=>this.addSource.apply(this,o.args));break;case"removeSource":n.push(()=>this.removeSource.apply(this,o.args));break;case"setLayerZoomRange":n.push(()=>this.setLayerZoomRange.apply(this,o.args));break;case"setLight":n.push(()=>this.setLight.apply(this,o.args));break;case"setGeoJSONSourceData":n.push(()=>this.setGeoJSONSourceData.apply(this,o.args));break;case"setGlyphs":n.push(()=>this.setGlyphs.apply(this,o.args));break;case"setSprite":n.push(()=>this.setSprite.apply(this,o.args));break;case"setSky":n.push(()=>this.setSky.apply(this,o.args));break;case"setTerrain":n.push(()=>this.map.setTerrain.apply(this,o.args));break;case"setTransition":n.push(()=>{});break;default:s.push(o.command)}return{operations:n,unimplemented:s}}addImage(e,n){if(this.getImage(e))return this.fire(new p.j(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,n),this._afterImageUpdated(e)}updateImage(e,n){this.imageManager.updateImage(e,n)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new p.j(new Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,n,s={}){if(this._checkLoaded(),this.sourceCaches[e]!==void 0)throw new Error(`Source "${e}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(p.u.source,`sources.${e}`,n,null,s))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);let o=this.sourceCaches[e]=new at(e,n,this.dispatcher);o.style=this,o.setEventedParent(this,()=>({isSourceLoaded:o.loaded(),source:o.serialize(),sourceId:e})),o.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error("There is no source with this ID");for(let s in this._layers)if(this._layers[s].source===e)return this.fire(new p.j(new Error(`Source "${e}" cannot be removed while layer "${s}" is using it.`)));let n=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],n.fire(new p.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,n){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error(`There is no source with this ID=${e}`);let s=this.sourceCaches[e].getSource();if(s.type!=="geojson")throw new Error(`geojsonSource.type is ${s.type}, which is !== 'geojson`);s.setData(n),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,n,s={}){this._checkLoaded();let o=e.id;if(this.getLayer(o))return void this.fire(new p.j(new Error(`Layer "${o}" already exists on this map.`)));let u;if(e.type==="custom"){if(Lr(this,p.aD(e)))return;u=p.aA(e)}else{if("source"in e&&typeof e.source=="object"&&(this.addSource(o,e.source),e=p.aB(e),e=p.e(e,{source:o})),this._validate(p.u.layer,`layers.${o}`,e,{arrayIndex:-1},s))return;u=p.aA(e),this._validateLayer(u),u.setEventedParent(this,{layer:{id:o}})}let m=n?this._order.indexOf(n):this._order.length;if(n&&m===-1)this.fire(new p.j(new Error(`Cannot add layer "${o}" before non-existing layer "${n}".`)));else{if(this._order.splice(m,0,o),this._layerOrderChanged=!0,this._layers[o]=u,this._removedLayers[o]&&u.source&&u.type!=="custom"){let _=this._removedLayers[o];delete this._removedLayers[o],_.type!==u.type?this._updatedSources[u.source]="clear":(this._updatedSources[u.source]="reload",this.sourceCaches[u.source].pause())}this._updateLayer(u),u.onAdd&&u.onAdd(this.map)}}moveLayer(e,n){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new p.j(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===n)return;let s=this._order.indexOf(e);this._order.splice(s,1);let o=n?this._order.indexOf(n):this._order.length;n&&o===-1?this.fire(new p.j(new Error(`Cannot move layer "${e}" before non-existing layer "${n}".`))):(this._order.splice(o,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();let n=this._layers[e];if(!n)return void this.fire(new p.j(new Error(`Cannot remove non-existing layer "${e}".`)));n.setEventedParent(null);let s=this._order.indexOf(e);this._order.splice(s,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=n,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],n.onRemove&&n.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,n,s){this._checkLoaded();let o=this.getLayer(e);o?o.minzoom===n&&o.maxzoom===s||(n!=null&&(o.minzoom=n),s!=null&&(o.maxzoom=s),this._updateLayer(o)):this.fire(new p.j(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,n,s={}){this._checkLoaded();let o=this.getLayer(e);if(o){if(!p.aE(o.filter,n))return n==null?(o.filter=void 0,void this._updateLayer(o)):void(this._validate(p.u.filter,`layers.${o.id}.filter`,n,null,s)||(o.filter=p.aB(n),this._updateLayer(o)))}else this.fire(new p.j(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return p.aB(this.getLayer(e).filter)}setLayoutProperty(e,n,s,o={}){this._checkLoaded();let u=this.getLayer(e);u?p.aE(u.getLayoutProperty(n),s)||(u.setLayoutProperty(n,s,o),this._updateLayer(u)):this.fire(new p.j(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,n){let s=this.getLayer(e);if(s)return s.getLayoutProperty(n);this.fire(new p.j(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,n,s,o={}){this._checkLoaded();let u=this.getLayer(e);u?p.aE(u.getPaintProperty(n),s)||(u.setPaintProperty(n,s,o)&&this._updateLayer(u),this._changed=!0,this._updatedPaintProps[e]=!0,this._serializedLayers=null):this.fire(new p.j(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(e,n){return this.getLayer(e).getPaintProperty(n)}setFeatureState(e,n){this._checkLoaded();let s=e.source,o=e.sourceLayer,u=this.sourceCaches[s];if(u===void 0)return void this.fire(new p.j(new Error(`The source '${s}' does not exist in the map's style.`)));let m=u.getSource().type;m==="geojson"&&o?this.fire(new p.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):m!=="vector"||o?(e.id===void 0&&this.fire(new p.j(new Error("The feature id parameter must be provided."))),u.setFeatureState(o,e.id,n)):this.fire(new p.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,n){this._checkLoaded();let s=e.source,o=this.sourceCaches[s];if(o===void 0)return void this.fire(new p.j(new Error(`The source '${s}' does not exist in the map's style.`)));let u=o.getSource().type,m=u==="vector"?e.sourceLayer:void 0;u!=="vector"||m?n&&typeof e.id!="string"&&typeof e.id!="number"?this.fire(new p.j(new Error("A feature id is required to remove its specific state property."))):o.removeFeatureState(m,e.id,n):this.fire(new p.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();let n=e.source,s=e.sourceLayer,o=this.sourceCaches[n];if(o!==void 0)return o.getSource().type!=="vector"||s?(e.id===void 0&&this.fire(new p.j(new Error("The feature id parameter must be provided."))),o.getFeatureState(s,e.id)):void this.fire(new p.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new p.j(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return p.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;let e=p.aF(this.sourceCaches,u=>u.serialize()),n=this._serializeByIds(this._order,!0),s=this.map.getTerrain()||void 0,o=this.stylesheet;return p.aG({version:o.version,name:o.name,metadata:o.metadata,light:o.light,sky:o.sky,center:o.center,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch,sprite:o.sprite,glyphs:o.glyphs,transition:o.transition,sources:e,layers:n,terrain:s},u=>u!==void 0)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.sourceCaches[e.source].getSource().type!=="raster"&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){let n=m=>this._layers[m].type==="fill-extrusion",s={},o=[];for(let m=this._order.length-1;m>=0;m--){let _=this._order[m];if(n(_)){s[_]=m;for(let y of e){let b=y[_];if(b)for(let T of b)o.push(T)}}}o.sort((m,_)=>_.intersectionZ-m.intersectionZ);let u=[];for(let m=this._order.length-1;m>=0;m--){let _=this._order[m];if(n(_))for(let y=o.length-1;y>=0;y--){let b=o[y].feature;if(s[b.layer.id]{let be=G.featureSortOrder;if(be){let ze=be.indexOf(ae.featureIndex);return be.indexOf(fe.featureIndex)-ze}return fe.featureIndex-ae.featureIndex});for(let ae of te)Q.push(ae)}}for(let G in O)O[G].forEach(W=>{let N=W.feature,Q=b[_[G].source].getFeatureState(N.layer["source-layer"],N.id);N.source=N.layer.source,N.layer["source-layer"]&&(N.sourceLayer=N.layer["source-layer"]),N.state=Q});return O}(this._layers,m,this.sourceCaches,e,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(u)}querySourceFeatures(e,n){n&&n.filter&&this._validate(p.u.filter,"querySourceFeatures.filter",n.filter,null,n);let s=this.sourceCaches[e];return s?function(o,u){let m=o.getRenderableIds().map(b=>o.getTileByID(b)),_=[],y={};for(let b=0;bP.getTileByID(L)).sort((L,O)=>O.tileID.overscaledZ-L.tileID.overscaledZ||(L.tileID.isLessThan(O.tileID)?-1:1))}let C=this.crossTileSymbolIndex.addLayer(T,y[T.source],e.center.lng);m=m||C}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((u=u||this._layerOrderChanged||s===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(se.now(),e.zoom))&&(this.pauseablePlacement=new wa(e,this.map.terrain,this._order,u,n,s,o,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,y),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(se.now()),_=!0),m&&this.pauseablePlacement.placement.setStale()),_||m)for(let b of this._order){let T=this._layers[b];T.type==="symbol"&&this.placement.updateLayerOpacities(T,y[T.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(se.now())}_releaseSymbolFadeTiles(){for(let e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,n){return p._(this,void 0,void 0,function*(){let s=yield this.imageManager.getImages(n.icons);this._updateTilesForChangedImages();let o=this.sourceCaches[n.source];return o&&o.setDependencies(n.tileID.key,n.type,n.icons),s})}getGlyphs(e,n){return p._(this,void 0,void 0,function*(){let s=yield this.glyphManager.getGlyphs(n.stacks),o=this.sourceCaches[n.source];return o&&o.setDependencies(n.tileID.key,n.type,[""]),s})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,n={}){this._checkLoaded(),e&&this._validate(p.u.glyphs,"glyphs",e,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,n,s={},o){this._checkLoaded();let u=[{id:e,url:n}],m=[...ve(this.stylesheet.sprite),...u];this._validate(p.u.sprite,"sprite",m,null,s)||(this.stylesheet.sprite=m,this._loadSprite(u,!0,o))}removeSprite(e){this._checkLoaded();let n=ve(this.stylesheet.sprite);if(n.find(s=>s.id===e)){if(this._spritesImagesIds[e])for(let s of this._spritesImagesIds[e])this.imageManager.removeImage(s),this._changedImages[s]=!0;n.splice(n.findIndex(s=>s.id===e),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.k("data",{dataType:"style"}))}else this.fire(new p.j(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return ve(this.stylesheet.sprite)}setSprite(e,n={},s){this._checkLoaded(),e&&this._validate(p.u.sprite,"sprite",e,null,n)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,s):(this._unloadSprite(),s&&s(null)))}}var xn=p.Y([{name:"a_pos",type:"Int16",components:2}]);let ln={prelude:Nt(`#ifdef GL_ES +(()=>{var $m=Object.create;var Kp=Object.defineProperty;var Zm=Object.getOwnPropertyDescriptor;var Gm=Object.getOwnPropertyNames;var Hm=Object.getPrototypeOf,Xm=Object.prototype.hasOwnProperty;var xa=(w,S)=>()=>(S||w((S={exports:{}}).exports,S),S.exports);var Wm=(w,S,F,J)=>{if(S&&typeof S=="object"||typeof S=="function")for(let E of Gm(S))!Xm.call(w,E)&&E!==F&&Kp(w,E,{get:()=>S[E],enumerable:!(J=Zm(S,E))||J.enumerable});return w};var Yp=(w,S,F)=>(F=w!=null?$m(Hm(w)):{},Wm(S||!w||!w.__esModule?Kp(F,"default",{value:w,enumerable:!0}):F,w));var ed=xa((Xc,Wc)=>{(function(w,S){typeof Xc=="object"&&typeof Wc<"u"?Wc.exports=S():typeof define=="function"&&define.amd?define(S):(w=typeof globalThis<"u"?globalThis:w||self,w.maplibregl=S())})(Xc,function(){"use strict";var w={},S={};function F(E,p,ue){if(S[E]=ue,E==="index"){var pe="var sharedModule = {}; ("+S.shared+")(sharedModule); ("+S.worker+")(sharedModule);",De={};return S.shared(De),S.index(w,De),typeof window<"u"&&w.setWorkerUrl(window.URL.createObjectURL(new Blob([pe],{type:"text/javascript"}))),w}}F("shared",["exports"],function(E){"use strict";function p(i,t,r,a){return new(r||(r=Promise))(function(l,h){function d(v){try{g(a.next(v))}catch(x){h(x)}}function f(v){try{g(a.throw(v))}catch(x){h(x)}}function g(v){var x;v.done?l(v.value):(x=v.value,x instanceof r?x:new r(function(A){A(x)})).then(d,f)}g((a=a.apply(i,t||[])).next())})}function ue(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}typeof SuppressedError=="function"&&SuppressedError;var pe=De;function De(i,t){this.x=i,this.y=t}De.prototype={clone:function(){return new De(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,t){return this.clone()._rotateAround(i,t)},matMult:function(i){return this.clone()._matMult(i)},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(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var t=i.x-this.x,r=i.y-this.y;return t*t+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,t){return Math.atan2(this.x*t-this.y*i,this.x*i+this.y*t)},_matMult:function(i){var t=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=t,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var t=Math.cos(i),r=Math.sin(i),a=r*this.x+t*this.y;return this.x=t*this.x-r*this.y,this.y=a,this},_rotateAround:function(i,t){var r=Math.cos(i),a=Math.sin(i),l=t.y+a*(this.x-t.x)+r*(this.y-t.y);return this.x=t.x+r*(this.x-t.x)-a*(this.y-t.y),this.y=l,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},De.convert=function(i){return i instanceof De?i:Array.isArray(i)?new De(i[0],i[1]):i};var se=ue(pe),W=Mt;function Mt(i,t,r,a){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(a-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=t,this.p2x=r,this.p2y=a}Mt.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,t){if(t===void 0&&(t=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,a=0;a<8;a++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)l?d=r:f=r,r=.5*(f-d)+d;return r},solve:function(i,t){return this.sampleCurveY(this.solveCurveX(i,t))}};var gt=ue(W);let Et,li;function Lt(){return Et==null&&(Et=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Et}function Pt(){if(li==null&&(li=!1,Lt())){let t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let a=0;a<5*5;a++){let l=4*a;t.fillStyle=`rgb(${l},${l+1},${l+2})`,t.fillRect(a%5,Math.floor(a/5),1,1)}let r=t.getImageData(0,0,5,5).data;for(let a=0;a<5*5*4;a++)if(a%4!=3&&r[a]!==a){li=!0;break}}}return li||!1}function ge(i,t,r,a){let l=new gt(i,t,r,a);return h=>l.solve(h)}let $e=ge(.25,.1,.25,1);function Pe(i,t,r){return Math.min(r,Math.max(t,i))}function Fe(i,t,r){let a=r-t,l=((i-t)%a+a)%a+t;return l===t?r:l}function Ye(i,...t){for(let r of t)for(let a in r)i[a]=r[a];return i}let ve=1;function xe(i,t,r){let a={};for(let l in i)a[l]=t.call(this,i[l],l,i);return a}function Ae(i,t,r){let a={};for(let l in i)t.call(this,i[l],l,i)&&(a[l]=i[l]);return a}function ye(i){return Array.isArray(i)?i.map(ye):typeof i=="object"&&i?xe(i,ye):i}let Xe={};function Ie(i){Xe[i]||(typeof console<"u"&&console.warn(i),Xe[i]=!0)}function Qe(i,t,r){return(r.y-i.y)*(t.x-i.x)>(t.y-i.y)*(r.x-i.x)}function qe(i){return typeof WorkerGlobalScope<"u"&&i!==void 0&&i instanceof WorkerGlobalScope}let at=null;function ht(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}let pt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Be(i,t,r,a,l){return p(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");let h=new VideoFrame(i,{timestamp:0});try{let d=h?.format;if(!d||!d.startsWith("BGR")&&!d.startsWith("RGB"))throw new Error(`Unrecognized format ${d}`);let f=d.startsWith("BGR"),g=new Uint8ClampedArray(a*l*4);if(yield h.copyTo(g,function(v,x,A,D,M){let z=4*Math.max(-x,0),B=(Math.max(0,A)-A)*D*4+z,q=4*D,$=Math.max(0,x),ne=Math.max(0,A);return{rect:{x:$,y:ne,width:Math.min(v.width,x+D)-$,height:Math.min(v.height,A+M)-ne},layout:[{offset:B,stride:q}]}}(i,t,r,a,l)),f)for(let v=0;vqe(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,et=function(i,t){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){let a=Rt(i.url);if(a)return a(i,t);if(qe(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,targetMapId:Vt},t)}if(!(/^file:/.test(r=i.url)||/^file:/.test(ui())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(a,l){return p(this,void 0,void 0,function*(){let h=new Request(a.url,{method:a.method||"GET",body:a.body,credentials:a.credentials,headers:a.headers,cache:a.cache,referrer:ui(),signal:l.signal});a.type!=="json"||h.headers.has("Accept")||h.headers.set("Accept","application/json");let d=yield fetch(h);if(!d.ok){let v=yield d.blob();throw new xt(d.status,d.statusText,a.url,v)}let f;f=a.type==="arrayBuffer"||a.type==="image"?d.arrayBuffer():a.type==="json"?d.json():d.text();let g=yield f;if(l.signal.aborted)throw St();return{data:g,cacheControl:d.headers.get("Cache-Control"),expires:d.headers.get("Expires")}})}(i,t);if(qe(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,mustQueue:!0,targetMapId:Vt},t)}var r;return function(a,l){return new Promise((h,d)=>{var f;let g=new XMLHttpRequest;g.open(a.method||"GET",a.url,!0),a.type!=="arrayBuffer"&&a.type!=="image"||(g.responseType="arraybuffer");for(let v in a.headers)g.setRequestHeader(v,a.headers[v]);a.type==="json"&&(g.responseType="text",!((f=a.headers)===null||f===void 0)&&f.Accept||g.setRequestHeader("Accept","application/json")),g.withCredentials=a.credentials==="include",g.onerror=()=>{d(new Error(g.statusText))},g.onload=()=>{if(!l.signal.aborted)if((g.status>=200&&g.status<300||g.status===0)&&g.response!==null){let v=g.response;if(a.type==="json")try{v=JSON.parse(g.response)}catch(x){return void d(x)}h({data:v,cacheControl:g.getResponseHeader("Cache-Control"),expires:g.getResponseHeader("Expires")})}else{let v=new Blob([g.response],{type:g.getResponseHeader("Content-Type")});d(new xt(g.status,g.statusText,a.url,v))}},l.signal.addEventListener("abort",()=>{g.abort(),d(St())}),g.send(a.body)})}(i,t)};function yt(i){if(!i||i.indexOf("://")<=0||i.indexOf("data:image/")===0||i.indexOf("blob:")===0)return!0;let t=new URL(i),r=window.location;return t.protocol===r.protocol&&t.host===r.host}function jt(i,t,r){r[i]&&r[i].indexOf(t)!==-1||(r[i]=r[i]||[],r[i].push(t))}function ut(i,t,r){if(r&&r[i]){let a=r[i].indexOf(t);a!==-1&&r[i].splice(a,1)}}class ci{constructor(t,r={}){Ye(this,r),this.type=t}}class bi extends ci{constructor(t,r={}){super("error",Ye({error:t},r))}}class Kt{on(t,r){return this._listeners=this._listeners||{},jt(t,r,this._listeners),this}off(t,r){return ut(t,r,this._listeners),ut(t,r,this._oneTimeListeners),this}once(t,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},jt(t,r,this._oneTimeListeners),this):new Promise(a=>this.once(t,a))}fire(t,r){typeof t=="string"&&(t=new ci(t,r||{}));let a=t.type;if(this.listens(a)){t.target=this;let l=this._listeners&&this._listeners[a]?this._listeners[a].slice():[];for(let f of l)f.call(this,t);let h=this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[];for(let f of h)ut(a,f,this._oneTimeListeners),f.call(this,t);let d=this._eventedParent;d&&(Ye(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),d.fire(t))}else t instanceof bi&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,r){return this._eventedParent=t,this._eventedParentData=r,this}}var oe={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},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:{},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_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"}},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:"enum",default:"mercator",values:{mercator:{},globe:{}}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","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:"number",default:335,minimum:0,maximum:359,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:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",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"}},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"}}};let Xi=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function kr(i,t){let r={};for(let a in i)a!=="ref"&&(r[a]=i[a]);return Xi.forEach(a=>{a in t&&(r[a]=t[a])}),r}function wt(i,t){if(Array.isArray(i)){if(!Array.isArray(t)||i.length!==t.length)return!1;for(let r=0;r`:i.itemType.kind==="value"?"array":`array<${t}>`}return i.kind}let R=[Pr,Ee,mt,nt,Si,yr,Ji,k(st),on,Zr,j];function V(i,t){if(t.kind==="error")return null;if(i.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!V(i.itemType,t.itemType))&&(typeof i.N!="number"||i.N===t.N))return null}else{if(i.kind===t.kind)return null;if(i.kind==="value"){for(let r of R)if(!V(r,t))return null}}return`Expected ${I(i)} but found ${I(t)} instead.`}function Y(i,t){return t.some(r=>r.kind===i.kind)}function ee(i,t){return t.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}function re(i,t){return i.kind==="array"&&t.kind==="array"?i.itemType.kind===t.itemType.kind&&typeof i.N=="number":i.kind===t.kind}let H=.96422,he=.82521,me=4/29,le=6/29,Te=3*le*le,Ke=le*le*le,tt=Math.PI/180,zt=180/Math.PI;function ft(i){return(i%=360)<0&&(i+=360),i}function Bt([i,t,r,a]){let l,h,d=yi((.2225045*(i=Ct(i))+.7168786*(t=Ct(t))+.0606169*(r=Ct(r)))/1);i===t&&t===r?l=h=d:(l=yi((.4360747*i+.3850649*t+.1430804*r)/H),h=yi((.0139322*i+.0971045*t+.7141733*r)/he));let f=116*d-16;return[f<0?0:f,500*(l-d),200*(d-h),a]}function Ct(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function yi(i){return i>Ke?Math.pow(i,1/3):i/Te+me}function hi([i,t,r,a]){let l=(i+16)/116,h=isNaN(t)?l:l+t/500,d=isNaN(r)?l:l-r/200;return l=1*$t(l),h=H*$t(h),d=he*$t(d),[bt(3.1338561*h-1.6168667*l-.4906146*d),bt(-.9787684*h+1.9161415*l+.033454*d),bt(.0719453*h-.2289914*l+1.4052427*d),a]}function bt(i){return(i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055)<0?0:i>1?1:i}function $t(i){return i>le?i*i*i:Te*(i-me)}function oi(i){return parseInt(i.padEnd(2,i),16)/255}function Ei(i,t){return Ii(t?i/100:i,0,1)}function Ii(i,t,r){return Math.min(Math.max(t,i),r)}function ji(i){return!i.some(Number.isNaN)}let qn={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]};class Zt{constructor(t,r,a,l=1,h=!0){this.r=t,this.g=r,this.b=a,this.a=l,h||(this.r*=l,this.g*=l,this.b*=l,l||this.overwriteGetter("rgb",[t,r,a,l]))}static parse(t){if(t instanceof Zt)return t;if(typeof t!="string")return;let r=function(a){if((a=a.toLowerCase().trim())==="transparent")return[0,0,0,0];let l=qn[a];if(l){let[d,f,g]=l;return[d/255,f/255,g/255,1]}if(a.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(a)){let d=a.length<6?1:2,f=1;return[oi(a.slice(f,f+=d)),oi(a.slice(f,f+=d)),oi(a.slice(f,f+=d)),oi(a.slice(f,f+d)||"ff")]}if(a.startsWith("rgb")){let d=a.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){let[f,g,v,x,A,D,M,z,B,q,$,ne]=d,K=[x||" ",M||" ",q].join("");if(K===" "||K===" /"||K===",,"||K===",,,"){let ie=[v,D,B].join(""),ce=ie==="%%%"?100:ie===""?255:0;if(ce){let _e=[Ii(+g/ce,0,1),Ii(+A/ce,0,1),Ii(+z/ce,0,1),$?Ei(+$,ne):1];if(ji(_e))return _e}}return}}let h=a.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(h){let[d,f,g,v,x,A,D,M,z]=h,B=[g||" ",x||" ",D].join("");if(B===" "||B===" /"||B===",,"||B===",,,"){let q=[+f,Ii(+v,0,100),Ii(+A,0,100),M?Ei(+M,z):1];if(ji(q))return function([$,ne,K,ie]){function ce(_e){let Oe=(_e+$/30)%12,it=ne*Math.min(K,1-K);return K-it*Math.max(-1,Math.min(Oe-3,9-Oe,1))}return $=ft($),ne/=100,K/=100,[ce(0),ce(8),ce(4),ie]}(q)}}}(t);return r?new Zt(...r,!1):void 0}get rgb(){let{r:t,g:r,b:a,a:l}=this,h=l||1/0;return this.overwriteGetter("rgb",[t/h,r/h,a/h,l])}get hcl(){return this.overwriteGetter("hcl",function(t){let[r,a,l,h]=Bt(t),d=Math.sqrt(a*a+l*l);return[Math.round(1e4*d)?ft(Math.atan2(l,a)*zt):NaN,d,r,h]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Bt(this.rgb))}overwriteGetter(t,r){return Object.defineProperty(this,t,{value:r}),r}toString(){let[t,r,a,l]=this.rgb;return`rgba(${[t,r,a].map(h=>Math.round(255*h)).join(",")},${l})`}}Zt.black=new Zt(0,0,0,1),Zt.white=new Zt(1,1,1,1),Zt.transparent=new Zt(0,0,0,0),Zt.red=new Zt(1,0,0,1);class Ys{constructor(t,r,a){this.sensitivity=t?r?"variant":"case":r?"accent":"base",this.locale=a,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,r){return this.collator.compare(t,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Qs{constructor(t,r,a,l,h){this.text=t,this.image=r,this.scale=a,this.fontStack=l,this.textColor=h}}class ur{constructor(t){this.sections=t}static fromString(t){return new ur([new Qs(t,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(t=>t.text.length!==0||t.image&&t.image.name.length!==0)}static factory(t){return t instanceof ur?t:ur.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}}class cr{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof cr)return t;if(typeof t=="number")return new cr([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(let r of t)if(typeof r!="number")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new cr(t)}}toString(){return JSON.stringify(this.values)}}let zu=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class vr{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof vr)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let r=0;r=0&&i<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof r=="number"&&r>=0&&r<=255?a===void 0||typeof a=="number"&&a>=0&&a<=1?null:`Invalid rgba value [${[i,t,r,a].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof a=="number"?[i,t,r,a]:[i,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function vn(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof Zt||i instanceof Ys||i instanceof ur||i instanceof cr||i instanceof vr||i instanceof hr)return!0;if(Array.isArray(i)){for(let t of i)if(!vn(t))return!1;return!0}if(typeof i=="object"){for(let t in i)if(!vn(i[t]))return!1;return!0}return!1}function vi(i){if(i===null)return Pr;if(typeof i=="string")return mt;if(typeof i=="boolean")return nt;if(typeof i=="number")return Ee;if(i instanceof Zt)return Si;if(i instanceof Ys)return Ki;if(i instanceof ur)return yr;if(i instanceof cr)return on;if(i instanceof vr)return j;if(i instanceof hr)return Zr;if(Array.isArray(i)){let t=i.length,r;for(let a of i){let l=vi(a);if(r){if(r===l)continue;r=st;break}r=l}return k(r||st,t)}return Ji}function wa(i){let t=typeof i;return i===null?"":t==="string"||t==="number"||t==="boolean"?String(i):i instanceof Zt||i instanceof ur||i instanceof cr||i instanceof vr||i instanceof hr?i.toString():JSON.stringify(i)}class zr{constructor(t,r){this.type=t,this.value=r}static parse(t,r){if(t.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!vn(t[1]))return r.error("invalid value");let a=t[1],l=vi(a),h=r.expectedType;return l.kind!=="array"||l.N!==0||!h||h.kind!=="array"||typeof h.N=="number"&&h.N!==0||(l=h),new zr(l,a)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class gi{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}let Wa={string:mt,number:Ee,boolean:nt,object:Ji};class Br{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let a,l=1,h=t[0];if(h==="array"){let f,g;if(t.length>2){let v=t[1];if(typeof v!="string"||!(v in Wa)||v==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);f=Wa[v],l++}else f=st;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return r.error('The length argument to "array" must be a positive integer literal',2);g=t[2],l++}a=k(f,g)}else{if(!Wa[h])throw new Error(`Types doesn't contain name = ${h}`);a=Wa[h]}let d=[];for(;lt.outputDefined())}}let eo={"to-boolean":nt,"to-color":Si,"to-number":Ee,"to-string":mt};class Lr{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let a=t[0];if(!eo[a])throw new Error(`Can't parse ${a} as it is not part of the known types`);if((a==="to-boolean"||a==="to-string")&&t.length!==2)return r.error("Expected one argument.");let l=eo[a],h=[];for(let d=1;d4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:Vn(r[0],r[1],r[2],r[3]),!a))return new Zt(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new gi(a||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(let a of this.args){r=a.evaluate(t);let l=cr.parse(r);if(l)return l}throw new gi(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(let a of this.args){r=a.evaluate(t);let l=vr.parse(r);if(l)return l}throw new gi(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(let a of this.args){if(r=a.evaluate(t),r===null)return 0;let l=Number(r);if(!isNaN(l))return l}throw new gi(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return ur.fromString(wa(this.args[0].evaluate(t)));case"resolvedImage":return hr.fromString(wa(this.args[0].evaluate(t)));default:return wa(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}let Bu=["Unknown","Point","LineString","Polygon"];class Ja{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},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"?Bu[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(t){let r=this._parseColorCache[t];return r||(r=this._parseColorCache[t]=Zt.parse(t)),r}}class xn{constructor(t,r,a=[],l,h=new lr,d=[]){this.registry=t,this.path=a,this.key=a.map(f=>`[${f}]`).join(""),this.scope=h,this.errors=d,this.expectedType=l,this._isConstant=r}parse(t,r,a,l,h={}){return r?this.concat(r,a,l)._parse(t,h):this._parse(t,h)}_parse(t,r){function a(l,h,d){return d==="assert"?new Br(h,[l]):d==="coerce"?new Lr(h,[l]):l}if(t!==null&&typeof t!="string"&&typeof t!="boolean"&&typeof t!="number"||(t=["literal",t]),Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let l=t[0];if(typeof l!="string")return this.error(`Expression name must be a string, but found ${typeof l} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let h=this.registry[l];if(h){let d=h.parse(t,this);if(!d)return null;if(this.expectedType){let f=this.expectedType,g=d.type;if(f.kind!=="string"&&f.kind!=="number"&&f.kind!=="boolean"&&f.kind!=="object"&&f.kind!=="array"||g.kind!=="value")if(f.kind!=="color"&&f.kind!=="formatted"&&f.kind!=="resolvedImage"||g.kind!=="value"&&g.kind!=="string")if(f.kind!=="padding"||g.kind!=="value"&&g.kind!=="number"&&g.kind!=="array")if(f.kind!=="variableAnchorOffsetCollection"||g.kind!=="value"&&g.kind!=="array"){if(this.checkSubtype(f,g))return null}else d=a(d,f,r.typeAnnotation||"coerce");else d=a(d,f,r.typeAnnotation||"coerce");else d=a(d,f,r.typeAnnotation||"coerce");else d=a(d,f,r.typeAnnotation||"assert")}if(!(d instanceof zr)&&d.type.kind!=="resolvedImage"&&this._isConstant(d)){let f=new Ja;try{d=new zr(d.type,d.evaluate(f))}catch(g){return this.error(g.message),null}}return d}return this.error(`Unknown expression "${l}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(t===void 0?"'undefined' value invalid. Use null instead.":typeof t=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,r,a){let l=typeof t=="number"?this.path.concat(t):this.path,h=a?this.scope.concat(a):this.scope;return new xn(this.registry,this._isConstant,l,r||null,h,this.errors)}error(t,...r){let a=`${this.key}${r.map(l=>`[${l}]`).join("")}`;this.errors.push(new Ai(a,t))}checkSubtype(t,r){let a=V(t,r);return a&&this.error(a),a}}class ln{constructor(t,r){this.type=r.type,this.bindings=[].concat(t),this.result=r}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(let r of this.bindings)t(r[1]);t(this.result)}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);let a=[];for(let h=1;h=a.length)throw new gi(`Array index out of bounds: ${r} > ${a.length-1}.`);if(r!==Math.floor(r))throw new gi(`Array index must be an integer, but found ${r} instead.`);return a[r]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class io{constructor(t,r){this.type=nt,this.needle=t,this.haystack=r}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let a=r.parse(t[1],1,st),l=r.parse(t[2],2,st);return a&&l?Y(a.type,[nt,mt,Ee,Pr,st])?new io(a,l):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${I(a.type)} instead`):null}evaluate(t){let r=this.needle.evaluate(t),a=this.haystack.evaluate(t);if(!a)return!1;if(!ee(r,["boolean","string","number","null"]))throw new gi(`Expected first argument to be of type boolean, string, number or null, but found ${I(vi(r))} instead.`);if(!ee(a,["string","array"]))throw new gi(`Expected second argument to be of type array or string, but found ${I(vi(a))} instead.`);return a.indexOf(r)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class Un{constructor(t,r,a){this.type=Ee,this.needle=t,this.haystack=r,this.fromIndex=a}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);let a=r.parse(t[1],1,st),l=r.parse(t[2],2,st);if(!a||!l)return null;if(!Y(a.type,[nt,mt,Ee,Pr,st]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${I(a.type)} instead`);if(t.length===4){let h=r.parse(t[3],3,Ee);return h?new Un(a,l,h):null}return new Un(a,l)}evaluate(t){let r=this.needle.evaluate(t),a=this.haystack.evaluate(t);if(!ee(r,["boolean","string","number","null"]))throw new gi(`Expected first argument to be of type boolean, string, number or null, but found ${I(vi(r))} instead.`);let l;if(this.fromIndex&&(l=this.fromIndex.evaluate(t)),ee(a,["string"])){let h=a.indexOf(r,l);return h===-1?-1:[...a.slice(0,h)].length}if(ee(a,["array"]))return a.indexOf(r,l);throw new gi(`Expected second argument to be of type array or string, but found ${I(vi(a))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class ro{constructor(t,r,a,l,h,d){this.inputType=t,this.type=r,this.input=a,this.cases=l,this.outputs=h,this.otherwise=d}static parse(t,r){if(t.length<5)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return r.error("Expected an even number of arguments.");let a,l;r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);let h={},d=[];for(let v=2;vNumber.MAX_SAFE_INTEGER)return D.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof z=="number"&&Math.floor(z)!==z)return D.error("Numeric branch labels must be integer values.");if(a){if(D.checkSubtype(a,vi(z)))return null}else a=vi(z);if(h[String(z)]!==void 0)return D.error("Branch labels must be unique.");h[String(z)]=d.length}let M=r.parse(A,v,l);if(!M)return null;l=l||M.type,d.push(M)}let f=r.parse(t[1],1,st);if(!f)return null;let g=r.parse(t[t.length-1],t.length-1,l);return g?f.type.kind!=="value"&&r.concat(1).checkSubtype(a,f.type)?null:new ro(a,l,f,h,d,g):null}evaluate(t){let r=this.input.evaluate(t);return(vi(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}}class Ka{constructor(t,r,a){this.type=t,this.branches=r,this.otherwise=a}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return r.error("Expected an odd number of arguments.");let a;r.expectedType&&r.expectedType.kind!=="value"&&(a=r.expectedType);let l=[];for(let d=1;dr.outputDefined())&&this.otherwise.outputDefined()}}class Aa{constructor(t,r,a,l){this.type=t,this.input=r,this.beginIndex=a,this.endIndex=l}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);let a=r.parse(t[1],1,st),l=r.parse(t[2],2,Ee);if(!a||!l)return null;if(!Y(a.type,[k(st),mt,st]))return r.error(`Expected first argument to be of type array or string, but found ${I(a.type)} instead`);if(t.length===4){let h=r.parse(t[3],3,Ee);return h?new Aa(a.type,a,l,h):null}return new Aa(a.type,a,l)}evaluate(t){let r=this.input.evaluate(t),a=this.beginIndex.evaluate(t),l;if(this.endIndex&&(l=this.endIndex.evaluate(t)),ee(r,["string"]))return[...r].slice(a,l).join("");if(ee(r,["array"]))return r.slice(a,l);throw new gi(`Expected first argument to be of type array or string, but found ${I(vi(r))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function Ya(i,t){let r=i.length-1,a,l,h=0,d=r,f=0;for(;h<=d;)if(f=Math.floor((h+d)/2),a=i[f],l=i[f+1],a<=t){if(f===r||tt))throw new gi("Input is not a number.");d=f-1}return 0}class jn{constructor(t,r,a){this.type=t,this.input=r,this.labels=[],this.outputs=[];for(let[l,h]of a)this.labels.push(l),this.outputs.push(h)}static parse(t,r){if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");let a=r.parse(t[1],1,Ee);if(!a)return null;let l=[],h=null;r.expectedType&&r.expectedType.kind!=="value"&&(h=r.expectedType);for(let d=1;d=f)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',v);let A=r.parse(g,x,h);if(!A)return null;h=h||A.type,l.push([f,A])}return new jn(h,a,l)}evaluate(t){let r=this.labels,a=this.outputs;if(r.length===1)return a[0].evaluate(t);let l=this.input.evaluate(t);if(l<=r[0])return a[0].evaluate(t);let h=r.length;return l>=r[h-1]?a[h-1].evaluate(t):a[Ya(r,l)].evaluate(t)}eachChild(t){t(this.input);for(let r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function vl(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Lu=xl;function xl(i,t,r,a){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(a-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=t,this.p2x=r,this.p2y=a}xl.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,t){if(t===void 0&&(t=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,a=0;a<8;a++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)l?d=r:f=r,r=.5*(f-d)+d;return r},solve:function(i,t){return this.sampleCurveY(this.solveCurveX(i,t))}};var Ru=vl(Lu);function bn(i,t,r){return i+r*(t-i)}function Ea(i,t,r){return i.map((a,l)=>bn(a,t[l],r))}let Yi={number:bn,color:function(i,t,r,a="rgb"){switch(a){case"rgb":{let[l,h,d,f]=Ea(i.rgb,t.rgb,r);return new Zt(l,h,d,f,!1)}case"hcl":{let[l,h,d,f]=i.hcl,[g,v,x,A]=t.hcl,D,M;if(isNaN(l)||isNaN(g))isNaN(l)?isNaN(g)?D=NaN:(D=g,d!==1&&d!==0||(M=v)):(D=l,x!==1&&x!==0||(M=h));else{let ne=g-l;g>l&&ne>180?ne-=360:g180&&(ne+=360),D=l+r*ne}let[z,B,q,$]=function([ne,K,ie,ce]){return ne=isNaN(ne)?0:ne*tt,hi([ie,Math.cos(ne)*K,Math.sin(ne)*K,ce])}([D,M??bn(h,v,r),bn(d,x,r),bn(f,A,r)]);return new Zt(z,B,q,$,!1)}case"lab":{let[l,h,d,f]=hi(Ea(i.lab,t.lab,r));return new Zt(l,h,d,f,!1)}}},array:Ea,padding:function(i,t,r){return new cr(Ea(i.values,t.values,r))},variableAnchorOffsetCollection:function(i,t,r){let a=i.values,l=t.values;if(a.length!==l.length)throw new gi(`Cannot interpolate values of different length. from: ${i.toString()}, to: ${t.toString()}`);let h=[];for(let d=0;dtypeof x!="number"||x<0||x>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);l={name:"cubic-bezier",controlPoints:v}}}if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(h=r.parse(h,2,Ee),!h)return null;let f=[],g=null;a==="interpolate-hcl"||a==="interpolate-lab"?g=Si:r.expectedType&&r.expectedType.kind!=="value"&&(g=r.expectedType);for(let v=0;v=x)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',D);let z=r.parse(A,M,g);if(!z)return null;g=g||z.type,f.push([x,z])}return re(g,Ee)||re(g,Si)||re(g,on)||re(g,j)||re(g,k(Ee))?new Qi(g,a,l,h,f):r.error(`Type ${I(g)} is not interpolatable.`)}evaluate(t){let r=this.labels,a=this.outputs;if(r.length===1)return a[0].evaluate(t);let l=this.input.evaluate(t);if(l<=r[0])return a[0].evaluate(t);let h=r.length;if(l>=r[h-1])return a[h-1].evaluate(t);let d=Ya(r,l),f=Qi.interpolationFactor(this.interpolation,l,r[d],r[d+1]),g=a[d].evaluate(t),v=a[d+1].evaluate(t);switch(this.operator){case"interpolate":return Yi[this.type.kind](g,v,f);case"interpolate-hcl":return Yi.color(g,v,f,"hcl");case"interpolate-lab":return Yi.color(g,v,f,"lab")}}eachChild(t){t(this.input);for(let r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function Qa(i,t,r,a){let l=a-r,h=i-r;return l===0?0:t===1?h/l:(Math.pow(t,h)-1)/(Math.pow(t,l)-1)}class es{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expectected at least one argument.");let a=null,l=r.expectedType;l&&l.kind!=="value"&&(a=l);let h=[];for(let f of t.slice(1)){let g=r.parse(f,1+h.length,a,void 0,{typeAnnotation:"omit"});if(!g)return null;a=a||g.type,h.push(g)}if(!a)throw new Error("No output type");let d=l&&h.some(f=>V(l,f.type));return new es(d?st:a,h)}evaluate(t){let r,a=null,l=0;for(let h of this.args)if(l++,a=h.evaluate(t),a&&a instanceof hr&&!a.available&&(r||(r=a.name),a=null,l===this.args.length&&(a=r)),a!==null)break;return a}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function ts(i,t){return i==="=="||i==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function bl(i,t,r,a){return a.compare(t,r)===0}function $n(i,t,r){let a=i!=="=="&&i!=="!=";return class Qp{constructor(h,d,f){this.type=nt,this.lhs=h,this.rhs=d,this.collator=f,this.hasUntypedArgument=h.type.kind==="value"||d.type.kind==="value"}static parse(h,d){if(h.length!==3&&h.length!==4)return d.error("Expected two or three arguments.");let f=h[0],g=d.parse(h[1],1,st);if(!g)return null;if(!ts(f,g.type))return d.concat(1).error(`"${f}" comparisons are not supported for type '${I(g.type)}'.`);let v=d.parse(h[2],2,st);if(!v)return null;if(!ts(f,v.type))return d.concat(2).error(`"${f}" comparisons are not supported for type '${I(v.type)}'.`);if(g.type.kind!==v.type.kind&&g.type.kind!=="value"&&v.type.kind!=="value")return d.error(`Cannot compare types '${I(g.type)}' and '${I(v.type)}'.`);a&&(g.type.kind==="value"&&v.type.kind!=="value"?g=new Br(v.type,[g]):g.type.kind!=="value"&&v.type.kind==="value"&&(v=new Br(g.type,[v])));let x=null;if(h.length===4){if(g.type.kind!=="string"&&v.type.kind!=="string"&&g.type.kind!=="value"&&v.type.kind!=="value")return d.error("Cannot use collator to compare non-string types.");if(x=d.parse(h[3],3,Ki),!x)return null}return new Qp(g,v,x)}evaluate(h){let d=this.lhs.evaluate(h),f=this.rhs.evaluate(h);if(a&&this.hasUntypedArgument){let g=vi(d),v=vi(f);if(g.kind!==v.kind||g.kind!=="string"&&g.kind!=="number")throw new gi(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${g.kind}, ${v.kind}) instead.`)}if(this.collator&&!a&&this.hasUntypedArgument){let g=vi(d),v=vi(f);if(g.kind!=="string"||v.kind!=="string")return t(h,d,f)}return this.collator?r(h,d,f,this.collator.evaluate(h)):t(h,d,f)}eachChild(h){h(this.lhs),h(this.rhs),this.collator&&h(this.collator)}outputDefined(){return!0}}}let Fu=$n("==",function(i,t,r){return t===r},bl),wl=$n("!=",function(i,t,r){return t!==r},function(i,t,r,a){return!bl(0,t,r,a)}),Al=$n("<",function(i,t,r){return t",function(i,t,r){return t>r},function(i,t,r,a){return a.compare(t,r)>0}),Nu=$n("<=",function(i,t,r){return t<=r},function(i,t,r,a){return a.compare(t,r)<=0}),El=$n(">=",function(i,t,r){return t>=r},function(i,t,r,a){return a.compare(t,r)>=0});class Ta{constructor(t,r,a){this.type=Ki,this.locale=a,this.caseSensitive=t,this.diacriticSensitive=r}static parse(t,r){if(t.length!==2)return r.error("Expected one argument.");let a=t[1];if(typeof a!="object"||Array.isArray(a))return r.error("Collator options argument must be an object.");let l=r.parse(a["case-sensitive"]!==void 0&&a["case-sensitive"],1,nt);if(!l)return null;let h=r.parse(a["diacritic-sensitive"]!==void 0&&a["diacritic-sensitive"],1,nt);if(!h)return null;let d=null;return a.locale&&(d=r.parse(a.locale,1,mt),!d)?null:new Ta(l,h,d)}evaluate(t){return new Ys(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}class no{constructor(t,r,a,l,h){this.type=mt,this.number=t,this.locale=r,this.currency=a,this.minFractionDigits=l,this.maxFractionDigits=h}static parse(t,r){if(t.length!==3)return r.error("Expected two arguments.");let a=r.parse(t[1],1,Ee);if(!a)return null;let l=t[2];if(typeof l!="object"||Array.isArray(l))return r.error("NumberFormat options argument must be an object.");let h=null;if(l.locale&&(h=r.parse(l.locale,1,mt),!h))return null;let d=null;if(l.currency&&(d=r.parse(l.currency,1,mt),!d))return null;let f=null;if(l["min-fraction-digits"]&&(f=r.parse(l["min-fraction-digits"],1,Ee),!f))return null;let g=null;return l["max-fraction-digits"]&&(g=r.parse(l["max-fraction-digits"],1,Ee),!g)?null:new no(a,h,d,f,g)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class is{constructor(t){this.type=yr,this.sections=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let a=t[1];if(!Array.isArray(a)&&typeof a=="object")return r.error("First argument must be an image or text section.");let l=[],h=!1;for(let d=1;d<=t.length-1;++d){let f=t[d];if(h&&typeof f=="object"&&!Array.isArray(f)){h=!1;let g=null;if(f["font-scale"]&&(g=r.parse(f["font-scale"],1,Ee),!g))return null;let v=null;if(f["text-font"]&&(v=r.parse(f["text-font"],1,k(mt)),!v))return null;let x=null;if(f["text-color"]&&(x=r.parse(f["text-color"],1,Si),!x))return null;let A=l[l.length-1];A.scale=g,A.font=v,A.textColor=x}else{let g=r.parse(t[d],1,st);if(!g)return null;let v=g.type.kind;if(v!=="string"&&v!=="value"&&v!=="null"&&v!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");h=!0,l.push({content:g,scale:null,font:null,textColor:null})}}return new is(l)}evaluate(t){return new ur(this.sections.map(r=>{let a=r.content.evaluate(t);return vi(a)===Zr?new Qs("",a,null,null,null):new Qs(wa(a),null,r.scale?r.scale.evaluate(t):null,r.font?r.font.evaluate(t).join(","):null,r.textColor?r.textColor.evaluate(t):null)}))}eachChild(t){for(let r of this.sections)t(r.content),r.scale&&t(r.scale),r.font&&t(r.font),r.textColor&&t(r.textColor)}outputDefined(){return!1}}class ao{constructor(t){this.type=Zr,this.input=t}static parse(t,r){if(t.length!==2)return r.error("Expected two arguments.");let a=r.parse(t[1],1,mt);return a?new ao(a):r.error("No image name provided.")}evaluate(t){let r=this.input.evaluate(t),a=hr.fromString(r);return a&&t.availableImages&&(a.available=t.availableImages.indexOf(r)>-1),a}eachChild(t){t(this.input)}outputDefined(){return!1}}class so{constructor(t){this.type=Ee,this.input=t}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);let a=r.parse(t[1],1);return a?a.type.kind!=="array"&&a.type.kind!=="string"&&a.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${I(a.type)} instead.`):new so(a):null}evaluate(t){let r=this.input.evaluate(t);if(typeof r=="string")return[...r].length;if(Array.isArray(r))return r.length;throw new gi(`Expected value to be of type string or array, but found ${I(vi(r))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}let Gr=8192;function qu(i,t){let r=(180+i[0])/360,a=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,l=Math.pow(2,t.z);return[Math.round(r*l*Gr),Math.round(a*l*Gr)]}function oo(i,t){let r=Math.pow(2,t.z);return[(l=(i[0]/Gr+t.x)/r,360*l-180),(a=(i[1]/Gr+t.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90)];var a,l}function wn(i,t){i[0]=Math.min(i[0],t[0]),i[1]=Math.min(i[1],t[1]),i[2]=Math.max(i[2],t[0]),i[3]=Math.max(i[3],t[1])}function un(i,t){return!(i[0]<=t[0]||i[2]>=t[2]||i[1]<=t[1]||i[3]>=t[3])}function Ut(i,t,r){let a=i[0]-t[0],l=i[1]-t[1],h=i[0]-r[0],d=i[1]-r[1];return a*d-h*l==0&&a*h<=0&&l*d<=0}function rs(i,t,r,a){return(l=[a[0]-r[0],a[1]-r[1]])[0]*(h=[t[0]-i[0],t[1]-i[1]])[1]-l[1]*h[0]!=0&&!(!Cl(i,t,r,a)||!Cl(r,a,i,t));var l,h}function Vu(i,t,r){for(let a of r)for(let l=0;l(l=i)[1]!=(d=f[g+1])[1]>l[1]&&l[0]<(d[0]-h[0])*(l[1]-h[1])/(d[1]-h[1])+h[0]&&(a=!a)}var l,h,d;return a}function Uu(i,t){for(let r of t)if(Zn(i,r))return!0;return!1}function Tl(i,t){for(let r of i)if(!Zn(r,t))return!1;for(let r=0;r0&&f<0||d<0&&f>0}function lo(i,t,r){let a=[];for(let l=0;lr[2]){let l=.5*a,h=i[0]-r[0]>l?-a:r[0]-i[0]>l?a:0;h===0&&(h=i[0]-r[2]>l?-a:r[2]-i[0]>l?a:0),i[0]+=h}wn(t,i)}function Il(i,t,r,a){let l=Math.pow(2,a.z)*Gr,h=[a.x*Gr,a.y*Gr],d=[];for(let f of i)for(let g of f){let v=[g.x+h[0],g.y+h[1]];Sl(v,t,r,l),d.push(v)}return d}function kl(i,t,r,a){let l=Math.pow(2,a.z)*Gr,h=[a.x*Gr,a.y*Gr],d=[];for(let g of i){let v=[];for(let x of g){let A=[x.x+h[0],x.y+h[1]];wn(t,A),v.push(A)}d.push(v)}if(t[2]-t[0]<=l/2){(f=t)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(let g of d)for(let v of g)Sl(v,t,r,l)}var f;return d}class An{constructor(t,r){this.type=nt,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(vn(t[1])){let a=t[1];if(a.type==="FeatureCollection"){let l=[];for(let h of a.features){let{type:d,coordinates:f}=h.geometry;d==="Polygon"&&l.push(f),d==="MultiPolygon"&&l.push(...f)}if(l.length)return new An(a,{type:"MultiPolygon",coordinates:l})}else if(a.type==="Feature"){let l=a.geometry.type;if(l==="Polygon"||l==="MultiPolygon")return new An(a,a.geometry)}else if(a.type==="Polygon"||a.type==="MultiPolygon")return new An(a,a)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(r,a){let l=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(a.type==="Polygon"){let f=lo(a.coordinates,h,d),g=Il(r.geometry(),l,h,d);if(!un(l,h))return!1;for(let v of g)if(!Zn(v,f))return!1}if(a.type==="MultiPolygon"){let f=Dl(a.coordinates,h,d),g=Il(r.geometry(),l,h,d);if(!un(l,h))return!1;for(let v of g)if(!Uu(v,f))return!1}return!0}(t,this.geometries);if(t.geometryType()==="LineString")return function(r,a){let l=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(a.type==="Polygon"){let f=lo(a.coordinates,h,d),g=kl(r.geometry(),l,h,d);if(!un(l,h))return!1;for(let v of g)if(!Tl(v,f))return!1}if(a.type==="MultiPolygon"){let f=Dl(a.coordinates,h,d),g=kl(r.geometry(),l,h,d);if(!un(l,h))return!1;for(let v of g)if(!ju(v,f))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Ml=class{constructor(i=[],t=(r,a)=>ra?1:0){if(this.data=i,this.length=this.data.length,this.compare=t,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(i){this.data.push(i),this._up(this.length++)}pop(){if(this.length===0)return;let i=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),i}peek(){return this.data[0]}_up(i){let{data:t,compare:r}=this,a=t[i];for(;i>0;){let l=i-1>>1,h=t[l];if(r(a,h)>=0)break;t[i]=h,i=l}t[i]=a}_down(i){let{data:t,compare:r}=this,a=this.length>>1,l=t[i];for(;i=0)break;t[i]=t[h],i=h}t[i]=l}};function $u(i,t,r,a,l){Pl(i,t,r,a||i.length-1,l||Zu)}function Pl(i,t,r,a,l){for(;a>r;){if(a-r>600){var h=a-r+1,d=t-r+1,f=Math.log(h),g=.5*Math.exp(2*f/3),v=.5*Math.sqrt(f*g*(h-g)/h)*(d-h/2<0?-1:1);Pl(i,t,Math.max(r,Math.floor(t-d*g/h+v)),Math.min(a,Math.floor(t+(h-d)*g/h+v)),l)}var x=i[t],A=r,D=a;for(Ca(i,r,t),l(i[a],x)>0&&Ca(i,r,a);A0;)D--}l(i[r],x)===0?Ca(i,r,D):Ca(i,++D,a),D<=t&&(r=D+1),t<=D&&(a=D-1)}}function Ca(i,t,r){var a=i[t];i[t]=i[r],i[r]=a}function Zu(i,t){return it?1:0}function ns(i,t){if(i.length<=1)return[i];let r=[],a,l;for(let h of i){let d=Hu(h);d!==0&&(h.area=Math.abs(d),l===void 0&&(l=d<0),l===d<0?(a&&r.push(a),a=[h]):a.push(h))}if(a&&r.push(a),t>1)for(let h=0;h1?(v=t[g+1][0],x=t[g+1][1]):M>0&&(v+=A/this.kx*M,x+=D/this.ky*M)),A=this.wrap(r[0]-v)*this.kx,D=(r[1]-x)*this.ky;let z=A*A+D*D;z180;)t-=360;return t}}function Rl(i,t){return t[0]-i[0]}function as(i){return i[1]-i[0]+1}function en(i,t){return i[1]>=i[0]&&i[1]i[1])return[null,null];let r=as(i);if(t){if(r===2)return[i,null];let l=Math.floor(r/2);return[[i[0],i[0]+l],[i[0]+l,i[1]]]}if(r===1)return[i,null];let a=Math.floor(r/2)-1;return[[i[0],i[0]+a],[i[0]+a+1,i[1]]]}function ho(i,t){if(!en(t,i.length))return[1/0,1/0,-1/0,-1/0];let r=[1/0,1/0,-1/0,-1/0];for(let a=t[0];a<=t[1];++a)wn(r,i[a]);return r}function po(i){let t=[1/0,1/0,-1/0,-1/0];for(let r of i)for(let a of r)wn(t,a);return t}function ss(i){return i[0]!==-1/0&&i[1]!==-1/0&&i[2]!==1/0&&i[3]!==1/0}function fo(i,t,r){if(!ss(i)||!ss(t))return NaN;let a=0,l=0;return i[2]t[2]&&(a=i[0]-t[2]),i[1]>t[3]&&(l=i[1]-t[3]),i[3]=a)return a;if(un(l,h)){if(os(i,t))return 0}else if(os(t,i))return 0;let d=1/0;for(let f of i)for(let g=0,v=f.length,x=v-1;g0;){let g=d.pop();if(g[0]>=h)continue;let v=g[1],x=t?50:100;if(as(v)<=x){if(!en(v,i.length))return NaN;if(t){let A=At(i,v,r,a);if(isNaN(A)||A===0)return A;h=Math.min(h,A)}else for(let A=v[0];A<=v[1];++A){let D=Wu(i[A],r,a);if(h=Math.min(h,D),h===0)return 0}}else{let A=co(v,t);Ht(d,h,a,i,f,A[0]),Ht(d,h,a,i,f,A[1])}}return h}function Sa(i,t,r,a,l,h=1/0){let d=Math.min(h,l.distance(i[0],r[0]));if(d===0)return d;let f=new Ml([[0,[0,i.length-1],[0,r.length-1]]],Rl);for(;f.length>0;){let g=f.pop();if(g[0]>=d)continue;let v=g[1],x=g[2],A=t?50:100,D=a?50:100;if(as(v)<=A&&as(x)<=D){if(!en(v,i.length)&&en(x,r.length))return NaN;let M;if(t&&a)M=Xu(i,v,r,x,l),d=Math.min(d,M);else if(t&&!a){let z=i.slice(v[0],v[1]+1);for(let B=x[0];B<=x[1];++B)if(M=En(r[B],z,l),d=Math.min(d,M),d===0)return d}else if(!t&&a){let z=r.slice(x[0],x[1]+1);for(let B=v[0];B<=v[1];++B)if(M=En(i[B],z,l),d=Math.min(d,M),d===0)return d}else M=di(i,v,r,x,l),d=Math.min(d,M)}else{let M=co(v,t),z=co(x,a);Tn(f,d,l,i,r,M[0],z[0]),Tn(f,d,l,i,r,M[0],z[1]),Tn(f,d,l,i,r,M[1],z[0]),Tn(f,d,l,i,r,M[1],z[1])}}return d}function go(i){return i.type==="MultiPolygon"?i.coordinates.map(t=>({type:"Polygon",coordinates:t})):i.type==="MultiLineString"?i.coordinates.map(t=>({type:"LineString",coordinates:t})):i.type==="MultiPoint"?i.coordinates.map(t=>({type:"Point",coordinates:t})):[i]}class Cn{constructor(t,r){this.type=Ee,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(vn(t[1])){let a=t[1];if(a.type==="FeatureCollection")return new Cn(a,a.features.map(l=>go(l.geometry)).flat());if(a.type==="Feature")return new Cn(a,go(a.geometry));if("type"in a&&"coordinates"in a)return new Cn(a,go(a))}return r.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(r,a){let l=r.geometry(),h=l.flat().map(g=>oo([g.x,g.y],r.canonical));if(l.length===0)return NaN;let d=new uo(h[0][1]),f=1/0;for(let g of a){switch(g.type){case"Point":f=Math.min(f,Sa(h,!1,[g.coordinates],!1,d,f));break;case"LineString":f=Math.min(f,Sa(h,!1,g.coordinates,!0,d,f));break;case"Polygon":f=Math.min(f,Da(h,!1,g.coordinates,d,f))}if(f===0)return f}return f}(t,this.geometries);if(t.geometryType()==="LineString")return function(r,a){let l=r.geometry(),h=l.flat().map(g=>oo([g.x,g.y],r.canonical));if(l.length===0)return NaN;let d=new uo(h[0][1]),f=1/0;for(let g of a){switch(g.type){case"Point":f=Math.min(f,Sa(h,!0,[g.coordinates],!1,d,f));break;case"LineString":f=Math.min(f,Sa(h,!0,g.coordinates,!0,d,f));break;case"Polygon":f=Math.min(f,Da(h,!0,g.coordinates,d,f))}if(f===0)return f}return f}(t,this.geometries);if(t.geometryType()==="Polygon")return function(r,a){let l=r.geometry();if(l.length===0||l[0].length===0)return NaN;let h=ns(l,0).map(g=>g.map(v=>v.map(x=>oo([x.x,x.y],r.canonical)))),d=new uo(h[0][0][0][1]),f=1/0;for(let g of a)for(let v of h){switch(g.type){case"Point":f=Math.min(f,Da([g.coordinates],!1,v,d,f));break;case"LineString":f=Math.min(f,Da(g.coordinates,!0,v,d,f));break;case"Polygon":f=Math.min(f,Yt(v,g.coordinates,d,f))}if(f===0)return f}return f}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}let Gn={"==":Fu,"!=":wl,">":Ou,"<":Al,">=":El,"<=":Nu,array:Br,at:to,boolean:Br,case:Ka,coalesce:es,collator:Ta,format:is,image:ao,in:io,"index-of":Un,interpolate:Qi,"interpolate-hcl":Qi,"interpolate-lab":Qi,length:so,let:ln,literal:zr,match:ro,number:Br,"number-format":no,object:Br,slice:Aa,step:jn,string:Br,"to-boolean":Lr,"to-color":Lr,"to-number":Lr,"to-string":Lr,var:Nt,within:An,distance:Cn};class xr{constructor(t,r,a,l){this.name=t,this.type=r,this._evaluate=a,this.args=l}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,r){let a=t[0],l=xr.definitions[a];if(!l)return r.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0);let h=Array.isArray(l)?l[0]:l.type,d=Array.isArray(l)?[[l[1],l[2]]]:l.overloads,f=d.filter(([v])=>!Array.isArray(v)||v.length===t.length-1),g=null;for(let[v,x]of f){g=new xn(r.registry,Ia,r.path,null,r.scope);let A=[],D=!1;for(let M=1;M{return D=A,Array.isArray(D)?`(${D.map(I).join(", ")})`:`(${I(D.type)}...)`;var D}).join(" | "),x=[];for(let A=1;A{r=t?r&&Ia(a):r&&a instanceof zr}),!!r&&ka(i)&&Ma(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function ka(i){if(i instanceof xr&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||/^filter-/.test(i.name))||i instanceof An||i instanceof Cn)return!1;let t=!0;return i.eachChild(r=>{t&&!ka(r)&&(t=!1)}),t}function Hn(i){if(i instanceof xr&&i.name==="feature-state")return!1;let t=!0;return i.eachChild(r=>{t&&!Hn(r)&&(t=!1)}),t}function Ma(i,t){if(i instanceof xr&&t.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(a=>{r&&!Ma(a,t)&&(r=!1)}),r}function ls(i){return{result:"success",value:i}}function Xn(i){return{result:"error",value:i}}function Wn(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function Fl(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function xo(i){return!!i.expression&&i.expression.interpolated}function Ft(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function us(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Ju(i){return i}function Ol(i,t){let r=t.type==="color",a=i.stops&&typeof i.stops[0][0]=="object",l=a||!(a||i.property!==void 0),h=i.type||(xo(t)?"exponential":"interval");if(r||t.type==="padding"){let x=r?Zt.parse:cr.parse;(i=or({},i)).stops&&(i.stops=i.stops.map(A=>[A[0],x(A[1])])),i.default=x(i.default?i.default:t.default)}if(i.colorSpace&&(d=i.colorSpace)!=="rgb"&&d!=="hcl"&&d!=="lab")throw new Error(`Unknown color space: "${i.colorSpace}"`);var d;let f,g,v;if(h==="exponential")f=ql;else if(h==="interval")f=cs;else if(h==="categorical"){f=Nl,g=Object.create(null);for(let x of i.stops)g[x[0]]=x[1];v=typeof i.stops[0][0]}else{if(h!=="identity")throw new Error(`Unknown function type "${h}"`);f=Vl}if(a){let x={},A=[];for(let z=0;zz[0]),evaluate:({zoom:z},B)=>ql({stops:D,base:i.base},t,z).evaluate(z,B)}}if(l){let x=h==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:x,interpolationFactor:Qi.interpolationFactor.bind(void 0,x),zoomStops:i.stops.map(A=>A[0]),evaluate:({zoom:A})=>f(i,t,A,g,v)}}return{kind:"source",evaluate(x,A){let D=A&&A.properties?A.properties[i.property]:void 0;return D===void 0?Jn(i.default,t.default):f(i,t,D,g,v)}}}function Jn(i,t,r){return i!==void 0?i:t!==void 0?t:r!==void 0?r:void 0}function Nl(i,t,r,a,l){return Jn(typeof r===l?a[r]:void 0,i.default,t.default)}function cs(i,t,r){if(Ft(r)!=="number")return Jn(i.default,t.default);let a=i.stops.length;if(a===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[a-1][0])return i.stops[a-1][1];let l=Ya(i.stops.map(h=>h[0]),r);return i.stops[l][1]}function ql(i,t,r){let a=i.base!==void 0?i.base:1;if(Ft(r)!=="number")return Jn(i.default,t.default);let l=i.stops.length;if(l===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[l-1][0])return i.stops[l-1][1];let h=Ya(i.stops.map(x=>x[0]),r),d=function(x,A,D,M){let z=M-D,B=x-D;return z===0?0:A===1?B/z:(Math.pow(A,B)-1)/(Math.pow(A,z)-1)}(r,a,i.stops[h][0],i.stops[h+1][0]),f=i.stops[h][1],g=i.stops[h+1][1],v=Yi[t.type]||Ju;return typeof f.evaluate=="function"?{evaluate(...x){let A=f.evaluate.apply(void 0,x),D=g.evaluate.apply(void 0,x);if(A!==void 0&&D!==void 0)return v(A,D,d,i.colorSpace)}}:v(f,g,d,i.colorSpace)}function Vl(i,t,r){switch(t.type){case"color":r=Zt.parse(r);break;case"formatted":r=ur.fromString(r.toString());break;case"resolvedImage":r=hr.fromString(r.toString());break;case"padding":r=cr.parse(r);break;default:Ft(r)===t.type||t.type==="enum"&&t.values[r]||(r=void 0)}return Jn(r,i.default,t.default)}xr.register(Gn,{error:[{kind:"error"},[mt],(i,[t])=>{throw new gi(t.evaluate(i))}],typeof:[mt,[st],(i,[t])=>I(vi(t.evaluate(i)))],"to-rgba":[k(Ee,4),[Si],(i,[t])=>{let[r,a,l,h]=t.evaluate(i).rgb;return[255*r,255*a,255*l,h]}],rgb:[Si,[Ee,Ee,Ee],_o],rgba:[Si,[Ee,Ee,Ee,Ee],_o],has:{type:nt,overloads:[[[mt],(i,[t])=>yo(t.evaluate(i),i.properties())],[[mt,Ji],(i,[t,r])=>yo(t.evaluate(i),r.evaluate(i))]]},get:{type:st,overloads:[[[mt],(i,[t])=>vo(t.evaluate(i),i.properties())],[[mt,Ji],(i,[t,r])=>vo(t.evaluate(i),r.evaluate(i))]]},"feature-state":[st,[mt],(i,[t])=>vo(t.evaluate(i),i.featureState||{})],properties:[Ji,[],i=>i.properties()],"geometry-type":[mt,[],i=>i.geometryType()],id:[st,[],i=>i.id()],zoom:[Ee,[],i=>i.globals.zoom],"heatmap-density":[Ee,[],i=>i.globals.heatmapDensity||0],"line-progress":[Ee,[],i=>i.globals.lineProgress||0],accumulated:[st,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Ee,Dn(Ee),(i,t)=>{let r=0;for(let a of t)r+=a.evaluate(i);return r}],"*":[Ee,Dn(Ee),(i,t)=>{let r=1;for(let a of t)r*=a.evaluate(i);return r}],"-":{type:Ee,overloads:[[[Ee,Ee],(i,[t,r])=>t.evaluate(i)-r.evaluate(i)],[[Ee],(i,[t])=>-t.evaluate(i)]]},"/":[Ee,[Ee,Ee],(i,[t,r])=>t.evaluate(i)/r.evaluate(i)],"%":[Ee,[Ee,Ee],(i,[t,r])=>t.evaluate(i)%r.evaluate(i)],ln2:[Ee,[],()=>Math.LN2],pi:[Ee,[],()=>Math.PI],e:[Ee,[],()=>Math.E],"^":[Ee,[Ee,Ee],(i,[t,r])=>Math.pow(t.evaluate(i),r.evaluate(i))],sqrt:[Ee,[Ee],(i,[t])=>Math.sqrt(t.evaluate(i))],log10:[Ee,[Ee],(i,[t])=>Math.log(t.evaluate(i))/Math.LN10],ln:[Ee,[Ee],(i,[t])=>Math.log(t.evaluate(i))],log2:[Ee,[Ee],(i,[t])=>Math.log(t.evaluate(i))/Math.LN2],sin:[Ee,[Ee],(i,[t])=>Math.sin(t.evaluate(i))],cos:[Ee,[Ee],(i,[t])=>Math.cos(t.evaluate(i))],tan:[Ee,[Ee],(i,[t])=>Math.tan(t.evaluate(i))],asin:[Ee,[Ee],(i,[t])=>Math.asin(t.evaluate(i))],acos:[Ee,[Ee],(i,[t])=>Math.acos(t.evaluate(i))],atan:[Ee,[Ee],(i,[t])=>Math.atan(t.evaluate(i))],min:[Ee,Dn(Ee),(i,t)=>Math.min(...t.map(r=>r.evaluate(i)))],max:[Ee,Dn(Ee),(i,t)=>Math.max(...t.map(r=>r.evaluate(i)))],abs:[Ee,[Ee],(i,[t])=>Math.abs(t.evaluate(i))],round:[Ee,[Ee],(i,[t])=>{let r=t.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[Ee,[Ee],(i,[t])=>Math.floor(t.evaluate(i))],ceil:[Ee,[Ee],(i,[t])=>Math.ceil(t.evaluate(i))],"filter-==":[nt,[mt,st],(i,[t,r])=>i.properties()[t.value]===r.value],"filter-id-==":[nt,[st],(i,[t])=>i.id()===t.value],"filter-type-==":[nt,[mt],(i,[t])=>i.geometryType()===t.value],"filter-<":[nt,[mt,st],(i,[t,r])=>{let a=i.properties()[t.value],l=r.value;return typeof a==typeof l&&a{let r=i.id(),a=t.value;return typeof r==typeof a&&r":[nt,[mt,st],(i,[t,r])=>{let a=i.properties()[t.value],l=r.value;return typeof a==typeof l&&a>l}],"filter-id->":[nt,[st],(i,[t])=>{let r=i.id(),a=t.value;return typeof r==typeof a&&r>a}],"filter-<=":[nt,[mt,st],(i,[t,r])=>{let a=i.properties()[t.value],l=r.value;return typeof a==typeof l&&a<=l}],"filter-id-<=":[nt,[st],(i,[t])=>{let r=i.id(),a=t.value;return typeof r==typeof a&&r<=a}],"filter->=":[nt,[mt,st],(i,[t,r])=>{let a=i.properties()[t.value],l=r.value;return typeof a==typeof l&&a>=l}],"filter-id->=":[nt,[st],(i,[t])=>{let r=i.id(),a=t.value;return typeof r==typeof a&&r>=a}],"filter-has":[nt,[st],(i,[t])=>t.value in i.properties()],"filter-has-id":[nt,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[nt,[k(mt)],(i,[t])=>t.value.indexOf(i.geometryType())>=0],"filter-id-in":[nt,[k(st)],(i,[t])=>t.value.indexOf(i.id())>=0],"filter-in-small":[nt,[mt,k(st)],(i,[t,r])=>r.value.indexOf(i.properties()[t.value])>=0],"filter-in-large":[nt,[mt,k(st)],(i,[t,r])=>function(a,l,h,d){for(;h<=d;){let f=h+d>>1;if(l[f]===a)return!0;l[f]>a?d=f-1:h=f+1}return!1}(i.properties()[t.value],r.value,0,r.value.length-1)],all:{type:nt,overloads:[[[nt,nt],(i,[t,r])=>t.evaluate(i)&&r.evaluate(i)],[Dn(nt),(i,t)=>{for(let r of t)if(!r.evaluate(i))return!1;return!0}]]},any:{type:nt,overloads:[[[nt,nt],(i,[t,r])=>t.evaluate(i)||r.evaluate(i)],[Dn(nt),(i,t)=>{for(let r of t)if(r.evaluate(i))return!0;return!1}]]},"!":[nt,[nt],(i,[t])=>!t.evaluate(i)],"is-supported-script":[nt,[mt],(i,[t])=>{let r=i.globals&&i.globals.isSupportedScript;return!r||r(t.evaluate(i))}],upcase:[mt,[mt],(i,[t])=>t.evaluate(i).toUpperCase()],downcase:[mt,[mt],(i,[t])=>t.evaluate(i).toLowerCase()],concat:[mt,Dn(st),(i,t)=>t.map(r=>wa(r.evaluate(i))).join("")],"resolved-locale":[mt,[Ki],(i,[t])=>t.evaluate(i).resolvedLocale()]});class hs{constructor(t,r){var a;this.expression=t,this._warningHistory={},this._evaluator=new Ja,this._defaultValue=r?(a=r).type==="color"&&us(a.default)?new Zt(0,0,0,0):a.type==="color"?Zt.parse(a.default)||null:a.type==="padding"?cr.parse(a.default)||null:a.type==="variableAnchorOffsetCollection"?vr.parse(a.default)||null:a.default===void 0?null:a.default:null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(t,r,a,l,h,d){return this._evaluator.globals=t,this._evaluator.feature=r,this._evaluator.featureState=a,this._evaluator.canonical=l,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=d,this.expression.evaluate(this._evaluator)}evaluate(t,r,a,l,h,d){this._evaluator.globals=t,this._evaluator.feature=r||null,this._evaluator.featureState=a||null,this._evaluator.canonical=l,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=d||null;try{let f=this.expression.evaluate(this._evaluator);if(f==null||typeof f=="number"&&f!=f)return this._defaultValue;if(this._enumValues&&!(f in this._enumValues))throw new gi(`Expected value to be one of ${Object.keys(this._enumValues).map(g=>JSON.stringify(g)).join(", ")}, but found ${JSON.stringify(f)} instead.`);return f}catch(f){return this._warningHistory[f.message]||(this._warningHistory[f.message]=!0,typeof console<"u"&&console.warn(f.message)),this._defaultValue}}}function ps(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in Gn}function Kn(i,t){let r=new xn(Gn,Ia,[],t?function(l){let h={color:Si,string:mt,number:Ee,enum:mt,boolean:nt,formatted:yr,padding:on,resolvedImage:Zr,variableAnchorOffsetCollection:j};return l.type==="array"?k(h[l.value]||st,l.length):h[l.type]}(t):void 0),a=r.parse(i,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return a?ls(new hs(a,t)):Xn(r.errors)}class Yn{constructor(t,r){this.kind=t,this._styleExpression=r,this.isStateDependent=t!=="constant"&&!Hn(r.expression)}evaluateWithoutErrorHandling(t,r,a,l,h,d){return this._styleExpression.evaluateWithoutErrorHandling(t,r,a,l,h,d)}evaluate(t,r,a,l,h,d){return this._styleExpression.evaluate(t,r,a,l,h,d)}}class Qn{constructor(t,r,a,l){this.kind=t,this.zoomStops=a,this._styleExpression=r,this.isStateDependent=t!=="camera"&&!Hn(r.expression),this.interpolationType=l}evaluateWithoutErrorHandling(t,r,a,l,h,d){return this._styleExpression.evaluateWithoutErrorHandling(t,r,a,l,h,d)}evaluate(t,r,a,l,h,d){return this._styleExpression.evaluate(t,r,a,l,h,d)}interpolationFactor(t,r,a){return this.interpolationType?Qi.interpolationFactor(this.interpolationType,t,r,a):0}}function bo(i,t){let r=Kn(i,t);if(r.result==="error")return r;let a=r.value.expression,l=ka(a);if(!l&&!Wn(t))return Xn([new Ai("","data expressions not supported")]);let h=Ma(a,["zoom"]);if(!h&&!Fl(t))return Xn([new Ai("","zoom expressions not supported")]);let d=Pa(a);return d||h?d instanceof Ai?Xn([d]):d instanceof Qi&&!xo(t)?Xn([new Ai("",'"interpolate" expressions cannot be used with this property')]):ls(d?new Qn(l?"camera":"composite",r.value,d.labels,d instanceof Qi?d.interpolation:void 0):new Yn(l?"constant":"source",r.value)):Xn([new Ai("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class ea{constructor(t,r){this._parameters=t,this._specification=r,or(this,Ol(this._parameters,this._specification))}static deserialize(t){return new ea(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Pa(i){let t=null;if(i instanceof ln)t=Pa(i.result);else if(i instanceof es){for(let r of i.args)if(t=Pa(r),t)break}else(i instanceof jn||i instanceof Qi)&&i.input instanceof xr&&i.input.name==="zoom"&&(t=i);return t instanceof Ai||i.eachChild(r=>{let a=Pa(r);a instanceof Ai?t=a:!t&&a?t=new Ai("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&a&&t!==a&&(t=new Ai("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function ds(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(let t of i.slice(1))if(!ds(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}let fs={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function wo(i){if(i==null)return{filter:()=>!0,needGeometry:!1};ds(i)||(i=ms(i));let t=Kn(i,fs);if(t.result==="error")throw new Error(t.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,a,l)=>t.value.evaluate(r,a,{},l),needGeometry:Ul(i)}}function Ku(i,t){return it?1:0}function Ul(i){if(!Array.isArray(i))return!1;if(i[0]==="within"||i[0]==="distance")return!0;for(let t=1;t"||t==="<="||t===">="?Ao(i[1],i[2],t):t==="any"?(r=i.slice(1),["any"].concat(r.map(ms))):t==="all"?["all"].concat(i.slice(1).map(ms)):t==="none"?["all"].concat(i.slice(1).map(ms).map(Pi)):t==="in"?za(i[1],i.slice(2)):t==="!in"?Pi(za(i[1],i.slice(2))):t==="has"?Ba(i[1]):t!=="!has"||Pi(Ba(i[1]));var r}function Ao(i,t,r){switch(i){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,i,t]}}function za(i,t){if(t.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(r=>typeof r!=typeof t[0])?["filter-in-large",i,["literal",t.sort(Ku)]]:["filter-in-small",i,["literal",t]]}}function Ba(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Pi(i){return["!",i]}function Sn(i){let t=typeof i;if(t==="number"||t==="boolean"||t==="string"||i==null)return JSON.stringify(i);if(Array.isArray(i)){let l="[";for(let h of i)l+=`${Sn(h)},`;return`${l}]`}let r=Object.keys(i).sort(),a="{";for(let l=0;la.maximum?[new we(t,r,`${r} is greater than the maximum value ${a.maximum}`)]:[]}function gs(i){let t=i.valueSpec,r=fi(i.value.type),a,l,h,d={},f=r!=="categorical"&&i.value.property===void 0,g=!f,v=Ft(i.value.stops)==="array"&&Ft(i.value.stops[0])==="array"&&Ft(i.value.stops[0][0])==="object",x=pr({key:i.key,value:i.value,valueSpec:i.styleSpec.function,validateSpec:i.validateSpec,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(M){if(r==="identity")return[new we(M.key,M.value,'identity function may not have a "stops" property')];let z=[],B=M.value;return z=z.concat(La({key:M.key,value:B,valueSpec:M.valueSpec,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec,arrayElementValidator:A})),Ft(B)==="array"&&B.length===0&&z.push(new we(M.key,B,"array must have at least one stop")),z},default:function(M){return M.validateSpec({key:M.key,value:M.value,valueSpec:t,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec})}}});return r==="identity"&&f&&x.push(new we(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||x.push(new we(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!xo(i.valueSpec)&&x.push(new we(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(g&&!Wn(i.valueSpec)?x.push(new we(i.key,i.value,"property functions not supported")):f&&!Fl(i.valueSpec)&&x.push(new we(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!v||i.value.property!==void 0||x.push(new we(i.key,i.value,'"property" property is required')),x;function A(M){let z=[],B=M.value,q=M.key;if(Ft(B)!=="array")return[new we(q,B,`array expected, ${Ft(B)} found`)];if(B.length!==2)return[new we(q,B,`array length 2 expected, length ${B.length} found`)];if(v){if(Ft(B[0])!=="object")return[new we(q,B,`object expected, ${Ft(B[0])} found`)];if(B[0].zoom===void 0)return[new we(q,B,"object stop key must have zoom")];if(B[0].value===void 0)return[new we(q,B,"object stop key must have value")];if(h&&h>fi(B[0].zoom))return[new we(q,B[0].zoom,"stop zoom values must appear in ascending order")];fi(B[0].zoom)!==h&&(h=fi(B[0].zoom),l=void 0,d={}),z=z.concat(pr({key:`${q}[0]`,value:B[0],valueSpec:{zoom:{}},validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec,objectElementValidators:{zoom:Eo,value:D}}))}else z=z.concat(D({key:`${q}[0]`,value:B[0],valueSpec:{},validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec},B));return ps(Rr(B[1]))?z.concat([new we(`${q}[1]`,B[1],"expressions are not allowed in function stops.")]):z.concat(M.validateSpec({key:`${q}[1]`,value:B[1],valueSpec:t,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec}))}function D(M,z){let B=Ft(M.value),q=fi(M.value),$=M.value!==null?M.value:z;if(a){if(B!==a)return[new we(M.key,$,`${B} stop domain type must match previous stop domain type ${a}`)]}else a=B;if(B!=="number"&&B!=="string"&&B!=="boolean")return[new we(M.key,$,"stop domain value must be a number, string, or boolean")];if(B!=="number"&&r!=="categorical"){let ne=`number expected, ${B} found`;return Wn(t)&&r===void 0&&(ne+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new we(M.key,$,ne)]}return r!=="categorical"||B!=="number"||isFinite(q)&&Math.floor(q)===q?r!=="categorical"&&B==="number"&&l!==void 0&&qnew we(`${i.key}${a.key}`,i.value,a.message));let r=t.value.expression||t.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new we(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!Hn(r))return[new we(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!Hn(r))return[new we(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!Ma(r,["zoom","feature-state"]))return[new we(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!ka(r))return[new we(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function tn(i){let t=i.key,r=i.value,a=i.valueSpec,l=[];return Array.isArray(a.values)?a.values.indexOf(fi(r))===-1&&l.push(new we(t,r,`expected one of [${a.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(a.values).indexOf(fi(r))===-1&&l.push(new we(t,r,`expected one of [${Object.keys(a.values).join(", ")}], ${JSON.stringify(r)} found`)),l}function To(i){return ds(Rr(i.value))?ta(or({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):_s(i)}function _s(i){let t=i.value,r=i.key;if(Ft(t)!=="array")return[new we(r,t,`array expected, ${Ft(t)} found`)];let a=i.styleSpec,l,h=[];if(t.length<1)return[new we(r,t,"filter array must have at least 1 element")];switch(h=h.concat(tn({key:`${r}[0]`,value:t[0],valueSpec:a.filter_operator,style:i.style,styleSpec:i.styleSpec})),fi(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&fi(t[1])==="$type"&&h.push(new we(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&h.push(new we(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(l=Ft(t[1]),l!=="string"&&h.push(new we(`${r}[1]`,t[1],`string expected, ${l} found`)));for(let d=2;d{v in r&&t.push(new we(a,r[v],`"${v}" is prohibited for ref layers`))}),l.layers.forEach(v=>{fi(v.id)===f&&(g=v)}),g?g.ref?t.push(new we(a,r.ref,"ref cannot reference another ref layer")):d=fi(g.type):t.push(new we(a,r.ref,`ref layer "${f}" not found`))}else if(d!=="background")if(r.source){let g=l.sources&&l.sources[r.source],v=g&&fi(g.type);g?v==="vector"&&d==="raster"?t.push(new we(a,r.source,`layer "${r.id}" requires a raster source`)):v!=="raster-dem"&&d==="hillshade"?t.push(new we(a,r.source,`layer "${r.id}" requires a raster-dem source`)):v==="raster"&&d!=="raster"?t.push(new we(a,r.source,`layer "${r.id}" requires a vector source`)):v!=="vector"||r["source-layer"]?v==="raster-dem"&&d!=="hillshade"?t.push(new we(a,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):d!=="line"||!r.paint||!r.paint["line-gradient"]||v==="geojson"&&g.lineMetrics||t.push(new we(a,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new we(a,r,`layer "${r.id}" must specify a "source-layer"`)):t.push(new we(a,r.source,`source "${r.source}" not found`))}else t.push(new we(a,r,'missing required property "source"'));return t=t.concat(pr({key:a,value:r,valueSpec:h.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${a}.type`,value:r.type,valueSpec:h.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:r,objectKey:"type"}),filter:To,layout:g=>pr({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":v=>Do(or({layerType:d},v))}}),paint:g=>pr({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":v=>ys(or({layerType:d},v))}})}})),t}function In(i){let t=i.value,r=i.key,a=Ft(t);return a!=="string"?[new we(r,t,`string expected, ${a} found`)]:[]}let vs={promoteId:function({key:i,value:t}){if(Ft(t)==="string")return In({key:i,value:t});{let r=[];for(let a in t)r.push(...In({key:`${i}.${a}`,value:t[a]}));return r}}};function Ra(i){let t=i.value,r=i.key,a=i.styleSpec,l=i.style,h=i.validateSpec;if(!t.type)return[new we(r,t,'"type" is required')];let d=fi(t.type),f;switch(d){case"vector":case"raster":return f=pr({key:r,value:t,valueSpec:a[`source_${d.replace("-","_")}`],style:i.style,styleSpec:a,objectElementValidators:vs,validateSpec:h}),f;case"raster-dem":return f=function(g){var v;let x=(v=g.sourceName)!==null&&v!==void 0?v:"",A=g.value,D=g.styleSpec,M=D.source_raster_dem,z=g.style,B=[],q=Ft(A);if(A===void 0)return B;if(q!=="object")return B.push(new we("source_raster_dem",A,`object expected, ${q} found`)),B;let $=fi(A.encoding)==="custom",ne=["redFactor","greenFactor","blueFactor","baseShift"],K=g.value.encoding?`"${g.value.encoding}"`:"Default";for(let ie in A)!$&&ne.includes(ie)?B.push(new we(ie,A[ie],`In "${x}": "${ie}" is only valid when "encoding" is set to "custom". ${K} encoding found`)):M[ie]?B=B.concat(g.validateSpec({key:ie,value:A[ie],valueSpec:M[ie],validateSpec:g.validateSpec,style:z,styleSpec:D})):B.push(new we(ie,A[ie],`unknown property "${ie}"`));return B}({sourceName:r,value:t,style:i.style,styleSpec:a,validateSpec:h}),f;case"geojson":if(f=pr({key:r,value:t,valueSpec:a.source_geojson,style:l,styleSpec:a,validateSpec:h,objectElementValidators:vs}),t.cluster)for(let g in t.clusterProperties){let[v,x]=t.clusterProperties[g],A=typeof v=="string"?[v,["accumulated"],["get",g]]:v;f.push(...ta({key:`${r}.${g}.map`,value:x,validateSpec:h,expressionContext:"cluster-map"})),f.push(...ta({key:`${r}.${g}.reduce`,value:A,validateSpec:h,expressionContext:"cluster-reduce"}))}return f;case"video":return pr({key:r,value:t,valueSpec:a.source_video,style:l,validateSpec:h,styleSpec:a});case"image":return pr({key:r,value:t,valueSpec:a.source_image,style:l,validateSpec:h,styleSpec:a});case"canvas":return[new we(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return tn({key:`${r}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:l,validateSpec:h,styleSpec:a})}}function Io(i){let t=i.value,r=i.styleSpec,a=r.light,l=i.style,h=[],d=Ft(t);if(t===void 0)return h;if(d!=="object")return h=h.concat([new we("light",t,`object expected, ${d} found`)]),h;for(let f in t){let g=f.match(/^(.*)-transition$/);h=h.concat(g&&a[g[1]]&&a[g[1]].transition?i.validateSpec({key:f,value:t[f],valueSpec:r.transition,validateSpec:i.validateSpec,style:l,styleSpec:r}):a[f]?i.validateSpec({key:f,value:t[f],valueSpec:a[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new we(f,t[f],`unknown property "${f}"`)])}return h}function ko(i){let t=i.value,r=i.styleSpec,a=r.sky,l=i.style,h=Ft(t);if(t===void 0)return[];if(h!=="object")return[new we("sky",t,`object expected, ${h} found`)];let d=[];for(let f in t)d=d.concat(a[f]?i.validateSpec({key:f,value:t[f],valueSpec:a[f],style:l,styleSpec:r}):[new we(f,t[f],`unknown property "${f}"`)]);return d}function Mo(i){let t=i.value,r=i.styleSpec,a=r.terrain,l=i.style,h=[],d=Ft(t);if(t===void 0)return h;if(d!=="object")return h=h.concat([new we("terrain",t,`object expected, ${d} found`)]),h;for(let f in t)h=h.concat(a[f]?i.validateSpec({key:f,value:t[f],valueSpec:a[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new we(f,t[f],`unknown property "${f}"`)]);return h}function Po(i){let t=[],r=i.value,a=i.key;if(Array.isArray(r)){let l=[],h=[];for(let d in r)r[d].id&&l.includes(r[d].id)&&t.push(new we(a,r,`all the sprites' ids must be unique, but ${r[d].id} is duplicated`)),l.push(r[d].id),r[d].url&&h.includes(r[d].url)&&t.push(new we(a,r,`all the sprites' URLs must be unique, but ${r[d].url} is duplicated`)),h.push(r[d].url),t=t.concat(pr({key:`${a}[${d}]`,value:r[d],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return t}return In({key:a,value:r})}let xs={"*":()=>[],array:La,boolean:function(i){let t=i.value,r=i.key,a=Ft(t);return a!=="boolean"?[new we(r,t,`boolean expected, ${a} found`)]:[]},number:Eo,color:function(i){let t=i.key,r=i.value,a=Ft(r);return a!=="string"?[new we(t,r,`color expected, ${a} found`)]:Zt.parse(String(r))?[]:[new we(t,r,`color expected, "${r}" found`)]},constants:$l,enum:tn,filter:To,function:gs,layer:So,object:pr,source:Ra,light:Io,sky:ko,terrain:Mo,projection:function(i){let t=i.value,r=i.styleSpec,a=r.projection,l=i.style,h=Ft(t);if(t===void 0)return[];if(h!=="object")return[new we("projection",t,`object expected, ${h} found`)];let d=[];for(let f in t)d=d.concat(a[f]?i.validateSpec({key:f,value:t[f],valueSpec:a[f],style:l,styleSpec:r}):[new we(f,t[f],`unknown property "${f}"`)]);return d},string:In,formatted:function(i){return In(i).length===0?[]:ta(i)},resolvedImage:function(i){return In(i).length===0?[]:ta(i)},padding:function(i){let t=i.key,r=i.value;if(Ft(r)==="array"){if(r.length<1||r.length>4)return[new we(t,r,`padding requires 1 to 4 values; ${r.length} values found`)];let a={type:"number"},l=[];for(let h=0;h[]}})),i.constants&&(r=r.concat($l({key:"constants",value:i.constants,style:i,styleSpec:t,validateSpec:ia}))),zo(r)}function Hr(i){return function(t){return i({...t,validateSpec:ia})}}function zo(i){return[].concat(i).sort((t,r)=>t.line-r.line)}function Fr(i){return function(...t){return zo(i.apply(this,t))}}br.source=Fr(Hr(Ra)),br.sprite=Fr(Hr(Po)),br.glyphs=Fr(Hr(Zl)),br.light=Fr(Hr(Io)),br.sky=Fr(Hr(ko)),br.terrain=Fr(Hr(Mo)),br.layer=Fr(Hr(So)),br.filter=Fr(Hr(To)),br.paintProperty=Fr(Hr(ys)),br.layoutProperty=Fr(Hr(Do));let kn=br,Yu=kn.light,Qu=kn.sky,Gl=kn.paintProperty,Hl=kn.layoutProperty;function Bo(i,t){let r=!1;if(t&&t.length)for(let a of t)i.fire(new bi(new Error(a.message))),r=!0;return r}class ra{constructor(t,r,a){let l=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;let d=new Int32Array(this.arrayBuffer);t=d[0],this.d=(r=d[1])+2*(a=d[2]);for(let g=0;g=A[z+0]&&l>=A[z+1])?(f[M]=!0,d.push(x[M])):f[M]=!1}}}}_forEachCell(t,r,a,l,h,d,f,g){let v=this._convertToCellCoord(t),x=this._convertToCellCoord(r),A=this._convertToCellCoord(a),D=this._convertToCellCoord(l);for(let M=v;M<=A;M++)for(let z=x;z<=D;z++){let B=this.d*z+M;if((!g||g(this._convertFromCellCoord(M),this._convertFromCellCoord(z),this._convertFromCellCoord(M+1),this._convertFromCellCoord(z+1)))&&h.call(this,t,r,a,l,B,d,f,g))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let t=this.cells,r=3+this.cells.length+1+1,a=0;for(let d=0;d=0)continue;let d=i[h];l[h]=wr[r].shallow.indexOf(h)>=0?d:na(d,t)}i instanceof Error&&(l.message=i.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(l.$name=r),l}function aa(i){if(Xl(i))return i;if(Array.isArray(i))return i.map(aa);if(typeof i!="object")throw new Error("can't deserialize object of type "+typeof i);let t=Lo(i)||"Object";if(!wr[t])throw new Error(`can't deserialize unregistered class ${t}`);let{klass:r}=wr[t];if(!r)throw new Error(`can't deserialize unregistered class ${t}`);if(r.deserialize)return r.deserialize(i);let a=Object.create(r.prototype);for(let l of Object.keys(i)){if(l==="$name")continue;let h=i[l];a[l]=wr[t].shallow.indexOf(l)>=0?h:aa(h)}return a}class Ro{constructor(){this.first=!0}update(t,r){let a=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=a,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=a,!0):(this.lastFloorZoom>a?(this.lastIntegerZoom=a+1,this.lastIntegerZoomTime=r):this.lastFloorZoomi>=128&&i<=255,"Hangul Jamo":i=>i>=4352&&i<=4607,Khmer:i=>i>=6016&&i<=6143,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Katakana:i=>i>=12448&&i<=12543,Kanbun:i=>i>=12688&&i<=12703,"CJK Strokes":i=>i>=12736&&i<=12783,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"Private Use Area":i=>i>=57344&&i<=63743,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function Fo(i){for(let t of i)if(No(t.charCodeAt(0)))return!0;return!1}function ec(i){for(let t of i)if(!sa(t.charCodeAt(0)))return!1;return!0}function Oo(i){let t=i.map(r=>{try{return new RegExp(`\\p{sc=${r}}`,"u").source}catch{return null}}).filter(r=>r);return new RegExp(t.join("|"),"u")}let tc=Oo(["Arab","Dupl","Mong","Ougr","Syrc"]);function sa(i){return!tc.test(String.fromCodePoint(i))}let Wl=Oo(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function No(i){return!(i!==746&&i!==747&&(i<4352||!(It["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||It["CJK Compatibility"](i)||It["CJK Strokes"](i)||!(!It["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||It["Enclosed CJK Letters and Months"](i)||It["Ideographic Description Characters"](i)||It.Kanbun(i)||It.Katakana(i)&&i!==12540||!(!It["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!It["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||It["Vertical Forms"](i)||It["Yijing Hexagram Symbols"](i)||/\p{sc=Cans}/u.test(String.fromCodePoint(i))||/\p{sc=Hang}/u.test(String.fromCodePoint(i))||Wl.test(String.fromCodePoint(i)))))}function Jl(i){return!(No(i)||function(t){return!!(It["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||It["General Punctuation"](t)&&(t===8214||t===8224||t===8225||t===8240||t===8241||t===8251||t===8252||t===8258||t===8263||t===8264||t===8265||t===8273)||It["Letterlike Symbols"](t)||It["Number Forms"](t)||It["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||t===9003||t>=9085&&t<=9114||t>=9150&&t<=9165||t===9167||t>=9169&&t<=9179||t>=9186&&t<=9215)||It["Control Pictures"](t)&&t!==9251||It["Optical Character Recognition"](t)||It["Enclosed Alphanumerics"](t)||It["Geometric Shapes"](t)||It["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||It["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||It["CJK Symbols and Punctuation"](t)||It.Katakana(t)||It["Private Use Area"](t)||It["CJK Compatibility Forms"](t)||It["Small Form Variants"](t)||It["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}(i))}let ic=Oo(["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 qo(i){return ic.test(String.fromCodePoint(i))}function rc(i,t){return!(!t&&qo(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||It.Khmer(i))}function nc(i){for(let t of i)if(qo(t.charCodeAt(0)))return!0;return!1}let dr=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(i){this.pluginStatus=i.pluginStatus,this.pluginURL=i.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(i){this.applyArabicShaping=i.applyArabicShaping,this.processBidirectionalText=i.processBidirectionalText,this.processStyledBidirectionalText=i.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class ti{constructor(t,r){this.zoom=t,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Ro,this.transition={})}isSupportedScript(t){return function(r,a){for(let l of r)if(!rc(l.charCodeAt(0),a))return!1;return!0}(t,dr.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let t=this.zoom,r=t-Math.floor(t),a=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*a}:{fromScale:.5,toScale:1,t:1-(1-a)*r}}}class oa{constructor(t,r){this.property=t,this.value=r,this.expression=function(a,l){if(us(a))return new ea(a,l);if(ps(a)){let h=bo(a,l);if(h.result==="error")throw new Error(h.value.map(d=>`${d.key}: ${d.message}`).join(", "));return h.value}{let h=a;return l.type==="color"&&typeof a=="string"?h=Zt.parse(a):l.type!=="padding"||typeof a!="number"&&!Array.isArray(a)?l.type==="variableAnchorOffsetCollection"&&Array.isArray(a)&&(h=vr.parse(a)):h=cr.parse(a),{kind:"constant",evaluate:()=>h}}}(r===void 0?t.specification.default:r,t.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(t,r,a){return this.property.possiblyEvaluate(this,t,r,a)}}class ws{constructor(t){this.property=t,this.value=new oa(t,void 0)}transitioned(t,r){return new Kl(this.property,this.value,r,Ye({},t.transition,this.transition),t.now)}untransitioned(){return new Kl(this.property,this.value,null,{},0)}}class As{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return ye(this._values[t].value.value)}setValue(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new ws(this._values[t].property)),this._values[t].value=new oa(this._values[t].property,r===null?void 0:ye(r))}getTransition(t){return ye(this._values[t].transition)}setTransition(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new ws(this._values[t].property)),this._values[t].transition=ye(r)||void 0}serialize(){let t={};for(let r of Object.keys(this._values)){let a=this.getValue(r);a!==void 0&&(t[r]=a);let l=this.getTransition(r);l!==void 0&&(t[`${r}-transition`]=l)}return t}transitioned(t,r){let a=new Fa(this._properties);for(let l of Object.keys(this._values))a._values[l]=this._values[l].transitioned(t,r._values[l]);return a}untransitioned(){let t=new Fa(this._properties);for(let r of Object.keys(this._values))t._values[r]=this._values[r].untransitioned();return t}}class Kl{constructor(t,r,a,l,h){this.property=t,this.value=r,this.begin=h+l.delay||0,this.end=this.begin+l.duration||0,t.specification.transition&&(l.delay||l.duration)&&(this.prior=a)}possiblyEvaluate(t,r,a){let l=t.now||0,h=this.value.possiblyEvaluate(t,r,a),d=this.prior;if(d){if(l>this.end)return this.prior=null,h;if(this.value.isDataDriven())return this.prior=null,h;if(l=1)return 1;let v=g*g,x=v*g;return 4*(g<.5?x:3*(g-v)+x-.75)}(f))}}return h}}class Fa{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,r,a){let l=new Na(this._properties);for(let h of Object.keys(this._values))l._values[h]=this._values[h].possiblyEvaluate(t,r,a);return l}hasTransition(){for(let t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class Oa{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return this._values[t].value!==void 0}getValue(t){return ye(this._values[t].value)}setValue(t,r){this._values[t]=new oa(this._values[t].property,r===null?void 0:ye(r))}serialize(){let t={};for(let r of Object.keys(this._values)){let a=this.getValue(r);a!==void 0&&(t[r]=a)}return t}possiblyEvaluate(t,r,a){let l=new Na(this._properties);for(let h of Object.keys(this._values))l._values[h]=this._values[h].possiblyEvaluate(t,r,a);return l}}class Xr{constructor(t,r,a){this.property=t,this.value=r,this.parameters=a}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,r,a,l){return this.property.evaluate(this.value,this.parameters,t,r,a,l)}}class Na{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class Ze{constructor(t){this.specification=t}possiblyEvaluate(t,r){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(r)}interpolate(t,r,a){let l=Yi[this.specification.type];return l?l(t,r,a):t}}class rt{constructor(t,r){this.specification=t,this.overrides=r}possiblyEvaluate(t,r,a,l){return new Xr(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(r,null,{},a,l)}:t.expression,r)}interpolate(t,r,a){if(t.value.kind!=="constant"||r.value.kind!=="constant")return t;if(t.value.value===void 0||r.value.value===void 0)return new Xr(this,{kind:"constant",value:void 0},t.parameters);let l=Yi[this.specification.type];if(l){let h=l(t.value.value,r.value.value,a);return new Xr(this,{kind:"constant",value:h},t.parameters)}return t}evaluate(t,r,a,l,h,d){return t.kind==="constant"?t.value:t.evaluate(r,a,l,h,d)}}class Es extends rt{possiblyEvaluate(t,r,a,l){if(t.value===void 0)return new Xr(this,{kind:"constant",value:void 0},r);if(t.expression.kind==="constant"){let h=t.expression.evaluate(r,null,{},a,l),d=t.property.specification.type==="resolvedImage"&&typeof h!="string"?h.name:h,f=this._calculate(d,d,d,r);return new Xr(this,{kind:"constant",value:f},r)}if(t.expression.kind==="camera"){let h=this._calculate(t.expression.evaluate({zoom:r.zoom-1}),t.expression.evaluate({zoom:r.zoom}),t.expression.evaluate({zoom:r.zoom+1}),r);return new Xr(this,{kind:"constant",value:h},r)}return new Xr(this,t.expression,r)}evaluate(t,r,a,l,h,d){if(t.kind==="source"){let f=t.evaluate(r,a,l,h,d);return this._calculate(f,f,f,r)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(r.zoom)-1},a,l),t.evaluate({zoom:Math.floor(r.zoom)},a,l),t.evaluate({zoom:Math.floor(r.zoom)+1},a,l),r):t.value}_calculate(t,r,a,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:a,to:r}}interpolate(t){return t}}class Ts{constructor(t){this.specification=t}possiblyEvaluate(t,r,a,l){if(t.value!==void 0){if(t.expression.kind==="constant"){let h=t.expression.evaluate(r,null,{},a,l);return this._calculate(h,h,h,r)}return this._calculate(t.expression.evaluate(new ti(Math.floor(r.zoom-1),r)),t.expression.evaluate(new ti(Math.floor(r.zoom),r)),t.expression.evaluate(new ti(Math.floor(r.zoom+1),r)),r)}}_calculate(t,r,a,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:a,to:r}}interpolate(t){return t}}class Vo{constructor(t){this.specification=t}possiblyEvaluate(t,r,a,l){return!!t.expression.evaluate(r,null,{},a,l)}interpolate(){return!1}}class c{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let r in t){let a=t[r];a.specification.overridable&&this.overridableProperties.push(r);let l=this.defaultPropertyValues[r]=new oa(a,void 0),h=this.defaultTransitionablePropertyValues[r]=new ws(a);this.defaultTransitioningPropertyValues[r]=h.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=l.possiblyEvaluate({})}}}Ue("DataDrivenProperty",rt),Ue("DataConstantProperty",Ze),Ue("CrossFadedDataDrivenProperty",Es),Ue("CrossFadedProperty",Ts),Ue("ColorRampProperty",Vo);let e="-transition";class n extends Kt{constructor(t,r){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},t.type!=="custom"&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!=="background"&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),r.layout&&(this._unevaluatedLayout=new Oa(r.layout)),r.paint)){this._transitionablePaint=new As(r.paint);for(let a in t.paint)this.setPaintProperty(a,t.paint[a],{validate:!1});for(let a in t.layout)this.setLayoutProperty(a,t.layout[a],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Na(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return t==="visibility"?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,r,a={}){r!=null&&this._validate(Hl,`layers.${this.id}.layout.${t}`,t,r,a)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,r):this.visibility=r)}getPaintProperty(t){return t.endsWith(e)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,r,a={}){if(r!=null&&this._validate(Gl,`layers.${this.id}.paint.${t}`,t,r,a))return!1;if(t.endsWith(e))return this._transitionablePaint.setTransition(t.slice(0,-11),r||void 0),!1;{let l=this._transitionablePaint._values[t],h=l.property.specification["property-type"]==="cross-faded-data-driven",d=l.value.isDataDriven(),f=l.value;this._transitionablePaint.setValue(t,r),this._handleSpecialPaintPropertyUpdate(t);let g=this._transitionablePaint._values[t].value;return g.isDataDriven()||d||h||this._handleOverridablePaintPropertyUpdate(t,f,g)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,r,a){return!1}isHidden(t){return!!(this.minzoom&&t=this.maxzoom)||this.visibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,r){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,r)}serialize(){let t={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&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),Ae(t,(r,a)=>!(r===void 0||a==="layout"&&!Object.keys(r).length||a==="paint"&&!Object.keys(r).length))}_validate(t,r,a,l,h={}){return(!h||h.validate!==!1)&&Bo(this,t.call(kn,{key:r,layerType:this.type,objectKey:a,value:l,styleSpec:oe,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let t in this.paint._values){let r=this.paint.get(t);if(r instanceof Xr&&Wn(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}let s={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class o{constructor(t,r){this._structArray=t,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class u{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,r){return t._trim(),r&&(t.isTransferred=!0,r.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){let r=Object.create(this.prototype);return r.arrayBuffer=t.arrayBuffer,r.length=t.length,r.capacity=t.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_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(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function m(i,t=1){let r=0,a=0;return{members:i.map(l=>{let h=s[l.type].BYTES_PER_ELEMENT,d=r=_(r,Math.max(t,h)),f=l.components||1;return a=Math.max(a,h),r+=h*f,{name:l.name,type:l.type,components:f,offset:d}}),size:_(r,Math.max(a,t)),alignment:t}}function _(i,t){return Math.ceil(i/t)*t}class y extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r){let a=this.length;return this.resize(a+1),this.emplace(a,t,r)}emplace(t,r,a){let l=2*t;return this.int16[l+0]=r,this.int16[l+1]=a,t}}y.prototype.bytesPerElement=4,Ue("StructArrayLayout2i4",y);class b extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a){let l=this.length;return this.resize(l+1),this.emplace(l,t,r,a)}emplace(t,r,a,l){let h=3*t;return this.int16[h+0]=r,this.int16[h+1]=a,this.int16[h+2]=l,t}}b.prototype.bytesPerElement=6,Ue("StructArrayLayout3i6",b);class T extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,l){let h=this.length;return this.resize(h+1),this.emplace(h,t,r,a,l)}emplace(t,r,a,l,h){let d=4*t;return this.int16[d+0]=r,this.int16[d+1]=a,this.int16[d+2]=l,this.int16[d+3]=h,t}}T.prototype.bytesPerElement=8,Ue("StructArrayLayout4i8",T);class C extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,l,h,d){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,a,l,h,d)}emplace(t,r,a,l,h,d,f){let g=6*t;return this.int16[g+0]=r,this.int16[g+1]=a,this.int16[g+2]=l,this.int16[g+3]=h,this.int16[g+4]=d,this.int16[g+5]=f,t}}C.prototype.bytesPerElement=12,Ue("StructArrayLayout2i4i12",C);class P extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,l,h,d){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,a,l,h,d)}emplace(t,r,a,l,h,d,f){let g=4*t,v=8*t;return this.int16[g+0]=r,this.int16[g+1]=a,this.uint8[v+4]=l,this.uint8[v+5]=h,this.uint8[v+6]=d,this.uint8[v+7]=f,t}}P.prototype.bytesPerElement=8,Ue("StructArrayLayout2i4ub8",P);class L extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r){let a=this.length;return this.resize(a+1),this.emplace(a,t,r)}emplace(t,r,a){let l=2*t;return this.float32[l+0]=r,this.float32[l+1]=a,t}}L.prototype.bytesPerElement=8,Ue("StructArrayLayout2f8",L);class O extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,a,l,h,d,f,g,v,x){let A=this.length;return this.resize(A+1),this.emplace(A,t,r,a,l,h,d,f,g,v,x)}emplace(t,r,a,l,h,d,f,g,v,x,A){let D=10*t;return this.uint16[D+0]=r,this.uint16[D+1]=a,this.uint16[D+2]=l,this.uint16[D+3]=h,this.uint16[D+4]=d,this.uint16[D+5]=f,this.uint16[D+6]=g,this.uint16[D+7]=v,this.uint16[D+8]=x,this.uint16[D+9]=A,t}}O.prototype.bytesPerElement=20,Ue("StructArrayLayout10ui20",O);class U extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,a,l,h,d,f,g,v,x,A,D){let M=this.length;return this.resize(M+1),this.emplace(M,t,r,a,l,h,d,f,g,v,x,A,D)}emplace(t,r,a,l,h,d,f,g,v,x,A,D,M){let z=12*t;return this.int16[z+0]=r,this.int16[z+1]=a,this.int16[z+2]=l,this.int16[z+3]=h,this.uint16[z+4]=d,this.uint16[z+5]=f,this.uint16[z+6]=g,this.uint16[z+7]=v,this.int16[z+8]=x,this.int16[z+9]=A,this.int16[z+10]=D,this.int16[z+11]=M,t}}U.prototype.bytesPerElement=24,Ue("StructArrayLayout4i4ui4i24",U);class Z extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,a){let l=this.length;return this.resize(l+1),this.emplace(l,t,r,a)}emplace(t,r,a,l){let h=3*t;return this.float32[h+0]=r,this.float32[h+1]=a,this.float32[h+2]=l,t}}Z.prototype.bytesPerElement=12,Ue("StructArrayLayout3f12",Z);class G extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){let r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint32[1*t+0]=r,t}}G.prototype.bytesPerElement=4,Ue("StructArrayLayout1ul4",G);class X extends u{_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(t,r,a,l,h,d,f,g,v){let x=this.length;return this.resize(x+1),this.emplace(x,t,r,a,l,h,d,f,g,v)}emplace(t,r,a,l,h,d,f,g,v,x){let A=10*t,D=5*t;return this.int16[A+0]=r,this.int16[A+1]=a,this.int16[A+2]=l,this.int16[A+3]=h,this.int16[A+4]=d,this.int16[A+5]=f,this.uint32[D+3]=g,this.uint16[A+8]=v,this.uint16[A+9]=x,t}}X.prototype.bytesPerElement=20,Ue("StructArrayLayout6i1ul2ui20",X);class N extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,l,h,d){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,a,l,h,d)}emplace(t,r,a,l,h,d,f){let g=6*t;return this.int16[g+0]=r,this.int16[g+1]=a,this.int16[g+2]=l,this.int16[g+3]=h,this.int16[g+4]=d,this.int16[g+5]=f,t}}N.prototype.bytesPerElement=12,Ue("StructArrayLayout2i2i2i12",N);class Q extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,l,h){let d=this.length;return this.resize(d+1),this.emplace(d,t,r,a,l,h)}emplace(t,r,a,l,h,d){let f=4*t,g=8*t;return this.float32[f+0]=r,this.float32[f+1]=a,this.float32[f+2]=l,this.int16[g+6]=h,this.int16[g+7]=d,t}}Q.prototype.bytesPerElement=16,Ue("StructArrayLayout2f1f2i16",Q);class te extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,l,h,d){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,a,l,h,d)}emplace(t,r,a,l,h,d,f){let g=16*t,v=4*t,x=8*t;return this.uint8[g+0]=r,this.uint8[g+1]=a,this.float32[v+1]=l,this.float32[v+2]=h,this.int16[x+6]=d,this.int16[x+7]=f,t}}te.prototype.bytesPerElement=16,Ue("StructArrayLayout2ub2f2i16",te);class ae extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,a){let l=this.length;return this.resize(l+1),this.emplace(l,t,r,a)}emplace(t,r,a,l){let h=3*t;return this.uint16[h+0]=r,this.uint16[h+1]=a,this.uint16[h+2]=l,t}}ae.prototype.bytesPerElement=6,Ue("StructArrayLayout3ui6",ae);class fe extends u{_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(t,r,a,l,h,d,f,g,v,x,A,D,M,z,B,q,$){let ne=this.length;return this.resize(ne+1),this.emplace(ne,t,r,a,l,h,d,f,g,v,x,A,D,M,z,B,q,$)}emplace(t,r,a,l,h,d,f,g,v,x,A,D,M,z,B,q,$,ne){let K=24*t,ie=12*t,ce=48*t;return this.int16[K+0]=r,this.int16[K+1]=a,this.uint16[K+2]=l,this.uint16[K+3]=h,this.uint32[ie+2]=d,this.uint32[ie+3]=f,this.uint32[ie+4]=g,this.uint16[K+10]=v,this.uint16[K+11]=x,this.uint16[K+12]=A,this.float32[ie+7]=D,this.float32[ie+8]=M,this.uint8[ce+36]=z,this.uint8[ce+37]=B,this.uint8[ce+38]=q,this.uint32[ie+10]=$,this.int16[K+22]=ne,t}}fe.prototype.bytesPerElement=48,Ue("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",fe);class be extends u{_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(t,r,a,l,h,d,f,g,v,x,A,D,M,z,B,q,$,ne,K,ie,ce,_e,Oe,it,Le,Me,We,je){let Ve=this.length;return this.resize(Ve+1),this.emplace(Ve,t,r,a,l,h,d,f,g,v,x,A,D,M,z,B,q,$,ne,K,ie,ce,_e,Oe,it,Le,Me,We,je)}emplace(t,r,a,l,h,d,f,g,v,x,A,D,M,z,B,q,$,ne,K,ie,ce,_e,Oe,it,Le,Me,We,je,Ve){let de=32*t,Je=16*t;return this.int16[de+0]=r,this.int16[de+1]=a,this.int16[de+2]=l,this.int16[de+3]=h,this.int16[de+4]=d,this.int16[de+5]=f,this.int16[de+6]=g,this.int16[de+7]=v,this.uint16[de+8]=x,this.uint16[de+9]=A,this.uint16[de+10]=D,this.uint16[de+11]=M,this.uint16[de+12]=z,this.uint16[de+13]=B,this.uint16[de+14]=q,this.uint16[de+15]=$,this.uint16[de+16]=ne,this.uint16[de+17]=K,this.uint16[de+18]=ie,this.uint16[de+19]=ce,this.uint16[de+20]=_e,this.uint16[de+21]=Oe,this.uint16[de+22]=it,this.uint32[Je+12]=Le,this.float32[Je+13]=Me,this.float32[Je+14]=We,this.uint16[de+30]=je,this.uint16[de+31]=Ve,t}}be.prototype.bytesPerElement=64,Ue("StructArrayLayout8i15ui1ul2f2ui64",be);class ze extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){let r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.float32[1*t+0]=r,t}}ze.prototype.bytesPerElement=4,Ue("StructArrayLayout1f4",ze);class Ne extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,a){let l=this.length;return this.resize(l+1),this.emplace(l,t,r,a)}emplace(t,r,a,l){let h=3*t;return this.uint16[6*t+0]=r,this.float32[h+1]=a,this.float32[h+2]=l,t}}Ne.prototype.bytesPerElement=12,Ue("StructArrayLayout1ui2f12",Ne);class Se extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,a){let l=this.length;return this.resize(l+1),this.emplace(l,t,r,a)}emplace(t,r,a,l){let h=4*t;return this.uint32[2*t+0]=r,this.uint16[h+2]=a,this.uint16[h+3]=l,t}}Se.prototype.bytesPerElement=8,Ue("StructArrayLayout1ul2ui8",Se);class Ce extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r){let a=this.length;return this.resize(a+1),this.emplace(a,t,r)}emplace(t,r,a){let l=2*t;return this.uint16[l+0]=r,this.uint16[l+1]=a,t}}Ce.prototype.bytesPerElement=4,Ue("StructArrayLayout2ui4",Ce);class Ge extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){let r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint16[1*t+0]=r,t}}Ge.prototype.bytesPerElement=2,Ue("StructArrayLayout1ui2",Ge);class ct extends u{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,a,l){let h=this.length;return this.resize(h+1),this.emplace(h,t,r,a,l)}emplace(t,r,a,l,h){let d=4*t;return this.float32[d+0]=r,this.float32[d+1]=a,this.float32[d+2]=l,this.float32[d+3]=h,t}}ct.prototype.bytesPerElement=16,Ue("StructArrayLayout4f16",ct);class ke extends o{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 se(this.anchorPointX,this.anchorPointY)}}ke.prototype.size=20;class Re extends X{get(t){return new ke(this,t)}}Ue("CollisionBoxArray",Re);class ot extends o{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(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}ot.prototype.size=48;class ii extends fe{get(t){return new ot(this,t)}}Ue("PlacedSymbolArray",ii);class vt extends o{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(t){this._structArray.uint32[this._pos4+12]=t}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]}}vt.prototype.size=64;class Dt extends be{get(t){return new vt(this,t)}}Ue("SymbolInstanceArray",Dt);class ri extends ze{getoffsetX(t){return this.float32[1*t+0]}}Ue("GlyphOffsetArray",ri);class zi extends b{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}Ue("SymbolLineVertexArray",zi);class Or extends o{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]}}Or.prototype.size=12;class ni extends Ne{get(t){return new Or(this,t)}}Ue("TextAnchorOffsetArray",ni);class er extends o{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]}}er.prototype.size=8;class $i extends Se{get(t){return new er(this,t)}}Ue("FeatureIndexArray",$i);class Bi extends y{}class Zi extends y{}class Wr extends y{}class la extends C{}class Cs extends P{}class ua extends L{}class Ar extends O{}class Ds extends U{}class Uo extends Z{}class Er extends G{}class Tr extends N{}class cn extends te{}class Nr extends ae{}class ki extends Ce{}let Li=m([{name:"a_pos",components:2,type:"Int16"}],4),{members:fr}=Li;class kt{constructor(t=[]){this.segments=t}prepareSegment(t,r,a,l){let h=this.segments[this.segments.length-1];return t>kt.MAX_VERTEX_ARRAY_LENGTH&&Ie(`Max vertices per segment is ${kt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!h||h.vertexLength+t>kt.MAX_VERTEX_ARRAY_LENGTH||h.sortKey!==l)&&(h={vertexOffset:r.length,primitiveOffset:a.length,vertexLength:0,primitiveLength:0},l!==void 0&&(h.sortKey=l),this.segments.push(h)),h}get(){return this.segments}destroy(){for(let t of this.segments)for(let r in t.vaos)t.vaos[r].destroy()}static simpleSegment(t,r,a,l){return new kt([{vertexOffset:t,primitiveOffset:r,vertexLength:a,primitiveLength:l,vaos:{},sortKey:0}])}}function Mn(i,t){return 256*(i=Pe(Math.floor(i),0,255))+Pe(Math.floor(t),0,255)}kt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Ue("SegmentVector",kt);let ca=m([{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 ha={exports:{}},Yl={exports:{}};Yl.exports=function(i,t){var r,a,l,h,d,f,g,v;for(a=i.length-(r=3&i.length),l=t,d=3432918353,f=461845907,v=0;v>>16)*d&65535)<<16)&4294967295)<<15|g>>>17))*f+(((g>>>16)*f&65535)<<16)&4294967295)<<13|l>>>19))+((5*(l>>>16)&65535)<<16)&4294967295))+((58964+(h>>>16)&65535)<<16);switch(g=0,r){case 3:g^=(255&i.charCodeAt(v+2))<<16;case 2:g^=(255&i.charCodeAt(v+1))<<8;case 1:l^=g=(65535&(g=(g=(65535&(g^=255&i.charCodeAt(v)))*d+(((g>>>16)*d&65535)<<16)&4294967295)<<15|g>>>17))*f+(((g>>>16)*f&65535)<<16)&4294967295}return l^=i.length,l=2246822507*(65535&(l^=l>>>16))+((2246822507*(l>>>16)&65535)<<16)&4294967295,l=3266489909*(65535&(l^=l>>>13))+((3266489909*(l>>>16)&65535)<<16)&4294967295,(l^=l>>>16)>>>0};var ac=Yl.exports,Ql={exports:{}};Ql.exports=function(i,t){for(var r,a=i.length,l=t^a,h=0;a>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(h)|(255&i.charCodeAt(++h))<<8|(255&i.charCodeAt(++h))<<16|(255&i.charCodeAt(++h))<<24))+((1540483477*(r>>>16)&65535)<<16),l=1540483477*(65535&l)+((1540483477*(l>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),a-=4,++h;switch(a){case 3:l^=(255&i.charCodeAt(h+2))<<16;case 2:l^=(255&i.charCodeAt(h+1))<<8;case 1:l=1540483477*(65535&(l^=255&i.charCodeAt(h)))+((1540483477*(l>>>16)&65535)<<16)}return l=1540483477*(65535&(l^=l>>>13))+((1540483477*(l>>>16)&65535)<<16),(l^=l>>>15)>>>0};var hn=ac,eu=Ql.exports;ha.exports=hn,ha.exports.murmur3=hn,ha.exports.murmur2=eu;var Ss=ue(ha.exports);class qa{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,r,a,l){this.ids.push(Is(t)),this.positions.push(r,a,l)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let r=Is(t),a=0,l=this.ids.length-1;for(;a>1;this.ids[d]>=r?l=d:a=d+1}let h=[];for(;this.ids[a]===r;)h.push({index:this.positions[3*a],start:this.positions[3*a+1],end:this.positions[3*a+2]}),a++;return h}static serialize(t,r){let a=new Float64Array(t.ids),l=new Uint32Array(t.positions);return ks(a,l,0,a.length-1),r&&r.push(a.buffer,l.buffer),{ids:a,positions:l}}static deserialize(t){let r=new qa;return r.ids=t.ids,r.positions=t.positions,r.indexed=!0,r}}function Is(i){let t=+i;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:Ss(String(i))}function ks(i,t,r,a){for(;r>1],h=r-1,d=a+1;for(;;){do h++;while(i[h]l);if(h>=d)break;pa(i,h,d),pa(t,3*h,3*d),pa(t,3*h+1,3*d+1),pa(t,3*h+2,3*d+2)}d-r`u_${l}`),this.type=a}setUniform(t,r,a){t.set(a.constantOr(this.value))}getBinding(t,r,a){return this.type==="color"?new mh(t,r):new tu(t,r)}}class Ms{constructor(t,r){this.uniformNames=r.map(a=>`u_${a}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=t.tlbr}setUniform(t,r,a,l){let h=l==="u_pattern_to"?this.patternTo:l==="u_pattern_from"?this.patternFrom:l==="u_pixel_ratio_to"?this.pixelRatioTo:l==="u_pixel_ratio_from"?this.pixelRatioFrom:null;h&&t.set(h)}getBinding(t,r,a){return a.substr(0,9)==="u_pattern"?new fh(t,r):new tu(t,r)}}class Pn{constructor(t,r,a,l){this.expression=t,this.type=a,this.maxValue=0,this.paintVertexAttributes=r.map(h=>({name:`a_${h}`,type:"Float32",components:a==="color"?2:1,offset:0})),this.paintVertexArray=new l}populatePaintArray(t,r,a,l,h){let d=this.paintVertexArray.length,f=this.expression.evaluate(new ti(0),r,{},l,[],h);this.paintVertexArray.resize(t),this._setPaintValue(d,t,f)}updatePaintArray(t,r,a,l){let h=this.expression.evaluate({zoom:0},a,l);this._setPaintValue(t,r,h)}_setPaintValue(t,r,a){if(this.type==="color"){let l=sc(a);for(let h=t;h`u_${f}_t`),this.type=a,this.useIntegerZoom=l,this.zoom=h,this.maxValue=0,this.paintVertexAttributes=r.map(f=>({name:`a_${f}`,type:"Float32",components:a==="color"?4:2,offset:0})),this.paintVertexArray=new d}populatePaintArray(t,r,a,l,h){let d=this.expression.evaluate(new ti(this.zoom),r,{},l,[],h),f=this.expression.evaluate(new ti(this.zoom+1),r,{},l,[],h),g=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(g,t,d,f)}updatePaintArray(t,r,a,l){let h=this.expression.evaluate({zoom:this.zoom},a,l),d=this.expression.evaluate({zoom:this.zoom+1},a,l);this._setPaintValue(t,r,h,d)}_setPaintValue(t,r,a,l){if(this.type==="color"){let h=sc(a),d=sc(l);for(let f=t;f`#define HAS_UNIFORM_${l}`))}return t}getBinderAttributes(){let t=[];for(let r in this.binders){let a=this.binders[r];if(a instanceof Pn||a instanceof rn)for(let l=0;l!0){this.programConfigurations={};for(let l of t)this.programConfigurations[l.id]=new gh(l,r,a);this.needsUpload=!1,this._featureMap=new qa,this._bufferOffset=0}populatePaintArrays(t,r,a,l,h,d){for(let f in this.programConfigurations)this.programConfigurations[f].populatePaintArrays(t,r,l,h,d);r.id!==void 0&&this._featureMap.add(r.id,a,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,r,a,l){for(let h of a)this.needsUpload=this.programConfigurations[h.id].updatePaintArrays(t,this._featureMap,r,h,l)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(let r in this.programConfigurations)this.programConfigurations[r].upload(t);this.needsUpload=!1}}destroy(){for(let t in this.programConfigurations)this.programConfigurations[t].destroy()}}function Yd(i,t){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"]}[i]||[i.replace(`${t}-`,"").replace(/-/g,"_")]}function _h(i,t,r){let a={color:{source:L,composite:ct},number:{source:ze,composite:L}},l=function(h){return{"line-pattern":{source:Ar,composite:Ar},"fill-pattern":{source:Ar,composite:Ar},"fill-extrusion-pattern":{source:Ar,composite:Ar}}[h]}(i);return l&&l[r]||a[t][r]}Ue("ConstantBinder",jo),Ue("CrossFadedConstantBinder",Ms),Ue("SourceExpressionBinder",Pn),Ue("CrossFadedCompositeBinder",da),Ue("CompositeExpressionBinder",rn),Ue("ProgramConfiguration",gh,{omit:["_buffers"]}),Ue("ProgramConfigurationSet",Ua);let xi=8192,oc=Math.pow(2,14)-1,yh=-oc-1;function ja(i){let t=xi/i.extent,r=i.loadGeometry();for(let a=0;ad.x+1||gd.y+1)&&Ie("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function $a(i,t){return{type:i.type,id:i.id,properties:i.properties,geometry:t?ja(i):[]}}function iu(i,t,r,a,l){i.emplaceBack(2*t+(a+1)/2,2*r+(l+1)/2)}class lc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Zi,this.indexArray=new Nr,this.segments=new kt,this.programConfigurations=new Ua(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,a){let l=this.layers[0],h=[],d=null,f=!1;l.type==="circle"&&(d=l.layout.get("circle-sort-key"),f=!d.isConstant());for(let{feature:g,id:v,index:x,sourceLayerIndex:A}of t){let D=this.layers[0]._featureFilter.needGeometry,M=$a(g,D);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom),M,a))continue;let z=f?d.evaluate(M,{},a):void 0,B={id:v,properties:g.properties,type:g.type,sourceLayerIndex:A,index:x,geometry:D?M.geometry:ja(g),patterns:{},sortKey:z};h.push(B)}f&&h.sort((g,v)=>g.sortKey-v.sortKey);for(let g of h){let{geometry:v,index:x,sourceLayerIndex:A}=g,D=t[x].feature;this.addFeature(g,v,x,a),r.featureIndex.insert(D,v,x,A,this.index)}}update(t,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,a)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,fr),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,r,a,l){for(let h of r)for(let d of h){let f=d.x,g=d.y;if(f<0||f>=xi||g<0||g>=xi)continue;let v=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),x=v.vertexLength;iu(this.layoutVertexArray,f,g,-1,-1),iu(this.layoutVertexArray,f,g,1,-1),iu(this.layoutVertexArray,f,g,1,1),iu(this.layoutVertexArray,f,g,-1,1),this.indexArray.emplaceBack(x,x+1,x+2),this.indexArray.emplaceBack(x,x+3,x+2),v.vertexLength+=4,v.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,{},l)}}function vh(i,t){for(let r=0;r1){if(uc(i,t))return!0;for(let a=0;a1?r:r.sub(t)._mult(l)._add(t))}function wh(i,t){let r,a,l,h=!1;for(let d=0;dt.y!=l.y>t.y&&t.x<(l.x-a.x)*(t.y-a.y)/(l.y-a.y)+a.x&&(h=!h)}return h}function Ps(i,t){let r=!1;for(let a=0,l=i.length-1;at.y!=d.y>t.y&&t.x<(d.x-h.x)*(t.y-h.y)/(d.y-h.y)+h.x&&(r=!r)}return r}function rf(i,t,r){let a=r[0],l=r[2];if(i.xl.x&&t.x>l.x||i.yl.y&&t.y>l.y)return!1;let h=Qe(i,t,r[0]);return h!==Qe(i,t,r[1])||h!==Qe(i,t,r[2])||h!==Qe(i,t,r[3])}function $o(i,t,r){let a=t.paint.get(i).value;return a.kind==="constant"?a.value:r.programConfigurations.get(t.id).getMaxValue(i)}function ru(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function nu(i,t,r,a,l){if(!t[0]&&!t[1])return i;let h=se.convert(t)._mult(l);r==="viewport"&&h._rotate(-a);let d=[];for(let f=0;fCh(q,B))}(v,g),M=A?x*f:x;for(let z of l)for(let B of z){let q=A?B:Ch(B,g),$=M,ne=au([],[B.x,B.y,0,1],g);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?$*=ne[3]/d.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&($*=d.cameraToCenterDistance/ne[3]),Qd(D,q,$))return!0}return!1}}function Ch(i,t){let r=au([],[i.x,i.y,0,1],t);return new se(r[0]/r[3],r[1]/r[3])}class Dh extends lc{}let Sh;Ue("HeatmapBucket",Dh,{omit:["layers"]});var of={get paint(){return Sh=Sh||new c({"heatmap-radius":new rt(oe.paint_heatmap["heatmap-radius"]),"heatmap-weight":new rt(oe.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ze(oe.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Vo(oe.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ze(oe.paint_heatmap["heatmap-opacity"])})}};function pc(i,{width:t,height:r},a,l){if(l){if(l instanceof Uint8ClampedArray)l=new Uint8Array(l.buffer);else if(l.length!==t*r*a)throw new RangeError(`mismatched image size. expected: ${l.length} but got: ${t*r*a}`)}else l=new Uint8Array(t*r*a);return i.width=t,i.height=r,i.data=l,i}function Ih(i,{width:t,height:r},a){if(t===i.width&&r===i.height)return;let l=pc({},{width:t,height:r},a);dc(i,l,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,t),height:Math.min(i.height,r)},a),i.width=t,i.height=r,i.data=l.data}function dc(i,t,r,a,l,h){if(l.width===0||l.height===0)return t;if(l.width>i.width||l.height>i.height||r.x>i.width-l.width||r.y>i.height-l.height)throw new RangeError("out of range source coordinates for image copy");if(l.width>t.width||l.height>t.height||a.x>t.width-l.width||a.y>t.height-l.height)throw new RangeError("out of range destination coordinates for image copy");let d=i.data,f=t.data;if(d===f)throw new Error("srcData equals dstData, so image is already copied");for(let g=0;g{t[i.evaluationKey]=g;let v=i.expression.evaluate(t);l.data[d+f+0]=Math.floor(255*v.r/v.a),l.data[d+f+1]=Math.floor(255*v.g/v.a),l.data[d+f+2]=Math.floor(255*v.b/v.a),l.data[d+f+3]=Math.floor(255*v.a)};if(i.clips)for(let d=0,f=0;d80*r){f=1/0,g=1/0;let x=-1/0,A=-1/0;for(let D=r;Dx&&(x=M),z>A&&(A=z)}v=Math.max(x-f,A-g),v=v!==0?32767/v:0}return Ho(h,d,r,f,g,v,0),d}function zh(i,t,r,a,l){let h;if(l===function(d,f,g,v){let x=0;for(let A=f,D=g-v;A0)for(let d=t;d=t;d-=a)h=Rh(d/a|0,i[d],i[d+1],h);return h&&su(h,h.next)&&(Wo(h),h=h.next),h}function Za(i,t){if(!i)return i;t||(t=i);let r,a=i;do if(r=!1,a.steiner||!su(a,a.next)&&_i(a.prev,a,a.next)!==0)a=a.next;else{if(Wo(a),a=t=a.prev,a===a.next)break;r=!0}while(r||a!==t);return t}function Ho(i,t,r,a,l,h,d){if(!i)return;!d&&h&&function(g,v,x,A){let D=g;do D.z===0&&(D.z=mc(D.x,D.y,v,x,A)),D.prevZ=D.prev,D.nextZ=D.next,D=D.next;while(D!==g);D.prevZ.nextZ=null,D.prevZ=null,function(M){let z,B=1;do{let q,$=M;M=null;let ne=null;for(z=0;$;){z++;let K=$,ie=0;for(let _e=0;_e0||ce>0&&K;)ie!==0&&(ce===0||!K||$.z<=K.z)?(q=$,$=$.nextZ,ie--):(q=K,K=K.nextZ,ce--),ne?ne.nextZ=q:M=q,q.prevZ=ne,ne=q;$=K}ne.nextZ=null,B*=2}while(z>1)}(D)}(i,a,l,h);let f=i;for(;i.prev!==i.next;){let g=i.prev,v=i.next;if(h?ff(i,a,l,h):df(i))t.push(g.i,i.i,v.i),Wo(i),i=v.next,f=v.next;else if((i=v)===f){d?d===1?Ho(i=mf(Za(i),t),t,r,a,l,h,2):d===2&&gf(i,t,r,a,l,h):Ho(Za(i),t,r,a,l,h,1);break}}}function df(i){let t=i.prev,r=i,a=i.next;if(_i(t,r,a)>=0)return!1;let l=t.x,h=r.x,d=a.x,f=t.y,g=r.y,v=a.y,x=lh?l>d?l:d:h>d?h:d,M=f>g?f>v?f:v:g>v?g:v,z=a.next;for(;z!==t;){if(z.x>=x&&z.x<=D&&z.y>=A&&z.y<=M&&Bs(l,f,h,g,d,v,z.x,z.y)&&_i(z.prev,z,z.next)>=0)return!1;z=z.next}return!0}function ff(i,t,r,a){let l=i.prev,h=i,d=i.next;if(_i(l,h,d)>=0)return!1;let f=l.x,g=h.x,v=d.x,x=l.y,A=h.y,D=d.y,M=fg?f>v?f:v:g>v?g:v,q=x>A?x>D?x:D:A>D?A:D,$=mc(M,z,t,r,a),ne=mc(B,q,t,r,a),K=i.prevZ,ie=i.nextZ;for(;K&&K.z>=$&&ie&&ie.z<=ne;){if(K.x>=M&&K.x<=B&&K.y>=z&&K.y<=q&&K!==l&&K!==d&&Bs(f,x,g,A,v,D,K.x,K.y)&&_i(K.prev,K,K.next)>=0||(K=K.prevZ,ie.x>=M&&ie.x<=B&&ie.y>=z&&ie.y<=q&&ie!==l&&ie!==d&&Bs(f,x,g,A,v,D,ie.x,ie.y)&&_i(ie.prev,ie,ie.next)>=0))return!1;ie=ie.nextZ}for(;K&&K.z>=$;){if(K.x>=M&&K.x<=B&&K.y>=z&&K.y<=q&&K!==l&&K!==d&&Bs(f,x,g,A,v,D,K.x,K.y)&&_i(K.prev,K,K.next)>=0)return!1;K=K.prevZ}for(;ie&&ie.z<=ne;){if(ie.x>=M&&ie.x<=B&&ie.y>=z&&ie.y<=q&&ie!==l&&ie!==d&&Bs(f,x,g,A,v,D,ie.x,ie.y)&&_i(ie.prev,ie,ie.next)>=0)return!1;ie=ie.nextZ}return!0}function mf(i,t){let r=i;do{let a=r.prev,l=r.next.next;!su(a,l)&&Bh(a,r,r.next,l)&&Xo(a,l)&&Xo(l,a)&&(t.push(a.i,r.i,l.i),Wo(r),Wo(r.next),r=i=l),r=r.next}while(r!==i);return Za(r)}function gf(i,t,r,a,l,h){let d=i;do{let f=d.next.next;for(;f!==d.prev;){if(d.i!==f.i&&bf(d,f)){let g=Lh(d,f);return d=Za(d,d.next),g=Za(g,g.next),Ho(d,t,r,a,l,h,0),void Ho(g,t,r,a,l,h,0)}f=f.next}d=d.next}while(d!==i)}function _f(i,t){return i.x-t.x}function yf(i,t){let r=function(l,h){let d=h,f=l.x,g=l.y,v,x=-1/0;do{if(g<=d.y&&g>=d.next.y&&d.next.y!==d.y){let B=d.x+(g-d.y)*(d.next.x-d.x)/(d.next.y-d.y);if(B<=f&&B>x&&(x=B,v=d.x=d.x&&d.x>=D&&f!==d.x&&Bs(gv.x||d.x===v.x&&vf(v,d)))&&(v=d,z=B)}d=d.next}while(d!==A);return v}(i,t);if(!r)return t;let a=Lh(r,i);return Za(a,a.next),Za(r,r.next)}function vf(i,t){return _i(i.prev,i,t.prev)<0&&_i(t.next,i,i.next)<0}function mc(i,t,r,a,l){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*l|0)|i<<8))|i<<4))|i<<2))|i<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-a)*l|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function xf(i){let t=i,r=i;do(t.x=(i-d)*(h-f)&&(i-d)*(a-f)>=(r-d)*(t-f)&&(r-d)*(h-f)>=(l-d)*(a-f)}function bf(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!function(r,a){let l=r;do{if(l.i!==r.i&&l.next.i!==r.i&&l.i!==a.i&&l.next.i!==a.i&&Bh(l,l.next,r,a))return!0;l=l.next}while(l!==r);return!1}(i,t)&&(Xo(i,t)&&Xo(t,i)&&function(r,a){let l=r,h=!1,d=(r.x+a.x)/2,f=(r.y+a.y)/2;do l.y>f!=l.next.y>f&&l.next.y!==l.y&&d<(l.next.x-l.x)*(f-l.y)/(l.next.y-l.y)+l.x&&(h=!h),l=l.next;while(l!==r);return h}(i,t)&&(_i(i.prev,i,t.prev)||_i(i,t.prev,t))||su(i,t)&&_i(i.prev,i,i.next)>0&&_i(t.prev,t,t.next)>0)}function _i(i,t,r){return(t.y-i.y)*(r.x-t.x)-(t.x-i.x)*(r.y-t.y)}function su(i,t){return i.x===t.x&&i.y===t.y}function Bh(i,t,r,a){let l=lu(_i(i,t,r)),h=lu(_i(i,t,a)),d=lu(_i(r,a,i)),f=lu(_i(r,a,t));return l!==h&&d!==f||!(l!==0||!ou(i,r,t))||!(h!==0||!ou(i,a,t))||!(d!==0||!ou(r,i,a))||!(f!==0||!ou(r,t,a))}function ou(i,t,r){return t.x<=Math.max(i.x,r.x)&&t.x>=Math.min(i.x,r.x)&&t.y<=Math.max(i.y,r.y)&&t.y>=Math.min(i.y,r.y)}function lu(i){return i>0?1:i<0?-1:0}function Xo(i,t){return _i(i.prev,i,i.next)<0?_i(i,t,i.next)>=0&&_i(i,i.prev,t)>=0:_i(i,t,i.prev)<0||_i(i,i.next,t)<0}function Lh(i,t){let r=gc(i.i,i.x,i.y),a=gc(t.i,t.x,t.y),l=i.next,h=t.prev;return i.next=t,t.prev=i,r.next=l,l.prev=r,a.next=r,r.prev=a,h.next=a,a.prev=h,a}function Rh(i,t,r,a){let l=gc(i,t,r);return a?(l.next=a.next,l.prev=a,a.next.prev=l,a.next=l):(l.prev=l,l.next=l),l}function Wo(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function gc(i,t,r){return{i,x:t,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function _c(i,t,r){let a=r.patternDependencies,l=!1;for(let h of t){let d=h.paint.get(`${i}-pattern`);d.isConstant()||(l=!0);let f=d.constantOr(null);f&&(l=!0,a[f.to]=!0,a[f.from]=!0)}return l}function yc(i,t,r,a,l){let h=l.patternDependencies;for(let d of t){let f=d.paint.get(`${i}-pattern`).value;if(f.kind!=="constant"){let g=f.evaluate({zoom:a-1},r,{},l.availableImages),v=f.evaluate({zoom:a},r,{},l.availableImages),x=f.evaluate({zoom:a+1},r,{},l.availableImages);g=g&&g.name?g.name:g,v=v&&v.name?v.name:v,x=x&&x.name?x.name:x,h[g]=!0,h[v]=!0,h[x]=!0,r.patterns[d.id]={min:g,mid:v,max:x}}}return r}class vc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Wr,this.indexArray=new Nr,this.indexArray2=new ki,this.programConfigurations=new Ua(t.layers,t.zoom),this.segments=new kt,this.segments2=new kt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,a){this.hasPattern=_c("fill",this.layers,r);let l=this.layers[0].layout.get("fill-sort-key"),h=!l.isConstant(),d=[];for(let{feature:f,id:g,index:v,sourceLayerIndex:x}of t){let A=this.layers[0]._featureFilter.needGeometry,D=$a(f,A);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom),D,a))continue;let M=h?l.evaluate(D,{},a,r.availableImages):void 0,z={id:g,properties:f.properties,type:f.type,sourceLayerIndex:x,index:v,geometry:A?D.geometry:ja(f),patterns:{},sortKey:M};d.push(z)}h&&d.sort((f,g)=>f.sortKey-g.sortKey);for(let f of d){let{geometry:g,index:v,sourceLayerIndex:x}=f;if(this.hasPattern){let A=yc("fill",this.layers,f,this.zoom,r);this.patternFeatures.push(A)}else this.addFeature(f,g,v,a,{});r.featureIndex.insert(t[v].feature,g,v,x,this.index)}}update(t,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,a)}addFeatures(t,r,a){for(let l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,a)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,pf),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),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(t,r,a,l,h){for(let d of ns(r,500)){let f=0;for(let M of d)f+=M.length;let g=this.segments.prepareSegment(f,this.layoutVertexArray,this.indexArray),v=g.vertexLength,x=[],A=[];for(let M of d){if(M.length===0)continue;M!==d[0]&&A.push(x.length/2);let z=this.segments2.prepareSegment(M.length,this.layoutVertexArray,this.indexArray2),B=z.vertexLength;this.layoutVertexArray.emplaceBack(M[0].x,M[0].y),this.indexArray2.emplaceBack(B+M.length-1,B),x.push(M[0].x),x.push(M[0].y);for(let q=1;q>3}if(l--,a===1||a===2)h+=i.readSVarint(),d+=i.readSVarint(),a===1&&(t&&f.push(t),t=[]),t.push(new Df(h,d));else{if(a!==7)throw new Error("unknown command "+a);t&&t.push(t[0].clone())}}return t&&f.push(t),f},Ls.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var t=i.readVarint()+i.pos,r=1,a=0,l=0,h=0,d=1/0,f=-1/0,g=1/0,v=-1/0;i.pos>3}if(a--,r===1||r===2)(l+=i.readSVarint())f&&(f=l),(h+=i.readSVarint())v&&(v=h);else if(r!==7)throw new Error("unknown command "+r)}return[d,g,f,v]},Ls.prototype.toGeoJSON=function(i,t,r){var a,l,h=this.extent*Math.pow(2,r),d=this.extent*i,f=this.extent*t,g=this.loadGeometry(),v=Ls.types[this.type];function x(M){for(var z=0;z>3;l=d===1?a.readString():d===2?a.readFloat():d===3?a.readDouble():d===4?a.readVarint64():d===5?a.readVarint():d===6?a.readSVarint():d===7?a.readBoolean():null}return l}(r))}Vh.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var t=this._pbf.readVarint()+this._pbf.pos;return new kf(this._pbf,t,this.extent,this._keys,this._values)};var Pf=qh;function zf(i,t,r){if(i===3){var a=new Pf(r,r.readVarint()+r.pos);a.length&&(t[a.name]=a)}}fa.VectorTile=function(i,t){this.layers=i.readFields(zf,{},t)},fa.VectorTileFeature=Nh,fa.VectorTileLayer=qh;let Bf=fa.VectorTileFeature.types,xc=Math.pow(2,13);function Jo(i,t,r,a,l,h,d,f){i.emplaceBack(t,r,2*Math.floor(a*xc)+d,l*xc*2,h*xc*2,Math.round(f))}class bc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new la,this.centroidVertexArray=new Bi,this.indexArray=new Nr,this.programConfigurations=new Ua(t.layers,t.zoom),this.segments=new kt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,a){this.features=[],this.hasPattern=_c("fill-extrusion",this.layers,r);for(let{feature:l,id:h,index:d,sourceLayerIndex:f}of t){let g=this.layers[0]._featureFilter.needGeometry,v=$a(l,g);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom),v,a))continue;let x={id:h,sourceLayerIndex:f,index:d,geometry:g?v.geometry:ja(l),properties:l.properties,type:l.type,patterns:{}};this.hasPattern?this.features.push(yc("fill-extrusion",this.layers,x,this.zoom,r)):this.addFeature(x,x.geometry,d,a,{}),r.featureIndex.insert(l,x.geometry,d,f,this.index,!0)}}addFeatures(t,r,a){for(let l of this.features){let{geometry:h}=l;this.addFeature(l,h,l.index,r,a)}}update(t,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,a)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Cf),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Tf.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,r,a,l,h){for(let d of ns(r,500)){let f={x:0,y:0,vertexCount:0},g=0;for(let z of d)g+=z.length;let v=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let z of d){if(z.length===0||Rf(z))continue;let B=0;for(let q=0;q=1){let ne=z[q-1];if(!Lf($,ne)){v.vertexLength+4>kt.MAX_VERTEX_ARRAY_LENGTH&&(v=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let K=$.sub(ne)._perp()._unit(),ie=ne.dist($);B+ie>32768&&(B=0),Jo(this.layoutVertexArray,$.x,$.y,K.x,K.y,0,0,B),Jo(this.layoutVertexArray,$.x,$.y,K.x,K.y,0,1,B),f.x+=2*$.x,f.y+=2*$.y,f.vertexCount+=2,B+=ie,Jo(this.layoutVertexArray,ne.x,ne.y,K.x,K.y,0,0,B),Jo(this.layoutVertexArray,ne.x,ne.y,K.x,K.y,0,1,B),f.x+=2*ne.x,f.y+=2*ne.y,f.vertexCount+=2;let ce=v.vertexLength;this.indexArray.emplaceBack(ce,ce+2,ce+1),this.indexArray.emplaceBack(ce+1,ce+2,ce+3),v.vertexLength+=4,v.primitiveLength+=2}}}}if(v.vertexLength+g>kt.MAX_VERTEX_ARRAY_LENGTH&&(v=this.segments.prepareSegment(g,this.layoutVertexArray,this.indexArray)),Bf[t.type]!=="Polygon")continue;let x=[],A=[],D=v.vertexLength;for(let z of d)if(z.length!==0){z!==d[0]&&A.push(x.length/2);for(let B=0;Bxi)||i.y===t.y&&(i.y<0||i.y>xi)}function Rf(i){return i.every(t=>t.x<0)||i.every(t=>t.x>xi)||i.every(t=>t.y<0)||i.every(t=>t.y>xi)}let Uh;Ue("FillExtrusionBucket",bc,{omit:["layers","features"]});var Ff={get paint(){return Uh=Uh||new c({"fill-extrusion-opacity":new Ze(oe["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new rt(oe["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ze(oe["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ze(oe["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Es(oe["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new rt(oe["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new rt(oe["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ze(oe["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Of extends n{constructor(t){super(t,Ff)}createBucket(t){return new bc(t)}queryRadius(){return ru(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(t,r,a,l,h,d,f,g){let v=nu(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),d.angle,f),x=this.paint.get("fill-extrusion-height").evaluate(r,a),A=this.paint.get("fill-extrusion-base").evaluate(r,a),D=function(z,B,q,$){let ne=[];for(let K of z){let ie=[K.x,K.y,0,1];au(ie,ie,B),ne.push(new se(ie[0]/ie[3],ie[1]/ie[3]))}return ne}(v,g),M=function(z,B,q,$){let ne=[],K=[],ie=$[8]*B,ce=$[9]*B,_e=$[10]*B,Oe=$[11]*B,it=$[8]*q,Le=$[9]*q,Me=$[10]*q,We=$[11]*q;for(let je of z){let Ve=[],de=[];for(let Je of je){let He=Je.x,lt=Je.y,Jt=$[0]*He+$[4]*lt+$[12],Wt=$[1]*He+$[5]*lt+$[13],Ti=$[2]*He+$[6]*lt+$[14],Jr=$[3]*He+$[7]*lt+$[15],Fi=Ti+_e,Ci=Jr+Oe,ir=Jt+it,rr=Wt+Le,nr=Ti+Me,mi=Jr+We,Di=new se((Jt+ie)/Ci,(Wt+ce)/Ci);Di.z=Fi/Ci,Ve.push(Di);let Gi=new se(ir/mi,rr/mi);Gi.z=nr/mi,de.push(Gi)}ne.push(Ve),K.push(de)}return[ne,K]}(l,A,x,g);return function(z,B,q){let $=1/0;xh(q,B)&&($=jh(q,B[0]));for(let ne=0;ner.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new Cs,this.layoutVertexArray2=new ua,this.indexArray=new Nr,this.programConfigurations=new Ua(t.layers,t.zoom),this.segments=new kt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,a){this.hasPattern=_c("line",this.layers,r);let l=this.layers[0].layout.get("line-sort-key"),h=!l.isConstant(),d=[];for(let{feature:f,id:g,index:v,sourceLayerIndex:x}of t){let A=this.layers[0]._featureFilter.needGeometry,D=$a(f,A);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom),D,a))continue;let M=h?l.evaluate(D,{},a):void 0,z={id:g,properties:f.properties,type:f.type,sourceLayerIndex:x,index:v,geometry:A?D.geometry:ja(f),patterns:{},sortKey:M};d.push(z)}h&&d.sort((f,g)=>f.sortKey-g.sortKey);for(let f of d){let{geometry:g,index:v,sourceLayerIndex:x}=f;if(this.hasPattern){let A=yc("line",this.layers,f,this.zoom,r);this.patternFeatures.push(A)}else this.addFeature(f,g,v,a,{});r.featureIndex.insert(t[v].feature,g,v,x,this.index)}}update(t,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,a)}addFeatures(t,r,a){for(let l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,a)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Uf)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,qf),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,r,a,l,h){let d=this.layers[0].layout,f=d.get("line-join").evaluate(t,{}),g=d.get("line-cap"),v=d.get("line-miter-limit"),x=d.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(let A of r)this.addLine(A,t,f,g,v,x);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,h,l)}addLine(t,r,a,l,h,d){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let $=0;$=2&&t[g-1].equals(t[g-2]);)g--;let v=0;for(;v0;if(Oe&&$>v){let We=D.dist(M);if(We>2*x){let je=D.sub(D.sub(M)._mult(x/We)._round());this.updateDistance(M,je),this.addCurrentVertex(je,B,0,0,A),M=je}}let Le=M&&z,Me=Le?a:f?"butt":l;if(Le&&Me==="round"&&(ceh&&(Me="bevel"),Me==="bevel"&&(ce>2&&(Me="flipbevel"),ce100)ne=q.mult(-1);else{let We=ce*B.add(q).mag()/B.sub(q).mag();ne._perp()._mult(We*(it?-1:1))}this.addCurrentVertex(D,ne,0,0,A),this.addCurrentVertex(D,ne.mult(-1),0,0,A)}else if(Me==="bevel"||Me==="fakeround"){let We=-Math.sqrt(ce*ce-1),je=it?We:0,Ve=it?0:We;if(M&&this.addCurrentVertex(D,B,je,Ve,A),Me==="fakeround"){let de=Math.round(180*_e/Math.PI/20);for(let Je=1;Je2*x){let je=D.add(z.sub(D)._mult(x/We)._round());this.updateDistance(D,je),this.addCurrentVertex(je,q,0,0,A),D=je}}}}addCurrentVertex(t,r,a,l,h,d=!1){let f=r.y*l-r.x,g=-r.y-r.x*l;this.addHalfVertex(t,r.x+r.y*a,r.y-r.x*a,d,!1,a,h),this.addHalfVertex(t,f,g,d,!0,-l,h),this.distance>$h/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,r,a,l,h,d))}addHalfVertex({x:t,y:r},a,l,h,d,f,g){let v=.5*(this.lineClips?this.scaledDistance*($h-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(h?1:0),(r<<1)+(d?1:0),Math.round(63*a)+128,Math.round(63*l)+128,1+(f===0?0:f<0?-1:1)|(63&v)<<2,v>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);let x=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,x),g.primitiveLength++),d?this.e2=x:this.e1=x}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,r){this.distance+=t.dist(r),this.updateScaledDistance()}}let Zh,Gh;Ue("LineBucket",wc,{omit:["layers","patternFeatures"]});var Hh={get paint(){return Gh=Gh||new c({"line-opacity":new rt(oe.paint_line["line-opacity"]),"line-color":new rt(oe.paint_line["line-color"]),"line-translate":new Ze(oe.paint_line["line-translate"]),"line-translate-anchor":new Ze(oe.paint_line["line-translate-anchor"]),"line-width":new rt(oe.paint_line["line-width"]),"line-gap-width":new rt(oe.paint_line["line-gap-width"]),"line-offset":new rt(oe.paint_line["line-offset"]),"line-blur":new rt(oe.paint_line["line-blur"]),"line-dasharray":new Ts(oe.paint_line["line-dasharray"]),"line-pattern":new Es(oe.paint_line["line-pattern"]),"line-gradient":new Vo(oe.paint_line["line-gradient"])})},get layout(){return Zh=Zh||new c({"line-cap":new Ze(oe.layout_line["line-cap"]),"line-join":new rt(oe.layout_line["line-join"]),"line-miter-limit":new Ze(oe.layout_line["line-miter-limit"]),"line-round-limit":new Ze(oe.layout_line["line-round-limit"]),"line-sort-key":new rt(oe.layout_line["line-sort-key"])})}};class Zf extends rt{possiblyEvaluate(t,r){return r=new ti(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(t,r)}evaluate(t,r,a,l){return r=Ye({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(t,r,a,l)}}let uu;class Gf extends n{constructor(t){super(t,Hh),this.gradientVersion=0,uu||(uu=new Zf(Hh.paint.properties["line-width"].specification),uu.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){let r=this.gradientExpression();this.stepInterpolant=!!function(a){return a._styleExpression!==void 0}(r)&&r._styleExpression.expression instanceof jn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,r){super.recalculate(t,r),this.paint._values["line-floorwidth"]=uu.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new wc(t)}queryRadius(t){let r=t,a=Xh($o("line-width",this,r),$o("line-gap-width",this,r)),l=$o("line-offset",this,r);return a/2+Math.abs(l)+ru(this.paint.get("line-translate"))}queryIntersectsFeature(t,r,a,l,h,d,f){let g=nu(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),d.angle,f),v=f/2*Xh(this.paint.get("line-width").evaluate(r,a),this.paint.get("line-gap-width").evaluate(r,a)),x=this.paint.get("line-offset").evaluate(r,a);return x&&(l=function(A,D){let M=[];for(let z=0;z=3){for(let q=0;q0?t+2*i:i}let Hf=m([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Xf=m([{name:"a_projected_pos",components:3,type:"Float32"}],4);m([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let Wf=m([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);m([{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"}]);let Wh=m([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Jf=m([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Kf(i,t,r){return i.sections.forEach(a=>{a.text=function(l,h,d){let f=h.layout.get("text-transform").evaluate(d,{});return f==="uppercase"?l=l.toLocaleUpperCase():f==="lowercase"&&(l=l.toLocaleLowerCase()),dr.applyArabicShaping&&(l=dr.applyArabicShaping(l)),l}(a.text,t,r)}),i}m([{name:"triangle",components:3,type:"Uint16"}]),m([{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"}]),m([{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"}]),m([{type:"Float32",name:"offsetX"}]),m([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),m([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);let Yo={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"};var wi=24,Jh=Xt,Kh=function(i,t,r,a,l){var h,d,f=8*l-a-1,g=(1<>1,x=-7,A=r?l-1:0,D=r?-1:1,M=i[t+A];for(A+=D,h=M&(1<<-x)-1,M>>=-x,x+=f;x>0;h=256*h+i[t+A],A+=D,x-=8);for(d=h&(1<<-x)-1,h>>=-x,x+=a;x>0;d=256*d+i[t+A],A+=D,x-=8);if(h===0)h=1-v;else{if(h===g)return d?NaN:1/0*(M?-1:1);d+=Math.pow(2,a),h-=v}return(M?-1:1)*d*Math.pow(2,h-a)},Yh=function(i,t,r,a,l,h){var d,f,g,v=8*h-l-1,x=(1<>1,D=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=a?0:h-1,z=a?1:-1,B=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(f=isNaN(t)?1:0,d=x):(d=Math.floor(Math.log(t)/Math.LN2),t*(g=Math.pow(2,-d))<1&&(d--,g*=2),(t+=d+A>=1?D/g:D*Math.pow(2,1-A))*g>=2&&(d++,g/=2),d+A>=x?(f=0,d=x):d+A>=1?(f=(t*g-1)*Math.pow(2,l),d+=A):(f=t*Math.pow(2,A-1)*Math.pow(2,l),d=0));l>=8;i[r+M]=255&f,M+=z,f/=256,l-=8);for(d=d<0;i[r+M]=255&d,M+=z,d/=256,v-=8);i[r+M-z]|=128*B};function Xt(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}Xt.Varint=0,Xt.Fixed64=1,Xt.Bytes=2,Xt.Fixed32=5;var Ac=4294967296,Qh=1/Ac,ep=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function zn(i){return i.type===Xt.Bytes?i.readVarint()+i.pos:i.pos+1}function Rs(i,t,r){return r?4294967296*t+(i>>>0):4294967296*(t>>>0)+(i>>>0)}function tp(i,t,r){var a=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));r.realloc(a);for(var l=r.pos-1;l>=i;l--)r.buf[l+a]=r.buf[l]}function Yf(i,t){for(var r=0;r>>8,i[r+2]=t>>>16,i[r+3]=t>>>24}function ip(i,t){return(i[t]|i[t+1]<<8|i[t+2]<<16)+(i[t+3]<<24)}Xt.prototype={destroy:function(){this.buf=null},readFields:function(i,t,r){for(r=r||this.length;this.pos>3,h=this.pos;this.type=7&a,i(l,t,this),this.pos===h&&this.skip(a)}return t},readMessage:function(i,t){return this.readFields(i,t,this.readVarint()+this.pos)},readFixed32:function(){var i=cu(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=ip(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=cu(this.buf,this.pos)+cu(this.buf,this.pos+4)*Ac;return this.pos+=8,i},readSFixed64:function(){var i=cu(this.buf,this.pos)+ip(this.buf,this.pos+4)*Ac;return this.pos+=8,i},readFloat:function(){var i=Kh(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Kh(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var t,r,a=this.buf;return t=127&(r=a[this.pos++]),r<128?t:(t|=(127&(r=a[this.pos++]))<<7,r<128?t:(t|=(127&(r=a[this.pos++]))<<14,r<128?t:(t|=(127&(r=a[this.pos++]))<<21,r<128?t:function(l,h,d){var f,g,v=d.buf;if(f=(112&(g=v[d.pos++]))>>4,g<128||(f|=(127&(g=v[d.pos++]))<<3,g<128)||(f|=(127&(g=v[d.pos++]))<<10,g<128)||(f|=(127&(g=v[d.pos++]))<<17,g<128)||(f|=(127&(g=v[d.pos++]))<<24,g<128)||(f|=(1&(g=v[d.pos++]))<<31,g<128))return Rs(l,f,h);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(r=a[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var i=this.readVarint()+this.pos,t=this.pos;return this.pos=i,i-t>=12&&ep?function(r,a,l){return ep.decode(r.subarray(a,l))}(this.buf,t,i):function(r,a,l){for(var h="",d=a;d239?4:x>223?3:x>191?2:1;if(d+D>l)break;D===1?x<128&&(A=x):D===2?(192&(f=r[d+1]))==128&&(A=(31&x)<<6|63&f)<=127&&(A=null):D===3?(g=r[d+2],(192&(f=r[d+1]))==128&&(192&g)==128&&((A=(15&x)<<12|(63&f)<<6|63&g)<=2047||A>=55296&&A<=57343)&&(A=null)):D===4&&(g=r[d+2],v=r[d+3],(192&(f=r[d+1]))==128&&(192&g)==128&&(192&v)==128&&((A=(15&x)<<18|(63&f)<<12|(63&g)<<6|63&v)<=65535||A>=1114112)&&(A=null)),A===null?(A=65533,D=1):A>65535&&(A-=65536,h+=String.fromCharCode(A>>>10&1023|55296),A=56320|1023&A),h+=String.fromCharCode(A),d+=D}return h}(this.buf,t,i)},readBytes:function(){var i=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,i);return this.pos=i,t},readPackedVarint:function(i,t){if(this.type!==Xt.Bytes)return i.push(this.readVarint(t));var r=zn(this);for(i=i||[];this.pos127;);else if(t===Xt.Bytes)this.pos=this.readVarint()+this.pos;else if(t===Xt.Fixed32)this.pos+=4;else{if(t!==Xt.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(i,t){this.writeVarint(i<<3|t)},realloc:function(i){for(var t=this.length||16;t268435455||i<0?function(t,r){var a,l;if(t>=0?(a=t%4294967296|0,l=t/4294967296|0):(l=~(-t/4294967296),4294967295^(a=~(-t%4294967296))?a=a+1|0:(a=0,l=l+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(h,d,f){f.buf[f.pos++]=127&h|128,h>>>=7,f.buf[f.pos++]=127&h|128,h>>>=7,f.buf[f.pos++]=127&h|128,h>>>=7,f.buf[f.pos++]=127&h|128,f.buf[f.pos]=127&(h>>>=7)}(a,0,r),function(h,d){var f=(7&h)<<4;d.buf[d.pos++]|=f|((h>>>=3)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h)))))}(l,r)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(!!i)},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var t=this.pos;this.pos=function(a,l,h){for(var d,f,g=0;g55295&&d<57344){if(!f){d>56319||g+1===l.length?(a[h++]=239,a[h++]=191,a[h++]=189):f=d;continue}if(d<56320){a[h++]=239,a[h++]=191,a[h++]=189,f=d;continue}d=f-55296<<10|d-56320|65536,f=null}else f&&(a[h++]=239,a[h++]=191,a[h++]=189,f=null);d<128?a[h++]=d:(d<2048?a[h++]=d>>6|192:(d<65536?a[h++]=d>>12|224:(a[h++]=d>>18|240,a[h++]=d>>12&63|128),a[h++]=d>>6&63|128),a[h++]=63&d|128)}return h}(this.buf,i,this.pos);var r=this.pos-t;r>=128&&tp(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Yh(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Yh(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var t=i.length;this.writeVarint(t),this.realloc(t);for(var r=0;r=128&&tp(r,a,this),this.pos=r-1,this.writeVarint(a),this.pos+=a},writeMessage:function(i,t,r){this.writeTag(i,Xt.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(i,t){t.length&&this.writeMessage(i,Yf,t)},writePackedSVarint:function(i,t){t.length&&this.writeMessage(i,Qf,t)},writePackedBoolean:function(i,t){t.length&&this.writeMessage(i,im,t)},writePackedFloat:function(i,t){t.length&&this.writeMessage(i,em,t)},writePackedDouble:function(i,t){t.length&&this.writeMessage(i,tm,t)},writePackedFixed32:function(i,t){t.length&&this.writeMessage(i,rm,t)},writePackedSFixed32:function(i,t){t.length&&this.writeMessage(i,nm,t)},writePackedFixed64:function(i,t){t.length&&this.writeMessage(i,am,t)},writePackedSFixed64:function(i,t){t.length&&this.writeMessage(i,sm,t)},writeBytesField:function(i,t){this.writeTag(i,Xt.Bytes),this.writeBytes(t)},writeFixed32Field:function(i,t){this.writeTag(i,Xt.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(i,t){this.writeTag(i,Xt.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(i,t){this.writeTag(i,Xt.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(i,t){this.writeTag(i,Xt.Fixed64),this.writeSFixed64(t)},writeVarintField:function(i,t){this.writeTag(i,Xt.Varint),this.writeVarint(t)},writeSVarintField:function(i,t){this.writeTag(i,Xt.Varint),this.writeSVarint(t)},writeStringField:function(i,t){this.writeTag(i,Xt.Bytes),this.writeString(t)},writeFloatField:function(i,t){this.writeTag(i,Xt.Fixed32),this.writeFloat(t)},writeDoubleField:function(i,t){this.writeTag(i,Xt.Fixed64),this.writeDouble(t)},writeBooleanField:function(i,t){this.writeVarintField(i,!!t)}};var Ec=ue(Jh);let Tc=3;function om(i,t,r){i===1&&r.readMessage(lm,t)}function lm(i,t,r){if(i===3){let{id:a,bitmap:l,width:h,height:d,left:f,top:g,advance:v}=r.readMessage(um,{});t.push({id:a,bitmap:new Go({width:h+2*Tc,height:d+2*Tc},l),metrics:{width:h,height:d,left:f,top:g,advance:v}})}}function um(i,t,r){i===1?t.id=r.readVarint():i===2?t.bitmap=r.readBytes():i===3?t.width=r.readVarint():i===4?t.height=r.readVarint():i===5?t.left=r.readSVarint():i===6?t.top=r.readSVarint():i===7&&(t.advance=r.readVarint())}let rp=Tc;function np(i){let t=0,r=0;for(let d of i)t+=d.w*d.h,r=Math.max(r,d.w);i.sort((d,f)=>f.h-d.h);let a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}],l=0,h=0;for(let d of i)for(let f=a.length-1;f>=0;f--){let g=a[f];if(!(d.w>g.w||d.h>g.h)){if(d.x=g.x,d.y=g.y,h=Math.max(h,d.y+d.h),l=Math.max(l,d.x+d.w),d.w===g.w&&d.h===g.h){let v=a.pop();f=0&&a>=t&&pu[this.text.charCodeAt(a)];a--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)}substring(t,r){let a=new Os;return a.text=this.text.substring(t,r),a.sectionIndex=this.sectionIndex.slice(t,r),a.sections=this.sections,a}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,r)=>Math.max(t,this.sections[r].scale),0)}addTextSection(t,r){this.text+=t.text,this.sections.push(el.forText(t.scale,t.fontStack||r));let a=this.sections.length-1;for(let l=0;l=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function hu(i,t,r,a,l,h,d,f,g,v,x,A,D,M,z){let B=Os.fromFeature(i,l),q;A===E.ah.vertical&&B.verticalizePunctuation();let{processBidirectionalText:$,processStyledBidirectionalText:ne}=dr;if($&&B.sections.length===1){q=[];let ce=$(B.toString(),Dc(B,v,h,t,a,M));for(let _e of ce){let Oe=new Os;Oe.text=_e,Oe.sections=B.sections;for(let it=0;it<_e.length;it++)Oe.sectionIndex.push(0);q.push(Oe)}}else if(ne){q=[];let ce=ne(B.text,B.sectionIndex,Dc(B,v,h,t,a,M));for(let _e of ce){let Oe=new Os;Oe.text=_e[0],Oe.sectionIndex=_e[1],Oe.sections=B.sections,q.push(Oe)}}else q=function(ce,_e){let Oe=[],it=ce.text,Le=0;for(let Me of _e)Oe.push(ce.substring(Le,Me)),Le=Me;return Le0&&Bn>Ni&&(Ni=Bn)}else{let jr=Oe[Ot.fontStack],Mi=jr&&jr[ai];if(Mi&&Mi.rect)Us=Mi.rect,pi=Mi.metrics;else{let Bn=_e[Ot.fontStack],sl=Bn&&Bn[ai];if(!sl)continue;pi=sl.metrics}Cr=(Di-Ot.scale)*wi}Kr?(ce.verticalizable=!0,ar.push({glyph:ai,imageName:dn,x:lt,y:Jt+Cr,vertical:Kr,scale:Ot.scale,fontStack:Ot.fontStack,sectionIndex:Qt,metrics:pi,rect:Us}),lt+=fn*Ot.scale+de):(ar.push({glyph:ai,imageName:dn,x:lt,y:Jt+Cr,vertical:Kr,scale:Ot.scale,fontStack:Ot.fontStack,sectionIndex:Qt,metrics:pi,rect:Us}),lt+=pi.advance*Ot.scale+de)}ar.length!==0&&(Wt=Math.max(lt-de,Wt),dm(ar,0,ar.length-1,Jr,Ni)),lt=0;let Ur=Me*Di+Ni;Oi.lineOffset=Math.max(Ni,Gi),Jt+=Ur,Ti=Math.max(Ur,Ti),++Fi}var Ci;let ir=Jt-Qo,{horizontalAlign:rr,verticalAlign:nr}=Sc(We);(function(mi,Di,Gi,Oi,ar,Ni,Ur,gr,Ot){let Qt=(Di-Gi)*ar,ai=0;ai=Ni!==Ur?-gr*Oi-Qo:(-Oi*Ot+.5)*Ur;for(let Cr of mi)for(let pi of Cr.positionedGlyphs)pi.x+=Qt,pi.y+=ai})(ce.positionedLines,Jr,rr,nr,Wt,Ti,Me,ir,Le.length),ce.top+=-nr*ir,ce.bottom=ce.top+ir,ce.left+=-rr*Wt,ce.right=ce.left+Wt}(ie,t,r,a,q,d,f,g,A,v,D,z),!function(ce){for(let _e of ce)if(_e.positionedGlyphs.length!==0)return!1;return!0}(K)&&ie}let pu={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},cm={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},hm={40:!0};function sp(i,t,r,a,l,h){if(t.imageName){let d=a[t.imageName];return d?d.displaySize[0]*t.scale*wi/h+l:0}{let d=r[t.fontStack],f=d&&d[i];return f?f.metrics.advance*t.scale+l:0}}function op(i,t,r,a){let l=Math.pow(i-t,2);return a?i=0,v=0;for(let A=0;Av){let x=Math.ceil(h/v);l*=x/d,d=x}return{x1:a,y1:l,x2:a+h,y2:l+d}}function hp(i,t,r,a,l,h){let d=i.image,f;if(d.content){let q=d.content,$=d.pixelRatio||1;f=[q[0]/$,q[1]/$,d.displaySize[0]-q[2]/$,d.displaySize[1]-q[3]/$]}let g=t.left*h,v=t.right*h,x,A,D,M;r==="width"||r==="both"?(M=l[0]+g-a[3],A=l[0]+v+a[1]):(M=l[0]+(g+v-d.displaySize[0])/2,A=M+d.displaySize[0]);let z=t.top*h,B=t.bottom*h;return r==="height"||r==="both"?(x=l[1]+z-a[0],D=l[1]+B+a[2]):(x=l[1]+(z+B-d.displaySize[1])/2,D=x+d.displaySize[1]),{image:d,top:x,right:A,bottom:D,left:M,collisionPadding:f}}let tl=255,pn=128,ga=tl*pn;function pp(i,t){let{expression:r}=t;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new ti(i+1))};if(r.kind==="source")return{kind:"source"};{let{zoomStops:a,interpolationType:l}=r,h=0;for(;hd.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=hc([]),this.placementViewportMatrix=hc([]);let r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=pp(this.zoom,r["text-size"]),this.iconSizeData=pp(this.zoom,r["icon-size"]);let a=this.layers[0].layout,l=a.get("symbol-sort-key"),h=a.get("symbol-z-order");this.canOverlap=Ic(a,"text-overlap","text-allow-overlap")!=="never"||Ic(a,"icon-overlap","icon-allow-overlap")!=="never"||a.get("text-ignore-placement")||a.get("icon-ignore-placement"),this.sortFeaturesByKey=h!=="viewport-y"&&!l.isConstant(),this.sortFeaturesByY=(h==="viewport-y"||h==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,a.get("symbol-placement")==="point"&&(this.writingModes=a.get("text-writing-mode").map(d=>E.ah[d])),this.stateDependentLayerIds=this.layers.filter(d=>d.isStateDependent()).map(d=>d.id),this.sourceID=t.sourceID}createArrays(){this.text=new Mc(new Ua(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new Mc(new Ua(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new ri,this.lineVertexArray=new zi,this.symbolInstances=new Dt,this.textAnchorOffsets=new ni}calculateGlyphDependencies(t,r,a,l,h){for(let d=0;d0)&&(d.value.kind!=="constant"||d.value.value.length>0),x=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,A=h.get("symbol-sort-key");if(this.features=[],!v&&!x)return;let D=r.iconDependencies,M=r.glyphDependencies,z=r.availableImages,B=new ti(this.zoom);for(let{feature:q,id:$,index:ne,sourceLayerIndex:K}of t){let ie=l._featureFilter.needGeometry,ce=$a(q,ie);if(!l._featureFilter.filter(B,ce,a))continue;let _e,Oe;if(ie||(ce.geometry=ja(q)),v){let Le=l.getValueAndResolveTokens("text-field",ce,a,z),Me=ur.factory(Le),We=this.hasRTLText=this.hasRTLText||_m(Me);(!We||dr.getRTLTextPluginStatus()==="unavailable"||We&&dr.isParsed())&&(_e=Kf(Me,l,ce))}if(x){let Le=l.getValueAndResolveTokens("icon-image",ce,a,z);Oe=Le instanceof hr?Le:hr.fromString(Le)}if(!_e&&!Oe)continue;let it=this.sortFeaturesByKey?A.evaluate(ce,{},a):void 0;if(this.features.push({id:$,text:_e,icon:Oe,index:ne,sourceLayerIndex:K,geometry:ce.geometry,properties:q.properties,type:mm[q.type],sortKey:it}),Oe&&(D[Oe.name]=!0),_e){let Le=d.evaluate(ce,{},a).join(","),Me=h.get("text-rotation-alignment")!=="viewport"&&h.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(E.ah.vertical)>=0;for(let We of _e.sections)if(We.image)D[We.image.name]=!0;else{let je=Fo(_e.toString()),Ve=We.fontStack||Le,de=M[Ve]=M[Ve]||{};this.calculateGlyphDependencies(We.text,de,Me,this.allowVerticalPlacement,je)}}}h.get("symbol-placement")==="line"&&(this.features=function(q){let $={},ne={},K=[],ie=0;function ce(Le){K.push(q[Le]),ie++}function _e(Le,Me,We){let je=ne[Le];return delete ne[Le],ne[Me]=je,K[je].geometry[0].pop(),K[je].geometry[0]=K[je].geometry[0].concat(We[0]),je}function Oe(Le,Me,We){let je=$[Me];return delete $[Me],$[Le]=je,K[je].geometry[0].shift(),K[je].geometry[0]=We[0].concat(K[je].geometry[0]),je}function it(Le,Me,We){let je=We?Me[0][Me[0].length-1]:Me[0][0];return`${Le}:${je.x}:${je.y}`}for(let Le=0;LeLe.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((q,$)=>q.sortKey-$.sortKey)}update(t,r,a){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,r,this.layers,a),this.icon.programConfigurations.updatePaintArrays(t,r,this.layers,a))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,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(t,r){let a=this.lineVertexArray.length;if(t.segment!==void 0){let l=t.dist(r[t.segment+1]),h=t.dist(r[t.segment]),d={};for(let f=t.segment+1;f=0;f--)d[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:h},f>0&&(h+=r[f-1].dist(r[f]));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(t,r){let a=t.placedSymbolArray.get(r),l=a.vertexStartIndex+4*a.numGlyphs;for(let h=a.vertexStartIndex;hl[f]-l[g]||h[g]-h[f]),d}addToSortKeyRanges(t,r){let a=this.sortKeyRanges[this.sortKeyRanges.length-1];a&&a.sortKey===r?a.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let r of this.symbolInstanceIndexes){let a=this.symbolInstances.get(r);this.featureSortOrder.push(a.featureIndex),[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex].forEach((l,h,d)=>{l>=0&&d.indexOf(l)===h&&this.addIndicesForPlacedSymbol(this.text,l)}),a.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,a.verticalPlacedTextSymbolIndex),a.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.placedIconSymbolIndex),a.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let dp,fp;Ue("SymbolBucket",Ns,{omit:["layers","collisionBoxArray","features","compareText"]}),Ns.MAX_GLYPHS=65535,Ns.addDynamicAttributes=kc;var zc={get paint(){return fp=fp||new c({"icon-opacity":new rt(oe.paint_symbol["icon-opacity"]),"icon-color":new rt(oe.paint_symbol["icon-color"]),"icon-halo-color":new rt(oe.paint_symbol["icon-halo-color"]),"icon-halo-width":new rt(oe.paint_symbol["icon-halo-width"]),"icon-halo-blur":new rt(oe.paint_symbol["icon-halo-blur"]),"icon-translate":new Ze(oe.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ze(oe.paint_symbol["icon-translate-anchor"]),"text-opacity":new rt(oe.paint_symbol["text-opacity"]),"text-color":new rt(oe.paint_symbol["text-color"],{runtimeType:Si,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new rt(oe.paint_symbol["text-halo-color"]),"text-halo-width":new rt(oe.paint_symbol["text-halo-width"]),"text-halo-blur":new rt(oe.paint_symbol["text-halo-blur"]),"text-translate":new Ze(oe.paint_symbol["text-translate"]),"text-translate-anchor":new Ze(oe.paint_symbol["text-translate-anchor"])})},get layout(){return dp=dp||new c({"symbol-placement":new Ze(oe.layout_symbol["symbol-placement"]),"symbol-spacing":new Ze(oe.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ze(oe.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new rt(oe.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ze(oe.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ze(oe.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ze(oe.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ze(oe.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ze(oe.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ze(oe.layout_symbol["icon-rotation-alignment"]),"icon-size":new rt(oe.layout_symbol["icon-size"]),"icon-text-fit":new Ze(oe.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ze(oe.layout_symbol["icon-text-fit-padding"]),"icon-image":new rt(oe.layout_symbol["icon-image"]),"icon-rotate":new rt(oe.layout_symbol["icon-rotate"]),"icon-padding":new rt(oe.layout_symbol["icon-padding"]),"icon-keep-upright":new Ze(oe.layout_symbol["icon-keep-upright"]),"icon-offset":new rt(oe.layout_symbol["icon-offset"]),"icon-anchor":new rt(oe.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ze(oe.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ze(oe.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ze(oe.layout_symbol["text-rotation-alignment"]),"text-field":new rt(oe.layout_symbol["text-field"]),"text-font":new rt(oe.layout_symbol["text-font"]),"text-size":new rt(oe.layout_symbol["text-size"]),"text-max-width":new rt(oe.layout_symbol["text-max-width"]),"text-line-height":new Ze(oe.layout_symbol["text-line-height"]),"text-letter-spacing":new rt(oe.layout_symbol["text-letter-spacing"]),"text-justify":new rt(oe.layout_symbol["text-justify"]),"text-radial-offset":new rt(oe.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ze(oe.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new rt(oe.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new rt(oe.layout_symbol["text-anchor"]),"text-max-angle":new Ze(oe.layout_symbol["text-max-angle"]),"text-writing-mode":new Ze(oe.layout_symbol["text-writing-mode"]),"text-rotate":new rt(oe.layout_symbol["text-rotate"]),"text-padding":new Ze(oe.layout_symbol["text-padding"]),"text-keep-upright":new Ze(oe.layout_symbol["text-keep-upright"]),"text-transform":new rt(oe.layout_symbol["text-transform"]),"text-offset":new rt(oe.layout_symbol["text-offset"]),"text-allow-overlap":new Ze(oe.layout_symbol["text-allow-overlap"]),"text-overlap":new Ze(oe.layout_symbol["text-overlap"]),"text-ignore-placement":new Ze(oe.layout_symbol["text-ignore-placement"]),"text-optional":new Ze(oe.layout_symbol["text-optional"])})}};class mp{constructor(t){if(t.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:Pr,this.defaultValue=t}evaluate(t){if(t.formattedSection){let r=this.defaultValue.property.overrides;if(r&&r.hasOverride(t.formattedSection))return r.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Ue("FormatSectionOverride",mp,{omit:["defaultValue"]});class fu extends n{constructor(t){super(t,zc)}recalculate(t,r){if(super.recalculate(t,r),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"){let a=this.layout.get("text-writing-mode");if(a){let l=[];for(let h of a)l.indexOf(h)<0&&l.push(h);this.layout._values["text-writing-mode"]=l}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,r,a,l){let h=this.layout.get(t).evaluate(r,{},a,l),d=this._unevaluatedLayout._values[t];return d.isDataDriven()||ps(d.value)||!h?h:function(f,g){return g.replace(/{([^{}]+)}/g,(v,x)=>f&&x in f?String(f[x]):"")}(r.properties,h)}createBucket(t){return new Ns(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let t of zc.paint.overridableProperties){if(!fu.hasPaintOverride(this.layout,t))continue;let r=this.paint.get(t),a=new mp(r),l=new hs(a,r.property.specification),h=null;h=r.value.kind==="constant"||r.value.kind==="source"?new Yn("source",l):new Qn("composite",l,r.value.zoomStops),this.paint._values[t]=new Xr(r.property,h,r.parameters)}}_handleOverridablePaintPropertyUpdate(t,r,a){return!(!this.layout||r.isDataDriven()||a.isDataDriven())&&fu.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,r){let a=t.get("text-field"),l=zc.paint.properties[r],h=!1,d=f=>{for(let g of f)if(l.overrides&&l.overrides.hasOverride(g))return void(h=!0)};if(a.value.kind==="constant"&&a.value.value instanceof ur)d(a.value.value.sections);else if(a.value.kind==="source"){let f=v=>{h||(v instanceof zr&&vi(v.value)===yr?d(v.value.sections):v instanceof is?d(v.sections):v.eachChild(f))},g=a.value;g._styleExpression&&f(g._styleExpression.expression)}return h}}let gp;var ym={get paint(){return gp=gp||new c({"background-color":new Ze(oe.paint_background["background-color"]),"background-pattern":new Ts(oe.paint_background["background-pattern"]),"background-opacity":new Ze(oe.paint_background["background-opacity"])})}};class vm extends n{constructor(t){super(t,ym)}}let _p;var xm={get paint(){return _p=_p||new c({"raster-opacity":new Ze(oe.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ze(oe.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ze(oe.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ze(oe.paint_raster["raster-brightness-max"]),"raster-saturation":new Ze(oe.paint_raster["raster-saturation"]),"raster-contrast":new Ze(oe.paint_raster["raster-contrast"]),"raster-resampling":new Ze(oe.paint_raster["raster-resampling"]),"raster-fade-duration":new Ze(oe.paint_raster["raster-fade-duration"])})}};class bm extends n{constructor(t){super(t,xm)}}class wm extends n{constructor(t){super(t,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=t}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 Am{constructor(t){this._methodToThrottle=t,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=()=>{}}}let Bc=63710088e-1;class _a{constructor(t,r){if(isNaN(t)||isNaN(r))throw new Error(`Invalid LngLat object: (${t}, ${r})`);if(this.lng=+t,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new _a(Fe(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){let r=Math.PI/180,a=this.lat*r,l=t.lat*r,h=Math.sin(a)*Math.sin(l)+Math.cos(a)*Math.cos(l)*Math.cos((t.lng-this.lng)*r);return Bc*Math.acos(Math.min(h,1))}static convert(t){if(t instanceof _a)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new _a(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new _a(Number("lng"in t?t.lng:t.lon),Number(t.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 [, ]")}}let yp=2*Math.PI*Bc;function vp(i){return yp*Math.cos(i*Math.PI/180)}function xp(i){return(180+i)/360}function bp(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function wp(i,t){return i/vp(t)}function Lc(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class il{constructor(t,r,a=0){this.x=+t,this.y=+r,this.z=+a}static fromLngLat(t,r=0){let a=_a.convert(t);return new il(xp(a.lng),bp(a.lat),wp(r,a.lat))}toLngLat(){return new _a(360*this.x-180,Lc(this.y))}toAltitude(){return this.z*vp(Lc(this.y))}meterInMercatorCoordinateUnits(){return 1/yp*(t=Lc(this.y),1/Math.cos(t*Math.PI/180));var t}}function Ap(i,t,r){var a=2*Math.PI*6378137/256/Math.pow(2,r);return[i*a-2*Math.PI*6378137/2,t*a-2*Math.PI*6378137/2]}class Rc{constructor(t,r,a){if(!function(l,h,d){return!(l<0||l>25||d<0||d>=Math.pow(2,l)||h<0||h>=Math.pow(2,l))}(t,r,a))throw new Error(`x=${r}, y=${a}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=r,this.y=a,this.key=rl(0,t,t,r,a)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,r,a){let l=(d=this.y,f=this.z,g=Ap(256*(h=this.x),256*(d=Math.pow(2,f)-d-1),f),v=Ap(256*(h+1),256*(d+1),f),g[0]+","+g[1]+","+v[0]+","+v[1]);var h,d,f,g,v;let x=function(A,D,M){let z,B="";for(let q=A;q>0;q--)z=1<1?"@2x":"").replace(/{quadkey}/g,x).replace(/{bbox-epsg-3857}/g,l)}isChildOf(t){let r=this.z-t.z;return r>0&&t.x===this.x>>r&&t.y===this.y>>r}getTilePoint(t){let r=Math.pow(2,this.z);return new se((t.x*r-this.x)*xi,(t.y*r-this.y)*xi)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Ep{constructor(t,r){this.wrap=t,this.canonical=r,this.key=rl(t,r.z,r.z,r.x,r.y)}}class Vr{constructor(t,r,a,l,h){if(t= z; overscaledZ = ${t}; z = ${a}`);this.overscaledZ=t,this.wrap=r,this.canonical=new Rc(a,+l,+h),this.key=rl(r,t,a,l,h)}clone(){return new Vr(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);let r=this.canonical.z-t;return t>this.canonical.z?new Vr(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Vr(t,this.wrap,t,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(t,r){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);let a=this.canonical.z-t;return t>this.canonical.z?rl(this.wrap*+r,t,this.canonical.z,this.canonical.x,this.canonical.y):rl(this.wrap*+r,t,t,this.canonical.x>>a,this.canonical.y>>a)}isChildOf(t){if(t.wrap!==this.wrap)return!1;let r=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ>r&&t.canonical.y===this.canonical.y>>r}children(t){if(this.overscaledZ>=t)return[new Vr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,a=2*this.canonical.x,l=2*this.canonical.y;return[new Vr(r,this.wrap,r,a,l),new Vr(r,this.wrap,r,a+1,l),new Vr(r,this.wrap,r,a,l+1),new Vr(r,this.wrap,r,a+1,l+1)]}isLessThan(t){return this.wrapt.wrap)&&(this.overscaledZt.overscaledZ)&&(this.canonical.xt.canonical.x)&&this.canonical.ythis.max&&(this.max=A),A=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(t+1)}unpack(t,r,a){return t*this.redFactor+r*this.greenFactor+a*this.blueFactor-this.baseShift}getPixels(){return new qr({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,r,a){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let l=r*this.dim,h=r*this.dim+this.dim,d=a*this.dim,f=a*this.dim+this.dim;switch(r){case-1:l=h-1;break;case 1:h=l+1}switch(a){case-1:d=f-1;break;case 1:f=d+1}let g=-r*this.dim,v=-a*this.dim;for(let x=d;x=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class Dp{constructor(t,r,a,l,h){this.type="Feature",this._vectorTileFeature=t,t._z=r,t._x=a,t._y=l,this.properties=t.properties,this.id=h}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(t){this._geometry=t}toJSON(){let t={geometry:this.geometry};for(let r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(t[r]=this[r]);return t}}class Sp{constructor(t,r){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new ra(xi,16,0),this.grid3D=new ra(xi,16,0),this.featureIndexArray=new $i,this.promoteId=r}insert(t,r,a,l,h,d){let f=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(a,l,h);let g=d?this.grid3D:this.grid;for(let v=0;v=0&&A[3]>=0&&g.insert(f,A[0],A[1],A[2],A[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new fa.VectorTile(new Ec(this.rawTileData)).layers,this.sourceLayerCoder=new Cp(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,r,a,l){this.loadVTLayers();let h=t.params||{},d=xi/t.tileSize/t.scale,f=wo(h.filter),g=t.queryGeometry,v=t.queryPadding*d,x=kp(g),A=this.grid.query(x.minX-v,x.minY-v,x.maxX+v,x.maxY+v),D=kp(t.cameraQueryGeometry),M=this.grid3D.query(D.minX-v,D.minY-v,D.maxX+v,D.maxY+v,(q,$,ne,K)=>function(ie,ce,_e,Oe,it){for(let Me of ie)if(ce<=Me.x&&_e<=Me.y&&Oe>=Me.x&&it>=Me.y)return!0;let Le=[new se(ce,_e),new se(ce,it),new se(Oe,it),new se(Oe,_e)];if(ie.length>2){for(let Me of Le)if(Ps(ie,Me))return!0}for(let Me=0;Me(K||(K=ja(ie)),ce.queryIntersectsFeature(g,ie,_e,K,this.z,t.transform,d,t.pixelPosMatrix)))}return z}loadMatchingFeature(t,r,a,l,h,d,f,g,v,x,A){let D=this.bucketLayerIDs[r];if(d&&!function(q,$){for(let ne=0;ne=0)return!0;return!1}(d,D))return;let M=this.sourceLayerCoder.decode(a),z=this.vtLayers[M].feature(l);if(h.needGeometry){let q=$a(z,!0);if(!h.filter(new ti(this.tileID.overscaledZ),q,this.tileID.canonical))return}else if(!h.filter(new ti(this.tileID.overscaledZ),z))return;let B=this.getId(z,M);for(let q=0;q{let f=t instanceof Na?t.get(d):null;return f&&f.evaluate?f.evaluate(r,a,l):f})}function kp(i){let t=1/0,r=1/0,a=-1/0,l=-1/0;for(let h of i)t=Math.min(t,h.x),r=Math.min(r,h.y),a=Math.max(a,h.x),l=Math.max(l,h.y);return{minX:t,minY:r,maxX:a,maxY:l}}function Em(i,t){return t-i}function Mp(i,t,r,a,l){let h=[];for(let d=0;d=a&&A.x>=a||(x.x>=a?x=new se(a,x.y+(a-x.x)/(A.x-x.x)*(A.y-x.y))._round():A.x>=a&&(A=new se(a,x.y+(a-x.x)/(A.x-x.x)*(A.y-x.y))._round()),x.y>=l&&A.y>=l||(x.y>=l?x=new se(x.x+(l-x.y)/(A.y-x.y)*(A.x-x.x),l)._round():A.y>=l&&(A=new se(x.x+(l-x.y)/(A.y-x.y)*(A.x-x.x),l)._round()),g&&x.equals(g[g.length-1])||(g=[x],h.push(g)),g.push(A)))))}}return h}Ue("FeatureIndex",Sp,{omit:["rawTileData","sourceLayerCoder"]});class ya extends se{constructor(t,r,a,l){super(t,r),this.angle=a,l!==void 0&&(this.segment=l)}clone(){return new ya(this.x,this.y,this.angle,this.segment)}}function Pp(i,t,r,a,l){if(t.segment===void 0||r===0)return!0;let h=t,d=t.segment+1,f=0;for(;f>-r/2;){if(d--,d<0)return!1;f-=i[d].dist(h),h=i[d]}f+=i[d].dist(i[d+1]),d++;let g=[],v=0;for(;fa;)v-=g.shift().angleDelta;if(v>l)return!1;d++,f+=x.dist(A)}return!0}function zp(i){let t=0;for(let r=0;rv){let z=(v-g)/M,B=Yi.number(A.x,D.x,z),q=Yi.number(A.y,D.y,z),$=new ya(B,q,D.angleTo(A),x);return $._round(),!d||Pp(i,$,f,d,t)?$:void 0}g+=M}}function Cm(i,t,r,a,l,h,d,f,g){let v=Bp(a,h,d),x=Lp(a,l),A=x*d,D=i[0].x===0||i[0].x===g||i[0].y===0||i[0].y===g;return t-A=0&&ie=0&&ce=0&&D+v<=x){let _e=new ya(ie,ce,ne,z);_e._round(),a&&!Pp(i,_e,h,a,l)||M.push(_e)}}A+=$}return f||M.length||d||(M=Rp(i,A/2,r,a,l,h,d,!0,g)),M}Ue("Anchor",ya);let qs=mr;function Fp(i,t,r,a){let l=[],h=i.image,d=h.pixelRatio,f=h.paddedRect.w-2*qs,g=h.paddedRect.h-2*qs,v={x1:i.left,y1:i.top,x2:i.right,y2:i.bottom},x=h.stretchX||[[0,f]],A=h.stretchY||[[0,g]],D=(de,Je)=>de+Je[1]-Je[0],M=x.reduce(D,0),z=A.reduce(D,0),B=f-M,q=g-z,$=0,ne=M,K=0,ie=z,ce=0,_e=B,Oe=0,it=q;if(h.content&&a){let de=h.content,Je=de[2]-de[0],He=de[3]-de[1];(h.textFitWidth||h.textFitHeight)&&(v=cp(i)),$=mu(x,0,de[0]),K=mu(A,0,de[1]),ne=mu(x,de[0],de[2]),ie=mu(A,de[1],de[3]),ce=de[0]-$,Oe=de[1]-K,_e=Je-ne,it=He-ie}let Le=v.x1,Me=v.y1,We=v.x2-Le,je=v.y2-Me,Ve=(de,Je,He,lt)=>{let Jt=gu(de.stretch-$,ne,We,Le),Wt=_u(de.fixed-ce,_e,de.stretch,M),Ti=gu(Je.stretch-K,ie,je,Me),Jr=_u(Je.fixed-Oe,it,Je.stretch,z),Fi=gu(He.stretch-$,ne,We,Le),Ci=_u(He.fixed-ce,_e,He.stretch,M),ir=gu(lt.stretch-K,ie,je,Me),rr=_u(lt.fixed-Oe,it,lt.stretch,z),nr=new se(Jt,Ti),mi=new se(Fi,Ti),Di=new se(Fi,ir),Gi=new se(Jt,ir),Oi=new se(Wt/d,Jr/d),ar=new se(Ci/d,rr/d),Ni=t*Math.PI/180;if(Ni){let Ot=Math.sin(Ni),Qt=Math.cos(Ni),ai=[Qt,-Ot,Ot,Qt];nr._matMult(ai),mi._matMult(ai),Gi._matMult(ai),Di._matMult(ai)}let Ur=de.stretch+de.fixed,gr=Je.stretch+Je.fixed;return{tl:nr,tr:mi,bl:Gi,br:Di,tex:{x:h.paddedRect.x+qs+Ur,y:h.paddedRect.y+qs+gr,w:He.stretch+He.fixed-Ur,h:lt.stretch+lt.fixed-gr},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Oi,pixelOffsetBR:ar,minFontScaleX:_e/d/We,minFontScaleY:it/d/je,isSDF:r}};if(a&&(h.stretchX||h.stretchY)){let de=Op(x,B,M),Je=Op(A,q,z);for(let He=0;He0&&(B=Math.max(10,B),this.circleDiameter=B)}else{let D=!((A=d.image)===null||A===void 0)&&A.content&&(d.image.textFitWidth||d.image.textFitHeight)?cp(d):{x1:d.left,y1:d.top,x2:d.right,y2:d.bottom};D.y1=D.y1*f-g[0],D.y2=D.y2*f+g[2],D.x1=D.x1*f-g[3],D.x2=D.x2*f+g[1];let M=d.collisionPadding;if(M&&(D.x1-=M[0]*f,D.y1-=M[1]*f,D.x2+=M[2]*f,D.y2+=M[3]*f),x){let z=new se(D.x1,D.y1),B=new se(D.x2,D.y1),q=new se(D.x1,D.y2),$=new se(D.x2,D.y2),ne=x*Math.PI/180;z._rotate(ne),B._rotate(ne),q._rotate(ne),$._rotate(ne),D.x1=Math.min(z.x,B.x,q.x,$.x),D.x2=Math.max(z.x,B.x,q.x,$.x),D.y1=Math.min(z.y,B.y,q.y,$.y),D.y2=Math.max(z.y,B.y,q.y,$.y)}t.emplaceBack(r.x,r.y,D.x1,D.y1,D.x2,D.y2,a,l,h)}this.boxEndIndex=t.length}}class Dm{constructor(t=[],r=(a,l)=>al?1:0){if(this.data=t,this.length=this.data.length,this.compare=r,this.length>0)for(let a=(this.length>>1)-1;a>=0;a--)this._down(a)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;let t=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:r,compare:a}=this,l=r[t];for(;t>0;){let h=t-1>>1,d=r[h];if(a(l,d)>=0)break;r[t]=d,t=h}r[t]=l}_down(t){let{data:r,compare:a}=this,l=this.length>>1,h=r[t];for(;t=0)break;r[t]=r[d],t=d}r[t]=h}}function Sm(i,t=1,r=!1){let a=1/0,l=1/0,h=-1/0,d=-1/0,f=i[0];for(let M=0;Mh)&&(h=z.x),(!M||z.y>d)&&(d=z.y)}let g=Math.min(h-a,d-l),v=g/2,x=new Dm([],Im);if(g===0)return new se(a,l);for(let M=a;MA.d||!A.d)&&(A=M,r&&console.log("found best %d after %d probes",Math.round(1e4*M.d)/1e4,D)),M.max-A.d<=t||(v=M.h/2,x.push(new Vs(M.p.x-v,M.p.y-v,v,i)),x.push(new Vs(M.p.x+v,M.p.y-v,v,i)),x.push(new Vs(M.p.x-v,M.p.y+v,v,i)),x.push(new Vs(M.p.x+v,M.p.y+v,v,i)),D+=4)}return r&&(console.log(`num probes: ${D}`),console.log(`best distance: ${A.d}`)),A.p}function Im(i,t){return t.max-i.max}function Vs(i,t,r,a){this.p=new se(i,t),this.h=r,this.d=function(l,h){let d=!1,f=1/0;for(let g=0;gl.y!=z.y>l.y&&l.x<(z.x-M.x)*(l.y-M.y)/(z.y-M.y)+M.x&&(d=!d),f=Math.min(f,bh(l,M,z))}}return(d?1:-1)*Math.sqrt(f)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}var Ri;E.aq=void 0,(Ri=E.aq||(E.aq={}))[Ri.center=1]="center",Ri[Ri.left=2]="left",Ri[Ri.right=3]="right",Ri[Ri.top=4]="top",Ri[Ri.bottom=5]="bottom",Ri[Ri["top-left"]=6]="top-left",Ri[Ri["top-right"]=7]="top-right",Ri[Ri["bottom-left"]=8]="bottom-left",Ri[Ri["bottom-right"]=9]="bottom-right";let va=7,Fc=Number.POSITIVE_INFINITY;function Np(i,t){return t[1]!==Fc?function(r,a,l){let h=0,d=0;switch(a=Math.abs(a),l=Math.abs(l),r){case"top-right":case"top-left":case"top":d=l-va;break;case"bottom-right":case"bottom-left":case"bottom":d=-l+va}switch(r){case"top-right":case"bottom-right":case"right":h=-a;break;case"top-left":case"bottom-left":case"left":h=a}return[h,d]}(i,t[0],t[1]):function(r,a){let l=0,h=0;a<0&&(a=0);let d=a/Math.SQRT2;switch(r){case"top-right":case"top-left":h=d-va;break;case"bottom-right":case"bottom-left":h=-d+va;break;case"bottom":h=-a+va;break;case"top":h=a-va}switch(r){case"top-right":case"bottom-right":l=-d;break;case"top-left":case"bottom-left":l=d;break;case"left":l=a;break;case"right":l=-a}return[l,h]}(i,t[0])}function qp(i,t,r){var a;let l=i.layout,h=(a=l.get("text-variable-anchor-offset"))===null||a===void 0?void 0:a.evaluate(t,{},r);if(h){let f=h.values,g=[];for(let v=0;vD*wi);x.startsWith("top")?A[1]-=va:x.startsWith("bottom")&&(A[1]+=va),g[v+1]=A}return new vr(g)}let d=l.get("text-variable-anchor");if(d){let f;f=i._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[l.get("text-radial-offset").evaluate(t,{},r)*wi,Fc]:l.get("text-offset").evaluate(t,{},r).map(v=>v*wi);let g=[];for(let v of d)g.push(v,Np(v,f));return new vr(g)}return null}function Oc(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function km(i,t,r,a,l,h,d,f,g,v,x){let A=h.textMaxSize.evaluate(t,{});A===void 0&&(A=d);let D=i.layers[0].layout,M=D.get("icon-offset").evaluate(t,{},x),z=Up(r.horizontal),B=d/24,q=i.tilePixelRatio*B,$=i.tilePixelRatio*A/24,ne=i.tilePixelRatio*f,K=i.tilePixelRatio*D.get("symbol-spacing"),ie=D.get("text-padding")*i.tilePixelRatio,ce=function(de,Je,He,lt=1){let Jt=de.get("icon-padding").evaluate(Je,{},He),Wt=Jt&&Jt.values;return[Wt[0]*lt,Wt[1]*lt,Wt[2]*lt,Wt[3]*lt]}(D,t,x,i.tilePixelRatio),_e=D.get("text-max-angle")/180*Math.PI,Oe=D.get("text-rotation-alignment")!=="viewport"&&D.get("symbol-placement")!=="point",it=D.get("icon-rotation-alignment")==="map"&&D.get("symbol-placement")!=="point",Le=D.get("symbol-placement"),Me=K/2,We=D.get("icon-text-fit"),je;a&&We!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(je=hp(a,r.vertical,We,D.get("icon-text-fit-padding"),M,B)),z&&(a=hp(a,z,We,D.get("icon-text-fit-padding"),M,B)));let Ve=(de,Je)=>{Je.x<0||Je.x>=xi||Je.y<0||Je.y>=xi||function(He,lt,Jt,Wt,Ti,Jr,Fi,Ci,ir,rr,nr,mi,Di,Gi,Oi,ar,Ni,Ur,gr,Ot,Qt,ai,Cr,pi,Us){let dn=He.addToLineVertexArray(lt,Jt),fn,Kr,jr,Mi,Bn=0,sl=0,Gp=0,Hp=0,Gc=-1,Hc=-1,Ln={},Xp=Ss("");if(He.allowVerticalPlacement&&Wt.vertical){let Hi=Ci.layout.get("text-rotate").evaluate(Qt,{},pi)+90;jr=new yu(ir,lt,rr,nr,mi,Wt.vertical,Di,Gi,Oi,Hi),Fi&&(Mi=new yu(ir,lt,rr,nr,mi,Fi,Ni,Ur,Oi,Hi))}if(Ti){let Hi=Ci.layout.get("icon-rotate").evaluate(Qt,{}),$r=Ci.layout.get("icon-text-fit")!=="none",Ga=Fp(Ti,Hi,Cr,$r),an=Fi?Fp(Fi,Hi,Cr,$r):void 0;Kr=new yu(ir,lt,rr,nr,mi,Ti,Ni,Ur,!1,Hi),Bn=4*Ga.length;let Ha=He.iconSizeData,mn=null;Ha.kind==="source"?(mn=[pn*Ci.layout.get("icon-size").evaluate(Qt,{})],mn[0]>ga&&Ie(`${He.layerIds[0]}: Value for "icon-size" is >= ${tl}. Reduce your "icon-size".`)):Ha.kind==="composite"&&(mn=[pn*ai.compositeIconSizes[0].evaluate(Qt,{},pi),pn*ai.compositeIconSizes[1].evaluate(Qt,{},pi)],(mn[0]>ga||mn[1]>ga)&&Ie(`${He.layerIds[0]}: Value for "icon-size" is >= ${tl}. Reduce your "icon-size".`)),He.addSymbols(He.icon,Ga,mn,Ot,gr,Qt,E.ah.none,lt,dn.lineStartIndex,dn.lineLength,-1,pi),Gc=He.icon.placedSymbolArray.length-1,an&&(sl=4*an.length,He.addSymbols(He.icon,an,mn,Ot,gr,Qt,E.ah.vertical,lt,dn.lineStartIndex,dn.lineLength,-1,pi),Hc=He.icon.placedSymbolArray.length-1)}let Wp=Object.keys(Wt.horizontal);for(let Hi of Wp){let $r=Wt.horizontal[Hi];if(!fn){Xp=Ss($r.text);let an=Ci.layout.get("text-rotate").evaluate(Qt,{},pi);fn=new yu(ir,lt,rr,nr,mi,$r,Di,Gi,Oi,an)}let Ga=$r.positionedLines.length===1;if(Gp+=Vp(He,lt,$r,Jr,Ci,Oi,Qt,ar,dn,Wt.vertical?E.ah.horizontal:E.ah.horizontalOnly,Ga?Wp:[Hi],Ln,Gc,ai,pi),Ga)break}Wt.vertical&&(Hp+=Vp(He,lt,Wt.vertical,Jr,Ci,Oi,Qt,ar,dn,E.ah.vertical,["vertical"],Ln,Hc,ai,pi));let zm=fn?fn.boxStartIndex:He.collisionBoxArray.length,Bm=fn?fn.boxEndIndex:He.collisionBoxArray.length,Lm=jr?jr.boxStartIndex:He.collisionBoxArray.length,Rm=jr?jr.boxEndIndex:He.collisionBoxArray.length,Fm=Kr?Kr.boxStartIndex:He.collisionBoxArray.length,Om=Kr?Kr.boxEndIndex:He.collisionBoxArray.length,Nm=Mi?Mi.boxStartIndex:He.collisionBoxArray.length,qm=Mi?Mi.boxEndIndex:He.collisionBoxArray.length,nn=-1,xu=(Hi,$r)=>Hi&&Hi.circleDiameter?Math.max(Hi.circleDiameter,$r):$r;nn=xu(fn,nn),nn=xu(jr,nn),nn=xu(Kr,nn),nn=xu(Mi,nn);let Jp=nn>-1?1:0;Jp&&(nn*=Us/wi),He.glyphOffsetArray.length>=Ns.MAX_GLYPHS&&Ie("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Qt.sortKey!==void 0&&He.addToSortKeyRanges(He.symbolInstances.length,Qt.sortKey);let Vm=qp(Ci,Qt,pi),[Um,jm]=function(Hi,$r){let Ga=Hi.length,an=$r?.values;if(an?.length>0)for(let Ha=0;Ha=0?Ln.right:-1,Ln.center>=0?Ln.center:-1,Ln.left>=0?Ln.left:-1,Ln.vertical||-1,Gc,Hc,Xp,zm,Bm,Lm,Rm,Fm,Om,Nm,qm,rr,Gp,Hp,Bn,sl,Jp,0,Di,nn,Um,jm)}(i,Je,de,r,a,l,je,i.layers[0],i.collisionBoxArray,t.index,t.sourceLayerIndex,i.index,q,[ie,ie,ie,ie],Oe,g,ne,ce,it,M,t,h,v,x,d)};if(Le==="line")for(let de of Mp(t.geometry,0,0,xi,xi)){let Je=Cm(de,K,_e,r.vertical||z,a,24,$,i.overscaling,xi);for(let He of Je)z&&Mm(i,z.text,Me,He)||Ve(de,He)}else if(Le==="line-center"){for(let de of t.geometry)if(de.length>1){let Je=Tm(de,_e,r.vertical||z,a,24,$);Je&&Ve(de,Je)}}else if(t.type==="Polygon")for(let de of ns(t.geometry,0)){let Je=Sm(de,16);Ve(de[0],new ya(Je.x,Je.y,0))}else if(t.type==="LineString")for(let de of t.geometry)Ve(de,new ya(de[0].x,de[0].y,0));else if(t.type==="Point")for(let de of t.geometry)for(let Je of de)Ve([Je],new ya(Je.x,Je.y,0))}function Vp(i,t,r,a,l,h,d,f,g,v,x,A,D,M,z){let B=function(ne,K,ie,ce,_e,Oe,it,Le){let Me=ce.layout.get("text-rotate").evaluate(Oe,{})*Math.PI/180,We=[];for(let je of K.positionedLines)for(let Ve of je.positionedGlyphs){if(!Ve.rect)continue;let de=Ve.rect||{},Je=rp+1,He=!0,lt=1,Jt=0,Wt=(_e||Le)&&Ve.vertical,Ti=Ve.metrics.advance*Ve.scale/2;if(Le&&K.verticalizable&&(Jt=je.lineOffset/2-(Ve.imageName?-(wi-Ve.metrics.width*Ve.scale)/2:(Ve.scale-1)*wi)),Ve.imageName){let Ot=it[Ve.imageName];He=Ot.sdf,lt=Ot.pixelRatio,Je=mr/lt}let Jr=_e?[Ve.x+Ti,Ve.y]:[0,0],Fi=_e?[0,0]:[Ve.x+Ti+ie[0],Ve.y+ie[1]-Jt],Ci=[0,0];Wt&&(Ci=Fi,Fi=[0,0]);let ir=Ve.metrics.isDoubleResolution?2:1,rr=(Ve.metrics.left-Je)*Ve.scale-Ti+Fi[0],nr=(-Ve.metrics.top-Je)*Ve.scale+Fi[1],mi=rr+de.w/ir*Ve.scale/lt,Di=nr+de.h/ir*Ve.scale/lt,Gi=new se(rr,nr),Oi=new se(mi,nr),ar=new se(rr,Di),Ni=new se(mi,Di);if(Wt){let Ot=new se(-Ti,Ti-Qo),Qt=-Math.PI/2,ai=wi/2-Ti,Cr=new se(5-Qo-ai,-(Ve.imageName?ai:0)),pi=new se(...Ci);Gi._rotateAround(Qt,Ot)._add(Cr)._add(pi),Oi._rotateAround(Qt,Ot)._add(Cr)._add(pi),ar._rotateAround(Qt,Ot)._add(Cr)._add(pi),Ni._rotateAround(Qt,Ot)._add(Cr)._add(pi)}if(Me){let Ot=Math.sin(Me),Qt=Math.cos(Me),ai=[Qt,-Ot,Ot,Qt];Gi._matMult(ai),Oi._matMult(ai),ar._matMult(ai),Ni._matMult(ai)}let Ur=new se(0,0),gr=new se(0,0);We.push({tl:Gi,tr:Oi,bl:ar,br:Ni,tex:de,writingMode:K.writingMode,glyphOffset:Jr,sectionIndex:Ve.sectionIndex,isSDF:He,pixelOffsetTL:Ur,pixelOffsetBR:gr,minFontScaleX:0,minFontScaleY:0})}return We}(0,r,f,l,h,d,a,i.allowVerticalPlacement),q=i.textSizeData,$=null;q.kind==="source"?($=[pn*l.layout.get("text-size").evaluate(d,{})],$[0]>ga&&Ie(`${i.layerIds[0]}: Value for "text-size" is >= ${tl}. Reduce your "text-size".`)):q.kind==="composite"&&($=[pn*M.compositeTextSizes[0].evaluate(d,{},z),pn*M.compositeTextSizes[1].evaluate(d,{},z)],($[0]>ga||$[1]>ga)&&Ie(`${i.layerIds[0]}: Value for "text-size" is >= ${tl}. Reduce your "text-size".`)),i.addSymbols(i.text,B,$,f,h,d,v,t,g.lineStartIndex,g.lineLength,D,z);for(let ne of x)A[ne]=i.text.placedSymbolArray.length-1;return 4*B.length}function Up(i){for(let t in i)return i[t];return null}function Mm(i,t,r,a){let l=i.compareText;if(t in l){let h=l[t];for(let d=h.length-1;d>=0;d--)if(a.dist(h[d])>4;if(l!==1)throw new Error(`Got v${l} data when expected v1.`);let h=jp[15&a];if(!h)throw new Error("Unrecognized array type.");let[d]=new Uint16Array(t,2,1),[f]=new Uint32Array(t,4,1);return new Nc(f,d,h,t)}constructor(t,r=64,a=Float64Array,l){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=a,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;let h=jp.indexOf(this.ArrayType),d=2*t*this.ArrayType.BYTES_PER_ELEMENT,f=t*this.IndexArrayType.BYTES_PER_ELEMENT,g=(8-f%8)%8;if(h<0)throw new Error(`Unexpected typed array class: ${a}.`);l&&l instanceof ArrayBuffer?(this.data=l,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+f+g,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+d+f+g),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+f+g,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+h]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=t)}add(t,r){let a=this._pos>>1;return this.ids[a]=a,this.coords[this._pos++]=t,this.coords[this._pos++]=r,a}finish(){let t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return qc(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,r,a,l){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:h,coords:d,nodeSize:f}=this,g=[0,h.length-1,0],v=[];for(;g.length;){let x=g.pop()||0,A=g.pop()||0,D=g.pop()||0;if(A-D<=f){for(let q=D;q<=A;q++){let $=d[2*q],ne=d[2*q+1];$>=t&&$<=a&&ne>=r&&ne<=l&&v.push(h[q])}continue}let M=D+A>>1,z=d[2*M],B=d[2*M+1];z>=t&&z<=a&&B>=r&&B<=l&&v.push(h[M]),(x===0?t<=z:r<=B)&&(g.push(D),g.push(M-1),g.push(1-x)),(x===0?a>=z:l>=B)&&(g.push(M+1),g.push(A),g.push(1-x))}return v}within(t,r,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:l,coords:h,nodeSize:d}=this,f=[0,l.length-1,0],g=[],v=a*a;for(;f.length;){let x=f.pop()||0,A=f.pop()||0,D=f.pop()||0;if(A-D<=d){for(let q=D;q<=A;q++)Zp(h[2*q],h[2*q+1],t,r)<=v&&g.push(l[q]);continue}let M=D+A>>1,z=h[2*M],B=h[2*M+1];Zp(z,B,t,r)<=v&&g.push(l[M]),(x===0?t-a<=z:r-a<=B)&&(f.push(D),f.push(M-1),f.push(1-x)),(x===0?t+a>=z:r+a>=B)&&(f.push(M+1),f.push(A),f.push(1-x))}return g}}function qc(i,t,r,a,l,h){if(l-a<=r)return;let d=a+l>>1;$p(i,t,d,a,l,h),qc(i,t,r,a,d-1,1-h),qc(i,t,r,d+1,l,1-h)}function $p(i,t,r,a,l,h){for(;l>a;){if(l-a>600){let v=l-a+1,x=r-a+1,A=Math.log(v),D=.5*Math.exp(2*A/3),M=.5*Math.sqrt(A*D*(v-D)/v)*(x-v/2<0?-1:1);$p(i,t,r,Math.max(a,Math.floor(r-x*D/v+M)),Math.min(l,Math.floor(r+(v-x)*D/v+M)),h)}let d=t[2*r+h],f=a,g=l;for(nl(i,t,a,r),t[2*l+h]>d&&nl(i,t,a,l);fd;)g--}t[2*a+h]===d?nl(i,t,a,g):(g++,nl(i,t,g,l)),g<=r&&(a=g+1),r<=g&&(l=g-1)}}function nl(i,t,r,a){Vc(i,r,a),Vc(t,2*r,2*a),Vc(t,2*r+1,2*a+1)}function Vc(i,t,r){let a=i[t];i[t]=i[r],i[r]=a}function Zp(i,t,r,a){let l=i-r,h=t-a;return l*l+h*h}var Uc;E.bg=void 0,(Uc=E.bg||(E.bg={})).create="create",Uc.load="load",Uc.fullLoad="fullLoad";let vu=null,al=[],jc=1e3/60,$c="loadTime",Zc="fullLoadTime",Pm={mark(i){performance.mark(i)},frame(i){let t=i;vu!=null&&al.push(t-vu),vu=t},clearMetrics(){vu=null,al=[],performance.clearMeasures($c),performance.clearMeasures(Zc);for(let i in E.bg)performance.clearMarks(E.bg[i])},getPerformanceMetrics(){performance.measure($c,E.bg.create,E.bg.load),performance.measure(Zc,E.bg.create,E.bg.fullLoad);let i=performance.getEntriesByName($c)[0].duration,t=performance.getEntriesByName(Zc)[0].duration,r=al.length,a=1/(al.reduce((h,d)=>h+d,0)/r/1e3),l=al.filter(h=>h>jc).reduce((h,d)=>h+(d-jc)/jc,0);return{loadTime:i,fullLoadTime:t,fps:a,percentDroppedFrames:l/(r+l)*100,totalFrames:r}}};E.$=class extends T{},E.A=zs,E.B=Qu,E.C=function(i){if(at==null){let t=i.navigator?i.navigator.userAgent:null;at=!!i.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return at},E.D=Ze,E.E=Kt,E.F=class{constructor(i,t){this.target=i,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Am(()=>this.process()),this.subscription=function(r,a,l,h){return r.addEventListener(a,l,!1),{unsubscribe:()=>{r.removeEventListener(a,l,!1)}}}(this.target,"message",r=>this.receive(r)),this.globalScope=qe(self)?i:window}registerMessageHandler(i,t){this.messageHandlers[i]=t}sendAsync(i,t){return new Promise((r,a)=>{let l=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[l]={resolve:r,reject:a},t&&t.signal.addEventListener("abort",()=>{delete this.resolveRejects[l];let f={id:l,type:"",origin:location.origin,targetMapId:i.targetMapId,sourceMapId:this.mapId};this.target.postMessage(f)},{once:!0});let h=[],d=Object.assign(Object.assign({},i),{id:l,sourceMapId:this.mapId,origin:location.origin,data:na(i.data,h)});this.target.postMessage(d,{transfer:h})})}receive(i){let t=i.data,r=t.id;if(!(t.origin!=="file://"&&location.origin!=="file://"&&t.origin!=="resource://android"&&location.origin!=="resource://android"&&t.origin!==location.origin||t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type===""){delete this.tasks[r];let a=this.abortControllers[r];return delete this.abortControllers[r],void(a&&a.abort())}if(qe(self)||t.mustQueue)return this.tasks[r]=t,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,t)}}process(){if(this.taskQueue.length===0)return;let i=this.taskQueue.shift(),t=this.tasks[i];delete this.tasks[i],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(i,t)}processTask(i,t){return p(this,void 0,void 0,function*(){if(t.type===""){let l=this.resolveRejects[i];return delete this.resolveRejects[i],l?void(t.error?l.reject(aa(t.error)):l.resolve(aa(t.data))):void 0}if(!this.messageHandlers[t.type])return void this.completeTask(i,new Error(`Could not find a registered handler for ${t.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));let r=aa(t.data),a=new AbortController;this.abortControllers[i]=a;try{let l=yield this.messageHandlers[t.type](t.sourceMapId,r,a);this.completeTask(i,null,l)}catch(l){this.completeTask(i,l)}})}completeTask(i,t,r){let a=[];delete this.abortControllers[i];let l={id:i,type:"",sourceMapId:this.mapId,origin:location.origin,error:t?na(t):null,data:na(r,a)};this.target.postMessage(l,{transfer:a})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},E.G=Vt,E.H=function(){var i=new zs(16);return zs!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},E.I=Cc,E.J=function(i,t,r){var a,l,h,d,f,g,v,x,A,D,M,z,B=r[0],q=r[1],$=r[2];return t===i?(i[12]=t[0]*B+t[4]*q+t[8]*$+t[12],i[13]=t[1]*B+t[5]*q+t[9]*$+t[13],i[14]=t[2]*B+t[6]*q+t[10]*$+t[14],i[15]=t[3]*B+t[7]*q+t[11]*$+t[15]):(l=t[1],h=t[2],d=t[3],f=t[4],g=t[5],v=t[6],x=t[7],A=t[8],D=t[9],M=t[10],z=t[11],i[0]=a=t[0],i[1]=l,i[2]=h,i[3]=d,i[4]=f,i[5]=g,i[6]=v,i[7]=x,i[8]=A,i[9]=D,i[10]=M,i[11]=z,i[12]=a*B+f*q+A*$+t[12],i[13]=l*B+g*q+D*$+t[13],i[14]=h*B+v*q+M*$+t[14],i[15]=d*B+x*q+z*$+t[15]),i},E.K=function(i,t,r){var a=r[0],l=r[1],h=r[2];return i[0]=t[0]*a,i[1]=t[1]*a,i[2]=t[2]*a,i[3]=t[3]*a,i[4]=t[4]*l,i[5]=t[5]*l,i[6]=t[6]*l,i[7]=t[7]*l,i[8]=t[8]*h,i[9]=t[9]*h,i[10]=t[10]*h,i[11]=t[11]*h,i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15],i},E.L=Th,E.M=function(i,t){let r={};for(let a=0;a{let t=window.document.createElement("video");return t.muted=!0,new Promise(r=>{t.onloadstart=()=>{r(t)};for(let a of i){let l=window.document.createElement("source");yt(a)||(t.crossOrigin="Anonymous"),l.src=a,t.appendChild(l)}})},E.a4=function(){return ve++},E.a5=Re,E.a6=Ns,E.a7=wo,E.a8=$a,E.a9=Dp,E.aA=function(i){if(i.type==="custom")return new wm(i);switch(i.type){case"background":return new vm(i);case"circle":return new sf(i);case"fill":return new Af(i);case"fill-extrusion":return new Of(i);case"heatmap":return new lf(i);case"hillshade":return new cf(i);case"line":return new Gf(i);case"raster":return new bm(i);case"symbol":return new fu(i)}},E.aB=ye,E.aC=function(i,t){if(!i)return[{command:"setStyle",args:[t]}];let r=[];try{if(!wt(i.version,t.version))return[{command:"setStyle",args:[t]}];wt(i.center,t.center)||r.push({command:"setCenter",args:[t.center]}),wt(i.zoom,t.zoom)||r.push({command:"setZoom",args:[t.zoom]}),wt(i.bearing,t.bearing)||r.push({command:"setBearing",args:[t.bearing]}),wt(i.pitch,t.pitch)||r.push({command:"setPitch",args:[t.pitch]}),wt(i.sprite,t.sprite)||r.push({command:"setSprite",args:[t.sprite]}),wt(i.glyphs,t.glyphs)||r.push({command:"setGlyphs",args:[t.glyphs]}),wt(i.transition,t.transition)||r.push({command:"setTransition",args:[t.transition]}),wt(i.light,t.light)||r.push({command:"setLight",args:[t.light]}),wt(i.terrain,t.terrain)||r.push({command:"setTerrain",args:[t.terrain]}),wt(i.sky,t.sky)||r.push({command:"setSky",args:[t.sky]}),wt(i.projection,t.projection)||r.push({command:"setProjection",args:[t.projection]});let a={},l=[];(function(d,f,g,v){let x;for(x in f=f||{},d=d||{})Object.prototype.hasOwnProperty.call(d,x)&&(Object.prototype.hasOwnProperty.call(f,x)||Mr(x,g,v));for(x in f)Object.prototype.hasOwnProperty.call(f,x)&&(Object.prototype.hasOwnProperty.call(d,x)?wt(d[x],f[x])||(d[x].type==="geojson"&&f[x].type==="geojson"&&Qr(d,f,x)?Gt(g,{command:"setGeoJSONSourceData",args:[x,f[x].data]}):Wi(x,f,g,v)):_r(x,f,g))})(i.sources,t.sources,l,a);let h=[];i.layers&&i.layers.forEach(d=>{"source"in d&&a[d.source]?r.push({command:"removeLayer",args:[d.id]}):h.push(d)}),r=r.concat(l),function(d,f,g){f=f||[];let v=(d=d||[]).map(sn),x=f.map(sn),A=d.reduce(yn,{}),D=f.reduce(yn,{}),M=v.slice(),z=Object.create(null),B,q,$,ne,K;for(let ie=0,ce=0;ie@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,a,l,h)=>{let d=l||h;return t[a]=!d||d.toLowerCase(),""}),t["max-age"]){let r=parseInt(t["max-age"],10);isNaN(r)?delete t["max-age"]:t["max-age"]=r}return t},E.ab=function(i,t){let r=[];for(let a in i)a in t||r.push(a);return r},E.ac=Pe,E.ad=function(i,t,r){var a=Math.sin(r),l=Math.cos(r),h=t[0],d=t[1],f=t[2],g=t[3],v=t[4],x=t[5],A=t[6],D=t[7];return t!==i&&(i[8]=t[8],i[9]=t[9],i[10]=t[10],i[11]=t[11],i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15]),i[0]=h*l+v*a,i[1]=d*l+x*a,i[2]=f*l+A*a,i[3]=g*l+D*a,i[4]=v*l-h*a,i[5]=x*l-d*a,i[6]=A*l-f*a,i[7]=D*l-g*a,i},E.ae=function(i){var t=new zs(16);return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],t},E.af=au,E.ag=function(i,t){let r=0,a=0;if(i.kind==="constant")a=i.layoutSize;else if(i.kind!=="source"){let{interpolationType:l,minZoom:h,maxZoom:d}=i,f=l?Pe(Qi.interpolationFactor(l,t,h,d),0,1):0;i.kind==="camera"?a=Yi.number(i.minSize,i.maxSize,f):r=f}return{uSizeT:r,uSize:a}},E.ai=function(i,{uSize:t,uSizeT:r},{lowerSize:a,upperSize:l}){return i.kind==="source"?a/pn:i.kind==="composite"?Yi.number(a/pn,l/pn,r):t},E.aj=kc,E.ak=function(i,t,r,a){let l=t.y-i.y,h=t.x-i.x,d=a.y-r.y,f=a.x-r.x,g=d*h-f*l;if(g===0)return null;let v=(f*(i.y-r.y)-d*(i.x-r.x))/g;return new se(i.x+v*h,i.y+v*l)},E.al=Mp,E.am=vh,E.an=hc,E.ao=function(i){let t=1/0,r=1/0,a=-1/0,l=-1/0;for(let h of i)t=Math.min(t,h.x),r=Math.min(r,h.y),a=Math.max(a,h.x),l=Math.max(l,h.y);return[t,r,a,l]},E.ap=wi,E.ar=Ic,E.as=function(i,t){var r=t[0],a=t[1],l=t[2],h=t[3],d=t[4],f=t[5],g=t[6],v=t[7],x=t[8],A=t[9],D=t[10],M=t[11],z=t[12],B=t[13],q=t[14],$=t[15],ne=r*f-a*d,K=r*g-l*d,ie=r*v-h*d,ce=a*g-l*f,_e=a*v-h*f,Oe=l*v-h*g,it=x*B-A*z,Le=x*q-D*z,Me=x*$-M*z,We=A*q-D*B,je=A*$-M*B,Ve=D*$-M*q,de=ne*Ve-K*je+ie*We+ce*Me-_e*Le+Oe*it;return de?(i[0]=(f*Ve-g*je+v*We)*(de=1/de),i[1]=(l*je-a*Ve-h*We)*de,i[2]=(B*Oe-q*_e+$*ce)*de,i[3]=(D*_e-A*Oe-M*ce)*de,i[4]=(g*Me-d*Ve-v*Le)*de,i[5]=(r*Ve-l*Me+h*Le)*de,i[6]=(q*ie-z*Oe-$*K)*de,i[7]=(x*Oe-D*ie+M*K)*de,i[8]=(d*je-f*Me+v*it)*de,i[9]=(a*Me-r*je-h*it)*de,i[10]=(z*_e-B*ie+$*ne)*de,i[11]=(A*ie-x*_e-M*ne)*de,i[12]=(f*Le-d*We-g*it)*de,i[13]=(r*We-a*Le+l*it)*de,i[14]=(B*K-z*ce-q*ne)*de,i[15]=(x*ce-A*K+D*ne)*de,i):null},E.at=Oc,E.au=Sc,E.av=Nc,E.aw=function(){let i={},t=oe.$version;for(let r in oe.$root){let a=oe.$root[r];if(a.required){let l=null;l=r==="version"?t:a.type==="array"?[]:{},l!=null&&(i[r]=l)}}return i},E.ax=Ro,E.ay=ui,E.az=function(i){i=i.slice();let t=Object.create(null);for(let r=0;r25||a<0||a>=1||r<0||r>=1)},E.bc=function(i,t){return i[0]=t[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=t[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=t[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},E.bd=class extends b{},E.be=Bc,E.bf=Pm,E.bh=xt,E.bi=function(i,t){_t.REGISTERED_PROTOCOLS[i]=t},E.bj=function(i){delete _t.REGISTERED_PROTOCOLS[i]},E.bk=function(i,t){let r={};for(let l=0;lVe*wi)}let Le=d?"center":r.get("text-justify").evaluate(v,{},i.canonical),Me=r.get("symbol-placement")==="point"?r.get("text-max-width").evaluate(v,{},i.canonical)*wi:1/0,We=()=>{i.bucket.allowVerticalPlacement&&Fo(ie)&&(z.vertical=hu(B,i.glyphMap,i.glyphPositions,i.imagePositions,x,Me,h,Oe,"left",_e,$,E.ah.vertical,!0,D,A))};if(!d&&it){let je=new Set;if(Le==="auto")for(let de=0;dep(void 0,void 0,void 0,function*(){if(i.byteLength===0)return createImageBitmap(new ImageData(1,1));let t=new Blob([new Uint8Array(i)],{type:"image/png"});try{return createImageBitmap(t)}catch(r){throw new Error(`Could not load image because of ${r.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),E.e=Ye,E.f=i=>new Promise((t,r)=>{let a=new Image;a.onload=()=>{t(a),URL.revokeObjectURL(a.src),a.onload=null,window.requestAnimationFrame(()=>{a.src=pt})},a.onerror=()=>r(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."));let l=new Blob([new Uint8Array(i)],{type:"image/png"});a.src=i.byteLength?URL.createObjectURL(l):pt}),E.g=Rt,E.h=(i,t)=>et(Ye(i,{type:"json"}),t),E.i=qe,E.j=bi,E.k=ci,E.l=(i,t)=>et(Ye(i,{type:"arrayBuffer"}),t),E.m=et,E.n=function(i){return new Ec(i).readFields(om,[])},E.o=Go,E.p=np,E.q=c,E.r=Yu,E.s=yt,E.t=Bo,E.u=kn,E.v=oe,E.w=Ie,E.x=function([i,t,r]){return t+=90,t*=Math.PI/180,r*=Math.PI/180,{x:i*Math.cos(t)*Math.sin(r),y:i*Math.sin(t)*Math.sin(r),z:i*Math.cos(r)}},E.y=Yi,E.z=ti}),F("worker",["./shared"],function(E){"use strict";class p{constructor(k){this.keyCache={},k&&this.replace(k)}replace(k){this._layerConfigs={},this._layers={},this.update(k,[])}update(k,I){for(let V of k){this._layerConfigs[V.id]=V;let Y=this._layers[V.id]=E.aA(V);Y._featureFilter=E.a7(Y.filter),this.keyCache[V.id]&&delete this.keyCache[V.id]}for(let V of I)delete this.keyCache[V],delete this._layerConfigs[V],delete this._layers[V];this.familiesBySource={};let R=E.bk(Object.values(this._layerConfigs),this.keyCache);for(let V of R){let Y=V.map(le=>this._layers[le.id]),ee=Y[0];if(ee.visibility==="none")continue;let re=ee.source||"",H=this.familiesBySource[re];H||(H=this.familiesBySource[re]={});let he=ee.sourceLayer||"_geojsonTileLayer",me=H[he];me||(me=H[he]=[]),me.push(Y)}}}class ue{constructor(k){let I={},R=[];for(let re in k){let H=k[re],he=I[re]={};for(let me in H){let le=H[+me];if(!le||le.bitmap.width===0||le.bitmap.height===0)continue;let Te={x:0,y:0,w:le.bitmap.width+2,h:le.bitmap.height+2};R.push(Te),he[me]={rect:Te,metrics:le.metrics}}}let{w:V,h:Y}=E.p(R),ee=new E.o({width:V||1,height:Y||1});for(let re in k){let H=k[re];for(let he in H){let me=H[+he];if(!me||me.bitmap.width===0||me.bitmap.height===0)continue;let le=I[re][he].rect;E.o.copy(me.bitmap,ee,{x:0,y:0},{x:le.x+1,y:le.y+1},me.bitmap)}}this.image=ee,this.positions=I}}E.bl("GlyphAtlas",ue);class pe{constructor(k){this.tileID=new E.S(k.tileID.overscaledZ,k.tileID.wrap,k.tileID.canonical.z,k.tileID.canonical.x,k.tileID.canonical.y),this.uid=k.uid,this.zoom=k.zoom,this.pixelRatio=k.pixelRatio,this.tileSize=k.tileSize,this.source=k.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=k.showCollisionBoxes,this.collectResourceTiming=!!k.collectResourceTiming,this.returnDependencies=!!k.returnDependencies,this.promoteId=k.promoteId,this.inFlightDependencies=[]}parse(k,I,R,V){return E._(this,void 0,void 0,function*(){this.status="parsing",this.data=k,this.collisionBoxArray=new E.a5;let Y=new E.bm(Object.keys(k.layers).sort()),ee=new E.bn(this.tileID,this.promoteId);ee.bucketLayerIDs=[];let re={},H={featureIndex:ee,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:R},he=I.familiesBySource[this.source];for(let bt in he){let $t=k.layers[bt];if(!$t)continue;$t.version===1&&E.w(`Vector tile source "${this.source}" layer "${bt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let oi=Y.encode(bt),Ei=[];for(let Ii=0;Ii<$t.length;Ii++){let ji=$t.feature(Ii),qn=ee.getId(ji,bt);Ei.push({feature:ji,id:qn,index:Ii,sourceLayerIndex:oi})}for(let Ii of he[bt]){let ji=Ii[0];ji.source!==this.source&&E.w(`layer.source = ${ji.source} does not equal this.source = ${this.source}`),ji.minzoom&&this.zoom=ji.maxzoom||ji.visibility!=="none"&&(De(Ii,this.zoom,R),(re[ji.id]=ji.createBucket({index:ee.bucketLayerIDs.length,layers:Ii,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:oi,sourceID:this.source})).populate(Ei,H,this.tileID.canonical),ee.bucketLayerIDs.push(Ii.map(qn=>qn.id)))}}let me=E.aF(H.glyphDependencies,bt=>Object.keys(bt).map(Number));this.inFlightDependencies.forEach(bt=>bt?.abort()),this.inFlightDependencies=[];let le=Promise.resolve({});if(Object.keys(me).length){let bt=new AbortController;this.inFlightDependencies.push(bt),le=V.sendAsync({type:"GG",data:{stacks:me,source:this.source,tileID:this.tileID,type:"glyphs"}},bt)}let Te=Object.keys(H.iconDependencies),Ke=Promise.resolve({});if(Te.length){let bt=new AbortController;this.inFlightDependencies.push(bt),Ke=V.sendAsync({type:"GI",data:{icons:Te,source:this.source,tileID:this.tileID,type:"icons"}},bt)}let tt=Object.keys(H.patternDependencies),zt=Promise.resolve({});if(tt.length){let bt=new AbortController;this.inFlightDependencies.push(bt),zt=V.sendAsync({type:"GI",data:{icons:tt,source:this.source,tileID:this.tileID,type:"patterns"}},bt)}let[ft,Bt,Ct]=yield Promise.all([le,Ke,zt]),yi=new ue(ft),hi=new E.bo(Bt,Ct);for(let bt in re){let $t=re[bt];$t instanceof E.a6?(De($t.layers,this.zoom,R),E.bp({bucket:$t,glyphMap:ft,glyphPositions:yi.positions,imageMap:Bt,imagePositions:hi.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):$t.hasPattern&&($t instanceof E.bq||$t instanceof E.br||$t instanceof E.bs)&&(De($t.layers,this.zoom,R),$t.addFeatures(H,this.tileID.canonical,hi.patternPositions))}return this.status="done",{buckets:Object.values(re).filter(bt=>!bt.isEmpty()),featureIndex:ee,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:yi.image,imageAtlas:hi,glyphMap:this.returnDependencies?ft:null,iconMap:this.returnDependencies?Bt:null,glyphPositions:this.returnDependencies?yi.positions:null}})}}function De(j,k,I){let R=new E.z(k);for(let V of j)V.recalculate(R,I)}class se{constructor(k,I,R){this.actor=k,this.layerIndex=I,this.availableImages=R,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(k,I){return E._(this,void 0,void 0,function*(){let R=yield E.l(k.request,I);try{return{vectorTile:new E.bt.VectorTile(new E.bu(R.data)),rawData:R.data,cacheControl:R.cacheControl,expires:R.expires}}catch(V){let Y=new Uint8Array(R.data),ee=`Unable to parse the tile at ${k.request.url}, `;throw ee+=Y[0]===31&&Y[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${V.message}`,new Error(ee)}})}loadTile(k){return E._(this,void 0,void 0,function*(){let I=k.uid,R=!!(k&&k.request&&k.request.collectResourceTiming)&&new E.bv(k.request),V=new pe(k);this.loading[I]=V;let Y=new AbortController;V.abort=Y;try{let ee=yield this.loadVectorTile(k,Y);if(delete this.loading[I],!ee)return null;let re=ee.rawData,H={};ee.expires&&(H.expires=ee.expires),ee.cacheControl&&(H.cacheControl=ee.cacheControl);let he={};if(R){let le=R.finish();le&&(he.resourceTiming=JSON.parse(JSON.stringify(le)))}V.vectorTile=ee.vectorTile;let me=V.parse(ee.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[I]=V,this.fetching[I]={rawTileData:re,cacheControl:H,resourceTiming:he};try{let le=yield me;return E.e({rawTileData:re.slice(0)},le,H,he)}finally{delete this.fetching[I]}}catch(ee){throw delete this.loading[I],V.status="done",this.loaded[I]=V,ee}})}reloadTile(k){return E._(this,void 0,void 0,function*(){let I=k.uid;if(!this.loaded||!this.loaded[I])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");let R=this.loaded[I];if(R.showCollisionBoxes=k.showCollisionBoxes,R.status==="parsing"){let V=yield R.parse(R.vectorTile,this.layerIndex,this.availableImages,this.actor),Y;if(this.fetching[I]){let{rawTileData:ee,cacheControl:re,resourceTiming:H}=this.fetching[I];delete this.fetching[I],Y=E.e({rawTileData:ee.slice(0)},V,re,H)}else Y=V;return Y}if(R.status==="done"&&R.vectorTile)return R.parse(R.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(k){return E._(this,void 0,void 0,function*(){let I=this.loading,R=k.uid;I&&I[R]&&I[R].abort&&(I[R].abort.abort(),delete I[R])})}removeTile(k){return E._(this,void 0,void 0,function*(){this.loaded&&this.loaded[k.uid]&&delete this.loaded[k.uid]})}}class W{constructor(){this.loaded={}}loadTile(k){return E._(this,void 0,void 0,function*(){let{uid:I,encoding:R,rawImageData:V,redFactor:Y,greenFactor:ee,blueFactor:re,baseShift:H}=k,he=V.width+2,me=V.height+2,le=E.b(V)?new E.R({width:he,height:me},yield E.bw(V,-1,-1,he,me)):V,Te=new E.bx(I,le,R,Y,ee,re,H);return this.loaded=this.loaded||{},this.loaded[I]=Te,Te})}removeTile(k){let I=this.loaded,R=k.uid;I&&I[R]&&delete I[R]}}function Mt(j,k){if(j.length!==0){gt(j[0],k);for(var I=1;I=Math.abs(re)?I-H+re:re-H+I,I=H}I+R>=0!=!!k&&j.reverse()}var Et=E.by(function j(k,I){var R,V=k&&k.type;if(V==="FeatureCollection")for(R=0;R>31}function qe(j,k){for(var I=j.loadGeometry(),R=j.type,V=0,Y=0,ee=I.length,re=0;rej},Be=Math.fround||(Tt=new Float32Array(1),j=>(Tt[0]=+j,Tt[0]));var Tt;let qt=3,dt=5,St=6;class _t{constructor(k){this.options=Object.assign(Object.create(pt),k),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(k){let{log:I,minZoom:R,maxZoom:V}=this.options;I&&console.time("total time");let Y=`prepare ${k.length} points`;I&&console.time(Y),this.points=k;let ee=[];for(let H=0;H=R;H--){let he=+Date.now();re=this.trees[H]=this._createTree(this._cluster(re,H)),I&&console.log("z%d: %d clusters in %dms",H,re.numItems,+Date.now()-he)}return I&&console.timeEnd("total time"),this}getClusters(k,I){let R=((k[0]+180)%360+360)%360-180,V=Math.max(-90,Math.min(90,k[1])),Y=k[2]===180?180:((k[2]+180)%360+360)%360-180,ee=Math.max(-90,Math.min(90,k[3]));if(k[2]-k[0]>=360)R=-180,Y=180;else if(R>Y){let le=this.getClusters([R,V,180,ee],I),Te=this.getClusters([-180,V,Y,ee],I);return le.concat(Te)}let re=this.trees[this._limitZoom(I)],H=re.range(xt(R),ui(ee),xt(Y),ui(V)),he=re.data,me=[];for(let le of H){let Te=this.stride*le;me.push(he[Te+dt]>1?Rt(he,Te,this.clusterProps):this.points[he[Te+qt]])}return me}getChildren(k){let I=this._getOriginId(k),R=this._getOriginZoom(k),V="No cluster with the specified id.",Y=this.trees[R];if(!Y)throw new Error(V);let ee=Y.data;if(I*this.stride>=ee.length)throw new Error(V);let re=this.options.radius/(this.options.extent*Math.pow(2,R-1)),H=Y.within(ee[I*this.stride],ee[I*this.stride+1],re),he=[];for(let me of H){let le=me*this.stride;ee[le+4]===k&&he.push(ee[le+dt]>1?Rt(ee,le,this.clusterProps):this.points[ee[le+qt]])}if(he.length===0)throw new Error(V);return he}getLeaves(k,I,R){let V=[];return this._appendLeaves(V,k,I=I||10,R=R||0,0),V}getTile(k,I,R){let V=this.trees[this._limitZoom(k)],Y=Math.pow(2,k),{extent:ee,radius:re}=this.options,H=re/ee,he=(R-H)/Y,me=(R+1+H)/Y,le={features:[]};return this._addTileFeatures(V.range((I-H)/Y,he,(I+1+H)/Y,me),V.data,I,R,Y,le),I===0&&this._addTileFeatures(V.range(1-H/Y,he,1,me),V.data,Y,R,Y,le),I===Y-1&&this._addTileFeatures(V.range(0,he,H/Y,me),V.data,-1,R,Y,le),le.features.length?le:null}getClusterExpansionZoom(k){let I=this._getOriginZoom(k)-1;for(;I<=this.options.maxZoom;){let R=this.getChildren(k);if(I++,R.length!==1)break;k=R[0].properties.cluster_id}return I}_appendLeaves(k,I,R,V,Y){let ee=this.getChildren(I);for(let re of ee){let H=re.properties;if(H&&H.cluster?Y+H.point_count<=V?Y+=H.point_count:Y=this._appendLeaves(k,H.cluster_id,R,V,Y):Y1,me,le,Te;if(he)me=Vt(I,H,this.clusterProps),le=I[H],Te=I[H+1];else{let zt=this.points[I[H+qt]];me=zt.properties;let[ft,Bt]=zt.geometry.coordinates;le=xt(ft),Te=ui(Bt)}let Ke={type:1,geometry:[[Math.round(this.options.extent*(le*Y-R)),Math.round(this.options.extent*(Te*Y-V))]],tags:me},tt;tt=he||this.options.generateId?I[H+qt]:this.points[I[H+qt]].id,tt!==void 0&&(Ke.id=tt),ee.features.push(Ke)}}_limitZoom(k){return Math.max(this.options.minZoom,Math.min(Math.floor(+k),this.options.maxZoom+1))}_cluster(k,I){let{radius:R,extent:V,reduce:Y,minPoints:ee}=this.options,re=R/(V*Math.pow(2,I)),H=k.data,he=[],me=this.stride;for(let le=0;leI&&(ft+=H[Ct+dt])}if(ft>zt&&ft>=ee){let Bt,Ct=Te*zt,yi=Ke*zt,hi=-1,bt=((le/me|0)<<5)+(I+1)+this.points.length;for(let $t of tt){let oi=$t*me;if(H[oi+2]<=I)continue;H[oi+2]=I;let Ei=H[oi+dt];Ct+=H[oi]*Ei,yi+=H[oi+1]*Ei,H[oi+4]=bt,Y&&(Bt||(Bt=this._map(H,le,!0),hi=this.clusterProps.length,this.clusterProps.push(Bt)),Y(Bt,this._map(H,oi)))}H[le+4]=bt,he.push(Ct/ft,yi/ft,1/0,bt,-1,ft),Y&&he.push(hi)}else{for(let Bt=0;Bt1)for(let Bt of tt){let Ct=Bt*me;if(!(H[Ct+2]<=I)){H[Ct+2]=I;for(let yi=0;yi>5}_getOriginZoom(k){return(k-this.points.length)%32}_map(k,I,R){if(k[I+dt]>1){let ee=this.clusterProps[k[I+St]];return R?Object.assign({},ee):ee}let V=this.points[k[I+qt]].properties,Y=this.options.map(V);return R&&Y===V?Object.assign({},Y):Y}}function Rt(j,k,I){return{type:"Feature",id:j[k+qt],properties:Vt(j,k,I),geometry:{type:"Point",coordinates:[(R=j[k],360*(R-.5)),et(j[k+1])]}};var R}function Vt(j,k,I){let R=j[k+dt],V=R>=1e4?`${Math.round(R/1e3)}k`:R>=1e3?Math.round(R/100)/10+"k":R,Y=j[k+St],ee=Y===-1?{}:Object.assign({},I[Y]);return Object.assign(ee,{cluster:!0,cluster_id:j[k+qt],point_count:R,point_count_abbreviated:V})}function xt(j){return j/360+.5}function ui(j){let k=Math.sin(j*Math.PI/180),I=.5-.25*Math.log((1+k)/(1-k))/Math.PI;return I<0?0:I>1?1:I}function et(j){let k=(180-360*j)*Math.PI/180;return 360*Math.atan(Math.exp(k))/Math.PI-90}function yt(j,k,I,R){let V=R,Y=k+(I-k>>1),ee,re=I-k,H=j[k],he=j[k+1],me=j[I],le=j[I+1];for(let Te=k+3;TeV)ee=Te,V=Ke;else if(Ke===V){let tt=Math.abs(Te-Y);ttR&&(ee-k>3&&yt(j,k,ee,R),j[ee+2]=V,I-ee>3&&yt(j,ee,I,R))}function jt(j,k,I,R,V,Y){let ee=V-I,re=Y-R;if(ee!==0||re!==0){let H=((j-I)*ee+(k-R)*re)/(ee*ee+re*re);H>1?(I=V,R=Y):H>0&&(I+=ee*H,R+=re*H)}return ee=j-I,re=k-R,ee*ee+re*re}function ut(j,k,I,R){let V={id:j??null,type:k,geometry:I,tags:R,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(k==="Point"||k==="MultiPoint"||k==="LineString")ci(V,I);else if(k==="Polygon")ci(V,I[0]);else if(k==="MultiLineString")for(let Y of I)ci(V,Y);else if(k==="MultiPolygon")for(let Y of I)ci(V,Y[0]);return V}function ci(j,k){for(let I=0;I0&&(ee+=R?(V*me-he*Y)/2:Math.sqrt(Math.pow(he-V,2)+Math.pow(me-Y,2))),V=he,Y=me}let re=k.length-3;k[2]=1,yt(k,0,re,I),k[re+2]=1,k.size=Math.abs(ee),k.start=0,k.end=k.size}function Xi(j,k,I,R){for(let V=0;V1?1:I}function Gt(j,k,I,R,V,Y,ee,re){if(R/=k,Y>=(I/=k)&&ee=R)return null;let H=[];for(let he of j){let me=he.geometry,le=he.type,Te=V===0?he.minX:he.minY,Ke=V===0?he.maxX:he.maxY;if(Te>=I&&Ke=R)continue;let tt=[];if(le==="Point"||le==="MultiPoint")_r(me,tt,I,R,V);else if(le==="LineString")Mr(me,tt,I,R,V,!1,re.lineMetrics);else if(le==="MultiLineString")Qr(me,tt,I,R,V,!1);else if(le==="Polygon")Qr(me,tt,I,R,V,!0);else if(le==="MultiPolygon")for(let zt of me){let ft=[];Qr(zt,ft,I,R,V,!0),ft.length&&tt.push(ft)}if(tt.length){if(re.lineMetrics&&le==="LineString"){for(let zt of tt)H.push(ut(he.id,le,zt,he.tags));continue}le!=="LineString"&&le!=="MultiLineString"||(tt.length===1?(le="LineString",tt=tt[0]):le="MultiLineString"),le!=="Point"&&le!=="MultiPoint"||(le=tt.length===3?"Point":"MultiPoint"),H.push(ut(he.id,le,tt,he.tags))}}return H.length?H:null}function _r(j,k,I,R,V){for(let Y=0;Y=I&&ee<=R&&Ui(k,j[Y],j[Y+1],j[Y+2])}}function Mr(j,k,I,R,V,Y,ee){let re=Wi(j),H=V===0?sn:yn,he,me,le=j.start;for(let ft=0;ftI&&(me=H(re,Bt,Ct,hi,bt,I),ee&&(re.start=le+he*me)):$t>R?oi=I&&(me=H(re,Bt,Ct,hi,bt,I),Ei=!0),oi>R&&$t<=R&&(me=H(re,Bt,Ct,hi,bt,R),Ei=!0),!Y&&Ei&&(ee&&(re.end=le+he*me),k.push(re),re=Wi(j)),ee&&(le+=he)}let Te=j.length-3,Ke=j[Te],tt=j[Te+1],zt=V===0?Ke:tt;zt>=I&&zt<=R&&Ui(re,Ke,tt,j[Te+2]),Te=re.length-3,Y&&Te>=3&&(re[Te]!==re[0]||re[Te+1]!==re[1])&&Ui(re,re[0],re[1],re[2]),re.length&&k.push(re)}function Wi(j){let k=[];return k.size=j.size,k.start=j.start,k.end=j.end,k}function Qr(j,k,I,R,V,Y){for(let ee of j)Mr(ee,k,I,R,V,Y,!1)}function Ui(j,k,I,R){j.push(k,I,R)}function sn(j,k,I,R,V,Y){let ee=(Y-k)/(R-k);return Ui(j,Y,I+(V-I)*ee,1),ee}function yn(j,k,I,R,V,Y){let ee=(Y-I)/(V-I);return Ui(j,k+(R-k)*ee,Y,1),ee}function we(j,k){let I=[];for(let R=0;R0&&k.size<(V?ee:R))return void(I.numPoints+=k.length/3);let re=[];for(let H=0;Hee)&&(I.numSimplified++,re.push(k[H],k[H+1])),I.numPoints++;V&&function(H,he){let me=0;for(let le=0,Te=H.length,Ke=Te-2;le0===he)for(let le=0,Te=H.length;le24)throw new Error("maxZoom should be in the 0-24 range");if(I.promoteId&&I.generateId)throw new Error("promoteId and generateId cannot be used together.");let V=function(Y,ee){let re=[];if(Y.type==="FeatureCollection")for(let H=0;H1&&console.time("creation"),Ke=this.tiles[Te]=Pr(k,I,R,V,he),this.tileCoords.push({z:I,x:R,y:V}),me)){me>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",I,R,V,Ke.numFeatures,Ke.numPoints,Ke.numSimplified),console.timeEnd("creation"));let Ei=`z${I}`;this.stats[Ei]=(this.stats[Ei]||0)+1,this.total++}if(Ke.source=k,Y==null){if(I===he.indexMaxZoom||Ke.numPoints<=he.indexMaxPoints)continue}else{if(I===he.maxZoom||I===Y)continue;if(Y!=null){let Ei=Y-I;if(R!==ee>>Ei||V!==re>>Ei)continue}}if(Ke.source=null,k.length===0)continue;me>1&&console.time("clipping");let tt=.5*he.buffer/he.extent,zt=.5-tt,ft=.5+tt,Bt=1+tt,Ct=null,yi=null,hi=null,bt=null,$t=Gt(k,le,R-tt,R+ft,0,Ke.minX,Ke.maxX,he),oi=Gt(k,le,R+zt,R+Bt,0,Ke.minX,Ke.maxX,he);k=null,$t&&(Ct=Gt($t,le,V-tt,V+ft,1,Ke.minY,Ke.maxY,he),yi=Gt($t,le,V+zt,V+Bt,1,Ke.minY,Ke.maxY,he),$t=null),oi&&(hi=Gt(oi,le,V-tt,V+ft,1,Ke.minY,Ke.maxY,he),bt=Gt(oi,le,V+zt,V+Bt,1,Ke.minY,Ke.maxY,he),oi=null),me>1&&console.timeEnd("clipping"),H.push(Ct||[],I+1,2*R,2*V),H.push(yi||[],I+1,2*R,2*V+1),H.push(hi||[],I+1,2*R+1,2*V),H.push(bt||[],I+1,2*R+1,2*V+1)}}getTile(k,I,R){k=+k,I=+I,R=+R;let V=this.options,{extent:Y,debug:ee}=V;if(k<0||k>24)return null;let re=1<1&&console.log("drilling down to z%d-%d-%d",k,I,R);let he,me=k,le=I,Te=R;for(;!he&&me>0;)me--,le>>=1,Te>>=1,he=this.tiles[Ji(me,le,Te)];return he&&he.source?(ee>1&&(console.log("found parent tile z%d-%d-%d",me,le,Te),console.time("drilling down")),this.splitTile(he.source,me,le,Te,k,I,R),ee>1&&console.timeEnd("drilling down"),this.tiles[H]?Ai(this.tiles[H],Y):null):null}}function Ji(j,k,I){return 32*((1<{le.properties=Ke;let tt={};for(let zt of Te)tt[zt]=H[zt].evaluate(me,le);return tt},ee.reduce=(Ke,tt)=>{le.properties=tt;for(let zt of Te)me.accumulated=Ke[zt],Ke[zt]=he[zt].evaluate(me,le)},ee}(k)).load((yield this._pendingData).features):(V=yield this._pendingData,new Si(V,k.geojsonVtOptions)),this.loaded={};let Y={};if(R){let ee=R.finish();ee&&(Y.resourceTiming={},Y.resourceTiming[k.source]=JSON.parse(JSON.stringify(ee)))}return Y}catch(Y){if(delete this._pendingRequest,E.bB(Y))return{abandoned:!0};throw Y}var V})}getData(){return E._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(k){let I=this.loaded;return I&&I[k.uid]?super.reloadTile(k):this.loadTile(k)}loadAndProcessGeoJSON(k,I){return E._(this,void 0,void 0,function*(){let R=yield this.loadGeoJSON(k,I);if(delete this._pendingRequest,typeof R!="object")throw new Error(`Input data given to '${k.source}' is not a valid GeoJSON object.`);if(Et(R,!0),k.filter){let V=E.bC(k.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(V.result==="error")throw new Error(V.value.map(ee=>`${ee.key}: ${ee.message}`).join(", "));R={type:"FeatureCollection",features:R.features.filter(ee=>V.value.evaluate({zoom:0},ee))}}return R})}loadGeoJSON(k,I){return E._(this,void 0,void 0,function*(){let{promoteId:R}=k;if(k.request){let V=yield E.h(k.request,I);return this._dataUpdateable=Ki(V.data,R)?yr(V.data,R):void 0,V.data}if(typeof k.data=="string")try{let V=JSON.parse(k.data);return this._dataUpdateable=Ki(V,R)?yr(V,R):void 0,V}catch{throw new Error(`Input data given to '${k.source}' is not a valid GeoJSON object.`)}if(!k.dataDiff)throw new Error(`Input data given to '${k.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${k.source}`);return function(V,Y,ee){var re,H,he,me;if(Y.removeAll&&V.clear(),Y.remove)for(let le of Y.remove)V.delete(le);if(Y.add)for(let le of Y.add){let Te=st(le,ee);Te!=null&&V.set(Te,le)}if(Y.update)for(let le of Y.update){let Te=V.get(le.id);if(Te==null)continue;let Ke=!le.removeAllProperties&&(((re=le.removeProperties)===null||re===void 0?void 0:re.length)>0||((H=le.addOrUpdateProperties)===null||H===void 0?void 0:H.length)>0);if((le.newGeometry||le.removeAllProperties||Ke)&&(Te=Object.assign({},Te),V.set(le.id,Te),Ke&&(Te.properties=Object.assign({},Te.properties))),le.newGeometry&&(Te.geometry=le.newGeometry),le.removeAllProperties)Te.properties={};else if(((he=le.removeProperties)===null||he===void 0?void 0:he.length)>0)for(let tt of le.removeProperties)Object.prototype.hasOwnProperty.call(Te.properties,tt)&&delete Te.properties[tt];if(((me=le.addOrUpdateProperties)===null||me===void 0?void 0:me.length)>0)for(let{key:tt,value:zt}of le.addOrUpdateProperties)Te.properties[tt]=zt}}(this._dataUpdateable,k.dataDiff,R),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(k){return E._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(k){return this._geoJSONIndex.getClusterExpansionZoom(k.clusterId)}getClusterChildren(k){return this._geoJSONIndex.getChildren(k.clusterId)}getClusterLeaves(k){return this._geoJSONIndex.getLeaves(k.clusterId,k.limit,k.offset)}}class Zr{constructor(k){this.self=k,this.actor=new E.F(k),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(I,R)=>{if(this.externalWorkerSourceTypes[I])throw new Error(`Worker source with name "${I}" already registered.`);this.externalWorkerSourceTypes[I]=R},this.self.addProtocol=E.bi,this.self.removeProtocol=E.bj,this.self.registerRTLTextPlugin=I=>{if(E.bD.isParsed())throw new Error("RTL text plugin already registered.");E.bD.setMethods(I)},this.actor.registerMessageHandler("LDT",(I,R)=>this._getDEMWorkerSource(I,R.source).loadTile(R)),this.actor.registerMessageHandler("RDT",(I,R)=>E._(this,void 0,void 0,function*(){this._getDEMWorkerSource(I,R.source).removeTile(R)})),this.actor.registerMessageHandler("GCEZ",(I,R)=>E._(this,void 0,void 0,function*(){return this._getWorkerSource(I,R.type,R.source).getClusterExpansionZoom(R)})),this.actor.registerMessageHandler("GCC",(I,R)=>E._(this,void 0,void 0,function*(){return this._getWorkerSource(I,R.type,R.source).getClusterChildren(R)})),this.actor.registerMessageHandler("GCL",(I,R)=>E._(this,void 0,void 0,function*(){return this._getWorkerSource(I,R.type,R.source).getClusterLeaves(R)})),this.actor.registerMessageHandler("LD",(I,R)=>this._getWorkerSource(I,R.type,R.source).loadData(R)),this.actor.registerMessageHandler("GD",(I,R)=>this._getWorkerSource(I,R.type,R.source).getData()),this.actor.registerMessageHandler("LT",(I,R)=>this._getWorkerSource(I,R.type,R.source).loadTile(R)),this.actor.registerMessageHandler("RT",(I,R)=>this._getWorkerSource(I,R.type,R.source).reloadTile(R)),this.actor.registerMessageHandler("AT",(I,R)=>this._getWorkerSource(I,R.type,R.source).abortTile(R)),this.actor.registerMessageHandler("RMT",(I,R)=>this._getWorkerSource(I,R.type,R.source).removeTile(R)),this.actor.registerMessageHandler("RS",(I,R)=>E._(this,void 0,void 0,function*(){if(!this.workerSources[I]||!this.workerSources[I][R.type]||!this.workerSources[I][R.type][R.source])return;let V=this.workerSources[I][R.type][R.source];delete this.workerSources[I][R.type][R.source],V.removeSource!==void 0&&V.removeSource(R)})),this.actor.registerMessageHandler("RM",I=>E._(this,void 0,void 0,function*(){delete this.layerIndexes[I],delete this.availableImages[I],delete this.workerSources[I],delete this.demWorkerSources[I]})),this.actor.registerMessageHandler("SR",(I,R)=>E._(this,void 0,void 0,function*(){this.referrer=R})),this.actor.registerMessageHandler("SRPS",(I,R)=>this._syncRTLPluginState(I,R)),this.actor.registerMessageHandler("IS",(I,R)=>E._(this,void 0,void 0,function*(){this.self.importScripts(R)})),this.actor.registerMessageHandler("SI",(I,R)=>this._setImages(I,R)),this.actor.registerMessageHandler("UL",(I,R)=>E._(this,void 0,void 0,function*(){this._getLayerIndex(I).update(R.layers,R.removedIds)})),this.actor.registerMessageHandler("SL",(I,R)=>E._(this,void 0,void 0,function*(){this._getLayerIndex(I).replace(R)}))}_setImages(k,I){return E._(this,void 0,void 0,function*(){this.availableImages[k]=I;for(let R in this.workerSources[k]){let V=this.workerSources[k][R];for(let Y in V)V[Y].availableImages=I}})}_syncRTLPluginState(k,I){return E._(this,void 0,void 0,function*(){if(E.bD.isParsed())return E.bD.getState();if(I.pluginStatus!=="loading")return E.bD.setState(I),I;let R=I.pluginURL;if(this.self.importScripts(R),E.bD.isParsed()){let V={pluginStatus:"loaded",pluginURL:R};return E.bD.setState(V),V}throw E.bD.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${R}`)})}_getAvailableImages(k){let I=this.availableImages[k];return I||(I=[]),I}_getLayerIndex(k){let I=this.layerIndexes[k];return I||(I=this.layerIndexes[k]=new p),I}_getWorkerSource(k,I,R){if(this.workerSources[k]||(this.workerSources[k]={}),this.workerSources[k][I]||(this.workerSources[k][I]={}),!this.workerSources[k][I][R]){let V={sendAsync:(Y,ee)=>(Y.targetMapId=k,this.actor.sendAsync(Y,ee))};switch(I){case"vector":this.workerSources[k][I][R]=new se(V,this._getLayerIndex(k),this._getAvailableImages(k));break;case"geojson":this.workerSources[k][I][R]=new on(V,this._getLayerIndex(k),this._getAvailableImages(k));break;default:this.workerSources[k][I][R]=new this.externalWorkerSourceTypes[I](V,this._getLayerIndex(k),this._getAvailableImages(k))}}return this.workerSources[k][I][R]}_getDEMWorkerSource(k,I){return this.demWorkerSources[k]||(this.demWorkerSources[k]={}),this.demWorkerSources[k][I]||(this.demWorkerSources[k][I]=new W),this.demWorkerSources[k][I]}}return E.i(self)&&(self.worker=new Zr(self)),Zr}),F("index",["exports","./shared"],function(E,p){"use strict";var ue="4.7.1";let pe,De,se={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:c=>new Promise((e,n)=>{let s=requestAnimationFrame(e);c.signal.addEventListener("abort",()=>{cancelAnimationFrame(s),n(p.c())})}),getImageData(c,e=0){return this.getImageCanvasContext(c).getImageData(-e,-e,c.width+2*e,c.height+2*e)},getImageCanvasContext(c){let e=window.document.createElement("canvas"),n=e.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("failed to create canvas 2d context");return e.width=c.width,e.height=c.height,n.drawImage(c,0,0,c.width,c.height),n},resolveURL:c=>(pe||(pe=document.createElement("a")),pe.href=c,pe.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(De==null&&(De=matchMedia("(prefers-reduced-motion: reduce)")),De.matches)}};class W{static testProp(e){if(!W.docStyle)return e[0];for(let n=0;n{window.removeEventListener("click",W.suppressClickInternal,!0)},0)}static getScale(e){let n=e.getBoundingClientRect();return{x:n.width/e.offsetWidth||1,y:n.height/e.offsetHeight||1,boundingClientRect:n}}static getPoint(e,n,s){let o=n.boundingClientRect;return new p.P((s.clientX-o.left)/n.x-e.clientLeft,(s.clientY-o.top)/n.y-e.clientTop)}static mousePos(e,n){let s=W.getScale(e);return W.getPoint(e,s,n)}static touchPos(e,n){let s=[],o=W.getScale(e);for(let u=0;u{gt&&Pt(gt),gt=null,Lt=!0},Et.onerror=()=>{li=!0,gt=null},Et.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(c){let e,n,s,o;c.resetRequestQueue=()=>{e=[],n=0,s=0,o={}},c.addThrottleControl=y=>{let b=s++;return o[b]=y,b},c.removeThrottleControl=y=>{delete o[y],m()},c.getImage=(y,b,T=!0)=>new Promise((C,P)=>{Mt.supported&&(y.headers||(y.headers={}),y.headers.accept="image/webp,*/*"),p.e(y,{type:"image"}),e.push({abortController:b,requestParameters:y,supportImageRefresh:T,state:"queued",onError:L=>{P(L)},onSuccess:L=>{C(L)}}),m()});let u=y=>p._(this,void 0,void 0,function*(){y.state="running";let{requestParameters:b,supportImageRefresh:T,onError:C,onSuccess:P,abortController:L}=y,O=T===!1&&!p.i(self)&&!p.g(b.url)&&(!b.headers||Object.keys(b.headers).reduce((G,X)=>G&&X==="accept",!0));n++;let U=O?_(b,L):p.m(b,L);try{let G=yield U;delete y.abortController,y.state="completed",G.data instanceof HTMLImageElement||p.b(G.data)?P(G):G.data&&P({data:yield(Z=G.data,typeof createImageBitmap=="function"?p.d(Z):p.f(Z)),cacheControl:G.cacheControl,expires:G.expires})}catch(G){delete y.abortController,C(G)}finally{n--,m()}var Z}),m=()=>{let y=(()=>{for(let b of Object.keys(o))if(o[b]())return!0;return!1})()?p.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:p.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let b=n;b0;b++){let T=e.shift();T.abortController.signal.aborted?b--:u(T)}},_=(y,b)=>new Promise((T,C)=>{let P=new Image,L=y.url,O=y.credentials;O&&O==="include"?P.crossOrigin="use-credentials":(O&&O==="same-origin"||!p.s(L))&&(P.crossOrigin="anonymous"),b.signal.addEventListener("abort",()=>{P.src="",C(p.c())}),P.fetchPriority="high",P.onload=()=>{P.onerror=P.onload=null,T({data:P})},P.onerror=()=>{P.onerror=P.onload=null,b.signal.aborted||C(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."))},P.src=L})}(ge||(ge={})),ge.resetRequestQueue();class $e{constructor(e){this._transformRequestFn=e}transformRequest(e,n){return this._transformRequestFn&&this._transformRequestFn(e,n)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function Pe(c){var e=new p.A(3);return e[0]=c[0],e[1]=c[1],e[2]=c[2],e}var Fe,Ye=function(c,e,n){return c[0]=e[0]-n[0],c[1]=e[1]-n[1],c[2]=e[2]-n[2],c};Fe=new p.A(3),p.A!=Float32Array&&(Fe[0]=0,Fe[1]=0,Fe[2]=0);var ve=function(c){var e=c[0],n=c[1];return e*e+n*n};function xe(c){let e=[];if(typeof c=="string")e.push({id:"default",url:c});else if(c&&c.length>0){let n=[];for(let{id:s,url:o}of c){let u=`${s}${o}`;n.indexOf(u)===-1&&(n.push(u),e.push({id:s,url:o}))}}return e}function Ae(c,e,n){let s=c.split("?");return s[0]+=`${e}${n}`,s.join("?")}(function(){var c=new p.A(2);p.A!=Float32Array&&(c[0]=0,c[1]=0)})();class ye{constructor(e,n,s,o){this.context=e,this.format=s,this.texture=e.gl.createTexture(),this.update(n,o)}update(e,n,s){let{width:o,height:u}=e,m=!(this.size&&this.size[0]===o&&this.size[1]===u||s),{context:_}=this,{gl:y}=_;if(this.useMipmap=!!(n&&n.useMipmap),y.bindTexture(y.TEXTURE_2D,this.texture),_.pixelStoreUnpackFlipY.set(!1),_.pixelStoreUnpack.set(1),_.pixelStoreUnpackPremultiplyAlpha.set(this.format===y.RGBA&&(!n||n.premultiply!==!1)),m)this.size=[o,u],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||p.b(e)?y.texImage2D(y.TEXTURE_2D,0,this.format,this.format,y.UNSIGNED_BYTE,e):y.texImage2D(y.TEXTURE_2D,0,this.format,o,u,0,this.format,y.UNSIGNED_BYTE,e.data);else{let{x:b,y:T}=s||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||p.b(e)?y.texSubImage2D(y.TEXTURE_2D,0,b,T,y.RGBA,y.UNSIGNED_BYTE,e):y.texSubImage2D(y.TEXTURE_2D,0,b,T,o,u,y.RGBA,y.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&y.generateMipmap(y.TEXTURE_2D)}bind(e,n,s){let{context:o}=this,{gl:u}=o;u.bindTexture(u.TEXTURE_2D,this.texture),s!==u.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=u.LINEAR),e!==this.filter&&(u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,e),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,s||e),this.filter=e),n!==this.wrap&&(u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,n),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,n),this.wrap=n)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}function Xe(c){let{userImage:e}=c;return!!(e&&e.render&&e.render())&&(c.data.replace(new Uint8Array(e.data.buffer)),!0)}class Ie extends p.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new p.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:n,promiseResolve:s}of this.requestors)s(this._getImagesForIds(n));this.requestors=[]}}getImage(e){let n=this.images[e];if(n&&!n.data&&n.spriteData){let s=n.spriteData;n.data=new p.R({width:s.width,height:s.height},s.context.getImageData(s.x,s.y,s.width,s.height).data),n.spriteData=null}return n}addImage(e,n){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,n)&&(this.images[e]=n)}_validate(e,n){let s=!0,o=n.data||n.spriteData;return this._validateStretch(n.stretchX,o&&o.width)||(this.fire(new p.j(new Error(`Image "${e}" has invalid "stretchX" value`))),s=!1),this._validateStretch(n.stretchY,o&&o.height)||(this.fire(new p.j(new Error(`Image "${e}" has invalid "stretchY" value`))),s=!1),this._validateContent(n.content,n)||(this.fire(new p.j(new Error(`Image "${e}" has invalid "content" value`))),s=!1),s}_validateStretch(e,n){if(!e)return!0;let s=0;for(let o of e){if(o[0]{let o=!0;if(!this.isLoaded())for(let u of e)this.images[u]||(o=!1);this.isLoaded()||o?n(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:n})})}_getImagesForIds(e){let n={};for(let s of e){let o=this.getImage(s);o||(this.fire(new p.k("styleimagemissing",{id:s})),o=this.getImage(s)),o?n[s]={data:o.data.clone(),pixelRatio:o.pixelRatio,sdf:o.sdf,version:o.version,stretchX:o.stretchX,stretchY:o.stretchY,content:o.content,textFitWidth:o.textFitWidth,textFitHeight:o.textFitHeight,hasRenderCallback:!!(o.userImage&&o.userImage.render)}:p.w(`Image "${s}" 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 n}getPixelSize(){let{width:e,height:n}=this.atlasImage;return{width:e,height:n}}getPattern(e){let n=this.patterns[e],s=this.getImage(e);if(!s)return null;if(n&&n.position.version===s.version)return n.position;if(n)n.position.version=s.version;else{let o={w:s.data.width+2,h:s.data.height+2,x:0,y:0},u=new p.I(o,s);this.patterns[e]={bin:o,position:u}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){let n=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new ye(e,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){let e=[];for(let u in this.patterns)e.push(this.patterns[u].bin);let{w:n,h:s}=p.p(e),o=this.atlasImage;o.resize({width:n||1,height:s||1});for(let u in this.patterns){let{bin:m}=this.patterns[u],_=m.x+1,y=m.y+1,b=this.getImage(u).data,T=b.width,C=b.height;p.R.copy(b,o,{x:0,y:0},{x:_,y},{width:T,height:C}),p.R.copy(b,o,{x:0,y:C-1},{x:_,y:y-1},{width:T,height:1}),p.R.copy(b,o,{x:0,y:0},{x:_,y:y+C},{width:T,height:1}),p.R.copy(b,o,{x:T-1,y:0},{x:_-1,y},{width:1,height:C}),p.R.copy(b,o,{x:0,y:0},{x:_+T,y},{width:1,height:C})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let n of e){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;let s=this.getImage(n);s||p.w(`Image with ID: "${n}" was not found`),Xe(s)&&this.updateImage(n,s)}}}let Qe=1e20;function qe(c,e,n,s,o,u,m,_,y){for(let b=e;b-1);y++,u[y]=_,m[y]=b,m[y+1]=Qe}for(let _=0,y=0;_65535)throw new Error("glyphs > 65535 not supported");if(s.ranges[u])return{stack:e,id:n,glyph:o};if(!this.url)throw new Error("glyphsUrl is not set");if(!s.requests[u]){let _=ht.loadGlyphRange(e,u,this.url,this.requestManager);s.requests[u]=_}let m=yield s.requests[u];for(let _ in m)this._doesCharSupportLocalGlyph(+_)||(s.glyphs[+_]=m[+_]);return s.ranges[u]=!0,{stack:e,id:n,glyph:m[n]||null}})}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&/\p{Ideo}|\p{sc=Hang}|\p{sc=Hira}|\p{sc=Kana}/u.test(String.fromCodePoint(e))}_tinySDF(e,n,s){let o=this.localIdeographFontFamily;if(!o||!this._doesCharSupportLocalGlyph(s))return;let u=e.tinySDF;if(!u){let _="400";/bold/i.test(n)?_="900":/medium/i.test(n)?_="500":/light/i.test(n)&&(_="200"),u=e.tinySDF=new ht.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:o,fontWeight:_})}let m=u.draw(String.fromCharCode(s));return{id:s,bitmap:new p.o({width:m.width||60,height:m.height||60},m.data),metrics:{width:m.glyphWidth/2||24,height:m.glyphHeight/2||24,left:m.glyphLeft/2+.5||0,top:m.glyphTop/2-27.5||-8,advance:m.glyphAdvance/2||24,isDoubleResolution:!0}}}}ht.loadGlyphRange=function(c,e,n,s){return p._(this,void 0,void 0,function*(){let o=256*e,u=o+255,m=s.transformRequest(n.replace("{fontstack}",c).replace("{range}",`${o}-${u}`),"Glyphs"),_=yield p.l(m,new AbortController);if(!_||!_.data)throw new Error(`Could not load glyph range. range: ${e}, ${o}-${u}`);let y={};for(let b of p.n(_.data))y[b.id]=b;return y})},ht.TinySDF=class{constructor({fontSize:c=24,buffer:e=3,radius:n=8,cutoff:s=.25,fontFamily:o="sans-serif",fontWeight:u="normal",fontStyle:m="normal"}={}){this.buffer=e,this.cutoff=s,this.radius=n;let _=this.size=c+4*e,y=this._createCanvas(_),b=this.ctx=y.getContext("2d",{willReadFrequently:!0});b.font=`${m} ${u} ${c}px ${o}`,b.textBaseline="alphabetic",b.textAlign="left",b.fillStyle="black",this.gridOuter=new Float64Array(_*_),this.gridInner=new Float64Array(_*_),this.f=new Float64Array(_),this.z=new Float64Array(_+1),this.v=new Uint16Array(_)}_createCanvas(c){let e=document.createElement("canvas");return e.width=e.height=c,e}draw(c){let{width:e,actualBoundingBoxAscent:n,actualBoundingBoxDescent:s,actualBoundingBoxLeft:o,actualBoundingBoxRight:u}=this.ctx.measureText(c),m=Math.ceil(n),_=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(u-o))),y=Math.min(this.size-this.buffer,m+Math.ceil(s)),b=_+2*this.buffer,T=y+2*this.buffer,C=Math.max(b*T,0),P=new Uint8ClampedArray(C),L={data:P,width:b,height:T,glyphWidth:_,glyphHeight:y,glyphTop:m,glyphLeft:0,glyphAdvance:e};if(_===0||y===0)return L;let{ctx:O,buffer:U,gridInner:Z,gridOuter:G}=this;O.clearRect(U,U,_,y),O.fillText(c,U,U+m);let X=O.getImageData(U,U,_,y);G.fill(Qe,0,C),Z.fill(0,0,C);for(let N=0;N0?fe*fe:0,Z[ae]=fe<0?fe*fe:0}}qe(G,0,0,b,T,b,this.f,this.v,this.z),qe(Z,U,U,_,y,b,this.f,this.v,this.z);for(let N=0;N1&&(y=e[++_]);let T=Math.abs(b-y.left),C=Math.abs(b-y.right),P=Math.min(T,C),L,O=u/s*(o+1);if(y.isDash){let U=o-Math.abs(O);L=Math.sqrt(P*P+U*U)}else L=o-Math.sqrt(P*P+O*O);this.data[m+b]=Math.max(0,Math.min(255,L+128))}}}addRegularDash(e){for(let _=e.length-1;_>=0;--_){let y=e[_],b=e[_+1];y.zeroLength?e.splice(_,1):b&&b.isDash===y.isDash&&(b.left=y.left,e.splice(_,1))}let n=e[0],s=e[e.length-1];n.isDash===s.isDash&&(n.left=s.left-this.width,s.right=n.right+this.width);let o=this.width*this.nextRow,u=0,m=e[u];for(let _=0;_1&&(m=e[++u]);let y=Math.abs(_-m.left),b=Math.abs(_-m.right),T=Math.min(y,b);this.data[o+_]=Math.max(0,Math.min(255,(m.isDash?T:-T)+128))}}addDash(e,n){let s=n?7:0,o=2*s+1;if(this.nextRow+o>this.height)return p.w("LineAtlas out of space"),null;let u=0;for(let _=0;_{n.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[_t]}numActive(){return Object.keys(this.active).length}}let Vt=Math.floor(se.hardwareConcurrency/2),xt,ui;function et(){return xt||(xt=new Rt),xt}Rt.workerCount=p.C(globalThis)?Math.max(Math.min(Vt,3),1):1;class yt{constructor(e,n){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=n;let s=this.workerPool.acquire(n);for(let o=0;o{n.remove()}),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,n){for(let s of this.actors)s.registerMessageHandler(e,n)}}function jt(){return ui||(ui=new yt(et(),p.G),ui.registerMessageHandler("GR",(c,e,n)=>p.m(e,n))),ui}function ut(c,e){let n=p.H();return p.J(n,n,[1,1,0]),p.K(n,n,[.5*c.width,.5*c.height,1]),p.L(n,n,c.calculatePosMatrix(e.toUnwrapped()))}function ci(c,e,n,s,o,u){let m=function(C,P,L){if(C)for(let O of C){let U=P[O];if(U&&U.source===L&&U.type==="fill-extrusion")return!0}else for(let O in P){let U=P[O];if(U.source===L&&U.type==="fill-extrusion")return!0}return!1}(o&&o.layers,e,c.id),_=u.maxPitchScaleFactor(),y=c.tilesIn(s,_,m);y.sort(bi);let b=[];for(let C of y)b.push({wrappedTileID:C.tileID.wrapped().key,queryResults:C.tile.queryRenderedFeatures(e,n,c._state,C.queryGeometry,C.cameraQueryGeometry,C.scale,o,u,_,ut(c.transform,C.tileID))});let T=function(C){let P={},L={};for(let O of C){let U=O.queryResults,Z=O.wrappedTileID,G=L[Z]=L[Z]||{};for(let X in U){let N=U[X],Q=G[X]=G[X]||{},te=P[X]=P[X]||[];for(let ae of N)Q[ae.featureIndex]||(Q[ae.featureIndex]=!0,te.push(ae))}}return P}(b);for(let C in T)T[C].forEach(P=>{let L=P.feature,O=c.getFeatureState(L.layer["source-layer"],L.id);L.source=L.layer.source,L.layer["source-layer"]&&(L.sourceLayer=L.layer["source-layer"]),L.state=O});return T}function bi(c,e){let n=c.tileID,s=e.tileID;return n.overscaledZ-s.overscaledZ||n.canonical.y-s.canonical.y||n.wrap-s.wrap||n.canonical.x-s.canonical.x}function Kt(c,e,n){return p._(this,void 0,void 0,function*(){let s=c;if(c.url?s=(yield p.h(e.transformRequest(c.url,"Source"),n)).data:yield se.frameAsync(n),!s)return null;let o=p.M(p.e(s,c),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in s&&s.vector_layers&&(o.vectorLayerIds=s.vector_layers.map(u=>u.id)),o})}class oe{constructor(e,n){e&&(n?this.setSouthWest(e).setNorthEast(n):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof p.N?new p.N(e.lng,e.lat):p.N.convert(e),this}setSouthWest(e){return this._sw=e instanceof p.N?new p.N(e.lng,e.lat):p.N.convert(e),this}extend(e){let n=this._sw,s=this._ne,o,u;if(e instanceof p.N)o=e,u=e;else{if(!(e instanceof oe))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(oe.convert(e)):this.extend(p.N.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(p.N.convert(e)):this;if(o=e._sw,u=e._ne,!o||!u)return this}return n||s?(n.lng=Math.min(o.lng,n.lng),n.lat=Math.min(o.lat,n.lat),s.lng=Math.max(u.lng,s.lng),s.lat=Math.max(u.lat,s.lat)):(this._sw=new p.N(o.lng,o.lat),this._ne=new p.N(u.lng,u.lat)),this}getCenter(){return new p.N((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 p.N(this.getWest(),this.getNorth())}getSouthEast(){return new p.N(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(e){let{lng:n,lat:s}=p.N.convert(e),o=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=s&&s<=this._ne.lat&&o}static convert(e){return e instanceof oe?e:e&&new oe(e)}static fromLngLat(e,n=0){let s=360*n/40075017,o=s/Math.cos(Math.PI/180*e.lat);return new oe(new p.N(e.lng-o,e.lat-s),new p.N(e.lng+o,e.lat+s))}adjustAntiMeridian(){let e=new p.N(this._sw.lng,this._sw.lat),n=new p.N(this._ne.lng,this._ne.lat);return new oe(e,e.lng>n.lng?new p.N(n.lng+360,n.lat):n)}}class Xi{constructor(e,n,s){this.bounds=oe.convert(this.validateBounds(e)),this.minzoom=n||0,this.maxzoom=s||24}validateBounds(e){return Array.isArray(e)&&e.length===4?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){let n=Math.pow(2,e.z),s=Math.floor(p.O(this.bounds.getWest())*n),o=Math.floor(p.Q(this.bounds.getNorth())*n),u=Math.ceil(p.O(this.bounds.getEast())*n),m=Math.ceil(p.Q(this.bounds.getSouth())*n);return e.x>=s&&e.x=o&&e.y{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return p.e({},this._options)}loadTile(e){return p._(this,void 0,void 0,function*(){let n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),s={request:this.map._requestManager.transformRequest(n,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};s.request.collectResourceTiming=this._collectResourceTiming;let o="RT";if(e.actor&&e.state!=="expired"){if(e.state==="loading")return new Promise((u,m)=>{e.reloadPromise={resolve:u,reject:m}})}else e.actor=this.dispatcher.getActor(),o="LT";e.abortController=new AbortController;try{let u=yield e.actor.sendAsync({type:o,data:s},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,u)}catch(u){if(delete e.abortController,e.aborted)return;if(u&&u.status!==404)throw u;this._afterTileLoadWorkerResponse(e,null)}})}_afterTileLoadWorkerResponse(e,n){if(n&&n.resourceTiming&&(e.resourceTiming=n.resourceTiming),n&&this.map._refreshExpiredTiles&&e.setExpiryData(n),e.loadVectorData(n,this.map.painter),e.reloadPromise){let s=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(s.resolve).catch(s.reject)}}abortTile(e){return p._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}}))})}unloadTile(e){return p._(this,void 0,void 0,function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class wt extends p.E{constructor(e,n,s,o){super(),this.id=e,this.dispatcher=s,this.setEventedParent(o),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=p.e({type:"raster"},n),p.e(this,p.M(n,["url","scheme","tileSize"]))}load(){return p._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new p.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let e=yield Kt(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,e&&(p.e(this,e),e.bounds&&(this.tileBounds=new Xi(e.bounds,this.minzoom,this.maxzoom)),this.fire(new p.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new p.k("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new p.j(e))}})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return p.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return p._(this,void 0,void 0,function*(){let n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{let s=yield ge.getImage(this.map._requestManager.transformRequest(n,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(s&&s.data){this.map._refreshExpiredTiles&&s.cacheControl&&s.expires&&e.setExpiryData({cacheControl:s.cacheControl,expires:s.expires});let o=this.map.painter.context,u=o.gl,m=s.data;e.texture=this.map.painter.getTileTexture(m.width),e.texture?e.texture.update(m,{useMipmap:!0}):(e.texture=new ye(o,m,u.RGBA,{useMipmap:!0}),e.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE,u.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(s){if(delete e.abortController,e.aborted)e.state="unloaded";else if(s)throw e.state="errored",s}})}abortTile(e){return p._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)})}unloadTile(e){return p._(this,void 0,void 0,function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)})}hasTransition(){return!1}}class Gt extends wt{constructor(e,n,s,o){super(e,n,s,o),this.type="raster-dem",this.maxzoom=22,this._options=p.e({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox",this.redFactor=n.redFactor,this.greenFactor=n.greenFactor,this.blueFactor=n.blueFactor,this.baseShift=n.baseShift}loadTile(e){return p._(this,void 0,void 0,function*(){let n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),s=this.map._requestManager.transformRequest(n,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{let o=yield ge.getImage(s,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(o&&o.data){let u=o.data;this.map._refreshExpiredTiles&&o.cacheControl&&o.expires&&e.setExpiryData({cacheControl:o.cacheControl,expires:o.expires});let m=p.b(u)&&p.U()?u:yield this.readImageNow(u),_={type:this.type,uid:e.uid,source:this.id,rawImageData:m,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||e.state==="expired"){e.actor=this.dispatcher.getActor();let y=yield e.actor.sendAsync({type:"LDT",data:_});e.dem=y,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(o){if(delete e.abortController,e.aborted)e.state="unloaded";else if(o)throw e.state="errored",o}})}readImageNow(e){return p._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&p.V()){let n=e.width+2,s=e.height+2;try{return new p.R({width:n,height:s},yield p.W(e,-1,-1,n,s))}catch{}}return se.getImageData(e,1)})}_getNeighboringTiles(e){let n=e.canonical,s=Math.pow(2,n.z),o=(n.x-1+s)%s,u=n.x===0?e.wrap-1:e.wrap,m=(n.x+1+s)%s,_=n.x+1===s?e.wrap+1:e.wrap,y={};return y[new p.S(e.overscaledZ,u,n.z,o,n.y).key]={backfilled:!1},y[new p.S(e.overscaledZ,_,n.z,m,n.y).key]={backfilled:!1},n.y>0&&(y[new p.S(e.overscaledZ,u,n.z,o,n.y-1).key]={backfilled:!1},y[new p.S(e.overscaledZ,e.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},y[new p.S(e.overscaledZ,_,n.z,m,n.y-1).key]={backfilled:!1}),n.y+10&&p.e(u,{resourceTiming:o}),this.fire(new p.k("data",Object.assign(Object.assign({},u),{sourceDataType:"metadata"}))),this.fire(new p.k("data",Object.assign(Object.assign({},u),{sourceDataType:"content"})))}catch(s){if(this._pendingLoads--,this._removed)return void this.fire(new p.k("dataabort",{dataType:"source"}));this.fire(new p.j(s))}})}loaded(){return this._pendingLoads===0}loadTile(e){return p._(this,void 0,void 0,function*(){let n=e.actor?"RT":"LT";e.actor=this.actor;let s={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};e.abortController=new AbortController;let o=yield this.actor.sendAsync({type:n,data:s},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(o,this.map.painter,n==="RT")})}abortTile(e){return p._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0})}unloadTile(e){return p._(this,void 0,void 0,function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:e.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 p.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Mr=p.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Wi extends p.E{constructor(e,n,s,o){super(),this.id=e,this.dispatcher=s,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(o),this.options=n}load(e){return p._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new p.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{let n=yield ge.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,n&&n.data&&(this.image=n.data,e&&(this.coordinates=e),this._finishLoading())}catch(n){this._request=null,this._loaded=!0,this.fire(new p.j(n))}})}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new p.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;let n=e.map(p.Z.fromLngLat);this.tileID=function(o){let u=1/0,m=1/0,_=-1/0,y=-1/0;for(let P of o)u=Math.min(u,P.x),m=Math.min(m,P.y),_=Math.max(_,P.x),y=Math.max(y,P.y);let b=Math.max(_-u,y-m),T=Math.max(0,Math.floor(-Math.log(b)/Math.LN2)),C=Math.pow(2,T);return new p.a1(T,Math.floor((u+_)/2*C),Math.floor((m+y)/2*C))}(n),this.minzoom=this.maxzoom=this.tileID.z;let s=n.map(o=>this.tileID.getTilePoint(o)._round());return this._boundsArray=new p.$,this._boundsArray.emplaceBack(s[0].x,s[0].y,0,0),this._boundsArray.emplaceBack(s[1].x,s[1].y,p.X,0),this._boundsArray.emplaceBack(s[3].x,s[3].y,0,p.X),this._boundsArray.emplaceBack(s[2].x,s[2].y,p.X,p.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new p.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let e=this.map.painter.context,n=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Mr.members)),this.boundsSegments||(this.boundsSegments=p.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new ye(e,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let s=!1;for(let o in this.tiles){let u=this.tiles[o];u.state!=="loaded"&&(u.state="loaded",u.texture=this.texture,s=!0)}s&&this.fire(new p.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return p._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Qr extends Wi{constructor(e,n,s,o){super(e,n,s,o),this.roundZoom=!0,this.type="video",this.options=n}load(){return p._(this,void 0,void 0,function*(){this._loaded=!1;let e=this.options;this.urls=[];for(let n of e.urls)this.urls.push(this.map._requestManager.transformRequest(n,"Source").url);try{let n=yield p.a3(this.urls);if(this._loaded=!0,!n)return;this.video=n,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(n){this.fire(new p.j(n))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let n=this.video.seekable;en.end(0)?this.fire(new p.j(new p.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let e=this.map.painter.context,n=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Mr.members)),this.boundsSegments||(this.boundsSegments=p.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new ye(e,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let s=!1;for(let o in this.tiles){let u=this.tiles[o];u.state!=="loaded"&&(u.state="loaded",u.texture=this.texture,s=!0)}s&&this.fire(new p.k("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 Ui extends Wi{constructor(e,n,s,o){super(e,n,s,o),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(u=>!Array.isArray(u)||u.length!==2||u.some(m=>typeof m!="number"))||this.fire(new p.j(new p.a2(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new p.j(new p.a2(`sources.${e}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new p.j(new p.a2(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new p.j(new p.a2(`sources.${e}`,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 p.j(new p.a2(`sources.${e}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){return p._(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 p.j(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(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let n=this.map.painter.context,s=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,Mr.members)),this.boundsSegments||(this.boundsSegments=p.a0.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new ye(n,this.canvas,s.RGBA,{premultiply:!0});let o=!1;for(let u in this.tiles){let m=this.tiles[u];m.state!=="loaded"&&(m.state="loaded",m.texture=this.texture,o=!0)}o&&this.fire(new p.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}let sn={},yn=c=>{switch(c){case"geojson":return _r;case"image":return Wi;case"raster":return wt;case"raster-dem":return Gt;case"vector":return kr;case"video":return Qr;case"canvas":return Ui}return sn[c]},we="RTLPluginLoaded";class or extends p.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=jt()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(n=>{throw this.status="error",n})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return p._(this,arguments,void 0,function*(n,s=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=se.resolveURL(n),!this.url)throw new Error(`requested url ${n} is invalid`);if(this.status==="unavailable"){if(!s)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return p._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new p.k(we))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Ai=null;function lr(){return Ai||(Ai=new or),Ai}class Pr{constructor(e,n){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=p.a4(),this.uses=0,this.tileSize=n,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(e){let n=e+this.timeAdded;nu.getLayer(b)).filter(Boolean);if(y.length!==0){_.layers=y,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map(b=>y.filter(T=>T.id===b)[0]));for(let b of y)m[b.id]=_}}return m}(e.buckets,n.style),this.hasSymbolBuckets=!1;for(let o in this.buckets){let u=this.buckets[o];if(u instanceof p.a6){if(this.hasSymbolBuckets=!0,!s)break;u.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let o in this.buckets){let u=this.buckets[o];if(u instanceof p.a6&&u.hasRTLText){this.hasRTLText=!0,lr().lazyLoad();break}}this.queryPadding=0;for(let o in this.buckets){let u=this.buckets[o];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(o).queryRadius(u))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new p.a5}unloadVectorData(){for(let e in this.buckets)this.buckets[e].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(e){return this.buckets[e.id]}upload(e){for(let s in this.buckets){let o=this.buckets[s];o.uploadPending()&&o.upload(e)}let n=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new ye(e,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new ye(e,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,n,s,o,u,m,_,y,b,T){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:o,cameraQueryGeometry:u,scale:m,tileSize:this.tileSize,pixelPosMatrix:T,transform:y,params:_,queryPadding:this.queryPadding*b},e,n,s):{}}querySourceFeatures(e,n){let s=this.latestFeatureIndex;if(!s||!s.rawTileData)return;let o=s.loadVTLayers(),u=n&&n.sourceLayer?n.sourceLayer:"",m=o._geojsonTileLayer||o[u];if(!m)return;let _=p.a7(n&&n.filter),{z:y,x:b,y:T}=this.tileID.canonical,C={z:y,x:b,y:T};for(let P=0;Ps)o=!1;else if(n)if(this.expirationTime{this.remove(e,u)},s)),this.data[o].push(u),this.order.push(o),this.order.length>this.max){let m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let n=this.data[e].shift();return n.timeout&&clearTimeout(n.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),n.value}getByKey(e){let n=this.data[e];return n?n[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,n){if(!this.has(e))return this;let s=e.wrapped().key,o=n===void 0?0:this.data[s].indexOf(n),u=this.data[s][o];return this.data[s].splice(o,1),u.timeout&&clearTimeout(u.timeout),this.data[s].length===0&&delete this.data[s],this.onRemove(u.value),this.order.splice(this.order.indexOf(s),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(e){let n=[];for(let s in this.data)for(let o of this.data[s])e(o.value)||n.push(o);for(let s of n)this.remove(s.value.tileID,s)}}class mt{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,n,s){let o=String(n);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][o]=this.stateChanges[e][o]||{},p.e(this.stateChanges[e][o],s),this.deletedStates[e]===null){this.deletedStates[e]={};for(let u in this.state[e])u!==o&&(this.deletedStates[e][u]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][o]===null){this.deletedStates[e][o]={};for(let u in this.state[e][o])s[u]||(this.deletedStates[e][o][u]=null)}else for(let u in s)this.deletedStates[e]&&this.deletedStates[e][o]&&this.deletedStates[e][o][u]===null&&delete this.deletedStates[e][o][u]}removeFeatureState(e,n,s){if(this.deletedStates[e]===null)return;let o=String(n);if(this.deletedStates[e]=this.deletedStates[e]||{},s&&n!==void 0)this.deletedStates[e][o]!==null&&(this.deletedStates[e][o]=this.deletedStates[e][o]||{},this.deletedStates[e][o][s]=null);else if(n!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][o])for(s in this.deletedStates[e][o]={},this.stateChanges[e][o])this.deletedStates[e][o][s]=null;else this.deletedStates[e][o]=null;else this.deletedStates[e]=null}getState(e,n){let s=String(n),o=p.e({},(this.state[e]||{})[s],(this.stateChanges[e]||{})[s]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){let u=this.deletedStates[e][n];if(u===null)return{};for(let m in u)delete o[m]}return o}initializeTileState(e,n){e.setFeatureState(this.state,n)}coalesceChanges(e,n){let s={};for(let o in this.stateChanges){this.state[o]=this.state[o]||{};let u={};for(let m in this.stateChanges[o])this.state[o][m]||(this.state[o][m]={}),p.e(this.state[o][m],this.stateChanges[o][m]),u[m]=this.state[o][m];s[o]=u}for(let o in this.deletedStates){this.state[o]=this.state[o]||{};let u={};if(this.deletedStates[o]===null)for(let m in this.state[o])u[m]={},this.state[o][m]={};else for(let m in this.deletedStates[o]){if(this.deletedStates[o][m]===null)this.state[o][m]={};else for(let _ of Object.keys(this.deletedStates[o][m]))delete this.state[o][m][_];u[m]=this.state[o][m]}s[o]=s[o]||{},p.e(s[o],u)}if(this.stateChanges={},this.deletedStates={},Object.keys(s).length!==0)for(let o in e)e[o].setFeatureState(s,n)}}class nt extends p.E{constructor(e,n,s){super(),this.id=e,this.dispatcher=s,this.on("data",o=>this._dataHandler(o)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((o,u,m,_)=>{let y=new(yn(u.type))(o,u,m,_);if(y.id!==o)throw new Error(`Expected Source id to be ${o} instead of ${y.id}`);return y})(e,n,s,this),this._tiles={},this._cache=new Ee(0,o=>this._unloadTile(o)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new mt,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}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(let e in this._tiles){let n=this._tiles[e];if(n.state!=="loaded"&&n.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,n,s){return p._(this,void 0,void 0,function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,n,s)}catch(o){e.state="errored",o.status!==404?this._source.fire(new p.j(o,{tile:e})):this.update(this.transform,this.terrain)}})}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new p.k("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(let n in this._tiles){let s=this._tiles[n];s.upload(e),s.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(Si).map(e=>e.key)}getRenderableIds(e){let n=[];for(let s in this._tiles)this._isIdRenderable(s,e)&&n.push(this._tiles[s]);return e?n.sort((s,o)=>{let u=s.tileID,m=o.tileID,_=new p.P(u.canonical.x,u.canonical.y)._rotate(this.transform.angle),y=new p.P(m.canonical.x,m.canonical.y)._rotate(this.transform.angle);return u.overscaledZ-m.overscaledZ||y.y-_.y||y.x-_.x}).map(s=>s.tileID.key):n.map(s=>s.tileID).sort(Si).map(s=>s.key)}hasRenderableParent(e){let n=this.findLoadedParent(e,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(e,n){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(n||!this._tiles[e].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(let e in this._tiles)this._tiles[e].state!=="errored"&&this._reloadTile(e,"reloading")}}_reloadTile(e,n){return p._(this,void 0,void 0,function*(){let s=this._tiles[e];s&&(s.state!=="loading"&&(s.state=n),yield this._loadTile(s,e,n))})}_tileLoaded(e,n,s){e.timeAdded=se.now(),s==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(n,e),this.getSource().type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new p.k("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){let n=this.getRenderableIds();for(let o=0;o1||(Math.abs(m)>1&&(Math.abs(m+y)===1?m+=y:Math.abs(m-y)===1&&(m-=y)),u.dem&&o.dem&&(o.dem.backfillBorder(u.dem,m,_),o.neighboringTiles&&o.neighboringTiles[b]&&(o.neighboringTiles[b].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,n,s,o){for(let u in this._tiles){let m=this._tiles[u];if(o[u]||!m.hasData()||m.tileID.overscaledZ<=n||m.tileID.overscaledZ>s)continue;let _=m.tileID;for(;m&&m.tileID.overscaledZ>n+1;){let b=m.tileID.scaledTo(m.tileID.overscaledZ-1);m=this._tiles[b.key],m&&m.hasData()&&(_=b)}let y=_;for(;y.overscaledZ>n;)if(y=y.scaledTo(y.overscaledZ-1),e[y.key]){o[_.key]=_;break}}}findLoadedParent(e,n){if(e.key in this._loadedParentTiles){let s=this._loadedParentTiles[e.key];return s&&s.tileID.overscaledZ>=n?s:null}for(let s=e.overscaledZ-1;s>=n;s--){let o=e.scaledTo(s),u=this._getLoadedTile(o);if(u)return u}}findLoadedSibling(e){return this._getLoadedTile(e)}_getLoadedTile(e){let n=this._tiles[e.key];return n&&n.hasData()?n:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){let n=Math.ceil(e.width/this._source.tileSize)+1,s=Math.ceil(e.height/this._source.tileSize)+1,o=Math.floor(n*s*(this._maxTileCacheZoomLevels===null?p.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),u=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,o):o;this._cache.setMaxSize(u)}handleWrapJump(e){let n=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,n){let s={};for(let o in this._tiles){let u=this._tiles[o];u.tileID=u.tileID.unwrapTo(u.tileID.wrap+n),s[u.tileID.key]=u}this._tiles=s;for(let o in this._timers)clearTimeout(this._timers[o]),delete this._timers[o];for(let o in this._tiles)this._setTileReloadTimer(o,this._tiles[o])}}_updateCoveredAndRetainedTiles(e,n,s,o,u,m){let _={},y={},b=Object.keys(e),T=se.now();for(let C of b){let P=e[C],L=this._tiles[C];if(!L||L.fadeEndTime!==0&&L.fadeEndTime<=T)continue;let O=this.findLoadedParent(P,n),U=this.findLoadedSibling(P),Z=O||U||null;Z&&(this._addTile(Z.tileID),_[Z.tileID.key]=Z.tileID),y[C]=P}this._retainLoadedChildren(y,o,s,e);for(let C in _)e[C]||(this._coveredTiles[C]=!0,e[C]=_[C]);if(m){let C={},P={};for(let L of u)this._tiles[L.key].hasData()?C[L.key]=L:P[L.key]=L;for(let L in P){let O=P[L].children(this._source.maxzoom);this._tiles[O[0].key]&&this._tiles[O[1].key]&&this._tiles[O[2].key]&&this._tiles[O[3].key]&&(C[O[0].key]=e[O[0].key]=O[0],C[O[1].key]=e[O[1].key]=O[1],C[O[2].key]=e[O[2].key]=O[2],C[O[3].key]=e[O[3].key]=O[3],delete P[L])}for(let L in P){let O=P[L],U=this.findLoadedParent(O,this._source.minzoom),Z=this.findLoadedSibling(O),G=U||Z||null;if(G){C[G.tileID.key]=e[G.tileID.key]=G.tileID;for(let X in C)C[X].isChildOf(G.tileID)&&delete C[X]}}for(let L in this._tiles)C[L]||(this._coveredTiles[L]=!0)}}update(e,n){if(!this._sourceLoaded||this._paused)return;let s;this.transform=e,this.terrain=n,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?s=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(T=>new p.S(T.canonical.z,T.wrap,T.canonical.z,T.canonical.x,T.canonical.y)):(s=e.coveringTiles({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:n}),this._source.hasTile&&(s=s.filter(T=>this._source.hasTile(T)))):s=[];let o=e.coveringZoomLevel(this._source),u=Math.max(o-nt.maxOverzooming,this._source.minzoom),m=Math.max(o+nt.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let T={};for(let C of s)if(C.canonical.z>this._source.minzoom){let P=C.scaledTo(C.canonical.z-1);T[P.key]=P;let L=C.scaledTo(Math.max(this._source.minzoom,Math.min(C.canonical.z,5)));T[L.key]=L}s=s.concat(Object.values(T))}let _=s.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,_&&this.fire(new p.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let y=this._updateRetainedTiles(s,o);Ji(this._source.type)&&this._updateCoveredAndRetainedTiles(y,u,m,o,s,n);for(let T in y)this._tiles[T].clearFadeHold();let b=p.ab(this._tiles,y);for(let T of b){let C=this._tiles[T];C.hasSymbolBuckets&&!C.holdingForFade()?C.setHoldDuration(this.map._fadeDuration):C.hasSymbolBuckets&&!C.symbolFadeFinished()||this._removeTile(T)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(let e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,n){var s;let o={},u={},m=Math.max(n-nt.maxOverzooming,this._source.minzoom),_=Math.max(n+nt.maxUnderzooming,this._source.minzoom),y={};for(let b of e){let T=this._addTile(b);o[b.key]=b,T.hasData()||nthis._source.maxzoom){let P=b.children(this._source.maxzoom)[0],L=this.getTile(P);if(L&&L.hasData()){o[P.key]=P;continue}}else{let P=b.children(this._source.maxzoom);if(o[P[0].key]&&o[P[1].key]&&o[P[2].key]&&o[P[3].key])continue}let C=T.wasRequested();for(let P=b.overscaledZ-1;P>=m;--P){let L=b.scaledTo(P);if(u[L.key])break;if(u[L.key]=!0,T=this.getTile(L),!T&&C&&(T=this._addTile(L)),T){let O=T.hasData();if((O||!(!((s=this.map)===null||s===void 0)&&s.cancelPendingTileRequestsWhileZooming)||C)&&(o[L.key]=L),C=T.wasRequested(),O)break}}}return o}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let e in this._tiles){let n=[],s,o=this._tiles[e].tileID;for(;o.overscaledZ>0;){if(o.key in this._loadedParentTiles){s=this._loadedParentTiles[o.key];break}n.push(o.key);let u=o.scaledTo(o.overscaledZ-1);if(s=this._getLoadedTile(u),s)break;o=u}for(let u of n)this._loadedParentTiles[u]=s}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(let e in this._tiles){let n=this._tiles[e].tileID,s=this._getLoadedTile(n);this._loadedSiblingTiles[n.key]=s}}_addTile(e){let n=this._tiles[e.key];if(n)return n;n=this._cache.getAndRemove(e),n&&(this._setTileReloadTimer(e.key,n),n.tileID=e,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,n)));let s=n;return n||(n=new Pr(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(n,e.key,n.state)),n.uses++,this._tiles[e.key]=n,s||this._source.fire(new p.k("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(e,n){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);let s=n.getExpiryTimeout();s&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},s))}_removeTile(e){let n=this._tiles[e];n&&(n.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}_dataHandler(e){let n=e.sourceDataType;e.dataType==="source"&&n==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType==="source"&&n==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,n,s){let o=[],u=this.transform;if(!u)return o;let m=s?u.getCameraQueryGeometry(e):e,_=e.map(O=>u.pointCoordinate(O,this.terrain)),y=m.map(O=>u.pointCoordinate(O,this.terrain)),b=this.getIds(),T=1/0,C=1/0,P=-1/0,L=-1/0;for(let O of y)T=Math.min(T,O.x),C=Math.min(C,O.y),P=Math.max(P,O.x),L=Math.max(L,O.y);for(let O=0;O=0&&N[1].y+X>=0){let Q=_.map(ae=>Z.getTilePoint(ae)),te=y.map(ae=>Z.getTilePoint(ae));o.push({tile:U,tileID:Z,queryGeometry:Q,cameraQueryGeometry:te,scale:G})}}return o}getVisibleCoordinates(e){let n=this.getRenderableIds(e).map(s=>this._tiles[s].tileID);for(let s of n)s.posMatrix=this.transform.calculatePosMatrix(s.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if(Ji(this._source.type)){let e=se.now();for(let n in this._tiles)if(this._tiles[n].fadeEndTime>=e)return!0}return!1}setFeatureState(e,n,s){this._state.updateState(e=e||"_geojsonTileLayer",n,s)}removeFeatureState(e,n,s){this._state.removeFeatureState(e=e||"_geojsonTileLayer",n,s)}getFeatureState(e,n){return this._state.getState(e=e||"_geojsonTileLayer",n)}setDependencies(e,n,s){let o=this._tiles[e];o&&o.setDependencies(n,s)}reloadTilesForDependencies(e,n){for(let s in this._tiles)this._tiles[s].hasDependency(e,n)&&this._reloadTile(s,"reloading");this._cache.filter(s=>!s.hasDependency(e,n))}}function Si(c,e){let n=Math.abs(2*c.wrap)-+(c.wrap<0),s=Math.abs(2*e.wrap)-+(e.wrap<0);return c.overscaledZ-e.overscaledZ||s-n||e.canonical.y-c.canonical.y||e.canonical.x-c.canonical.x}function Ji(c){return c==="raster"||c==="image"||c==="video"}nt.maxOverzooming=10,nt.maxUnderzooming=3;class st{constructor(e,n){this.reset(e,n)}reset(e,n){this.points=e||[],this._distances=[0];for(let s=1;s0?(o-m)/_:0;return this.points[u].mult(1-y).add(this.points[n].mult(y))}}function Ki(c,e){let n=!0;return c==="always"||c!=="never"&&e!=="never"||(n=!1),n}class yr{constructor(e,n,s){let o=this.boxCells=[],u=this.circleCells=[];this.xCellCount=Math.ceil(e/s),this.yCellCount=Math.ceil(n/s);for(let m=0;mthis.width||o<0||n>this.height)return[];let y=[];if(e<=0&&n<=0&&this.width<=s&&this.height<=o){if(u)return[{key:null,x1:e,y1:n,x2:s,y2:o}];for(let b=0;b0}hitTestCircle(e,n,s,o,u){let m=e-s,_=e+s,y=n-s,b=n+s;if(_<0||m>this.width||b<0||y>this.height)return!1;let T=[];return this._forEachCell(m,y,_,b,this._queryCellCircle,T,{hitTest:!0,overlapMode:o,circle:{x:e,y:n,radius:s},seenUids:{box:{},circle:{}}},u),T.length>0}_queryCell(e,n,s,o,u,m,_,y){let{seenUids:b,hitTest:T,overlapMode:C}=_,P=this.boxCells[u];if(P!==null){let O=this.bboxes;for(let U of P)if(!b.box[U]){b.box[U]=!0;let Z=4*U,G=this.boxKeys[U];if(e<=O[Z+2]&&n<=O[Z+3]&&s>=O[Z+0]&&o>=O[Z+1]&&(!y||y(G))&&(!T||!Ki(C,G.overlapMode))&&(m.push({key:G,x1:O[Z],y1:O[Z+1],x2:O[Z+2],y2:O[Z+3]}),T))return!0}}let L=this.circleCells[u];if(L!==null){let O=this.circles;for(let U of L)if(!b.circle[U]){b.circle[U]=!0;let Z=3*U,G=this.circleKeys[U];if(this._circleAndRectCollide(O[Z],O[Z+1],O[Z+2],e,n,s,o)&&(!y||y(G))&&(!T||!Ki(C,G.overlapMode))){let X=O[Z],N=O[Z+1],Q=O[Z+2];if(m.push({key:G,x1:X-Q,y1:N-Q,x2:X+Q,y2:N+Q}),T)return!0}}}return!1}_queryCellCircle(e,n,s,o,u,m,_,y){let{circle:b,seenUids:T,overlapMode:C}=_,P=this.boxCells[u];if(P!==null){let O=this.bboxes;for(let U of P)if(!T.box[U]){T.box[U]=!0;let Z=4*U,G=this.boxKeys[U];if(this._circleAndRectCollide(b.x,b.y,b.radius,O[Z+0],O[Z+1],O[Z+2],O[Z+3])&&(!y||y(G))&&!Ki(C,G.overlapMode))return m.push(!0),!0}}let L=this.circleCells[u];if(L!==null){let O=this.circles;for(let U of L)if(!T.circle[U]){T.circle[U]=!0;let Z=3*U,G=this.circleKeys[U];if(this._circlesCollide(O[Z],O[Z+1],O[Z+2],b.x,b.y,b.radius)&&(!y||y(G))&&!Ki(C,G.overlapMode))return m.push(!0),!0}}}_forEachCell(e,n,s,o,u,m,_,y){let b=this._convertToXCellCoord(e),T=this._convertToYCellCoord(n),C=this._convertToXCellCoord(s),P=this._convertToYCellCoord(o);for(let L=b;L<=C;L++)for(let O=T;O<=P;O++)if(u.call(this,e,n,s,o,this.xCellCount*O+L,m,_,y))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,n,s,o,u,m){let _=o-e,y=u-n,b=s+m;return b*b>_*_+y*y}_circleAndRectCollide(e,n,s,o,u,m,_){let y=(m-o)/2,b=Math.abs(e-(o+y));if(b>y+s)return!1;let T=(_-u)/2,C=Math.abs(n-(u+T));if(C>T+s)return!1;if(b<=y||C<=T)return!0;let P=b-y,L=C-T;return P*P+L*L<=s*s}}function on(c,e,n,s,o){let u=p.H();return e?(p.K(u,u,[1/o,1/o,1]),n||p.ad(u,u,s.angle)):p.L(u,s.labelPlaneMatrix,c),u}function Zr(c,e,n,s,o){if(e){let u=p.ae(c);return p.K(u,u,[o,o,1]),n||p.ad(u,u,-s.angle),u}return s.glCoordMatrix}function j(c,e,n,s){let o;s?(o=[c,e,s(c,e),1],p.af(o,o,n)):(o=[c,e,0,1],zt(o,o,n));let u=o[3];return{point:new p.P(o[0]/u,o[1]/u),signedDistanceFromCamera:u,isOccluded:!1}}function k(c,e){return .5+c/e*.5}function I(c,e){return c.x>=-e[0]&&c.x<=e[0]&&c.y>=-e[1]&&c.y<=e[1]}function R(c,e,n,s,o,u,m,_,y,b,T,C,P,L,O){let U=s?c.textSizeData:c.iconSizeData,Z=p.ag(U,n.transform.zoom),G=[256/n.width*2+1,256/n.height*2+1],X=s?c.text.dynamicLayoutVertexArray:c.icon.dynamicLayoutVertexArray;X.clear();let N=c.lineVertexArray,Q=s?c.text.placedSymbolArray:c.icon.placedSymbolArray,te=n.transform.width/n.transform.height,ae=!1;for(let fe=0;feMath.abs(n.x-e.x)*s?{useVertical:!0}:(c===p.ah.vertical?e.yn.x)?{needsFlipping:!0}:null}function ee(c,e,n,s,o,u,m,_,y,b,T){let C=n/24,P=e.lineOffsetX*C,L=e.lineOffsetY*C,O;if(e.numGlyphs>1){let U=e.glyphStartIndex+e.numGlyphs,Z=e.lineStartIndex,G=e.lineStartIndex+e.lineLength,X=V(C,_,P,L,s,e,T,c);if(!X)return{notEnoughRoom:!0};let N=j(X.first.point.x,X.first.point.y,m,c.getElevation).point,Q=j(X.last.point.x,X.last.point.y,m,c.getElevation).point;if(o&&!s){let te=Y(e.writingMode,N,Q,b);if(te)return te}O=[X.first];for(let te=e.glyphStartIndex+1;te0?N.point:function(ae,fe,be,ze,Ne,Se){return re(ae,fe,be,1,Ne,Se)}(c.tileAnchorPoint,X,Z,0,u,c),te=Y(e.writingMode,Z,Q,b);if(te)return te}let U=Te(C*_.getoffsetX(e.glyphStartIndex),P,L,s,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,c,T);if(!U||c.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};O=[U]}for(let U of O)p.aj(y,U.point,U.angle);return{}}function re(c,e,n,s,o,u){let m=c.add(c.sub(e)._unit()),_=o!==void 0?j(m.x,m.y,o,u.getElevation).point:he(m.x,m.y,u).point,y=n.sub(_);return n.add(y._mult(s/y.mag()))}function H(c,e,n){let s=e.projectionCache;if(s.projections[c])return s.projections[c];let o=new p.P(e.lineVertexArray.getx(c),e.lineVertexArray.gety(c)),u=he(o.x,o.y,e);if(u.signedDistanceFromCamera>0)return s.projections[c]=u.point,s.anyProjectionOccluded=s.anyProjectionOccluded||u.isOccluded,u.point;let m=c-n.direction;return function(_,y,b,T,C){return re(_,y,b,T,void 0,C)}(n.distanceFromAnchor===0?e.tileAnchorPoint:new p.P(e.lineVertexArray.getx(m),e.lineVertexArray.gety(m)),o,n.previousVertex,n.absOffsetX-n.distanceFromAnchor+1,e)}function he(c,e,n){let s=c+n.translation[0],o=e+n.translation[1],u;return!n.pitchWithMap&&n.projection.useSpecialProjectionForSymbols?(u=n.projection.projectTileCoordinates(s,o,n.unwrappedTileID,n.getElevation),u.point.x=(.5*u.point.x+.5)*n.width,u.point.y=(.5*-u.point.y+.5)*n.height):(u=j(s,o,n.labelPlaneMatrix,n.getElevation),u.isOccluded=!1),u}function me(c,e,n){return c._unit()._perp()._mult(e*n)}function le(c,e,n,s,o,u,m,_,y){if(_.projectionCache.offsets[c])return _.projectionCache.offsets[c];let b=n.add(e);if(c+y.direction=o)return _.projectionCache.offsets[c]=b,b;let T=H(c+y.direction,_,y),C=me(T.sub(n),m,y.direction),P=n.add(C),L=T.add(C);return _.projectionCache.offsets[c]=p.ak(u,b,P,L)||b,_.projectionCache.offsets[c]}function Te(c,e,n,s,o,u,m,_,y){let b=s?c-e:c+e,T=b>0?1:-1,C=0;s&&(T*=-1,C=Math.PI),T<0&&(C+=Math.PI);let P,L=T>0?u+o:u+o+1;_.projectionCache.cachedAnchorPoint?P=_.projectionCache.cachedAnchorPoint:(P=he(_.tileAnchorPoint.x,_.tileAnchorPoint.y,_).point,_.projectionCache.cachedAnchorPoint=P);let O,U,Z=P,G=P,X=0,N=0,Q=Math.abs(b),te=[],ae;for(;X+N<=Q;){if(L+=T,L=m)return null;X+=N,G=Z,U=O;let ze={absOffsetX:Q,direction:T,distanceFromAnchor:X,previousVertex:G};if(Z=H(L,_,ze),n===0)te.push(G),ae=Z.sub(G);else{let Ne,Se=Z.sub(G);Ne=Se.mag()===0?me(H(L+T,_,ze).sub(Z),n,T):me(Se,n,T),U||(U=G.add(Ne)),O=le(L,Ne,Z,u,m,U,n,_,ze),te.push(U),ae=O.sub(U)}N=ae.mag()}let fe=ae._mult((Q-X)/N)._add(U||G),be=C+Math.atan2(Z.y-G.y,Z.x-G.x);return te.push(fe),{point:fe,angle:y?be:0,path:te}}let Ke=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function tt(c,e){for(let n=0;n=1;vt--)Re.push(ct.path[vt]);for(let vt=1;vtDt.signedDistanceFromCamera<=0)?[]:vt.map(Dt=>Dt.point)}let ii=[];if(Re.length>0){let vt=Re[0].clone(),Dt=Re[0].clone();for(let ri=1;ri=Se.x&&Dt.x<=Ce.x&&vt.y>=Se.y&&Dt.y<=Ce.y?[Re]:Dt.xCe.x||Dt.yCe.y?[]:p.al([Re],Se.x,Se.y,Ce.x,Ce.y)}for(let vt of ii){Ge.reset(vt,.25*Ne);let Dt=0;Dt=Ge.length<=.5*Ne?1:Math.ceil(Ge.paddedLength/ot)+1;for(let ri=0;rij(o.x,o.y,s,n.getElevation))}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let n=[],s=1/0,o=1/0,u=-1/0,m=-1/0;for(let T of e){let C=new p.P(T.x+ft,T.y+ft);s=Math.min(s,C.x),o=Math.min(o,C.y),u=Math.max(u,C.x),m=Math.max(m,C.y),n.push(C)}let _=this.grid.query(s,o,u,m).concat(this.ignoredGrid.query(s,o,u,m)),y={},b={};for(let T of _){let C=T.key;if(y[C.bucketInstanceId]===void 0&&(y[C.bucketInstanceId]={}),y[C.bucketInstanceId][C.featureIndex])continue;let P=[new p.P(T.x1,T.y1),new p.P(T.x2,T.y1),new p.P(T.x2,T.y2),new p.P(T.x1,T.y2)];p.am(n,P)&&(y[C.bucketInstanceId][C.featureIndex]=!0,b[C.bucketInstanceId]===void 0&&(b[C.bucketInstanceId]=[]),b[C.bucketInstanceId].push(C.featureIndex))}return b}insertCollisionBox(e,n,s,o,u,m){(s?this.ignoredGrid:this.grid).insert({bucketInstanceId:o,featureIndex:u,collisionGroupID:m,overlapMode:n},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,n,s,o,u,m){let _=s?this.ignoredGrid:this.grid,y={bucketInstanceId:o,featureIndex:u,collisionGroupID:m,overlapMode:n};for(let b=0;b=this.screenRightBoundary||othis.screenBottomBoundary}isInsideGrid(e,n,s,o){return s>=0&&e=0&&nthis.projectAndGetPerspectiveRatio(s,Ne.x,Ne.y,o,b));be=ze.some(Ne=>!Ne.isOccluded),fe=ze.map(Ne=>Ne.point)}else be=!0;return{box:p.ao(fe),allPointsOccluded:!be}}}function Ct(c,e,n){return e*(p.X/(c.tileSize*Math.pow(2,n-c.tileID.overscaledZ)))}class yi{constructor(e,n,s,o){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?n:-n))):o&&s?1:0,this.placed=s}isHidden(){return this.opacity===0&&!this.placed}}class hi{constructor(e,n,s,o,u){this.text=new yi(e?e.text:null,n,s,u),this.icon=new yi(e?e.icon:null,n,o,u)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class bt{constructor(e,n,s){this.text=e,this.icon=n,this.skipFade=s}}class $t{constructor(){this.invProjMatrix=p.H(),this.viewportMatrix=p.H(),this.circles=[]}}class oi{constructor(e,n,s,o,u){this.bucketInstanceId=e,this.featureIndex=n,this.sourceLayerIndex=s,this.bucketIndex=o,this.tileID=u}}class Ei{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let n=++this.maxGroupID;this.collisionGroups[e]={ID:n,predicate:s=>s.collisionGroupID===n}}return this.collisionGroups[e]}}function Ii(c,e,n,s,o){let{horizontalAlign:u,verticalAlign:m}=p.au(c);return new p.P(-(u-.5)*e+s[0]*o,-(m-.5)*n+s[1]*o)}class ji{constructor(e,n,s,o,u,m){this.transform=e.clone(),this.terrain=s,this.collisionIndex=new Bt(this.transform,n),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=o,this.retainedQueryData={},this.collisionGroups=new Ei(u),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=m,m&&(m.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){let n=this.terrain;return n?(s,o)=>n.getElevation(e,s,o):null}getBucketParts(e,n,s,o){let u=s.getBucket(n),m=s.latestFeatureIndex;if(!u||!m||n.id!==u.layerIds[0])return;let _=s.collisionBoxArray,y=u.layers[0].layout,b=u.layers[0].paint,T=Math.pow(2,this.transform.zoom-s.tileID.overscaledZ),C=s.tileSize/p.X,P=s.tileID.toUnwrapped(),L=this.transform.calculatePosMatrix(P),O=y.get("text-pitch-alignment")==="map",U=y.get("text-rotation-alignment")==="map",Z=Ct(s,1,this.transform.zoom),G=this.collisionIndex.mapProjection.translatePosition(this.transform,s,b.get("text-translate"),b.get("text-translate-anchor")),X=this.collisionIndex.mapProjection.translatePosition(this.transform,s,b.get("icon-translate"),b.get("icon-translate-anchor")),N=on(L,O,U,this.transform,Z),Q=null;if(O){let ae=Zr(L,O,U,this.transform,Z);Q=p.L([],this.transform.labelPlaneMatrix,ae)}this.retainedQueryData[u.bucketInstanceId]=new oi(u.bucketInstanceId,m,u.sourceLayerIndex,u.index,s.tileID);let te={bucket:u,layout:y,translationText:G,translationIcon:X,posMatrix:L,unwrappedTileID:P,textLabelPlaneMatrix:N,labelToScreenMatrix:Q,scale:T,textPixelRatio:C,holdingForFade:s.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:p.ag(u.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(u.sourceID)};if(o)for(let ae of u.sortKeyRanges){let{sortKey:fe,symbolInstanceStart:be,symbolInstanceEnd:ze}=ae;e.push({sortKey:fe,symbolInstanceStart:be,symbolInstanceEnd:ze,parameters:te})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:u.symbolInstances.length,parameters:te})}attemptAnchorPlacement(e,n,s,o,u,m,_,y,b,T,C,P,L,O,U,Z,G,X,N){let Q=p.aq[e.textAnchor],te=[e.textOffset0,e.textOffset1],ae=Ii(Q,s,o,te,u),fe=this.collisionIndex.placeCollisionBox(n,P,y,b,T,_,m,Z,C.predicate,N,ae);if((!X||this.collisionIndex.placeCollisionBox(X,P,y,b,T,_,m,G,C.predicate,N,ae).placeable)&&fe.placeable){let be;if(this.prevPlacement&&this.prevPlacement.variableOffsets[L.crossTileID]&&this.prevPlacement.placements[L.crossTileID]&&this.prevPlacement.placements[L.crossTileID].text&&(be=this.prevPlacement.variableOffsets[L.crossTileID].anchor),L.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[L.crossTileID]={textOffset:te,width:s,height:o,anchor:Q,textBoxScale:u,prevAnchor:be},this.markUsedJustification(O,Q,L,U),O.allowVerticalPlacement&&(this.markUsedOrientation(O,U,L),this.placedOrientations[L.crossTileID]=U),{shift:ae,placedGlyphBoxes:fe}}}placeLayerBucketPart(e,n,s){let{bucket:o,layout:u,translationText:m,translationIcon:_,posMatrix:y,unwrappedTileID:b,textLabelPlaneMatrix:T,labelToScreenMatrix:C,textPixelRatio:P,holdingForFade:L,collisionBoxArray:O,partiallyEvaluatedTextSize:U,collisionGroup:Z}=e.parameters,G=u.get("text-optional"),X=u.get("icon-optional"),N=p.ar(u,"text-overlap","text-allow-overlap"),Q=N==="always",te=p.ar(u,"icon-overlap","icon-allow-overlap"),ae=te==="always",fe=u.get("text-rotation-alignment")==="map",be=u.get("text-pitch-alignment")==="map",ze=u.get("icon-text-fit")!=="none",Ne=u.get("symbol-z-order")==="viewport-y",Se=Q&&(ae||!o.hasIconData()||X),Ce=ae&&(Q||!o.hasTextData()||G);!o.collisionArrays&&O&&o.deserializeCollisionBoxes(O);let Ge=this._getTerrainElevationFunc(this.retainedQueryData[o.bucketInstanceId].tileID),ct=(ke,Re,ot)=>{var ii,vt;if(n[ke.crossTileID])return;if(L)return void(this.placements[ke.crossTileID]=new bt(!1,!1,!1));let Dt=!1,ri=!1,zi=!0,Or=null,ni={box:null,placeable:!1,offscreen:null},er={box:null,placeable:!1,offscreen:null},$i=null,Bi=null,Zi=null,Wr=0,la=0,Cs=0;Re.textFeatureIndex?Wr=Re.textFeatureIndex:ke.useRuntimeCollisionCircles&&(Wr=ke.featureIndex),Re.verticalTextFeatureIndex&&(la=Re.verticalTextFeatureIndex);let ua=Re.textBox;if(ua){let Er=ki=>{let Li=p.ah.horizontal;if(o.allowVerticalPlacement&&!ki&&this.prevPlacement){let fr=this.prevPlacement.placedOrientations[ke.crossTileID];fr&&(this.placedOrientations[ke.crossTileID]=fr,Li=fr,this.markUsedOrientation(o,Li,ke))}return Li},Tr=(ki,Li)=>{if(o.allowVerticalPlacement&&ke.numVerticalGlyphVertices>0&&Re.verticalTextBox){for(let fr of o.writingModes)if(fr===p.ah.vertical?(ni=Li(),er=ni):ni=ki(),ni&&ni.placeable)break}else ni=ki()},cn=ke.textAnchorOffsetStartIndex,Nr=ke.textAnchorOffsetEndIndex;if(Nr===cn){let ki=(Li,fr)=>{let kt=this.collisionIndex.placeCollisionBox(Li,N,P,y,b,be,fe,m,Z.predicate,Ge);return kt&&kt.placeable&&(this.markUsedOrientation(o,fr,ke),this.placedOrientations[ke.crossTileID]=fr),kt};Tr(()=>ki(ua,p.ah.horizontal),()=>{let Li=Re.verticalTextBox;return o.allowVerticalPlacement&&ke.numVerticalGlyphVertices>0&&Li?ki(Li,p.ah.vertical):{box:null,offscreen:null}}),Er(ni&&ni.placeable)}else{let ki=p.aq[(vt=(ii=this.prevPlacement)===null||ii===void 0?void 0:ii.variableOffsets[ke.crossTileID])===null||vt===void 0?void 0:vt.anchor],Li=(kt,Mn,ca)=>{let ha=kt.x2-kt.x1,Yl=kt.y2-kt.y1,ac=ke.textBoxScale,Ql=ze&&te==="never"?Mn:null,hn=null,eu=N==="never"?1:2,Ss="never";ki&&eu++;for(let qa=0;qaLi(ua,Re.iconBox,p.ah.horizontal),()=>{let kt=Re.verticalTextBox;return o.allowVerticalPlacement&&(!ni||!ni.placeable)&&ke.numVerticalGlyphVertices>0&&kt?Li(kt,Re.verticalIconBox,p.ah.vertical):{box:null,occluded:!0,offscreen:null}}),ni&&(Dt=ni.placeable,zi=ni.offscreen);let fr=Er(ni&&ni.placeable);if(!Dt&&this.prevPlacement){let kt=this.prevPlacement.variableOffsets[ke.crossTileID];kt&&(this.variableOffsets[ke.crossTileID]=kt,this.markUsedJustification(o,kt.anchor,ke,fr))}}}if($i=ni,Dt=$i&&$i.placeable,zi=$i&&$i.offscreen,ke.useRuntimeCollisionCircles){let Er=o.text.placedSymbolArray.get(ke.centerJustifiedTextSymbolIndex),Tr=p.ai(o.textSizeData,U,Er),cn=u.get("text-padding");Bi=this.collisionIndex.placeCollisionCircles(N,Er,o.lineVertexArray,o.glyphOffsetArray,Tr,y,b,T,C,s,be,Z.predicate,ke.collisionCircleDiameter,cn,m,Ge),Bi.circles.length&&Bi.collisionDetected&&!s&&p.w("Collisions detected, but collision boxes are not shown"),Dt=Q||Bi.circles.length>0&&!Bi.collisionDetected,zi=zi&&Bi.offscreen}if(Re.iconFeatureIndex&&(Cs=Re.iconFeatureIndex),Re.iconBox){let Er=Tr=>this.collisionIndex.placeCollisionBox(Tr,te,P,y,b,be,fe,_,Z.predicate,Ge,ze&&Or?Or:void 0);er&&er.placeable&&Re.verticalIconBox?(Zi=Er(Re.verticalIconBox),ri=Zi.placeable):(Zi=Er(Re.iconBox),ri=Zi.placeable),zi=zi&&Zi.offscreen}let Ar=G||ke.numHorizontalGlyphVertices===0&&ke.numVerticalGlyphVertices===0,Ds=X||ke.numIconVertices===0;Ar||Ds?Ds?Ar||(ri=ri&&Dt):Dt=ri&&Dt:ri=Dt=ri&&Dt;let Uo=ri&&Zi.placeable;if(Dt&&$i.placeable&&this.collisionIndex.insertCollisionBox($i.box,N,u.get("text-ignore-placement"),o.bucketInstanceId,er&&er.placeable&&la?la:Wr,Z.ID),Uo&&this.collisionIndex.insertCollisionBox(Zi.box,te,u.get("icon-ignore-placement"),o.bucketInstanceId,Cs,Z.ID),Bi&&Dt&&this.collisionIndex.insertCollisionCircles(Bi.circles,N,u.get("text-ignore-placement"),o.bucketInstanceId,Wr,Z.ID),s&&this.storeCollisionData(o.bucketInstanceId,ot,Re,$i,Zi,Bi),ke.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(o.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[ke.crossTileID]=new bt(Dt||Se,ri||Ce,zi||o.justReloaded),n[ke.crossTileID]=!0};if(Ne){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");let ke=o.getSortedSymbolIndexes(this.transform.angle);for(let Re=ke.length-1;Re>=0;--Re){let ot=ke[Re];ct(o.symbolInstances.get(ot),o.collisionArrays[ot],ot)}}else for(let ke=e.symbolInstanceStart;ke=0&&(e.text.placedSymbolArray.get(_).crossTileID=u>=0&&_!==u?0:s.crossTileID)}markUsedOrientation(e,n,s){let o=n===p.ah.horizontal||n===p.ah.horizontalOnly?n:0,u=n===p.ah.vertical?n:0,m=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex];for(let _ of m)e.text.placedSymbolArray.get(_).placedOrientation=o;s.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(s.verticalPlacedTextSymbolIndex).placedOrientation=u)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let n=this.prevPlacement,s=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;let o=n?n.symbolFadeChange(e):1,u=n?n.opacities:{},m=n?n.variableOffsets:{},_=n?n.placedOrientations:{};for(let y in this.placements){let b=this.placements[y],T=u[y];T?(this.opacities[y]=new hi(T,o,b.text,b.icon),s=s||b.text!==T.text.placed||b.icon!==T.icon.placed):(this.opacities[y]=new hi(null,o,b.text,b.icon,b.skipFade),s=s||b.text||b.icon)}for(let y in u){let b=u[y];if(!this.opacities[y]){let T=new hi(b,o,!1,!1);T.isHidden()||(this.opacities[y]=T,s=s||b.text.placed||b.icon.placed)}}for(let y in m)this.variableOffsets[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.variableOffsets[y]=m[y]);for(let y in _)this.placedOrientations[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.placedOrientations[y]=_[y]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");s?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:e)}updateLayerOpacities(e,n){let s={};for(let o of n){let u=o.getBucket(e);u&&o.latestFeatureIndex&&e.id===u.layerIds[0]&&this.updateBucketOpacities(u,o.tileID,s,o.collisionBoxArray)}}updateBucketOpacities(e,n,s,o){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();let u=e.layers[0],m=u.layout,_=new hi(null,0,!1,!1,!0),y=m.get("text-allow-overlap"),b=m.get("icon-allow-overlap"),T=u._unevaluatedLayout.hasValue("text-variable-anchor")||u._unevaluatedLayout.hasValue("text-variable-anchor-offset"),C=m.get("text-rotation-alignment")==="map",P=m.get("text-pitch-alignment")==="map",L=m.get("icon-text-fit")!=="none",O=new hi(null,0,y&&(b||!e.hasIconData()||m.get("icon-optional")),b&&(y||!e.hasTextData()||m.get("text-optional")),!0);!e.collisionArrays&&o&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(o);let U=(G,X,N)=>{for(let Q=0;Q0,be=this.placedOrientations[X.crossTileID],ze=be===p.ah.vertical,Ne=be===p.ah.horizontal||be===p.ah.horizontalOnly;if(N>0||Q>0){let Ce=hr(ae.text);U(e.text,N,ze?Vn:Ce),U(e.text,Q,Ne?Vn:Ce);let Ge=ae.text.isHidden();[X.rightJustifiedTextSymbolIndex,X.centerJustifiedTextSymbolIndex,X.leftJustifiedTextSymbolIndex].forEach(Re=>{Re>=0&&(e.text.placedSymbolArray.get(Re).hidden=Ge||ze?1:0)}),X.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(X.verticalPlacedTextSymbolIndex).hidden=Ge||Ne?1:0);let ct=this.variableOffsets[X.crossTileID];ct&&this.markUsedJustification(e,ct.anchor,X,be);let ke=this.placedOrientations[X.crossTileID];ke&&(this.markUsedJustification(e,"left",X,ke),this.markUsedOrientation(e,ke,X))}if(fe){let Ce=hr(ae.icon),Ge=!(L&&X.verticalPlacedIconSymbolIndex&&ze);X.placedIconSymbolIndex>=0&&(U(e.icon,X.numIconVertices,Ge?Ce:Vn),e.icon.placedSymbolArray.get(X.placedIconSymbolIndex).hidden=ae.icon.isHidden()),X.verticalPlacedIconSymbolIndex>=0&&(U(e.icon,X.numVerticalIconVertices,Ge?Vn:Ce),e.icon.placedSymbolArray.get(X.verticalPlacedIconSymbolIndex).hidden=ae.icon.isHidden())}let Se=Z&&Z.has(G)?Z.get(G):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let Ce=e.collisionArrays[G];if(Ce){let Ge=new p.P(0,0);if(Ce.textBox||Ce.verticalTextBox){let ct=!0;if(T){let ke=this.variableOffsets[te];ke?(Ge=Ii(ke.anchor,ke.width,ke.height,ke.textOffset,ke.textBoxScale),C&&Ge._rotate(P?this.transform.angle:-this.transform.angle)):ct=!1}if(Ce.textBox||Ce.verticalTextBox){let ke;Ce.textBox&&(ke=ze),Ce.verticalTextBox&&(ke=Ne),qn(e.textCollisionBox.collisionVertexArray,ae.text.placed,!ct||ke,Se.text,Ge.x,Ge.y)}}if(Ce.iconBox||Ce.verticalIconBox){let ct=!!(!Ne&&Ce.verticalIconBox),ke;Ce.iconBox&&(ke=ct),Ce.verticalIconBox&&(ke=!ct),qn(e.iconCollisionBox.collisionVertexArray,ae.icon.placed,ke,Se.icon,L?Ge.x:0,L?Ge.y:0)}}}}if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);if(e.bucketInstanceId in this.collisionCircleArrays){let G=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=G.invProjMatrix,e.placementViewportMatrix=G.viewportMatrix,e.collisionCircleArray=G.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTimee}setStale(){this.stale=!0}}function qn(c,e,n,s,o,u){s&&s.length!==0||(s=[0,0,0,0]);let m=s[0]-ft,_=s[1]-ft,y=s[2]-ft,b=s[3]-ft;c.emplaceBack(e?1:0,n?1:0,o||0,u||0,m,_),c.emplaceBack(e?1:0,n?1:0,o||0,u||0,y,_),c.emplaceBack(e?1:0,n?1:0,o||0,u||0,y,b),c.emplaceBack(e?1:0,n?1:0,o||0,u||0,m,b)}let Zt=Math.pow(2,25),Ys=Math.pow(2,24),Qs=Math.pow(2,17),ur=Math.pow(2,16),cr=Math.pow(2,9),zu=Math.pow(2,8),vr=Math.pow(2,1);function hr(c){if(c.opacity===0&&!c.placed)return 0;if(c.opacity===1&&c.placed)return 4294967295;let e=c.placed?1:0,n=Math.floor(127*c.opacity);return n*Zt+e*Ys+n*Qs+e*ur+n*cr+e*zu+n*vr+e}let Vn=0;function vn(){return{isOccluded:(c,e,n)=>!1,getPitchedTextCorrection:(c,e,n)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(c,e,n,s){throw new Error("Not implemented.")},translatePosition:(c,e,n,s)=>function(o,u,m,_,y=!1){if(!m[0]&&!m[1])return[0,0];let b=y?_==="map"?o.angle:0:_==="viewport"?-o.angle:0;if(b){let T=Math.sin(b),C=Math.cos(b);m=[m[0]*C-m[1]*T,m[0]*T+m[1]*C]}return[y?m[0]:Ct(u,m[0],o.zoom),y?m[1]:Ct(u,m[1],o.zoom)]}(c,e,n,s),getCircleRadiusCorrection:c=>1}}class vi{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,n,s,o,u){let m=this._bucketParts;for(;this._currentTileIndex_.sortKey-y.sortKey));this._currentPartIndex!this._forceFullPlacement&&se.now()-o>2;for(;this._currentPlacementIndex>=0;){let m=n[e[this._currentPlacementIndex]],_=this.placement.collisionIndex.transform.zoom;if(m.type==="symbol"&&(!m.minzoom||m.minzoom<=_)&&(!m.maxzoom||m.maxzoom>_)){if(this._inProgressLayer||(this._inProgressLayer=new vi(m)),this._inProgressLayer.continuePlacement(s[m.source],this.placement,this._showCollisionBoxes,m,u))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}let zr=512/p.X/2;class gi{constructor(e,n,s){this.tileID=e,this.bucketInstanceId=s,this._symbolsByKey={};let o=new Map;for(let u=0;u({x:Math.floor(y.anchorX*zr),y:Math.floor(y.anchorY*zr)})),crossTileIDs:m.map(y=>y.crossTileID)};if(_.positions.length>128){let y=new p.av(_.positions.length,16,Uint16Array);for(let{x:b,y:T}of _.positions)y.add(b,T);y.finish(),delete _.positions,_.index=y}this._symbolsByKey[u]=_}}getScaledCoordinates(e,n){let{x:s,y:o,z:u}=this.tileID.canonical,{x:m,y:_,z:y}=n.canonical,b=zr/Math.pow(2,y-u),T=(_*p.X+e.anchorY)*b,C=o*p.X*zr;return{x:Math.floor((m*p.X+e.anchorX)*b-s*p.X*zr),y:Math.floor(T-C)}}findMatches(e,n,s){let o=this.tileID.canonical.ze)}}class Wa{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Br{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let n=Math.round((e-this.lng)/360);if(n!==0)for(let s in this.indexes){let o=this.indexes[s],u={};for(let m in o){let _=o[m];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+n),u[_.tileID.key]=_}this.indexes[s]=u}this.lng=e}addBucket(e,n,s){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let u=0;ue.overscaledZ)for(let _ in m){let y=m[_];y.tileID.isChildOf(e)&&y.findMatches(n.symbolInstances,e,o)}else{let _=m[e.scaledTo(Number(u)).key];_&&_.findMatches(n.symbolInstances,e,o)}}for(let u=0;u{n[s]=!0});for(let s in this.layerIndexes)n[s]||delete this.layerIndexes[s]}}let Lr=(c,e)=>p.t(c,e&&e.filter(n=>n.identifier!=="source.canvas")),Bu=p.aw();class Ja extends p.E{constructor(e,n={}){super(),this._rtlPluginLoaded=()=>{for(let s in this.sourceCaches){let o=this.sourceCaches[s].getSource().type;o!=="vector"&&o!=="geojson"||this.sourceCaches[s].reload()}},this.map=e,this.dispatcher=new yt(et(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",(s,o)=>this.getGlyphs(s,o)),this.dispatcher.registerMessageHandler("GI",(s,o)=>this.getImages(s,o)),this.imageManager=new Ie,this.imageManager.setEventedParent(this),this.glyphManager=new ht(e._requestManager,n.localIdeographFontFamily),this.lineAtlas=new St(256,512),this.crossTileSymbolIndex=new eo,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new p.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",p.ay()),lr().on(we,this._rtlPluginLoaded),this.on("data",s=>{if(s.dataType!=="source"||s.sourceDataType!=="metadata")return;let o=this.sourceCaches[s.sourceId];if(!o)return;let u=o.getSource();if(u&&u.vectorLayerIds)for(let m in this._layers){let _=this._layers[m];_.source===u.id&&this._validateLayer(_)}})}loadURL(e,n={},s){this.fire(new p.k("dataloading",{dataType:"style"})),n.validate=typeof n.validate!="boolean"||n.validate;let o=this.map._requestManager.transformRequest(e,"Style");this._loadStyleRequest=new AbortController;let u=this._loadStyleRequest;p.h(o,this._loadStyleRequest).then(m=>{this._loadStyleRequest=null,this._load(m.data,n,s)}).catch(m=>{this._loadStyleRequest=null,m&&!u.signal.aborted&&this.fire(new p.j(m))})}loadJSON(e,n={},s){this.fire(new p.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,se.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,n.validate=n.validate!==!1,this._load(e,n,s)}).catch(()=>{})}loadEmpty(){this.fire(new p.k("dataloading",{dataType:"style"})),this._load(Bu,{validate:!1})}_load(e,n,s){var o;let u=n.transformStyle?n.transformStyle(s,e):e;if(!n.validate||!Lr(this,p.u(u))){this._loaded=!0,this.stylesheet=u;for(let m in u.sources)this.addSource(m,u.sources[m],{validate:!1});u.sprite?this._loadSprite(u.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(u.glyphs),this._createLayers(),this.light=new Tt(this.stylesheet.light),this.sky=new dt(this.stylesheet.sky),this.map.setTerrain((o=this.stylesheet.terrain)!==null&&o!==void 0?o:null),this.fire(new p.k("data",{dataType:"style"})),this.fire(new p.k("style.load"))}}_createLayers(){let e=p.az(this.stylesheet.layers);this.dispatcher.broadcast("SL",e),this._order=e.map(n=>n.id),this._layers={},this._serializedLayers=null;for(let n of e){let s=p.aA(n);s.setEventedParent(this,{layer:{id:n.id}}),this._layers[n.id]=s}}_loadSprite(e,n=!1,s=void 0){let o;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(u,m,_,y){return p._(this,void 0,void 0,function*(){let b=xe(u),T=_>1?"@2x":"",C={},P={};for(let{id:L,url:O}of b){let U=m.transformRequest(Ae(O,T,".json"),"SpriteJSON");C[L]=p.h(U,y);let Z=m.transformRequest(Ae(O,T,".png"),"SpriteImage");P[L]=ge.getImage(Z,y)}return yield Promise.all([...Object.values(C),...Object.values(P)]),function(L,O){return p._(this,void 0,void 0,function*(){let U={};for(let Z in L){U[Z]={};let G=se.getImageCanvasContext((yield O[Z]).data),X=(yield L[Z]).data;for(let N in X){let{width:Q,height:te,x:ae,y:fe,sdf:be,pixelRatio:ze,stretchX:Ne,stretchY:Se,content:Ce,textFitWidth:Ge,textFitHeight:ct}=X[N];U[Z][N]={data:null,pixelRatio:ze,sdf:be,stretchX:Ne,stretchY:Se,content:Ce,textFitWidth:Ge,textFitHeight:ct,spriteData:{width:Q,height:te,x:ae,y:fe,context:G}}}}return U})}(C,P)})}(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(u=>{if(this._spriteRequest=null,u)for(let m in u){this._spritesImagesIds[m]=[];let _=this._spritesImagesIds[m]?this._spritesImagesIds[m].filter(y=>!(y in u)):[];for(let y of _)this.imageManager.removeImage(y),this._changedImages[y]=!0;for(let y in u[m]){let b=m==="default"?y:`${m}:${y}`;this._spritesImagesIds[m].push(b),b in this.imageManager.images?this.imageManager.updateImage(b,u[m][y],!1):this.imageManager.addImage(b,u[m][y]),n&&(this._changedImages[b]=!0)}}}).catch(u=>{this._spriteRequest=null,o=u,this.fire(new p.j(o))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.k("data",{dataType:"style"})),s&&s(o)})}_unloadSprite(){for(let e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.k("data",{dataType:"style"}))}_validateLayer(e){let n=this.sourceCaches[e.source];if(!n)return;let s=e.sourceLayer;if(!s)return;let o=n.getSource();(o.type==="geojson"||o.vectorLayerIds&&o.vectorLayerIds.indexOf(s)===-1)&&this.fire(new p.j(new Error(`Source layer "${s}" does not exist on source "${o.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e,n=!1){let s=this._serializedAllLayers();if(!e||e.length===0)return Object.values(n?p.aB(s):s);let o=[];for(let u of e)if(s[u]){let m=n?p.aB(s[u]):s[u];o.push(m)}return o}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};let n=Object.keys(this._layers);for(let s of n){let o=this._layers[s];o.type!=="custom"&&(e[s]=o.serialize())}return e}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(let e in this.sourceCaches)if(this.sourceCaches[e].hasTransition())return!0;for(let e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;let n=this._changed;if(n){let o=Object.keys(this._updatedLayers),u=Object.keys(this._removedLayers);(o.length||u.length)&&this._updateWorkerLayers(o,u);for(let m in this._updatedSources){let _=this._updatedSources[m];if(_==="reload")this._reloadSource(m);else{if(_!=="clear")throw new Error(`Invalid action ${_}`);this._clearSource(m)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let m in this._updatedPaintProps)this._layers[m].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}let s={};for(let o in this.sourceCaches){let u=this.sourceCaches[o];s[o]=u.used,u.used=!1}for(let o of this._order){let u=this._layers[o];u.recalculate(e,this._availableImages),!u.isHidden(e.zoom)&&u.source&&(this.sourceCaches[u.source].used=!0)}for(let o in s){let u=this.sourceCaches[o];!!s[o]!=!!u.used&&u.fire(new p.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:o}))}this.light.recalculate(e),this.sky.recalculate(e),this.z=e.zoom,n&&this.fire(new p.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let n in this.sourceCaches)this.sourceCaches[n].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,n){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,n={}){var s;this._checkLoaded();let o=this.serialize();if(e=n.transformStyle?n.transformStyle(o,e):e,((s=n.validate)===null||s===void 0||s)&&Lr(this,p.u(e)))return!1;(e=p.aB(e)).layers=p.az(e.layers);let u=p.aC(o,e),m=this._getOperationsToPerform(u);if(m.unimplemented.length>0)throw new Error(`Unimplemented: ${m.unimplemented.join(", ")}.`);if(m.operations.length===0)return!1;for(let _ of m.operations)_();return this.stylesheet=e,this._serializedLayers=null,!0}_getOperationsToPerform(e){let n=[],s=[];for(let o of e)switch(o.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":n.push(()=>this.addLayer.apply(this,o.args));break;case"removeLayer":n.push(()=>this.removeLayer.apply(this,o.args));break;case"setPaintProperty":n.push(()=>this.setPaintProperty.apply(this,o.args));break;case"setLayoutProperty":n.push(()=>this.setLayoutProperty.apply(this,o.args));break;case"setFilter":n.push(()=>this.setFilter.apply(this,o.args));break;case"addSource":n.push(()=>this.addSource.apply(this,o.args));break;case"removeSource":n.push(()=>this.removeSource.apply(this,o.args));break;case"setLayerZoomRange":n.push(()=>this.setLayerZoomRange.apply(this,o.args));break;case"setLight":n.push(()=>this.setLight.apply(this,o.args));break;case"setGeoJSONSourceData":n.push(()=>this.setGeoJSONSourceData.apply(this,o.args));break;case"setGlyphs":n.push(()=>this.setGlyphs.apply(this,o.args));break;case"setSprite":n.push(()=>this.setSprite.apply(this,o.args));break;case"setSky":n.push(()=>this.setSky.apply(this,o.args));break;case"setTerrain":n.push(()=>this.map.setTerrain.apply(this,o.args));break;case"setTransition":n.push(()=>{});break;default:s.push(o.command)}return{operations:n,unimplemented:s}}addImage(e,n){if(this.getImage(e))return this.fire(new p.j(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,n),this._afterImageUpdated(e)}updateImage(e,n){this.imageManager.updateImage(e,n)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new p.j(new Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,n,s={}){if(this._checkLoaded(),this.sourceCaches[e]!==void 0)throw new Error(`Source "${e}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(p.u.source,`sources.${e}`,n,null,s))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);let o=this.sourceCaches[e]=new nt(e,n,this.dispatcher);o.style=this,o.setEventedParent(this,()=>({isSourceLoaded:o.loaded(),source:o.serialize(),sourceId:e})),o.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error("There is no source with this ID");for(let s in this._layers)if(this._layers[s].source===e)return this.fire(new p.j(new Error(`Source "${e}" cannot be removed while layer "${s}" is using it.`)));let n=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],n.fire(new p.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,n){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error(`There is no source with this ID=${e}`);let s=this.sourceCaches[e].getSource();if(s.type!=="geojson")throw new Error(`geojsonSource.type is ${s.type}, which is !== 'geojson`);s.setData(n),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,n,s={}){this._checkLoaded();let o=e.id;if(this.getLayer(o))return void this.fire(new p.j(new Error(`Layer "${o}" already exists on this map.`)));let u;if(e.type==="custom"){if(Lr(this,p.aD(e)))return;u=p.aA(e)}else{if("source"in e&&typeof e.source=="object"&&(this.addSource(o,e.source),e=p.aB(e),e=p.e(e,{source:o})),this._validate(p.u.layer,`layers.${o}`,e,{arrayIndex:-1},s))return;u=p.aA(e),this._validateLayer(u),u.setEventedParent(this,{layer:{id:o}})}let m=n?this._order.indexOf(n):this._order.length;if(n&&m===-1)this.fire(new p.j(new Error(`Cannot add layer "${o}" before non-existing layer "${n}".`)));else{if(this._order.splice(m,0,o),this._layerOrderChanged=!0,this._layers[o]=u,this._removedLayers[o]&&u.source&&u.type!=="custom"){let _=this._removedLayers[o];delete this._removedLayers[o],_.type!==u.type?this._updatedSources[u.source]="clear":(this._updatedSources[u.source]="reload",this.sourceCaches[u.source].pause())}this._updateLayer(u),u.onAdd&&u.onAdd(this.map)}}moveLayer(e,n){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new p.j(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===n)return;let s=this._order.indexOf(e);this._order.splice(s,1);let o=n?this._order.indexOf(n):this._order.length;n&&o===-1?this.fire(new p.j(new Error(`Cannot move layer "${e}" before non-existing layer "${n}".`))):(this._order.splice(o,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();let n=this._layers[e];if(!n)return void this.fire(new p.j(new Error(`Cannot remove non-existing layer "${e}".`)));n.setEventedParent(null);let s=this._order.indexOf(e);this._order.splice(s,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=n,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],n.onRemove&&n.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,n,s){this._checkLoaded();let o=this.getLayer(e);o?o.minzoom===n&&o.maxzoom===s||(n!=null&&(o.minzoom=n),s!=null&&(o.maxzoom=s),this._updateLayer(o)):this.fire(new p.j(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,n,s={}){this._checkLoaded();let o=this.getLayer(e);if(o){if(!p.aE(o.filter,n))return n==null?(o.filter=void 0,void this._updateLayer(o)):void(this._validate(p.u.filter,`layers.${o.id}.filter`,n,null,s)||(o.filter=p.aB(n),this._updateLayer(o)))}else this.fire(new p.j(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return p.aB(this.getLayer(e).filter)}setLayoutProperty(e,n,s,o={}){this._checkLoaded();let u=this.getLayer(e);u?p.aE(u.getLayoutProperty(n),s)||(u.setLayoutProperty(n,s,o),this._updateLayer(u)):this.fire(new p.j(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,n){let s=this.getLayer(e);if(s)return s.getLayoutProperty(n);this.fire(new p.j(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,n,s,o={}){this._checkLoaded();let u=this.getLayer(e);u?p.aE(u.getPaintProperty(n),s)||(u.setPaintProperty(n,s,o)&&this._updateLayer(u),this._changed=!0,this._updatedPaintProps[e]=!0,this._serializedLayers=null):this.fire(new p.j(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(e,n){return this.getLayer(e).getPaintProperty(n)}setFeatureState(e,n){this._checkLoaded();let s=e.source,o=e.sourceLayer,u=this.sourceCaches[s];if(u===void 0)return void this.fire(new p.j(new Error(`The source '${s}' does not exist in the map's style.`)));let m=u.getSource().type;m==="geojson"&&o?this.fire(new p.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):m!=="vector"||o?(e.id===void 0&&this.fire(new p.j(new Error("The feature id parameter must be provided."))),u.setFeatureState(o,e.id,n)):this.fire(new p.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,n){this._checkLoaded();let s=e.source,o=this.sourceCaches[s];if(o===void 0)return void this.fire(new p.j(new Error(`The source '${s}' does not exist in the map's style.`)));let u=o.getSource().type,m=u==="vector"?e.sourceLayer:void 0;u!=="vector"||m?n&&typeof e.id!="string"&&typeof e.id!="number"?this.fire(new p.j(new Error("A feature id is required to remove its specific state property."))):o.removeFeatureState(m,e.id,n):this.fire(new p.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();let n=e.source,s=e.sourceLayer,o=this.sourceCaches[n];if(o!==void 0)return o.getSource().type!=="vector"||s?(e.id===void 0&&this.fire(new p.j(new Error("The feature id parameter must be provided."))),o.getFeatureState(s,e.id)):void this.fire(new p.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new p.j(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return p.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;let e=p.aF(this.sourceCaches,u=>u.serialize()),n=this._serializeByIds(this._order,!0),s=this.map.getTerrain()||void 0,o=this.stylesheet;return p.aG({version:o.version,name:o.name,metadata:o.metadata,light:o.light,sky:o.sky,center:o.center,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch,sprite:o.sprite,glyphs:o.glyphs,transition:o.transition,sources:e,layers:n,terrain:s},u=>u!==void 0)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.sourceCaches[e.source].getSource().type!=="raster"&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){let n=m=>this._layers[m].type==="fill-extrusion",s={},o=[];for(let m=this._order.length-1;m>=0;m--){let _=this._order[m];if(n(_)){s[_]=m;for(let y of e){let b=y[_];if(b)for(let T of b)o.push(T)}}}o.sort((m,_)=>_.intersectionZ-m.intersectionZ);let u=[];for(let m=this._order.length-1;m>=0;m--){let _=this._order[m];if(n(_))for(let y=o.length-1;y>=0;y--){let b=o[y].feature;if(s[b.layer.id]{let be=G.featureSortOrder;if(be){let ze=be.indexOf(ae.featureIndex);return be.indexOf(fe.featureIndex)-ze}return fe.featureIndex-ae.featureIndex});for(let ae of te)Q.push(ae)}}for(let G in O)O[G].forEach(X=>{let N=X.feature,Q=b[_[G].source].getFeatureState(N.layer["source-layer"],N.id);N.source=N.layer.source,N.layer["source-layer"]&&(N.sourceLayer=N.layer["source-layer"]),N.state=Q});return O}(this._layers,m,this.sourceCaches,e,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(u)}querySourceFeatures(e,n){n&&n.filter&&this._validate(p.u.filter,"querySourceFeatures.filter",n.filter,null,n);let s=this.sourceCaches[e];return s?function(o,u){let m=o.getRenderableIds().map(b=>o.getTileByID(b)),_=[],y={};for(let b=0;bP.getTileByID(L)).sort((L,O)=>O.tileID.overscaledZ-L.tileID.overscaledZ||(L.tileID.isLessThan(O.tileID)?-1:1))}let C=this.crossTileSymbolIndex.addLayer(T,y[T.source],e.center.lng);m=m||C}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((u=u||this._layerOrderChanged||s===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(se.now(),e.zoom))&&(this.pauseablePlacement=new wa(e,this.map.terrain,this._order,u,n,s,o,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,y),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(se.now()),_=!0),m&&this.pauseablePlacement.placement.setStale()),_||m)for(let b of this._order){let T=this._layers[b];T.type==="symbol"&&this.placement.updateLayerOpacities(T,y[T.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(se.now())}_releaseSymbolFadeTiles(){for(let e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,n){return p._(this,void 0,void 0,function*(){let s=yield this.imageManager.getImages(n.icons);this._updateTilesForChangedImages();let o=this.sourceCaches[n.source];return o&&o.setDependencies(n.tileID.key,n.type,n.icons),s})}getGlyphs(e,n){return p._(this,void 0,void 0,function*(){let s=yield this.glyphManager.getGlyphs(n.stacks),o=this.sourceCaches[n.source];return o&&o.setDependencies(n.tileID.key,n.type,[""]),s})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,n={}){this._checkLoaded(),e&&this._validate(p.u.glyphs,"glyphs",e,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,n,s={},o){this._checkLoaded();let u=[{id:e,url:n}],m=[...xe(this.stylesheet.sprite),...u];this._validate(p.u.sprite,"sprite",m,null,s)||(this.stylesheet.sprite=m,this._loadSprite(u,!0,o))}removeSprite(e){this._checkLoaded();let n=xe(this.stylesheet.sprite);if(n.find(s=>s.id===e)){if(this._spritesImagesIds[e])for(let s of this._spritesImagesIds[e])this.imageManager.removeImage(s),this._changedImages[s]=!0;n.splice(n.findIndex(s=>s.id===e),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.k("data",{dataType:"style"}))}else this.fire(new p.j(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return xe(this.stylesheet.sprite)}setSprite(e,n={},s){this._checkLoaded(),e&&this._validate(p.u.sprite,"sprite",e,null,n)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,s):(this._unloadSprite(),s&&s(null)))}}var xn=p.Y([{name:"a_pos",type:"Int16",components:2}]);let ln={prelude:Nt(`#ifdef GL_ES precision mediump float; #else #if !defined(lowp) @@ -573,12 +573,12 @@ uniform ${T} ${C} u_${P}; ${T} ${C} ${P} = u_${P}; #endif `}),staticAttributes:s,staticUniforms:m}}class to{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,n,s,o,u,m,_,y,b){this.context=e;let T=this.boundPaintVertexBuffers.length!==o.length;for(let C=0;!T&&C({u_matrix:c,u_texture:0,u_ele_delta:e,u_fog_matrix:n,u_fog_color:s?s.properties.get("fog-color"):p.aM.white,u_fog_ground_blend:s?s.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:s?s.calculateFogBlendOpacity(o):0,u_horizon_color:s?s.properties.get("horizon-color"):p.aM.white,u_horizon_fog_blend:s?s.properties.get("horizon-fog-blend"):1});function Un(c){let e=[];for(let n=0;n({u_depth:new p.aH(ae,fe.u_depth),u_terrain:new p.aH(ae,fe.u_terrain),u_terrain_dim:new p.aI(ae,fe.u_terrain_dim),u_terrain_matrix:new p.aJ(ae,fe.u_terrain_matrix),u_terrain_unpack:new p.aK(ae,fe.u_terrain_unpack),u_terrain_exaggeration:new p.aI(ae,fe.u_terrain_exaggeration)}))(e,te),this.binderUniforms=s?s.getUniforms(e,te):[]}draw(e,n,s,o,u,m,_,y,b,T,C,P,L,O,U,Z,G,W){let N=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(s),e.setStencilMode(o),e.setColorMode(u),e.setCullFace(m),y){e.activeTexture.set(N.TEXTURE2),N.bindTexture(N.TEXTURE_2D,y.depthTexture),e.activeTexture.set(N.TEXTURE3),N.bindTexture(N.TEXTURE_2D,y.texture);for(let te in this.terrainUniforms)this.terrainUniforms[te].set(y[te])}for(let te in this.fixedUniforms)this.fixedUniforms[te].set(_[te]);U&&U.setUniforms(e,this.binderUniforms,L,{zoom:O});let Q=0;switch(n){case N.LINES:Q=2;break;case N.TRIANGLES:Q=3;break;case N.LINE_STRIP:Q=1}for(let te of P.get()){let ae=te.vaos||(te.vaos={});(ae[b]||(ae[b]=new to)).bind(e,this,T,U?U.getPaintVertexBuffers():[],C,te.vertexOffset,Z,G,W),N.drawElements(n,te.primitiveLength*Q,N.UNSIGNED_SHORT,te.primitiveOffset*Q*2)}}}function Ka(c,e,n){let s=1/Dt(n,1,e.transform.tileZoom),o=Math.pow(2,n.tileID.overscaledZ),u=n.tileSize*Math.pow(2,e.transform.tileZoom)/o,m=u*(n.tileID.canonical.x+n.tileID.wrap*o),_=u*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[s,c.fromScale,c.toScale],u_fade:c.t,u_pixel_coord_upper:[m>>16,_>>16],u_pixel_coord_lower:[65535&m,65535&_]}}let Aa=(c,e,n,s)=>{let o=e.style.light,u=o.properties.get("position"),m=[u.x,u.y,u.z],_=function(){var b=new p.A(9);return p.A!=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}();o.properties.get("anchor")==="viewport"&&function(b,T){var C=Math.sin(T),P=Math.cos(T);b[0]=P,b[1]=C,b[2]=0,b[3]=-C,b[4]=P,b[5]=0,b[6]=0,b[7]=0,b[8]=1}(_,-e.transform.angle),function(b,T,C){var P=T[0],L=T[1],O=T[2];b[0]=P*C[0]+L*C[3]+O*C[6],b[1]=P*C[1]+L*C[4]+O*C[7],b[2]=P*C[2]+L*C[5]+O*C[8]}(m,m,_);let y=o.properties.get("color");return{u_matrix:c,u_lightpos:m,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[y.r,y.g,y.b],u_vertical_gradient:+n,u_opacity:s}},Ya=(c,e,n,s,o,u,m)=>p.e(Aa(c,e,n,s),Ka(u,e,m),{u_height_factor:-Math.pow(2,o.overscaledZ)/m.tileSize/8}),jn=c=>({u_matrix:c}),vl=(c,e,n,s)=>p.e(jn(c),Ka(n,e,s)),Lu=(c,e)=>({u_matrix:c,u_world:e}),xl=(c,e,n,s,o)=>p.e(vl(c,e,n,s),{u_world:o}),Ru=(c,e,n,s)=>{let o=c.transform,u,m;if(s.paint.get("circle-pitch-alignment")==="map"){let _=Dt(n,1,o.zoom);u=!0,m=[_,_]}else u=!1,m=o.pixelsToGLUnits;return{u_camera_to_center_distance:o.cameraToCenterDistance,u_scale_with_map:+(s.paint.get("circle-pitch-scale")==="map"),u_matrix:c.translatePosMatrix(e.posMatrix,n,s.paint.get("circle-translate"),s.paint.get("circle-translate-anchor")),u_pitch_with_map:+u,u_device_pixel_ratio:c.pixelRatio,u_extrude_scale:m}},bn=(c,e,n)=>({u_matrix:c,u_inv_matrix:e,u_camera_to_center_distance:n.cameraToCenterDistance,u_viewport_size:[n.width,n.height]}),Ea=(c,e,n=1)=>({u_matrix:c,u_color:e,u_overlay:0,u_overlay_scale:n}),Yi=c=>({u_matrix:c}),Qi=(c,e,n,s)=>({u_matrix:c,u_extrude_scale:Dt(e,1,n),u_intensity:s}),Qa=(c,e,n,s)=>{let o=p.H();p.aP(o,0,c.width,c.height,0,0,1);let u=c.context.gl;return{u_matrix:o,u_world:[u.drawingBufferWidth,u.drawingBufferHeight],u_image:n,u_color_ramp:s,u_opacity:e.paint.get("heatmap-opacity")}};function es(c,e){let n=Math.pow(2,e.canonical.z),s=e.canonical.y;return[new p.Z(0,s/n).toLngLat().lat,new p.Z(0,(s+1)/n).toLngLat().lat]}let ts=(c,e,n,s)=>{let o=c.transform;return{u_matrix:Al(c,e,n,s),u_ratio:1/Dt(e,1,o.zoom),u_device_pixel_ratio:c.pixelRatio,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},bl=(c,e,n,s,o)=>p.e(ts(c,e,n,o),{u_image:0,u_image_height:s}),$n=(c,e,n,s,o)=>{let u=c.transform,m=wl(e,u);return{u_matrix:Al(c,e,n,o),u_texsize:e.imageAtlasTexture.size,u_ratio:1/Dt(e,1,u.zoom),u_device_pixel_ratio:c.pixelRatio,u_image:0,u_scale:[m,s.fromScale,s.toScale],u_fade:s.t,u_units_to_pixels:[1/u.pixelsToGLUnits[0],1/u.pixelsToGLUnits[1]]}},Fu=(c,e,n,s,o,u)=>{let m=c.lineAtlas,_=wl(e,c.transform),y=n.layout.get("line-cap")==="round",b=m.getDash(s.from,y),T=m.getDash(s.to,y),C=b.width*o.fromScale,P=T.width*o.toScale;return p.e(ts(c,e,n,u),{u_patternscale_a:[_/C,-b.height/2],u_patternscale_b:[_/P,-T.height/2],u_sdfgamma:m.width/(256*Math.min(C,P)*c.pixelRatio)/2,u_image:0,u_tex_y_a:b.y,u_tex_y_b:T.y,u_mix:o.t})};function wl(c,e){return 1/Dt(c,1,e.tileZoom)}function Al(c,e,n,s){return c.translatePosMatrix(s?s.posMatrix:e.tileID.posMatrix,e,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}let Ou=(c,e,n,s,o)=>{return{u_matrix:c,u_tl_parent:e,u_scale_parent:n,u_buffer_scale:1,u_fade_t:s.mix,u_opacity:s.opacity*o.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:o.paint.get("raster-brightness-min"),u_brightness_high:o.paint.get("raster-brightness-max"),u_saturation_factor:(m=o.paint.get("raster-saturation"),m>0?1-1/(1.001-m):-m),u_contrast_factor:(u=o.paint.get("raster-contrast"),u>0?1/(1-u):1+u),u_spin_weights:Nu(o.paint.get("raster-hue-rotate"))};var u,m};function Nu(c){c*=Math.PI/180;let e=Math.sin(c),n=Math.cos(c);return[(2*n+1)/3,(-Math.sqrt(3)*e-n+1)/3,(Math.sqrt(3)*e-n+1)/3]}let El=(c,e,n,s,o,u,m,_,y,b,T,C,P,L)=>{let O=m.transform;return{u_is_size_zoom_constant:+(c==="constant"||c==="source"),u_is_size_feature_constant:+(c==="constant"||c==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:O.cameraToCenterDistance,u_pitch:O.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:O.width/O.height,u_fade_change:m.options.fadeDuration?m.symbolFadeChange:1,u_matrix:_,u_label_plane_matrix:y,u_coord_matrix:b,u_is_text:+C,u_pitch_with_map:+s,u_is_along_line:o,u_is_variable_anchor:u,u_texsize:P,u_texture:0,u_translation:T,u_pitched_scale:L}},Ta=(c,e,n,s,o,u,m,_,y,b,T,C,P,L,O)=>{let U=m.transform;return p.e(El(c,e,n,s,o,u,m,_,y,b,T,C,P,O),{u_gamma_scale:s?Math.cos(U._pitch)*U.cameraToCenterDistance:1,u_device_pixel_ratio:m.pixelRatio,u_is_halo:+L})},no=(c,e,n,s,o,u,m,_,y,b,T,C,P,L)=>p.e(Ta(c,e,n,s,o,u,m,_,y,b,T,!0,C,!0,L),{u_texsize_icon:P,u_texture_icon:1}),is=(c,e,n)=>({u_matrix:c,u_opacity:e,u_color:n}),ao=(c,e,n,s,o,u)=>p.e(function(m,_,y,b){let T=y.imageManager.getPattern(m.from.toString()),C=y.imageManager.getPattern(m.to.toString()),{width:P,height:L}=y.imageManager.getPixelSize(),O=Math.pow(2,b.tileID.overscaledZ),U=b.tileSize*Math.pow(2,y.transform.tileZoom)/O,Z=U*(b.tileID.canonical.x+b.tileID.wrap*O),G=U*b.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:T.tl,u_pattern_br_a:T.br,u_pattern_tl_b:C.tl,u_pattern_br_b:C.br,u_texsize:[P,L],u_mix:_.t,u_pattern_size_a:T.displaySize,u_pattern_size_b:C.displaySize,u_scale_a:_.fromScale,u_scale_b:_.toScale,u_tile_units_to_pixels:1/Dt(b,1,y.transform.tileZoom),u_pixel_coord_upper:[Z>>16,G>>16],u_pixel_coord_lower:[65535&Z,65535&G]}}(s,u,n,o),{u_matrix:c,u_opacity:e}),so={fillExtrusion:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_lightpos:new p.aN(c,e.u_lightpos),u_lightintensity:new p.aI(c,e.u_lightintensity),u_lightcolor:new p.aN(c,e.u_lightcolor),u_vertical_gradient:new p.aI(c,e.u_vertical_gradient),u_opacity:new p.aI(c,e.u_opacity)}),fillExtrusionPattern:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_lightpos:new p.aN(c,e.u_lightpos),u_lightintensity:new p.aI(c,e.u_lightintensity),u_lightcolor:new p.aN(c,e.u_lightcolor),u_vertical_gradient:new p.aI(c,e.u_vertical_gradient),u_height_factor:new p.aI(c,e.u_height_factor),u_image:new p.aH(c,e.u_image),u_texsize:new p.aO(c,e.u_texsize),u_pixel_coord_upper:new p.aO(c,e.u_pixel_coord_upper),u_pixel_coord_lower:new p.aO(c,e.u_pixel_coord_lower),u_scale:new p.aN(c,e.u_scale),u_fade:new p.aI(c,e.u_fade),u_opacity:new p.aI(c,e.u_opacity)}),fill:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix)}),fillPattern:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_image:new p.aH(c,e.u_image),u_texsize:new p.aO(c,e.u_texsize),u_pixel_coord_upper:new p.aO(c,e.u_pixel_coord_upper),u_pixel_coord_lower:new p.aO(c,e.u_pixel_coord_lower),u_scale:new p.aN(c,e.u_scale),u_fade:new p.aI(c,e.u_fade)}),fillOutline:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_world:new p.aO(c,e.u_world)}),fillOutlinePattern:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_world:new p.aO(c,e.u_world),u_image:new p.aH(c,e.u_image),u_texsize:new p.aO(c,e.u_texsize),u_pixel_coord_upper:new p.aO(c,e.u_pixel_coord_upper),u_pixel_coord_lower:new p.aO(c,e.u_pixel_coord_lower),u_scale:new p.aN(c,e.u_scale),u_fade:new p.aI(c,e.u_fade)}),circle:(c,e)=>({u_camera_to_center_distance:new p.aI(c,e.u_camera_to_center_distance),u_scale_with_map:new p.aH(c,e.u_scale_with_map),u_pitch_with_map:new p.aH(c,e.u_pitch_with_map),u_extrude_scale:new p.aO(c,e.u_extrude_scale),u_device_pixel_ratio:new p.aI(c,e.u_device_pixel_ratio),u_matrix:new p.aJ(c,e.u_matrix)}),collisionBox:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_pixel_extrude_scale:new p.aO(c,e.u_pixel_extrude_scale)}),collisionCircle:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_inv_matrix:new p.aJ(c,e.u_inv_matrix),u_camera_to_center_distance:new p.aI(c,e.u_camera_to_center_distance),u_viewport_size:new p.aO(c,e.u_viewport_size)}),debug:(c,e)=>({u_color:new p.aL(c,e.u_color),u_matrix:new p.aJ(c,e.u_matrix),u_overlay:new p.aH(c,e.u_overlay),u_overlay_scale:new p.aI(c,e.u_overlay_scale)}),clippingMask:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix)}),heatmap:(c,e)=>({u_extrude_scale:new p.aI(c,e.u_extrude_scale),u_intensity:new p.aI(c,e.u_intensity),u_matrix:new p.aJ(c,e.u_matrix)}),heatmapTexture:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_world:new p.aO(c,e.u_world),u_image:new p.aH(c,e.u_image),u_color_ramp:new p.aH(c,e.u_color_ramp),u_opacity:new p.aI(c,e.u_opacity)}),hillshade:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_image:new p.aH(c,e.u_image),u_latrange:new p.aO(c,e.u_latrange),u_light:new p.aO(c,e.u_light),u_shadow:new p.aL(c,e.u_shadow),u_highlight:new p.aL(c,e.u_highlight),u_accent:new p.aL(c,e.u_accent)}),hillshadePrepare:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_image:new p.aH(c,e.u_image),u_dimension:new p.aO(c,e.u_dimension),u_zoom:new p.aI(c,e.u_zoom),u_unpack:new p.aK(c,e.u_unpack)}),line:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_ratio:new p.aI(c,e.u_ratio),u_device_pixel_ratio:new p.aI(c,e.u_device_pixel_ratio),u_units_to_pixels:new p.aO(c,e.u_units_to_pixels)}),lineGradient:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_ratio:new p.aI(c,e.u_ratio),u_device_pixel_ratio:new p.aI(c,e.u_device_pixel_ratio),u_units_to_pixels:new p.aO(c,e.u_units_to_pixels),u_image:new p.aH(c,e.u_image),u_image_height:new p.aI(c,e.u_image_height)}),linePattern:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_texsize:new p.aO(c,e.u_texsize),u_ratio:new p.aI(c,e.u_ratio),u_device_pixel_ratio:new p.aI(c,e.u_device_pixel_ratio),u_image:new p.aH(c,e.u_image),u_units_to_pixels:new p.aO(c,e.u_units_to_pixels),u_scale:new p.aN(c,e.u_scale),u_fade:new p.aI(c,e.u_fade)}),lineSDF:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_ratio:new p.aI(c,e.u_ratio),u_device_pixel_ratio:new p.aI(c,e.u_device_pixel_ratio),u_units_to_pixels:new p.aO(c,e.u_units_to_pixels),u_patternscale_a:new p.aO(c,e.u_patternscale_a),u_patternscale_b:new p.aO(c,e.u_patternscale_b),u_sdfgamma:new p.aI(c,e.u_sdfgamma),u_image:new p.aH(c,e.u_image),u_tex_y_a:new p.aI(c,e.u_tex_y_a),u_tex_y_b:new p.aI(c,e.u_tex_y_b),u_mix:new p.aI(c,e.u_mix)}),raster:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_tl_parent:new p.aO(c,e.u_tl_parent),u_scale_parent:new p.aI(c,e.u_scale_parent),u_buffer_scale:new p.aI(c,e.u_buffer_scale),u_fade_t:new p.aI(c,e.u_fade_t),u_opacity:new p.aI(c,e.u_opacity),u_image0:new p.aH(c,e.u_image0),u_image1:new p.aH(c,e.u_image1),u_brightness_low:new p.aI(c,e.u_brightness_low),u_brightness_high:new p.aI(c,e.u_brightness_high),u_saturation_factor:new p.aI(c,e.u_saturation_factor),u_contrast_factor:new p.aI(c,e.u_contrast_factor),u_spin_weights:new p.aN(c,e.u_spin_weights)}),symbolIcon:(c,e)=>({u_is_size_zoom_constant:new p.aH(c,e.u_is_size_zoom_constant),u_is_size_feature_constant:new p.aH(c,e.u_is_size_feature_constant),u_size_t:new p.aI(c,e.u_size_t),u_size:new p.aI(c,e.u_size),u_camera_to_center_distance:new p.aI(c,e.u_camera_to_center_distance),u_pitch:new p.aI(c,e.u_pitch),u_rotate_symbol:new p.aH(c,e.u_rotate_symbol),u_aspect_ratio:new p.aI(c,e.u_aspect_ratio),u_fade_change:new p.aI(c,e.u_fade_change),u_matrix:new p.aJ(c,e.u_matrix),u_label_plane_matrix:new p.aJ(c,e.u_label_plane_matrix),u_coord_matrix:new p.aJ(c,e.u_coord_matrix),u_is_text:new p.aH(c,e.u_is_text),u_pitch_with_map:new p.aH(c,e.u_pitch_with_map),u_is_along_line:new p.aH(c,e.u_is_along_line),u_is_variable_anchor:new p.aH(c,e.u_is_variable_anchor),u_texsize:new p.aO(c,e.u_texsize),u_texture:new p.aH(c,e.u_texture),u_translation:new p.aO(c,e.u_translation),u_pitched_scale:new p.aI(c,e.u_pitched_scale)}),symbolSDF:(c,e)=>({u_is_size_zoom_constant:new p.aH(c,e.u_is_size_zoom_constant),u_is_size_feature_constant:new p.aH(c,e.u_is_size_feature_constant),u_size_t:new p.aI(c,e.u_size_t),u_size:new p.aI(c,e.u_size),u_camera_to_center_distance:new p.aI(c,e.u_camera_to_center_distance),u_pitch:new p.aI(c,e.u_pitch),u_rotate_symbol:new p.aH(c,e.u_rotate_symbol),u_aspect_ratio:new p.aI(c,e.u_aspect_ratio),u_fade_change:new p.aI(c,e.u_fade_change),u_matrix:new p.aJ(c,e.u_matrix),u_label_plane_matrix:new p.aJ(c,e.u_label_plane_matrix),u_coord_matrix:new p.aJ(c,e.u_coord_matrix),u_is_text:new p.aH(c,e.u_is_text),u_pitch_with_map:new p.aH(c,e.u_pitch_with_map),u_is_along_line:new p.aH(c,e.u_is_along_line),u_is_variable_anchor:new p.aH(c,e.u_is_variable_anchor),u_texsize:new p.aO(c,e.u_texsize),u_texture:new p.aH(c,e.u_texture),u_gamma_scale:new p.aI(c,e.u_gamma_scale),u_device_pixel_ratio:new p.aI(c,e.u_device_pixel_ratio),u_is_halo:new p.aH(c,e.u_is_halo),u_translation:new p.aO(c,e.u_translation),u_pitched_scale:new p.aI(c,e.u_pitched_scale)}),symbolTextAndIcon:(c,e)=>({u_is_size_zoom_constant:new p.aH(c,e.u_is_size_zoom_constant),u_is_size_feature_constant:new p.aH(c,e.u_is_size_feature_constant),u_size_t:new p.aI(c,e.u_size_t),u_size:new p.aI(c,e.u_size),u_camera_to_center_distance:new p.aI(c,e.u_camera_to_center_distance),u_pitch:new p.aI(c,e.u_pitch),u_rotate_symbol:new p.aH(c,e.u_rotate_symbol),u_aspect_ratio:new p.aI(c,e.u_aspect_ratio),u_fade_change:new p.aI(c,e.u_fade_change),u_matrix:new p.aJ(c,e.u_matrix),u_label_plane_matrix:new p.aJ(c,e.u_label_plane_matrix),u_coord_matrix:new p.aJ(c,e.u_coord_matrix),u_is_text:new p.aH(c,e.u_is_text),u_pitch_with_map:new p.aH(c,e.u_pitch_with_map),u_is_along_line:new p.aH(c,e.u_is_along_line),u_is_variable_anchor:new p.aH(c,e.u_is_variable_anchor),u_texsize:new p.aO(c,e.u_texsize),u_texsize_icon:new p.aO(c,e.u_texsize_icon),u_texture:new p.aH(c,e.u_texture),u_texture_icon:new p.aH(c,e.u_texture_icon),u_gamma_scale:new p.aI(c,e.u_gamma_scale),u_device_pixel_ratio:new p.aI(c,e.u_device_pixel_ratio),u_is_halo:new p.aH(c,e.u_is_halo),u_translation:new p.aO(c,e.u_translation),u_pitched_scale:new p.aI(c,e.u_pitched_scale)}),background:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_opacity:new p.aI(c,e.u_opacity),u_color:new p.aL(c,e.u_color)}),backgroundPattern:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_opacity:new p.aI(c,e.u_opacity),u_image:new p.aH(c,e.u_image),u_pattern_tl_a:new p.aO(c,e.u_pattern_tl_a),u_pattern_br_a:new p.aO(c,e.u_pattern_br_a),u_pattern_tl_b:new p.aO(c,e.u_pattern_tl_b),u_pattern_br_b:new p.aO(c,e.u_pattern_br_b),u_texsize:new p.aO(c,e.u_texsize),u_mix:new p.aI(c,e.u_mix),u_pattern_size_a:new p.aO(c,e.u_pattern_size_a),u_pattern_size_b:new p.aO(c,e.u_pattern_size_b),u_scale_a:new p.aI(c,e.u_scale_a),u_scale_b:new p.aI(c,e.u_scale_b),u_pixel_coord_upper:new p.aO(c,e.u_pixel_coord_upper),u_pixel_coord_lower:new p.aO(c,e.u_pixel_coord_lower),u_tile_units_to_pixels:new p.aI(c,e.u_tile_units_to_pixels)}),terrain:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_texture:new p.aH(c,e.u_texture),u_ele_delta:new p.aI(c,e.u_ele_delta),u_fog_matrix:new p.aJ(c,e.u_fog_matrix),u_fog_color:new p.aL(c,e.u_fog_color),u_fog_ground_blend:new p.aI(c,e.u_fog_ground_blend),u_fog_ground_blend_opacity:new p.aI(c,e.u_fog_ground_blend_opacity),u_horizon_color:new p.aL(c,e.u_horizon_color),u_horizon_fog_blend:new p.aI(c,e.u_horizon_fog_blend)}),terrainDepth:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_ele_delta:new p.aI(c,e.u_ele_delta)}),terrainCoords:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_texture:new p.aH(c,e.u_texture),u_terrain_coords_id:new p.aI(c,e.u_terrain_coords_id),u_ele_delta:new p.aI(c,e.u_ele_delta)}),sky:(c,e)=>({u_sky_color:new p.aL(c,e.u_sky_color),u_horizon_color:new p.aL(c,e.u_horizon_color),u_horizon:new p.aI(c,e.u_horizon),u_sky_horizon_blend:new p.aI(c,e.u_sky_horizon_blend)})};class Gr{constructor(e,n,s){this.context=e;let o=e.gl;this.buffer=o.createBuffer(),this.dynamicDraw=!!s,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let n=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let qu={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class oo{constructor(e,n,s,o){this.length=n.length,this.attributes=s,this.itemSize=n.bytesPerElement,this.dynamicDraw=o,this.context=e;let u=e.gl;this.buffer=u.createBuffer(),e.bindVertexBuffer.set(this.buffer),u.bufferData(u.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?u.DYNAMIC_DRAW:u.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);let n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,n){for(let s=0;s0){let ae=p.H();p.aQ(ae,N.placementInvProjMatrix,c.transform.glCoordMatrix),p.aQ(ae,ae,N.placementViewportMatrix),y.push({circleArray:te,circleOffset:T,transform:W.posMatrix,invTransform:ae,coord:W}),b+=te.length/4,T=b}Q&&_.draw(u,m.LINES,Tt.disabled,Yt.disabled,c.colorModeForRenderPass(),Ht.disabled,{u_matrix:W.posMatrix,u_pixel_extrude_scale:[1/(C=c.transform).width,1/C.height]},c.style.map.terrain&&c.style.map.terrain.getTerrainData(W),n.id,Q.layoutVertexBuffer,Q.indexBuffer,Q.segments,null,c.transform.zoom,null,null,Q.collisionVertexBuffer)}var C;if(!o||!y.length)return;let P=c.useProgram("collisionCircle"),L=new p.aR;L.resize(4*b),L._trim();let O=0;for(let G of y)for(let W=0;W=0&&(G[N.associatedIconIndex]={shiftedAnchor:ot,angle:ii})}else tt(N.numGlyphs,U)}if(b){Z.clear();let W=c.icon.placedSymbolArray;for(let N=0;Nc.style.map.terrain.getElevation(Ie,ca,ha):null,Mn=n.layout.get("text-rotation-alignment")==="map";R(Ze,Ie.posMatrix,c,o,la,ua,G,b,Mn,U,Ie.toUnwrapped(),O.width,O.height,Ar,kt)}let Er=Ie.posMatrix,Tr=o&&be||Uo,cn=W||Tr?Sa:la,Nr=Cs,ki=Le&&n.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1)!==0,Li;Li=Le?Ze.iconsInText?no(ot.kind,St,N,G,W,Tr,c,Er,cn,Nr,Ar,zi,$i,Oe):Ta(ot.kind,St,N,G,W,Tr,c,Er,cn,Nr,Ar,o,zi,!0,Oe):El(ot.kind,St,N,G,W,Tr,c,Er,cn,Nr,Ar,o,zi,Oe);let fr={program:xt,buffers:ct,uniformValues:Li,atlasTexture:Or,atlasTextureIcon:Bi,atlasInterpolation:ni,atlasInterpolationIcon:er,isSDF:Le,hasHalo:ki};if(te&&Ze.canOverlap){ae=!0;let kt=ct.segments.get();for(let Mn of kt)ze.push({segments:new p.a0([Mn]),sortKey:Mn.sortKey,state:fr,terrainData:ri})}else ze.push({segments:ct.segments,sortKey:0,state:fr,terrainData:ri})}ae&&ze.sort((Ie,Ce)=>Ie.sortKey-Ce.sortKey);for(let Ie of ze){let Ce=Ie.state;if(P.activeTexture.set(L.TEXTURE0),Ce.atlasTexture.bind(Ce.atlasInterpolation,L.CLAMP_TO_EDGE),Ce.atlasTextureIcon&&(P.activeTexture.set(L.TEXTURE1),Ce.atlasTextureIcon&&Ce.atlasTextureIcon.bind(Ce.atlasInterpolationIcon,L.CLAMP_TO_EDGE)),Ce.isSDF){let Ze=Ce.uniformValues;Ce.hasHalo&&(Ze.u_is_halo=1,yo(Ce.buffers,Ie.segments,n,c,Ce.program,fe,T,C,Ze,Ie.terrainData)),Ze.u_is_halo=0}yo(Ce.buffers,Ie.segments,n,c,Ce.program,fe,T,C,Ce.uniformValues,Ie.terrainData)}}function yo(c,e,n,s,o,u,m,_,y,b){let T=s.context;o.draw(T,T.gl.TRIANGLES,u,m,_,Ht.disabled,y,b,n.id,c.layoutVertexBuffer,c.indexBuffer,e,n.paint,s.transform.zoom,c.programConfigurations.get(n.id),c.dynamicLayoutVertexBuffer,c.opacityVertexBuffer)}function vo(c,e,n,s){let o=c.context,u=o.gl,m=Yt.disabled,_=new fi([u.ONE,u.ONE],p.aM.transparent,[!0,!0,!0,!0]),y=e.getBucket(n);if(!y)return;let b=s.key,T=n.heatmapFbos.get(b);T||(T=Ia(o,e.tileSize,e.tileSize),n.heatmapFbos.set(b,T)),o.bindFramebuffer.set(T.framebuffer),o.viewport.set([0,0,e.tileSize,e.tileSize]),o.clear({color:p.aM.transparent});let C=y.programConfigurations.get(n.id),P=c.useProgram("heatmap",C),L=c.style.map.terrain.getTerrainData(s);P.draw(o,u.TRIANGLES,Tt.disabled,m,_,Ht.disabled,Qi(s.posMatrix,e,c.transform.zoom,n.paint.get("heatmap-intensity")),L,n.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,n.paint,c.transform.zoom,C)}function Dn(c,e,n){let s=c.context,o=s.gl;s.setColorMode(c.colorModeForRenderPass());let u=ka(s,e),m=n.key,_=e.heatmapFbos.get(m);_&&(s.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,_.colorAttachment.get()),s.activeTexture.set(o.TEXTURE1),u.bind(o.LINEAR,o.CLAMP_TO_EDGE),c.useProgram("heatmapTexture").draw(s,o.TRIANGLES,Tt.disabled,Yt.disabled,c.colorModeForRenderPass(),Ht.disabled,Qa(c,e,0,1),null,e.id,c.rasterBoundsBuffer,c.quadTriangleIndexBuffer,c.rasterBoundsSegments,e.paint,c.transform.zoom),_.destroy(),e.heatmapFbos.delete(m))}function Ia(c,e,n){var s,o;let u=c.gl,m=u.createTexture();u.bindTexture(u.TEXTURE_2D,m),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,u.LINEAR),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,u.LINEAR);let _=(s=c.HALF_FLOAT)!==null&&s!==void 0?s:u.UNSIGNED_BYTE,y=(o=c.RGBA16F)!==null&&o!==void 0?o:u.RGBA;u.texImage2D(u.TEXTURE_2D,0,y,e,n,0,u.RGBA,_,null);let b=c.createFramebuffer(e,n,!1,!1);return b.colorAttachment.set(m),b}function ka(c,e){return e.colorRampTexture||(e.colorRampTexture=new ge(c,e.colorRamp,c.gl.RGBA)),e.colorRampTexture}function Hn(c,e,n,s,o){if(!n||!s||!s.imageAtlas)return;let u=s.imageAtlas.patternPositions,m=u[n.to.toString()],_=u[n.from.toString()];if(!m&&_&&(m=_),!_&&m&&(_=m),!m||!_){let y=o.getPaintProperty(e);m=u[y],_=u[y]}m&&_&&c.setConstantPatternPositions(m,_)}function Ma(c,e,n,s,o,u,m){let _=c.context.gl,y="fill-pattern",b=n.paint.get(y),T=b&&b.constantOr(1),C=n.getCrossfadeParameters(),P,L,O,U,Z;m?(L=T&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",P=_.LINES):(L=T?"fillPattern":"fill",P=_.TRIANGLES);let G=b.constantOr(null);for(let W of s){let N=e.getTile(W);if(T&&!N.patternsLoaded())continue;let Q=N.getBucket(n);if(!Q)continue;let te=Q.programConfigurations.get(n.id),ae=c.useProgram(L,te),fe=c.style.map.terrain&&c.style.map.terrain.getTerrainData(W);T&&(c.context.activeTexture.set(_.TEXTURE0),N.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),te.updatePaintBuffers(C)),Hn(te,y,G,N,n);let be=fe?W:null,ze=c.translatePosMatrix(be?be.posMatrix:W.posMatrix,N,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(m){U=Q.indexBuffer2,Z=Q.segments2;let Oe=[_.drawingBufferWidth,_.drawingBufferHeight];O=L==="fillOutlinePattern"&&T?xl(ze,c,C,N,Oe):Lu(ze,Oe)}else U=Q.indexBuffer,Z=Q.segments,O=T?vl(ze,c,C,N):jn(ze);ae.draw(c.context,P,o,c.stencilModeForClipping(W),u,Ht.disabled,O,fe,n.id,Q.layoutVertexBuffer,U,Z,n.paint,c.transform.zoom,te)}}function ls(c,e,n,s,o,u,m){let _=c.context,y=_.gl,b="fill-extrusion-pattern",T=n.paint.get(b),C=T.constantOr(1),P=n.getCrossfadeParameters(),L=n.paint.get("fill-extrusion-opacity"),O=T.constantOr(null);for(let U of s){let Z=e.getTile(U),G=Z.getBucket(n);if(!G)continue;let W=c.style.map.terrain&&c.style.map.terrain.getTerrainData(U),N=G.programConfigurations.get(n.id),Q=c.useProgram(C?"fillExtrusionPattern":"fillExtrusion",N);C&&(c.context.activeTexture.set(y.TEXTURE0),Z.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),N.updatePaintBuffers(P)),Hn(N,b,O,Z,n);let te=c.translatePosMatrix(U.posMatrix,Z,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),ae=n.paint.get("fill-extrusion-vertical-gradient"),fe=C?Ya(te,c,ae,L,U,P,Z):Aa(te,c,ae,L);Q.draw(_,_.gl.TRIANGLES,o,u,m,Ht.backCCW,fe,W,n.id,G.layoutVertexBuffer,G.indexBuffer,G.segments,n.paint,c.transform.zoom,N,c.style.map.terrain&&G.centroidVertexBuffer)}}function Xn(c,e,n,s,o,u,m){let _=c.context,y=_.gl,b=n.fbo;if(!b)return;let T=c.useProgram("hillshade"),C=c.style.map.terrain&&c.style.map.terrain.getTerrainData(e);_.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,b.colorAttachment.get()),T.draw(_,y.TRIANGLES,o,u,m,Ht.disabled,((P,L,O,U)=>{let Z=O.paint.get("hillshade-shadow-color"),G=O.paint.get("hillshade-highlight-color"),W=O.paint.get("hillshade-accent-color"),N=O.paint.get("hillshade-illumination-direction")*(Math.PI/180);O.paint.get("hillshade-illumination-anchor")==="viewport"&&(N-=P.transform.angle);let Q=!P.options.moving;return{u_matrix:U?U.posMatrix:P.transform.calculatePosMatrix(L.tileID.toUnwrapped(),Q),u_image:0,u_latrange:es(0,L.tileID),u_light:[O.paint.get("hillshade-exaggeration"),N],u_shadow:Z,u_highlight:G,u_accent:W}})(c,n,s,C?e:null),C,s.id,c.rasterBoundsBuffer,c.quadTriangleIndexBuffer,c.rasterBoundsSegments)}function Wn(c,e,n,s,o,u){let m=c.context,_=m.gl,y=e.dem;if(y&&y.data){let b=y.dim,T=y.stride,C=y.getPixels();if(m.activeTexture.set(_.TEXTURE1),m.pixelStoreUnpackPremultiplyAlpha.set(!1),e.demTexture=e.demTexture||c.getTileTexture(T),e.demTexture){let L=e.demTexture;L.update(C,{premultiply:!1}),L.bind(_.NEAREST,_.CLAMP_TO_EDGE)}else e.demTexture=new ge(m,C,_.RGBA,{premultiply:!1}),e.demTexture.bind(_.NEAREST,_.CLAMP_TO_EDGE);m.activeTexture.set(_.TEXTURE0);let P=e.fbo;if(!P){let L=new ge(m,{width:b,height:b,data:null},_.RGBA);L.bind(_.LINEAR,_.CLAMP_TO_EDGE),P=e.fbo=m.createFramebuffer(b,b,!0,!1),P.colorAttachment.set(L.texture)}m.bindFramebuffer.set(P.framebuffer),m.viewport.set([0,0,b,b]),c.useProgram("hillshadePrepare").draw(m,_.TRIANGLES,s,o,u,Ht.disabled,((L,O)=>{let U=O.stride,Z=p.H();return p.aP(Z,0,p.X,-p.X,0,0,1),p.J(Z,Z,[0,-p.X,0]),{u_matrix:Z,u_image:1,u_dimension:[U,U],u_zoom:L.overscaledZ,u_unpack:O.getUnpackVector()}})(e.tileID,y),null,n.id,c.rasterBoundsBuffer,c.quadTriangleIndexBuffer,c.rasterBoundsSegments),e.needsHillshadePrepare=!1}}function Fl(c,e,n,s,o,u){let m=s.paint.get("raster-fade-duration");if(!u&&m>0){let _=se.now(),y=(_-c.timeAdded)/m,b=e?(_-e.timeAdded)/m:-1,T=n.getSource(),C=o.coveringZoomLevel({tileSize:T.tileSize,roundZoom:T.roundZoom}),P=!e||Math.abs(e.tileID.overscaledZ-C)>Math.abs(c.tileID.overscaledZ-C),L=P&&c.refreshedUponExpiration?1:p.ac(P?y:1-b,0,1);return c.refreshedUponExpiration&&y>=1&&(c.refreshedUponExpiration=!1),e?{opacity:1,mix:1-L}:{opacity:L,mix:0}}return{opacity:1,mix:0}}let xo=new p.aM(1,0,0,1),Ft=new p.aM(0,1,0,1),us=new p.aM(0,0,1,1),Ju=new p.aM(1,0,1,1),Ol=new p.aM(0,1,1,1);function Jn(c,e,n,s){cs(c,0,e+n/2,c.transform.width,n,s)}function Nl(c,e,n,s){cs(c,e-n/2,0,n,c.transform.height,s)}function cs(c,e,n,s,o,u){let m=c.context,_=m.gl;_.enable(_.SCISSOR_TEST),_.scissor(e*c.pixelRatio,n*c.pixelRatio,s*c.pixelRatio,o*c.pixelRatio),m.clear({color:u}),_.disable(_.SCISSOR_TEST)}function ql(c,e,n){let s=c.context,o=s.gl,u=n.posMatrix,m=c.useProgram("debug"),_=Tt.disabled,y=Yt.disabled,b=c.colorModeForRenderPass(),T="$debug",C=c.style.map.terrain&&c.style.map.terrain.getTerrainData(n);s.activeTexture.set(o.TEXTURE0);let P=e.getTileByID(n.key).latestRawTileData,L=Math.floor((P&&P.byteLength||0)/1024),O=e.getTile(n).tileSize,U=512/Math.min(O,512)*(n.overscaledZ/c.transform.zoom)*.5,Z=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(Z+=` => ${n.overscaledZ}`),function(G,W){G.initDebugOverlayCanvas();let N=G.debugOverlayCanvas,Q=G.context.gl,te=G.debugOverlayCanvas.getContext("2d");te.clearRect(0,0,N.width,N.height),te.shadowColor="white",te.shadowBlur=2,te.lineWidth=1.5,te.strokeStyle="white",te.textBaseline="top",te.font="bold 36px Open Sans, sans-serif",te.fillText(W,5,5),te.strokeText(W,5,5),G.debugOverlayTexture.update(N),G.debugOverlayTexture.bind(Q.LINEAR,Q.CLAMP_TO_EDGE)}(c,`${Z} ${L}kB`),m.draw(s,o.TRIANGLES,_,y,fi.alphaBlended,Ht.disabled,Ea(u,p.aM.transparent,U),null,T,c.debugBuffer,c.quadTriangleIndexBuffer,c.debugSegments),m.draw(s,o.LINE_STRIP,_,y,b,Ht.disabled,Ea(u,p.aM.red),C,T,c.debugBuffer,c.tileBorderIndexBuffer,c.debugSegments)}function Vl(c,e,n){let s=c.context,o=s.gl,u=c.colorModeForRenderPass(),m=new Tt(o.LEQUAL,Tt.ReadWrite,c.depthRangeFor3D),_=c.useProgram("terrain"),y=e.getTerrainMesh();s.bindFramebuffer.set(null),s.viewport.set([0,0,c.width,c.height]);for(let b of n){let T=c.renderToTexture.getTexture(b),C=e.getTerrainData(b.tileID);s.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,T.texture);let P=c.transform.calculatePosMatrix(b.tileID.toUnwrapped()),L=e.getMeshFrameDelta(c.transform.zoom),O=c.transform.calculateFogMatrix(b.tileID.toUnwrapped()),U=io(P,L,O,c.style.sky,c.transform.pitch);_.draw(s,o.TRIANGLES,m,Yt.disabled,u,Ht.backCCW,U,C,"terrain",y.vertexBuffer,y.indexBuffer,y.segments)}}class hs{constructor(e,n,s){this.vertexBuffer=e,this.indexBuffer=n,this.segments=s}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class ps{constructor(e,n){this.context=new Wu(e),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:p.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=at.maxUnderzooming+at.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new eo}resize(e,n,s){if(this.width=Math.floor(e*s),this.height=Math.floor(n*s),this.pixelRatio=s,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let o of this.style._order)this.style._layers[o].resize()}setup(){let e=this.context,n=new p.aX;n.emplaceBack(0,0),n.emplaceBack(p.X,0),n.emplaceBack(0,p.X),n.emplaceBack(p.X,p.X),this.tileExtentBuffer=e.createVertexBuffer(n,xn.members),this.tileExtentSegments=p.a0.simpleSegment(0,0,4,2);let s=new p.aX;s.emplaceBack(0,0),s.emplaceBack(p.X,0),s.emplaceBack(0,p.X),s.emplaceBack(p.X,p.X),this.debugBuffer=e.createVertexBuffer(s,xn.members),this.debugSegments=p.a0.simpleSegment(0,0,4,5);let o=new p.$;o.emplaceBack(0,0,0,0),o.emplaceBack(p.X,0,p.X,0),o.emplaceBack(0,p.X,0,p.X),o.emplaceBack(p.X,p.X,p.X,p.X),this.rasterBoundsBuffer=e.createVertexBuffer(o,Mr.members),this.rasterBoundsSegments=p.a0.simpleSegment(0,0,4,2);let u=new p.aX;u.emplaceBack(0,0),u.emplaceBack(1,0),u.emplaceBack(0,1),u.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(u,xn.members),this.viewportSegments=p.a0.simpleSegment(0,0,4,2);let m=new p.aZ;m.emplaceBack(0),m.emplaceBack(1),m.emplaceBack(3),m.emplaceBack(2),m.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(m);let _=new p.aY;_.emplaceBack(0,1,2),_.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(_);let y=this.context.gl;this.stencilClearMode=new Yt({func:y.ALWAYS,mask:0},0,255,y.ZERO,y.ZERO,y.ZERO)}clearStencil(){let e=this.context,n=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let s=p.H();p.aP(s,0,this.width,this.height,0,0,1),p.K(s,s,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,n.TRIANGLES,Tt.disabled,this.stencilClearMode,fi.disabled,Ht.disabled,Yi(s),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,n){if(this.currentStencilSource===e.source||!e.isTileClipped()||!n||!n.length)return;this.currentStencilSource=e.source;let s=this.context,o=s.gl;this.nextStencilID+n.length>256&&this.clearStencil(),s.setColorMode(fi.disabled),s.setDepthMode(Tt.disabled);let u=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(let m of n){let _=this._tileClippingMaskIDs[m.key]=this.nextStencilID++,y=this.style.map.terrain&&this.style.map.terrain.getTerrainData(m);u.draw(s,o.TRIANGLES,Tt.disabled,new Yt({func:o.ALWAYS,mask:0},_,255,o.KEEP,o.KEEP,o.REPLACE),fi.disabled,Ht.disabled,Yi(m.posMatrix),y,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,n=this.context.gl;return new Yt({func:n.NOTEQUAL,mask:255},e,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(e){let n=this.context.gl;return new Yt({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(e){let n=this.context.gl,s=e.sort((m,_)=>_.overscaledZ-m.overscaledZ),o=s[s.length-1].overscaledZ,u=s[0].overscaledZ-o+1;if(u>1){this.currentStencilSource=void 0,this.nextStencilID+u>256&&this.clearStencil();let m={};for(let _=0;_({u_sky_color:G.properties.get("sky-color"),u_horizon_color:G.properties.get("horizon-color"),u_horizon:(W.height/2+W.getHorizon())*N,u_sky_horizon_blend:G.properties.get("sky-horizon-blend")*W.height/2*N}))(b,y.style.map.transform,y.pixelRatio),L=new Tt(C.LEQUAL,Tt.ReadWrite,[0,1]),O=Yt.disabled,U=y.colorModeForRenderPass(),Z=y.useProgram("sky");if(!b.mesh){let G=new p.aX;G.emplaceBack(-1,-1),G.emplaceBack(1,-1),G.emplaceBack(1,1),G.emplaceBack(-1,1);let W=new p.aY;W.emplaceBack(0,1,2),W.emplaceBack(0,2,3),b.mesh=new hs(T.createVertexBuffer(G,xn.members),T.createIndexBuffer(W),p.a0.simpleSegment(0,0,G.length,W.length))}Z.draw(T,C.TRIANGLES,L,O,U,Ht.disabled,P,void 0,"sky",b.mesh.vertexBuffer,b.mesh.indexBuffer,b.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=s.length-1;this.currentLayer>=0;this.currentLayer--){let y=this.style._layers[s[this.currentLayer]],b=o[y.source],T=u[y.source];this._renderTileClippingMasks(y,T),this.renderLayer(this,b,y,T)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerZ.source&&!Z.isHidden(T)?[b.sourceCaches[Z.source]]:[]),L=P.filter(Z=>Z.getSource().type==="vector"),O=P.filter(Z=>Z.getSource().type!=="vector"),U=Z=>{(!C||C.getSource().maxzoomU(Z)),C||O.forEach(Z=>U(Z)),C}(this.style,this.transform.zoom);y&&function(b,T,C){for(let P=0;P0),o&&(p.b0(n,s),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(u,m){let _=u.context,y=_.gl,b=fi.unblended,T=new Tt(y.LEQUAL,Tt.ReadWrite,[0,1]),C=m.getTerrainMesh(),P=m.sourceCache.getRenderableTiles(),L=u.useProgram("terrainDepth");_.bindFramebuffer.set(m.getFramebuffer("depth").framebuffer),_.viewport.set([0,0,u.width/devicePixelRatio,u.height/devicePixelRatio]),_.clear({color:p.aM.transparent,depth:1});for(let O of P){let U=m.getTerrainData(O.tileID),Z={u_matrix:u.transform.calculatePosMatrix(O.tileID.toUnwrapped()),u_ele_delta:m.getMeshFrameDelta(u.transform.zoom)};L.draw(_,y.TRIANGLES,T,Yt.disabled,b,Ht.backCCW,Z,U,"terrain",C.vertexBuffer,C.indexBuffer,C.segments)}_.bindFramebuffer.set(null),_.viewport.set([0,0,u.width,u.height])}(this,this.style.map.terrain),function(u,m){let _=u.context,y=_.gl,b=fi.unblended,T=new Tt(y.LEQUAL,Tt.ReadWrite,[0,1]),C=m.getTerrainMesh(),P=m.getCoordsTexture(),L=m.sourceCache.getRenderableTiles(),O=u.useProgram("terrainCoords");_.bindFramebuffer.set(m.getFramebuffer("coords").framebuffer),_.viewport.set([0,0,u.width/devicePixelRatio,u.height/devicePixelRatio]),_.clear({color:p.aM.transparent,depth:1}),m.coordsIndex=[];for(let U of L){let Z=m.getTerrainData(U.tileID);_.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,P.texture);let G={u_matrix:u.transform.calculatePosMatrix(U.tileID.toUnwrapped()),u_terrain_coords_id:(255-m.coordsIndex.length)/255,u_texture:0,u_ele_delta:m.getMeshFrameDelta(u.transform.zoom)};O.draw(_,y.TRIANGLES,T,Yt.disabled,b,Ht.backCCW,G,Z,"terrain",C.vertexBuffer,C.indexBuffer,C.segments),m.coordsIndex.push(U.tileID.key)}_.bindFramebuffer.set(null),_.viewport.set([0,0,u.width,u.height])}(this,this.style.map.terrain))}renderLayer(e,n,s,o){if(!s.isHidden(this.transform.zoom)&&(s.type==="background"||s.type==="custom"||(o||[]).length))switch(this.id=s.id,s.type){case"symbol":(function(u,m,_,y,b){if(u.renderPass!=="translucent")return;let T=Yt.disabled,C=u.colorModeForRenderPass();(_._unevaluatedLayout.hasValue("text-variable-anchor")||_._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(P,L,O,U,Z,G,W,N,Q){let te=L.transform,ae=vn(),fe=Z==="map",be=G==="map";for(let ze of P){let Oe=U.getTile(ze),Ie=Oe.getBucket(O);if(!Ie||!Ie.text||!Ie.text.segments.get().length)continue;let Ce=p.ag(Ie.textSizeData,te.zoom),Ze=Dt(Oe,1,L.transform.zoom),ct=on(ze.posMatrix,be,fe,L.transform,Ze),ke=O.layout.get("icon-text-fit")!=="none"&&Ie.hasIconData();if(Ce){let Le=Math.pow(2,te.zoom-Oe.tileID.overscaledZ),ot=L.style.map.terrain?(xt,St)=>L.style.map.terrain.getElevation(ze,xt,St):null,ii=ae.translatePosition(te,Oe,W,N);Gn(Ie,fe,be,Q,te,ct,ze.posMatrix,Le,Ce,ke,ae,ii,ze.toUnwrapped(),ot)}}}(y,u,_,m,_.layout.get("text-rotation-alignment"),_.layout.get("text-pitch-alignment"),_.paint.get("text-translate"),_.paint.get("text-translate-anchor"),b),_.paint.get("icon-opacity").constantOr(1)!==0&&_o(u,m,_,y,!1,_.paint.get("icon-translate"),_.paint.get("icon-translate-anchor"),_.layout.get("icon-rotation-alignment"),_.layout.get("icon-pitch-alignment"),_.layout.get("icon-keep-upright"),T,C),_.paint.get("text-opacity").constantOr(1)!==0&&_o(u,m,_,y,!0,_.paint.get("text-translate"),_.paint.get("text-translate-anchor"),_.layout.get("text-rotation-alignment"),_.layout.get("text-pitch-alignment"),_.layout.get("text-keep-upright"),T,C),m.map.showCollisionBoxes&&(Da(u,m,_,y,!0),Da(u,m,_,y,!1))})(e,n,s,o,this.style.placement.variableOffsets);break;case"circle":(function(u,m,_,y){if(u.renderPass!=="translucent")return;let b=_.paint.get("circle-opacity"),T=_.paint.get("circle-stroke-width"),C=_.paint.get("circle-stroke-opacity"),P=!_.layout.get("circle-sort-key").isConstant();if(b.constantOr(1)===0&&(T.constantOr(1)===0||C.constantOr(1)===0))return;let L=u.context,O=L.gl,U=u.depthModeForSublayer(0,Tt.ReadOnly),Z=Yt.disabled,G=u.colorModeForRenderPass(),W=[];for(let N=0;NN.sortKey-Q.sortKey);for(let N of W){let{programConfiguration:Q,program:te,layoutVertexBuffer:ae,indexBuffer:fe,uniformValues:be,terrainData:ze}=N.state;te.draw(L,O.TRIANGLES,U,Z,G,Ht.disabled,be,ze,_.id,ae,fe,N.segments,_.paint,u.transform.zoom,Q)}})(e,n,s,o);break;case"heatmap":(function(u,m,_,y){if(_.paint.get("heatmap-opacity")===0)return;let b=u.context;if(u.style.map.terrain){for(let T of y){let C=m.getTile(T);m.hasRenderableParent(T)||(u.renderPass==="offscreen"?vo(u,C,_,T):u.renderPass==="translucent"&&Dn(u,_,T))}b.viewport.set([0,0,u.width,u.height])}else u.renderPass==="offscreen"?function(T,C,P,L){let O=T.context,U=O.gl,Z=Yt.disabled,G=new fi([U.ONE,U.ONE],p.aM.transparent,[!0,!0,!0,!0]);(function(W,N,Q){let te=W.gl;W.activeTexture.set(te.TEXTURE1),W.viewport.set([0,0,N.width/4,N.height/4]);let ae=Q.heatmapFbos.get(p.aU);ae?(te.bindTexture(te.TEXTURE_2D,ae.colorAttachment.get()),W.bindFramebuffer.set(ae.framebuffer)):(ae=Ia(W,N.width/4,N.height/4),Q.heatmapFbos.set(p.aU,ae))})(O,T,P),O.clear({color:p.aM.transparent});for(let W=0;W20&&T.texParameterf(T.TEXTURE_2D,b.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,b.extTextureFilterAnisotropicMax);let Ie=u.style.map.terrain&&u.style.map.terrain.getTerrainData(W),Ce=Ie?W:null,Ze=Ce?Ce.posMatrix:u.transform.calculatePosMatrix(W.toUnwrapped(),G),ct=Ou(Ze,ze||[0,0],be||1,fe,_);C instanceof Wi?P.draw(b,T.TRIANGLES,N,Yt.disabled,L,Ht.disabled,ct,Ie,_.id,C.boundsBuffer,u.quadTriangleIndexBuffer,C.boundsSegments):P.draw(b,T.TRIANGLES,N,O[W.overscaledZ],L,Ht.disabled,ct,Ie,_.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments)}})(e,n,s,o);break;case"background":(function(u,m,_,y){let b=_.paint.get("background-color"),T=_.paint.get("background-opacity");if(T===0)return;let C=u.context,P=C.gl,L=u.transform,O=L.tileSize,U=_.paint.get("background-pattern");if(u.isPatternMissing(U))return;let Z=!U&&b.a===1&&T===1&&u.opaquePassEnabledForLayer()?"opaque":"translucent";if(u.renderPass!==Z)return;let G=Yt.disabled,W=u.depthModeForSublayer(0,Z==="opaque"?Tt.ReadWrite:Tt.ReadOnly),N=u.colorModeForRenderPass(),Q=u.useProgram(U?"backgroundPattern":"background"),te=y||L.coveringTiles({tileSize:O,terrain:u.style.map.terrain});U&&(C.activeTexture.set(P.TEXTURE0),u.imageManager.bind(u.context));let ae=_.getCrossfadeParameters();for(let fe of te){let be=y?fe.posMatrix:u.transform.calculatePosMatrix(fe.toUnwrapped()),ze=U?ao(be,T,u,U,{tileID:fe,tileSize:O},ae):is(be,T,b),Oe=u.style.map.terrain&&u.style.map.terrain.getTerrainData(fe);Q.draw(C,P.TRIANGLES,W,G,N,Ht.disabled,ze,Oe,_.id,u.tileExtentBuffer,u.quadTriangleIndexBuffer,u.tileExtentSegments)}})(e,0,s,o);break;case"custom":(function(u,m,_){let y=u.context,b=_.implementation;if(u.renderPass==="offscreen"){let T=b.prerender;T&&(u.setCustomLayerDefaults(),y.setColorMode(u.colorModeForRenderPass()),T.call(b,y.gl,u.transform.customLayerMatrix()),y.setDirty(),u.setBaseState())}else if(u.renderPass==="translucent"){u.setCustomLayerDefaults(),y.setColorMode(u.colorModeForRenderPass()),y.setStencilMode(Yt.disabled);let T=b.renderingMode==="3d"?new Tt(u.context.gl.LEQUAL,Tt.ReadWrite,u.depthRangeFor3D):u.depthModeForSublayer(0,Tt.ReadOnly);y.setDepthMode(T),b.render(y.gl,u.transform.customLayerMatrix(),{farZ:u.transform.farZ,nearZ:u.transform.nearZ,fov:u.transform._fov,modelViewProjectionMatrix:u.transform.modelViewProjectionMatrix,projectionMatrix:u.transform.projectionMatrix}),y.setDirty(),u.setBaseState(),y.bindFramebuffer.set(null)}})(e,0,s)}}translatePosMatrix(e,n,s,o,u){if(!s[0]&&!s[1])return e;let m=u?o==="map"?this.transform.angle:0:o==="viewport"?-this.transform.angle:0;if(m){let b=Math.sin(m),T=Math.cos(m);s=[s[0]*T-s[1]*b,s[0]*b+s[1]*T]}let _=[u?s[0]:Dt(n,s[0],this.transform.zoom),u?s[1]:Dt(n,s[1],this.transform.zoom),0],y=new Float32Array(16);return p.J(y,e,_),y}saveTileTexture(e){let n=this._tileTextures[e.size[0]];n?n.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){let n=this._tileTextures[e];return n&&n.length>0?n.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;let n=this.imageManager.getPattern(e.from.toString()),s=this.imageManager.getPattern(e.to.toString());return!n||!s}useProgram(e,n){this.cache=this.cache||{};let s=e+(n?n.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[s]||(this.cache[s]=new ro(this.context,ln[e],n,so[e],this._showOverdrawInspector,this.style.map.terrain)),this.cache[s]}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(){let e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new ge(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){let{drawingBufferWidth:e,drawingBufferHeight:n}=this.context.gl;return this.width!==e||this.height!==n}}class Kn{constructor(e,n){this.points=e,this.planes=n}static fromInvProjectionMatrix(e,n,s){let o=Math.pow(2,s),u=[[-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(_=>{let y=1/(_=p.af([],_,e))[3]/n*o;return p.b1(_,_,[y,y,1/_[3],y])}),m=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(_=>{let y=function(P,L){var O=L[0],U=L[1],Z=L[2],G=O*O+U*U+Z*Z;return G>0&&(G=1/Math.sqrt(G)),P[0]=L[0]*G,P[1]=L[1]*G,P[2]=L[2]*G,P}([],function(P,L,O){var U=L[0],Z=L[1],G=L[2],W=O[0],N=O[1],Q=O[2];return P[0]=Z*Q-G*N,P[1]=G*W-U*Q,P[2]=U*N-Z*W,P}([],He([],u[_[0]],u[_[1]]),He([],u[_[2]],u[_[1]]))),b=-((T=y)[0]*(C=u[_[1]])[0]+T[1]*C[1]+T[2]*C[2]);var T,C;return y.concat(b)});return new Kn(u,m)}}class Yn{constructor(e,n){this.min=e,this.max=n,this.center=function(s,o,u){return s[0]=.5*o[0],s[1]=.5*o[1],s[2]=.5*o[2],s}([],function(s,o,u){return s[0]=o[0]+u[0],s[1]=o[1]+u[1],s[2]=o[2]+u[2],s}([],this.min,this.max))}quadrant(e){let n=[e%2==0,e<2],s=Se(this.min),o=Se(this.max);for(let u=0;u=0&&m++;if(m===0)return 0;m!==n.length&&(s=!1)}if(s)return 2;for(let o=0;o<3;o++){let u=Number.MAX_VALUE,m=-Number.MAX_VALUE;for(let _=0;_this.max[o]-this.min[o])return 0}return 1}}class Qn{constructor(e=0,n=0,s=0,o=0){if(isNaN(e)||e<0||isNaN(n)||n<0||isNaN(s)||s<0||isNaN(o)||o<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=n,this.left=s,this.right=o}interpolate(e,n,s){return n.top!=null&&e.top!=null&&(this.top=p.y.number(e.top,n.top,s)),n.bottom!=null&&e.bottom!=null&&(this.bottom=p.y.number(e.bottom,n.bottom,s)),n.left!=null&&e.left!=null&&(this.left=p.y.number(e.left,n.left,s)),n.right!=null&&e.right!=null&&(this.right=p.y.number(e.right,n.right,s)),this}getCenter(e,n){let s=p.ac((this.left+e-this.right)/2,0,e),o=p.ac((this.top+n-this.bottom)/2,0,n);return new p.P(s,o)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new Qn(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}let bo=85.051129;class ea{constructor(e,n,s,o,u){this.tileSize=512,this._renderWorldCopies=u===void 0||!!u,this._minZoom=e||0,this._maxZoom=n||22,this._minPitch=s??0,this._maxPitch=o??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new p.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Qn,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){let e=new ea(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return e.apply(this),e}apply(e){this.tileSize=e.tileSize,this.latRange=e.latRange,this.lngRange=e.lngRange,this.width=e.width,this.height=e.height,this._center=e._center,this._elevation=e._elevation,this.minElevationForCurrentTile=e.minElevationForCurrentTile,this.zoom=e.zoom,this.angle=e.angle,this._fov=e._fov,this._pitch=e._pitch,this._unmodified=e._unmodified,this._edgeInsets=e._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new p.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(e){let n=-p.b3(e,-180,180)*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=function(){var s=new p.A(4);return p.A!=Float32Array&&(s[1]=0,s[2]=0),s[0]=1,s[3]=1,s}(),function(s,o,u){var m=o[0],_=o[1],y=o[2],b=o[3],T=Math.sin(u),C=Math.cos(u);s[0]=m*C+y*T,s[1]=_*C+b*T,s[2]=m*-T+y*C,s[3]=_*-T+b*C}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(e){let n=p.ac(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(e){e=Math.max(.01,Math.min(60,e)),this._fov!==e&&(this._unmodified=!1,this._fov=e/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(e){let n=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this.tileZoom=Math.max(0,Math.floor(n)),this.scale=this.zoomScale(n),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,n,s){this._unmodified=!1,this._edgeInsets.interpolate(e,n,s),this._constrain(),this._calcMatrices()}coveringZoomLevel(e){let n=(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(e){let n=[new p.b4(0,e)];if(this._renderWorldCopies){let s=this.pointCoordinate(new p.P(0,0)),o=this.pointCoordinate(new p.P(this.width,0)),u=this.pointCoordinate(new p.P(this.width,this.height)),m=this.pointCoordinate(new p.P(0,this.height)),_=Math.floor(Math.min(s.x,o.x,u.x,m.x)),y=Math.floor(Math.max(s.x,o.x,u.x,m.x)),b=1;for(let T=_-b;T<=y+b;T++)T!==0&&n.push(new p.b4(T,e))}return n}coveringTiles(e){var n,s;let o=this.coveringZoomLevel(e),u=o;if(e.minzoom!==void 0&&oe.maxzoom&&(o=e.maxzoom);let m=this.pointCoordinate(this.getCameraPoint()),_=p.Z.fromLngLat(this.center),y=Math.pow(2,o),b=[y*m.x,y*m.y,0],T=[y*_.x,y*_.y,0],C=Kn.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,o),P=e.minzoom||0;!e.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(P=o);let L=e.terrain?2/Math.min(this.tileSize,e.tileSize)*this.tileSize:3,O=N=>({aabb:new Yn([N*y,0,0],[(N+1)*y,y,0]),zoom:0,x:0,y:0,wrap:N,fullyVisible:!1}),U=[],Z=[],G=o,W=e.reparseOverscaled?u:o;if(this._renderWorldCopies)for(let N=1;N<=3;N++)U.push(O(-N)),U.push(O(N));for(U.push(O(0));U.length>0;){let N=U.pop(),Q=N.x,te=N.y,ae=N.fullyVisible;if(!ae){let Ie=N.aabb.intersects(C);if(Ie===0)continue;ae=Ie===2}let fe=e.terrain?b:T,be=N.aabb.distanceX(fe),ze=N.aabb.distanceY(fe),Oe=Math.max(Math.abs(be),Math.abs(ze));if(N.zoom===G||Oe>L+(1<=P){let Ie=G-N.zoom,Ce=b[0]-.5-(Q<>1),ct=N.zoom+1,ke=N.aabb.quadrant(Ie);if(e.terrain){let Le=new p.S(ct,N.wrap,ct,Ce,Ze),ot=e.terrain.getMinMaxElevation(Le),ii=(n=ot.minElevation)!==null&&n!==void 0?n:this.elevation,xt=(s=ot.maxElevation)!==null&&s!==void 0?s:this.elevation;ke=new Yn([ke.min[0],ke.min[1],ii],[ke.max[0],ke.max[1],xt])}U.push({aabb:ke,zoom:ct,x:Ce,y:Ze,wrap:N.wrap,fullyVisible:ae})}}return Z.sort((N,Q)=>N.distanceSq-Q.distanceSq).map(N=>N.tileID)}resize(e,n){this.width=e,this.height=n,this.pixelsToGLUnits=[2/e,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(e){let n=p.ac(e.lat,-85.051129,bo);return new p.P(p.O(e.lng)*this.worldSize,p.Q(n)*this.worldSize)}unproject(e){return new p.Z(e.x/this.worldSize,e.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(e){let n=this.elevation,s=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,o=this.pointLocation(this.centerPoint,e),u=e.getElevationForLngLatZoom(o,this.tileZoom);if(!(this.elevation-u))return;let m=s+n-u,_=Math.cos(this._pitch)*this.cameraToCenterDistance/m/p.b5(1,o.lat),y=this.scaleZoom(_/this.tileSize);this._elevation=u,this._center=o,this.zoom=y}setLocationAtPoint(e,n){let s=this.pointCoordinate(n),o=this.pointCoordinate(this.centerPoint),u=this.locationCoordinate(e),m=new p.Z(u.x-(s.x-o.x),u.y-(s.y-o.y));this.center=this.coordinateLocation(m),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(e,n){return n?this.coordinatePoint(this.locationCoordinate(e),n.getElevationForLngLatZoom(e,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(e))}pointLocation(e,n){return this.coordinateLocation(this.pointCoordinate(e,n))}locationCoordinate(e){return p.Z.fromLngLat(e)}coordinateLocation(e){return e&&e.toLngLat()}pointCoordinate(e,n){if(n){let P=n.pointCoordinate(e);if(P!=null)return P}let s=[e.x,e.y,0,1],o=[e.x,e.y,1,1];p.af(s,s,this.pixelMatrixInverse),p.af(o,o,this.pixelMatrixInverse);let u=s[3],m=o[3],_=s[1]/u,y=o[1]/m,b=s[2]/u,T=o[2]/m,C=b===T?0:(0-b)/(T-b);return new p.Z(p.y.number(s[0]/u,o[0]/m,C)/this.worldSize,p.y.number(_,y,C)/this.worldSize)}coordinatePoint(e,n=0,s=this.pixelMatrix){let o=[e.x*this.worldSize,e.y*this.worldSize,n,1];return p.af(o,o,s),new p.P(o[0]/o[3],o[1]/o[3])}getBounds(){let e=Math.max(0,this.height/2-this.getHorizon());return new oe().extend(this.pointLocation(new p.P(0,e))).extend(this.pointLocation(new p.P(this.width,e))).extend(this.pointLocation(new p.P(this.width,this.height))).extend(this.pointLocation(new p.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new oe([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(e){e?(this.lngRange=[e.getWest(),e.getEast()],this.latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,bo])}calculateTileMatrix(e){let n=e.canonical,s=this.worldSize/this.zoomScale(n.z),o=n.x+Math.pow(2,n.z)*e.wrap,u=p.an(new Float64Array(16));return p.J(u,u,[o*s,n.y*s,0]),p.K(u,u,[s/p.X,s/p.X,1]),u}calculatePosMatrix(e,n=!1){let s=e.key,o=n?this._alignedPosMatrixCache:this._posMatrixCache;if(o[s])return o[s];let u=this.calculateTileMatrix(e);return p.L(u,n?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,u),o[s]=new Float32Array(u),o[s]}calculateFogMatrix(e){let n=e.key,s=this._fogMatrixCache;if(s[n])return s[n];let o=this.calculateTileMatrix(e);return p.L(o,this.fogMatrix,o),s[n]=new Float32Array(o),s[n]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(e,n){n=p.ac(+n,this.minZoom,this.maxZoom);let s={center:new p.N(e.lng,e.lat),zoom:n},o=this.lngRange;if(!this._renderWorldCopies&&o===null){let N=179.9999999999;o=[-N,N]}let u=this.tileSize*this.zoomScale(s.zoom),m=0,_=u,y=0,b=u,T=0,C=0,{x:P,y:L}=this.size;if(this.latRange){let N=this.latRange;m=p.Q(N[1])*u,_=p.Q(N[0])*u,_-m_&&(G=_-N)}if(o){let N=(y+b)/2,Q=O;this._renderWorldCopies&&(Q=p.b3(O,N-u/2,N+u/2));let te=P/2;Q-teb&&(Z=b-te)}if(Z!==void 0||G!==void 0){let N=new p.P(Z??O,G??U);s.center=this.unproject.call({worldSize:u},N).wrap()}return s}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let e=this._unmodified,{center:n,zoom:s}=this.getConstrained(this.center,this.zoom);this.center=n,this.zoom=s,this._unmodified=e,this._constraining=!1}_calcMatrices(){if(!this.height)return;let e=this.centerOffset,n=this.point.x,s=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=p.b5(1,this.center.lat)*this.worldSize;let o=p.an(new Float64Array(16));p.K(o,o,[this.width/2,-this.height/2,1]),p.J(o,o,[1,-1,0]),this.labelPlaneMatrix=o,o=p.an(new Float64Array(16)),p.K(o,o,[1,-1,1]),p.J(o,o,[-1,-1,0]),p.K(o,o,[2/this.width,2/this.height,1]),this.glCoordMatrix=o;let u=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),m=Math.min(this.elevation,this.minElevationForCurrentTile),_=u-m*this._pixelPerMeter/Math.cos(this._pitch),y=m<0?_:u,b=Math.PI/2+this._pitch,T=this._fov*(.5+e.y/this.height),C=Math.sin(T)*y/Math.sin(p.ac(Math.PI-b-T,.01,Math.PI-.01)),P=this.getHorizon(),L=2*Math.atan(P/this.cameraToCenterDistance)*(.5+e.y/(2*P)),O=Math.sin(L)*y/Math.sin(p.ac(Math.PI-b-L,.01,Math.PI-.01)),U=Math.min(C,O);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*U+y),this.nearZ=this.height/50,o=new Float64Array(16),p.b6(o,this._fov,this.width/this.height,this.nearZ,this.farZ),o[8]=2*-e.x/this.width,o[9]=2*e.y/this.height,this.projectionMatrix=p.ae(o),p.K(o,o,[1,-1,1]),p.J(o,o,[0,0,-this.cameraToCenterDistance]),p.b7(o,o,this._pitch),p.ad(o,o,this.angle),p.J(o,o,[-n,-s,0]),this.mercatorMatrix=p.K([],o,[this.worldSize,this.worldSize,this.worldSize]),p.K(o,o,[1,1,this._pixelPerMeter]),this.pixelMatrix=p.L(new Float64Array(16),this.labelPlaneMatrix,o),p.J(o,o,[0,0,-this.elevation]),this.modelViewProjectionMatrix=o,this.invModelViewProjectionMatrix=p.as([],o),this.fogMatrix=new Float64Array(16),p.b6(this.fogMatrix,this._fov,this.width/this.height,u,this.farZ),this.fogMatrix[8]=2*-e.x/this.width,this.fogMatrix[9]=2*e.y/this.height,p.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),p.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),p.b7(this.fogMatrix,this.fogMatrix,this._pitch),p.ad(this.fogMatrix,this.fogMatrix,this.angle),p.J(this.fogMatrix,this.fogMatrix,[-n,-s,0]),p.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),p.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=p.L(new Float64Array(16),this.labelPlaneMatrix,o);let Z=this.width%2/2,G=this.height%2/2,W=Math.cos(this.angle),N=Math.sin(this.angle),Q=n-Math.round(n)+W*Z+N*G,te=s-Math.round(s)+W*G+N*Z,ae=new Float64Array(o);if(p.J(ae,ae,[Q>.5?Q-1:Q,te>.5?te-1:te,0]),this.alignedModelViewProjectionMatrix=ae,o=p.as(new Float64Array(16),this.pixelMatrix),!o)throw new Error("failed to invert matrix");this.pixelMatrixInverse=o,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;let e=this.pointCoordinate(new p.P(0,0)),n=[e.x*this.worldSize,e.y*this.worldSize,0,1];return p.af(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){let e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new p.P(0,e))}getCameraQueryGeometry(e){let n=this.getCameraPoint();if(e.length===1)return[e[0],n];{let s=n.x,o=n.y,u=n.x,m=n.y;for(let _ of e)s=Math.min(s,_.x),o=Math.min(o,_.y),u=Math.max(u,_.x),m=Math.max(m,_.y);return[new p.P(s,o),new p.P(u,o),new p.P(u,m),new p.P(s,m),new p.P(s,o)]}}lngLatToCameraDepth(e,n){let s=this.locationCoordinate(e),o=[s.x*this.worldSize,s.y*this.worldSize,n,1];return p.af(o,o,this.modelViewProjectionMatrix),o[2]/o[3]}}function Pa(c,e){let n,s=!1,o=null,u=null,m=()=>{o=null,s&&(c.apply(u,n),o=setTimeout(m,e),s=!1)};return(..._)=>(s=!0,u=this,n=_,o||m(),o)}class ds{constructor(e){this._getCurrentHash=()=>{let n=window.location.hash.replace("#","");if(this._hashName){let s;return n.split("&").map(o=>o.split("=")).forEach(o=>{o[0]===this._hashName&&(s=o)}),(s&&s[1]||"").split("/")}return n.split("/")},this._onHashChange=()=>{let n=this._getCurrentHash();if(n.length>=3&&!n.some(s=>isNaN(s))){let s=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(n[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+n[2],+n[1]],zoom:+n[0],bearing:s,pitch:+(n[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{let n=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,n)},this._removeHash=()=>{let n=this._getCurrentHash();if(n.length===0)return;let s=n.join("/"),o=s;o.split("&").length>0&&(o=o.split("&")[0]),this._hashName&&(o=`${this._hashName}=${s}`);let u=window.location.hash.replace(o,"");u.startsWith("#&")?u=u.slice(0,1)+u.slice(2):u==="#"&&(u="");let m=window.location.href.replace(/(#.+)?$/,u);m=m.replace("&&","&"),window.history.replaceState(window.history.state,null,m)},this._updateHash=Pa(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,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(e){let n=this._map.getCenter(),s=Math.round(100*this._map.getZoom())/100,o=Math.ceil((s*Math.LN2+Math.log(512/360/.5))/Math.LN10),u=Math.pow(10,o),m=Math.round(n.lng*u)/u,_=Math.round(n.lat*u)/u,y=this._map.getBearing(),b=this._map.getPitch(),T="";if(T+=e?`/${m}/${_}/${s}`:`${s}/${_}/${m}`,(y||b)&&(T+="/"+Math.round(10*y)/10),b&&(T+=`/${Math.round(b)}`),this._hashName){let C=this._hashName,P=!1,L=window.location.hash.slice(1).split("&").map(O=>{let U=O.split("=")[0];return U===C?(P=!0,`${U}=${T}`):O}).filter(O=>O);return P||L.push(`${C}=${T}`),`#${L.join("&")}`}return`#${T}`}}let fs={linearity:.3,easing:p.b8(0,0,.3,1)},wo=p.e({deceleration:2500,maxSpeed:1400},fs),Ku=p.e({deceleration:20,maxSpeed:1400},fs),Ul=p.e({deceleration:1e3,maxSpeed:360},fs),ms=p.e({deceleration:1e3,maxSpeed:90},fs);class Ao{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:se.now(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,n=se.now();for(;e.length>0&&n-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let n={zoom:0,bearing:0,pitch:0,pan:new p.P(0,0),pinchAround:void 0,around:void 0};for(let{settings:u}of this._inertiaBuffer)n.zoom+=u.zoomDelta||0,n.bearing+=u.bearingDelta||0,n.pitch+=u.pitchDelta||0,u.panDelta&&n.pan._add(u.panDelta),u.around&&(n.around=u.around),u.pinchAround&&(n.pinchAround=u.pinchAround);let s=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,o={};if(n.pan.mag()){let u=Ba(n.pan.mag(),s,p.e({},wo,e||{}));o.offset=n.pan.mult(u.amount/n.pan.mag()),o.center=this._map.transform.center,za(o,u)}if(n.zoom){let u=Ba(n.zoom,s,Ku);o.zoom=this._map.transform.zoom+u.amount,za(o,u)}if(n.bearing){let u=Ba(n.bearing,s,Ul);o.bearing=this._map.transform.bearing+p.ac(u.amount,-179,179),za(o,u)}if(n.pitch){let u=Ba(n.pitch,s,ms);o.pitch=this._map.transform.pitch+u.amount,za(o,u)}if(o.zoom||o.bearing){let u=n.pinchAround===void 0?n.around:n.pinchAround;o.around=u?this._map.unproject(u):this._map.getCenter()}return this.clear(),p.e(o,{noMoveStart:!0})}}function za(c,e){(!c.duration||c.durationn.unproject(y)),_=u.reduce((y,b,T,C)=>y.add(b.div(C.length)),new p.P(0,0));super(e,{points:u,point:_,lngLats:m,lngLat:n.unproject(_),originalEvent:s}),this._defaultPrevented=!1}}class jl extends p.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,n,s){super(e,{originalEvent:s}),this._defaultPrevented=!1}}class $l{constructor(e,n){this._map=e,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new jl(e.type,this._map,e))}mousedown(e,n){return this._mousedownPos=n,this._firePreventable(new Pi(e.type,this._map,e))}mouseup(e){this._map.fire(new Pi(e.type,this._map,e))}click(e,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Pi(e.type,this._map,e))}dblclick(e){return this._firePreventable(new Pi(e.type,this._map,e))}mouseover(e){this._map.fire(new Pi(e.type,this._map,e))}mouseout(e){this._map.fire(new Pi(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Sn(e.type,this._map,e))}touchmove(e){this._map.fire(new Sn(e.type,this._map,e))}touchend(e){this._map.fire(new Sn(e.type,this._map,e))}touchcancel(e){this._map.fire(new Sn(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class mi{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new Pi(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Pi("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new Pi(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Rr{constructor(e){this._map=e}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(e){return this.transform.pointLocation(p.P.convert(e),this._map.terrain)}}class pr{constructor(e,n){this._map=e,this._tr=new Rr(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=n.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,n){this.isEnabled()&&e.shiftKey&&e.button===0&&(X.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(e,n){if(!this._active)return;let s=n;if(this._lastPos.equals(s)||!this._box&&s.dist(this._startPos)u.fitScreenCoordinates(s,o,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(X.remove(this._box),this._box=null),X.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,n){return this._map.fire(new p.k(e,{originalEvent:n}))}}function La(c,e){if(c.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${c.length}, points ${e.length}`);let n={};for(let s=0;sthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),s.length===this.numTouches&&(this.centroid=function(o){let u=new p.P(0,0);for(let m of o)u._add(m);return u.div(o.length)}(n),this.touches=La(s,n)))}touchmove(e,n,s){if(this.aborted||!this.centroid)return;let o=La(s,n);for(let u in this.touches){let m=o[u];(!m||m.dist(this.touches[u])>30)&&(this.aborted=!0)}}touchend(e,n,s){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),s.length===0){let o=!this.aborted&&this.centroid;if(this.reset(),o)return o}}}class gs{constructor(e){this.singleTap=new Eo(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,n,s){this.singleTap.touchstart(e,n,s)}touchmove(e,n,s){this.singleTap.touchmove(e,n,s)}touchend(e,n,s){let o=this.singleTap.touchend(e,n,s);if(o){let u=e.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(o)<30;if(u&&m||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=o,this.count===this.numTaps)return this.reset(),o}}}class ta{constructor(e){this._tr=new Rr(e),this._zoomIn=new gs({numTouches:1,numTaps:2}),this._zoomOut=new gs({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,n,s){this._zoomIn.touchstart(e,n,s),this._zoomOut.touchstart(e,n,s)}touchmove(e,n,s){this._zoomIn.touchmove(e,n,s),this._zoomOut.touchmove(e,n,s)}touchend(e,n,s){let o=this._zoomIn.touchend(e,n,s),u=this._zoomOut.touchend(e,n,s),m=this._tr;return o?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:m.zoom+1,around:m.unproject(o)},{originalEvent:e})}):u?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:m.zoom-1,around:m.unproject(u)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class tn{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){let n=this._moveFunction(...e);if(n.bearingDelta||n.pitchDelta||n.around||n.panDelta)return this._active=!0,n}dragStart(e,n){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=n.length?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,n){if(!this.isEnabled())return;let s=this._lastPoint;if(!s)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);let o=n.length?n[0]:n;return!this._moved&&o.dist(s){c.mousedown=c.dragStart,c.mousemoveWindow=c.dragMove,c.mouseup=c.dragEnd,c.contextmenu=e=>{e.preventDefault()}},Do=({enable:c,clickTolerance:e,bearingDegreesPerPixelMoved:n=.8})=>{let s=new _s({checkCorrectEvent:o=>X.mouseButton(o)===0&&o.ctrlKey||X.mouseButton(o)===2});return new tn({clickTolerance:e,move:(o,u)=>({bearingDelta:(u.x-o.x)*n}),moveStateManager:s,enable:c,assignEvents:ys})},So=({enable:c,clickTolerance:e,pitchDegreesPerPixelMoved:n=-.5})=>{let s=new _s({checkCorrectEvent:o=>X.mouseButton(o)===0&&o.ctrlKey||X.mouseButton(o)===2});return new tn({clickTolerance:e,move:(o,u)=>({pitchDelta:(u.y-o.y)*n}),moveStateManager:s,enable:c,assignEvents:ys})};class In{constructor(e,n){this._clickTolerance=e.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new p.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,n,s){return this._calculateTransform(e,n,s)}touchmove(e,n,s){if(this._active){if(!this._shouldBePrevented(s.length))return e.preventDefault(),this._calculateTransform(e,n,s);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,n,s){this._calculateTransform(e,n,s),this._active&&this._shouldBePrevented(s.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,n,s){s.length>0&&(this._active=!0);let o=La(s,n),u=new p.P(0,0),m=new p.P(0,0),_=0;for(let b in o){let T=o[b],C=this._touches[b];C&&(u._add(T),m._add(T.sub(C)),_++,o[b]=T)}if(this._touches=o,this._shouldBePrevented(_)||!m.mag())return;let y=m.div(_);return this._sum._add(y),this._sum.mag()Math.abs(c.x)}class ia extends vs{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,n,s){super.touchstart(e,n,s),this._currentTouchCount=s.length}_start(e){this._lastPoints=e,xs(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,n,s){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let o=e[0].sub(this._lastPoints[0]),u=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(o,u,s.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(o.y+u.y)/2*-.5}):void 0}gestureBeginsVertically(e,n,s){if(this._valid!==void 0)return this._valid;let o=e.mag()>=2,u=n.mag()>=2;if(!o&&!u)return;if(!o||!u)return this._firstMove===void 0&&(this._firstMove=s),s-this._firstMove<100&&void 0;let m=e.y>0==n.y>0;return xs(e)&&xs(n)&&m}}let Zl={panStep:100,bearingStep:15,pitchStep:10};class br{constructor(e){this._tr=new Rr(e);let n=Zl;this._panStep=n.panStep,this._bearingStep=n.bearingStep,this._pitchStep=n.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let n=0,s=0,o=0,u=0,m=0;switch(e.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:e.shiftKey?s=-1:(e.preventDefault(),u=-1);break;case 39:e.shiftKey?s=1:(e.preventDefault(),u=1);break;case 38:e.shiftKey?o=1:(e.preventDefault(),m=-1);break;case 40:e.shiftKey?o=-1:(e.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(s=0,o=0),{cameraAnimation:_=>{let y=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:Hr,zoom:n?Math.round(y.zoom)+n*(e.shiftKey?2:1):y.zoom,bearing:y.bearing+s*this._bearingStep,pitch:y.pitch+o*this._pitchStep,offset:[-u*this._panStep,-m*this._panStep],center:y.center},{originalEvent:e})}}}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 Hr(c){return c*(2-c)}let zo=4.000244140625;class Fr{constructor(e,n){this._onTimeout=s=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(s)},this._map=e,this._tr=new Rr(e),this._triggerRenderFrame=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let n=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,s=se.now(),o=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,n!==0&&n%zo==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":o>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(o*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),e.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=e,this._delta-=n,this._active||this._start(e)),e.preventDefault()}_start(e){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);let n=X.mousePos(this._map.getCanvas(),e),s=this._tr;this._around=n.y>s.transform.height/2-s.transform.getHorizon()?p.N.convert(this._aroundCenter?s.center:s.unproject(n)):p.N.convert(s.center),this._aroundPoint=s.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let e=this._tr.transform;if(this._delta!==0){let y=this._type==="wheel"&&Math.abs(this._delta)>zo?this._wheelZoomRate:this._defaultZoomRate,b=2/(1+Math.exp(-Math.abs(this._delta*y)));this._delta<0&&b!==0&&(b=1/b);let T=typeof this._targetZoom=="number"?e.zoomScale(this._targetZoom):e.scale;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(T*b))),this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let n=typeof this._targetZoom=="number"?this._targetZoom:e.zoom,s=this._startZoom,o=this._easing,u,m=!1,_=se.now()-this._lastWheelEventTime;if(this._type==="wheel"&&s&&o&&_){let y=Math.min(_/200,1),b=o(y);u=p.y.number(s,n,b),y<1?this._frameId||(this._frameId=!0):m=!0}else u=n,m=!0;return this._active=!0,m&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!m,zoomDelta:u-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let n=p.b9;if(this._prevEase){let s=this._prevEase,o=(se.now()-s.start)/s.duration,u=s.easing(o+.01)-s.easing(o),m=.27/Math.sqrt(u*u+1e-4)*.01,_=Math.sqrt(.0729-m*m);n=p.b8(m,_,.25,1)}return this._prevEase={start:se.now(),duration:e,easing:n},n}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class kn{constructor(e,n){this._clickZoom=e,this._tapZoom=n}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 Yu{constructor(e){this._tr=new Rr(e),this.reset()}reset(){this._active=!1}dblclick(e,n){return e.preventDefault(),{cameraAnimation:s=>{s.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(n)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Qu{constructor(){this._tap=new gs({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(e,n,s){if(!this._swipePoint)if(this._tapTime){let o=n[0],u=e.timeStamp-this._tapTime<500,m=this._tapPoint.dist(o)<30;u&&m?s.length>0&&(this._swipePoint=o,this._swipeTouch=s[0].identifier):this.reset()}else this._tap.touchstart(e,n,s)}touchmove(e,n,s){if(this._tapTime){if(this._swipePoint){if(s[0].identifier!==this._swipeTouch)return;let o=n[0],u=o.y-this._swipePoint.y;return this._swipePoint=o,e.preventDefault(),this._active=!0,{zoomDelta:u/128}}}else this._tap.touchmove(e,n,s)}touchend(e,n,s){if(this._tapTime)this._swipePoint&&s.length===0&&this.reset();else{let o=this._tap.touchend(e,n,s);o&&(this._tapTime=e.timeStamp,this._tapPoint=o)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Gl{constructor(e,n,s){this._el=e,this._mousePan=n,this._touchPan=s}enable(e){this._inertiaOptions=e||{},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 Hl{constructor(e,n,s){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=n,this._mousePitch=s}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Bo{constructor(e,n,s,o){this._el=e,this._touchZoom=n,this._touchRotate=s,this._tapDragZoom=o,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),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 ra{constructor(e,n){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=e,this._options=n,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=X.create("div","maplibregl-cooperative-gesture-screen",e);let n=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(n=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let s=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),o=document.createElement("div");o.className="maplibregl-desktop-message",o.textContent=n,this._container.appendChild(o);let u=document.createElement("div");u.className="maplibregl-mobile-message",u.textContent=s,this._container.appendChild(u),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(X.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(e){return e[this._bypassKey]}notifyGestureBlocked(e,n){this._enabled&&(this._map.fire(new p.k("cooperativegestureprevented",{gestureType:e,originalEvent:n})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}let wr=c=>c.zoom||c.drag||c.pitch||c.rotate;class Ve extends p.k{}function bs(c){return c.panDelta&&c.panDelta.mag()||c.zoomDelta||c.bearingDelta||c.pitchDelta}class Lo{constructor(e,n){this.handleWindowEvent=o=>{this.handleEvent(o,`${o.type}Window`)},this.handleEvent=(o,u)=>{if(o.type==="blur")return void this.stop(!0);this._updatingCamera=!0;let m=o.type==="renderFrame"?void 0:o,_={needsRenderFrame:!1},y={},b={},T=o.touches,C=T?this._getMapTouches(T):void 0,P=C?X.touchPos(this._map.getCanvas(),C):X.mousePos(this._map.getCanvas(),o);for(let{handlerName:U,handler:Z,allowed:G}of this._handlers){if(!Z.isEnabled())continue;let W;this._blockedByActive(b,G,U)?Z.reset():Z[u||o.type]&&(W=Z[u||o.type](o,P,C),this.mergeHandlerResult(_,y,W,U,m),W&&W.needsRenderFrame&&this._triggerRenderFrame()),(W||Z.isActive())&&(b[U]=Z)}let L={};for(let U in this._previousActiveHandlers)b[U]||(L[U]=m);this._previousActiveHandlers=b,(Object.keys(L).length||bs(_))&&(this._changes.push([_,y,L]),this._triggerRenderFrame()),(Object.keys(b).length||bs(_))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:O}=_;O&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],O(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Ao(e),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n);let s=this._el;this._listeners=[[s,"touchstart",{passive:!0}],[s,"touchmove",{passive:!1}],[s,"touchend",void 0],[s,"touchcancel",void 0],[s,"mousedown",void 0],[s,"mousemove",void 0],[s,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[s,"mouseover",void 0],[s,"mouseout",void 0],[s,"dblclick",void 0],[s,"click",void 0],[s,"keydown",{capture:!1}],[s,"keyup",void 0],[s,"wheel",{passive:!1}],[s,"contextmenu",void 0],[window,"blur",void 0]];for(let[o,u,m]of this._listeners)X.addEventListener(o,u,o===document?this.handleWindowEvent:this.handleEvent,m)}destroy(){for(let[e,n,s]of this._listeners)X.removeEventListener(e,n,e===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(e){let n=this._map,s=n.getCanvasContainer();this._add("mapEvent",new $l(n,e));let o=n.boxZoom=new pr(n,e);this._add("boxZoom",o),e.interactive&&e.boxZoom&&o.enable();let u=n.cooperativeGestures=new ra(n,e.cooperativeGestures);this._add("cooperativeGestures",u),e.cooperativeGestures&&u.enable();let m=new ta(n),_=new Yu(n);n.doubleClickZoom=new kn(_,m),this._add("tapZoom",m),this._add("clickZoom",_),e.interactive&&e.doubleClickZoom&&n.doubleClickZoom.enable();let y=new Qu;this._add("tapDragZoom",y);let b=n.touchPitch=new ia(n);this._add("touchPitch",b),e.interactive&&e.touchPitch&&n.touchPitch.enable(e.touchPitch);let T=Do(e),C=So(e);n.dragRotate=new Hl(e,T,C),this._add("mouseRotate",T,["mousePitch"]),this._add("mousePitch",C,["mouseRotate"]),e.interactive&&e.dragRotate&&n.dragRotate.enable();let P=(({enable:W,clickTolerance:N})=>{let Q=new _s({checkCorrectEvent:te=>X.mouseButton(te)===0&&!te.ctrlKey});return new tn({clickTolerance:N,move:(te,ae)=>({around:ae,panDelta:ae.sub(te)}),activateOnStart:!0,moveStateManager:Q,enable:W,assignEvents:ys})})(e),L=new In(e,n);n.dragPan=new Gl(s,P,L),this._add("mousePan",P),this._add("touchPan",L,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&n.dragPan.enable(e.dragPan);let O=new Po,U=new ko;n.touchZoomRotate=new Bo(s,U,O,y),this._add("touchRotate",O,["touchPan","touchZoom"]),this._add("touchZoom",U,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&n.touchZoomRotate.enable(e.touchZoomRotate);let Z=n.scrollZoom=new Fr(n,()=>this._triggerRenderFrame());this._add("scrollZoom",Z,["mousePan"]),e.interactive&&e.scrollZoom&&n.scrollZoom.enable(e.scrollZoom);let G=n.keyboard=new br(n);this._add("keyboard",G),e.interactive&&e.keyboard&&n.keyboard.enable(),this._add("blockableMapEvent",new mi(n))}_add(e,n,s){this._handlers.push({handlerName:e,handler:n,allowed:s}),this._handlersById[e]=n}stop(e){if(!this._updatingCamera){for(let{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!wr(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,n,s){for(let o in e)if(o!==s&&(!n||n.indexOf(o)<0))return!0;return!1}_getMapTouches(e){let n=[];for(let s of e)this._el.contains(s.target)&&n.push(s);return n}mergeHandlerResult(e,n,s,o,u){if(!s)return;p.e(e,s);let m={handlerName:o,originalEvent:s.originalEvent||u};s.zoomDelta!==void 0&&(n.zoom=m),s.panDelta!==void 0&&(n.drag=m),s.pitchDelta!==void 0&&(n.pitch=m),s.bearingDelta!==void 0&&(n.rotate=m)}_applyChanges(){let e={},n={},s={};for(let[o,u,m]of this._changes)o.panDelta&&(e.panDelta=(e.panDelta||new p.P(0,0))._add(o.panDelta)),o.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+o.zoomDelta),o.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+o.bearingDelta),o.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+o.pitchDelta),o.around!==void 0&&(e.around=o.around),o.pinchAround!==void 0&&(e.pinchAround=o.pinchAround),o.noInertia&&(e.noInertia=o.noInertia),p.e(n,u),p.e(s,m);this._updateMapTransform(e,n,s),this._changes=[]}_updateMapTransform(e,n,s){let o=this._map,u=o._getTransformForUpdate(),m=o.terrain;if(!(bs(e)||m&&this._terrainMovement))return this._fireEvents(n,s,!0);let{panDelta:_,zoomDelta:y,bearingDelta:b,pitchDelta:T,around:C,pinchAround:P}=e;P!==void 0&&(C=P),o._stop(!0),C=C||o.transform.centerPoint;let L=u.pointLocation(_?C.sub(_):C);b&&(u.bearing+=b),T&&(u.pitch+=T),y&&(u.zoom+=y),m?this._terrainMovement||!n.drag&&!n.zoom?n.drag&&this._terrainMovement?u.center=u.pointLocation(u.centerPoint.sub(_)):u.setLocationAtPoint(L,C):(this._terrainMovement=!0,this._map._elevationFreeze=!0,u.setLocationAtPoint(L,C)):u.setLocationAtPoint(L,C),o._applyUpdatedTransform(u),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(n,s,!0)}_fireEvents(e,n,s){let o=wr(this._eventsInProgress),u=wr(e),m={};for(let C in e){let{originalEvent:P}=e[C];this._eventsInProgress[C]||(m[`${C}start`]=P),this._eventsInProgress[C]=e[C]}!o&&u&&this._fireEvent("movestart",u.originalEvent);for(let C in m)this._fireEvent(C,m[C]);u&&this._fireEvent("move",u.originalEvent);for(let C in e){let{originalEvent:P}=e[C];this._fireEvent(C,P)}let _={},y;for(let C in this._eventsInProgress){let{handlerName:P,originalEvent:L}=this._eventsInProgress[C];this._handlersById[P].isActive()||(delete this._eventsInProgress[C],y=n[P]||L,_[`${C}end`]=y)}for(let C in _)this._fireEvent(C,_[C]);let b=wr(this._eventsInProgress),T=(o||u)&&!b;if(T&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;let C=this._map._getTransformForUpdate();C.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(C)}if(s&&T){this._updatingCamera=!0;let C=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),P=L=>L!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new Ve("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Xl extends p.E{constructor(e,n){super(),this._renderFrameCallback=()=>{let s=Math.min((se.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(s)),s<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=n.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new p.N(this.transform.center.lng,this.transform.center.lat)}setCenter(e,n){return this.jumpTo({center:e},n)}panBy(e,n,s){return e=p.P.convert(e).mult(-1),this.panTo(this.transform.center,p.e({offset:e},n),s)}panTo(e,n,s){return this.easeTo(p.e({center:e},n),s)}getZoom(){return this.transform.zoom}setZoom(e,n){return this.jumpTo({zoom:e},n),this}zoomTo(e,n,s){return this.easeTo(p.e({zoom:e},n),s)}zoomIn(e,n){return this.zoomTo(this.getZoom()+1,e,n),this}zoomOut(e,n){return this.zoomTo(this.getZoom()-1,e,n),this}getBearing(){return this.transform.bearing}setBearing(e,n){return this.jumpTo({bearing:e},n),this}getPadding(){return this.transform.padding}setPadding(e,n){return this.jumpTo({padding:e},n),this}rotateTo(e,n,s){return this.easeTo(p.e({bearing:e},n),s)}resetNorth(e,n){return this.rotateTo(0,p.e({duration:1e3},e),n),this}resetNorthPitch(e,n){return this.easeTo(p.e({bearing:0,pitch:0,duration:1e3},e),n),this}snapToNorth(e,n){return Math.abs(this.getBearing()){if(this._zooming&&(o.zoom=p.y.number(u,Z,fe)),this._rotating&&(o.bearing=p.y.number(m,b,fe)),this._pitching&&(o.pitch=p.y.number(_,T,fe)),this._padding&&(o.interpolatePadding(y,C,fe),L=o.centerPoint.add(P)),this.terrain&&!e.freezeElevation&&this._updateElevation(fe),Q)o.setLocationAtPoint(Q,te);else{let be=o.zoomScale(o.zoom-u),ze=Z>u?Math.min(2,N):Math.max(.5,N),Oe=Math.pow(ze,1-fe),Ie=o.unproject(G.add(W.mult(fe*Oe)).mult(be));o.setLocationAtPoint(o.renderWorldCopies?Ie.wrap():Ie,L)}this._applyUpdatedTransform(o),this._fireMoveEvents(n)},fe=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(n,fe)},e),this}_prepareEase(e,n,s={}){this._moving=!0,n||s.moving||this.fire(new p.k("movestart",e)),this._zooming&&!s.zooming&&this.fire(new p.k("zoomstart",e)),this._rotating&&!s.rotating&&this.fire(new p.k("rotatestart",e)),this._pitching&&!s.pitching&&this.fire(new p.k("pitchstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);let n=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&n!==this._elevationTarget){let s=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(s-(n-(s*e+this._elevationStart))/(1-e)),this._elevationTarget=n}this.transform.elevation=p.y.number(this._elevationStart,this._elevationTarget,e)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){let n=e.getCameraPosition(),s=this.terrain.getElevationForLngLatZoom(n.lngLat,e.zoom);if(n.altitudethis._elevateCameraIfInsideTerrain(o)),this.transformCameraUpdate&&n.push(o=>this.transformCameraUpdate(o)),!n.length)return;let s=e.clone();for(let o of n){let u=s.clone(),{center:m,zoom:_,pitch:y,bearing:b,elevation:T}=o(u);m&&(u.center=m),_!==void 0&&(u.zoom=_),y!==void 0&&(u.pitch=y),b!==void 0&&(u.bearing=b),T!==void 0&&(u.elevation=T),s.apply(u)}this.transform.apply(s)}_fireMoveEvents(e){this.fire(new p.k("move",e)),this._zooming&&this.fire(new p.k("zoom",e)),this._rotating&&this.fire(new p.k("rotate",e)),this._pitching&&this.fire(new p.k("pitch",e))}_afterEase(e,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;let s=this._zooming,o=this._rotating,u=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,s&&this.fire(new p.k("zoomend",e)),o&&this.fire(new p.k("rotateend",e)),u&&this.fire(new p.k("pitchend",e)),this.fire(new p.k("moveend",e))}flyTo(e,n){var s;if(!e.essential&&se.prefersReducedMotion){let Le=p.M(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Le,n)}this.stop(),e=p.e({offset:[0,0],speed:1.2,curve:1.42,easing:p.b9},e);let o=this._getTransformForUpdate(),u=o.zoom,m=o.bearing,_=o.pitch,y=o.padding,b="bearing"in e?this._normalizeBearing(e.bearing,m):m,T="pitch"in e?+e.pitch:_,C="padding"in e?e.padding:o.padding,P=p.P.convert(e.offset),L=o.centerPoint.add(P),O=o.pointLocation(L),{center:U,zoom:Z}=o.getConstrained(p.N.convert(e.center||O),(s=e.zoom)!==null&&s!==void 0?s:u);this._normalizeCenter(U,o);let G=o.zoomScale(Z-u),W=o.project(O),N=o.project(U).sub(W),Q=e.curve,te=Math.max(o.width,o.height),ae=te/G,fe=N.mag();if("minZoom"in e){let Le=p.ac(Math.min(e.minZoom,u,Z),o.minZoom,o.maxZoom),ot=te/o.zoomScale(Le-u);Q=Math.sqrt(ot/fe*2)}let be=Q*Q;function ze(Le){let ot=(ae*ae-te*te+(Le?-1:1)*be*be*fe*fe)/(2*(Le?ae:te)*be*fe);return Math.log(Math.sqrt(ot*ot+1)-ot)}function Oe(Le){return(Math.exp(Le)-Math.exp(-Le))/2}function Ie(Le){return(Math.exp(Le)+Math.exp(-Le))/2}let Ce=ze(!1),Ze=function(Le){return Ie(Ce)/Ie(Ce+Q*Le)},ct=function(Le){return te*((Ie(Ce)*(Oe(ot=Ce+Q*Le)/Ie(ot))-Oe(Ce))/be)/fe;var ot},ke=(ze(!0)-Ce)/Q;if(Math.abs(fe)<1e-6||!isFinite(ke)){if(Math.abs(te-ae)<1e-6)return this.easeTo(e,n);let Le=ae0,Ze=ot=>Math.exp(Le*Q*ot)}return e.duration="duration"in e?+e.duration:1e3*ke/("screenSpeed"in e?+e.screenSpeed/Q:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=m!==b,this._pitching=T!==_,this._padding=!o.isPaddingEqual(C),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(U),this._ease(Le=>{let ot=Le*ke,ii=1/Ze(ot);o.zoom=Le===1?Z:u+o.scaleZoom(ii),this._rotating&&(o.bearing=p.y.number(m,b,Le)),this._pitching&&(o.pitch=p.y.number(_,T,Le)),this._padding&&(o.interpolatePadding(y,C,Le),L=o.centerPoint.add(P)),this.terrain&&!e.freezeElevation&&this._updateElevation(Le);let xt=Le===1?U:o.unproject(W.add(N.mult(ct(ot))).mult(ii));o.setLocationAtPoint(o.renderWorldCopies?xt.wrap():xt,L),this._applyUpdatedTransform(o),this._fireMoveEvents(n)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(n)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,n){var s;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let o=this._onEaseEnd;delete this._onEaseEnd,o.call(this,n)}return e||(s=this.handlers)===null||s===void 0||s.stop(!1),this}_ease(e,n,s){s.animate===!1||s.duration===0?(e(1),n()):(this._easeStart=se.now(),this._easeOptions=s,this._onEaseFrame=e,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,n){e=p.b3(e,-180,180);let s=Math.abs(e-n);return Math.abs(e-360-n)180?-360:s<-180?360:0}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(p.N.convert(e),this.transform.tileZoom)-this.transform.elevation:null}}let na={compact:!0,customAttribution:'MapLibre'};class aa{constructor(e=na){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=n=>{!n||n.sourceDataType!=="metadata"&&n.sourceDataType!=="visibility"&&n.dataType!=="style"&&n.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=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=X.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=X.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=X.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(){X.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(e,n){let s=this._map._getUIString(`AttributionControl.${n}`);e.title=s,e.setAttribute("aria-label",s)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(o=>typeof o!="string"?"":o)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let o=this._map.style.stylesheet;this.styleOwner=o.owner,this.styleId=o.id}let n=this._map.style.sourceCaches;for(let o in n){let u=n[o];if(u.used||u.usedForTerrain){let m=u.getSource();m.attribution&&e.indexOf(m.attribution)<0&&e.push(m.attribution)}}e=e.filter(o=>String(o).trim()),e.sort((o,u)=>o.length-u.length),e=e.filter((o,u)=>{for(let m=u+1;m=0)return!1;return!0});let s=e.join(" | ");s!==this._attribHTML&&(this._attribHTML=s,e.length?(this._innerContainer.innerHTML=s,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Ro{constructor(e={}){this._updateCompact=()=>{let n=this._container.children;if(n.length){let s=n[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&s.classList.add("maplibregl-compact"):s.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=X.create("div","maplibregl-ctrl");let n=X.create("a","maplibregl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){X.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class It{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let n=++this._id;return this._queue.push({callback:e,id:n,cancelled:!1}),n}remove(e){let n=this._currentlyRunning,s=n?this._queue.concat(n):this._queue;for(let o of s)if(o.id===e)return void(o.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");let n=this._currentlyRunning=this._queue;this._queue=[];for(let s of n)if(!s.cancelled&&(s.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Fo=p.Y([{name:"a_pos3d",type:"Int16",components:3}]);class ec extends p.E{constructor(e){super(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,e.usedForTerrain=!0,e.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,n){this.sourceCache.update(e,n),this._renderableTilesKeys=[];let s={};for(let o of e.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))s[o.key]=!0,this._renderableTilesKeys.push(o.key),this._tiles[o.key]||(o.posMatrix=new Float64Array(16),p.aP(o.posMatrix,0,p.X,0,p.X,0,1),this._tiles[o.key]=new Pr(o,this.tileSize));for(let o in this._tiles)s[o]||delete this._tiles[o]}freeRtt(e){for(let n in this._tiles){let s=this._tiles[n];(!e||s.tileID.equals(e)||s.tileID.isChildOf(e)||e.isChildOf(s.tileID))&&(s.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e){let n={};for(let s of this._renderableTilesKeys){let o=this._tiles[s].tileID;if(o.canonical.equals(e.canonical)){let u=e.clone();u.posMatrix=new Float64Array(16),p.aP(u.posMatrix,0,p.X,0,p.X,0,1),n[s]=u}else if(o.canonical.isChildOf(e.canonical)){let u=e.clone();u.posMatrix=new Float64Array(16);let m=o.canonical.z-e.canonical.z,_=o.canonical.x-(o.canonical.x>>m<>m<>m;p.aP(u.posMatrix,0,b,0,b,0,1),p.J(u.posMatrix,u.posMatrix,[-_*b,-y*b,0]),n[s]=u}else if(e.canonical.isChildOf(o.canonical)){let u=e.clone();u.posMatrix=new Float64Array(16);let m=e.canonical.z-o.canonical.z,_=e.canonical.x-(e.canonical.x>>m<>m<>m;p.aP(u.posMatrix,0,p.X,0,p.X,0,1),p.J(u.posMatrix,u.posMatrix,[_*b,y*b,0]),p.K(u.posMatrix,u.posMatrix,[1/2**m,1/2**m,0]),n[s]=u}}return n}getSourceTile(e,n){let s=this.sourceCache._source,o=e.overscaledZ-this.deltaZoom;if(o>s.maxzoom&&(o=s.maxzoom),o=s.minzoom&&(!u||!u.dem);)u=this.sourceCache.getTileByID(e.scaledTo(o--).key);return u}tilesAfterTime(e=Date.now()){return Object.values(this._tiles).filter(n=>n.timeAdded>=e)}}class Oo{constructor(e,n,s){this.painter=e,this.sourceCache=new ec(n),this.options=s,this.exaggeration=typeof s.exaggeration=="number"?s.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,n,s,o=p.X){var u;if(!(n>=0&&n=0&&se.canonical.z&&(e.canonical.z>=o?u=e.canonical.z-o:p.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let m=e.canonical.x-(e.canonical.x>>u<>u<>8<<4|u>>8,n[m+3]=0;let s=new p.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),o=new ge(e,s,e.gl.RGBA,{premultiply:!1});return o.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=o,o}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);let n=new Uint8Array(4),s=this.painter.context,o=s.gl,u=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),m=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),_=Math.round(this.painter.height/devicePixelRatio);s.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),o.readPixels(u,_-m-1,1,1,o.RGBA,o.UNSIGNED_BYTE,n),s.bindFramebuffer.set(null);let y=n[0]+(n[2]>>4<<8),b=n[1]+((15&n[2])<<8),T=this.coordsIndex[255-n[3]],C=T&&this.sourceCache.getTileByID(T);if(!C)return null;let P=this._coordsTextureSize,L=(1<e.id!==n),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(let n of this._recentlyUsed)if(!this._objects[n].inUse)return this._objects[n];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");let e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(let e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length!e.inUse)===!1}}let sa={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Wl{constructor(e,n){this.painter=e,this.terrain=n,this.pool=new tc(e.context,30,n.sourceCache.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,n){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter(s=>!e._layers[s].isHidden(n)),this._coordsDescendingInv={};for(let s in e.sourceCaches){this._coordsDescendingInv[s]={};let o=e.sourceCaches[s].getVisibleCoordinates();for(let u of o){let m=this.terrain.sourceCache.getTerrainCoords(u);for(let _ in m)this._coordsDescendingInv[s][_]||(this._coordsDescendingInv[s][_]=[]),this._coordsDescendingInv[s][_].push(m[_])}}this._coordsDescendingInvStr={};for(let s of e._order){let o=e._layers[s],u=o.source;if(sa[o.type]&&!this._coordsDescendingInvStr[u]){this._coordsDescendingInvStr[u]={};for(let m in this._coordsDescendingInv[u])this._coordsDescendingInvStr[u][m]=this._coordsDescendingInv[u][m].map(_=>_.key).sort().join()}}for(let s of this._renderableTiles)for(let o in this._coordsDescendingInvStr){let u=this._coordsDescendingInvStr[o][s.tileID.key];u&&u!==s.rttCoords[o]&&(s.rtt=[])}}renderLayer(e){if(e.isHidden(this.painter.transform.zoom))return!1;let n=e.type,s=this.painter,o=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(sa[n]&&(this._prevType&&sa[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(e.id),!o))return!0;if(sa[this._prevType]||sa[n]&&o){this._prevType=n;let u=this._stacks.length-1,m=this._stacks[u]||[];for(let _ of this._renderableTiles){if(this.pool.isFull()&&(Vl(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(_),_.rtt[u]){let b=this.pool.getObjectForId(_.rtt[u].id);if(b.stamp===_.rtt[u].stamp){this.pool.useObject(b);continue}}let y=this.pool.getOrCreateFreeObject();this.pool.useObject(y),this.pool.stampObject(y),_.rtt[u]={id:y.id,stamp:y.stamp},s.context.bindFramebuffer.set(y.fbo.framebuffer),s.context.clear({color:p.aM.transparent,stencil:0}),s.currentStencilSource=void 0;for(let b=0;b{c.touchstart=c.dragStart,c.touchmoveWindow=c.dragMove,c.touchend=c.dragEnd},rc={showCompass:!0,showZoom:!0,visualizePitch:!1};class nc{constructor(e,n,s=!1){this.mousedown=m=>{this.startMouse(p.e({},m,{ctrlKey:!0,preventDefault:()=>m.preventDefault()}),X.mousePos(this.element,m)),X.addEventListener(window,"mousemove",this.mousemove),X.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=m=>{this.moveMouse(m,X.mousePos(this.element,m))},this.mouseup=m=>{this.mouseRotate.dragEnd(m),this.mousePitch&&this.mousePitch.dragEnd(m),this.offTemp()},this.touchstart=m=>{m.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=X.touchPos(this.element,m.targetTouches)[0],this.startTouch(m,this._startPos),X.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),X.addEventListener(window,"touchend",this.touchend))},this.touchmove=m=>{m.targetTouches.length!==1?this.reset():(this._lastPos=X.touchPos(this.element,m.targetTouches)[0],this.moveTouch(m,this._lastPos))},this.touchend=m=>{m.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;let o=e.dragRotate._mouseRotate.getClickTolerance(),u=e.dragRotate._mousePitch.getClickTolerance();this.element=n,this.mouseRotate=Do({clickTolerance:o,enable:!0}),this.touchRotate=(({enable:m,clickTolerance:_,bearingDegreesPerPixelMoved:y=.8})=>{let b=new Co;return new tn({clickTolerance:_,move:(T,C)=>({bearingDelta:(C.x-T.x)*y}),moveStateManager:b,enable:m,assignEvents:qo})})({clickTolerance:o,enable:!0}),this.map=e,s&&(this.mousePitch=So({clickTolerance:u,enable:!0}),this.touchPitch=(({enable:m,clickTolerance:_,pitchDegreesPerPixelMoved:y=-.5})=>{let b=new Co;return new tn({clickTolerance:_,move:(T,C)=>({pitchDelta:(C.y-T.y)*y}),moveStateManager:b,enable:m,assignEvents:qo})})({clickTolerance:u,enable:!0})),X.addEventListener(n,"mousedown",this.mousedown),X.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),X.addEventListener(n,"touchcancel",this.reset)}startMouse(e,n){this.mouseRotate.dragStart(e,n),this.mousePitch&&this.mousePitch.dragStart(e,n),X.disableDrag()}startTouch(e,n){this.touchRotate.dragStart(e,n),this.touchPitch&&this.touchPitch.dragStart(e,n),X.disableDrag()}moveMouse(e,n){let s=this.map,{bearingDelta:o}=this.mouseRotate.dragMove(e,n)||{};if(o&&s.setBearing(s.getBearing()+o),this.mousePitch){let{pitchDelta:u}=this.mousePitch.dragMove(e,n)||{};u&&s.setPitch(s.getPitch()+u)}}moveTouch(e,n){let s=this.map,{bearingDelta:o}=this.touchRotate.dragMove(e,n)||{};if(o&&s.setBearing(s.getBearing()+o),this.touchPitch){let{pitchDelta:u}=this.touchPitch.dragMove(e,n)||{};u&&s.setPitch(s.getPitch()+u)}}off(){let e=this.element;X.removeEventListener(e,"mousedown",this.mousedown),X.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),X.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),X.removeEventListener(window,"touchend",this.touchend),X.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){X.enableDrag(),X.removeEventListener(window,"mousemove",this.mousemove),X.removeEventListener(window,"mouseup",this.mouseup),X.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),X.removeEventListener(window,"touchend",this.touchend)}}let dr;function ti(c,e,n){let s=new p.N(c.lng,c.lat);if(c=new p.N(c.lng,c.lat),e){let o=new p.N(c.lng-360,c.lat),u=new p.N(c.lng+360,c.lat),m=n.locationPoint(c).distSqr(e);n.locationPoint(o).distSqr(e)180;){let o=n.locationPoint(c);if(o.x>=0&&o.y>=0&&o.x<=n.width&&o.y<=n.height)break;c.lng>n.center.lng?c.lng-=360:c.lng+=360}return c.lng!==s.lng&&n.locationPoint(c).y>n.height/2-n.getHorizon()?c:s}let oa={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 ws(c,e,n){let s=c.classList;for(let o in oa)s.remove(`maplibregl-${n}-anchor-${o}`);s.add(`maplibregl-${n}-anchor-${e}`)}class As extends p.E{constructor(e){if(super(),this._onKeyPress=n=>{let s=n.code,o=n.charCode||n.keyCode;s!=="Space"&&s!=="Enter"&&o!==32&&o!==13||this.togglePopup()},this._onMapClick=n=>{let s=n.originalEvent.target,o=this._element;this._popup&&(s===o||o.contains(s))&&this.togglePopup()},this._update=n=>{var s;if(!this._map)return;let o=this._map.loaded()&&!this._map.isMoving();(n?.type==="terrain"||n?.type==="render"&&!o)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?ti(this._lngLat,this._flatPos,this._map.transform):(s=this._lngLat)===null||s===void 0?void 0:s.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let u="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?u=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(u=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let m="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?m="rotateX(0deg)":this._pitchAlignment==="map"&&(m=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||n&&n.type!=="moveend"||(this._pos=this._pos.round()),X.setTransform(this._element,`${oa[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${m} ${u}`),se.frameAsync(new AbortController).then(()=>{this._updateOpacity(n&&n.type==="moveend")}).catch(()=>{})},this._onMove=n=>{if(!this._isDragging){let s=this._clickTolerance||this._map._clickTolerance;this._isDragging=n.point.dist(this._pointerdownPos)>=s}this._isDragging&&(this._pos=n.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 p.k("dragstart"))),this.fire(new p.k("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 p.k("dragend")),this._state="inactive"},this._addDragHandler=n=>{this._element.contains(n.originalEvent.target)&&(n.preventDefault(),this._positionDelta=n.point.sub(this._pos).add(this._offset),this._pointerdownPos=n.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=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._subpixelPositioning=e&&e.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(e?.opacity,e?.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=p.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=X.create("div");let n=X.createNS("http://www.w3.org/2000/svg","svg"),s=41,o=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${s}px`),n.setAttributeNS(null,"width",`${o}px`),n.setAttributeNS(null,"viewBox",`0 0 ${o} ${s}`);let u=X.createNS("http://www.w3.org/2000/svg","g");u.setAttributeNS(null,"stroke","none"),u.setAttributeNS(null,"stroke-width","1"),u.setAttributeNS(null,"fill","none"),u.setAttributeNS(null,"fill-rule","evenodd");let m=X.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"fill-rule","nonzero");let _=X.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");let y=[{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(let G of y){let W=X.createNS("http://www.w3.org/2000/svg","ellipse");W.setAttributeNS(null,"opacity","0.04"),W.setAttributeNS(null,"cx","10.5"),W.setAttributeNS(null,"cy","5.80029008"),W.setAttributeNS(null,"rx",G.rx),W.setAttributeNS(null,"ry",G.ry),_.appendChild(W)}let b=X.createNS("http://www.w3.org/2000/svg","g");b.setAttributeNS(null,"fill",this._color);let T=X.createNS("http://www.w3.org/2000/svg","path");T.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"),b.appendChild(T);let C=X.createNS("http://www.w3.org/2000/svg","g");C.setAttributeNS(null,"opacity","0.25"),C.setAttributeNS(null,"fill","#000000");let P=X.createNS("http://www.w3.org/2000/svg","path");P.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"),C.appendChild(P);let L=X.createNS("http://www.w3.org/2000/svg","g");L.setAttributeNS(null,"transform","translate(6.0, 7.0)"),L.setAttributeNS(null,"fill","#FFFFFF");let O=X.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"transform","translate(8.0, 8.0)");let U=X.createNS("http://www.w3.org/2000/svg","circle");U.setAttributeNS(null,"fill","#000000"),U.setAttributeNS(null,"opacity","0.25"),U.setAttributeNS(null,"cx","5.5"),U.setAttributeNS(null,"cy","5.5"),U.setAttributeNS(null,"r","5.4999962");let Z=X.createNS("http://www.w3.org/2000/svg","circle");Z.setAttributeNS(null,"fill","#FFFFFF"),Z.setAttributeNS(null,"cx","5.5"),Z.setAttributeNS(null,"cy","5.5"),Z.setAttributeNS(null,"r","5.4999962"),O.appendChild(U),O.appendChild(Z),m.appendChild(_),m.appendChild(b),m.appendChild(C),m.appendChild(L),m.appendChild(O),n.appendChild(m),n.setAttributeNS(null,"height",s*this._scale+"px"),n.setAttributeNS(null,"width",o*this._scale+"px"),this._element.appendChild(n),this._offset=p.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",n=>{n.preventDefault()}),this._element.addEventListener("mousedown",n=>{n.preventDefault()}),ws(this._element,this._anchor,"marker"),e&&e.className)for(let n of e.className.split(" "))this._element.classList.add(n);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",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("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),X.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=p.N.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){let o=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[o,-1*(38.1-13.5+o)],"bottom-right":[-o,-1*(38.1-13.5+o)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){let e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var n,s;if(!(!((n=this._map)===null||n===void 0)&&n.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let o=this._map,u=o.terrain.depthAtPoint(this._pos),m=o.terrain.getElevationForLngLatZoom(this._lngLat,o.transform.tileZoom);if(o.transform.lngLatToCameraDepth(this._lngLat,m)-u<.006)return void(this._element.style.opacity=this._opacity);let _=-this._offset.y/o.transform._pixelPerMeter,y=Math.sin(o.getPitch()*Math.PI/180)*_,b=o.terrain.depthAtPoint(new p.P(this._pos.x,this._pos.y-this._offset.y)),T=o.transform.lngLatToCameraDepth(this._lngLat,m+y)-b>.006;!((s=this._popup)===null||s===void 0)&&s.isOpen()&&T&&this._popup.remove(),this._element.style.opacity=T?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=p.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(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(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,n){return e===void 0&&n===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=e),n!==void 0&&(this._opacityWhenCovered=n),this._map&&this._updateOpacity(!0),this}}let Kl={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},Fa=0,Oa=!1,Xr={maxWidth:100,unit:"metric"};function Na(c,e,n){let s=n&&n.maxWidth||100,o=c._container.clientHeight/2,u=c.unproject([0,o]),m=c.unproject([s,o]),_=u.distanceTo(m);if(n&&n.unit==="imperial"){let y=3.2808*_;y>5280?$e(e,s,y/5280,c._getUIString("ScaleControl.Miles")):$e(e,s,y,c._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?$e(e,s,_/1852,c._getUIString("ScaleControl.NauticalMiles")):_>=1e3?$e(e,s,_/1e3,c._getUIString("ScaleControl.Kilometers")):$e(e,s,_,c._getUIString("ScaleControl.Meters"))}function $e(c,e,n,s){let o=function(u){let m=Math.pow(10,`${Math.floor(u)}`.length-1),_=u/m;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(y){let b=Math.pow(10,Math.ceil(-Math.log(y)/Math.LN10));return Math.round(y*b)/b}(_),m*_}(n);c.style.width=e*(o/n)+"px",c.innerHTML=`${o} ${s}`}let nt={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Es=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Ts(c){if(c){if(typeof c=="number"){let e=Math.round(Math.abs(c)/Math.SQRT2);return{center:new p.P(0,0),top:new p.P(0,c),"top-left":new p.P(e,e),"top-right":new p.P(-e,e),bottom:new p.P(0,-c),"bottom-left":new p.P(e,-e),"bottom-right":new p.P(-e,-e),left:new p.P(c,0),right:new p.P(-c,0)}}if(c instanceof p.P||Array.isArray(c)){let e=p.P.convert(c);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:p.P.convert(c.center||[0,0]),top:p.P.convert(c.top||[0,0]),"top-left":p.P.convert(c["top-left"]||[0,0]),"top-right":p.P.convert(c["top-right"]||[0,0]),bottom:p.P.convert(c.bottom||[0,0]),"bottom-left":p.P.convert(c["bottom-left"]||[0,0]),"bottom-right":p.P.convert(c["bottom-right"]||[0,0]),left:p.P.convert(c.left||[0,0]),right:p.P.convert(c.right||[0,0])}}return Ts(new p.P(0,0))}let Vo=ue;E.AJAXError=p.bh,E.Evented=p.E,E.LngLat=p.N,E.MercatorCoordinate=p.Z,E.Point=p.P,E.addProtocol=p.bi,E.config=p.a,E.removeProtocol=p.bj,E.AttributionControl=aa,E.BoxZoomHandler=pr,E.CanvasSource=Ui,E.CooperativeGesturesHandler=ra,E.DoubleClickZoomHandler=kn,E.DragPanHandler=Gl,E.DragRotateHandler=Hl,E.EdgeInsets=Qn,E.FullscreenControl=class extends p.E{constructor(c={}){super(),this._onFullscreenChange=()=>{var e;let n=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((e=n?.shadowRoot)===null||e===void 0)&&e.fullscreenElement;)n=n.shadowRoot.fullscreenElement;n===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,c&&c.container&&(c.container instanceof HTMLElement?this._container=c.container:p.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(c){return this._map=c,this._container||(this._container=this._map.getContainer()),this._controlContainer=X.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){X.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let c=this._fullscreenButton=X.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);X.create("span","maplibregl-ctrl-icon",c).setAttribute("aria-hidden","true"),c.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let c=this._getTitle();this._fullscreenButton.setAttribute("aria-label",c),this._fullscreenButton.title=c}_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 p.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new p.k("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()}},E.GeoJSONSource=_r,E.GeolocateControl=class extends p.E{constructor(c){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new p.k("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,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(e),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new p.k("geolocate",e)),this._finish()}},this._updateCamera=e=>{let n=new p.N(e.coords.longitude,e.coords.latitude),s=e.coords.accuracy,o=this._map.getBearing(),u=p.e({bearing:o},this.options.fitBoundsOptions),m=oe.fromLngLat(n,s);this._map.fitBounds(m,u,{geolocateSource:!0})},this._updateMarker=e=>{if(e){let n=new p.N(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=e.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=e=>{if(this._map){if(this.options.trackUserLocation)if(e.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;let n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&Oa)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new p.k("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=X.create("button","maplibregl-ctrl-geolocate",this._container),X.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(e===!1){p.w("Geolocation support is not available so the GeolocateControl will be disabled.");let n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}else{let n=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=X.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new As({element:this._dotElement}),this._circleElement=X.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new As({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",n=>{n.geolocateSource||this._watchState!=="ACTIVE_LOCK"||n.originalEvent&&n.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 p.k("trackuserlocationend")),this.fire(new p.k("userlocationlostfocus")))})}},this.options=p.e({},Kl,c)}onAdd(c){return this._map=c,this._container=X.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return p._(this,arguments,void 0,function*(e=!1){if(dr!==void 0&&!e)return dr;if(window.navigator.permissions===void 0)return dr=!!window.navigator.geolocation,dr;try{dr=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{dr=!!window.navigator.geolocation}return dr})}().then(e=>this._finishSetupUI(e)),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(),X.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Fa=0,Oa=!1}_isOutOfMapMaxBounds(c){let e=this._map.getMaxBounds(),n=c.coords;return e&&(n.longitudee.getEast()||n.latitudee.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(){let c=this._map.getBounds(),e=c.getSouthEast(),n=c.getNorthEast(),s=e.distanceTo(n),o=Math.ceil(this._accuracy/(s/this._map._container.clientHeight)*2);this._circleElement.style.width=`${o}px`,this._circleElement.style.height=`${o}px`}trigger(){if(!this._setup)return p.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 p.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Fa--,Oa=!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 p.k("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 p.k("trackuserlocationstart")),this.fire(new p.k("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 c;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Fa++,Fa>1?(c={maximumAge:6e5,timeout:0},Oa=!0):(c=this.options.positionOptions,Oa=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,c)}}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)}},E.Hash=ds,E.ImageSource=Wi,E.KeyboardHandler=br,E.LngLatBounds=oe,E.LogoControl=Ro,E.Map=class extends Xl{constructor(c){p.bf.mark(p.bg.create);let e=Object.assign(Object.assign({},ic),c);if(e.minZoom!=null&&e.maxZoom!=null&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(e.minPitch!=null&&e.maxPitch!=null&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(e.minPitch!=null&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(e.maxPitch!=null&&e.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new ea(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies),{bearingSnap:e.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new It,this._controls=[],this._mapId=p.a4(),this._contextLost=n=>{n.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new p.k("webglcontextlost",{originalEvent:n}))},this._contextRestored=n=>{this._setupPainter(),this.resize(),this._update(),this.fire(new p.k("webglcontextrestored",{originalEvent:n}))},this._onMapScroll=n=>{if(n.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._maxTileCacheZoomLevels=e.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=e.preserveDrawingBuffer===!0,this._antialias=e.antialias===!0,this._trackResize=e.trackResize===!0,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles===!0,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions===!0,this._collectResourceTiming=e.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},No),e.locale),this._clickTolerance=e.clickTolerance,this._overridePixelRatio=e.pixelRatio,this._maxCanvasSize=e.maxCanvasSize,this.transformCameraUpdate=e.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=e.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=jt.addThrottleControl(()=>this.isMoving()),this._requestManager=new xe(e.transformRequest),typeof e.container=="string"){if(this._container=document.getElementById(e.container),!this._container)throw new Error(`Container '${e.container}' not found.`)}else{if(!(e.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)).on("moveend",()=>this._update(!1)).on("zoom",()=>this._update(!0)).on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}).once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let n=!1,s=Pa(o=>{this._trackResize&&!this._removed&&(this.resize(o),this.redraw())},50);this._resizeObserver=new ResizeObserver(o=>{n?s(o):n=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Lo(this,e),this._hash=e.hash&&new ds(typeof e.hash=="string"&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,p.e({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,this._validateStyle=e.validateStyle,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new aa(typeof e.attributionControl=="boolean"?void 0:e.attributionControl)),e.maplibreLogo&&this.addControl(new Ro,e.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",n=>{this._update(n.dataType==="style"),this.fire(new p.k(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new p.k(`${n.dataType}dataloading`,n))}),this.on("dataabort",n=>{this.fire(new p.k("sourcedataabort",n))})}_getMapId(){return this._mapId}addControl(c,e){if(e===void 0&&(e=c.getDefaultPosition?c.getDefaultPosition():"top-right"),!c||!c.onAdd)return this.fire(new p.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let n=c.onAdd(this);this._controls.push(c);let s=this._controlPositions[e];return e.indexOf("bottom")!==-1?s.insertBefore(n,s.firstChild):s.appendChild(n),this}removeControl(c){if(!c||!c.onRemove)return this.fire(new p.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let e=this._controls.indexOf(c);return e>-1&&this._controls.splice(e,1),c.onRemove(this),this}hasControl(c){return this._controls.indexOf(c)>-1}calculateCameraOptionsFromTo(c,e,n,s){return s==null&&this.terrain&&(s=this.terrain.getElevationForLngLatZoom(n,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(c,e,n,s)}resize(c){var e;let n=this._containerDimensions(),s=n[0],o=n[1],u=this._getClampedPixelRatio(s,o);if(this._resizeCanvas(s,o,u),this.painter.resize(s,o,u),this.painter.overLimit()){let _=this.painter.context.gl;this._maxCanvasSize=[_.drawingBufferWidth,_.drawingBufferHeight];let y=this._getClampedPixelRatio(s,o);this._resizeCanvas(s,o,y),this.painter.resize(s,o,y)}this.transform.resize(s,o),(e=this._requestedCameraState)===null||e===void 0||e.resize(s,o);let m=!this._moving;return m&&(this.stop(),this.fire(new p.k("movestart",c)).fire(new p.k("move",c))),this.fire(new p.k("resize",c)),m&&this.fire(new p.k("moveend",c)),this}_getClampedPixelRatio(c,e){let{0:n,1:s}=this._maxCanvasSize,o=this.getPixelRatio(),u=c*o,m=e*o;return Math.min(u>n?n/u:1,m>s?s/m:1)*o}getPixelRatio(){var c;return(c=this._overridePixelRatio)!==null&&c!==void 0?c:devicePixelRatio}setPixelRatio(c){this._overridePixelRatio=c,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(c){return this.transform.setMaxBounds(oe.convert(c)),this._update()}setMinZoom(c){if((c=c??-2)>=-2&&c<=this.transform.maxZoom)return this.transform.minZoom=c,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=c,this._update(),this.getZoom()>c&&this.setZoom(c),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(c){if((c=c??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(c>=0&&c<=this.transform.maxPitch)return this.transform.minPitch=c,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(c>=this.transform.minPitch)return this.transform.maxPitch=c,this._update(),this.getPitch()>c&&this.setPitch(c),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(c){return this.transform.renderWorldCopies=c,this._update()}project(c){return this.transform.locationPoint(p.N.convert(c),this.style&&this.terrain)}unproject(c){return this.transform.pointLocation(p.P.convert(c),this.terrain)}isMoving(){var c;return this._moving||((c=this.handlers)===null||c===void 0?void 0:c.isMoving())}isZooming(){var c;return this._zooming||((c=this.handlers)===null||c===void 0?void 0:c.isZooming())}isRotating(){var c;return this._rotating||((c=this.handlers)===null||c===void 0?void 0:c.isRotating())}_createDelegatedListener(c,e,n){if(c==="mouseenter"||c==="mouseover"){let s=!1;return{layers:e,listener:n,delegates:{mousemove:u=>{let m=e.filter(y=>this.getLayer(y)),_=m.length!==0?this.queryRenderedFeatures(u.point,{layers:m}):[];_.length?s||(s=!0,n.call(this,new Pi(c,this,u.originalEvent,{features:_}))):s=!1},mouseout:()=>{s=!1}}}}if(c==="mouseleave"||c==="mouseout"){let s=!1;return{layers:e,listener:n,delegates:{mousemove:m=>{let _=e.filter(y=>this.getLayer(y));(_.length!==0?this.queryRenderedFeatures(m.point,{layers:_}):[]).length?s=!0:s&&(s=!1,n.call(this,new Pi(c,this,m.originalEvent)))},mouseout:m=>{s&&(s=!1,n.call(this,new Pi(c,this,m.originalEvent)))}}}}{let s=o=>{let u=e.filter(_=>this.getLayer(_)),m=u.length!==0?this.queryRenderedFeatures(o.point,{layers:u}):[];m.length&&(o.features=m,n.call(this,o),delete o.features)};return{layers:e,listener:n,delegates:{[c]:s}}}}_saveDelegatedListener(c,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[c]=this._delegatedListeners[c]||[],this._delegatedListeners[c].push(e)}_removeDelegatedListener(c,e,n){if(!this._delegatedListeners||!this._delegatedListeners[c])return;let s=this._delegatedListeners[c];for(let o=0;oe.includes(m))){for(let m in u.delegates)this.off(m,u.delegates[m]);return void s.splice(o,1)}}}on(c,e,n){if(n===void 0)return super.on(c,e);let s=this._createDelegatedListener(c,typeof e=="string"?[e]:e,n);this._saveDelegatedListener(c,s);for(let o in s.delegates)this.on(o,s.delegates[o]);return this}once(c,e,n){if(n===void 0)return super.once(c,e);let s=typeof e=="string"?[e]:e,o=this._createDelegatedListener(c,s,n);for(let u in o.delegates){let m=o.delegates[u];o.delegates[u]=(..._)=>{this._removeDelegatedListener(c,s,n),m(..._)}}this._saveDelegatedListener(c,o);for(let u in o.delegates)this.once(u,o.delegates[u]);return this}off(c,e,n){return n===void 0?super.off(c,e):(this._removeDelegatedListener(c,typeof e=="string"?[e]:e,n),this)}queryRenderedFeatures(c,e){if(!this.style)return[];let n,s=c instanceof p.P||Array.isArray(c),o=s?c:[[0,0],[this.transform.width,this.transform.height]];if(e=e||(s?{}:c)||{},o instanceof p.P||typeof o[0]=="number")n=[p.P.convert(o)];else{let u=p.P.convert(o[0]),m=p.P.convert(o[1]);n=[u,new p.P(m.x,u.y),m,new p.P(u.x,m.y),u]}return this.style.queryRenderedFeatures(n,e,this.transform)}querySourceFeatures(c,e){return this.style.querySourceFeatures(c,e)}setStyle(c,e){return(e=p.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&c?(this._diffStyle(c,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(c,e))}setTransformRequest(c){return this._requestManager.setTransformRequest(c),this}_getUIString(c){let e=this._locale[c];if(e==null)throw new Error(`Missing UI string '${c}'`);return e}_updateStyle(c,e){if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(c,e));let n=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!c)),c?(this.style=new Ja(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof c=="string"?this.style.loadURL(c,e,n):this.style.loadJSON(c,e,n),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Ja(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(c,e){if(typeof c=="string"){let n=this._requestManager.transformRequest(c,"Style");p.h(n,new AbortController).then(s=>{this._updateDiff(s.data,e)}).catch(s=>{s&&this.fire(new p.j(s))})}else typeof c=="object"&&this._updateDiff(c,e)}_updateDiff(c,e){try{this.style.setState(c,e)&&this._update(!0)}catch(n){p.w(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(c,e)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():p.w("There is no style added to the map.")}addSource(c,e){return this._lazyInitEmptyStyle(),this.style.addSource(c,e),this._update(!0)}isSourceLoaded(c){let e=this.style&&this.style.sourceCaches[c];if(e!==void 0)return e.loaded();this.fire(new p.j(new Error(`There is no source with ID '${c}'`)))}setTerrain(c){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),c){let e=this.style.sourceCaches[c.source];if(!e)throw new Error(`cannot load terrain, because there exists no source with ID: ${c.source}`);this.terrain===null&&e.reload();for(let n in this.style._layers){let s=this.style._layers[n];s.type==="hillshade"&&s.source===c.source&&p.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.")}this.terrain=new Oo(this.painter,e,c),this.painter.renderToTexture=new Wl(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=n=>{n.dataType==="style"?this.terrain.sourceCache.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId!==c.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(n.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.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new p.k("terrain",{terrain:c})),this}getTerrain(){var c,e;return(e=(c=this.terrain)===null||c===void 0?void 0:c.options)!==null&&e!==void 0?e:null}areTilesLoaded(){let c=this.style&&this.style.sourceCaches;for(let e in c){let n=c[e]._tiles;for(let s in n){let o=n[s];if(o.state!=="loaded"&&o.state!=="errored")return!1}}return!0}removeSource(c){return this.style.removeSource(c),this._update(!0)}getSource(c){return this.style.getSource(c)}addImage(c,e,n={}){let{pixelRatio:s=1,sdf:o=!1,stretchX:u,stretchY:m,content:_,textFitWidth:y,textFitHeight:b}=n;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||p.b(e))){if(e.width===void 0||e.height===void 0)return this.fire(new p.j(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`")));{let{width:T,height:C,data:P}=e,L=e;return this.style.addImage(c,{data:new p.R({width:T,height:C},new Uint8Array(P)),pixelRatio:s,stretchX:u,stretchY:m,content:_,textFitWidth:y,textFitHeight:b,sdf:o,version:0,userImage:L}),L.onAdd&&L.onAdd(this,c),this}}{let{width:T,height:C,data:P}=se.getImageData(e);this.style.addImage(c,{data:new p.R({width:T,height:C},P),pixelRatio:s,stretchX:u,stretchY:m,content:_,textFitWidth:y,textFitHeight:b,sdf:o,version:0})}}updateImage(c,e){let n=this.style.getImage(c);if(!n)return this.fire(new p.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let s=e instanceof HTMLImageElement||p.b(e)?se.getImageData(e):e,{width:o,height:u,data:m}=s;if(o===void 0||u===void 0)return this.fire(new p.j(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(o!==n.data.width||u!==n.data.height)return this.fire(new p.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));let _=!(e instanceof HTMLImageElement||p.b(e));return n.data.replace(m,_),this.style.updateImage(c,n),this}getImage(c){return this.style.getImage(c)}hasImage(c){return c?!!this.style.getImage(c):(this.fire(new p.j(new Error("Missing required image id"))),!1)}removeImage(c){this.style.removeImage(c)}loadImage(c){return jt.getImage(this._requestManager.transformRequest(c,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(c,e){return this._lazyInitEmptyStyle(),this.style.addLayer(c,e),this._update(!0)}moveLayer(c,e){return this.style.moveLayer(c,e),this._update(!0)}removeLayer(c){return this.style.removeLayer(c),this._update(!0)}getLayer(c){return this.style.getLayer(c)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(c,e,n){return this.style.setLayerZoomRange(c,e,n),this._update(!0)}setFilter(c,e,n={}){return this.style.setFilter(c,e,n),this._update(!0)}getFilter(c){return this.style.getFilter(c)}setPaintProperty(c,e,n,s={}){return this.style.setPaintProperty(c,e,n,s),this._update(!0)}getPaintProperty(c,e){return this.style.getPaintProperty(c,e)}setLayoutProperty(c,e,n,s={}){return this.style.setLayoutProperty(c,e,n,s),this._update(!0)}getLayoutProperty(c,e){return this.style.getLayoutProperty(c,e)}setGlyphs(c,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(c,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(c,e,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(c,e,n,s=>{s||this._update(!0)}),this}removeSprite(c){return this._lazyInitEmptyStyle(),this.style.removeSprite(c),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(c,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(c,e,n=>{n||this._update(!0)}),this}setLight(c,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(c,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(c){return this._lazyInitEmptyStyle(),this.style.setSky(c),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(c,e){return this.style.setFeatureState(c,e),this._update()}removeFeatureState(c,e){return this.style.removeFeatureState(c,e),this._update()}getFeatureState(c){return this.style.getFeatureState(c)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let c=0,e=0;return this._container&&(c=this._container.clientWidth||400,e=this._container.clientHeight||300),[c,e]}_setupContainer(){let c=this._container;c.classList.add("maplibregl-map");let e=this._canvasContainer=X.create("div","maplibregl-canvas-container",c);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=X.create("canvas","maplibregl-canvas",e),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");let n=this._containerDimensions(),s=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],s);let o=this._controlContainer=X.create("div","maplibregl-control-container",c),u=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(m=>{u[m]=X.create("div",`maplibregl-ctrl-${m} `,o)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(c,e,n){this._canvas.width=Math.floor(n*c),this._canvas.height=Math.floor(n*e),this._canvas.style.width=`${c}px`,this._canvas.style.height=`${e}px`}_setupPainter(){let c={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1},e=null;this._canvas.addEventListener("webglcontextcreationerror",s=>{e={requestedAttributes:c},s&&(e.statusMessage=s.statusMessage,e.type=s.type)},{once:!0});let n=this._canvas.getContext("webgl2",c)||this._canvas.getContext("webgl",c);if(!n){let s="Failed to initialize WebGL";throw e?(e.message=s,new Error(JSON.stringify(e))):new Error(s)}this.painter=new ps(n,this.transform),Mt.testSupport(n)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(c){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||c,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(c){return this._update(),this._renderTaskQueue.add(c)}_cancelRenderFrame(c){this._renderTaskQueue.remove(c)}_render(c){let e=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(c),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let o=this.transform.zoom,u=se.now();this.style.zoomHistory.update(o,u);let m=new p.z(o,{now:u,fadeDuration:e,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),_=m.crossFadingFactor();_===1&&_===this._crossFadingFactor||(n=!0,this._crossFadingFactor=_),this.style.update(m)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,e,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:e,showPadding:this.showPadding}),this.fire(new p.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,p.bf.mark(p.bg.load),this.fire(new p.k("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let s=this._sourcesDirty||this._styleDirty||this._placementDirty;return s||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new p.k("idle")),!this._loaded||this._fullyLoaded||s||(this._fullyLoaded=!0,p.bf.mark(p.bg.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var c;this._hash&&this._hash.remove();for(let n of this._controls)n.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),jt.removeThrottleControl(this._imageQueueHandle),(c=this._resizeObserver)===null||c===void 0||c.disconnect();let e=this.painter.context.gl.getExtension("WEBGL_lose_context");e?.loseContext&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),X.remove(this._canvasContainer),X.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),p.bf.clearMetrics(),this._removed=!0,this.fire(new p.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,se.frameAsync(this._frameRequest).then(c=>{p.bf.frame(c),this._frameRequest=null,this._render(c)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(c){this._showTileBoundaries!==c&&(this._showTileBoundaries=c,this._update())}get showPadding(){return!!this._showPadding}set showPadding(c){this._showPadding!==c&&(this._showPadding=c,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(c){this._showCollisionBoxes!==c&&(this._showCollisionBoxes=c,c?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(c){this._showOverdrawInspector!==c&&(this._showOverdrawInspector=c,this._update())}get repaint(){return!!this._repaint}set repaint(c){this._repaint!==c&&(this._repaint=c,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(c){this._vertices=c,this._update()}get version(){return Jl}getCameraTargetElevation(){return this.transform.elevation}},E.MapMouseEvent=Pi,E.MapTouchEvent=Sn,E.MapWheelEvent=jl,E.Marker=As,E.NavigationControl=class{constructor(c){this._updateZoomButtons=()=>{let e=this._map.getZoom(),n=e===this._map.getMaxZoom(),s=e===this._map.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=s,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",s.toString())},this._rotateCompassArrow=()=>{let e=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=e},this._setButtonTitle=(e,n)=>{let s=this._map._getUIString(`NavigationControl.${n}`);e.title=s,e.setAttribute("aria-label",s)},this.options=p.e({},rc,c),this._container=X.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),X.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),X.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=X.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(c){return this._map=c,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._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new nc(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){X.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._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(c,e){let n=X.create("button",c,this._container);return n.type="button",n.addEventListener("click",e),n}},E.Popup=class extends p.E{constructor(c){super(),this.remove=()=>(this._content&&X.remove(this._content),this._container&&(X.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 p.k("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{var n;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=X.create("div","maplibregl-popup",this._map.getContainer()),this._tip=X.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let _ of this.options.className.split(" "))this._container.classList.add(_);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=this._map.transform.renderWorldCopies&&!this._trackPointer?ti(this._lngLat,this._flatPos,this._map.transform):(n=this._lngLat)===null||n===void 0?void 0:n.wrap(),this._trackPointer&&!e)return;let s=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationPoint(this._lngLat));let o=this.options.anchor,u=Ts(this.options.offset);if(!o){let _=this._container.offsetWidth,y=this._container.offsetHeight,b;b=s.y+u.bottom.ythis._map.transform.height-y?["bottom"]:[],s.x<_/2?b.push("left"):s.x>this._map.transform.width-_/2&&b.push("right"),o=b.length===0?"bottom":b.join("-")}let m=s.add(u[o]);this.options.subpixelPositioning||(m=m.round()),X.setTransform(this._container,`${oa[o]} translate(${m.x}px,${m.y}px)`),ws(this._container,o,"popup")},this._onClose=()=>{this.remove()},this.options=p.e(Object.create(nt),c)}addTo(c){return this._map&&this.remove(),this._map=c,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 p.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(c){return this._lngLat=p.N.convert(c),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(c){return this.setDOMContent(document.createTextNode(c))}setHTML(c){let e=document.createDocumentFragment(),n=document.createElement("body"),s;for(n.innerHTML=c;s=n.firstChild,s;)e.appendChild(s);return this.setDOMContent(e)}getMaxWidth(){var c;return(c=this._container)===null||c===void 0?void 0:c.style.maxWidth}setMaxWidth(c){return this.options.maxWidth=c,this._update(),this}setDOMContent(c){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=X.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(c),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(c){return this._container&&this._container.classList.add(c),this}removeClassName(c){return this._container&&this._container.classList.remove(c),this}setOffset(c){return this.options.offset=c,this._update(),this}toggleClassName(c){if(this._container)return this._container.classList.toggle(c)}setSubpixelPositioning(c){this.options.subpixelPositioning=c}_createCloseButton(){this.options.closeButton&&(this._closeButton=X.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;let c=this._container.querySelector(Es);c&&c.focus()}},E.RasterDEMTileSource=Gt,E.RasterTileSource=Et,E.ScaleControl=class{constructor(c){this._onMove=()=>{Na(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,Na(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Xr),c)}getDefaultPosition(){return"bottom-left"}onAdd(c){return this._map=c,this._container=X.create("div","maplibregl-ctrl maplibregl-ctrl-scale",c.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){X.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},E.ScrollZoomHandler=Fr,E.Style=Ja,E.TerrainControl=class{constructor(c){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=c}onAdd(c){return this._map=c,this._container=X.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=X.create("button","maplibregl-ctrl-terrain",this._container),X.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(){X.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},E.TwoFingersTouchPitchHandler=ia,E.TwoFingersTouchRotateHandler=Po,E.TwoFingersTouchZoomHandler=ko,E.TwoFingersTouchZoomRotateHandler=Bo,E.VectorTileSource=kr,E.VideoSource=Qr,E.addSourceType=(c,e)=>p._(void 0,void 0,void 0,function*(){if(yn(c))throw new Error(`A source type called "${c}" already exists.`);((n,s)=>{sn[n]=s})(c,e)}),E.clearPrewarmedResources=function(){let c=gt;c&&(c.isPreloaded()&&c.numActive()===1?(c.release(mt),gt=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()"))},E.getMaxParallelImageRequests=function(){return p.a.MAX_PARALLEL_IMAGE_REQUESTS},E.getRTLTextPluginStatus=function(){return lr().getRTLTextPluginStatus()},E.getVersion=function(){return Vo},E.getWorkerCount=function(){return Bt.workerCount},E.getWorkerUrl=function(){return p.a.WORKER_URL},E.importScriptInWorkers=function(c){return Ut().broadcast("IS",c)},E.prewarm=function(){et().acquire(mt)},E.setMaxParallelImageRequests=function(c){p.a.MAX_PARALLEL_IMAGE_REQUESTS=c},E.setRTLTextPlugin=function(c,e){return lr().setRTLTextPlugin(c,e)},E.setWorkerCount=function(c){Bt.workerCount=c},E.setWorkerUrl=function(c){p.a.WORKER_URL=c}});var K=w;return K})});var ol=xa(js=>{"use strict";function Wm(w,S,F){if(F===void 0&&(F=Array.prototype),w&&typeof F.find=="function")return F.find.call(w,S);for(var K=0;K{var ud=ol(),gn=ud.find,ll=ud.NAMESPACE;function Km(w){return w!==""}function Ym(w){return w?w.split(/[\t\n\f\r ]+/).filter(Km):[]}function Qm(w,S){return w.hasOwnProperty(S)||(w[S]=!0),w}function id(w){if(!w)return[];var S=Ym(w);return Object.keys(S.reduce(Qm,{}))}function e0(w){return function(S){return w&&w.indexOf(S)!==-1}}function cl(w,S){for(var F in w)Object.prototype.hasOwnProperty.call(w,F)&&(S[F]=w[F])}function Sr(w,S){var F=w.prototype;if(!(F instanceof S)){let E=function(){};var K=E;E.prototype=S.prototype,E=new E,cl(F,E),w.prototype=F=E}F.constructor!=w&&(typeof w!="function"&&console.error("unknown Class:"+w),F.constructor=w)}var Ir={},Yr=Ir.ELEMENT_NODE=1,Zs=Ir.ATTRIBUTE_NODE=2,wu=Ir.TEXT_NODE=3,cd=Ir.CDATA_SECTION_NODE=4,hd=Ir.ENTITY_REFERENCE_NODE=5,t0=Ir.ENTITY_NODE=6,Kc=Ir.PROCESSING_INSTRUCTION_NODE=7,Yc=Ir.COMMENT_NODE=8,pd=Ir.DOCUMENT_NODE=9,dd=Ir.DOCUMENT_TYPE_NODE=10,Rn=Ir.DOCUMENT_FRAGMENT_NODE=11,i0=Ir.NOTATION_NODE=12,sr={},Vi={},Y0=sr.INDEX_SIZE_ERR=(Vi[1]="Index size error",1),Q0=sr.DOMSTRING_SIZE_ERR=(Vi[2]="DOMString size error",2),Dr=sr.HIERARCHY_REQUEST_ERR=(Vi[3]="Hierarchy request error",3),eg=sr.WRONG_DOCUMENT_ERR=(Vi[4]="Wrong document",4),r0=sr.INVALID_CHARACTER_ERR=(Vi[5]="Invalid character",5),tg=sr.NO_DATA_ALLOWED_ERR=(Vi[6]="No data allowed",6),ig=sr.NO_MODIFICATION_ALLOWED_ERR=(Vi[7]="No modification allowed",7),fd=sr.NOT_FOUND_ERR=(Vi[8]="Not found",8),rg=sr.NOT_SUPPORTED_ERR=(Vi[9]="Not supported",9),rd=sr.INUSE_ATTRIBUTE_ERR=(Vi[10]="Attribute in use",10),$s=sr.INVALID_STATE_ERR=(Vi[11]="Invalid state",11),ng=sr.SYNTAX_ERR=(Vi[12]="Syntax error",12),ag=sr.INVALID_MODIFICATION_ERR=(Vi[13]="Invalid modification",13),sg=sr.NAMESPACE_ERR=(Vi[14]="Invalid namespace",14),og=sr.INVALID_ACCESS_ERR=(Vi[15]="Invalid access",15);function si(w,S){if(S instanceof Error)var F=S;else F=this,Error.call(this,Vi[w]),this.message=Vi[w],Error.captureStackTrace&&Error.captureStackTrace(this,si);return F.code=w,S&&(this.message=this.message+": "+S),F}si.prototype=Error.prototype;cl(sr,si);function Fn(){}Fn.prototype={length:0,item:function(w){return w>=0&&w=0){for(var E=S.length-1;K0},lookupPrefix:function(w){for(var S=this;S;){var F=S._nsMap;if(F){for(var K in F)if(Object.prototype.hasOwnProperty.call(F,K)&&F[K]===w)return K}S=S.nodeType==Zs?S.ownerDocument:S.parentNode}return null},lookupNamespaceURI:function(w){for(var S=this;S;){var F=S._nsMap;if(F&&Object.prototype.hasOwnProperty.call(F,w))return F[w];S=S.nodeType==Zs?S.ownerDocument:S.parentNode}return null},isDefaultNamespace:function(w){var S=this.lookupPrefix(w);return S==null}};function _d(w){return w=="<"&&"<"||w==">"&&">"||w=="&"&&"&"||w=='"'&&"""||"&#"+w.charCodeAt()+";"}cl(Ir,ei);cl(Ir,ei.prototype);function Eu(w,S){return qi(w,null,{enter:function(F){return S(F)?qi.STOP:!0}})===qi.STOP}function qi(w,S,F){for(var K=[{node:w,context:S,phase:qi.ENTER}];K.length>0;){var E=K.pop();if(E.phase===qi.ENTER){var p=F.enter(E.node,E.context);if(p===qi.STOP)return qi.STOP;if(K.push({node:E.node,context:p,phase:qi.EXIT}),p==null)continue;for(var ue=E.node.lastChild;ue;)K.push({node:ue,context:p,phase:qi.ENTER}),ue=ue.previousSibling}else F.exit&&F.exit(E.node,E.context)}}qi.STOP=Symbol("walkDOM.STOP");qi.ENTER=0;qi.EXIT=1;function hl(){this.ownerDocument=this}function n0(w,S,F){w&&w._inc++;var K=F.namespaceURI;K===ll.XMLNS&&(S._nsMap[F.prefix?F.localName:""]=F.value)}function yd(w,S,F,K){w&&w._inc++;var E=F.namespaceURI;E===ll.XMLNS&&delete S._nsMap[F.prefix?F.localName:""]}function eh(w,S,F){if(w&&w._inc){w._inc++;var K=S.childNodes;if(F)K[K.length++]=F;else{for(var E=S.firstChild,p=0;E;)K[p++]=E,E=E.nextSibling;K.length=p,delete K[K.length]}}}function vd(w,S){var F=S.previousSibling,K=S.nextSibling;return F?F.nextSibling=K:w.firstChild=K,K?K.previousSibling=F:w.lastChild=F,S.parentNode=null,S.previousSibling=null,S.nextSibling=null,eh(w.ownerDocument,w),S}function a0(w){return w&&(w.nodeType===ei.DOCUMENT_NODE||w.nodeType===ei.DOCUMENT_FRAGMENT_NODE||w.nodeType===ei.ELEMENT_NODE)}function s0(w){return w&&(_n(w)||th(w)||On(w)||w.nodeType===ei.DOCUMENT_FRAGMENT_NODE||w.nodeType===ei.COMMENT_NODE||w.nodeType===ei.PROCESSING_INSTRUCTION_NODE)}function On(w){return w&&w.nodeType===ei.DOCUMENT_TYPE_NODE}function _n(w){return w&&w.nodeType===ei.ELEMENT_NODE}function th(w){return w&&w.nodeType===ei.TEXT_NODE}function sd(w,S){var F=w.childNodes||[];if(gn(F,_n)||On(S))return!1;var K=gn(F,On);return!(S&&K&&F.indexOf(K)>F.indexOf(S))}function od(w,S){var F=w.childNodes||[];function K(p){return _n(p)&&p!==S}if(gn(F,K))return!1;var E=gn(F,On);return!(S&&E&&F.indexOf(E)>F.indexOf(S))}function o0(w,S,F){if(!a0(w))throw new si(Dr,"Unexpected parent node type "+w.nodeType);if(F&&F.parentNode!==w)throw new si(fd,"child not in parent");if(!s0(S)||On(S)&&w.nodeType!==ei.DOCUMENT_NODE)throw new si(Dr,"Unexpected node type "+S.nodeType+" for parent node type "+w.nodeType)}function l0(w,S,F){var K=w.childNodes||[],E=S.childNodes||[];if(S.nodeType===ei.DOCUMENT_FRAGMENT_NODE){var p=E.filter(_n);if(p.length>1||gn(E,th))throw new si(Dr,"More than one element or text in fragment");if(p.length===1&&!sd(w,F))throw new si(Dr,"Element in fragment can not be inserted before doctype")}if(_n(S)&&!sd(w,F))throw new si(Dr,"Only one element can be added and only after doctype");if(On(S)){if(gn(K,On))throw new si(Dr,"Only one doctype is allowed");var ue=gn(K,_n);if(F&&K.indexOf(ue)1||gn(E,th))throw new si(Dr,"More than one element or text in fragment");if(p.length===1&&!od(w,F))throw new si(Dr,"Element in fragment can not be inserted before doctype")}if(_n(S)&&!od(w,F))throw new si(Dr,"Only one element can be added and only after doctype");if(On(S)){let De=function(se){return On(se)&&se!==F};var pe=De;if(gn(K,De))throw new si(Dr,"Only one doctype is allowed");var ue=gn(K,_n);if(F&&K.indexOf(ue)0&&Eu(F.documentElement,function(E){if(E!==F&&E.nodeType===Yr){var p=E.getAttribute("class");if(p){var ue=w===p;if(!ue){var pe=id(p);ue=S.every(e0(pe))}ue&&K.push(E)}}}),K})},createElement:function(w){var S=new Xa;S.ownerDocument=this,S.nodeName=w,S.tagName=w,S.localName=w,S.childNodes=new Fn;var F=S.attributes=new Au;return F._ownerElement=S,S},createDocumentFragment:function(){var w=new Su;return w.ownerDocument=this,w.childNodes=new Fn,w},createTextNode:function(w){var S=new ih;return S.ownerDocument=this,S.appendData(w),S},createComment:function(w){var S=new rh;return S.ownerDocument=this,S.appendData(w),S},createCDATASection:function(w){if(w.indexOf("]]>")!==-1)throw new si(r0,'data contains "]]>"');var S=new nh;return S.ownerDocument=this,S.appendData(w),S},createProcessingInstruction:function(w,S){var F=new sh;return F.ownerDocument=this,F.tagName=F.nodeName=F.target=w,F.nodeValue=F.data=S,F},createAttribute:function(w){var S=new Cu;return S.ownerDocument=this,S.name=w,S.nodeName=w,S.localName=w,S.specified=!0,S},createEntityReference:function(w){var S=new ah;return S.ownerDocument=this,S.nodeName=w,S},createElementNS:function(w,S){var F=new Xa,K=S.split(":"),E=F.attributes=new Au;return F.childNodes=new Fn,F.ownerDocument=this,F.nodeName=S,F.tagName=S,F.namespaceURI=w,K.length==2?(F.prefix=K[0],F.localName=K[1]):F.localName=S,E._ownerElement=F,F},createAttributeNS:function(w,S){var F=new Cu,K=S.split(":");return F.ownerDocument=this,F.nodeName=S,F.name=S,F.namespaceURI=w,F.specified=!0,K.length==2?(F.prefix=K[0],F.localName=K[1]):F.localName=S,F}};Sr(hl,ei);function Xa(){this._nsMap={}}Xa.prototype={nodeType:Yr,hasAttribute:function(w){return this.getAttributeNode(w)!=null},getAttribute:function(w){var S=this.getAttributeNode(w);return S&&S.value||""},getAttributeNode:function(w){return this.attributes.getNamedItem(w)},setAttribute:function(w,S){var F=this.ownerDocument.createAttribute(w);F.value=F.nodeValue=""+S,this.setAttributeNode(F)},removeAttribute:function(w){var S=this.getAttributeNode(w);S&&this.removeAttributeNode(S)},appendChild:function(w){return w.nodeType===Rn?this.insertBefore(w,null):u0(this,w)},setAttributeNode:function(w){return this.attributes.setNamedItem(w)},setAttributeNodeNS:function(w){return this.attributes.setNamedItemNS(w)},removeAttributeNode:function(w){return this.attributes.removeNamedItem(w.nodeName)},removeAttributeNS:function(w,S){var F=this.getAttributeNodeNS(w,S);F&&this.removeAttributeNode(F)},hasAttributeNS:function(w,S){return this.getAttributeNodeNS(w,S)!=null},getAttributeNS:function(w,S){var F=this.getAttributeNodeNS(w,S);return F&&F.value||""},setAttributeNS:function(w,S,F){var K=this.ownerDocument.createAttributeNS(w,S);K.value=K.nodeValue=""+F,this.setAttributeNode(K)},getAttributeNodeNS:function(w,S){return this.attributes.getNamedItemNS(w,S)},getElementsByTagName:function(w){return new Gs(this,function(S){var F=[];return Eu(S,function(K){K!==S&&K.nodeType==Yr&&(w==="*"||K.tagName==w)&&F.push(K)}),F})},getElementsByTagNameNS:function(w,S){return new Gs(this,function(F){var K=[];return Eu(F,function(E){E!==F&&E.nodeType===Yr&&(w==="*"||E.namespaceURI===w)&&(S==="*"||E.localName==S)&&K.push(E)}),K})}};hl.prototype.getElementsByTagName=Xa.prototype.getElementsByTagName;hl.prototype.getElementsByTagNameNS=Xa.prototype.getElementsByTagNameNS;Sr(Xa,ei);function Cu(){}Cu.prototype.nodeType=Zs;Sr(Cu,ei);function pl(){}pl.prototype={data:"",substringData:function(w,S){return this.data.substring(w,w+S)},appendData:function(w){w=this.data+w,this.nodeValue=this.data=w,this.length=w.length},insertData:function(w,S){this.replaceData(w,0,S)},appendChild:function(w){throw new Error(Vi[Dr])},deleteData:function(w,S){this.replaceData(w,S,"")},replaceData:function(w,S,F){var K=this.data.substring(0,w),E=this.data.substring(w+S);F=K+F+E,this.nodeValue=this.data=F,this.length=F.length}};Sr(pl,ei);function ih(){}ih.prototype={nodeName:"#text",nodeType:wu,splitText:function(w){var S=this.data,F=S.substring(w);S=S.substring(0,w),this.data=this.nodeValue=S,this.length=S.length;var K=this.ownerDocument.createTextNode(F);return this.parentNode&&this.parentNode.insertBefore(K,this.nextSibling),K}};Sr(ih,pl);function rh(){}rh.prototype={nodeName:"#comment",nodeType:Yc};Sr(rh,pl);function nh(){}nh.prototype={nodeName:"#cdata-section",nodeType:cd};Sr(nh,pl);function Du(){}Du.prototype.nodeType=dd;Sr(Du,ei);function bd(){}bd.prototype.nodeType=i0;Sr(bd,ei);function wd(){}wd.prototype.nodeType=t0;Sr(wd,ei);function ah(){}ah.prototype.nodeType=hd;Sr(ah,ei);function Su(){}Su.prototype.nodeName="#document-fragment";Su.prototype.nodeType=Rn;Sr(Su,ei);function sh(){}sh.prototype.nodeType=Kc;Sr(sh,ei);function Ad(){}Ad.prototype.serializeToString=function(w,S,F,K){return Ed.call(w,S,F,K)};ei.prototype.toString=Ed;function Ed(w,S,F){var K=!!F&&!!F.requireWellFormed,E=[],p=this.nodeType==9&&this.documentElement||this,ue=p.prefix,pe=p.namespaceURI;if(pe&&ue==null){var ue=p.lookupPrefix(pe);if(ue==null)var De=[{namespace:pe,prefix:null}]}return oh(this,E,w,S,De,K),E.join("")}function ld(w,S,F){var K=w.prefix||"",E=w.namespaceURI;if(!E||K==="xml"&&E===ll.XML||E===ll.XMLNS)return!1;for(var p=F.length;p--;){var ue=F[p];if(ue.prefix===K)return ue.namespace!==E}return!0}function bu(w,S,F){w.push(" ",S,'="',F.replace(/[<>&"\t\n\r]/g,_d),'"')}function oh(w,S,F,K,E,p){E||(E=[]),qi(w,{ns:E,isHTML:F},{enter:function(ue,pe){var De=pe.ns,se=pe.isHTML;if(K)if(ue=K(ue),ue){if(typeof ue=="string")return S.push(ue),null}else return null;switch(ue.nodeType){case Yr:var X=ue.attributes,Mt=X.length,yt=ue.tagName;se=ll.isHTML(ue.namespaceURI)||se;var Ct=yt;if(!se&&!ue.prefix&&ue.namespaceURI){for(var li,Pt=0;Pt=0;zt--){var jt=De[zt];if(jt.prefix===""&&jt.namespace===ue.namespaceURI){li=jt.namespace;break}}if(li!==ue.namespaceURI)for(var zt=De.length-1;zt>=0;zt--){var jt=De[zt];if(jt.namespace===ue.namespaceURI){jt.prefix&&(Ct=jt.prefix+":"+yt);break}}}S.push("<",Ct);for(var xe=De.slice(),Se=0;Se"),se&&/^script$/i.test(yt)){for(;ge;)ge.data?S.push(ge.data):oh(ge,S,se,K,xe.slice(),p),ge=ge.nextSibling;return S.push(""),null}return{ns:xe,isHTML:se,tag:Ct}}else return S.push("/>"),null;case pd:case Rn:return{ns:De.slice(),isHTML:se,tag:null};case Zs:return bu(S,ue.name,ue.value),null;case wu:return S.push(ue.data.replace(/[<&>]/g,_d)),null;case cd:if(p&&ue.data.indexOf("]]>")!==-1)throw new si($s,'The CDATASection data contains "]]>"');return S.push("/g,"]]]]>"),"]]>"),null;case Yc:if(p&&ue.data.indexOf("-->")!==-1)throw new si($s,'The comment node data contains "-->"');return S.push(""),null;case dd:if(p){if(ue.publicId&&!/^("[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%']*"|'[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%'"]*')$/.test(ue.publicId))throw new si($s,"DocumentType publicId is not a valid PubidLiteral");if(ue.systemId&&!/^("[^"]*"|'[^']*')$/.test(ue.systemId))throw new si($s,"DocumentType systemId is not a valid SystemLiteral");if(ue.internalSubset&&ue.internalSubset.indexOf("]>")!==-1)throw new si($s,'DocumentType internalSubset contains "]>"')}var Ke=ue.publicId,we=ue.systemId;if(S.push("");else if(we&&we!=".")S.push(" SYSTEM ",we,">");else{var Ye=ue.internalSubset;Ye&&S.push(" [",Ye,"]"),S.push(">")}return null;case Kc:if(p&&ue.data.indexOf("?>")!==-1)throw new si($s,'The ProcessingInstruction data contains "?>"');return S.push(""),null;case hd:return S.push("&",ue.nodeName,";"),null;default:return S.push("??",ue.nodeName),null}},exit:function(ue,pe){pe&&pe.tag&&S.push("")}})}function c0(w,S,F){var K;return qi(S,null,{enter:function(E,p){var ue=E.cloneNode(!1);ue.ownerDocument=w,ue.parentNode=null,p===null?K=ue:p.appendChild(ue);var pe=E.nodeType===Zs||F;return pe?ue:null}}),K}function Td(w,S,F){var K;return qi(S,null,{enter:function(E,p){var ue=new E.constructor;for(var pe in E)if(Object.prototype.hasOwnProperty.call(E,pe)){var De=E[pe];typeof De!="object"&&De!=ue[pe]&&(ue[pe]=De)}E.childNodes&&(ue.childNodes=new Fn),ue.ownerDocument=w;var se=F;switch(ue.nodeType){case Yr:var X=E.attributes,Mt=ue.attributes=new Au,yt=X.length;Mt._ownerElement=ue;for(var Ct=0;Ct{"use strict";var Dd=ol().freeze;dl.XML_ENTITIES=Dd({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});dl.HTML_ENTITIES=Dd({Aacute:"\xC1",aacute:"\xE1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223E",acd:"\u223F",acE:"\u223E\u0333",Acirc:"\xC2",acirc:"\xE2",acute:"\xB4",Acy:"\u0410",acy:"\u0430",AElig:"\xC6",aelig:"\xE6",af:"\u2061",Afr:"\u{1D504}",afr:"\u{1D51E}",Agrave:"\xC0",agrave:"\xE0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03B1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2A3F",AMP:"&",amp:"&",And:"\u2A53",and:"\u2227",andand:"\u2A55",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsd:"\u2221",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",Aogon:"\u0104",aogon:"\u0105",Aopf:"\u{1D538}",aopf:"\u{1D552}",ap:"\u2248",apacir:"\u2A6F",apE:"\u2A70",ape:"\u224A",apid:"\u224B",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224A",Aring:"\xC5",aring:"\xE5",Ascr:"\u{1D49C}",ascr:"\u{1D4B6}",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224D",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",awconint:"\u2233",awint:"\u2A11",backcong:"\u224C",backepsilon:"\u03F6",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",Backslash:"\u2216",Barv:"\u2AE7",barvee:"\u22BD",Barwed:"\u2306",barwed:"\u2305",barwedge:"\u2305",bbrk:"\u23B5",bbrktbrk:"\u23B6",bcong:"\u224C",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201E",becaus:"\u2235",Because:"\u2235",because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",Bernoullis:"\u212C",Beta:"\u0392",beta:"\u03B2",beth:"\u2136",between:"\u226C",Bfr:"\u{1D505}",bfr:"\u{1D51F}",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",bkarow:"\u290D",blacklozenge:"\u29EB",blacksquare:"\u25AA",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20E5",bnequiv:"\u2261\u20E5",bNot:"\u2AED",bnot:"\u2310",Bopf:"\u{1D539}",bopf:"\u{1D553}",bot:"\u22A5",bottom:"\u22A5",bowtie:"\u22C8",boxbox:"\u29C9",boxDL:"\u2557",boxDl:"\u2556",boxdL:"\u2555",boxdl:"\u2510",boxDR:"\u2554",boxDr:"\u2553",boxdR:"\u2552",boxdr:"\u250C",boxH:"\u2550",boxh:"\u2500",boxHD:"\u2566",boxHd:"\u2564",boxhD:"\u2565",boxhd:"\u252C",boxHU:"\u2569",boxHu:"\u2567",boxhU:"\u2568",boxhu:"\u2534",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",boxUL:"\u255D",boxUl:"\u255C",boxuL:"\u255B",boxul:"\u2518",boxUR:"\u255A",boxUr:"\u2559",boxuR:"\u2558",boxur:"\u2514",boxV:"\u2551",boxv:"\u2502",boxVH:"\u256C",boxVh:"\u256B",boxvH:"\u256A",boxvh:"\u253C",boxVL:"\u2563",boxVl:"\u2562",boxvL:"\u2561",boxvl:"\u2524",boxVR:"\u2560",boxVr:"\u255F",boxvR:"\u255E",boxvr:"\u251C",bprime:"\u2035",Breve:"\u02D8",breve:"\u02D8",brvbar:"\xA6",Bscr:"\u212C",bscr:"\u{1D4B7}",bsemi:"\u204F",bsim:"\u223D",bsime:"\u22CD",bsol:"\\",bsolb:"\u29C5",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpE:"\u2AAE",bumpe:"\u224F",Bumpeq:"\u224E",bumpeq:"\u224F",Cacute:"\u0106",cacute:"\u0107",Cap:"\u22D2",cap:"\u2229",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",capcup:"\u2A47",capdot:"\u2A40",CapitalDifferentialD:"\u2145",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",Cayleys:"\u212D",ccaps:"\u2A4D",Ccaron:"\u010C",ccaron:"\u010D",Ccedil:"\xC7",ccedil:"\xE7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2A4C",ccupssm:"\u2A50",Cdot:"\u010A",cdot:"\u010B",cedil:"\xB8",Cedilla:"\xB8",cemptyv:"\u29B2",cent:"\xA2",CenterDot:"\xB7",centerdot:"\xB7",Cfr:"\u212D",cfr:"\u{1D520}",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03A7",chi:"\u03C7",cir:"\u25CB",circ:"\u02C6",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",CircleDot:"\u2299",circledR:"\xAE",circledS:"\u24C8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cirE:"\u29C3",cire:"\u2257",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",Colon:"\u2237",colon:":",Colone:"\u2A74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2A6D",Congruent:"\u2261",Conint:"\u222F",conint:"\u222E",ContourIntegral:"\u222E",Copf:"\u2102",copf:"\u{1D554}",coprod:"\u2210",Coproduct:"\u2210",COPY:"\xA9",copy:"\xA9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21B5",Cross:"\u2A2F",cross:"\u2717",Cscr:"\u{1D49E}",cscr:"\u{1D4B8}",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",Cup:"\u22D3",cup:"\u222A",cupbrcap:"\u2A48",CupCap:"\u224D",cupcap:"\u2A46",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarr:"\u21B7",curarrm:"\u293C",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curren:"\xA4",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",cuvee:"\u22CE",cuwed:"\u22CF",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232D",Dagger:"\u2021",dagger:"\u2020",daleth:"\u2138",Darr:"\u21A1",dArr:"\u21D3",darr:"\u2193",dash:"\u2010",Dashv:"\u2AE4",dashv:"\u22A3",dbkarow:"\u290F",dblac:"\u02DD",Dcaron:"\u010E",dcaron:"\u010F",Dcy:"\u0414",dcy:"\u0434",DD:"\u2145",dd:"\u2146",ddagger:"\u2021",ddarr:"\u21CA",DDotrahd:"\u2911",ddotseq:"\u2A77",deg:"\xB0",Del:"\u2207",Delta:"\u0394",delta:"\u03B4",demptyv:"\u29B1",dfisht:"\u297F",Dfr:"\u{1D507}",dfr:"\u{1D521}",dHar:"\u2965",dharl:"\u21C3",dharr:"\u21C2",DiacriticalAcute:"\xB4",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",DiacriticalGrave:"`",DiacriticalTilde:"\u02DC",diam:"\u22C4",Diamond:"\u22C4",diamond:"\u22C4",diamondsuit:"\u2666",diams:"\u2666",die:"\xA8",DifferentialD:"\u2146",digamma:"\u03DD",disin:"\u22F2",div:"\xF7",divide:"\xF7",divideontimes:"\u22C7",divonx:"\u22C7",DJcy:"\u0402",djcy:"\u0452",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",Dopf:"\u{1D53B}",dopf:"\u{1D555}",Dot:"\xA8",dot:"\u02D9",DotDot:"\u20DC",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22A1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222F",DoubleDot:"\xA8",DoubleDownArrow:"\u21D3",DoubleLeftArrow:"\u21D0",DoubleLeftRightArrow:"\u21D4",DoubleLeftTee:"\u2AE4",DoubleLongLeftArrow:"\u27F8",DoubleLongLeftRightArrow:"\u27FA",DoubleLongRightArrow:"\u27F9",DoubleRightArrow:"\u21D2",DoubleRightTee:"\u22A8",DoubleUpArrow:"\u21D1",DoubleUpDownArrow:"\u21D5",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",Downarrow:"\u21D3",downarrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVector:"\u21BD",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295F",DownRightVector:"\u21C1",DownRightVectorBar:"\u2957",DownTee:"\u22A4",DownTeeArrow:"\u21A7",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",Dscr:"\u{1D49F}",dscr:"\u{1D4B9}",DScy:"\u0405",dscy:"\u0455",dsol:"\u29F6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",DZcy:"\u040F",dzcy:"\u045F",dzigrarr:"\u27FF",Eacute:"\xC9",eacute:"\xE9",easter:"\u2A6E",Ecaron:"\u011A",ecaron:"\u011B",ecir:"\u2256",Ecirc:"\xCA",ecirc:"\xEA",ecolon:"\u2255",Ecy:"\u042D",ecy:"\u044D",eDDot:"\u2A77",Edot:"\u0116",eDot:"\u2251",edot:"\u0117",ee:"\u2147",efDot:"\u2252",Efr:"\u{1D508}",efr:"\u{1D522}",eg:"\u2A9A",Egrave:"\xC8",egrave:"\xE8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",Element:"\u2208",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25FB",emptyv:"\u2205",EmptyVerySmallSquare:"\u25AB",emsp:"\u2003",emsp13:"\u2004",emsp14:"\u2005",ENG:"\u014A",eng:"\u014B",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\u{1D53C}",eopf:"\u{1D556}",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",Epsilon:"\u0395",epsilon:"\u03B5",epsiv:"\u03F5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2A96",eqslantless:"\u2A95",Equal:"\u2A75",equals:"=",EqualTilde:"\u2242",equest:"\u225F",Equilibrium:"\u21CC",equiv:"\u2261",equivDD:"\u2A78",eqvparsl:"\u29E5",erarr:"\u2971",erDot:"\u2253",Escr:"\u2130",escr:"\u212F",esdot:"\u2250",Esim:"\u2A73",esim:"\u2242",Eta:"\u0397",eta:"\u03B7",ETH:"\xD0",eth:"\xF0",Euml:"\xCB",euml:"\xEB",euro:"\u20AC",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",ExponentialE:"\u2147",exponentiale:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",Ffr:"\u{1D509}",ffr:"\u{1D523}",filig:"\uFB01",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",Fopf:"\u{1D53D}",fopf:"\u{1D557}",ForAll:"\u2200",forall:"\u2200",fork:"\u22D4",forkv:"\u2AD9",Fouriertrf:"\u2131",fpartint:"\u2A0D",frac12:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044",frown:"\u2322",Fscr:"\u2131",fscr:"\u{1D4BB}",gacute:"\u01F5",Gamma:"\u0393",gamma:"\u03B3",Gammad:"\u03DC",gammad:"\u03DD",gap:"\u2A86",Gbreve:"\u011E",gbreve:"\u011F",Gcedil:"\u0122",Gcirc:"\u011C",gcirc:"\u011D",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",gE:"\u2267",ge:"\u2265",gEl:"\u2A8C",gel:"\u22DB",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",ges:"\u2A7E",gescc:"\u2AA9",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",Gfr:"\u{1D50A}",gfr:"\u{1D524}",Gg:"\u22D9",gg:"\u226B",ggg:"\u22D9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gl:"\u2277",gla:"\u2AA5",glE:"\u2A92",glj:"\u2AA4",gnap:"\u2A8A",gnapprox:"\u2A8A",gnE:"\u2269",gne:"\u2A88",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",Gopf:"\u{1D53E}",gopf:"\u{1D558}",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",Gscr:"\u{1D4A2}",gscr:"\u210A",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",Gt:"\u226B",GT:">",gt:">",gtcc:"\u2AA7",gtcir:"\u2A7A",gtdot:"\u22D7",gtlPar:"\u2995",gtquest:"\u2A7C",gtrapprox:"\u2A86",gtrarr:"\u2978",gtrdot:"\u22D7",gtreqless:"\u22DB",gtreqqless:"\u2A8C",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\uFE00",gvnE:"\u2269\uFE00",Hacek:"\u02C7",hairsp:"\u200A",half:"\xBD",hamilt:"\u210B",HARDcy:"\u042A",hardcy:"\u044A",hArr:"\u21D4",harr:"\u2194",harrcir:"\u2948",harrw:"\u21AD",Hat:"^",hbar:"\u210F",Hcirc:"\u0124",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22B9",Hfr:"\u210C",hfr:"\u{1D525}",HilbertSpace:"\u210B",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21FF",homtht:"\u223B",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",Hopf:"\u210D",hopf:"\u{1D559}",horbar:"\u2015",HorizontalLine:"\u2500",Hscr:"\u210B",hscr:"\u{1D4BD}",hslash:"\u210F",Hstrok:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224E",HumpEqual:"\u224F",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xCD",iacute:"\xED",ic:"\u2063",Icirc:"\xCE",icirc:"\xEE",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xA1",iff:"\u21D4",Ifr:"\u2111",ifr:"\u{1D526}",Igrave:"\xCC",igrave:"\xEC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Im:"\u2111",Imacr:"\u012A",imacr:"\u012B",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",imof:"\u22B7",imped:"\u01B5",Implies:"\u21D2",in:"\u2208",incare:"\u2105",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",Int:"\u222C",int:"\u222B",intcal:"\u22BA",integers:"\u2124",Integral:"\u222B",intercal:"\u22BA",Intersection:"\u22C2",intlarhk:"\u2A17",intprod:"\u2A3C",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012E",iogon:"\u012F",Iopf:"\u{1D540}",iopf:"\u{1D55A}",Iota:"\u0399",iota:"\u03B9",iprod:"\u2A3C",iquest:"\xBF",Iscr:"\u2110",iscr:"\u{1D4BE}",isin:"\u2208",isindot:"\u22F5",isinE:"\u22F9",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xCF",iuml:"\xEF",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\u{1D50D}",jfr:"\u{1D527}",jmath:"\u0237",Jopf:"\u{1D541}",jopf:"\u{1D55B}",Jscr:"\u{1D4A5}",jscr:"\u{1D4BF}",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039A",kappa:"\u03BA",kappav:"\u03F0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041A",kcy:"\u043A",Kfr:"\u{1D50E}",kfr:"\u{1D528}",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040C",kjcy:"\u045C",Kopf:"\u{1D542}",kopf:"\u{1D55C}",Kscr:"\u{1D4A6}",kscr:"\u{1D4C0}",lAarr:"\u21DA",Lacute:"\u0139",lacute:"\u013A",laemptyv:"\u29B4",lagran:"\u2112",Lambda:"\u039B",lambda:"\u03BB",Lang:"\u27EA",lang:"\u27E8",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",Laplacetrf:"\u2112",laquo:"\xAB",Larr:"\u219E",lArr:"\u21D0",larr:"\u2190",larrb:"\u21E4",larrbfs:"\u291F",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",lat:"\u2AAB",lAtail:"\u291B",latail:"\u2919",late:"\u2AAD",lates:"\u2AAD\uFE00",lBarr:"\u290E",lbarr:"\u290C",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",Lcaron:"\u013D",lcaron:"\u013E",Lcedil:"\u013B",lcedil:"\u013C",lceil:"\u2308",lcub:"{",Lcy:"\u041B",lcy:"\u043B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",lE:"\u2266",le:"\u2264",LeftAngleBracket:"\u27E8",LeftArrow:"\u2190",Leftarrow:"\u21D0",leftarrow:"\u2190",LeftArrowBar:"\u21E4",LeftArrowRightArrow:"\u21C6",leftarrowtail:"\u21A2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21C3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230A",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",LeftRightArrow:"\u2194",Leftrightarrow:"\u21D4",leftrightarrow:"\u2194",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",LeftRightVector:"\u294E",LeftTee:"\u22A3",LeftTeeArrow:"\u21A4",LeftTeeVector:"\u295A",leftthreetimes:"\u22CB",LeftTriangle:"\u22B2",LeftTriangleBar:"\u29CF",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21BF",LeftUpVectorBar:"\u2958",LeftVector:"\u21BC",LeftVectorBar:"\u2952",lEg:"\u2A8B",leg:"\u22DA",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",les:"\u2A7D",lescc:"\u2AA8",lesdot:"\u2A7F",lesdoto:"\u2A81",lesdotor:"\u2A83",lesg:"\u22DA\uFE00",lesges:"\u2A93",lessapprox:"\u2A85",lessdot:"\u22D6",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",LessEqualGreater:"\u22DA",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2AA1",lesssim:"\u2272",LessSlantEqual:"\u2A7D",LessTilde:"\u2272",lfisht:"\u297C",lfloor:"\u230A",Lfr:"\u{1D50F}",lfr:"\u{1D529}",lg:"\u2276",lgE:"\u2A91",lHar:"\u2962",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",Ll:"\u22D8",ll:"\u226A",llarr:"\u21C7",llcorner:"\u231E",Lleftarrow:"\u21DA",llhard:"\u296B",lltri:"\u25FA",Lmidot:"\u013F",lmidot:"\u0140",lmoust:"\u23B0",lmoustache:"\u23B0",lnap:"\u2A89",lnapprox:"\u2A89",lnE:"\u2268",lne:"\u2A87",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",LongLeftArrow:"\u27F5",Longleftarrow:"\u27F8",longleftarrow:"\u27F5",LongLeftRightArrow:"\u27F7",Longleftrightarrow:"\u27FA",longleftrightarrow:"\u27F7",longmapsto:"\u27FC",LongRightArrow:"\u27F6",Longrightarrow:"\u27F9",longrightarrow:"\u27F6",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",Lopf:"\u{1D543}",lopf:"\u{1D55D}",loplus:"\u2A2D",lotimes:"\u2A34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25CA",lozenge:"\u25CA",lozf:"\u29EB",lpar:"(",lparlt:"\u2993",lrarr:"\u21C6",lrcorner:"\u231F",lrhar:"\u21CB",lrhard:"\u296D",lrm:"\u200E",lrtri:"\u22BF",lsaquo:"\u2039",Lscr:"\u2112",lscr:"\u{1D4C1}",Lsh:"\u21B0",lsh:"\u21B0",lsim:"\u2272",lsime:"\u2A8D",lsimg:"\u2A8F",lsqb:"[",lsquo:"\u2018",lsquor:"\u201A",Lstrok:"\u0141",lstrok:"\u0142",Lt:"\u226A",LT:"<",lt:"<",ltcc:"\u2AA6",ltcir:"\u2A79",ltdot:"\u22D6",lthree:"\u22CB",ltimes:"\u22C9",ltlarr:"\u2976",ltquest:"\u2A7B",ltri:"\u25C3",ltrie:"\u22B4",ltrif:"\u25C2",ltrPar:"\u2996",lurdshar:"\u294A",luruhar:"\u2966",lvertneqq:"\u2268\uFE00",lvnE:"\u2268\uFE00",macr:"\xAF",male:"\u2642",malt:"\u2720",maltese:"\u2720",Map:"\u2905",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",Mcy:"\u041C",mcy:"\u043C",mdash:"\u2014",mDDot:"\u223A",measuredangle:"\u2221",MediumSpace:"\u205F",Mellintrf:"\u2133",Mfr:"\u{1D510}",mfr:"\u{1D52A}",mho:"\u2127",micro:"\xB5",mid:"\u2223",midast:"*",midcir:"\u2AF0",middot:"\xB7",minus:"\u2212",minusb:"\u229F",minusd:"\u2238",minusdu:"\u2A2A",MinusPlus:"\u2213",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",Mopf:"\u{1D544}",mopf:"\u{1D55E}",mp:"\u2213",Mscr:"\u2133",mscr:"\u{1D4C2}",mstpos:"\u223E",Mu:"\u039C",mu:"\u03BC",multimap:"\u22B8",mumap:"\u22B8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natur:"\u266E",natural:"\u266E",naturals:"\u2115",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",Ncy:"\u041D",ncy:"\u043D",ndash:"\u2013",ne:"\u2260",nearhk:"\u2924",neArr:"\u21D7",nearr:"\u2197",nearrow:"\u2197",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200B",NegativeThickSpace:"\u200B",NegativeThinSpace:"\u200B",NegativeVeryThinSpace:"\u200B",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226B",NestedLessLess:"\u226A",NewLine:` -`,nexist:"\u2204",nexists:"\u2204",Nfr:"\u{1D511}",nfr:"\u{1D52B}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",nGg:"\u22D9\u0338",ngsim:"\u2275",nGt:"\u226B\u20D2",ngt:"\u226F",ngtr:"\u226F",nGtv:"\u226B\u0338",nhArr:"\u21CE",nharr:"\u21AE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",NJcy:"\u040A",njcy:"\u045A",nlArr:"\u21CD",nlarr:"\u219A",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nLeftarrow:"\u21CD",nleftarrow:"\u219A",nLeftrightarrow:"\u21CE",nleftrightarrow:"\u21AE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nLl:"\u22D8\u0338",nlsim:"\u2274",nLt:"\u226A\u20D2",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nLtv:"\u226A\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xA0",Nopf:"\u2115",nopf:"\u{1D55F}",Not:"\u2AEC",not:"\xAC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",notin:"\u2209",notindot:"\u22F5\u0338",notinE:"\u22F9\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",NotLeftTriangle:"\u22EA",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangle:"\u22EB",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",npar:"\u2226",nparallel:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",npre:"\u2AAF\u0338",nprec:"\u2280",npreceq:"\u2AAF\u0338",nrArr:"\u21CF",nrarr:"\u219B",nrarrc:"\u2933\u0338",nrarrw:"\u219D\u0338",nRightarrow:"\u21CF",nrightarrow:"\u219B",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",Nscr:"\u{1D4A9}",nscr:"\u{1D4C3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",Ntilde:"\xD1",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",Nu:"\u039D",nu:"\u03BD",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224D\u20D2",nVDash:"\u22AF",nVdash:"\u22AE",nvDash:"\u22AD",nvdash:"\u22AC",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvHarr:"\u2904",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwarhk:"\u2923",nwArr:"\u21D6",nwarr:"\u2196",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xD3",oacute:"\xF3",oast:"\u229B",ocir:"\u229A",Ocirc:"\xD4",ocirc:"\xF4",Ocy:"\u041E",ocy:"\u043E",odash:"\u229D",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29BF",Ofr:"\u{1D512}",ofr:"\u{1D52C}",ogon:"\u02DB",Ograve:"\xD2",ograve:"\xF2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",Omacr:"\u014C",omacr:"\u014D",Omega:"\u03A9",omega:"\u03C9",Omicron:"\u039F",omicron:"\u03BF",omid:"\u29B6",ominus:"\u2296",Oopf:"\u{1D546}",oopf:"\u{1D560}",opar:"\u29B7",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",operp:"\u29B9",oplus:"\u2295",Or:"\u2A54",or:"\u2228",orarr:"\u21BB",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oS:"\u24C8",Oscr:"\u{1D4AA}",oscr:"\u2134",Oslash:"\xD8",oslash:"\xF8",osol:"\u2298",Otilde:"\xD5",otilde:"\xF5",Otimes:"\u2A37",otimes:"\u2297",otimesas:"\u2A36",Ouml:"\xD6",ouml:"\xF6",ovbar:"\u233D",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",par:"\u2225",para:"\xB6",parallel:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",PartialD:"\u2202",Pcy:"\u041F",pcy:"\u043F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",Pfr:"\u{1D513}",pfr:"\u{1D52D}",Phi:"\u03A6",phi:"\u03C6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",Pi:"\u03A0",pi:"\u03C0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plus:"+",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plusdo:"\u2214",plusdu:"\u2A25",pluse:"\u2A72",PlusMinus:"\xB1",plusmn:"\xB1",plussim:"\u2A26",plustwo:"\u2A27",pm:"\xB1",Poincareplane:"\u210C",pointint:"\u2A15",Popf:"\u2119",popf:"\u{1D561}",pound:"\xA3",Pr:"\u2ABB",pr:"\u227A",prap:"\u2AB7",prcue:"\u227C",prE:"\u2AB3",pre:"\u2AAF",prec:"\u227A",precapprox:"\u2AB7",preccurlyeq:"\u227C",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",precsim:"\u227E",Prime:"\u2033",prime:"\u2032",primes:"\u2119",prnap:"\u2AB9",prnE:"\u2AB5",prnsim:"\u22E8",prod:"\u220F",Product:"\u220F",profalar:"\u232E",profline:"\u2312",profsurf:"\u2313",prop:"\u221D",Proportion:"\u2237",Proportional:"\u221D",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",Pscr:"\u{1D4AB}",pscr:"\u{1D4C5}",Psi:"\u03A8",psi:"\u03C8",puncsp:"\u2008",Qfr:"\u{1D514}",qfr:"\u{1D52E}",qint:"\u2A0C",Qopf:"\u211A",qopf:"\u{1D562}",qprime:"\u2057",Qscr:"\u{1D4AC}",qscr:"\u{1D4C6}",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",QUOT:'"',quot:'"',rAarr:"\u21DB",race:"\u223D\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221A",raemptyv:"\u29B3",Rang:"\u27EB",rang:"\u27E9",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",Rarr:"\u21A0",rArr:"\u21D2",rarr:"\u2192",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21A3",rarrw:"\u219D",rAtail:"\u291C",ratail:"\u291A",ratio:"\u2236",rationals:"\u211A",RBarr:"\u2910",rBarr:"\u290F",rbarr:"\u290D",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298C",rbrksld:"\u298E",rbrkslu:"\u2990",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",Re:"\u211C",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",rect:"\u25AD",REG:"\xAE",reg:"\xAE",ReverseElement:"\u220B",ReverseEquilibrium:"\u21CB",ReverseUpEquilibrium:"\u296F",rfisht:"\u297D",rfloor:"\u230B",Rfr:"\u211C",rfr:"\u{1D52F}",rHar:"\u2964",rhard:"\u21C1",rharu:"\u21C0",rharul:"\u296C",Rho:"\u03A1",rho:"\u03C1",rhov:"\u03F1",RightAngleBracket:"\u27E9",RightArrow:"\u2192",Rightarrow:"\u21D2",rightarrow:"\u2192",RightArrowBar:"\u21E5",RightArrowLeftArrow:"\u21C4",rightarrowtail:"\u21A3",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVector:"\u21C2",RightDownVectorBar:"\u2955",RightFloor:"\u230B",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",RightTee:"\u22A2",RightTeeArrow:"\u21A6",RightTeeVector:"\u295B",rightthreetimes:"\u22CC",RightTriangle:"\u22B3",RightTriangleBar:"\u29D0",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVector:"\u21BE",RightUpVectorBar:"\u2954",RightVector:"\u21C0",RightVectorBar:"\u2953",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoust:"\u23B1",rmoustache:"\u23B1",rnmid:"\u2AEE",roang:"\u27ED",roarr:"\u21FE",robrk:"\u27E7",ropar:"\u2986",Ropf:"\u211D",ropf:"\u{1D563}",roplus:"\u2A2E",rotimes:"\u2A35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2A12",rrarr:"\u21C9",Rrightarrow:"\u21DB",rsaquo:"\u203A",Rscr:"\u211B",rscr:"\u{1D4C7}",Rsh:"\u21B1",rsh:"\u21B1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22CC",rtimes:"\u22CA",rtri:"\u25B9",rtrie:"\u22B5",rtrif:"\u25B8",rtriltri:"\u29CE",RuleDelayed:"\u29F4",ruluhar:"\u2968",rx:"\u211E",Sacute:"\u015A",sacute:"\u015B",sbquo:"\u201A",Sc:"\u2ABC",sc:"\u227B",scap:"\u2AB8",Scaron:"\u0160",scaron:"\u0161",sccue:"\u227D",scE:"\u2AB4",sce:"\u2AB0",Scedil:"\u015E",scedil:"\u015F",Scirc:"\u015C",scirc:"\u015D",scnap:"\u2ABA",scnE:"\u2AB6",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",Scy:"\u0421",scy:"\u0441",sdot:"\u22C5",sdotb:"\u22A1",sdote:"\u2A66",searhk:"\u2925",seArr:"\u21D8",searr:"\u2198",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\u{1D516}",sfr:"\u{1D530}",sfrown:"\u2322",sharp:"\u266F",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xAD",Sigma:"\u03A3",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",sim:"\u223C",simdot:"\u2A6A",sime:"\u2243",simeq:"\u2243",simg:"\u2A9E",simgE:"\u2AA0",siml:"\u2A9D",simlE:"\u2A9F",simne:"\u2246",simplus:"\u2A24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2A33",smeparsl:"\u29E4",smid:"\u2223",smile:"\u2323",smt:"\u2AAA",smte:"\u2AAC",smtes:"\u2AAC\uFE00",SOFTcy:"\u042C",softcy:"\u044C",sol:"/",solb:"\u29C4",solbar:"\u233F",Sopf:"\u{1D54A}",sopf:"\u{1D564}",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\uFE00",sqcup:"\u2294",sqcups:"\u2294\uFE00",Sqrt:"\u221A",sqsub:"\u228F",sqsube:"\u2291",sqsubset:"\u228F",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",squ:"\u25A1",Square:"\u25A1",square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25AA",squf:"\u25AA",srarr:"\u2192",Sscr:"\u{1D4AE}",sscr:"\u{1D4C8}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",Star:"\u22C6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",Sub:"\u22D0",sub:"\u2282",subdot:"\u2ABD",subE:"\u2AC5",sube:"\u2286",subedot:"\u2AC3",submult:"\u2AC1",subnE:"\u2ACB",subne:"\u228A",subplus:"\u2ABF",subrarr:"\u2979",Subset:"\u22D0",subset:"\u2282",subseteq:"\u2286",subseteqq:"\u2AC5",SubsetEqual:"\u2286",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succ:"\u227B",succapprox:"\u2AB8",succcurlyeq:"\u227D",Succeeds:"\u227B",SucceedsEqual:"\u2AB0",SucceedsSlantEqual:"\u227D",SucceedsTilde:"\u227F",succeq:"\u2AB0",succnapprox:"\u2ABA",succneqq:"\u2AB6",succnsim:"\u22E9",succsim:"\u227F",SuchThat:"\u220B",Sum:"\u2211",sum:"\u2211",sung:"\u266A",Sup:"\u22D1",sup:"\u2283",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",supdot:"\u2ABE",supdsub:"\u2AD8",supE:"\u2AC6",supe:"\u2287",supedot:"\u2AC4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supnE:"\u2ACC",supne:"\u228B",supplus:"\u2AC0",Supset:"\u22D1",supset:"\u2283",supseteq:"\u2287",supseteqq:"\u2AC6",supsetneq:"\u228B",supsetneqq:"\u2ACC",supsim:"\u2AC8",supsub:"\u2AD4",supsup:"\u2AD6",swarhk:"\u2926",swArr:"\u21D9",swarr:"\u2199",swarrow:"\u2199",swnwar:"\u292A",szlig:"\xDF",Tab:" ",target:"\u2316",Tau:"\u03A4",tau:"\u03C4",tbrk:"\u23B4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20DB",telrec:"\u2315",Tfr:"\u{1D517}",tfr:"\u{1D531}",there4:"\u2234",Therefore:"\u2234",therefore:"\u2234",Theta:"\u0398",theta:"\u03B8",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",ThickSpace:"\u205F\u200A",thinsp:"\u2009",ThinSpace:"\u2009",thkap:"\u2248",thksim:"\u223C",THORN:"\xDE",thorn:"\xFE",Tilde:"\u223C",tilde:"\u02DC",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",times:"\xD7",timesb:"\u22A0",timesbar:"\u2A31",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",top:"\u22A4",topbot:"\u2336",topcir:"\u2AF1",Topf:"\u{1D54B}",topf:"\u{1D565}",topfork:"\u2ADA",tosa:"\u2929",tprime:"\u2034",TRADE:"\u2122",trade:"\u2122",triangle:"\u25B5",triangledown:"\u25BF",triangleleft:"\u25C3",trianglelefteq:"\u22B4",triangleq:"\u225C",triangleright:"\u25B9",trianglerighteq:"\u22B5",tridot:"\u25EC",trie:"\u225C",triminus:"\u2A3A",TripleDot:"\u20DB",triplus:"\u2A39",trisb:"\u29CD",tritime:"\u2A3B",trpezium:"\u23E2",Tscr:"\u{1D4AF}",tscr:"\u{1D4C9}",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040B",tshcy:"\u045B",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",Uacute:"\xDA",uacute:"\xFA",Uarr:"\u219F",uArr:"\u21D1",uarr:"\u2191",Uarrocir:"\u2949",Ubrcy:"\u040E",ubrcy:"\u045E",Ubreve:"\u016C",ubreve:"\u016D",Ucirc:"\xDB",ucirc:"\xFB",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21C5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296E",ufisht:"\u297E",Ufr:"\u{1D518}",ufr:"\u{1D532}",Ugrave:"\xD9",ugrave:"\xF9",uHar:"\u2963",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",Umacr:"\u016A",umacr:"\u016B",uml:"\xA8",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",Uogon:"\u0172",uogon:"\u0173",Uopf:"\u{1D54C}",uopf:"\u{1D566}",UpArrow:"\u2191",Uparrow:"\u21D1",uparrow:"\u2191",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21C5",UpDownArrow:"\u2195",Updownarrow:"\u21D5",updownarrow:"\u2195",UpEquilibrium:"\u296E",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",Upsi:"\u03D2",upsi:"\u03C5",upsih:"\u03D2",Upsilon:"\u03A5",upsilon:"\u03C5",UpTee:"\u22A5",UpTeeArrow:"\u21A5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",Uring:"\u016E",uring:"\u016F",urtri:"\u25F9",Uscr:"\u{1D4B0}",uscr:"\u{1D4CA}",utdot:"\u22F0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",Uuml:"\xDC",uuml:"\xFC",uwangle:"\u29A7",vangrt:"\u299C",varepsilon:"\u03F5",varkappa:"\u03F0",varnothing:"\u2205",varphi:"\u03D5",varpi:"\u03D6",varpropto:"\u221D",vArr:"\u21D5",varr:"\u2195",varrho:"\u03F1",varsigma:"\u03C2",varsubsetneq:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vartheta:"\u03D1",vartriangleleft:"\u22B2",vartriangleright:"\u22B3",Vbar:"\u2AEB",vBar:"\u2AE8",vBarv:"\u2AE9",Vcy:"\u0412",vcy:"\u0432",VDash:"\u22AB",Vdash:"\u22A9",vDash:"\u22A8",vdash:"\u22A2",Vdashl:"\u2AE6",Vee:"\u22C1",vee:"\u2228",veebar:"\u22BB",veeeq:"\u225A",vellip:"\u22EE",Verbar:"\u2016",verbar:"|",Vert:"\u2016",vert:"|",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",Vfr:"\u{1D519}",vfr:"\u{1D533}",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",Vopf:"\u{1D54D}",vopf:"\u{1D567}",vprop:"\u221D",vrtri:"\u22B3",Vscr:"\u{1D4B1}",vscr:"\u{1D4CB}",vsubnE:"\u2ACB\uFE00",vsubne:"\u228A\uFE00",vsupnE:"\u2ACC\uFE00",vsupne:"\u228B\uFE00",Vvdash:"\u22AA",vzigzag:"\u299A",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2A5F",Wedge:"\u22C0",wedge:"\u2227",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\u{1D51A}",wfr:"\u{1D534}",Wopf:"\u{1D54E}",wopf:"\u{1D568}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\u{1D4B2}",wscr:"\u{1D4CC}",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",Xfr:"\u{1D51B}",xfr:"\u{1D535}",xhArr:"\u27FA",xharr:"\u27F7",Xi:"\u039E",xi:"\u03BE",xlArr:"\u27F8",xlarr:"\u27F5",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",Xopf:"\u{1D54F}",xopf:"\u{1D569}",xoplus:"\u2A01",xotime:"\u2A02",xrArr:"\u27F9",xrarr:"\u27F6",Xscr:"\u{1D4B3}",xscr:"\u{1D4CD}",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",Yacute:"\xDD",yacute:"\xFD",YAcy:"\u042F",yacy:"\u044F",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042B",ycy:"\u044B",yen:"\xA5",Yfr:"\u{1D51C}",yfr:"\u{1D536}",YIcy:"\u0407",yicy:"\u0457",Yopf:"\u{1D550}",yopf:"\u{1D56A}",Yscr:"\u{1D4B4}",yscr:"\u{1D4CE}",YUcy:"\u042E",yucy:"\u044E",Yuml:"\u0178",yuml:"\xFF",Zacute:"\u0179",zacute:"\u017A",Zcaron:"\u017D",zcaron:"\u017E",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017B",zdot:"\u017C",zeetrf:"\u2128",ZeroWidthSpace:"\u200B",Zeta:"\u0396",zeta:"\u03B6",Zfr:"\u2128",zfr:"\u{1D537}",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21DD",Zopf:"\u2124",zopf:"\u{1D56B}",Zscr:"\u{1D4B5}",zscr:"\u{1D4CF}",zwj:"\u200D",zwnj:"\u200C"});dl.entityMap=dl.HTML_ENTITIES});var Rd=xa(ch=>{var _l=ol().NAMESPACE,uh=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,Id=new RegExp("[\\-\\.0-9"+uh.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),kd=new RegExp("^"+uh.source+Id.source+"*(?::"+uh.source+Id.source+"*)?$"),fl=0,ba=1,Hs=2,ml=3,Xs=4,Ws=5,gl=6,Iu=7;function Js(w,S){this.message=w,this.locator=S,Error.captureStackTrace&&Error.captureStackTrace(this,Js)}Js.prototype=new Error;Js.prototype.name=Js.name;function zd(){}zd.prototype={parse:function(w,S,F){var K=this.domBuilder;K.startDocument(),Bd(S,S={}),h0(w,S,F,K,this.errorHandler),K.endDocument()}};function h0(w,S,F,K,E){function p(Qe){if(Qe>65535){Qe-=65536;var ft=55296+(Qe>>10),je=56320+(Qe&1023);return String.fromCharCode(ft,je)}else return String.fromCharCode(Qe)}function ue(Qe){var ft=Qe.slice(1,-1);return Object.hasOwnProperty.call(F,ft)?F[ft]:ft.charAt(0)==="#"?p(parseInt(ft.substr(1).replace("x","0x"))):(E.error("entity not found:"+Qe),Qe)}function pe(Qe){if(Qe>Pt){var ft=w.substring(Pt,Qe).replace(/&#?\w+;/g,ue);yt&&De(Pt),K.characters(ft,0,Qe-Pt),Pt=Qe}}function De(Qe,ft){for(;Qe>=X&&(ft=Mt.exec(w));)se=ft.index,X=se+ft[0].length,yt.lineNumber++;yt.columnNumber=Qe-se+1}for(var se=0,X=0,Mt=/.*(?:\r\n?|\n)|.*$/g,yt=K.locator,Ct=[{currentNSMap:S}],li={},Pt=0;;){try{var zt=w.indexOf("<",Pt);if(zt<0){if(!w.substr(Pt).match(/^\s*$/)){var jt=K.doc,xe=jt.createTextNode(w.substr(Pt));jt.appendChild(xe),K.currentElement=xe}return}switch(zt>Pt&&pe(zt),w.charAt(zt+1)){case"/":var we=w.indexOf(">",zt+3),Se=w.substring(zt+2,we).replace(/[ \t\n\r]+$/g,""),Me=Ct.pop();we<0?(Se=w.substring(zt+2).replace(/[\s<].*/,""),E.error("end tag name: "+Se+" is not complete:"+Me.tagName),we=zt+1+Se.length):Se.match(/\sPt?Pt=we:pe(Math.max(zt,Pt)+1)}}function Md(w,S){return S.lineNumber=w.lineNumber,S.columnNumber=w.columnNumber,S}function p0(w,S,F,K,E,p){function ue(Ct,li,Pt){F.attributeNames.hasOwnProperty(Ct)&&p.fatalError("Attribute "+Ct+" redefined"),F.addValue(Ct,li.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,E),Pt)}for(var pe,De,se=++S,X=fl;;){var Mt=w.charAt(se);switch(Mt){case"=":if(X===ba)pe=w.slice(S,se),X=ml;else if(X===Hs)X=ml;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(X===ml||X===ba)if(X===ba&&(p.warning('attribute value must after "="'),pe=w.slice(S,se)),S=se+1,se=w.indexOf(Mt,S),se>0)De=w.slice(S,se),ue(pe,De,S-1),X=Ws;else throw new Error("attribute value no end '"+Mt+"' match");else if(X==Xs)De=w.slice(S,se),ue(pe,De,S),p.warning('attribute "'+pe+'" missed start quot('+Mt+")!!"),S=se+1,X=Ws;else throw new Error('attribute value must after "="');break;case"/":switch(X){case fl:F.setTagName(w.slice(S,se));case Ws:case gl:case Iu:X=Iu,F.closed=!0;case Xs:case ba:break;case Hs:F.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return p.error("unexpected end of input"),X==fl&&F.setTagName(w.slice(S,se)),se;case">":switch(X){case fl:F.setTagName(w.slice(S,se));case Ws:case gl:case Iu:break;case Xs:case ba:De=w.slice(S,se),De.slice(-1)==="/"&&(F.closed=!0,De=De.slice(0,-1));case Hs:X===Hs&&(De=pe),X==Xs?(p.warning('attribute "'+De+'" missed quot(")!'),ue(pe,De,S)):((!_l.isHTML(K[""])||!De.match(/^(?:disabled|checked|selected)$/i))&&p.warning('attribute "'+De+'" missed value!! "'+De+'" instead!!'),ue(De,De,S));break;case ml:throw new Error("attribute value missed!!")}return se;case"\x80":Mt=" ";default:if(Mt<=" ")switch(X){case fl:F.setTagName(w.slice(S,se)),X=gl;break;case ba:pe=w.slice(S,se),X=Hs;break;case Xs:var De=w.slice(S,se);p.warning('attribute "'+De+'" missed quot(")!!'),ue(pe,De,S);case Ws:X=gl;break}else switch(X){case Hs:var yt=F.tagName;(!_l.isHTML(K[""])||!pe.match(/^(?:disabled|checked|selected)$/i))&&p.warning('attribute "'+pe+'" missed value!! "'+pe+'" instead2!!'),ue(pe,pe,S),S=se,X=ba;break;case Ws:p.warning('attribute space is required"'+pe+'"!!');case gl:X=ba,S=se;break;case ml:X=Xs,S=se;break;case Iu:throw new Error("elements closed character '/' and '>' must be connected to")}}se++}}function Pd(w,S,F){for(var K=w.tagName,E=null,Mt=w.length;Mt--;){var p=w[Mt],ue=p.qName,pe=p.value,yt=ue.indexOf(":");if(yt>0)var De=p.prefix=ue.slice(0,yt),se=ue.slice(yt+1),X=De==="xmlns"&&se;else se=ue,De=null,X=ue==="xmlns"&&"";p.localName=se,X!==!1&&(E==null&&(E={},Bd(F,F={})),F[X]=E[X]=pe,p.uri=_l.XMLNS,S.startPrefixMapping(X,pe))}for(var Mt=w.length;Mt--;){p=w[Mt];var De=p.prefix;De&&(De==="xml"&&(p.uri=_l.XML),De!=="xmlns"&&(p.uri=F[De||""]))}var yt=K.indexOf(":");yt>0?(De=w.prefix=K.slice(0,yt),se=w.localName=K.slice(yt+1)):(De=null,se=w.localName=K);var Ct=w.uri=F[De||""];if(S.startElement(Ct,se,K,w),w.closed){if(S.endElement(Ct,se,K),E)for(De in E)Object.prototype.hasOwnProperty.call(E,De)&&S.endPrefixMapping(De)}else return w.currentNSMap=F,w.localNSMap=E,!0}function d0(w,S,F,K,E){if(/^(?:script|textarea)$/i.test(F)){var p=w.indexOf("",S),ue=w.substring(S+1,p);if(/[&<]/.test(ue))return/^script$/i.test(F)?(E.characters(ue,0,ue.length),p):(ue=ue.replace(/&#?\w+;/g,K),E.characters(ue,0,ue.length),p)}return S+1}function f0(w,S,F,K){var E=K[F];return E==null&&(E=w.lastIndexOf(""),E",S+4);return p>S?(F.comment(w,S+4,p-S-4),p+3):(K.error("Unclosed comment"),-1)}else return-1;default:if(w.substr(S+3,6)=="CDATA["){var p=w.indexOf("]]>",S+9);return F.startCDATA(),F.characters(w,S+9,p-S-9),F.endCDATA(),p+3}var ue=_0(w,S),pe=ue.length;if(pe>1&&/!doctype/i.test(ue[0][0])){var De=ue[1][0],se=!1,X=!1;pe>3&&(/^public$/i.test(ue[2][0])?(se=ue[3][0],X=pe>4&&ue[4][0]):/^system$/i.test(ue[2][0])&&(X=ue[3][0]));var Mt=ue[pe-1];return F.startDTD(De,se,X),F.endDTD(),Mt.index+Mt[0].length}}return-1}function g0(w,S,F){var K=w.indexOf("?>",S);if(K){var E=w.substring(S,K).match(/^<\?(\S*)\s*([\s\S]*?)$/);if(E){var p=E[0].length;return F.processingInstruction(E[1],E[2]),K+2}else return-1}return-1}function Ld(){this.attributeNames={}}Ld.prototype={setTagName:function(w){if(!kd.test(w))throw new Error("invalid tagName:"+w);this.tagName=w},addValue:function(w,S,F){if(!kd.test(w))throw new Error("invalid attribute:"+w);this.attributeNames[w]=this.length,this[this.length++]={qName:w,value:S,offset:F}},length:0,getLocalName:function(w){return this[w].localName},getLocator:function(w){return this[w].locator},getQName:function(w){return this[w].qName},getURI:function(w){return this[w].uri},getValue:function(w){return this[w].value}};function _0(w,S){var F,K=[],E=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(E.lastIndex=S,E.exec(w);F=E.exec(w);)if(K.push(F),F[1])return K}ch.XMLReader=zd;ch.ParseError=Js});var jd=xa(Mu=>{var y0=ol(),v0=lh(),Fd=Sd(),qd=Rd(),x0=v0.DOMImplementation,Od=y0.NAMESPACE,b0=qd.ParseError,w0=qd.XMLReader;function Vd(w){return w.replace(/\r[\n\u0085]/g,` +`),X=Z.concat(ln.prelude.vertexSource,n.vertexSource).join(` +`),N=_.createShader(_.FRAGMENT_SHADER);if(_.isContextLost())return void(this.failedToCreate=!0);if(_.shaderSource(N,G),_.compileShader(N),!_.getShaderParameter(N,_.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${_.getShaderInfoLog(N)}`);_.attachShader(this.program,N);let Q=_.createShader(_.VERTEX_SHADER);if(_.isContextLost())return void(this.failedToCreate=!0);if(_.shaderSource(Q,X),_.compileShader(Q),!_.getShaderParameter(Q,_.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${_.getShaderInfoLog(Q)}`);_.attachShader(this.program,Q),this.attributes={};let te={};this.numAttributes=T.length;for(let ae=0;ae({u_depth:new p.aH(ae,fe.u_depth),u_terrain:new p.aH(ae,fe.u_terrain),u_terrain_dim:new p.aI(ae,fe.u_terrain_dim),u_terrain_matrix:new p.aJ(ae,fe.u_terrain_matrix),u_terrain_unpack:new p.aK(ae,fe.u_terrain_unpack),u_terrain_exaggeration:new p.aI(ae,fe.u_terrain_exaggeration)}))(e,te),this.binderUniforms=s?s.getUniforms(e,te):[]}draw(e,n,s,o,u,m,_,y,b,T,C,P,L,O,U,Z,G,X){let N=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(s),e.setStencilMode(o),e.setColorMode(u),e.setCullFace(m),y){e.activeTexture.set(N.TEXTURE2),N.bindTexture(N.TEXTURE_2D,y.depthTexture),e.activeTexture.set(N.TEXTURE3),N.bindTexture(N.TEXTURE_2D,y.texture);for(let te in this.terrainUniforms)this.terrainUniforms[te].set(y[te])}for(let te in this.fixedUniforms)this.fixedUniforms[te].set(_[te]);U&&U.setUniforms(e,this.binderUniforms,L,{zoom:O});let Q=0;switch(n){case N.LINES:Q=2;break;case N.TRIANGLES:Q=3;break;case N.LINE_STRIP:Q=1}for(let te of P.get()){let ae=te.vaos||(te.vaos={});(ae[b]||(ae[b]=new to)).bind(e,this,T,U?U.getPaintVertexBuffers():[],C,te.vertexOffset,Z,G,X),N.drawElements(n,te.primitiveLength*Q,N.UNSIGNED_SHORT,te.primitiveOffset*Q*2)}}}function Ka(c,e,n){let s=1/Ct(n,1,e.transform.tileZoom),o=Math.pow(2,n.tileID.overscaledZ),u=n.tileSize*Math.pow(2,e.transform.tileZoom)/o,m=u*(n.tileID.canonical.x+n.tileID.wrap*o),_=u*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[s,c.fromScale,c.toScale],u_fade:c.t,u_pixel_coord_upper:[m>>16,_>>16],u_pixel_coord_lower:[65535&m,65535&_]}}let Aa=(c,e,n,s)=>{let o=e.style.light,u=o.properties.get("position"),m=[u.x,u.y,u.z],_=function(){var b=new p.A(9);return p.A!=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}();o.properties.get("anchor")==="viewport"&&function(b,T){var C=Math.sin(T),P=Math.cos(T);b[0]=P,b[1]=C,b[2]=0,b[3]=-C,b[4]=P,b[5]=0,b[6]=0,b[7]=0,b[8]=1}(_,-e.transform.angle),function(b,T,C){var P=T[0],L=T[1],O=T[2];b[0]=P*C[0]+L*C[3]+O*C[6],b[1]=P*C[1]+L*C[4]+O*C[7],b[2]=P*C[2]+L*C[5]+O*C[8]}(m,m,_);let y=o.properties.get("color");return{u_matrix:c,u_lightpos:m,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[y.r,y.g,y.b],u_vertical_gradient:+n,u_opacity:s}},Ya=(c,e,n,s,o,u,m)=>p.e(Aa(c,e,n,s),Ka(u,e,m),{u_height_factor:-Math.pow(2,o.overscaledZ)/m.tileSize/8}),jn=c=>({u_matrix:c}),vl=(c,e,n,s)=>p.e(jn(c),Ka(n,e,s)),Lu=(c,e)=>({u_matrix:c,u_world:e}),xl=(c,e,n,s,o)=>p.e(vl(c,e,n,s),{u_world:o}),Ru=(c,e,n,s)=>{let o=c.transform,u,m;if(s.paint.get("circle-pitch-alignment")==="map"){let _=Ct(n,1,o.zoom);u=!0,m=[_,_]}else u=!1,m=o.pixelsToGLUnits;return{u_camera_to_center_distance:o.cameraToCenterDistance,u_scale_with_map:+(s.paint.get("circle-pitch-scale")==="map"),u_matrix:c.translatePosMatrix(e.posMatrix,n,s.paint.get("circle-translate"),s.paint.get("circle-translate-anchor")),u_pitch_with_map:+u,u_device_pixel_ratio:c.pixelRatio,u_extrude_scale:m}},bn=(c,e,n)=>({u_matrix:c,u_inv_matrix:e,u_camera_to_center_distance:n.cameraToCenterDistance,u_viewport_size:[n.width,n.height]}),Ea=(c,e,n=1)=>({u_matrix:c,u_color:e,u_overlay:0,u_overlay_scale:n}),Yi=c=>({u_matrix:c}),Qi=(c,e,n,s)=>({u_matrix:c,u_extrude_scale:Ct(e,1,n),u_intensity:s}),Qa=(c,e,n,s)=>{let o=p.H();p.aP(o,0,c.width,c.height,0,0,1);let u=c.context.gl;return{u_matrix:o,u_world:[u.drawingBufferWidth,u.drawingBufferHeight],u_image:n,u_color_ramp:s,u_opacity:e.paint.get("heatmap-opacity")}};function es(c,e){let n=Math.pow(2,e.canonical.z),s=e.canonical.y;return[new p.Z(0,s/n).toLngLat().lat,new p.Z(0,(s+1)/n).toLngLat().lat]}let ts=(c,e,n,s)=>{let o=c.transform;return{u_matrix:Al(c,e,n,s),u_ratio:1/Ct(e,1,o.zoom),u_device_pixel_ratio:c.pixelRatio,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},bl=(c,e,n,s,o)=>p.e(ts(c,e,n,o),{u_image:0,u_image_height:s}),$n=(c,e,n,s,o)=>{let u=c.transform,m=wl(e,u);return{u_matrix:Al(c,e,n,o),u_texsize:e.imageAtlasTexture.size,u_ratio:1/Ct(e,1,u.zoom),u_device_pixel_ratio:c.pixelRatio,u_image:0,u_scale:[m,s.fromScale,s.toScale],u_fade:s.t,u_units_to_pixels:[1/u.pixelsToGLUnits[0],1/u.pixelsToGLUnits[1]]}},Fu=(c,e,n,s,o,u)=>{let m=c.lineAtlas,_=wl(e,c.transform),y=n.layout.get("line-cap")==="round",b=m.getDash(s.from,y),T=m.getDash(s.to,y),C=b.width*o.fromScale,P=T.width*o.toScale;return p.e(ts(c,e,n,u),{u_patternscale_a:[_/C,-b.height/2],u_patternscale_b:[_/P,-T.height/2],u_sdfgamma:m.width/(256*Math.min(C,P)*c.pixelRatio)/2,u_image:0,u_tex_y_a:b.y,u_tex_y_b:T.y,u_mix:o.t})};function wl(c,e){return 1/Ct(c,1,e.tileZoom)}function Al(c,e,n,s){return c.translatePosMatrix(s?s.posMatrix:e.tileID.posMatrix,e,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}let Ou=(c,e,n,s,o)=>{return{u_matrix:c,u_tl_parent:e,u_scale_parent:n,u_buffer_scale:1,u_fade_t:s.mix,u_opacity:s.opacity*o.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:o.paint.get("raster-brightness-min"),u_brightness_high:o.paint.get("raster-brightness-max"),u_saturation_factor:(m=o.paint.get("raster-saturation"),m>0?1-1/(1.001-m):-m),u_contrast_factor:(u=o.paint.get("raster-contrast"),u>0?1/(1-u):1+u),u_spin_weights:Nu(o.paint.get("raster-hue-rotate"))};var u,m};function Nu(c){c*=Math.PI/180;let e=Math.sin(c),n=Math.cos(c);return[(2*n+1)/3,(-Math.sqrt(3)*e-n+1)/3,(Math.sqrt(3)*e-n+1)/3]}let El=(c,e,n,s,o,u,m,_,y,b,T,C,P,L)=>{let O=m.transform;return{u_is_size_zoom_constant:+(c==="constant"||c==="source"),u_is_size_feature_constant:+(c==="constant"||c==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:O.cameraToCenterDistance,u_pitch:O.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:O.width/O.height,u_fade_change:m.options.fadeDuration?m.symbolFadeChange:1,u_matrix:_,u_label_plane_matrix:y,u_coord_matrix:b,u_is_text:+C,u_pitch_with_map:+s,u_is_along_line:o,u_is_variable_anchor:u,u_texsize:P,u_texture:0,u_translation:T,u_pitched_scale:L}},Ta=(c,e,n,s,o,u,m,_,y,b,T,C,P,L,O)=>{let U=m.transform;return p.e(El(c,e,n,s,o,u,m,_,y,b,T,C,P,O),{u_gamma_scale:s?Math.cos(U._pitch)*U.cameraToCenterDistance:1,u_device_pixel_ratio:m.pixelRatio,u_is_halo:+L})},no=(c,e,n,s,o,u,m,_,y,b,T,C,P,L)=>p.e(Ta(c,e,n,s,o,u,m,_,y,b,T,!0,C,!0,L),{u_texsize_icon:P,u_texture_icon:1}),is=(c,e,n)=>({u_matrix:c,u_opacity:e,u_color:n}),ao=(c,e,n,s,o,u)=>p.e(function(m,_,y,b){let T=y.imageManager.getPattern(m.from.toString()),C=y.imageManager.getPattern(m.to.toString()),{width:P,height:L}=y.imageManager.getPixelSize(),O=Math.pow(2,b.tileID.overscaledZ),U=b.tileSize*Math.pow(2,y.transform.tileZoom)/O,Z=U*(b.tileID.canonical.x+b.tileID.wrap*O),G=U*b.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:T.tl,u_pattern_br_a:T.br,u_pattern_tl_b:C.tl,u_pattern_br_b:C.br,u_texsize:[P,L],u_mix:_.t,u_pattern_size_a:T.displaySize,u_pattern_size_b:C.displaySize,u_scale_a:_.fromScale,u_scale_b:_.toScale,u_tile_units_to_pixels:1/Ct(b,1,y.transform.tileZoom),u_pixel_coord_upper:[Z>>16,G>>16],u_pixel_coord_lower:[65535&Z,65535&G]}}(s,u,n,o),{u_matrix:c,u_opacity:e}),so={fillExtrusion:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_lightpos:new p.aN(c,e.u_lightpos),u_lightintensity:new p.aI(c,e.u_lightintensity),u_lightcolor:new p.aN(c,e.u_lightcolor),u_vertical_gradient:new p.aI(c,e.u_vertical_gradient),u_opacity:new p.aI(c,e.u_opacity)}),fillExtrusionPattern:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_lightpos:new p.aN(c,e.u_lightpos),u_lightintensity:new p.aI(c,e.u_lightintensity),u_lightcolor:new p.aN(c,e.u_lightcolor),u_vertical_gradient:new p.aI(c,e.u_vertical_gradient),u_height_factor:new p.aI(c,e.u_height_factor),u_image:new p.aH(c,e.u_image),u_texsize:new p.aO(c,e.u_texsize),u_pixel_coord_upper:new p.aO(c,e.u_pixel_coord_upper),u_pixel_coord_lower:new p.aO(c,e.u_pixel_coord_lower),u_scale:new p.aN(c,e.u_scale),u_fade:new p.aI(c,e.u_fade),u_opacity:new p.aI(c,e.u_opacity)}),fill:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix)}),fillPattern:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_image:new p.aH(c,e.u_image),u_texsize:new p.aO(c,e.u_texsize),u_pixel_coord_upper:new p.aO(c,e.u_pixel_coord_upper),u_pixel_coord_lower:new p.aO(c,e.u_pixel_coord_lower),u_scale:new p.aN(c,e.u_scale),u_fade:new p.aI(c,e.u_fade)}),fillOutline:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_world:new p.aO(c,e.u_world)}),fillOutlinePattern:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_world:new p.aO(c,e.u_world),u_image:new p.aH(c,e.u_image),u_texsize:new p.aO(c,e.u_texsize),u_pixel_coord_upper:new p.aO(c,e.u_pixel_coord_upper),u_pixel_coord_lower:new p.aO(c,e.u_pixel_coord_lower),u_scale:new p.aN(c,e.u_scale),u_fade:new p.aI(c,e.u_fade)}),circle:(c,e)=>({u_camera_to_center_distance:new p.aI(c,e.u_camera_to_center_distance),u_scale_with_map:new p.aH(c,e.u_scale_with_map),u_pitch_with_map:new p.aH(c,e.u_pitch_with_map),u_extrude_scale:new p.aO(c,e.u_extrude_scale),u_device_pixel_ratio:new p.aI(c,e.u_device_pixel_ratio),u_matrix:new p.aJ(c,e.u_matrix)}),collisionBox:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_pixel_extrude_scale:new p.aO(c,e.u_pixel_extrude_scale)}),collisionCircle:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_inv_matrix:new p.aJ(c,e.u_inv_matrix),u_camera_to_center_distance:new p.aI(c,e.u_camera_to_center_distance),u_viewport_size:new p.aO(c,e.u_viewport_size)}),debug:(c,e)=>({u_color:new p.aL(c,e.u_color),u_matrix:new p.aJ(c,e.u_matrix),u_overlay:new p.aH(c,e.u_overlay),u_overlay_scale:new p.aI(c,e.u_overlay_scale)}),clippingMask:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix)}),heatmap:(c,e)=>({u_extrude_scale:new p.aI(c,e.u_extrude_scale),u_intensity:new p.aI(c,e.u_intensity),u_matrix:new p.aJ(c,e.u_matrix)}),heatmapTexture:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_world:new p.aO(c,e.u_world),u_image:new p.aH(c,e.u_image),u_color_ramp:new p.aH(c,e.u_color_ramp),u_opacity:new p.aI(c,e.u_opacity)}),hillshade:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_image:new p.aH(c,e.u_image),u_latrange:new p.aO(c,e.u_latrange),u_light:new p.aO(c,e.u_light),u_shadow:new p.aL(c,e.u_shadow),u_highlight:new p.aL(c,e.u_highlight),u_accent:new p.aL(c,e.u_accent)}),hillshadePrepare:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_image:new p.aH(c,e.u_image),u_dimension:new p.aO(c,e.u_dimension),u_zoom:new p.aI(c,e.u_zoom),u_unpack:new p.aK(c,e.u_unpack)}),line:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_ratio:new p.aI(c,e.u_ratio),u_device_pixel_ratio:new p.aI(c,e.u_device_pixel_ratio),u_units_to_pixels:new p.aO(c,e.u_units_to_pixels)}),lineGradient:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_ratio:new p.aI(c,e.u_ratio),u_device_pixel_ratio:new p.aI(c,e.u_device_pixel_ratio),u_units_to_pixels:new p.aO(c,e.u_units_to_pixels),u_image:new p.aH(c,e.u_image),u_image_height:new p.aI(c,e.u_image_height)}),linePattern:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_texsize:new p.aO(c,e.u_texsize),u_ratio:new p.aI(c,e.u_ratio),u_device_pixel_ratio:new p.aI(c,e.u_device_pixel_ratio),u_image:new p.aH(c,e.u_image),u_units_to_pixels:new p.aO(c,e.u_units_to_pixels),u_scale:new p.aN(c,e.u_scale),u_fade:new p.aI(c,e.u_fade)}),lineSDF:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_ratio:new p.aI(c,e.u_ratio),u_device_pixel_ratio:new p.aI(c,e.u_device_pixel_ratio),u_units_to_pixels:new p.aO(c,e.u_units_to_pixels),u_patternscale_a:new p.aO(c,e.u_patternscale_a),u_patternscale_b:new p.aO(c,e.u_patternscale_b),u_sdfgamma:new p.aI(c,e.u_sdfgamma),u_image:new p.aH(c,e.u_image),u_tex_y_a:new p.aI(c,e.u_tex_y_a),u_tex_y_b:new p.aI(c,e.u_tex_y_b),u_mix:new p.aI(c,e.u_mix)}),raster:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_tl_parent:new p.aO(c,e.u_tl_parent),u_scale_parent:new p.aI(c,e.u_scale_parent),u_buffer_scale:new p.aI(c,e.u_buffer_scale),u_fade_t:new p.aI(c,e.u_fade_t),u_opacity:new p.aI(c,e.u_opacity),u_image0:new p.aH(c,e.u_image0),u_image1:new p.aH(c,e.u_image1),u_brightness_low:new p.aI(c,e.u_brightness_low),u_brightness_high:new p.aI(c,e.u_brightness_high),u_saturation_factor:new p.aI(c,e.u_saturation_factor),u_contrast_factor:new p.aI(c,e.u_contrast_factor),u_spin_weights:new p.aN(c,e.u_spin_weights)}),symbolIcon:(c,e)=>({u_is_size_zoom_constant:new p.aH(c,e.u_is_size_zoom_constant),u_is_size_feature_constant:new p.aH(c,e.u_is_size_feature_constant),u_size_t:new p.aI(c,e.u_size_t),u_size:new p.aI(c,e.u_size),u_camera_to_center_distance:new p.aI(c,e.u_camera_to_center_distance),u_pitch:new p.aI(c,e.u_pitch),u_rotate_symbol:new p.aH(c,e.u_rotate_symbol),u_aspect_ratio:new p.aI(c,e.u_aspect_ratio),u_fade_change:new p.aI(c,e.u_fade_change),u_matrix:new p.aJ(c,e.u_matrix),u_label_plane_matrix:new p.aJ(c,e.u_label_plane_matrix),u_coord_matrix:new p.aJ(c,e.u_coord_matrix),u_is_text:new p.aH(c,e.u_is_text),u_pitch_with_map:new p.aH(c,e.u_pitch_with_map),u_is_along_line:new p.aH(c,e.u_is_along_line),u_is_variable_anchor:new p.aH(c,e.u_is_variable_anchor),u_texsize:new p.aO(c,e.u_texsize),u_texture:new p.aH(c,e.u_texture),u_translation:new p.aO(c,e.u_translation),u_pitched_scale:new p.aI(c,e.u_pitched_scale)}),symbolSDF:(c,e)=>({u_is_size_zoom_constant:new p.aH(c,e.u_is_size_zoom_constant),u_is_size_feature_constant:new p.aH(c,e.u_is_size_feature_constant),u_size_t:new p.aI(c,e.u_size_t),u_size:new p.aI(c,e.u_size),u_camera_to_center_distance:new p.aI(c,e.u_camera_to_center_distance),u_pitch:new p.aI(c,e.u_pitch),u_rotate_symbol:new p.aH(c,e.u_rotate_symbol),u_aspect_ratio:new p.aI(c,e.u_aspect_ratio),u_fade_change:new p.aI(c,e.u_fade_change),u_matrix:new p.aJ(c,e.u_matrix),u_label_plane_matrix:new p.aJ(c,e.u_label_plane_matrix),u_coord_matrix:new p.aJ(c,e.u_coord_matrix),u_is_text:new p.aH(c,e.u_is_text),u_pitch_with_map:new p.aH(c,e.u_pitch_with_map),u_is_along_line:new p.aH(c,e.u_is_along_line),u_is_variable_anchor:new p.aH(c,e.u_is_variable_anchor),u_texsize:new p.aO(c,e.u_texsize),u_texture:new p.aH(c,e.u_texture),u_gamma_scale:new p.aI(c,e.u_gamma_scale),u_device_pixel_ratio:new p.aI(c,e.u_device_pixel_ratio),u_is_halo:new p.aH(c,e.u_is_halo),u_translation:new p.aO(c,e.u_translation),u_pitched_scale:new p.aI(c,e.u_pitched_scale)}),symbolTextAndIcon:(c,e)=>({u_is_size_zoom_constant:new p.aH(c,e.u_is_size_zoom_constant),u_is_size_feature_constant:new p.aH(c,e.u_is_size_feature_constant),u_size_t:new p.aI(c,e.u_size_t),u_size:new p.aI(c,e.u_size),u_camera_to_center_distance:new p.aI(c,e.u_camera_to_center_distance),u_pitch:new p.aI(c,e.u_pitch),u_rotate_symbol:new p.aH(c,e.u_rotate_symbol),u_aspect_ratio:new p.aI(c,e.u_aspect_ratio),u_fade_change:new p.aI(c,e.u_fade_change),u_matrix:new p.aJ(c,e.u_matrix),u_label_plane_matrix:new p.aJ(c,e.u_label_plane_matrix),u_coord_matrix:new p.aJ(c,e.u_coord_matrix),u_is_text:new p.aH(c,e.u_is_text),u_pitch_with_map:new p.aH(c,e.u_pitch_with_map),u_is_along_line:new p.aH(c,e.u_is_along_line),u_is_variable_anchor:new p.aH(c,e.u_is_variable_anchor),u_texsize:new p.aO(c,e.u_texsize),u_texsize_icon:new p.aO(c,e.u_texsize_icon),u_texture:new p.aH(c,e.u_texture),u_texture_icon:new p.aH(c,e.u_texture_icon),u_gamma_scale:new p.aI(c,e.u_gamma_scale),u_device_pixel_ratio:new p.aI(c,e.u_device_pixel_ratio),u_is_halo:new p.aH(c,e.u_is_halo),u_translation:new p.aO(c,e.u_translation),u_pitched_scale:new p.aI(c,e.u_pitched_scale)}),background:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_opacity:new p.aI(c,e.u_opacity),u_color:new p.aL(c,e.u_color)}),backgroundPattern:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_opacity:new p.aI(c,e.u_opacity),u_image:new p.aH(c,e.u_image),u_pattern_tl_a:new p.aO(c,e.u_pattern_tl_a),u_pattern_br_a:new p.aO(c,e.u_pattern_br_a),u_pattern_tl_b:new p.aO(c,e.u_pattern_tl_b),u_pattern_br_b:new p.aO(c,e.u_pattern_br_b),u_texsize:new p.aO(c,e.u_texsize),u_mix:new p.aI(c,e.u_mix),u_pattern_size_a:new p.aO(c,e.u_pattern_size_a),u_pattern_size_b:new p.aO(c,e.u_pattern_size_b),u_scale_a:new p.aI(c,e.u_scale_a),u_scale_b:new p.aI(c,e.u_scale_b),u_pixel_coord_upper:new p.aO(c,e.u_pixel_coord_upper),u_pixel_coord_lower:new p.aO(c,e.u_pixel_coord_lower),u_tile_units_to_pixels:new p.aI(c,e.u_tile_units_to_pixels)}),terrain:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_texture:new p.aH(c,e.u_texture),u_ele_delta:new p.aI(c,e.u_ele_delta),u_fog_matrix:new p.aJ(c,e.u_fog_matrix),u_fog_color:new p.aL(c,e.u_fog_color),u_fog_ground_blend:new p.aI(c,e.u_fog_ground_blend),u_fog_ground_blend_opacity:new p.aI(c,e.u_fog_ground_blend_opacity),u_horizon_color:new p.aL(c,e.u_horizon_color),u_horizon_fog_blend:new p.aI(c,e.u_horizon_fog_blend)}),terrainDepth:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_ele_delta:new p.aI(c,e.u_ele_delta)}),terrainCoords:(c,e)=>({u_matrix:new p.aJ(c,e.u_matrix),u_texture:new p.aH(c,e.u_texture),u_terrain_coords_id:new p.aI(c,e.u_terrain_coords_id),u_ele_delta:new p.aI(c,e.u_ele_delta)}),sky:(c,e)=>({u_sky_color:new p.aL(c,e.u_sky_color),u_horizon_color:new p.aL(c,e.u_horizon_color),u_horizon:new p.aI(c,e.u_horizon),u_sky_horizon_blend:new p.aI(c,e.u_sky_horizon_blend)})};class Gr{constructor(e,n,s){this.context=e;let o=e.gl;this.buffer=o.createBuffer(),this.dynamicDraw=!!s,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let n=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let qu={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class oo{constructor(e,n,s,o){this.length=n.length,this.attributes=s,this.itemSize=n.bytesPerElement,this.dynamicDraw=o,this.context=e;let u=e.gl;this.buffer=u.createBuffer(),e.bindVertexBuffer.set(this.buffer),u.bufferData(u.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?u.DYNAMIC_DRAW:u.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);let n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,n){for(let s=0;s0){let ae=p.H();p.aQ(ae,N.placementInvProjMatrix,c.transform.glCoordMatrix),p.aQ(ae,ae,N.placementViewportMatrix),y.push({circleArray:te,circleOffset:T,transform:X.posMatrix,invTransform:ae,coord:X}),b+=te.length/4,T=b}Q&&_.draw(u,m.LINES,At.disabled,Yt.disabled,c.colorModeForRenderPass(),Ht.disabled,{u_matrix:X.posMatrix,u_pixel_extrude_scale:[1/(C=c.transform).width,1/C.height]},c.style.map.terrain&&c.style.map.terrain.getTerrainData(X),n.id,Q.layoutVertexBuffer,Q.indexBuffer,Q.segments,null,c.transform.zoom,null,null,Q.collisionVertexBuffer)}var C;if(!o||!y.length)return;let P=c.useProgram("collisionCircle"),L=new p.aR;L.resize(4*b),L._trim();let O=0;for(let G of y)for(let X=0;X=0&&(G[N.associatedIconIndex]={shiftedAnchor:ot,angle:ii})}else tt(N.numGlyphs,U)}if(b){Z.clear();let X=c.icon.placedSymbolArray;for(let N=0;Nc.style.map.terrain.getElevation(Se,ca,ha):null,Mn=n.layout.get("text-rotation-alignment")==="map";R(Ge,Se.posMatrix,c,o,la,ua,G,b,Mn,U,Se.toUnwrapped(),O.width,O.height,Ar,kt)}let Er=Se.posMatrix,Tr=o&&be||Uo,cn=X||Tr?Sa:la,Nr=Cs,ki=Re&&n.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1)!==0,Li;Li=Re?Ge.iconsInText?no(ot.kind,Dt,N,G,X,Tr,c,Er,cn,Nr,Ar,zi,$i,Ne):Ta(ot.kind,Dt,N,G,X,Tr,c,Er,cn,Nr,Ar,o,zi,!0,Ne):El(ot.kind,Dt,N,G,X,Tr,c,Er,cn,Nr,Ar,o,zi,Ne);let fr={program:vt,buffers:ct,uniformValues:Li,atlasTexture:Or,atlasTextureIcon:Bi,atlasInterpolation:ni,atlasInterpolationIcon:er,isSDF:Re,hasHalo:ki};if(te&&Ge.canOverlap){ae=!0;let kt=ct.segments.get();for(let Mn of kt)ze.push({segments:new p.a0([Mn]),sortKey:Mn.sortKey,state:fr,terrainData:ri})}else ze.push({segments:ct.segments,sortKey:0,state:fr,terrainData:ri})}ae&&ze.sort((Se,Ce)=>Se.sortKey-Ce.sortKey);for(let Se of ze){let Ce=Se.state;if(P.activeTexture.set(L.TEXTURE0),Ce.atlasTexture.bind(Ce.atlasInterpolation,L.CLAMP_TO_EDGE),Ce.atlasTextureIcon&&(P.activeTexture.set(L.TEXTURE1),Ce.atlasTextureIcon&&Ce.atlasTextureIcon.bind(Ce.atlasInterpolationIcon,L.CLAMP_TO_EDGE)),Ce.isSDF){let Ge=Ce.uniformValues;Ce.hasHalo&&(Ge.u_is_halo=1,yo(Ce.buffers,Se.segments,n,c,Ce.program,fe,T,C,Ge,Se.terrainData)),Ge.u_is_halo=0}yo(Ce.buffers,Se.segments,n,c,Ce.program,fe,T,C,Ce.uniformValues,Se.terrainData)}}function yo(c,e,n,s,o,u,m,_,y,b){let T=s.context;o.draw(T,T.gl.TRIANGLES,u,m,_,Ht.disabled,y,b,n.id,c.layoutVertexBuffer,c.indexBuffer,e,n.paint,s.transform.zoom,c.programConfigurations.get(n.id),c.dynamicLayoutVertexBuffer,c.opacityVertexBuffer)}function vo(c,e,n,s){let o=c.context,u=o.gl,m=Yt.disabled,_=new di([u.ONE,u.ONE],p.aM.transparent,[!0,!0,!0,!0]),y=e.getBucket(n);if(!y)return;let b=s.key,T=n.heatmapFbos.get(b);T||(T=Ia(o,e.tileSize,e.tileSize),n.heatmapFbos.set(b,T)),o.bindFramebuffer.set(T.framebuffer),o.viewport.set([0,0,e.tileSize,e.tileSize]),o.clear({color:p.aM.transparent});let C=y.programConfigurations.get(n.id),P=c.useProgram("heatmap",C),L=c.style.map.terrain.getTerrainData(s);P.draw(o,u.TRIANGLES,At.disabled,m,_,Ht.disabled,Qi(s.posMatrix,e,c.transform.zoom,n.paint.get("heatmap-intensity")),L,n.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,n.paint,c.transform.zoom,C)}function Dn(c,e,n){let s=c.context,o=s.gl;s.setColorMode(c.colorModeForRenderPass());let u=ka(s,e),m=n.key,_=e.heatmapFbos.get(m);_&&(s.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,_.colorAttachment.get()),s.activeTexture.set(o.TEXTURE1),u.bind(o.LINEAR,o.CLAMP_TO_EDGE),c.useProgram("heatmapTexture").draw(s,o.TRIANGLES,At.disabled,Yt.disabled,c.colorModeForRenderPass(),Ht.disabled,Qa(c,e,0,1),null,e.id,c.rasterBoundsBuffer,c.quadTriangleIndexBuffer,c.rasterBoundsSegments,e.paint,c.transform.zoom),_.destroy(),e.heatmapFbos.delete(m))}function Ia(c,e,n){var s,o;let u=c.gl,m=u.createTexture();u.bindTexture(u.TEXTURE_2D,m),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,u.LINEAR),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,u.LINEAR);let _=(s=c.HALF_FLOAT)!==null&&s!==void 0?s:u.UNSIGNED_BYTE,y=(o=c.RGBA16F)!==null&&o!==void 0?o:u.RGBA;u.texImage2D(u.TEXTURE_2D,0,y,e,n,0,u.RGBA,_,null);let b=c.createFramebuffer(e,n,!1,!1);return b.colorAttachment.set(m),b}function ka(c,e){return e.colorRampTexture||(e.colorRampTexture=new ye(c,e.colorRamp,c.gl.RGBA)),e.colorRampTexture}function Hn(c,e,n,s,o){if(!n||!s||!s.imageAtlas)return;let u=s.imageAtlas.patternPositions,m=u[n.to.toString()],_=u[n.from.toString()];if(!m&&_&&(m=_),!_&&m&&(_=m),!m||!_){let y=o.getPaintProperty(e);m=u[y],_=u[y]}m&&_&&c.setConstantPatternPositions(m,_)}function Ma(c,e,n,s,o,u,m){let _=c.context.gl,y="fill-pattern",b=n.paint.get(y),T=b&&b.constantOr(1),C=n.getCrossfadeParameters(),P,L,O,U,Z;m?(L=T&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",P=_.LINES):(L=T?"fillPattern":"fill",P=_.TRIANGLES);let G=b.constantOr(null);for(let X of s){let N=e.getTile(X);if(T&&!N.patternsLoaded())continue;let Q=N.getBucket(n);if(!Q)continue;let te=Q.programConfigurations.get(n.id),ae=c.useProgram(L,te),fe=c.style.map.terrain&&c.style.map.terrain.getTerrainData(X);T&&(c.context.activeTexture.set(_.TEXTURE0),N.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),te.updatePaintBuffers(C)),Hn(te,y,G,N,n);let be=fe?X:null,ze=c.translatePosMatrix(be?be.posMatrix:X.posMatrix,N,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(m){U=Q.indexBuffer2,Z=Q.segments2;let Ne=[_.drawingBufferWidth,_.drawingBufferHeight];O=L==="fillOutlinePattern"&&T?xl(ze,c,C,N,Ne):Lu(ze,Ne)}else U=Q.indexBuffer,Z=Q.segments,O=T?vl(ze,c,C,N):jn(ze);ae.draw(c.context,P,o,c.stencilModeForClipping(X),u,Ht.disabled,O,fe,n.id,Q.layoutVertexBuffer,U,Z,n.paint,c.transform.zoom,te)}}function ls(c,e,n,s,o,u,m){let _=c.context,y=_.gl,b="fill-extrusion-pattern",T=n.paint.get(b),C=T.constantOr(1),P=n.getCrossfadeParameters(),L=n.paint.get("fill-extrusion-opacity"),O=T.constantOr(null);for(let U of s){let Z=e.getTile(U),G=Z.getBucket(n);if(!G)continue;let X=c.style.map.terrain&&c.style.map.terrain.getTerrainData(U),N=G.programConfigurations.get(n.id),Q=c.useProgram(C?"fillExtrusionPattern":"fillExtrusion",N);C&&(c.context.activeTexture.set(y.TEXTURE0),Z.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),N.updatePaintBuffers(P)),Hn(N,b,O,Z,n);let te=c.translatePosMatrix(U.posMatrix,Z,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),ae=n.paint.get("fill-extrusion-vertical-gradient"),fe=C?Ya(te,c,ae,L,U,P,Z):Aa(te,c,ae,L);Q.draw(_,_.gl.TRIANGLES,o,u,m,Ht.backCCW,fe,X,n.id,G.layoutVertexBuffer,G.indexBuffer,G.segments,n.paint,c.transform.zoom,N,c.style.map.terrain&&G.centroidVertexBuffer)}}function Xn(c,e,n,s,o,u,m){let _=c.context,y=_.gl,b=n.fbo;if(!b)return;let T=c.useProgram("hillshade"),C=c.style.map.terrain&&c.style.map.terrain.getTerrainData(e);_.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,b.colorAttachment.get()),T.draw(_,y.TRIANGLES,o,u,m,Ht.disabled,((P,L,O,U)=>{let Z=O.paint.get("hillshade-shadow-color"),G=O.paint.get("hillshade-highlight-color"),X=O.paint.get("hillshade-accent-color"),N=O.paint.get("hillshade-illumination-direction")*(Math.PI/180);O.paint.get("hillshade-illumination-anchor")==="viewport"&&(N-=P.transform.angle);let Q=!P.options.moving;return{u_matrix:U?U.posMatrix:P.transform.calculatePosMatrix(L.tileID.toUnwrapped(),Q),u_image:0,u_latrange:es(0,L.tileID),u_light:[O.paint.get("hillshade-exaggeration"),N],u_shadow:Z,u_highlight:G,u_accent:X}})(c,n,s,C?e:null),C,s.id,c.rasterBoundsBuffer,c.quadTriangleIndexBuffer,c.rasterBoundsSegments)}function Wn(c,e,n,s,o,u){let m=c.context,_=m.gl,y=e.dem;if(y&&y.data){let b=y.dim,T=y.stride,C=y.getPixels();if(m.activeTexture.set(_.TEXTURE1),m.pixelStoreUnpackPremultiplyAlpha.set(!1),e.demTexture=e.demTexture||c.getTileTexture(T),e.demTexture){let L=e.demTexture;L.update(C,{premultiply:!1}),L.bind(_.NEAREST,_.CLAMP_TO_EDGE)}else e.demTexture=new ye(m,C,_.RGBA,{premultiply:!1}),e.demTexture.bind(_.NEAREST,_.CLAMP_TO_EDGE);m.activeTexture.set(_.TEXTURE0);let P=e.fbo;if(!P){let L=new ye(m,{width:b,height:b,data:null},_.RGBA);L.bind(_.LINEAR,_.CLAMP_TO_EDGE),P=e.fbo=m.createFramebuffer(b,b,!0,!1),P.colorAttachment.set(L.texture)}m.bindFramebuffer.set(P.framebuffer),m.viewport.set([0,0,b,b]),c.useProgram("hillshadePrepare").draw(m,_.TRIANGLES,s,o,u,Ht.disabled,((L,O)=>{let U=O.stride,Z=p.H();return p.aP(Z,0,p.X,-p.X,0,0,1),p.J(Z,Z,[0,-p.X,0]),{u_matrix:Z,u_image:1,u_dimension:[U,U],u_zoom:L.overscaledZ,u_unpack:O.getUnpackVector()}})(e.tileID,y),null,n.id,c.rasterBoundsBuffer,c.quadTriangleIndexBuffer,c.rasterBoundsSegments),e.needsHillshadePrepare=!1}}function Fl(c,e,n,s,o,u){let m=s.paint.get("raster-fade-duration");if(!u&&m>0){let _=se.now(),y=(_-c.timeAdded)/m,b=e?(_-e.timeAdded)/m:-1,T=n.getSource(),C=o.coveringZoomLevel({tileSize:T.tileSize,roundZoom:T.roundZoom}),P=!e||Math.abs(e.tileID.overscaledZ-C)>Math.abs(c.tileID.overscaledZ-C),L=P&&c.refreshedUponExpiration?1:p.ac(P?y:1-b,0,1);return c.refreshedUponExpiration&&y>=1&&(c.refreshedUponExpiration=!1),e?{opacity:1,mix:1-L}:{opacity:L,mix:0}}return{opacity:1,mix:0}}let xo=new p.aM(1,0,0,1),Ft=new p.aM(0,1,0,1),us=new p.aM(0,0,1,1),Ju=new p.aM(1,0,1,1),Ol=new p.aM(0,1,1,1);function Jn(c,e,n,s){cs(c,0,e+n/2,c.transform.width,n,s)}function Nl(c,e,n,s){cs(c,e-n/2,0,n,c.transform.height,s)}function cs(c,e,n,s,o,u){let m=c.context,_=m.gl;_.enable(_.SCISSOR_TEST),_.scissor(e*c.pixelRatio,n*c.pixelRatio,s*c.pixelRatio,o*c.pixelRatio),m.clear({color:u}),_.disable(_.SCISSOR_TEST)}function ql(c,e,n){let s=c.context,o=s.gl,u=n.posMatrix,m=c.useProgram("debug"),_=At.disabled,y=Yt.disabled,b=c.colorModeForRenderPass(),T="$debug",C=c.style.map.terrain&&c.style.map.terrain.getTerrainData(n);s.activeTexture.set(o.TEXTURE0);let P=e.getTileByID(n.key).latestRawTileData,L=Math.floor((P&&P.byteLength||0)/1024),O=e.getTile(n).tileSize,U=512/Math.min(O,512)*(n.overscaledZ/c.transform.zoom)*.5,Z=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(Z+=` => ${n.overscaledZ}`),function(G,X){G.initDebugOverlayCanvas();let N=G.debugOverlayCanvas,Q=G.context.gl,te=G.debugOverlayCanvas.getContext("2d");te.clearRect(0,0,N.width,N.height),te.shadowColor="white",te.shadowBlur=2,te.lineWidth=1.5,te.strokeStyle="white",te.textBaseline="top",te.font="bold 36px Open Sans, sans-serif",te.fillText(X,5,5),te.strokeText(X,5,5),G.debugOverlayTexture.update(N),G.debugOverlayTexture.bind(Q.LINEAR,Q.CLAMP_TO_EDGE)}(c,`${Z} ${L}kB`),m.draw(s,o.TRIANGLES,_,y,di.alphaBlended,Ht.disabled,Ea(u,p.aM.transparent,U),null,T,c.debugBuffer,c.quadTriangleIndexBuffer,c.debugSegments),m.draw(s,o.LINE_STRIP,_,y,b,Ht.disabled,Ea(u,p.aM.red),C,T,c.debugBuffer,c.tileBorderIndexBuffer,c.debugSegments)}function Vl(c,e,n){let s=c.context,o=s.gl,u=c.colorModeForRenderPass(),m=new At(o.LEQUAL,At.ReadWrite,c.depthRangeFor3D),_=c.useProgram("terrain"),y=e.getTerrainMesh();s.bindFramebuffer.set(null),s.viewport.set([0,0,c.width,c.height]);for(let b of n){let T=c.renderToTexture.getTexture(b),C=e.getTerrainData(b.tileID);s.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,T.texture);let P=c.transform.calculatePosMatrix(b.tileID.toUnwrapped()),L=e.getMeshFrameDelta(c.transform.zoom),O=c.transform.calculateFogMatrix(b.tileID.toUnwrapped()),U=io(P,L,O,c.style.sky,c.transform.pitch);_.draw(s,o.TRIANGLES,m,Yt.disabled,u,Ht.backCCW,U,C,"terrain",y.vertexBuffer,y.indexBuffer,y.segments)}}class hs{constructor(e,n,s){this.vertexBuffer=e,this.indexBuffer=n,this.segments=s}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class ps{constructor(e,n){this.context=new Wu(e),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:p.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=nt.maxUnderzooming+nt.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new eo}resize(e,n,s){if(this.width=Math.floor(e*s),this.height=Math.floor(n*s),this.pixelRatio=s,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let o of this.style._order)this.style._layers[o].resize()}setup(){let e=this.context,n=new p.aX;n.emplaceBack(0,0),n.emplaceBack(p.X,0),n.emplaceBack(0,p.X),n.emplaceBack(p.X,p.X),this.tileExtentBuffer=e.createVertexBuffer(n,xn.members),this.tileExtentSegments=p.a0.simpleSegment(0,0,4,2);let s=new p.aX;s.emplaceBack(0,0),s.emplaceBack(p.X,0),s.emplaceBack(0,p.X),s.emplaceBack(p.X,p.X),this.debugBuffer=e.createVertexBuffer(s,xn.members),this.debugSegments=p.a0.simpleSegment(0,0,4,5);let o=new p.$;o.emplaceBack(0,0,0,0),o.emplaceBack(p.X,0,p.X,0),o.emplaceBack(0,p.X,0,p.X),o.emplaceBack(p.X,p.X,p.X,p.X),this.rasterBoundsBuffer=e.createVertexBuffer(o,Mr.members),this.rasterBoundsSegments=p.a0.simpleSegment(0,0,4,2);let u=new p.aX;u.emplaceBack(0,0),u.emplaceBack(1,0),u.emplaceBack(0,1),u.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(u,xn.members),this.viewportSegments=p.a0.simpleSegment(0,0,4,2);let m=new p.aZ;m.emplaceBack(0),m.emplaceBack(1),m.emplaceBack(3),m.emplaceBack(2),m.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(m);let _=new p.aY;_.emplaceBack(0,1,2),_.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(_);let y=this.context.gl;this.stencilClearMode=new Yt({func:y.ALWAYS,mask:0},0,255,y.ZERO,y.ZERO,y.ZERO)}clearStencil(){let e=this.context,n=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let s=p.H();p.aP(s,0,this.width,this.height,0,0,1),p.K(s,s,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,n.TRIANGLES,At.disabled,this.stencilClearMode,di.disabled,Ht.disabled,Yi(s),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,n){if(this.currentStencilSource===e.source||!e.isTileClipped()||!n||!n.length)return;this.currentStencilSource=e.source;let s=this.context,o=s.gl;this.nextStencilID+n.length>256&&this.clearStencil(),s.setColorMode(di.disabled),s.setDepthMode(At.disabled);let u=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(let m of n){let _=this._tileClippingMaskIDs[m.key]=this.nextStencilID++,y=this.style.map.terrain&&this.style.map.terrain.getTerrainData(m);u.draw(s,o.TRIANGLES,At.disabled,new Yt({func:o.ALWAYS,mask:0},_,255,o.KEEP,o.KEEP,o.REPLACE),di.disabled,Ht.disabled,Yi(m.posMatrix),y,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,n=this.context.gl;return new Yt({func:n.NOTEQUAL,mask:255},e,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(e){let n=this.context.gl;return new Yt({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(e){let n=this.context.gl,s=e.sort((m,_)=>_.overscaledZ-m.overscaledZ),o=s[s.length-1].overscaledZ,u=s[0].overscaledZ-o+1;if(u>1){this.currentStencilSource=void 0,this.nextStencilID+u>256&&this.clearStencil();let m={};for(let _=0;_({u_sky_color:G.properties.get("sky-color"),u_horizon_color:G.properties.get("horizon-color"),u_horizon:(X.height/2+X.getHorizon())*N,u_sky_horizon_blend:G.properties.get("sky-horizon-blend")*X.height/2*N}))(b,y.style.map.transform,y.pixelRatio),L=new At(C.LEQUAL,At.ReadWrite,[0,1]),O=Yt.disabled,U=y.colorModeForRenderPass(),Z=y.useProgram("sky");if(!b.mesh){let G=new p.aX;G.emplaceBack(-1,-1),G.emplaceBack(1,-1),G.emplaceBack(1,1),G.emplaceBack(-1,1);let X=new p.aY;X.emplaceBack(0,1,2),X.emplaceBack(0,2,3),b.mesh=new hs(T.createVertexBuffer(G,xn.members),T.createIndexBuffer(X),p.a0.simpleSegment(0,0,G.length,X.length))}Z.draw(T,C.TRIANGLES,L,O,U,Ht.disabled,P,void 0,"sky",b.mesh.vertexBuffer,b.mesh.indexBuffer,b.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=s.length-1;this.currentLayer>=0;this.currentLayer--){let y=this.style._layers[s[this.currentLayer]],b=o[y.source],T=u[y.source];this._renderTileClippingMasks(y,T),this.renderLayer(this,b,y,T)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerZ.source&&!Z.isHidden(T)?[b.sourceCaches[Z.source]]:[]),L=P.filter(Z=>Z.getSource().type==="vector"),O=P.filter(Z=>Z.getSource().type!=="vector"),U=Z=>{(!C||C.getSource().maxzoomU(Z)),C||O.forEach(Z=>U(Z)),C}(this.style,this.transform.zoom);y&&function(b,T,C){for(let P=0;P0),o&&(p.b0(n,s),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(u,m){let _=u.context,y=_.gl,b=di.unblended,T=new At(y.LEQUAL,At.ReadWrite,[0,1]),C=m.getTerrainMesh(),P=m.sourceCache.getRenderableTiles(),L=u.useProgram("terrainDepth");_.bindFramebuffer.set(m.getFramebuffer("depth").framebuffer),_.viewport.set([0,0,u.width/devicePixelRatio,u.height/devicePixelRatio]),_.clear({color:p.aM.transparent,depth:1});for(let O of P){let U=m.getTerrainData(O.tileID),Z={u_matrix:u.transform.calculatePosMatrix(O.tileID.toUnwrapped()),u_ele_delta:m.getMeshFrameDelta(u.transform.zoom)};L.draw(_,y.TRIANGLES,T,Yt.disabled,b,Ht.backCCW,Z,U,"terrain",C.vertexBuffer,C.indexBuffer,C.segments)}_.bindFramebuffer.set(null),_.viewport.set([0,0,u.width,u.height])}(this,this.style.map.terrain),function(u,m){let _=u.context,y=_.gl,b=di.unblended,T=new At(y.LEQUAL,At.ReadWrite,[0,1]),C=m.getTerrainMesh(),P=m.getCoordsTexture(),L=m.sourceCache.getRenderableTiles(),O=u.useProgram("terrainCoords");_.bindFramebuffer.set(m.getFramebuffer("coords").framebuffer),_.viewport.set([0,0,u.width/devicePixelRatio,u.height/devicePixelRatio]),_.clear({color:p.aM.transparent,depth:1}),m.coordsIndex=[];for(let U of L){let Z=m.getTerrainData(U.tileID);_.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,P.texture);let G={u_matrix:u.transform.calculatePosMatrix(U.tileID.toUnwrapped()),u_terrain_coords_id:(255-m.coordsIndex.length)/255,u_texture:0,u_ele_delta:m.getMeshFrameDelta(u.transform.zoom)};O.draw(_,y.TRIANGLES,T,Yt.disabled,b,Ht.backCCW,G,Z,"terrain",C.vertexBuffer,C.indexBuffer,C.segments),m.coordsIndex.push(U.tileID.key)}_.bindFramebuffer.set(null),_.viewport.set([0,0,u.width,u.height])}(this,this.style.map.terrain))}renderLayer(e,n,s,o){if(!s.isHidden(this.transform.zoom)&&(s.type==="background"||s.type==="custom"||(o||[]).length))switch(this.id=s.id,s.type){case"symbol":(function(u,m,_,y,b){if(u.renderPass!=="translucent")return;let T=Yt.disabled,C=u.colorModeForRenderPass();(_._unevaluatedLayout.hasValue("text-variable-anchor")||_._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(P,L,O,U,Z,G,X,N,Q){let te=L.transform,ae=vn(),fe=Z==="map",be=G==="map";for(let ze of P){let Ne=U.getTile(ze),Se=Ne.getBucket(O);if(!Se||!Se.text||!Se.text.segments.get().length)continue;let Ce=p.ag(Se.textSizeData,te.zoom),Ge=Ct(Ne,1,L.transform.zoom),ct=on(ze.posMatrix,be,fe,L.transform,Ge),ke=O.layout.get("icon-text-fit")!=="none"&&Se.hasIconData();if(Ce){let Re=Math.pow(2,te.zoom-Ne.tileID.overscaledZ),ot=L.style.map.terrain?(vt,Dt)=>L.style.map.terrain.getElevation(ze,vt,Dt):null,ii=ae.translatePosition(te,Ne,X,N);Gn(Se,fe,be,Q,te,ct,ze.posMatrix,Re,Ce,ke,ae,ii,ze.toUnwrapped(),ot)}}}(y,u,_,m,_.layout.get("text-rotation-alignment"),_.layout.get("text-pitch-alignment"),_.paint.get("text-translate"),_.paint.get("text-translate-anchor"),b),_.paint.get("icon-opacity").constantOr(1)!==0&&_o(u,m,_,y,!1,_.paint.get("icon-translate"),_.paint.get("icon-translate-anchor"),_.layout.get("icon-rotation-alignment"),_.layout.get("icon-pitch-alignment"),_.layout.get("icon-keep-upright"),T,C),_.paint.get("text-opacity").constantOr(1)!==0&&_o(u,m,_,y,!0,_.paint.get("text-translate"),_.paint.get("text-translate-anchor"),_.layout.get("text-rotation-alignment"),_.layout.get("text-pitch-alignment"),_.layout.get("text-keep-upright"),T,C),m.map.showCollisionBoxes&&(Da(u,m,_,y,!0),Da(u,m,_,y,!1))})(e,n,s,o,this.style.placement.variableOffsets);break;case"circle":(function(u,m,_,y){if(u.renderPass!=="translucent")return;let b=_.paint.get("circle-opacity"),T=_.paint.get("circle-stroke-width"),C=_.paint.get("circle-stroke-opacity"),P=!_.layout.get("circle-sort-key").isConstant();if(b.constantOr(1)===0&&(T.constantOr(1)===0||C.constantOr(1)===0))return;let L=u.context,O=L.gl,U=u.depthModeForSublayer(0,At.ReadOnly),Z=Yt.disabled,G=u.colorModeForRenderPass(),X=[];for(let N=0;NN.sortKey-Q.sortKey);for(let N of X){let{programConfiguration:Q,program:te,layoutVertexBuffer:ae,indexBuffer:fe,uniformValues:be,terrainData:ze}=N.state;te.draw(L,O.TRIANGLES,U,Z,G,Ht.disabled,be,ze,_.id,ae,fe,N.segments,_.paint,u.transform.zoom,Q)}})(e,n,s,o);break;case"heatmap":(function(u,m,_,y){if(_.paint.get("heatmap-opacity")===0)return;let b=u.context;if(u.style.map.terrain){for(let T of y){let C=m.getTile(T);m.hasRenderableParent(T)||(u.renderPass==="offscreen"?vo(u,C,_,T):u.renderPass==="translucent"&&Dn(u,_,T))}b.viewport.set([0,0,u.width,u.height])}else u.renderPass==="offscreen"?function(T,C,P,L){let O=T.context,U=O.gl,Z=Yt.disabled,G=new di([U.ONE,U.ONE],p.aM.transparent,[!0,!0,!0,!0]);(function(X,N,Q){let te=X.gl;X.activeTexture.set(te.TEXTURE1),X.viewport.set([0,0,N.width/4,N.height/4]);let ae=Q.heatmapFbos.get(p.aU);ae?(te.bindTexture(te.TEXTURE_2D,ae.colorAttachment.get()),X.bindFramebuffer.set(ae.framebuffer)):(ae=Ia(X,N.width/4,N.height/4),Q.heatmapFbos.set(p.aU,ae))})(O,T,P),O.clear({color:p.aM.transparent});for(let X=0;X20&&T.texParameterf(T.TEXTURE_2D,b.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,b.extTextureFilterAnisotropicMax);let Se=u.style.map.terrain&&u.style.map.terrain.getTerrainData(X),Ce=Se?X:null,Ge=Ce?Ce.posMatrix:u.transform.calculatePosMatrix(X.toUnwrapped(),G),ct=Ou(Ge,ze||[0,0],be||1,fe,_);C instanceof Wi?P.draw(b,T.TRIANGLES,N,Yt.disabled,L,Ht.disabled,ct,Se,_.id,C.boundsBuffer,u.quadTriangleIndexBuffer,C.boundsSegments):P.draw(b,T.TRIANGLES,N,O[X.overscaledZ],L,Ht.disabled,ct,Se,_.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments)}})(e,n,s,o);break;case"background":(function(u,m,_,y){let b=_.paint.get("background-color"),T=_.paint.get("background-opacity");if(T===0)return;let C=u.context,P=C.gl,L=u.transform,O=L.tileSize,U=_.paint.get("background-pattern");if(u.isPatternMissing(U))return;let Z=!U&&b.a===1&&T===1&&u.opaquePassEnabledForLayer()?"opaque":"translucent";if(u.renderPass!==Z)return;let G=Yt.disabled,X=u.depthModeForSublayer(0,Z==="opaque"?At.ReadWrite:At.ReadOnly),N=u.colorModeForRenderPass(),Q=u.useProgram(U?"backgroundPattern":"background"),te=y||L.coveringTiles({tileSize:O,terrain:u.style.map.terrain});U&&(C.activeTexture.set(P.TEXTURE0),u.imageManager.bind(u.context));let ae=_.getCrossfadeParameters();for(let fe of te){let be=y?fe.posMatrix:u.transform.calculatePosMatrix(fe.toUnwrapped()),ze=U?ao(be,T,u,U,{tileID:fe,tileSize:O},ae):is(be,T,b),Ne=u.style.map.terrain&&u.style.map.terrain.getTerrainData(fe);Q.draw(C,P.TRIANGLES,X,G,N,Ht.disabled,ze,Ne,_.id,u.tileExtentBuffer,u.quadTriangleIndexBuffer,u.tileExtentSegments)}})(e,0,s,o);break;case"custom":(function(u,m,_){let y=u.context,b=_.implementation;if(u.renderPass==="offscreen"){let T=b.prerender;T&&(u.setCustomLayerDefaults(),y.setColorMode(u.colorModeForRenderPass()),T.call(b,y.gl,u.transform.customLayerMatrix()),y.setDirty(),u.setBaseState())}else if(u.renderPass==="translucent"){u.setCustomLayerDefaults(),y.setColorMode(u.colorModeForRenderPass()),y.setStencilMode(Yt.disabled);let T=b.renderingMode==="3d"?new At(u.context.gl.LEQUAL,At.ReadWrite,u.depthRangeFor3D):u.depthModeForSublayer(0,At.ReadOnly);y.setDepthMode(T),b.render(y.gl,u.transform.customLayerMatrix(),{farZ:u.transform.farZ,nearZ:u.transform.nearZ,fov:u.transform._fov,modelViewProjectionMatrix:u.transform.modelViewProjectionMatrix,projectionMatrix:u.transform.projectionMatrix}),y.setDirty(),u.setBaseState(),y.bindFramebuffer.set(null)}})(e,0,s)}}translatePosMatrix(e,n,s,o,u){if(!s[0]&&!s[1])return e;let m=u?o==="map"?this.transform.angle:0:o==="viewport"?-this.transform.angle:0;if(m){let b=Math.sin(m),T=Math.cos(m);s=[s[0]*T-s[1]*b,s[0]*b+s[1]*T]}let _=[u?s[0]:Ct(n,s[0],this.transform.zoom),u?s[1]:Ct(n,s[1],this.transform.zoom),0],y=new Float32Array(16);return p.J(y,e,_),y}saveTileTexture(e){let n=this._tileTextures[e.size[0]];n?n.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){let n=this._tileTextures[e];return n&&n.length>0?n.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;let n=this.imageManager.getPattern(e.from.toString()),s=this.imageManager.getPattern(e.to.toString());return!n||!s}useProgram(e,n){this.cache=this.cache||{};let s=e+(n?n.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[s]||(this.cache[s]=new ro(this.context,ln[e],n,so[e],this._showOverdrawInspector,this.style.map.terrain)),this.cache[s]}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(){let e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new ye(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){let{drawingBufferWidth:e,drawingBufferHeight:n}=this.context.gl;return this.width!==e||this.height!==n}}class Kn{constructor(e,n){this.points=e,this.planes=n}static fromInvProjectionMatrix(e,n,s){let o=Math.pow(2,s),u=[[-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(_=>{let y=1/(_=p.af([],_,e))[3]/n*o;return p.b1(_,_,[y,y,1/_[3],y])}),m=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(_=>{let y=function(P,L){var O=L[0],U=L[1],Z=L[2],G=O*O+U*U+Z*Z;return G>0&&(G=1/Math.sqrt(G)),P[0]=L[0]*G,P[1]=L[1]*G,P[2]=L[2]*G,P}([],function(P,L,O){var U=L[0],Z=L[1],G=L[2],X=O[0],N=O[1],Q=O[2];return P[0]=Z*Q-G*N,P[1]=G*X-U*Q,P[2]=U*N-Z*X,P}([],Ye([],u[_[0]],u[_[1]]),Ye([],u[_[2]],u[_[1]]))),b=-((T=y)[0]*(C=u[_[1]])[0]+T[1]*C[1]+T[2]*C[2]);var T,C;return y.concat(b)});return new Kn(u,m)}}class Yn{constructor(e,n){this.min=e,this.max=n,this.center=function(s,o,u){return s[0]=.5*o[0],s[1]=.5*o[1],s[2]=.5*o[2],s}([],function(s,o,u){return s[0]=o[0]+u[0],s[1]=o[1]+u[1],s[2]=o[2]+u[2],s}([],this.min,this.max))}quadrant(e){let n=[e%2==0,e<2],s=Pe(this.min),o=Pe(this.max);for(let u=0;u=0&&m++;if(m===0)return 0;m!==n.length&&(s=!1)}if(s)return 2;for(let o=0;o<3;o++){let u=Number.MAX_VALUE,m=-Number.MAX_VALUE;for(let _=0;_this.max[o]-this.min[o])return 0}return 1}}class Qn{constructor(e=0,n=0,s=0,o=0){if(isNaN(e)||e<0||isNaN(n)||n<0||isNaN(s)||s<0||isNaN(o)||o<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=n,this.left=s,this.right=o}interpolate(e,n,s){return n.top!=null&&e.top!=null&&(this.top=p.y.number(e.top,n.top,s)),n.bottom!=null&&e.bottom!=null&&(this.bottom=p.y.number(e.bottom,n.bottom,s)),n.left!=null&&e.left!=null&&(this.left=p.y.number(e.left,n.left,s)),n.right!=null&&e.right!=null&&(this.right=p.y.number(e.right,n.right,s)),this}getCenter(e,n){let s=p.ac((this.left+e-this.right)/2,0,e),o=p.ac((this.top+n-this.bottom)/2,0,n);return new p.P(s,o)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new Qn(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}let bo=85.051129;class ea{constructor(e,n,s,o,u){this.tileSize=512,this._renderWorldCopies=u===void 0||!!u,this._minZoom=e||0,this._maxZoom=n||22,this._minPitch=s??0,this._maxPitch=o??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new p.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Qn,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){let e=new ea(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return e.apply(this),e}apply(e){this.tileSize=e.tileSize,this.latRange=e.latRange,this.lngRange=e.lngRange,this.width=e.width,this.height=e.height,this._center=e._center,this._elevation=e._elevation,this.minElevationForCurrentTile=e.minElevationForCurrentTile,this.zoom=e.zoom,this.angle=e.angle,this._fov=e._fov,this._pitch=e._pitch,this._unmodified=e._unmodified,this._edgeInsets=e._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new p.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(e){let n=-p.b3(e,-180,180)*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=function(){var s=new p.A(4);return p.A!=Float32Array&&(s[1]=0,s[2]=0),s[0]=1,s[3]=1,s}(),function(s,o,u){var m=o[0],_=o[1],y=o[2],b=o[3],T=Math.sin(u),C=Math.cos(u);s[0]=m*C+y*T,s[1]=_*C+b*T,s[2]=m*-T+y*C,s[3]=_*-T+b*C}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(e){let n=p.ac(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(e){e=Math.max(.01,Math.min(60,e)),this._fov!==e&&(this._unmodified=!1,this._fov=e/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(e){let n=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this.tileZoom=Math.max(0,Math.floor(n)),this.scale=this.zoomScale(n),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,n,s){this._unmodified=!1,this._edgeInsets.interpolate(e,n,s),this._constrain(),this._calcMatrices()}coveringZoomLevel(e){let n=(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(e){let n=[new p.b4(0,e)];if(this._renderWorldCopies){let s=this.pointCoordinate(new p.P(0,0)),o=this.pointCoordinate(new p.P(this.width,0)),u=this.pointCoordinate(new p.P(this.width,this.height)),m=this.pointCoordinate(new p.P(0,this.height)),_=Math.floor(Math.min(s.x,o.x,u.x,m.x)),y=Math.floor(Math.max(s.x,o.x,u.x,m.x)),b=1;for(let T=_-b;T<=y+b;T++)T!==0&&n.push(new p.b4(T,e))}return n}coveringTiles(e){var n,s;let o=this.coveringZoomLevel(e),u=o;if(e.minzoom!==void 0&&oe.maxzoom&&(o=e.maxzoom);let m=this.pointCoordinate(this.getCameraPoint()),_=p.Z.fromLngLat(this.center),y=Math.pow(2,o),b=[y*m.x,y*m.y,0],T=[y*_.x,y*_.y,0],C=Kn.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,o),P=e.minzoom||0;!e.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(P=o);let L=e.terrain?2/Math.min(this.tileSize,e.tileSize)*this.tileSize:3,O=N=>({aabb:new Yn([N*y,0,0],[(N+1)*y,y,0]),zoom:0,x:0,y:0,wrap:N,fullyVisible:!1}),U=[],Z=[],G=o,X=e.reparseOverscaled?u:o;if(this._renderWorldCopies)for(let N=1;N<=3;N++)U.push(O(-N)),U.push(O(N));for(U.push(O(0));U.length>0;){let N=U.pop(),Q=N.x,te=N.y,ae=N.fullyVisible;if(!ae){let Se=N.aabb.intersects(C);if(Se===0)continue;ae=Se===2}let fe=e.terrain?b:T,be=N.aabb.distanceX(fe),ze=N.aabb.distanceY(fe),Ne=Math.max(Math.abs(be),Math.abs(ze));if(N.zoom===G||Ne>L+(1<=P){let Se=G-N.zoom,Ce=b[0]-.5-(Q<>1),ct=N.zoom+1,ke=N.aabb.quadrant(Se);if(e.terrain){let Re=new p.S(ct,N.wrap,ct,Ce,Ge),ot=e.terrain.getMinMaxElevation(Re),ii=(n=ot.minElevation)!==null&&n!==void 0?n:this.elevation,vt=(s=ot.maxElevation)!==null&&s!==void 0?s:this.elevation;ke=new Yn([ke.min[0],ke.min[1],ii],[ke.max[0],ke.max[1],vt])}U.push({aabb:ke,zoom:ct,x:Ce,y:Ge,wrap:N.wrap,fullyVisible:ae})}}return Z.sort((N,Q)=>N.distanceSq-Q.distanceSq).map(N=>N.tileID)}resize(e,n){this.width=e,this.height=n,this.pixelsToGLUnits=[2/e,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(e){let n=p.ac(e.lat,-85.051129,bo);return new p.P(p.O(e.lng)*this.worldSize,p.Q(n)*this.worldSize)}unproject(e){return new p.Z(e.x/this.worldSize,e.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(e){let n=this.elevation,s=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,o=this.pointLocation(this.centerPoint,e),u=e.getElevationForLngLatZoom(o,this.tileZoom);if(!(this.elevation-u))return;let m=s+n-u,_=Math.cos(this._pitch)*this.cameraToCenterDistance/m/p.b5(1,o.lat),y=this.scaleZoom(_/this.tileSize);this._elevation=u,this._center=o,this.zoom=y}setLocationAtPoint(e,n){let s=this.pointCoordinate(n),o=this.pointCoordinate(this.centerPoint),u=this.locationCoordinate(e),m=new p.Z(u.x-(s.x-o.x),u.y-(s.y-o.y));this.center=this.coordinateLocation(m),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(e,n){return n?this.coordinatePoint(this.locationCoordinate(e),n.getElevationForLngLatZoom(e,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(e))}pointLocation(e,n){return this.coordinateLocation(this.pointCoordinate(e,n))}locationCoordinate(e){return p.Z.fromLngLat(e)}coordinateLocation(e){return e&&e.toLngLat()}pointCoordinate(e,n){if(n){let P=n.pointCoordinate(e);if(P!=null)return P}let s=[e.x,e.y,0,1],o=[e.x,e.y,1,1];p.af(s,s,this.pixelMatrixInverse),p.af(o,o,this.pixelMatrixInverse);let u=s[3],m=o[3],_=s[1]/u,y=o[1]/m,b=s[2]/u,T=o[2]/m,C=b===T?0:(0-b)/(T-b);return new p.Z(p.y.number(s[0]/u,o[0]/m,C)/this.worldSize,p.y.number(_,y,C)/this.worldSize)}coordinatePoint(e,n=0,s=this.pixelMatrix){let o=[e.x*this.worldSize,e.y*this.worldSize,n,1];return p.af(o,o,s),new p.P(o[0]/o[3],o[1]/o[3])}getBounds(){let e=Math.max(0,this.height/2-this.getHorizon());return new oe().extend(this.pointLocation(new p.P(0,e))).extend(this.pointLocation(new p.P(this.width,e))).extend(this.pointLocation(new p.P(this.width,this.height))).extend(this.pointLocation(new p.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new oe([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(e){e?(this.lngRange=[e.getWest(),e.getEast()],this.latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,bo])}calculateTileMatrix(e){let n=e.canonical,s=this.worldSize/this.zoomScale(n.z),o=n.x+Math.pow(2,n.z)*e.wrap,u=p.an(new Float64Array(16));return p.J(u,u,[o*s,n.y*s,0]),p.K(u,u,[s/p.X,s/p.X,1]),u}calculatePosMatrix(e,n=!1){let s=e.key,o=n?this._alignedPosMatrixCache:this._posMatrixCache;if(o[s])return o[s];let u=this.calculateTileMatrix(e);return p.L(u,n?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,u),o[s]=new Float32Array(u),o[s]}calculateFogMatrix(e){let n=e.key,s=this._fogMatrixCache;if(s[n])return s[n];let o=this.calculateTileMatrix(e);return p.L(o,this.fogMatrix,o),s[n]=new Float32Array(o),s[n]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(e,n){n=p.ac(+n,this.minZoom,this.maxZoom);let s={center:new p.N(e.lng,e.lat),zoom:n},o=this.lngRange;if(!this._renderWorldCopies&&o===null){let N=179.9999999999;o=[-N,N]}let u=this.tileSize*this.zoomScale(s.zoom),m=0,_=u,y=0,b=u,T=0,C=0,{x:P,y:L}=this.size;if(this.latRange){let N=this.latRange;m=p.Q(N[1])*u,_=p.Q(N[0])*u,_-m_&&(G=_-N)}if(o){let N=(y+b)/2,Q=O;this._renderWorldCopies&&(Q=p.b3(O,N-u/2,N+u/2));let te=P/2;Q-teb&&(Z=b-te)}if(Z!==void 0||G!==void 0){let N=new p.P(Z??O,G??U);s.center=this.unproject.call({worldSize:u},N).wrap()}return s}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let e=this._unmodified,{center:n,zoom:s}=this.getConstrained(this.center,this.zoom);this.center=n,this.zoom=s,this._unmodified=e,this._constraining=!1}_calcMatrices(){if(!this.height)return;let e=this.centerOffset,n=this.point.x,s=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=p.b5(1,this.center.lat)*this.worldSize;let o=p.an(new Float64Array(16));p.K(o,o,[this.width/2,-this.height/2,1]),p.J(o,o,[1,-1,0]),this.labelPlaneMatrix=o,o=p.an(new Float64Array(16)),p.K(o,o,[1,-1,1]),p.J(o,o,[-1,-1,0]),p.K(o,o,[2/this.width,2/this.height,1]),this.glCoordMatrix=o;let u=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),m=Math.min(this.elevation,this.minElevationForCurrentTile),_=u-m*this._pixelPerMeter/Math.cos(this._pitch),y=m<0?_:u,b=Math.PI/2+this._pitch,T=this._fov*(.5+e.y/this.height),C=Math.sin(T)*y/Math.sin(p.ac(Math.PI-b-T,.01,Math.PI-.01)),P=this.getHorizon(),L=2*Math.atan(P/this.cameraToCenterDistance)*(.5+e.y/(2*P)),O=Math.sin(L)*y/Math.sin(p.ac(Math.PI-b-L,.01,Math.PI-.01)),U=Math.min(C,O);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*U+y),this.nearZ=this.height/50,o=new Float64Array(16),p.b6(o,this._fov,this.width/this.height,this.nearZ,this.farZ),o[8]=2*-e.x/this.width,o[9]=2*e.y/this.height,this.projectionMatrix=p.ae(o),p.K(o,o,[1,-1,1]),p.J(o,o,[0,0,-this.cameraToCenterDistance]),p.b7(o,o,this._pitch),p.ad(o,o,this.angle),p.J(o,o,[-n,-s,0]),this.mercatorMatrix=p.K([],o,[this.worldSize,this.worldSize,this.worldSize]),p.K(o,o,[1,1,this._pixelPerMeter]),this.pixelMatrix=p.L(new Float64Array(16),this.labelPlaneMatrix,o),p.J(o,o,[0,0,-this.elevation]),this.modelViewProjectionMatrix=o,this.invModelViewProjectionMatrix=p.as([],o),this.fogMatrix=new Float64Array(16),p.b6(this.fogMatrix,this._fov,this.width/this.height,u,this.farZ),this.fogMatrix[8]=2*-e.x/this.width,this.fogMatrix[9]=2*e.y/this.height,p.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),p.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),p.b7(this.fogMatrix,this.fogMatrix,this._pitch),p.ad(this.fogMatrix,this.fogMatrix,this.angle),p.J(this.fogMatrix,this.fogMatrix,[-n,-s,0]),p.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),p.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=p.L(new Float64Array(16),this.labelPlaneMatrix,o);let Z=this.width%2/2,G=this.height%2/2,X=Math.cos(this.angle),N=Math.sin(this.angle),Q=n-Math.round(n)+X*Z+N*G,te=s-Math.round(s)+X*G+N*Z,ae=new Float64Array(o);if(p.J(ae,ae,[Q>.5?Q-1:Q,te>.5?te-1:te,0]),this.alignedModelViewProjectionMatrix=ae,o=p.as(new Float64Array(16),this.pixelMatrix),!o)throw new Error("failed to invert matrix");this.pixelMatrixInverse=o,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;let e=this.pointCoordinate(new p.P(0,0)),n=[e.x*this.worldSize,e.y*this.worldSize,0,1];return p.af(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){let e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new p.P(0,e))}getCameraQueryGeometry(e){let n=this.getCameraPoint();if(e.length===1)return[e[0],n];{let s=n.x,o=n.y,u=n.x,m=n.y;for(let _ of e)s=Math.min(s,_.x),o=Math.min(o,_.y),u=Math.max(u,_.x),m=Math.max(m,_.y);return[new p.P(s,o),new p.P(u,o),new p.P(u,m),new p.P(s,m),new p.P(s,o)]}}lngLatToCameraDepth(e,n){let s=this.locationCoordinate(e),o=[s.x*this.worldSize,s.y*this.worldSize,n,1];return p.af(o,o,this.modelViewProjectionMatrix),o[2]/o[3]}}function Pa(c,e){let n,s=!1,o=null,u=null,m=()=>{o=null,s&&(c.apply(u,n),o=setTimeout(m,e),s=!1)};return(..._)=>(s=!0,u=this,n=_,o||m(),o)}class ds{constructor(e){this._getCurrentHash=()=>{let n=window.location.hash.replace("#","");if(this._hashName){let s;return n.split("&").map(o=>o.split("=")).forEach(o=>{o[0]===this._hashName&&(s=o)}),(s&&s[1]||"").split("/")}return n.split("/")},this._onHashChange=()=>{let n=this._getCurrentHash();if(n.length>=3&&!n.some(s=>isNaN(s))){let s=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(n[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+n[2],+n[1]],zoom:+n[0],bearing:s,pitch:+(n[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{let n=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,n)},this._removeHash=()=>{let n=this._getCurrentHash();if(n.length===0)return;let s=n.join("/"),o=s;o.split("&").length>0&&(o=o.split("&")[0]),this._hashName&&(o=`${this._hashName}=${s}`);let u=window.location.hash.replace(o,"");u.startsWith("#&")?u=u.slice(0,1)+u.slice(2):u==="#"&&(u="");let m=window.location.href.replace(/(#.+)?$/,u);m=m.replace("&&","&"),window.history.replaceState(window.history.state,null,m)},this._updateHash=Pa(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,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(e){let n=this._map.getCenter(),s=Math.round(100*this._map.getZoom())/100,o=Math.ceil((s*Math.LN2+Math.log(512/360/.5))/Math.LN10),u=Math.pow(10,o),m=Math.round(n.lng*u)/u,_=Math.round(n.lat*u)/u,y=this._map.getBearing(),b=this._map.getPitch(),T="";if(T+=e?`/${m}/${_}/${s}`:`${s}/${_}/${m}`,(y||b)&&(T+="/"+Math.round(10*y)/10),b&&(T+=`/${Math.round(b)}`),this._hashName){let C=this._hashName,P=!1,L=window.location.hash.slice(1).split("&").map(O=>{let U=O.split("=")[0];return U===C?(P=!0,`${U}=${T}`):O}).filter(O=>O);return P||L.push(`${C}=${T}`),`#${L.join("&")}`}return`#${T}`}}let fs={linearity:.3,easing:p.b8(0,0,.3,1)},wo=p.e({deceleration:2500,maxSpeed:1400},fs),Ku=p.e({deceleration:20,maxSpeed:1400},fs),Ul=p.e({deceleration:1e3,maxSpeed:360},fs),ms=p.e({deceleration:1e3,maxSpeed:90},fs);class Ao{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:se.now(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,n=se.now();for(;e.length>0&&n-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let n={zoom:0,bearing:0,pitch:0,pan:new p.P(0,0),pinchAround:void 0,around:void 0};for(let{settings:u}of this._inertiaBuffer)n.zoom+=u.zoomDelta||0,n.bearing+=u.bearingDelta||0,n.pitch+=u.pitchDelta||0,u.panDelta&&n.pan._add(u.panDelta),u.around&&(n.around=u.around),u.pinchAround&&(n.pinchAround=u.pinchAround);let s=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,o={};if(n.pan.mag()){let u=Ba(n.pan.mag(),s,p.e({},wo,e||{}));o.offset=n.pan.mult(u.amount/n.pan.mag()),o.center=this._map.transform.center,za(o,u)}if(n.zoom){let u=Ba(n.zoom,s,Ku);o.zoom=this._map.transform.zoom+u.amount,za(o,u)}if(n.bearing){let u=Ba(n.bearing,s,Ul);o.bearing=this._map.transform.bearing+p.ac(u.amount,-179,179),za(o,u)}if(n.pitch){let u=Ba(n.pitch,s,ms);o.pitch=this._map.transform.pitch+u.amount,za(o,u)}if(o.zoom||o.bearing){let u=n.pinchAround===void 0?n.around:n.pinchAround;o.around=u?this._map.unproject(u):this._map.getCenter()}return this.clear(),p.e(o,{noMoveStart:!0})}}function za(c,e){(!c.duration||c.durationn.unproject(y)),_=u.reduce((y,b,T,C)=>y.add(b.div(C.length)),new p.P(0,0));super(e,{points:u,point:_,lngLats:m,lngLat:n.unproject(_),originalEvent:s}),this._defaultPrevented=!1}}class jl extends p.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,n,s){super(e,{originalEvent:s}),this._defaultPrevented=!1}}class $l{constructor(e,n){this._map=e,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new jl(e.type,this._map,e))}mousedown(e,n){return this._mousedownPos=n,this._firePreventable(new Pi(e.type,this._map,e))}mouseup(e){this._map.fire(new Pi(e.type,this._map,e))}click(e,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Pi(e.type,this._map,e))}dblclick(e){return this._firePreventable(new Pi(e.type,this._map,e))}mouseover(e){this._map.fire(new Pi(e.type,this._map,e))}mouseout(e){this._map.fire(new Pi(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Sn(e.type,this._map,e))}touchmove(e){this._map.fire(new Sn(e.type,this._map,e))}touchend(e){this._map.fire(new Sn(e.type,this._map,e))}touchcancel(e){this._map.fire(new Sn(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class fi{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new Pi(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Pi("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new Pi(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Rr{constructor(e){this._map=e}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(e){return this.transform.pointLocation(p.P.convert(e),this._map.terrain)}}class pr{constructor(e,n){this._map=e,this._tr=new Rr(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=n.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,n){this.isEnabled()&&e.shiftKey&&e.button===0&&(W.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(e,n){if(!this._active)return;let s=n;if(this._lastPos.equals(s)||!this._box&&s.dist(this._startPos)u.fitScreenCoordinates(s,o,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(W.remove(this._box),this._box=null),W.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,n){return this._map.fire(new p.k(e,{originalEvent:n}))}}function La(c,e){if(c.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${c.length}, points ${e.length}`);let n={};for(let s=0;sthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),s.length===this.numTouches&&(this.centroid=function(o){let u=new p.P(0,0);for(let m of o)u._add(m);return u.div(o.length)}(n),this.touches=La(s,n)))}touchmove(e,n,s){if(this.aborted||!this.centroid)return;let o=La(s,n);for(let u in this.touches){let m=o[u];(!m||m.dist(this.touches[u])>30)&&(this.aborted=!0)}}touchend(e,n,s){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),s.length===0){let o=!this.aborted&&this.centroid;if(this.reset(),o)return o}}}class gs{constructor(e){this.singleTap=new Eo(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,n,s){this.singleTap.touchstart(e,n,s)}touchmove(e,n,s){this.singleTap.touchmove(e,n,s)}touchend(e,n,s){let o=this.singleTap.touchend(e,n,s);if(o){let u=e.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(o)<30;if(u&&m||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=o,this.count===this.numTaps)return this.reset(),o}}}class ta{constructor(e){this._tr=new Rr(e),this._zoomIn=new gs({numTouches:1,numTaps:2}),this._zoomOut=new gs({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,n,s){this._zoomIn.touchstart(e,n,s),this._zoomOut.touchstart(e,n,s)}touchmove(e,n,s){this._zoomIn.touchmove(e,n,s),this._zoomOut.touchmove(e,n,s)}touchend(e,n,s){let o=this._zoomIn.touchend(e,n,s),u=this._zoomOut.touchend(e,n,s),m=this._tr;return o?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:m.zoom+1,around:m.unproject(o)},{originalEvent:e})}):u?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:m.zoom-1,around:m.unproject(u)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class tn{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){let n=this._moveFunction(...e);if(n.bearingDelta||n.pitchDelta||n.around||n.panDelta)return this._active=!0,n}dragStart(e,n){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=n.length?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,n){if(!this.isEnabled())return;let s=this._lastPoint;if(!s)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);let o=n.length?n[0]:n;return!this._moved&&o.dist(s){c.mousedown=c.dragStart,c.mousemoveWindow=c.dragMove,c.mouseup=c.dragEnd,c.contextmenu=e=>{e.preventDefault()}},Do=({enable:c,clickTolerance:e,bearingDegreesPerPixelMoved:n=.8})=>{let s=new _s({checkCorrectEvent:o=>W.mouseButton(o)===0&&o.ctrlKey||W.mouseButton(o)===2});return new tn({clickTolerance:e,move:(o,u)=>({bearingDelta:(u.x-o.x)*n}),moveStateManager:s,enable:c,assignEvents:ys})},So=({enable:c,clickTolerance:e,pitchDegreesPerPixelMoved:n=-.5})=>{let s=new _s({checkCorrectEvent:o=>W.mouseButton(o)===0&&o.ctrlKey||W.mouseButton(o)===2});return new tn({clickTolerance:e,move:(o,u)=>({pitchDelta:(u.y-o.y)*n}),moveStateManager:s,enable:c,assignEvents:ys})};class In{constructor(e,n){this._clickTolerance=e.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new p.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,n,s){return this._calculateTransform(e,n,s)}touchmove(e,n,s){if(this._active){if(!this._shouldBePrevented(s.length))return e.preventDefault(),this._calculateTransform(e,n,s);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,n,s){this._calculateTransform(e,n,s),this._active&&this._shouldBePrevented(s.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,n,s){s.length>0&&(this._active=!0);let o=La(s,n),u=new p.P(0,0),m=new p.P(0,0),_=0;for(let b in o){let T=o[b],C=this._touches[b];C&&(u._add(T),m._add(T.sub(C)),_++,o[b]=T)}if(this._touches=o,this._shouldBePrevented(_)||!m.mag())return;let y=m.div(_);return this._sum._add(y),this._sum.mag()Math.abs(c.x)}class ia extends vs{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,n,s){super.touchstart(e,n,s),this._currentTouchCount=s.length}_start(e){this._lastPoints=e,xs(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,n,s){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let o=e[0].sub(this._lastPoints[0]),u=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(o,u,s.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(o.y+u.y)/2*-.5}):void 0}gestureBeginsVertically(e,n,s){if(this._valid!==void 0)return this._valid;let o=e.mag()>=2,u=n.mag()>=2;if(!o&&!u)return;if(!o||!u)return this._firstMove===void 0&&(this._firstMove=s),s-this._firstMove<100&&void 0;let m=e.y>0==n.y>0;return xs(e)&&xs(n)&&m}}let Zl={panStep:100,bearingStep:15,pitchStep:10};class br{constructor(e){this._tr=new Rr(e);let n=Zl;this._panStep=n.panStep,this._bearingStep=n.bearingStep,this._pitchStep=n.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let n=0,s=0,o=0,u=0,m=0;switch(e.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:e.shiftKey?s=-1:(e.preventDefault(),u=-1);break;case 39:e.shiftKey?s=1:(e.preventDefault(),u=1);break;case 38:e.shiftKey?o=1:(e.preventDefault(),m=-1);break;case 40:e.shiftKey?o=-1:(e.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(s=0,o=0),{cameraAnimation:_=>{let y=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:Hr,zoom:n?Math.round(y.zoom)+n*(e.shiftKey?2:1):y.zoom,bearing:y.bearing+s*this._bearingStep,pitch:y.pitch+o*this._pitchStep,offset:[-u*this._panStep,-m*this._panStep],center:y.center},{originalEvent:e})}}}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 Hr(c){return c*(2-c)}let zo=4.000244140625;class Fr{constructor(e,n){this._onTimeout=s=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(s)},this._map=e,this._tr=new Rr(e),this._triggerRenderFrame=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let n=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,s=se.now(),o=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,n!==0&&n%zo==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":o>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(o*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),e.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=e,this._delta-=n,this._active||this._start(e)),e.preventDefault()}_start(e){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);let n=W.mousePos(this._map.getCanvas(),e),s=this._tr;this._around=n.y>s.transform.height/2-s.transform.getHorizon()?p.N.convert(this._aroundCenter?s.center:s.unproject(n)):p.N.convert(s.center),this._aroundPoint=s.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let e=this._tr.transform;if(this._delta!==0){let y=this._type==="wheel"&&Math.abs(this._delta)>zo?this._wheelZoomRate:this._defaultZoomRate,b=2/(1+Math.exp(-Math.abs(this._delta*y)));this._delta<0&&b!==0&&(b=1/b);let T=typeof this._targetZoom=="number"?e.zoomScale(this._targetZoom):e.scale;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(T*b))),this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let n=typeof this._targetZoom=="number"?this._targetZoom:e.zoom,s=this._startZoom,o=this._easing,u,m=!1,_=se.now()-this._lastWheelEventTime;if(this._type==="wheel"&&s&&o&&_){let y=Math.min(_/200,1),b=o(y);u=p.y.number(s,n,b),y<1?this._frameId||(this._frameId=!0):m=!0}else u=n,m=!0;return this._active=!0,m&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!m,zoomDelta:u-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let n=p.b9;if(this._prevEase){let s=this._prevEase,o=(se.now()-s.start)/s.duration,u=s.easing(o+.01)-s.easing(o),m=.27/Math.sqrt(u*u+1e-4)*.01,_=Math.sqrt(.0729-m*m);n=p.b8(m,_,.25,1)}return this._prevEase={start:se.now(),duration:e,easing:n},n}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class kn{constructor(e,n){this._clickZoom=e,this._tapZoom=n}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 Yu{constructor(e){this._tr=new Rr(e),this.reset()}reset(){this._active=!1}dblclick(e,n){return e.preventDefault(),{cameraAnimation:s=>{s.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(n)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Qu{constructor(){this._tap=new gs({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(e,n,s){if(!this._swipePoint)if(this._tapTime){let o=n[0],u=e.timeStamp-this._tapTime<500,m=this._tapPoint.dist(o)<30;u&&m?s.length>0&&(this._swipePoint=o,this._swipeTouch=s[0].identifier):this.reset()}else this._tap.touchstart(e,n,s)}touchmove(e,n,s){if(this._tapTime){if(this._swipePoint){if(s[0].identifier!==this._swipeTouch)return;let o=n[0],u=o.y-this._swipePoint.y;return this._swipePoint=o,e.preventDefault(),this._active=!0,{zoomDelta:u/128}}}else this._tap.touchmove(e,n,s)}touchend(e,n,s){if(this._tapTime)this._swipePoint&&s.length===0&&this.reset();else{let o=this._tap.touchend(e,n,s);o&&(this._tapTime=e.timeStamp,this._tapPoint=o)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Gl{constructor(e,n,s){this._el=e,this._mousePan=n,this._touchPan=s}enable(e){this._inertiaOptions=e||{},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 Hl{constructor(e,n,s){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=n,this._mousePitch=s}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Bo{constructor(e,n,s,o){this._el=e,this._touchZoom=n,this._touchRotate=s,this._tapDragZoom=o,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),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 ra{constructor(e,n){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=e,this._options=n,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=W.create("div","maplibregl-cooperative-gesture-screen",e);let n=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(n=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let s=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),o=document.createElement("div");o.className="maplibregl-desktop-message",o.textContent=n,this._container.appendChild(o);let u=document.createElement("div");u.className="maplibregl-mobile-message",u.textContent=s,this._container.appendChild(u),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(W.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(e){return e[this._bypassKey]}notifyGestureBlocked(e,n){this._enabled&&(this._map.fire(new p.k("cooperativegestureprevented",{gestureType:e,originalEvent:n})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}let wr=c=>c.zoom||c.drag||c.pitch||c.rotate;class Ue extends p.k{}function bs(c){return c.panDelta&&c.panDelta.mag()||c.zoomDelta||c.bearingDelta||c.pitchDelta}class Lo{constructor(e,n){this.handleWindowEvent=o=>{this.handleEvent(o,`${o.type}Window`)},this.handleEvent=(o,u)=>{if(o.type==="blur")return void this.stop(!0);this._updatingCamera=!0;let m=o.type==="renderFrame"?void 0:o,_={needsRenderFrame:!1},y={},b={},T=o.touches,C=T?this._getMapTouches(T):void 0,P=C?W.touchPos(this._map.getCanvas(),C):W.mousePos(this._map.getCanvas(),o);for(let{handlerName:U,handler:Z,allowed:G}of this._handlers){if(!Z.isEnabled())continue;let X;this._blockedByActive(b,G,U)?Z.reset():Z[u||o.type]&&(X=Z[u||o.type](o,P,C),this.mergeHandlerResult(_,y,X,U,m),X&&X.needsRenderFrame&&this._triggerRenderFrame()),(X||Z.isActive())&&(b[U]=Z)}let L={};for(let U in this._previousActiveHandlers)b[U]||(L[U]=m);this._previousActiveHandlers=b,(Object.keys(L).length||bs(_))&&(this._changes.push([_,y,L]),this._triggerRenderFrame()),(Object.keys(b).length||bs(_))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:O}=_;O&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],O(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Ao(e),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n);let s=this._el;this._listeners=[[s,"touchstart",{passive:!0}],[s,"touchmove",{passive:!1}],[s,"touchend",void 0],[s,"touchcancel",void 0],[s,"mousedown",void 0],[s,"mousemove",void 0],[s,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[s,"mouseover",void 0],[s,"mouseout",void 0],[s,"dblclick",void 0],[s,"click",void 0],[s,"keydown",{capture:!1}],[s,"keyup",void 0],[s,"wheel",{passive:!1}],[s,"contextmenu",void 0],[window,"blur",void 0]];for(let[o,u,m]of this._listeners)W.addEventListener(o,u,o===document?this.handleWindowEvent:this.handleEvent,m)}destroy(){for(let[e,n,s]of this._listeners)W.removeEventListener(e,n,e===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(e){let n=this._map,s=n.getCanvasContainer();this._add("mapEvent",new $l(n,e));let o=n.boxZoom=new pr(n,e);this._add("boxZoom",o),e.interactive&&e.boxZoom&&o.enable();let u=n.cooperativeGestures=new ra(n,e.cooperativeGestures);this._add("cooperativeGestures",u),e.cooperativeGestures&&u.enable();let m=new ta(n),_=new Yu(n);n.doubleClickZoom=new kn(_,m),this._add("tapZoom",m),this._add("clickZoom",_),e.interactive&&e.doubleClickZoom&&n.doubleClickZoom.enable();let y=new Qu;this._add("tapDragZoom",y);let b=n.touchPitch=new ia(n);this._add("touchPitch",b),e.interactive&&e.touchPitch&&n.touchPitch.enable(e.touchPitch);let T=Do(e),C=So(e);n.dragRotate=new Hl(e,T,C),this._add("mouseRotate",T,["mousePitch"]),this._add("mousePitch",C,["mouseRotate"]),e.interactive&&e.dragRotate&&n.dragRotate.enable();let P=(({enable:X,clickTolerance:N})=>{let Q=new _s({checkCorrectEvent:te=>W.mouseButton(te)===0&&!te.ctrlKey});return new tn({clickTolerance:N,move:(te,ae)=>({around:ae,panDelta:ae.sub(te)}),activateOnStart:!0,moveStateManager:Q,enable:X,assignEvents:ys})})(e),L=new In(e,n);n.dragPan=new Gl(s,P,L),this._add("mousePan",P),this._add("touchPan",L,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&n.dragPan.enable(e.dragPan);let O=new Po,U=new ko;n.touchZoomRotate=new Bo(s,U,O,y),this._add("touchRotate",O,["touchPan","touchZoom"]),this._add("touchZoom",U,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&n.touchZoomRotate.enable(e.touchZoomRotate);let Z=n.scrollZoom=new Fr(n,()=>this._triggerRenderFrame());this._add("scrollZoom",Z,["mousePan"]),e.interactive&&e.scrollZoom&&n.scrollZoom.enable(e.scrollZoom);let G=n.keyboard=new br(n);this._add("keyboard",G),e.interactive&&e.keyboard&&n.keyboard.enable(),this._add("blockableMapEvent",new fi(n))}_add(e,n,s){this._handlers.push({handlerName:e,handler:n,allowed:s}),this._handlersById[e]=n}stop(e){if(!this._updatingCamera){for(let{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!wr(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,n,s){for(let o in e)if(o!==s&&(!n||n.indexOf(o)<0))return!0;return!1}_getMapTouches(e){let n=[];for(let s of e)this._el.contains(s.target)&&n.push(s);return n}mergeHandlerResult(e,n,s,o,u){if(!s)return;p.e(e,s);let m={handlerName:o,originalEvent:s.originalEvent||u};s.zoomDelta!==void 0&&(n.zoom=m),s.panDelta!==void 0&&(n.drag=m),s.pitchDelta!==void 0&&(n.pitch=m),s.bearingDelta!==void 0&&(n.rotate=m)}_applyChanges(){let e={},n={},s={};for(let[o,u,m]of this._changes)o.panDelta&&(e.panDelta=(e.panDelta||new p.P(0,0))._add(o.panDelta)),o.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+o.zoomDelta),o.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+o.bearingDelta),o.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+o.pitchDelta),o.around!==void 0&&(e.around=o.around),o.pinchAround!==void 0&&(e.pinchAround=o.pinchAround),o.noInertia&&(e.noInertia=o.noInertia),p.e(n,u),p.e(s,m);this._updateMapTransform(e,n,s),this._changes=[]}_updateMapTransform(e,n,s){let o=this._map,u=o._getTransformForUpdate(),m=o.terrain;if(!(bs(e)||m&&this._terrainMovement))return this._fireEvents(n,s,!0);let{panDelta:_,zoomDelta:y,bearingDelta:b,pitchDelta:T,around:C,pinchAround:P}=e;P!==void 0&&(C=P),o._stop(!0),C=C||o.transform.centerPoint;let L=u.pointLocation(_?C.sub(_):C);b&&(u.bearing+=b),T&&(u.pitch+=T),y&&(u.zoom+=y),m?this._terrainMovement||!n.drag&&!n.zoom?n.drag&&this._terrainMovement?u.center=u.pointLocation(u.centerPoint.sub(_)):u.setLocationAtPoint(L,C):(this._terrainMovement=!0,this._map._elevationFreeze=!0,u.setLocationAtPoint(L,C)):u.setLocationAtPoint(L,C),o._applyUpdatedTransform(u),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(n,s,!0)}_fireEvents(e,n,s){let o=wr(this._eventsInProgress),u=wr(e),m={};for(let C in e){let{originalEvent:P}=e[C];this._eventsInProgress[C]||(m[`${C}start`]=P),this._eventsInProgress[C]=e[C]}!o&&u&&this._fireEvent("movestart",u.originalEvent);for(let C in m)this._fireEvent(C,m[C]);u&&this._fireEvent("move",u.originalEvent);for(let C in e){let{originalEvent:P}=e[C];this._fireEvent(C,P)}let _={},y;for(let C in this._eventsInProgress){let{handlerName:P,originalEvent:L}=this._eventsInProgress[C];this._handlersById[P].isActive()||(delete this._eventsInProgress[C],y=n[P]||L,_[`${C}end`]=y)}for(let C in _)this._fireEvent(C,_[C]);let b=wr(this._eventsInProgress),T=(o||u)&&!b;if(T&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;let C=this._map._getTransformForUpdate();C.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(C)}if(s&&T){this._updatingCamera=!0;let C=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),P=L=>L!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new Ue("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Xl extends p.E{constructor(e,n){super(),this._renderFrameCallback=()=>{let s=Math.min((se.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(s)),s<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=n.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new p.N(this.transform.center.lng,this.transform.center.lat)}setCenter(e,n){return this.jumpTo({center:e},n)}panBy(e,n,s){return e=p.P.convert(e).mult(-1),this.panTo(this.transform.center,p.e({offset:e},n),s)}panTo(e,n,s){return this.easeTo(p.e({center:e},n),s)}getZoom(){return this.transform.zoom}setZoom(e,n){return this.jumpTo({zoom:e},n),this}zoomTo(e,n,s){return this.easeTo(p.e({zoom:e},n),s)}zoomIn(e,n){return this.zoomTo(this.getZoom()+1,e,n),this}zoomOut(e,n){return this.zoomTo(this.getZoom()-1,e,n),this}getBearing(){return this.transform.bearing}setBearing(e,n){return this.jumpTo({bearing:e},n),this}getPadding(){return this.transform.padding}setPadding(e,n){return this.jumpTo({padding:e},n),this}rotateTo(e,n,s){return this.easeTo(p.e({bearing:e},n),s)}resetNorth(e,n){return this.rotateTo(0,p.e({duration:1e3},e),n),this}resetNorthPitch(e,n){return this.easeTo(p.e({bearing:0,pitch:0,duration:1e3},e),n),this}snapToNorth(e,n){return Math.abs(this.getBearing()){if(this._zooming&&(o.zoom=p.y.number(u,Z,fe)),this._rotating&&(o.bearing=p.y.number(m,b,fe)),this._pitching&&(o.pitch=p.y.number(_,T,fe)),this._padding&&(o.interpolatePadding(y,C,fe),L=o.centerPoint.add(P)),this.terrain&&!e.freezeElevation&&this._updateElevation(fe),Q)o.setLocationAtPoint(Q,te);else{let be=o.zoomScale(o.zoom-u),ze=Z>u?Math.min(2,N):Math.max(.5,N),Ne=Math.pow(ze,1-fe),Se=o.unproject(G.add(X.mult(fe*Ne)).mult(be));o.setLocationAtPoint(o.renderWorldCopies?Se.wrap():Se,L)}this._applyUpdatedTransform(o),this._fireMoveEvents(n)},fe=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(n,fe)},e),this}_prepareEase(e,n,s={}){this._moving=!0,n||s.moving||this.fire(new p.k("movestart",e)),this._zooming&&!s.zooming&&this.fire(new p.k("zoomstart",e)),this._rotating&&!s.rotating&&this.fire(new p.k("rotatestart",e)),this._pitching&&!s.pitching&&this.fire(new p.k("pitchstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);let n=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&n!==this._elevationTarget){let s=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(s-(n-(s*e+this._elevationStart))/(1-e)),this._elevationTarget=n}this.transform.elevation=p.y.number(this._elevationStart,this._elevationTarget,e)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){let n=e.getCameraPosition(),s=this.terrain.getElevationForLngLatZoom(n.lngLat,e.zoom);if(n.altitudethis._elevateCameraIfInsideTerrain(o)),this.transformCameraUpdate&&n.push(o=>this.transformCameraUpdate(o)),!n.length)return;let s=e.clone();for(let o of n){let u=s.clone(),{center:m,zoom:_,pitch:y,bearing:b,elevation:T}=o(u);m&&(u.center=m),_!==void 0&&(u.zoom=_),y!==void 0&&(u.pitch=y),b!==void 0&&(u.bearing=b),T!==void 0&&(u.elevation=T),s.apply(u)}this.transform.apply(s)}_fireMoveEvents(e){this.fire(new p.k("move",e)),this._zooming&&this.fire(new p.k("zoom",e)),this._rotating&&this.fire(new p.k("rotate",e)),this._pitching&&this.fire(new p.k("pitch",e))}_afterEase(e,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;let s=this._zooming,o=this._rotating,u=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,s&&this.fire(new p.k("zoomend",e)),o&&this.fire(new p.k("rotateend",e)),u&&this.fire(new p.k("pitchend",e)),this.fire(new p.k("moveend",e))}flyTo(e,n){var s;if(!e.essential&&se.prefersReducedMotion){let Re=p.M(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Re,n)}this.stop(),e=p.e({offset:[0,0],speed:1.2,curve:1.42,easing:p.b9},e);let o=this._getTransformForUpdate(),u=o.zoom,m=o.bearing,_=o.pitch,y=o.padding,b="bearing"in e?this._normalizeBearing(e.bearing,m):m,T="pitch"in e?+e.pitch:_,C="padding"in e?e.padding:o.padding,P=p.P.convert(e.offset),L=o.centerPoint.add(P),O=o.pointLocation(L),{center:U,zoom:Z}=o.getConstrained(p.N.convert(e.center||O),(s=e.zoom)!==null&&s!==void 0?s:u);this._normalizeCenter(U,o);let G=o.zoomScale(Z-u),X=o.project(O),N=o.project(U).sub(X),Q=e.curve,te=Math.max(o.width,o.height),ae=te/G,fe=N.mag();if("minZoom"in e){let Re=p.ac(Math.min(e.minZoom,u,Z),o.minZoom,o.maxZoom),ot=te/o.zoomScale(Re-u);Q=Math.sqrt(ot/fe*2)}let be=Q*Q;function ze(Re){let ot=(ae*ae-te*te+(Re?-1:1)*be*be*fe*fe)/(2*(Re?ae:te)*be*fe);return Math.log(Math.sqrt(ot*ot+1)-ot)}function Ne(Re){return(Math.exp(Re)-Math.exp(-Re))/2}function Se(Re){return(Math.exp(Re)+Math.exp(-Re))/2}let Ce=ze(!1),Ge=function(Re){return Se(Ce)/Se(Ce+Q*Re)},ct=function(Re){return te*((Se(Ce)*(Ne(ot=Ce+Q*Re)/Se(ot))-Ne(Ce))/be)/fe;var ot},ke=(ze(!0)-Ce)/Q;if(Math.abs(fe)<1e-6||!isFinite(ke)){if(Math.abs(te-ae)<1e-6)return this.easeTo(e,n);let Re=ae0,Ge=ot=>Math.exp(Re*Q*ot)}return e.duration="duration"in e?+e.duration:1e3*ke/("screenSpeed"in e?+e.screenSpeed/Q:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=m!==b,this._pitching=T!==_,this._padding=!o.isPaddingEqual(C),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(U),this._ease(Re=>{let ot=Re*ke,ii=1/Ge(ot);o.zoom=Re===1?Z:u+o.scaleZoom(ii),this._rotating&&(o.bearing=p.y.number(m,b,Re)),this._pitching&&(o.pitch=p.y.number(_,T,Re)),this._padding&&(o.interpolatePadding(y,C,Re),L=o.centerPoint.add(P)),this.terrain&&!e.freezeElevation&&this._updateElevation(Re);let vt=Re===1?U:o.unproject(X.add(N.mult(ct(ot))).mult(ii));o.setLocationAtPoint(o.renderWorldCopies?vt.wrap():vt,L),this._applyUpdatedTransform(o),this._fireMoveEvents(n)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(n)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,n){var s;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let o=this._onEaseEnd;delete this._onEaseEnd,o.call(this,n)}return e||(s=this.handlers)===null||s===void 0||s.stop(!1),this}_ease(e,n,s){s.animate===!1||s.duration===0?(e(1),n()):(this._easeStart=se.now(),this._easeOptions=s,this._onEaseFrame=e,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,n){e=p.b3(e,-180,180);let s=Math.abs(e-n);return Math.abs(e-360-n)180?-360:s<-180?360:0}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(p.N.convert(e),this.transform.tileZoom)-this.transform.elevation:null}}let na={compact:!0,customAttribution:'MapLibre'};class aa{constructor(e=na){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=n=>{!n||n.sourceDataType!=="metadata"&&n.sourceDataType!=="visibility"&&n.dataType!=="style"&&n.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=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=W.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=W.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=W.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(){W.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(e,n){let s=this._map._getUIString(`AttributionControl.${n}`);e.title=s,e.setAttribute("aria-label",s)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(o=>typeof o!="string"?"":o)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let o=this._map.style.stylesheet;this.styleOwner=o.owner,this.styleId=o.id}let n=this._map.style.sourceCaches;for(let o in n){let u=n[o];if(u.used||u.usedForTerrain){let m=u.getSource();m.attribution&&e.indexOf(m.attribution)<0&&e.push(m.attribution)}}e=e.filter(o=>String(o).trim()),e.sort((o,u)=>o.length-u.length),e=e.filter((o,u)=>{for(let m=u+1;m=0)return!1;return!0});let s=e.join(" | ");s!==this._attribHTML&&(this._attribHTML=s,e.length?(this._innerContainer.innerHTML=s,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Ro{constructor(e={}){this._updateCompact=()=>{let n=this._container.children;if(n.length){let s=n[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&s.classList.add("maplibregl-compact"):s.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=W.create("div","maplibregl-ctrl");let n=W.create("a","maplibregl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){W.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class It{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let n=++this._id;return this._queue.push({callback:e,id:n,cancelled:!1}),n}remove(e){let n=this._currentlyRunning,s=n?this._queue.concat(n):this._queue;for(let o of s)if(o.id===e)return void(o.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");let n=this._currentlyRunning=this._queue;this._queue=[];for(let s of n)if(!s.cancelled&&(s.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Fo=p.Y([{name:"a_pos3d",type:"Int16",components:3}]);class ec extends p.E{constructor(e){super(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,e.usedForTerrain=!0,e.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,n){this.sourceCache.update(e,n),this._renderableTilesKeys=[];let s={};for(let o of e.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))s[o.key]=!0,this._renderableTilesKeys.push(o.key),this._tiles[o.key]||(o.posMatrix=new Float64Array(16),p.aP(o.posMatrix,0,p.X,0,p.X,0,1),this._tiles[o.key]=new Pr(o,this.tileSize));for(let o in this._tiles)s[o]||delete this._tiles[o]}freeRtt(e){for(let n in this._tiles){let s=this._tiles[n];(!e||s.tileID.equals(e)||s.tileID.isChildOf(e)||e.isChildOf(s.tileID))&&(s.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e){let n={};for(let s of this._renderableTilesKeys){let o=this._tiles[s].tileID;if(o.canonical.equals(e.canonical)){let u=e.clone();u.posMatrix=new Float64Array(16),p.aP(u.posMatrix,0,p.X,0,p.X,0,1),n[s]=u}else if(o.canonical.isChildOf(e.canonical)){let u=e.clone();u.posMatrix=new Float64Array(16);let m=o.canonical.z-e.canonical.z,_=o.canonical.x-(o.canonical.x>>m<>m<>m;p.aP(u.posMatrix,0,b,0,b,0,1),p.J(u.posMatrix,u.posMatrix,[-_*b,-y*b,0]),n[s]=u}else if(e.canonical.isChildOf(o.canonical)){let u=e.clone();u.posMatrix=new Float64Array(16);let m=e.canonical.z-o.canonical.z,_=e.canonical.x-(e.canonical.x>>m<>m<>m;p.aP(u.posMatrix,0,p.X,0,p.X,0,1),p.J(u.posMatrix,u.posMatrix,[_*b,y*b,0]),p.K(u.posMatrix,u.posMatrix,[1/2**m,1/2**m,0]),n[s]=u}}return n}getSourceTile(e,n){let s=this.sourceCache._source,o=e.overscaledZ-this.deltaZoom;if(o>s.maxzoom&&(o=s.maxzoom),o=s.minzoom&&(!u||!u.dem);)u=this.sourceCache.getTileByID(e.scaledTo(o--).key);return u}tilesAfterTime(e=Date.now()){return Object.values(this._tiles).filter(n=>n.timeAdded>=e)}}class Oo{constructor(e,n,s){this.painter=e,this.sourceCache=new ec(n),this.options=s,this.exaggeration=typeof s.exaggeration=="number"?s.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,n,s,o=p.X){var u;if(!(n>=0&&n=0&&se.canonical.z&&(e.canonical.z>=o?u=e.canonical.z-o:p.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let m=e.canonical.x-(e.canonical.x>>u<>u<>8<<4|u>>8,n[m+3]=0;let s=new p.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),o=new ye(e,s,e.gl.RGBA,{premultiply:!1});return o.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=o,o}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);let n=new Uint8Array(4),s=this.painter.context,o=s.gl,u=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),m=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),_=Math.round(this.painter.height/devicePixelRatio);s.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),o.readPixels(u,_-m-1,1,1,o.RGBA,o.UNSIGNED_BYTE,n),s.bindFramebuffer.set(null);let y=n[0]+(n[2]>>4<<8),b=n[1]+((15&n[2])<<8),T=this.coordsIndex[255-n[3]],C=T&&this.sourceCache.getTileByID(T);if(!C)return null;let P=this._coordsTextureSize,L=(1<e.id!==n),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(let n of this._recentlyUsed)if(!this._objects[n].inUse)return this._objects[n];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");let e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(let e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length!e.inUse)===!1}}let sa={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Wl{constructor(e,n){this.painter=e,this.terrain=n,this.pool=new tc(e.context,30,n.sourceCache.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,n){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter(s=>!e._layers[s].isHidden(n)),this._coordsDescendingInv={};for(let s in e.sourceCaches){this._coordsDescendingInv[s]={};let o=e.sourceCaches[s].getVisibleCoordinates();for(let u of o){let m=this.terrain.sourceCache.getTerrainCoords(u);for(let _ in m)this._coordsDescendingInv[s][_]||(this._coordsDescendingInv[s][_]=[]),this._coordsDescendingInv[s][_].push(m[_])}}this._coordsDescendingInvStr={};for(let s of e._order){let o=e._layers[s],u=o.source;if(sa[o.type]&&!this._coordsDescendingInvStr[u]){this._coordsDescendingInvStr[u]={};for(let m in this._coordsDescendingInv[u])this._coordsDescendingInvStr[u][m]=this._coordsDescendingInv[u][m].map(_=>_.key).sort().join()}}for(let s of this._renderableTiles)for(let o in this._coordsDescendingInvStr){let u=this._coordsDescendingInvStr[o][s.tileID.key];u&&u!==s.rttCoords[o]&&(s.rtt=[])}}renderLayer(e){if(e.isHidden(this.painter.transform.zoom))return!1;let n=e.type,s=this.painter,o=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(sa[n]&&(this._prevType&&sa[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(e.id),!o))return!0;if(sa[this._prevType]||sa[n]&&o){this._prevType=n;let u=this._stacks.length-1,m=this._stacks[u]||[];for(let _ of this._renderableTiles){if(this.pool.isFull()&&(Vl(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(_),_.rtt[u]){let b=this.pool.getObjectForId(_.rtt[u].id);if(b.stamp===_.rtt[u].stamp){this.pool.useObject(b);continue}}let y=this.pool.getOrCreateFreeObject();this.pool.useObject(y),this.pool.stampObject(y),_.rtt[u]={id:y.id,stamp:y.stamp},s.context.bindFramebuffer.set(y.fbo.framebuffer),s.context.clear({color:p.aM.transparent,stencil:0}),s.currentStencilSource=void 0;for(let b=0;b{c.touchstart=c.dragStart,c.touchmoveWindow=c.dragMove,c.touchend=c.dragEnd},rc={showCompass:!0,showZoom:!0,visualizePitch:!1};class nc{constructor(e,n,s=!1){this.mousedown=m=>{this.startMouse(p.e({},m,{ctrlKey:!0,preventDefault:()=>m.preventDefault()}),W.mousePos(this.element,m)),W.addEventListener(window,"mousemove",this.mousemove),W.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=m=>{this.moveMouse(m,W.mousePos(this.element,m))},this.mouseup=m=>{this.mouseRotate.dragEnd(m),this.mousePitch&&this.mousePitch.dragEnd(m),this.offTemp()},this.touchstart=m=>{m.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=W.touchPos(this.element,m.targetTouches)[0],this.startTouch(m,this._startPos),W.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),W.addEventListener(window,"touchend",this.touchend))},this.touchmove=m=>{m.targetTouches.length!==1?this.reset():(this._lastPos=W.touchPos(this.element,m.targetTouches)[0],this.moveTouch(m,this._lastPos))},this.touchend=m=>{m.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;let o=e.dragRotate._mouseRotate.getClickTolerance(),u=e.dragRotate._mousePitch.getClickTolerance();this.element=n,this.mouseRotate=Do({clickTolerance:o,enable:!0}),this.touchRotate=(({enable:m,clickTolerance:_,bearingDegreesPerPixelMoved:y=.8})=>{let b=new Co;return new tn({clickTolerance:_,move:(T,C)=>({bearingDelta:(C.x-T.x)*y}),moveStateManager:b,enable:m,assignEvents:qo})})({clickTolerance:o,enable:!0}),this.map=e,s&&(this.mousePitch=So({clickTolerance:u,enable:!0}),this.touchPitch=(({enable:m,clickTolerance:_,pitchDegreesPerPixelMoved:y=-.5})=>{let b=new Co;return new tn({clickTolerance:_,move:(T,C)=>({pitchDelta:(C.y-T.y)*y}),moveStateManager:b,enable:m,assignEvents:qo})})({clickTolerance:u,enable:!0})),W.addEventListener(n,"mousedown",this.mousedown),W.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),W.addEventListener(n,"touchcancel",this.reset)}startMouse(e,n){this.mouseRotate.dragStart(e,n),this.mousePitch&&this.mousePitch.dragStart(e,n),W.disableDrag()}startTouch(e,n){this.touchRotate.dragStart(e,n),this.touchPitch&&this.touchPitch.dragStart(e,n),W.disableDrag()}moveMouse(e,n){let s=this.map,{bearingDelta:o}=this.mouseRotate.dragMove(e,n)||{};if(o&&s.setBearing(s.getBearing()+o),this.mousePitch){let{pitchDelta:u}=this.mousePitch.dragMove(e,n)||{};u&&s.setPitch(s.getPitch()+u)}}moveTouch(e,n){let s=this.map,{bearingDelta:o}=this.touchRotate.dragMove(e,n)||{};if(o&&s.setBearing(s.getBearing()+o),this.touchPitch){let{pitchDelta:u}=this.touchPitch.dragMove(e,n)||{};u&&s.setPitch(s.getPitch()+u)}}off(){let e=this.element;W.removeEventListener(e,"mousedown",this.mousedown),W.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),W.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),W.removeEventListener(window,"touchend",this.touchend),W.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){W.enableDrag(),W.removeEventListener(window,"mousemove",this.mousemove),W.removeEventListener(window,"mouseup",this.mouseup),W.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),W.removeEventListener(window,"touchend",this.touchend)}}let dr;function ti(c,e,n){let s=new p.N(c.lng,c.lat);if(c=new p.N(c.lng,c.lat),e){let o=new p.N(c.lng-360,c.lat),u=new p.N(c.lng+360,c.lat),m=n.locationPoint(c).distSqr(e);n.locationPoint(o).distSqr(e)180;){let o=n.locationPoint(c);if(o.x>=0&&o.y>=0&&o.x<=n.width&&o.y<=n.height)break;c.lng>n.center.lng?c.lng-=360:c.lng+=360}return c.lng!==s.lng&&n.locationPoint(c).y>n.height/2-n.getHorizon()?c:s}let oa={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 ws(c,e,n){let s=c.classList;for(let o in oa)s.remove(`maplibregl-${n}-anchor-${o}`);s.add(`maplibregl-${n}-anchor-${e}`)}class As extends p.E{constructor(e){if(super(),this._onKeyPress=n=>{let s=n.code,o=n.charCode||n.keyCode;s!=="Space"&&s!=="Enter"&&o!==32&&o!==13||this.togglePopup()},this._onMapClick=n=>{let s=n.originalEvent.target,o=this._element;this._popup&&(s===o||o.contains(s))&&this.togglePopup()},this._update=n=>{var s;if(!this._map)return;let o=this._map.loaded()&&!this._map.isMoving();(n?.type==="terrain"||n?.type==="render"&&!o)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?ti(this._lngLat,this._flatPos,this._map.transform):(s=this._lngLat)===null||s===void 0?void 0:s.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let u="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?u=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(u=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let m="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?m="rotateX(0deg)":this._pitchAlignment==="map"&&(m=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||n&&n.type!=="moveend"||(this._pos=this._pos.round()),W.setTransform(this._element,`${oa[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${m} ${u}`),se.frameAsync(new AbortController).then(()=>{this._updateOpacity(n&&n.type==="moveend")}).catch(()=>{})},this._onMove=n=>{if(!this._isDragging){let s=this._clickTolerance||this._map._clickTolerance;this._isDragging=n.point.dist(this._pointerdownPos)>=s}this._isDragging&&(this._pos=n.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 p.k("dragstart"))),this.fire(new p.k("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 p.k("dragend")),this._state="inactive"},this._addDragHandler=n=>{this._element.contains(n.originalEvent.target)&&(n.preventDefault(),this._positionDelta=n.point.sub(this._pos).add(this._offset),this._pointerdownPos=n.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=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._subpixelPositioning=e&&e.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(e?.opacity,e?.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=p.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=W.create("div");let n=W.createNS("http://www.w3.org/2000/svg","svg"),s=41,o=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${s}px`),n.setAttributeNS(null,"width",`${o}px`),n.setAttributeNS(null,"viewBox",`0 0 ${o} ${s}`);let u=W.createNS("http://www.w3.org/2000/svg","g");u.setAttributeNS(null,"stroke","none"),u.setAttributeNS(null,"stroke-width","1"),u.setAttributeNS(null,"fill","none"),u.setAttributeNS(null,"fill-rule","evenodd");let m=W.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"fill-rule","nonzero");let _=W.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");let y=[{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(let G of y){let X=W.createNS("http://www.w3.org/2000/svg","ellipse");X.setAttributeNS(null,"opacity","0.04"),X.setAttributeNS(null,"cx","10.5"),X.setAttributeNS(null,"cy","5.80029008"),X.setAttributeNS(null,"rx",G.rx),X.setAttributeNS(null,"ry",G.ry),_.appendChild(X)}let b=W.createNS("http://www.w3.org/2000/svg","g");b.setAttributeNS(null,"fill",this._color);let T=W.createNS("http://www.w3.org/2000/svg","path");T.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"),b.appendChild(T);let C=W.createNS("http://www.w3.org/2000/svg","g");C.setAttributeNS(null,"opacity","0.25"),C.setAttributeNS(null,"fill","#000000");let P=W.createNS("http://www.w3.org/2000/svg","path");P.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"),C.appendChild(P);let L=W.createNS("http://www.w3.org/2000/svg","g");L.setAttributeNS(null,"transform","translate(6.0, 7.0)"),L.setAttributeNS(null,"fill","#FFFFFF");let O=W.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"transform","translate(8.0, 8.0)");let U=W.createNS("http://www.w3.org/2000/svg","circle");U.setAttributeNS(null,"fill","#000000"),U.setAttributeNS(null,"opacity","0.25"),U.setAttributeNS(null,"cx","5.5"),U.setAttributeNS(null,"cy","5.5"),U.setAttributeNS(null,"r","5.4999962");let Z=W.createNS("http://www.w3.org/2000/svg","circle");Z.setAttributeNS(null,"fill","#FFFFFF"),Z.setAttributeNS(null,"cx","5.5"),Z.setAttributeNS(null,"cy","5.5"),Z.setAttributeNS(null,"r","5.4999962"),O.appendChild(U),O.appendChild(Z),m.appendChild(_),m.appendChild(b),m.appendChild(C),m.appendChild(L),m.appendChild(O),n.appendChild(m),n.setAttributeNS(null,"height",s*this._scale+"px"),n.setAttributeNS(null,"width",o*this._scale+"px"),this._element.appendChild(n),this._offset=p.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",n=>{n.preventDefault()}),this._element.addEventListener("mousedown",n=>{n.preventDefault()}),ws(this._element,this._anchor,"marker"),e&&e.className)for(let n of e.className.split(" "))this._element.classList.add(n);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",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("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),W.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=p.N.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){let o=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[o,-1*(38.1-13.5+o)],"bottom-right":[-o,-1*(38.1-13.5+o)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){let e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var n,s;if(!(!((n=this._map)===null||n===void 0)&&n.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let o=this._map,u=o.terrain.depthAtPoint(this._pos),m=o.terrain.getElevationForLngLatZoom(this._lngLat,o.transform.tileZoom);if(o.transform.lngLatToCameraDepth(this._lngLat,m)-u<.006)return void(this._element.style.opacity=this._opacity);let _=-this._offset.y/o.transform._pixelPerMeter,y=Math.sin(o.getPitch()*Math.PI/180)*_,b=o.terrain.depthAtPoint(new p.P(this._pos.x,this._pos.y-this._offset.y)),T=o.transform.lngLatToCameraDepth(this._lngLat,m+y)-b>.006;!((s=this._popup)===null||s===void 0)&&s.isOpen()&&T&&this._popup.remove(),this._element.style.opacity=T?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=p.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(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(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,n){return e===void 0&&n===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=e),n!==void 0&&(this._opacityWhenCovered=n),this._map&&this._updateOpacity(!0),this}}let Kl={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},Fa=0,Oa=!1,Xr={maxWidth:100,unit:"metric"};function Na(c,e,n){let s=n&&n.maxWidth||100,o=c._container.clientHeight/2,u=c.unproject([0,o]),m=c.unproject([s,o]),_=u.distanceTo(m);if(n&&n.unit==="imperial"){let y=3.2808*_;y>5280?Ze(e,s,y/5280,c._getUIString("ScaleControl.Miles")):Ze(e,s,y,c._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?Ze(e,s,_/1852,c._getUIString("ScaleControl.NauticalMiles")):_>=1e3?Ze(e,s,_/1e3,c._getUIString("ScaleControl.Kilometers")):Ze(e,s,_,c._getUIString("ScaleControl.Meters"))}function Ze(c,e,n,s){let o=function(u){let m=Math.pow(10,`${Math.floor(u)}`.length-1),_=u/m;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(y){let b=Math.pow(10,Math.ceil(-Math.log(y)/Math.LN10));return Math.round(y*b)/b}(_),m*_}(n);c.style.width=e*(o/n)+"px",c.innerHTML=`${o} ${s}`}let rt={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Es=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Ts(c){if(c){if(typeof c=="number"){let e=Math.round(Math.abs(c)/Math.SQRT2);return{center:new p.P(0,0),top:new p.P(0,c),"top-left":new p.P(e,e),"top-right":new p.P(-e,e),bottom:new p.P(0,-c),"bottom-left":new p.P(e,-e),"bottom-right":new p.P(-e,-e),left:new p.P(c,0),right:new p.P(-c,0)}}if(c instanceof p.P||Array.isArray(c)){let e=p.P.convert(c);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:p.P.convert(c.center||[0,0]),top:p.P.convert(c.top||[0,0]),"top-left":p.P.convert(c["top-left"]||[0,0]),"top-right":p.P.convert(c["top-right"]||[0,0]),bottom:p.P.convert(c.bottom||[0,0]),"bottom-left":p.P.convert(c["bottom-left"]||[0,0]),"bottom-right":p.P.convert(c["bottom-right"]||[0,0]),left:p.P.convert(c.left||[0,0]),right:p.P.convert(c.right||[0,0])}}return Ts(new p.P(0,0))}let Vo=ue;E.AJAXError=p.bh,E.Evented=p.E,E.LngLat=p.N,E.MercatorCoordinate=p.Z,E.Point=p.P,E.addProtocol=p.bi,E.config=p.a,E.removeProtocol=p.bj,E.AttributionControl=aa,E.BoxZoomHandler=pr,E.CanvasSource=Ui,E.CooperativeGesturesHandler=ra,E.DoubleClickZoomHandler=kn,E.DragPanHandler=Gl,E.DragRotateHandler=Hl,E.EdgeInsets=Qn,E.FullscreenControl=class extends p.E{constructor(c={}){super(),this._onFullscreenChange=()=>{var e;let n=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((e=n?.shadowRoot)===null||e===void 0)&&e.fullscreenElement;)n=n.shadowRoot.fullscreenElement;n===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,c&&c.container&&(c.container instanceof HTMLElement?this._container=c.container:p.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(c){return this._map=c,this._container||(this._container=this._map.getContainer()),this._controlContainer=W.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){W.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let c=this._fullscreenButton=W.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);W.create("span","maplibregl-ctrl-icon",c).setAttribute("aria-hidden","true"),c.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let c=this._getTitle();this._fullscreenButton.setAttribute("aria-label",c),this._fullscreenButton.title=c}_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 p.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new p.k("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()}},E.GeoJSONSource=_r,E.GeolocateControl=class extends p.E{constructor(c){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new p.k("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,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(e),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new p.k("geolocate",e)),this._finish()}},this._updateCamera=e=>{let n=new p.N(e.coords.longitude,e.coords.latitude),s=e.coords.accuracy,o=this._map.getBearing(),u=p.e({bearing:o},this.options.fitBoundsOptions),m=oe.fromLngLat(n,s);this._map.fitBounds(m,u,{geolocateSource:!0})},this._updateMarker=e=>{if(e){let n=new p.N(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=e.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=e=>{if(this._map){if(this.options.trackUserLocation)if(e.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;let n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&Oa)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new p.k("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=W.create("button","maplibregl-ctrl-geolocate",this._container),W.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(e===!1){p.w("Geolocation support is not available so the GeolocateControl will be disabled.");let n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}else{let n=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=W.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new As({element:this._dotElement}),this._circleElement=W.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new As({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",n=>{n.geolocateSource||this._watchState!=="ACTIVE_LOCK"||n.originalEvent&&n.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 p.k("trackuserlocationend")),this.fire(new p.k("userlocationlostfocus")))})}},this.options=p.e({},Kl,c)}onAdd(c){return this._map=c,this._container=W.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return p._(this,arguments,void 0,function*(e=!1){if(dr!==void 0&&!e)return dr;if(window.navigator.permissions===void 0)return dr=!!window.navigator.geolocation,dr;try{dr=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{dr=!!window.navigator.geolocation}return dr})}().then(e=>this._finishSetupUI(e)),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(),W.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Fa=0,Oa=!1}_isOutOfMapMaxBounds(c){let e=this._map.getMaxBounds(),n=c.coords;return e&&(n.longitudee.getEast()||n.latitudee.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(){let c=this._map.getBounds(),e=c.getSouthEast(),n=c.getNorthEast(),s=e.distanceTo(n),o=Math.ceil(this._accuracy/(s/this._map._container.clientHeight)*2);this._circleElement.style.width=`${o}px`,this._circleElement.style.height=`${o}px`}trigger(){if(!this._setup)return p.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 p.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Fa--,Oa=!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 p.k("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 p.k("trackuserlocationstart")),this.fire(new p.k("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 c;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Fa++,Fa>1?(c={maximumAge:6e5,timeout:0},Oa=!0):(c=this.options.positionOptions,Oa=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,c)}}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)}},E.Hash=ds,E.ImageSource=Wi,E.KeyboardHandler=br,E.LngLatBounds=oe,E.LogoControl=Ro,E.Map=class extends Xl{constructor(c){p.bf.mark(p.bg.create);let e=Object.assign(Object.assign({},ic),c);if(e.minZoom!=null&&e.maxZoom!=null&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(e.minPitch!=null&&e.maxPitch!=null&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(e.minPitch!=null&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(e.maxPitch!=null&&e.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new ea(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies),{bearingSnap:e.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new It,this._controls=[],this._mapId=p.a4(),this._contextLost=n=>{n.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new p.k("webglcontextlost",{originalEvent:n}))},this._contextRestored=n=>{this._setupPainter(),this.resize(),this._update(),this.fire(new p.k("webglcontextrestored",{originalEvent:n}))},this._onMapScroll=n=>{if(n.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._maxTileCacheZoomLevels=e.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=e.preserveDrawingBuffer===!0,this._antialias=e.antialias===!0,this._trackResize=e.trackResize===!0,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles===!0,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions===!0,this._collectResourceTiming=e.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},No),e.locale),this._clickTolerance=e.clickTolerance,this._overridePixelRatio=e.pixelRatio,this._maxCanvasSize=e.maxCanvasSize,this.transformCameraUpdate=e.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=e.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=ge.addThrottleControl(()=>this.isMoving()),this._requestManager=new $e(e.transformRequest),typeof e.container=="string"){if(this._container=document.getElementById(e.container),!this._container)throw new Error(`Container '${e.container}' not found.`)}else{if(!(e.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)).on("moveend",()=>this._update(!1)).on("zoom",()=>this._update(!0)).on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}).once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let n=!1,s=Pa(o=>{this._trackResize&&!this._removed&&(this.resize(o),this.redraw())},50);this._resizeObserver=new ResizeObserver(o=>{n?s(o):n=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Lo(this,e),this._hash=e.hash&&new ds(typeof e.hash=="string"&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,p.e({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,this._validateStyle=e.validateStyle,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new aa(typeof e.attributionControl=="boolean"?void 0:e.attributionControl)),e.maplibreLogo&&this.addControl(new Ro,e.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",n=>{this._update(n.dataType==="style"),this.fire(new p.k(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new p.k(`${n.dataType}dataloading`,n))}),this.on("dataabort",n=>{this.fire(new p.k("sourcedataabort",n))})}_getMapId(){return this._mapId}addControl(c,e){if(e===void 0&&(e=c.getDefaultPosition?c.getDefaultPosition():"top-right"),!c||!c.onAdd)return this.fire(new p.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let n=c.onAdd(this);this._controls.push(c);let s=this._controlPositions[e];return e.indexOf("bottom")!==-1?s.insertBefore(n,s.firstChild):s.appendChild(n),this}removeControl(c){if(!c||!c.onRemove)return this.fire(new p.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let e=this._controls.indexOf(c);return e>-1&&this._controls.splice(e,1),c.onRemove(this),this}hasControl(c){return this._controls.indexOf(c)>-1}calculateCameraOptionsFromTo(c,e,n,s){return s==null&&this.terrain&&(s=this.terrain.getElevationForLngLatZoom(n,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(c,e,n,s)}resize(c){var e;let n=this._containerDimensions(),s=n[0],o=n[1],u=this._getClampedPixelRatio(s,o);if(this._resizeCanvas(s,o,u),this.painter.resize(s,o,u),this.painter.overLimit()){let _=this.painter.context.gl;this._maxCanvasSize=[_.drawingBufferWidth,_.drawingBufferHeight];let y=this._getClampedPixelRatio(s,o);this._resizeCanvas(s,o,y),this.painter.resize(s,o,y)}this.transform.resize(s,o),(e=this._requestedCameraState)===null||e===void 0||e.resize(s,o);let m=!this._moving;return m&&(this.stop(),this.fire(new p.k("movestart",c)).fire(new p.k("move",c))),this.fire(new p.k("resize",c)),m&&this.fire(new p.k("moveend",c)),this}_getClampedPixelRatio(c,e){let{0:n,1:s}=this._maxCanvasSize,o=this.getPixelRatio(),u=c*o,m=e*o;return Math.min(u>n?n/u:1,m>s?s/m:1)*o}getPixelRatio(){var c;return(c=this._overridePixelRatio)!==null&&c!==void 0?c:devicePixelRatio}setPixelRatio(c){this._overridePixelRatio=c,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(c){return this.transform.setMaxBounds(oe.convert(c)),this._update()}setMinZoom(c){if((c=c??-2)>=-2&&c<=this.transform.maxZoom)return this.transform.minZoom=c,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=c,this._update(),this.getZoom()>c&&this.setZoom(c),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(c){if((c=c??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(c>=0&&c<=this.transform.maxPitch)return this.transform.minPitch=c,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(c>=this.transform.minPitch)return this.transform.maxPitch=c,this._update(),this.getPitch()>c&&this.setPitch(c),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(c){return this.transform.renderWorldCopies=c,this._update()}project(c){return this.transform.locationPoint(p.N.convert(c),this.style&&this.terrain)}unproject(c){return this.transform.pointLocation(p.P.convert(c),this.terrain)}isMoving(){var c;return this._moving||((c=this.handlers)===null||c===void 0?void 0:c.isMoving())}isZooming(){var c;return this._zooming||((c=this.handlers)===null||c===void 0?void 0:c.isZooming())}isRotating(){var c;return this._rotating||((c=this.handlers)===null||c===void 0?void 0:c.isRotating())}_createDelegatedListener(c,e,n){if(c==="mouseenter"||c==="mouseover"){let s=!1;return{layers:e,listener:n,delegates:{mousemove:u=>{let m=e.filter(y=>this.getLayer(y)),_=m.length!==0?this.queryRenderedFeatures(u.point,{layers:m}):[];_.length?s||(s=!0,n.call(this,new Pi(c,this,u.originalEvent,{features:_}))):s=!1},mouseout:()=>{s=!1}}}}if(c==="mouseleave"||c==="mouseout"){let s=!1;return{layers:e,listener:n,delegates:{mousemove:m=>{let _=e.filter(y=>this.getLayer(y));(_.length!==0?this.queryRenderedFeatures(m.point,{layers:_}):[]).length?s=!0:s&&(s=!1,n.call(this,new Pi(c,this,m.originalEvent)))},mouseout:m=>{s&&(s=!1,n.call(this,new Pi(c,this,m.originalEvent)))}}}}{let s=o=>{let u=e.filter(_=>this.getLayer(_)),m=u.length!==0?this.queryRenderedFeatures(o.point,{layers:u}):[];m.length&&(o.features=m,n.call(this,o),delete o.features)};return{layers:e,listener:n,delegates:{[c]:s}}}}_saveDelegatedListener(c,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[c]=this._delegatedListeners[c]||[],this._delegatedListeners[c].push(e)}_removeDelegatedListener(c,e,n){if(!this._delegatedListeners||!this._delegatedListeners[c])return;let s=this._delegatedListeners[c];for(let o=0;oe.includes(m))){for(let m in u.delegates)this.off(m,u.delegates[m]);return void s.splice(o,1)}}}on(c,e,n){if(n===void 0)return super.on(c,e);let s=this._createDelegatedListener(c,typeof e=="string"?[e]:e,n);this._saveDelegatedListener(c,s);for(let o in s.delegates)this.on(o,s.delegates[o]);return this}once(c,e,n){if(n===void 0)return super.once(c,e);let s=typeof e=="string"?[e]:e,o=this._createDelegatedListener(c,s,n);for(let u in o.delegates){let m=o.delegates[u];o.delegates[u]=(..._)=>{this._removeDelegatedListener(c,s,n),m(..._)}}this._saveDelegatedListener(c,o);for(let u in o.delegates)this.once(u,o.delegates[u]);return this}off(c,e,n){return n===void 0?super.off(c,e):(this._removeDelegatedListener(c,typeof e=="string"?[e]:e,n),this)}queryRenderedFeatures(c,e){if(!this.style)return[];let n,s=c instanceof p.P||Array.isArray(c),o=s?c:[[0,0],[this.transform.width,this.transform.height]];if(e=e||(s?{}:c)||{},o instanceof p.P||typeof o[0]=="number")n=[p.P.convert(o)];else{let u=p.P.convert(o[0]),m=p.P.convert(o[1]);n=[u,new p.P(m.x,u.y),m,new p.P(u.x,m.y),u]}return this.style.queryRenderedFeatures(n,e,this.transform)}querySourceFeatures(c,e){return this.style.querySourceFeatures(c,e)}setStyle(c,e){return(e=p.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&c?(this._diffStyle(c,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(c,e))}setTransformRequest(c){return this._requestManager.setTransformRequest(c),this}_getUIString(c){let e=this._locale[c];if(e==null)throw new Error(`Missing UI string '${c}'`);return e}_updateStyle(c,e){if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(c,e));let n=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!c)),c?(this.style=new Ja(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof c=="string"?this.style.loadURL(c,e,n):this.style.loadJSON(c,e,n),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Ja(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(c,e){if(typeof c=="string"){let n=this._requestManager.transformRequest(c,"Style");p.h(n,new AbortController).then(s=>{this._updateDiff(s.data,e)}).catch(s=>{s&&this.fire(new p.j(s))})}else typeof c=="object"&&this._updateDiff(c,e)}_updateDiff(c,e){try{this.style.setState(c,e)&&this._update(!0)}catch(n){p.w(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(c,e)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():p.w("There is no style added to the map.")}addSource(c,e){return this._lazyInitEmptyStyle(),this.style.addSource(c,e),this._update(!0)}isSourceLoaded(c){let e=this.style&&this.style.sourceCaches[c];if(e!==void 0)return e.loaded();this.fire(new p.j(new Error(`There is no source with ID '${c}'`)))}setTerrain(c){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),c){let e=this.style.sourceCaches[c.source];if(!e)throw new Error(`cannot load terrain, because there exists no source with ID: ${c.source}`);this.terrain===null&&e.reload();for(let n in this.style._layers){let s=this.style._layers[n];s.type==="hillshade"&&s.source===c.source&&p.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.")}this.terrain=new Oo(this.painter,e,c),this.painter.renderToTexture=new Wl(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=n=>{n.dataType==="style"?this.terrain.sourceCache.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId!==c.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(n.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.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new p.k("terrain",{terrain:c})),this}getTerrain(){var c,e;return(e=(c=this.terrain)===null||c===void 0?void 0:c.options)!==null&&e!==void 0?e:null}areTilesLoaded(){let c=this.style&&this.style.sourceCaches;for(let e in c){let n=c[e]._tiles;for(let s in n){let o=n[s];if(o.state!=="loaded"&&o.state!=="errored")return!1}}return!0}removeSource(c){return this.style.removeSource(c),this._update(!0)}getSource(c){return this.style.getSource(c)}addImage(c,e,n={}){let{pixelRatio:s=1,sdf:o=!1,stretchX:u,stretchY:m,content:_,textFitWidth:y,textFitHeight:b}=n;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||p.b(e))){if(e.width===void 0||e.height===void 0)return this.fire(new p.j(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`")));{let{width:T,height:C,data:P}=e,L=e;return this.style.addImage(c,{data:new p.R({width:T,height:C},new Uint8Array(P)),pixelRatio:s,stretchX:u,stretchY:m,content:_,textFitWidth:y,textFitHeight:b,sdf:o,version:0,userImage:L}),L.onAdd&&L.onAdd(this,c),this}}{let{width:T,height:C,data:P}=se.getImageData(e);this.style.addImage(c,{data:new p.R({width:T,height:C},P),pixelRatio:s,stretchX:u,stretchY:m,content:_,textFitWidth:y,textFitHeight:b,sdf:o,version:0})}}updateImage(c,e){let n=this.style.getImage(c);if(!n)return this.fire(new p.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let s=e instanceof HTMLImageElement||p.b(e)?se.getImageData(e):e,{width:o,height:u,data:m}=s;if(o===void 0||u===void 0)return this.fire(new p.j(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(o!==n.data.width||u!==n.data.height)return this.fire(new p.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));let _=!(e instanceof HTMLImageElement||p.b(e));return n.data.replace(m,_),this.style.updateImage(c,n),this}getImage(c){return this.style.getImage(c)}hasImage(c){return c?!!this.style.getImage(c):(this.fire(new p.j(new Error("Missing required image id"))),!1)}removeImage(c){this.style.removeImage(c)}loadImage(c){return ge.getImage(this._requestManager.transformRequest(c,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(c,e){return this._lazyInitEmptyStyle(),this.style.addLayer(c,e),this._update(!0)}moveLayer(c,e){return this.style.moveLayer(c,e),this._update(!0)}removeLayer(c){return this.style.removeLayer(c),this._update(!0)}getLayer(c){return this.style.getLayer(c)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(c,e,n){return this.style.setLayerZoomRange(c,e,n),this._update(!0)}setFilter(c,e,n={}){return this.style.setFilter(c,e,n),this._update(!0)}getFilter(c){return this.style.getFilter(c)}setPaintProperty(c,e,n,s={}){return this.style.setPaintProperty(c,e,n,s),this._update(!0)}getPaintProperty(c,e){return this.style.getPaintProperty(c,e)}setLayoutProperty(c,e,n,s={}){return this.style.setLayoutProperty(c,e,n,s),this._update(!0)}getLayoutProperty(c,e){return this.style.getLayoutProperty(c,e)}setGlyphs(c,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(c,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(c,e,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(c,e,n,s=>{s||this._update(!0)}),this}removeSprite(c){return this._lazyInitEmptyStyle(),this.style.removeSprite(c),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(c,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(c,e,n=>{n||this._update(!0)}),this}setLight(c,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(c,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(c){return this._lazyInitEmptyStyle(),this.style.setSky(c),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(c,e){return this.style.setFeatureState(c,e),this._update()}removeFeatureState(c,e){return this.style.removeFeatureState(c,e),this._update()}getFeatureState(c){return this.style.getFeatureState(c)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let c=0,e=0;return this._container&&(c=this._container.clientWidth||400,e=this._container.clientHeight||300),[c,e]}_setupContainer(){let c=this._container;c.classList.add("maplibregl-map");let e=this._canvasContainer=W.create("div","maplibregl-canvas-container",c);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=W.create("canvas","maplibregl-canvas",e),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");let n=this._containerDimensions(),s=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],s);let o=this._controlContainer=W.create("div","maplibregl-control-container",c),u=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(m=>{u[m]=W.create("div",`maplibregl-ctrl-${m} `,o)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(c,e,n){this._canvas.width=Math.floor(n*c),this._canvas.height=Math.floor(n*e),this._canvas.style.width=`${c}px`,this._canvas.style.height=`${e}px`}_setupPainter(){let c={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1},e=null;this._canvas.addEventListener("webglcontextcreationerror",s=>{e={requestedAttributes:c},s&&(e.statusMessage=s.statusMessage,e.type=s.type)},{once:!0});let n=this._canvas.getContext("webgl2",c)||this._canvas.getContext("webgl",c);if(!n){let s="Failed to initialize WebGL";throw e?(e.message=s,new Error(JSON.stringify(e))):new Error(s)}this.painter=new ps(n,this.transform),Mt.testSupport(n)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(c){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||c,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(c){return this._update(),this._renderTaskQueue.add(c)}_cancelRenderFrame(c){this._renderTaskQueue.remove(c)}_render(c){let e=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(c),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let o=this.transform.zoom,u=se.now();this.style.zoomHistory.update(o,u);let m=new p.z(o,{now:u,fadeDuration:e,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),_=m.crossFadingFactor();_===1&&_===this._crossFadingFactor||(n=!0,this._crossFadingFactor=_),this.style.update(m)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,e,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:e,showPadding:this.showPadding}),this.fire(new p.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,p.bf.mark(p.bg.load),this.fire(new p.k("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let s=this._sourcesDirty||this._styleDirty||this._placementDirty;return s||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new p.k("idle")),!this._loaded||this._fullyLoaded||s||(this._fullyLoaded=!0,p.bf.mark(p.bg.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var c;this._hash&&this._hash.remove();for(let n of this._controls)n.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),ge.removeThrottleControl(this._imageQueueHandle),(c=this._resizeObserver)===null||c===void 0||c.disconnect();let e=this.painter.context.gl.getExtension("WEBGL_lose_context");e?.loseContext&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),W.remove(this._canvasContainer),W.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),p.bf.clearMetrics(),this._removed=!0,this.fire(new p.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,se.frameAsync(this._frameRequest).then(c=>{p.bf.frame(c),this._frameRequest=null,this._render(c)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(c){this._showTileBoundaries!==c&&(this._showTileBoundaries=c,this._update())}get showPadding(){return!!this._showPadding}set showPadding(c){this._showPadding!==c&&(this._showPadding=c,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(c){this._showCollisionBoxes!==c&&(this._showCollisionBoxes=c,c?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(c){this._showOverdrawInspector!==c&&(this._showOverdrawInspector=c,this._update())}get repaint(){return!!this._repaint}set repaint(c){this._repaint!==c&&(this._repaint=c,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(c){this._vertices=c,this._update()}get version(){return Jl}getCameraTargetElevation(){return this.transform.elevation}},E.MapMouseEvent=Pi,E.MapTouchEvent=Sn,E.MapWheelEvent=jl,E.Marker=As,E.NavigationControl=class{constructor(c){this._updateZoomButtons=()=>{let e=this._map.getZoom(),n=e===this._map.getMaxZoom(),s=e===this._map.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=s,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",s.toString())},this._rotateCompassArrow=()=>{let e=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=e},this._setButtonTitle=(e,n)=>{let s=this._map._getUIString(`NavigationControl.${n}`);e.title=s,e.setAttribute("aria-label",s)},this.options=p.e({},rc,c),this._container=W.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),W.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),W.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=W.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(c){return this._map=c,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._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new nc(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){W.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._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(c,e){let n=W.create("button",c,this._container);return n.type="button",n.addEventListener("click",e),n}},E.Popup=class extends p.E{constructor(c){super(),this.remove=()=>(this._content&&W.remove(this._content),this._container&&(W.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 p.k("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{var n;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=W.create("div","maplibregl-popup",this._map.getContainer()),this._tip=W.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let _ of this.options.className.split(" "))this._container.classList.add(_);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=this._map.transform.renderWorldCopies&&!this._trackPointer?ti(this._lngLat,this._flatPos,this._map.transform):(n=this._lngLat)===null||n===void 0?void 0:n.wrap(),this._trackPointer&&!e)return;let s=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationPoint(this._lngLat));let o=this.options.anchor,u=Ts(this.options.offset);if(!o){let _=this._container.offsetWidth,y=this._container.offsetHeight,b;b=s.y+u.bottom.ythis._map.transform.height-y?["bottom"]:[],s.x<_/2?b.push("left"):s.x>this._map.transform.width-_/2&&b.push("right"),o=b.length===0?"bottom":b.join("-")}let m=s.add(u[o]);this.options.subpixelPositioning||(m=m.round()),W.setTransform(this._container,`${oa[o]} translate(${m.x}px,${m.y}px)`),ws(this._container,o,"popup")},this._onClose=()=>{this.remove()},this.options=p.e(Object.create(rt),c)}addTo(c){return this._map&&this.remove(),this._map=c,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 p.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(c){return this._lngLat=p.N.convert(c),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(c){return this.setDOMContent(document.createTextNode(c))}setHTML(c){let e=document.createDocumentFragment(),n=document.createElement("body"),s;for(n.innerHTML=c;s=n.firstChild,s;)e.appendChild(s);return this.setDOMContent(e)}getMaxWidth(){var c;return(c=this._container)===null||c===void 0?void 0:c.style.maxWidth}setMaxWidth(c){return this.options.maxWidth=c,this._update(),this}setDOMContent(c){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=W.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(c),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(c){return this._container&&this._container.classList.add(c),this}removeClassName(c){return this._container&&this._container.classList.remove(c),this}setOffset(c){return this.options.offset=c,this._update(),this}toggleClassName(c){if(this._container)return this._container.classList.toggle(c)}setSubpixelPositioning(c){this.options.subpixelPositioning=c}_createCloseButton(){this.options.closeButton&&(this._closeButton=W.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;let c=this._container.querySelector(Es);c&&c.focus()}},E.RasterDEMTileSource=Gt,E.RasterTileSource=wt,E.ScaleControl=class{constructor(c){this._onMove=()=>{Na(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,Na(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Xr),c)}getDefaultPosition(){return"bottom-left"}onAdd(c){return this._map=c,this._container=W.create("div","maplibregl-ctrl maplibregl-ctrl-scale",c.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){W.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},E.ScrollZoomHandler=Fr,E.Style=Ja,E.TerrainControl=class{constructor(c){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=c}onAdd(c){return this._map=c,this._container=W.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=W.create("button","maplibregl-ctrl-terrain",this._container),W.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(){W.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},E.TwoFingersTouchPitchHandler=ia,E.TwoFingersTouchRotateHandler=Po,E.TwoFingersTouchZoomHandler=ko,E.TwoFingersTouchZoomRotateHandler=Bo,E.VectorTileSource=kr,E.VideoSource=Qr,E.addSourceType=(c,e)=>p._(void 0,void 0,void 0,function*(){if(yn(c))throw new Error(`A source type called "${c}" already exists.`);((n,s)=>{sn[n]=s})(c,e)}),E.clearPrewarmedResources=function(){let c=xt;c&&(c.isPreloaded()&&c.numActive()===1?(c.release(_t),xt=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()"))},E.getMaxParallelImageRequests=function(){return p.a.MAX_PARALLEL_IMAGE_REQUESTS},E.getRTLTextPluginStatus=function(){return lr().getRTLTextPluginStatus()},E.getVersion=function(){return Vo},E.getWorkerCount=function(){return Rt.workerCount},E.getWorkerUrl=function(){return p.a.WORKER_URL},E.importScriptInWorkers=function(c){return jt().broadcast("IS",c)},E.prewarm=function(){et().acquire(_t)},E.setMaxParallelImageRequests=function(c){p.a.MAX_PARALLEL_IMAGE_REQUESTS=c},E.setRTLTextPlugin=function(c,e){return lr().setRTLTextPlugin(c,e)},E.setWorkerCount=function(c){Rt.workerCount=c},E.setWorkerUrl=function(c){p.a.WORKER_URL=c}});var J=w;return J})});var ol=xa(js=>{"use strict";function Jm(w,S,F){if(F===void 0&&(F=Array.prototype),w&&typeof F.find=="function")return F.find.call(w,S);for(var J=0;J{var cd=ol(),gn=cd.find,ll=cd.NAMESPACE;function Ym(w){return w!==""}function Qm(w){return w?w.split(/[\t\n\f\r ]+/).filter(Ym):[]}function e0(w,S){return w.hasOwnProperty(S)||(w[S]=!0),w}function rd(w){if(!w)return[];var S=Qm(w);return Object.keys(S.reduce(e0,{}))}function t0(w){return function(S){return w&&w.indexOf(S)!==-1}}function cl(w,S){for(var F in w)Object.prototype.hasOwnProperty.call(w,F)&&(S[F]=w[F])}function Sr(w,S){var F=w.prototype;if(!(F instanceof S)){let E=function(){};var J=E;E.prototype=S.prototype,E=new E,cl(F,E),w.prototype=F=E}F.constructor!=w&&(typeof w!="function"&&console.error("unknown Class:"+w),F.constructor=w)}var Ir={},Yr=Ir.ELEMENT_NODE=1,Zs=Ir.ATTRIBUTE_NODE=2,wu=Ir.TEXT_NODE=3,hd=Ir.CDATA_SECTION_NODE=4,pd=Ir.ENTITY_REFERENCE_NODE=5,i0=Ir.ENTITY_NODE=6,Kc=Ir.PROCESSING_INSTRUCTION_NODE=7,Yc=Ir.COMMENT_NODE=8,dd=Ir.DOCUMENT_NODE=9,fd=Ir.DOCUMENT_TYPE_NODE=10,Rn=Ir.DOCUMENT_FRAGMENT_NODE=11,r0=Ir.NOTATION_NODE=12,sr={},Vi={},Q0=sr.INDEX_SIZE_ERR=(Vi[1]="Index size error",1),eg=sr.DOMSTRING_SIZE_ERR=(Vi[2]="DOMString size error",2),Dr=sr.HIERARCHY_REQUEST_ERR=(Vi[3]="Hierarchy request error",3),tg=sr.WRONG_DOCUMENT_ERR=(Vi[4]="Wrong document",4),n0=sr.INVALID_CHARACTER_ERR=(Vi[5]="Invalid character",5),ig=sr.NO_DATA_ALLOWED_ERR=(Vi[6]="No data allowed",6),rg=sr.NO_MODIFICATION_ALLOWED_ERR=(Vi[7]="No modification allowed",7),md=sr.NOT_FOUND_ERR=(Vi[8]="Not found",8),ng=sr.NOT_SUPPORTED_ERR=(Vi[9]="Not supported",9),nd=sr.INUSE_ATTRIBUTE_ERR=(Vi[10]="Attribute in use",10),$s=sr.INVALID_STATE_ERR=(Vi[11]="Invalid state",11),ag=sr.SYNTAX_ERR=(Vi[12]="Syntax error",12),sg=sr.INVALID_MODIFICATION_ERR=(Vi[13]="Invalid modification",13),og=sr.NAMESPACE_ERR=(Vi[14]="Invalid namespace",14),lg=sr.INVALID_ACCESS_ERR=(Vi[15]="Invalid access",15);function si(w,S){if(S instanceof Error)var F=S;else F=this,Error.call(this,Vi[w]),this.message=Vi[w],Error.captureStackTrace&&Error.captureStackTrace(this,si);return F.code=w,S&&(this.message=this.message+": "+S),F}si.prototype=Error.prototype;cl(sr,si);function Fn(){}Fn.prototype={length:0,item:function(w){return w>=0&&w=0){for(var E=S.length-1;J0},lookupPrefix:function(w){for(var S=this;S;){var F=S._nsMap;if(F){for(var J in F)if(Object.prototype.hasOwnProperty.call(F,J)&&F[J]===w)return J}S=S.nodeType==Zs?S.ownerDocument:S.parentNode}return null},lookupNamespaceURI:function(w){for(var S=this;S;){var F=S._nsMap;if(F&&Object.prototype.hasOwnProperty.call(F,w))return F[w];S=S.nodeType==Zs?S.ownerDocument:S.parentNode}return null},isDefaultNamespace:function(w){var S=this.lookupPrefix(w);return S==null}};function yd(w){return w=="<"&&"<"||w==">"&&">"||w=="&"&&"&"||w=='"'&&"""||"&#"+w.charCodeAt()+";"}cl(Ir,ei);cl(Ir,ei.prototype);function Eu(w,S){return qi(w,null,{enter:function(F){return S(F)?qi.STOP:!0}})===qi.STOP}function qi(w,S,F){for(var J=[{node:w,context:S,phase:qi.ENTER}];J.length>0;){var E=J.pop();if(E.phase===qi.ENTER){var p=F.enter(E.node,E.context);if(p===qi.STOP)return qi.STOP;if(J.push({node:E.node,context:p,phase:qi.EXIT}),p==null)continue;for(var ue=E.node.lastChild;ue;)J.push({node:ue,context:p,phase:qi.ENTER}),ue=ue.previousSibling}else F.exit&&F.exit(E.node,E.context)}}qi.STOP=Symbol("walkDOM.STOP");qi.ENTER=0;qi.EXIT=1;function hl(){this.ownerDocument=this}function a0(w,S,F){w&&w._inc++;var J=F.namespaceURI;J===ll.XMLNS&&(S._nsMap[F.prefix?F.localName:""]=F.value)}function vd(w,S,F,J){w&&w._inc++;var E=F.namespaceURI;E===ll.XMLNS&&delete S._nsMap[F.prefix?F.localName:""]}function eh(w,S,F){if(w&&w._inc){w._inc++;var J=S.childNodes;if(F)J[J.length++]=F;else{for(var E=S.firstChild,p=0;E;)J[p++]=E,E=E.nextSibling;J.length=p,delete J[J.length]}}}function xd(w,S){var F=S.previousSibling,J=S.nextSibling;return F?F.nextSibling=J:w.firstChild=J,J?J.previousSibling=F:w.lastChild=F,S.parentNode=null,S.previousSibling=null,S.nextSibling=null,eh(w.ownerDocument,w),S}function s0(w){return w&&(w.nodeType===ei.DOCUMENT_NODE||w.nodeType===ei.DOCUMENT_FRAGMENT_NODE||w.nodeType===ei.ELEMENT_NODE)}function o0(w){return w&&(_n(w)||th(w)||On(w)||w.nodeType===ei.DOCUMENT_FRAGMENT_NODE||w.nodeType===ei.COMMENT_NODE||w.nodeType===ei.PROCESSING_INSTRUCTION_NODE)}function On(w){return w&&w.nodeType===ei.DOCUMENT_TYPE_NODE}function _n(w){return w&&w.nodeType===ei.ELEMENT_NODE}function th(w){return w&&w.nodeType===ei.TEXT_NODE}function od(w,S){var F=w.childNodes||[];if(gn(F,_n)||On(S))return!1;var J=gn(F,On);return!(S&&J&&F.indexOf(J)>F.indexOf(S))}function ld(w,S){var F=w.childNodes||[];function J(p){return _n(p)&&p!==S}if(gn(F,J))return!1;var E=gn(F,On);return!(S&&E&&F.indexOf(E)>F.indexOf(S))}function l0(w,S,F){if(!s0(w))throw new si(Dr,"Unexpected parent node type "+w.nodeType);if(F&&F.parentNode!==w)throw new si(md,"child not in parent");if(!o0(S)||On(S)&&w.nodeType!==ei.DOCUMENT_NODE)throw new si(Dr,"Unexpected node type "+S.nodeType+" for parent node type "+w.nodeType)}function u0(w,S,F){var J=w.childNodes||[],E=S.childNodes||[];if(S.nodeType===ei.DOCUMENT_FRAGMENT_NODE){var p=E.filter(_n);if(p.length>1||gn(E,th))throw new si(Dr,"More than one element or text in fragment");if(p.length===1&&!od(w,F))throw new si(Dr,"Element in fragment can not be inserted before doctype")}if(_n(S)&&!od(w,F))throw new si(Dr,"Only one element can be added and only after doctype");if(On(S)){if(gn(J,On))throw new si(Dr,"Only one doctype is allowed");var ue=gn(J,_n);if(F&&J.indexOf(ue)1||gn(E,th))throw new si(Dr,"More than one element or text in fragment");if(p.length===1&&!ld(w,F))throw new si(Dr,"Element in fragment can not be inserted before doctype")}if(_n(S)&&!ld(w,F))throw new si(Dr,"Only one element can be added and only after doctype");if(On(S)){let De=function(se){return On(se)&&se!==F};var pe=De;if(gn(J,De))throw new si(Dr,"Only one doctype is allowed");var ue=gn(J,_n);if(F&&J.indexOf(ue)0&&Eu(F.documentElement,function(E){if(E!==F&&E.nodeType===Yr){var p=E.getAttribute("class");if(p){var ue=w===p;if(!ue){var pe=rd(p);ue=S.every(t0(pe))}ue&&J.push(E)}}}),J})},createElement:function(w){var S=new Xa;S.ownerDocument=this,S.nodeName=w,S.tagName=w,S.localName=w,S.childNodes=new Fn;var F=S.attributes=new Au;return F._ownerElement=S,S},createDocumentFragment:function(){var w=new Su;return w.ownerDocument=this,w.childNodes=new Fn,w},createTextNode:function(w){var S=new ih;return S.ownerDocument=this,S.appendData(w),S},createComment:function(w){var S=new rh;return S.ownerDocument=this,S.appendData(w),S},createCDATASection:function(w){if(w.indexOf("]]>")!==-1)throw new si(n0,'data contains "]]>"');var S=new nh;return S.ownerDocument=this,S.appendData(w),S},createProcessingInstruction:function(w,S){var F=new sh;return F.ownerDocument=this,F.tagName=F.nodeName=F.target=w,F.nodeValue=F.data=S,F},createAttribute:function(w){var S=new Cu;return S.ownerDocument=this,S.name=w,S.nodeName=w,S.localName=w,S.specified=!0,S},createEntityReference:function(w){var S=new ah;return S.ownerDocument=this,S.nodeName=w,S},createElementNS:function(w,S){var F=new Xa,J=S.split(":"),E=F.attributes=new Au;return F.childNodes=new Fn,F.ownerDocument=this,F.nodeName=S,F.tagName=S,F.namespaceURI=w,J.length==2?(F.prefix=J[0],F.localName=J[1]):F.localName=S,E._ownerElement=F,F},createAttributeNS:function(w,S){var F=new Cu,J=S.split(":");return F.ownerDocument=this,F.nodeName=S,F.name=S,F.namespaceURI=w,F.specified=!0,J.length==2?(F.prefix=J[0],F.localName=J[1]):F.localName=S,F}};Sr(hl,ei);function Xa(){this._nsMap={}}Xa.prototype={nodeType:Yr,hasAttribute:function(w){return this.getAttributeNode(w)!=null},getAttribute:function(w){var S=this.getAttributeNode(w);return S&&S.value||""},getAttributeNode:function(w){return this.attributes.getNamedItem(w)},setAttribute:function(w,S){var F=this.ownerDocument.createAttribute(w);F.value=F.nodeValue=""+S,this.setAttributeNode(F)},removeAttribute:function(w){var S=this.getAttributeNode(w);S&&this.removeAttributeNode(S)},appendChild:function(w){return w.nodeType===Rn?this.insertBefore(w,null):c0(this,w)},setAttributeNode:function(w){return this.attributes.setNamedItem(w)},setAttributeNodeNS:function(w){return this.attributes.setNamedItemNS(w)},removeAttributeNode:function(w){return this.attributes.removeNamedItem(w.nodeName)},removeAttributeNS:function(w,S){var F=this.getAttributeNodeNS(w,S);F&&this.removeAttributeNode(F)},hasAttributeNS:function(w,S){return this.getAttributeNodeNS(w,S)!=null},getAttributeNS:function(w,S){var F=this.getAttributeNodeNS(w,S);return F&&F.value||""},setAttributeNS:function(w,S,F){var J=this.ownerDocument.createAttributeNS(w,S);J.value=J.nodeValue=""+F,this.setAttributeNode(J)},getAttributeNodeNS:function(w,S){return this.attributes.getNamedItemNS(w,S)},getElementsByTagName:function(w){return new Gs(this,function(S){var F=[];return Eu(S,function(J){J!==S&&J.nodeType==Yr&&(w==="*"||J.tagName==w)&&F.push(J)}),F})},getElementsByTagNameNS:function(w,S){return new Gs(this,function(F){var J=[];return Eu(F,function(E){E!==F&&E.nodeType===Yr&&(w==="*"||E.namespaceURI===w)&&(S==="*"||E.localName==S)&&J.push(E)}),J})}};hl.prototype.getElementsByTagName=Xa.prototype.getElementsByTagName;hl.prototype.getElementsByTagNameNS=Xa.prototype.getElementsByTagNameNS;Sr(Xa,ei);function Cu(){}Cu.prototype.nodeType=Zs;Sr(Cu,ei);function pl(){}pl.prototype={data:"",substringData:function(w,S){return this.data.substring(w,w+S)},appendData:function(w){w=this.data+w,this.nodeValue=this.data=w,this.length=w.length},insertData:function(w,S){this.replaceData(w,0,S)},appendChild:function(w){throw new Error(Vi[Dr])},deleteData:function(w,S){this.replaceData(w,S,"")},replaceData:function(w,S,F){var J=this.data.substring(0,w),E=this.data.substring(w+S);F=J+F+E,this.nodeValue=this.data=F,this.length=F.length}};Sr(pl,ei);function ih(){}ih.prototype={nodeName:"#text",nodeType:wu,splitText:function(w){var S=this.data,F=S.substring(w);S=S.substring(0,w),this.data=this.nodeValue=S,this.length=S.length;var J=this.ownerDocument.createTextNode(F);return this.parentNode&&this.parentNode.insertBefore(J,this.nextSibling),J}};Sr(ih,pl);function rh(){}rh.prototype={nodeName:"#comment",nodeType:Yc};Sr(rh,pl);function nh(){}nh.prototype={nodeName:"#cdata-section",nodeType:hd};Sr(nh,pl);function Du(){}Du.prototype.nodeType=fd;Sr(Du,ei);function wd(){}wd.prototype.nodeType=r0;Sr(wd,ei);function Ad(){}Ad.prototype.nodeType=i0;Sr(Ad,ei);function ah(){}ah.prototype.nodeType=pd;Sr(ah,ei);function Su(){}Su.prototype.nodeName="#document-fragment";Su.prototype.nodeType=Rn;Sr(Su,ei);function sh(){}sh.prototype.nodeType=Kc;Sr(sh,ei);function Ed(){}Ed.prototype.serializeToString=function(w,S,F,J){return Td.call(w,S,F,J)};ei.prototype.toString=Td;function Td(w,S,F){var J=!!F&&!!F.requireWellFormed,E=[],p=this.nodeType==9&&this.documentElement||this,ue=p.prefix,pe=p.namespaceURI;if(pe&&ue==null){var ue=p.lookupPrefix(pe);if(ue==null)var De=[{namespace:pe,prefix:null}]}return oh(this,E,w,S,De,J),E.join("")}function ud(w,S,F){var J=w.prefix||"",E=w.namespaceURI;if(!E||J==="xml"&&E===ll.XML||E===ll.XMLNS)return!1;for(var p=F.length;p--;){var ue=F[p];if(ue.prefix===J)return ue.namespace!==E}return!0}function bu(w,S,F){w.push(" ",S,'="',F.replace(/[<>&"\t\n\r]/g,yd),'"')}function oh(w,S,F,J,E,p){E||(E=[]),qi(w,{ns:E,isHTML:F},{enter:function(ue,pe){var De=pe.ns,se=pe.isHTML;if(J)if(ue=J(ue),ue){if(typeof ue=="string")return S.push(ue),null}else return null;switch(ue.nodeType){case Yr:var W=ue.attributes,Mt=W.length,gt=ue.tagName;se=ll.isHTML(ue.namespaceURI)||se;var Et=gt;if(!se&&!ue.prefix&&ue.namespaceURI){for(var li,Lt=0;Lt=0;Pt--){var ge=De[Pt];if(ge.prefix===""&&ge.namespace===ue.namespaceURI){li=ge.namespace;break}}if(li!==ue.namespaceURI)for(var Pt=De.length-1;Pt>=0;Pt--){var ge=De[Pt];if(ge.namespace===ue.namespaceURI){ge.prefix&&(Et=ge.prefix+":"+gt);break}}}S.push("<",Et);for(var $e=De.slice(),Pe=0;Pe"),se&&/^script$/i.test(gt)){for(;ye;)ye.data?S.push(ye.data):oh(ye,S,se,J,$e.slice(),p),ye=ye.nextSibling;return S.push(""),null}return{ns:$e,isHTML:se,tag:Et}}else return S.push("/>"),null;case dd:case Rn:return{ns:De.slice(),isHTML:se,tag:null};case Zs:return bu(S,ue.name,ue.value),null;case wu:return S.push(ue.data.replace(/[<&>]/g,yd)),null;case hd:if(p&&ue.data.indexOf("]]>")!==-1)throw new si($s,'The CDATASection data contains "]]>"');return S.push("/g,"]]]]>"),"]]>"),null;case Yc:if(p&&ue.data.indexOf("-->")!==-1)throw new si($s,'The comment node data contains "-->"');return S.push(""),null;case fd:if(p){if(ue.publicId&&!/^("[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%']*"|'[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%'"]*')$/.test(ue.publicId))throw new si($s,"DocumentType publicId is not a valid PubidLiteral");if(ue.systemId&&!/^("[^"]*"|'[^']*')$/.test(ue.systemId))throw new si($s,"DocumentType systemId is not a valid SystemLiteral");if(ue.internalSubset&&ue.internalSubset.indexOf("]>")!==-1)throw new si($s,'DocumentType internalSubset contains "]>"')}var Xe=ue.publicId,Ie=ue.systemId;if(S.push("");else if(Ie&&Ie!=".")S.push(" SYSTEM ",Ie,">");else{var Qe=ue.internalSubset;Qe&&S.push(" [",Qe,"]"),S.push(">")}return null;case Kc:if(p&&ue.data.indexOf("?>")!==-1)throw new si($s,'The ProcessingInstruction data contains "?>"');return S.push(""),null;case pd:return S.push("&",ue.nodeName,";"),null;default:return S.push("??",ue.nodeName),null}},exit:function(ue,pe){pe&&pe.tag&&S.push("")}})}function h0(w,S,F){var J;return qi(S,null,{enter:function(E,p){var ue=E.cloneNode(!1);ue.ownerDocument=w,ue.parentNode=null,p===null?J=ue:p.appendChild(ue);var pe=E.nodeType===Zs||F;return pe?ue:null}}),J}function Cd(w,S,F){var J;return qi(S,null,{enter:function(E,p){var ue=new E.constructor;for(var pe in E)if(Object.prototype.hasOwnProperty.call(E,pe)){var De=E[pe];typeof De!="object"&&De!=ue[pe]&&(ue[pe]=De)}E.childNodes&&(ue.childNodes=new Fn),ue.ownerDocument=w;var se=F;switch(ue.nodeType){case Yr:var W=E.attributes,Mt=ue.attributes=new Au,gt=W.length;Mt._ownerElement=ue;for(var Et=0;Et{"use strict";var Sd=ol().freeze;dl.XML_ENTITIES=Sd({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});dl.HTML_ENTITIES=Sd({Aacute:"\xC1",aacute:"\xE1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223E",acd:"\u223F",acE:"\u223E\u0333",Acirc:"\xC2",acirc:"\xE2",acute:"\xB4",Acy:"\u0410",acy:"\u0430",AElig:"\xC6",aelig:"\xE6",af:"\u2061",Afr:"\u{1D504}",afr:"\u{1D51E}",Agrave:"\xC0",agrave:"\xE0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03B1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2A3F",AMP:"&",amp:"&",And:"\u2A53",and:"\u2227",andand:"\u2A55",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsd:"\u2221",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",Aogon:"\u0104",aogon:"\u0105",Aopf:"\u{1D538}",aopf:"\u{1D552}",ap:"\u2248",apacir:"\u2A6F",apE:"\u2A70",ape:"\u224A",apid:"\u224B",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224A",Aring:"\xC5",aring:"\xE5",Ascr:"\u{1D49C}",ascr:"\u{1D4B6}",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224D",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",awconint:"\u2233",awint:"\u2A11",backcong:"\u224C",backepsilon:"\u03F6",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",Backslash:"\u2216",Barv:"\u2AE7",barvee:"\u22BD",Barwed:"\u2306",barwed:"\u2305",barwedge:"\u2305",bbrk:"\u23B5",bbrktbrk:"\u23B6",bcong:"\u224C",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201E",becaus:"\u2235",Because:"\u2235",because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",Bernoullis:"\u212C",Beta:"\u0392",beta:"\u03B2",beth:"\u2136",between:"\u226C",Bfr:"\u{1D505}",bfr:"\u{1D51F}",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",bkarow:"\u290D",blacklozenge:"\u29EB",blacksquare:"\u25AA",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20E5",bnequiv:"\u2261\u20E5",bNot:"\u2AED",bnot:"\u2310",Bopf:"\u{1D539}",bopf:"\u{1D553}",bot:"\u22A5",bottom:"\u22A5",bowtie:"\u22C8",boxbox:"\u29C9",boxDL:"\u2557",boxDl:"\u2556",boxdL:"\u2555",boxdl:"\u2510",boxDR:"\u2554",boxDr:"\u2553",boxdR:"\u2552",boxdr:"\u250C",boxH:"\u2550",boxh:"\u2500",boxHD:"\u2566",boxHd:"\u2564",boxhD:"\u2565",boxhd:"\u252C",boxHU:"\u2569",boxHu:"\u2567",boxhU:"\u2568",boxhu:"\u2534",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",boxUL:"\u255D",boxUl:"\u255C",boxuL:"\u255B",boxul:"\u2518",boxUR:"\u255A",boxUr:"\u2559",boxuR:"\u2558",boxur:"\u2514",boxV:"\u2551",boxv:"\u2502",boxVH:"\u256C",boxVh:"\u256B",boxvH:"\u256A",boxvh:"\u253C",boxVL:"\u2563",boxVl:"\u2562",boxvL:"\u2561",boxvl:"\u2524",boxVR:"\u2560",boxVr:"\u255F",boxvR:"\u255E",boxvr:"\u251C",bprime:"\u2035",Breve:"\u02D8",breve:"\u02D8",brvbar:"\xA6",Bscr:"\u212C",bscr:"\u{1D4B7}",bsemi:"\u204F",bsim:"\u223D",bsime:"\u22CD",bsol:"\\",bsolb:"\u29C5",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpE:"\u2AAE",bumpe:"\u224F",Bumpeq:"\u224E",bumpeq:"\u224F",Cacute:"\u0106",cacute:"\u0107",Cap:"\u22D2",cap:"\u2229",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",capcup:"\u2A47",capdot:"\u2A40",CapitalDifferentialD:"\u2145",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",Cayleys:"\u212D",ccaps:"\u2A4D",Ccaron:"\u010C",ccaron:"\u010D",Ccedil:"\xC7",ccedil:"\xE7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2A4C",ccupssm:"\u2A50",Cdot:"\u010A",cdot:"\u010B",cedil:"\xB8",Cedilla:"\xB8",cemptyv:"\u29B2",cent:"\xA2",CenterDot:"\xB7",centerdot:"\xB7",Cfr:"\u212D",cfr:"\u{1D520}",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03A7",chi:"\u03C7",cir:"\u25CB",circ:"\u02C6",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",CircleDot:"\u2299",circledR:"\xAE",circledS:"\u24C8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cirE:"\u29C3",cire:"\u2257",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",Colon:"\u2237",colon:":",Colone:"\u2A74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2A6D",Congruent:"\u2261",Conint:"\u222F",conint:"\u222E",ContourIntegral:"\u222E",Copf:"\u2102",copf:"\u{1D554}",coprod:"\u2210",Coproduct:"\u2210",COPY:"\xA9",copy:"\xA9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21B5",Cross:"\u2A2F",cross:"\u2717",Cscr:"\u{1D49E}",cscr:"\u{1D4B8}",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",Cup:"\u22D3",cup:"\u222A",cupbrcap:"\u2A48",CupCap:"\u224D",cupcap:"\u2A46",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarr:"\u21B7",curarrm:"\u293C",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curren:"\xA4",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",cuvee:"\u22CE",cuwed:"\u22CF",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232D",Dagger:"\u2021",dagger:"\u2020",daleth:"\u2138",Darr:"\u21A1",dArr:"\u21D3",darr:"\u2193",dash:"\u2010",Dashv:"\u2AE4",dashv:"\u22A3",dbkarow:"\u290F",dblac:"\u02DD",Dcaron:"\u010E",dcaron:"\u010F",Dcy:"\u0414",dcy:"\u0434",DD:"\u2145",dd:"\u2146",ddagger:"\u2021",ddarr:"\u21CA",DDotrahd:"\u2911",ddotseq:"\u2A77",deg:"\xB0",Del:"\u2207",Delta:"\u0394",delta:"\u03B4",demptyv:"\u29B1",dfisht:"\u297F",Dfr:"\u{1D507}",dfr:"\u{1D521}",dHar:"\u2965",dharl:"\u21C3",dharr:"\u21C2",DiacriticalAcute:"\xB4",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",DiacriticalGrave:"`",DiacriticalTilde:"\u02DC",diam:"\u22C4",Diamond:"\u22C4",diamond:"\u22C4",diamondsuit:"\u2666",diams:"\u2666",die:"\xA8",DifferentialD:"\u2146",digamma:"\u03DD",disin:"\u22F2",div:"\xF7",divide:"\xF7",divideontimes:"\u22C7",divonx:"\u22C7",DJcy:"\u0402",djcy:"\u0452",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",Dopf:"\u{1D53B}",dopf:"\u{1D555}",Dot:"\xA8",dot:"\u02D9",DotDot:"\u20DC",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22A1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222F",DoubleDot:"\xA8",DoubleDownArrow:"\u21D3",DoubleLeftArrow:"\u21D0",DoubleLeftRightArrow:"\u21D4",DoubleLeftTee:"\u2AE4",DoubleLongLeftArrow:"\u27F8",DoubleLongLeftRightArrow:"\u27FA",DoubleLongRightArrow:"\u27F9",DoubleRightArrow:"\u21D2",DoubleRightTee:"\u22A8",DoubleUpArrow:"\u21D1",DoubleUpDownArrow:"\u21D5",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",Downarrow:"\u21D3",downarrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVector:"\u21BD",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295F",DownRightVector:"\u21C1",DownRightVectorBar:"\u2957",DownTee:"\u22A4",DownTeeArrow:"\u21A7",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",Dscr:"\u{1D49F}",dscr:"\u{1D4B9}",DScy:"\u0405",dscy:"\u0455",dsol:"\u29F6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",DZcy:"\u040F",dzcy:"\u045F",dzigrarr:"\u27FF",Eacute:"\xC9",eacute:"\xE9",easter:"\u2A6E",Ecaron:"\u011A",ecaron:"\u011B",ecir:"\u2256",Ecirc:"\xCA",ecirc:"\xEA",ecolon:"\u2255",Ecy:"\u042D",ecy:"\u044D",eDDot:"\u2A77",Edot:"\u0116",eDot:"\u2251",edot:"\u0117",ee:"\u2147",efDot:"\u2252",Efr:"\u{1D508}",efr:"\u{1D522}",eg:"\u2A9A",Egrave:"\xC8",egrave:"\xE8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",Element:"\u2208",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25FB",emptyv:"\u2205",EmptyVerySmallSquare:"\u25AB",emsp:"\u2003",emsp13:"\u2004",emsp14:"\u2005",ENG:"\u014A",eng:"\u014B",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\u{1D53C}",eopf:"\u{1D556}",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",Epsilon:"\u0395",epsilon:"\u03B5",epsiv:"\u03F5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2A96",eqslantless:"\u2A95",Equal:"\u2A75",equals:"=",EqualTilde:"\u2242",equest:"\u225F",Equilibrium:"\u21CC",equiv:"\u2261",equivDD:"\u2A78",eqvparsl:"\u29E5",erarr:"\u2971",erDot:"\u2253",Escr:"\u2130",escr:"\u212F",esdot:"\u2250",Esim:"\u2A73",esim:"\u2242",Eta:"\u0397",eta:"\u03B7",ETH:"\xD0",eth:"\xF0",Euml:"\xCB",euml:"\xEB",euro:"\u20AC",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",ExponentialE:"\u2147",exponentiale:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",Ffr:"\u{1D509}",ffr:"\u{1D523}",filig:"\uFB01",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",Fopf:"\u{1D53D}",fopf:"\u{1D557}",ForAll:"\u2200",forall:"\u2200",fork:"\u22D4",forkv:"\u2AD9",Fouriertrf:"\u2131",fpartint:"\u2A0D",frac12:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044",frown:"\u2322",Fscr:"\u2131",fscr:"\u{1D4BB}",gacute:"\u01F5",Gamma:"\u0393",gamma:"\u03B3",Gammad:"\u03DC",gammad:"\u03DD",gap:"\u2A86",Gbreve:"\u011E",gbreve:"\u011F",Gcedil:"\u0122",Gcirc:"\u011C",gcirc:"\u011D",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",gE:"\u2267",ge:"\u2265",gEl:"\u2A8C",gel:"\u22DB",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",ges:"\u2A7E",gescc:"\u2AA9",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",Gfr:"\u{1D50A}",gfr:"\u{1D524}",Gg:"\u22D9",gg:"\u226B",ggg:"\u22D9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gl:"\u2277",gla:"\u2AA5",glE:"\u2A92",glj:"\u2AA4",gnap:"\u2A8A",gnapprox:"\u2A8A",gnE:"\u2269",gne:"\u2A88",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",Gopf:"\u{1D53E}",gopf:"\u{1D558}",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",Gscr:"\u{1D4A2}",gscr:"\u210A",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",Gt:"\u226B",GT:">",gt:">",gtcc:"\u2AA7",gtcir:"\u2A7A",gtdot:"\u22D7",gtlPar:"\u2995",gtquest:"\u2A7C",gtrapprox:"\u2A86",gtrarr:"\u2978",gtrdot:"\u22D7",gtreqless:"\u22DB",gtreqqless:"\u2A8C",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\uFE00",gvnE:"\u2269\uFE00",Hacek:"\u02C7",hairsp:"\u200A",half:"\xBD",hamilt:"\u210B",HARDcy:"\u042A",hardcy:"\u044A",hArr:"\u21D4",harr:"\u2194",harrcir:"\u2948",harrw:"\u21AD",Hat:"^",hbar:"\u210F",Hcirc:"\u0124",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22B9",Hfr:"\u210C",hfr:"\u{1D525}",HilbertSpace:"\u210B",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21FF",homtht:"\u223B",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",Hopf:"\u210D",hopf:"\u{1D559}",horbar:"\u2015",HorizontalLine:"\u2500",Hscr:"\u210B",hscr:"\u{1D4BD}",hslash:"\u210F",Hstrok:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224E",HumpEqual:"\u224F",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xCD",iacute:"\xED",ic:"\u2063",Icirc:"\xCE",icirc:"\xEE",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xA1",iff:"\u21D4",Ifr:"\u2111",ifr:"\u{1D526}",Igrave:"\xCC",igrave:"\xEC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Im:"\u2111",Imacr:"\u012A",imacr:"\u012B",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",imof:"\u22B7",imped:"\u01B5",Implies:"\u21D2",in:"\u2208",incare:"\u2105",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",Int:"\u222C",int:"\u222B",intcal:"\u22BA",integers:"\u2124",Integral:"\u222B",intercal:"\u22BA",Intersection:"\u22C2",intlarhk:"\u2A17",intprod:"\u2A3C",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012E",iogon:"\u012F",Iopf:"\u{1D540}",iopf:"\u{1D55A}",Iota:"\u0399",iota:"\u03B9",iprod:"\u2A3C",iquest:"\xBF",Iscr:"\u2110",iscr:"\u{1D4BE}",isin:"\u2208",isindot:"\u22F5",isinE:"\u22F9",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xCF",iuml:"\xEF",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\u{1D50D}",jfr:"\u{1D527}",jmath:"\u0237",Jopf:"\u{1D541}",jopf:"\u{1D55B}",Jscr:"\u{1D4A5}",jscr:"\u{1D4BF}",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039A",kappa:"\u03BA",kappav:"\u03F0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041A",kcy:"\u043A",Kfr:"\u{1D50E}",kfr:"\u{1D528}",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040C",kjcy:"\u045C",Kopf:"\u{1D542}",kopf:"\u{1D55C}",Kscr:"\u{1D4A6}",kscr:"\u{1D4C0}",lAarr:"\u21DA",Lacute:"\u0139",lacute:"\u013A",laemptyv:"\u29B4",lagran:"\u2112",Lambda:"\u039B",lambda:"\u03BB",Lang:"\u27EA",lang:"\u27E8",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",Laplacetrf:"\u2112",laquo:"\xAB",Larr:"\u219E",lArr:"\u21D0",larr:"\u2190",larrb:"\u21E4",larrbfs:"\u291F",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",lat:"\u2AAB",lAtail:"\u291B",latail:"\u2919",late:"\u2AAD",lates:"\u2AAD\uFE00",lBarr:"\u290E",lbarr:"\u290C",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",Lcaron:"\u013D",lcaron:"\u013E",Lcedil:"\u013B",lcedil:"\u013C",lceil:"\u2308",lcub:"{",Lcy:"\u041B",lcy:"\u043B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",lE:"\u2266",le:"\u2264",LeftAngleBracket:"\u27E8",LeftArrow:"\u2190",Leftarrow:"\u21D0",leftarrow:"\u2190",LeftArrowBar:"\u21E4",LeftArrowRightArrow:"\u21C6",leftarrowtail:"\u21A2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21C3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230A",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",LeftRightArrow:"\u2194",Leftrightarrow:"\u21D4",leftrightarrow:"\u2194",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",LeftRightVector:"\u294E",LeftTee:"\u22A3",LeftTeeArrow:"\u21A4",LeftTeeVector:"\u295A",leftthreetimes:"\u22CB",LeftTriangle:"\u22B2",LeftTriangleBar:"\u29CF",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21BF",LeftUpVectorBar:"\u2958",LeftVector:"\u21BC",LeftVectorBar:"\u2952",lEg:"\u2A8B",leg:"\u22DA",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",les:"\u2A7D",lescc:"\u2AA8",lesdot:"\u2A7F",lesdoto:"\u2A81",lesdotor:"\u2A83",lesg:"\u22DA\uFE00",lesges:"\u2A93",lessapprox:"\u2A85",lessdot:"\u22D6",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",LessEqualGreater:"\u22DA",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2AA1",lesssim:"\u2272",LessSlantEqual:"\u2A7D",LessTilde:"\u2272",lfisht:"\u297C",lfloor:"\u230A",Lfr:"\u{1D50F}",lfr:"\u{1D529}",lg:"\u2276",lgE:"\u2A91",lHar:"\u2962",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",Ll:"\u22D8",ll:"\u226A",llarr:"\u21C7",llcorner:"\u231E",Lleftarrow:"\u21DA",llhard:"\u296B",lltri:"\u25FA",Lmidot:"\u013F",lmidot:"\u0140",lmoust:"\u23B0",lmoustache:"\u23B0",lnap:"\u2A89",lnapprox:"\u2A89",lnE:"\u2268",lne:"\u2A87",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",LongLeftArrow:"\u27F5",Longleftarrow:"\u27F8",longleftarrow:"\u27F5",LongLeftRightArrow:"\u27F7",Longleftrightarrow:"\u27FA",longleftrightarrow:"\u27F7",longmapsto:"\u27FC",LongRightArrow:"\u27F6",Longrightarrow:"\u27F9",longrightarrow:"\u27F6",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",Lopf:"\u{1D543}",lopf:"\u{1D55D}",loplus:"\u2A2D",lotimes:"\u2A34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25CA",lozenge:"\u25CA",lozf:"\u29EB",lpar:"(",lparlt:"\u2993",lrarr:"\u21C6",lrcorner:"\u231F",lrhar:"\u21CB",lrhard:"\u296D",lrm:"\u200E",lrtri:"\u22BF",lsaquo:"\u2039",Lscr:"\u2112",lscr:"\u{1D4C1}",Lsh:"\u21B0",lsh:"\u21B0",lsim:"\u2272",lsime:"\u2A8D",lsimg:"\u2A8F",lsqb:"[",lsquo:"\u2018",lsquor:"\u201A",Lstrok:"\u0141",lstrok:"\u0142",Lt:"\u226A",LT:"<",lt:"<",ltcc:"\u2AA6",ltcir:"\u2A79",ltdot:"\u22D6",lthree:"\u22CB",ltimes:"\u22C9",ltlarr:"\u2976",ltquest:"\u2A7B",ltri:"\u25C3",ltrie:"\u22B4",ltrif:"\u25C2",ltrPar:"\u2996",lurdshar:"\u294A",luruhar:"\u2966",lvertneqq:"\u2268\uFE00",lvnE:"\u2268\uFE00",macr:"\xAF",male:"\u2642",malt:"\u2720",maltese:"\u2720",Map:"\u2905",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",Mcy:"\u041C",mcy:"\u043C",mdash:"\u2014",mDDot:"\u223A",measuredangle:"\u2221",MediumSpace:"\u205F",Mellintrf:"\u2133",Mfr:"\u{1D510}",mfr:"\u{1D52A}",mho:"\u2127",micro:"\xB5",mid:"\u2223",midast:"*",midcir:"\u2AF0",middot:"\xB7",minus:"\u2212",minusb:"\u229F",minusd:"\u2238",minusdu:"\u2A2A",MinusPlus:"\u2213",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",Mopf:"\u{1D544}",mopf:"\u{1D55E}",mp:"\u2213",Mscr:"\u2133",mscr:"\u{1D4C2}",mstpos:"\u223E",Mu:"\u039C",mu:"\u03BC",multimap:"\u22B8",mumap:"\u22B8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natur:"\u266E",natural:"\u266E",naturals:"\u2115",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",Ncy:"\u041D",ncy:"\u043D",ndash:"\u2013",ne:"\u2260",nearhk:"\u2924",neArr:"\u21D7",nearr:"\u2197",nearrow:"\u2197",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200B",NegativeThickSpace:"\u200B",NegativeThinSpace:"\u200B",NegativeVeryThinSpace:"\u200B",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226B",NestedLessLess:"\u226A",NewLine:` +`,nexist:"\u2204",nexists:"\u2204",Nfr:"\u{1D511}",nfr:"\u{1D52B}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",nGg:"\u22D9\u0338",ngsim:"\u2275",nGt:"\u226B\u20D2",ngt:"\u226F",ngtr:"\u226F",nGtv:"\u226B\u0338",nhArr:"\u21CE",nharr:"\u21AE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",NJcy:"\u040A",njcy:"\u045A",nlArr:"\u21CD",nlarr:"\u219A",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nLeftarrow:"\u21CD",nleftarrow:"\u219A",nLeftrightarrow:"\u21CE",nleftrightarrow:"\u21AE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nLl:"\u22D8\u0338",nlsim:"\u2274",nLt:"\u226A\u20D2",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nLtv:"\u226A\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xA0",Nopf:"\u2115",nopf:"\u{1D55F}",Not:"\u2AEC",not:"\xAC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",notin:"\u2209",notindot:"\u22F5\u0338",notinE:"\u22F9\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",NotLeftTriangle:"\u22EA",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangle:"\u22EB",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",npar:"\u2226",nparallel:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",npre:"\u2AAF\u0338",nprec:"\u2280",npreceq:"\u2AAF\u0338",nrArr:"\u21CF",nrarr:"\u219B",nrarrc:"\u2933\u0338",nrarrw:"\u219D\u0338",nRightarrow:"\u21CF",nrightarrow:"\u219B",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",Nscr:"\u{1D4A9}",nscr:"\u{1D4C3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",Ntilde:"\xD1",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",Nu:"\u039D",nu:"\u03BD",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224D\u20D2",nVDash:"\u22AF",nVdash:"\u22AE",nvDash:"\u22AD",nvdash:"\u22AC",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvHarr:"\u2904",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwarhk:"\u2923",nwArr:"\u21D6",nwarr:"\u2196",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xD3",oacute:"\xF3",oast:"\u229B",ocir:"\u229A",Ocirc:"\xD4",ocirc:"\xF4",Ocy:"\u041E",ocy:"\u043E",odash:"\u229D",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29BF",Ofr:"\u{1D512}",ofr:"\u{1D52C}",ogon:"\u02DB",Ograve:"\xD2",ograve:"\xF2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",Omacr:"\u014C",omacr:"\u014D",Omega:"\u03A9",omega:"\u03C9",Omicron:"\u039F",omicron:"\u03BF",omid:"\u29B6",ominus:"\u2296",Oopf:"\u{1D546}",oopf:"\u{1D560}",opar:"\u29B7",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",operp:"\u29B9",oplus:"\u2295",Or:"\u2A54",or:"\u2228",orarr:"\u21BB",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oS:"\u24C8",Oscr:"\u{1D4AA}",oscr:"\u2134",Oslash:"\xD8",oslash:"\xF8",osol:"\u2298",Otilde:"\xD5",otilde:"\xF5",Otimes:"\u2A37",otimes:"\u2297",otimesas:"\u2A36",Ouml:"\xD6",ouml:"\xF6",ovbar:"\u233D",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",par:"\u2225",para:"\xB6",parallel:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",PartialD:"\u2202",Pcy:"\u041F",pcy:"\u043F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",Pfr:"\u{1D513}",pfr:"\u{1D52D}",Phi:"\u03A6",phi:"\u03C6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",Pi:"\u03A0",pi:"\u03C0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plus:"+",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plusdo:"\u2214",plusdu:"\u2A25",pluse:"\u2A72",PlusMinus:"\xB1",plusmn:"\xB1",plussim:"\u2A26",plustwo:"\u2A27",pm:"\xB1",Poincareplane:"\u210C",pointint:"\u2A15",Popf:"\u2119",popf:"\u{1D561}",pound:"\xA3",Pr:"\u2ABB",pr:"\u227A",prap:"\u2AB7",prcue:"\u227C",prE:"\u2AB3",pre:"\u2AAF",prec:"\u227A",precapprox:"\u2AB7",preccurlyeq:"\u227C",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",precsim:"\u227E",Prime:"\u2033",prime:"\u2032",primes:"\u2119",prnap:"\u2AB9",prnE:"\u2AB5",prnsim:"\u22E8",prod:"\u220F",Product:"\u220F",profalar:"\u232E",profline:"\u2312",profsurf:"\u2313",prop:"\u221D",Proportion:"\u2237",Proportional:"\u221D",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",Pscr:"\u{1D4AB}",pscr:"\u{1D4C5}",Psi:"\u03A8",psi:"\u03C8",puncsp:"\u2008",Qfr:"\u{1D514}",qfr:"\u{1D52E}",qint:"\u2A0C",Qopf:"\u211A",qopf:"\u{1D562}",qprime:"\u2057",Qscr:"\u{1D4AC}",qscr:"\u{1D4C6}",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",QUOT:'"',quot:'"',rAarr:"\u21DB",race:"\u223D\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221A",raemptyv:"\u29B3",Rang:"\u27EB",rang:"\u27E9",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",Rarr:"\u21A0",rArr:"\u21D2",rarr:"\u2192",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21A3",rarrw:"\u219D",rAtail:"\u291C",ratail:"\u291A",ratio:"\u2236",rationals:"\u211A",RBarr:"\u2910",rBarr:"\u290F",rbarr:"\u290D",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298C",rbrksld:"\u298E",rbrkslu:"\u2990",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",Re:"\u211C",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",rect:"\u25AD",REG:"\xAE",reg:"\xAE",ReverseElement:"\u220B",ReverseEquilibrium:"\u21CB",ReverseUpEquilibrium:"\u296F",rfisht:"\u297D",rfloor:"\u230B",Rfr:"\u211C",rfr:"\u{1D52F}",rHar:"\u2964",rhard:"\u21C1",rharu:"\u21C0",rharul:"\u296C",Rho:"\u03A1",rho:"\u03C1",rhov:"\u03F1",RightAngleBracket:"\u27E9",RightArrow:"\u2192",Rightarrow:"\u21D2",rightarrow:"\u2192",RightArrowBar:"\u21E5",RightArrowLeftArrow:"\u21C4",rightarrowtail:"\u21A3",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVector:"\u21C2",RightDownVectorBar:"\u2955",RightFloor:"\u230B",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",RightTee:"\u22A2",RightTeeArrow:"\u21A6",RightTeeVector:"\u295B",rightthreetimes:"\u22CC",RightTriangle:"\u22B3",RightTriangleBar:"\u29D0",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVector:"\u21BE",RightUpVectorBar:"\u2954",RightVector:"\u21C0",RightVectorBar:"\u2953",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoust:"\u23B1",rmoustache:"\u23B1",rnmid:"\u2AEE",roang:"\u27ED",roarr:"\u21FE",robrk:"\u27E7",ropar:"\u2986",Ropf:"\u211D",ropf:"\u{1D563}",roplus:"\u2A2E",rotimes:"\u2A35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2A12",rrarr:"\u21C9",Rrightarrow:"\u21DB",rsaquo:"\u203A",Rscr:"\u211B",rscr:"\u{1D4C7}",Rsh:"\u21B1",rsh:"\u21B1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22CC",rtimes:"\u22CA",rtri:"\u25B9",rtrie:"\u22B5",rtrif:"\u25B8",rtriltri:"\u29CE",RuleDelayed:"\u29F4",ruluhar:"\u2968",rx:"\u211E",Sacute:"\u015A",sacute:"\u015B",sbquo:"\u201A",Sc:"\u2ABC",sc:"\u227B",scap:"\u2AB8",Scaron:"\u0160",scaron:"\u0161",sccue:"\u227D",scE:"\u2AB4",sce:"\u2AB0",Scedil:"\u015E",scedil:"\u015F",Scirc:"\u015C",scirc:"\u015D",scnap:"\u2ABA",scnE:"\u2AB6",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",Scy:"\u0421",scy:"\u0441",sdot:"\u22C5",sdotb:"\u22A1",sdote:"\u2A66",searhk:"\u2925",seArr:"\u21D8",searr:"\u2198",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\u{1D516}",sfr:"\u{1D530}",sfrown:"\u2322",sharp:"\u266F",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xAD",Sigma:"\u03A3",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",sim:"\u223C",simdot:"\u2A6A",sime:"\u2243",simeq:"\u2243",simg:"\u2A9E",simgE:"\u2AA0",siml:"\u2A9D",simlE:"\u2A9F",simne:"\u2246",simplus:"\u2A24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2A33",smeparsl:"\u29E4",smid:"\u2223",smile:"\u2323",smt:"\u2AAA",smte:"\u2AAC",smtes:"\u2AAC\uFE00",SOFTcy:"\u042C",softcy:"\u044C",sol:"/",solb:"\u29C4",solbar:"\u233F",Sopf:"\u{1D54A}",sopf:"\u{1D564}",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\uFE00",sqcup:"\u2294",sqcups:"\u2294\uFE00",Sqrt:"\u221A",sqsub:"\u228F",sqsube:"\u2291",sqsubset:"\u228F",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",squ:"\u25A1",Square:"\u25A1",square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25AA",squf:"\u25AA",srarr:"\u2192",Sscr:"\u{1D4AE}",sscr:"\u{1D4C8}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",Star:"\u22C6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",Sub:"\u22D0",sub:"\u2282",subdot:"\u2ABD",subE:"\u2AC5",sube:"\u2286",subedot:"\u2AC3",submult:"\u2AC1",subnE:"\u2ACB",subne:"\u228A",subplus:"\u2ABF",subrarr:"\u2979",Subset:"\u22D0",subset:"\u2282",subseteq:"\u2286",subseteqq:"\u2AC5",SubsetEqual:"\u2286",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succ:"\u227B",succapprox:"\u2AB8",succcurlyeq:"\u227D",Succeeds:"\u227B",SucceedsEqual:"\u2AB0",SucceedsSlantEqual:"\u227D",SucceedsTilde:"\u227F",succeq:"\u2AB0",succnapprox:"\u2ABA",succneqq:"\u2AB6",succnsim:"\u22E9",succsim:"\u227F",SuchThat:"\u220B",Sum:"\u2211",sum:"\u2211",sung:"\u266A",Sup:"\u22D1",sup:"\u2283",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",supdot:"\u2ABE",supdsub:"\u2AD8",supE:"\u2AC6",supe:"\u2287",supedot:"\u2AC4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supnE:"\u2ACC",supne:"\u228B",supplus:"\u2AC0",Supset:"\u22D1",supset:"\u2283",supseteq:"\u2287",supseteqq:"\u2AC6",supsetneq:"\u228B",supsetneqq:"\u2ACC",supsim:"\u2AC8",supsub:"\u2AD4",supsup:"\u2AD6",swarhk:"\u2926",swArr:"\u21D9",swarr:"\u2199",swarrow:"\u2199",swnwar:"\u292A",szlig:"\xDF",Tab:" ",target:"\u2316",Tau:"\u03A4",tau:"\u03C4",tbrk:"\u23B4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20DB",telrec:"\u2315",Tfr:"\u{1D517}",tfr:"\u{1D531}",there4:"\u2234",Therefore:"\u2234",therefore:"\u2234",Theta:"\u0398",theta:"\u03B8",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",ThickSpace:"\u205F\u200A",thinsp:"\u2009",ThinSpace:"\u2009",thkap:"\u2248",thksim:"\u223C",THORN:"\xDE",thorn:"\xFE",Tilde:"\u223C",tilde:"\u02DC",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",times:"\xD7",timesb:"\u22A0",timesbar:"\u2A31",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",top:"\u22A4",topbot:"\u2336",topcir:"\u2AF1",Topf:"\u{1D54B}",topf:"\u{1D565}",topfork:"\u2ADA",tosa:"\u2929",tprime:"\u2034",TRADE:"\u2122",trade:"\u2122",triangle:"\u25B5",triangledown:"\u25BF",triangleleft:"\u25C3",trianglelefteq:"\u22B4",triangleq:"\u225C",triangleright:"\u25B9",trianglerighteq:"\u22B5",tridot:"\u25EC",trie:"\u225C",triminus:"\u2A3A",TripleDot:"\u20DB",triplus:"\u2A39",trisb:"\u29CD",tritime:"\u2A3B",trpezium:"\u23E2",Tscr:"\u{1D4AF}",tscr:"\u{1D4C9}",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040B",tshcy:"\u045B",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",Uacute:"\xDA",uacute:"\xFA",Uarr:"\u219F",uArr:"\u21D1",uarr:"\u2191",Uarrocir:"\u2949",Ubrcy:"\u040E",ubrcy:"\u045E",Ubreve:"\u016C",ubreve:"\u016D",Ucirc:"\xDB",ucirc:"\xFB",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21C5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296E",ufisht:"\u297E",Ufr:"\u{1D518}",ufr:"\u{1D532}",Ugrave:"\xD9",ugrave:"\xF9",uHar:"\u2963",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",Umacr:"\u016A",umacr:"\u016B",uml:"\xA8",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",Uogon:"\u0172",uogon:"\u0173",Uopf:"\u{1D54C}",uopf:"\u{1D566}",UpArrow:"\u2191",Uparrow:"\u21D1",uparrow:"\u2191",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21C5",UpDownArrow:"\u2195",Updownarrow:"\u21D5",updownarrow:"\u2195",UpEquilibrium:"\u296E",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",Upsi:"\u03D2",upsi:"\u03C5",upsih:"\u03D2",Upsilon:"\u03A5",upsilon:"\u03C5",UpTee:"\u22A5",UpTeeArrow:"\u21A5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",Uring:"\u016E",uring:"\u016F",urtri:"\u25F9",Uscr:"\u{1D4B0}",uscr:"\u{1D4CA}",utdot:"\u22F0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",Uuml:"\xDC",uuml:"\xFC",uwangle:"\u29A7",vangrt:"\u299C",varepsilon:"\u03F5",varkappa:"\u03F0",varnothing:"\u2205",varphi:"\u03D5",varpi:"\u03D6",varpropto:"\u221D",vArr:"\u21D5",varr:"\u2195",varrho:"\u03F1",varsigma:"\u03C2",varsubsetneq:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vartheta:"\u03D1",vartriangleleft:"\u22B2",vartriangleright:"\u22B3",Vbar:"\u2AEB",vBar:"\u2AE8",vBarv:"\u2AE9",Vcy:"\u0412",vcy:"\u0432",VDash:"\u22AB",Vdash:"\u22A9",vDash:"\u22A8",vdash:"\u22A2",Vdashl:"\u2AE6",Vee:"\u22C1",vee:"\u2228",veebar:"\u22BB",veeeq:"\u225A",vellip:"\u22EE",Verbar:"\u2016",verbar:"|",Vert:"\u2016",vert:"|",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",Vfr:"\u{1D519}",vfr:"\u{1D533}",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",Vopf:"\u{1D54D}",vopf:"\u{1D567}",vprop:"\u221D",vrtri:"\u22B3",Vscr:"\u{1D4B1}",vscr:"\u{1D4CB}",vsubnE:"\u2ACB\uFE00",vsubne:"\u228A\uFE00",vsupnE:"\u2ACC\uFE00",vsupne:"\u228B\uFE00",Vvdash:"\u22AA",vzigzag:"\u299A",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2A5F",Wedge:"\u22C0",wedge:"\u2227",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\u{1D51A}",wfr:"\u{1D534}",Wopf:"\u{1D54E}",wopf:"\u{1D568}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\u{1D4B2}",wscr:"\u{1D4CC}",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",Xfr:"\u{1D51B}",xfr:"\u{1D535}",xhArr:"\u27FA",xharr:"\u27F7",Xi:"\u039E",xi:"\u03BE",xlArr:"\u27F8",xlarr:"\u27F5",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",Xopf:"\u{1D54F}",xopf:"\u{1D569}",xoplus:"\u2A01",xotime:"\u2A02",xrArr:"\u27F9",xrarr:"\u27F6",Xscr:"\u{1D4B3}",xscr:"\u{1D4CD}",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",Yacute:"\xDD",yacute:"\xFD",YAcy:"\u042F",yacy:"\u044F",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042B",ycy:"\u044B",yen:"\xA5",Yfr:"\u{1D51C}",yfr:"\u{1D536}",YIcy:"\u0407",yicy:"\u0457",Yopf:"\u{1D550}",yopf:"\u{1D56A}",Yscr:"\u{1D4B4}",yscr:"\u{1D4CE}",YUcy:"\u042E",yucy:"\u044E",Yuml:"\u0178",yuml:"\xFF",Zacute:"\u0179",zacute:"\u017A",Zcaron:"\u017D",zcaron:"\u017E",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017B",zdot:"\u017C",zeetrf:"\u2128",ZeroWidthSpace:"\u200B",Zeta:"\u0396",zeta:"\u03B6",Zfr:"\u2128",zfr:"\u{1D537}",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21DD",Zopf:"\u2124",zopf:"\u{1D56B}",Zscr:"\u{1D4B5}",zscr:"\u{1D4CF}",zwj:"\u200D",zwnj:"\u200C"});dl.entityMap=dl.HTML_ENTITIES});var Fd=xa(ch=>{var _l=ol().NAMESPACE,uh=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,kd=new RegExp("[\\-\\.0-9"+uh.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),Md=new RegExp("^"+uh.source+kd.source+"*(?::"+uh.source+kd.source+"*)?$"),fl=0,ba=1,Hs=2,ml=3,Xs=4,Ws=5,gl=6,Iu=7;function Js(w,S){this.message=w,this.locator=S,Error.captureStackTrace&&Error.captureStackTrace(this,Js)}Js.prototype=new Error;Js.prototype.name=Js.name;function Bd(){}Bd.prototype={parse:function(w,S,F){var J=this.domBuilder;J.startDocument(),Ld(S,S={}),p0(w,S,F,J,this.errorHandler),J.endDocument()}};function p0(w,S,F,J,E){function p(pt){if(pt>65535){pt-=65536;var Be=55296+(pt>>10),Tt=56320+(pt&1023);return String.fromCharCode(Be,Tt)}else return String.fromCharCode(pt)}function ue(pt){var Be=pt.slice(1,-1);return Object.hasOwnProperty.call(F,Be)?F[Be]:Be.charAt(0)==="#"?p(parseInt(Be.substr(1).replace("x","0x"))):(E.error("entity not found:"+pt),pt)}function pe(pt){if(pt>Lt){var Be=w.substring(Lt,pt).replace(/&#?\w+;/g,ue);gt&&De(Lt),J.characters(Be,0,pt-Lt),Lt=pt}}function De(pt,Be){for(;pt>=W&&(Be=Mt.exec(w));)se=Be.index,W=se+Be[0].length,gt.lineNumber++;gt.columnNumber=pt-se+1}for(var se=0,W=0,Mt=/.*(?:\r\n?|\n)|.*$/g,gt=J.locator,Et=[{currentNSMap:S}],li={},Lt=0;;){try{var Pt=w.indexOf("<",Lt);if(Pt<0){if(!w.substr(Lt).match(/^\s*$/)){var ge=J.doc,$e=ge.createTextNode(w.substr(Lt));ge.appendChild($e),J.currentElement=$e}return}switch(Pt>Lt&&pe(Pt),w.charAt(Pt+1)){case"/":var Ie=w.indexOf(">",Pt+3),Pe=w.substring(Pt+2,Ie).replace(/[ \t\n\r]+$/g,""),Fe=Et.pop();Ie<0?(Pe=w.substring(Pt+2).replace(/[\s<].*/,""),E.error("end tag name: "+Pe+" is not complete:"+Fe.tagName),Ie=Pt+1+Pe.length):Pe.match(/\sLt?Lt=Ie:pe(Math.max(Pt,Lt)+1)}}function Pd(w,S){return S.lineNumber=w.lineNumber,S.columnNumber=w.columnNumber,S}function d0(w,S,F,J,E,p){function ue(Et,li,Lt){F.attributeNames.hasOwnProperty(Et)&&p.fatalError("Attribute "+Et+" redefined"),F.addValue(Et,li.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,E),Lt)}for(var pe,De,se=++S,W=fl;;){var Mt=w.charAt(se);switch(Mt){case"=":if(W===ba)pe=w.slice(S,se),W=ml;else if(W===Hs)W=ml;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(W===ml||W===ba)if(W===ba&&(p.warning('attribute value must after "="'),pe=w.slice(S,se)),S=se+1,se=w.indexOf(Mt,S),se>0)De=w.slice(S,se),ue(pe,De,S-1),W=Ws;else throw new Error("attribute value no end '"+Mt+"' match");else if(W==Xs)De=w.slice(S,se),ue(pe,De,S),p.warning('attribute "'+pe+'" missed start quot('+Mt+")!!"),S=se+1,W=Ws;else throw new Error('attribute value must after "="');break;case"/":switch(W){case fl:F.setTagName(w.slice(S,se));case Ws:case gl:case Iu:W=Iu,F.closed=!0;case Xs:case ba:break;case Hs:F.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return p.error("unexpected end of input"),W==fl&&F.setTagName(w.slice(S,se)),se;case">":switch(W){case fl:F.setTagName(w.slice(S,se));case Ws:case gl:case Iu:break;case Xs:case ba:De=w.slice(S,se),De.slice(-1)==="/"&&(F.closed=!0,De=De.slice(0,-1));case Hs:W===Hs&&(De=pe),W==Xs?(p.warning('attribute "'+De+'" missed quot(")!'),ue(pe,De,S)):((!_l.isHTML(J[""])||!De.match(/^(?:disabled|checked|selected)$/i))&&p.warning('attribute "'+De+'" missed value!! "'+De+'" instead!!'),ue(De,De,S));break;case ml:throw new Error("attribute value missed!!")}return se;case"\x80":Mt=" ";default:if(Mt<=" ")switch(W){case fl:F.setTagName(w.slice(S,se)),W=gl;break;case ba:pe=w.slice(S,se),W=Hs;break;case Xs:var De=w.slice(S,se);p.warning('attribute "'+De+'" missed quot(")!!'),ue(pe,De,S);case Ws:W=gl;break}else switch(W){case Hs:var gt=F.tagName;(!_l.isHTML(J[""])||!pe.match(/^(?:disabled|checked|selected)$/i))&&p.warning('attribute "'+pe+'" missed value!! "'+pe+'" instead2!!'),ue(pe,pe,S),S=se,W=ba;break;case Ws:p.warning('attribute space is required"'+pe+'"!!');case gl:W=ba,S=se;break;case ml:W=Xs,S=se;break;case Iu:throw new Error("elements closed character '/' and '>' must be connected to")}}se++}}function zd(w,S,F){for(var J=w.tagName,E=null,Mt=w.length;Mt--;){var p=w[Mt],ue=p.qName,pe=p.value,gt=ue.indexOf(":");if(gt>0)var De=p.prefix=ue.slice(0,gt),se=ue.slice(gt+1),W=De==="xmlns"&&se;else se=ue,De=null,W=ue==="xmlns"&&"";p.localName=se,W!==!1&&(E==null&&(E={},Ld(F,F={})),F[W]=E[W]=pe,p.uri=_l.XMLNS,S.startPrefixMapping(W,pe))}for(var Mt=w.length;Mt--;){p=w[Mt];var De=p.prefix;De&&(De==="xml"&&(p.uri=_l.XML),De!=="xmlns"&&(p.uri=F[De||""]))}var gt=J.indexOf(":");gt>0?(De=w.prefix=J.slice(0,gt),se=w.localName=J.slice(gt+1)):(De=null,se=w.localName=J);var Et=w.uri=F[De||""];if(S.startElement(Et,se,J,w),w.closed){if(S.endElement(Et,se,J),E)for(De in E)Object.prototype.hasOwnProperty.call(E,De)&&S.endPrefixMapping(De)}else return w.currentNSMap=F,w.localNSMap=E,!0}function f0(w,S,F,J,E){if(/^(?:script|textarea)$/i.test(F)){var p=w.indexOf("",S),ue=w.substring(S+1,p);if(/[&<]/.test(ue))return/^script$/i.test(F)?(E.characters(ue,0,ue.length),p):(ue=ue.replace(/&#?\w+;/g,J),E.characters(ue,0,ue.length),p)}return S+1}function m0(w,S,F,J){var E=J[F];return E==null&&(E=w.lastIndexOf(""),E",S+4);return p>S?(F.comment(w,S+4,p-S-4),p+3):(J.error("Unclosed comment"),-1)}else return-1;default:if(w.substr(S+3,6)=="CDATA["){var p=w.indexOf("]]>",S+9);return F.startCDATA(),F.characters(w,S+9,p-S-9),F.endCDATA(),p+3}var ue=y0(w,S),pe=ue.length;if(pe>1&&/!doctype/i.test(ue[0][0])){var De=ue[1][0],se=!1,W=!1;pe>3&&(/^public$/i.test(ue[2][0])?(se=ue[3][0],W=pe>4&&ue[4][0]):/^system$/i.test(ue[2][0])&&(W=ue[3][0]));var Mt=ue[pe-1];return F.startDTD(De,se,W),F.endDTD(),Mt.index+Mt[0].length}}return-1}function _0(w,S,F){var J=w.indexOf("?>",S);if(J){var E=w.substring(S,J).match(/^<\?(\S*)\s*([\s\S]*?)$/);if(E){var p=E[0].length;return F.processingInstruction(E[1],E[2]),J+2}else return-1}return-1}function Rd(){this.attributeNames={}}Rd.prototype={setTagName:function(w){if(!Md.test(w))throw new Error("invalid tagName:"+w);this.tagName=w},addValue:function(w,S,F){if(!Md.test(w))throw new Error("invalid attribute:"+w);this.attributeNames[w]=this.length,this[this.length++]={qName:w,value:S,offset:F}},length:0,getLocalName:function(w){return this[w].localName},getLocator:function(w){return this[w].locator},getQName:function(w){return this[w].qName},getURI:function(w){return this[w].uri},getValue:function(w){return this[w].value}};function y0(w,S){var F,J=[],E=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(E.lastIndex=S,E.exec(w);F=E.exec(w);)if(J.push(F),F[1])return J}ch.XMLReader=Bd;ch.ParseError=Js});var $d=xa(Mu=>{var v0=ol(),x0=lh(),Od=Id(),Vd=Fd(),b0=x0.DOMImplementation,Nd=v0.NAMESPACE,w0=Vd.ParseError,A0=Vd.XMLReader;function Ud(w){return w.replace(/\r[\n\u0085]/g,` `).replace(/[\r\u0085\u2028]/g,` -`)}function Ud(w){this.options=w||{locator:{}}}Ud.prototype.parseFromString=function(w,S){var F=this.options,K=new w0,E=F.domBuilder||new yl,p=F.errorHandler,ue=F.locator,pe=F.xmlns||{},De=/\/x?html?$/.test(S),se=De?Fd.HTML_ENTITIES:Fd.XML_ENTITIES;ue&&E.setDocumentLocator(ue),K.errorHandler=A0(p,E,ue),K.domBuilder=F.domBuilder||E,De&&(pe[""]=Od.HTML),pe.xml=pe.xml||Od.XML;var X=F.normalizeLineEndings||Vd;return w&&typeof w=="string"?K.parse(X(w),pe,se):K.errorHandler.error("invalid doc source"),E.doc};function A0(w,S,F){if(!w){if(S instanceof yl)return S;w=S}var K={},E=w instanceof Function;F=F||{};function p(ue){var pe=w[ue];!pe&&E&&(pe=w.length==2?function(De){w(ue,De)}:w),K[ue]=pe&&function(De){pe("[xmldom "+ue+"] "+De+hh(F))}||function(){}}return p("warning"),p("error"),p("fatalError"),K}function yl(){this.cdata=!1}function Ks(w,S){S.lineNumber=w.lineNumber,S.columnNumber=w.columnNumber}yl.prototype={startDocument:function(){this.doc=new x0().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(w,S,F,K){var E=this.doc,p=E.createElementNS(w,F||S),ue=K.length;ku(this,p),this.currentElement=p,this.locator&&Ks(this.locator,p);for(var pe=0;pe=S+F||S?new java.lang.String(w,S,F)+"":w}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(w){yl.prototype[w]=function(){return null}});function ku(w,S){w.currentElement?w.currentElement.appendChild(S):w.doc.appendChild(S)}Mu.__DOMHandler=yl;Mu.normalizeLineEndings=Vd;Mu.DOMParser=Ud});var Zd=xa(Pu=>{var $d=lh();Pu.DOMImplementation=$d.DOMImplementation;Pu.XMLSerializer=$d.XMLSerializer;Pu.DOMParser=jd().DOMParser});var Hd=xa((Gd,ph)=>{var E0=function(){"use strict";var w=/\s*/g,S=/^\s*|\s*$/g,F=/\s+/;function K(ye){if(!ye||!ye.length)return 0;for(var ve=0,Fe=0;veye||Math.abs(ge[1]-Se)>ve)&&X(xe,Se,ge[0],ge[1])<=He)return!0}var Ke=Me[Me.length-1];return X(xe,Se,Ke[0],Ke[1])<=He}function Ct(xe,Se,Me){for(var He=Se&&Se.connectMode||"on",ye=[],ve=[],Fe=0;Fe=2&&ye.push(ve),ve=[Ke])}return ve.length>=2&&ye.push(ve),ye}function li(xe,Se,Me){Se.forEach(function(He,ye){var ve=Se.length===1?Me:Me+"-"+ye;pe(xe,He,ve)})}function Pt(xe,Se,Me,He,ye,ve){var Fe=ve&&ve.connectMode==="intelligent_gpx";Promise.all(Se.map(function(ge,Ke){return fetch(ge).then(function(we){return we.text()}).then(function(we){var Ye=new DOMParser().parseFromString(we,"text/xml"),ht=toGeoJSON.gpx(Ye),Ne=He+"-"+Ke;return xe.addSource(Ne,{type:"geojson",data:ht}),xe.addLayer({id:Ne+"-line",type:"line",source:Ne,layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":S,"line-width":2,"line-opacity":.7}}),Fe?Mt(ht):[]}).catch(function(we){return console.warn("GPX load failed:",ge,we),[]})})).then(function(ge){var Ke=Fe?ge.filter(function(Ye){return Ye.length>0}):[],we=Ct(Me,ve,Ke);li(xe,we,ye)})}function zt(xe,Se){var Me=xe.length,He=new Array(xe.length);if(Me===0){Se({error:"no files"});return}xe.forEach(function(ve,Fe){fetch(ve).then(function(ge){return ge.text()}).then(function(ge){var Ke=new DOMParser().parseFromString(ge,"text/xml"),we=[];Ke.querySelectorAll("trkpt").forEach(function(Ye){var ht=Ye.querySelector("ele"),Ne=Ye.querySelector("time");we.push({lat:parseFloat(Ye.getAttribute("lat")),lon:parseFloat(Ye.getAttribute("lon")),ele:ht?parseFloat(ht.textContent):NaN,time:Ne?Ne.textContent:null})}),He[Fe]=we,--Me===0&&ye()}).catch(function(ge){console.warn("GPX load failed:",ve,ge),He[Fe]=[],--Me===0&&ye()})});function ye(){var ve=0,Fe=0,ge=0,Ke=NaN,we=NaN,Ye=0;He.forEach(function(Qe){if(!(!Qe||Qe.length<2)){isNaN(Qe[0].ele)||((isNaN(Ke)||Qe[0].ele>Ke)&&(Ke=Qe[0].ele),(isNaN(we)||Qe[0].ele0&&(Fe+=pt),pt<0&&(ge+=-pt),(isNaN(Ke)||bt.ele>Ke)&&(Ke=bt.ele),(isNaN(we)||bt.ele0&&X(je.lat,je.lon,bt.lat,bt.lon)/At>=1&&(Ye+=At)}}}});var ht=Ye>0?ve/Ye:0,Ne=Math.floor(Ye),rt=Math.round((Ye-Ne)*60);rt===60&&(Ne++,rt=0),Se({distance:ve,eleGain:Fe,eleLoss:ge,highest:Ke,lowest:we,movingTime:Ne+":"+(rt<10?"0":"")+rt,avgSpeed:ht})}}function jt(xe){xe=xe||{};var Se=xe.entries||[],Me=xe.fit||{},He=Me.padding!=null?Me.padding:60,ye=Me.maxZoom!=null?Me.maxZoom:11,ve=Me.singleZoom!=null?Me.singleZoom:10,Fe=xe.markLatest!==!1,ge=new maplibregl.Map({container:xe.container,style:K,center:[20,20],zoom:2,attributionControl:!1});if(ge.addControl(new maplibregl.AttributionControl({compact:!0}),"bottom-left"),ge.on("load",function(){if(Se.length===0){ge.jumpTo({center:[0,20],zoom:2});return}var Ye=new maplibregl.LngLatBounds;Se.forEach(function(Ne,rt){var Qe=Fe&&Ne.type!=="story"&&rt===Se.length-1,ft=[parseFloat(Ne.lng),parseFloat(Ne.lat)];Ye.extend(ft);var je=xe.storyMarkers&&Ne.type==="story"?se():De(Qe);je.dataset.url=Ne.url;var bt=new maplibregl.Popup({offset:12,closeButton:!1,closeOnClick:!1,className:"map-tip-popup"}).setLngLat(ft).setHTML(''+Ne.title+"");je.addEventListener("mouseenter",function(){bt.addTo(ge)}),je.addEventListener("mouseleave",function(){bt.remove()}),je.addEventListener("click",function(){var pt=xe.cardPrefix?document.getElementById(xe.cardPrefix+Ne.slug):null;if(!pt){window.location.href=Ne.url;return}var At=xe.cardPrefix+Ne.slug;function mt(){window.location.hash=At,setTimeout(function(){pt.classList.add("is-highlighted"),setTimeout(function(){pt.classList.remove("is-highlighted")},700)},350)}if(xe.fullscreen){var Bt=document.querySelector(xe.fullscreen.colSelector),Vt=Bt&&Bt.classList.contains("is-fullscreen");if(Vt){var gt=document.getElementById(xe.fullscreen.btnId);gt&>.click(),setTimeout(mt,450);return}}mt()}),new maplibregl.Marker({element:je}).setLngLat(ft).addTo(ge)}),Se.length===1?ge.jumpTo({center:[parseFloat(Se[0].lng),parseFloat(Se[0].lat)],zoom:ve}):ge.fitBounds(Ye,{padding:He,maxZoom:ye}),xe.gpx&&Pt(ge,xe.gpx.use?xe.gpx.urls||[]:[],Se,xe.gpx.sourcePrefix,xe.gpx.journeyId,{connectMode:xe.gpx.autoconnect});var ht=ge.getContainer().querySelector(".maplibregl-ctrl-attrib");ht&&ht.removeAttribute("open")}),setTimeout(function(){ge.resize()},100),xe.fullscreen){var Ke=document.getElementById(xe.fullscreen.btnId),we=document.querySelector(xe.fullscreen.colSelector);Ke&&we&&Ke.addEventListener("click",function(){var Ye=we.classList.toggle("is-fullscreen");Ke.setAttribute("aria-label",Ye?"Close map":"Expand map"),document.body.style.overflow=Ye?"hidden":"",setTimeout(function(){ge.resize()},50)})}return ge}w.MapUtils={MAP_STYLE:K,initEntryMap:jt,ACCENT:S,haversineKm:X,parseGpxFiles:zt,addJourneyLine:pe,addJourneySegments:li,buildJourneySegments:Ct,renderGpxJourney:Pt,createDotMarker:De,createStoryMarker:se}})(window);window.maplibregl=Xd.default;window.toGeoJSON=Wd.default;})(); +`)}function jd(w){this.options=w||{locator:{}}}jd.prototype.parseFromString=function(w,S){var F=this.options,J=new A0,E=F.domBuilder||new yl,p=F.errorHandler,ue=F.locator,pe=F.xmlns||{},De=/\/x?html?$/.test(S),se=De?Od.HTML_ENTITIES:Od.XML_ENTITIES;ue&&E.setDocumentLocator(ue),J.errorHandler=E0(p,E,ue),J.domBuilder=F.domBuilder||E,De&&(pe[""]=Nd.HTML),pe.xml=pe.xml||Nd.XML;var W=F.normalizeLineEndings||Ud;return w&&typeof w=="string"?J.parse(W(w),pe,se):J.errorHandler.error("invalid doc source"),E.doc};function E0(w,S,F){if(!w){if(S instanceof yl)return S;w=S}var J={},E=w instanceof Function;F=F||{};function p(ue){var pe=w[ue];!pe&&E&&(pe=w.length==2?function(De){w(ue,De)}:w),J[ue]=pe&&function(De){pe("[xmldom "+ue+"] "+De+hh(F))}||function(){}}return p("warning"),p("error"),p("fatalError"),J}function yl(){this.cdata=!1}function Ks(w,S){S.lineNumber=w.lineNumber,S.columnNumber=w.columnNumber}yl.prototype={startDocument:function(){this.doc=new b0().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(w,S,F,J){var E=this.doc,p=E.createElementNS(w,F||S),ue=J.length;ku(this,p),this.currentElement=p,this.locator&&Ks(this.locator,p);for(var pe=0;pe=S+F||S?new java.lang.String(w,S,F)+"":w}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(w){yl.prototype[w]=function(){return null}});function ku(w,S){w.currentElement?w.currentElement.appendChild(S):w.doc.appendChild(S)}Mu.__DOMHandler=yl;Mu.normalizeLineEndings=Ud;Mu.DOMParser=jd});var Gd=xa(Pu=>{var Zd=lh();Pu.DOMImplementation=Zd.DOMImplementation;Pu.XMLSerializer=Zd.XMLSerializer;Pu.DOMParser=$d().DOMParser});var Xd=xa((Hd,ph)=>{var T0=function(){"use strict";var w=/\s*/g,S=/^\s*|\s*$/g,F=/\s+/;function J(ve){if(!ve||!ve.length)return 0;for(var xe=0,Ae=0;xeYe||Math.abs(Ae[1]-$e)>ve)&&se(ge,$e,Ae[0],Ae[1])<=Fe)return!0}var ye=Pe[Pe.length-1];return se(ge,$e,ye[0],ye[1])<=Fe}function gt(ge,$e,Pe){for(var Fe=$e&&$e.connectMode||"on",Ye=[],ve=[],xe=0;xe=2&&Ye.push(ve),ve=[ye])}return ve.length>=2&&Ye.push(ve),Ye}function Et(ge,$e,Pe){$e.forEach(function(Fe,Ye){var ve=$e.length===1?Pe:Pe+"-"+Ye;ue(ge,Fe,ve)})}function li(ge,$e,Pe,Fe,Ye,ve){var xe=ve&&ve.connectMode==="intelligent_gpx";Promise.all($e.map(function(Ae,ye){return fetch(Ae).then(function(Xe){return Xe.text()}).then(function(Xe){var Ie=new DOMParser().parseFromString(Xe,"text/xml"),Qe=toGeoJSON.gpx(Ie),qe=Fe+"-"+ye;return ge.addSource(qe,{type:"geojson",data:Qe}),ge.addLayer({id:qe+"-line",type:"line",source:qe,layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":S,"line-width":2,"line-opacity":.7}}),xe?W(Qe):[]}).catch(function(Xe){return console.warn("GPX load failed:",Ae,Xe),[]})})).then(function(Ae){var ye=xe?Ae.filter(function(Ie){return Ie.length>0}):[],Xe=gt(Pe,ve,ye);Et(ge,Xe,Ye)})}function Lt(ge,$e){var Pe=ge.length,Fe=new Array(ge.length);if(Pe===0){$e({error:"no files"});return}ge.forEach(function(ve,xe){fetch(ve).then(function(Ae){return Ae.text()}).then(function(Ae){var ye=new DOMParser().parseFromString(Ae,"text/xml"),Xe=[];ye.querySelectorAll("trkpt").forEach(function(Ie){var Qe=Ie.querySelector("ele"),qe=Ie.querySelector("time");Xe.push({lat:parseFloat(Ie.getAttribute("lat")),lon:parseFloat(Ie.getAttribute("lon")),ele:Qe?parseFloat(Qe.textContent):NaN,time:qe?qe.textContent:null})}),Fe[xe]=Xe,--Pe===0&&Ye()}).catch(function(Ae){console.warn("GPX load failed:",ve,Ae),Fe[xe]=[],--Pe===0&&Ye()})});function Ye(){var ve=0,xe=0,Ae=0,ye=NaN,Xe=NaN,Ie=0;Fe.forEach(function(ht){if(!(!ht||ht.length<2)){isNaN(ht[0].ele)||((isNaN(ye)||ht[0].ele>ye)&&(ye=ht[0].ele),(isNaN(Xe)||ht[0].ele0&&(xe+=qt),qt<0&&(Ae+=-qt),(isNaN(ye)||Tt.ele>ye)&&(ye=Tt.ele),(isNaN(Xe)||Tt.ele0&&se(Be.lat,Be.lon,Tt.lat,Tt.lon)/dt>=1&&(Ie+=dt)}}}});var Qe=Ie>0?ve/Ie:0,qe=Math.floor(Ie),at=Math.round((Ie-qe)*60);at===60&&(qe++,at=0),$e({distance:ve,eleGain:xe,eleLoss:Ae,highest:ye,lowest:Xe,movingTime:qe+":"+(at<10?"0":"")+at,avgSpeed:Qe})}}function Pt(ge){ge=ge||{};var $e=ge.entries||[],Pe=ge.fit||{},Fe=Pe.padding!=null?Pe.padding:60,Ye=Pe.maxZoom!=null?Pe.maxZoom:11,ve=Pe.singleZoom!=null?Pe.singleZoom:10,xe=ge.markLatest!==!1,Ae=new maplibregl.Map({container:ge.container,style:dh,center:[20,20],zoom:2,attributionControl:!1});if(Ae.addControl(new maplibregl.AttributionControl({compact:!0}),"bottom-left"),Ae.on("load",function(){if($e.length===0){Ae.jumpTo({center:[0,20],zoom:2});return}var Ie=new maplibregl.LngLatBounds;$e.forEach(function(qe,at){var ht=xe&&qe.type!=="story"&&at===$e.length-1,pt=[parseFloat(qe.lng),parseFloat(qe.lat)];Ie.extend(pt);var Be=ge.storyMarkers&&qe.type==="story"?De():pe(ht);Be.dataset.url=qe.url;var Tt=new maplibregl.Popup({offset:12,closeButton:!1,closeOnClick:!1,className:"map-tip-popup"}).setLngLat(pt).setHTML(''+qe.title+"");Be.addEventListener("mouseenter",function(){Tt.addTo(Ae)}),Be.addEventListener("mouseleave",function(){Tt.remove()}),Be.addEventListener("click",function(){var qt=ge.cardPrefix?document.getElementById(ge.cardPrefix+qe.slug):null;if(!qt){window.location.href=qe.url;return}var dt=ge.cardPrefix+qe.slug;function St(){window.location.hash=dt,setTimeout(function(){qt.classList.add("is-highlighted"),setTimeout(function(){qt.classList.remove("is-highlighted")},700)},350)}if(ge.fullscreen){var _t=document.querySelector(ge.fullscreen.colSelector),Rt=_t&&_t.classList.contains("is-fullscreen");if(Rt){var Vt=document.getElementById(ge.fullscreen.btnId);Vt&&Vt.click(),setTimeout(St,450);return}}St()}),new maplibregl.Marker({element:Be}).setLngLat(pt).addTo(Ae)}),$e.length===1?Ae.jumpTo({center:[parseFloat($e[0].lng),parseFloat($e[0].lat)],zoom:ve}):Ae.fitBounds(Ie,{padding:Fe,maxZoom:Ye}),ge.gpx&&li(Ae,ge.gpx.use?ge.gpx.urls||[]:[],$e,ge.gpx.sourcePrefix,ge.gpx.journeyId,{connectMode:ge.gpx.autoconnect});var Qe=Ae.getContainer().querySelector(".maplibregl-ctrl-attrib");Qe&&Qe.removeAttribute("open")}),setTimeout(function(){Ae.resize()},100),ge.fullscreen){var ye=document.getElementById(ge.fullscreen.btnId),Xe=document.querySelector(ge.fullscreen.colSelector);ye&&Xe&&ye.addEventListener("click",function(){var Ie=Xe.classList.toggle("is-fullscreen");ye.setAttribute("aria-label",Ie?"Close map":"Expand map"),document.body.style.overflow=Ie?"hidden":"",setTimeout(function(){Ae.resize()},50)})}return Ae}w.MapUtils={MAP_STYLE:dh,initEntryMap:Pt,ACCENT:S,haversineKm:se,parseGpxFiles:Lt,addJourneyLine:ue,addJourneySegments:Et,buildJourneySegments:gt,renderGpxJourney:li,createDotMarker:pe,createStoryMarker:De}})(window);window.maplibregl=Wd.default;window.toGeoJSON=Jd.default;})(); /*! Bundled license information: maplibre-gl/dist/maplibre-gl.js: diff --git a/themes/intotheeast/js/maplibre-utils.js b/themes/intotheeast/js/maplibre-utils.js index 9098778..19f572e 100644 --- a/themes/intotheeast/js/maplibre-utils.js +++ b/themes/intotheeast/js/maplibre-utils.js @@ -1,8 +1,9 @@ /* Shared MapLibre GL utilities — loaded by map.html.twig, dailies.html.twig, home.html.twig */ +import { MAP_STYLE } from './src/map-style.js'; + (function (global) { var ACCENT = '#2A8C73'; var ACCENT_DIM = '#155244'; - var MAP_STYLE = 'https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json'; /* Build a GeoJSON LineString feature */ function lineFeature(coords) { diff --git a/themes/intotheeast/js/src/map-style.js b/themes/intotheeast/js/src/map-style.js new file mode 100644 index 0000000..6911237 --- /dev/null +++ b/themes/intotheeast/js/src/map-style.js @@ -0,0 +1,4 @@ +// Shared MapLibre style URL — single source of truth for maplibre-utils.js +// (multi-marker/GPX maps) and location-map.js (post-form pin preview), so the +// two never drift apart (KTD1). +export const MAP_STYLE = 'https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json'; From 797b472a6092f3a699380e93fea86c09d7ff0769 Mon Sep 17 00:00:00 2001 From: Mischa Date: Fri, 24 Jul 2026 19:38:24 +0200 Subject: [PATCH 3/8] =?UTF-8?q?feat(post):=20add=20"More=20location=20deta?= =?UTF-8?q?ils"=20panel=20=E2=80=94=20search,=20map,=20sync?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closed-by-default disclosure below City/Country holding a city/country geocode lookup (Open-Meteo, city-only query with client-side country ranking), a single-marker draggable MapLibre preview (lazy-loaded via location-map.js), and the relocated lat/lng fields. GPS button, search pick, pin drag, and typed values all stay in sync via syncPinFromFields(), with a visual mismatch flag for unparseable typed input. Built entirely in JS (mirrors the existing 'More options' disclosure pattern) so post-form.html.twig needs no template change. --- themes/intotheeast/css-compiled/post-form.css | 2 +- .../js/post/maplibre-gl-5OH44QV6.js | 585 ++++++++++++++++++ themes/intotheeast/js/post/post-form.js | 126 ++-- themes/intotheeast/js/src/location-map.js | 61 ++ themes/intotheeast/js/src/post-form.js | 242 ++++++++ 5 files changed, 952 insertions(+), 64 deletions(-) create mode 100644 themes/intotheeast/js/post/maplibre-gl-5OH44QV6.js create mode 100644 themes/intotheeast/js/src/location-map.js diff --git a/themes/intotheeast/css-compiled/post-form.css b/themes/intotheeast/css-compiled/post-form.css index af310f9..bc07458 100644 --- a/themes/intotheeast/css-compiled/post-form.css +++ b/themes/intotheeast/css-compiled/post-form.css @@ -1,4 +1,4 @@ -.CodeMirror{font-family:monospace;height:300px;color:#000;direction:ltr}.CodeMirror-lines{padding:4px 0}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}.CodeMirror-guttermarker{color:#000}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror-cursor{border-left:1px solid #000;border-right:none;width:0}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.cm-fat-cursor .CodeMirror-cursor{width:auto;border:0!important;background:#7e7}.cm-fat-cursor div.CodeMirror-cursors{z-index:1}.cm-fat-cursor .CodeMirror-line::selection,.cm-fat-cursor .CodeMirror-line>span::selection,.cm-fat-cursor .CodeMirror-line>span>span::selection{background:0 0}.cm-fat-cursor .CodeMirror-line::-moz-selection,.cm-fat-cursor .CodeMirror-line>span::-moz-selection,.cm-fat-cursor .CodeMirror-line>span>span::-moz-selection{background:0 0}.cm-fat-cursor{caret-color:transparent}@-moz-keyframes blink{50%{background-color:transparent}}@-webkit-keyframes blink{50%{background-color:transparent}}@keyframes blink{50%{background-color:transparent}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-rulers{position:absolute;inset:-50px 0 0;overflow:hidden}.CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;position:absolute}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:700}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-strikethrough{text-decoration:line-through}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-type,.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta,.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-s-default .cm-error,.cm-invalidchar{color:red}.CodeMirror-composing{border-bottom:2px solid}div.CodeMirror span.CodeMirror-matchingbracket{color:#0b0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#a22}.CodeMirror-matchingtag{background:#ff96004d}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{position:relative;overflow:hidden;background:#fff}.CodeMirror-scroll{overflow:scroll!important;margin-bottom:-50px;margin-right:-50px;padding-bottom:50px;height:100%;outline:0;position:relative;z-index:0}.CodeMirror-sizer{position:relative;border-right:50px solid transparent}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none;outline:0}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;min-height:100%;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;vertical-align:top;margin-bottom:-50px}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;background:0 0!important;border:none!important}.CodeMirror-gutter-background{position:absolute;top:0;bottom:0;z-index:4}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-gutter-wrapper ::selection{background-color:transparent}.CodeMirror-gutter-wrapper ::-moz-selection{background-color:transparent}.CodeMirror-lines{cursor:text;min-height:1px}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent;-webkit-font-variant-ligatures:contextual;font-variant-ligatures:contextual}.CodeMirror-wrap pre.CodeMirror-line,.CodeMirror-wrap pre.CodeMirror-line-like{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-linebackground{position:absolute;inset:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;padding:.1px}.CodeMirror-code{outline:0}.CodeMirror-gutter,.CodeMirror-gutters,.CodeMirror-linenumber,.CodeMirror-scroll,.CodeMirror-sizer{-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-cursor{position:absolute;pointer-events:none}.CodeMirror-measure pre{position:static}div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}div.CodeMirror-dragcursors,.CodeMirror-focused div.CodeMirror-cursors{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.CodeMirror-line::selection,.CodeMirror-line>span::selection,.CodeMirror-line>span>span::selection{background:#d7d4f0}.CodeMirror-line::-moz-selection,.CodeMirror-line>span::-moz-selection,.CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}.cm-searching{background-color:#ffa;background-color:#ff06}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:""}span.CodeMirror-selectedtext{background:0 0}.EasyMDEContainer{display:block}.CodeMirror-rtl pre{direction:rtl}.EasyMDEContainer.sided--no-fullscreen{display:flex;flex-direction:row;flex-wrap:wrap}.EasyMDEContainer .CodeMirror{box-sizing:border-box;height:auto;border:1px solid #ced4da;border-bottom-left-radius:4px;border-bottom-right-radius:4px;padding:10px;font:inherit;z-index:0;word-wrap:break-word}.EasyMDEContainer .CodeMirror-scroll{cursor:text}.EasyMDEContainer .CodeMirror-fullscreen{background:#fff;position:fixed!important;inset:50px 0 0;height:auto;z-index:8;border-right:none!important;border-bottom-right-radius:0!important}.EasyMDEContainer .CodeMirror-sided{width:50%!important}.EasyMDEContainer.sided--no-fullscreen .CodeMirror-sided{border-right:none!important;border-bottom-right-radius:0;position:relative;flex:1 1 auto}.EasyMDEContainer .CodeMirror-placeholder{opacity:.5}.EasyMDEContainer .CodeMirror-focused .CodeMirror-selected{background:#d9d9d9}.editor-toolbar{position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;padding:9px 10px;border-top:1px solid #ced4da;border-left:1px solid #ced4da;border-right:1px solid #ced4da;border-top-left-radius:4px;border-top-right-radius:4px}.editor-toolbar.fullscreen{width:100%;height:50px;padding-top:10px;padding-bottom:10px;box-sizing:border-box;background:#fff;border:0;position:fixed;top:0;left:0;opacity:1;z-index:9}.editor-toolbar.fullscreen:before{width:20px;height:50px;background:-moz-linear-gradient(left,#fff 0,rgba(255,255,255,0) 100%);background:-webkit-gradient(linear,left top,right top,color-stop(0,#fff),color-stop(100%,rgba(255,255,255,0)));background:-webkit-linear-gradient(left,#fff 0,rgba(255,255,255,0) 100%);background:-o-linear-gradient(left,#fff 0,rgba(255,255,255,0) 100%);background:-ms-linear-gradient(left,#fff 0,rgba(255,255,255,0) 100%);background:linear-gradient(to right,#fff 0,#fff0);position:fixed;top:0;left:0;margin:0;padding:0}.editor-toolbar.fullscreen:after{width:20px;height:50px;background:-moz-linear-gradient(left,rgba(255,255,255,0) 0,#fff 100%);background:-webkit-gradient(linear,left top,right top,color-stop(0,rgba(255,255,255,0)),color-stop(100%,#fff));background:-webkit-linear-gradient(left,rgba(255,255,255,0) 0,#fff 100%);background:-o-linear-gradient(left,rgba(255,255,255,0) 0,#fff 100%);background:-ms-linear-gradient(left,rgba(255,255,255,0) 0,#fff 100%);background:linear-gradient(to right,#fff0 0,#fff);position:fixed;top:0;right:0;margin:0;padding:0}.EasyMDEContainer.sided--no-fullscreen .editor-toolbar{width:100%}.editor-toolbar .easymde-dropdown,.editor-toolbar button{background:0 0;display:inline-block;text-align:center;text-decoration:none!important;height:30px;margin:0;padding:0;border:1px solid transparent;border-radius:3px;cursor:pointer}.editor-toolbar button{font-weight:700;min-width:30px;padding:0 6px;white-space:nowrap}.editor-toolbar button.active,.editor-toolbar button:hover{background:#fcfcfc;border-color:#95a5a6}.editor-toolbar i.separator{display:inline-block;width:0;border-left:1px solid #d9d9d9;border-right:1px solid #fff;color:transparent;text-indent:-10px;margin:0 6px}.editor-toolbar button:after{font-family:Arial,Helvetica Neue,Helvetica,sans-serif;font-size:65%;vertical-align:text-bottom;position:relative;top:2px}.editor-toolbar button.heading-1:after{content:"1"}.editor-toolbar button.heading-2:after{content:"2"}.editor-toolbar button.heading-3:after{content:"3"}.editor-toolbar button.heading-bigger:after{content:"\25b2"}.editor-toolbar button.heading-smaller:after{content:"\25bc"}.editor-toolbar.disabled-for-preview button:not(.no-disable){opacity:.6;pointer-events:none}@media only screen and (max-width:700px){.editor-toolbar i.no-mobile{display:none}}.editor-statusbar{padding:8px 10px;font-size:12px;color:#959694;text-align:right}.EasyMDEContainer.sided--no-fullscreen .editor-statusbar{width:100%}.editor-statusbar span{display:inline-block;min-width:4em;margin-left:1em}.editor-statusbar .lines:before{content:"lines: "}.editor-statusbar .words:before{content:"words: "}.editor-statusbar .characters:before{content:"characters: "}.editor-preview-full{position:absolute;width:100%;height:100%;top:0;left:0;z-index:7;overflow:auto;display:none;box-sizing:border-box}.editor-preview-side{position:fixed;bottom:0;width:50%;top:50px;right:0;z-index:9;overflow:auto;display:none;box-sizing:border-box;border:1px solid #ddd;word-wrap:break-word}.editor-preview-active-side{display:block}.EasyMDEContainer.sided--no-fullscreen .editor-preview-active-side{flex:1 1 auto;height:auto;position:static}.editor-preview-active{display:block}.editor-preview{padding:10px;background:#fafafa}.editor-preview>p{margin-top:0}.editor-preview pre{background:#eee;margin-bottom:10px}.editor-preview table td,.editor-preview table th{border:1px solid #ddd;padding:5px}.cm-s-easymde .cm-tag{color:#63a35c}.cm-s-easymde .cm-attribute{color:#795da3}.cm-s-easymde .cm-string{color:#183691}.cm-s-easymde .cm-header-1{font-size:calc(1.375rem + 1.5vw)}.cm-s-easymde .cm-header-2{font-size:calc(1.325rem + .9vw)}.cm-s-easymde .cm-header-3{font-size:calc(1.3rem + .6vw)}.cm-s-easymde .cm-header-4{font-size:calc(1.275rem + .3vw)}.cm-s-easymde .cm-header-5{font-size:1.25rem}.cm-s-easymde .cm-header-6{font-size:1rem}.cm-s-easymde .cm-header-1,.cm-s-easymde .cm-header-2,.cm-s-easymde .cm-header-3,.cm-s-easymde .cm-header-4,.cm-s-easymde .cm-header-5,.cm-s-easymde .cm-header-6{margin-bottom:.5rem;line-height:1.2}.cm-s-easymde .cm-comment{background:#0000000d;border-radius:2px}.cm-s-easymde .cm-link{color:#7f8c8d}.cm-s-easymde .cm-url{color:#aab2b3}.cm-s-easymde .cm-quote{color:#7f8c8d;font-style:italic}.editor-toolbar .easymde-dropdown{position:relative;background:linear-gradient(to bottom right,#fff 0 84%,#333 50% 100%);border-radius:0;border:1px solid #fff}.editor-toolbar .easymde-dropdown:hover{background:linear-gradient(to bottom right,#fff 0 84%,#333 50% 100%)}.easymde-dropdown-content{display:block;visibility:hidden;position:absolute;background-color:#f9f9f9;box-shadow:0 8px 16px #0003;padding:8px;z-index:2;top:30px}.easymde-dropdown:active .easymde-dropdown-content,.easymde-dropdown:focus .easymde-dropdown-content,.easymde-dropdown:focus-within .easymde-dropdown-content{visibility:visible}.easymde-dropdown-content button{display:block}span[data-img-src]:after{content:"";background-image:var(--bg-image);display:block;max-height:100%;max-width:100%;background-size:contain;height:0;padding-top:var(--height);width:var(--width);background-repeat:no-repeat}.CodeMirror .cm-spell-error:not(.cm-url):not(.cm-comment):not(.cm-tag):not(.cm-word){background:#ff000026}.post-edit-error{margin:1rem 0;padding:.75rem 1rem;border:1px solid #E5786A;border-radius:8px;background:#e5786a1f;color:#e5786a;font-size:.9rem;line-height:1.4}.editor-toolbar .mde-btn:before{font-style:normal;font-weight:400;font-family:inherit}.editor-toolbar .mde-bold:before{content:"B";font-weight:700}.editor-toolbar .mde-italic:before{content:"I";font-style:italic}.editor-toolbar .mde-ul:before{content:"\2022\2002\2014"}.editor-toolbar .mde-link:before{content:"\1f517"}.editor-toolbar .mde-preview:before{content:"\1f441"}.EasyMDEContainer .CodeMirror{min-height:180px}.photo-convert-status:empty{display:none}.photo-convert-status{font-size:var(--text-sm);margin-top:var(--space-2)}.photo-reauth-hint{display:none;font-size:var(--text-sm);color:var(--color-ink-muted);margin-top:var(--space-2)}.photo-reauth-hint.is-shown{display:block}.post-form-wrap select{width:100%;font-family:var(--font-ui);font-size:var(--text-base);padding:.875rem 2.5rem .875rem 1rem;min-height:44px;border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-canvas);color:var(--color-ink);-webkit-appearance:none;appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2390887E' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 1rem center}.post-form-wrap select:focus{outline:2px solid var(--color-accent);outline-offset:1px;border-color:var(--color-accent)}.post-form-wrap input[type=number]{width:100%;font-family:var(--font-ui);font-size:var(--text-base);padding:.875rem 1rem;min-height:44px;border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-canvas);color:var(--color-ink);-webkit-appearance:none;appearance:none}.post-form-wrap input[type=number]:focus{outline:2px solid var(--color-accent);outline-offset:1px;border-color:var(--color-accent)}.more-options{margin-bottom:var(--space-5);border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-canvas)}.more-options__summary{cursor:pointer;padding:.875rem 1rem;min-height:44px;display:flex;align-items:center;font-family:var(--font-ui);font-size:var(--text-sm);font-weight:600;color:var(--color-ink);list-style:none;user-select:none}.more-options__summary::-webkit-details-marker{display:none}.more-options__summary:before{content:"\25b8";margin-right:var(--space-2);color:var(--color-ink-muted);transition:transform .15s}.more-options[open] .more-options__summary:before{transform:rotate(90deg)}.more-options[open] .more-options__summary{border-bottom:1px solid var(--color-border)}.more-options>.form-field{padding:0 1rem}.more-options>.form-field:first-of-type{padding-top:var(--space-4)}.more-options>.form-field:last-child{padding-bottom:var(--space-4);margin-bottom:0}.btn-action.is-loading{position:relative;color:transparent;pointer-events:none}.btn-action.is-loading:after{content:"";position:absolute;top:50%;left:50%;width:16px;height:16px;margin:-8px 0 0 -8px;border:2px solid var(--color-ink-muted);border-top-color:var(--color-accent);border-radius:50%;animation:post-spin .7s linear infinite}.btn-action[disabled]{opacity:.5;cursor:not-allowed}@keyframes post-spin{to{transform:rotate(360deg)}}.post-form-wrap .notices{padding:1rem 1.1rem;border-radius:var(--radius-md);font-size:var(--text-base);margin:0 0 var(--space-5);background:var(--color-canvas);color:var(--color-ink);border-left:4px solid var(--color-accent)}.post-form-wrap .notices p{margin:0}.post-form-wrap .notices.error,.post-form-wrap .notices.red{border-left-color:var(--color-error)}.post-form-wrap .notices.success,.post-form-wrap .notices.green{border-left-color:var(--color-accent)}.post-success{margin:0 0 var(--space-5);padding:1.1rem;border-radius:var(--radius-md);background:var(--color-accent-light);border:1px solid var(--color-accent)}.post-success__title{font-family:var(--font-ui);font-size:var(--text-md);font-weight:600;color:var(--color-ink);margin:0 0 var(--space-3)}.post-success__actions{display:flex;flex-wrap:wrap;gap:var(--space-3)}.post-success__view{flex:1;min-width:140px;text-align:center;padding:.8rem 1rem;min-height:44px;border-radius:var(--radius-md);background:var(--color-accent);color:var(--color-accent-on);font-weight:600;text-decoration:none}.post-success__again{flex:1;min-width:140px;text-align:center;padding:.8rem 1rem;min-height:44px;border-radius:var(--radius-md);background:transparent;color:var(--color-ink);border:1px solid var(--color-border);font-weight:600;text-decoration:none}.filepond--credits{display:none!important}.filepond--root{font-family:var(--font-ui);font-size:var(--text-base)}.filepond--panel-root{background-color:var(--color-canvas);border:1px solid var(--color-border);border-radius:var(--radius-md)}.filepond--drop-label,.filepond--drop-label label{color:var(--color-ink-muted)}.filepond--label-action{color:var(--color-accent);text-decoration-color:var(--color-accent)}.filepond--item-panel{background-color:var(--color-surface-raised);border-radius:var(--radius-md)}.filepond--drip-blob{background-color:var(--color-accent)}.filepond--file{color:var(--color-ink)}.filepond--file-action-button{color:var(--color-ink);background-color:#00000073}.filepond--file-action-button:hover{background-color:#000000a6}.filepond--image-preview-overlay{display:none!important}.filepond--item[data-filepond-item-state=processing-complete] .filepond--file-info,.filepond--item[data-filepond-item-state=processing-complete] .filepond--file-status{opacity:0}.filepond--item[data-filepond-item-state=processing-complete]:after{content:"\2713";position:absolute;top:8px;right:8px;z-index:5;width:24px;height:24px;line-height:24px;text-align:center;border-radius:50%;background:var(--color-accent);color:#fff;font-size:15px;font-weight:700;box-shadow:0 1px 3px #00000059;pointer-events:none}.filepond--list.filepond--list{margin:.25rem}.filepond--item{width:calc(33.333% - .5rem)}.filepond--item .filepond--panel-root,.filepond--item .filepond--image-preview-wrapper{border-radius:var(--radius-sm)}.filepond--image-preview,.filepond--image-preview-wrapper,.filepond--image-clip,.filepond--image-preview canvas,.filepond--image-bitmap,.filepond--file img{-webkit-user-drag:none;-khtml-user-drag:none;user-drag:none}.filepond--item[data-filepond-item-state=idle] .filepond--file-info,.filepond--item[data-filepond-item-state=idle] .filepond--file-status{opacity:0}.photos-collapse{margin-bottom:var(--space-5);border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-canvas)}.photos-collapse__summary{cursor:pointer;padding:.875rem 1rem;min-height:44px;display:flex;align-items:center;font-family:var(--font-ui);font-size:var(--text-sm);font-weight:600;color:var(--color-ink);list-style:none;user-select:none}.photos-collapse__summary::-webkit-details-marker{display:none}.photos-collapse__summary:before{content:"\25b8";margin-right:var(--space-2);color:var(--color-ink-muted);transition:transform .15s}.photos-collapse[open] .photos-collapse__summary:before{transform:rotate(90deg)}.photos-collapse[open] .photos-collapse__summary{border-bottom:1px solid var(--color-border)}.photos-collapse>:not(summary){padding-left:1rem;padding-right:1rem}.photos-collapse[open] .filepond--root,.photos-collapse[open] .filepond-root{margin:var(--space-4) 0}.photos-collapse[open]>.photo-convert-status:last-child,.photos-collapse[open]>.photo-reauth-hint:last-child{padding-bottom:var(--space-4)}.EasyMDEContainer .CodeMirror{background:var(--color-canvas);color:var(--color-ink);border:1px solid var(--color-border);border-radius:0 0 var(--radius-md) var(--radius-md);font-family:var(--font-ui);font-size:var(--text-base);line-height:var(--leading-normal);padding:var(--space-1)}.EasyMDEContainer .CodeMirror-cursor{border-color:var(--color-ink)}.EasyMDEContainer .CodeMirror-selected{background:var(--color-accent-light)!important}.EasyMDEContainer .editor-toolbar{background:var(--color-surface-raised);border:1px solid var(--color-border);border-bottom:none;border-radius:var(--radius-md) var(--radius-md) 0 0;opacity:1}.EasyMDEContainer .editor-toolbar button{color:var(--color-ink)!important;min-width:34px;height:34px}.EasyMDEContainer .editor-toolbar button:hover,.EasyMDEContainer .editor-toolbar button.active{background:var(--color-accent-light);border-color:var(--color-border)}.EasyMDEContainer .editor-toolbar i.separator{border-color:var(--color-border)}.EasyMDEContainer .editor-preview,.EasyMDEContainer .editor-preview-side{background:var(--color-canvas);color:var(--color-ink)}.EasyMDEContainer .editor-preview a{color:var(--color-accent)}.photo-editor{margin-bottom:var(--space-5)}.photo-editor__head{display:flex;align-items:center;justify-content:space-between;gap:var(--space-3);margin-bottom:var(--space-2)}.photo-editor__label{font-family:var(--font-ui);font-size:var(--text-base);font-weight:600;color:var(--color-ink)}.photo-editor__add{font-family:var(--font-ui);font-size:var(--text-sm);background:var(--color-accent);color:#fff;border:none;border-radius:var(--radius-sm);padding:var(--space-2) var(--space-4);cursor:pointer}.photo-editor__add:disabled{opacity:.5;cursor:default}.photo-editor__status{font-size:var(--text-sm);color:var(--color-ink-muted);min-height:1.2em;margin:0 0 var(--space-2)}.photo-editor__status.error{color:var(--color-error)}.photo-editor__grid{display:grid;grid-template-columns:repeat(3,1fr);gap:var(--space-2)}@media (min-width: 600px){.photo-editor__grid{grid-template-columns:repeat(4,1fr)}}.photo-editor__loading,.photo-editor__empty{grid-column:1 / -1;color:var(--color-ink-muted);font-size:var(--text-sm);padding:var(--space-4) 0}.photo-editor__cell{position:relative;aspect-ratio:1 / 1;border-radius:var(--radius-sm);overflow:hidden;background:var(--color-surface-raised);cursor:grab;touch-action:none}.photo-editor__cell:active{cursor:grabbing}.photo-editor__img{width:100%;height:100%;object-fit:cover;display:block;-webkit-user-drag:none;user-select:none;pointer-events:none}.photo-editor__cell:first-child:after{content:"Cover";position:absolute;left:var(--space-1);bottom:var(--space-1);font-family:var(--font-ui);font-size:var(--text-xs, .7rem);font-weight:600;color:#fff;background:var(--color-accent);padding:1px 6px;border-radius:var(--radius-sm);pointer-events:none}.photo-editor__del{position:absolute;top:var(--space-1);right:var(--space-1);width:24px;height:24px;line-height:1;display:flex;align-items:center;justify-content:center;border:none;border-radius:50%;background:#0000008c;color:#fff;font-size:.85rem;cursor:pointer}.photo-editor__del:hover{background:#000000bf}.photo-editor__del:disabled{opacity:.4;cursor:default}.photo-editor__confirm{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--space-1);padding:var(--space-2);background:#000000b8;text-align:center}.photo-editor__confirm-q{color:#fff;font-family:var(--font-ui);font-size:var(--text-sm)}.photo-editor__confirm button{font-family:var(--font-ui);font-size:var(--text-xs, .72rem);border:none;border-radius:var(--radius-sm);padding:3px 10px;cursor:pointer}.photo-editor__confirm-yes{background:var(--color-error);color:#fff}.photo-editor__confirm-no{background:#fff;color:var(--color-ink)}.photo-editor__confirm button:disabled{opacity:.5;cursor:default}.photo-editor__cell.sortable-ghost{opacity:.4}.photo-editor__cell.sortable-chosen{outline:2px solid var(--color-accent)} +.CodeMirror{font-family:monospace;height:300px;color:#000;direction:ltr}.CodeMirror-lines{padding:4px 0}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}.CodeMirror-guttermarker{color:#000}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror-cursor{border-left:1px solid #000;border-right:none;width:0}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.cm-fat-cursor .CodeMirror-cursor{width:auto;border:0!important;background:#7e7}.cm-fat-cursor div.CodeMirror-cursors{z-index:1}.cm-fat-cursor .CodeMirror-line::selection,.cm-fat-cursor .CodeMirror-line>span::selection,.cm-fat-cursor .CodeMirror-line>span>span::selection{background:0 0}.cm-fat-cursor .CodeMirror-line::-moz-selection,.cm-fat-cursor .CodeMirror-line>span::-moz-selection,.cm-fat-cursor .CodeMirror-line>span>span::-moz-selection{background:0 0}.cm-fat-cursor{caret-color:transparent}@-moz-keyframes blink{50%{background-color:transparent}}@-webkit-keyframes blink{50%{background-color:transparent}}@keyframes blink{50%{background-color:transparent}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-rulers{position:absolute;inset:-50px 0 0;overflow:hidden}.CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;position:absolute}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:700}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-strikethrough{text-decoration:line-through}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-type,.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta,.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-s-default .cm-error,.cm-invalidchar{color:red}.CodeMirror-composing{border-bottom:2px solid}div.CodeMirror span.CodeMirror-matchingbracket{color:#0b0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#a22}.CodeMirror-matchingtag{background:#ff96004d}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{position:relative;overflow:hidden;background:#fff}.CodeMirror-scroll{overflow:scroll!important;margin-bottom:-50px;margin-right:-50px;padding-bottom:50px;height:100%;outline:0;position:relative;z-index:0}.CodeMirror-sizer{position:relative;border-right:50px solid transparent}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none;outline:0}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;min-height:100%;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;vertical-align:top;margin-bottom:-50px}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;background:0 0!important;border:none!important}.CodeMirror-gutter-background{position:absolute;top:0;bottom:0;z-index:4}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-gutter-wrapper ::selection{background-color:transparent}.CodeMirror-gutter-wrapper ::-moz-selection{background-color:transparent}.CodeMirror-lines{cursor:text;min-height:1px}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent;-webkit-font-variant-ligatures:contextual;font-variant-ligatures:contextual}.CodeMirror-wrap pre.CodeMirror-line,.CodeMirror-wrap pre.CodeMirror-line-like{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-linebackground{position:absolute;inset:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;padding:.1px}.CodeMirror-code{outline:0}.CodeMirror-gutter,.CodeMirror-gutters,.CodeMirror-linenumber,.CodeMirror-scroll,.CodeMirror-sizer{-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-cursor{position:absolute;pointer-events:none}.CodeMirror-measure pre{position:static}div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}div.CodeMirror-dragcursors,.CodeMirror-focused div.CodeMirror-cursors{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.CodeMirror-line::selection,.CodeMirror-line>span::selection,.CodeMirror-line>span>span::selection{background:#d7d4f0}.CodeMirror-line::-moz-selection,.CodeMirror-line>span::-moz-selection,.CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}.cm-searching{background-color:#ffa;background-color:#ff06}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:""}span.CodeMirror-selectedtext{background:0 0}.EasyMDEContainer{display:block}.CodeMirror-rtl pre{direction:rtl}.EasyMDEContainer.sided--no-fullscreen{display:flex;flex-direction:row;flex-wrap:wrap}.EasyMDEContainer .CodeMirror{box-sizing:border-box;height:auto;border:1px solid #ced4da;border-bottom-left-radius:4px;border-bottom-right-radius:4px;padding:10px;font:inherit;z-index:0;word-wrap:break-word}.EasyMDEContainer .CodeMirror-scroll{cursor:text}.EasyMDEContainer .CodeMirror-fullscreen{background:#fff;position:fixed!important;inset:50px 0 0;height:auto;z-index:8;border-right:none!important;border-bottom-right-radius:0!important}.EasyMDEContainer .CodeMirror-sided{width:50%!important}.EasyMDEContainer.sided--no-fullscreen .CodeMirror-sided{border-right:none!important;border-bottom-right-radius:0;position:relative;flex:1 1 auto}.EasyMDEContainer .CodeMirror-placeholder{opacity:.5}.EasyMDEContainer .CodeMirror-focused .CodeMirror-selected{background:#d9d9d9}.editor-toolbar{position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;padding:9px 10px;border-top:1px solid #ced4da;border-left:1px solid #ced4da;border-right:1px solid #ced4da;border-top-left-radius:4px;border-top-right-radius:4px}.editor-toolbar.fullscreen{width:100%;height:50px;padding-top:10px;padding-bottom:10px;box-sizing:border-box;background:#fff;border:0;position:fixed;top:0;left:0;opacity:1;z-index:9}.editor-toolbar.fullscreen:before{width:20px;height:50px;background:-moz-linear-gradient(left,#fff 0,rgba(255,255,255,0) 100%);background:-webkit-gradient(linear,left top,right top,color-stop(0,#fff),color-stop(100%,rgba(255,255,255,0)));background:-webkit-linear-gradient(left,#fff 0,rgba(255,255,255,0) 100%);background:-o-linear-gradient(left,#fff 0,rgba(255,255,255,0) 100%);background:-ms-linear-gradient(left,#fff 0,rgba(255,255,255,0) 100%);background:linear-gradient(to right,#fff 0,#fff0);position:fixed;top:0;left:0;margin:0;padding:0}.editor-toolbar.fullscreen:after{width:20px;height:50px;background:-moz-linear-gradient(left,rgba(255,255,255,0) 0,#fff 100%);background:-webkit-gradient(linear,left top,right top,color-stop(0,rgba(255,255,255,0)),color-stop(100%,#fff));background:-webkit-linear-gradient(left,rgba(255,255,255,0) 0,#fff 100%);background:-o-linear-gradient(left,rgba(255,255,255,0) 0,#fff 100%);background:-ms-linear-gradient(left,rgba(255,255,255,0) 0,#fff 100%);background:linear-gradient(to right,#fff0 0,#fff);position:fixed;top:0;right:0;margin:0;padding:0}.EasyMDEContainer.sided--no-fullscreen .editor-toolbar{width:100%}.editor-toolbar .easymde-dropdown,.editor-toolbar button{background:0 0;display:inline-block;text-align:center;text-decoration:none!important;height:30px;margin:0;padding:0;border:1px solid transparent;border-radius:3px;cursor:pointer}.editor-toolbar button{font-weight:700;min-width:30px;padding:0 6px;white-space:nowrap}.editor-toolbar button.active,.editor-toolbar button:hover{background:#fcfcfc;border-color:#95a5a6}.editor-toolbar i.separator{display:inline-block;width:0;border-left:1px solid #d9d9d9;border-right:1px solid #fff;color:transparent;text-indent:-10px;margin:0 6px}.editor-toolbar button:after{font-family:Arial,Helvetica Neue,Helvetica,sans-serif;font-size:65%;vertical-align:text-bottom;position:relative;top:2px}.editor-toolbar button.heading-1:after{content:"1"}.editor-toolbar button.heading-2:after{content:"2"}.editor-toolbar button.heading-3:after{content:"3"}.editor-toolbar button.heading-bigger:after{content:"\25b2"}.editor-toolbar button.heading-smaller:after{content:"\25bc"}.editor-toolbar.disabled-for-preview button:not(.no-disable){opacity:.6;pointer-events:none}@media only screen and (max-width:700px){.editor-toolbar i.no-mobile{display:none}}.editor-statusbar{padding:8px 10px;font-size:12px;color:#959694;text-align:right}.EasyMDEContainer.sided--no-fullscreen .editor-statusbar{width:100%}.editor-statusbar span{display:inline-block;min-width:4em;margin-left:1em}.editor-statusbar .lines:before{content:"lines: "}.editor-statusbar .words:before{content:"words: "}.editor-statusbar .characters:before{content:"characters: "}.editor-preview-full{position:absolute;width:100%;height:100%;top:0;left:0;z-index:7;overflow:auto;display:none;box-sizing:border-box}.editor-preview-side{position:fixed;bottom:0;width:50%;top:50px;right:0;z-index:9;overflow:auto;display:none;box-sizing:border-box;border:1px solid #ddd;word-wrap:break-word}.editor-preview-active-side{display:block}.EasyMDEContainer.sided--no-fullscreen .editor-preview-active-side{flex:1 1 auto;height:auto;position:static}.editor-preview-active{display:block}.editor-preview{padding:10px;background:#fafafa}.editor-preview>p{margin-top:0}.editor-preview pre{background:#eee;margin-bottom:10px}.editor-preview table td,.editor-preview table th{border:1px solid #ddd;padding:5px}.cm-s-easymde .cm-tag{color:#63a35c}.cm-s-easymde .cm-attribute{color:#795da3}.cm-s-easymde .cm-string{color:#183691}.cm-s-easymde .cm-header-1{font-size:calc(1.375rem + 1.5vw)}.cm-s-easymde .cm-header-2{font-size:calc(1.325rem + .9vw)}.cm-s-easymde .cm-header-3{font-size:calc(1.3rem + .6vw)}.cm-s-easymde .cm-header-4{font-size:calc(1.275rem + .3vw)}.cm-s-easymde .cm-header-5{font-size:1.25rem}.cm-s-easymde .cm-header-6{font-size:1rem}.cm-s-easymde .cm-header-1,.cm-s-easymde .cm-header-2,.cm-s-easymde .cm-header-3,.cm-s-easymde .cm-header-4,.cm-s-easymde .cm-header-5,.cm-s-easymde .cm-header-6{margin-bottom:.5rem;line-height:1.2}.cm-s-easymde .cm-comment{background:#0000000d;border-radius:2px}.cm-s-easymde .cm-link{color:#7f8c8d}.cm-s-easymde .cm-url{color:#aab2b3}.cm-s-easymde .cm-quote{color:#7f8c8d;font-style:italic}.editor-toolbar .easymde-dropdown{position:relative;background:linear-gradient(to bottom right,#fff 0 84%,#333 50% 100%);border-radius:0;border:1px solid #fff}.editor-toolbar .easymde-dropdown:hover{background:linear-gradient(to bottom right,#fff 0 84%,#333 50% 100%)}.easymde-dropdown-content{display:block;visibility:hidden;position:absolute;background-color:#f9f9f9;box-shadow:0 8px 16px #0003;padding:8px;z-index:2;top:30px}.easymde-dropdown:active .easymde-dropdown-content,.easymde-dropdown:focus .easymde-dropdown-content,.easymde-dropdown:focus-within .easymde-dropdown-content{visibility:visible}.easymde-dropdown-content button{display:block}span[data-img-src]:after{content:"";background-image:var(--bg-image);display:block;max-height:100%;max-width:100%;background-size:contain;height:0;padding-top:var(--height);width:var(--width);background-repeat:no-repeat}.CodeMirror .cm-spell-error:not(.cm-url):not(.cm-comment):not(.cm-tag):not(.cm-word){background:#ff000026}.maplibregl-map{font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative;-webkit-tap-highlight-color:rgb(0 0 0/0)}.maplibregl-canvas{left:0;position:absolute;top:0}.maplibregl-map:fullscreen{height:100%;width:100%}.maplibregl-ctrl-group button.maplibregl-ctrl-compass{touch-action:none}.maplibregl-canvas-container.maplibregl-interactive,.maplibregl-ctrl-group button.maplibregl-ctrl-compass{cursor:grab;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:grabbing}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.maplibregl-ctrl-top-left{left:0;top:0}.maplibregl-ctrl-top-right{right:0;top:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{bottom:0;right:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{float:left;margin:10px 0 0 10px}.maplibregl-ctrl-top-right .maplibregl-ctrl{float:right;margin:10px 10px 0 0}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{float:left;margin:0 0 10px 10px}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{float:right;margin:0 10px 10px 0}.maplibregl-ctrl-group{background:#fff;border-radius:4px}.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px #0000001a}@media (forced-colors:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.maplibregl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;padding:0;width:29px}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (forced-colors:active){.maplibregl-ctrl-icon{background-color:transparent}.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl button:disabled{cursor:not-allowed}.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}.maplibregl-ctrl button:not(:disabled):hover{background-color:#0000000d}.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.maplibregl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.maplibregl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.maplibregl-ctrl-group button:focus:only-child{border-radius:inherit}.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%23333' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%2333b5e5' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23aaa' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{animation:maplibregl-spin 2s linear infinite}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23999' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23666' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}}@keyframes maplibregl-spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E");background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (forced-colors:active){a.maplibregl-ctrl-logo{background-color:transparent;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}.maplibregl-ctrl.maplibregl-ctrl-attrib{background-color:#ffffff80;margin:0;padding:0 5px}@media screen{.maplibregl-ctrl-attrib.maplibregl-compact{background-color:#fff;border-radius:12px;box-sizing:content-box;color:#000;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.maplibregl-ctrl-attrib-button{background-color:#ffffff80;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E");border:0;border-radius:12px;box-sizing:border-box;cursor:pointer;display:none;height:24px;outline:none;position:absolute;right:0;top:0;width:24px}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button{-webkit-appearance:none;-moz-appearance:none;appearance:none;list-style:none}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker{display:none}.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button{left:0}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner{display:block}.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button{background-color:#0000000d}.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{right:0;top:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{left:0;top:0}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (forced-colors:active){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%23fff' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}@media screen and (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}.maplibregl-ctrl-attrib a{color:#000000bf;text-decoration:none}.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.maplibregl-attrib-empty{display:none}.maplibregl-ctrl-scale{background-color:#ffffffbf;border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px}.maplibregl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.maplibregl-popup-anchor-top,.maplibregl-popup-anchor-top-left,.maplibregl-popup-anchor-top-right{flex-direction:column}.maplibregl-popup-anchor-bottom,.maplibregl-popup-anchor-bottom-left,.maplibregl-popup-anchor-bottom-right{flex-direction:column-reverse}.maplibregl-popup-anchor-left{flex-direction:row}.maplibregl-popup-anchor-right{flex-direction:row-reverse}.maplibregl-popup-tip{border:10px solid transparent;height:0;width:0;z-index:1}.maplibregl-popup-anchor-top .maplibregl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.maplibregl-popup-anchor-left .maplibregl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.maplibregl-popup-anchor-right .maplibregl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}.maplibregl-popup-close-button{background-color:transparent;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.maplibregl-popup-close-button:hover{background-color:#0000000d}.maplibregl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px #0000001a;padding:15px 10px;pointer-events:auto;position:relative}.maplibregl-popup-anchor-top-left .maplibregl-popup-content{border-top-left-radius:0}.maplibregl-popup-anchor-top-right .maplibregl-popup-content{border-top-right-radius:0}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-content{border-bottom-left-radius:0}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-content{border-bottom-right-radius:0}.maplibregl-popup-track-pointer{display:none}.maplibregl-popup-track-pointer *{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-map:hover .maplibregl-popup-track-pointer{display:flex}.maplibregl-map:active .maplibregl-popup-track-pointer{display:none}.maplibregl-marker{left:0;position:absolute;top:0;transition:opacity .2s;will-change:transform}.maplibregl-user-location-dot,.maplibregl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.maplibregl-user-location-dot:before{animation:maplibregl-user-location-dot-pulse 2s infinite;content:"";position:absolute}.maplibregl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px #00000059;box-sizing:border-box;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px}@keyframes maplibregl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.maplibregl-user-location-dot-stale{background-color:#aaa}.maplibregl-user-location-dot-stale:after{display:none}.maplibregl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.maplibregl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}.maplibregl-cooperative-gesture-screen{align-items:center;background:#0006;color:#fff;display:flex;font-size:1.4em;inset:0;justify-content:center;line-height:1.2;opacity:0;padding:1rem;pointer-events:none;position:absolute;transition:opacity 1s ease 1s;z-index:99999}.maplibregl-cooperative-gesture-screen.maplibregl-show{opacity:1;transition:opacity .05s}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:none}@media (hover:none),(width <= 480px){.maplibregl-cooperative-gesture-screen .maplibregl-desktop-message{display:none}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:block}}.maplibregl-pseudo-fullscreen{height:100%!important;left:0!important;position:fixed!important;top:0!important;width:100%!important;z-index:99999}.post-edit-error{margin:1rem 0;padding:.75rem 1rem;border:1px solid #E5786A;border-radius:8px;background:#e5786a1f;color:#e5786a;font-size:.9rem;line-height:1.4}.editor-toolbar .mde-btn:before{font-style:normal;font-weight:400;font-family:inherit}.editor-toolbar .mde-bold:before{content:"B";font-weight:700}.editor-toolbar .mde-italic:before{content:"I";font-style:italic}.editor-toolbar .mde-ul:before{content:"\2022\2002\2014"}.editor-toolbar .mde-link:before{content:"\1f517"}.editor-toolbar .mde-preview:before{content:"\1f441"}.EasyMDEContainer .CodeMirror{min-height:180px}.photo-convert-status:empty{display:none}.photo-convert-status{font-size:var(--text-sm);margin-top:var(--space-2)}.photo-reauth-hint{display:none;font-size:var(--text-sm);color:var(--color-ink-muted);margin-top:var(--space-2)}.photo-reauth-hint.is-shown{display:block}.post-form-wrap select{width:100%;font-family:var(--font-ui);font-size:var(--text-base);padding:.875rem 2.5rem .875rem 1rem;min-height:44px;border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-canvas);color:var(--color-ink);-webkit-appearance:none;appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2390887E' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 1rem center}.post-form-wrap select:focus{outline:2px solid var(--color-accent);outline-offset:1px;border-color:var(--color-accent)}.post-form-wrap input[type=number]{width:100%;font-family:var(--font-ui);font-size:var(--text-base);padding:.875rem 1rem;min-height:44px;border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-canvas);color:var(--color-ink);-webkit-appearance:none;appearance:none}.post-form-wrap input[type=number]:focus{outline:2px solid var(--color-accent);outline-offset:1px;border-color:var(--color-accent)}.more-options{margin-bottom:var(--space-5);border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-canvas)}.more-options__summary{cursor:pointer;padding:.875rem 1rem;min-height:44px;display:flex;align-items:center;font-family:var(--font-ui);font-size:var(--text-sm);font-weight:600;color:var(--color-ink);list-style:none;user-select:none}.more-options__summary::-webkit-details-marker{display:none}.more-options__summary:before{content:"\25b8";margin-right:var(--space-2);color:var(--color-ink-muted);transition:transform .15s}.more-options[open] .more-options__summary:before{transform:rotate(90deg)}.more-options[open] .more-options__summary{border-bottom:1px solid var(--color-border)}.more-options>.form-field{padding:0 1rem}.more-options>.form-field:first-of-type{padding-top:var(--space-4)}.more-options>.form-field:last-child{padding-bottom:var(--space-4);margin-bottom:0}.btn-action.is-loading{position:relative;color:transparent;pointer-events:none}.btn-action.is-loading:after{content:"";position:absolute;top:50%;left:50%;width:16px;height:16px;margin:-8px 0 0 -8px;border:2px solid var(--color-ink-muted);border-top-color:var(--color-accent);border-radius:50%;animation:post-spin .7s linear infinite}.btn-action[disabled]{opacity:.5;cursor:not-allowed}@keyframes post-spin{to{transform:rotate(360deg)}}.post-form-wrap .notices{padding:1rem 1.1rem;border-radius:var(--radius-md);font-size:var(--text-base);margin:0 0 var(--space-5);background:var(--color-canvas);color:var(--color-ink);border-left:4px solid var(--color-accent)}.post-form-wrap .notices p{margin:0}.post-form-wrap .notices.error,.post-form-wrap .notices.red{border-left-color:var(--color-error)}.post-form-wrap .notices.success,.post-form-wrap .notices.green{border-left-color:var(--color-accent)}.post-success{margin:0 0 var(--space-5);padding:1.1rem;border-radius:var(--radius-md);background:var(--color-accent-light);border:1px solid var(--color-accent)}.post-success__title{font-family:var(--font-ui);font-size:var(--text-md);font-weight:600;color:var(--color-ink);margin:0 0 var(--space-3)}.post-success__actions{display:flex;flex-wrap:wrap;gap:var(--space-3)}.post-success__view{flex:1;min-width:140px;text-align:center;padding:.8rem 1rem;min-height:44px;border-radius:var(--radius-md);background:var(--color-accent);color:var(--color-accent-on);font-weight:600;text-decoration:none}.post-success__again{flex:1;min-width:140px;text-align:center;padding:.8rem 1rem;min-height:44px;border-radius:var(--radius-md);background:transparent;color:var(--color-ink);border:1px solid var(--color-border);font-weight:600;text-decoration:none}.filepond--credits{display:none!important}.filepond--root{font-family:var(--font-ui);font-size:var(--text-base)}.filepond--panel-root{background-color:var(--color-canvas);border:1px solid var(--color-border);border-radius:var(--radius-md)}.filepond--drop-label,.filepond--drop-label label{color:var(--color-ink-muted)}.filepond--label-action{color:var(--color-accent);text-decoration-color:var(--color-accent)}.filepond--item-panel{background-color:var(--color-surface-raised);border-radius:var(--radius-md)}.filepond--drip-blob{background-color:var(--color-accent)}.filepond--file{color:var(--color-ink)}.filepond--file-action-button{color:var(--color-ink);background-color:#00000073}.filepond--file-action-button:hover{background-color:#000000a6}.filepond--image-preview-overlay{display:none!important}.filepond--item[data-filepond-item-state=processing-complete] .filepond--file-info,.filepond--item[data-filepond-item-state=processing-complete] .filepond--file-status{opacity:0}.filepond--item[data-filepond-item-state=processing-complete]:after{content:"\2713";position:absolute;top:8px;right:8px;z-index:5;width:24px;height:24px;line-height:24px;text-align:center;border-radius:50%;background:var(--color-accent);color:#fff;font-size:15px;font-weight:700;box-shadow:0 1px 3px #00000059;pointer-events:none}.filepond--list.filepond--list{margin:.25rem}.filepond--item{width:calc(33.333% - .5rem)}.filepond--item .filepond--panel-root,.filepond--item .filepond--image-preview-wrapper{border-radius:var(--radius-sm)}.filepond--image-preview,.filepond--image-preview-wrapper,.filepond--image-clip,.filepond--image-preview canvas,.filepond--image-bitmap,.filepond--file img{-webkit-user-drag:none;-khtml-user-drag:none;user-drag:none}.filepond--item[data-filepond-item-state=idle] .filepond--file-info,.filepond--item[data-filepond-item-state=idle] .filepond--file-status{opacity:0}.photos-collapse{margin-bottom:var(--space-5);border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-canvas)}.photos-collapse__summary{cursor:pointer;padding:.875rem 1rem;min-height:44px;display:flex;align-items:center;font-family:var(--font-ui);font-size:var(--text-sm);font-weight:600;color:var(--color-ink);list-style:none;user-select:none}.photos-collapse__summary::-webkit-details-marker{display:none}.photos-collapse__summary:before{content:"\25b8";margin-right:var(--space-2);color:var(--color-ink-muted);transition:transform .15s}.photos-collapse[open] .photos-collapse__summary:before{transform:rotate(90deg)}.photos-collapse[open] .photos-collapse__summary{border-bottom:1px solid var(--color-border)}.photos-collapse>:not(summary){padding-left:1rem;padding-right:1rem}.photos-collapse[open] .filepond--root,.photos-collapse[open] .filepond-root{margin:var(--space-4) 0}.photos-collapse[open]>.photo-convert-status:last-child,.photos-collapse[open]>.photo-reauth-hint:last-child{padding-bottom:var(--space-4)}.EasyMDEContainer .CodeMirror{background:var(--color-canvas);color:var(--color-ink);border:1px solid var(--color-border);border-radius:0 0 var(--radius-md) var(--radius-md);font-family:var(--font-ui);font-size:var(--text-base);line-height:var(--leading-normal);padding:var(--space-1)}.EasyMDEContainer .CodeMirror-cursor{border-color:var(--color-ink)}.EasyMDEContainer .CodeMirror-selected{background:var(--color-accent-light)!important}.EasyMDEContainer .editor-toolbar{background:var(--color-surface-raised);border:1px solid var(--color-border);border-bottom:none;border-radius:var(--radius-md) var(--radius-md) 0 0;opacity:1}.EasyMDEContainer .editor-toolbar button{color:var(--color-ink)!important;min-width:34px;height:34px}.EasyMDEContainer .editor-toolbar button:hover,.EasyMDEContainer .editor-toolbar button.active{background:var(--color-accent-light);border-color:var(--color-border)}.EasyMDEContainer .editor-toolbar i.separator{border-color:var(--color-border)}.EasyMDEContainer .editor-preview,.EasyMDEContainer .editor-preview-side{background:var(--color-canvas);color:var(--color-ink)}.EasyMDEContainer .editor-preview a{color:var(--color-accent)}.photo-editor{margin-bottom:var(--space-5)}.photo-editor__head{display:flex;align-items:center;justify-content:space-between;gap:var(--space-3);margin-bottom:var(--space-2)}.photo-editor__label{font-family:var(--font-ui);font-size:var(--text-base);font-weight:600;color:var(--color-ink)}.photo-editor__add{font-family:var(--font-ui);font-size:var(--text-sm);background:var(--color-accent);color:#fff;border:none;border-radius:var(--radius-sm);padding:var(--space-2) var(--space-4);cursor:pointer}.photo-editor__add:disabled{opacity:.5;cursor:default}.photo-editor__status{font-size:var(--text-sm);color:var(--color-ink-muted);min-height:1.2em;margin:0 0 var(--space-2)}.photo-editor__status.error{color:var(--color-error)}.photo-editor__grid{display:grid;grid-template-columns:repeat(3,1fr);gap:var(--space-2)}@media (min-width: 600px){.photo-editor__grid{grid-template-columns:repeat(4,1fr)}}.photo-editor__loading,.photo-editor__empty{grid-column:1 / -1;color:var(--color-ink-muted);font-size:var(--text-sm);padding:var(--space-4) 0}.photo-editor__cell{position:relative;aspect-ratio:1 / 1;border-radius:var(--radius-sm);overflow:hidden;background:var(--color-surface-raised);cursor:grab;touch-action:none}.photo-editor__cell:active{cursor:grabbing}.photo-editor__img{width:100%;height:100%;object-fit:cover;display:block;-webkit-user-drag:none;user-select:none;pointer-events:none}.photo-editor__cell:first-child:after{content:"Cover";position:absolute;left:var(--space-1);bottom:var(--space-1);font-family:var(--font-ui);font-size:var(--text-xs, .7rem);font-weight:600;color:#fff;background:var(--color-accent);padding:1px 6px;border-radius:var(--radius-sm);pointer-events:none}.photo-editor__del{position:absolute;top:var(--space-1);right:var(--space-1);width:24px;height:24px;line-height:1;display:flex;align-items:center;justify-content:center;border:none;border-radius:50%;background:#0000008c;color:#fff;font-size:.85rem;cursor:pointer}.photo-editor__del:hover{background:#000000bf}.photo-editor__del:disabled{opacity:.4;cursor:default}.photo-editor__confirm{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--space-1);padding:var(--space-2);background:#000000b8;text-align:center}.photo-editor__confirm-q{color:#fff;font-family:var(--font-ui);font-size:var(--text-sm)}.photo-editor__confirm button{font-family:var(--font-ui);font-size:var(--text-xs, .72rem);border:none;border-radius:var(--radius-sm);padding:3px 10px;cursor:pointer}.photo-editor__confirm-yes{background:var(--color-error);color:#fff}.photo-editor__confirm-no{background:#fff;color:var(--color-ink)}.photo-editor__confirm button:disabled{opacity:.5;cursor:default}.photo-editor__cell.sortable-ghost{opacity:.4}.photo-editor__cell.sortable-chosen{outline:2px solid var(--color-accent)} /*! Bundled license information: easymde/dist/easymde.min.css: diff --git a/themes/intotheeast/js/post/maplibre-gl-5OH44QV6.js b/themes/intotheeast/js/post/maplibre-gl-5OH44QV6.js new file mode 100644 index 0000000..635ae6e --- /dev/null +++ b/themes/intotheeast/js/post/maplibre-gl-5OH44QV6.js @@ -0,0 +1,585 @@ +import{b as Cp}from"./chunk-ZWRDP37E.js";var kp=Cp((Kc,Jc)=>{(function(an,Br){typeof Kc=="object"&&typeof Jc<"u"?Jc.exports=Br():typeof define=="function"&&define.amd?define(Br):(an=typeof globalThis<"u"?globalThis:an||self,an.maplibregl=Br())})(Kc,function(){"use strict";var an={},Br={};function Ll(L,p,ki){if(Br[L]=ki,L==="index"){var Hi="var sharedModule = {}; ("+Br.shared+")(sharedModule); ("+Br.worker+")(sharedModule);",Gt={};return Br.shared(Gt),Br.index(an,Gt),typeof window<"u"&&an.setWorkerUrl(window.URL.createObjectURL(new Blob([Hi],{type:"text/javascript"}))),an}}Ll("shared",["exports"],function(L){"use strict";function p(i,t,r,s){return new(r||(r=Promise))(function(l,u){function d(x){try{_(s.next(x))}catch(v){u(v)}}function f(x){try{_(s.throw(x))}catch(v){u(v)}}function _(x){var v;x.done?l(x.value):(v=x.value,v instanceof r?v:new r(function(w){w(v)})).then(d,f)}_((s=s.apply(i,t||[])).next())})}function ki(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}typeof SuppressedError=="function"&&SuppressedError;var Hi=Gt;function Gt(i,t){this.x=i,this.y=t}Gt.prototype={clone:function(){return new Gt(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,t){return this.clone()._rotateAround(i,t)},matMult:function(i){return this.clone()._matMult(i)},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(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var t=i.x-this.x,r=i.y-this.y;return t*t+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,t){return Math.atan2(this.x*t-this.y*i,this.x*i+this.y*t)},_matMult:function(i){var t=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=t,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var t=Math.cos(i),r=Math.sin(i),s=r*this.x+t*this.y;return this.x=t*this.x-r*this.y,this.y=s,this},_rotateAround:function(i,t){var r=Math.cos(i),s=Math.sin(i),l=t.y+s*(this.x-t.x)+r*(this.y-t.y);return this.x=t.x+r*(this.x-t.x)-s*(this.y-t.y),this.y=l,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Gt.convert=function(i){return i instanceof Gt?i:Array.isArray(i)?new Gt(i[0],i[1]):i};var me=ki(Hi),se=Fr;function Fr(i,t,r,s){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(s-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=t,this.p2x=r,this.p2y=s}Fr.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,t){if(t===void 0&&(t=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,s=0;s<8;s++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)l?d=r:f=r,r=.5*(f-d)+d;return r},solve:function(i,t){return this.sampleCurveY(this.solveCurveX(i,t))}};var vr=ki(se);let Xi,br;function cr(){return Xi==null&&(Xi=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Xi}function Gn(){if(br==null&&(br=!1,cr())){let t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let s=0;s<5*5;s++){let l=4*s;t.fillStyle=`rgb(${l},${l+1},${l+2})`,t.fillRect(s%5,Math.floor(s/5),1,1)}let r=t.getImageData(0,0,5,5).data;for(let s=0;s<5*5*4;s++)if(s%4!=3&&r[s]!==s){br=!0;break}}}return br||!1}function hi(i,t,r,s){let l=new vr(i,t,r,s);return u=>l.solve(u)}let wa=hi(.25,.1,.25,1);function zi(i,t,r){return Math.min(r,Math.max(t,i))}function Wi(i,t,r){let s=r-t,l=((i-t)%s+s)%s+t;return l===t?r:l}function vi(i,...t){for(let r of t)for(let s in r)i[s]=r[s];return i}let Is=1;function Ki(i,t,r){let s={};for(let l in i)s[l]=t.call(this,i[l],l,i);return s}function Hn(i,t,r){let s={};for(let l in i)t.call(this,i[l],l,i)&&(s[l]=i[l]);return s}function st(i){return Array.isArray(i)?i.map(st):typeof i=="object"&&i?Ki(i,st):i}let Ps={};function Ft(i){Ps[i]||(typeof console<"u"&&console.warn(i),Ps[i]=!0)}function Ht(i,t,r){return(r.y-i.y)*(t.x-i.x)>(t.y-i.y)*(r.x-i.x)}function hr(i){return typeof WorkerGlobalScope<"u"&&i!==void 0&&i instanceof WorkerGlobalScope}let on=null;function Ji(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}let As="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Or(i,t,r,s,l){return p(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");let u=new VideoFrame(i,{timestamp:0});try{let d=u?.format;if(!d||!d.startsWith("BGR")&&!d.startsWith("RGB"))throw new Error(`Unrecognized format ${d}`);let f=d.startsWith("BGR"),_=new Uint8ClampedArray(s*l*4);if(yield u.copyTo(_,function(x,v,w,I,M){let k=4*Math.max(-v,0),z=(Math.max(0,w)-w)*I*4+k,F=4*I,j=Math.max(0,v),Q=Math.max(0,w);return{rect:{x:j,y:Q,width:Math.min(x.width,v+I)-j,height:Math.min(x.height,w+M)-Q},layout:[{offset:z,stride:F}]}}(i,t,r,s,l)),f)for(let x=0;x<_.length;x+=4){let v=_[x];_[x]=_[x+2],_[x+2]=v}return _}finally{u.close()}})}let ur,ei,Ei="AbortError";function ln(){return new Error(Ei)}let wr={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Yi(i){return wr.REGISTERED_PROTOCOLS[i.substring(0,i.indexOf("://"))]}let cn="global-dispatcher";class ui extends Error{constructor(t,r,s,l){super(`AJAXError: ${r} (${t}): ${s}`),this.status=t,this.statusText=r,this.url=s,this.body=l}}let Di=()=>hr(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Vr=function(i,t){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){let s=Yi(i.url);if(s)return s(i,t);if(hr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,targetMapId:cn},t)}if(!(/^file:/.test(r=i.url)||/^file:/.test(Di())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(s,l){return p(this,void 0,void 0,function*(){let u=new Request(s.url,{method:s.method||"GET",body:s.body,credentials:s.credentials,headers:s.headers,cache:s.cache,referrer:Di(),signal:l.signal});s.type!=="json"||u.headers.has("Accept")||u.headers.set("Accept","application/json");let d=yield fetch(u);if(!d.ok){let x=yield d.blob();throw new ui(d.status,d.statusText,s.url,x)}let f;f=s.type==="arrayBuffer"||s.type==="image"?d.arrayBuffer():s.type==="json"?d.json():d.text();let _=yield f;if(l.signal.aborted)throw ln();return{data:_,cacheControl:d.headers.get("Cache-Control"),expires:d.headers.get("Expires")}})}(i,t);if(hr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:i,mustQueue:!0,targetMapId:cn},t)}var r;return function(s,l){return new Promise((u,d)=>{var f;let _=new XMLHttpRequest;_.open(s.method||"GET",s.url,!0),s.type!=="arrayBuffer"&&s.type!=="image"||(_.responseType="arraybuffer");for(let x in s.headers)_.setRequestHeader(x,s.headers[x]);s.type==="json"&&(_.responseType="text",!((f=s.headers)===null||f===void 0)&&f.Accept||_.setRequestHeader("Accept","application/json")),_.withCredentials=s.credentials==="include",_.onerror=()=>{d(new Error(_.statusText))},_.onload=()=>{if(!l.signal.aborted)if((_.status>=200&&_.status<300||_.status===0)&&_.response!==null){let x=_.response;if(s.type==="json")try{x=JSON.parse(_.response)}catch(v){return void d(v)}u({data:x,cacheControl:_.getResponseHeader("Cache-Control"),expires:_.getResponseHeader("Expires")})}else{let x=new Blob([_.response],{type:_.getResponseHeader("Content-Type")});d(new ui(_.status,_.statusText,s.url,x))}},l.signal.addEventListener("abort",()=>{_.abort(),d(ln())}),_.send(s.body)})}(i,t)};function Nr(i){if(!i||i.indexOf("://")<=0||i.indexOf("data:image/")===0||i.indexOf("blob:")===0)return!0;let t=new URL(i),r=window.location;return t.protocol===r.protocol&&t.host===r.host}function Xn(i,t,r){r[i]&&r[i].indexOf(t)!==-1||(r[i]=r[i]||[],r[i].push(t))}function dr(i,t,r){if(r&&r[i]){let s=r[i].indexOf(t);s!==-1&&r[i].splice(s,1)}}class Tr{constructor(t,r={}){vi(this,r),this.type=t}}class Sr extends Tr{constructor(t,r={}){super("error",vi({error:t},r))}}class hn{on(t,r){return this._listeners=this._listeners||{},Xn(t,r,this._listeners),this}off(t,r){return dr(t,r,this._listeners),dr(t,r,this._oneTimeListeners),this}once(t,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},Xn(t,r,this._oneTimeListeners),this):new Promise(s=>this.once(t,s))}fire(t,r){typeof t=="string"&&(t=new Tr(t,r||{}));let s=t.type;if(this.listens(s)){t.target=this;let l=this._listeners&&this._listeners[s]?this._listeners[s].slice():[];for(let f of l)f.call(this,t);let u=this._oneTimeListeners&&this._oneTimeListeners[s]?this._oneTimeListeners[s].slice():[];for(let f of u)dr(s,f,this._oneTimeListeners),f.call(this,t);let d=this._eventedParent;d&&(vi(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),d.fire(t))}else t instanceof Sr&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,r){return this._eventedParent=t,this._eventedParentData=r,this}}var ie={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},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:{},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_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"}},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:"enum",default:"mercator",values:{mercator:{},globe:{}}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","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:"number",default:335,minimum:0,maximum:359,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:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",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"}},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"}}};let jr=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Wn(i,t){let r={};for(let s in i)s!=="ref"&&(r[s]=i[s]);return jr.forEach(s=>{s in t&&(r[s]=t[s])}),r}function et(i,t){if(Array.isArray(i)){if(!Array.isArray(t)||i.length!==t.length)return!1;for(let r=0;r`:i.itemType.kind==="value"?"array":`array<${t}>`}return i.kind}let D=[Pr,_e,$e,Be,ti,fr,Li,A(Ne),Ar,ir,N];function O(i,t){if(t.kind==="error")return null;if(i.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!O(i.itemType,t.itemType))&&(typeof i.N!="number"||i.N===t.N))return null}else{if(i.kind===t.kind)return null;if(i.kind==="value"){for(let r of D)if(!O(r,t))return null}}return`Expected ${P(i)} but found ${P(t)} instead.`}function H(i,t){return t.some(r=>r.kind===i.kind)}function W(i,t){return t.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}function Y(i,t){return i.kind==="array"&&t.kind==="array"?i.itemType.kind===t.itemType.kind&&typeof i.N=="number":i.kind===t.kind}let q=.96422,ne=.82521,le=4/29,te=6/29,de=3*te*te,Ee=te*te*te,De=Math.PI/180,Ke=180/Math.PI;function je(i){return(i%=360)<0&&(i+=360),i}function Je([i,t,r,s]){let l,u,d=Pt((.2225045*(i=Ge(i))+.7168786*(t=Ge(t))+.0606169*(r=Ge(r)))/1);i===t&&t===r?l=u=d:(l=Pt((.4360747*i+.3850649*t+.1430804*r)/q),u=Pt((.0139322*i+.0971045*t+.7141733*r)/ne));let f=116*d-16;return[f<0?0:f,500*(l-d),200*(d-u),s]}function Ge(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function Pt(i){return i>Ee?Math.pow(i,1/3):i/de+le}function xt([i,t,r,s]){let l=(i+16)/116,u=isNaN(t)?l:l+t/500,d=isNaN(r)?l:l-r/200;return l=1*rt(l),u=q*rt(u),d=ne*rt(d),[qe(3.1338561*u-1.6168667*l-.4906146*d),qe(-.9787684*u+1.9161415*l+.033454*d),qe(.0719453*u-.2289914*l+1.4052427*d),s]}function qe(i){return(i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055)<0?0:i>1?1:i}function rt(i){return i>te?i*i*i:de*(i-le)}function gt(i){return parseInt(i.padEnd(2,i),16)/255}function kt(i,t){return Lt(t?i/100:i,0,1)}function Lt(i,t,r){return Math.min(Math.max(t,i),r)}function Wt(i){return!i.some(Number.isNaN)}let dn={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]};class nt{constructor(t,r,s,l=1,u=!0){this.r=t,this.g=r,this.b=s,this.a=l,u||(this.r*=l,this.g*=l,this.b*=l,l||this.overwriteGetter("rgb",[t,r,s,l]))}static parse(t){if(t instanceof nt)return t;if(typeof t!="string")return;let r=function(s){if((s=s.toLowerCase().trim())==="transparent")return[0,0,0,0];let l=dn[s];if(l){let[d,f,_]=l;return[d/255,f/255,_/255,1]}if(s.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(s)){let d=s.length<6?1:2,f=1;return[gt(s.slice(f,f+=d)),gt(s.slice(f,f+=d)),gt(s.slice(f,f+=d)),gt(s.slice(f,f+d)||"ff")]}if(s.startsWith("rgb")){let d=s.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){let[f,_,x,v,w,I,M,k,z,F,j,Q]=d,G=[v||" ",M||" ",F].join("");if(G===" "||G===" /"||G===",,"||G===",,,"){let J=[x,I,z].join(""),re=J==="%%%"?100:J===""?255:0;if(re){let ce=[Lt(+_/re,0,1),Lt(+w/re,0,1),Lt(+k/re,0,1),j?kt(+j,Q):1];if(Wt(ce))return ce}}return}}let u=s.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(u){let[d,f,_,x,v,w,I,M,k]=u,z=[_||" ",v||" ",I].join("");if(z===" "||z===" /"||z===",,"||z===",,,"){let F=[+f,Lt(+x,0,100),Lt(+w,0,100),M?kt(+M,k):1];if(Wt(F))return function([j,Q,G,J]){function re(ce){let we=(ce+j/30)%12,Le=Q*Math.min(G,1-G);return G-Le*Math.max(-1,Math.min(we-3,9-we,1))}return j=je(j),Q/=100,G/=100,[re(0),re(8),re(4),J]}(F)}}}(t);return r?new nt(...r,!1):void 0}get rgb(){let{r:t,g:r,b:s,a:l}=this,u=l||1/0;return this.overwriteGetter("rgb",[t/u,r/u,s/u,l])}get hcl(){return this.overwriteGetter("hcl",function(t){let[r,s,l,u]=Je(t),d=Math.sqrt(s*s+l*l);return[Math.round(1e4*d)?je(Math.atan2(l,s)*Ke):NaN,d,r,u]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Je(this.rgb))}overwriteGetter(t,r){return Object.defineProperty(this,t,{value:r}),r}toString(){let[t,r,s,l]=this.rgb;return`rgba(${[t,r,s].map(u=>Math.round(255*u)).join(",")},${l})`}}nt.black=new nt(0,0,0,1),nt.white=new nt(1,1,1,1),nt.transparent=new nt(0,0,0,0),nt.red=new nt(1,0,0,1);class Ta{constructor(t,r,s){this.sensitivity=t?r?"variant":"case":r?"accent":"base",this.locale=s,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,r){return this.collator.compare(t,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Sa{constructor(t,r,s,l,u){this.text=t,this.image=r,this.scale=s,this.fontStack=l,this.textColor=u}}class di{constructor(t){this.sections=t}static fromString(t){return new di([new Sa(t,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(t=>t.text.length!==0||t.image&&t.image.name.length!==0)}static factory(t){return t instanceof di?t:di.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}}class pi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof pi)return t;if(typeof t=="number")return new pi([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(let r of t)if(typeof r!="number")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new pi(t)}}toString(){return JSON.stringify(this.values)}}let Rl=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class wi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof wi)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let r=0;r=0&&i<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof r=="number"&&r>=0&&r<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[i,t,r,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[i,t,r,s]:[i,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ur(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof nt||i instanceof Ta||i instanceof di||i instanceof pi||i instanceof wi||i instanceof fi)return!0;if(Array.isArray(i)){for(let t of i)if(!Ur(t))return!1;return!0}if(typeof i=="object"){for(let t in i)if(!Ur(i[t]))return!1;return!0}return!1}function At(i){if(i===null)return Pr;if(typeof i=="string")return $e;if(typeof i=="boolean")return Be;if(typeof i=="number")return _e;if(i instanceof nt)return ti;if(i instanceof Ta)return tr;if(i instanceof di)return fr;if(i instanceof pi)return Ar;if(i instanceof wi)return N;if(i instanceof fi)return ir;if(Array.isArray(i)){let t=i.length,r;for(let s of i){let l=At(s);if(r){if(r===l)continue;r=Ne;break}r=l}return A(r||Ne,t)}return Li}function Qn(i){let t=typeof i;return i===null?"":t==="string"||t==="number"||t==="boolean"?String(i):i instanceof nt||i instanceof di||i instanceof pi||i instanceof wi||i instanceof fi?i.toString():JSON.stringify(i)}class Ri{constructor(t,r){this.type=t,this.value=r}static parse(t,r){if(t.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Ur(t[1]))return r.error("invalid value");let s=t[1],l=At(s),u=r.expectedType;return l.kind!=="array"||l.N!==0||!u||u.kind!=="array"||typeof u.N=="number"&&u.N!==0||(l=u),new Ri(l,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class St{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}let Ms={string:$e,number:_e,boolean:Be,object:Li};class Bi{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let s,l=1,u=t[0];if(u==="array"){let f,_;if(t.length>2){let x=t[1];if(typeof x!="string"||!(x in Ms)||x==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);f=Ms[x],l++}else f=Ne;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return r.error('The length argument to "array" must be a positive integer literal',2);_=t[2],l++}s=A(f,_)}else{if(!Ms[u])throw new Error(`Types doesn't contain name = ${u}`);s=Ms[u]}let d=[];for(;lt.outputDefined())}}let Ia={"to-boolean":Be,"to-color":ti,"to-number":_e,"to-string":$e};class Fi{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let s=t[0];if(!Ia[s])throw new Error(`Can't parse ${s} as it is not part of the known types`);if((s==="to-boolean"||s==="to-string")&&t.length!==2)return r.error("Expected one argument.");let l=Ia[s],u=[];for(let d=1;d4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:pn(r[0],r[1],r[2],r[3]),!s))return new nt(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new St(s||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(let s of this.args){r=s.evaluate(t);let l=pi.parse(r);if(l)return l}throw new St(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(let s of this.args){r=s.evaluate(t);let l=wi.parse(r);if(l)return l}throw new St(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(let s of this.args){if(r=s.evaluate(t),r===null)return 0;let l=Number(r);if(!isNaN(l))return l}throw new St(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return di.fromString(Qn(this.args[0].evaluate(t)));case"resolvedImage":return fi.fromString(Qn(this.args[0].evaluate(t)));default:return Qn(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}let Bl=["Unknown","Point","LineString","Polygon"];class Cs{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},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"?Bl[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(t){let r=this._parseColorCache[t];return r||(r=this._parseColorCache[t]=nt.parse(t)),r}}class $r{constructor(t,r,s=[],l,u=new er,d=[]){this.registry=t,this.path=s,this.key=s.map(f=>`[${f}]`).join(""),this.scope=u,this.errors=d,this.expectedType=l,this._isConstant=r}parse(t,r,s,l,u={}){return r?this.concat(r,s,l)._parse(t,u):this._parse(t,u)}_parse(t,r){function s(l,u,d){return d==="assert"?new Bi(u,[l]):d==="coerce"?new Fi(u,[l]):l}if(t!==null&&typeof t!="string"&&typeof t!="boolean"&&typeof t!="number"||(t=["literal",t]),Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let l=t[0];if(typeof l!="string")return this.error(`Expression name must be a string, but found ${typeof l} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let u=this.registry[l];if(u){let d=u.parse(t,this);if(!d)return null;if(this.expectedType){let f=this.expectedType,_=d.type;if(f.kind!=="string"&&f.kind!=="number"&&f.kind!=="boolean"&&f.kind!=="object"&&f.kind!=="array"||_.kind!=="value")if(f.kind!=="color"&&f.kind!=="formatted"&&f.kind!=="resolvedImage"||_.kind!=="value"&&_.kind!=="string")if(f.kind!=="padding"||_.kind!=="value"&&_.kind!=="number"&&_.kind!=="array")if(f.kind!=="variableAnchorOffsetCollection"||_.kind!=="value"&&_.kind!=="array"){if(this.checkSubtype(f,_))return null}else d=s(d,f,r.typeAnnotation||"coerce");else d=s(d,f,r.typeAnnotation||"coerce");else d=s(d,f,r.typeAnnotation||"coerce");else d=s(d,f,r.typeAnnotation||"assert")}if(!(d instanceof Ri)&&d.type.kind!=="resolvedImage"&&this._isConstant(d)){let f=new Cs;try{d=new Ri(d.type,d.evaluate(f))}catch(_){return this.error(_.message),null}}return d}return this.error(`Unknown expression "${l}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(t===void 0?"'undefined' value invalid. Use null instead.":typeof t=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,r,s){let l=typeof t=="number"?this.path.concat(t):this.path,u=s?this.scope.concat(s):this.scope;return new $r(this.registry,this._isConstant,l,r||null,u,this.errors)}error(t,...r){let s=`${this.key}${r.map(l=>`[${l}]`).join("")}`;this.errors.push(new Xt(s,t))}checkSubtype(t,r){let s=O(t,r);return s&&this.error(s),s}}class Mr{constructor(t,r){this.type=r.type,this.bindings=[].concat(t),this.result=r}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(let r of this.bindings)t(r[1]);t(this.result)}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);let s=[];for(let u=1;u=s.length)throw new St(`Array index out of bounds: ${r} > ${s.length-1}.`);if(r!==Math.floor(r))throw new St(`Array index must be an integer, but found ${r} instead.`);return s[r]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class Aa{constructor(t,r){this.type=Be,this.needle=t,this.haystack=r}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let s=r.parse(t[1],1,Ne),l=r.parse(t[2],2,Ne);return s&&l?H(s.type,[Be,$e,_e,Pr,Ne])?new Aa(s,l):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${P(s.type)} instead`):null}evaluate(t){let r=this.needle.evaluate(t),s=this.haystack.evaluate(t);if(!s)return!1;if(!W(r,["boolean","string","number","null"]))throw new St(`Expected first argument to be of type boolean, string, number or null, but found ${P(At(r))} instead.`);if(!W(s,["string","array"]))throw new St(`Expected second argument to be of type array or string, but found ${P(At(s))} instead.`);return s.indexOf(r)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class fn{constructor(t,r,s){this.type=_e,this.needle=t,this.haystack=r,this.fromIndex=s}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);let s=r.parse(t[1],1,Ne),l=r.parse(t[2],2,Ne);if(!s||!l)return null;if(!H(s.type,[Be,$e,_e,Pr,Ne]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${P(s.type)} instead`);if(t.length===4){let u=r.parse(t[3],3,_e);return u?new fn(s,l,u):null}return new fn(s,l)}evaluate(t){let r=this.needle.evaluate(t),s=this.haystack.evaluate(t);if(!W(r,["boolean","string","number","null"]))throw new St(`Expected first argument to be of type boolean, string, number or null, but found ${P(At(r))} instead.`);let l;if(this.fromIndex&&(l=this.fromIndex.evaluate(t)),W(s,["string"])){let u=s.indexOf(r,l);return u===-1?-1:[...s.slice(0,u)].length}if(W(s,["array"]))return s.indexOf(r,l);throw new St(`Expected second argument to be of type array or string, but found ${P(At(s))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class Ma{constructor(t,r,s,l,u,d){this.inputType=t,this.type=r,this.input=s,this.cases=l,this.outputs=u,this.otherwise=d}static parse(t,r){if(t.length<5)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return r.error("Expected an even number of arguments.");let s,l;r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);let u={},d=[];for(let x=2;xNumber.MAX_SAFE_INTEGER)return I.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof k=="number"&&Math.floor(k)!==k)return I.error("Numeric branch labels must be integer values.");if(s){if(I.checkSubtype(s,At(k)))return null}else s=At(k);if(u[String(k)]!==void 0)return I.error("Branch labels must be unique.");u[String(k)]=d.length}let M=r.parse(w,x,l);if(!M)return null;l=l||M.type,d.push(M)}let f=r.parse(t[1],1,Ne);if(!f)return null;let _=r.parse(t[t.length-1],t.length-1,l);return _?f.type.kind!=="value"&&r.concat(1).checkSubtype(s,f.type)?null:new Ma(s,l,f,u,d,_):null}evaluate(t){let r=this.input.evaluate(t);return(At(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}}class ks{constructor(t,r,s){this.type=t,this.branches=r,this.otherwise=s}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return r.error("Expected an odd number of arguments.");let s;r.expectedType&&r.expectedType.kind!=="value"&&(s=r.expectedType);let l=[];for(let d=1;dr.outputDefined())&&this.otherwise.outputDefined()}}class es{constructor(t,r,s,l){this.type=t,this.input=r,this.beginIndex=s,this.endIndex=l}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);let s=r.parse(t[1],1,Ne),l=r.parse(t[2],2,_e);if(!s||!l)return null;if(!H(s.type,[A(Ne),$e,Ne]))return r.error(`Expected first argument to be of type array or string, but found ${P(s.type)} instead`);if(t.length===4){let u=r.parse(t[3],3,_e);return u?new es(s.type,s,l,u):null}return new es(s.type,s,l)}evaluate(t){let r=this.input.evaluate(t),s=this.beginIndex.evaluate(t),l;if(this.endIndex&&(l=this.endIndex.evaluate(t)),W(r,["string"]))return[...r].slice(s,l).join("");if(W(r,["array"]))return r.slice(s,l);throw new St(`Expected first argument to be of type array or string, but found ${P(At(r))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function zs(i,t){let r=i.length-1,s,l,u=0,d=r,f=0;for(;u<=d;)if(f=Math.floor((u+d)/2),s=i[f],l=i[f+1],s<=t){if(f===r||tt))throw new St("Input is not a number.");d=f-1}return 0}class mn{constructor(t,r,s){this.type=t,this.input=r,this.labels=[],this.outputs=[];for(let[l,u]of s)this.labels.push(l),this.outputs.push(u)}static parse(t,r){if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");let s=r.parse(t[1],1,_e);if(!s)return null;let l=[],u=null;r.expectedType&&r.expectedType.kind!=="value"&&(u=r.expectedType);for(let d=1;d=f)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',x);let w=r.parse(_,v,u);if(!w)return null;u=u||w.type,l.push([f,w])}return new mn(u,s,l)}evaluate(t){let r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(t);let l=this.input.evaluate(t);if(l<=r[0])return s[0].evaluate(t);let u=r.length;return l>=r[u-1]?s[u-1].evaluate(t):s[zs(r,l)].evaluate(t)}eachChild(t){t(this.input);for(let r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function Eo(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Fl=Do;function Do(i,t,r,s){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(s-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=t,this.p2x=r,this.p2y=s}Do.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,t){if(t===void 0&&(t=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,s=0;s<8;s++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)l?d=r:f=r,r=.5*(f-d)+d;return r},solve:function(i,t){return this.sampleCurveY(this.solveCurveX(i,t))}};var Ol=Eo(Fl);function qr(i,t,r){return i+r*(t-i)}function ts(i,t,r){return i.map((s,l)=>qr(s,t[l],r))}let ii={number:qr,color:function(i,t,r,s="rgb"){switch(s){case"rgb":{let[l,u,d,f]=ts(i.rgb,t.rgb,r);return new nt(l,u,d,f,!1)}case"hcl":{let[l,u,d,f]=i.hcl,[_,x,v,w]=t.hcl,I,M;if(isNaN(l)||isNaN(_))isNaN(l)?isNaN(_)?I=NaN:(I=_,d!==1&&d!==0||(M=x)):(I=l,v!==1&&v!==0||(M=u));else{let Q=_-l;_>l&&Q>180?Q-=360:_180&&(Q+=360),I=l+r*Q}let[k,z,F,j]=function([Q,G,J,re]){return Q=isNaN(Q)?0:Q*De,xt([J,Math.cos(Q)*G,Math.sin(Q)*G,re])}([I,M??qr(u,x,r),qr(d,v,r),qr(f,w,r)]);return new nt(k,z,F,j,!1)}case"lab":{let[l,u,d,f]=xt(ts(i.lab,t.lab,r));return new nt(l,u,d,f,!1)}}},array:ts,padding:function(i,t,r){return new pi(ts(i.values,t.values,r))},variableAnchorOffsetCollection:function(i,t,r){let s=i.values,l=t.values;if(s.length!==l.length)throw new St(`Cannot interpolate values of different length. from: ${i.toString()}, to: ${t.toString()}`);let u=[];for(let d=0;dtypeof v!="number"||v<0||v>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);l={name:"cubic-bezier",controlPoints:x}}}if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(u=r.parse(u,2,_e),!u)return null;let f=[],_=null;s==="interpolate-hcl"||s==="interpolate-lab"?_=ti:r.expectedType&&r.expectedType.kind!=="value"&&(_=r.expectedType);for(let x=0;x=v)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',I);let k=r.parse(w,M,_);if(!k)return null;_=_||k.type,f.push([v,k])}return Y(_,_e)||Y(_,ti)||Y(_,Ar)||Y(_,N)||Y(_,A(_e))?new ri(_,s,l,u,f):r.error(`Type ${P(_)} is not interpolatable.`)}evaluate(t){let r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(t);let l=this.input.evaluate(t);if(l<=r[0])return s[0].evaluate(t);let u=r.length;if(l>=r[u-1])return s[u-1].evaluate(t);let d=zs(r,l),f=ri.interpolationFactor(this.interpolation,l,r[d],r[d+1]),_=s[d].evaluate(t),x=s[d+1].evaluate(t);switch(this.operator){case"interpolate":return ii[this.type.kind](_,x,f);case"interpolate-hcl":return ii.color(_,x,f,"hcl");case"interpolate-lab":return ii.color(_,x,f,"lab")}}eachChild(t){t(this.input);for(let r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function Es(i,t,r,s){let l=s-r,u=i-r;return l===0?0:t===1?u/l:(Math.pow(t,u)-1)/(Math.pow(t,l)-1)}class Ds{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expectected at least one argument.");let s=null,l=r.expectedType;l&&l.kind!=="value"&&(s=l);let u=[];for(let f of t.slice(1)){let _=r.parse(f,1+u.length,s,void 0,{typeAnnotation:"omit"});if(!_)return null;s=s||_.type,u.push(_)}if(!s)throw new Error("No output type");let d=l&&u.some(f=>O(l,f.type));return new Ds(d?Ne:s,u)}evaluate(t){let r,s=null,l=0;for(let u of this.args)if(l++,s=u.evaluate(t),s&&s instanceof fi&&!s.available&&(r||(r=s.name),s=null,l===this.args.length&&(s=r)),s!==null)break;return s}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function Ls(i,t){return i==="=="||i==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function Lo(i,t,r,s){return s.compare(t,r)===0}function _n(i,t,r){let s=i!=="=="&&i!=="!=";return class Ru{constructor(u,d,f){this.type=Be,this.lhs=u,this.rhs=d,this.collator=f,this.hasUntypedArgument=u.type.kind==="value"||d.type.kind==="value"}static parse(u,d){if(u.length!==3&&u.length!==4)return d.error("Expected two or three arguments.");let f=u[0],_=d.parse(u[1],1,Ne);if(!_)return null;if(!Ls(f,_.type))return d.concat(1).error(`"${f}" comparisons are not supported for type '${P(_.type)}'.`);let x=d.parse(u[2],2,Ne);if(!x)return null;if(!Ls(f,x.type))return d.concat(2).error(`"${f}" comparisons are not supported for type '${P(x.type)}'.`);if(_.type.kind!==x.type.kind&&_.type.kind!=="value"&&x.type.kind!=="value")return d.error(`Cannot compare types '${P(_.type)}' and '${P(x.type)}'.`);s&&(_.type.kind==="value"&&x.type.kind!=="value"?_=new Bi(x.type,[_]):_.type.kind!=="value"&&x.type.kind==="value"&&(x=new Bi(_.type,[x])));let v=null;if(u.length===4){if(_.type.kind!=="string"&&x.type.kind!=="string"&&_.type.kind!=="value"&&x.type.kind!=="value")return d.error("Cannot use collator to compare non-string types.");if(v=d.parse(u[3],3,tr),!v)return null}return new Ru(_,x,v)}evaluate(u){let d=this.lhs.evaluate(u),f=this.rhs.evaluate(u);if(s&&this.hasUntypedArgument){let _=At(d),x=At(f);if(_.kind!==x.kind||_.kind!=="string"&&_.kind!=="number")throw new St(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${_.kind}, ${x.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){let _=At(d),x=At(f);if(_.kind!=="string"||x.kind!=="string")return t(u,d,f)}return this.collator?r(u,d,f,this.collator.evaluate(u)):t(u,d,f)}eachChild(u){u(this.lhs),u(this.rhs),this.collator&&u(this.collator)}outputDefined(){return!0}}}let Vl=_n("==",function(i,t,r){return t===r},Lo),Ro=_n("!=",function(i,t,r){return t!==r},function(i,t,r,s){return!Lo(0,t,r,s)}),Bo=_n("<",function(i,t,r){return t",function(i,t,r){return t>r},function(i,t,r,s){return s.compare(t,r)>0}),jl=_n("<=",function(i,t,r){return t<=r},function(i,t,r,s){return s.compare(t,r)<=0}),Fo=_n(">=",function(i,t,r){return t>=r},function(i,t,r,s){return s.compare(t,r)>=0});class is{constructor(t,r,s){this.type=tr,this.locale=s,this.caseSensitive=t,this.diacriticSensitive=r}static parse(t,r){if(t.length!==2)return r.error("Expected one argument.");let s=t[1];if(typeof s!="object"||Array.isArray(s))return r.error("Collator options argument must be an object.");let l=r.parse(s["case-sensitive"]!==void 0&&s["case-sensitive"],1,Be);if(!l)return null;let u=r.parse(s["diacritic-sensitive"]!==void 0&&s["diacritic-sensitive"],1,Be);if(!u)return null;let d=null;return s.locale&&(d=r.parse(s.locale,1,$e),!d)?null:new is(l,u,d)}evaluate(t){return new Ta(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}class Ca{constructor(t,r,s,l,u){this.type=$e,this.number=t,this.locale=r,this.currency=s,this.minFractionDigits=l,this.maxFractionDigits=u}static parse(t,r){if(t.length!==3)return r.error("Expected two arguments.");let s=r.parse(t[1],1,_e);if(!s)return null;let l=t[2];if(typeof l!="object"||Array.isArray(l))return r.error("NumberFormat options argument must be an object.");let u=null;if(l.locale&&(u=r.parse(l.locale,1,$e),!u))return null;let d=null;if(l.currency&&(d=r.parse(l.currency,1,$e),!d))return null;let f=null;if(l["min-fraction-digits"]&&(f=r.parse(l["min-fraction-digits"],1,_e),!f))return null;let _=null;return l["max-fraction-digits"]&&(_=r.parse(l["max-fraction-digits"],1,_e),!_)?null:new Ca(s,u,d,f,_)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class Rs{constructor(t){this.type=fr,this.sections=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let s=t[1];if(!Array.isArray(s)&&typeof s=="object")return r.error("First argument must be an image or text section.");let l=[],u=!1;for(let d=1;d<=t.length-1;++d){let f=t[d];if(u&&typeof f=="object"&&!Array.isArray(f)){u=!1;let _=null;if(f["font-scale"]&&(_=r.parse(f["font-scale"],1,_e),!_))return null;let x=null;if(f["text-font"]&&(x=r.parse(f["text-font"],1,A($e)),!x))return null;let v=null;if(f["text-color"]&&(v=r.parse(f["text-color"],1,ti),!v))return null;let w=l[l.length-1];w.scale=_,w.font=x,w.textColor=v}else{let _=r.parse(t[d],1,Ne);if(!_)return null;let x=_.type.kind;if(x!=="string"&&x!=="value"&&x!=="null"&&x!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");u=!0,l.push({content:_,scale:null,font:null,textColor:null})}}return new Rs(l)}evaluate(t){return new di(this.sections.map(r=>{let s=r.content.evaluate(t);return At(s)===ir?new Sa("",s,null,null,null):new Sa(Qn(s),null,r.scale?r.scale.evaluate(t):null,r.font?r.font.evaluate(t).join(","):null,r.textColor?r.textColor.evaluate(t):null)}))}eachChild(t){for(let r of this.sections)t(r.content),r.scale&&t(r.scale),r.font&&t(r.font),r.textColor&&t(r.textColor)}outputDefined(){return!1}}class ka{constructor(t){this.type=ir,this.input=t}static parse(t,r){if(t.length!==2)return r.error("Expected two arguments.");let s=r.parse(t[1],1,$e);return s?new ka(s):r.error("No image name provided.")}evaluate(t){let r=this.input.evaluate(t),s=fi.fromString(r);return s&&t.availableImages&&(s.available=t.availableImages.indexOf(r)>-1),s}eachChild(t){t(this.input)}outputDefined(){return!1}}class za{constructor(t){this.type=_e,this.input=t}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);let s=r.parse(t[1],1);return s?s.type.kind!=="array"&&s.type.kind!=="string"&&s.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${P(s.type)} instead.`):new za(s):null}evaluate(t){let r=this.input.evaluate(t);if(typeof r=="string")return[...r].length;if(Array.isArray(r))return r.length;throw new St(`Expected value to be of type string or array, but found ${P(At(r))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}let rr=8192;function Ul(i,t){let r=(180+i[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,l=Math.pow(2,t.z);return[Math.round(r*l*rr),Math.round(s*l*rr)]}function Ea(i,t){let r=Math.pow(2,t.z);return[(l=(i[0]/rr+t.x)/r,360*l-180),(s=(i[1]/rr+t.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90)];var s,l}function Zr(i,t){i[0]=Math.min(i[0],t[0]),i[1]=Math.min(i[1],t[1]),i[2]=Math.max(i[2],t[0]),i[3]=Math.max(i[3],t[1])}function Cr(i,t){return!(i[0]<=t[0]||i[2]>=t[2]||i[1]<=t[1]||i[3]>=t[3])}function it(i,t,r){let s=i[0]-t[0],l=i[1]-t[1],u=i[0]-r[0],d=i[1]-r[1];return s*d-u*l==0&&s*u<=0&&l*d<=0}function Bs(i,t,r,s){return(l=[s[0]-r[0],s[1]-r[1]])[0]*(u=[t[0]-i[0],t[1]-i[1]])[1]-l[1]*u[0]!=0&&!(!Vo(i,t,r,s)||!Vo(r,s,i,t));var l,u}function $l(i,t,r){for(let s of r)for(let l=0;l(l=i)[1]!=(d=f[_+1])[1]>l[1]&&l[0]<(d[0]-u[0])*(l[1]-u[1])/(d[1]-u[1])+u[0]&&(s=!s)}var l,u,d;return s}function ql(i,t){for(let r of t)if(gn(i,r))return!0;return!1}function Oo(i,t){for(let r of i)if(!gn(r,t))return!1;for(let r=0;r0&&f<0||d<0&&f>0}function Da(i,t,r){let s=[];for(let l=0;lr[2]){let l=.5*s,u=i[0]-r[0]>l?-s:r[0]-i[0]>l?s:0;u===0&&(u=i[0]-r[2]>l?-s:r[2]-i[0]>l?s:0),i[0]+=u}Zr(t,i)}function Uo(i,t,r,s){let l=Math.pow(2,s.z)*rr,u=[s.x*rr,s.y*rr],d=[];for(let f of i)for(let _ of f){let x=[_.x+u[0],_.y+u[1]];jo(x,t,r,l),d.push(x)}return d}function $o(i,t,r,s){let l=Math.pow(2,s.z)*rr,u=[s.x*rr,s.y*rr],d=[];for(let _ of i){let x=[];for(let v of _){let w=[v.x+u[0],v.y+u[1]];Zr(t,w),x.push(w)}d.push(x)}if(t[2]-t[0]<=l/2){(f=t)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(let _ of d)for(let x of _)jo(x,t,r,l)}var f;return d}class Gr{constructor(t,r){this.type=Be,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Ur(t[1])){let s=t[1];if(s.type==="FeatureCollection"){let l=[];for(let u of s.features){let{type:d,coordinates:f}=u.geometry;d==="Polygon"&&l.push(f),d==="MultiPolygon"&&l.push(...f)}if(l.length)return new Gr(s,{type:"MultiPolygon",coordinates:l})}else if(s.type==="Feature"){let l=s.geometry.type;if(l==="Polygon"||l==="MultiPolygon")return new Gr(s,s.geometry)}else if(s.type==="Polygon"||s.type==="MultiPolygon")return new Gr(s,s)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(r,s){let l=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(s.type==="Polygon"){let f=Da(s.coordinates,u,d),_=Uo(r.geometry(),l,u,d);if(!Cr(l,u))return!1;for(let x of _)if(!gn(x,f))return!1}if(s.type==="MultiPolygon"){let f=No(s.coordinates,u,d),_=Uo(r.geometry(),l,u,d);if(!Cr(l,u))return!1;for(let x of _)if(!ql(x,f))return!1}return!0}(t,this.geometries);if(t.geometryType()==="LineString")return function(r,s){let l=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],d=r.canonicalID();if(s.type==="Polygon"){let f=Da(s.coordinates,u,d),_=$o(r.geometry(),l,u,d);if(!Cr(l,u))return!1;for(let x of _)if(!Oo(x,f))return!1}if(s.type==="MultiPolygon"){let f=No(s.coordinates,u,d),_=$o(r.geometry(),l,u,d);if(!Cr(l,u))return!1;for(let x of _)if(!Zl(x,f))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let qo=class{constructor(i=[],t=(r,s)=>rs?1:0){if(this.data=i,this.length=this.data.length,this.compare=t,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(i){this.data.push(i),this._up(this.length++)}pop(){if(this.length===0)return;let i=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),i}peek(){return this.data[0]}_up(i){let{data:t,compare:r}=this,s=t[i];for(;i>0;){let l=i-1>>1,u=t[l];if(r(s,u)>=0)break;t[i]=u,i=l}t[i]=s}_down(i){let{data:t,compare:r}=this,s=this.length>>1,l=t[i];for(;i=0)break;t[i]=t[u],i=u}t[i]=l}};function Gl(i,t,r,s,l){Zo(i,t,r,s||i.length-1,l||Hl)}function Zo(i,t,r,s,l){for(;s>r;){if(s-r>600){var u=s-r+1,d=t-r+1,f=Math.log(u),_=.5*Math.exp(2*f/3),x=.5*Math.sqrt(f*_*(u-_)/u)*(d-u/2<0?-1:1);Zo(i,t,Math.max(r,Math.floor(t-d*_/u+x)),Math.min(s,Math.floor(t+(u-d)*_/u+x)),l)}var v=i[t],w=r,I=s;for(rs(i,r,t),l(i[s],v)>0&&rs(i,r,s);w0;)I--}l(i[r],v)===0?rs(i,r,I):rs(i,++I,s),I<=t&&(r=I+1),t<=I&&(s=I-1)}}function rs(i,t,r){var s=i[t];i[t]=i[r],i[r]=s}function Hl(i,t){return it?1:0}function Fs(i,t){if(i.length<=1)return[i];let r=[],s,l;for(let u of i){let d=Wl(u);d!==0&&(u.area=Math.abs(d),l===void 0&&(l=d<0),l===d<0?(s&&r.push(s),s=[u]):s.push(u))}if(s&&r.push(s),t>1)for(let u=0;u1?(x=t[_+1][0],v=t[_+1][1]):M>0&&(x+=w/this.kx*M,v+=I/this.ky*M)),w=this.wrap(r[0]-x)*this.kx,I=(r[1]-v)*this.ky;let k=w*w+I*I;k180;)t-=360;return t}}function Wo(i,t){return t[0]-i[0]}function Os(i){return i[1]-i[0]+1}function mr(i,t){return i[1]>=i[0]&&i[1]i[1])return[null,null];let r=Os(i);if(t){if(r===2)return[i,null];let l=Math.floor(r/2);return[[i[0],i[0]+l],[i[0]+l,i[1]]]}if(r===1)return[i,null];let s=Math.floor(r/2)-1;return[[i[0],i[0]+s],[i[0]+s+1,i[1]]]}function Ba(i,t){if(!mr(t,i.length))return[1/0,1/0,-1/0,-1/0];let r=[1/0,1/0,-1/0,-1/0];for(let s=t[0];s<=t[1];++s)Zr(r,i[s]);return r}function Fa(i){let t=[1/0,1/0,-1/0,-1/0];for(let r of i)for(let s of r)Zr(t,s);return t}function Vs(i){return i[0]!==-1/0&&i[1]!==-1/0&&i[2]!==1/0&&i[3]!==1/0}function Oa(i,t,r){if(!Vs(i)||!Vs(t))return NaN;let s=0,l=0;return i[2]t[2]&&(s=i[0]-t[2]),i[1]>t[3]&&(l=i[1]-t[3]),i[3]=s)return s;if(Cr(l,u)){if(Ns(i,t))return 0}else if(Ns(t,i))return 0;let d=1/0;for(let f of i)for(let _=0,x=f.length,v=x-1;_0;){let _=d.pop();if(_[0]>=u)continue;let x=_[1],v=t?50:100;if(Os(x)<=v){if(!mr(x,i.length))return NaN;if(t){let w=Ze(i,x,r,s);if(isNaN(w)||w===0)return w;u=Math.min(u,w)}else for(let w=x[0];w<=x[1];++w){let I=Jl(i[w],r,s);if(u=Math.min(u,I),u===0)return 0}}else{let w=Ra(x,t);at(d,u,s,i,f,w[0]),at(d,u,s,i,f,w[1])}}return u}function ss(i,t,r,s,l,u=1/0){let d=Math.min(u,l.distance(i[0],r[0]));if(d===0)return d;let f=new qo([[0,[0,i.length-1],[0,r.length-1]]],Wo);for(;f.length>0;){let _=f.pop();if(_[0]>=d)continue;let x=_[1],v=_[2],w=t?50:100,I=s?50:100;if(Os(x)<=w&&Os(v)<=I){if(!mr(x,i.length)&&mr(v,r.length))return NaN;let M;if(t&&s)M=Kl(i,x,r,v,l),d=Math.min(d,M);else if(t&&!s){let k=i.slice(x[0],x[1]+1);for(let z=v[0];z<=v[1];++z)if(M=Hr(r[z],k,l),d=Math.min(d,M),d===0)return d}else if(!t&&s){let k=r.slice(v[0],v[1]+1);for(let z=x[0];z<=x[1];++z)if(M=Hr(i[z],k,l),d=Math.min(d,M),d===0)return d}else M=bt(i,x,r,v,l),d=Math.min(d,M)}else{let M=Ra(x,t),k=Ra(v,s);Xr(f,d,l,i,r,M[0],k[0]),Xr(f,d,l,i,r,M[0],k[1]),Xr(f,d,l,i,r,M[1],k[0]),Xr(f,d,l,i,r,M[1],k[1])}}return d}function Na(i){return i.type==="MultiPolygon"?i.coordinates.map(t=>({type:"Polygon",coordinates:t})):i.type==="MultiLineString"?i.coordinates.map(t=>({type:"LineString",coordinates:t})):i.type==="MultiPoint"?i.coordinates.map(t=>({type:"Point",coordinates:t})):[i]}class Wr{constructor(t,r){this.type=_e,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Ur(t[1])){let s=t[1];if(s.type==="FeatureCollection")return new Wr(s,s.features.map(l=>Na(l.geometry)).flat());if(s.type==="Feature")return new Wr(s,Na(s.geometry));if("type"in s&&"coordinates"in s)return new Wr(s,Na(s))}return r.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(r,s){let l=r.geometry(),u=l.flat().map(_=>Ea([_.x,_.y],r.canonical));if(l.length===0)return NaN;let d=new La(u[0][1]),f=1/0;for(let _ of s){switch(_.type){case"Point":f=Math.min(f,ss(u,!1,[_.coordinates],!1,d,f));break;case"LineString":f=Math.min(f,ss(u,!1,_.coordinates,!0,d,f));break;case"Polygon":f=Math.min(f,ns(u,!1,_.coordinates,d,f))}if(f===0)return f}return f}(t,this.geometries);if(t.geometryType()==="LineString")return function(r,s){let l=r.geometry(),u=l.flat().map(_=>Ea([_.x,_.y],r.canonical));if(l.length===0)return NaN;let d=new La(u[0][1]),f=1/0;for(let _ of s){switch(_.type){case"Point":f=Math.min(f,ss(u,!0,[_.coordinates],!1,d,f));break;case"LineString":f=Math.min(f,ss(u,!0,_.coordinates,!0,d,f));break;case"Polygon":f=Math.min(f,ns(u,!0,_.coordinates,d,f))}if(f===0)return f}return f}(t,this.geometries);if(t.geometryType()==="Polygon")return function(r,s){let l=r.geometry();if(l.length===0||l[0].length===0)return NaN;let u=Fs(l,0).map(_=>_.map(x=>x.map(v=>Ea([v.x,v.y],r.canonical)))),d=new La(u[0][0][0][1]),f=1/0;for(let _ of s)for(let x of u){switch(_.type){case"Point":f=Math.min(f,ns([_.coordinates],!1,x,d,f));break;case"LineString":f=Math.min(f,ns(_.coordinates,!0,x,d,f));break;case"Polygon":f=Math.min(f,ht(x,_.coordinates,d,f))}if(f===0)return f}return f}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}let yn={"==":Vl,"!=":Ro,">":Nl,"<":Bo,">=":Fo,"<=":jl,array:Bi,at:Pa,boolean:Bi,case:ks,coalesce:Ds,collator:is,format:Rs,image:ka,in:Aa,"index-of":fn,interpolate:ri,"interpolate-hcl":ri,"interpolate-lab":ri,length:za,let:Mr,literal:Ri,match:Ma,number:Bi,"number-format":Ca,object:Bi,slice:es,step:mn,string:Bi,"to-boolean":Fi,"to-color":Fi,"to-number":Fi,"to-string":Fi,var:tt,within:Gr,distance:Wr};class Ti{constructor(t,r,s,l){this.name=t,this.type=r,this._evaluate=s,this.args=l}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,r){let s=t[0],l=Ti.definitions[s];if(!l)return r.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0);let u=Array.isArray(l)?l[0]:l.type,d=Array.isArray(l)?[[l[1],l[2]]]:l.overloads,f=d.filter(([x])=>!Array.isArray(x)||x.length===t.length-1),_=null;for(let[x,v]of f){_=new $r(r.registry,as,r.path,null,r.scope);let w=[],I=!1;for(let M=1;M{return I=w,Array.isArray(I)?`(${I.map(P).join(", ")})`:`(${P(I.type)}...)`;var I}).join(" | "),v=[];for(let w=1;w{r=t?r&&as(s):r&&s instanceof Ri}),!!r&&os(i)&&ls(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function os(i){if(i instanceof Ti&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||/^filter-/.test(i.name))||i instanceof Gr||i instanceof Wr)return!1;let t=!0;return i.eachChild(r=>{t&&!os(r)&&(t=!1)}),t}function xn(i){if(i instanceof Ti&&i.name==="feature-state")return!1;let t=!0;return i.eachChild(r=>{t&&!xn(r)&&(t=!1)}),t}function ls(i,t){if(i instanceof Ti&&t.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(s=>{r&&!ls(s,t)&&(r=!1)}),r}function js(i){return{result:"success",value:i}}function vn(i){return{result:"error",value:i}}function bn(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function Ko(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function qa(i){return!!i.expression&&i.expression.interpolated}function Ye(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function Us(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Yl(i){return i}function Jo(i,t){let r=t.type==="color",s=i.stops&&typeof i.stops[0][0]=="object",l=s||!(s||i.property!==void 0),u=i.type||(qa(t)?"exponential":"interval");if(r||t.type==="padding"){let v=r?nt.parse:pi.parse;(i=Qi({},i)).stops&&(i.stops=i.stops.map(w=>[w[0],v(w[1])])),i.default=v(i.default?i.default:t.default)}if(i.colorSpace&&(d=i.colorSpace)!=="rgb"&&d!=="hcl"&&d!=="lab")throw new Error(`Unknown color space: "${i.colorSpace}"`);var d;let f,_,x;if(u==="exponential")f=Qo;else if(u==="interval")f=$s;else if(u==="categorical"){f=Yo,_=Object.create(null);for(let v of i.stops)_[v[0]]=v[1];x=typeof i.stops[0][0]}else{if(u!=="identity")throw new Error(`Unknown function type "${u}"`);f=el}if(s){let v={},w=[];for(let k=0;kk[0]),evaluate:({zoom:k},z)=>Qo({stops:I,base:i.base},t,k).evaluate(k,z)}}if(l){let v=u==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:v,interpolationFactor:ri.interpolationFactor.bind(void 0,v),zoomStops:i.stops.map(w=>w[0]),evaluate:({zoom:w})=>f(i,t,w,_,x)}}return{kind:"source",evaluate(v,w){let I=w&&w.properties?w.properties[i.property]:void 0;return I===void 0?wn(i.default,t.default):f(i,t,I,_,x)}}}function wn(i,t,r){return i!==void 0?i:t!==void 0?t:r!==void 0?r:void 0}function Yo(i,t,r,s,l){return wn(typeof r===l?s[r]:void 0,i.default,t.default)}function $s(i,t,r){if(Ye(r)!=="number")return wn(i.default,t.default);let s=i.stops.length;if(s===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[s-1][0])return i.stops[s-1][1];let l=zs(i.stops.map(u=>u[0]),r);return i.stops[l][1]}function Qo(i,t,r){let s=i.base!==void 0?i.base:1;if(Ye(r)!=="number")return wn(i.default,t.default);let l=i.stops.length;if(l===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[l-1][0])return i.stops[l-1][1];let u=zs(i.stops.map(v=>v[0]),r),d=function(v,w,I,M){let k=M-I,z=v-I;return k===0?0:w===1?z/k:(Math.pow(w,z)-1)/(Math.pow(w,k)-1)}(r,s,i.stops[u][0],i.stops[u+1][0]),f=i.stops[u][1],_=i.stops[u+1][1],x=ii[t.type]||Yl;return typeof f.evaluate=="function"?{evaluate(...v){let w=f.evaluate.apply(void 0,v),I=_.evaluate.apply(void 0,v);if(w!==void 0&&I!==void 0)return x(w,I,d,i.colorSpace)}}:x(f,_,d,i.colorSpace)}function el(i,t,r){switch(t.type){case"color":r=nt.parse(r);break;case"formatted":r=di.fromString(r.toString());break;case"resolvedImage":r=fi.fromString(r.toString());break;case"padding":r=pi.parse(r);break;default:Ye(r)===t.type||t.type==="enum"&&t.values[r]||(r=void 0)}return wn(r,i.default,t.default)}Ti.register(yn,{error:[{kind:"error"},[$e],(i,[t])=>{throw new St(t.evaluate(i))}],typeof:[$e,[Ne],(i,[t])=>P(At(t.evaluate(i)))],"to-rgba":[A(_e,4),[ti],(i,[t])=>{let[r,s,l,u]=t.evaluate(i).rgb;return[255*r,255*s,255*l,u]}],rgb:[ti,[_e,_e,_e],ja],rgba:[ti,[_e,_e,_e,_e],ja],has:{type:Be,overloads:[[[$e],(i,[t])=>Ua(t.evaluate(i),i.properties())],[[$e,Li],(i,[t,r])=>Ua(t.evaluate(i),r.evaluate(i))]]},get:{type:Ne,overloads:[[[$e],(i,[t])=>$a(t.evaluate(i),i.properties())],[[$e,Li],(i,[t,r])=>$a(t.evaluate(i),r.evaluate(i))]]},"feature-state":[Ne,[$e],(i,[t])=>$a(t.evaluate(i),i.featureState||{})],properties:[Li,[],i=>i.properties()],"geometry-type":[$e,[],i=>i.geometryType()],id:[Ne,[],i=>i.id()],zoom:[_e,[],i=>i.globals.zoom],"heatmap-density":[_e,[],i=>i.globals.heatmapDensity||0],"line-progress":[_e,[],i=>i.globals.lineProgress||0],accumulated:[Ne,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[_e,Kr(_e),(i,t)=>{let r=0;for(let s of t)r+=s.evaluate(i);return r}],"*":[_e,Kr(_e),(i,t)=>{let r=1;for(let s of t)r*=s.evaluate(i);return r}],"-":{type:_e,overloads:[[[_e,_e],(i,[t,r])=>t.evaluate(i)-r.evaluate(i)],[[_e],(i,[t])=>-t.evaluate(i)]]},"/":[_e,[_e,_e],(i,[t,r])=>t.evaluate(i)/r.evaluate(i)],"%":[_e,[_e,_e],(i,[t,r])=>t.evaluate(i)%r.evaluate(i)],ln2:[_e,[],()=>Math.LN2],pi:[_e,[],()=>Math.PI],e:[_e,[],()=>Math.E],"^":[_e,[_e,_e],(i,[t,r])=>Math.pow(t.evaluate(i),r.evaluate(i))],sqrt:[_e,[_e],(i,[t])=>Math.sqrt(t.evaluate(i))],log10:[_e,[_e],(i,[t])=>Math.log(t.evaluate(i))/Math.LN10],ln:[_e,[_e],(i,[t])=>Math.log(t.evaluate(i))],log2:[_e,[_e],(i,[t])=>Math.log(t.evaluate(i))/Math.LN2],sin:[_e,[_e],(i,[t])=>Math.sin(t.evaluate(i))],cos:[_e,[_e],(i,[t])=>Math.cos(t.evaluate(i))],tan:[_e,[_e],(i,[t])=>Math.tan(t.evaluate(i))],asin:[_e,[_e],(i,[t])=>Math.asin(t.evaluate(i))],acos:[_e,[_e],(i,[t])=>Math.acos(t.evaluate(i))],atan:[_e,[_e],(i,[t])=>Math.atan(t.evaluate(i))],min:[_e,Kr(_e),(i,t)=>Math.min(...t.map(r=>r.evaluate(i)))],max:[_e,Kr(_e),(i,t)=>Math.max(...t.map(r=>r.evaluate(i)))],abs:[_e,[_e],(i,[t])=>Math.abs(t.evaluate(i))],round:[_e,[_e],(i,[t])=>{let r=t.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[_e,[_e],(i,[t])=>Math.floor(t.evaluate(i))],ceil:[_e,[_e],(i,[t])=>Math.ceil(t.evaluate(i))],"filter-==":[Be,[$e,Ne],(i,[t,r])=>i.properties()[t.value]===r.value],"filter-id-==":[Be,[Ne],(i,[t])=>i.id()===t.value],"filter-type-==":[Be,[$e],(i,[t])=>i.geometryType()===t.value],"filter-<":[Be,[$e,Ne],(i,[t,r])=>{let s=i.properties()[t.value],l=r.value;return typeof s==typeof l&&s{let r=i.id(),s=t.value;return typeof r==typeof s&&r":[Be,[$e,Ne],(i,[t,r])=>{let s=i.properties()[t.value],l=r.value;return typeof s==typeof l&&s>l}],"filter-id->":[Be,[Ne],(i,[t])=>{let r=i.id(),s=t.value;return typeof r==typeof s&&r>s}],"filter-<=":[Be,[$e,Ne],(i,[t,r])=>{let s=i.properties()[t.value],l=r.value;return typeof s==typeof l&&s<=l}],"filter-id-<=":[Be,[Ne],(i,[t])=>{let r=i.id(),s=t.value;return typeof r==typeof s&&r<=s}],"filter->=":[Be,[$e,Ne],(i,[t,r])=>{let s=i.properties()[t.value],l=r.value;return typeof s==typeof l&&s>=l}],"filter-id->=":[Be,[Ne],(i,[t])=>{let r=i.id(),s=t.value;return typeof r==typeof s&&r>=s}],"filter-has":[Be,[Ne],(i,[t])=>t.value in i.properties()],"filter-has-id":[Be,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[Be,[A($e)],(i,[t])=>t.value.indexOf(i.geometryType())>=0],"filter-id-in":[Be,[A(Ne)],(i,[t])=>t.value.indexOf(i.id())>=0],"filter-in-small":[Be,[$e,A(Ne)],(i,[t,r])=>r.value.indexOf(i.properties()[t.value])>=0],"filter-in-large":[Be,[$e,A(Ne)],(i,[t,r])=>function(s,l,u,d){for(;u<=d;){let f=u+d>>1;if(l[f]===s)return!0;l[f]>s?d=f-1:u=f+1}return!1}(i.properties()[t.value],r.value,0,r.value.length-1)],all:{type:Be,overloads:[[[Be,Be],(i,[t,r])=>t.evaluate(i)&&r.evaluate(i)],[Kr(Be),(i,t)=>{for(let r of t)if(!r.evaluate(i))return!1;return!0}]]},any:{type:Be,overloads:[[[Be,Be],(i,[t,r])=>t.evaluate(i)||r.evaluate(i)],[Kr(Be),(i,t)=>{for(let r of t)if(r.evaluate(i))return!0;return!1}]]},"!":[Be,[Be],(i,[t])=>!t.evaluate(i)],"is-supported-script":[Be,[$e],(i,[t])=>{let r=i.globals&&i.globals.isSupportedScript;return!r||r(t.evaluate(i))}],upcase:[$e,[$e],(i,[t])=>t.evaluate(i).toUpperCase()],downcase:[$e,[$e],(i,[t])=>t.evaluate(i).toLowerCase()],concat:[$e,Kr(Ne),(i,t)=>t.map(r=>Qn(r.evaluate(i))).join("")],"resolved-locale":[$e,[tr],(i,[t])=>t.evaluate(i).resolvedLocale()]});class qs{constructor(t,r){var s;this.expression=t,this._warningHistory={},this._evaluator=new Cs,this._defaultValue=r?(s=r).type==="color"&&Us(s.default)?new nt(0,0,0,0):s.type==="color"?nt.parse(s.default)||null:s.type==="padding"?pi.parse(s.default)||null:s.type==="variableAnchorOffsetCollection"?wi.parse(s.default)||null:s.default===void 0?null:s.default:null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(t,r,s,l,u,d){return this._evaluator.globals=t,this._evaluator.feature=r,this._evaluator.featureState=s,this._evaluator.canonical=l,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=d,this.expression.evaluate(this._evaluator)}evaluate(t,r,s,l,u,d){this._evaluator.globals=t,this._evaluator.feature=r||null,this._evaluator.featureState=s||null,this._evaluator.canonical=l,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=d||null;try{let f=this.expression.evaluate(this._evaluator);if(f==null||typeof f=="number"&&f!=f)return this._defaultValue;if(this._enumValues&&!(f in this._enumValues))throw new St(`Expected value to be one of ${Object.keys(this._enumValues).map(_=>JSON.stringify(_)).join(", ")}, but found ${JSON.stringify(f)} instead.`);return f}catch(f){return this._warningHistory[f.message]||(this._warningHistory[f.message]=!0,typeof console<"u"&&console.warn(f.message)),this._defaultValue}}}function Zs(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in yn}function Tn(i,t){let r=new $r(yn,as,[],t?function(l){let u={color:ti,string:$e,number:_e,enum:$e,boolean:Be,formatted:fr,padding:Ar,resolvedImage:ir,variableAnchorOffsetCollection:N};return l.type==="array"?A(u[l.value]||Ne,l.length):u[l.type]}(t):void 0),s=r.parse(i,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?js(new qs(s,t)):vn(r.errors)}class Sn{constructor(t,r){this.kind=t,this._styleExpression=r,this.isStateDependent=t!=="constant"&&!xn(r.expression)}evaluateWithoutErrorHandling(t,r,s,l,u,d){return this._styleExpression.evaluateWithoutErrorHandling(t,r,s,l,u,d)}evaluate(t,r,s,l,u,d){return this._styleExpression.evaluate(t,r,s,l,u,d)}}class In{constructor(t,r,s,l){this.kind=t,this.zoomStops=s,this._styleExpression=r,this.isStateDependent=t!=="camera"&&!xn(r.expression),this.interpolationType=l}evaluateWithoutErrorHandling(t,r,s,l,u,d){return this._styleExpression.evaluateWithoutErrorHandling(t,r,s,l,u,d)}evaluate(t,r,s,l,u,d){return this._styleExpression.evaluate(t,r,s,l,u,d)}interpolationFactor(t,r,s){return this.interpolationType?ri.interpolationFactor(this.interpolationType,t,r,s):0}}function Za(i,t){let r=Tn(i,t);if(r.result==="error")return r;let s=r.value.expression,l=os(s);if(!l&&!bn(t))return vn([new Xt("","data expressions not supported")]);let u=ls(s,["zoom"]);if(!u&&!Ko(t))return vn([new Xt("","zoom expressions not supported")]);let d=cs(s);return d||u?d instanceof Xt?vn([d]):d instanceof ri&&!qa(t)?vn([new Xt("",'"interpolate" expressions cannot be used with this property')]):js(d?new In(l?"camera":"composite",r.value,d.labels,d instanceof ri?d.interpolation:void 0):new Sn(l?"constant":"source",r.value)):vn([new Xt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Pn{constructor(t,r){this._parameters=t,this._specification=r,Qi(this,Jo(this._parameters,this._specification))}static deserialize(t){return new Pn(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function cs(i){let t=null;if(i instanceof Mr)t=cs(i.result);else if(i instanceof Ds){for(let r of i.args)if(t=cs(r),t)break}else(i instanceof mn||i instanceof ri)&&i.input instanceof Ti&&i.input.name==="zoom"&&(t=i);return t instanceof Xt||i.eachChild(r=>{let s=cs(r);s instanceof Xt?t=s:!t&&s?t=new Xt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&s&&t!==s&&(t=new Xt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function Gs(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(let t of i.slice(1))if(!Gs(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}let Hs={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Ga(i){if(i==null)return{filter:()=>!0,needGeometry:!1};Gs(i)||(i=Xs(i));let t=Tn(i,Hs);if(t.result==="error")throw new Error(t.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,s,l)=>t.value.evaluate(r,s,{},l),needGeometry:tl(i)}}function Ql(i,t){return it?1:0}function tl(i){if(!Array.isArray(i))return!1;if(i[0]==="within"||i[0]==="distance")return!0;for(let t=1;t"||t==="<="||t===">="?Ha(i[1],i[2],t):t==="any"?(r=i.slice(1),["any"].concat(r.map(Xs))):t==="all"?["all"].concat(i.slice(1).map(Xs)):t==="none"?["all"].concat(i.slice(1).map(Xs).map(Ot)):t==="in"?hs(i[1],i.slice(2)):t==="!in"?Ot(hs(i[1],i.slice(2))):t==="has"?us(i[1]):t!=="!has"||Ot(us(i[1]));var r}function Ha(i,t,r){switch(i){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,i,t]}}function hs(i,t){if(t.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(r=>typeof r!=typeof t[0])?["filter-in-large",i,["literal",t.sort(Ql)]]:["filter-in-small",i,["literal",t]]}}function us(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Ot(i){return["!",i]}function Jr(i){let t=typeof i;if(t==="number"||t==="boolean"||t==="string"||i==null)return JSON.stringify(i);if(Array.isArray(i)){let l="[";for(let u of i)l+=`${Jr(u)},`;return`${l}]`}let r=Object.keys(i).sort(),s="{";for(let l=0;ls.maximum?[new ue(t,r,`${r} is greater than the maximum value ${s.maximum}`)]:[]}function Ws(i){let t=i.valueSpec,r=wt(i.value.type),s,l,u,d={},f=r!=="categorical"&&i.value.property===void 0,_=!f,x=Ye(i.value.stops)==="array"&&Ye(i.value.stops[0])==="array"&&Ye(i.value.stops[0][0])==="object",v=mi({key:i.key,value:i.value,valueSpec:i.styleSpec.function,validateSpec:i.validateSpec,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(M){if(r==="identity")return[new ue(M.key,M.value,'identity function may not have a "stops" property')];let k=[],z=M.value;return k=k.concat(ds({key:M.key,value:z,valueSpec:M.valueSpec,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec,arrayElementValidator:w})),Ye(z)==="array"&&z.length===0&&k.push(new ue(M.key,z,"array must have at least one stop")),k},default:function(M){return M.validateSpec({key:M.key,value:M.value,valueSpec:t,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec})}}});return r==="identity"&&f&&v.push(new ue(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||v.push(new ue(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!qa(i.valueSpec)&&v.push(new ue(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(_&&!bn(i.valueSpec)?v.push(new ue(i.key,i.value,"property functions not supported")):f&&!Ko(i.valueSpec)&&v.push(new ue(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!x||i.value.property!==void 0||v.push(new ue(i.key,i.value,'"property" property is required')),v;function w(M){let k=[],z=M.value,F=M.key;if(Ye(z)!=="array")return[new ue(F,z,`array expected, ${Ye(z)} found`)];if(z.length!==2)return[new ue(F,z,`array length 2 expected, length ${z.length} found`)];if(x){if(Ye(z[0])!=="object")return[new ue(F,z,`object expected, ${Ye(z[0])} found`)];if(z[0].zoom===void 0)return[new ue(F,z,"object stop key must have zoom")];if(z[0].value===void 0)return[new ue(F,z,"object stop key must have value")];if(u&&u>wt(z[0].zoom))return[new ue(F,z[0].zoom,"stop zoom values must appear in ascending order")];wt(z[0].zoom)!==u&&(u=wt(z[0].zoom),l=void 0,d={}),k=k.concat(mi({key:`${F}[0]`,value:z[0],valueSpec:{zoom:{}},validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec,objectElementValidators:{zoom:Xa,value:I}}))}else k=k.concat(I({key:`${F}[0]`,value:z[0],valueSpec:{},validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec},z));return Zs(Oi(z[1]))?k.concat([new ue(`${F}[1]`,z[1],"expressions are not allowed in function stops.")]):k.concat(M.validateSpec({key:`${F}[1]`,value:z[1],valueSpec:t,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec}))}function I(M,k){let z=Ye(M.value),F=wt(M.value),j=M.value!==null?M.value:k;if(s){if(z!==s)return[new ue(M.key,j,`${z} stop domain type must match previous stop domain type ${s}`)]}else s=z;if(z!=="number"&&z!=="string"&&z!=="boolean")return[new ue(M.key,j,"stop domain value must be a number, string, or boolean")];if(z!=="number"&&r!=="categorical"){let Q=`number expected, ${z} found`;return bn(t)&&r===void 0&&(Q+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new ue(M.key,j,Q)]}return r!=="categorical"||z!=="number"||isFinite(F)&&Math.floor(F)===F?r!=="categorical"&&z==="number"&&l!==void 0&&Fnew ue(`${i.key}${s.key}`,i.value,s.message));let r=t.value.expression||t.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new ue(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!xn(r))return[new ue(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!xn(r))return[new ue(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!ls(r,["zoom","feature-state"]))return[new ue(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!os(r))return[new ue(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function _r(i){let t=i.key,r=i.value,s=i.valueSpec,l=[];return Array.isArray(s.values)?s.values.indexOf(wt(r))===-1&&l.push(new ue(t,r,`expected one of [${s.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(s.values).indexOf(wt(r))===-1&&l.push(new ue(t,r,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(r)} found`)),l}function Wa(i){return Gs(Oi(i.value))?An(Qi({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Ks(i)}function Ks(i){let t=i.value,r=i.key;if(Ye(t)!=="array")return[new ue(r,t,`array expected, ${Ye(t)} found`)];let s=i.styleSpec,l,u=[];if(t.length<1)return[new ue(r,t,"filter array must have at least 1 element")];switch(u=u.concat(_r({key:`${r}[0]`,value:t[0],valueSpec:s.filter_operator,style:i.style,styleSpec:i.styleSpec})),wt(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&wt(t[1])==="$type"&&u.push(new ue(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&u.push(new ue(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(l=Ye(t[1]),l!=="string"&&u.push(new ue(`${r}[1]`,t[1],`string expected, ${l} found`)));for(let d=2;d{x in r&&t.push(new ue(s,r[x],`"${x}" is prohibited for ref layers`))}),l.layers.forEach(x=>{wt(x.id)===f&&(_=x)}),_?_.ref?t.push(new ue(s,r.ref,"ref cannot reference another ref layer")):d=wt(_.type):t.push(new ue(s,r.ref,`ref layer "${f}" not found`))}else if(d!=="background")if(r.source){let _=l.sources&&l.sources[r.source],x=_&&wt(_.type);_?x==="vector"&&d==="raster"?t.push(new ue(s,r.source,`layer "${r.id}" requires a raster source`)):x!=="raster-dem"&&d==="hillshade"?t.push(new ue(s,r.source,`layer "${r.id}" requires a raster-dem source`)):x==="raster"&&d!=="raster"?t.push(new ue(s,r.source,`layer "${r.id}" requires a vector source`)):x!=="vector"||r["source-layer"]?x==="raster-dem"&&d!=="hillshade"?t.push(new ue(s,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):d!=="line"||!r.paint||!r.paint["line-gradient"]||x==="geojson"&&_.lineMetrics||t.push(new ue(s,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new ue(s,r,`layer "${r.id}" must specify a "source-layer"`)):t.push(new ue(s,r.source,`source "${r.source}" not found`))}else t.push(new ue(s,r,'missing required property "source"'));return t=t.concat(mi({key:s,value:r,valueSpec:u.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${s}.type`,value:r.type,valueSpec:u.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:r,objectKey:"type"}),filter:Wa,layout:_=>mi({layer:r,key:_.key,value:_.value,style:_.style,styleSpec:_.styleSpec,validateSpec:_.validateSpec,objectElementValidators:{"*":x=>Ja(Qi({layerType:d},x))}}),paint:_=>mi({layer:r,key:_.key,value:_.value,style:_.style,styleSpec:_.styleSpec,validateSpec:_.validateSpec,objectElementValidators:{"*":x=>Js(Qi({layerType:d},x))}})}})),t}function Yr(i){let t=i.value,r=i.key,s=Ye(t);return s!=="string"?[new ue(r,t,`string expected, ${s} found`)]:[]}let Ys={promoteId:function({key:i,value:t}){if(Ye(t)==="string")return Yr({key:i,value:t});{let r=[];for(let s in t)r.push(...Yr({key:`${i}.${s}`,value:t[s]}));return r}}};function ps(i){let t=i.value,r=i.key,s=i.styleSpec,l=i.style,u=i.validateSpec;if(!t.type)return[new ue(r,t,'"type" is required')];let d=wt(t.type),f;switch(d){case"vector":case"raster":return f=mi({key:r,value:t,valueSpec:s[`source_${d.replace("-","_")}`],style:i.style,styleSpec:s,objectElementValidators:Ys,validateSpec:u}),f;case"raster-dem":return f=function(_){var x;let v=(x=_.sourceName)!==null&&x!==void 0?x:"",w=_.value,I=_.styleSpec,M=I.source_raster_dem,k=_.style,z=[],F=Ye(w);if(w===void 0)return z;if(F!=="object")return z.push(new ue("source_raster_dem",w,`object expected, ${F} found`)),z;let j=wt(w.encoding)==="custom",Q=["redFactor","greenFactor","blueFactor","baseShift"],G=_.value.encoding?`"${_.value.encoding}"`:"Default";for(let J in w)!j&&Q.includes(J)?z.push(new ue(J,w[J],`In "${v}": "${J}" is only valid when "encoding" is set to "custom". ${G} encoding found`)):M[J]?z=z.concat(_.validateSpec({key:J,value:w[J],valueSpec:M[J],validateSpec:_.validateSpec,style:k,styleSpec:I})):z.push(new ue(J,w[J],`unknown property "${J}"`));return z}({sourceName:r,value:t,style:i.style,styleSpec:s,validateSpec:u}),f;case"geojson":if(f=mi({key:r,value:t,valueSpec:s.source_geojson,style:l,styleSpec:s,validateSpec:u,objectElementValidators:Ys}),t.cluster)for(let _ in t.clusterProperties){let[x,v]=t.clusterProperties[_],w=typeof x=="string"?[x,["accumulated"],["get",_]]:x;f.push(...An({key:`${r}.${_}.map`,value:v,validateSpec:u,expressionContext:"cluster-map"})),f.push(...An({key:`${r}.${_}.reduce`,value:w,validateSpec:u,expressionContext:"cluster-reduce"}))}return f;case"video":return mi({key:r,value:t,valueSpec:s.source_video,style:l,validateSpec:u,styleSpec:s});case"image":return mi({key:r,value:t,valueSpec:s.source_image,style:l,validateSpec:u,styleSpec:s});case"canvas":return[new ue(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return _r({key:`${r}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:l,validateSpec:u,styleSpec:s})}}function Qa(i){let t=i.value,r=i.styleSpec,s=r.light,l=i.style,u=[],d=Ye(t);if(t===void 0)return u;if(d!=="object")return u=u.concat([new ue("light",t,`object expected, ${d} found`)]),u;for(let f in t){let _=f.match(/^(.*)-transition$/);u=u.concat(_&&s[_[1]]&&s[_[1]].transition?i.validateSpec({key:f,value:t[f],valueSpec:r.transition,validateSpec:i.validateSpec,style:l,styleSpec:r}):s[f]?i.validateSpec({key:f,value:t[f],valueSpec:s[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new ue(f,t[f],`unknown property "${f}"`)])}return u}function eo(i){let t=i.value,r=i.styleSpec,s=r.sky,l=i.style,u=Ye(t);if(t===void 0)return[];if(u!=="object")return[new ue("sky",t,`object expected, ${u} found`)];let d=[];for(let f in t)d=d.concat(s[f]?i.validateSpec({key:f,value:t[f],valueSpec:s[f],style:l,styleSpec:r}):[new ue(f,t[f],`unknown property "${f}"`)]);return d}function to(i){let t=i.value,r=i.styleSpec,s=r.terrain,l=i.style,u=[],d=Ye(t);if(t===void 0)return u;if(d!=="object")return u=u.concat([new ue("terrain",t,`object expected, ${d} found`)]),u;for(let f in t)u=u.concat(s[f]?i.validateSpec({key:f,value:t[f],valueSpec:s[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new ue(f,t[f],`unknown property "${f}"`)]);return u}function io(i){let t=[],r=i.value,s=i.key;if(Array.isArray(r)){let l=[],u=[];for(let d in r)r[d].id&&l.includes(r[d].id)&&t.push(new ue(s,r,`all the sprites' ids must be unique, but ${r[d].id} is duplicated`)),l.push(r[d].id),r[d].url&&u.includes(r[d].url)&&t.push(new ue(s,r,`all the sprites' URLs must be unique, but ${r[d].url} is duplicated`)),u.push(r[d].url),t=t.concat(mi({key:`${s}[${d}]`,value:r[d],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return t}return Yr({key:s,value:r})}let Qs={"*":()=>[],array:ds,boolean:function(i){let t=i.value,r=i.key,s=Ye(t);return s!=="boolean"?[new ue(r,t,`boolean expected, ${s} found`)]:[]},number:Xa,color:function(i){let t=i.key,r=i.value,s=Ye(r);return s!=="string"?[new ue(t,r,`color expected, ${s} found`)]:nt.parse(String(r))?[]:[new ue(t,r,`color expected, "${r}" found`)]},constants:rl,enum:_r,filter:Wa,function:Ws,layer:Ya,object:mi,source:ps,light:Qa,sky:eo,terrain:to,projection:function(i){let t=i.value,r=i.styleSpec,s=r.projection,l=i.style,u=Ye(t);if(t===void 0)return[];if(u!=="object")return[new ue("projection",t,`object expected, ${u} found`)];let d=[];for(let f in t)d=d.concat(s[f]?i.validateSpec({key:f,value:t[f],valueSpec:s[f],style:l,styleSpec:r}):[new ue(f,t[f],`unknown property "${f}"`)]);return d},string:Yr,formatted:function(i){return Yr(i).length===0?[]:An(i)},resolvedImage:function(i){return Yr(i).length===0?[]:An(i)},padding:function(i){let t=i.key,r=i.value;if(Ye(r)==="array"){if(r.length<1||r.length>4)return[new ue(t,r,`padding requires 1 to 4 values; ${r.length} values found`)];let s={type:"number"},l=[];for(let u=0;u[]}})),i.constants&&(r=r.concat(rl({key:"constants",value:i.constants,style:i,styleSpec:t,validateSpec:Mn}))),ro(r)}function nr(i){return function(t){return i({...t,validateSpec:Mn})}}function ro(i){return[].concat(i).sort((t,r)=>t.line-r.line)}function Vi(i){return function(...t){return ro(i.apply(this,t))}}Si.source=Vi(nr(ps)),Si.sprite=Vi(nr(io)),Si.glyphs=Vi(nr(nl)),Si.light=Vi(nr(Qa)),Si.sky=Vi(nr(eo)),Si.terrain=Vi(nr(to)),Si.layer=Vi(nr(Ya)),Si.filter=Vi(nr(Wa)),Si.paintProperty=Vi(nr(Js)),Si.layoutProperty=Vi(nr(Ja));let Qr=Si,ec=Qr.light,tc=Qr.sky,sl=Qr.paintProperty,al=Qr.layoutProperty;function no(i,t){let r=!1;if(t&&t.length)for(let s of t)i.fire(new Sr(new Error(s.message))),r=!0;return r}class Cn{constructor(t,r,s){let l=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;let d=new Int32Array(this.arrayBuffer);t=d[0],this.d=(r=d[1])+2*(s=d[2]);for(let _=0;_=w[k+0]&&l>=w[k+1])?(f[M]=!0,d.push(v[M])):f[M]=!1}}}}_forEachCell(t,r,s,l,u,d,f,_){let x=this._convertToCellCoord(t),v=this._convertToCellCoord(r),w=this._convertToCellCoord(s),I=this._convertToCellCoord(l);for(let M=x;M<=w;M++)for(let k=v;k<=I;k++){let z=this.d*k+M;if((!_||_(this._convertFromCellCoord(M),this._convertFromCellCoord(k),this._convertFromCellCoord(M+1),this._convertFromCellCoord(k+1)))&&u.call(this,t,r,s,l,z,d,f,_))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let t=this.cells,r=3+this.cells.length+1+1,s=0;for(let d=0;d=0)continue;let d=i[u];l[u]=Ii[r].shallow.indexOf(u)>=0?d:kn(d,t)}i instanceof Error&&(l.message=i.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(l.$name=r),l}function zn(i){if(ol(i))return i;if(Array.isArray(i))return i.map(zn);if(typeof i!="object")throw new Error("can't deserialize object of type "+typeof i);let t=so(i)||"Object";if(!Ii[t])throw new Error(`can't deserialize unregistered class ${t}`);let{klass:r}=Ii[t];if(!r)throw new Error(`can't deserialize unregistered class ${t}`);if(r.deserialize)return r.deserialize(i);let s=Object.create(r.prototype);for(let l of Object.keys(i)){if(l==="$name")continue;let u=i[l];s[l]=Ii[t].shallow.indexOf(l)>=0?u:zn(u)}return s}class ao{constructor(){this.first=!0}update(t,r){let s=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=s,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=s,!0):(this.lastFloorZoom>s?(this.lastIntegerZoom=s+1,this.lastIntegerZoomTime=r):this.lastFloorZoomi>=128&&i<=255,"Hangul Jamo":i=>i>=4352&&i<=4607,Khmer:i=>i>=6016&&i<=6143,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Katakana:i=>i>=12448&&i<=12543,Kanbun:i=>i>=12688&&i<=12703,"CJK Strokes":i=>i>=12736&&i<=12783,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"Private Use Area":i=>i>=57344&&i<=63743,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function oo(i){for(let t of i)if(co(t.charCodeAt(0)))return!0;return!1}function ic(i){for(let t of i)if(!En(t.charCodeAt(0)))return!1;return!0}function lo(i){let t=i.map(r=>{try{return new RegExp(`\\p{sc=${r}}`,"u").source}catch{return null}}).filter(r=>r);return new RegExp(t.join("|"),"u")}let rc=lo(["Arab","Dupl","Mong","Ougr","Syrc"]);function En(i){return!rc.test(String.fromCodePoint(i))}let ll=lo(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function co(i){return!(i!==746&&i!==747&&(i<4352||!(Xe["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||Xe["CJK Compatibility"](i)||Xe["CJK Strokes"](i)||!(!Xe["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||Xe["Enclosed CJK Letters and Months"](i)||Xe["Ideographic Description Characters"](i)||Xe.Kanbun(i)||Xe.Katakana(i)&&i!==12540||!(!Xe["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!Xe["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||Xe["Vertical Forms"](i)||Xe["Yijing Hexagram Symbols"](i)||/\p{sc=Cans}/u.test(String.fromCodePoint(i))||/\p{sc=Hang}/u.test(String.fromCodePoint(i))||ll.test(String.fromCodePoint(i)))))}function cl(i){return!(co(i)||function(t){return!!(Xe["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||Xe["General Punctuation"](t)&&(t===8214||t===8224||t===8225||t===8240||t===8241||t===8251||t===8252||t===8258||t===8263||t===8264||t===8265||t===8273)||Xe["Letterlike Symbols"](t)||Xe["Number Forms"](t)||Xe["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||t===9003||t>=9085&&t<=9114||t>=9150&&t<=9165||t===9167||t>=9169&&t<=9179||t>=9186&&t<=9215)||Xe["Control Pictures"](t)&&t!==9251||Xe["Optical Character Recognition"](t)||Xe["Enclosed Alphanumerics"](t)||Xe["Geometric Shapes"](t)||Xe["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Xe["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Xe["CJK Symbols and Punctuation"](t)||Xe.Katakana(t)||Xe["Private Use Area"](t)||Xe["CJK Compatibility Forms"](t)||Xe["Small Form Variants"](t)||Xe["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}(i))}let nc=lo(["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 ho(i){return nc.test(String.fromCodePoint(i))}function sc(i,t){return!(!t&&ho(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||Xe.Khmer(i))}function ac(i){for(let t of i)if(ho(t.charCodeAt(0)))return!0;return!1}let _i=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(i){this.pluginStatus=i.pluginStatus,this.pluginURL=i.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(i){this.applyArabicShaping=i.applyArabicShaping,this.processBidirectionalText=i.processBidirectionalText,this.processStyledBidirectionalText=i.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class dt{constructor(t,r){this.zoom=t,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new ao,this.transition={})}isSupportedScript(t){return function(r,s){for(let l of r)if(!sc(l.charCodeAt(0),s))return!1;return!0}(t,_i.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let t=this.zoom,r=t-Math.floor(t),s=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*s}:{fromScale:.5,toScale:1,t:1-(1-s)*r}}}class Dn{constructor(t,r){this.property=t,this.value=r,this.expression=function(s,l){if(Us(s))return new Pn(s,l);if(Zs(s)){let u=Za(s,l);if(u.result==="error")throw new Error(u.value.map(d=>`${d.key}: ${d.message}`).join(", "));return u.value}{let u=s;return l.type==="color"&&typeof s=="string"?u=nt.parse(s):l.type!=="padding"||typeof s!="number"&&!Array.isArray(s)?l.type==="variableAnchorOffsetCollection"&&Array.isArray(s)&&(u=wi.parse(s)):u=pi.parse(s),{kind:"constant",evaluate:()=>u}}}(r===void 0?t.specification.default:r,t.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(t,r,s){return this.property.possiblyEvaluate(this,t,r,s)}}class ta{constructor(t){this.property=t,this.value=new Dn(t,void 0)}transitioned(t,r){return new hl(this.property,this.value,r,vi({},t.transition,this.transition),t.now)}untransitioned(){return new hl(this.property,this.value,null,{},0)}}class ia{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return st(this._values[t].value.value)}setValue(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new ta(this._values[t].property)),this._values[t].value=new Dn(this._values[t].property,r===null?void 0:st(r))}getTransition(t){return st(this._values[t].transition)}setTransition(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new ta(this._values[t].property)),this._values[t].transition=st(r)||void 0}serialize(){let t={};for(let r of Object.keys(this._values)){let s=this.getValue(r);s!==void 0&&(t[r]=s);let l=this.getTransition(r);l!==void 0&&(t[`${r}-transition`]=l)}return t}transitioned(t,r){let s=new fs(this._properties);for(let l of Object.keys(this._values))s._values[l]=this._values[l].transitioned(t,r._values[l]);return s}untransitioned(){let t=new fs(this._properties);for(let r of Object.keys(this._values))t._values[r]=this._values[r].untransitioned();return t}}class hl{constructor(t,r,s,l,u){this.property=t,this.value=r,this.begin=u+l.delay||0,this.end=this.begin+l.duration||0,t.specification.transition&&(l.delay||l.duration)&&(this.prior=s)}possiblyEvaluate(t,r,s){let l=t.now||0,u=this.value.possiblyEvaluate(t,r,s),d=this.prior;if(d){if(l>this.end)return this.prior=null,u;if(this.value.isDataDriven())return this.prior=null,u;if(l=1)return 1;let x=_*_,v=x*_;return 4*(_<.5?v:3*(_-x)+v-.75)}(f))}}return u}}class fs{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,r,s){let l=new _s(this._properties);for(let u of Object.keys(this._values))l._values[u]=this._values[u].possiblyEvaluate(t,r,s);return l}hasTransition(){for(let t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class ms{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return this._values[t].value!==void 0}getValue(t){return st(this._values[t].value)}setValue(t,r){this._values[t]=new Dn(this._values[t].property,r===null?void 0:st(r))}serialize(){let t={};for(let r of Object.keys(this._values)){let s=this.getValue(r);s!==void 0&&(t[r]=s)}return t}possiblyEvaluate(t,r,s){let l=new _s(this._properties);for(let u of Object.keys(this._values))l._values[u]=this._values[u].possiblyEvaluate(t,r,s);return l}}class sr{constructor(t,r,s){this.property=t,this.value=r,this.parameters=s}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,r,s,l){return this.property.evaluate(this.value,this.parameters,t,r,s,l)}}class _s{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class Ae{constructor(t){this.specification=t}possiblyEvaluate(t,r){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(r)}interpolate(t,r,s){let l=ii[this.specification.type];return l?l(t,r,s):t}}class Re{constructor(t,r){this.specification=t,this.overrides=r}possiblyEvaluate(t,r,s,l){return new sr(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(r,null,{},s,l)}:t.expression,r)}interpolate(t,r,s){if(t.value.kind!=="constant"||r.value.kind!=="constant")return t;if(t.value.value===void 0||r.value.value===void 0)return new sr(this,{kind:"constant",value:void 0},t.parameters);let l=ii[this.specification.type];if(l){let u=l(t.value.value,r.value.value,s);return new sr(this,{kind:"constant",value:u},t.parameters)}return t}evaluate(t,r,s,l,u,d){return t.kind==="constant"?t.value:t.evaluate(r,s,l,u,d)}}class ra extends Re{possiblyEvaluate(t,r,s,l){if(t.value===void 0)return new sr(this,{kind:"constant",value:void 0},r);if(t.expression.kind==="constant"){let u=t.expression.evaluate(r,null,{},s,l),d=t.property.specification.type==="resolvedImage"&&typeof u!="string"?u.name:u,f=this._calculate(d,d,d,r);return new sr(this,{kind:"constant",value:f},r)}if(t.expression.kind==="camera"){let u=this._calculate(t.expression.evaluate({zoom:r.zoom-1}),t.expression.evaluate({zoom:r.zoom}),t.expression.evaluate({zoom:r.zoom+1}),r);return new sr(this,{kind:"constant",value:u},r)}return new sr(this,t.expression,r)}evaluate(t,r,s,l,u,d){if(t.kind==="source"){let f=t.evaluate(r,s,l,u,d);return this._calculate(f,f,f,r)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(r.zoom)-1},s,l),t.evaluate({zoom:Math.floor(r.zoom)},s,l),t.evaluate({zoom:Math.floor(r.zoom)+1},s,l),r):t.value}_calculate(t,r,s,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:s,to:r}}interpolate(t){return t}}class na{constructor(t){this.specification=t}possiblyEvaluate(t,r,s,l){if(t.value!==void 0){if(t.expression.kind==="constant"){let u=t.expression.evaluate(r,null,{},s,l);return this._calculate(u,u,u,r)}return this._calculate(t.expression.evaluate(new dt(Math.floor(r.zoom-1),r)),t.expression.evaluate(new dt(Math.floor(r.zoom),r)),t.expression.evaluate(new dt(Math.floor(r.zoom+1),r)),r)}}_calculate(t,r,s,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:s,to:r}}interpolate(t){return t}}class uo{constructor(t){this.specification=t}possiblyEvaluate(t,r,s,l){return!!t.expression.evaluate(r,null,{},s,l)}interpolate(){return!1}}class h{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let r in t){let s=t[r];s.specification.overridable&&this.overridableProperties.push(r);let l=this.defaultPropertyValues[r]=new Dn(s,void 0),u=this.defaultTransitionablePropertyValues[r]=new ta(s);this.defaultTransitioningPropertyValues[r]=u.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=l.possiblyEvaluate({})}}}Ie("DataDrivenProperty",Re),Ie("DataConstantProperty",Ae),Ie("CrossFadedDataDrivenProperty",ra),Ie("CrossFadedProperty",na),Ie("ColorRampProperty",uo);let e="-transition";class n extends hn{constructor(t,r){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},t.type!=="custom"&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!=="background"&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),r.layout&&(this._unevaluatedLayout=new ms(r.layout)),r.paint)){this._transitionablePaint=new ia(r.paint);for(let s in t.paint)this.setPaintProperty(s,t.paint[s],{validate:!1});for(let s in t.layout)this.setLayoutProperty(s,t.layout[s],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new _s(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return t==="visibility"?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,r,s={}){r!=null&&this._validate(al,`layers.${this.id}.layout.${t}`,t,r,s)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,r):this.visibility=r)}getPaintProperty(t){return t.endsWith(e)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,r,s={}){if(r!=null&&this._validate(sl,`layers.${this.id}.paint.${t}`,t,r,s))return!1;if(t.endsWith(e))return this._transitionablePaint.setTransition(t.slice(0,-11),r||void 0),!1;{let l=this._transitionablePaint._values[t],u=l.property.specification["property-type"]==="cross-faded-data-driven",d=l.value.isDataDriven(),f=l.value;this._transitionablePaint.setValue(t,r),this._handleSpecialPaintPropertyUpdate(t);let _=this._transitionablePaint._values[t].value;return _.isDataDriven()||d||u||this._handleOverridablePaintPropertyUpdate(t,f,_)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,r,s){return!1}isHidden(t){return!!(this.minzoom&&t=this.maxzoom)||this.visibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,r){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,r)}serialize(){let t={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&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),Hn(t,(r,s)=>!(r===void 0||s==="layout"&&!Object.keys(r).length||s==="paint"&&!Object.keys(r).length))}_validate(t,r,s,l,u={}){return(!u||u.validate!==!1)&&no(this,t.call(Qr,{key:r,layerType:this.type,objectKey:s,value:l,styleSpec:ie,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let t in this.paint._values){let r=this.paint.get(t);if(r instanceof sr&&bn(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}let a={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class o{constructor(t,r){this._structArray=t,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class c{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,r){return t._trim(),r&&(t.isTransferred=!0,r.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){let r=Object.create(this.prototype);return r.arrayBuffer=t.arrayBuffer,r.length=t.length,r.capacity=t.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_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(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function m(i,t=1){let r=0,s=0;return{members:i.map(l=>{let u=a[l.type].BYTES_PER_ELEMENT,d=r=g(r,Math.max(t,u)),f=l.components||1;return s=Math.max(s,u),r+=u*f,{name:l.name,type:l.type,components:f,offset:d}}),size:g(r,Math.max(s,t)),alignment:t}}function g(i,t){return Math.ceil(i/t)*t}class y extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r){let s=this.length;return this.resize(s+1),this.emplace(s,t,r)}emplace(t,r,s){let l=2*t;return this.int16[l+0]=r,this.int16[l+1]=s,t}}y.prototype.bytesPerElement=4,Ie("StructArrayLayout2i4",y);class b extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s){let l=this.length;return this.resize(l+1),this.emplace(l,t,r,s)}emplace(t,r,s,l){let u=3*t;return this.int16[u+0]=r,this.int16[u+1]=s,this.int16[u+2]=l,t}}b.prototype.bytesPerElement=6,Ie("StructArrayLayout3i6",b);class T extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,l){let u=this.length;return this.resize(u+1),this.emplace(u,t,r,s,l)}emplace(t,r,s,l,u){let d=4*t;return this.int16[d+0]=r,this.int16[d+1]=s,this.int16[d+2]=l,this.int16[d+3]=u,t}}T.prototype.bytesPerElement=8,Ie("StructArrayLayout4i8",T);class S extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,u,d){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,s,l,u,d)}emplace(t,r,s,l,u,d,f){let _=6*t;return this.int16[_+0]=r,this.int16[_+1]=s,this.int16[_+2]=l,this.int16[_+3]=u,this.int16[_+4]=d,this.int16[_+5]=f,t}}S.prototype.bytesPerElement=12,Ie("StructArrayLayout2i4i12",S);class C extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,u,d){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,s,l,u,d)}emplace(t,r,s,l,u,d,f){let _=4*t,x=8*t;return this.int16[_+0]=r,this.int16[_+1]=s,this.uint8[x+4]=l,this.uint8[x+5]=u,this.uint8[x+6]=d,this.uint8[x+7]=f,t}}C.prototype.bytesPerElement=8,Ie("StructArrayLayout2i4ub8",C);class E extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r){let s=this.length;return this.resize(s+1),this.emplace(s,t,r)}emplace(t,r,s){let l=2*t;return this.float32[l+0]=r,this.float32[l+1]=s,t}}E.prototype.bytesPerElement=8,Ie("StructArrayLayout2f8",E);class R extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,u,d,f,_,x,v){let w=this.length;return this.resize(w+1),this.emplace(w,t,r,s,l,u,d,f,_,x,v)}emplace(t,r,s,l,u,d,f,_,x,v,w){let I=10*t;return this.uint16[I+0]=r,this.uint16[I+1]=s,this.uint16[I+2]=l,this.uint16[I+3]=u,this.uint16[I+4]=d,this.uint16[I+5]=f,this.uint16[I+6]=_,this.uint16[I+7]=x,this.uint16[I+8]=v,this.uint16[I+9]=w,t}}R.prototype.bytesPerElement=20,Ie("StructArrayLayout10ui20",R);class V extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,u,d,f,_,x,v,w,I){let M=this.length;return this.resize(M+1),this.emplace(M,t,r,s,l,u,d,f,_,x,v,w,I)}emplace(t,r,s,l,u,d,f,_,x,v,w,I,M){let k=12*t;return this.int16[k+0]=r,this.int16[k+1]=s,this.int16[k+2]=l,this.int16[k+3]=u,this.uint16[k+4]=d,this.uint16[k+5]=f,this.uint16[k+6]=_,this.uint16[k+7]=x,this.int16[k+8]=v,this.int16[k+9]=w,this.int16[k+10]=I,this.int16[k+11]=M,t}}V.prototype.bytesPerElement=24,Ie("StructArrayLayout4i4ui4i24",V);class U extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,s){let l=this.length;return this.resize(l+1),this.emplace(l,t,r,s)}emplace(t,r,s,l){let u=3*t;return this.float32[u+0]=r,this.float32[u+1]=s,this.float32[u+2]=l,t}}U.prototype.bytesPerElement=12,Ie("StructArrayLayout3f12",U);class $ extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){let r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint32[1*t+0]=r,t}}$.prototype.bytesPerElement=4,Ie("StructArrayLayout1ul4",$);class Z extends c{_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(t,r,s,l,u,d,f,_,x){let v=this.length;return this.resize(v+1),this.emplace(v,t,r,s,l,u,d,f,_,x)}emplace(t,r,s,l,u,d,f,_,x,v){let w=10*t,I=5*t;return this.int16[w+0]=r,this.int16[w+1]=s,this.int16[w+2]=l,this.int16[w+3]=u,this.int16[w+4]=d,this.int16[w+5]=f,this.uint32[I+3]=_,this.uint16[w+8]=x,this.uint16[w+9]=v,t}}Z.prototype.bytesPerElement=20,Ie("StructArrayLayout6i1ul2ui20",Z);class B extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,u,d){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,s,l,u,d)}emplace(t,r,s,l,u,d,f){let _=6*t;return this.int16[_+0]=r,this.int16[_+1]=s,this.int16[_+2]=l,this.int16[_+3]=u,this.int16[_+4]=d,this.int16[_+5]=f,t}}B.prototype.bytesPerElement=12,Ie("StructArrayLayout2i2i2i12",B);class X extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,u){let d=this.length;return this.resize(d+1),this.emplace(d,t,r,s,l,u)}emplace(t,r,s,l,u,d){let f=4*t,_=8*t;return this.float32[f+0]=r,this.float32[f+1]=s,this.float32[f+2]=l,this.int16[_+6]=u,this.int16[_+7]=d,t}}X.prototype.bytesPerElement=16,Ie("StructArrayLayout2f1f2i16",X);class K extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,s,l,u,d){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,s,l,u,d)}emplace(t,r,s,l,u,d,f){let _=16*t,x=4*t,v=8*t;return this.uint8[_+0]=r,this.uint8[_+1]=s,this.float32[x+1]=l,this.float32[x+2]=u,this.int16[v+6]=d,this.int16[v+7]=f,t}}K.prototype.bytesPerElement=16,Ie("StructArrayLayout2ub2f2i16",K);class ee extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,s){let l=this.length;return this.resize(l+1),this.emplace(l,t,r,s)}emplace(t,r,s,l){let u=3*t;return this.uint16[u+0]=r,this.uint16[u+1]=s,this.uint16[u+2]=l,t}}ee.prototype.bytesPerElement=6,Ie("StructArrayLayout3ui6",ee);class oe extends c{_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(t,r,s,l,u,d,f,_,x,v,w,I,M,k,z,F,j){let Q=this.length;return this.resize(Q+1),this.emplace(Q,t,r,s,l,u,d,f,_,x,v,w,I,M,k,z,F,j)}emplace(t,r,s,l,u,d,f,_,x,v,w,I,M,k,z,F,j,Q){let G=24*t,J=12*t,re=48*t;return this.int16[G+0]=r,this.int16[G+1]=s,this.uint16[G+2]=l,this.uint16[G+3]=u,this.uint32[J+2]=d,this.uint32[J+3]=f,this.uint32[J+4]=_,this.uint16[G+10]=x,this.uint16[G+11]=v,this.uint16[G+12]=w,this.float32[J+7]=I,this.float32[J+8]=M,this.uint8[re+36]=k,this.uint8[re+37]=z,this.uint8[re+38]=F,this.uint32[J+10]=j,this.int16[G+22]=Q,t}}oe.prototype.bytesPerElement=48,Ie("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",oe);class he extends c{_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(t,r,s,l,u,d,f,_,x,v,w,I,M,k,z,F,j,Q,G,J,re,ce,we,Le,ve,ye,ke,Pe){let Se=this.length;return this.resize(Se+1),this.emplace(Se,t,r,s,l,u,d,f,_,x,v,w,I,M,k,z,F,j,Q,G,J,re,ce,we,Le,ve,ye,ke,Pe)}emplace(t,r,s,l,u,d,f,_,x,v,w,I,M,k,z,F,j,Q,G,J,re,ce,we,Le,ve,ye,ke,Pe,Se){let ae=32*t,ze=16*t;return this.int16[ae+0]=r,this.int16[ae+1]=s,this.int16[ae+2]=l,this.int16[ae+3]=u,this.int16[ae+4]=d,this.int16[ae+5]=f,this.int16[ae+6]=_,this.int16[ae+7]=x,this.uint16[ae+8]=v,this.uint16[ae+9]=w,this.uint16[ae+10]=I,this.uint16[ae+11]=M,this.uint16[ae+12]=k,this.uint16[ae+13]=z,this.uint16[ae+14]=F,this.uint16[ae+15]=j,this.uint16[ae+16]=Q,this.uint16[ae+17]=G,this.uint16[ae+18]=J,this.uint16[ae+19]=re,this.uint16[ae+20]=ce,this.uint16[ae+21]=we,this.uint16[ae+22]=Le,this.uint32[ze+12]=ve,this.float32[ze+13]=ye,this.float32[ze+14]=ke,this.uint16[ae+30]=Pe,this.uint16[ae+31]=Se,t}}he.prototype.bytesPerElement=64,Ie("StructArrayLayout8i15ui1ul2f2ui64",he);class xe extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){let r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.float32[1*t+0]=r,t}}xe.prototype.bytesPerElement=4,Ie("StructArrayLayout1f4",xe);class Te extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,s){let l=this.length;return this.resize(l+1),this.emplace(l,t,r,s)}emplace(t,r,s,l){let u=3*t;return this.uint16[6*t+0]=r,this.float32[u+1]=s,this.float32[u+2]=l,t}}Te.prototype.bytesPerElement=12,Ie("StructArrayLayout1ui2f12",Te);class fe extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,s){let l=this.length;return this.resize(l+1),this.emplace(l,t,r,s)}emplace(t,r,s,l){let u=4*t;return this.uint32[2*t+0]=r,this.uint16[u+2]=s,this.uint16[u+3]=l,t}}fe.prototype.bytesPerElement=8,Ie("StructArrayLayout1ul2ui8",fe);class pe extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r){let s=this.length;return this.resize(s+1),this.emplace(s,t,r)}emplace(t,r,s){let l=2*t;return this.uint16[l+0]=r,this.uint16[l+1]=s,t}}pe.prototype.bytesPerElement=4,Ie("StructArrayLayout2ui4",pe);class Me extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){let r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint16[1*t+0]=r,t}}Me.prototype.bytesPerElement=2,Ie("StructArrayLayout1ui2",Me);class Ve extends c{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,s,l){let u=this.length;return this.resize(u+1),this.emplace(u,t,r,s,l)}emplace(t,r,s,l,u){let d=4*t;return this.float32[d+0]=r,this.float32[d+1]=s,this.float32[d+2]=l,this.float32[d+3]=u,t}}Ve.prototype.bytesPerElement=16,Ie("StructArrayLayout4f16",Ve);class ge extends o{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 me(this.anchorPointX,this.anchorPointY)}}ge.prototype.size=20;class be extends Z{get(t){return new ge(this,t)}}Ie("CollisionBoxArray",be);class Fe extends o{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(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Fe.prototype.size=48;class pt extends oe{get(t){return new Fe(this,t)}}Ie("PlacedSymbolArray",pt);class Ue extends o{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(t){this._structArray.uint32[this._pos4+12]=t}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]}}Ue.prototype.size=64;class He extends he{get(t){return new Ue(this,t)}}Ie("SymbolInstanceArray",He);class ft extends xe{getoffsetX(t){return this.float32[1*t+0]}}Ie("GlyphOffsetArray",ft);class Vt extends b{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}Ie("SymbolLineVertexArray",Vt);class Ni extends o{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]}}Ni.prototype.size=12;class mt extends Te{get(t){return new Ni(this,t)}}Ie("TextAnchorOffsetArray",mt);class ni extends o{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]}}ni.prototype.size=8;class Kt extends fe{get(t){return new ni(this,t)}}Ie("FeatureIndexArray",Kt);class Nt extends y{}class Jt extends y{}class ar extends y{}class Ln extends S{}class sa extends C{}class Rn extends E{}class Pi extends R{}class aa extends V{}class po extends U{}class Ai extends ${}class Mi extends B{}class kr extends K{}class ji extends ee{}class Rt extends pe{}let jt=m([{name:"a_pos",components:2,type:"Int16"}],4),{members:gi}=jt;class We{constructor(t=[]){this.segments=t}prepareSegment(t,r,s,l){let u=this.segments[this.segments.length-1];return t>We.MAX_VERTEX_ARRAY_LENGTH&&Ft(`Max vertices per segment is ${We.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!u||u.vertexLength+t>We.MAX_VERTEX_ARRAY_LENGTH||u.sortKey!==l)&&(u={vertexOffset:r.length,primitiveOffset:s.length,vertexLength:0,primitiveLength:0},l!==void 0&&(u.sortKey=l),this.segments.push(u)),u}get(){return this.segments}destroy(){for(let t of this.segments)for(let r in t.vaos)t.vaos[r].destroy()}static simpleSegment(t,r,s,l){return new We([{vertexOffset:t,primitiveOffset:r,vertexLength:s,primitiveLength:l,vaos:{},sortKey:0}])}}function en(i,t){return 256*(i=zi(Math.floor(i),0,255))+zi(Math.floor(t),0,255)}We.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Ie("SegmentVector",We);let Bn=m([{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 Fn={exports:{}},ul={exports:{}};ul.exports=function(i,t){var r,s,l,u,d,f,_,x;for(s=i.length-(r=3&i.length),l=t,d=3432918353,f=461845907,x=0;x>>16)*d&65535)<<16)&4294967295)<<15|_>>>17))*f+(((_>>>16)*f&65535)<<16)&4294967295)<<13|l>>>19))+((5*(l>>>16)&65535)<<16)&4294967295))+((58964+(u>>>16)&65535)<<16);switch(_=0,r){case 3:_^=(255&i.charCodeAt(x+2))<<16;case 2:_^=(255&i.charCodeAt(x+1))<<8;case 1:l^=_=(65535&(_=(_=(65535&(_^=255&i.charCodeAt(x)))*d+(((_>>>16)*d&65535)<<16)&4294967295)<<15|_>>>17))*f+(((_>>>16)*f&65535)<<16)&4294967295}return l^=i.length,l=2246822507*(65535&(l^=l>>>16))+((2246822507*(l>>>16)&65535)<<16)&4294967295,l=3266489909*(65535&(l^=l>>>13))+((3266489909*(l>>>16)&65535)<<16)&4294967295,(l^=l>>>16)>>>0};var oc=ul.exports,dl={exports:{}};dl.exports=function(i,t){for(var r,s=i.length,l=t^s,u=0;s>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(u)|(255&i.charCodeAt(++u))<<8|(255&i.charCodeAt(++u))<<16|(255&i.charCodeAt(++u))<<24))+((1540483477*(r>>>16)&65535)<<16),l=1540483477*(65535&l)+((1540483477*(l>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),s-=4,++u;switch(s){case 3:l^=(255&i.charCodeAt(u+2))<<16;case 2:l^=(255&i.charCodeAt(u+1))<<8;case 1:l=1540483477*(65535&(l^=255&i.charCodeAt(u)))+((1540483477*(l>>>16)&65535)<<16)}return l=1540483477*(65535&(l^=l>>>13))+((1540483477*(l>>>16)&65535)<<16),(l^=l>>>15)>>>0};var zr=oc,pl=dl.exports;Fn.exports=zr,Fn.exports.murmur3=zr,Fn.exports.murmur2=pl;var oa=ki(Fn.exports);class gs{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,r,s,l){this.ids.push(la(t)),this.positions.push(r,s,l)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let r=la(t),s=0,l=this.ids.length-1;for(;s>1;this.ids[d]>=r?l=d:s=d+1}let u=[];for(;this.ids[s]===r;)u.push({index:this.positions[3*s],start:this.positions[3*s+1],end:this.positions[3*s+2]}),s++;return u}static serialize(t,r){let s=new Float64Array(t.ids),l=new Uint32Array(t.positions);return ca(s,l,0,s.length-1),r&&r.push(s.buffer,l.buffer),{ids:s,positions:l}}static deserialize(t){let r=new gs;return r.ids=t.ids,r.positions=t.positions,r.indexed=!0,r}}function la(i){let t=+i;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:oa(String(i))}function ca(i,t,r,s){for(;r>1],u=r-1,d=s+1;for(;;){do u++;while(i[u]l);if(u>=d)break;On(i,u,d),On(t,3*u,3*d),On(t,3*u+1,3*d+1),On(t,3*u+2,3*d+2)}d-r`u_${l}`),this.type=s}setUniform(t,r,s){t.set(s.constantOr(this.value))}getBinding(t,r,s){return this.type==="color"?new Qc(t,r):new fl(t,r)}}class ha{constructor(t,r){this.uniformNames=r.map(s=>`u_${s}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=t.tlbr}setUniform(t,r,s,l){let u=l==="u_pattern_to"?this.patternTo:l==="u_pattern_from"?this.patternFrom:l==="u_pixel_ratio_to"?this.pixelRatioTo:l==="u_pixel_ratio_from"?this.pixelRatioFrom:null;u&&t.set(u)}getBinding(t,r,s){return s.substr(0,9)==="u_pattern"?new Yc(t,r):new fl(t,r)}}class tn{constructor(t,r,s,l){this.expression=t,this.type=s,this.maxValue=0,this.paintVertexAttributes=r.map(u=>({name:`a_${u}`,type:"Float32",components:s==="color"?2:1,offset:0})),this.paintVertexArray=new l}populatePaintArray(t,r,s,l,u){let d=this.paintVertexArray.length,f=this.expression.evaluate(new dt(0),r,{},l,[],u);this.paintVertexArray.resize(t),this._setPaintValue(d,t,f)}updatePaintArray(t,r,s,l){let u=this.expression.evaluate({zoom:0},s,l);this._setPaintValue(t,r,u)}_setPaintValue(t,r,s){if(this.type==="color"){let l=lc(s);for(let u=t;u`u_${f}_t`),this.type=s,this.useIntegerZoom=l,this.zoom=u,this.maxValue=0,this.paintVertexAttributes=r.map(f=>({name:`a_${f}`,type:"Float32",components:s==="color"?4:2,offset:0})),this.paintVertexArray=new d}populatePaintArray(t,r,s,l,u){let d=this.expression.evaluate(new dt(this.zoom),r,{},l,[],u),f=this.expression.evaluate(new dt(this.zoom+1),r,{},l,[],u),_=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(_,t,d,f)}updatePaintArray(t,r,s,l){let u=this.expression.evaluate({zoom:this.zoom},s,l),d=this.expression.evaluate({zoom:this.zoom+1},s,l);this._setPaintValue(t,r,u,d)}_setPaintValue(t,r,s,l){if(this.type==="color"){let u=lc(s),d=lc(l);for(let f=t;f`#define HAS_UNIFORM_${l}`))}return t}getBinderAttributes(){let t=[];for(let r in this.binders){let s=this.binders[r];if(s instanceof tn||s instanceof gr)for(let l=0;l!0){this.programConfigurations={};for(let l of t)this.programConfigurations[l.id]=new eh(l,r,s);this.needsUpload=!1,this._featureMap=new gs,this._bufferOffset=0}populatePaintArrays(t,r,s,l,u,d){for(let f in this.programConfigurations)this.programConfigurations[f].populatePaintArrays(t,r,l,u,d);r.id!==void 0&&this._featureMap.add(r.id,s,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,r,s,l){for(let u of s)this.needsUpload=this.programConfigurations[u.id].updatePaintArrays(t,this._featureMap,r,u,l)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(let r in this.programConfigurations)this.programConfigurations[r].upload(t);this.needsUpload=!1}}destroy(){for(let t in this.programConfigurations)this.programConfigurations[t].destroy()}}function Ou(i,t){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"]}[i]||[i.replace(`${t}-`,"").replace(/-/g,"_")]}function th(i,t,r){let s={color:{source:E,composite:Ve},number:{source:xe,composite:E}},l=function(u){return{"line-pattern":{source:Pi,composite:Pi},"fill-pattern":{source:Pi,composite:Pi},"fill-extrusion-pattern":{source:Pi,composite:Pi}}[u]}(i);return l&&l[r]||s[t][r]}Ie("ConstantBinder",fo),Ie("CrossFadedConstantBinder",ha),Ie("SourceExpressionBinder",tn),Ie("CrossFadedCompositeBinder",Vn),Ie("CompositeExpressionBinder",gr),Ie("ProgramConfiguration",eh,{omit:["_buffers"]}),Ie("ProgramConfigurationSet",xs);let Mt=8192,cc=Math.pow(2,14)-1,ih=-cc-1;function vs(i){let t=Mt/i.extent,r=i.loadGeometry();for(let s=0;sd.x+1||_d.y+1)&&Ft("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function bs(i,t){return{type:i.type,id:i.id,properties:i.properties,geometry:t?vs(i):[]}}function ml(i,t,r,s,l){i.emplaceBack(2*t+(s+1)/2,2*r+(l+1)/2)}class hc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Jt,this.indexArray=new ji,this.segments=new We,this.programConfigurations=new xs(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,s){let l=this.layers[0],u=[],d=null,f=!1;l.type==="circle"&&(d=l.layout.get("circle-sort-key"),f=!d.isConstant());for(let{feature:_,id:x,index:v,sourceLayerIndex:w}of t){let I=this.layers[0]._featureFilter.needGeometry,M=bs(_,I);if(!this.layers[0]._featureFilter.filter(new dt(this.zoom),M,s))continue;let k=f?d.evaluate(M,{},s):void 0,z={id:x,properties:_.properties,type:_.type,sourceLayerIndex:w,index:v,geometry:I?M.geometry:vs(_),patterns:{},sortKey:k};u.push(z)}f&&u.sort((_,x)=>_.sortKey-x.sortKey);for(let _ of u){let{geometry:x,index:v,sourceLayerIndex:w}=_,I=t[v].feature;this.addFeature(_,x,v,s),r.featureIndex.insert(I,x,v,w,this.index)}}update(t,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,gi),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,r,s,l){for(let u of r)for(let d of u){let f=d.x,_=d.y;if(f<0||f>=Mt||_<0||_>=Mt)continue;let x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),v=x.vertexLength;ml(this.layoutVertexArray,f,_,-1,-1),ml(this.layoutVertexArray,f,_,1,-1),ml(this.layoutVertexArray,f,_,1,1),ml(this.layoutVertexArray,f,_,-1,1),this.indexArray.emplaceBack(v,v+1,v+2),this.indexArray.emplaceBack(v,v+3,v+2),x.vertexLength+=4,x.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,s,{},l)}}function rh(i,t){for(let r=0;r1){if(uc(i,t))return!0;for(let s=0;s1?r:r.sub(t)._mult(l)._add(t))}function ah(i,t){let r,s,l,u=!1;for(let d=0;dt.y!=l.y>t.y&&t.x<(l.x-s.x)*(t.y-s.y)/(l.y-s.y)+s.x&&(u=!u)}return u}function ua(i,t){let r=!1;for(let s=0,l=i.length-1;st.y!=d.y>t.y&&t.x<(d.x-u.x)*(t.y-u.y)/(d.y-u.y)+u.x&&(r=!r)}return r}function Uu(i,t,r){let s=r[0],l=r[2];if(i.xl.x&&t.x>l.x||i.yl.y&&t.y>l.y)return!1;let u=Ht(i,t,r[0]);return u!==Ht(i,t,r[1])||u!==Ht(i,t,r[2])||u!==Ht(i,t,r[3])}function mo(i,t,r){let s=t.paint.get(i).value;return s.kind==="constant"?s.value:r.programConfigurations.get(t.id).getMaxValue(i)}function _l(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function gl(i,t,r,s,l){if(!t[0]&&!t[1])return i;let u=me.convert(t)._mult(l);r==="viewport"&&u._rotate(-s);let d=[];for(let f=0;fhh(F,z))}(x,_),M=w?v*f:v;for(let k of l)for(let z of k){let F=w?z:hh(z,_),j=M,Q=yl([],[z.x,z.y,0,1],_);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?j*=Q[3]/d.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(j*=d.cameraToCenterDistance/Q[3]),Vu(I,F,j))return!0}return!1}}function hh(i,t){let r=yl([],[i.x,i.y,0,1],t);return new me(r[0]/r[3],r[1]/r[3])}class uh extends hc{}let dh;Ie("HeatmapBucket",uh,{omit:["layers"]});var Gu={get paint(){return dh=dh||new h({"heatmap-radius":new Re(ie.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Re(ie.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ae(ie.paint_heatmap["heatmap-intensity"]),"heatmap-color":new uo(ie.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ae(ie.paint_heatmap["heatmap-opacity"])})}};function fc(i,{width:t,height:r},s,l){if(l){if(l instanceof Uint8ClampedArray)l=new Uint8Array(l.buffer);else if(l.length!==t*r*s)throw new RangeError(`mismatched image size. expected: ${l.length} but got: ${t*r*s}`)}else l=new Uint8Array(t*r*s);return i.width=t,i.height=r,i.data=l,i}function ph(i,{width:t,height:r},s){if(t===i.width&&r===i.height)return;let l=fc({},{width:t,height:r},s);mc(i,l,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,t),height:Math.min(i.height,r)},s),i.width=t,i.height=r,i.data=l.data}function mc(i,t,r,s,l,u){if(l.width===0||l.height===0)return t;if(l.width>i.width||l.height>i.height||r.x>i.width-l.width||r.y>i.height-l.height)throw new RangeError("out of range source coordinates for image copy");if(l.width>t.width||l.height>t.height||s.x>t.width-l.width||s.y>t.height-l.height)throw new RangeError("out of range destination coordinates for image copy");let d=i.data,f=t.data;if(d===f)throw new Error("srcData equals dstData, so image is already copied");for(let _=0;_{t[i.evaluationKey]=_;let x=i.expression.evaluate(t);l.data[d+f+0]=Math.floor(255*x.r/x.a),l.data[d+f+1]=Math.floor(255*x.g/x.a),l.data[d+f+2]=Math.floor(255*x.b/x.a),l.data[d+f+3]=Math.floor(255*x.a)};if(i.clips)for(let d=0,f=0;d80*r){f=1/0,_=1/0;let v=-1/0,w=-1/0;for(let I=r;Iv&&(v=M),k>w&&(w=k)}x=Math.max(v-f,w-_),x=x!==0?32767/x:0}return yo(u,d,r,f,_,x,0),d}function gh(i,t,r,s,l){let u;if(l===function(d,f,_,x){let v=0;for(let w=f,I=_-x;w<_;w+=x)v+=(d[I]-d[w])*(d[w+1]+d[I+1]),I=w;return v}(i,t,r,s)>0)for(let d=t;d=t;d-=s)u=vh(d/s|0,i[d],i[d+1],u);return u&&xl(u,u.next)&&(vo(u),u=u.next),u}function ws(i,t){if(!i)return i;t||(t=i);let r,s=i;do if(r=!1,s.steiner||!xl(s,s.next)&&It(s.prev,s,s.next)!==0)s=s.next;else{if(vo(s),s=t=s.prev,s===s.next)break;r=!0}while(r||s!==t);return t}function yo(i,t,r,s,l,u,d){if(!i)return;!d&&u&&function(_,x,v,w){let I=_;do I.z===0&&(I.z=gc(I.x,I.y,x,v,w)),I.prevZ=I.prev,I.nextZ=I.next,I=I.next;while(I!==_);I.prevZ.nextZ=null,I.prevZ=null,function(M){let k,z=1;do{let F,j=M;M=null;let Q=null;for(k=0;j;){k++;let G=j,J=0;for(let ce=0;ce0||re>0&&G;)J!==0&&(re===0||!G||j.z<=G.z)?(F=j,j=j.nextZ,J--):(F=G,G=G.nextZ,re--),Q?Q.nextZ=F:M=F,F.prevZ=Q,Q=F;j=G}Q.nextZ=null,z*=2}while(k>1)}(I)}(i,s,l,u);let f=i;for(;i.prev!==i.next;){let _=i.prev,x=i.next;if(u?Qu(i,s,l,u):Yu(i))t.push(_.i,i.i,x.i),vo(i),i=x.next,f=x.next;else if((i=x)===f){d?d===1?yo(i=ed(ws(i),t),t,r,s,l,u,2):d===2&&td(i,t,r,s,l,u):yo(ws(i),t,r,s,l,u,1);break}}}function Yu(i){let t=i.prev,r=i,s=i.next;if(It(t,r,s)>=0)return!1;let l=t.x,u=r.x,d=s.x,f=t.y,_=r.y,x=s.y,v=lu?l>d?l:d:u>d?u:d,M=f>_?f>x?f:x:_>x?_:x,k=s.next;for(;k!==t;){if(k.x>=v&&k.x<=I&&k.y>=w&&k.y<=M&&pa(l,f,u,_,d,x,k.x,k.y)&&It(k.prev,k,k.next)>=0)return!1;k=k.next}return!0}function Qu(i,t,r,s){let l=i.prev,u=i,d=i.next;if(It(l,u,d)>=0)return!1;let f=l.x,_=u.x,x=d.x,v=l.y,w=u.y,I=d.y,M=f<_?f_?f>x?f:x:_>x?_:x,F=v>w?v>I?v:I:w>I?w:I,j=gc(M,k,t,r,s),Q=gc(z,F,t,r,s),G=i.prevZ,J=i.nextZ;for(;G&&G.z>=j&&J&&J.z<=Q;){if(G.x>=M&&G.x<=z&&G.y>=k&&G.y<=F&&G!==l&&G!==d&&pa(f,v,_,w,x,I,G.x,G.y)&&It(G.prev,G,G.next)>=0||(G=G.prevZ,J.x>=M&&J.x<=z&&J.y>=k&&J.y<=F&&J!==l&&J!==d&&pa(f,v,_,w,x,I,J.x,J.y)&&It(J.prev,J,J.next)>=0))return!1;J=J.nextZ}for(;G&&G.z>=j;){if(G.x>=M&&G.x<=z&&G.y>=k&&G.y<=F&&G!==l&&G!==d&&pa(f,v,_,w,x,I,G.x,G.y)&&It(G.prev,G,G.next)>=0)return!1;G=G.prevZ}for(;J&&J.z<=Q;){if(J.x>=M&&J.x<=z&&J.y>=k&&J.y<=F&&J!==l&&J!==d&&pa(f,v,_,w,x,I,J.x,J.y)&&It(J.prev,J,J.next)>=0)return!1;J=J.nextZ}return!0}function ed(i,t){let r=i;do{let s=r.prev,l=r.next.next;!xl(s,l)&&yh(s,r,r.next,l)&&xo(s,l)&&xo(l,s)&&(t.push(s.i,r.i,l.i),vo(r),vo(r.next),r=i=l),r=r.next}while(r!==i);return ws(r)}function td(i,t,r,s,l,u){let d=i;do{let f=d.next.next;for(;f!==d.prev;){if(d.i!==f.i&&ad(d,f)){let _=xh(d,f);return d=ws(d,d.next),_=ws(_,_.next),yo(d,t,r,s,l,u,0),void yo(_,t,r,s,l,u,0)}f=f.next}d=d.next}while(d!==i)}function id(i,t){return i.x-t.x}function rd(i,t){let r=function(l,u){let d=u,f=l.x,_=l.y,x,v=-1/0;do{if(_<=d.y&&_>=d.next.y&&d.next.y!==d.y){let z=d.x+(_-d.y)*(d.next.x-d.x)/(d.next.y-d.y);if(z<=f&&z>v&&(v=z,x=d.x=d.x&&d.x>=I&&f!==d.x&&pa(_x.x||d.x===x.x&&nd(x,d)))&&(x=d,k=z)}d=d.next}while(d!==w);return x}(i,t);if(!r)return t;let s=xh(r,i);return ws(s,s.next),ws(r,r.next)}function nd(i,t){return It(i.prev,i,t.prev)<0&&It(t.next,i,i.next)<0}function gc(i,t,r,s,l){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*l|0)|i<<8))|i<<4))|i<<2))|i<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-s)*l|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function sd(i){let t=i,r=i;do(t.x=(i-d)*(u-f)&&(i-d)*(s-f)>=(r-d)*(t-f)&&(r-d)*(u-f)>=(l-d)*(s-f)}function ad(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!function(r,s){let l=r;do{if(l.i!==r.i&&l.next.i!==r.i&&l.i!==s.i&&l.next.i!==s.i&&yh(l,l.next,r,s))return!0;l=l.next}while(l!==r);return!1}(i,t)&&(xo(i,t)&&xo(t,i)&&function(r,s){let l=r,u=!1,d=(r.x+s.x)/2,f=(r.y+s.y)/2;do l.y>f!=l.next.y>f&&l.next.y!==l.y&&d<(l.next.x-l.x)*(f-l.y)/(l.next.y-l.y)+l.x&&(u=!u),l=l.next;while(l!==r);return u}(i,t)&&(It(i.prev,i,t.prev)||It(i,t.prev,t))||xl(i,t)&&It(i.prev,i,i.next)>0&&It(t.prev,t,t.next)>0)}function It(i,t,r){return(t.y-i.y)*(r.x-t.x)-(t.x-i.x)*(r.y-t.y)}function xl(i,t){return i.x===t.x&&i.y===t.y}function yh(i,t,r,s){let l=bl(It(i,t,r)),u=bl(It(i,t,s)),d=bl(It(r,s,i)),f=bl(It(r,s,t));return l!==u&&d!==f||!(l!==0||!vl(i,r,t))||!(u!==0||!vl(i,s,t))||!(d!==0||!vl(r,i,s))||!(f!==0||!vl(r,t,s))}function vl(i,t,r){return t.x<=Math.max(i.x,r.x)&&t.x>=Math.min(i.x,r.x)&&t.y<=Math.max(i.y,r.y)&&t.y>=Math.min(i.y,r.y)}function bl(i){return i>0?1:i<0?-1:0}function xo(i,t){return It(i.prev,i,i.next)<0?It(i,t,i.next)>=0&&It(i,i.prev,t)>=0:It(i,t,i.prev)<0||It(i,i.next,t)<0}function xh(i,t){let r=yc(i.i,i.x,i.y),s=yc(t.i,t.x,t.y),l=i.next,u=t.prev;return i.next=t,t.prev=i,r.next=l,l.prev=r,s.next=r,r.prev=s,u.next=s,s.prev=u,s}function vh(i,t,r,s){let l=yc(i,t,r);return s?(l.next=s.next,l.prev=s,s.next.prev=l,s.next=l):(l.prev=l,l.next=l),l}function vo(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function yc(i,t,r){return{i,x:t,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function xc(i,t,r){let s=r.patternDependencies,l=!1;for(let u of t){let d=u.paint.get(`${i}-pattern`);d.isConstant()||(l=!0);let f=d.constantOr(null);f&&(l=!0,s[f.to]=!0,s[f.from]=!0)}return l}function vc(i,t,r,s,l){let u=l.patternDependencies;for(let d of t){let f=d.paint.get(`${i}-pattern`).value;if(f.kind!=="constant"){let _=f.evaluate({zoom:s-1},r,{},l.availableImages),x=f.evaluate({zoom:s},r,{},l.availableImages),v=f.evaluate({zoom:s+1},r,{},l.availableImages);_=_&&_.name?_.name:_,x=x&&x.name?x.name:x,v=v&&v.name?v.name:v,u[_]=!0,u[x]=!0,u[v]=!0,r.patterns[d.id]={min:_,mid:x,max:v}}}return r}class bc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new ar,this.indexArray=new ji,this.indexArray2=new Rt,this.programConfigurations=new xs(t.layers,t.zoom),this.segments=new We,this.segments2=new We,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,s){this.hasPattern=xc("fill",this.layers,r);let l=this.layers[0].layout.get("fill-sort-key"),u=!l.isConstant(),d=[];for(let{feature:f,id:_,index:x,sourceLayerIndex:v}of t){let w=this.layers[0]._featureFilter.needGeometry,I=bs(f,w);if(!this.layers[0]._featureFilter.filter(new dt(this.zoom),I,s))continue;let M=u?l.evaluate(I,{},s,r.availableImages):void 0,k={id:_,properties:f.properties,type:f.type,sourceLayerIndex:v,index:x,geometry:w?I.geometry:vs(f),patterns:{},sortKey:M};d.push(k)}u&&d.sort((f,_)=>f.sortKey-_.sortKey);for(let f of d){let{geometry:_,index:x,sourceLayerIndex:v}=f;if(this.hasPattern){let w=vc("fill",this.layers,f,this.zoom,r);this.patternFeatures.push(w)}else this.addFeature(f,_,x,s,{});r.featureIndex.insert(t[x].feature,_,x,v,this.index)}}update(t,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,s)}addFeatures(t,r,s){for(let l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ju),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),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(t,r,s,l,u){for(let d of Fs(r,500)){let f=0;for(let M of d)f+=M.length;let _=this.segments.prepareSegment(f,this.layoutVertexArray,this.indexArray),x=_.vertexLength,v=[],w=[];for(let M of d){if(M.length===0)continue;M!==d[0]&&w.push(v.length/2);let k=this.segments2.prepareSegment(M.length,this.layoutVertexArray,this.indexArray2),z=k.vertexLength;this.layoutVertexArray.emplaceBack(M[0].x,M[0].y),this.indexArray2.emplaceBack(z+M.length-1,z),v.push(M[0].x),v.push(M[0].y);for(let F=1;F>3}if(l--,s===1||s===2)u+=i.readSVarint(),d+=i.readSVarint(),s===1&&(t&&f.push(t),t=[]),t.push(new dd(u,d));else{if(s!==7)throw new Error("unknown command "+s);t&&t.push(t[0].clone())}}return t&&f.push(t),f},fa.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var t=i.readVarint()+i.pos,r=1,s=0,l=0,u=0,d=1/0,f=-1/0,_=1/0,x=-1/0;i.pos>3}if(s--,r===1||r===2)(l+=i.readSVarint())f&&(f=l),(u+=i.readSVarint())<_&&(_=u),u>x&&(x=u);else if(r!==7)throw new Error("unknown command "+r)}return[d,_,f,x]},fa.prototype.toGeoJSON=function(i,t,r){var s,l,u=this.extent*Math.pow(2,r),d=this.extent*i,f=this.extent*t,_=this.loadGeometry(),x=fa.types[this.type];function v(M){for(var k=0;k>3;l=d===1?s.readString():d===2?s.readFloat():d===3?s.readDouble():d===4?s.readVarint64():d===5?s.readVarint():d===6?s.readSVarint():d===7?s.readBoolean():null}return l}(r))}Ih.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var t=this._pbf.readVarint()+this._pbf.pos;return new md(this._pbf,t,this.extent,this._keys,this._values)};var gd=Sh;function yd(i,t,r){if(i===3){var s=new gd(r,r.readVarint()+r.pos);s.length&&(t[s.name]=s)}}Nn.VectorTile=function(i,t){this.layers=i.readFields(yd,{},t)},Nn.VectorTileFeature=Th,Nn.VectorTileLayer=Sh;let xd=Nn.VectorTileFeature.types,wc=Math.pow(2,13);function bo(i,t,r,s,l,u,d,f){i.emplaceBack(t,r,2*Math.floor(s*wc)+d,l*wc*2,u*wc*2,Math.round(f))}class Tc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Ln,this.centroidVertexArray=new Nt,this.indexArray=new ji,this.programConfigurations=new xs(t.layers,t.zoom),this.segments=new We,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,s){this.features=[],this.hasPattern=xc("fill-extrusion",this.layers,r);for(let{feature:l,id:u,index:d,sourceLayerIndex:f}of t){let _=this.layers[0]._featureFilter.needGeometry,x=bs(l,_);if(!this.layers[0]._featureFilter.filter(new dt(this.zoom),x,s))continue;let v={id:u,sourceLayerIndex:f,index:d,geometry:_?x.geometry:vs(l),properties:l.properties,type:l.type,patterns:{}};this.hasPattern?this.features.push(vc("fill-extrusion",this.layers,v,this.zoom,r)):this.addFeature(v,v.geometry,d,s,{}),r.featureIndex.insert(l,v.geometry,d,f,this.index,!0)}}addFeatures(t,r,s){for(let l of this.features){let{geometry:u}=l;this.addFeature(l,u,l.index,r,s)}}update(t,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ud),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,hd.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,r,s,l,u){for(let d of Fs(r,500)){let f={x:0,y:0,vertexCount:0},_=0;for(let k of d)_+=k.length;let x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let k of d){if(k.length===0||bd(k))continue;let z=0;for(let F=0;F=1){let Q=k[F-1];if(!vd(j,Q)){x.vertexLength+4>We.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let G=j.sub(Q)._perp()._unit(),J=Q.dist(j);z+J>32768&&(z=0),bo(this.layoutVertexArray,j.x,j.y,G.x,G.y,0,0,z),bo(this.layoutVertexArray,j.x,j.y,G.x,G.y,0,1,z),f.x+=2*j.x,f.y+=2*j.y,f.vertexCount+=2,z+=J,bo(this.layoutVertexArray,Q.x,Q.y,G.x,G.y,0,0,z),bo(this.layoutVertexArray,Q.x,Q.y,G.x,G.y,0,1,z),f.x+=2*Q.x,f.y+=2*Q.y,f.vertexCount+=2;let re=x.vertexLength;this.indexArray.emplaceBack(re,re+2,re+1),this.indexArray.emplaceBack(re+1,re+2,re+3),x.vertexLength+=4,x.primitiveLength+=2}}}}if(x.vertexLength+_>We.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(_,this.layoutVertexArray,this.indexArray)),xd[t.type]!=="Polygon")continue;let v=[],w=[],I=x.vertexLength;for(let k of d)if(k.length!==0){k!==d[0]&&w.push(v.length/2);for(let z=0;zMt)||i.y===t.y&&(i.y<0||i.y>Mt)}function bd(i){return i.every(t=>t.x<0)||i.every(t=>t.x>Mt)||i.every(t=>t.y<0)||i.every(t=>t.y>Mt)}let Ph;Ie("FillExtrusionBucket",Tc,{omit:["layers","features"]});var wd={get paint(){return Ph=Ph||new h({"fill-extrusion-opacity":new Ae(ie["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Re(ie["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ae(ie["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ae(ie["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ra(ie["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Re(ie["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Re(ie["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ae(ie["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Td extends n{constructor(t){super(t,wd)}createBucket(t){return new Tc(t)}queryRadius(){return _l(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(t,r,s,l,u,d,f,_){let x=gl(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),d.angle,f),v=this.paint.get("fill-extrusion-height").evaluate(r,s),w=this.paint.get("fill-extrusion-base").evaluate(r,s),I=function(k,z,F,j){let Q=[];for(let G of k){let J=[G.x,G.y,0,1];yl(J,J,z),Q.push(new me(J[0]/J[3],J[1]/J[3]))}return Q}(x,_),M=function(k,z,F,j){let Q=[],G=[],J=j[8]*z,re=j[9]*z,ce=j[10]*z,we=j[11]*z,Le=j[8]*F,ve=j[9]*F,ye=j[10]*F,ke=j[11]*F;for(let Pe of k){let Se=[],ae=[];for(let ze of Pe){let Ce=ze.x,Oe=ze.y,ct=j[0]*Ce+j[4]*Oe+j[12],lt=j[1]*Ce+j[5]*Oe+j[13],zt=j[2]*Ce+j[6]*Oe+j[14],or=j[3]*Ce+j[7]*Oe+j[15],$t=zt+ce,Et=or+we,ai=ct+Le,oi=lt+ve,li=zt+ye,Tt=or+ke,Dt=new me((ct+J)/Et,(lt+re)/Et);Dt.z=$t/Et,Se.push(Dt);let Yt=new me(ai/Tt,oi/Tt);Yt.z=li/Tt,ae.push(Yt)}Q.push(Se),G.push(ae)}return[Q,G]}(l,w,v,_);return function(k,z,F){let j=1/0;nh(F,z)&&(j=Ah(F,z[0]));for(let Q=0;Qr.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new sa,this.layoutVertexArray2=new Rn,this.indexArray=new ji,this.programConfigurations=new xs(t.layers,t.zoom),this.segments=new We,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,s){this.hasPattern=xc("line",this.layers,r);let l=this.layers[0].layout.get("line-sort-key"),u=!l.isConstant(),d=[];for(let{feature:f,id:_,index:x,sourceLayerIndex:v}of t){let w=this.layers[0]._featureFilter.needGeometry,I=bs(f,w);if(!this.layers[0]._featureFilter.filter(new dt(this.zoom),I,s))continue;let M=u?l.evaluate(I,{},s):void 0,k={id:_,properties:f.properties,type:f.type,sourceLayerIndex:v,index:x,geometry:w?I.geometry:vs(f),patterns:{},sortKey:M};d.push(k)}u&&d.sort((f,_)=>f.sortKey-_.sortKey);for(let f of d){let{geometry:_,index:x,sourceLayerIndex:v}=f;if(this.hasPattern){let w=vc("line",this.layers,f,this.zoom,r);this.patternFeatures.push(w)}else this.addFeature(f,_,x,s,{});r.featureIndex.insert(t[x].feature,_,x,v,this.index)}}update(t,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,s)}addFeatures(t,r,s){for(let l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Ad)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Id),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,r,s,l,u){let d=this.layers[0].layout,f=d.get("line-join").evaluate(t,{}),_=d.get("line-cap"),x=d.get("line-miter-limit"),v=d.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(let w of r)this.addLine(w,t,f,_,x,v);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,s,u,l)}addLine(t,r,s,l,u,d){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let j=0;j=2&&t[_-1].equals(t[_-2]);)_--;let x=0;for(;x<_-1&&t[x].equals(t[x+1]);)x++;if(_<(f?3:2))return;s==="bevel"&&(u=1.05);let v=this.overscaling<=16?15*Mt/(512*this.overscaling):0,w=this.segments.prepareSegment(10*_,this.layoutVertexArray,this.indexArray),I,M,k,z,F;this.e1=this.e2=-1,f&&(I=t[_-2],F=t[x].sub(I)._unit()._perp());for(let j=x;j<_;j++){if(k=j===_-1?f?t[x+1]:void 0:t[j+1],k&&t[j].equals(k))continue;F&&(z=F),I&&(M=I),I=t[j],F=k?k.sub(I)._unit()._perp():z,z=z||F;let Q=z.add(F);Q.x===0&&Q.y===0||Q._unit();let G=z.x*F.x+z.y*F.y,J=Q.x*F.x+Q.y*F.y,re=J!==0?1/J:1/0,ce=2*Math.sqrt(2-2*J),we=J0;if(we&&j>x){let ke=I.dist(M);if(ke>2*v){let Pe=I.sub(I.sub(M)._mult(v/ke)._round());this.updateDistance(M,Pe),this.addCurrentVertex(Pe,z,0,0,w),M=Pe}}let ve=M&&k,ye=ve?s:f?"butt":l;if(ve&&ye==="round"&&(reu&&(ye="bevel"),ye==="bevel"&&(re>2&&(ye="flipbevel"),re100)Q=F.mult(-1);else{let ke=re*z.add(F).mag()/z.sub(F).mag();Q._perp()._mult(ke*(Le?-1:1))}this.addCurrentVertex(I,Q,0,0,w),this.addCurrentVertex(I,Q.mult(-1),0,0,w)}else if(ye==="bevel"||ye==="fakeround"){let ke=-Math.sqrt(re*re-1),Pe=Le?ke:0,Se=Le?0:ke;if(M&&this.addCurrentVertex(I,z,Pe,Se,w),ye==="fakeround"){let ae=Math.round(180*ce/Math.PI/20);for(let ze=1;ze2*v){let Pe=I.add(k.sub(I)._mult(v/ke)._round());this.updateDistance(I,Pe),this.addCurrentVertex(Pe,F,0,0,w),I=Pe}}}}addCurrentVertex(t,r,s,l,u,d=!1){let f=r.y*l-r.x,_=-r.y-r.x*l;this.addHalfVertex(t,r.x+r.y*s,r.y-r.x*s,d,!1,s,u),this.addHalfVertex(t,f,_,d,!0,-l,u),this.distance>Mh/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,r,s,l,u,d))}addHalfVertex({x:t,y:r},s,l,u,d,f,_){let x=.5*(this.lineClips?this.scaledDistance*(Mh-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(u?1:0),(r<<1)+(d?1:0),Math.round(63*s)+128,Math.round(63*l)+128,1+(f===0?0:f<0?-1:1)|(63&x)<<2,x>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);let v=_.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,v),_.primitiveLength++),d?this.e2=v:this.e1=v}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,r){this.distance+=t.dist(r),this.updateScaledDistance()}}let Ch,kh;Ie("LineBucket",Sc,{omit:["layers","patternFeatures"]});var zh={get paint(){return kh=kh||new h({"line-opacity":new Re(ie.paint_line["line-opacity"]),"line-color":new Re(ie.paint_line["line-color"]),"line-translate":new Ae(ie.paint_line["line-translate"]),"line-translate-anchor":new Ae(ie.paint_line["line-translate-anchor"]),"line-width":new Re(ie.paint_line["line-width"]),"line-gap-width":new Re(ie.paint_line["line-gap-width"]),"line-offset":new Re(ie.paint_line["line-offset"]),"line-blur":new Re(ie.paint_line["line-blur"]),"line-dasharray":new na(ie.paint_line["line-dasharray"]),"line-pattern":new ra(ie.paint_line["line-pattern"]),"line-gradient":new uo(ie.paint_line["line-gradient"])})},get layout(){return Ch=Ch||new h({"line-cap":new Ae(ie.layout_line["line-cap"]),"line-join":new Re(ie.layout_line["line-join"]),"line-miter-limit":new Ae(ie.layout_line["line-miter-limit"]),"line-round-limit":new Ae(ie.layout_line["line-round-limit"]),"line-sort-key":new Re(ie.layout_line["line-sort-key"])})}};class kd extends Re{possiblyEvaluate(t,r){return r=new dt(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(t,r)}evaluate(t,r,s,l){return r=vi({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(t,r,s,l)}}let wl;class zd extends n{constructor(t){super(t,zh),this.gradientVersion=0,wl||(wl=new kd(zh.paint.properties["line-width"].specification),wl.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){let r=this.gradientExpression();this.stepInterpolant=!!function(s){return s._styleExpression!==void 0}(r)&&r._styleExpression.expression instanceof mn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,r){super.recalculate(t,r),this.paint._values["line-floorwidth"]=wl.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Sc(t)}queryRadius(t){let r=t,s=Eh(mo("line-width",this,r),mo("line-gap-width",this,r)),l=mo("line-offset",this,r);return s/2+Math.abs(l)+_l(this.paint.get("line-translate"))}queryIntersectsFeature(t,r,s,l,u,d,f){let _=gl(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),d.angle,f),x=f/2*Eh(this.paint.get("line-width").evaluate(r,s),this.paint.get("line-gap-width").evaluate(r,s)),v=this.paint.get("line-offset").evaluate(r,s);return v&&(l=function(w,I){let M=[];for(let k=0;k=3){for(let F=0;F0?t+2*i:i}let Ed=m([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Dd=m([{name:"a_projected_pos",components:3,type:"Float32"}],4);m([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let Ld=m([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);m([{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"}]);let Dh=m([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Rd=m([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Bd(i,t,r){return i.sections.forEach(s=>{s.text=function(l,u,d){let f=u.layout.get("text-transform").evaluate(d,{});return f==="uppercase"?l=l.toLocaleUpperCase():f==="lowercase"&&(l=l.toLocaleLowerCase()),_i.applyArabicShaping&&(l=_i.applyArabicShaping(l)),l}(s.text,t,r)}),i}m([{name:"triangle",components:3,type:"Uint16"}]),m([{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"}]),m([{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"}]),m([{type:"Float32",name:"offsetX"}]),m([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),m([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);let To={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"};var Ct=24,Lh=ot,Rh=function(i,t,r,s,l){var u,d,f=8*l-s-1,_=(1<>1,v=-7,w=r?l-1:0,I=r?-1:1,M=i[t+w];for(w+=I,u=M&(1<<-v)-1,M>>=-v,v+=f;v>0;u=256*u+i[t+w],w+=I,v-=8);for(d=u&(1<<-v)-1,u>>=-v,v+=s;v>0;d=256*d+i[t+w],w+=I,v-=8);if(u===0)u=1-x;else{if(u===_)return d?NaN:1/0*(M?-1:1);d+=Math.pow(2,s),u-=x}return(M?-1:1)*d*Math.pow(2,u-s)},Bh=function(i,t,r,s,l,u){var d,f,_,x=8*u-l-1,v=(1<>1,I=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=s?0:u-1,k=s?1:-1,z=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(f=isNaN(t)?1:0,d=v):(d=Math.floor(Math.log(t)/Math.LN2),t*(_=Math.pow(2,-d))<1&&(d--,_*=2),(t+=d+w>=1?I/_:I*Math.pow(2,1-w))*_>=2&&(d++,_/=2),d+w>=v?(f=0,d=v):d+w>=1?(f=(t*_-1)*Math.pow(2,l),d+=w):(f=t*Math.pow(2,w-1)*Math.pow(2,l),d=0));l>=8;i[r+M]=255&f,M+=k,f/=256,l-=8);for(d=d<0;i[r+M]=255&d,M+=k,d/=256,x-=8);i[r+M-k]|=128*z};function ot(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}ot.Varint=0,ot.Fixed64=1,ot.Bytes=2,ot.Fixed32=5;var Ic=4294967296,Fh=1/Ic,Oh=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function rn(i){return i.type===ot.Bytes?i.readVarint()+i.pos:i.pos+1}function ma(i,t,r){return r?4294967296*t+(i>>>0):4294967296*(t>>>0)+(i>>>0)}function Vh(i,t,r){var s=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));r.realloc(s);for(var l=r.pos-1;l>=i;l--)r.buf[l+s]=r.buf[l]}function Fd(i,t){for(var r=0;r>>8,i[r+2]=t>>>16,i[r+3]=t>>>24}function Nh(i,t){return(i[t]|i[t+1]<<8|i[t+2]<<16)+(i[t+3]<<24)}ot.prototype={destroy:function(){this.buf=null},readFields:function(i,t,r){for(r=r||this.length;this.pos>3,u=this.pos;this.type=7&s,i(l,t,this),this.pos===u&&this.skip(s)}return t},readMessage:function(i,t){return this.readFields(i,t,this.readVarint()+this.pos)},readFixed32:function(){var i=Tl(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=Nh(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=Tl(this.buf,this.pos)+Tl(this.buf,this.pos+4)*Ic;return this.pos+=8,i},readSFixed64:function(){var i=Tl(this.buf,this.pos)+Nh(this.buf,this.pos+4)*Ic;return this.pos+=8,i},readFloat:function(){var i=Rh(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Rh(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var t,r,s=this.buf;return t=127&(r=s[this.pos++]),r<128?t:(t|=(127&(r=s[this.pos++]))<<7,r<128?t:(t|=(127&(r=s[this.pos++]))<<14,r<128?t:(t|=(127&(r=s[this.pos++]))<<21,r<128?t:function(l,u,d){var f,_,x=d.buf;if(f=(112&(_=x[d.pos++]))>>4,_<128||(f|=(127&(_=x[d.pos++]))<<3,_<128)||(f|=(127&(_=x[d.pos++]))<<10,_<128)||(f|=(127&(_=x[d.pos++]))<<17,_<128)||(f|=(127&(_=x[d.pos++]))<<24,_<128)||(f|=(1&(_=x[d.pos++]))<<31,_<128))return ma(l,f,u);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(r=s[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var i=this.readVarint()+this.pos,t=this.pos;return this.pos=i,i-t>=12&&Oh?function(r,s,l){return Oh.decode(r.subarray(s,l))}(this.buf,t,i):function(r,s,l){for(var u="",d=s;d239?4:v>223?3:v>191?2:1;if(d+I>l)break;I===1?v<128&&(w=v):I===2?(192&(f=r[d+1]))==128&&(w=(31&v)<<6|63&f)<=127&&(w=null):I===3?(_=r[d+2],(192&(f=r[d+1]))==128&&(192&_)==128&&((w=(15&v)<<12|(63&f)<<6|63&_)<=2047||w>=55296&&w<=57343)&&(w=null)):I===4&&(_=r[d+2],x=r[d+3],(192&(f=r[d+1]))==128&&(192&_)==128&&(192&x)==128&&((w=(15&v)<<18|(63&f)<<12|(63&_)<<6|63&x)<=65535||w>=1114112)&&(w=null)),w===null?(w=65533,I=1):w>65535&&(w-=65536,u+=String.fromCharCode(w>>>10&1023|55296),w=56320|1023&w),u+=String.fromCharCode(w),d+=I}return u}(this.buf,t,i)},readBytes:function(){var i=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,i);return this.pos=i,t},readPackedVarint:function(i,t){if(this.type!==ot.Bytes)return i.push(this.readVarint(t));var r=rn(this);for(i=i||[];this.pos127;);else if(t===ot.Bytes)this.pos=this.readVarint()+this.pos;else if(t===ot.Fixed32)this.pos+=4;else{if(t!==ot.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(i,t){this.writeVarint(i<<3|t)},realloc:function(i){for(var t=this.length||16;t268435455||i<0?function(t,r){var s,l;if(t>=0?(s=t%4294967296|0,l=t/4294967296|0):(l=~(-t/4294967296),4294967295^(s=~(-t%4294967296))?s=s+1|0:(s=0,l=l+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(u,d,f){f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,f.buf[f.pos]=127&(u>>>=7)}(s,0,r),function(u,d){var f=(7&u)<<4;d.buf[d.pos++]|=f|((u>>>=3)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u)))))}(l,r)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(!!i)},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var t=this.pos;this.pos=function(s,l,u){for(var d,f,_=0;_55295&&d<57344){if(!f){d>56319||_+1===l.length?(s[u++]=239,s[u++]=191,s[u++]=189):f=d;continue}if(d<56320){s[u++]=239,s[u++]=191,s[u++]=189,f=d;continue}d=f-55296<<10|d-56320|65536,f=null}else f&&(s[u++]=239,s[u++]=191,s[u++]=189,f=null);d<128?s[u++]=d:(d<2048?s[u++]=d>>6|192:(d<65536?s[u++]=d>>12|224:(s[u++]=d>>18|240,s[u++]=d>>12&63|128),s[u++]=d>>6&63|128),s[u++]=63&d|128)}return u}(this.buf,i,this.pos);var r=this.pos-t;r>=128&&Vh(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Bh(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Bh(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var t=i.length;this.writeVarint(t),this.realloc(t);for(var r=0;r=128&&Vh(r,s,this),this.pos=r-1,this.writeVarint(s),this.pos+=s},writeMessage:function(i,t,r){this.writeTag(i,ot.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(i,t){t.length&&this.writeMessage(i,Fd,t)},writePackedSVarint:function(i,t){t.length&&this.writeMessage(i,Od,t)},writePackedBoolean:function(i,t){t.length&&this.writeMessage(i,jd,t)},writePackedFloat:function(i,t){t.length&&this.writeMessage(i,Vd,t)},writePackedDouble:function(i,t){t.length&&this.writeMessage(i,Nd,t)},writePackedFixed32:function(i,t){t.length&&this.writeMessage(i,Ud,t)},writePackedSFixed32:function(i,t){t.length&&this.writeMessage(i,$d,t)},writePackedFixed64:function(i,t){t.length&&this.writeMessage(i,qd,t)},writePackedSFixed64:function(i,t){t.length&&this.writeMessage(i,Zd,t)},writeBytesField:function(i,t){this.writeTag(i,ot.Bytes),this.writeBytes(t)},writeFixed32Field:function(i,t){this.writeTag(i,ot.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(i,t){this.writeTag(i,ot.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(i,t){this.writeTag(i,ot.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(i,t){this.writeTag(i,ot.Fixed64),this.writeSFixed64(t)},writeVarintField:function(i,t){this.writeTag(i,ot.Varint),this.writeVarint(t)},writeSVarintField:function(i,t){this.writeTag(i,ot.Varint),this.writeSVarint(t)},writeStringField:function(i,t){this.writeTag(i,ot.Bytes),this.writeString(t)},writeFloatField:function(i,t){this.writeTag(i,ot.Fixed32),this.writeFloat(t)},writeDoubleField:function(i,t){this.writeTag(i,ot.Fixed64),this.writeDouble(t)},writeBooleanField:function(i,t){this.writeVarintField(i,!!t)}};var Pc=ki(Lh);let Ac=3;function Gd(i,t,r){i===1&&r.readMessage(Hd,t)}function Hd(i,t,r){if(i===3){let{id:s,bitmap:l,width:u,height:d,left:f,top:_,advance:x}=r.readMessage(Xd,{});t.push({id:s,bitmap:new go({width:u+2*Ac,height:d+2*Ac},l),metrics:{width:u,height:d,left:f,top:_,advance:x}})}}function Xd(i,t,r){i===1?t.id=r.readVarint():i===2?t.bitmap=r.readBytes():i===3?t.width=r.readVarint():i===4?t.height=r.readVarint():i===5?t.left=r.readSVarint():i===6?t.top=r.readSVarint():i===7&&(t.advance=r.readVarint())}let jh=Ac;function Uh(i){let t=0,r=0;for(let d of i)t+=d.w*d.h,r=Math.max(r,d.w);i.sort((d,f)=>f.h-d.h);let s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}],l=0,u=0;for(let d of i)for(let f=s.length-1;f>=0;f--){let _=s[f];if(!(d.w>_.w||d.h>_.h)){if(d.x=_.x,d.y=_.y,u=Math.max(u,d.y+d.h),l=Math.max(l,d.x+d.w),d.w===_.w&&d.h===_.h){let x=s.pop();f=0&&s>=t&&Il[this.text.charCodeAt(s)];s--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)}substring(t,r){let s=new ga;return s.text=this.text.substring(t,r),s.sectionIndex=this.sectionIndex.slice(t,r),s.sections=this.sections,s}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,r)=>Math.max(t,this.sections[r].scale),0)}addTextSection(t,r){this.text+=t.text,this.sections.push(Io.forText(t.scale,t.fontStack||r));let s=this.sections.length-1;for(let l=0;l=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Sl(i,t,r,s,l,u,d,f,_,x,v,w,I,M,k){let z=ga.fromFeature(i,l),F;w===L.ah.vertical&&z.verticalizePunctuation();let{processBidirectionalText:j,processStyledBidirectionalText:Q}=_i;if(j&&z.sections.length===1){F=[];let re=j(z.toString(),Cc(z,x,u,t,s,M));for(let ce of re){let we=new ga;we.text=ce,we.sections=z.sections;for(let Le=0;Le0&&nn>Zt&&(Zt=nn)}else{let Zi=we[Qe.fontStack],Bt=Zi&&Zi[_t];if(Bt&&Bt.rect)ba=Bt.rect,vt=Bt.metrics;else{let nn=ce[Qe.fontStack],zo=nn&&nn[_t];if(!zo)continue;vt=zo.metrics}Ci=(Dt-Qe.scale)*Ct}lr?(re.verticalizable=!0,ci.push({glyph:_t,imageName:Dr,x:Oe,y:ct+Ci,vertical:lr,scale:Qe.scale,fontStack:Qe.fontStack,sectionIndex:ut,metrics:vt,rect:ba}),Oe+=Lr*Qe.scale+ae):(ci.push({glyph:_t,imageName:Dr,x:Oe,y:ct+Ci,vertical:lr,scale:Qe.scale,fontStack:Qe.fontStack,sectionIndex:ut,metrics:vt,rect:ba}),Oe+=vt.advance*Qe.scale+ae)}ci.length!==0&&(lt=Math.max(Oe-ae,lt),Yd(ci,0,ci.length-1,or,Zt)),Oe=0;let qi=ye*Dt+Zt;qt.lineOffset=Math.max(Zt,Yt),ct+=qi,zt=Math.max(qi,zt),++$t}var Et;let ai=ct-So,{horizontalAlign:oi,verticalAlign:li}=kc(ke);(function(Tt,Dt,Yt,qt,ci,Zt,qi,xi,Qe){let ut=(Dt-Yt)*ci,_t=0;_t=Zt!==qi?-xi*qt-So:(-qt*Qe+.5)*qi;for(let Ci of Tt)for(let vt of Ci.positionedGlyphs)vt.x+=ut,vt.y+=_t})(re.positionedLines,or,oi,li,lt,zt,ye,ai,ve.length),re.top+=-li*ai,re.bottom=re.top+ai,re.left+=-oi*lt,re.right=re.left+lt}(J,t,r,s,F,d,f,_,w,x,I,k),!function(re){for(let ce of re)if(ce.positionedGlyphs.length!==0)return!1;return!0}(G)&&J}let Il={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Wd={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},Kd={40:!0};function qh(i,t,r,s,l,u){if(t.imageName){let d=s[t.imageName];return d?d.displaySize[0]*t.scale*Ct/u+l:0}{let d=r[t.fontStack],f=d&&d[i];return f?f.metrics.advance*t.scale+l:0}}function Zh(i,t,r,s){let l=Math.pow(i-t,2);return s?i=0,x=0;for(let w=0;wx){let v=Math.ceil(u/x);l*=v/d,d=v}return{x1:s,y1:l,x2:s+u,y2:l+d}}function Wh(i,t,r,s,l,u){let d=i.image,f;if(d.content){let F=d.content,j=d.pixelRatio||1;f=[F[0]/j,F[1]/j,d.displaySize[0]-F[2]/j,d.displaySize[1]-F[3]/j]}let _=t.left*u,x=t.right*u,v,w,I,M;r==="width"||r==="both"?(M=l[0]+_-s[3],w=l[0]+x+s[1]):(M=l[0]+(_+x-d.displaySize[0])/2,w=M+d.displaySize[0]);let k=t.top*u,z=t.bottom*u;return r==="height"||r==="both"?(v=l[1]+k-s[0],I=l[1]+z+s[2]):(v=l[1]+(k+z-d.displaySize[1])/2,I=v+d.displaySize[1]),{image:d,top:v,right:w,bottom:I,left:M,collisionPadding:f}}let Po=255,Er=128,Un=Po*Er;function Kh(i,t){let{expression:r}=t;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new dt(i+1))};if(r.kind==="source")return{kind:"source"};{let{zoomStops:s,interpolationType:l}=r,u=0;for(;ud.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=pc([]),this.placementViewportMatrix=pc([]);let r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Kh(this.zoom,r["text-size"]),this.iconSizeData=Kh(this.zoom,r["icon-size"]);let s=this.layers[0].layout,l=s.get("symbol-sort-key"),u=s.get("symbol-z-order");this.canOverlap=zc(s,"text-overlap","text-allow-overlap")!=="never"||zc(s,"icon-overlap","icon-allow-overlap")!=="never"||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=u!=="viewport-y"&&!l.isConstant(),this.sortFeaturesByY=(u==="viewport-y"||u==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,s.get("symbol-placement")==="point"&&(this.writingModes=s.get("text-writing-mode").map(d=>L.ah[d])),this.stateDependentLayerIds=this.layers.filter(d=>d.isStateDependent()).map(d=>d.id),this.sourceID=t.sourceID}createArrays(){this.text=new Dc(new xs(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new Dc(new xs(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new ft,this.lineVertexArray=new Vt,this.symbolInstances=new He,this.textAnchorOffsets=new mt}calculateGlyphDependencies(t,r,s,l,u){for(let d=0;d0)&&(d.value.kind!=="constant"||d.value.value.length>0),v=_.value.kind!=="constant"||!!_.value.value||Object.keys(_.parameters).length>0,w=u.get("symbol-sort-key");if(this.features=[],!x&&!v)return;let I=r.iconDependencies,M=r.glyphDependencies,k=r.availableImages,z=new dt(this.zoom);for(let{feature:F,id:j,index:Q,sourceLayerIndex:G}of t){let J=l._featureFilter.needGeometry,re=bs(F,J);if(!l._featureFilter.filter(z,re,s))continue;let ce,we;if(J||(re.geometry=vs(F)),x){let ve=l.getValueAndResolveTokens("text-field",re,s,k),ye=di.factory(ve),ke=this.hasRTLText=this.hasRTLText||ip(ye);(!ke||_i.getRTLTextPluginStatus()==="unavailable"||ke&&_i.isParsed())&&(ce=Bd(ye,l,re))}if(v){let ve=l.getValueAndResolveTokens("icon-image",re,s,k);we=ve instanceof fi?ve:fi.fromString(ve)}if(!ce&&!we)continue;let Le=this.sortFeaturesByKey?w.evaluate(re,{},s):void 0;if(this.features.push({id:j,text:ce,icon:we,index:Q,sourceLayerIndex:G,geometry:re.geometry,properties:F.properties,type:ep[F.type],sortKey:Le}),we&&(I[we.name]=!0),ce){let ve=d.evaluate(re,{},s).join(","),ye=u.get("text-rotation-alignment")!=="viewport"&&u.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(L.ah.vertical)>=0;for(let ke of ce.sections)if(ke.image)I[ke.image.name]=!0;else{let Pe=oo(ce.toString()),Se=ke.fontStack||ve,ae=M[Se]=M[Se]||{};this.calculateGlyphDependencies(ke.text,ae,ye,this.allowVerticalPlacement,Pe)}}}u.get("symbol-placement")==="line"&&(this.features=function(F){let j={},Q={},G=[],J=0;function re(ve){G.push(F[ve]),J++}function ce(ve,ye,ke){let Pe=Q[ve];return delete Q[ve],Q[ye]=Pe,G[Pe].geometry[0].pop(),G[Pe].geometry[0]=G[Pe].geometry[0].concat(ke[0]),Pe}function we(ve,ye,ke){let Pe=j[ye];return delete j[ye],j[ve]=Pe,G[Pe].geometry[0].shift(),G[Pe].geometry[0]=ke[0].concat(G[Pe].geometry[0]),Pe}function Le(ve,ye,ke){let Pe=ke?ye[0][ye[0].length-1]:ye[0][0];return`${ve}:${Pe.x}:${Pe.y}`}for(let ve=0;veve.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((F,j)=>F.sortKey-j.sortKey)}update(t,r,s){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,r,this.layers,s),this.icon.programConfigurations.updatePaintArrays(t,r,this.layers,s))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,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(t,r){let s=this.lineVertexArray.length;if(t.segment!==void 0){let l=t.dist(r[t.segment+1]),u=t.dist(r[t.segment]),d={};for(let f=t.segment+1;f=0;f--)d[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:u},f>0&&(u+=r[f-1].dist(r[f]));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(t,r){let s=t.placedSymbolArray.get(r),l=s.vertexStartIndex+4*s.numGlyphs;for(let u=s.vertexStartIndex;ul[f]-l[_]||u[_]-u[f]),d}addToSortKeyRanges(t,r){let s=this.sortKeyRanges[this.sortKeyRanges.length-1];s&&s.sortKey===r?s.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let r of this.symbolInstanceIndexes){let s=this.symbolInstances.get(r);this.featureSortOrder.push(s.featureIndex),[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex].forEach((l,u,d)=>{l>=0&&d.indexOf(l)===u&&this.addIndicesForPlacedSymbol(this.text,l)}),s.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,s.verticalPlacedTextSymbolIndex),s.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.placedIconSymbolIndex),s.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Jh,Yh;Ie("SymbolBucket",ya,{omit:["layers","collisionBoxArray","features","compareText"]}),ya.MAX_GLYPHS=65535,ya.addDynamicAttributes=Ec;var Rc={get paint(){return Yh=Yh||new h({"icon-opacity":new Re(ie.paint_symbol["icon-opacity"]),"icon-color":new Re(ie.paint_symbol["icon-color"]),"icon-halo-color":new Re(ie.paint_symbol["icon-halo-color"]),"icon-halo-width":new Re(ie.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Re(ie.paint_symbol["icon-halo-blur"]),"icon-translate":new Ae(ie.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ae(ie.paint_symbol["icon-translate-anchor"]),"text-opacity":new Re(ie.paint_symbol["text-opacity"]),"text-color":new Re(ie.paint_symbol["text-color"],{runtimeType:ti,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new Re(ie.paint_symbol["text-halo-color"]),"text-halo-width":new Re(ie.paint_symbol["text-halo-width"]),"text-halo-blur":new Re(ie.paint_symbol["text-halo-blur"]),"text-translate":new Ae(ie.paint_symbol["text-translate"]),"text-translate-anchor":new Ae(ie.paint_symbol["text-translate-anchor"])})},get layout(){return Jh=Jh||new h({"symbol-placement":new Ae(ie.layout_symbol["symbol-placement"]),"symbol-spacing":new Ae(ie.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ae(ie.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Re(ie.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ae(ie.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ae(ie.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ae(ie.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ae(ie.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ae(ie.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ae(ie.layout_symbol["icon-rotation-alignment"]),"icon-size":new Re(ie.layout_symbol["icon-size"]),"icon-text-fit":new Ae(ie.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ae(ie.layout_symbol["icon-text-fit-padding"]),"icon-image":new Re(ie.layout_symbol["icon-image"]),"icon-rotate":new Re(ie.layout_symbol["icon-rotate"]),"icon-padding":new Re(ie.layout_symbol["icon-padding"]),"icon-keep-upright":new Ae(ie.layout_symbol["icon-keep-upright"]),"icon-offset":new Re(ie.layout_symbol["icon-offset"]),"icon-anchor":new Re(ie.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ae(ie.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ae(ie.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ae(ie.layout_symbol["text-rotation-alignment"]),"text-field":new Re(ie.layout_symbol["text-field"]),"text-font":new Re(ie.layout_symbol["text-font"]),"text-size":new Re(ie.layout_symbol["text-size"]),"text-max-width":new Re(ie.layout_symbol["text-max-width"]),"text-line-height":new Ae(ie.layout_symbol["text-line-height"]),"text-letter-spacing":new Re(ie.layout_symbol["text-letter-spacing"]),"text-justify":new Re(ie.layout_symbol["text-justify"]),"text-radial-offset":new Re(ie.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ae(ie.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Re(ie.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Re(ie.layout_symbol["text-anchor"]),"text-max-angle":new Ae(ie.layout_symbol["text-max-angle"]),"text-writing-mode":new Ae(ie.layout_symbol["text-writing-mode"]),"text-rotate":new Re(ie.layout_symbol["text-rotate"]),"text-padding":new Ae(ie.layout_symbol["text-padding"]),"text-keep-upright":new Ae(ie.layout_symbol["text-keep-upright"]),"text-transform":new Re(ie.layout_symbol["text-transform"]),"text-offset":new Re(ie.layout_symbol["text-offset"]),"text-allow-overlap":new Ae(ie.layout_symbol["text-allow-overlap"]),"text-overlap":new Ae(ie.layout_symbol["text-overlap"]),"text-ignore-placement":new Ae(ie.layout_symbol["text-ignore-placement"]),"text-optional":new Ae(ie.layout_symbol["text-optional"])})}};class Qh{constructor(t){if(t.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:Pr,this.defaultValue=t}evaluate(t){if(t.formattedSection){let r=this.defaultValue.property.overrides;if(r&&r.hasOverride(t.formattedSection))return r.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Ie("FormatSectionOverride",Qh,{omit:["defaultValue"]});class Al extends n{constructor(t){super(t,Rc)}recalculate(t,r){if(super.recalculate(t,r),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"){let s=this.layout.get("text-writing-mode");if(s){let l=[];for(let u of s)l.indexOf(u)<0&&l.push(u);this.layout._values["text-writing-mode"]=l}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,r,s,l){let u=this.layout.get(t).evaluate(r,{},s,l),d=this._unevaluatedLayout._values[t];return d.isDataDriven()||Zs(d.value)||!u?u:function(f,_){return _.replace(/{([^{}]+)}/g,(x,v)=>f&&v in f?String(f[v]):"")}(r.properties,u)}createBucket(t){return new ya(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let t of Rc.paint.overridableProperties){if(!Al.hasPaintOverride(this.layout,t))continue;let r=this.paint.get(t),s=new Qh(r),l=new qs(s,r.property.specification),u=null;u=r.value.kind==="constant"||r.value.kind==="source"?new Sn("source",l):new In("composite",l,r.value.zoomStops),this.paint._values[t]=new sr(r.property,u,r.parameters)}}_handleOverridablePaintPropertyUpdate(t,r,s){return!(!this.layout||r.isDataDriven()||s.isDataDriven())&&Al.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,r){let s=t.get("text-field"),l=Rc.paint.properties[r],u=!1,d=f=>{for(let _ of f)if(l.overrides&&l.overrides.hasOverride(_))return void(u=!0)};if(s.value.kind==="constant"&&s.value.value instanceof di)d(s.value.value.sections);else if(s.value.kind==="source"){let f=x=>{u||(x instanceof Ri&&At(x.value)===fr?d(x.value.sections):x instanceof Rs?d(x.sections):x.eachChild(f))},_=s.value;_._styleExpression&&f(_._styleExpression.expression)}return u}}let eu;var rp={get paint(){return eu=eu||new h({"background-color":new Ae(ie.paint_background["background-color"]),"background-pattern":new na(ie.paint_background["background-pattern"]),"background-opacity":new Ae(ie.paint_background["background-opacity"])})}};class np extends n{constructor(t){super(t,rp)}}let tu;var sp={get paint(){return tu=tu||new h({"raster-opacity":new Ae(ie.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ae(ie.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ae(ie.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ae(ie.paint_raster["raster-brightness-max"]),"raster-saturation":new Ae(ie.paint_raster["raster-saturation"]),"raster-contrast":new Ae(ie.paint_raster["raster-contrast"]),"raster-resampling":new Ae(ie.paint_raster["raster-resampling"]),"raster-fade-duration":new Ae(ie.paint_raster["raster-fade-duration"])})}};class ap extends n{constructor(t){super(t,sp)}}class op extends n{constructor(t){super(t,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=t}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 lp{constructor(t){this._methodToThrottle=t,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=()=>{}}}let Bc=63710088e-1;class $n{constructor(t,r){if(isNaN(t)||isNaN(r))throw new Error(`Invalid LngLat object: (${t}, ${r})`);if(this.lng=+t,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new $n(Wi(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){let r=Math.PI/180,s=this.lat*r,l=t.lat*r,u=Math.sin(s)*Math.sin(l)+Math.cos(s)*Math.cos(l)*Math.cos((t.lng-this.lng)*r);return Bc*Math.acos(Math.min(u,1))}static convert(t){if(t instanceof $n)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new $n(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new $n(Number("lng"in t?t.lng:t.lon),Number(t.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 [, ]")}}let iu=2*Math.PI*Bc;function ru(i){return iu*Math.cos(i*Math.PI/180)}function nu(i){return(180+i)/360}function su(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function au(i,t){return i/ru(t)}function Fc(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class Ao{constructor(t,r,s=0){this.x=+t,this.y=+r,this.z=+s}static fromLngLat(t,r=0){let s=$n.convert(t);return new Ao(nu(s.lng),su(s.lat),au(r,s.lat))}toLngLat(){return new $n(360*this.x-180,Fc(this.y))}toAltitude(){return this.z*ru(Fc(this.y))}meterInMercatorCoordinateUnits(){return 1/iu*(t=Fc(this.y),1/Math.cos(t*Math.PI/180));var t}}function ou(i,t,r){var s=2*Math.PI*6378137/256/Math.pow(2,r);return[i*s-2*Math.PI*6378137/2,t*s-2*Math.PI*6378137/2]}class Oc{constructor(t,r,s){if(!function(l,u,d){return!(l<0||l>25||d<0||d>=Math.pow(2,l)||u<0||u>=Math.pow(2,l))}(t,r,s))throw new Error(`x=${r}, y=${s}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=r,this.y=s,this.key=Mo(0,t,t,r,s)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,r,s){let l=(d=this.y,f=this.z,_=ou(256*(u=this.x),256*(d=Math.pow(2,f)-d-1),f),x=ou(256*(u+1),256*(d+1),f),_[0]+","+_[1]+","+x[0]+","+x[1]);var u,d,f,_,x;let v=function(w,I,M){let k,z="";for(let F=w;F>0;F--)k=1<1?"@2x":"").replace(/{quadkey}/g,v).replace(/{bbox-epsg-3857}/g,l)}isChildOf(t){let r=this.z-t.z;return r>0&&t.x===this.x>>r&&t.y===this.y>>r}getTilePoint(t){let r=Math.pow(2,this.z);return new me((t.x*r-this.x)*Mt,(t.y*r-this.y)*Mt)}toString(){return`${this.z}/${this.x}/${this.y}`}}class lu{constructor(t,r){this.wrap=t,this.canonical=r,this.key=Mo(t,r.z,r.z,r.x,r.y)}}class $i{constructor(t,r,s,l,u){if(t= z; overscaledZ = ${t}; z = ${s}`);this.overscaledZ=t,this.wrap=r,this.canonical=new Oc(s,+l,+u),this.key=Mo(r,t,s,l,u)}clone(){return new $i(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);let r=this.canonical.z-t;return t>this.canonical.z?new $i(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new $i(t,this.wrap,t,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(t,r){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);let s=this.canonical.z-t;return t>this.canonical.z?Mo(this.wrap*+r,t,this.canonical.z,this.canonical.x,this.canonical.y):Mo(this.wrap*+r,t,t,this.canonical.x>>s,this.canonical.y>>s)}isChildOf(t){if(t.wrap!==this.wrap)return!1;let r=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ>r&&t.canonical.y===this.canonical.y>>r}children(t){if(this.overscaledZ>=t)return[new $i(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,s=2*this.canonical.x,l=2*this.canonical.y;return[new $i(r,this.wrap,r,s,l),new $i(r,this.wrap,r,s+1,l),new $i(r,this.wrap,r,s,l+1),new $i(r,this.wrap,r,s+1,l+1)]}isLessThan(t){return this.wrapt.wrap)&&(this.overscaledZt.overscaledZ)&&(this.canonical.xt.canonical.x)&&this.canonical.ythis.max&&(this.max=w),w=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(t+1)}unpack(t,r,s){return t*this.redFactor+r*this.greenFactor+s*this.blueFactor-this.baseShift}getPixels(){return new Ui({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,r,s){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let l=r*this.dim,u=r*this.dim+this.dim,d=s*this.dim,f=s*this.dim+this.dim;switch(r){case-1:l=u-1;break;case 1:u=l+1}switch(s){case-1:d=f-1;break;case 1:f=d+1}let _=-r*this.dim,x=-s*this.dim;for(let v=d;v=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class uu{constructor(t,r,s,l,u){this.type="Feature",this._vectorTileFeature=t,t._z=r,t._x=s,t._y=l,this.properties=t.properties,this.id=u}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(t){this._geometry=t}toJSON(){let t={geometry:this.geometry};for(let r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(t[r]=this[r]);return t}}class du{constructor(t,r){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Cn(Mt,16,0),this.grid3D=new Cn(Mt,16,0),this.featureIndexArray=new Kt,this.promoteId=r}insert(t,r,s,l,u,d){let f=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,l,u);let _=d?this.grid3D:this.grid;for(let x=0;x=0&&w[3]>=0&&_.insert(f,w[0],w[1],w[2],w[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Nn.VectorTile(new Pc(this.rawTileData)).layers,this.sourceLayerCoder=new hu(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,r,s,l){this.loadVTLayers();let u=t.params||{},d=Mt/t.tileSize/t.scale,f=Ga(u.filter),_=t.queryGeometry,x=t.queryPadding*d,v=fu(_),w=this.grid.query(v.minX-x,v.minY-x,v.maxX+x,v.maxY+x),I=fu(t.cameraQueryGeometry),M=this.grid3D.query(I.minX-x,I.minY-x,I.maxX+x,I.maxY+x,(F,j,Q,G)=>function(J,re,ce,we,Le){for(let ye of J)if(re<=ye.x&&ce<=ye.y&&we>=ye.x&&Le>=ye.y)return!0;let ve=[new me(re,ce),new me(re,Le),new me(we,Le),new me(we,ce)];if(J.length>2){for(let ye of ve)if(ua(J,ye))return!0}for(let ye=0;ye(G||(G=vs(J)),re.queryIntersectsFeature(_,J,ce,G,this.z,t.transform,d,t.pixelPosMatrix)))}return k}loadMatchingFeature(t,r,s,l,u,d,f,_,x,v,w){let I=this.bucketLayerIDs[r];if(d&&!function(F,j){for(let Q=0;Q=0)return!0;return!1}(d,I))return;let M=this.sourceLayerCoder.decode(s),k=this.vtLayers[M].feature(l);if(u.needGeometry){let F=bs(k,!0);if(!u.filter(new dt(this.tileID.overscaledZ),F,this.tileID.canonical))return}else if(!u.filter(new dt(this.tileID.overscaledZ),k))return;let z=this.getId(k,M);for(let F=0;F{let f=t instanceof _s?t.get(d):null;return f&&f.evaluate?f.evaluate(r,s,l):f})}function fu(i){let t=1/0,r=1/0,s=-1/0,l=-1/0;for(let u of i)t=Math.min(t,u.x),r=Math.min(r,u.y),s=Math.max(s,u.x),l=Math.max(l,u.y);return{minX:t,minY:r,maxX:s,maxY:l}}function cp(i,t){return t-i}function mu(i,t,r,s,l){let u=[];for(let d=0;d=s&&w.x>=s||(v.x>=s?v=new me(s,v.y+(s-v.x)/(w.x-v.x)*(w.y-v.y))._round():w.x>=s&&(w=new me(s,v.y+(s-v.x)/(w.x-v.x)*(w.y-v.y))._round()),v.y>=l&&w.y>=l||(v.y>=l?v=new me(v.x+(l-v.y)/(w.y-v.y)*(w.x-v.x),l)._round():w.y>=l&&(w=new me(v.x+(l-v.y)/(w.y-v.y)*(w.x-v.x),l)._round()),_&&v.equals(_[_.length-1])||(_=[v],u.push(_)),_.push(w)))))}}return u}Ie("FeatureIndex",du,{omit:["rawTileData","sourceLayerCoder"]});class qn extends me{constructor(t,r,s,l){super(t,r),this.angle=s,l!==void 0&&(this.segment=l)}clone(){return new qn(this.x,this.y,this.angle,this.segment)}}function _u(i,t,r,s,l){if(t.segment===void 0||r===0)return!0;let u=t,d=t.segment+1,f=0;for(;f>-r/2;){if(d--,d<0)return!1;f-=i[d].dist(u),u=i[d]}f+=i[d].dist(i[d+1]),d++;let _=[],x=0;for(;fs;)x-=_.shift().angleDelta;if(x>l)return!1;d++,f+=v.dist(w)}return!0}function gu(i){let t=0;for(let r=0;rx){let k=(x-_)/M,z=ii.number(w.x,I.x,k),F=ii.number(w.y,I.y,k),j=new qn(z,F,I.angleTo(w),v);return j._round(),!d||_u(i,j,f,d,t)?j:void 0}_+=M}}function up(i,t,r,s,l,u,d,f,_){let x=yu(s,u,d),v=xu(s,l),w=v*d,I=i[0].x===0||i[0].x===_||i[0].y===0||i[0].y===_;return t-w=0&&J<_&&re>=0&&re<_&&I-x>=0&&I+x<=v){let ce=new qn(J,re,Q,k);ce._round(),s&&!_u(i,ce,u,s,l)||M.push(ce)}}w+=j}return f||M.length||d||(M=vu(i,w/2,r,s,l,u,d,!0,_)),M}Ie("Anchor",qn);let xa=yi;function bu(i,t,r,s){let l=[],u=i.image,d=u.pixelRatio,f=u.paddedRect.w-2*xa,_=u.paddedRect.h-2*xa,x={x1:i.left,y1:i.top,x2:i.right,y2:i.bottom},v=u.stretchX||[[0,f]],w=u.stretchY||[[0,_]],I=(ae,ze)=>ae+ze[1]-ze[0],M=v.reduce(I,0),k=w.reduce(I,0),z=f-M,F=_-k,j=0,Q=M,G=0,J=k,re=0,ce=z,we=0,Le=F;if(u.content&&s){let ae=u.content,ze=ae[2]-ae[0],Ce=ae[3]-ae[1];(u.textFitWidth||u.textFitHeight)&&(x=Xh(i)),j=Ml(v,0,ae[0]),G=Ml(w,0,ae[1]),Q=Ml(v,ae[0],ae[2]),J=Ml(w,ae[1],ae[3]),re=ae[0]-j,we=ae[1]-G,ce=ze-Q,Le=Ce-J}let ve=x.x1,ye=x.y1,ke=x.x2-ve,Pe=x.y2-ye,Se=(ae,ze,Ce,Oe)=>{let ct=Cl(ae.stretch-j,Q,ke,ve),lt=kl(ae.fixed-re,ce,ae.stretch,M),zt=Cl(ze.stretch-G,J,Pe,ye),or=kl(ze.fixed-we,Le,ze.stretch,k),$t=Cl(Ce.stretch-j,Q,ke,ve),Et=kl(Ce.fixed-re,ce,Ce.stretch,M),ai=Cl(Oe.stretch-G,J,Pe,ye),oi=kl(Oe.fixed-we,Le,Oe.stretch,k),li=new me(ct,zt),Tt=new me($t,zt),Dt=new me($t,ai),Yt=new me(ct,ai),qt=new me(lt/d,or/d),ci=new me(Et/d,oi/d),Zt=t*Math.PI/180;if(Zt){let Qe=Math.sin(Zt),ut=Math.cos(Zt),_t=[ut,-Qe,Qe,ut];li._matMult(_t),Tt._matMult(_t),Yt._matMult(_t),Dt._matMult(_t)}let qi=ae.stretch+ae.fixed,xi=ze.stretch+ze.fixed;return{tl:li,tr:Tt,bl:Yt,br:Dt,tex:{x:u.paddedRect.x+xa+qi,y:u.paddedRect.y+xa+xi,w:Ce.stretch+Ce.fixed-qi,h:Oe.stretch+Oe.fixed-xi},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:qt,pixelOffsetBR:ci,minFontScaleX:ce/d/ke,minFontScaleY:Le/d/Pe,isSDF:r}};if(s&&(u.stretchX||u.stretchY)){let ae=wu(v,z,M),ze=wu(w,F,k);for(let Ce=0;Ce0&&(z=Math.max(10,z),this.circleDiameter=z)}else{let I=!((w=d.image)===null||w===void 0)&&w.content&&(d.image.textFitWidth||d.image.textFitHeight)?Xh(d):{x1:d.left,y1:d.top,x2:d.right,y2:d.bottom};I.y1=I.y1*f-_[0],I.y2=I.y2*f+_[2],I.x1=I.x1*f-_[3],I.x2=I.x2*f+_[1];let M=d.collisionPadding;if(M&&(I.x1-=M[0]*f,I.y1-=M[1]*f,I.x2+=M[2]*f,I.y2+=M[3]*f),v){let k=new me(I.x1,I.y1),z=new me(I.x2,I.y1),F=new me(I.x1,I.y2),j=new me(I.x2,I.y2),Q=v*Math.PI/180;k._rotate(Q),z._rotate(Q),F._rotate(Q),j._rotate(Q),I.x1=Math.min(k.x,z.x,F.x,j.x),I.x2=Math.max(k.x,z.x,F.x,j.x),I.y1=Math.min(k.y,z.y,F.y,j.y),I.y2=Math.max(k.y,z.y,F.y,j.y)}t.emplaceBack(r.x,r.y,I.x1,I.y1,I.x2,I.y2,s,l,u)}this.boxEndIndex=t.length}}class dp{constructor(t=[],r=(s,l)=>sl?1:0){if(this.data=t,this.length=this.data.length,this.compare=r,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;let t=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:r,compare:s}=this,l=r[t];for(;t>0;){let u=t-1>>1,d=r[u];if(s(l,d)>=0)break;r[t]=d,t=u}r[t]=l}_down(t){let{data:r,compare:s}=this,l=this.length>>1,u=r[t];for(;t=0)break;r[t]=r[d],t=d}r[t]=u}}function pp(i,t=1,r=!1){let s=1/0,l=1/0,u=-1/0,d=-1/0,f=i[0];for(let M=0;Mu)&&(u=k.x),(!M||k.y>d)&&(d=k.y)}let _=Math.min(u-s,d-l),x=_/2,v=new dp([],fp);if(_===0)return new me(s,l);for(let M=s;Mw.d||!w.d)&&(w=M,r&&console.log("found best %d after %d probes",Math.round(1e4*M.d)/1e4,I)),M.max-w.d<=t||(x=M.h/2,v.push(new va(M.p.x-x,M.p.y-x,x,i)),v.push(new va(M.p.x+x,M.p.y-x,x,i)),v.push(new va(M.p.x-x,M.p.y+x,x,i)),v.push(new va(M.p.x+x,M.p.y+x,x,i)),I+=4)}return r&&(console.log(`num probes: ${I}`),console.log(`best distance: ${w.d}`)),w.p}function fp(i,t){return t.max-i.max}function va(i,t,r,s){this.p=new me(i,t),this.h=r,this.d=function(l,u){let d=!1,f=1/0;for(let _=0;_l.y!=k.y>l.y&&l.x<(k.x-M.x)*(l.y-M.y)/(k.y-M.y)+M.x&&(d=!d),f=Math.min(f,sh(l,M,k))}}return(d?1:-1)*Math.sqrt(f)}(this.p,s),this.max=this.d+this.h*Math.SQRT2}var Ut;L.aq=void 0,(Ut=L.aq||(L.aq={}))[Ut.center=1]="center",Ut[Ut.left=2]="left",Ut[Ut.right=3]="right",Ut[Ut.top=4]="top",Ut[Ut.bottom=5]="bottom",Ut[Ut["top-left"]=6]="top-left",Ut[Ut["top-right"]=7]="top-right",Ut[Ut["bottom-left"]=8]="bottom-left",Ut[Ut["bottom-right"]=9]="bottom-right";let Zn=7,Vc=Number.POSITIVE_INFINITY;function Tu(i,t){return t[1]!==Vc?function(r,s,l){let u=0,d=0;switch(s=Math.abs(s),l=Math.abs(l),r){case"top-right":case"top-left":case"top":d=l-Zn;break;case"bottom-right":case"bottom-left":case"bottom":d=-l+Zn}switch(r){case"top-right":case"bottom-right":case"right":u=-s;break;case"top-left":case"bottom-left":case"left":u=s}return[u,d]}(i,t[0],t[1]):function(r,s){let l=0,u=0;s<0&&(s=0);let d=s/Math.SQRT2;switch(r){case"top-right":case"top-left":u=d-Zn;break;case"bottom-right":case"bottom-left":u=-d+Zn;break;case"bottom":u=-s+Zn;break;case"top":u=s-Zn}switch(r){case"top-right":case"bottom-right":l=-d;break;case"top-left":case"bottom-left":l=d;break;case"left":l=s;break;case"right":l=-s}return[l,u]}(i,t[0])}function Su(i,t,r){var s;let l=i.layout,u=(s=l.get("text-variable-anchor-offset"))===null||s===void 0?void 0:s.evaluate(t,{},r);if(u){let f=u.values,_=[];for(let x=0;xI*Ct);v.startsWith("top")?w[1]-=Zn:v.startsWith("bottom")&&(w[1]+=Zn),_[x+1]=w}return new wi(_)}let d=l.get("text-variable-anchor");if(d){let f;f=i._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[l.get("text-radial-offset").evaluate(t,{},r)*Ct,Vc]:l.get("text-offset").evaluate(t,{},r).map(x=>x*Ct);let _=[];for(let x of d)_.push(x,Tu(x,f));return new wi(_)}return null}function Nc(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function mp(i,t,r,s,l,u,d,f,_,x,v){let w=u.textMaxSize.evaluate(t,{});w===void 0&&(w=d);let I=i.layers[0].layout,M=I.get("icon-offset").evaluate(t,{},v),k=Pu(r.horizontal),z=d/24,F=i.tilePixelRatio*z,j=i.tilePixelRatio*w/24,Q=i.tilePixelRatio*f,G=i.tilePixelRatio*I.get("symbol-spacing"),J=I.get("text-padding")*i.tilePixelRatio,re=function(ae,ze,Ce,Oe=1){let ct=ae.get("icon-padding").evaluate(ze,{},Ce),lt=ct&&ct.values;return[lt[0]*Oe,lt[1]*Oe,lt[2]*Oe,lt[3]*Oe]}(I,t,v,i.tilePixelRatio),ce=I.get("text-max-angle")/180*Math.PI,we=I.get("text-rotation-alignment")!=="viewport"&&I.get("symbol-placement")!=="point",Le=I.get("icon-rotation-alignment")==="map"&&I.get("symbol-placement")!=="point",ve=I.get("symbol-placement"),ye=G/2,ke=I.get("icon-text-fit"),Pe;s&&ke!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Pe=Wh(s,r.vertical,ke,I.get("icon-text-fit-padding"),M,z)),k&&(s=Wh(s,k,ke,I.get("icon-text-fit-padding"),M,z)));let Se=(ae,ze)=>{ze.x<0||ze.x>=Mt||ze.y<0||ze.y>=Mt||function(Ce,Oe,ct,lt,zt,or,$t,Et,ai,oi,li,Tt,Dt,Yt,qt,ci,Zt,qi,xi,Qe,ut,_t,Ci,vt,ba){let Dr=Ce.addToLineVertexArray(Oe,ct),Lr,lr,Zi,Bt,nn=0,zo=0,ku=0,zu=0,Xc=-1,Wc=-1,sn={},Eu=oa("");if(Ce.allowVerticalPlacement&<.vertical){let Qt=Et.layout.get("text-rotate").evaluate(ut,{},vt)+90;Zi=new zl(ai,Oe,oi,li,Tt,lt.vertical,Dt,Yt,qt,Qt),$t&&(Bt=new zl(ai,Oe,oi,li,Tt,$t,Zt,qi,qt,Qt))}if(zt){let Qt=Et.layout.get("icon-rotate").evaluate(ut,{}),Gi=Et.layout.get("icon-text-fit")!=="none",Ts=bu(zt,Qt,Ci,Gi),xr=$t?bu($t,Qt,Ci,Gi):void 0;lr=new zl(ai,Oe,oi,li,Tt,zt,Zt,qi,!1,Qt),nn=4*Ts.length;let Ss=Ce.iconSizeData,Rr=null;Ss.kind==="source"?(Rr=[Er*Et.layout.get("icon-size").evaluate(ut,{})],Rr[0]>Un&&Ft(`${Ce.layerIds[0]}: Value for "icon-size" is >= ${Po}. Reduce your "icon-size".`)):Ss.kind==="composite"&&(Rr=[Er*_t.compositeIconSizes[0].evaluate(ut,{},vt),Er*_t.compositeIconSizes[1].evaluate(ut,{},vt)],(Rr[0]>Un||Rr[1]>Un)&&Ft(`${Ce.layerIds[0]}: Value for "icon-size" is >= ${Po}. Reduce your "icon-size".`)),Ce.addSymbols(Ce.icon,Ts,Rr,Qe,xi,ut,L.ah.none,Oe,Dr.lineStartIndex,Dr.lineLength,-1,vt),Xc=Ce.icon.placedSymbolArray.length-1,xr&&(zo=4*xr.length,Ce.addSymbols(Ce.icon,xr,Rr,Qe,xi,ut,L.ah.vertical,Oe,Dr.lineStartIndex,Dr.lineLength,-1,vt),Wc=Ce.icon.placedSymbolArray.length-1)}let Du=Object.keys(lt.horizontal);for(let Qt of Du){let Gi=lt.horizontal[Qt];if(!Lr){Eu=oa(Gi.text);let xr=Et.layout.get("text-rotate").evaluate(ut,{},vt);Lr=new zl(ai,Oe,oi,li,Tt,Gi,Dt,Yt,qt,xr)}let Ts=Gi.positionedLines.length===1;if(ku+=Iu(Ce,Oe,Gi,or,Et,qt,ut,ci,Dr,lt.vertical?L.ah.horizontal:L.ah.horizontalOnly,Ts?Du:[Qt],sn,Xc,_t,vt),Ts)break}lt.vertical&&(zu+=Iu(Ce,Oe,lt.vertical,or,Et,qt,ut,ci,Dr,L.ah.vertical,["vertical"],sn,Wc,_t,vt));let yp=Lr?Lr.boxStartIndex:Ce.collisionBoxArray.length,xp=Lr?Lr.boxEndIndex:Ce.collisionBoxArray.length,vp=Zi?Zi.boxStartIndex:Ce.collisionBoxArray.length,bp=Zi?Zi.boxEndIndex:Ce.collisionBoxArray.length,wp=lr?lr.boxStartIndex:Ce.collisionBoxArray.length,Tp=lr?lr.boxEndIndex:Ce.collisionBoxArray.length,Sp=Bt?Bt.boxStartIndex:Ce.collisionBoxArray.length,Ip=Bt?Bt.boxEndIndex:Ce.collisionBoxArray.length,yr=-1,Dl=(Qt,Gi)=>Qt&&Qt.circleDiameter?Math.max(Qt.circleDiameter,Gi):Gi;yr=Dl(Lr,yr),yr=Dl(Zi,yr),yr=Dl(lr,yr),yr=Dl(Bt,yr);let Lu=yr>-1?1:0;Lu&&(yr*=ba/Ct),Ce.glyphOffsetArray.length>=ya.MAX_GLYPHS&&Ft("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),ut.sortKey!==void 0&&Ce.addToSortKeyRanges(Ce.symbolInstances.length,ut.sortKey);let Pp=Su(Et,ut,vt),[Ap,Mp]=function(Qt,Gi){let Ts=Qt.length,xr=Gi?.values;if(xr?.length>0)for(let Ss=0;Ss=0?sn.right:-1,sn.center>=0?sn.center:-1,sn.left>=0?sn.left:-1,sn.vertical||-1,Xc,Wc,Eu,yp,xp,vp,bp,wp,Tp,Sp,Ip,oi,ku,zu,nn,zo,Lu,0,Dt,yr,Ap,Mp)}(i,ze,ae,r,s,l,Pe,i.layers[0],i.collisionBoxArray,t.index,t.sourceLayerIndex,i.index,F,[J,J,J,J],we,_,Q,re,Le,M,t,u,x,v,d)};if(ve==="line")for(let ae of mu(t.geometry,0,0,Mt,Mt)){let ze=up(ae,G,ce,r.vertical||k,s,24,j,i.overscaling,Mt);for(let Ce of ze)k&&_p(i,k.text,ye,Ce)||Se(ae,Ce)}else if(ve==="line-center"){for(let ae of t.geometry)if(ae.length>1){let ze=hp(ae,ce,r.vertical||k,s,24,j);ze&&Se(ae,ze)}}else if(t.type==="Polygon")for(let ae of Fs(t.geometry,0)){let ze=pp(ae,16);Se(ae[0],new qn(ze.x,ze.y,0))}else if(t.type==="LineString")for(let ae of t.geometry)Se(ae,new qn(ae[0].x,ae[0].y,0));else if(t.type==="Point")for(let ae of t.geometry)for(let ze of ae)Se([ze],new qn(ze.x,ze.y,0))}function Iu(i,t,r,s,l,u,d,f,_,x,v,w,I,M,k){let z=function(Q,G,J,re,ce,we,Le,ve){let ye=re.layout.get("text-rotate").evaluate(we,{})*Math.PI/180,ke=[];for(let Pe of G.positionedLines)for(let Se of Pe.positionedGlyphs){if(!Se.rect)continue;let ae=Se.rect||{},ze=jh+1,Ce=!0,Oe=1,ct=0,lt=(ce||ve)&&Se.vertical,zt=Se.metrics.advance*Se.scale/2;if(ve&&G.verticalizable&&(ct=Pe.lineOffset/2-(Se.imageName?-(Ct-Se.metrics.width*Se.scale)/2:(Se.scale-1)*Ct)),Se.imageName){let Qe=Le[Se.imageName];Ce=Qe.sdf,Oe=Qe.pixelRatio,ze=yi/Oe}let or=ce?[Se.x+zt,Se.y]:[0,0],$t=ce?[0,0]:[Se.x+zt+J[0],Se.y+J[1]-ct],Et=[0,0];lt&&(Et=$t,$t=[0,0]);let ai=Se.metrics.isDoubleResolution?2:1,oi=(Se.metrics.left-ze)*Se.scale-zt+$t[0],li=(-Se.metrics.top-ze)*Se.scale+$t[1],Tt=oi+ae.w/ai*Se.scale/Oe,Dt=li+ae.h/ai*Se.scale/Oe,Yt=new me(oi,li),qt=new me(Tt,li),ci=new me(oi,Dt),Zt=new me(Tt,Dt);if(lt){let Qe=new me(-zt,zt-So),ut=-Math.PI/2,_t=Ct/2-zt,Ci=new me(5-So-_t,-(Se.imageName?_t:0)),vt=new me(...Et);Yt._rotateAround(ut,Qe)._add(Ci)._add(vt),qt._rotateAround(ut,Qe)._add(Ci)._add(vt),ci._rotateAround(ut,Qe)._add(Ci)._add(vt),Zt._rotateAround(ut,Qe)._add(Ci)._add(vt)}if(ye){let Qe=Math.sin(ye),ut=Math.cos(ye),_t=[ut,-Qe,Qe,ut];Yt._matMult(_t),qt._matMult(_t),ci._matMult(_t),Zt._matMult(_t)}let qi=new me(0,0),xi=new me(0,0);ke.push({tl:Yt,tr:qt,bl:ci,br:Zt,tex:ae,writingMode:G.writingMode,glyphOffset:or,sectionIndex:Se.sectionIndex,isSDF:Ce,pixelOffsetTL:qi,pixelOffsetBR:xi,minFontScaleX:0,minFontScaleY:0})}return ke}(0,r,f,l,u,d,s,i.allowVerticalPlacement),F=i.textSizeData,j=null;F.kind==="source"?(j=[Er*l.layout.get("text-size").evaluate(d,{})],j[0]>Un&&Ft(`${i.layerIds[0]}: Value for "text-size" is >= ${Po}. Reduce your "text-size".`)):F.kind==="composite"&&(j=[Er*M.compositeTextSizes[0].evaluate(d,{},k),Er*M.compositeTextSizes[1].evaluate(d,{},k)],(j[0]>Un||j[1]>Un)&&Ft(`${i.layerIds[0]}: Value for "text-size" is >= ${Po}. Reduce your "text-size".`)),i.addSymbols(i.text,z,j,f,u,d,x,t,_.lineStartIndex,_.lineLength,I,k);for(let Q of v)w[Q]=i.text.placedSymbolArray.length-1;return 4*z.length}function Pu(i){for(let t in i)return i[t];return null}function _p(i,t,r,s){let l=i.compareText;if(t in l){let u=l[t];for(let d=u.length-1;d>=0;d--)if(s.dist(u[d])>4;if(l!==1)throw new Error(`Got v${l} data when expected v1.`);let u=Au[15&s];if(!u)throw new Error("Unrecognized array type.");let[d]=new Uint16Array(t,2,1),[f]=new Uint32Array(t,4,1);return new jc(f,d,u,t)}constructor(t,r=64,s=Float64Array,l){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=s,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;let u=Au.indexOf(this.ArrayType),d=2*t*this.ArrayType.BYTES_PER_ELEMENT,f=t*this.IndexArrayType.BYTES_PER_ELEMENT,_=(8-f%8)%8;if(u<0)throw new Error(`Unexpected typed array class: ${s}.`);l&&l instanceof ArrayBuffer?(this.data=l,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+f+_,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+d+f+_),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+f+_,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+u]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=t)}add(t,r){let s=this._pos>>1;return this.ids[s]=s,this.coords[this._pos++]=t,this.coords[this._pos++]=r,s}finish(){let t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Uc(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,r,s,l){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:u,coords:d,nodeSize:f}=this,_=[0,u.length-1,0],x=[];for(;_.length;){let v=_.pop()||0,w=_.pop()||0,I=_.pop()||0;if(w-I<=f){for(let F=I;F<=w;F++){let j=d[2*F],Q=d[2*F+1];j>=t&&j<=s&&Q>=r&&Q<=l&&x.push(u[F])}continue}let M=I+w>>1,k=d[2*M],z=d[2*M+1];k>=t&&k<=s&&z>=r&&z<=l&&x.push(u[M]),(v===0?t<=k:r<=z)&&(_.push(I),_.push(M-1),_.push(1-v)),(v===0?s>=k:l>=z)&&(_.push(M+1),_.push(w),_.push(1-v))}return x}within(t,r,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:l,coords:u,nodeSize:d}=this,f=[0,l.length-1,0],_=[],x=s*s;for(;f.length;){let v=f.pop()||0,w=f.pop()||0,I=f.pop()||0;if(w-I<=d){for(let F=I;F<=w;F++)Cu(u[2*F],u[2*F+1],t,r)<=x&&_.push(l[F]);continue}let M=I+w>>1,k=u[2*M],z=u[2*M+1];Cu(k,z,t,r)<=x&&_.push(l[M]),(v===0?t-s<=k:r-s<=z)&&(f.push(I),f.push(M-1),f.push(1-v)),(v===0?t+s>=k:r+s>=z)&&(f.push(M+1),f.push(w),f.push(1-v))}return _}}function Uc(i,t,r,s,l,u){if(l-s<=r)return;let d=s+l>>1;Mu(i,t,d,s,l,u),Uc(i,t,r,s,d-1,1-u),Uc(i,t,r,d+1,l,1-u)}function Mu(i,t,r,s,l,u){for(;l>s;){if(l-s>600){let x=l-s+1,v=r-s+1,w=Math.log(x),I=.5*Math.exp(2*w/3),M=.5*Math.sqrt(w*I*(x-I)/x)*(v-x/2<0?-1:1);Mu(i,t,r,Math.max(s,Math.floor(r-v*I/x+M)),Math.min(l,Math.floor(r+(x-v)*I/x+M)),u)}let d=t[2*r+u],f=s,_=l;for(Co(i,t,s,r),t[2*l+u]>d&&Co(i,t,s,l);f<_;){for(Co(i,t,f,_),f++,_--;t[2*f+u]d;)_--}t[2*s+u]===d?Co(i,t,s,_):(_++,Co(i,t,_,l)),_<=r&&(s=_+1),r<=_&&(l=_-1)}}function Co(i,t,r,s){$c(i,r,s),$c(t,2*r,2*s),$c(t,2*r+1,2*s+1)}function $c(i,t,r){let s=i[t];i[t]=i[r],i[r]=s}function Cu(i,t,r,s){let l=i-r,u=t-s;return l*l+u*u}var qc;L.bg=void 0,(qc=L.bg||(L.bg={})).create="create",qc.load="load",qc.fullLoad="fullLoad";let El=null,ko=[],Zc=1e3/60,Gc="loadTime",Hc="fullLoadTime",gp={mark(i){performance.mark(i)},frame(i){let t=i;El!=null&&ko.push(t-El),El=t},clearMetrics(){El=null,ko=[],performance.clearMeasures(Gc),performance.clearMeasures(Hc);for(let i in L.bg)performance.clearMarks(L.bg[i])},getPerformanceMetrics(){performance.measure(Gc,L.bg.create,L.bg.load),performance.measure(Hc,L.bg.create,L.bg.fullLoad);let i=performance.getEntriesByName(Gc)[0].duration,t=performance.getEntriesByName(Hc)[0].duration,r=ko.length,s=1/(ko.reduce((u,d)=>u+d,0)/r/1e3),l=ko.filter(u=>u>Zc).reduce((u,d)=>u+(d-Zc)/Zc,0);return{loadTime:i,fullLoadTime:t,fps:s,percentDroppedFrames:l/(r+l)*100,totalFrames:r}}};L.$=class extends T{},L.A=da,L.B=tc,L.C=function(i){if(on==null){let t=i.navigator?i.navigator.userAgent:null;on=!!i.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return on},L.D=Ae,L.E=hn,L.F=class{constructor(i,t){this.target=i,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new lp(()=>this.process()),this.subscription=function(r,s,l,u){return r.addEventListener(s,l,!1),{unsubscribe:()=>{r.removeEventListener(s,l,!1)}}}(this.target,"message",r=>this.receive(r)),this.globalScope=hr(self)?i:window}registerMessageHandler(i,t){this.messageHandlers[i]=t}sendAsync(i,t){return new Promise((r,s)=>{let l=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[l]={resolve:r,reject:s},t&&t.signal.addEventListener("abort",()=>{delete this.resolveRejects[l];let f={id:l,type:"",origin:location.origin,targetMapId:i.targetMapId,sourceMapId:this.mapId};this.target.postMessage(f)},{once:!0});let u=[],d=Object.assign(Object.assign({},i),{id:l,sourceMapId:this.mapId,origin:location.origin,data:kn(i.data,u)});this.target.postMessage(d,{transfer:u})})}receive(i){let t=i.data,r=t.id;if(!(t.origin!=="file://"&&location.origin!=="file://"&&t.origin!=="resource://android"&&location.origin!=="resource://android"&&t.origin!==location.origin||t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type===""){delete this.tasks[r];let s=this.abortControllers[r];return delete this.abortControllers[r],void(s&&s.abort())}if(hr(self)||t.mustQueue)return this.tasks[r]=t,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,t)}}process(){if(this.taskQueue.length===0)return;let i=this.taskQueue.shift(),t=this.tasks[i];delete this.tasks[i],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(i,t)}processTask(i,t){return p(this,void 0,void 0,function*(){if(t.type===""){let l=this.resolveRejects[i];return delete this.resolveRejects[i],l?void(t.error?l.reject(zn(t.error)):l.resolve(zn(t.data))):void 0}if(!this.messageHandlers[t.type])return void this.completeTask(i,new Error(`Could not find a registered handler for ${t.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));let r=zn(t.data),s=new AbortController;this.abortControllers[i]=s;try{let l=yield this.messageHandlers[t.type](t.sourceMapId,r,s);this.completeTask(i,null,l)}catch(l){this.completeTask(i,l)}})}completeTask(i,t,r){let s=[];delete this.abortControllers[i];let l={id:i,type:"",sourceMapId:this.mapId,origin:location.origin,error:t?kn(t):null,data:kn(r,s)};this.target.postMessage(l,{transfer:s})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},L.G=cn,L.H=function(){var i=new da(16);return da!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},L.I=Mc,L.J=function(i,t,r){var s,l,u,d,f,_,x,v,w,I,M,k,z=r[0],F=r[1],j=r[2];return t===i?(i[12]=t[0]*z+t[4]*F+t[8]*j+t[12],i[13]=t[1]*z+t[5]*F+t[9]*j+t[13],i[14]=t[2]*z+t[6]*F+t[10]*j+t[14],i[15]=t[3]*z+t[7]*F+t[11]*j+t[15]):(l=t[1],u=t[2],d=t[3],f=t[4],_=t[5],x=t[6],v=t[7],w=t[8],I=t[9],M=t[10],k=t[11],i[0]=s=t[0],i[1]=l,i[2]=u,i[3]=d,i[4]=f,i[5]=_,i[6]=x,i[7]=v,i[8]=w,i[9]=I,i[10]=M,i[11]=k,i[12]=s*z+f*F+w*j+t[12],i[13]=l*z+_*F+I*j+t[13],i[14]=u*z+x*F+M*j+t[14],i[15]=d*z+v*F+k*j+t[15]),i},L.K=function(i,t,r){var s=r[0],l=r[1],u=r[2];return i[0]=t[0]*s,i[1]=t[1]*s,i[2]=t[2]*s,i[3]=t[3]*s,i[4]=t[4]*l,i[5]=t[5]*l,i[6]=t[6]*l,i[7]=t[7]*l,i[8]=t[8]*u,i[9]=t[9]*u,i[10]=t[10]*u,i[11]=t[11]*u,i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15],i},L.L=ch,L.M=function(i,t){let r={};for(let s=0;s{let t=window.document.createElement("video");return t.muted=!0,new Promise(r=>{t.onloadstart=()=>{r(t)};for(let s of i){let l=window.document.createElement("source");Nr(s)||(t.crossOrigin="Anonymous"),l.src=s,t.appendChild(l)}})},L.a4=function(){return Is++},L.a5=be,L.a6=ya,L.a7=Ga,L.a8=bs,L.a9=uu,L.aA=function(i){if(i.type==="custom")return new op(i);switch(i.type){case"background":return new np(i);case"circle":return new Zu(i);case"fill":return new ld(i);case"fill-extrusion":return new Td(i);case"heatmap":return new Hu(i);case"hillshade":return new Wu(i);case"line":return new zd(i);case"raster":return new ap(i);case"symbol":return new Al(i)}},L.aB=st,L.aC=function(i,t){if(!i)return[{command:"setStyle",args:[t]}];let r=[];try{if(!et(i.version,t.version))return[{command:"setStyle",args:[t]}];et(i.center,t.center)||r.push({command:"setCenter",args:[t.center]}),et(i.zoom,t.zoom)||r.push({command:"setZoom",args:[t.zoom]}),et(i.bearing,t.bearing)||r.push({command:"setBearing",args:[t.bearing]}),et(i.pitch,t.pitch)||r.push({command:"setPitch",args:[t.pitch]}),et(i.sprite,t.sprite)||r.push({command:"setSprite",args:[t.sprite]}),et(i.glyphs,t.glyphs)||r.push({command:"setGlyphs",args:[t.glyphs]}),et(i.transition,t.transition)||r.push({command:"setTransition",args:[t.transition]}),et(i.light,t.light)||r.push({command:"setLight",args:[t.light]}),et(i.terrain,t.terrain)||r.push({command:"setTerrain",args:[t.terrain]}),et(i.sky,t.sky)||r.push({command:"setSky",args:[t.sky]}),et(i.projection,t.projection)||r.push({command:"setProjection",args:[t.projection]});let s={},l=[];(function(d,f,_,x){let v;for(v in f=f||{},d=d||{})Object.prototype.hasOwnProperty.call(d,v)&&(Object.prototype.hasOwnProperty.call(f,v)||Ir(v,_,x));for(v in f)Object.prototype.hasOwnProperty.call(f,v)&&(Object.prototype.hasOwnProperty.call(d,v)?et(d[v],f[v])||(d[v].type==="geojson"&&f[v].type==="geojson"&&un(d,f,v)?yt(_,{command:"setGeoJSONSourceData",args:[v,f[v].data]}):pr(v,f,_,x)):Kn(v,f,_))})(i.sources,t.sources,l,s);let u=[];i.layers&&i.layers.forEach(d=>{"source"in d&&s[d.source]?r.push({command:"removeLayer",args:[d.id]}):u.push(d)}),r=r.concat(l),function(d,f,_){f=f||[];let x=(d=d||[]).map(Jn),v=f.map(Jn),w=d.reduce(Yn,{}),I=f.reduce(Yn,{}),M=x.slice(),k=Object.create(null),z,F,j,Q,G;for(let J=0,re=0;J@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,s,l,u)=>{let d=l||u;return t[s]=!d||d.toLowerCase(),""}),t["max-age"]){let r=parseInt(t["max-age"],10);isNaN(r)?delete t["max-age"]:t["max-age"]=r}return t},L.ab=function(i,t){let r=[];for(let s in i)s in t||r.push(s);return r},L.ac=zi,L.ad=function(i,t,r){var s=Math.sin(r),l=Math.cos(r),u=t[0],d=t[1],f=t[2],_=t[3],x=t[4],v=t[5],w=t[6],I=t[7];return t!==i&&(i[8]=t[8],i[9]=t[9],i[10]=t[10],i[11]=t[11],i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15]),i[0]=u*l+x*s,i[1]=d*l+v*s,i[2]=f*l+w*s,i[3]=_*l+I*s,i[4]=x*l-u*s,i[5]=v*l-d*s,i[6]=w*l-f*s,i[7]=I*l-_*s,i},L.ae=function(i){var t=new da(16);return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],t},L.af=yl,L.ag=function(i,t){let r=0,s=0;if(i.kind==="constant")s=i.layoutSize;else if(i.kind!=="source"){let{interpolationType:l,minZoom:u,maxZoom:d}=i,f=l?zi(ri.interpolationFactor(l,t,u,d),0,1):0;i.kind==="camera"?s=ii.number(i.minSize,i.maxSize,f):r=f}return{uSizeT:r,uSize:s}},L.ai=function(i,{uSize:t,uSizeT:r},{lowerSize:s,upperSize:l}){return i.kind==="source"?s/Er:i.kind==="composite"?ii.number(s/Er,l/Er,r):t},L.aj=Ec,L.ak=function(i,t,r,s){let l=t.y-i.y,u=t.x-i.x,d=s.y-r.y,f=s.x-r.x,_=d*u-f*l;if(_===0)return null;let x=(f*(i.y-r.y)-d*(i.x-r.x))/_;return new me(i.x+x*u,i.y+x*l)},L.al=mu,L.am=rh,L.an=pc,L.ao=function(i){let t=1/0,r=1/0,s=-1/0,l=-1/0;for(let u of i)t=Math.min(t,u.x),r=Math.min(r,u.y),s=Math.max(s,u.x),l=Math.max(l,u.y);return[t,r,s,l]},L.ap=Ct,L.ar=zc,L.as=function(i,t){var r=t[0],s=t[1],l=t[2],u=t[3],d=t[4],f=t[5],_=t[6],x=t[7],v=t[8],w=t[9],I=t[10],M=t[11],k=t[12],z=t[13],F=t[14],j=t[15],Q=r*f-s*d,G=r*_-l*d,J=r*x-u*d,re=s*_-l*f,ce=s*x-u*f,we=l*x-u*_,Le=v*z-w*k,ve=v*F-I*k,ye=v*j-M*k,ke=w*F-I*z,Pe=w*j-M*z,Se=I*j-M*F,ae=Q*Se-G*Pe+J*ke+re*ye-ce*ve+we*Le;return ae?(i[0]=(f*Se-_*Pe+x*ke)*(ae=1/ae),i[1]=(l*Pe-s*Se-u*ke)*ae,i[2]=(z*we-F*ce+j*re)*ae,i[3]=(I*ce-w*we-M*re)*ae,i[4]=(_*ye-d*Se-x*ve)*ae,i[5]=(r*Se-l*ye+u*ve)*ae,i[6]=(F*J-k*we-j*G)*ae,i[7]=(v*we-I*J+M*G)*ae,i[8]=(d*Pe-f*ye+x*Le)*ae,i[9]=(s*ye-r*Pe-u*Le)*ae,i[10]=(k*ce-z*J+j*Q)*ae,i[11]=(w*J-v*ce-M*Q)*ae,i[12]=(f*ve-d*ke-_*Le)*ae,i[13]=(r*ke-s*ve+l*Le)*ae,i[14]=(z*G-k*re-F*Q)*ae,i[15]=(v*re-w*G+I*Q)*ae,i):null},L.at=Nc,L.au=kc,L.av=jc,L.aw=function(){let i={},t=ie.$version;for(let r in ie.$root){let s=ie.$root[r];if(s.required){let l=null;l=r==="version"?t:s.type==="array"?[]:{},l!=null&&(i[r]=l)}}return i},L.ax=ao,L.ay=Di,L.az=function(i){i=i.slice();let t=Object.create(null);for(let r=0;r25||s<0||s>=1||r<0||r>=1)},L.bc=function(i,t){return i[0]=t[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=t[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=t[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},L.bd=class extends b{},L.be=Bc,L.bf=gp,L.bh=ui,L.bi=function(i,t){wr.REGISTERED_PROTOCOLS[i]=t},L.bj=function(i){delete wr.REGISTERED_PROTOCOLS[i]},L.bk=function(i,t){let r={};for(let l=0;lSe*Ct)}let ve=d?"center":r.get("text-justify").evaluate(x,{},i.canonical),ye=r.get("symbol-placement")==="point"?r.get("text-max-width").evaluate(x,{},i.canonical)*Ct:1/0,ke=()=>{i.bucket.allowVerticalPlacement&&oo(J)&&(k.vertical=Sl(z,i.glyphMap,i.glyphPositions,i.imagePositions,v,ye,u,we,"left",ce,j,L.ah.vertical,!0,I,w))};if(!d&&Le){let Pe=new Set;if(ve==="auto")for(let ae=0;aep(void 0,void 0,void 0,function*(){if(i.byteLength===0)return createImageBitmap(new ImageData(1,1));let t=new Blob([new Uint8Array(i)],{type:"image/png"});try{return createImageBitmap(t)}catch(r){throw new Error(`Could not load image because of ${r.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),L.e=vi,L.f=i=>new Promise((t,r)=>{let s=new Image;s.onload=()=>{t(s),URL.revokeObjectURL(s.src),s.onload=null,window.requestAnimationFrame(()=>{s.src=As})},s.onerror=()=>r(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."));let l=new Blob([new Uint8Array(i)],{type:"image/png"});s.src=i.byteLength?URL.createObjectURL(l):As}),L.g=Yi,L.h=(i,t)=>Vr(vi(i,{type:"json"}),t),L.i=hr,L.j=Sr,L.k=Tr,L.l=(i,t)=>Vr(vi(i,{type:"arrayBuffer"}),t),L.m=Vr,L.n=function(i){return new Pc(i).readFields(Gd,[])},L.o=go,L.p=Uh,L.q=h,L.r=ec,L.s=Nr,L.t=no,L.u=Qr,L.v=ie,L.w=Ft,L.x=function([i,t,r]){return t+=90,t*=Math.PI/180,r*=Math.PI/180,{x:i*Math.cos(t)*Math.sin(r),y:i*Math.sin(t)*Math.sin(r),z:i*Math.cos(r)}},L.y=ii,L.z=dt}),Ll("worker",["./shared"],function(L){"use strict";class p{constructor(A){this.keyCache={},A&&this.replace(A)}replace(A){this._layerConfigs={},this._layers={},this.update(A,[])}update(A,P){for(let O of A){this._layerConfigs[O.id]=O;let H=this._layers[O.id]=L.aA(O);H._featureFilter=L.a7(H.filter),this.keyCache[O.id]&&delete this.keyCache[O.id]}for(let O of P)delete this.keyCache[O],delete this._layerConfigs[O],delete this._layers[O];this.familiesBySource={};let D=L.bk(Object.values(this._layerConfigs),this.keyCache);for(let O of D){let H=O.map(te=>this._layers[te.id]),W=H[0];if(W.visibility==="none")continue;let Y=W.source||"",q=this.familiesBySource[Y];q||(q=this.familiesBySource[Y]={});let ne=W.sourceLayer||"_geojsonTileLayer",le=q[ne];le||(le=q[ne]=[]),le.push(H)}}}class ki{constructor(A){let P={},D=[];for(let Y in A){let q=A[Y],ne=P[Y]={};for(let le in q){let te=q[+le];if(!te||te.bitmap.width===0||te.bitmap.height===0)continue;let de={x:0,y:0,w:te.bitmap.width+2,h:te.bitmap.height+2};D.push(de),ne[le]={rect:de,metrics:te.metrics}}}let{w:O,h:H}=L.p(D),W=new L.o({width:O||1,height:H||1});for(let Y in A){let q=A[Y];for(let ne in q){let le=q[+ne];if(!le||le.bitmap.width===0||le.bitmap.height===0)continue;let te=P[Y][ne].rect;L.o.copy(le.bitmap,W,{x:0,y:0},{x:te.x+1,y:te.y+1},le.bitmap)}}this.image=W,this.positions=P}}L.bl("GlyphAtlas",ki);class Hi{constructor(A){this.tileID=new L.S(A.tileID.overscaledZ,A.tileID.wrap,A.tileID.canonical.z,A.tileID.canonical.x,A.tileID.canonical.y),this.uid=A.uid,this.zoom=A.zoom,this.pixelRatio=A.pixelRatio,this.tileSize=A.tileSize,this.source=A.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=A.showCollisionBoxes,this.collectResourceTiming=!!A.collectResourceTiming,this.returnDependencies=!!A.returnDependencies,this.promoteId=A.promoteId,this.inFlightDependencies=[]}parse(A,P,D,O){return L._(this,void 0,void 0,function*(){this.status="parsing",this.data=A,this.collisionBoxArray=new L.a5;let H=new L.bm(Object.keys(A.layers).sort()),W=new L.bn(this.tileID,this.promoteId);W.bucketLayerIDs=[];let Y={},q={featureIndex:W,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:D},ne=P.familiesBySource[this.source];for(let qe in ne){let rt=A.layers[qe];if(!rt)continue;rt.version===1&&L.w(`Vector tile source "${this.source}" layer "${qe}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let gt=H.encode(qe),kt=[];for(let Lt=0;Lt=Wt.maxzoom||Wt.visibility!=="none"&&(Gt(Lt,this.zoom,D),(Y[Wt.id]=Wt.createBucket({index:W.bucketLayerIDs.length,layers:Lt,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:gt,sourceID:this.source})).populate(kt,q,this.tileID.canonical),W.bucketLayerIDs.push(Lt.map(dn=>dn.id)))}}let le=L.aF(q.glyphDependencies,qe=>Object.keys(qe).map(Number));this.inFlightDependencies.forEach(qe=>qe?.abort()),this.inFlightDependencies=[];let te=Promise.resolve({});if(Object.keys(le).length){let qe=new AbortController;this.inFlightDependencies.push(qe),te=O.sendAsync({type:"GG",data:{stacks:le,source:this.source,tileID:this.tileID,type:"glyphs"}},qe)}let de=Object.keys(q.iconDependencies),Ee=Promise.resolve({});if(de.length){let qe=new AbortController;this.inFlightDependencies.push(qe),Ee=O.sendAsync({type:"GI",data:{icons:de,source:this.source,tileID:this.tileID,type:"icons"}},qe)}let De=Object.keys(q.patternDependencies),Ke=Promise.resolve({});if(De.length){let qe=new AbortController;this.inFlightDependencies.push(qe),Ke=O.sendAsync({type:"GI",data:{icons:De,source:this.source,tileID:this.tileID,type:"patterns"}},qe)}let[je,Je,Ge]=yield Promise.all([te,Ee,Ke]),Pt=new ki(je),xt=new L.bo(Je,Ge);for(let qe in Y){let rt=Y[qe];rt instanceof L.a6?(Gt(rt.layers,this.zoom,D),L.bp({bucket:rt,glyphMap:je,glyphPositions:Pt.positions,imageMap:Je,imagePositions:xt.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):rt.hasPattern&&(rt instanceof L.bq||rt instanceof L.br||rt instanceof L.bs)&&(Gt(rt.layers,this.zoom,D),rt.addFeatures(q,this.tileID.canonical,xt.patternPositions))}return this.status="done",{buckets:Object.values(Y).filter(qe=>!qe.isEmpty()),featureIndex:W,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Pt.image,imageAtlas:xt,glyphMap:this.returnDependencies?je:null,iconMap:this.returnDependencies?Je:null,glyphPositions:this.returnDependencies?Pt.positions:null}})}}function Gt(N,A,P){let D=new L.z(A);for(let O of N)O.recalculate(D,P)}class me{constructor(A,P,D){this.actor=A,this.layerIndex=P,this.availableImages=D,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(A,P){return L._(this,void 0,void 0,function*(){let D=yield L.l(A.request,P);try{return{vectorTile:new L.bt.VectorTile(new L.bu(D.data)),rawData:D.data,cacheControl:D.cacheControl,expires:D.expires}}catch(O){let H=new Uint8Array(D.data),W=`Unable to parse the tile at ${A.request.url}, `;throw W+=H[0]===31&&H[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${O.message}`,new Error(W)}})}loadTile(A){return L._(this,void 0,void 0,function*(){let P=A.uid,D=!!(A&&A.request&&A.request.collectResourceTiming)&&new L.bv(A.request),O=new Hi(A);this.loading[P]=O;let H=new AbortController;O.abort=H;try{let W=yield this.loadVectorTile(A,H);if(delete this.loading[P],!W)return null;let Y=W.rawData,q={};W.expires&&(q.expires=W.expires),W.cacheControl&&(q.cacheControl=W.cacheControl);let ne={};if(D){let te=D.finish();te&&(ne.resourceTiming=JSON.parse(JSON.stringify(te)))}O.vectorTile=W.vectorTile;let le=O.parse(W.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[P]=O,this.fetching[P]={rawTileData:Y,cacheControl:q,resourceTiming:ne};try{let te=yield le;return L.e({rawTileData:Y.slice(0)},te,q,ne)}finally{delete this.fetching[P]}}catch(W){throw delete this.loading[P],O.status="done",this.loaded[P]=O,W}})}reloadTile(A){return L._(this,void 0,void 0,function*(){let P=A.uid;if(!this.loaded||!this.loaded[P])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");let D=this.loaded[P];if(D.showCollisionBoxes=A.showCollisionBoxes,D.status==="parsing"){let O=yield D.parse(D.vectorTile,this.layerIndex,this.availableImages,this.actor),H;if(this.fetching[P]){let{rawTileData:W,cacheControl:Y,resourceTiming:q}=this.fetching[P];delete this.fetching[P],H=L.e({rawTileData:W.slice(0)},O,Y,q)}else H=O;return H}if(D.status==="done"&&D.vectorTile)return D.parse(D.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(A){return L._(this,void 0,void 0,function*(){let P=this.loading,D=A.uid;P&&P[D]&&P[D].abort&&(P[D].abort.abort(),delete P[D])})}removeTile(A){return L._(this,void 0,void 0,function*(){this.loaded&&this.loaded[A.uid]&&delete this.loaded[A.uid]})}}class se{constructor(){this.loaded={}}loadTile(A){return L._(this,void 0,void 0,function*(){let{uid:P,encoding:D,rawImageData:O,redFactor:H,greenFactor:W,blueFactor:Y,baseShift:q}=A,ne=O.width+2,le=O.height+2,te=L.b(O)?new L.R({width:ne,height:le},yield L.bw(O,-1,-1,ne,le)):O,de=new L.bx(P,te,D,H,W,Y,q);return this.loaded=this.loaded||{},this.loaded[P]=de,de})}removeTile(A){let P=this.loaded,D=A.uid;P&&P[D]&&delete P[D]}}function Fr(N,A){if(N.length!==0){vr(N[0],A);for(var P=1;P=Math.abs(Y)?P-q+Y:Y-q+P,P=q}P+D>=0!=!!A&&N.reverse()}var Xi=L.by(function N(A,P){var D,O=A&&A.type;if(O==="FeatureCollection")for(D=0;D>31}function hr(N,A){for(var P=N.loadGeometry(),D=N.type,O=0,H=0,W=P.length,Y=0;YN},Or=Math.fround||(ur=new Float32Array(1),N=>(ur[0]=+N,ur[0]));var ur;let ei=3,Ei=5,ln=6;class wr{constructor(A){this.options=Object.assign(Object.create(As),A),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(A){let{log:P,minZoom:D,maxZoom:O}=this.options;P&&console.time("total time");let H=`prepare ${A.length} points`;P&&console.time(H),this.points=A;let W=[];for(let q=0;q=D;q--){let ne=+Date.now();Y=this.trees[q]=this._createTree(this._cluster(Y,q)),P&&console.log("z%d: %d clusters in %dms",q,Y.numItems,+Date.now()-ne)}return P&&console.timeEnd("total time"),this}getClusters(A,P){let D=((A[0]+180)%360+360)%360-180,O=Math.max(-90,Math.min(90,A[1])),H=A[2]===180?180:((A[2]+180)%360+360)%360-180,W=Math.max(-90,Math.min(90,A[3]));if(A[2]-A[0]>=360)D=-180,H=180;else if(D>H){let te=this.getClusters([D,O,180,W],P),de=this.getClusters([-180,O,H,W],P);return te.concat(de)}let Y=this.trees[this._limitZoom(P)],q=Y.range(ui(D),Di(W),ui(H),Di(O)),ne=Y.data,le=[];for(let te of q){let de=this.stride*te;le.push(ne[de+Ei]>1?Yi(ne,de,this.clusterProps):this.points[ne[de+ei]])}return le}getChildren(A){let P=this._getOriginId(A),D=this._getOriginZoom(A),O="No cluster with the specified id.",H=this.trees[D];if(!H)throw new Error(O);let W=H.data;if(P*this.stride>=W.length)throw new Error(O);let Y=this.options.radius/(this.options.extent*Math.pow(2,D-1)),q=H.within(W[P*this.stride],W[P*this.stride+1],Y),ne=[];for(let le of q){let te=le*this.stride;W[te+4]===A&&ne.push(W[te+Ei]>1?Yi(W,te,this.clusterProps):this.points[W[te+ei]])}if(ne.length===0)throw new Error(O);return ne}getLeaves(A,P,D){let O=[];return this._appendLeaves(O,A,P=P||10,D=D||0,0),O}getTile(A,P,D){let O=this.trees[this._limitZoom(A)],H=Math.pow(2,A),{extent:W,radius:Y}=this.options,q=Y/W,ne=(D-q)/H,le=(D+1+q)/H,te={features:[]};return this._addTileFeatures(O.range((P-q)/H,ne,(P+1+q)/H,le),O.data,P,D,H,te),P===0&&this._addTileFeatures(O.range(1-q/H,ne,1,le),O.data,H,D,H,te),P===H-1&&this._addTileFeatures(O.range(0,ne,q/H,le),O.data,-1,D,H,te),te.features.length?te:null}getClusterExpansionZoom(A){let P=this._getOriginZoom(A)-1;for(;P<=this.options.maxZoom;){let D=this.getChildren(A);if(P++,D.length!==1)break;A=D[0].properties.cluster_id}return P}_appendLeaves(A,P,D,O,H){let W=this.getChildren(P);for(let Y of W){let q=Y.properties;if(q&&q.cluster?H+q.point_count<=O?H+=q.point_count:H=this._appendLeaves(A,q.cluster_id,D,O,H):H1,le,te,de;if(ne)le=cn(P,q,this.clusterProps),te=P[q],de=P[q+1];else{let Ke=this.points[P[q+ei]];le=Ke.properties;let[je,Je]=Ke.geometry.coordinates;te=ui(je),de=Di(Je)}let Ee={type:1,geometry:[[Math.round(this.options.extent*(te*H-D)),Math.round(this.options.extent*(de*H-O))]],tags:le},De;De=ne||this.options.generateId?P[q+ei]:this.points[P[q+ei]].id,De!==void 0&&(Ee.id=De),W.features.push(Ee)}}_limitZoom(A){return Math.max(this.options.minZoom,Math.min(Math.floor(+A),this.options.maxZoom+1))}_cluster(A,P){let{radius:D,extent:O,reduce:H,minPoints:W}=this.options,Y=D/(O*Math.pow(2,P)),q=A.data,ne=[],le=this.stride;for(let te=0;teP&&(je+=q[Ge+Ei])}if(je>Ke&&je>=W){let Je,Ge=de*Ke,Pt=Ee*Ke,xt=-1,qe=((te/le|0)<<5)+(P+1)+this.points.length;for(let rt of De){let gt=rt*le;if(q[gt+2]<=P)continue;q[gt+2]=P;let kt=q[gt+Ei];Ge+=q[gt]*kt,Pt+=q[gt+1]*kt,q[gt+4]=qe,H&&(Je||(Je=this._map(q,te,!0),xt=this.clusterProps.length,this.clusterProps.push(Je)),H(Je,this._map(q,gt)))}q[te+4]=qe,ne.push(Ge/je,Pt/je,1/0,qe,-1,je),H&&ne.push(xt)}else{for(let Je=0;Je1)for(let Je of De){let Ge=Je*le;if(!(q[Ge+2]<=P)){q[Ge+2]=P;for(let Pt=0;Pt>5}_getOriginZoom(A){return(A-this.points.length)%32}_map(A,P,D){if(A[P+Ei]>1){let W=this.clusterProps[A[P+ln]];return D?Object.assign({},W):W}let O=this.points[A[P+ei]].properties,H=this.options.map(O);return D&&H===O?Object.assign({},H):H}}function Yi(N,A,P){return{type:"Feature",id:N[A+ei],properties:cn(N,A,P),geometry:{type:"Point",coordinates:[(D=N[A],360*(D-.5)),Vr(N[A+1])]}};var D}function cn(N,A,P){let D=N[A+Ei],O=D>=1e4?`${Math.round(D/1e3)}k`:D>=1e3?Math.round(D/100)/10+"k":D,H=N[A+ln],W=H===-1?{}:Object.assign({},P[H]);return Object.assign(W,{cluster:!0,cluster_id:N[A+ei],point_count:D,point_count_abbreviated:O})}function ui(N){return N/360+.5}function Di(N){let A=Math.sin(N*Math.PI/180),P=.5-.25*Math.log((1+A)/(1-A))/Math.PI;return P<0?0:P>1?1:P}function Vr(N){let A=(180-360*N)*Math.PI/180;return 360*Math.atan(Math.exp(A))/Math.PI-90}function Nr(N,A,P,D){let O=D,H=A+(P-A>>1),W,Y=P-A,q=N[A],ne=N[A+1],le=N[P],te=N[P+1];for(let de=A+3;deO)W=de,O=Ee;else if(Ee===O){let De=Math.abs(de-H);DeD&&(W-A>3&&Nr(N,A,W,D),N[W+2]=O,P-W>3&&Nr(N,W,P,D))}function Xn(N,A,P,D,O,H){let W=O-P,Y=H-D;if(W!==0||Y!==0){let q=((N-P)*W+(A-D)*Y)/(W*W+Y*Y);q>1?(P=O,D=H):q>0&&(P+=W*q,D+=Y*q)}return W=N-P,Y=A-D,W*W+Y*Y}function dr(N,A,P,D){let O={id:N??null,type:A,geometry:P,tags:D,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(A==="Point"||A==="MultiPoint"||A==="LineString")Tr(O,P);else if(A==="Polygon")Tr(O,P[0]);else if(A==="MultiLineString")for(let H of P)Tr(O,H);else if(A==="MultiPolygon")for(let H of P)Tr(O,H[0]);return O}function Tr(N,A){for(let P=0;P0&&(W+=D?(O*le-ne*H)/2:Math.sqrt(Math.pow(ne-O,2)+Math.pow(le-H,2))),O=ne,H=le}let Y=A.length-3;A[2]=1,Nr(A,0,Y,P),A[Y+2]=1,A.size=Math.abs(W),A.start=0,A.end=A.size}function jr(N,A,P,D){for(let O=0;O1?1:P}function yt(N,A,P,D,O,H,W,Y){if(D/=A,H>=(P/=A)&&W=D)return null;let q=[];for(let ne of N){let le=ne.geometry,te=ne.type,de=O===0?ne.minX:ne.minY,Ee=O===0?ne.maxX:ne.maxY;if(de>=P&&Ee=D)continue;let De=[];if(te==="Point"||te==="MultiPoint")Kn(le,De,P,D,O);else if(te==="LineString")Ir(le,De,P,D,O,!1,Y.lineMetrics);else if(te==="MultiLineString")un(le,De,P,D,O,!1);else if(te==="Polygon")un(le,De,P,D,O,!0);else if(te==="MultiPolygon")for(let Ke of le){let je=[];un(Ke,je,P,D,O,!0),je.length&&De.push(je)}if(De.length){if(Y.lineMetrics&&te==="LineString"){for(let Ke of De)q.push(dr(ne.id,te,Ke,ne.tags));continue}te!=="LineString"&&te!=="MultiLineString"||(De.length===1?(te="LineString",De=De[0]):te="MultiLineString"),te!=="Point"&&te!=="MultiPoint"||(te=De.length===3?"Point":"MultiPoint"),q.push(dr(ne.id,te,De,ne.tags))}}return q.length?q:null}function Kn(N,A,P,D,O){for(let H=0;H=P&&W<=D&&bi(A,N[H],N[H+1],N[H+2])}}function Ir(N,A,P,D,O,H,W){let Y=pr(N),q=O===0?Jn:Yn,ne,le,te=N.start;for(let je=0;jeP&&(le=q(Y,Je,Ge,xt,qe,P),W&&(Y.start=te+ne*le)):rt>D?gt=P&&(le=q(Y,Je,Ge,xt,qe,P),kt=!0),gt>D&&rt<=D&&(le=q(Y,Je,Ge,xt,qe,D),kt=!0),!H&&kt&&(W&&(Y.end=te+ne*le),A.push(Y),Y=pr(N)),W&&(te+=ne)}let de=N.length-3,Ee=N[de],De=N[de+1],Ke=O===0?Ee:De;Ke>=P&&Ke<=D&&bi(Y,Ee,De,N[de+2]),de=Y.length-3,H&&de>=3&&(Y[de]!==Y[0]||Y[de+1]!==Y[1])&&bi(Y,Y[0],Y[1],Y[2]),Y.length&&A.push(Y)}function pr(N){let A=[];return A.size=N.size,A.start=N.start,A.end=N.end,A}function un(N,A,P,D,O,H){for(let W of N)Ir(W,A,P,D,O,H,!1)}function bi(N,A,P,D){N.push(A,P,D)}function Jn(N,A,P,D,O,H){let W=(H-A)/(D-A);return bi(N,H,P+(O-P)*W,1),W}function Yn(N,A,P,D,O,H){let W=(H-P)/(O-P);return bi(N,A+(D-A)*W,H,1),W}function ue(N,A){let P=[];for(let D=0;D0&&A.size<(O?W:D))return void(P.numPoints+=A.length/3);let Y=[];for(let q=0;qW)&&(P.numSimplified++,Y.push(A[q],A[q+1])),P.numPoints++;O&&function(q,ne){let le=0;for(let te=0,de=q.length,Ee=de-2;te0===ne)for(let te=0,de=q.length;te24)throw new Error("maxZoom should be in the 0-24 range");if(P.promoteId&&P.generateId)throw new Error("promoteId and generateId cannot be used together.");let O=function(H,W){let Y=[];if(H.type==="FeatureCollection")for(let q=0;q1&&console.time("creation"),Ee=this.tiles[de]=Pr(A,P,D,O,ne),this.tileCoords.push({z:P,x:D,y:O}),le)){le>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",P,D,O,Ee.numFeatures,Ee.numPoints,Ee.numSimplified),console.timeEnd("creation"));let kt=`z${P}`;this.stats[kt]=(this.stats[kt]||0)+1,this.total++}if(Ee.source=A,H==null){if(P===ne.indexMaxZoom||Ee.numPoints<=ne.indexMaxPoints)continue}else{if(P===ne.maxZoom||P===H)continue;if(H!=null){let kt=H-P;if(D!==W>>kt||O!==Y>>kt)continue}}if(Ee.source=null,A.length===0)continue;le>1&&console.time("clipping");let De=.5*ne.buffer/ne.extent,Ke=.5-De,je=.5+De,Je=1+De,Ge=null,Pt=null,xt=null,qe=null,rt=yt(A,te,D-De,D+je,0,Ee.minX,Ee.maxX,ne),gt=yt(A,te,D+Ke,D+Je,0,Ee.minX,Ee.maxX,ne);A=null,rt&&(Ge=yt(rt,te,O-De,O+je,1,Ee.minY,Ee.maxY,ne),Pt=yt(rt,te,O+Ke,O+Je,1,Ee.minY,Ee.maxY,ne),rt=null),gt&&(xt=yt(gt,te,O-De,O+je,1,Ee.minY,Ee.maxY,ne),qe=yt(gt,te,O+Ke,O+Je,1,Ee.minY,Ee.maxY,ne),gt=null),le>1&&console.timeEnd("clipping"),q.push(Ge||[],P+1,2*D,2*O),q.push(Pt||[],P+1,2*D,2*O+1),q.push(xt||[],P+1,2*D+1,2*O),q.push(qe||[],P+1,2*D+1,2*O+1)}}getTile(A,P,D){A=+A,P=+P,D=+D;let O=this.options,{extent:H,debug:W}=O;if(A<0||A>24)return null;let Y=1<1&&console.log("drilling down to z%d-%d-%d",A,P,D);let ne,le=A,te=P,de=D;for(;!ne&&le>0;)le--,te>>=1,de>>=1,ne=this.tiles[Li(le,te,de)];return ne&&ne.source?(W>1&&(console.log("found parent tile z%d-%d-%d",le,te,de),console.time("drilling down")),this.splitTile(ne.source,le,te,de,A,P,D),W>1&&console.timeEnd("drilling down"),this.tiles[q]?Xt(this.tiles[q],H):null):null}}function Li(N,A,P){return 32*((1<{te.properties=Ee;let De={};for(let Ke of de)De[Ke]=q[Ke].evaluate(le,te);return De},W.reduce=(Ee,De)=>{te.properties=De;for(let Ke of de)le.accumulated=Ee[Ke],Ee[Ke]=ne[Ke].evaluate(le,te)},W}(A)).load((yield this._pendingData).features):(O=yield this._pendingData,new ti(O,A.geojsonVtOptions)),this.loaded={};let H={};if(D){let W=D.finish();W&&(H.resourceTiming={},H.resourceTiming[A.source]=JSON.parse(JSON.stringify(W)))}return H}catch(H){if(delete this._pendingRequest,L.bB(H))return{abandoned:!0};throw H}var O})}getData(){return L._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(A){let P=this.loaded;return P&&P[A.uid]?super.reloadTile(A):this.loadTile(A)}loadAndProcessGeoJSON(A,P){return L._(this,void 0,void 0,function*(){let D=yield this.loadGeoJSON(A,P);if(delete this._pendingRequest,typeof D!="object")throw new Error(`Input data given to '${A.source}' is not a valid GeoJSON object.`);if(Xi(D,!0),A.filter){let O=L.bC(A.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(O.result==="error")throw new Error(O.value.map(W=>`${W.key}: ${W.message}`).join(", "));D={type:"FeatureCollection",features:D.features.filter(W=>O.value.evaluate({zoom:0},W))}}return D})}loadGeoJSON(A,P){return L._(this,void 0,void 0,function*(){let{promoteId:D}=A;if(A.request){let O=yield L.h(A.request,P);return this._dataUpdateable=tr(O.data,D)?fr(O.data,D):void 0,O.data}if(typeof A.data=="string")try{let O=JSON.parse(A.data);return this._dataUpdateable=tr(O,D)?fr(O,D):void 0,O}catch{throw new Error(`Input data given to '${A.source}' is not a valid GeoJSON object.`)}if(!A.dataDiff)throw new Error(`Input data given to '${A.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${A.source}`);return function(O,H,W){var Y,q,ne,le;if(H.removeAll&&O.clear(),H.remove)for(let te of H.remove)O.delete(te);if(H.add)for(let te of H.add){let de=Ne(te,W);de!=null&&O.set(de,te)}if(H.update)for(let te of H.update){let de=O.get(te.id);if(de==null)continue;let Ee=!te.removeAllProperties&&(((Y=te.removeProperties)===null||Y===void 0?void 0:Y.length)>0||((q=te.addOrUpdateProperties)===null||q===void 0?void 0:q.length)>0);if((te.newGeometry||te.removeAllProperties||Ee)&&(de=Object.assign({},de),O.set(te.id,de),Ee&&(de.properties=Object.assign({},de.properties))),te.newGeometry&&(de.geometry=te.newGeometry),te.removeAllProperties)de.properties={};else if(((ne=te.removeProperties)===null||ne===void 0?void 0:ne.length)>0)for(let De of te.removeProperties)Object.prototype.hasOwnProperty.call(de.properties,De)&&delete de.properties[De];if(((le=te.addOrUpdateProperties)===null||le===void 0?void 0:le.length)>0)for(let{key:De,value:Ke}of te.addOrUpdateProperties)de.properties[De]=Ke}}(this._dataUpdateable,A.dataDiff,D),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(A){return L._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(A){return this._geoJSONIndex.getClusterExpansionZoom(A.clusterId)}getClusterChildren(A){return this._geoJSONIndex.getChildren(A.clusterId)}getClusterLeaves(A){return this._geoJSONIndex.getLeaves(A.clusterId,A.limit,A.offset)}}class ir{constructor(A){this.self=A,this.actor=new L.F(A),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(P,D)=>{if(this.externalWorkerSourceTypes[P])throw new Error(`Worker source with name "${P}" already registered.`);this.externalWorkerSourceTypes[P]=D},this.self.addProtocol=L.bi,this.self.removeProtocol=L.bj,this.self.registerRTLTextPlugin=P=>{if(L.bD.isParsed())throw new Error("RTL text plugin already registered.");L.bD.setMethods(P)},this.actor.registerMessageHandler("LDT",(P,D)=>this._getDEMWorkerSource(P,D.source).loadTile(D)),this.actor.registerMessageHandler("RDT",(P,D)=>L._(this,void 0,void 0,function*(){this._getDEMWorkerSource(P,D.source).removeTile(D)})),this.actor.registerMessageHandler("GCEZ",(P,D)=>L._(this,void 0,void 0,function*(){return this._getWorkerSource(P,D.type,D.source).getClusterExpansionZoom(D)})),this.actor.registerMessageHandler("GCC",(P,D)=>L._(this,void 0,void 0,function*(){return this._getWorkerSource(P,D.type,D.source).getClusterChildren(D)})),this.actor.registerMessageHandler("GCL",(P,D)=>L._(this,void 0,void 0,function*(){return this._getWorkerSource(P,D.type,D.source).getClusterLeaves(D)})),this.actor.registerMessageHandler("LD",(P,D)=>this._getWorkerSource(P,D.type,D.source).loadData(D)),this.actor.registerMessageHandler("GD",(P,D)=>this._getWorkerSource(P,D.type,D.source).getData()),this.actor.registerMessageHandler("LT",(P,D)=>this._getWorkerSource(P,D.type,D.source).loadTile(D)),this.actor.registerMessageHandler("RT",(P,D)=>this._getWorkerSource(P,D.type,D.source).reloadTile(D)),this.actor.registerMessageHandler("AT",(P,D)=>this._getWorkerSource(P,D.type,D.source).abortTile(D)),this.actor.registerMessageHandler("RMT",(P,D)=>this._getWorkerSource(P,D.type,D.source).removeTile(D)),this.actor.registerMessageHandler("RS",(P,D)=>L._(this,void 0,void 0,function*(){if(!this.workerSources[P]||!this.workerSources[P][D.type]||!this.workerSources[P][D.type][D.source])return;let O=this.workerSources[P][D.type][D.source];delete this.workerSources[P][D.type][D.source],O.removeSource!==void 0&&O.removeSource(D)})),this.actor.registerMessageHandler("RM",P=>L._(this,void 0,void 0,function*(){delete this.layerIndexes[P],delete this.availableImages[P],delete this.workerSources[P],delete this.demWorkerSources[P]})),this.actor.registerMessageHandler("SR",(P,D)=>L._(this,void 0,void 0,function*(){this.referrer=D})),this.actor.registerMessageHandler("SRPS",(P,D)=>this._syncRTLPluginState(P,D)),this.actor.registerMessageHandler("IS",(P,D)=>L._(this,void 0,void 0,function*(){this.self.importScripts(D)})),this.actor.registerMessageHandler("SI",(P,D)=>this._setImages(P,D)),this.actor.registerMessageHandler("UL",(P,D)=>L._(this,void 0,void 0,function*(){this._getLayerIndex(P).update(D.layers,D.removedIds)})),this.actor.registerMessageHandler("SL",(P,D)=>L._(this,void 0,void 0,function*(){this._getLayerIndex(P).replace(D)}))}_setImages(A,P){return L._(this,void 0,void 0,function*(){this.availableImages[A]=P;for(let D in this.workerSources[A]){let O=this.workerSources[A][D];for(let H in O)O[H].availableImages=P}})}_syncRTLPluginState(A,P){return L._(this,void 0,void 0,function*(){if(L.bD.isParsed())return L.bD.getState();if(P.pluginStatus!=="loading")return L.bD.setState(P),P;let D=P.pluginURL;if(this.self.importScripts(D),L.bD.isParsed()){let O={pluginStatus:"loaded",pluginURL:D};return L.bD.setState(O),O}throw L.bD.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${D}`)})}_getAvailableImages(A){let P=this.availableImages[A];return P||(P=[]),P}_getLayerIndex(A){let P=this.layerIndexes[A];return P||(P=this.layerIndexes[A]=new p),P}_getWorkerSource(A,P,D){if(this.workerSources[A]||(this.workerSources[A]={}),this.workerSources[A][P]||(this.workerSources[A][P]={}),!this.workerSources[A][P][D]){let O={sendAsync:(H,W)=>(H.targetMapId=A,this.actor.sendAsync(H,W))};switch(P){case"vector":this.workerSources[A][P][D]=new me(O,this._getLayerIndex(A),this._getAvailableImages(A));break;case"geojson":this.workerSources[A][P][D]=new Ar(O,this._getLayerIndex(A),this._getAvailableImages(A));break;default:this.workerSources[A][P][D]=new this.externalWorkerSourceTypes[P](O,this._getLayerIndex(A),this._getAvailableImages(A))}}return this.workerSources[A][P][D]}_getDEMWorkerSource(A,P){return this.demWorkerSources[A]||(this.demWorkerSources[A]={}),this.demWorkerSources[A][P]||(this.demWorkerSources[A][P]=new se),this.demWorkerSources[A][P]}}return L.i(self)&&(self.worker=new ir(self)),ir}),Ll("index",["exports","./shared"],function(L,p){"use strict";var ki="4.7.1";let Hi,Gt,me={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:h=>new Promise((e,n)=>{let a=requestAnimationFrame(e);h.signal.addEventListener("abort",()=>{cancelAnimationFrame(a),n(p.c())})}),getImageData(h,e=0){return this.getImageCanvasContext(h).getImageData(-e,-e,h.width+2*e,h.height+2*e)},getImageCanvasContext(h){let e=window.document.createElement("canvas"),n=e.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("failed to create canvas 2d context");return e.width=h.width,e.height=h.height,n.drawImage(h,0,0,h.width,h.height),n},resolveURL:h=>(Hi||(Hi=document.createElement("a")),Hi.href=h,Hi.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Gt==null&&(Gt=matchMedia("(prefers-reduced-motion: reduce)")),Gt.matches)}};class se{static testProp(e){if(!se.docStyle)return e[0];for(let n=0;n{window.removeEventListener("click",se.suppressClickInternal,!0)},0)}static getScale(e){let n=e.getBoundingClientRect();return{x:n.width/e.offsetWidth||1,y:n.height/e.offsetHeight||1,boundingClientRect:n}}static getPoint(e,n,a){let o=n.boundingClientRect;return new p.P((a.clientX-o.left)/n.x-e.clientLeft,(a.clientY-o.top)/n.y-e.clientTop)}static mousePos(e,n){let a=se.getScale(e);return se.getPoint(e,a,n)}static touchPos(e,n){let a=[],o=se.getScale(e);for(let c=0;c{vr&&Gn(vr),vr=null,cr=!0},Xi.onerror=()=>{br=!0,vr=null},Xi.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(h){let e,n,a,o;h.resetRequestQueue=()=>{e=[],n=0,a=0,o={}},h.addThrottleControl=y=>{let b=a++;return o[b]=y,b},h.removeThrottleControl=y=>{delete o[y],m()},h.getImage=(y,b,T=!0)=>new Promise((S,C)=>{Fr.supported&&(y.headers||(y.headers={}),y.headers.accept="image/webp,*/*"),p.e(y,{type:"image"}),e.push({abortController:b,requestParameters:y,supportImageRefresh:T,state:"queued",onError:E=>{C(E)},onSuccess:E=>{S(E)}}),m()});let c=y=>p._(this,void 0,void 0,function*(){y.state="running";let{requestParameters:b,supportImageRefresh:T,onError:S,onSuccess:C,abortController:E}=y,R=T===!1&&!p.i(self)&&!p.g(b.url)&&(!b.headers||Object.keys(b.headers).reduce(($,Z)=>$&&Z==="accept",!0));n++;let V=R?g(b,E):p.m(b,E);try{let $=yield V;delete y.abortController,y.state="completed",$.data instanceof HTMLImageElement||p.b($.data)?C($):$.data&&C({data:yield(U=$.data,typeof createImageBitmap=="function"?p.d(U):p.f(U)),cacheControl:$.cacheControl,expires:$.expires})}catch($){delete y.abortController,S($)}finally{n--,m()}var U}),m=()=>{let y=(()=>{for(let b of Object.keys(o))if(o[b]())return!0;return!1})()?p.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:p.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let b=n;b0;b++){let T=e.shift();T.abortController.signal.aborted?b--:c(T)}},g=(y,b)=>new Promise((T,S)=>{let C=new Image,E=y.url,R=y.credentials;R&&R==="include"?C.crossOrigin="use-credentials":(R&&R==="same-origin"||!p.s(E))&&(C.crossOrigin="anonymous"),b.signal.addEventListener("abort",()=>{C.src="",S(p.c())}),C.fetchPriority="high",C.onload=()=>{C.onerror=C.onload=null,T({data:C})},C.onerror=()=>{C.onerror=C.onload=null,b.signal.aborted||S(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."))},C.src=E})}(hi||(hi={})),hi.resetRequestQueue();class wa{constructor(e){this._transformRequestFn=e}transformRequest(e,n){return this._transformRequestFn&&this._transformRequestFn(e,n)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function zi(h){var e=new p.A(3);return e[0]=h[0],e[1]=h[1],e[2]=h[2],e}var Wi,vi=function(h,e,n){return h[0]=e[0]-n[0],h[1]=e[1]-n[1],h[2]=e[2]-n[2],h};Wi=new p.A(3),p.A!=Float32Array&&(Wi[0]=0,Wi[1]=0,Wi[2]=0);var Is=function(h){var e=h[0],n=h[1];return e*e+n*n};function Ki(h){let e=[];if(typeof h=="string")e.push({id:"default",url:h});else if(h&&h.length>0){let n=[];for(let{id:a,url:o}of h){let c=`${a}${o}`;n.indexOf(c)===-1&&(n.push(c),e.push({id:a,url:o}))}}return e}function Hn(h,e,n){let a=h.split("?");return a[0]+=`${e}${n}`,a.join("?")}(function(){var h=new p.A(2);p.A!=Float32Array&&(h[0]=0,h[1]=0)})();class st{constructor(e,n,a,o){this.context=e,this.format=a,this.texture=e.gl.createTexture(),this.update(n,o)}update(e,n,a){let{width:o,height:c}=e,m=!(this.size&&this.size[0]===o&&this.size[1]===c||a),{context:g}=this,{gl:y}=g;if(this.useMipmap=!!(n&&n.useMipmap),y.bindTexture(y.TEXTURE_2D,this.texture),g.pixelStoreUnpackFlipY.set(!1),g.pixelStoreUnpack.set(1),g.pixelStoreUnpackPremultiplyAlpha.set(this.format===y.RGBA&&(!n||n.premultiply!==!1)),m)this.size=[o,c],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||p.b(e)?y.texImage2D(y.TEXTURE_2D,0,this.format,this.format,y.UNSIGNED_BYTE,e):y.texImage2D(y.TEXTURE_2D,0,this.format,o,c,0,this.format,y.UNSIGNED_BYTE,e.data);else{let{x:b,y:T}=a||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||p.b(e)?y.texSubImage2D(y.TEXTURE_2D,0,b,T,y.RGBA,y.UNSIGNED_BYTE,e):y.texSubImage2D(y.TEXTURE_2D,0,b,T,o,c,y.RGBA,y.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&y.generateMipmap(y.TEXTURE_2D)}bind(e,n,a){let{context:o}=this,{gl:c}=o;c.bindTexture(c.TEXTURE_2D,this.texture),a!==c.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(a=c.LINEAR),e!==this.filter&&(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,e),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,a||e),this.filter=e),n!==this.wrap&&(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,n),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,n),this.wrap=n)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}function Ps(h){let{userImage:e}=h;return!!(e&&e.render&&e.render())&&(h.data.replace(new Uint8Array(e.data.buffer)),!0)}class Ft extends p.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new p.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:n,promiseResolve:a}of this.requestors)a(this._getImagesForIds(n));this.requestors=[]}}getImage(e){let n=this.images[e];if(n&&!n.data&&n.spriteData){let a=n.spriteData;n.data=new p.R({width:a.width,height:a.height},a.context.getImageData(a.x,a.y,a.width,a.height).data),n.spriteData=null}return n}addImage(e,n){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,n)&&(this.images[e]=n)}_validate(e,n){let a=!0,o=n.data||n.spriteData;return this._validateStretch(n.stretchX,o&&o.width)||(this.fire(new p.j(new Error(`Image "${e}" has invalid "stretchX" value`))),a=!1),this._validateStretch(n.stretchY,o&&o.height)||(this.fire(new p.j(new Error(`Image "${e}" has invalid "stretchY" value`))),a=!1),this._validateContent(n.content,n)||(this.fire(new p.j(new Error(`Image "${e}" has invalid "content" value`))),a=!1),a}_validateStretch(e,n){if(!e)return!0;let a=0;for(let o of e){if(o[0]{let o=!0;if(!this.isLoaded())for(let c of e)this.images[c]||(o=!1);this.isLoaded()||o?n(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:n})})}_getImagesForIds(e){let n={};for(let a of e){let o=this.getImage(a);o||(this.fire(new p.k("styleimagemissing",{id:a})),o=this.getImage(a)),o?n[a]={data:o.data.clone(),pixelRatio:o.pixelRatio,sdf:o.sdf,version:o.version,stretchX:o.stretchX,stretchY:o.stretchY,content:o.content,textFitWidth:o.textFitWidth,textFitHeight:o.textFitHeight,hasRenderCallback:!!(o.userImage&&o.userImage.render)}:p.w(`Image "${a}" 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 n}getPixelSize(){let{width:e,height:n}=this.atlasImage;return{width:e,height:n}}getPattern(e){let n=this.patterns[e],a=this.getImage(e);if(!a)return null;if(n&&n.position.version===a.version)return n.position;if(n)n.position.version=a.version;else{let o={w:a.data.width+2,h:a.data.height+2,x:0,y:0},c=new p.I(o,a);this.patterns[e]={bin:o,position:c}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){let n=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new st(e,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){let e=[];for(let c in this.patterns)e.push(this.patterns[c].bin);let{w:n,h:a}=p.p(e),o=this.atlasImage;o.resize({width:n||1,height:a||1});for(let c in this.patterns){let{bin:m}=this.patterns[c],g=m.x+1,y=m.y+1,b=this.getImage(c).data,T=b.width,S=b.height;p.R.copy(b,o,{x:0,y:0},{x:g,y},{width:T,height:S}),p.R.copy(b,o,{x:0,y:S-1},{x:g,y:y-1},{width:T,height:1}),p.R.copy(b,o,{x:0,y:0},{x:g,y:y+S},{width:T,height:1}),p.R.copy(b,o,{x:T-1,y:0},{x:g-1,y},{width:1,height:S}),p.R.copy(b,o,{x:0,y:0},{x:g+T,y},{width:1,height:S})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let n of e){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;let a=this.getImage(n);a||p.w(`Image with ID: "${n}" was not found`),Ps(a)&&this.updateImage(n,a)}}}let Ht=1e20;function hr(h,e,n,a,o,c,m,g,y){for(let b=e;b-1);y++,c[y]=g,m[y]=b,m[y+1]=Ht}for(let g=0,y=0;g65535)throw new Error("glyphs > 65535 not supported");if(a.ranges[c])return{stack:e,id:n,glyph:o};if(!this.url)throw new Error("glyphsUrl is not set");if(!a.requests[c]){let g=Ji.loadGlyphRange(e,c,this.url,this.requestManager);a.requests[c]=g}let m=yield a.requests[c];for(let g in m)this._doesCharSupportLocalGlyph(+g)||(a.glyphs[+g]=m[+g]);return a.ranges[c]=!0,{stack:e,id:n,glyph:m[n]||null}})}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&/\p{Ideo}|\p{sc=Hang}|\p{sc=Hira}|\p{sc=Kana}/u.test(String.fromCodePoint(e))}_tinySDF(e,n,a){let o=this.localIdeographFontFamily;if(!o||!this._doesCharSupportLocalGlyph(a))return;let c=e.tinySDF;if(!c){let g="400";/bold/i.test(n)?g="900":/medium/i.test(n)?g="500":/light/i.test(n)&&(g="200"),c=e.tinySDF=new Ji.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:o,fontWeight:g})}let m=c.draw(String.fromCharCode(a));return{id:a,bitmap:new p.o({width:m.width||60,height:m.height||60},m.data),metrics:{width:m.glyphWidth/2||24,height:m.glyphHeight/2||24,left:m.glyphLeft/2+.5||0,top:m.glyphTop/2-27.5||-8,advance:m.glyphAdvance/2||24,isDoubleResolution:!0}}}}Ji.loadGlyphRange=function(h,e,n,a){return p._(this,void 0,void 0,function*(){let o=256*e,c=o+255,m=a.transformRequest(n.replace("{fontstack}",h).replace("{range}",`${o}-${c}`),"Glyphs"),g=yield p.l(m,new AbortController);if(!g||!g.data)throw new Error(`Could not load glyph range. range: ${e}, ${o}-${c}`);let y={};for(let b of p.n(g.data))y[b.id]=b;return y})},Ji.TinySDF=class{constructor({fontSize:h=24,buffer:e=3,radius:n=8,cutoff:a=.25,fontFamily:o="sans-serif",fontWeight:c="normal",fontStyle:m="normal"}={}){this.buffer=e,this.cutoff=a,this.radius=n;let g=this.size=h+4*e,y=this._createCanvas(g),b=this.ctx=y.getContext("2d",{willReadFrequently:!0});b.font=`${m} ${c} ${h}px ${o}`,b.textBaseline="alphabetic",b.textAlign="left",b.fillStyle="black",this.gridOuter=new Float64Array(g*g),this.gridInner=new Float64Array(g*g),this.f=new Float64Array(g),this.z=new Float64Array(g+1),this.v=new Uint16Array(g)}_createCanvas(h){let e=document.createElement("canvas");return e.width=e.height=h,e}draw(h){let{width:e,actualBoundingBoxAscent:n,actualBoundingBoxDescent:a,actualBoundingBoxLeft:o,actualBoundingBoxRight:c}=this.ctx.measureText(h),m=Math.ceil(n),g=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(c-o))),y=Math.min(this.size-this.buffer,m+Math.ceil(a)),b=g+2*this.buffer,T=y+2*this.buffer,S=Math.max(b*T,0),C=new Uint8ClampedArray(S),E={data:C,width:b,height:T,glyphWidth:g,glyphHeight:y,glyphTop:m,glyphLeft:0,glyphAdvance:e};if(g===0||y===0)return E;let{ctx:R,buffer:V,gridInner:U,gridOuter:$}=this;R.clearRect(V,V,g,y),R.fillText(h,V,V+m);let Z=R.getImageData(V,V,g,y);$.fill(Ht,0,S),U.fill(0,0,S);for(let B=0;B0?oe*oe:0,U[ee]=oe<0?oe*oe:0}}hr($,0,0,b,T,b,this.f,this.v,this.z),hr(U,V,V,g,y,b,this.f,this.v,this.z);for(let B=0;B1&&(y=e[++g]);let T=Math.abs(b-y.left),S=Math.abs(b-y.right),C=Math.min(T,S),E,R=c/a*(o+1);if(y.isDash){let V=o-Math.abs(R);E=Math.sqrt(C*C+V*V)}else E=o-Math.sqrt(C*C+R*R);this.data[m+b]=Math.max(0,Math.min(255,E+128))}}}addRegularDash(e){for(let g=e.length-1;g>=0;--g){let y=e[g],b=e[g+1];y.zeroLength?e.splice(g,1):b&&b.isDash===y.isDash&&(b.left=y.left,e.splice(g,1))}let n=e[0],a=e[e.length-1];n.isDash===a.isDash&&(n.left=a.left-this.width,a.right=n.right+this.width);let o=this.width*this.nextRow,c=0,m=e[c];for(let g=0;g1&&(m=e[++c]);let y=Math.abs(g-m.left),b=Math.abs(g-m.right),T=Math.min(y,b);this.data[o+g]=Math.max(0,Math.min(255,(m.isDash?T:-T)+128))}}addDash(e,n){let a=n?7:0,o=2*a+1;if(this.nextRow+o>this.height)return p.w("LineAtlas out of space"),null;let c=0;for(let g=0;g{n.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[wr]}numActive(){return Object.keys(this.active).length}}let cn=Math.floor(me.hardwareConcurrency/2),ui,Di;function Vr(){return ui||(ui=new Yi),ui}Yi.workerCount=p.C(globalThis)?Math.max(Math.min(cn,3),1):1;class Nr{constructor(e,n){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=n;let a=this.workerPool.acquire(n);for(let o=0;o{n.remove()}),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,n){for(let a of this.actors)a.registerMessageHandler(e,n)}}function Xn(){return Di||(Di=new Nr(Vr(),p.G),Di.registerMessageHandler("GR",(h,e,n)=>p.m(e,n))),Di}function dr(h,e){let n=p.H();return p.J(n,n,[1,1,0]),p.K(n,n,[.5*h.width,.5*h.height,1]),p.L(n,n,h.calculatePosMatrix(e.toUnwrapped()))}function Tr(h,e,n,a,o,c){let m=function(S,C,E){if(S)for(let R of S){let V=C[R];if(V&&V.source===E&&V.type==="fill-extrusion")return!0}else for(let R in C){let V=C[R];if(V.source===E&&V.type==="fill-extrusion")return!0}return!1}(o&&o.layers,e,h.id),g=c.maxPitchScaleFactor(),y=h.tilesIn(a,g,m);y.sort(Sr);let b=[];for(let S of y)b.push({wrappedTileID:S.tileID.wrapped().key,queryResults:S.tile.queryRenderedFeatures(e,n,h._state,S.queryGeometry,S.cameraQueryGeometry,S.scale,o,c,g,dr(h.transform,S.tileID))});let T=function(S){let C={},E={};for(let R of S){let V=R.queryResults,U=R.wrappedTileID,$=E[U]=E[U]||{};for(let Z in V){let B=V[Z],X=$[Z]=$[Z]||{},K=C[Z]=C[Z]||[];for(let ee of B)X[ee.featureIndex]||(X[ee.featureIndex]=!0,K.push(ee))}}return C}(b);for(let S in T)T[S].forEach(C=>{let E=C.feature,R=h.getFeatureState(E.layer["source-layer"],E.id);E.source=E.layer.source,E.layer["source-layer"]&&(E.sourceLayer=E.layer["source-layer"]),E.state=R});return T}function Sr(h,e){let n=h.tileID,a=e.tileID;return n.overscaledZ-a.overscaledZ||n.canonical.y-a.canonical.y||n.wrap-a.wrap||n.canonical.x-a.canonical.x}function hn(h,e,n){return p._(this,void 0,void 0,function*(){let a=h;if(h.url?a=(yield p.h(e.transformRequest(h.url,"Source"),n)).data:yield me.frameAsync(n),!a)return null;let o=p.M(p.e(a,h),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in a&&a.vector_layers&&(o.vectorLayerIds=a.vector_layers.map(c=>c.id)),o})}class ie{constructor(e,n){e&&(n?this.setSouthWest(e).setNorthEast(n):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof p.N?new p.N(e.lng,e.lat):p.N.convert(e),this}setSouthWest(e){return this._sw=e instanceof p.N?new p.N(e.lng,e.lat):p.N.convert(e),this}extend(e){let n=this._sw,a=this._ne,o,c;if(e instanceof p.N)o=e,c=e;else{if(!(e instanceof ie))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(ie.convert(e)):this.extend(p.N.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(p.N.convert(e)):this;if(o=e._sw,c=e._ne,!o||!c)return this}return n||a?(n.lng=Math.min(o.lng,n.lng),n.lat=Math.min(o.lat,n.lat),a.lng=Math.max(c.lng,a.lng),a.lat=Math.max(c.lat,a.lat)):(this._sw=new p.N(o.lng,o.lat),this._ne=new p.N(c.lng,c.lat)),this}getCenter(){return new p.N((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 p.N(this.getWest(),this.getNorth())}getSouthEast(){return new p.N(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(e){let{lng:n,lat:a}=p.N.convert(e),o=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=a&&a<=this._ne.lat&&o}static convert(e){return e instanceof ie?e:e&&new ie(e)}static fromLngLat(e,n=0){let a=360*n/40075017,o=a/Math.cos(Math.PI/180*e.lat);return new ie(new p.N(e.lng-o,e.lat-a),new p.N(e.lng+o,e.lat+a))}adjustAntiMeridian(){let e=new p.N(this._sw.lng,this._sw.lat),n=new p.N(this._ne.lng,this._ne.lat);return new ie(e,e.lng>n.lng?new p.N(n.lng+360,n.lat):n)}}class jr{constructor(e,n,a){this.bounds=ie.convert(this.validateBounds(e)),this.minzoom=n||0,this.maxzoom=a||24}validateBounds(e){return Array.isArray(e)&&e.length===4?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){let n=Math.pow(2,e.z),a=Math.floor(p.O(this.bounds.getWest())*n),o=Math.floor(p.Q(this.bounds.getNorth())*n),c=Math.ceil(p.O(this.bounds.getEast())*n),m=Math.ceil(p.Q(this.bounds.getSouth())*n);return e.x>=a&&e.x=o&&e.y{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return p.e({},this._options)}loadTile(e){return p._(this,void 0,void 0,function*(){let n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),a={request:this.map._requestManager.transformRequest(n,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};a.request.collectResourceTiming=this._collectResourceTiming;let o="RT";if(e.actor&&e.state!=="expired"){if(e.state==="loading")return new Promise((c,m)=>{e.reloadPromise={resolve:c,reject:m}})}else e.actor=this.dispatcher.getActor(),o="LT";e.abortController=new AbortController;try{let c=yield e.actor.sendAsync({type:o,data:a},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,c)}catch(c){if(delete e.abortController,e.aborted)return;if(c&&c.status!==404)throw c;this._afterTileLoadWorkerResponse(e,null)}})}_afterTileLoadWorkerResponse(e,n){if(n&&n.resourceTiming&&(e.resourceTiming=n.resourceTiming),n&&this.map._refreshExpiredTiles&&e.setExpiryData(n),e.loadVectorData(n,this.map.painter),e.reloadPromise){let a=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(a.resolve).catch(a.reject)}}abortTile(e){return p._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}}))})}unloadTile(e){return p._(this,void 0,void 0,function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class et extends p.E{constructor(e,n,a,o){super(),this.id=e,this.dispatcher=a,this.setEventedParent(o),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=p.e({type:"raster"},n),p.e(this,p.M(n,["url","scheme","tileSize"]))}load(){return p._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new p.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let e=yield hn(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,e&&(p.e(this,e),e.bounds&&(this.tileBounds=new jr(e.bounds,this.minzoom,this.maxzoom)),this.fire(new p.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new p.k("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new p.j(e))}})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return p.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return p._(this,void 0,void 0,function*(){let n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{let a=yield hi.getImage(this.map._requestManager.transformRequest(n,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(a&&a.data){this.map._refreshExpiredTiles&&a.cacheControl&&a.expires&&e.setExpiryData({cacheControl:a.cacheControl,expires:a.expires});let o=this.map.painter.context,c=o.gl,m=a.data;e.texture=this.map.painter.getTileTexture(m.width),e.texture?e.texture.update(m,{useMipmap:!0}):(e.texture=new st(o,m,c.RGBA,{useMipmap:!0}),e.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE,c.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(a){if(delete e.abortController,e.aborted)e.state="unloaded";else if(a)throw e.state="errored",a}})}abortTile(e){return p._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)})}unloadTile(e){return p._(this,void 0,void 0,function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)})}hasTransition(){return!1}}class yt extends et{constructor(e,n,a,o){super(e,n,a,o),this.type="raster-dem",this.maxzoom=22,this._options=p.e({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox",this.redFactor=n.redFactor,this.greenFactor=n.greenFactor,this.blueFactor=n.blueFactor,this.baseShift=n.baseShift}loadTile(e){return p._(this,void 0,void 0,function*(){let n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),a=this.map._requestManager.transformRequest(n,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{let o=yield hi.getImage(a,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(o&&o.data){let c=o.data;this.map._refreshExpiredTiles&&o.cacheControl&&o.expires&&e.setExpiryData({cacheControl:o.cacheControl,expires:o.expires});let m=p.b(c)&&p.U()?c:yield this.readImageNow(c),g={type:this.type,uid:e.uid,source:this.id,rawImageData:m,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||e.state==="expired"){e.actor=this.dispatcher.getActor();let y=yield e.actor.sendAsync({type:"LDT",data:g});e.dem=y,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(o){if(delete e.abortController,e.aborted)e.state="unloaded";else if(o)throw e.state="errored",o}})}readImageNow(e){return p._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&p.V()){let n=e.width+2,a=e.height+2;try{return new p.R({width:n,height:a},yield p.W(e,-1,-1,n,a))}catch{}}return me.getImageData(e,1)})}_getNeighboringTiles(e){let n=e.canonical,a=Math.pow(2,n.z),o=(n.x-1+a)%a,c=n.x===0?e.wrap-1:e.wrap,m=(n.x+1+a)%a,g=n.x+1===a?e.wrap+1:e.wrap,y={};return y[new p.S(e.overscaledZ,c,n.z,o,n.y).key]={backfilled:!1},y[new p.S(e.overscaledZ,g,n.z,m,n.y).key]={backfilled:!1},n.y>0&&(y[new p.S(e.overscaledZ,c,n.z,o,n.y-1).key]={backfilled:!1},y[new p.S(e.overscaledZ,e.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},y[new p.S(e.overscaledZ,g,n.z,m,n.y-1).key]={backfilled:!1}),n.y+10&&p.e(c,{resourceTiming:o}),this.fire(new p.k("data",Object.assign(Object.assign({},c),{sourceDataType:"metadata"}))),this.fire(new p.k("data",Object.assign(Object.assign({},c),{sourceDataType:"content"})))}catch(a){if(this._pendingLoads--,this._removed)return void this.fire(new p.k("dataabort",{dataType:"source"}));this.fire(new p.j(a))}})}loaded(){return this._pendingLoads===0}loadTile(e){return p._(this,void 0,void 0,function*(){let n=e.actor?"RT":"LT";e.actor=this.actor;let a={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};e.abortController=new AbortController;let o=yield this.actor.sendAsync({type:n,data:a},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(o,this.map.painter,n==="RT")})}abortTile(e){return p._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0})}unloadTile(e){return p._(this,void 0,void 0,function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:e.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 p.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Ir=p.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class pr extends p.E{constructor(e,n,a,o){super(),this.id=e,this.dispatcher=a,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(o),this.options=n}load(e){return p._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new p.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{let n=yield hi.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,n&&n.data&&(this.image=n.data,e&&(this.coordinates=e),this._finishLoading())}catch(n){this._request=null,this._loaded=!0,this.fire(new p.j(n))}})}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new p.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;let n=e.map(p.Z.fromLngLat);this.tileID=function(o){let c=1/0,m=1/0,g=-1/0,y=-1/0;for(let C of o)c=Math.min(c,C.x),m=Math.min(m,C.y),g=Math.max(g,C.x),y=Math.max(y,C.y);let b=Math.max(g-c,y-m),T=Math.max(0,Math.floor(-Math.log(b)/Math.LN2)),S=Math.pow(2,T);return new p.a1(T,Math.floor((c+g)/2*S),Math.floor((m+y)/2*S))}(n),this.minzoom=this.maxzoom=this.tileID.z;let a=n.map(o=>this.tileID.getTilePoint(o)._round());return this._boundsArray=new p.$,this._boundsArray.emplaceBack(a[0].x,a[0].y,0,0),this._boundsArray.emplaceBack(a[1].x,a[1].y,p.X,0),this._boundsArray.emplaceBack(a[3].x,a[3].y,0,p.X),this._boundsArray.emplaceBack(a[2].x,a[2].y,p.X,p.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new p.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let e=this.map.painter.context,n=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Ir.members)),this.boundsSegments||(this.boundsSegments=p.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new st(e,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let a=!1;for(let o in this.tiles){let c=this.tiles[o];c.state!=="loaded"&&(c.state="loaded",c.texture=this.texture,a=!0)}a&&this.fire(new p.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return p._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class un extends pr{constructor(e,n,a,o){super(e,n,a,o),this.roundZoom=!0,this.type="video",this.options=n}load(){return p._(this,void 0,void 0,function*(){this._loaded=!1;let e=this.options;this.urls=[];for(let n of e.urls)this.urls.push(this.map._requestManager.transformRequest(n,"Source").url);try{let n=yield p.a3(this.urls);if(this._loaded=!0,!n)return;this.video=n,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(n){this.fire(new p.j(n))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let n=this.video.seekable;en.end(0)?this.fire(new p.j(new p.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let e=this.map.painter.context,n=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Ir.members)),this.boundsSegments||(this.boundsSegments=p.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new st(e,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let a=!1;for(let o in this.tiles){let c=this.tiles[o];c.state!=="loaded"&&(c.state="loaded",c.texture=this.texture,a=!0)}a&&this.fire(new p.k("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 bi extends pr{constructor(e,n,a,o){super(e,n,a,o),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(c=>!Array.isArray(c)||c.length!==2||c.some(m=>typeof m!="number"))||this.fire(new p.j(new p.a2(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new p.j(new p.a2(`sources.${e}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new p.j(new p.a2(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new p.j(new p.a2(`sources.${e}`,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 p.j(new p.a2(`sources.${e}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){return p._(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 p.j(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(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let n=this.map.painter.context,a=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,Ir.members)),this.boundsSegments||(this.boundsSegments=p.a0.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new st(n,this.canvas,a.RGBA,{premultiply:!0});let o=!1;for(let c in this.tiles){let m=this.tiles[c];m.state!=="loaded"&&(m.state="loaded",m.texture=this.texture,o=!0)}o&&this.fire(new p.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}let Jn={},Yn=h=>{switch(h){case"geojson":return Kn;case"image":return pr;case"raster":return et;case"raster-dem":return yt;case"vector":return Wn;case"video":return un;case"canvas":return bi}return Jn[h]},ue="RTLPluginLoaded";class Qi extends p.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Xn()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(n=>{throw this.status="error",n})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return p._(this,arguments,void 0,function*(n,a=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=me.resolveURL(n),!this.url)throw new Error(`requested url ${n} is invalid`);if(this.status==="unavailable"){if(!a)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return p._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new p.k(ue))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Xt=null;function er(){return Xt||(Xt=new Qi),Xt}class Pr{constructor(e,n){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=p.a4(),this.uses=0,this.tileSize=n,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(e){let n=e+this.timeAdded;nc.getLayer(b)).filter(Boolean);if(y.length!==0){g.layers=y,g.stateDependentLayerIds&&(g.stateDependentLayers=g.stateDependentLayerIds.map(b=>y.filter(T=>T.id===b)[0]));for(let b of y)m[b.id]=g}}return m}(e.buckets,n.style),this.hasSymbolBuckets=!1;for(let o in this.buckets){let c=this.buckets[o];if(c instanceof p.a6){if(this.hasSymbolBuckets=!0,!a)break;c.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let o in this.buckets){let c=this.buckets[o];if(c instanceof p.a6&&c.hasRTLText){this.hasRTLText=!0,er().lazyLoad();break}}this.queryPadding=0;for(let o in this.buckets){let c=this.buckets[o];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(o).queryRadius(c))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new p.a5}unloadVectorData(){for(let e in this.buckets)this.buckets[e].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(e){return this.buckets[e.id]}upload(e){for(let a in this.buckets){let o=this.buckets[a];o.uploadPending()&&o.upload(e)}let n=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new st(e,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new st(e,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,n,a,o,c,m,g,y,b,T){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:o,cameraQueryGeometry:c,scale:m,tileSize:this.tileSize,pixelPosMatrix:T,transform:y,params:g,queryPadding:this.queryPadding*b},e,n,a):{}}querySourceFeatures(e,n){let a=this.latestFeatureIndex;if(!a||!a.rawTileData)return;let o=a.loadVTLayers(),c=n&&n.sourceLayer?n.sourceLayer:"",m=o._geojsonTileLayer||o[c];if(!m)return;let g=p.a7(n&&n.filter),{z:y,x:b,y:T}=this.tileID.canonical,S={z:y,x:b,y:T};for(let C=0;Ca)o=!1;else if(n)if(this.expirationTime{this.remove(e,c)},a)),this.data[o].push(c),this.order.push(o),this.order.length>this.max){let m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let n=this.data[e].shift();return n.timeout&&clearTimeout(n.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),n.value}getByKey(e){let n=this.data[e];return n?n[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,n){if(!this.has(e))return this;let a=e.wrapped().key,o=n===void 0?0:this.data[a].indexOf(n),c=this.data[a][o];return this.data[a].splice(o,1),c.timeout&&clearTimeout(c.timeout),this.data[a].length===0&&delete this.data[a],this.onRemove(c.value),this.order.splice(this.order.indexOf(a),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(e){let n=[];for(let a in this.data)for(let o of this.data[a])e(o.value)||n.push(o);for(let a of n)this.remove(a.value.tileID,a)}}class $e{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,n,a){let o=String(n);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][o]=this.stateChanges[e][o]||{},p.e(this.stateChanges[e][o],a),this.deletedStates[e]===null){this.deletedStates[e]={};for(let c in this.state[e])c!==o&&(this.deletedStates[e][c]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][o]===null){this.deletedStates[e][o]={};for(let c in this.state[e][o])a[c]||(this.deletedStates[e][o][c]=null)}else for(let c in a)this.deletedStates[e]&&this.deletedStates[e][o]&&this.deletedStates[e][o][c]===null&&delete this.deletedStates[e][o][c]}removeFeatureState(e,n,a){if(this.deletedStates[e]===null)return;let o=String(n);if(this.deletedStates[e]=this.deletedStates[e]||{},a&&n!==void 0)this.deletedStates[e][o]!==null&&(this.deletedStates[e][o]=this.deletedStates[e][o]||{},this.deletedStates[e][o][a]=null);else if(n!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][o])for(a in this.deletedStates[e][o]={},this.stateChanges[e][o])this.deletedStates[e][o][a]=null;else this.deletedStates[e][o]=null;else this.deletedStates[e]=null}getState(e,n){let a=String(n),o=p.e({},(this.state[e]||{})[a],(this.stateChanges[e]||{})[a]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){let c=this.deletedStates[e][n];if(c===null)return{};for(let m in c)delete o[m]}return o}initializeTileState(e,n){e.setFeatureState(this.state,n)}coalesceChanges(e,n){let a={};for(let o in this.stateChanges){this.state[o]=this.state[o]||{};let c={};for(let m in this.stateChanges[o])this.state[o][m]||(this.state[o][m]={}),p.e(this.state[o][m],this.stateChanges[o][m]),c[m]=this.state[o][m];a[o]=c}for(let o in this.deletedStates){this.state[o]=this.state[o]||{};let c={};if(this.deletedStates[o]===null)for(let m in this.state[o])c[m]={},this.state[o][m]={};else for(let m in this.deletedStates[o]){if(this.deletedStates[o][m]===null)this.state[o][m]={};else for(let g of Object.keys(this.deletedStates[o][m]))delete this.state[o][m][g];c[m]=this.state[o][m]}a[o]=a[o]||{},p.e(a[o],c)}if(this.stateChanges={},this.deletedStates={},Object.keys(a).length!==0)for(let o in e)e[o].setFeatureState(a,n)}}class Be extends p.E{constructor(e,n,a){super(),this.id=e,this.dispatcher=a,this.on("data",o=>this._dataHandler(o)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((o,c,m,g)=>{let y=new(Yn(c.type))(o,c,m,g);if(y.id!==o)throw new Error(`Expected Source id to be ${o} instead of ${y.id}`);return y})(e,n,a,this),this._tiles={},this._cache=new _e(0,o=>this._unloadTile(o)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new $e,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}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(let e in this._tiles){let n=this._tiles[e];if(n.state!=="loaded"&&n.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,n,a){return p._(this,void 0,void 0,function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,n,a)}catch(o){e.state="errored",o.status!==404?this._source.fire(new p.j(o,{tile:e})):this.update(this.transform,this.terrain)}})}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new p.k("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(let n in this._tiles){let a=this._tiles[n];a.upload(e),a.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(ti).map(e=>e.key)}getRenderableIds(e){let n=[];for(let a in this._tiles)this._isIdRenderable(a,e)&&n.push(this._tiles[a]);return e?n.sort((a,o)=>{let c=a.tileID,m=o.tileID,g=new p.P(c.canonical.x,c.canonical.y)._rotate(this.transform.angle),y=new p.P(m.canonical.x,m.canonical.y)._rotate(this.transform.angle);return c.overscaledZ-m.overscaledZ||y.y-g.y||y.x-g.x}).map(a=>a.tileID.key):n.map(a=>a.tileID).sort(ti).map(a=>a.key)}hasRenderableParent(e){let n=this.findLoadedParent(e,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(e,n){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(n||!this._tiles[e].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(let e in this._tiles)this._tiles[e].state!=="errored"&&this._reloadTile(e,"reloading")}}_reloadTile(e,n){return p._(this,void 0,void 0,function*(){let a=this._tiles[e];a&&(a.state!=="loading"&&(a.state=n),yield this._loadTile(a,e,n))})}_tileLoaded(e,n,a){e.timeAdded=me.now(),a==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(n,e),this.getSource().type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new p.k("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){let n=this.getRenderableIds();for(let o=0;o1||(Math.abs(m)>1&&(Math.abs(m+y)===1?m+=y:Math.abs(m-y)===1&&(m-=y)),c.dem&&o.dem&&(o.dem.backfillBorder(c.dem,m,g),o.neighboringTiles&&o.neighboringTiles[b]&&(o.neighboringTiles[b].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,n,a,o){for(let c in this._tiles){let m=this._tiles[c];if(o[c]||!m.hasData()||m.tileID.overscaledZ<=n||m.tileID.overscaledZ>a)continue;let g=m.tileID;for(;m&&m.tileID.overscaledZ>n+1;){let b=m.tileID.scaledTo(m.tileID.overscaledZ-1);m=this._tiles[b.key],m&&m.hasData()&&(g=b)}let y=g;for(;y.overscaledZ>n;)if(y=y.scaledTo(y.overscaledZ-1),e[y.key]){o[g.key]=g;break}}}findLoadedParent(e,n){if(e.key in this._loadedParentTiles){let a=this._loadedParentTiles[e.key];return a&&a.tileID.overscaledZ>=n?a:null}for(let a=e.overscaledZ-1;a>=n;a--){let o=e.scaledTo(a),c=this._getLoadedTile(o);if(c)return c}}findLoadedSibling(e){return this._getLoadedTile(e)}_getLoadedTile(e){let n=this._tiles[e.key];return n&&n.hasData()?n:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){let n=Math.ceil(e.width/this._source.tileSize)+1,a=Math.ceil(e.height/this._source.tileSize)+1,o=Math.floor(n*a*(this._maxTileCacheZoomLevels===null?p.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),c=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,o):o;this._cache.setMaxSize(c)}handleWrapJump(e){let n=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,n){let a={};for(let o in this._tiles){let c=this._tiles[o];c.tileID=c.tileID.unwrapTo(c.tileID.wrap+n),a[c.tileID.key]=c}this._tiles=a;for(let o in this._timers)clearTimeout(this._timers[o]),delete this._timers[o];for(let o in this._tiles)this._setTileReloadTimer(o,this._tiles[o])}}_updateCoveredAndRetainedTiles(e,n,a,o,c,m){let g={},y={},b=Object.keys(e),T=me.now();for(let S of b){let C=e[S],E=this._tiles[S];if(!E||E.fadeEndTime!==0&&E.fadeEndTime<=T)continue;let R=this.findLoadedParent(C,n),V=this.findLoadedSibling(C),U=R||V||null;U&&(this._addTile(U.tileID),g[U.tileID.key]=U.tileID),y[S]=C}this._retainLoadedChildren(y,o,a,e);for(let S in g)e[S]||(this._coveredTiles[S]=!0,e[S]=g[S]);if(m){let S={},C={};for(let E of c)this._tiles[E.key].hasData()?S[E.key]=E:C[E.key]=E;for(let E in C){let R=C[E].children(this._source.maxzoom);this._tiles[R[0].key]&&this._tiles[R[1].key]&&this._tiles[R[2].key]&&this._tiles[R[3].key]&&(S[R[0].key]=e[R[0].key]=R[0],S[R[1].key]=e[R[1].key]=R[1],S[R[2].key]=e[R[2].key]=R[2],S[R[3].key]=e[R[3].key]=R[3],delete C[E])}for(let E in C){let R=C[E],V=this.findLoadedParent(R,this._source.minzoom),U=this.findLoadedSibling(R),$=V||U||null;if($){S[$.tileID.key]=e[$.tileID.key]=$.tileID;for(let Z in S)S[Z].isChildOf($.tileID)&&delete S[Z]}}for(let E in this._tiles)S[E]||(this._coveredTiles[E]=!0)}}update(e,n){if(!this._sourceLoaded||this._paused)return;let a;this.transform=e,this.terrain=n,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?a=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(T=>new p.S(T.canonical.z,T.wrap,T.canonical.z,T.canonical.x,T.canonical.y)):(a=e.coveringTiles({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:n}),this._source.hasTile&&(a=a.filter(T=>this._source.hasTile(T)))):a=[];let o=e.coveringZoomLevel(this._source),c=Math.max(o-Be.maxOverzooming,this._source.minzoom),m=Math.max(o+Be.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let T={};for(let S of a)if(S.canonical.z>this._source.minzoom){let C=S.scaledTo(S.canonical.z-1);T[C.key]=C;let E=S.scaledTo(Math.max(this._source.minzoom,Math.min(S.canonical.z,5)));T[E.key]=E}a=a.concat(Object.values(T))}let g=a.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,g&&this.fire(new p.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let y=this._updateRetainedTiles(a,o);Li(this._source.type)&&this._updateCoveredAndRetainedTiles(y,c,m,o,a,n);for(let T in y)this._tiles[T].clearFadeHold();let b=p.ab(this._tiles,y);for(let T of b){let S=this._tiles[T];S.hasSymbolBuckets&&!S.holdingForFade()?S.setHoldDuration(this.map._fadeDuration):S.hasSymbolBuckets&&!S.symbolFadeFinished()||this._removeTile(T)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(let e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,n){var a;let o={},c={},m=Math.max(n-Be.maxOverzooming,this._source.minzoom),g=Math.max(n+Be.maxUnderzooming,this._source.minzoom),y={};for(let b of e){let T=this._addTile(b);o[b.key]=b,T.hasData()||nthis._source.maxzoom){let C=b.children(this._source.maxzoom)[0],E=this.getTile(C);if(E&&E.hasData()){o[C.key]=C;continue}}else{let C=b.children(this._source.maxzoom);if(o[C[0].key]&&o[C[1].key]&&o[C[2].key]&&o[C[3].key])continue}let S=T.wasRequested();for(let C=b.overscaledZ-1;C>=m;--C){let E=b.scaledTo(C);if(c[E.key])break;if(c[E.key]=!0,T=this.getTile(E),!T&&S&&(T=this._addTile(E)),T){let R=T.hasData();if((R||!(!((a=this.map)===null||a===void 0)&&a.cancelPendingTileRequestsWhileZooming)||S)&&(o[E.key]=E),S=T.wasRequested(),R)break}}}return o}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let e in this._tiles){let n=[],a,o=this._tiles[e].tileID;for(;o.overscaledZ>0;){if(o.key in this._loadedParentTiles){a=this._loadedParentTiles[o.key];break}n.push(o.key);let c=o.scaledTo(o.overscaledZ-1);if(a=this._getLoadedTile(c),a)break;o=c}for(let c of n)this._loadedParentTiles[c]=a}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(let e in this._tiles){let n=this._tiles[e].tileID,a=this._getLoadedTile(n);this._loadedSiblingTiles[n.key]=a}}_addTile(e){let n=this._tiles[e.key];if(n)return n;n=this._cache.getAndRemove(e),n&&(this._setTileReloadTimer(e.key,n),n.tileID=e,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,n)));let a=n;return n||(n=new Pr(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(n,e.key,n.state)),n.uses++,this._tiles[e.key]=n,a||this._source.fire(new p.k("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(e,n){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);let a=n.getExpiryTimeout();a&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},a))}_removeTile(e){let n=this._tiles[e];n&&(n.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}_dataHandler(e){let n=e.sourceDataType;e.dataType==="source"&&n==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType==="source"&&n==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,n,a){let o=[],c=this.transform;if(!c)return o;let m=a?c.getCameraQueryGeometry(e):e,g=e.map(R=>c.pointCoordinate(R,this.terrain)),y=m.map(R=>c.pointCoordinate(R,this.terrain)),b=this.getIds(),T=1/0,S=1/0,C=-1/0,E=-1/0;for(let R of y)T=Math.min(T,R.x),S=Math.min(S,R.y),C=Math.max(C,R.x),E=Math.max(E,R.y);for(let R=0;R=0&&B[1].y+Z>=0){let X=g.map(ee=>U.getTilePoint(ee)),K=y.map(ee=>U.getTilePoint(ee));o.push({tile:V,tileID:U,queryGeometry:X,cameraQueryGeometry:K,scale:$})}}return o}getVisibleCoordinates(e){let n=this.getRenderableIds(e).map(a=>this._tiles[a].tileID);for(let a of n)a.posMatrix=this.transform.calculatePosMatrix(a.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if(Li(this._source.type)){let e=me.now();for(let n in this._tiles)if(this._tiles[n].fadeEndTime>=e)return!0}return!1}setFeatureState(e,n,a){this._state.updateState(e=e||"_geojsonTileLayer",n,a)}removeFeatureState(e,n,a){this._state.removeFeatureState(e=e||"_geojsonTileLayer",n,a)}getFeatureState(e,n){return this._state.getState(e=e||"_geojsonTileLayer",n)}setDependencies(e,n,a){let o=this._tiles[e];o&&o.setDependencies(n,a)}reloadTilesForDependencies(e,n){for(let a in this._tiles)this._tiles[a].hasDependency(e,n)&&this._reloadTile(a,"reloading");this._cache.filter(a=>!a.hasDependency(e,n))}}function ti(h,e){let n=Math.abs(2*h.wrap)-+(h.wrap<0),a=Math.abs(2*e.wrap)-+(e.wrap<0);return h.overscaledZ-e.overscaledZ||a-n||e.canonical.y-h.canonical.y||e.canonical.x-h.canonical.x}function Li(h){return h==="raster"||h==="image"||h==="video"}Be.maxOverzooming=10,Be.maxUnderzooming=3;class Ne{constructor(e,n){this.reset(e,n)}reset(e,n){this.points=e||[],this._distances=[0];for(let a=1;a0?(o-m)/g:0;return this.points[c].mult(1-y).add(this.points[n].mult(y))}}function tr(h,e){let n=!0;return h==="always"||h!=="never"&&e!=="never"||(n=!1),n}class fr{constructor(e,n,a){let o=this.boxCells=[],c=this.circleCells=[];this.xCellCount=Math.ceil(e/a),this.yCellCount=Math.ceil(n/a);for(let m=0;mthis.width||o<0||n>this.height)return[];let y=[];if(e<=0&&n<=0&&this.width<=a&&this.height<=o){if(c)return[{key:null,x1:e,y1:n,x2:a,y2:o}];for(let b=0;b0}hitTestCircle(e,n,a,o,c){let m=e-a,g=e+a,y=n-a,b=n+a;if(g<0||m>this.width||b<0||y>this.height)return!1;let T=[];return this._forEachCell(m,y,g,b,this._queryCellCircle,T,{hitTest:!0,overlapMode:o,circle:{x:e,y:n,radius:a},seenUids:{box:{},circle:{}}},c),T.length>0}_queryCell(e,n,a,o,c,m,g,y){let{seenUids:b,hitTest:T,overlapMode:S}=g,C=this.boxCells[c];if(C!==null){let R=this.bboxes;for(let V of C)if(!b.box[V]){b.box[V]=!0;let U=4*V,$=this.boxKeys[V];if(e<=R[U+2]&&n<=R[U+3]&&a>=R[U+0]&&o>=R[U+1]&&(!y||y($))&&(!T||!tr(S,$.overlapMode))&&(m.push({key:$,x1:R[U],y1:R[U+1],x2:R[U+2],y2:R[U+3]}),T))return!0}}let E=this.circleCells[c];if(E!==null){let R=this.circles;for(let V of E)if(!b.circle[V]){b.circle[V]=!0;let U=3*V,$=this.circleKeys[V];if(this._circleAndRectCollide(R[U],R[U+1],R[U+2],e,n,a,o)&&(!y||y($))&&(!T||!tr(S,$.overlapMode))){let Z=R[U],B=R[U+1],X=R[U+2];if(m.push({key:$,x1:Z-X,y1:B-X,x2:Z+X,y2:B+X}),T)return!0}}}return!1}_queryCellCircle(e,n,a,o,c,m,g,y){let{circle:b,seenUids:T,overlapMode:S}=g,C=this.boxCells[c];if(C!==null){let R=this.bboxes;for(let V of C)if(!T.box[V]){T.box[V]=!0;let U=4*V,$=this.boxKeys[V];if(this._circleAndRectCollide(b.x,b.y,b.radius,R[U+0],R[U+1],R[U+2],R[U+3])&&(!y||y($))&&!tr(S,$.overlapMode))return m.push(!0),!0}}let E=this.circleCells[c];if(E!==null){let R=this.circles;for(let V of E)if(!T.circle[V]){T.circle[V]=!0;let U=3*V,$=this.circleKeys[V];if(this._circlesCollide(R[U],R[U+1],R[U+2],b.x,b.y,b.radius)&&(!y||y($))&&!tr(S,$.overlapMode))return m.push(!0),!0}}}_forEachCell(e,n,a,o,c,m,g,y){let b=this._convertToXCellCoord(e),T=this._convertToYCellCoord(n),S=this._convertToXCellCoord(a),C=this._convertToYCellCoord(o);for(let E=b;E<=S;E++)for(let R=T;R<=C;R++)if(c.call(this,e,n,a,o,this.xCellCount*R+E,m,g,y))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,n,a,o,c,m){let g=o-e,y=c-n,b=a+m;return b*b>g*g+y*y}_circleAndRectCollide(e,n,a,o,c,m,g){let y=(m-o)/2,b=Math.abs(e-(o+y));if(b>y+a)return!1;let T=(g-c)/2,S=Math.abs(n-(c+T));if(S>T+a)return!1;if(b<=y||S<=T)return!0;let C=b-y,E=S-T;return C*C+E*E<=a*a}}function Ar(h,e,n,a,o){let c=p.H();return e?(p.K(c,c,[1/o,1/o,1]),n||p.ad(c,c,a.angle)):p.L(c,a.labelPlaneMatrix,h),c}function ir(h,e,n,a,o){if(e){let c=p.ae(h);return p.K(c,c,[o,o,1]),n||p.ad(c,c,-a.angle),c}return a.glCoordMatrix}function N(h,e,n,a){let o;a?(o=[h,e,a(h,e),1],p.af(o,o,n)):(o=[h,e,0,1],Ke(o,o,n));let c=o[3];return{point:new p.P(o[0]/c,o[1]/c),signedDistanceFromCamera:c,isOccluded:!1}}function A(h,e){return .5+h/e*.5}function P(h,e){return h.x>=-e[0]&&h.x<=e[0]&&h.y>=-e[1]&&h.y<=e[1]}function D(h,e,n,a,o,c,m,g,y,b,T,S,C,E,R){let V=a?h.textSizeData:h.iconSizeData,U=p.ag(V,n.transform.zoom),$=[256/n.width*2+1,256/n.height*2+1],Z=a?h.text.dynamicLayoutVertexArray:h.icon.dynamicLayoutVertexArray;Z.clear();let B=h.lineVertexArray,X=a?h.text.placedSymbolArray:h.icon.placedSymbolArray,K=n.transform.width/n.transform.height,ee=!1;for(let oe=0;oeMath.abs(n.x-e.x)*a?{useVertical:!0}:(h===p.ah.vertical?e.yn.x)?{needsFlipping:!0}:null}function W(h,e,n,a,o,c,m,g,y,b,T){let S=n/24,C=e.lineOffsetX*S,E=e.lineOffsetY*S,R;if(e.numGlyphs>1){let V=e.glyphStartIndex+e.numGlyphs,U=e.lineStartIndex,$=e.lineStartIndex+e.lineLength,Z=O(S,g,C,E,a,e,T,h);if(!Z)return{notEnoughRoom:!0};let B=N(Z.first.point.x,Z.first.point.y,m,h.getElevation).point,X=N(Z.last.point.x,Z.last.point.y,m,h.getElevation).point;if(o&&!a){let K=H(e.writingMode,B,X,b);if(K)return K}R=[Z.first];for(let K=e.glyphStartIndex+1;K0?B.point:function(ee,oe,he,xe,Te,fe){return Y(ee,oe,he,1,Te,fe)}(h.tileAnchorPoint,Z,U,0,c,h),K=H(e.writingMode,U,X,b);if(K)return K}let V=de(S*g.getoffsetX(e.glyphStartIndex),C,E,a,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,h,T);if(!V||h.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};R=[V]}for(let V of R)p.aj(y,V.point,V.angle);return{}}function Y(h,e,n,a,o,c){let m=h.add(h.sub(e)._unit()),g=o!==void 0?N(m.x,m.y,o,c.getElevation).point:ne(m.x,m.y,c).point,y=n.sub(g);return n.add(y._mult(a/y.mag()))}function q(h,e,n){let a=e.projectionCache;if(a.projections[h])return a.projections[h];let o=new p.P(e.lineVertexArray.getx(h),e.lineVertexArray.gety(h)),c=ne(o.x,o.y,e);if(c.signedDistanceFromCamera>0)return a.projections[h]=c.point,a.anyProjectionOccluded=a.anyProjectionOccluded||c.isOccluded,c.point;let m=h-n.direction;return function(g,y,b,T,S){return Y(g,y,b,T,void 0,S)}(n.distanceFromAnchor===0?e.tileAnchorPoint:new p.P(e.lineVertexArray.getx(m),e.lineVertexArray.gety(m)),o,n.previousVertex,n.absOffsetX-n.distanceFromAnchor+1,e)}function ne(h,e,n){let a=h+n.translation[0],o=e+n.translation[1],c;return!n.pitchWithMap&&n.projection.useSpecialProjectionForSymbols?(c=n.projection.projectTileCoordinates(a,o,n.unwrappedTileID,n.getElevation),c.point.x=(.5*c.point.x+.5)*n.width,c.point.y=(.5*-c.point.y+.5)*n.height):(c=N(a,o,n.labelPlaneMatrix,n.getElevation),c.isOccluded=!1),c}function le(h,e,n){return h._unit()._perp()._mult(e*n)}function te(h,e,n,a,o,c,m,g,y){if(g.projectionCache.offsets[h])return g.projectionCache.offsets[h];let b=n.add(e);if(h+y.direction=o)return g.projectionCache.offsets[h]=b,b;let T=q(h+y.direction,g,y),S=le(T.sub(n),m,y.direction),C=n.add(S),E=T.add(S);return g.projectionCache.offsets[h]=p.ak(c,b,C,E)||b,g.projectionCache.offsets[h]}function de(h,e,n,a,o,c,m,g,y){let b=a?h-e:h+e,T=b>0?1:-1,S=0;a&&(T*=-1,S=Math.PI),T<0&&(S+=Math.PI);let C,E=T>0?c+o:c+o+1;g.projectionCache.cachedAnchorPoint?C=g.projectionCache.cachedAnchorPoint:(C=ne(g.tileAnchorPoint.x,g.tileAnchorPoint.y,g).point,g.projectionCache.cachedAnchorPoint=C);let R,V,U=C,$=C,Z=0,B=0,X=Math.abs(b),K=[],ee;for(;Z+B<=X;){if(E+=T,E=m)return null;Z+=B,$=U,V=R;let xe={absOffsetX:X,direction:T,distanceFromAnchor:Z,previousVertex:$};if(U=q(E,g,xe),n===0)K.push($),ee=U.sub($);else{let Te,fe=U.sub($);Te=fe.mag()===0?le(q(E+T,g,xe).sub(U),n,T):le(fe,n,T),V||(V=$.add(Te)),R=te(E,Te,U,c,m,V,n,g,xe),K.push(V),ee=R.sub(V)}B=ee.mag()}let oe=ee._mult((X-Z)/B)._add(V||$),he=S+Math.atan2(U.y-$.y,U.x-$.x);return K.push(oe),{point:oe,angle:y?he:0,path:K}}let Ee=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function De(h,e){for(let n=0;n=1;Ue--)be.push(Ve.path[Ue]);for(let Ue=1;UeHe.signedDistanceFromCamera<=0)?[]:Ue.map(He=>He.point)}let pt=[];if(be.length>0){let Ue=be[0].clone(),He=be[0].clone();for(let ft=1;ft=fe.x&&He.x<=pe.x&&Ue.y>=fe.y&&He.y<=pe.y?[be]:He.xpe.x||He.ype.y?[]:p.al([be],fe.x,fe.y,pe.x,pe.y)}for(let Ue of pt){Me.reset(Ue,.25*Te);let He=0;He=Me.length<=.5*Te?1:Math.ceil(Me.paddedLength/Fe)+1;for(let ft=0;ftN(o.x,o.y,a,n.getElevation))}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let n=[],a=1/0,o=1/0,c=-1/0,m=-1/0;for(let T of e){let S=new p.P(T.x+je,T.y+je);a=Math.min(a,S.x),o=Math.min(o,S.y),c=Math.max(c,S.x),m=Math.max(m,S.y),n.push(S)}let g=this.grid.query(a,o,c,m).concat(this.ignoredGrid.query(a,o,c,m)),y={},b={};for(let T of g){let S=T.key;if(y[S.bucketInstanceId]===void 0&&(y[S.bucketInstanceId]={}),y[S.bucketInstanceId][S.featureIndex])continue;let C=[new p.P(T.x1,T.y1),new p.P(T.x2,T.y1),new p.P(T.x2,T.y2),new p.P(T.x1,T.y2)];p.am(n,C)&&(y[S.bucketInstanceId][S.featureIndex]=!0,b[S.bucketInstanceId]===void 0&&(b[S.bucketInstanceId]=[]),b[S.bucketInstanceId].push(S.featureIndex))}return b}insertCollisionBox(e,n,a,o,c,m){(a?this.ignoredGrid:this.grid).insert({bucketInstanceId:o,featureIndex:c,collisionGroupID:m,overlapMode:n},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,n,a,o,c,m){let g=a?this.ignoredGrid:this.grid,y={bucketInstanceId:o,featureIndex:c,collisionGroupID:m,overlapMode:n};for(let b=0;b=this.screenRightBoundary||othis.screenBottomBoundary}isInsideGrid(e,n,a,o){return a>=0&&e=0&&nthis.projectAndGetPerspectiveRatio(a,Te.x,Te.y,o,b));he=xe.some(Te=>!Te.isOccluded),oe=xe.map(Te=>Te.point)}else he=!0;return{box:p.ao(oe),allPointsOccluded:!he}}}function Ge(h,e,n){return e*(p.X/(h.tileSize*Math.pow(2,n-h.tileID.overscaledZ)))}class Pt{constructor(e,n,a,o){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?n:-n))):o&&a?1:0,this.placed=a}isHidden(){return this.opacity===0&&!this.placed}}class xt{constructor(e,n,a,o,c){this.text=new Pt(e?e.text:null,n,a,c),this.icon=new Pt(e?e.icon:null,n,o,c)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class qe{constructor(e,n,a){this.text=e,this.icon=n,this.skipFade=a}}class rt{constructor(){this.invProjMatrix=p.H(),this.viewportMatrix=p.H(),this.circles=[]}}class gt{constructor(e,n,a,o,c){this.bucketInstanceId=e,this.featureIndex=n,this.sourceLayerIndex=a,this.bucketIndex=o,this.tileID=c}}class kt{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let n=++this.maxGroupID;this.collisionGroups[e]={ID:n,predicate:a=>a.collisionGroupID===n}}return this.collisionGroups[e]}}function Lt(h,e,n,a,o){let{horizontalAlign:c,verticalAlign:m}=p.au(h);return new p.P(-(c-.5)*e+a[0]*o,-(m-.5)*n+a[1]*o)}class Wt{constructor(e,n,a,o,c,m){this.transform=e.clone(),this.terrain=a,this.collisionIndex=new Je(this.transform,n),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=o,this.retainedQueryData={},this.collisionGroups=new kt(c),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=m,m&&(m.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){let n=this.terrain;return n?(a,o)=>n.getElevation(e,a,o):null}getBucketParts(e,n,a,o){let c=a.getBucket(n),m=a.latestFeatureIndex;if(!c||!m||n.id!==c.layerIds[0])return;let g=a.collisionBoxArray,y=c.layers[0].layout,b=c.layers[0].paint,T=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ),S=a.tileSize/p.X,C=a.tileID.toUnwrapped(),E=this.transform.calculatePosMatrix(C),R=y.get("text-pitch-alignment")==="map",V=y.get("text-rotation-alignment")==="map",U=Ge(a,1,this.transform.zoom),$=this.collisionIndex.mapProjection.translatePosition(this.transform,a,b.get("text-translate"),b.get("text-translate-anchor")),Z=this.collisionIndex.mapProjection.translatePosition(this.transform,a,b.get("icon-translate"),b.get("icon-translate-anchor")),B=Ar(E,R,V,this.transform,U),X=null;if(R){let ee=ir(E,R,V,this.transform,U);X=p.L([],this.transform.labelPlaneMatrix,ee)}this.retainedQueryData[c.bucketInstanceId]=new gt(c.bucketInstanceId,m,c.sourceLayerIndex,c.index,a.tileID);let K={bucket:c,layout:y,translationText:$,translationIcon:Z,posMatrix:E,unwrappedTileID:C,textLabelPlaneMatrix:B,labelToScreenMatrix:X,scale:T,textPixelRatio:S,holdingForFade:a.holdingForFade(),collisionBoxArray:g,partiallyEvaluatedTextSize:p.ag(c.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(c.sourceID)};if(o)for(let ee of c.sortKeyRanges){let{sortKey:oe,symbolInstanceStart:he,symbolInstanceEnd:xe}=ee;e.push({sortKey:oe,symbolInstanceStart:he,symbolInstanceEnd:xe,parameters:K})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:c.symbolInstances.length,parameters:K})}attemptAnchorPlacement(e,n,a,o,c,m,g,y,b,T,S,C,E,R,V,U,$,Z,B){let X=p.aq[e.textAnchor],K=[e.textOffset0,e.textOffset1],ee=Lt(X,a,o,K,c),oe=this.collisionIndex.placeCollisionBox(n,C,y,b,T,g,m,U,S.predicate,B,ee);if((!Z||this.collisionIndex.placeCollisionBox(Z,C,y,b,T,g,m,$,S.predicate,B,ee).placeable)&&oe.placeable){let he;if(this.prevPlacement&&this.prevPlacement.variableOffsets[E.crossTileID]&&this.prevPlacement.placements[E.crossTileID]&&this.prevPlacement.placements[E.crossTileID].text&&(he=this.prevPlacement.variableOffsets[E.crossTileID].anchor),E.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[E.crossTileID]={textOffset:K,width:a,height:o,anchor:X,textBoxScale:c,prevAnchor:he},this.markUsedJustification(R,X,E,V),R.allowVerticalPlacement&&(this.markUsedOrientation(R,V,E),this.placedOrientations[E.crossTileID]=V),{shift:ee,placedGlyphBoxes:oe}}}placeLayerBucketPart(e,n,a){let{bucket:o,layout:c,translationText:m,translationIcon:g,posMatrix:y,unwrappedTileID:b,textLabelPlaneMatrix:T,labelToScreenMatrix:S,textPixelRatio:C,holdingForFade:E,collisionBoxArray:R,partiallyEvaluatedTextSize:V,collisionGroup:U}=e.parameters,$=c.get("text-optional"),Z=c.get("icon-optional"),B=p.ar(c,"text-overlap","text-allow-overlap"),X=B==="always",K=p.ar(c,"icon-overlap","icon-allow-overlap"),ee=K==="always",oe=c.get("text-rotation-alignment")==="map",he=c.get("text-pitch-alignment")==="map",xe=c.get("icon-text-fit")!=="none",Te=c.get("symbol-z-order")==="viewport-y",fe=X&&(ee||!o.hasIconData()||Z),pe=ee&&(X||!o.hasTextData()||$);!o.collisionArrays&&R&&o.deserializeCollisionBoxes(R);let Me=this._getTerrainElevationFunc(this.retainedQueryData[o.bucketInstanceId].tileID),Ve=(ge,be,Fe)=>{var pt,Ue;if(n[ge.crossTileID])return;if(E)return void(this.placements[ge.crossTileID]=new qe(!1,!1,!1));let He=!1,ft=!1,Vt=!0,Ni=null,mt={box:null,placeable:!1,offscreen:null},ni={box:null,placeable:!1,offscreen:null},Kt=null,Nt=null,Jt=null,ar=0,Ln=0,sa=0;be.textFeatureIndex?ar=be.textFeatureIndex:ge.useRuntimeCollisionCircles&&(ar=ge.featureIndex),be.verticalTextFeatureIndex&&(Ln=be.verticalTextFeatureIndex);let Rn=be.textBox;if(Rn){let Ai=Rt=>{let jt=p.ah.horizontal;if(o.allowVerticalPlacement&&!Rt&&this.prevPlacement){let gi=this.prevPlacement.placedOrientations[ge.crossTileID];gi&&(this.placedOrientations[ge.crossTileID]=gi,jt=gi,this.markUsedOrientation(o,jt,ge))}return jt},Mi=(Rt,jt)=>{if(o.allowVerticalPlacement&&ge.numVerticalGlyphVertices>0&&be.verticalTextBox){for(let gi of o.writingModes)if(gi===p.ah.vertical?(mt=jt(),ni=mt):mt=Rt(),mt&&mt.placeable)break}else mt=Rt()},kr=ge.textAnchorOffsetStartIndex,ji=ge.textAnchorOffsetEndIndex;if(ji===kr){let Rt=(jt,gi)=>{let We=this.collisionIndex.placeCollisionBox(jt,B,C,y,b,he,oe,m,U.predicate,Me);return We&&We.placeable&&(this.markUsedOrientation(o,gi,ge),this.placedOrientations[ge.crossTileID]=gi),We};Mi(()=>Rt(Rn,p.ah.horizontal),()=>{let jt=be.verticalTextBox;return o.allowVerticalPlacement&&ge.numVerticalGlyphVertices>0&&jt?Rt(jt,p.ah.vertical):{box:null,offscreen:null}}),Ai(mt&&mt.placeable)}else{let Rt=p.aq[(Ue=(pt=this.prevPlacement)===null||pt===void 0?void 0:pt.variableOffsets[ge.crossTileID])===null||Ue===void 0?void 0:Ue.anchor],jt=(We,en,Bn)=>{let Fn=We.x2-We.x1,ul=We.y2-We.y1,oc=ge.textBoxScale,dl=xe&&K==="never"?en:null,zr=null,pl=B==="never"?1:2,oa="never";Rt&&pl++;for(let gs=0;gsjt(Rn,be.iconBox,p.ah.horizontal),()=>{let We=be.verticalTextBox;return o.allowVerticalPlacement&&(!mt||!mt.placeable)&&ge.numVerticalGlyphVertices>0&&We?jt(We,be.verticalIconBox,p.ah.vertical):{box:null,occluded:!0,offscreen:null}}),mt&&(He=mt.placeable,Vt=mt.offscreen);let gi=Ai(mt&&mt.placeable);if(!He&&this.prevPlacement){let We=this.prevPlacement.variableOffsets[ge.crossTileID];We&&(this.variableOffsets[ge.crossTileID]=We,this.markUsedJustification(o,We.anchor,ge,gi))}}}if(Kt=mt,He=Kt&&Kt.placeable,Vt=Kt&&Kt.offscreen,ge.useRuntimeCollisionCircles){let Ai=o.text.placedSymbolArray.get(ge.centerJustifiedTextSymbolIndex),Mi=p.ai(o.textSizeData,V,Ai),kr=c.get("text-padding");Nt=this.collisionIndex.placeCollisionCircles(B,Ai,o.lineVertexArray,o.glyphOffsetArray,Mi,y,b,T,S,a,he,U.predicate,ge.collisionCircleDiameter,kr,m,Me),Nt.circles.length&&Nt.collisionDetected&&!a&&p.w("Collisions detected, but collision boxes are not shown"),He=X||Nt.circles.length>0&&!Nt.collisionDetected,Vt=Vt&&Nt.offscreen}if(be.iconFeatureIndex&&(sa=be.iconFeatureIndex),be.iconBox){let Ai=Mi=>this.collisionIndex.placeCollisionBox(Mi,K,C,y,b,he,oe,g,U.predicate,Me,xe&&Ni?Ni:void 0);ni&&ni.placeable&&be.verticalIconBox?(Jt=Ai(be.verticalIconBox),ft=Jt.placeable):(Jt=Ai(be.iconBox),ft=Jt.placeable),Vt=Vt&&Jt.offscreen}let Pi=$||ge.numHorizontalGlyphVertices===0&&ge.numVerticalGlyphVertices===0,aa=Z||ge.numIconVertices===0;Pi||aa?aa?Pi||(ft=ft&&He):He=ft&&He:ft=He=ft&&He;let po=ft&&Jt.placeable;if(He&&Kt.placeable&&this.collisionIndex.insertCollisionBox(Kt.box,B,c.get("text-ignore-placement"),o.bucketInstanceId,ni&&ni.placeable&&Ln?Ln:ar,U.ID),po&&this.collisionIndex.insertCollisionBox(Jt.box,K,c.get("icon-ignore-placement"),o.bucketInstanceId,sa,U.ID),Nt&&He&&this.collisionIndex.insertCollisionCircles(Nt.circles,B,c.get("text-ignore-placement"),o.bucketInstanceId,ar,U.ID),a&&this.storeCollisionData(o.bucketInstanceId,Fe,be,Kt,Jt,Nt),ge.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(o.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[ge.crossTileID]=new qe(He||fe,ft||pe,Vt||o.justReloaded),n[ge.crossTileID]=!0};if(Te){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");let ge=o.getSortedSymbolIndexes(this.transform.angle);for(let be=ge.length-1;be>=0;--be){let Fe=ge[be];Ve(o.symbolInstances.get(Fe),o.collisionArrays[Fe],Fe)}}else for(let ge=e.symbolInstanceStart;ge=0&&(e.text.placedSymbolArray.get(g).crossTileID=c>=0&&g!==c?0:a.crossTileID)}markUsedOrientation(e,n,a){let o=n===p.ah.horizontal||n===p.ah.horizontalOnly?n:0,c=n===p.ah.vertical?n:0,m=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex];for(let g of m)e.text.placedSymbolArray.get(g).placedOrientation=o;a.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).placedOrientation=c)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let n=this.prevPlacement,a=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;let o=n?n.symbolFadeChange(e):1,c=n?n.opacities:{},m=n?n.variableOffsets:{},g=n?n.placedOrientations:{};for(let y in this.placements){let b=this.placements[y],T=c[y];T?(this.opacities[y]=new xt(T,o,b.text,b.icon),a=a||b.text!==T.text.placed||b.icon!==T.icon.placed):(this.opacities[y]=new xt(null,o,b.text,b.icon,b.skipFade),a=a||b.text||b.icon)}for(let y in c){let b=c[y];if(!this.opacities[y]){let T=new xt(b,o,!1,!1);T.isHidden()||(this.opacities[y]=T,a=a||b.text.placed||b.icon.placed)}}for(let y in m)this.variableOffsets[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.variableOffsets[y]=m[y]);for(let y in g)this.placedOrientations[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.placedOrientations[y]=g[y]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");a?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:e)}updateLayerOpacities(e,n){let a={};for(let o of n){let c=o.getBucket(e);c&&o.latestFeatureIndex&&e.id===c.layerIds[0]&&this.updateBucketOpacities(c,o.tileID,a,o.collisionBoxArray)}}updateBucketOpacities(e,n,a,o){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();let c=e.layers[0],m=c.layout,g=new xt(null,0,!1,!1,!0),y=m.get("text-allow-overlap"),b=m.get("icon-allow-overlap"),T=c._unevaluatedLayout.hasValue("text-variable-anchor")||c._unevaluatedLayout.hasValue("text-variable-anchor-offset"),S=m.get("text-rotation-alignment")==="map",C=m.get("text-pitch-alignment")==="map",E=m.get("icon-text-fit")!=="none",R=new xt(null,0,y&&(b||!e.hasIconData()||m.get("icon-optional")),b&&(y||!e.hasTextData()||m.get("text-optional")),!0);!e.collisionArrays&&o&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(o);let V=($,Z,B)=>{for(let X=0;X0,he=this.placedOrientations[Z.crossTileID],xe=he===p.ah.vertical,Te=he===p.ah.horizontal||he===p.ah.horizontalOnly;if(B>0||X>0){let pe=fi(ee.text);V(e.text,B,xe?pn:pe),V(e.text,X,Te?pn:pe);let Me=ee.text.isHidden();[Z.rightJustifiedTextSymbolIndex,Z.centerJustifiedTextSymbolIndex,Z.leftJustifiedTextSymbolIndex].forEach(be=>{be>=0&&(e.text.placedSymbolArray.get(be).hidden=Me||xe?1:0)}),Z.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(Z.verticalPlacedTextSymbolIndex).hidden=Me||Te?1:0);let Ve=this.variableOffsets[Z.crossTileID];Ve&&this.markUsedJustification(e,Ve.anchor,Z,he);let ge=this.placedOrientations[Z.crossTileID];ge&&(this.markUsedJustification(e,"left",Z,ge),this.markUsedOrientation(e,ge,Z))}if(oe){let pe=fi(ee.icon),Me=!(E&&Z.verticalPlacedIconSymbolIndex&&xe);Z.placedIconSymbolIndex>=0&&(V(e.icon,Z.numIconVertices,Me?pe:pn),e.icon.placedSymbolArray.get(Z.placedIconSymbolIndex).hidden=ee.icon.isHidden()),Z.verticalPlacedIconSymbolIndex>=0&&(V(e.icon,Z.numVerticalIconVertices,Me?pn:pe),e.icon.placedSymbolArray.get(Z.verticalPlacedIconSymbolIndex).hidden=ee.icon.isHidden())}let fe=U&&U.has($)?U.get($):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let pe=e.collisionArrays[$];if(pe){let Me=new p.P(0,0);if(pe.textBox||pe.verticalTextBox){let Ve=!0;if(T){let ge=this.variableOffsets[K];ge?(Me=Lt(ge.anchor,ge.width,ge.height,ge.textOffset,ge.textBoxScale),S&&Me._rotate(C?this.transform.angle:-this.transform.angle)):Ve=!1}if(pe.textBox||pe.verticalTextBox){let ge;pe.textBox&&(ge=xe),pe.verticalTextBox&&(ge=Te),dn(e.textCollisionBox.collisionVertexArray,ee.text.placed,!Ve||ge,fe.text,Me.x,Me.y)}}if(pe.iconBox||pe.verticalIconBox){let Ve=!!(!Te&&pe.verticalIconBox),ge;pe.iconBox&&(ge=Ve),pe.verticalIconBox&&(ge=!Ve),dn(e.iconCollisionBox.collisionVertexArray,ee.icon.placed,ge,fe.icon,E?Me.x:0,E?Me.y:0)}}}}if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);if(e.bucketInstanceId in this.collisionCircleArrays){let $=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=$.invProjMatrix,e.placementViewportMatrix=$.viewportMatrix,e.collisionCircleArray=$.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTimee}setStale(){this.stale=!0}}function dn(h,e,n,a,o,c){a&&a.length!==0||(a=[0,0,0,0]);let m=a[0]-je,g=a[1]-je,y=a[2]-je,b=a[3]-je;h.emplaceBack(e?1:0,n?1:0,o||0,c||0,m,g),h.emplaceBack(e?1:0,n?1:0,o||0,c||0,y,g),h.emplaceBack(e?1:0,n?1:0,o||0,c||0,y,b),h.emplaceBack(e?1:0,n?1:0,o||0,c||0,m,b)}let nt=Math.pow(2,25),Ta=Math.pow(2,24),Sa=Math.pow(2,17),di=Math.pow(2,16),pi=Math.pow(2,9),Rl=Math.pow(2,8),wi=Math.pow(2,1);function fi(h){if(h.opacity===0&&!h.placed)return 0;if(h.opacity===1&&h.placed)return 4294967295;let e=h.placed?1:0,n=Math.floor(127*h.opacity);return n*nt+e*Ta+n*Sa+e*di+n*pi+e*Rl+n*wi+e}let pn=0;function Ur(){return{isOccluded:(h,e,n)=>!1,getPitchedTextCorrection:(h,e,n)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(h,e,n,a){throw new Error("Not implemented.")},translatePosition:(h,e,n,a)=>function(o,c,m,g,y=!1){if(!m[0]&&!m[1])return[0,0];let b=y?g==="map"?o.angle:0:g==="viewport"?-o.angle:0;if(b){let T=Math.sin(b),S=Math.cos(b);m=[m[0]*S-m[1]*T,m[0]*T+m[1]*S]}return[y?m[0]:Ge(c,m[0],o.zoom),y?m[1]:Ge(c,m[1],o.zoom)]}(h,e,n,a),getCircleRadiusCorrection:h=>1}}class At{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,n,a,o,c){let m=this._bucketParts;for(;this._currentTileIndexg.sortKey-y.sortKey));this._currentPartIndex!this._forceFullPlacement&&me.now()-o>2;for(;this._currentPlacementIndex>=0;){let m=n[e[this._currentPlacementIndex]],g=this.placement.collisionIndex.transform.zoom;if(m.type==="symbol"&&(!m.minzoom||m.minzoom<=g)&&(!m.maxzoom||m.maxzoom>g)){if(this._inProgressLayer||(this._inProgressLayer=new At(m)),this._inProgressLayer.continuePlacement(a[m.source],this.placement,this._showCollisionBoxes,m,c))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}let Ri=512/p.X/2;class St{constructor(e,n,a){this.tileID=e,this.bucketInstanceId=a,this._symbolsByKey={};let o=new Map;for(let c=0;c({x:Math.floor(y.anchorX*Ri),y:Math.floor(y.anchorY*Ri)})),crossTileIDs:m.map(y=>y.crossTileID)};if(g.positions.length>128){let y=new p.av(g.positions.length,16,Uint16Array);for(let{x:b,y:T}of g.positions)y.add(b,T);y.finish(),delete g.positions,g.index=y}this._symbolsByKey[c]=g}}getScaledCoordinates(e,n){let{x:a,y:o,z:c}=this.tileID.canonical,{x:m,y:g,z:y}=n.canonical,b=Ri/Math.pow(2,y-c),T=(g*p.X+e.anchorY)*b,S=o*p.X*Ri;return{x:Math.floor((m*p.X+e.anchorX)*b-a*p.X*Ri),y:Math.floor(T-S)}}findMatches(e,n,a){let o=this.tileID.canonical.ze)}}class Ms{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Bi{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let n=Math.round((e-this.lng)/360);if(n!==0)for(let a in this.indexes){let o=this.indexes[a],c={};for(let m in o){let g=o[m];g.tileID=g.tileID.unwrapTo(g.tileID.wrap+n),c[g.tileID.key]=g}this.indexes[a]=c}this.lng=e}addBucket(e,n,a){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let c=0;ce.overscaledZ)for(let g in m){let y=m[g];y.tileID.isChildOf(e)&&y.findMatches(n.symbolInstances,e,o)}else{let g=m[e.scaledTo(Number(c)).key];g&&g.findMatches(n.symbolInstances,e,o)}}for(let c=0;c{n[a]=!0});for(let a in this.layerIndexes)n[a]||delete this.layerIndexes[a]}}let Fi=(h,e)=>p.t(h,e&&e.filter(n=>n.identifier!=="source.canvas")),Bl=p.aw();class Cs extends p.E{constructor(e,n={}){super(),this._rtlPluginLoaded=()=>{for(let a in this.sourceCaches){let o=this.sourceCaches[a].getSource().type;o!=="vector"&&o!=="geojson"||this.sourceCaches[a].reload()}},this.map=e,this.dispatcher=new Nr(Vr(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",(a,o)=>this.getGlyphs(a,o)),this.dispatcher.registerMessageHandler("GI",(a,o)=>this.getImages(a,o)),this.imageManager=new Ft,this.imageManager.setEventedParent(this),this.glyphManager=new Ji(e._requestManager,n.localIdeographFontFamily),this.lineAtlas=new ln(256,512),this.crossTileSymbolIndex=new Ia,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new p.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",p.ay()),er().on(ue,this._rtlPluginLoaded),this.on("data",a=>{if(a.dataType!=="source"||a.sourceDataType!=="metadata")return;let o=this.sourceCaches[a.sourceId];if(!o)return;let c=o.getSource();if(c&&c.vectorLayerIds)for(let m in this._layers){let g=this._layers[m];g.source===c.id&&this._validateLayer(g)}})}loadURL(e,n={},a){this.fire(new p.k("dataloading",{dataType:"style"})),n.validate=typeof n.validate!="boolean"||n.validate;let o=this.map._requestManager.transformRequest(e,"Style");this._loadStyleRequest=new AbortController;let c=this._loadStyleRequest;p.h(o,this._loadStyleRequest).then(m=>{this._loadStyleRequest=null,this._load(m.data,n,a)}).catch(m=>{this._loadStyleRequest=null,m&&!c.signal.aborted&&this.fire(new p.j(m))})}loadJSON(e,n={},a){this.fire(new p.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,me.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,n.validate=n.validate!==!1,this._load(e,n,a)}).catch(()=>{})}loadEmpty(){this.fire(new p.k("dataloading",{dataType:"style"})),this._load(Bl,{validate:!1})}_load(e,n,a){var o;let c=n.transformStyle?n.transformStyle(a,e):e;if(!n.validate||!Fi(this,p.u(c))){this._loaded=!0,this.stylesheet=c;for(let m in c.sources)this.addSource(m,c.sources[m],{validate:!1});c.sprite?this._loadSprite(c.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(c.glyphs),this._createLayers(),this.light=new ur(this.stylesheet.light),this.sky=new Ei(this.stylesheet.sky),this.map.setTerrain((o=this.stylesheet.terrain)!==null&&o!==void 0?o:null),this.fire(new p.k("data",{dataType:"style"})),this.fire(new p.k("style.load"))}}_createLayers(){let e=p.az(this.stylesheet.layers);this.dispatcher.broadcast("SL",e),this._order=e.map(n=>n.id),this._layers={},this._serializedLayers=null;for(let n of e){let a=p.aA(n);a.setEventedParent(this,{layer:{id:n.id}}),this._layers[n.id]=a}}_loadSprite(e,n=!1,a=void 0){let o;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(c,m,g,y){return p._(this,void 0,void 0,function*(){let b=Ki(c),T=g>1?"@2x":"",S={},C={};for(let{id:E,url:R}of b){let V=m.transformRequest(Hn(R,T,".json"),"SpriteJSON");S[E]=p.h(V,y);let U=m.transformRequest(Hn(R,T,".png"),"SpriteImage");C[E]=hi.getImage(U,y)}return yield Promise.all([...Object.values(S),...Object.values(C)]),function(E,R){return p._(this,void 0,void 0,function*(){let V={};for(let U in E){V[U]={};let $=me.getImageCanvasContext((yield R[U]).data),Z=(yield E[U]).data;for(let B in Z){let{width:X,height:K,x:ee,y:oe,sdf:he,pixelRatio:xe,stretchX:Te,stretchY:fe,content:pe,textFitWidth:Me,textFitHeight:Ve}=Z[B];V[U][B]={data:null,pixelRatio:xe,sdf:he,stretchX:Te,stretchY:fe,content:pe,textFitWidth:Me,textFitHeight:Ve,spriteData:{width:X,height:K,x:ee,y:oe,context:$}}}}return V})}(S,C)})}(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(c=>{if(this._spriteRequest=null,c)for(let m in c){this._spritesImagesIds[m]=[];let g=this._spritesImagesIds[m]?this._spritesImagesIds[m].filter(y=>!(y in c)):[];for(let y of g)this.imageManager.removeImage(y),this._changedImages[y]=!0;for(let y in c[m]){let b=m==="default"?y:`${m}:${y}`;this._spritesImagesIds[m].push(b),b in this.imageManager.images?this.imageManager.updateImage(b,c[m][y],!1):this.imageManager.addImage(b,c[m][y]),n&&(this._changedImages[b]=!0)}}}).catch(c=>{this._spriteRequest=null,o=c,this.fire(new p.j(o))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.k("data",{dataType:"style"})),a&&a(o)})}_unloadSprite(){for(let e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.k("data",{dataType:"style"}))}_validateLayer(e){let n=this.sourceCaches[e.source];if(!n)return;let a=e.sourceLayer;if(!a)return;let o=n.getSource();(o.type==="geojson"||o.vectorLayerIds&&o.vectorLayerIds.indexOf(a)===-1)&&this.fire(new p.j(new Error(`Source layer "${a}" does not exist on source "${o.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e,n=!1){let a=this._serializedAllLayers();if(!e||e.length===0)return Object.values(n?p.aB(a):a);let o=[];for(let c of e)if(a[c]){let m=n?p.aB(a[c]):a[c];o.push(m)}return o}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};let n=Object.keys(this._layers);for(let a of n){let o=this._layers[a];o.type!=="custom"&&(e[a]=o.serialize())}return e}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(let e in this.sourceCaches)if(this.sourceCaches[e].hasTransition())return!0;for(let e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;let n=this._changed;if(n){let o=Object.keys(this._updatedLayers),c=Object.keys(this._removedLayers);(o.length||c.length)&&this._updateWorkerLayers(o,c);for(let m in this._updatedSources){let g=this._updatedSources[m];if(g==="reload")this._reloadSource(m);else{if(g!=="clear")throw new Error(`Invalid action ${g}`);this._clearSource(m)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let m in this._updatedPaintProps)this._layers[m].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}let a={};for(let o in this.sourceCaches){let c=this.sourceCaches[o];a[o]=c.used,c.used=!1}for(let o of this._order){let c=this._layers[o];c.recalculate(e,this._availableImages),!c.isHidden(e.zoom)&&c.source&&(this.sourceCaches[c.source].used=!0)}for(let o in a){let c=this.sourceCaches[o];!!a[o]!=!!c.used&&c.fire(new p.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:o}))}this.light.recalculate(e),this.sky.recalculate(e),this.z=e.zoom,n&&this.fire(new p.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let n in this.sourceCaches)this.sourceCaches[n].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,n){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,n={}){var a;this._checkLoaded();let o=this.serialize();if(e=n.transformStyle?n.transformStyle(o,e):e,((a=n.validate)===null||a===void 0||a)&&Fi(this,p.u(e)))return!1;(e=p.aB(e)).layers=p.az(e.layers);let c=p.aC(o,e),m=this._getOperationsToPerform(c);if(m.unimplemented.length>0)throw new Error(`Unimplemented: ${m.unimplemented.join(", ")}.`);if(m.operations.length===0)return!1;for(let g of m.operations)g();return this.stylesheet=e,this._serializedLayers=null,!0}_getOperationsToPerform(e){let n=[],a=[];for(let o of e)switch(o.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":n.push(()=>this.addLayer.apply(this,o.args));break;case"removeLayer":n.push(()=>this.removeLayer.apply(this,o.args));break;case"setPaintProperty":n.push(()=>this.setPaintProperty.apply(this,o.args));break;case"setLayoutProperty":n.push(()=>this.setLayoutProperty.apply(this,o.args));break;case"setFilter":n.push(()=>this.setFilter.apply(this,o.args));break;case"addSource":n.push(()=>this.addSource.apply(this,o.args));break;case"removeSource":n.push(()=>this.removeSource.apply(this,o.args));break;case"setLayerZoomRange":n.push(()=>this.setLayerZoomRange.apply(this,o.args));break;case"setLight":n.push(()=>this.setLight.apply(this,o.args));break;case"setGeoJSONSourceData":n.push(()=>this.setGeoJSONSourceData.apply(this,o.args));break;case"setGlyphs":n.push(()=>this.setGlyphs.apply(this,o.args));break;case"setSprite":n.push(()=>this.setSprite.apply(this,o.args));break;case"setSky":n.push(()=>this.setSky.apply(this,o.args));break;case"setTerrain":n.push(()=>this.map.setTerrain.apply(this,o.args));break;case"setTransition":n.push(()=>{});break;default:a.push(o.command)}return{operations:n,unimplemented:a}}addImage(e,n){if(this.getImage(e))return this.fire(new p.j(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,n),this._afterImageUpdated(e)}updateImage(e,n){this.imageManager.updateImage(e,n)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new p.j(new Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,n,a={}){if(this._checkLoaded(),this.sourceCaches[e]!==void 0)throw new Error(`Source "${e}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(p.u.source,`sources.${e}`,n,null,a))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);let o=this.sourceCaches[e]=new Be(e,n,this.dispatcher);o.style=this,o.setEventedParent(this,()=>({isSourceLoaded:o.loaded(),source:o.serialize(),sourceId:e})),o.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error("There is no source with this ID");for(let a in this._layers)if(this._layers[a].source===e)return this.fire(new p.j(new Error(`Source "${e}" cannot be removed while layer "${a}" is using it.`)));let n=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],n.fire(new p.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,n){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error(`There is no source with this ID=${e}`);let a=this.sourceCaches[e].getSource();if(a.type!=="geojson")throw new Error(`geojsonSource.type is ${a.type}, which is !== 'geojson`);a.setData(n),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,n,a={}){this._checkLoaded();let o=e.id;if(this.getLayer(o))return void this.fire(new p.j(new Error(`Layer "${o}" already exists on this map.`)));let c;if(e.type==="custom"){if(Fi(this,p.aD(e)))return;c=p.aA(e)}else{if("source"in e&&typeof e.source=="object"&&(this.addSource(o,e.source),e=p.aB(e),e=p.e(e,{source:o})),this._validate(p.u.layer,`layers.${o}`,e,{arrayIndex:-1},a))return;c=p.aA(e),this._validateLayer(c),c.setEventedParent(this,{layer:{id:o}})}let m=n?this._order.indexOf(n):this._order.length;if(n&&m===-1)this.fire(new p.j(new Error(`Cannot add layer "${o}" before non-existing layer "${n}".`)));else{if(this._order.splice(m,0,o),this._layerOrderChanged=!0,this._layers[o]=c,this._removedLayers[o]&&c.source&&c.type!=="custom"){let g=this._removedLayers[o];delete this._removedLayers[o],g.type!==c.type?this._updatedSources[c.source]="clear":(this._updatedSources[c.source]="reload",this.sourceCaches[c.source].pause())}this._updateLayer(c),c.onAdd&&c.onAdd(this.map)}}moveLayer(e,n){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new p.j(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===n)return;let a=this._order.indexOf(e);this._order.splice(a,1);let o=n?this._order.indexOf(n):this._order.length;n&&o===-1?this.fire(new p.j(new Error(`Cannot move layer "${e}" before non-existing layer "${n}".`))):(this._order.splice(o,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();let n=this._layers[e];if(!n)return void this.fire(new p.j(new Error(`Cannot remove non-existing layer "${e}".`)));n.setEventedParent(null);let a=this._order.indexOf(e);this._order.splice(a,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=n,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],n.onRemove&&n.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,n,a){this._checkLoaded();let o=this.getLayer(e);o?o.minzoom===n&&o.maxzoom===a||(n!=null&&(o.minzoom=n),a!=null&&(o.maxzoom=a),this._updateLayer(o)):this.fire(new p.j(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,n,a={}){this._checkLoaded();let o=this.getLayer(e);if(o){if(!p.aE(o.filter,n))return n==null?(o.filter=void 0,void this._updateLayer(o)):void(this._validate(p.u.filter,`layers.${o.id}.filter`,n,null,a)||(o.filter=p.aB(n),this._updateLayer(o)))}else this.fire(new p.j(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return p.aB(this.getLayer(e).filter)}setLayoutProperty(e,n,a,o={}){this._checkLoaded();let c=this.getLayer(e);c?p.aE(c.getLayoutProperty(n),a)||(c.setLayoutProperty(n,a,o),this._updateLayer(c)):this.fire(new p.j(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,n){let a=this.getLayer(e);if(a)return a.getLayoutProperty(n);this.fire(new p.j(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,n,a,o={}){this._checkLoaded();let c=this.getLayer(e);c?p.aE(c.getPaintProperty(n),a)||(c.setPaintProperty(n,a,o)&&this._updateLayer(c),this._changed=!0,this._updatedPaintProps[e]=!0,this._serializedLayers=null):this.fire(new p.j(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(e,n){return this.getLayer(e).getPaintProperty(n)}setFeatureState(e,n){this._checkLoaded();let a=e.source,o=e.sourceLayer,c=this.sourceCaches[a];if(c===void 0)return void this.fire(new p.j(new Error(`The source '${a}' does not exist in the map's style.`)));let m=c.getSource().type;m==="geojson"&&o?this.fire(new p.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):m!=="vector"||o?(e.id===void 0&&this.fire(new p.j(new Error("The feature id parameter must be provided."))),c.setFeatureState(o,e.id,n)):this.fire(new p.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,n){this._checkLoaded();let a=e.source,o=this.sourceCaches[a];if(o===void 0)return void this.fire(new p.j(new Error(`The source '${a}' does not exist in the map's style.`)));let c=o.getSource().type,m=c==="vector"?e.sourceLayer:void 0;c!=="vector"||m?n&&typeof e.id!="string"&&typeof e.id!="number"?this.fire(new p.j(new Error("A feature id is required to remove its specific state property."))):o.removeFeatureState(m,e.id,n):this.fire(new p.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();let n=e.source,a=e.sourceLayer,o=this.sourceCaches[n];if(o!==void 0)return o.getSource().type!=="vector"||a?(e.id===void 0&&this.fire(new p.j(new Error("The feature id parameter must be provided."))),o.getFeatureState(a,e.id)):void this.fire(new p.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new p.j(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return p.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;let e=p.aF(this.sourceCaches,c=>c.serialize()),n=this._serializeByIds(this._order,!0),a=this.map.getTerrain()||void 0,o=this.stylesheet;return p.aG({version:o.version,name:o.name,metadata:o.metadata,light:o.light,sky:o.sky,center:o.center,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch,sprite:o.sprite,glyphs:o.glyphs,transition:o.transition,sources:e,layers:n,terrain:a},c=>c!==void 0)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.sourceCaches[e.source].getSource().type!=="raster"&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){let n=m=>this._layers[m].type==="fill-extrusion",a={},o=[];for(let m=this._order.length-1;m>=0;m--){let g=this._order[m];if(n(g)){a[g]=m;for(let y of e){let b=y[g];if(b)for(let T of b)o.push(T)}}}o.sort((m,g)=>g.intersectionZ-m.intersectionZ);let c=[];for(let m=this._order.length-1;m>=0;m--){let g=this._order[m];if(n(g))for(let y=o.length-1;y>=0;y--){let b=o[y].feature;if(a[b.layer.id]{let he=$.featureSortOrder;if(he){let xe=he.indexOf(ee.featureIndex);return he.indexOf(oe.featureIndex)-xe}return oe.featureIndex-ee.featureIndex});for(let ee of K)X.push(ee)}}for(let $ in R)R[$].forEach(Z=>{let B=Z.feature,X=b[g[$].source].getFeatureState(B.layer["source-layer"],B.id);B.source=B.layer.source,B.layer["source-layer"]&&(B.sourceLayer=B.layer["source-layer"]),B.state=X});return R}(this._layers,m,this.sourceCaches,e,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(c)}querySourceFeatures(e,n){n&&n.filter&&this._validate(p.u.filter,"querySourceFeatures.filter",n.filter,null,n);let a=this.sourceCaches[e];return a?function(o,c){let m=o.getRenderableIds().map(b=>o.getTileByID(b)),g=[],y={};for(let b=0;bC.getTileByID(E)).sort((E,R)=>R.tileID.overscaledZ-E.tileID.overscaledZ||(E.tileID.isLessThan(R.tileID)?-1:1))}let S=this.crossTileSymbolIndex.addLayer(T,y[T.source],e.center.lng);m=m||S}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((c=c||this._layerOrderChanged||a===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(me.now(),e.zoom))&&(this.pauseablePlacement=new Qn(e,this.map.terrain,this._order,c,n,a,o,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,y),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(me.now()),g=!0),m&&this.pauseablePlacement.placement.setStale()),g||m)for(let b of this._order){let T=this._layers[b];T.type==="symbol"&&this.placement.updateLayerOpacities(T,y[T.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(me.now())}_releaseSymbolFadeTiles(){for(let e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,n){return p._(this,void 0,void 0,function*(){let a=yield this.imageManager.getImages(n.icons);this._updateTilesForChangedImages();let o=this.sourceCaches[n.source];return o&&o.setDependencies(n.tileID.key,n.type,n.icons),a})}getGlyphs(e,n){return p._(this,void 0,void 0,function*(){let a=yield this.glyphManager.getGlyphs(n.stacks),o=this.sourceCaches[n.source];return o&&o.setDependencies(n.tileID.key,n.type,[""]),a})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,n={}){this._checkLoaded(),e&&this._validate(p.u.glyphs,"glyphs",e,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,n,a={},o){this._checkLoaded();let c=[{id:e,url:n}],m=[...Ki(this.stylesheet.sprite),...c];this._validate(p.u.sprite,"sprite",m,null,a)||(this.stylesheet.sprite=m,this._loadSprite(c,!0,o))}removeSprite(e){this._checkLoaded();let n=Ki(this.stylesheet.sprite);if(n.find(a=>a.id===e)){if(this._spritesImagesIds[e])for(let a of this._spritesImagesIds[e])this.imageManager.removeImage(a),this._changedImages[a]=!0;n.splice(n.findIndex(a=>a.id===e),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.k("data",{dataType:"style"}))}else this.fire(new p.j(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return Ki(this.stylesheet.sprite)}setSprite(e,n={},a){this._checkLoaded(),e&&this._validate(p.u.sprite,"sprite",e,null,n)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,a):(this._unloadSprite(),a&&a(null)))}}var $r=p.Y([{name:"a_pos",type:"Int16",components:2}]);let Mr={prelude:tt(`#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 +`,`#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;} +#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(texture2D(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=(texture2D(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 +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 +}`),background:tt(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:tt(`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;varying vec2 v_pos_a;varying 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=texture2D(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=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,"uniform mat4 u_matrix;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;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);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:tt(`varying vec3 v_data;varying 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));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying 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 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);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:tt("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:tt(`uniform highp float u_intensity;varying 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);gl_FragColor=vec4(val,1.0,1.0,1.0); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying 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 unscaled_extrude=vec2(mod(a_pos,2.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;vec4 pos=vec4(floor(a_pos*0.5)+extrude,get_elevation(floor(a_pos*0.5)),1);gl_Position=u_matrix*pos;}`),heatmapTexture:tt(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(0.0); +#endif +}`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying 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:tt("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_anchor_pos;attribute vec2 a_placed;attribute vec2 a_box_real;uniform mat4 u_matrix;uniform vec2 u_pixel_extrude_scale;varying float v_placed;varying float v_notUsed;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}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:tt("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);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);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;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;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:tt("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:tt(`#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_FragColor=color*opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`attribute vec2 a_pos;uniform mat4 u_matrix; +#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=u_matrix*vec4(a_pos,0,1);}`),fillOutline:tt(`varying vec2 v_pos; +#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);gl_FragColor=outline_color*(alpha*opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos; +#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=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:tt(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos; +#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=texture2D(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=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos; +#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=u_matrix*vec4(a_pos,0,1);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;}`),fillPattern:tt(`#ifdef GL_ES +precision highp float; +#endif +uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying 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=texture2D(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=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying 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=u_matrix*vec4(a_pos,0,1);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:tt(`varying vec4 v_color;void main() {gl_FragColor=v_color; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed; +#ifdef TERRAIN3D +attribute vec2 a_centroid; +#endif +varying 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);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);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;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);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:tt(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying 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=texture2D(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=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;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 vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed; +#ifdef TERRAIN3D +attribute vec2 a_centroid; +#endif +varying vec2 v_pos_a;varying vec2 v_pos_b;varying 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 z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0 +? a_pos +: vec2(edgedistance,z*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:tt(`#ifdef GL_ES +precision highp float; +#endif +uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;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))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying 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:tt(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent; +#define PI 3.141592653589793 +void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;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_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:tt(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale; +#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);gl_FragColor=color*(alpha*opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,` +#define scale 0.015873016 +attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar; +#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);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; +#ifdef TERRAIN3D +v_gamma_scale=1.0; +#else +float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; +#endif +v_width2=vec2(outset,inset);}`),lineGradient:tt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv; +#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=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,` +#define scale 0.015873016 +attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv; +#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);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; +#ifdef TERRAIN3D +v_gamma_scale=1.0; +#else +float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; +#endif +v_width2=vec2(outset,inset);}`),linePattern:tt(`#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;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width; +#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(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,` +#define scale 0.015873016 +#define LINE_DISTANCE_SCALE 2.0 +attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width; +#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);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; +#ifdef TERRAIN3D +v_gamma_scale=1.0; +#else +float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.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:tt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale; +#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=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(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);gl_FragColor=color*(alpha*opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,` +#define scale 0.015873016 +#define LINE_DISTANCE_SCALE 2.0 +attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;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;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale; +#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);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude; +#ifdef TERRAIN3D +v_gamma_scale=1.0; +#else +float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.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:tt(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying 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=texture2D(u_image0,v_pos0);vec4 color1=texture2D(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);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:tt(`uniform sampler2D u_texture;varying vec2 v_tex;varying 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;gl_FragColor=texture2D(u_texture,v_tex)*alpha; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute 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_matrix;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;varying vec2 v_tex;varying float v_fade_opacity;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);} +#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;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:tt(`#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;varying vec2 v_data0;varying 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=texture2D(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);}gl_FragColor=color*(alpha*opacity*fade_opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute 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_matrix;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;varying vec2 v_data0;varying vec3 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);} +#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;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:tt(`#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;varying vec4 v_data0;varying 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;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha; +#ifdef OVERDRAW_INSPECTOR +gl_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=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute 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_matrix;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;varying vec4 v_data0;varying vec4 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);} +#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;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:tt("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;varying vec2 v_texture_pos;varying 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=texture2D(u_texture,v_texture_pos);if (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);gl_FragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {gl_FragColor=surface_color;}}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform mat4 u_fog_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying 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=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:tt("varying 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() {gl_FragColor=pack(v_depth);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying 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=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:tt("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying 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=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);}"),sky:tt("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform float u_horizon;uniform float u_sky_horizon_blend;void main() {float y=gl_FragCoord.y;if (y > u_horizon) {float blend=y-u_horizon;if (blend < u_sky_horizon_blend) {gl_FragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {gl_FragColor=u_sky_color;}}}","attribute vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function tt(h,e){let n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,a=e.match(/attribute ([\w]+) ([\w]+)/g),o=h.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),c=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),m=c?c.concat(o):o,g={};return{fragmentSource:h=h.replace(n,(y,b,T,S,C)=>(g[C]=!0,b==="define"?` +#ifndef HAS_UNIFORM_u_${C} +varying ${T} ${S} ${C}; +#else +uniform ${T} ${S} u_${C}; +#endif +`:` +#ifdef HAS_UNIFORM_u_${C} + ${T} ${S} ${C} = u_${C}; +#endif +`)),vertexSource:e=e.replace(n,(y,b,T,S,C)=>{let E=S==="float"?"vec2":"vec4",R=C.match(/color/)?"color":E;return g[C]?b==="define"?` +#ifndef HAS_UNIFORM_u_${C} +uniform lowp float u_${C}_t; +attribute ${T} ${E} a_${C}; +varying ${T} ${S} ${C}; +#else +uniform ${T} ${S} u_${C}; +#endif +`:R==="vec4"?` +#ifndef HAS_UNIFORM_u_${C} + ${C} = a_${C}; +#else + ${T} ${S} ${C} = u_${C}; +#endif +`:` +#ifndef HAS_UNIFORM_u_${C} + ${C} = unpack_mix_${R}(a_${C}, u_${C}_t); +#else + ${T} ${S} ${C} = u_${C}; +#endif +`:b==="define"?` +#ifndef HAS_UNIFORM_u_${C} +uniform lowp float u_${C}_t; +attribute ${T} ${E} a_${C}; +#else +uniform ${T} ${S} u_${C}; +#endif +`:R==="vec4"?` +#ifndef HAS_UNIFORM_u_${C} + ${T} ${S} ${C} = a_${C}; +#else + ${T} ${S} ${C} = u_${C}; +#endif +`:` +#ifndef HAS_UNIFORM_u_${C} + ${T} ${S} ${C} = unpack_mix_${R}(a_${C}, u_${C}_t); +#else + ${T} ${S} ${C} = u_${C}; +#endif +`}),staticAttributes:a,staticUniforms:m}}class Pa{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,n,a,o,c,m,g,y,b){this.context=e;let T=this.boundPaintVertexBuffers.length!==o.length;for(let S=0;!T&&S({u_matrix:h,u_texture:0,u_ele_delta:e,u_fog_matrix:n,u_fog_color:a?a.properties.get("fog-color"):p.aM.white,u_fog_ground_blend:a?a.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:a?a.calculateFogBlendOpacity(o):0,u_horizon_color:a?a.properties.get("horizon-color"):p.aM.white,u_horizon_fog_blend:a?a.properties.get("horizon-fog-blend"):1});function fn(h){let e=[];for(let n=0;n({u_depth:new p.aH(ee,oe.u_depth),u_terrain:new p.aH(ee,oe.u_terrain),u_terrain_dim:new p.aI(ee,oe.u_terrain_dim),u_terrain_matrix:new p.aJ(ee,oe.u_terrain_matrix),u_terrain_unpack:new p.aK(ee,oe.u_terrain_unpack),u_terrain_exaggeration:new p.aI(ee,oe.u_terrain_exaggeration)}))(e,K),this.binderUniforms=a?a.getUniforms(e,K):[]}draw(e,n,a,o,c,m,g,y,b,T,S,C,E,R,V,U,$,Z){let B=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(a),e.setStencilMode(o),e.setColorMode(c),e.setCullFace(m),y){e.activeTexture.set(B.TEXTURE2),B.bindTexture(B.TEXTURE_2D,y.depthTexture),e.activeTexture.set(B.TEXTURE3),B.bindTexture(B.TEXTURE_2D,y.texture);for(let K in this.terrainUniforms)this.terrainUniforms[K].set(y[K])}for(let K in this.fixedUniforms)this.fixedUniforms[K].set(g[K]);V&&V.setUniforms(e,this.binderUniforms,E,{zoom:R});let X=0;switch(n){case B.LINES:X=2;break;case B.TRIANGLES:X=3;break;case B.LINE_STRIP:X=1}for(let K of C.get()){let ee=K.vaos||(K.vaos={});(ee[b]||(ee[b]=new Pa)).bind(e,this,T,V?V.getPaintVertexBuffers():[],S,K.vertexOffset,U,$,Z),B.drawElements(n,K.primitiveLength*X,B.UNSIGNED_SHORT,K.primitiveOffset*X*2)}}}function ks(h,e,n){let a=1/Ge(n,1,e.transform.tileZoom),o=Math.pow(2,n.tileID.overscaledZ),c=n.tileSize*Math.pow(2,e.transform.tileZoom)/o,m=c*(n.tileID.canonical.x+n.tileID.wrap*o),g=c*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[a,h.fromScale,h.toScale],u_fade:h.t,u_pixel_coord_upper:[m>>16,g>>16],u_pixel_coord_lower:[65535&m,65535&g]}}let es=(h,e,n,a)=>{let o=e.style.light,c=o.properties.get("position"),m=[c.x,c.y,c.z],g=function(){var b=new p.A(9);return p.A!=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}();o.properties.get("anchor")==="viewport"&&function(b,T){var S=Math.sin(T),C=Math.cos(T);b[0]=C,b[1]=S,b[2]=0,b[3]=-S,b[4]=C,b[5]=0,b[6]=0,b[7]=0,b[8]=1}(g,-e.transform.angle),function(b,T,S){var C=T[0],E=T[1],R=T[2];b[0]=C*S[0]+E*S[3]+R*S[6],b[1]=C*S[1]+E*S[4]+R*S[7],b[2]=C*S[2]+E*S[5]+R*S[8]}(m,m,g);let y=o.properties.get("color");return{u_matrix:h,u_lightpos:m,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[y.r,y.g,y.b],u_vertical_gradient:+n,u_opacity:a}},zs=(h,e,n,a,o,c,m)=>p.e(es(h,e,n,a),ks(c,e,m),{u_height_factor:-Math.pow(2,o.overscaledZ)/m.tileSize/8}),mn=h=>({u_matrix:h}),Eo=(h,e,n,a)=>p.e(mn(h),ks(n,e,a)),Fl=(h,e)=>({u_matrix:h,u_world:e}),Do=(h,e,n,a,o)=>p.e(Eo(h,e,n,a),{u_world:o}),Ol=(h,e,n,a)=>{let o=h.transform,c,m;if(a.paint.get("circle-pitch-alignment")==="map"){let g=Ge(n,1,o.zoom);c=!0,m=[g,g]}else c=!1,m=o.pixelsToGLUnits;return{u_camera_to_center_distance:o.cameraToCenterDistance,u_scale_with_map:+(a.paint.get("circle-pitch-scale")==="map"),u_matrix:h.translatePosMatrix(e.posMatrix,n,a.paint.get("circle-translate"),a.paint.get("circle-translate-anchor")),u_pitch_with_map:+c,u_device_pixel_ratio:h.pixelRatio,u_extrude_scale:m}},qr=(h,e,n)=>({u_matrix:h,u_inv_matrix:e,u_camera_to_center_distance:n.cameraToCenterDistance,u_viewport_size:[n.width,n.height]}),ts=(h,e,n=1)=>({u_matrix:h,u_color:e,u_overlay:0,u_overlay_scale:n}),ii=h=>({u_matrix:h}),ri=(h,e,n,a)=>({u_matrix:h,u_extrude_scale:Ge(e,1,n),u_intensity:a}),Es=(h,e,n,a)=>{let o=p.H();p.aP(o,0,h.width,h.height,0,0,1);let c=h.context.gl;return{u_matrix:o,u_world:[c.drawingBufferWidth,c.drawingBufferHeight],u_image:n,u_color_ramp:a,u_opacity:e.paint.get("heatmap-opacity")}};function Ds(h,e){let n=Math.pow(2,e.canonical.z),a=e.canonical.y;return[new p.Z(0,a/n).toLngLat().lat,new p.Z(0,(a+1)/n).toLngLat().lat]}let Ls=(h,e,n,a)=>{let o=h.transform;return{u_matrix:Bo(h,e,n,a),u_ratio:1/Ge(e,1,o.zoom),u_device_pixel_ratio:h.pixelRatio,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},Lo=(h,e,n,a,o)=>p.e(Ls(h,e,n,o),{u_image:0,u_image_height:a}),_n=(h,e,n,a,o)=>{let c=h.transform,m=Ro(e,c);return{u_matrix:Bo(h,e,n,o),u_texsize:e.imageAtlasTexture.size,u_ratio:1/Ge(e,1,c.zoom),u_device_pixel_ratio:h.pixelRatio,u_image:0,u_scale:[m,a.fromScale,a.toScale],u_fade:a.t,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]]}},Vl=(h,e,n,a,o,c)=>{let m=h.lineAtlas,g=Ro(e,h.transform),y=n.layout.get("line-cap")==="round",b=m.getDash(a.from,y),T=m.getDash(a.to,y),S=b.width*o.fromScale,C=T.width*o.toScale;return p.e(Ls(h,e,n,c),{u_patternscale_a:[g/S,-b.height/2],u_patternscale_b:[g/C,-T.height/2],u_sdfgamma:m.width/(256*Math.min(S,C)*h.pixelRatio)/2,u_image:0,u_tex_y_a:b.y,u_tex_y_b:T.y,u_mix:o.t})};function Ro(h,e){return 1/Ge(h,1,e.tileZoom)}function Bo(h,e,n,a){return h.translatePosMatrix(a?a.posMatrix:e.tileID.posMatrix,e,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}let Nl=(h,e,n,a,o)=>{return{u_matrix:h,u_tl_parent:e,u_scale_parent:n,u_buffer_scale:1,u_fade_t:a.mix,u_opacity:a.opacity*o.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:o.paint.get("raster-brightness-min"),u_brightness_high:o.paint.get("raster-brightness-max"),u_saturation_factor:(m=o.paint.get("raster-saturation"),m>0?1-1/(1.001-m):-m),u_contrast_factor:(c=o.paint.get("raster-contrast"),c>0?1/(1-c):1+c),u_spin_weights:jl(o.paint.get("raster-hue-rotate"))};var c,m};function jl(h){h*=Math.PI/180;let e=Math.sin(h),n=Math.cos(h);return[(2*n+1)/3,(-Math.sqrt(3)*e-n+1)/3,(Math.sqrt(3)*e-n+1)/3]}let Fo=(h,e,n,a,o,c,m,g,y,b,T,S,C,E)=>{let R=m.transform;return{u_is_size_zoom_constant:+(h==="constant"||h==="source"),u_is_size_feature_constant:+(h==="constant"||h==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:R.cameraToCenterDistance,u_pitch:R.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:R.width/R.height,u_fade_change:m.options.fadeDuration?m.symbolFadeChange:1,u_matrix:g,u_label_plane_matrix:y,u_coord_matrix:b,u_is_text:+S,u_pitch_with_map:+a,u_is_along_line:o,u_is_variable_anchor:c,u_texsize:C,u_texture:0,u_translation:T,u_pitched_scale:E}},is=(h,e,n,a,o,c,m,g,y,b,T,S,C,E,R)=>{let V=m.transform;return p.e(Fo(h,e,n,a,o,c,m,g,y,b,T,S,C,R),{u_gamma_scale:a?Math.cos(V._pitch)*V.cameraToCenterDistance:1,u_device_pixel_ratio:m.pixelRatio,u_is_halo:+E})},Ca=(h,e,n,a,o,c,m,g,y,b,T,S,C,E)=>p.e(is(h,e,n,a,o,c,m,g,y,b,T,!0,S,!0,E),{u_texsize_icon:C,u_texture_icon:1}),Rs=(h,e,n)=>({u_matrix:h,u_opacity:e,u_color:n}),ka=(h,e,n,a,o,c)=>p.e(function(m,g,y,b){let T=y.imageManager.getPattern(m.from.toString()),S=y.imageManager.getPattern(m.to.toString()),{width:C,height:E}=y.imageManager.getPixelSize(),R=Math.pow(2,b.tileID.overscaledZ),V=b.tileSize*Math.pow(2,y.transform.tileZoom)/R,U=V*(b.tileID.canonical.x+b.tileID.wrap*R),$=V*b.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:T.tl,u_pattern_br_a:T.br,u_pattern_tl_b:S.tl,u_pattern_br_b:S.br,u_texsize:[C,E],u_mix:g.t,u_pattern_size_a:T.displaySize,u_pattern_size_b:S.displaySize,u_scale_a:g.fromScale,u_scale_b:g.toScale,u_tile_units_to_pixels:1/Ge(b,1,y.transform.tileZoom),u_pixel_coord_upper:[U>>16,$>>16],u_pixel_coord_lower:[65535&U,65535&$]}}(a,c,n,o),{u_matrix:h,u_opacity:e}),za={fillExtrusion:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_lightpos:new p.aN(h,e.u_lightpos),u_lightintensity:new p.aI(h,e.u_lightintensity),u_lightcolor:new p.aN(h,e.u_lightcolor),u_vertical_gradient:new p.aI(h,e.u_vertical_gradient),u_opacity:new p.aI(h,e.u_opacity)}),fillExtrusionPattern:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_lightpos:new p.aN(h,e.u_lightpos),u_lightintensity:new p.aI(h,e.u_lightintensity),u_lightcolor:new p.aN(h,e.u_lightcolor),u_vertical_gradient:new p.aI(h,e.u_vertical_gradient),u_height_factor:new p.aI(h,e.u_height_factor),u_image:new p.aH(h,e.u_image),u_texsize:new p.aO(h,e.u_texsize),u_pixel_coord_upper:new p.aO(h,e.u_pixel_coord_upper),u_pixel_coord_lower:new p.aO(h,e.u_pixel_coord_lower),u_scale:new p.aN(h,e.u_scale),u_fade:new p.aI(h,e.u_fade),u_opacity:new p.aI(h,e.u_opacity)}),fill:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix)}),fillPattern:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_image:new p.aH(h,e.u_image),u_texsize:new p.aO(h,e.u_texsize),u_pixel_coord_upper:new p.aO(h,e.u_pixel_coord_upper),u_pixel_coord_lower:new p.aO(h,e.u_pixel_coord_lower),u_scale:new p.aN(h,e.u_scale),u_fade:new p.aI(h,e.u_fade)}),fillOutline:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_world:new p.aO(h,e.u_world)}),fillOutlinePattern:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_world:new p.aO(h,e.u_world),u_image:new p.aH(h,e.u_image),u_texsize:new p.aO(h,e.u_texsize),u_pixel_coord_upper:new p.aO(h,e.u_pixel_coord_upper),u_pixel_coord_lower:new p.aO(h,e.u_pixel_coord_lower),u_scale:new p.aN(h,e.u_scale),u_fade:new p.aI(h,e.u_fade)}),circle:(h,e)=>({u_camera_to_center_distance:new p.aI(h,e.u_camera_to_center_distance),u_scale_with_map:new p.aH(h,e.u_scale_with_map),u_pitch_with_map:new p.aH(h,e.u_pitch_with_map),u_extrude_scale:new p.aO(h,e.u_extrude_scale),u_device_pixel_ratio:new p.aI(h,e.u_device_pixel_ratio),u_matrix:new p.aJ(h,e.u_matrix)}),collisionBox:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_pixel_extrude_scale:new p.aO(h,e.u_pixel_extrude_scale)}),collisionCircle:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_inv_matrix:new p.aJ(h,e.u_inv_matrix),u_camera_to_center_distance:new p.aI(h,e.u_camera_to_center_distance),u_viewport_size:new p.aO(h,e.u_viewport_size)}),debug:(h,e)=>({u_color:new p.aL(h,e.u_color),u_matrix:new p.aJ(h,e.u_matrix),u_overlay:new p.aH(h,e.u_overlay),u_overlay_scale:new p.aI(h,e.u_overlay_scale)}),clippingMask:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix)}),heatmap:(h,e)=>({u_extrude_scale:new p.aI(h,e.u_extrude_scale),u_intensity:new p.aI(h,e.u_intensity),u_matrix:new p.aJ(h,e.u_matrix)}),heatmapTexture:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_world:new p.aO(h,e.u_world),u_image:new p.aH(h,e.u_image),u_color_ramp:new p.aH(h,e.u_color_ramp),u_opacity:new p.aI(h,e.u_opacity)}),hillshade:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_image:new p.aH(h,e.u_image),u_latrange:new p.aO(h,e.u_latrange),u_light:new p.aO(h,e.u_light),u_shadow:new p.aL(h,e.u_shadow),u_highlight:new p.aL(h,e.u_highlight),u_accent:new p.aL(h,e.u_accent)}),hillshadePrepare:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_image:new p.aH(h,e.u_image),u_dimension:new p.aO(h,e.u_dimension),u_zoom:new p.aI(h,e.u_zoom),u_unpack:new p.aK(h,e.u_unpack)}),line:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_ratio:new p.aI(h,e.u_ratio),u_device_pixel_ratio:new p.aI(h,e.u_device_pixel_ratio),u_units_to_pixels:new p.aO(h,e.u_units_to_pixels)}),lineGradient:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_ratio:new p.aI(h,e.u_ratio),u_device_pixel_ratio:new p.aI(h,e.u_device_pixel_ratio),u_units_to_pixels:new p.aO(h,e.u_units_to_pixels),u_image:new p.aH(h,e.u_image),u_image_height:new p.aI(h,e.u_image_height)}),linePattern:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_texsize:new p.aO(h,e.u_texsize),u_ratio:new p.aI(h,e.u_ratio),u_device_pixel_ratio:new p.aI(h,e.u_device_pixel_ratio),u_image:new p.aH(h,e.u_image),u_units_to_pixels:new p.aO(h,e.u_units_to_pixels),u_scale:new p.aN(h,e.u_scale),u_fade:new p.aI(h,e.u_fade)}),lineSDF:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_ratio:new p.aI(h,e.u_ratio),u_device_pixel_ratio:new p.aI(h,e.u_device_pixel_ratio),u_units_to_pixels:new p.aO(h,e.u_units_to_pixels),u_patternscale_a:new p.aO(h,e.u_patternscale_a),u_patternscale_b:new p.aO(h,e.u_patternscale_b),u_sdfgamma:new p.aI(h,e.u_sdfgamma),u_image:new p.aH(h,e.u_image),u_tex_y_a:new p.aI(h,e.u_tex_y_a),u_tex_y_b:new p.aI(h,e.u_tex_y_b),u_mix:new p.aI(h,e.u_mix)}),raster:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_tl_parent:new p.aO(h,e.u_tl_parent),u_scale_parent:new p.aI(h,e.u_scale_parent),u_buffer_scale:new p.aI(h,e.u_buffer_scale),u_fade_t:new p.aI(h,e.u_fade_t),u_opacity:new p.aI(h,e.u_opacity),u_image0:new p.aH(h,e.u_image0),u_image1:new p.aH(h,e.u_image1),u_brightness_low:new p.aI(h,e.u_brightness_low),u_brightness_high:new p.aI(h,e.u_brightness_high),u_saturation_factor:new p.aI(h,e.u_saturation_factor),u_contrast_factor:new p.aI(h,e.u_contrast_factor),u_spin_weights:new p.aN(h,e.u_spin_weights)}),symbolIcon:(h,e)=>({u_is_size_zoom_constant:new p.aH(h,e.u_is_size_zoom_constant),u_is_size_feature_constant:new p.aH(h,e.u_is_size_feature_constant),u_size_t:new p.aI(h,e.u_size_t),u_size:new p.aI(h,e.u_size),u_camera_to_center_distance:new p.aI(h,e.u_camera_to_center_distance),u_pitch:new p.aI(h,e.u_pitch),u_rotate_symbol:new p.aH(h,e.u_rotate_symbol),u_aspect_ratio:new p.aI(h,e.u_aspect_ratio),u_fade_change:new p.aI(h,e.u_fade_change),u_matrix:new p.aJ(h,e.u_matrix),u_label_plane_matrix:new p.aJ(h,e.u_label_plane_matrix),u_coord_matrix:new p.aJ(h,e.u_coord_matrix),u_is_text:new p.aH(h,e.u_is_text),u_pitch_with_map:new p.aH(h,e.u_pitch_with_map),u_is_along_line:new p.aH(h,e.u_is_along_line),u_is_variable_anchor:new p.aH(h,e.u_is_variable_anchor),u_texsize:new p.aO(h,e.u_texsize),u_texture:new p.aH(h,e.u_texture),u_translation:new p.aO(h,e.u_translation),u_pitched_scale:new p.aI(h,e.u_pitched_scale)}),symbolSDF:(h,e)=>({u_is_size_zoom_constant:new p.aH(h,e.u_is_size_zoom_constant),u_is_size_feature_constant:new p.aH(h,e.u_is_size_feature_constant),u_size_t:new p.aI(h,e.u_size_t),u_size:new p.aI(h,e.u_size),u_camera_to_center_distance:new p.aI(h,e.u_camera_to_center_distance),u_pitch:new p.aI(h,e.u_pitch),u_rotate_symbol:new p.aH(h,e.u_rotate_symbol),u_aspect_ratio:new p.aI(h,e.u_aspect_ratio),u_fade_change:new p.aI(h,e.u_fade_change),u_matrix:new p.aJ(h,e.u_matrix),u_label_plane_matrix:new p.aJ(h,e.u_label_plane_matrix),u_coord_matrix:new p.aJ(h,e.u_coord_matrix),u_is_text:new p.aH(h,e.u_is_text),u_pitch_with_map:new p.aH(h,e.u_pitch_with_map),u_is_along_line:new p.aH(h,e.u_is_along_line),u_is_variable_anchor:new p.aH(h,e.u_is_variable_anchor),u_texsize:new p.aO(h,e.u_texsize),u_texture:new p.aH(h,e.u_texture),u_gamma_scale:new p.aI(h,e.u_gamma_scale),u_device_pixel_ratio:new p.aI(h,e.u_device_pixel_ratio),u_is_halo:new p.aH(h,e.u_is_halo),u_translation:new p.aO(h,e.u_translation),u_pitched_scale:new p.aI(h,e.u_pitched_scale)}),symbolTextAndIcon:(h,e)=>({u_is_size_zoom_constant:new p.aH(h,e.u_is_size_zoom_constant),u_is_size_feature_constant:new p.aH(h,e.u_is_size_feature_constant),u_size_t:new p.aI(h,e.u_size_t),u_size:new p.aI(h,e.u_size),u_camera_to_center_distance:new p.aI(h,e.u_camera_to_center_distance),u_pitch:new p.aI(h,e.u_pitch),u_rotate_symbol:new p.aH(h,e.u_rotate_symbol),u_aspect_ratio:new p.aI(h,e.u_aspect_ratio),u_fade_change:new p.aI(h,e.u_fade_change),u_matrix:new p.aJ(h,e.u_matrix),u_label_plane_matrix:new p.aJ(h,e.u_label_plane_matrix),u_coord_matrix:new p.aJ(h,e.u_coord_matrix),u_is_text:new p.aH(h,e.u_is_text),u_pitch_with_map:new p.aH(h,e.u_pitch_with_map),u_is_along_line:new p.aH(h,e.u_is_along_line),u_is_variable_anchor:new p.aH(h,e.u_is_variable_anchor),u_texsize:new p.aO(h,e.u_texsize),u_texsize_icon:new p.aO(h,e.u_texsize_icon),u_texture:new p.aH(h,e.u_texture),u_texture_icon:new p.aH(h,e.u_texture_icon),u_gamma_scale:new p.aI(h,e.u_gamma_scale),u_device_pixel_ratio:new p.aI(h,e.u_device_pixel_ratio),u_is_halo:new p.aH(h,e.u_is_halo),u_translation:new p.aO(h,e.u_translation),u_pitched_scale:new p.aI(h,e.u_pitched_scale)}),background:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_opacity:new p.aI(h,e.u_opacity),u_color:new p.aL(h,e.u_color)}),backgroundPattern:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_opacity:new p.aI(h,e.u_opacity),u_image:new p.aH(h,e.u_image),u_pattern_tl_a:new p.aO(h,e.u_pattern_tl_a),u_pattern_br_a:new p.aO(h,e.u_pattern_br_a),u_pattern_tl_b:new p.aO(h,e.u_pattern_tl_b),u_pattern_br_b:new p.aO(h,e.u_pattern_br_b),u_texsize:new p.aO(h,e.u_texsize),u_mix:new p.aI(h,e.u_mix),u_pattern_size_a:new p.aO(h,e.u_pattern_size_a),u_pattern_size_b:new p.aO(h,e.u_pattern_size_b),u_scale_a:new p.aI(h,e.u_scale_a),u_scale_b:new p.aI(h,e.u_scale_b),u_pixel_coord_upper:new p.aO(h,e.u_pixel_coord_upper),u_pixel_coord_lower:new p.aO(h,e.u_pixel_coord_lower),u_tile_units_to_pixels:new p.aI(h,e.u_tile_units_to_pixels)}),terrain:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_texture:new p.aH(h,e.u_texture),u_ele_delta:new p.aI(h,e.u_ele_delta),u_fog_matrix:new p.aJ(h,e.u_fog_matrix),u_fog_color:new p.aL(h,e.u_fog_color),u_fog_ground_blend:new p.aI(h,e.u_fog_ground_blend),u_fog_ground_blend_opacity:new p.aI(h,e.u_fog_ground_blend_opacity),u_horizon_color:new p.aL(h,e.u_horizon_color),u_horizon_fog_blend:new p.aI(h,e.u_horizon_fog_blend)}),terrainDepth:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_ele_delta:new p.aI(h,e.u_ele_delta)}),terrainCoords:(h,e)=>({u_matrix:new p.aJ(h,e.u_matrix),u_texture:new p.aH(h,e.u_texture),u_terrain_coords_id:new p.aI(h,e.u_terrain_coords_id),u_ele_delta:new p.aI(h,e.u_ele_delta)}),sky:(h,e)=>({u_sky_color:new p.aL(h,e.u_sky_color),u_horizon_color:new p.aL(h,e.u_horizon_color),u_horizon:new p.aI(h,e.u_horizon),u_sky_horizon_blend:new p.aI(h,e.u_sky_horizon_blend)})};class rr{constructor(e,n,a){this.context=e;let o=e.gl;this.buffer=o.createBuffer(),this.dynamicDraw=!!a,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let n=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let Ul={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Ea{constructor(e,n,a,o){this.length=n.length,this.attributes=a,this.itemSize=n.bytesPerElement,this.dynamicDraw=o,this.context=e;let c=e.gl;this.buffer=c.createBuffer(),e.bindVertexBuffer.set(this.buffer),c.bufferData(c.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?c.DYNAMIC_DRAW:c.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);let n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,n){for(let a=0;a0){let ee=p.H();p.aQ(ee,B.placementInvProjMatrix,h.transform.glCoordMatrix),p.aQ(ee,ee,B.placementViewportMatrix),y.push({circleArray:K,circleOffset:T,transform:Z.posMatrix,invTransform:ee,coord:Z}),b+=K.length/4,T=b}X&&g.draw(c,m.LINES,Ze.disabled,ht.disabled,h.colorModeForRenderPass(),at.disabled,{u_matrix:Z.posMatrix,u_pixel_extrude_scale:[1/(S=h.transform).width,1/S.height]},h.style.map.terrain&&h.style.map.terrain.getTerrainData(Z),n.id,X.layoutVertexBuffer,X.indexBuffer,X.segments,null,h.transform.zoom,null,null,X.collisionVertexBuffer)}var S;if(!o||!y.length)return;let C=h.useProgram("collisionCircle"),E=new p.aR;E.resize(4*b),E._trim();let R=0;for(let $ of y)for(let Z=0;Z<$.circleArray.length/4;Z++){let B=4*Z,X=$.circleArray[B+0],K=$.circleArray[B+1],ee=$.circleArray[B+2],oe=$.circleArray[B+3];E.emplace(R++,X,K,ee,oe,0),E.emplace(R++,X,K,ee,oe,1),E.emplace(R++,X,K,ee,oe,2),E.emplace(R++,X,K,ee,oe,3)}(!Xr||Xr.length<2*b)&&(Xr=function($){let Z=2*$,B=new p.aT;B.resize(Z),B._trim();for(let X=0;X=0&&($[B.associatedIconIndex]={shiftedAnchor:Fe,angle:pt})}else De(B.numGlyphs,V)}if(b){U.clear();let Z=h.icon.placedSymbolArray;for(let B=0;Bh.style.map.terrain.getElevation(fe,Bn,Fn):null,en=n.layout.get("text-rotation-alignment")==="map";D(Me,fe.posMatrix,h,o,Ln,Rn,$,b,en,V,fe.toUnwrapped(),R.width,R.height,Pi,We)}let Ai=fe.posMatrix,Mi=o&&he||po,kr=Z||Mi?ss:Ln,ji=sa,Rt=be&&n.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1)!==0,jt;jt=be?Me.iconsInText?Ca(Fe.kind,He,B,$,Z,Mi,h,Ai,kr,ji,Pi,Vt,Kt,Te):is(Fe.kind,He,B,$,Z,Mi,h,Ai,kr,ji,Pi,o,Vt,!0,Te):Fo(Fe.kind,He,B,$,Z,Mi,h,Ai,kr,ji,Pi,o,Vt,Te);let gi={program:Ue,buffers:Ve,uniformValues:jt,atlasTexture:Ni,atlasTextureIcon:Nt,atlasInterpolation:mt,atlasInterpolationIcon:ni,isSDF:be,hasHalo:Rt};if(K&&Me.canOverlap){ee=!0;let We=Ve.segments.get();for(let en of We)xe.push({segments:new p.a0([en]),sortKey:en.sortKey,state:gi,terrainData:ft})}else xe.push({segments:Ve.segments,sortKey:0,state:gi,terrainData:ft})}ee&&xe.sort((fe,pe)=>fe.sortKey-pe.sortKey);for(let fe of xe){let pe=fe.state;if(C.activeTexture.set(E.TEXTURE0),pe.atlasTexture.bind(pe.atlasInterpolation,E.CLAMP_TO_EDGE),pe.atlasTextureIcon&&(C.activeTexture.set(E.TEXTURE1),pe.atlasTextureIcon&&pe.atlasTextureIcon.bind(pe.atlasInterpolationIcon,E.CLAMP_TO_EDGE)),pe.isSDF){let Me=pe.uniformValues;pe.hasHalo&&(Me.u_is_halo=1,Ua(pe.buffers,fe.segments,n,h,pe.program,oe,T,S,Me,fe.terrainData)),Me.u_is_halo=0}Ua(pe.buffers,fe.segments,n,h,pe.program,oe,T,S,pe.uniformValues,fe.terrainData)}}function Ua(h,e,n,a,o,c,m,g,y,b){let T=a.context;o.draw(T,T.gl.TRIANGLES,c,m,g,at.disabled,y,b,n.id,h.layoutVertexBuffer,h.indexBuffer,e,n.paint,a.transform.zoom,h.programConfigurations.get(n.id),h.dynamicLayoutVertexBuffer,h.opacityVertexBuffer)}function $a(h,e,n,a){let o=h.context,c=o.gl,m=ht.disabled,g=new bt([c.ONE,c.ONE],p.aM.transparent,[!0,!0,!0,!0]),y=e.getBucket(n);if(!y)return;let b=a.key,T=n.heatmapFbos.get(b);T||(T=as(o,e.tileSize,e.tileSize),n.heatmapFbos.set(b,T)),o.bindFramebuffer.set(T.framebuffer),o.viewport.set([0,0,e.tileSize,e.tileSize]),o.clear({color:p.aM.transparent});let S=y.programConfigurations.get(n.id),C=h.useProgram("heatmap",S),E=h.style.map.terrain.getTerrainData(a);C.draw(o,c.TRIANGLES,Ze.disabled,m,g,at.disabled,ri(a.posMatrix,e,h.transform.zoom,n.paint.get("heatmap-intensity")),E,n.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,n.paint,h.transform.zoom,S)}function Kr(h,e,n){let a=h.context,o=a.gl;a.setColorMode(h.colorModeForRenderPass());let c=os(a,e),m=n.key,g=e.heatmapFbos.get(m);g&&(a.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,g.colorAttachment.get()),a.activeTexture.set(o.TEXTURE1),c.bind(o.LINEAR,o.CLAMP_TO_EDGE),h.useProgram("heatmapTexture").draw(a,o.TRIANGLES,Ze.disabled,ht.disabled,h.colorModeForRenderPass(),at.disabled,Es(h,e,0,1),null,e.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments,e.paint,h.transform.zoom),g.destroy(),e.heatmapFbos.delete(m))}function as(h,e,n){var a,o;let c=h.gl,m=c.createTexture();c.bindTexture(c.TEXTURE_2D,m),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.LINEAR),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.LINEAR);let g=(a=h.HALF_FLOAT)!==null&&a!==void 0?a:c.UNSIGNED_BYTE,y=(o=h.RGBA16F)!==null&&o!==void 0?o:c.RGBA;c.texImage2D(c.TEXTURE_2D,0,y,e,n,0,c.RGBA,g,null);let b=h.createFramebuffer(e,n,!1,!1);return b.colorAttachment.set(m),b}function os(h,e){return e.colorRampTexture||(e.colorRampTexture=new st(h,e.colorRamp,h.gl.RGBA)),e.colorRampTexture}function xn(h,e,n,a,o){if(!n||!a||!a.imageAtlas)return;let c=a.imageAtlas.patternPositions,m=c[n.to.toString()],g=c[n.from.toString()];if(!m&&g&&(m=g),!g&&m&&(g=m),!m||!g){let y=o.getPaintProperty(e);m=c[y],g=c[y]}m&&g&&h.setConstantPatternPositions(m,g)}function ls(h,e,n,a,o,c,m){let g=h.context.gl,y="fill-pattern",b=n.paint.get(y),T=b&&b.constantOr(1),S=n.getCrossfadeParameters(),C,E,R,V,U;m?(E=T&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",C=g.LINES):(E=T?"fillPattern":"fill",C=g.TRIANGLES);let $=b.constantOr(null);for(let Z of a){let B=e.getTile(Z);if(T&&!B.patternsLoaded())continue;let X=B.getBucket(n);if(!X)continue;let K=X.programConfigurations.get(n.id),ee=h.useProgram(E,K),oe=h.style.map.terrain&&h.style.map.terrain.getTerrainData(Z);T&&(h.context.activeTexture.set(g.TEXTURE0),B.imageAtlasTexture.bind(g.LINEAR,g.CLAMP_TO_EDGE),K.updatePaintBuffers(S)),xn(K,y,$,B,n);let he=oe?Z:null,xe=h.translatePosMatrix(he?he.posMatrix:Z.posMatrix,B,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(m){V=X.indexBuffer2,U=X.segments2;let Te=[g.drawingBufferWidth,g.drawingBufferHeight];R=E==="fillOutlinePattern"&&T?Do(xe,h,S,B,Te):Fl(xe,Te)}else V=X.indexBuffer,U=X.segments,R=T?Eo(xe,h,S,B):mn(xe);ee.draw(h.context,C,o,h.stencilModeForClipping(Z),c,at.disabled,R,oe,n.id,X.layoutVertexBuffer,V,U,n.paint,h.transform.zoom,K)}}function js(h,e,n,a,o,c,m){let g=h.context,y=g.gl,b="fill-extrusion-pattern",T=n.paint.get(b),S=T.constantOr(1),C=n.getCrossfadeParameters(),E=n.paint.get("fill-extrusion-opacity"),R=T.constantOr(null);for(let V of a){let U=e.getTile(V),$=U.getBucket(n);if(!$)continue;let Z=h.style.map.terrain&&h.style.map.terrain.getTerrainData(V),B=$.programConfigurations.get(n.id),X=h.useProgram(S?"fillExtrusionPattern":"fillExtrusion",B);S&&(h.context.activeTexture.set(y.TEXTURE0),U.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),B.updatePaintBuffers(C)),xn(B,b,R,U,n);let K=h.translatePosMatrix(V.posMatrix,U,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),ee=n.paint.get("fill-extrusion-vertical-gradient"),oe=S?zs(K,h,ee,E,V,C,U):es(K,h,ee,E);X.draw(g,g.gl.TRIANGLES,o,c,m,at.backCCW,oe,Z,n.id,$.layoutVertexBuffer,$.indexBuffer,$.segments,n.paint,h.transform.zoom,B,h.style.map.terrain&&$.centroidVertexBuffer)}}function vn(h,e,n,a,o,c,m){let g=h.context,y=g.gl,b=n.fbo;if(!b)return;let T=h.useProgram("hillshade"),S=h.style.map.terrain&&h.style.map.terrain.getTerrainData(e);g.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,b.colorAttachment.get()),T.draw(g,y.TRIANGLES,o,c,m,at.disabled,((C,E,R,V)=>{let U=R.paint.get("hillshade-shadow-color"),$=R.paint.get("hillshade-highlight-color"),Z=R.paint.get("hillshade-accent-color"),B=R.paint.get("hillshade-illumination-direction")*(Math.PI/180);R.paint.get("hillshade-illumination-anchor")==="viewport"&&(B-=C.transform.angle);let X=!C.options.moving;return{u_matrix:V?V.posMatrix:C.transform.calculatePosMatrix(E.tileID.toUnwrapped(),X),u_image:0,u_latrange:Ds(0,E.tileID),u_light:[R.paint.get("hillshade-exaggeration"),B],u_shadow:U,u_highlight:$,u_accent:Z}})(h,n,a,S?e:null),S,a.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments)}function bn(h,e,n,a,o,c){let m=h.context,g=m.gl,y=e.dem;if(y&&y.data){let b=y.dim,T=y.stride,S=y.getPixels();if(m.activeTexture.set(g.TEXTURE1),m.pixelStoreUnpackPremultiplyAlpha.set(!1),e.demTexture=e.demTexture||h.getTileTexture(T),e.demTexture){let E=e.demTexture;E.update(S,{premultiply:!1}),E.bind(g.NEAREST,g.CLAMP_TO_EDGE)}else e.demTexture=new st(m,S,g.RGBA,{premultiply:!1}),e.demTexture.bind(g.NEAREST,g.CLAMP_TO_EDGE);m.activeTexture.set(g.TEXTURE0);let C=e.fbo;if(!C){let E=new st(m,{width:b,height:b,data:null},g.RGBA);E.bind(g.LINEAR,g.CLAMP_TO_EDGE),C=e.fbo=m.createFramebuffer(b,b,!0,!1),C.colorAttachment.set(E.texture)}m.bindFramebuffer.set(C.framebuffer),m.viewport.set([0,0,b,b]),h.useProgram("hillshadePrepare").draw(m,g.TRIANGLES,a,o,c,at.disabled,((E,R)=>{let V=R.stride,U=p.H();return p.aP(U,0,p.X,-p.X,0,0,1),p.J(U,U,[0,-p.X,0]),{u_matrix:U,u_image:1,u_dimension:[V,V],u_zoom:E.overscaledZ,u_unpack:R.getUnpackVector()}})(e.tileID,y),null,n.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments),e.needsHillshadePrepare=!1}}function Ko(h,e,n,a,o,c){let m=a.paint.get("raster-fade-duration");if(!c&&m>0){let g=me.now(),y=(g-h.timeAdded)/m,b=e?(g-e.timeAdded)/m:-1,T=n.getSource(),S=o.coveringZoomLevel({tileSize:T.tileSize,roundZoom:T.roundZoom}),C=!e||Math.abs(e.tileID.overscaledZ-S)>Math.abs(h.tileID.overscaledZ-S),E=C&&h.refreshedUponExpiration?1:p.ac(C?y:1-b,0,1);return h.refreshedUponExpiration&&y>=1&&(h.refreshedUponExpiration=!1),e?{opacity:1,mix:1-E}:{opacity:E,mix:0}}return{opacity:1,mix:0}}let qa=new p.aM(1,0,0,1),Ye=new p.aM(0,1,0,1),Us=new p.aM(0,0,1,1),Yl=new p.aM(1,0,1,1),Jo=new p.aM(0,1,1,1);function wn(h,e,n,a){$s(h,0,e+n/2,h.transform.width,n,a)}function Yo(h,e,n,a){$s(h,e-n/2,0,n,h.transform.height,a)}function $s(h,e,n,a,o,c){let m=h.context,g=m.gl;g.enable(g.SCISSOR_TEST),g.scissor(e*h.pixelRatio,n*h.pixelRatio,a*h.pixelRatio,o*h.pixelRatio),m.clear({color:c}),g.disable(g.SCISSOR_TEST)}function Qo(h,e,n){let a=h.context,o=a.gl,c=n.posMatrix,m=h.useProgram("debug"),g=Ze.disabled,y=ht.disabled,b=h.colorModeForRenderPass(),T="$debug",S=h.style.map.terrain&&h.style.map.terrain.getTerrainData(n);a.activeTexture.set(o.TEXTURE0);let C=e.getTileByID(n.key).latestRawTileData,E=Math.floor((C&&C.byteLength||0)/1024),R=e.getTile(n).tileSize,V=512/Math.min(R,512)*(n.overscaledZ/h.transform.zoom)*.5,U=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(U+=` => ${n.overscaledZ}`),function($,Z){$.initDebugOverlayCanvas();let B=$.debugOverlayCanvas,X=$.context.gl,K=$.debugOverlayCanvas.getContext("2d");K.clearRect(0,0,B.width,B.height),K.shadowColor="white",K.shadowBlur=2,K.lineWidth=1.5,K.strokeStyle="white",K.textBaseline="top",K.font="bold 36px Open Sans, sans-serif",K.fillText(Z,5,5),K.strokeText(Z,5,5),$.debugOverlayTexture.update(B),$.debugOverlayTexture.bind(X.LINEAR,X.CLAMP_TO_EDGE)}(h,`${U} ${E}kB`),m.draw(a,o.TRIANGLES,g,y,bt.alphaBlended,at.disabled,ts(c,p.aM.transparent,V),null,T,h.debugBuffer,h.quadTriangleIndexBuffer,h.debugSegments),m.draw(a,o.LINE_STRIP,g,y,b,at.disabled,ts(c,p.aM.red),S,T,h.debugBuffer,h.tileBorderIndexBuffer,h.debugSegments)}function el(h,e,n){let a=h.context,o=a.gl,c=h.colorModeForRenderPass(),m=new Ze(o.LEQUAL,Ze.ReadWrite,h.depthRangeFor3D),g=h.useProgram("terrain"),y=e.getTerrainMesh();a.bindFramebuffer.set(null),a.viewport.set([0,0,h.width,h.height]);for(let b of n){let T=h.renderToTexture.getTexture(b),S=e.getTerrainData(b.tileID);a.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,T.texture);let C=h.transform.calculatePosMatrix(b.tileID.toUnwrapped()),E=e.getMeshFrameDelta(h.transform.zoom),R=h.transform.calculateFogMatrix(b.tileID.toUnwrapped()),V=Aa(C,E,R,h.style.sky,h.transform.pitch);g.draw(a,o.TRIANGLES,m,ht.disabled,c,at.backCCW,V,S,"terrain",y.vertexBuffer,y.indexBuffer,y.segments)}}class qs{constructor(e,n,a){this.vertexBuffer=e,this.indexBuffer=n,this.segments=a}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class Zs{constructor(e,n){this.context=new Jl(e),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:p.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Be.maxUnderzooming+Be.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Ia}resize(e,n,a){if(this.width=Math.floor(e*a),this.height=Math.floor(n*a),this.pixelRatio=a,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let o of this.style._order)this.style._layers[o].resize()}setup(){let e=this.context,n=new p.aX;n.emplaceBack(0,0),n.emplaceBack(p.X,0),n.emplaceBack(0,p.X),n.emplaceBack(p.X,p.X),this.tileExtentBuffer=e.createVertexBuffer(n,$r.members),this.tileExtentSegments=p.a0.simpleSegment(0,0,4,2);let a=new p.aX;a.emplaceBack(0,0),a.emplaceBack(p.X,0),a.emplaceBack(0,p.X),a.emplaceBack(p.X,p.X),this.debugBuffer=e.createVertexBuffer(a,$r.members),this.debugSegments=p.a0.simpleSegment(0,0,4,5);let o=new p.$;o.emplaceBack(0,0,0,0),o.emplaceBack(p.X,0,p.X,0),o.emplaceBack(0,p.X,0,p.X),o.emplaceBack(p.X,p.X,p.X,p.X),this.rasterBoundsBuffer=e.createVertexBuffer(o,Ir.members),this.rasterBoundsSegments=p.a0.simpleSegment(0,0,4,2);let c=new p.aX;c.emplaceBack(0,0),c.emplaceBack(1,0),c.emplaceBack(0,1),c.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(c,$r.members),this.viewportSegments=p.a0.simpleSegment(0,0,4,2);let m=new p.aZ;m.emplaceBack(0),m.emplaceBack(1),m.emplaceBack(3),m.emplaceBack(2),m.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(m);let g=new p.aY;g.emplaceBack(0,1,2),g.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(g);let y=this.context.gl;this.stencilClearMode=new ht({func:y.ALWAYS,mask:0},0,255,y.ZERO,y.ZERO,y.ZERO)}clearStencil(){let e=this.context,n=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let a=p.H();p.aP(a,0,this.width,this.height,0,0,1),p.K(a,a,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,n.TRIANGLES,Ze.disabled,this.stencilClearMode,bt.disabled,at.disabled,ii(a),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,n){if(this.currentStencilSource===e.source||!e.isTileClipped()||!n||!n.length)return;this.currentStencilSource=e.source;let a=this.context,o=a.gl;this.nextStencilID+n.length>256&&this.clearStencil(),a.setColorMode(bt.disabled),a.setDepthMode(Ze.disabled);let c=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(let m of n){let g=this._tileClippingMaskIDs[m.key]=this.nextStencilID++,y=this.style.map.terrain&&this.style.map.terrain.getTerrainData(m);c.draw(a,o.TRIANGLES,Ze.disabled,new ht({func:o.ALWAYS,mask:0},g,255,o.KEEP,o.KEEP,o.REPLACE),bt.disabled,at.disabled,ii(m.posMatrix),y,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,n=this.context.gl;return new ht({func:n.NOTEQUAL,mask:255},e,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(e){let n=this.context.gl;return new ht({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(e){let n=this.context.gl,a=e.sort((m,g)=>g.overscaledZ-m.overscaledZ),o=a[a.length-1].overscaledZ,c=a[0].overscaledZ-o+1;if(c>1){this.currentStencilSource=void 0,this.nextStencilID+c>256&&this.clearStencil();let m={};for(let g=0;g({u_sky_color:$.properties.get("sky-color"),u_horizon_color:$.properties.get("horizon-color"),u_horizon:(Z.height/2+Z.getHorizon())*B,u_sky_horizon_blend:$.properties.get("sky-horizon-blend")*Z.height/2*B}))(b,y.style.map.transform,y.pixelRatio),E=new Ze(S.LEQUAL,Ze.ReadWrite,[0,1]),R=ht.disabled,V=y.colorModeForRenderPass(),U=y.useProgram("sky");if(!b.mesh){let $=new p.aX;$.emplaceBack(-1,-1),$.emplaceBack(1,-1),$.emplaceBack(1,1),$.emplaceBack(-1,1);let Z=new p.aY;Z.emplaceBack(0,1,2),Z.emplaceBack(0,2,3),b.mesh=new qs(T.createVertexBuffer($,$r.members),T.createIndexBuffer(Z),p.a0.simpleSegment(0,0,$.length,Z.length))}U.draw(T,S.TRIANGLES,E,R,V,at.disabled,C,void 0,"sky",b.mesh.vertexBuffer,b.mesh.indexBuffer,b.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=a.length-1;this.currentLayer>=0;this.currentLayer--){let y=this.style._layers[a[this.currentLayer]],b=o[y.source],T=c[y.source];this._renderTileClippingMasks(y,T),this.renderLayer(this,b,y,T)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerU.source&&!U.isHidden(T)?[b.sourceCaches[U.source]]:[]),E=C.filter(U=>U.getSource().type==="vector"),R=C.filter(U=>U.getSource().type!=="vector"),V=U=>{(!S||S.getSource().maxzoomV(U)),S||R.forEach(U=>V(U)),S}(this.style,this.transform.zoom);y&&function(b,T,S){for(let C=0;C0),o&&(p.b0(n,a),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(c,m){let g=c.context,y=g.gl,b=bt.unblended,T=new Ze(y.LEQUAL,Ze.ReadWrite,[0,1]),S=m.getTerrainMesh(),C=m.sourceCache.getRenderableTiles(),E=c.useProgram("terrainDepth");g.bindFramebuffer.set(m.getFramebuffer("depth").framebuffer),g.viewport.set([0,0,c.width/devicePixelRatio,c.height/devicePixelRatio]),g.clear({color:p.aM.transparent,depth:1});for(let R of C){let V=m.getTerrainData(R.tileID),U={u_matrix:c.transform.calculatePosMatrix(R.tileID.toUnwrapped()),u_ele_delta:m.getMeshFrameDelta(c.transform.zoom)};E.draw(g,y.TRIANGLES,T,ht.disabled,b,at.backCCW,U,V,"terrain",S.vertexBuffer,S.indexBuffer,S.segments)}g.bindFramebuffer.set(null),g.viewport.set([0,0,c.width,c.height])}(this,this.style.map.terrain),function(c,m){let g=c.context,y=g.gl,b=bt.unblended,T=new Ze(y.LEQUAL,Ze.ReadWrite,[0,1]),S=m.getTerrainMesh(),C=m.getCoordsTexture(),E=m.sourceCache.getRenderableTiles(),R=c.useProgram("terrainCoords");g.bindFramebuffer.set(m.getFramebuffer("coords").framebuffer),g.viewport.set([0,0,c.width/devicePixelRatio,c.height/devicePixelRatio]),g.clear({color:p.aM.transparent,depth:1}),m.coordsIndex=[];for(let V of E){let U=m.getTerrainData(V.tileID);g.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,C.texture);let $={u_matrix:c.transform.calculatePosMatrix(V.tileID.toUnwrapped()),u_terrain_coords_id:(255-m.coordsIndex.length)/255,u_texture:0,u_ele_delta:m.getMeshFrameDelta(c.transform.zoom)};R.draw(g,y.TRIANGLES,T,ht.disabled,b,at.backCCW,$,U,"terrain",S.vertexBuffer,S.indexBuffer,S.segments),m.coordsIndex.push(V.tileID.key)}g.bindFramebuffer.set(null),g.viewport.set([0,0,c.width,c.height])}(this,this.style.map.terrain))}renderLayer(e,n,a,o){if(!a.isHidden(this.transform.zoom)&&(a.type==="background"||a.type==="custom"||(o||[]).length))switch(this.id=a.id,a.type){case"symbol":(function(c,m,g,y,b){if(c.renderPass!=="translucent")return;let T=ht.disabled,S=c.colorModeForRenderPass();(g._unevaluatedLayout.hasValue("text-variable-anchor")||g._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(C,E,R,V,U,$,Z,B,X){let K=E.transform,ee=Ur(),oe=U==="map",he=$==="map";for(let xe of C){let Te=V.getTile(xe),fe=Te.getBucket(R);if(!fe||!fe.text||!fe.text.segments.get().length)continue;let pe=p.ag(fe.textSizeData,K.zoom),Me=Ge(Te,1,E.transform.zoom),Ve=Ar(xe.posMatrix,he,oe,E.transform,Me),ge=R.layout.get("icon-text-fit")!=="none"&&fe.hasIconData();if(pe){let be=Math.pow(2,K.zoom-Te.tileID.overscaledZ),Fe=E.style.map.terrain?(Ue,He)=>E.style.map.terrain.getElevation(xe,Ue,He):null,pt=ee.translatePosition(K,Te,Z,B);yn(fe,oe,he,X,K,Ve,xe.posMatrix,be,pe,ge,ee,pt,xe.toUnwrapped(),Fe)}}}(y,c,g,m,g.layout.get("text-rotation-alignment"),g.layout.get("text-pitch-alignment"),g.paint.get("text-translate"),g.paint.get("text-translate-anchor"),b),g.paint.get("icon-opacity").constantOr(1)!==0&&ja(c,m,g,y,!1,g.paint.get("icon-translate"),g.paint.get("icon-translate-anchor"),g.layout.get("icon-rotation-alignment"),g.layout.get("icon-pitch-alignment"),g.layout.get("icon-keep-upright"),T,S),g.paint.get("text-opacity").constantOr(1)!==0&&ja(c,m,g,y,!0,g.paint.get("text-translate"),g.paint.get("text-translate-anchor"),g.layout.get("text-rotation-alignment"),g.layout.get("text-pitch-alignment"),g.layout.get("text-keep-upright"),T,S),m.map.showCollisionBoxes&&(ns(c,m,g,y,!0),ns(c,m,g,y,!1))})(e,n,a,o,this.style.placement.variableOffsets);break;case"circle":(function(c,m,g,y){if(c.renderPass!=="translucent")return;let b=g.paint.get("circle-opacity"),T=g.paint.get("circle-stroke-width"),S=g.paint.get("circle-stroke-opacity"),C=!g.layout.get("circle-sort-key").isConstant();if(b.constantOr(1)===0&&(T.constantOr(1)===0||S.constantOr(1)===0))return;let E=c.context,R=E.gl,V=c.depthModeForSublayer(0,Ze.ReadOnly),U=ht.disabled,$=c.colorModeForRenderPass(),Z=[];for(let B=0;BB.sortKey-X.sortKey);for(let B of Z){let{programConfiguration:X,program:K,layoutVertexBuffer:ee,indexBuffer:oe,uniformValues:he,terrainData:xe}=B.state;K.draw(E,R.TRIANGLES,V,U,$,at.disabled,he,xe,g.id,ee,oe,B.segments,g.paint,c.transform.zoom,X)}})(e,n,a,o);break;case"heatmap":(function(c,m,g,y){if(g.paint.get("heatmap-opacity")===0)return;let b=c.context;if(c.style.map.terrain){for(let T of y){let S=m.getTile(T);m.hasRenderableParent(T)||(c.renderPass==="offscreen"?$a(c,S,g,T):c.renderPass==="translucent"&&Kr(c,g,T))}b.viewport.set([0,0,c.width,c.height])}else c.renderPass==="offscreen"?function(T,S,C,E){let R=T.context,V=R.gl,U=ht.disabled,$=new bt([V.ONE,V.ONE],p.aM.transparent,[!0,!0,!0,!0]);(function(Z,B,X){let K=Z.gl;Z.activeTexture.set(K.TEXTURE1),Z.viewport.set([0,0,B.width/4,B.height/4]);let ee=X.heatmapFbos.get(p.aU);ee?(K.bindTexture(K.TEXTURE_2D,ee.colorAttachment.get()),Z.bindFramebuffer.set(ee.framebuffer)):(ee=as(Z,B.width/4,B.height/4),X.heatmapFbos.set(p.aU,ee))})(R,T,C),R.clear({color:p.aM.transparent});for(let Z=0;Z20&&T.texParameterf(T.TEXTURE_2D,b.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,b.extTextureFilterAnisotropicMax);let fe=c.style.map.terrain&&c.style.map.terrain.getTerrainData(Z),pe=fe?Z:null,Me=pe?pe.posMatrix:c.transform.calculatePosMatrix(Z.toUnwrapped(),$),Ve=Nl(Me,xe||[0,0],he||1,oe,g);S instanceof pr?C.draw(b,T.TRIANGLES,B,ht.disabled,E,at.disabled,Ve,fe,g.id,S.boundsBuffer,c.quadTriangleIndexBuffer,S.boundsSegments):C.draw(b,T.TRIANGLES,B,R[Z.overscaledZ],E,at.disabled,Ve,fe,g.id,c.rasterBoundsBuffer,c.quadTriangleIndexBuffer,c.rasterBoundsSegments)}})(e,n,a,o);break;case"background":(function(c,m,g,y){let b=g.paint.get("background-color"),T=g.paint.get("background-opacity");if(T===0)return;let S=c.context,C=S.gl,E=c.transform,R=E.tileSize,V=g.paint.get("background-pattern");if(c.isPatternMissing(V))return;let U=!V&&b.a===1&&T===1&&c.opaquePassEnabledForLayer()?"opaque":"translucent";if(c.renderPass!==U)return;let $=ht.disabled,Z=c.depthModeForSublayer(0,U==="opaque"?Ze.ReadWrite:Ze.ReadOnly),B=c.colorModeForRenderPass(),X=c.useProgram(V?"backgroundPattern":"background"),K=y||E.coveringTiles({tileSize:R,terrain:c.style.map.terrain});V&&(S.activeTexture.set(C.TEXTURE0),c.imageManager.bind(c.context));let ee=g.getCrossfadeParameters();for(let oe of K){let he=y?oe.posMatrix:c.transform.calculatePosMatrix(oe.toUnwrapped()),xe=V?ka(he,T,c,V,{tileID:oe,tileSize:R},ee):Rs(he,T,b),Te=c.style.map.terrain&&c.style.map.terrain.getTerrainData(oe);X.draw(S,C.TRIANGLES,Z,$,B,at.disabled,xe,Te,g.id,c.tileExtentBuffer,c.quadTriangleIndexBuffer,c.tileExtentSegments)}})(e,0,a,o);break;case"custom":(function(c,m,g){let y=c.context,b=g.implementation;if(c.renderPass==="offscreen"){let T=b.prerender;T&&(c.setCustomLayerDefaults(),y.setColorMode(c.colorModeForRenderPass()),T.call(b,y.gl,c.transform.customLayerMatrix()),y.setDirty(),c.setBaseState())}else if(c.renderPass==="translucent"){c.setCustomLayerDefaults(),y.setColorMode(c.colorModeForRenderPass()),y.setStencilMode(ht.disabled);let T=b.renderingMode==="3d"?new Ze(c.context.gl.LEQUAL,Ze.ReadWrite,c.depthRangeFor3D):c.depthModeForSublayer(0,Ze.ReadOnly);y.setDepthMode(T),b.render(y.gl,c.transform.customLayerMatrix(),{farZ:c.transform.farZ,nearZ:c.transform.nearZ,fov:c.transform._fov,modelViewProjectionMatrix:c.transform.modelViewProjectionMatrix,projectionMatrix:c.transform.projectionMatrix}),y.setDirty(),c.setBaseState(),y.bindFramebuffer.set(null)}})(e,0,a)}}translatePosMatrix(e,n,a,o,c){if(!a[0]&&!a[1])return e;let m=c?o==="map"?this.transform.angle:0:o==="viewport"?-this.transform.angle:0;if(m){let b=Math.sin(m),T=Math.cos(m);a=[a[0]*T-a[1]*b,a[0]*b+a[1]*T]}let g=[c?a[0]:Ge(n,a[0],this.transform.zoom),c?a[1]:Ge(n,a[1],this.transform.zoom),0],y=new Float32Array(16);return p.J(y,e,g),y}saveTileTexture(e){let n=this._tileTextures[e.size[0]];n?n.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){let n=this._tileTextures[e];return n&&n.length>0?n.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;let n=this.imageManager.getPattern(e.from.toString()),a=this.imageManager.getPattern(e.to.toString());return!n||!a}useProgram(e,n){this.cache=this.cache||{};let a=e+(n?n.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[a]||(this.cache[a]=new Ma(this.context,Mr[e],n,za[e],this._showOverdrawInspector,this.style.map.terrain)),this.cache[a]}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(){let e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new st(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){let{drawingBufferWidth:e,drawingBufferHeight:n}=this.context.gl;return this.width!==e||this.height!==n}}class Tn{constructor(e,n){this.points=e,this.planes=n}static fromInvProjectionMatrix(e,n,a){let o=Math.pow(2,a),c=[[-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(g=>{let y=1/(g=p.af([],g,e))[3]/n*o;return p.b1(g,g,[y,y,1/g[3],y])}),m=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(g=>{let y=function(C,E){var R=E[0],V=E[1],U=E[2],$=R*R+V*V+U*U;return $>0&&($=1/Math.sqrt($)),C[0]=E[0]*$,C[1]=E[1]*$,C[2]=E[2]*$,C}([],function(C,E,R){var V=E[0],U=E[1],$=E[2],Z=R[0],B=R[1],X=R[2];return C[0]=U*X-$*B,C[1]=$*Z-V*X,C[2]=V*B-U*Z,C}([],vi([],c[g[0]],c[g[1]]),vi([],c[g[2]],c[g[1]]))),b=-((T=y)[0]*(S=c[g[1]])[0]+T[1]*S[1]+T[2]*S[2]);var T,S;return y.concat(b)});return new Tn(c,m)}}class Sn{constructor(e,n){this.min=e,this.max=n,this.center=function(a,o,c){return a[0]=.5*o[0],a[1]=.5*o[1],a[2]=.5*o[2],a}([],function(a,o,c){return a[0]=o[0]+c[0],a[1]=o[1]+c[1],a[2]=o[2]+c[2],a}([],this.min,this.max))}quadrant(e){let n=[e%2==0,e<2],a=zi(this.min),o=zi(this.max);for(let c=0;c=0&&m++;if(m===0)return 0;m!==n.length&&(a=!1)}if(a)return 2;for(let o=0;o<3;o++){let c=Number.MAX_VALUE,m=-Number.MAX_VALUE;for(let g=0;gthis.max[o]-this.min[o])return 0}return 1}}class In{constructor(e=0,n=0,a=0,o=0){if(isNaN(e)||e<0||isNaN(n)||n<0||isNaN(a)||a<0||isNaN(o)||o<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=n,this.left=a,this.right=o}interpolate(e,n,a){return n.top!=null&&e.top!=null&&(this.top=p.y.number(e.top,n.top,a)),n.bottom!=null&&e.bottom!=null&&(this.bottom=p.y.number(e.bottom,n.bottom,a)),n.left!=null&&e.left!=null&&(this.left=p.y.number(e.left,n.left,a)),n.right!=null&&e.right!=null&&(this.right=p.y.number(e.right,n.right,a)),this}getCenter(e,n){let a=p.ac((this.left+e-this.right)/2,0,e),o=p.ac((this.top+n-this.bottom)/2,0,n);return new p.P(a,o)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new In(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}let Za=85.051129;class Pn{constructor(e,n,a,o,c){this.tileSize=512,this._renderWorldCopies=c===void 0||!!c,this._minZoom=e||0,this._maxZoom=n||22,this._minPitch=a??0,this._maxPitch=o??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new p.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new In,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){let e=new Pn(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return e.apply(this),e}apply(e){this.tileSize=e.tileSize,this.latRange=e.latRange,this.lngRange=e.lngRange,this.width=e.width,this.height=e.height,this._center=e._center,this._elevation=e._elevation,this.minElevationForCurrentTile=e.minElevationForCurrentTile,this.zoom=e.zoom,this.angle=e.angle,this._fov=e._fov,this._pitch=e._pitch,this._unmodified=e._unmodified,this._edgeInsets=e._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new p.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(e){let n=-p.b3(e,-180,180)*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=function(){var a=new p.A(4);return p.A!=Float32Array&&(a[1]=0,a[2]=0),a[0]=1,a[3]=1,a}(),function(a,o,c){var m=o[0],g=o[1],y=o[2],b=o[3],T=Math.sin(c),S=Math.cos(c);a[0]=m*S+y*T,a[1]=g*S+b*T,a[2]=m*-T+y*S,a[3]=g*-T+b*S}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(e){let n=p.ac(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(e){e=Math.max(.01,Math.min(60,e)),this._fov!==e&&(this._unmodified=!1,this._fov=e/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(e){let n=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this.tileZoom=Math.max(0,Math.floor(n)),this.scale=this.zoomScale(n),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,n,a){this._unmodified=!1,this._edgeInsets.interpolate(e,n,a),this._constrain(),this._calcMatrices()}coveringZoomLevel(e){let n=(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(e){let n=[new p.b4(0,e)];if(this._renderWorldCopies){let a=this.pointCoordinate(new p.P(0,0)),o=this.pointCoordinate(new p.P(this.width,0)),c=this.pointCoordinate(new p.P(this.width,this.height)),m=this.pointCoordinate(new p.P(0,this.height)),g=Math.floor(Math.min(a.x,o.x,c.x,m.x)),y=Math.floor(Math.max(a.x,o.x,c.x,m.x)),b=1;for(let T=g-b;T<=y+b;T++)T!==0&&n.push(new p.b4(T,e))}return n}coveringTiles(e){var n,a;let o=this.coveringZoomLevel(e),c=o;if(e.minzoom!==void 0&&oe.maxzoom&&(o=e.maxzoom);let m=this.pointCoordinate(this.getCameraPoint()),g=p.Z.fromLngLat(this.center),y=Math.pow(2,o),b=[y*m.x,y*m.y,0],T=[y*g.x,y*g.y,0],S=Tn.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,o),C=e.minzoom||0;!e.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(C=o);let E=e.terrain?2/Math.min(this.tileSize,e.tileSize)*this.tileSize:3,R=B=>({aabb:new Sn([B*y,0,0],[(B+1)*y,y,0]),zoom:0,x:0,y:0,wrap:B,fullyVisible:!1}),V=[],U=[],$=o,Z=e.reparseOverscaled?c:o;if(this._renderWorldCopies)for(let B=1;B<=3;B++)V.push(R(-B)),V.push(R(B));for(V.push(R(0));V.length>0;){let B=V.pop(),X=B.x,K=B.y,ee=B.fullyVisible;if(!ee){let fe=B.aabb.intersects(S);if(fe===0)continue;ee=fe===2}let oe=e.terrain?b:T,he=B.aabb.distanceX(oe),xe=B.aabb.distanceY(oe),Te=Math.max(Math.abs(he),Math.abs(xe));if(B.zoom===$||Te>E+(1<<$-B.zoom)-2&&B.zoom>=C){let fe=$-B.zoom,pe=b[0]-.5-(X<>1),Ve=B.zoom+1,ge=B.aabb.quadrant(fe);if(e.terrain){let be=new p.S(Ve,B.wrap,Ve,pe,Me),Fe=e.terrain.getMinMaxElevation(be),pt=(n=Fe.minElevation)!==null&&n!==void 0?n:this.elevation,Ue=(a=Fe.maxElevation)!==null&&a!==void 0?a:this.elevation;ge=new Sn([ge.min[0],ge.min[1],pt],[ge.max[0],ge.max[1],Ue])}V.push({aabb:ge,zoom:Ve,x:pe,y:Me,wrap:B.wrap,fullyVisible:ee})}}return U.sort((B,X)=>B.distanceSq-X.distanceSq).map(B=>B.tileID)}resize(e,n){this.width=e,this.height=n,this.pixelsToGLUnits=[2/e,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(e){let n=p.ac(e.lat,-85.051129,Za);return new p.P(p.O(e.lng)*this.worldSize,p.Q(n)*this.worldSize)}unproject(e){return new p.Z(e.x/this.worldSize,e.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(e){let n=this.elevation,a=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,o=this.pointLocation(this.centerPoint,e),c=e.getElevationForLngLatZoom(o,this.tileZoom);if(!(this.elevation-c))return;let m=a+n-c,g=Math.cos(this._pitch)*this.cameraToCenterDistance/m/p.b5(1,o.lat),y=this.scaleZoom(g/this.tileSize);this._elevation=c,this._center=o,this.zoom=y}setLocationAtPoint(e,n){let a=this.pointCoordinate(n),o=this.pointCoordinate(this.centerPoint),c=this.locationCoordinate(e),m=new p.Z(c.x-(a.x-o.x),c.y-(a.y-o.y));this.center=this.coordinateLocation(m),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(e,n){return n?this.coordinatePoint(this.locationCoordinate(e),n.getElevationForLngLatZoom(e,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(e))}pointLocation(e,n){return this.coordinateLocation(this.pointCoordinate(e,n))}locationCoordinate(e){return p.Z.fromLngLat(e)}coordinateLocation(e){return e&&e.toLngLat()}pointCoordinate(e,n){if(n){let C=n.pointCoordinate(e);if(C!=null)return C}let a=[e.x,e.y,0,1],o=[e.x,e.y,1,1];p.af(a,a,this.pixelMatrixInverse),p.af(o,o,this.pixelMatrixInverse);let c=a[3],m=o[3],g=a[1]/c,y=o[1]/m,b=a[2]/c,T=o[2]/m,S=b===T?0:(0-b)/(T-b);return new p.Z(p.y.number(a[0]/c,o[0]/m,S)/this.worldSize,p.y.number(g,y,S)/this.worldSize)}coordinatePoint(e,n=0,a=this.pixelMatrix){let o=[e.x*this.worldSize,e.y*this.worldSize,n,1];return p.af(o,o,a),new p.P(o[0]/o[3],o[1]/o[3])}getBounds(){let e=Math.max(0,this.height/2-this.getHorizon());return new ie().extend(this.pointLocation(new p.P(0,e))).extend(this.pointLocation(new p.P(this.width,e))).extend(this.pointLocation(new p.P(this.width,this.height))).extend(this.pointLocation(new p.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new ie([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(e){e?(this.lngRange=[e.getWest(),e.getEast()],this.latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,Za])}calculateTileMatrix(e){let n=e.canonical,a=this.worldSize/this.zoomScale(n.z),o=n.x+Math.pow(2,n.z)*e.wrap,c=p.an(new Float64Array(16));return p.J(c,c,[o*a,n.y*a,0]),p.K(c,c,[a/p.X,a/p.X,1]),c}calculatePosMatrix(e,n=!1){let a=e.key,o=n?this._alignedPosMatrixCache:this._posMatrixCache;if(o[a])return o[a];let c=this.calculateTileMatrix(e);return p.L(c,n?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,c),o[a]=new Float32Array(c),o[a]}calculateFogMatrix(e){let n=e.key,a=this._fogMatrixCache;if(a[n])return a[n];let o=this.calculateTileMatrix(e);return p.L(o,this.fogMatrix,o),a[n]=new Float32Array(o),a[n]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(e,n){n=p.ac(+n,this.minZoom,this.maxZoom);let a={center:new p.N(e.lng,e.lat),zoom:n},o=this.lngRange;if(!this._renderWorldCopies&&o===null){let B=179.9999999999;o=[-B,B]}let c=this.tileSize*this.zoomScale(a.zoom),m=0,g=c,y=0,b=c,T=0,S=0,{x:C,y:E}=this.size;if(this.latRange){let B=this.latRange;m=p.Q(B[1])*c,g=p.Q(B[0])*c,g-mg&&($=g-B)}if(o){let B=(y+b)/2,X=R;this._renderWorldCopies&&(X=p.b3(R,B-c/2,B+c/2));let K=C/2;X-Kb&&(U=b-K)}if(U!==void 0||$!==void 0){let B=new p.P(U??R,$??V);a.center=this.unproject.call({worldSize:c},B).wrap()}return a}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let e=this._unmodified,{center:n,zoom:a}=this.getConstrained(this.center,this.zoom);this.center=n,this.zoom=a,this._unmodified=e,this._constraining=!1}_calcMatrices(){if(!this.height)return;let e=this.centerOffset,n=this.point.x,a=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=p.b5(1,this.center.lat)*this.worldSize;let o=p.an(new Float64Array(16));p.K(o,o,[this.width/2,-this.height/2,1]),p.J(o,o,[1,-1,0]),this.labelPlaneMatrix=o,o=p.an(new Float64Array(16)),p.K(o,o,[1,-1,1]),p.J(o,o,[-1,-1,0]),p.K(o,o,[2/this.width,2/this.height,1]),this.glCoordMatrix=o;let c=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),m=Math.min(this.elevation,this.minElevationForCurrentTile),g=c-m*this._pixelPerMeter/Math.cos(this._pitch),y=m<0?g:c,b=Math.PI/2+this._pitch,T=this._fov*(.5+e.y/this.height),S=Math.sin(T)*y/Math.sin(p.ac(Math.PI-b-T,.01,Math.PI-.01)),C=this.getHorizon(),E=2*Math.atan(C/this.cameraToCenterDistance)*(.5+e.y/(2*C)),R=Math.sin(E)*y/Math.sin(p.ac(Math.PI-b-E,.01,Math.PI-.01)),V=Math.min(S,R);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*V+y),this.nearZ=this.height/50,o=new Float64Array(16),p.b6(o,this._fov,this.width/this.height,this.nearZ,this.farZ),o[8]=2*-e.x/this.width,o[9]=2*e.y/this.height,this.projectionMatrix=p.ae(o),p.K(o,o,[1,-1,1]),p.J(o,o,[0,0,-this.cameraToCenterDistance]),p.b7(o,o,this._pitch),p.ad(o,o,this.angle),p.J(o,o,[-n,-a,0]),this.mercatorMatrix=p.K([],o,[this.worldSize,this.worldSize,this.worldSize]),p.K(o,o,[1,1,this._pixelPerMeter]),this.pixelMatrix=p.L(new Float64Array(16),this.labelPlaneMatrix,o),p.J(o,o,[0,0,-this.elevation]),this.modelViewProjectionMatrix=o,this.invModelViewProjectionMatrix=p.as([],o),this.fogMatrix=new Float64Array(16),p.b6(this.fogMatrix,this._fov,this.width/this.height,c,this.farZ),this.fogMatrix[8]=2*-e.x/this.width,this.fogMatrix[9]=2*e.y/this.height,p.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),p.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),p.b7(this.fogMatrix,this.fogMatrix,this._pitch),p.ad(this.fogMatrix,this.fogMatrix,this.angle),p.J(this.fogMatrix,this.fogMatrix,[-n,-a,0]),p.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),p.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=p.L(new Float64Array(16),this.labelPlaneMatrix,o);let U=this.width%2/2,$=this.height%2/2,Z=Math.cos(this.angle),B=Math.sin(this.angle),X=n-Math.round(n)+Z*U+B*$,K=a-Math.round(a)+Z*$+B*U,ee=new Float64Array(o);if(p.J(ee,ee,[X>.5?X-1:X,K>.5?K-1:K,0]),this.alignedModelViewProjectionMatrix=ee,o=p.as(new Float64Array(16),this.pixelMatrix),!o)throw new Error("failed to invert matrix");this.pixelMatrixInverse=o,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;let e=this.pointCoordinate(new p.P(0,0)),n=[e.x*this.worldSize,e.y*this.worldSize,0,1];return p.af(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){let e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new p.P(0,e))}getCameraQueryGeometry(e){let n=this.getCameraPoint();if(e.length===1)return[e[0],n];{let a=n.x,o=n.y,c=n.x,m=n.y;for(let g of e)a=Math.min(a,g.x),o=Math.min(o,g.y),c=Math.max(c,g.x),m=Math.max(m,g.y);return[new p.P(a,o),new p.P(c,o),new p.P(c,m),new p.P(a,m),new p.P(a,o)]}}lngLatToCameraDepth(e,n){let a=this.locationCoordinate(e),o=[a.x*this.worldSize,a.y*this.worldSize,n,1];return p.af(o,o,this.modelViewProjectionMatrix),o[2]/o[3]}}function cs(h,e){let n,a=!1,o=null,c=null,m=()=>{o=null,a&&(h.apply(c,n),o=setTimeout(m,e),a=!1)};return(...g)=>(a=!0,c=this,n=g,o||m(),o)}class Gs{constructor(e){this._getCurrentHash=()=>{let n=window.location.hash.replace("#","");if(this._hashName){let a;return n.split("&").map(o=>o.split("=")).forEach(o=>{o[0]===this._hashName&&(a=o)}),(a&&a[1]||"").split("/")}return n.split("/")},this._onHashChange=()=>{let n=this._getCurrentHash();if(n.length>=3&&!n.some(a=>isNaN(a))){let a=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(n[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+n[2],+n[1]],zoom:+n[0],bearing:a,pitch:+(n[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{let n=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,n)},this._removeHash=()=>{let n=this._getCurrentHash();if(n.length===0)return;let a=n.join("/"),o=a;o.split("&").length>0&&(o=o.split("&")[0]),this._hashName&&(o=`${this._hashName}=${a}`);let c=window.location.hash.replace(o,"");c.startsWith("#&")?c=c.slice(0,1)+c.slice(2):c==="#"&&(c="");let m=window.location.href.replace(/(#.+)?$/,c);m=m.replace("&&","&"),window.history.replaceState(window.history.state,null,m)},this._updateHash=cs(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,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(e){let n=this._map.getCenter(),a=Math.round(100*this._map.getZoom())/100,o=Math.ceil((a*Math.LN2+Math.log(512/360/.5))/Math.LN10),c=Math.pow(10,o),m=Math.round(n.lng*c)/c,g=Math.round(n.lat*c)/c,y=this._map.getBearing(),b=this._map.getPitch(),T="";if(T+=e?`/${m}/${g}/${a}`:`${a}/${g}/${m}`,(y||b)&&(T+="/"+Math.round(10*y)/10),b&&(T+=`/${Math.round(b)}`),this._hashName){let S=this._hashName,C=!1,E=window.location.hash.slice(1).split("&").map(R=>{let V=R.split("=")[0];return V===S?(C=!0,`${V}=${T}`):R}).filter(R=>R);return C||E.push(`${S}=${T}`),`#${E.join("&")}`}return`#${T}`}}let Hs={linearity:.3,easing:p.b8(0,0,.3,1)},Ga=p.e({deceleration:2500,maxSpeed:1400},Hs),Ql=p.e({deceleration:20,maxSpeed:1400},Hs),tl=p.e({deceleration:1e3,maxSpeed:360},Hs),Xs=p.e({deceleration:1e3,maxSpeed:90},Hs);class Ha{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:me.now(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,n=me.now();for(;e.length>0&&n-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let n={zoom:0,bearing:0,pitch:0,pan:new p.P(0,0),pinchAround:void 0,around:void 0};for(let{settings:c}of this._inertiaBuffer)n.zoom+=c.zoomDelta||0,n.bearing+=c.bearingDelta||0,n.pitch+=c.pitchDelta||0,c.panDelta&&n.pan._add(c.panDelta),c.around&&(n.around=c.around),c.pinchAround&&(n.pinchAround=c.pinchAround);let a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,o={};if(n.pan.mag()){let c=us(n.pan.mag(),a,p.e({},Ga,e||{}));o.offset=n.pan.mult(c.amount/n.pan.mag()),o.center=this._map.transform.center,hs(o,c)}if(n.zoom){let c=us(n.zoom,a,Ql);o.zoom=this._map.transform.zoom+c.amount,hs(o,c)}if(n.bearing){let c=us(n.bearing,a,tl);o.bearing=this._map.transform.bearing+p.ac(c.amount,-179,179),hs(o,c)}if(n.pitch){let c=us(n.pitch,a,Xs);o.pitch=this._map.transform.pitch+c.amount,hs(o,c)}if(o.zoom||o.bearing){let c=n.pinchAround===void 0?n.around:n.pinchAround;o.around=c?this._map.unproject(c):this._map.getCenter()}return this.clear(),p.e(o,{noMoveStart:!0})}}function hs(h,e){(!h.duration||h.durationn.unproject(y)),g=c.reduce((y,b,T,S)=>y.add(b.div(S.length)),new p.P(0,0));super(e,{points:c,point:g,lngLats:m,lngLat:n.unproject(g),originalEvent:a}),this._defaultPrevented=!1}}class il extends p.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,n,a){super(e,{originalEvent:a}),this._defaultPrevented=!1}}class rl{constructor(e,n){this._map=e,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new il(e.type,this._map,e))}mousedown(e,n){return this._mousedownPos=n,this._firePreventable(new Ot(e.type,this._map,e))}mouseup(e){this._map.fire(new Ot(e.type,this._map,e))}click(e,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Ot(e.type,this._map,e))}dblclick(e){return this._firePreventable(new Ot(e.type,this._map,e))}mouseover(e){this._map.fire(new Ot(e.type,this._map,e))}mouseout(e){this._map.fire(new Ot(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Jr(e.type,this._map,e))}touchmove(e){this._map.fire(new Jr(e.type,this._map,e))}touchend(e){this._map.fire(new Jr(e.type,this._map,e))}touchcancel(e){this._map.fire(new Jr(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class wt{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new Ot(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ot("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new Ot(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Oi{constructor(e){this._map=e}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(e){return this.transform.pointLocation(p.P.convert(e),this._map.terrain)}}class mi{constructor(e,n){this._map=e,this._tr=new Oi(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=n.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,n){this.isEnabled()&&e.shiftKey&&e.button===0&&(se.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(e,n){if(!this._active)return;let a=n;if(this._lastPos.equals(a)||!this._box&&a.dist(this._startPos)c.fitScreenCoordinates(a,o,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(se.remove(this._box),this._box=null),se.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,n){return this._map.fire(new p.k(e,{originalEvent:n}))}}function ds(h,e){if(h.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${h.length}, points ${e.length}`);let n={};for(let a=0;athis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),a.length===this.numTouches&&(this.centroid=function(o){let c=new p.P(0,0);for(let m of o)c._add(m);return c.div(o.length)}(n),this.touches=ds(a,n)))}touchmove(e,n,a){if(this.aborted||!this.centroid)return;let o=ds(a,n);for(let c in this.touches){let m=o[c];(!m||m.dist(this.touches[c])>30)&&(this.aborted=!0)}}touchend(e,n,a){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),a.length===0){let o=!this.aborted&&this.centroid;if(this.reset(),o)return o}}}class Ws{constructor(e){this.singleTap=new Xa(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,n,a){this.singleTap.touchstart(e,n,a)}touchmove(e,n,a){this.singleTap.touchmove(e,n,a)}touchend(e,n,a){let o=this.singleTap.touchend(e,n,a);if(o){let c=e.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(o)<30;if(c&&m||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=o,this.count===this.numTaps)return this.reset(),o}}}class An{constructor(e){this._tr=new Oi(e),this._zoomIn=new Ws({numTouches:1,numTaps:2}),this._zoomOut=new Ws({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,n,a){this._zoomIn.touchstart(e,n,a),this._zoomOut.touchstart(e,n,a)}touchmove(e,n,a){this._zoomIn.touchmove(e,n,a),this._zoomOut.touchmove(e,n,a)}touchend(e,n,a){let o=this._zoomIn.touchend(e,n,a),c=this._zoomOut.touchend(e,n,a),m=this._tr;return o?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:g=>g.easeTo({duration:300,zoom:m.zoom+1,around:m.unproject(o)},{originalEvent:e})}):c?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:g=>g.easeTo({duration:300,zoom:m.zoom-1,around:m.unproject(c)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class _r{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){let n=this._moveFunction(...e);if(n.bearingDelta||n.pitchDelta||n.around||n.panDelta)return this._active=!0,n}dragStart(e,n){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=n.length?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,n){if(!this.isEnabled())return;let a=this._lastPoint;if(!a)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);let o=n.length?n[0]:n;return!this._moved&&o.dist(a){h.mousedown=h.dragStart,h.mousemoveWindow=h.dragMove,h.mouseup=h.dragEnd,h.contextmenu=e=>{e.preventDefault()}},Ja=({enable:h,clickTolerance:e,bearingDegreesPerPixelMoved:n=.8})=>{let a=new Ks({checkCorrectEvent:o=>se.mouseButton(o)===0&&o.ctrlKey||se.mouseButton(o)===2});return new _r({clickTolerance:e,move:(o,c)=>({bearingDelta:(c.x-o.x)*n}),moveStateManager:a,enable:h,assignEvents:Js})},Ya=({enable:h,clickTolerance:e,pitchDegreesPerPixelMoved:n=-.5})=>{let a=new Ks({checkCorrectEvent:o=>se.mouseButton(o)===0&&o.ctrlKey||se.mouseButton(o)===2});return new _r({clickTolerance:e,move:(o,c)=>({pitchDelta:(c.y-o.y)*n}),moveStateManager:a,enable:h,assignEvents:Js})};class Yr{constructor(e,n){this._clickTolerance=e.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new p.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,n,a){return this._calculateTransform(e,n,a)}touchmove(e,n,a){if(this._active){if(!this._shouldBePrevented(a.length))return e.preventDefault(),this._calculateTransform(e,n,a);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,n,a){this._calculateTransform(e,n,a),this._active&&this._shouldBePrevented(a.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,n,a){a.length>0&&(this._active=!0);let o=ds(a,n),c=new p.P(0,0),m=new p.P(0,0),g=0;for(let b in o){let T=o[b],S=this._touches[b];S&&(c._add(T),m._add(T.sub(S)),g++,o[b]=T)}if(this._touches=o,this._shouldBePrevented(g)||!m.mag())return;let y=m.div(g);return this._sum._add(y),this._sum.mag()Math.abs(h.x)}class Mn extends Ys{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,n,a){super.touchstart(e,n,a),this._currentTouchCount=a.length}_start(e){this._lastPoints=e,Qs(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,n,a){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let o=e[0].sub(this._lastPoints[0]),c=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(o,c,a.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(o.y+c.y)/2*-.5}):void 0}gestureBeginsVertically(e,n,a){if(this._valid!==void 0)return this._valid;let o=e.mag()>=2,c=n.mag()>=2;if(!o&&!c)return;if(!o||!c)return this._firstMove===void 0&&(this._firstMove=a),a-this._firstMove<100&&void 0;let m=e.y>0==n.y>0;return Qs(e)&&Qs(n)&&m}}let nl={panStep:100,bearingStep:15,pitchStep:10};class Si{constructor(e){this._tr=new Oi(e);let n=nl;this._panStep=n.panStep,this._bearingStep=n.bearingStep,this._pitchStep=n.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let n=0,a=0,o=0,c=0,m=0;switch(e.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:e.shiftKey?a=-1:(e.preventDefault(),c=-1);break;case 39:e.shiftKey?a=1:(e.preventDefault(),c=1);break;case 38:e.shiftKey?o=1:(e.preventDefault(),m=-1);break;case 40:e.shiftKey?o=-1:(e.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(a=0,o=0),{cameraAnimation:g=>{let y=this._tr;g.easeTo({duration:300,easeId:"keyboardHandler",easing:nr,zoom:n?Math.round(y.zoom)+n*(e.shiftKey?2:1):y.zoom,bearing:y.bearing+a*this._bearingStep,pitch:y.pitch+o*this._pitchStep,offset:[-c*this._panStep,-m*this._panStep],center:y.center},{originalEvent:e})}}}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 nr(h){return h*(2-h)}let ro=4.000244140625;class Vi{constructor(e,n){this._onTimeout=a=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(a)},this._map=e,this._tr=new Oi(e),this._triggerRenderFrame=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let n=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,a=me.now(),o=a-(this._lastWheelEventTime||0);this._lastWheelEventTime=a,n!==0&&n%ro==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":o>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(o*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),e.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=e,this._delta-=n,this._active||this._start(e)),e.preventDefault()}_start(e){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);let n=se.mousePos(this._map.getCanvas(),e),a=this._tr;this._around=n.y>a.transform.height/2-a.transform.getHorizon()?p.N.convert(this._aroundCenter?a.center:a.unproject(n)):p.N.convert(a.center),this._aroundPoint=a.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let e=this._tr.transform;if(this._delta!==0){let y=this._type==="wheel"&&Math.abs(this._delta)>ro?this._wheelZoomRate:this._defaultZoomRate,b=2/(1+Math.exp(-Math.abs(this._delta*y)));this._delta<0&&b!==0&&(b=1/b);let T=typeof this._targetZoom=="number"?e.zoomScale(this._targetZoom):e.scale;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(T*b))),this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let n=typeof this._targetZoom=="number"?this._targetZoom:e.zoom,a=this._startZoom,o=this._easing,c,m=!1,g=me.now()-this._lastWheelEventTime;if(this._type==="wheel"&&a&&o&&g){let y=Math.min(g/200,1),b=o(y);c=p.y.number(a,n,b),y<1?this._frameId||(this._frameId=!0):m=!0}else c=n,m=!0;return this._active=!0,m&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!m,zoomDelta:c-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let n=p.b9;if(this._prevEase){let a=this._prevEase,o=(me.now()-a.start)/a.duration,c=a.easing(o+.01)-a.easing(o),m=.27/Math.sqrt(c*c+1e-4)*.01,g=Math.sqrt(.0729-m*m);n=p.b8(m,g,.25,1)}return this._prevEase={start:me.now(),duration:e,easing:n},n}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Qr{constructor(e,n){this._clickZoom=e,this._tapZoom=n}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 ec{constructor(e){this._tr=new Oi(e),this.reset()}reset(){this._active=!1}dblclick(e,n){return e.preventDefault(),{cameraAnimation:a=>{a.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(n)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class tc{constructor(){this._tap=new Ws({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(e,n,a){if(!this._swipePoint)if(this._tapTime){let o=n[0],c=e.timeStamp-this._tapTime<500,m=this._tapPoint.dist(o)<30;c&&m?a.length>0&&(this._swipePoint=o,this._swipeTouch=a[0].identifier):this.reset()}else this._tap.touchstart(e,n,a)}touchmove(e,n,a){if(this._tapTime){if(this._swipePoint){if(a[0].identifier!==this._swipeTouch)return;let o=n[0],c=o.y-this._swipePoint.y;return this._swipePoint=o,e.preventDefault(),this._active=!0,{zoomDelta:c/128}}}else this._tap.touchmove(e,n,a)}touchend(e,n,a){if(this._tapTime)this._swipePoint&&a.length===0&&this.reset();else{let o=this._tap.touchend(e,n,a);o&&(this._tapTime=e.timeStamp,this._tapPoint=o)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class sl{constructor(e,n,a){this._el=e,this._mousePan=n,this._touchPan=a}enable(e){this._inertiaOptions=e||{},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 al{constructor(e,n,a){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=n,this._mousePitch=a}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class no{constructor(e,n,a,o){this._el=e,this._touchZoom=n,this._touchRotate=a,this._tapDragZoom=o,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),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 Cn{constructor(e,n){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=e,this._options=n,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=se.create("div","maplibregl-cooperative-gesture-screen",e);let n=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(n=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let a=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),o=document.createElement("div");o.className="maplibregl-desktop-message",o.textContent=n,this._container.appendChild(o);let c=document.createElement("div");c.className="maplibregl-mobile-message",c.textContent=a,this._container.appendChild(c),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(se.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(e){return e[this._bypassKey]}notifyGestureBlocked(e,n){this._enabled&&(this._map.fire(new p.k("cooperativegestureprevented",{gestureType:e,originalEvent:n})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}let Ii=h=>h.zoom||h.drag||h.pitch||h.rotate;class Ie extends p.k{}function ea(h){return h.panDelta&&h.panDelta.mag()||h.zoomDelta||h.bearingDelta||h.pitchDelta}class so{constructor(e,n){this.handleWindowEvent=o=>{this.handleEvent(o,`${o.type}Window`)},this.handleEvent=(o,c)=>{if(o.type==="blur")return void this.stop(!0);this._updatingCamera=!0;let m=o.type==="renderFrame"?void 0:o,g={needsRenderFrame:!1},y={},b={},T=o.touches,S=T?this._getMapTouches(T):void 0,C=S?se.touchPos(this._map.getCanvas(),S):se.mousePos(this._map.getCanvas(),o);for(let{handlerName:V,handler:U,allowed:$}of this._handlers){if(!U.isEnabled())continue;let Z;this._blockedByActive(b,$,V)?U.reset():U[c||o.type]&&(Z=U[c||o.type](o,C,S),this.mergeHandlerResult(g,y,Z,V,m),Z&&Z.needsRenderFrame&&this._triggerRenderFrame()),(Z||U.isActive())&&(b[V]=U)}let E={};for(let V in this._previousActiveHandlers)b[V]||(E[V]=m);this._previousActiveHandlers=b,(Object.keys(E).length||ea(g))&&(this._changes.push([g,y,E]),this._triggerRenderFrame()),(Object.keys(b).length||ea(g))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:R}=g;R&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],R(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Ha(e),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n);let a=this._el;this._listeners=[[a,"touchstart",{passive:!0}],[a,"touchmove",{passive:!1}],[a,"touchend",void 0],[a,"touchcancel",void 0],[a,"mousedown",void 0],[a,"mousemove",void 0],[a,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[a,"mouseover",void 0],[a,"mouseout",void 0],[a,"dblclick",void 0],[a,"click",void 0],[a,"keydown",{capture:!1}],[a,"keyup",void 0],[a,"wheel",{passive:!1}],[a,"contextmenu",void 0],[window,"blur",void 0]];for(let[o,c,m]of this._listeners)se.addEventListener(o,c,o===document?this.handleWindowEvent:this.handleEvent,m)}destroy(){for(let[e,n,a]of this._listeners)se.removeEventListener(e,n,e===document?this.handleWindowEvent:this.handleEvent,a)}_addDefaultHandlers(e){let n=this._map,a=n.getCanvasContainer();this._add("mapEvent",new rl(n,e));let o=n.boxZoom=new mi(n,e);this._add("boxZoom",o),e.interactive&&e.boxZoom&&o.enable();let c=n.cooperativeGestures=new Cn(n,e.cooperativeGestures);this._add("cooperativeGestures",c),e.cooperativeGestures&&c.enable();let m=new An(n),g=new ec(n);n.doubleClickZoom=new Qr(g,m),this._add("tapZoom",m),this._add("clickZoom",g),e.interactive&&e.doubleClickZoom&&n.doubleClickZoom.enable();let y=new tc;this._add("tapDragZoom",y);let b=n.touchPitch=new Mn(n);this._add("touchPitch",b),e.interactive&&e.touchPitch&&n.touchPitch.enable(e.touchPitch);let T=Ja(e),S=Ya(e);n.dragRotate=new al(e,T,S),this._add("mouseRotate",T,["mousePitch"]),this._add("mousePitch",S,["mouseRotate"]),e.interactive&&e.dragRotate&&n.dragRotate.enable();let C=(({enable:Z,clickTolerance:B})=>{let X=new Ks({checkCorrectEvent:K=>se.mouseButton(K)===0&&!K.ctrlKey});return new _r({clickTolerance:B,move:(K,ee)=>({around:ee,panDelta:ee.sub(K)}),activateOnStart:!0,moveStateManager:X,enable:Z,assignEvents:Js})})(e),E=new Yr(e,n);n.dragPan=new sl(a,C,E),this._add("mousePan",C),this._add("touchPan",E,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&n.dragPan.enable(e.dragPan);let R=new io,V=new eo;n.touchZoomRotate=new no(a,V,R,y),this._add("touchRotate",R,["touchPan","touchZoom"]),this._add("touchZoom",V,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&n.touchZoomRotate.enable(e.touchZoomRotate);let U=n.scrollZoom=new Vi(n,()=>this._triggerRenderFrame());this._add("scrollZoom",U,["mousePan"]),e.interactive&&e.scrollZoom&&n.scrollZoom.enable(e.scrollZoom);let $=n.keyboard=new Si(n);this._add("keyboard",$),e.interactive&&e.keyboard&&n.keyboard.enable(),this._add("blockableMapEvent",new wt(n))}_add(e,n,a){this._handlers.push({handlerName:e,handler:n,allowed:a}),this._handlersById[e]=n}stop(e){if(!this._updatingCamera){for(let{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Ii(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,n,a){for(let o in e)if(o!==a&&(!n||n.indexOf(o)<0))return!0;return!1}_getMapTouches(e){let n=[];for(let a of e)this._el.contains(a.target)&&n.push(a);return n}mergeHandlerResult(e,n,a,o,c){if(!a)return;p.e(e,a);let m={handlerName:o,originalEvent:a.originalEvent||c};a.zoomDelta!==void 0&&(n.zoom=m),a.panDelta!==void 0&&(n.drag=m),a.pitchDelta!==void 0&&(n.pitch=m),a.bearingDelta!==void 0&&(n.rotate=m)}_applyChanges(){let e={},n={},a={};for(let[o,c,m]of this._changes)o.panDelta&&(e.panDelta=(e.panDelta||new p.P(0,0))._add(o.panDelta)),o.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+o.zoomDelta),o.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+o.bearingDelta),o.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+o.pitchDelta),o.around!==void 0&&(e.around=o.around),o.pinchAround!==void 0&&(e.pinchAround=o.pinchAround),o.noInertia&&(e.noInertia=o.noInertia),p.e(n,c),p.e(a,m);this._updateMapTransform(e,n,a),this._changes=[]}_updateMapTransform(e,n,a){let o=this._map,c=o._getTransformForUpdate(),m=o.terrain;if(!(ea(e)||m&&this._terrainMovement))return this._fireEvents(n,a,!0);let{panDelta:g,zoomDelta:y,bearingDelta:b,pitchDelta:T,around:S,pinchAround:C}=e;C!==void 0&&(S=C),o._stop(!0),S=S||o.transform.centerPoint;let E=c.pointLocation(g?S.sub(g):S);b&&(c.bearing+=b),T&&(c.pitch+=T),y&&(c.zoom+=y),m?this._terrainMovement||!n.drag&&!n.zoom?n.drag&&this._terrainMovement?c.center=c.pointLocation(c.centerPoint.sub(g)):c.setLocationAtPoint(E,S):(this._terrainMovement=!0,this._map._elevationFreeze=!0,c.setLocationAtPoint(E,S)):c.setLocationAtPoint(E,S),o._applyUpdatedTransform(c),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(n,a,!0)}_fireEvents(e,n,a){let o=Ii(this._eventsInProgress),c=Ii(e),m={};for(let S in e){let{originalEvent:C}=e[S];this._eventsInProgress[S]||(m[`${S}start`]=C),this._eventsInProgress[S]=e[S]}!o&&c&&this._fireEvent("movestart",c.originalEvent);for(let S in m)this._fireEvent(S,m[S]);c&&this._fireEvent("move",c.originalEvent);for(let S in e){let{originalEvent:C}=e[S];this._fireEvent(S,C)}let g={},y;for(let S in this._eventsInProgress){let{handlerName:C,originalEvent:E}=this._eventsInProgress[S];this._handlersById[C].isActive()||(delete this._eventsInProgress[S],y=n[C]||E,g[`${S}end`]=y)}for(let S in g)this._fireEvent(S,g[S]);let b=Ii(this._eventsInProgress),T=(o||c)&&!b;if(T&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;let S=this._map._getTransformForUpdate();S.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(S)}if(a&&T){this._updatingCamera=!0;let S=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),C=E=>E!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new Ie("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class ol extends p.E{constructor(e,n){super(),this._renderFrameCallback=()=>{let a=Math.min((me.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(a)),a<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=n.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new p.N(this.transform.center.lng,this.transform.center.lat)}setCenter(e,n){return this.jumpTo({center:e},n)}panBy(e,n,a){return e=p.P.convert(e).mult(-1),this.panTo(this.transform.center,p.e({offset:e},n),a)}panTo(e,n,a){return this.easeTo(p.e({center:e},n),a)}getZoom(){return this.transform.zoom}setZoom(e,n){return this.jumpTo({zoom:e},n),this}zoomTo(e,n,a){return this.easeTo(p.e({zoom:e},n),a)}zoomIn(e,n){return this.zoomTo(this.getZoom()+1,e,n),this}zoomOut(e,n){return this.zoomTo(this.getZoom()-1,e,n),this}getBearing(){return this.transform.bearing}setBearing(e,n){return this.jumpTo({bearing:e},n),this}getPadding(){return this.transform.padding}setPadding(e,n){return this.jumpTo({padding:e},n),this}rotateTo(e,n,a){return this.easeTo(p.e({bearing:e},n),a)}resetNorth(e,n){return this.rotateTo(0,p.e({duration:1e3},e),n),this}resetNorthPitch(e,n){return this.easeTo(p.e({bearing:0,pitch:0,duration:1e3},e),n),this}snapToNorth(e,n){return Math.abs(this.getBearing()){if(this._zooming&&(o.zoom=p.y.number(c,U,oe)),this._rotating&&(o.bearing=p.y.number(m,b,oe)),this._pitching&&(o.pitch=p.y.number(g,T,oe)),this._padding&&(o.interpolatePadding(y,S,oe),E=o.centerPoint.add(C)),this.terrain&&!e.freezeElevation&&this._updateElevation(oe),X)o.setLocationAtPoint(X,K);else{let he=o.zoomScale(o.zoom-c),xe=U>c?Math.min(2,B):Math.max(.5,B),Te=Math.pow(xe,1-oe),fe=o.unproject($.add(Z.mult(oe*Te)).mult(he));o.setLocationAtPoint(o.renderWorldCopies?fe.wrap():fe,E)}this._applyUpdatedTransform(o),this._fireMoveEvents(n)},oe=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(n,oe)},e),this}_prepareEase(e,n,a={}){this._moving=!0,n||a.moving||this.fire(new p.k("movestart",e)),this._zooming&&!a.zooming&&this.fire(new p.k("zoomstart",e)),this._rotating&&!a.rotating&&this.fire(new p.k("rotatestart",e)),this._pitching&&!a.pitching&&this.fire(new p.k("pitchstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);let n=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&n!==this._elevationTarget){let a=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(a-(n-(a*e+this._elevationStart))/(1-e)),this._elevationTarget=n}this.transform.elevation=p.y.number(this._elevationStart,this._elevationTarget,e)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){let n=e.getCameraPosition(),a=this.terrain.getElevationForLngLatZoom(n.lngLat,e.zoom);if(n.altitudethis._elevateCameraIfInsideTerrain(o)),this.transformCameraUpdate&&n.push(o=>this.transformCameraUpdate(o)),!n.length)return;let a=e.clone();for(let o of n){let c=a.clone(),{center:m,zoom:g,pitch:y,bearing:b,elevation:T}=o(c);m&&(c.center=m),g!==void 0&&(c.zoom=g),y!==void 0&&(c.pitch=y),b!==void 0&&(c.bearing=b),T!==void 0&&(c.elevation=T),a.apply(c)}this.transform.apply(a)}_fireMoveEvents(e){this.fire(new p.k("move",e)),this._zooming&&this.fire(new p.k("zoom",e)),this._rotating&&this.fire(new p.k("rotate",e)),this._pitching&&this.fire(new p.k("pitch",e))}_afterEase(e,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;let a=this._zooming,o=this._rotating,c=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,a&&this.fire(new p.k("zoomend",e)),o&&this.fire(new p.k("rotateend",e)),c&&this.fire(new p.k("pitchend",e)),this.fire(new p.k("moveend",e))}flyTo(e,n){var a;if(!e.essential&&me.prefersReducedMotion){let be=p.M(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(be,n)}this.stop(),e=p.e({offset:[0,0],speed:1.2,curve:1.42,easing:p.b9},e);let o=this._getTransformForUpdate(),c=o.zoom,m=o.bearing,g=o.pitch,y=o.padding,b="bearing"in e?this._normalizeBearing(e.bearing,m):m,T="pitch"in e?+e.pitch:g,S="padding"in e?e.padding:o.padding,C=p.P.convert(e.offset),E=o.centerPoint.add(C),R=o.pointLocation(E),{center:V,zoom:U}=o.getConstrained(p.N.convert(e.center||R),(a=e.zoom)!==null&&a!==void 0?a:c);this._normalizeCenter(V,o);let $=o.zoomScale(U-c),Z=o.project(R),B=o.project(V).sub(Z),X=e.curve,K=Math.max(o.width,o.height),ee=K/$,oe=B.mag();if("minZoom"in e){let be=p.ac(Math.min(e.minZoom,c,U),o.minZoom,o.maxZoom),Fe=K/o.zoomScale(be-c);X=Math.sqrt(Fe/oe*2)}let he=X*X;function xe(be){let Fe=(ee*ee-K*K+(be?-1:1)*he*he*oe*oe)/(2*(be?ee:K)*he*oe);return Math.log(Math.sqrt(Fe*Fe+1)-Fe)}function Te(be){return(Math.exp(be)-Math.exp(-be))/2}function fe(be){return(Math.exp(be)+Math.exp(-be))/2}let pe=xe(!1),Me=function(be){return fe(pe)/fe(pe+X*be)},Ve=function(be){return K*((fe(pe)*(Te(Fe=pe+X*be)/fe(Fe))-Te(pe))/he)/oe;var Fe},ge=(xe(!0)-pe)/X;if(Math.abs(oe)<1e-6||!isFinite(ge)){if(Math.abs(K-ee)<1e-6)return this.easeTo(e,n);let be=ee0,Me=Fe=>Math.exp(be*X*Fe)}return e.duration="duration"in e?+e.duration:1e3*ge/("screenSpeed"in e?+e.screenSpeed/X:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=m!==b,this._pitching=T!==g,this._padding=!o.isPaddingEqual(S),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(V),this._ease(be=>{let Fe=be*ge,pt=1/Me(Fe);o.zoom=be===1?U:c+o.scaleZoom(pt),this._rotating&&(o.bearing=p.y.number(m,b,be)),this._pitching&&(o.pitch=p.y.number(g,T,be)),this._padding&&(o.interpolatePadding(y,S,be),E=o.centerPoint.add(C)),this.terrain&&!e.freezeElevation&&this._updateElevation(be);let Ue=be===1?V:o.unproject(Z.add(B.mult(Ve(Fe))).mult(pt));o.setLocationAtPoint(o.renderWorldCopies?Ue.wrap():Ue,E),this._applyUpdatedTransform(o),this._fireMoveEvents(n)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(n)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,n){var a;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let o=this._onEaseEnd;delete this._onEaseEnd,o.call(this,n)}return e||(a=this.handlers)===null||a===void 0||a.stop(!1),this}_ease(e,n,a){a.animate===!1||a.duration===0?(e(1),n()):(this._easeStart=me.now(),this._easeOptions=a,this._onEaseFrame=e,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,n){e=p.b3(e,-180,180);let a=Math.abs(e-n);return Math.abs(e-360-n)180?-360:a<-180?360:0}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(p.N.convert(e),this.transform.tileZoom)-this.transform.elevation:null}}let kn={compact:!0,customAttribution:'MapLibre'};class zn{constructor(e=kn){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=n=>{!n||n.sourceDataType!=="metadata"&&n.sourceDataType!=="visibility"&&n.dataType!=="style"&&n.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=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=se.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=se.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=se.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(){se.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(e,n){let a=this._map._getUIString(`AttributionControl.${n}`);e.title=a,e.setAttribute("aria-label",a)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(o=>typeof o!="string"?"":o)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let o=this._map.style.stylesheet;this.styleOwner=o.owner,this.styleId=o.id}let n=this._map.style.sourceCaches;for(let o in n){let c=n[o];if(c.used||c.usedForTerrain){let m=c.getSource();m.attribution&&e.indexOf(m.attribution)<0&&e.push(m.attribution)}}e=e.filter(o=>String(o).trim()),e.sort((o,c)=>o.length-c.length),e=e.filter((o,c)=>{for(let m=c+1;m=0)return!1;return!0});let a=e.join(" | ");a!==this._attribHTML&&(this._attribHTML=a,e.length?(this._innerContainer.innerHTML=a,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class ao{constructor(e={}){this._updateCompact=()=>{let n=this._container.children;if(n.length){let a=n[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&a.classList.add("maplibregl-compact"):a.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=se.create("div","maplibregl-ctrl");let n=se.create("a","maplibregl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){se.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Xe{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let n=++this._id;return this._queue.push({callback:e,id:n,cancelled:!1}),n}remove(e){let n=this._currentlyRunning,a=n?this._queue.concat(n):this._queue;for(let o of a)if(o.id===e)return void(o.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");let n=this._currentlyRunning=this._queue;this._queue=[];for(let a of n)if(!a.cancelled&&(a.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var oo=p.Y([{name:"a_pos3d",type:"Int16",components:3}]);class ic extends p.E{constructor(e){super(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,e.usedForTerrain=!0,e.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,n){this.sourceCache.update(e,n),this._renderableTilesKeys=[];let a={};for(let o of e.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))a[o.key]=!0,this._renderableTilesKeys.push(o.key),this._tiles[o.key]||(o.posMatrix=new Float64Array(16),p.aP(o.posMatrix,0,p.X,0,p.X,0,1),this._tiles[o.key]=new Pr(o,this.tileSize));for(let o in this._tiles)a[o]||delete this._tiles[o]}freeRtt(e){for(let n in this._tiles){let a=this._tiles[n];(!e||a.tileID.equals(e)||a.tileID.isChildOf(e)||e.isChildOf(a.tileID))&&(a.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e){let n={};for(let a of this._renderableTilesKeys){let o=this._tiles[a].tileID;if(o.canonical.equals(e.canonical)){let c=e.clone();c.posMatrix=new Float64Array(16),p.aP(c.posMatrix,0,p.X,0,p.X,0,1),n[a]=c}else if(o.canonical.isChildOf(e.canonical)){let c=e.clone();c.posMatrix=new Float64Array(16);let m=o.canonical.z-e.canonical.z,g=o.canonical.x-(o.canonical.x>>m<>m<>m;p.aP(c.posMatrix,0,b,0,b,0,1),p.J(c.posMatrix,c.posMatrix,[-g*b,-y*b,0]),n[a]=c}else if(e.canonical.isChildOf(o.canonical)){let c=e.clone();c.posMatrix=new Float64Array(16);let m=e.canonical.z-o.canonical.z,g=e.canonical.x-(e.canonical.x>>m<>m<>m;p.aP(c.posMatrix,0,p.X,0,p.X,0,1),p.J(c.posMatrix,c.posMatrix,[g*b,y*b,0]),p.K(c.posMatrix,c.posMatrix,[1/2**m,1/2**m,0]),n[a]=c}}return n}getSourceTile(e,n){let a=this.sourceCache._source,o=e.overscaledZ-this.deltaZoom;if(o>a.maxzoom&&(o=a.maxzoom),o=a.minzoom&&(!c||!c.dem);)c=this.sourceCache.getTileByID(e.scaledTo(o--).key);return c}tilesAfterTime(e=Date.now()){return Object.values(this._tiles).filter(n=>n.timeAdded>=e)}}class lo{constructor(e,n,a){this.painter=e,this.sourceCache=new ic(n),this.options=a,this.exaggeration=typeof a.exaggeration=="number"?a.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,n,a,o=p.X){var c;if(!(n>=0&&n=0&&ae.canonical.z&&(e.canonical.z>=o?c=e.canonical.z-o:p.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let m=e.canonical.x-(e.canonical.x>>c<>c<>8<<4|c>>8,n[m+3]=0;let a=new p.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),o=new st(e,a,e.gl.RGBA,{premultiply:!1});return o.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=o,o}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);let n=new Uint8Array(4),a=this.painter.context,o=a.gl,c=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),m=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),g=Math.round(this.painter.height/devicePixelRatio);a.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),o.readPixels(c,g-m-1,1,1,o.RGBA,o.UNSIGNED_BYTE,n),a.bindFramebuffer.set(null);let y=n[0]+(n[2]>>4<<8),b=n[1]+((15&n[2])<<8),T=this.coordsIndex[255-n[3]],S=T&&this.sourceCache.getTileByID(T);if(!S)return null;let C=this._coordsTextureSize,E=(1<e.id!==n),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(let n of this._recentlyUsed)if(!this._objects[n].inUse)return this._objects[n];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");let e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(let e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length!e.inUse)===!1}}let En={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class ll{constructor(e,n){this.painter=e,this.terrain=n,this.pool=new rc(e.context,30,n.sourceCache.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,n){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter(a=>!e._layers[a].isHidden(n)),this._coordsDescendingInv={};for(let a in e.sourceCaches){this._coordsDescendingInv[a]={};let o=e.sourceCaches[a].getVisibleCoordinates();for(let c of o){let m=this.terrain.sourceCache.getTerrainCoords(c);for(let g in m)this._coordsDescendingInv[a][g]||(this._coordsDescendingInv[a][g]=[]),this._coordsDescendingInv[a][g].push(m[g])}}this._coordsDescendingInvStr={};for(let a of e._order){let o=e._layers[a],c=o.source;if(En[o.type]&&!this._coordsDescendingInvStr[c]){this._coordsDescendingInvStr[c]={};for(let m in this._coordsDescendingInv[c])this._coordsDescendingInvStr[c][m]=this._coordsDescendingInv[c][m].map(g=>g.key).sort().join()}}for(let a of this._renderableTiles)for(let o in this._coordsDescendingInvStr){let c=this._coordsDescendingInvStr[o][a.tileID.key];c&&c!==a.rttCoords[o]&&(a.rtt=[])}}renderLayer(e){if(e.isHidden(this.painter.transform.zoom))return!1;let n=e.type,a=this.painter,o=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(En[n]&&(this._prevType&&En[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(e.id),!o))return!0;if(En[this._prevType]||En[n]&&o){this._prevType=n;let c=this._stacks.length-1,m=this._stacks[c]||[];for(let g of this._renderableTiles){if(this.pool.isFull()&&(el(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(g),g.rtt[c]){let b=this.pool.getObjectForId(g.rtt[c].id);if(b.stamp===g.rtt[c].stamp){this.pool.useObject(b);continue}}let y=this.pool.getOrCreateFreeObject();this.pool.useObject(y),this.pool.stampObject(y),g.rtt[c]={id:y.id,stamp:y.stamp},a.context.bindFramebuffer.set(y.fbo.framebuffer),a.context.clear({color:p.aM.transparent,stencil:0}),a.currentStencilSource=void 0;for(let b=0;b{h.touchstart=h.dragStart,h.touchmoveWindow=h.dragMove,h.touchend=h.dragEnd},sc={showCompass:!0,showZoom:!0,visualizePitch:!1};class ac{constructor(e,n,a=!1){this.mousedown=m=>{this.startMouse(p.e({},m,{ctrlKey:!0,preventDefault:()=>m.preventDefault()}),se.mousePos(this.element,m)),se.addEventListener(window,"mousemove",this.mousemove),se.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=m=>{this.moveMouse(m,se.mousePos(this.element,m))},this.mouseup=m=>{this.mouseRotate.dragEnd(m),this.mousePitch&&this.mousePitch.dragEnd(m),this.offTemp()},this.touchstart=m=>{m.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=se.touchPos(this.element,m.targetTouches)[0],this.startTouch(m,this._startPos),se.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),se.addEventListener(window,"touchend",this.touchend))},this.touchmove=m=>{m.targetTouches.length!==1?this.reset():(this._lastPos=se.touchPos(this.element,m.targetTouches)[0],this.moveTouch(m,this._lastPos))},this.touchend=m=>{m.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;let o=e.dragRotate._mouseRotate.getClickTolerance(),c=e.dragRotate._mousePitch.getClickTolerance();this.element=n,this.mouseRotate=Ja({clickTolerance:o,enable:!0}),this.touchRotate=(({enable:m,clickTolerance:g,bearingDegreesPerPixelMoved:y=.8})=>{let b=new Ka;return new _r({clickTolerance:g,move:(T,S)=>({bearingDelta:(S.x-T.x)*y}),moveStateManager:b,enable:m,assignEvents:ho})})({clickTolerance:o,enable:!0}),this.map=e,a&&(this.mousePitch=Ya({clickTolerance:c,enable:!0}),this.touchPitch=(({enable:m,clickTolerance:g,pitchDegreesPerPixelMoved:y=-.5})=>{let b=new Ka;return new _r({clickTolerance:g,move:(T,S)=>({pitchDelta:(S.y-T.y)*y}),moveStateManager:b,enable:m,assignEvents:ho})})({clickTolerance:c,enable:!0})),se.addEventListener(n,"mousedown",this.mousedown),se.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),se.addEventListener(n,"touchcancel",this.reset)}startMouse(e,n){this.mouseRotate.dragStart(e,n),this.mousePitch&&this.mousePitch.dragStart(e,n),se.disableDrag()}startTouch(e,n){this.touchRotate.dragStart(e,n),this.touchPitch&&this.touchPitch.dragStart(e,n),se.disableDrag()}moveMouse(e,n){let a=this.map,{bearingDelta:o}=this.mouseRotate.dragMove(e,n)||{};if(o&&a.setBearing(a.getBearing()+o),this.mousePitch){let{pitchDelta:c}=this.mousePitch.dragMove(e,n)||{};c&&a.setPitch(a.getPitch()+c)}}moveTouch(e,n){let a=this.map,{bearingDelta:o}=this.touchRotate.dragMove(e,n)||{};if(o&&a.setBearing(a.getBearing()+o),this.touchPitch){let{pitchDelta:c}=this.touchPitch.dragMove(e,n)||{};c&&a.setPitch(a.getPitch()+c)}}off(){let e=this.element;se.removeEventListener(e,"mousedown",this.mousedown),se.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),se.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),se.removeEventListener(window,"touchend",this.touchend),se.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){se.enableDrag(),se.removeEventListener(window,"mousemove",this.mousemove),se.removeEventListener(window,"mouseup",this.mouseup),se.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),se.removeEventListener(window,"touchend",this.touchend)}}let _i;function dt(h,e,n){let a=new p.N(h.lng,h.lat);if(h=new p.N(h.lng,h.lat),e){let o=new p.N(h.lng-360,h.lat),c=new p.N(h.lng+360,h.lat),m=n.locationPoint(h).distSqr(e);n.locationPoint(o).distSqr(e)180;){let o=n.locationPoint(h);if(o.x>=0&&o.y>=0&&o.x<=n.width&&o.y<=n.height)break;h.lng>n.center.lng?h.lng-=360:h.lng+=360}return h.lng!==a.lng&&n.locationPoint(h).y>n.height/2-n.getHorizon()?h:a}let Dn={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 ta(h,e,n){let a=h.classList;for(let o in Dn)a.remove(`maplibregl-${n}-anchor-${o}`);a.add(`maplibregl-${n}-anchor-${e}`)}class ia extends p.E{constructor(e){if(super(),this._onKeyPress=n=>{let a=n.code,o=n.charCode||n.keyCode;a!=="Space"&&a!=="Enter"&&o!==32&&o!==13||this.togglePopup()},this._onMapClick=n=>{let a=n.originalEvent.target,o=this._element;this._popup&&(a===o||o.contains(a))&&this.togglePopup()},this._update=n=>{var a;if(!this._map)return;let o=this._map.loaded()&&!this._map.isMoving();(n?.type==="terrain"||n?.type==="render"&&!o)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?dt(this._lngLat,this._flatPos,this._map.transform):(a=this._lngLat)===null||a===void 0?void 0:a.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let c="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?c=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(c=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let m="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?m="rotateX(0deg)":this._pitchAlignment==="map"&&(m=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||n&&n.type!=="moveend"||(this._pos=this._pos.round()),se.setTransform(this._element,`${Dn[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${m} ${c}`),me.frameAsync(new AbortController).then(()=>{this._updateOpacity(n&&n.type==="moveend")}).catch(()=>{})},this._onMove=n=>{if(!this._isDragging){let a=this._clickTolerance||this._map._clickTolerance;this._isDragging=n.point.dist(this._pointerdownPos)>=a}this._isDragging&&(this._pos=n.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 p.k("dragstart"))),this.fire(new p.k("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 p.k("dragend")),this._state="inactive"},this._addDragHandler=n=>{this._element.contains(n.originalEvent.target)&&(n.preventDefault(),this._positionDelta=n.point.sub(this._pos).add(this._offset),this._pointerdownPos=n.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=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._subpixelPositioning=e&&e.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(e?.opacity,e?.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=p.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=se.create("div");let n=se.createNS("http://www.w3.org/2000/svg","svg"),a=41,o=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${a}px`),n.setAttributeNS(null,"width",`${o}px`),n.setAttributeNS(null,"viewBox",`0 0 ${o} ${a}`);let c=se.createNS("http://www.w3.org/2000/svg","g");c.setAttributeNS(null,"stroke","none"),c.setAttributeNS(null,"stroke-width","1"),c.setAttributeNS(null,"fill","none"),c.setAttributeNS(null,"fill-rule","evenodd");let m=se.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"fill-rule","nonzero");let g=se.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"transform","translate(3.0, 29.0)"),g.setAttributeNS(null,"fill","#000000");let y=[{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(let $ of y){let Z=se.createNS("http://www.w3.org/2000/svg","ellipse");Z.setAttributeNS(null,"opacity","0.04"),Z.setAttributeNS(null,"cx","10.5"),Z.setAttributeNS(null,"cy","5.80029008"),Z.setAttributeNS(null,"rx",$.rx),Z.setAttributeNS(null,"ry",$.ry),g.appendChild(Z)}let b=se.createNS("http://www.w3.org/2000/svg","g");b.setAttributeNS(null,"fill",this._color);let T=se.createNS("http://www.w3.org/2000/svg","path");T.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"),b.appendChild(T);let S=se.createNS("http://www.w3.org/2000/svg","g");S.setAttributeNS(null,"opacity","0.25"),S.setAttributeNS(null,"fill","#000000");let C=se.createNS("http://www.w3.org/2000/svg","path");C.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"),S.appendChild(C);let E=se.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"transform","translate(6.0, 7.0)"),E.setAttributeNS(null,"fill","#FFFFFF");let R=se.createNS("http://www.w3.org/2000/svg","g");R.setAttributeNS(null,"transform","translate(8.0, 8.0)");let V=se.createNS("http://www.w3.org/2000/svg","circle");V.setAttributeNS(null,"fill","#000000"),V.setAttributeNS(null,"opacity","0.25"),V.setAttributeNS(null,"cx","5.5"),V.setAttributeNS(null,"cy","5.5"),V.setAttributeNS(null,"r","5.4999962");let U=se.createNS("http://www.w3.org/2000/svg","circle");U.setAttributeNS(null,"fill","#FFFFFF"),U.setAttributeNS(null,"cx","5.5"),U.setAttributeNS(null,"cy","5.5"),U.setAttributeNS(null,"r","5.4999962"),R.appendChild(V),R.appendChild(U),m.appendChild(g),m.appendChild(b),m.appendChild(S),m.appendChild(E),m.appendChild(R),n.appendChild(m),n.setAttributeNS(null,"height",a*this._scale+"px"),n.setAttributeNS(null,"width",o*this._scale+"px"),this._element.appendChild(n),this._offset=p.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",n=>{n.preventDefault()}),this._element.addEventListener("mousedown",n=>{n.preventDefault()}),ta(this._element,this._anchor,"marker"),e&&e.className)for(let n of e.className.split(" "))this._element.classList.add(n);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",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("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),se.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=p.N.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){let o=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[o,-1*(38.1-13.5+o)],"bottom-right":[-o,-1*(38.1-13.5+o)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){let e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var n,a;if(!(!((n=this._map)===null||n===void 0)&&n.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let o=this._map,c=o.terrain.depthAtPoint(this._pos),m=o.terrain.getElevationForLngLatZoom(this._lngLat,o.transform.tileZoom);if(o.transform.lngLatToCameraDepth(this._lngLat,m)-c<.006)return void(this._element.style.opacity=this._opacity);let g=-this._offset.y/o.transform._pixelPerMeter,y=Math.sin(o.getPitch()*Math.PI/180)*g,b=o.terrain.depthAtPoint(new p.P(this._pos.x,this._pos.y-this._offset.y)),T=o.transform.lngLatToCameraDepth(this._lngLat,m+y)-b>.006;!((a=this._popup)===null||a===void 0)&&a.isOpen()&&T&&this._popup.remove(),this._element.style.opacity=T?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=p.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(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(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,n){return e===void 0&&n===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=e),n!==void 0&&(this._opacityWhenCovered=n),this._map&&this._updateOpacity(!0),this}}let hl={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},fs=0,ms=!1,sr={maxWidth:100,unit:"metric"};function _s(h,e,n){let a=n&&n.maxWidth||100,o=h._container.clientHeight/2,c=h.unproject([0,o]),m=h.unproject([a,o]),g=c.distanceTo(m);if(n&&n.unit==="imperial"){let y=3.2808*g;y>5280?Ae(e,a,y/5280,h._getUIString("ScaleControl.Miles")):Ae(e,a,y,h._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?Ae(e,a,g/1852,h._getUIString("ScaleControl.NauticalMiles")):g>=1e3?Ae(e,a,g/1e3,h._getUIString("ScaleControl.Kilometers")):Ae(e,a,g,h._getUIString("ScaleControl.Meters"))}function Ae(h,e,n,a){let o=function(c){let m=Math.pow(10,`${Math.floor(c)}`.length-1),g=c/m;return g=g>=10?10:g>=5?5:g>=3?3:g>=2?2:g>=1?1:function(y){let b=Math.pow(10,Math.ceil(-Math.log(y)/Math.LN10));return Math.round(y*b)/b}(g),m*g}(n);h.style.width=e*(o/n)+"px",h.innerHTML=`${o} ${a}`}let Re={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},ra=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function na(h){if(h){if(typeof h=="number"){let e=Math.round(Math.abs(h)/Math.SQRT2);return{center:new p.P(0,0),top:new p.P(0,h),"top-left":new p.P(e,e),"top-right":new p.P(-e,e),bottom:new p.P(0,-h),"bottom-left":new p.P(e,-e),"bottom-right":new p.P(-e,-e),left:new p.P(h,0),right:new p.P(-h,0)}}if(h instanceof p.P||Array.isArray(h)){let e=p.P.convert(h);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:p.P.convert(h.center||[0,0]),top:p.P.convert(h.top||[0,0]),"top-left":p.P.convert(h["top-left"]||[0,0]),"top-right":p.P.convert(h["top-right"]||[0,0]),bottom:p.P.convert(h.bottom||[0,0]),"bottom-left":p.P.convert(h["bottom-left"]||[0,0]),"bottom-right":p.P.convert(h["bottom-right"]||[0,0]),left:p.P.convert(h.left||[0,0]),right:p.P.convert(h.right||[0,0])}}return na(new p.P(0,0))}let uo=ki;L.AJAXError=p.bh,L.Evented=p.E,L.LngLat=p.N,L.MercatorCoordinate=p.Z,L.Point=p.P,L.addProtocol=p.bi,L.config=p.a,L.removeProtocol=p.bj,L.AttributionControl=zn,L.BoxZoomHandler=mi,L.CanvasSource=bi,L.CooperativeGesturesHandler=Cn,L.DoubleClickZoomHandler=Qr,L.DragPanHandler=sl,L.DragRotateHandler=al,L.EdgeInsets=In,L.FullscreenControl=class extends p.E{constructor(h={}){super(),this._onFullscreenChange=()=>{var e;let n=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((e=n?.shadowRoot)===null||e===void 0)&&e.fullscreenElement;)n=n.shadowRoot.fullscreenElement;n===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,h&&h.container&&(h.container instanceof HTMLElement?this._container=h.container:p.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(h){return this._map=h,this._container||(this._container=this._map.getContainer()),this._controlContainer=se.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){se.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let h=this._fullscreenButton=se.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);se.create("span","maplibregl-ctrl-icon",h).setAttribute("aria-hidden","true"),h.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let h=this._getTitle();this._fullscreenButton.setAttribute("aria-label",h),this._fullscreenButton.title=h}_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 p.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new p.k("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()}},L.GeoJSONSource=Kn,L.GeolocateControl=class extends p.E{constructor(h){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new p.k("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,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(e),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new p.k("geolocate",e)),this._finish()}},this._updateCamera=e=>{let n=new p.N(e.coords.longitude,e.coords.latitude),a=e.coords.accuracy,o=this._map.getBearing(),c=p.e({bearing:o},this.options.fitBoundsOptions),m=ie.fromLngLat(n,a);this._map.fitBounds(m,c,{geolocateSource:!0})},this._updateMarker=e=>{if(e){let n=new p.N(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=e.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=e=>{if(this._map){if(this.options.trackUserLocation)if(e.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;let n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&ms)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new p.k("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=se.create("button","maplibregl-ctrl-geolocate",this._container),se.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(e===!1){p.w("Geolocation support is not available so the GeolocateControl will be disabled.");let n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}else{let n=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=se.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new ia({element:this._dotElement}),this._circleElement=se.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ia({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",n=>{n.geolocateSource||this._watchState!=="ACTIVE_LOCK"||n.originalEvent&&n.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 p.k("trackuserlocationend")),this.fire(new p.k("userlocationlostfocus")))})}},this.options=p.e({},hl,h)}onAdd(h){return this._map=h,this._container=se.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return p._(this,arguments,void 0,function*(e=!1){if(_i!==void 0&&!e)return _i;if(window.navigator.permissions===void 0)return _i=!!window.navigator.geolocation,_i;try{_i=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{_i=!!window.navigator.geolocation}return _i})}().then(e=>this._finishSetupUI(e)),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(),se.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,fs=0,ms=!1}_isOutOfMapMaxBounds(h){let e=this._map.getMaxBounds(),n=h.coords;return e&&(n.longitudee.getEast()||n.latitudee.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(){let h=this._map.getBounds(),e=h.getSouthEast(),n=h.getNorthEast(),a=e.distanceTo(n),o=Math.ceil(this._accuracy/(a/this._map._container.clientHeight)*2);this._circleElement.style.width=`${o}px`,this._circleElement.style.height=`${o}px`}trigger(){if(!this._setup)return p.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 p.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":fs--,ms=!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 p.k("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 p.k("trackuserlocationstart")),this.fire(new p.k("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 h;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),fs++,fs>1?(h={maximumAge:6e5,timeout:0},ms=!0):(h=this.options.positionOptions,ms=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,h)}}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)}},L.Hash=Gs,L.ImageSource=pr,L.KeyboardHandler=Si,L.LngLatBounds=ie,L.LogoControl=ao,L.Map=class extends ol{constructor(h){p.bf.mark(p.bg.create);let e=Object.assign(Object.assign({},nc),h);if(e.minZoom!=null&&e.maxZoom!=null&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(e.minPitch!=null&&e.maxPitch!=null&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(e.minPitch!=null&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(e.maxPitch!=null&&e.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Pn(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies),{bearingSnap:e.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Xe,this._controls=[],this._mapId=p.a4(),this._contextLost=n=>{n.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new p.k("webglcontextlost",{originalEvent:n}))},this._contextRestored=n=>{this._setupPainter(),this.resize(),this._update(),this.fire(new p.k("webglcontextrestored",{originalEvent:n}))},this._onMapScroll=n=>{if(n.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._maxTileCacheZoomLevels=e.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=e.preserveDrawingBuffer===!0,this._antialias=e.antialias===!0,this._trackResize=e.trackResize===!0,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles===!0,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions===!0,this._collectResourceTiming=e.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},co),e.locale),this._clickTolerance=e.clickTolerance,this._overridePixelRatio=e.pixelRatio,this._maxCanvasSize=e.maxCanvasSize,this.transformCameraUpdate=e.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=e.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=hi.addThrottleControl(()=>this.isMoving()),this._requestManager=new wa(e.transformRequest),typeof e.container=="string"){if(this._container=document.getElementById(e.container),!this._container)throw new Error(`Container '${e.container}' not found.`)}else{if(!(e.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)).on("moveend",()=>this._update(!1)).on("zoom",()=>this._update(!0)).on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}).once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let n=!1,a=cs(o=>{this._trackResize&&!this._removed&&(this.resize(o),this.redraw())},50);this._resizeObserver=new ResizeObserver(o=>{n?a(o):n=!0}),this._resizeObserver.observe(this._container)}this.handlers=new so(this,e),this._hash=e.hash&&new Gs(typeof e.hash=="string"&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,p.e({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,this._validateStyle=e.validateStyle,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new zn(typeof e.attributionControl=="boolean"?void 0:e.attributionControl)),e.maplibreLogo&&this.addControl(new ao,e.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",n=>{this._update(n.dataType==="style"),this.fire(new p.k(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new p.k(`${n.dataType}dataloading`,n))}),this.on("dataabort",n=>{this.fire(new p.k("sourcedataabort",n))})}_getMapId(){return this._mapId}addControl(h,e){if(e===void 0&&(e=h.getDefaultPosition?h.getDefaultPosition():"top-right"),!h||!h.onAdd)return this.fire(new p.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let n=h.onAdd(this);this._controls.push(h);let a=this._controlPositions[e];return e.indexOf("bottom")!==-1?a.insertBefore(n,a.firstChild):a.appendChild(n),this}removeControl(h){if(!h||!h.onRemove)return this.fire(new p.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let e=this._controls.indexOf(h);return e>-1&&this._controls.splice(e,1),h.onRemove(this),this}hasControl(h){return this._controls.indexOf(h)>-1}calculateCameraOptionsFromTo(h,e,n,a){return a==null&&this.terrain&&(a=this.terrain.getElevationForLngLatZoom(n,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(h,e,n,a)}resize(h){var e;let n=this._containerDimensions(),a=n[0],o=n[1],c=this._getClampedPixelRatio(a,o);if(this._resizeCanvas(a,o,c),this.painter.resize(a,o,c),this.painter.overLimit()){let g=this.painter.context.gl;this._maxCanvasSize=[g.drawingBufferWidth,g.drawingBufferHeight];let y=this._getClampedPixelRatio(a,o);this._resizeCanvas(a,o,y),this.painter.resize(a,o,y)}this.transform.resize(a,o),(e=this._requestedCameraState)===null||e===void 0||e.resize(a,o);let m=!this._moving;return m&&(this.stop(),this.fire(new p.k("movestart",h)).fire(new p.k("move",h))),this.fire(new p.k("resize",h)),m&&this.fire(new p.k("moveend",h)),this}_getClampedPixelRatio(h,e){let{0:n,1:a}=this._maxCanvasSize,o=this.getPixelRatio(),c=h*o,m=e*o;return Math.min(c>n?n/c:1,m>a?a/m:1)*o}getPixelRatio(){var h;return(h=this._overridePixelRatio)!==null&&h!==void 0?h:devicePixelRatio}setPixelRatio(h){this._overridePixelRatio=h,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(h){return this.transform.setMaxBounds(ie.convert(h)),this._update()}setMinZoom(h){if((h=h??-2)>=-2&&h<=this.transform.maxZoom)return this.transform.minZoom=h,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=h,this._update(),this.getZoom()>h&&this.setZoom(h),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(h){if((h=h??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(h>=0&&h<=this.transform.maxPitch)return this.transform.minPitch=h,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(h>=this.transform.minPitch)return this.transform.maxPitch=h,this._update(),this.getPitch()>h&&this.setPitch(h),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(h){return this.transform.renderWorldCopies=h,this._update()}project(h){return this.transform.locationPoint(p.N.convert(h),this.style&&this.terrain)}unproject(h){return this.transform.pointLocation(p.P.convert(h),this.terrain)}isMoving(){var h;return this._moving||((h=this.handlers)===null||h===void 0?void 0:h.isMoving())}isZooming(){var h;return this._zooming||((h=this.handlers)===null||h===void 0?void 0:h.isZooming())}isRotating(){var h;return this._rotating||((h=this.handlers)===null||h===void 0?void 0:h.isRotating())}_createDelegatedListener(h,e,n){if(h==="mouseenter"||h==="mouseover"){let a=!1;return{layers:e,listener:n,delegates:{mousemove:c=>{let m=e.filter(y=>this.getLayer(y)),g=m.length!==0?this.queryRenderedFeatures(c.point,{layers:m}):[];g.length?a||(a=!0,n.call(this,new Ot(h,this,c.originalEvent,{features:g}))):a=!1},mouseout:()=>{a=!1}}}}if(h==="mouseleave"||h==="mouseout"){let a=!1;return{layers:e,listener:n,delegates:{mousemove:m=>{let g=e.filter(y=>this.getLayer(y));(g.length!==0?this.queryRenderedFeatures(m.point,{layers:g}):[]).length?a=!0:a&&(a=!1,n.call(this,new Ot(h,this,m.originalEvent)))},mouseout:m=>{a&&(a=!1,n.call(this,new Ot(h,this,m.originalEvent)))}}}}{let a=o=>{let c=e.filter(g=>this.getLayer(g)),m=c.length!==0?this.queryRenderedFeatures(o.point,{layers:c}):[];m.length&&(o.features=m,n.call(this,o),delete o.features)};return{layers:e,listener:n,delegates:{[h]:a}}}}_saveDelegatedListener(h,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[h]=this._delegatedListeners[h]||[],this._delegatedListeners[h].push(e)}_removeDelegatedListener(h,e,n){if(!this._delegatedListeners||!this._delegatedListeners[h])return;let a=this._delegatedListeners[h];for(let o=0;oe.includes(m))){for(let m in c.delegates)this.off(m,c.delegates[m]);return void a.splice(o,1)}}}on(h,e,n){if(n===void 0)return super.on(h,e);let a=this._createDelegatedListener(h,typeof e=="string"?[e]:e,n);this._saveDelegatedListener(h,a);for(let o in a.delegates)this.on(o,a.delegates[o]);return this}once(h,e,n){if(n===void 0)return super.once(h,e);let a=typeof e=="string"?[e]:e,o=this._createDelegatedListener(h,a,n);for(let c in o.delegates){let m=o.delegates[c];o.delegates[c]=(...g)=>{this._removeDelegatedListener(h,a,n),m(...g)}}this._saveDelegatedListener(h,o);for(let c in o.delegates)this.once(c,o.delegates[c]);return this}off(h,e,n){return n===void 0?super.off(h,e):(this._removeDelegatedListener(h,typeof e=="string"?[e]:e,n),this)}queryRenderedFeatures(h,e){if(!this.style)return[];let n,a=h instanceof p.P||Array.isArray(h),o=a?h:[[0,0],[this.transform.width,this.transform.height]];if(e=e||(a?{}:h)||{},o instanceof p.P||typeof o[0]=="number")n=[p.P.convert(o)];else{let c=p.P.convert(o[0]),m=p.P.convert(o[1]);n=[c,new p.P(m.x,c.y),m,new p.P(c.x,m.y),c]}return this.style.queryRenderedFeatures(n,e,this.transform)}querySourceFeatures(h,e){return this.style.querySourceFeatures(h,e)}setStyle(h,e){return(e=p.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&h?(this._diffStyle(h,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(h,e))}setTransformRequest(h){return this._requestManager.setTransformRequest(h),this}_getUIString(h){let e=this._locale[h];if(e==null)throw new Error(`Missing UI string '${h}'`);return e}_updateStyle(h,e){if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(h,e));let n=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!h)),h?(this.style=new Cs(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof h=="string"?this.style.loadURL(h,e,n):this.style.loadJSON(h,e,n),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Cs(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(h,e){if(typeof h=="string"){let n=this._requestManager.transformRequest(h,"Style");p.h(n,new AbortController).then(a=>{this._updateDiff(a.data,e)}).catch(a=>{a&&this.fire(new p.j(a))})}else typeof h=="object"&&this._updateDiff(h,e)}_updateDiff(h,e){try{this.style.setState(h,e)&&this._update(!0)}catch(n){p.w(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(h,e)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():p.w("There is no style added to the map.")}addSource(h,e){return this._lazyInitEmptyStyle(),this.style.addSource(h,e),this._update(!0)}isSourceLoaded(h){let e=this.style&&this.style.sourceCaches[h];if(e!==void 0)return e.loaded();this.fire(new p.j(new Error(`There is no source with ID '${h}'`)))}setTerrain(h){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),h){let e=this.style.sourceCaches[h.source];if(!e)throw new Error(`cannot load terrain, because there exists no source with ID: ${h.source}`);this.terrain===null&&e.reload();for(let n in this.style._layers){let a=this.style._layers[n];a.type==="hillshade"&&a.source===h.source&&p.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.")}this.terrain=new lo(this.painter,e,h),this.painter.renderToTexture=new ll(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=n=>{n.dataType==="style"?this.terrain.sourceCache.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId!==h.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(n.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.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new p.k("terrain",{terrain:h})),this}getTerrain(){var h,e;return(e=(h=this.terrain)===null||h===void 0?void 0:h.options)!==null&&e!==void 0?e:null}areTilesLoaded(){let h=this.style&&this.style.sourceCaches;for(let e in h){let n=h[e]._tiles;for(let a in n){let o=n[a];if(o.state!=="loaded"&&o.state!=="errored")return!1}}return!0}removeSource(h){return this.style.removeSource(h),this._update(!0)}getSource(h){return this.style.getSource(h)}addImage(h,e,n={}){let{pixelRatio:a=1,sdf:o=!1,stretchX:c,stretchY:m,content:g,textFitWidth:y,textFitHeight:b}=n;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||p.b(e))){if(e.width===void 0||e.height===void 0)return this.fire(new p.j(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`")));{let{width:T,height:S,data:C}=e,E=e;return this.style.addImage(h,{data:new p.R({width:T,height:S},new Uint8Array(C)),pixelRatio:a,stretchX:c,stretchY:m,content:g,textFitWidth:y,textFitHeight:b,sdf:o,version:0,userImage:E}),E.onAdd&&E.onAdd(this,h),this}}{let{width:T,height:S,data:C}=me.getImageData(e);this.style.addImage(h,{data:new p.R({width:T,height:S},C),pixelRatio:a,stretchX:c,stretchY:m,content:g,textFitWidth:y,textFitHeight:b,sdf:o,version:0})}}updateImage(h,e){let n=this.style.getImage(h);if(!n)return this.fire(new p.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let a=e instanceof HTMLImageElement||p.b(e)?me.getImageData(e):e,{width:o,height:c,data:m}=a;if(o===void 0||c===void 0)return this.fire(new p.j(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(o!==n.data.width||c!==n.data.height)return this.fire(new p.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));let g=!(e instanceof HTMLImageElement||p.b(e));return n.data.replace(m,g),this.style.updateImage(h,n),this}getImage(h){return this.style.getImage(h)}hasImage(h){return h?!!this.style.getImage(h):(this.fire(new p.j(new Error("Missing required image id"))),!1)}removeImage(h){this.style.removeImage(h)}loadImage(h){return hi.getImage(this._requestManager.transformRequest(h,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(h,e){return this._lazyInitEmptyStyle(),this.style.addLayer(h,e),this._update(!0)}moveLayer(h,e){return this.style.moveLayer(h,e),this._update(!0)}removeLayer(h){return this.style.removeLayer(h),this._update(!0)}getLayer(h){return this.style.getLayer(h)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(h,e,n){return this.style.setLayerZoomRange(h,e,n),this._update(!0)}setFilter(h,e,n={}){return this.style.setFilter(h,e,n),this._update(!0)}getFilter(h){return this.style.getFilter(h)}setPaintProperty(h,e,n,a={}){return this.style.setPaintProperty(h,e,n,a),this._update(!0)}getPaintProperty(h,e){return this.style.getPaintProperty(h,e)}setLayoutProperty(h,e,n,a={}){return this.style.setLayoutProperty(h,e,n,a),this._update(!0)}getLayoutProperty(h,e){return this.style.getLayoutProperty(h,e)}setGlyphs(h,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(h,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(h,e,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(h,e,n,a=>{a||this._update(!0)}),this}removeSprite(h){return this._lazyInitEmptyStyle(),this.style.removeSprite(h),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(h,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(h,e,n=>{n||this._update(!0)}),this}setLight(h,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(h,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(h){return this._lazyInitEmptyStyle(),this.style.setSky(h),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(h,e){return this.style.setFeatureState(h,e),this._update()}removeFeatureState(h,e){return this.style.removeFeatureState(h,e),this._update()}getFeatureState(h){return this.style.getFeatureState(h)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let h=0,e=0;return this._container&&(h=this._container.clientWidth||400,e=this._container.clientHeight||300),[h,e]}_setupContainer(){let h=this._container;h.classList.add("maplibregl-map");let e=this._canvasContainer=se.create("div","maplibregl-canvas-container",h);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=se.create("canvas","maplibregl-canvas",e),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");let n=this._containerDimensions(),a=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],a);let o=this._controlContainer=se.create("div","maplibregl-control-container",h),c=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(m=>{c[m]=se.create("div",`maplibregl-ctrl-${m} `,o)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(h,e,n){this._canvas.width=Math.floor(n*h),this._canvas.height=Math.floor(n*e),this._canvas.style.width=`${h}px`,this._canvas.style.height=`${e}px`}_setupPainter(){let h={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1},e=null;this._canvas.addEventListener("webglcontextcreationerror",a=>{e={requestedAttributes:h},a&&(e.statusMessage=a.statusMessage,e.type=a.type)},{once:!0});let n=this._canvas.getContext("webgl2",h)||this._canvas.getContext("webgl",h);if(!n){let a="Failed to initialize WebGL";throw e?(e.message=a,new Error(JSON.stringify(e))):new Error(a)}this.painter=new Zs(n,this.transform),Fr.testSupport(n)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(h){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||h,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(h){return this._update(),this._renderTaskQueue.add(h)}_cancelRenderFrame(h){this._renderTaskQueue.remove(h)}_render(h){let e=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(h),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let o=this.transform.zoom,c=me.now();this.style.zoomHistory.update(o,c);let m=new p.z(o,{now:c,fadeDuration:e,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),g=m.crossFadingFactor();g===1&&g===this._crossFadingFactor||(n=!0,this._crossFadingFactor=g),this.style.update(m)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,e,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:e,showPadding:this.showPadding}),this.fire(new p.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,p.bf.mark(p.bg.load),this.fire(new p.k("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let a=this._sourcesDirty||this._styleDirty||this._placementDirty;return a||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new p.k("idle")),!this._loaded||this._fullyLoaded||a||(this._fullyLoaded=!0,p.bf.mark(p.bg.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var h;this._hash&&this._hash.remove();for(let n of this._controls)n.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),hi.removeThrottleControl(this._imageQueueHandle),(h=this._resizeObserver)===null||h===void 0||h.disconnect();let e=this.painter.context.gl.getExtension("WEBGL_lose_context");e?.loseContext&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),se.remove(this._canvasContainer),se.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),p.bf.clearMetrics(),this._removed=!0,this.fire(new p.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,me.frameAsync(this._frameRequest).then(h=>{p.bf.frame(h),this._frameRequest=null,this._render(h)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(h){this._showTileBoundaries!==h&&(this._showTileBoundaries=h,this._update())}get showPadding(){return!!this._showPadding}set showPadding(h){this._showPadding!==h&&(this._showPadding=h,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(h){this._showCollisionBoxes!==h&&(this._showCollisionBoxes=h,h?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(h){this._showOverdrawInspector!==h&&(this._showOverdrawInspector=h,this._update())}get repaint(){return!!this._repaint}set repaint(h){this._repaint!==h&&(this._repaint=h,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(h){this._vertices=h,this._update()}get version(){return cl}getCameraTargetElevation(){return this.transform.elevation}},L.MapMouseEvent=Ot,L.MapTouchEvent=Jr,L.MapWheelEvent=il,L.Marker=ia,L.NavigationControl=class{constructor(h){this._updateZoomButtons=()=>{let e=this._map.getZoom(),n=e===this._map.getMaxZoom(),a=e===this._map.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=a,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",a.toString())},this._rotateCompassArrow=()=>{let e=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=e},this._setButtonTitle=(e,n)=>{let a=this._map._getUIString(`NavigationControl.${n}`);e.title=a,e.setAttribute("aria-label",a)},this.options=p.e({},sc,h),this._container=se.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),se.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),se.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=se.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(h){return this._map=h,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._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new ac(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){se.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._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(h,e){let n=se.create("button",h,this._container);return n.type="button",n.addEventListener("click",e),n}},L.Popup=class extends p.E{constructor(h){super(),this.remove=()=>(this._content&&se.remove(this._content),this._container&&(se.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 p.k("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{var n;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=se.create("div","maplibregl-popup",this._map.getContainer()),this._tip=se.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let g of this.options.className.split(" "))this._container.classList.add(g);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=this._map.transform.renderWorldCopies&&!this._trackPointer?dt(this._lngLat,this._flatPos,this._map.transform):(n=this._lngLat)===null||n===void 0?void 0:n.wrap(),this._trackPointer&&!e)return;let a=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationPoint(this._lngLat));let o=this.options.anchor,c=na(this.options.offset);if(!o){let g=this._container.offsetWidth,y=this._container.offsetHeight,b;b=a.y+c.bottom.ythis._map.transform.height-y?["bottom"]:[],a.xthis._map.transform.width-g/2&&b.push("right"),o=b.length===0?"bottom":b.join("-")}let m=a.add(c[o]);this.options.subpixelPositioning||(m=m.round()),se.setTransform(this._container,`${Dn[o]} translate(${m.x}px,${m.y}px)`),ta(this._container,o,"popup")},this._onClose=()=>{this.remove()},this.options=p.e(Object.create(Re),h)}addTo(h){return this._map&&this.remove(),this._map=h,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 p.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(h){return this._lngLat=p.N.convert(h),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(h){return this.setDOMContent(document.createTextNode(h))}setHTML(h){let e=document.createDocumentFragment(),n=document.createElement("body"),a;for(n.innerHTML=h;a=n.firstChild,a;)e.appendChild(a);return this.setDOMContent(e)}getMaxWidth(){var h;return(h=this._container)===null||h===void 0?void 0:h.style.maxWidth}setMaxWidth(h){return this.options.maxWidth=h,this._update(),this}setDOMContent(h){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=se.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(h),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(h){return this._container&&this._container.classList.add(h),this}removeClassName(h){return this._container&&this._container.classList.remove(h),this}setOffset(h){return this.options.offset=h,this._update(),this}toggleClassName(h){if(this._container)return this._container.classList.toggle(h)}setSubpixelPositioning(h){this.options.subpixelPositioning=h}_createCloseButton(){this.options.closeButton&&(this._closeButton=se.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;let h=this._container.querySelector(ra);h&&h.focus()}},L.RasterDEMTileSource=yt,L.RasterTileSource=et,L.ScaleControl=class{constructor(h){this._onMove=()=>{_s(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,_s(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},sr),h)}getDefaultPosition(){return"bottom-left"}onAdd(h){return this._map=h,this._container=se.create("div","maplibregl-ctrl maplibregl-ctrl-scale",h.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){se.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},L.ScrollZoomHandler=Vi,L.Style=Cs,L.TerrainControl=class{constructor(h){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=h}onAdd(h){return this._map=h,this._container=se.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=se.create("button","maplibregl-ctrl-terrain",this._container),se.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(){se.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},L.TwoFingersTouchPitchHandler=Mn,L.TwoFingersTouchRotateHandler=io,L.TwoFingersTouchZoomHandler=eo,L.TwoFingersTouchZoomRotateHandler=no,L.VectorTileSource=Wn,L.VideoSource=un,L.addSourceType=(h,e)=>p._(void 0,void 0,void 0,function*(){if(Yn(h))throw new Error(`A source type called "${h}" already exists.`);((n,a)=>{Jn[n]=a})(h,e)}),L.clearPrewarmedResources=function(){let h=ui;h&&(h.isPreloaded()&&h.numActive()===1?(h.release(wr),ui=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()"))},L.getMaxParallelImageRequests=function(){return p.a.MAX_PARALLEL_IMAGE_REQUESTS},L.getRTLTextPluginStatus=function(){return er().getRTLTextPluginStatus()},L.getVersion=function(){return uo},L.getWorkerCount=function(){return Yi.workerCount},L.getWorkerUrl=function(){return p.a.WORKER_URL},L.importScriptInWorkers=function(h){return Xn().broadcast("IS",h)},L.prewarm=function(){Vr().acquire(wr)},L.setMaxParallelImageRequests=function(h){p.a.MAX_PARALLEL_IMAGE_REQUESTS=h},L.setRTLTextPlugin=function(h,e){return er().setRTLTextPlugin(h,e)},L.setWorkerCount=function(h){Yi.workerCount=h},L.setWorkerUrl=function(h){p.a.WORKER_URL=h}});var Bu=an;return Bu})});export default kp(); +/*! Bundled license information: + +maplibre-gl/dist/maplibre-gl.js: + (** + * MapLibre GL JS + * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.7.1/LICENSE.txt + *) +*/ diff --git a/themes/intotheeast/js/post/post-form.js b/themes/intotheeast/js/post/post-form.js index f83a178..cbf492f 100644 --- a/themes/intotheeast/js/post/post-form.js +++ b/themes/intotheeast/js/post/post-form.js @@ -1,68 +1,68 @@ -import{a as Zu,b as at,c as Kh}from"./chunk-ZWRDP37E.js";var Et=at((nl,il)=>{(function(o,l){typeof nl=="object"&&typeof il<"u"?il.exports=l():typeof define=="function"&&define.amd?define(l):(o=o||self,o.CodeMirror=l())})(nl,function(){"use strict";var o=navigator.userAgent,l=navigator.platform,s=/gecko\/\d/i.test(o),a=/MSIE \d/.test(o),f=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(o),p=/Edge\/(\d+)/.exec(o),c=a||f||p,d=c&&(a?document.documentMode||6:+(p||f)[1]),m=!p&&/WebKit\//.test(o),y=m&&/Qt\/\d+\.\d+/.test(o),x=!p&&/Chrome\/(\d+)/.exec(o),C=x&&+x[1],S=/Opera\//.test(o),F=/Apple Computer/.test(navigator.vendor),_=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(o),L=/PhantomJS/.test(o),T=F&&(/Mobile\/\w+/.test(o)||navigator.maxTouchPoints>2),O=/Android/.test(o),N=T||O||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(o),I=T||/Mac/.test(l),P=/\bCrOS\b/.test(o),q=/win/i.test(l),G=S&&o.match(/Version\/(\d*\.\d*)/);G&&(G=Number(G[1])),G&&G>=15&&(S=!1,m=!0);var K=I&&(y||S&&(G==null||G<12.11)),me=s||c&&d>=9;function U(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var le=function(e,t){var n=e.className,r=U(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function j(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function ee(e,t){return j(e).appendChild(t)}function E(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var u=0;u=t)return h+(t-u);h+=g-u,h+=n-h%n,u=g+1}}var ft=function(){this.id=null,this.f=null,this.time=0,this.handler=gt(this.onTimeout,this)};ft.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ft.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n=t)return r+Math.min(h,t-i);if(i+=u-r,i+=n-i%n,r=u+1,i>=t)return r}}var zt=[""];function pr(e){for(;zt.length<=e;)zt.push(Ce(zt)+" ");return zt[e]}function Ce(e){return e[e.length-1]}function Ht(e,t){for(var n=[],r=0;r"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Oc.test(e))}function Ci(e,t){return t?t.source.indexOf("\\w")>-1&&Yo(e)?!0:t.test(e):Yo(e)}function Ul(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Ic=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Zo(e){return e.charCodeAt(0)>=768&&Ic.test(e)}function jl(e,t,n){for(;(n<0?t>0:tn?-1:1;;){if(t==n)return t;var i=(t+n)/2,u=r<0?Math.ceil(i):Math.floor(i);if(u==t)return e(u)?t:n;e(u)?n=u:t=u+r}}function Pc(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,u=0;ut||t==n&&h.to==t)&&(r(Math.max(h.from,t),Math.min(h.to,n),h.level==1?"rtl":"ltr",u),i=!0)}i||r(t,n,"ltr")}var Mn=null;function _n(e,t,n){var r;Mn=null;for(var i=0;it)return i;u.to==t&&(u.from!=u.to&&n=="before"?r=i:Mn=i),u.from==t&&(u.from!=u.to&&n!="before"?r=i:Mn=i)}return r??Mn}var zc=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(b){return b<=247?e.charAt(b):1424<=b&&b<=1524?"R":1536<=b&&b<=1785?t.charAt(b-1536):1774<=b&&b<=2220?"r":8192<=b&&b<=8203?"w":b==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,u=/[LRr]/,h=/[Lb1n]/,g=/[1n]/;function v(b,w,k){this.level=b,this.from=w,this.to=k}return function(b,w){var k=w=="ltr"?"L":"R";if(b.length==0||w=="ltr"&&!r.test(b))return!1;for(var B=b.length,M=[],z=0;z-1&&(r[t]=i.slice(0,u).concat(i.slice(u+1)))}}}function je(e,t){var n=Qo(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i0}function Qr(e){e.prototype.on=function(t,n){ue(this,t,n)},e.prototype.off=function(t,n){Lt(this,t,n)}}function mt(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Kl(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Jo(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function Bn(e){mt(e),Kl(e)}function $o(e){return e.target||e.srcElement}function Yl(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),I&&e.ctrlKey&&t==1&&(t=3),t}var Hc=function(){if(c&&d<9)return!1;var e=E("div");return"draggable"in e||"dragDrop"in e}(),Vo;function Rc(e){if(Vo==null){var t=E("span","\u200B");ee(e,E("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Vo=t.offsetWidth<=1&&t.offsetHeight>2&&!(c&&d<8))}var n=Vo?E("span","\u200B"):E("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var ea;function Wc(e){if(ea!=null)return ea;var t=ee(e,document.createTextNode("A\u062EA")),n=W(t,0,1).getBoundingClientRect(),r=W(t,1,2).getBoundingClientRect();return j(e),!n||n.left==n.right?!1:ea=r.right-n.right<3}var ta=` +import{a as Qu,b as at,c as Jh}from"./chunk-ZWRDP37E.js";var At=at((nl,ol)=>{(function(o,l){typeof nl=="object"&&typeof ol<"u"?ol.exports=l():typeof define=="function"&&define.amd?define(l):(o=o||self,o.CodeMirror=l())})(nl,function(){"use strict";var o=navigator.userAgent,l=navigator.platform,s=/gecko\/\d/i.test(o),a=/MSIE \d/.test(o),f=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(o),h=/Edge\/(\d+)/.exec(o),c=a||f||h,d=c&&(a?document.documentMode||6:+(h||f)[1]),v=!h&&/WebKit\//.test(o),y=v&&/Qt\/\d+\.\d+/.test(o),x=!h&&/Chrome\/(\d+)/.exec(o),D=x&&+x[1],k=/Opera\//.test(o),F=/Apple Computer/.test(navigator.vendor),B=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(o),L=/PhantomJS/.test(o),T=F&&(/Mobile\/\w+/.test(o)||navigator.maxTouchPoints>2),N=/Android/.test(o),z=T||N||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(o),O=T||/Mac/.test(l),I=/\bCrOS\b/.test(o),W=/win/i.test(l),G=k&&o.match(/Version\/(\d*\.\d*)/);G&&(G=Number(G[1])),G&&G>=15&&(k=!1,v=!0);var X=O&&(y||k&&(G==null||G<12.11)),de=s||c&&d>=9;function j(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var oe=function(e,t){var i=e.className,r=j(t).exec(i);if(r){var n=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(n?r[1]+n:"")}};function H(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function Y(e,t){return H(e).appendChild(t)}function E(e,t,i,r){var n=document.createElement(e);if(i&&(n.className=i),r&&(n.style.cssText=r),typeof t=="string")n.appendChild(document.createTextNode(t));else if(t)for(var u=0;u=t)return p+(t-u);p+=g-u,p+=i-p%i,u=g+1}}var ct=function(){this.id=null,this.f=null,this.time=0,this.handler=mt(this.onTimeout,this)};ct.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ct.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i=t)return r+Math.min(p,t-n);if(n+=u-r,n+=i-n%i,r=u+1,n>=t)return r}}var Ht=[""];function pr(e){for(;Ht.length<=e;)Ht.push(De(Ht)+" ");return Ht[e]}function De(e){return e[e.length-1]}function Pt(e,t){for(var i=[],r=0;r"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Pc.test(e))}function Dn(e,t){return t?t.source.indexOf("\\w")>-1&&Zo(e)?!0:t.test(e):Zo(e)}function jl(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var qc=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Qo(e){return e.charCodeAt(0)>=768&&qc.test(e)}function Gl(e,t,i){for(;(i<0?t>0:ti?-1:1;;){if(t==i)return t;var n=(t+i)/2,u=r<0?Math.ceil(n):Math.floor(n);if(u==t)return e(u)?t:i;e(u)?i=u:t=u+r}}function Rc(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,u=0;ut||t==i&&p.to==t)&&(r(Math.max(p.from,t),Math.min(p.to,i),p.level==1?"rtl":"ltr",u),n=!0)}n||r(t,i,"ltr")}var Li=null;function Mi(e,t,i){var r;Li=null;for(var n=0;nt)return n;u.to==t&&(u.from!=u.to&&i=="before"?r=n:Li=n),u.from==t&&(u.from!=u.to&&i!="before"?r=n:Li=n)}return r??Li}var Wc=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(b){return b<=247?e.charAt(b):1424<=b&&b<=1524?"R":1536<=b&&b<=1785?t.charAt(b-1536):1774<=b&&b<=2220?"r":8192<=b&&b<=8203?"w":b==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,u=/[LRr]/,p=/[Lb1n]/,g=/[1n]/;function m(b,C,S){this.level=b,this.from=C,this.to=S}return function(b,C){var S=C=="ltr"?"L":"R";if(b.length==0||C=="ltr"&&!r.test(b))return!1;for(var _=b.length,M=[],P=0;P<_;++P)M.push(i(b.charCodeAt(P)));for(var U=0,Z=S;U<_;++U){var J=M[U];J=="m"?M[U]=Z:Z=J}for(var ee=0,V=S;ee<_;++ee){var ie=M[ee];ie=="1"&&V=="r"?M[ee]="n":u.test(ie)&&(V=ie,ie=="r"&&(M[ee]="R"))}for(var se=1,le=M[0];se<_-1;++se){var we=M[se];we=="+"&&le=="1"&&M[se+1]=="1"?M[se]="1":we==","&&le==M[se+1]&&(le=="1"||le=="n")&&(M[se]=le),le=we}for(var Le=0;Le<_;++Le){var it=M[Le];if(it==",")M[Le]="N";else if(it=="%"){var Ie=void 0;for(Ie=Le+1;Ie<_&&M[Ie]=="%";++Ie);for(var Et=Le&&M[Le-1]=="!"||Ie<_&&M[Ie]=="1"?"1":"N",wt=Le;wt-1&&(r[t]=n.slice(0,u).concat(n.slice(u+1)))}}}function je(e,t){var i=Jo(e,t);if(i.length)for(var r=Array.prototype.slice.call(arguments,2),n=0;n0}function Qr(e){e.prototype.on=function(t,i){ue(this,t,i)},e.prototype.off=function(t,i){Mt(this,t,i)}}function bt(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Yl(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Vo(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function Bi(e){bt(e),Yl(e)}function $o(e){return e.target||e.srcElement}function Zl(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),O&&e.ctrlKey&&t==1&&(t=3),t}var Uc=function(){if(c&&d<9)return!1;var e=E("div");return"draggable"in e||"dragDrop"in e}(),ea;function jc(e){if(ea==null){var t=E("span","\u200B");Y(e,E("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(ea=t.offsetWidth<=1&&t.offsetHeight>2&&!(c&&d<8))}var i=ea?E("span","\u200B"):E("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var ta;function Gc(e){if(ta!=null)return ta;var t=Y(e,document.createTextNode("A\u062EA")),i=R(t,0,1).getBoundingClientRect(),r=R(t,1,2).getBoundingClientRect();return H(e),!i||i.left==i.right?!1:ta=r.right-i.right<3}var ra=` -b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(` -`,t);i==-1&&(i=e.length);var u=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),h=u.indexOf("\r");h!=-1?(n.push(u.slice(0,h)),t+=h+1):(n.push(u),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},qc=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch{return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch{}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Uc=function(){var e=E("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),ra=null;function jc(e){if(ra!=null)return ra;var t=ee(e,E("span","x")),n=t.getBoundingClientRect(),r=W(t,0,1).getBoundingClientRect();return ra=Math.abs(n.left-r.left)>1}var na={},Jr={};function Gc(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),na[e]=t}function Xc(e,t){Jr[e]=t}function ki(e){if(typeof e=="string"&&Jr.hasOwnProperty(e))e=Jr[e];else if(e&&typeof e.name=="string"&&Jr.hasOwnProperty(e.name)){var t=Jr[e.name];typeof t=="string"&&(t={name:t}),e=ql(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return ki("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return ki("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function ia(e,t){t=ki(t);var n=na[t.name];if(!n)return ia(e,"text/plain");var r=n(e,t);if($r.hasOwnProperty(t.name)){var i=$r[t.name];for(var u in i)i.hasOwnProperty(u)&&(r.hasOwnProperty(u)&&(r["_"+u]=r[u]),r[u]=i[u])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var h in t.modeProps)r[h]=t.modeProps[h];return r}var $r={};function Kc(e,t){var n=$r.hasOwnProperty(e)?$r[e]:$r[e]={};Tt(t,n)}function Lr(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function oa(e,t){for(var n;e.innerMode&&(n=e.innerMode(t),!(!n||n.mode==e));)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Zl(e,t,n){return e.startState?e.startState(t,n):!0}var Ge=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};Ge.prototype.eol=function(){return this.pos>=this.string.length},Ge.prototype.sol=function(){return this.pos==this.lineStart},Ge.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ge.prototype.next=function(){if(this.post},Ge.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ge.prototype.skipToEnd=function(){this.pos=this.string.length},Ge.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ge.prototype.backUp=function(e){this.pos-=e},Ge.prototype.column=function(){return this.lastColumnPos0?null:(u&&t!==!1&&(this.pos+=u[0].length),u)}},Ge.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ge.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ge.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ge.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function oe(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],u=i.chunkSize();if(t=e.first&&tn?X(n,oe(e,n).text.length):Yc(t,oe(e,t.line).text.length)}function Yc(e,t){var n=e.ch;return n==null||n>t?X(e.line,t):n<0?X(e.line,0):e}function Jl(e,t){for(var n=[],r=0;rthis.maxLookAhead&&(this.maxLookAhead=e),t},Zt.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},Zt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Zt.fromSaved=function(e,t,n){return t instanceof Ai?new Zt(e,Lr(e.mode,t.state),n,t.lookAhead):new Zt(e,Lr(e.mode,t),n)},Zt.prototype.save=function(e){var t=e!==!1?Lr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Ai(t,this.maxLookAhead):t};function $l(e,t,n,r){var i=[e.state.modeGen],u={};is(e,t.text,e.doc.mode,n,function(b,w){return i.push(b,w)},u,r);for(var h=n.state,g=function(b){n.baseTokens=i;var w=e.state.overlays[b],k=1,B=0;n.state=!0,is(e,t.text,w.mode,n,function(M,z){for(var R=k;BM&&i.splice(k,1,M,i[k+1],Y),k+=2,B=Math.min(M,Y)}if(z)if(w.opaque)i.splice(R,k-R,M,"overlay "+z),k=R+2;else for(;Re.options.maxHighlightLength&&Lr(e.doc.mode,r.state),u=$l(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=u.styles,u.classes?t.styleClasses=u.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function On(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new Zt(r,!0,t);var u=Zc(e,t,n),h=u>r.first&&oe(r,u-1).stateAfter,g=h?Zt.fromSaved(r,h,u):new Zt(r,Zl(r.mode),u);return r.iter(u,t,function(v){fa(e,v.text,g);var b=g.line;v.stateAfter=b==t-1||b%5==0||b>=i.viewFrom&&bt.start)return u}throw new Error("Mode "+e.name+" failed to advance stream.")}var ts=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function rs(e,t,n,r){var i=e.doc,u=i.mode,h;t=ge(i,t);var g=oe(i,t.line),v=On(e,t.line,n),b=new Ge(g.text,e.options.tabSize,v),w;for(r&&(w=[]);(r||b.pose.options.maxHighlightLength?(g=!1,h&&fa(e,t,r,w.pos),w.pos=t.length,k=null):k=ns(ca(n,w,r.state,B),u),B){var M=B[0].name;M&&(k="m-"+(k?M+" "+k:M))}if(!g||b!=k){for(;vh;--g){if(g<=u.first)return u.first;var v=oe(u,g-1),b=v.stateAfter;if(b&&(!n||g+(b instanceof Ai?b.lookAhead:0)<=u.modeFrontier))return g;var w=Ye(v.text,null,e.options.tabSize);(i==null||r>w)&&(i=g-1,r=w)}return i}function Qc(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontiern;r--){var i=oe(e,r).stateAfter;if(i&&(!(i instanceof Ai)||r+i.lookAhead=t:u.to>t);(r||(r=[])).push(new Fi(h,u.from,v?null:u.to))}}return r}function rd(e,t,n){var r;if(e)for(var i=0;i=t:u.to>t);if(g||u.from==t&&h.type=="bookmark"&&(!n||u.marker.insertLeft)){var v=u.from==null||(h.inclusiveLeft?u.from<=t:u.from0&&g)for(var ne=0;ne0)){var w=[v,1],k=pe(b.from,g.from),B=pe(b.to,g.to);(k<0||!h.inclusiveLeft&&!k)&&w.push({from:b.from,to:g.from}),(B>0||!h.inclusiveRight&&!B)&&w.push({from:g.to,to:b.to}),i.splice.apply(i,w),v+=w.length-3}}return i}function ls(e){var t=e.markedSpans;if(t){for(var n=0;nt)&&(!r||ha(r,u.marker)<0)&&(r=u.marker)}return r}function cs(e,t,n,r,i){var u=oe(e,t),h=rr&&u.markedSpans;if(h)for(var g=0;g=0&&k<=0||w<=0&&k>=0)&&(w<=0&&(v.marker.inclusiveRight&&i.inclusiveLeft?pe(b.to,n)>=0:pe(b.to,n)>0)||w>=0&&(v.marker.inclusiveRight&&i.inclusiveLeft?pe(b.from,r)<=0:pe(b.from,r)<0)))return!0}}}function Rt(e){for(var t;t=fs(e);)e=t.find(-1,!0).line;return e}function od(e){for(var t;t=Mi(e);)e=t.find(1,!0).line;return e}function ad(e){for(var t,n;t=Mi(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function pa(e,t){var n=oe(e,t),r=Rt(n);return n==r?t:Ae(r)}function ds(e,t){if(t>e.lastLine())return t;var n=oe(e,t),r;if(!vr(e,n))return t;for(;r=Mi(n);)n=r.find(1,!0).line;return Ae(n)+1}function vr(e,t){var n=rr&&t.markedSpans;if(n){for(var r=void 0,i=0;it.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var Vr=function(e,t,n){this.text=e,ss(this,t),this.height=n?n(this):1};Vr.prototype.lineNo=function(){return Ae(this)},Qr(Vr);function ld(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),ls(e),ss(e,n);var i=r?r(e):1;i!=e.height&&Yt(e,i)}function sd(e){e.parent=null,ls(e)}var ud={},fd={};function hs(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?fd:ud;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function ps(e,t){var n=H("span",null,null,m?"padding-right: .1px":null),r={pre:H("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var u=i?t.rest[i-1]:t.line,h=void 0;r.pos=0,r.addToken=dd,Wc(e.display.measure)&&(h=tr(u,e.doc.direction))&&(r.addToken=pd(r.addToken,h)),r.map=[];var g=t!=e.display.externalMeasured&&Ae(u);gd(u,r,Vl(e,u,g)),u.styleClasses&&(u.styleClasses.bgClass&&(r.bgClass=Le(u.styleClasses.bgClass,r.bgClass||"")),u.styleClasses.textClass&&(r.textClass=Le(u.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(Rc(e.display.measure))),i==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(m){var v=r.content.lastChild;(/\bcm-tab\b/.test(v.className)||v.querySelector&&v.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return je(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=Le(r.pre.className,r.textClass||"")),r}function cd(e){var t=E("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function dd(e,t,n,r,i,u,h){if(t){var g=e.splitSpaces?hd(t,e.trailingSpace):t,v=e.cm.state.specialChars,b=!1,w;if(!v.test(t))e.col+=t.length,w=document.createTextNode(g),e.map.push(e.pos,e.pos+t.length,w),c&&d<9&&(b=!0),e.pos+=t.length;else{w=document.createDocumentFragment();for(var k=0;;){v.lastIndex=k;var B=v.exec(t),M=B?B.index-k:t.length-k;if(M){var z=document.createTextNode(g.slice(k,k+M));c&&d<9?w.appendChild(E("span",[z])):w.appendChild(z),e.map.push(e.pos,e.pos+M,z),e.col+=M,e.pos+=M}if(!B)break;k+=M+1;var R=void 0;if(B[0]==" "){var Y=e.cm.options.tabSize,Q=Y-e.col%Y;R=w.appendChild(E("span",pr(Q),"cm-tab")),R.setAttribute("role","presentation"),R.setAttribute("cm-text"," "),e.col+=Q}else B[0]=="\r"||B[0]==` -`?(R=w.appendChild(E("span",B[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),R.setAttribute("cm-text",B[0]),e.col+=1):(R=e.cm.options.specialCharPlaceholder(B[0]),R.setAttribute("cm-text",B[0]),c&&d<9?w.appendChild(E("span",[R])):w.appendChild(R),e.col+=1);e.map.push(e.pos,e.pos+1,R),e.pos++}}if(e.trailingSpace=g.charCodeAt(t.length-1)==32,n||r||i||b||u||h){var V=n||"";r&&(V+=r),i&&(V+=i);var J=E("span",[w],V,u);if(h)for(var ne in h)h.hasOwnProperty(ne)&&ne!="style"&&ne!="class"&&J.setAttribute(ne,h[ne]);return e.content.appendChild(J)}e.content.appendChild(w)}}function hd(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;ib&&k.from<=b));B++);if(k.to>=w)return e(n,r,i,u,h,g,v);e(n,r.slice(0,k.to-b),i,u,null,g,v),u=null,r=r.slice(k.to-b),b=k.to}}}function gs(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function gd(e,t,n){var r=e.markedSpans,i=e.text,u=0;if(!r){for(var h=1;hv||xe.collapsed&&ae.to==v&&ae.from==v)){if(ae.to!=null&&ae.to!=v&&M>ae.to&&(M=ae.to,R=""),xe.className&&(z+=" "+xe.className),xe.css&&(B=(B?B+";":"")+xe.css),xe.startStyle&&ae.from==v&&(Y+=" "+xe.startStyle),xe.endStyle&&ae.to==M&&(ne||(ne=[])).push(xe.endStyle,ae.to),xe.title&&((V||(V={})).title=xe.title),xe.attributes)for(var Te in xe.attributes)(V||(V={}))[Te]=xe.attributes[Te];xe.collapsed&&(!Q||ha(Q.marker,xe)<0)&&(Q=ae)}else ae.from>v&&M>ae.from&&(M=ae.from)}if(ne)for(var nt=0;nt=g)break;for(var St=Math.min(g,M);;){if(w){var xt=v+w.length;if(!Q){var Xe=xt>St?w.slice(0,St-v):w;t.addToken(t,Xe,k?k+z:z,Y,v+Xe.length==M?R:"",B,V)}if(xt>=St){w=w.slice(St-v),v=St;break}v=xt,Y=""}w=i.slice(u,u=n[b++]),k=hs(n[b++],t.cm.options)}}}function vs(e,t,n){this.line=t,this.rest=ad(t),this.size=this.rest?Ae(Ce(this.rest))-n+1:1,this.node=this.text=null,this.hidden=vr(e,t)}function Bi(e,t,n){for(var r=[],i,u=t;u2&&u.push((v.bottom+b.top)/2-n.top)}}u.push(n.bottom-n.top)}}function Cs(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var r=0;rn)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}}function Ed(e,t){t=Rt(t);var n=Ae(t),r=e.display.externalMeasured=new vs(e.doc,t,n);r.lineN=n;var i=r.built=ps(e,r);return r.text=i.pre,ee(e.display.lineMeasure,i.pre),r}function ks(e,t,n,r){return Jt(e,tn(e,t),n,r)}function xa(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&tt)&&(u=v-g,i=u-1,t>=v&&(h="right")),i!=null){if(r=e[b+2],g==v&&n==(r.insertLeft?"left":"right")&&(h=n),n=="left"&&i==0)for(;b&&e[b-2]==e[b-3]&&e[b-1].insertLeft;)r=e[(b-=3)+2],h="left";if(n=="right"&&i==v-g)for(;b=0&&(n=e[i]).left==n.right;i--);return n}function Fd(e,t,n,r){var i=Es(t.map,n,r),u=i.node,h=i.start,g=i.end,v=i.collapse,b;if(u.nodeType==3){for(var w=0;w<4;w++){for(;h&&Zo(t.line.text.charAt(i.coverStart+h));)--h;for(;i.coverStart+g0&&(v=r="right");var k;e.options.lineWrapping&&(k=u.getClientRects()).length>1?b=k[r=="right"?k.length-1:0]:b=u.getBoundingClientRect()}if(c&&d<9&&!h&&(!b||!b.left&&!b.right)){var B=u.parentNode.getClientRects()[0];B?b={left:B.left,right:B.left+nn(e.display),top:B.top,bottom:B.bottom}:b=Ss}for(var M=b.top-t.rect.top,z=b.bottom-t.rect.top,R=(M+z)/2,Y=t.view.measure.heights,Q=0;Q=r.text.length?(v=r.text.length,b="before"):v<=0&&(v=0,b="after"),!g)return h(b=="before"?v-1:v,b=="before");function w(z,R,Y){var Q=g[R],V=Q.level==1;return h(Y?z-1:z,V!=Y)}var k=_n(g,v,b),B=Mn,M=w(v,k,b=="before");return B!=null&&(M.other=w(v,B,b!="before")),M}function _s(e,t){var n=0;t=ge(e.doc,t),e.options.lineWrapping||(n=nn(e.display)*t.ch);var r=oe(e.doc,t.line),i=nr(r)+Ni(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function wa(e,t,n,r,i){var u=X(e,t,n);return u.xRel=i,r&&(u.outside=r),u}function Ca(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return wa(r.first,0,null,-1,-1);var i=_r(r,n),u=r.first+r.size-1;if(i>u)return wa(r.first+r.size-1,oe(r,u).text.length,null,1,1);t<0&&(t=0);for(var h=oe(r,i);;){var g=Ld(e,h,i,t,n),v=id(h,g.ch+(g.xRel>0||g.outside>0?1:0));if(!v)return g;var b=v.find(1);if(b.line==i)return b;h=oe(r,i=b.line)}}function Bs(e,t,n,r){r-=Da(t);var i=t.text.length,u=Ln(function(h){return Jt(e,n,h-1).bottom<=r},i,0);return i=Ln(function(h){return Jt(e,n,h).top>r},u,i),{begin:u,end:i}}function Ns(e,t,n,r){n||(n=tn(e,t));var i=Oi(e,t,Jt(e,n,r),"line").top;return Bs(e,t,n,i)}function ka(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Ld(e,t,n,r,i){i-=nr(t);var u=tn(e,t),h=Da(t),g=0,v=t.text.length,b=!0,w=tr(t,e.doc.direction);if(w){var k=(e.options.lineWrapping?_d:Md)(e,t,n,u,w,r,i);b=k.level!=1,g=b?k.from:k.to-1,v=b?k.to:k.from-1}var B=null,M=null,z=Ln(function(se){var ae=Jt(e,u,se);return ae.top+=h,ae.bottom+=h,ka(ae,r,i,!1)?(ae.top<=i&&ae.left<=r&&(B=se,M=ae),!0):!1},g,v),R,Y,Q=!1;if(M){var V=r-M.left=ne.bottom?1:0}return z=jl(t.text,z,1),wa(n,z,Y,Q,r-R)}function Md(e,t,n,r,i,u,h){var g=Ln(function(k){var B=i[k],M=B.level!=1;return ka(Wt(e,X(n,M?B.to:B.from,M?"before":"after"),"line",t,r),u,h,!0)},0,i.length-1),v=i[g];if(g>0){var b=v.level!=1,w=Wt(e,X(n,b?v.from:v.to,b?"after":"before"),"line",t,r);ka(w,u,h,!0)&&w.top>h&&(v=i[g-1])}return v}function _d(e,t,n,r,i,u,h){var g=Bs(e,t,r,h),v=g.begin,b=g.end;/\s/.test(t.text.charAt(b-1))&&b--;for(var w=null,k=null,B=0;B=b||M.to<=v)){var z=M.level!=1,R=Jt(e,r,z?Math.min(b,M.to)-1:Math.max(v,M.from)).right,Y=RY)&&(w=M,k=Y)}}return w||(w=i[i.length-1]),w.fromb&&(w={from:w.from,to:b,level:w.level}),w}var Nr;function rn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Nr==null){Nr=E("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Nr.appendChild(document.createTextNode("x")),Nr.appendChild(E("br"));Nr.appendChild(document.createTextNode("x"))}ee(e.measure,Nr);var n=Nr.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),j(e.measure),n||1}function nn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=E("span","xxxxxxxxxx"),n=E("pre",[t],"CodeMirror-line-like");ee(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Sa(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,u=t.gutters.firstChild,h=0;u;u=u.nextSibling,++h){var g=e.display.gutterSpecs[h].className;n[g]=u.offsetLeft+u.clientLeft+i,r[g]=u.clientWidth}return{fixedPos:Ea(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ea(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Os(e){var t=rn(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/nn(e.display)-3);return function(i){if(vr(e.doc,i))return 0;var u=0;if(i.widgets)for(var h=0;h0&&(b=oe(e.doc,v.line).text).length==v.ch){var w=Ye(b,b.length,e.options.tabSize)-b.length;v=X(v.line,Math.max(0,Math.round((u-ws(e.display).left)/nn(e.display))-w))}return v}function Ir(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var n=e.display.view,r=0;rt)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)rr&&pa(e.doc,t)i.viewFrom?br(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)br(e);else if(t<=i.viewFrom){var u=Pi(e,n,n+r,1);u?(i.view=i.view.slice(u.index),i.viewFrom=u.lineN,i.viewTo+=r):br(e)}else if(n>=i.viewTo){var h=Pi(e,t,t,-1);h?(i.view=i.view.slice(0,h.index),i.viewTo=h.lineN):br(e)}else{var g=Pi(e,t,t,-1),v=Pi(e,n,n+r,1);g&&v?(i.view=i.view.slice(0,g.index).concat(Bi(e,g.lineN,v.lineN)).concat(i.view.slice(v.index)),i.viewTo+=r):br(e)}var b=i.externalMeasured;b&&(n=i.lineN&&t=r.viewTo)){var u=r.view[Ir(e,t)];if(u.node!=null){var h=u.changes||(u.changes=[]);Ne(h,n)==-1&&h.push(n)}}}function br(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Pi(e,t,n,r){var i=Ir(e,t),u,h=e.display.view;if(!rr||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var g=e.display.viewFrom,v=0;v0){if(i==h.length-1)return null;u=g+h[i].size-t,i++}else u=g-t;t+=u,n+=u}for(;pa(e.doc,n)!=n;){if(i==(r<0?0:h.length-1))return null;n+=r*h[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Bd(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=Bi(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Bi(e,t,r.viewFrom).concat(r.view):r.viewFromn&&(r.view=r.view.slice(0,Ir(e,n)))),r.viewTo=n}function Is(e){for(var t=e.display.view,n=0,r=0;r=e.display.viewTo||v.to().line0?h:e.defaultCharWidth())+"px"}if(r.other){var g=n.appendChild(E("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));g.style.display="",g.style.left=r.other.left+"px",g.style.top=r.other.top+"px",g.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function zi(e,t){return e.top-t.top||e.left-t.left}function Nd(e,t,n){var r=e.display,i=e.doc,u=document.createDocumentFragment(),h=ws(e.display),g=h.left,v=Math.max(r.sizerWidth,Br(e)-r.sizer.offsetLeft)-h.right,b=i.direction=="ltr";function w(J,ne,se,ae){ne<0&&(ne=0),ne=Math.round(ne),ae=Math.round(ae),u.appendChild(E("div",null,"CodeMirror-selected","position: absolute; left: "+J+`px; - top: `+ne+"px; width: "+(se??v-J)+`px; - height: `+(ae-ne)+"px"))}function k(J,ne,se){var ae=oe(i,J),xe=ae.text.length,Te,nt;function Pe(Xe,Dt){return Ii(e,X(J,Xe),"div",ae,Dt)}function St(Xe,Dt,ot){var Qe=Ns(e,ae,null,Xe),Ke=Dt=="ltr"==(ot=="after")?"left":"right",Re=ot=="after"?Qe.begin:Qe.end-(/\s/.test(ae.text.charAt(Qe.end-1))?2:1);return Pe(Re,Ke)[Ke]}var xt=tr(ae,i.direction);return Pc(xt,ne||0,se??xe,function(Xe,Dt,ot,Qe){var Ke=ot=="ltr",Re=Pe(Xe,Ke?"left":"right"),wt=Pe(Dt-1,Ke?"right":"left"),mn=ne==null&&Xe==0,kr=se==null&&Dt==xe,st=Qe==0,$t=!xt||Qe==xt.length-1;if(wt.top-Re.top<=3){var it=(b?mn:kr)&&st,tl=(b?kr:mn)&&$t,lr=it?g:(Ke?Re:wt).left,Wr=tl?v:(Ke?wt:Re).right;w(lr,Re.top,Wr-lr,Re.bottom)}else{var qr,dt,bn,rl;Ke?(qr=b&&mn&&st?g:Re.left,dt=b?v:St(Xe,ot,"before"),bn=b?g:St(Dt,ot,"after"),rl=b&&kr&&$t?v:wt.right):(qr=b?St(Xe,ot,"before"):g,dt=!b&&mn&&st?v:Re.right,bn=!b&&kr&&$t?g:wt.left,rl=b?St(Dt,ot,"after"):v),w(qr,Re.top,dt-qr,Re.bottom),Re.bottom0?t.blinker=setInterval(function(){e.hasFocus()||on(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function zs(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Ma(e))}function La(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&on(e))},100)}function Ma(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(je(e,"focus",e,t),e.state.focused=!0,De(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),m&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ta(e))}function on(e,t){e.state.delayingBlurEvent||(e.state.focused&&(je(e,"blur",e,t),e.state.focused=!1,le(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function Hi(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),i=t.lineDiv.getBoundingClientRect().top,u=0,h=0;h.005||M<-.005)&&(ie.display.sizerWidth){var R=Math.ceil(w/nn(e.display));R>e.display.maxLineLength&&(e.display.maxLineLength=R,e.display.maxLine=g.line,e.display.maxLineChanged=!0)}}}Math.abs(u)>2&&(t.scroller.scrollTop+=u)}function Hs(e){if(e.widgets)for(var t=0;t=h&&(u=_r(t,nr(oe(t,v))-e.wrapper.clientHeight),h=v)}return{from:u,to:Math.max(h,u+1)}}function Od(e,t){if(!Ve(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),i=null,u=n.wrapper.ownerDocument;if(t.top+r.top<0?i=!0:t.bottom+r.top>(u.defaultView.innerHeight||u.documentElement.clientHeight)&&(i=!1),i!=null&&!L){var h=E("div","\u200B",null,`position: absolute; - top: `+(t.top-n.viewOffset-Ni(e.display))+`px; - height: `+(t.bottom-t.top+Qt(e)+n.barHeight)+`px; - left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(h),h.scrollIntoView(i),e.display.lineSpace.removeChild(h)}}}function Id(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(n=t.sticky=="before"?X(t.line,t.ch+1,"before"):t,t=t.ch?X(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var u=0;u<5;u++){var h=!1,g=Wt(e,t),v=!n||n==t?g:Wt(e,n);i={left:Math.min(g.left,v.left),top:Math.min(g.top,v.top)-r,right:Math.max(g.left,v.left),bottom:Math.max(g.bottom,v.bottom)+r};var b=_a(e,i),w=e.doc.scrollTop,k=e.doc.scrollLeft;if(b.scrollTop!=null&&(Un(e,b.scrollTop),Math.abs(e.doc.scrollTop-w)>1&&(h=!0)),b.scrollLeft!=null&&(Pr(e,b.scrollLeft),Math.abs(e.doc.scrollLeft-k)>1&&(h=!0)),!h)break}return i}function Pd(e,t){var n=_a(e,t);n.scrollTop!=null&&Un(e,n.scrollTop),n.scrollLeft!=null&&Pr(e,n.scrollLeft)}function _a(e,t){var n=e.display,r=rn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,u=ya(e),h={};t.bottom-t.top>u&&(t.bottom=t.top+u);var g=e.doc.height+ba(n),v=t.topg-r;if(t.topi+u){var w=Math.min(t.top,(b?g:t.bottom)-u);w!=i&&(h.scrollTop=w)}var k=e.options.fixedGutter?0:n.gutters.offsetWidth,B=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-k,M=Br(e)-n.gutters.offsetWidth,z=t.right-t.left>M;return z&&(t.right=t.left+M),t.left<10?h.scrollLeft=0:t.leftM+B-3&&(h.scrollLeft=t.right+(z?0:10)-M),h}function Ba(e,t){t!=null&&(Wi(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function an(e){Wi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function qn(e,t,n){(t!=null||n!=null)&&Wi(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function zd(e,t){Wi(e),e.curOp.scrollToPos=t}function Wi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=_s(e,t.from),r=_s(e,t.to);Rs(e,n,r,t.margin)}}function Rs(e,t,n,r){var i=_a(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});qn(e,i.scrollLeft,i.scrollTop)}function Un(e,t){Math.abs(e.doc.scrollTop-t)<2||(s||Oa(e,{top:t}),Ws(e,t,!0),s&&Oa(e),Xn(e,100))}function Ws(e,t,n){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),!(e.display.scroller.scrollTop==t&&!n)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Pr(e,t,n,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),!((n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)&&(e.doc.scrollLeft=t,Xs(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function jn(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+ba(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Qt(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var zr=function(e,t,n){this.cm=n;var r=this.vert=E("div",[E("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=E("div",[E("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),ue(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),ue(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,c&&d<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};zr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var u=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+u)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},zr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},zr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},zr.prototype.zeroWidthHack=function(){var e=I&&!_?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new ft,this.disableVert=new ft},zr.prototype.enableZeroWidthBar=function(e,t,n){e.style.visibility="";function r(){var i=e.getBoundingClientRect(),u=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);u!=e?e.style.visibility="hidden":t.set(1e3,r)}t.set(1e3,r)},zr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Gn=function(){};Gn.prototype.update=function(){return{bottom:0,right:0}},Gn.prototype.setScrollLeft=function(){},Gn.prototype.setScrollTop=function(){},Gn.prototype.clear=function(){};function ln(e,t){t||(t=jn(e));var n=e.display.barWidth,r=e.display.barHeight;qs(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Hi(e),qs(e,jn(e)),n=e.display.barWidth,r=e.display.barHeight}function qs(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var Us={native:zr,null:Gn};function js(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&le(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Us[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ue(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?Pr(e,t):Un(e,t)},e),e.display.scrollbars.addClass&&De(e.display.wrapper,e.display.scrollbars.addClass)}var Hd=0;function Hr(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Hd,markArrays:null},vd(e.curOp)}function Rr(e){var t=e.curOp;t&&bd(t,function(n){for(var r=0;r=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new qi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function qd(e){e.updatedDisplay=e.mustUpdate&&Na(e.cm,e.update)}function Ud(e){var t=e.cm,n=t.display;e.updatedDisplay&&Hi(t),e.barMeasure=jn(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=ks(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Qt(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Br(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function jd(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)){var n=+new Date+e.options.workTime,r=On(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(u){if(r.line>=e.display.viewFrom){var h=u.styles,g=u.text.length>e.options.maxHighlightLength?Lr(t.mode,r.state):null,v=$l(e,u,r,!0);g&&(r.state=g),u.styles=v.styles;var b=u.styleClasses,w=v.classes;w?u.styleClasses=w:b&&(u.styleClasses=null);for(var k=!h||h.length!=u.styles.length||b!=w&&(!b||!w||b.bgClass!=w.bgClass||b.textClass!=w.textClass),B=0;!k&&Bn)return Xn(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&kt(e,function(){for(var u=0;u=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&Is(e)==0)return!1;Ks(e)&&(br(e),t.dims=Sa(e));var i=r.first+r.size,u=Math.max(t.visible.from-e.options.viewportMargin,r.first),h=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFromh&&n.viewTo-h<20&&(h=Math.min(i,n.viewTo)),rr&&(u=pa(e.doc,u),h=ds(e.doc,h));var g=u!=n.viewFrom||h!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Bd(e,u,h),n.viewOffset=nr(oe(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var v=Is(e);if(!g&&v==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var b=Yd(e);return v>4&&(n.lineDiv.style.display="none"),Qd(e,n.updateLineNumbers,t.dims),v>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,Zd(b),j(n.cursorDiv),j(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,g&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,Xn(e,400)),n.updateLineNumbers=null,!0}function Gs(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==Br(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ba(e.display)-ya(e),n.top)}),t.visible=Ri(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Ri(e.display,e.doc,n));if(!Na(e,t))break;Hi(e);var i=jn(e);Wn(e),ln(e,i),Pa(e,i),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Oa(e,t){var n=new qi(e,t);if(Na(e,n)){Hi(e),Gs(e,n);var r=jn(e);Wn(e),ln(e,r),Pa(e,r),n.finish()}}function Qd(e,t,n){var r=e.display,i=e.options.lineNumbers,u=r.lineDiv,h=u.firstChild;function g(z){var R=z.nextSibling;return m&&I&&e.display.currentWheelTarget==z?z.style.display="none":z.parentNode.removeChild(z),R}for(var v=r.view,b=r.viewFrom,w=0;w-1&&(M=!1),ms(e,k,b,n)),M&&(j(k.lineNumber),k.lineNumber.appendChild(document.createTextNode(la(e.options,b)))),h=k.node.nextSibling}b+=k.size}for(;h;)h=g(h)}function Ia(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",et(e,"gutterChanged",e)}function Pa(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Qt(e)+"px"}function Xs(e){var t=e.display,n=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var r=Ea(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,u=r+"px",h=0;hg.clientWidth,b=g.scrollHeight>g.clientHeight;if(r&&v||i&&b){if(i&&I&&m){e:for(var w=t.target,k=h.view;w!=g;w=w.parentNode)for(var B=0;B=0&&pe(e,r.to())<=0)return n}return-1};var Ee=function(e,t){this.anchor=e,this.head=t};Ee.prototype.from=function(){return Ei(this.anchor,this.head)},Ee.prototype.to=function(){return Si(this.anchor,this.head)},Ee.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function qt(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(B,M){return pe(B.from(),M.from())}),n=Ne(t,i);for(var u=1;u0:v>=0){var b=Ei(g.from(),h.from()),w=Si(g.to(),h.to()),k=g.empty()?h.from()==h.head:g.from()==g.head;u<=n&&--n,t.splice(--u,2,new Ee(k?w:b,k?b:w))}}return new Mt(t,n)}function yr(e,t){return new Mt([new Ee(e,t||e)],0)}function xr(e){return e.text?X(e.from.line+e.text.length-1,Ce(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Js(e,t){if(pe(e,t.from)<0)return e;if(pe(e,t.to)<=0)return xr(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=xr(t).ch-t.to.ch),X(n,r)}function Ha(e,t){for(var n=[],r=0;r1&&e.remove(g.line+1,z-1),e.insert(g.line+1,Q)}et(e,"change",e,t)}function Dr(e,t,n){function r(i,u,h){if(i.linked)for(var g=0;g1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Ce(e.done)}function nu(e,t,n,r){var i=e.history;i.undone.length=0;var u=+new Date,h,g;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>u-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(h=th(i,i.lastOp==r)))g=Ce(h.changes),pe(t.from,t.to)==0&&pe(t.from,g.to)==0?g.to=xr(t):h.changes.push(qa(e,t));else{var v=Ce(i.done);for((!v||!v.ranges)&&Gi(e.sel,i.done),h={changes:[qa(e,t)],generation:i.generation},i.done.push(h);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=u,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,g||je(e,"historyAdded")}function rh(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function nh(e,t,n,r){var i=e.history,u=r&&r.origin;n==i.lastSelOp||u&&i.lastSelOrigin==u&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==u||rh(e,u,Ce(i.done),t))?i.done[i.done.length-1]=t:Gi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=u,i.lastSelOp=n,r&&r.clearRedo!==!1&&ru(i.undone)}function Gi(e,t){var n=Ce(t);n&&n.ranges&&n.equals(e)||t.push(e)}function iu(e,t,n,r){var i=t["spans_"+e.id],u=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(h){h.markedSpans&&((i||(i=t["spans_"+e.id]={}))[u]=h.markedSpans),++u})}function ih(e){if(!e)return null;for(var t,n=0;n-1&&(Ce(g)[k]=b[k],delete b[k])}}return r}function Ua(e,t,n,r){if(r){var i=e.anchor;if(n){var u=pe(t,i)<0;u!=pe(n,i)<0?(i=t,t=n):u!=pe(t,n)<0&&(t=n)}return new Ee(i,t)}else return new Ee(n||t,t)}function Xi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),lt(e,new Mt([Ua(e.sel.primary(),t,n,i)],0),r)}function au(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),u=0;u=t.ch:g.to>t.ch))){if(i&&(je(v,"beforeCursorEnter"),v.explicitlyCleared))if(u.markedSpans){--h;continue}else break;if(!v.atomic)continue;if(n){var k=v.find(r<0?1:-1),B=void 0;if((r<0?w:b)&&(k=du(e,k,-r,k&&k.line==t.line?u:null)),k&&k.line==t.line&&(B=pe(k,n))&&(r<0?B<0:B>0))return un(e,k,t,r,i)}var M=v.find(r<0?-1:1);return(r<0?b:w)&&(M=du(e,M,r,M.line==t.line?u:null)),M?un(e,M,t,r,i):null}}return t}function Yi(e,t,n,r,i){var u=r||1,h=un(e,t,n,u,i)||!i&&un(e,t,n,u,!0)||un(e,t,n,-u,i)||!i&&un(e,t,n,-u,!0);return h||(e.cantEdit=!0,X(e.first,0))}function du(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?ge(e,X(t.line-1)):null:n>0&&t.ch==(r||oe(e,t.line)).text.length?t.line=0;--i)gu(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else gu(e,t)}}function gu(e,t){if(!(t.text.length==1&&t.text[0]==""&&pe(t.from,t.to)==0)){var n=Ha(e,t);nu(e,t,n,e.cm?e.cm.curOp.id:NaN),Zn(e,t,n,da(e,t));var r=[];Dr(e,function(i,u){!u&&Ne(r,i.history)==-1&&(yu(i.history,t),r.push(i.history)),Zn(i,t,null,da(i,t))})}}function Zi(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(!(r&&!n)){for(var i=e.history,u,h=e.sel,g=t=="undo"?i.done:i.undone,v=t=="undo"?i.undone:i.done,b=0;b=0;--M){var z=B(M);if(z)return z.v}}}}function vu(e,t){if(t!=0&&(e.first+=t,e.sel=new Mt(Ht(e.sel.ranges,function(i){return new Ee(X(i.anchor.line+t,i.anchor.ch),X(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm)){bt(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;re.lastLine())){if(t.from.lineu&&(t={from:t.from,to:X(u,oe(e,u).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Mr(e,t.from,t.to),n||(n=Ha(e,t)),e.cm?lh(e.cm,t,r):Wa(e,t,r),Ki(e,n,vt),e.cantEdit&&Yi(e,X(e.firstLine(),0))&&(e.cantEdit=!1)}}function lh(e,t,n){var r=e.doc,i=e.display,u=t.from,h=t.to,g=!1,v=u.line;e.options.lineWrapping||(v=Ae(Rt(oe(r,u.line))),r.iter(v,h.line+1,function(M){if(M==i.maxLine)return g=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Xl(e),Wa(r,t,n,Os(e)),e.options.lineWrapping||(r.iter(v,u.line+t.text.length,function(M){var z=_i(M);z>i.maxLineLength&&(i.maxLine=M,i.maxLineLength=z,i.maxLineChanged=!0,g=!1)}),g&&(e.curOp.updateMaxLine=!0)),Qc(r,u.line),Xn(e,400);var b=t.text.length-(h.line-u.line)-1;t.full?bt(e):u.line==h.line&&t.text.length==1&&!Vs(e.doc,t)?mr(e,u.line,"text"):bt(e,u.line,h.line+1,b);var w=It(e,"changes"),k=It(e,"change");if(k||w){var B={from:u,to:h,text:t.text,removed:t.removed,origin:t.origin};k&&et(e,"change",e,B),w&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(B)}e.display.selForContextMenu=null}function cn(e,t,n,r,i){var u;r||(r=n),pe(r,n)<0&&(u=[r,n],n=u[0],r=u[1]),typeof t=="string"&&(t=e.splitLines(t)),fn(e,{from:n,to:r,text:t,origin:i})}function mu(e,t,n,r){n1||!(this.children[0]instanceof Jn))){var g=[];this.collapse(g),this.children=[new Jn(g)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var h=i.lines.length%25+25,g=h;g10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;re.display.maxLineLength&&(e.display.maxLine=b,e.display.maxLineLength=w,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&bt(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&fu(e.doc)),e&&et(e,"markerCleared",e,this,r,i),t&&Rr(e),this.parent&&this.parent.clear()}},wr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i0||h==0&&u.clearWhenEmpty!==!1)return u;if(u.replacedWith&&(u.collapsed=!0,u.widgetNode=H("span",[u.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||u.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(u.widgetNode.insertLeft=!0)),u.collapsed){if(cs(e,t.line,t,n,u)||t.line!=n.line&&cs(e,n.line,t,n,u))throw new Error("Inserting collapsed marker partially overlapping an existing one");$c()}u.addToHistory&&nu(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var g=t.line,v=e.cm,b;if(e.iter(g,n.line+1,function(k){v&&u.collapsed&&!v.options.lineWrapping&&Rt(k)==v.display.maxLine&&(b=!0),u.collapsed&&g!=t.line&&Yt(k,0),ed(k,new Fi(u,g==t.line?t.ch:null,g==n.line?n.ch:null),e.cm&&e.cm.curOp),++g}),u.collapsed&&e.iter(t.line,n.line+1,function(k){vr(e,k)&&Yt(k,0)}),u.clearOnEnter&&ue(u,"beforeCursorEnter",function(){return u.clear()}),u.readOnly&&(Jc(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),u.collapsed&&(u.id=++Du,u.atomic=!0),v){if(b&&(v.curOp.updateMaxLine=!0),u.collapsed)bt(v,t.line,n.line+1);else if(u.className||u.startStyle||u.endStyle||u.css||u.attributes||u.title)for(var w=t.line;w<=n.line;w++)mr(v,w,"text");u.atomic&&fu(v.doc),et(v,"markerAdded",v,u)}return u}var ei=function(e,t){this.markers=e,this.primary=t;for(var n=0;n=0;v--)fn(this,r[v]);g?su(this,g):this.cm&&an(this.cm)}),undo:rt(function(){Zi(this,"undo")}),redo:rt(function(){Zi(this,"redo")}),undoSelection:rt(function(){Zi(this,"undo",!0)}),redoSelection:rt(function(){Zi(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=ge(this,e),t=ge(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(u){var h=u.markedSpans;if(h)for(var g=0;g=v.to||v.from==null&&i!=e.line||v.from!=null&&i==t.line&&v.from>=t.ch)&&(!n||n(v.marker))&&r.push(v.marker.parent||v.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;re)return t=e,!0;e-=u,++n}),ge(this,X(n,t))},indexFromPos:function(e){e=ge(this,e);var t=e.ch;if(e.linet&&(t=e.from),e.to!=null&&e.to-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var w=e.dataTransfer.getData("Text");if(w){var k;if(t.state.draggingText&&!t.state.draggingText.copy&&(k=t.listSelections()),Ki(t.doc,yr(n,n)),k)for(var B=0;B=0;g--)cn(e.doc,"",r[g].from,r[g].to,"+delete");an(e)})}function Ga(e,t,n){var r=jl(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Xa(e,t,n){var r=Ga(e,t.ch,n);return r==null?null:new X(t.line,r,n<0?"after":"before")}function Ka(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var u=tr(n,t.doc.direction);if(u){var h=i<0?Ce(u):u[0],g=i<0==(h.level==1),v=g?"after":"before",b;if(h.level>0||t.doc.direction=="rtl"){var w=tn(t,n);b=i<0?n.text.length-1:0;var k=Jt(t,w,b).top;b=Ln(function(B){return Jt(t,w,B).top==k},i<0==(h.level==1)?h.from:h.to-1,b),v=="before"&&(b=Ga(n,b,1))}else b=i<0?h.to:h.from;return new X(r,b,v)}}return new X(r,i<0?n.text.length:0,i<0?"before":"after")}function Dh(e,t,n,r){var i=tr(t,e.doc.direction);if(!i)return Xa(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var u=_n(i,n.ch,n.sticky),h=i[u];if(e.doc.direction=="ltr"&&h.level%2==0&&(r>0?h.to>n.ch:h.from=h.from&&B>=w.begin)){var M=k?"before":"after";return new X(n.line,B,M)}}var z=function(Q,V,J){for(var ne=function(Te,nt){return nt?new X(n.line,g(Te,1),"before"):new X(n.line,Te,"after")};Q>=0&&Q0==(se.level!=1),xe=ae?J.begin:g(J.end,-1);if(se.from<=xe&&xe0?w.end:g(w.begin,-1);return Y!=null&&!(r>0&&Y==t.text.length)&&(R=z(r>0?0:i.length-1,r,b(Y)),R)?R:null}var ni={selectAll:hu,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),vt)},killLine:function(e){return pn(e,function(t){if(t.empty()){var n=oe(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line0)i=new X(i.line,i.ch+1),e.replaceRange(u.charAt(i.ch-1)+u.charAt(i.ch-2),X(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var h=oe(e.doc,i.line-1).text;h&&(i=new X(i.line,1),e.replaceRange(u.charAt(0)+e.doc.lineSeparator()+h.charAt(h.length-1),X(i.line-1,h.length-1),i,"+transpose"))}}n.push(new Ee(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return kt(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;re&&pe(t,this.pos)==0&&n==this.button};var oi,ai;function Fh(e,t){var n=+new Date;return ai&&ai.compare(n,e,t)?(oi=ai=null,"triple"):oi&&oi.compare(n,e,t)?(ai=new Za(n,e,t),oi=null,"double"):(oi=new Za(n,e,t),ai=null,"single")}function Pu(e){var t=this,n=t.display;if(!(Ve(t,e)||n.activeTouch&&n.input.supportsTouch())){if(n.input.ensurePolled(),n.shift=e.shiftKey,ir(n,e)){m||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(!Qa(t,e)){var r=Or(t,e),i=Yl(e),u=r?Fh(r,i):"single";ye(t).focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&Th(t,i,r,u,e))&&(i==1?r?Mh(t,r,u,e):$o(e)==n.scroller&&mt(e):i==2?(r&&Xi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(me?t.display.input.onContextMenu(e):La(t)))}}}function Th(e,t,n,r,i){var u="Click";return r=="double"?u="Double"+u:r=="triple"&&(u="Triple"+u),u=(t==1?"Left":t==2?"Middle":"Right")+u,ii(e,Fu(u,i),i,function(h){if(typeof h=="string"&&(h=ni[h]),!h)return!1;var g=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),g=h(e,n)!=Ze}finally{e.state.suppressEdits=!1}return g})}function Lh(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var u=P?n.shiftKey&&n.metaKey:n.altKey;i.unit=u?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=I?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(I?n.altKey:n.ctrlKey)),i}function Mh(e,t,n,r){c?setTimeout(gt(zs,e),0):e.curOp.focus=ve(te(e));var i=Lh(e,n,r),u=e.doc.sel,h;e.options.dragDrop&&Hc&&!e.isReadOnly()&&n=="single"&&(h=u.contains(t))>-1&&(pe((h=u.ranges[h]).from(),t)<0||t.xRel>0)&&(pe(h.to(),t)>0||t.xRel<0)?_h(e,r,t,i):Bh(e,r,t,i)}function _h(e,t,n,r){var i=e.display,u=!1,h=tt(e,function(b){m&&(i.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:La(e)),Lt(i.wrapper.ownerDocument,"mouseup",h),Lt(i.wrapper.ownerDocument,"mousemove",g),Lt(i.scroller,"dragstart",v),Lt(i.scroller,"drop",h),u||(mt(b),r.addNew||Xi(e.doc,n,null,null,r.extend),m&&!F||c&&d==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),g=function(b){u=u||Math.abs(t.clientX-b.clientX)+Math.abs(t.clientY-b.clientY)>=10},v=function(){return u=!0};m&&(i.scroller.draggable=!0),e.state.draggingText=h,h.copy=!r.moveOnDrag,ue(i.wrapper.ownerDocument,"mouseup",h),ue(i.wrapper.ownerDocument,"mousemove",g),ue(i.scroller,"dragstart",v),ue(i.scroller,"drop",h),e.state.delayingBlurEvent=!0,setTimeout(function(){return i.input.focus()},20),i.scroller.dragDrop&&i.scroller.dragDrop()}function zu(e,t,n){if(n=="char")return new Ee(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new Ee(X(t.line,0),ge(e.doc,X(t.line+1,0)));var r=n(e,t);return new Ee(r.from,r.to)}function Bh(e,t,n,r){c&&La(e);var i=e.display,u=e.doc;mt(t);var h,g,v=u.sel,b=v.ranges;if(r.addNew&&!r.extend?(g=u.sel.contains(n),g>-1?h=b[g]:h=new Ee(n,n)):(h=u.sel.primary(),g=u.sel.primIndex),r.unit=="rectangle")r.addNew||(h=new Ee(n,n)),n=Or(e,t,!0,!0),g=-1;else{var w=zu(e,n,r.unit);r.extend?h=Ua(h,w.anchor,w.head,r.extend):h=w}r.addNew?g==-1?(g=b.length,lt(u,qt(e,b.concat([h]),g),{scroll:!1,origin:"*mouse"})):b.length>1&&b[g].empty()&&r.unit=="char"&&!r.extend?(lt(u,qt(e,b.slice(0,g).concat(b.slice(g+1)),0),{scroll:!1,origin:"*mouse"}),v=u.sel):ja(u,g,h,Tn):(g=0,lt(u,new Mt([h],0),Tn),v=u.sel);var k=n;function B(J){if(pe(k,J)!=0)if(k=J,r.unit=="rectangle"){for(var ne=[],se=e.options.tabSize,ae=Ye(oe(u,n.line).text,n.ch,se),xe=Ye(oe(u,J.line).text,J.ch,se),Te=Math.min(ae,xe),nt=Math.max(ae,xe),Pe=Math.min(n.line,J.line),St=Math.min(e.lastLine(),Math.max(n.line,J.line));Pe<=St;Pe++){var xt=oe(u,Pe).text,Xe=Kt(xt,Te,se);Te==nt?ne.push(new Ee(X(Pe,Xe),X(Pe,Xe))):xt.length>Xe&&ne.push(new Ee(X(Pe,Xe),X(Pe,Kt(xt,nt,se))))}ne.length||ne.push(new Ee(n,n)),lt(u,qt(e,v.ranges.slice(0,g).concat(ne),g),{origin:"*mouse",scroll:!1}),e.scrollIntoView(J)}else{var Dt=h,ot=zu(e,J,r.unit),Qe=Dt.anchor,Ke;pe(ot.anchor,Qe)>0?(Ke=ot.head,Qe=Ei(Dt.from(),ot.anchor)):(Ke=ot.anchor,Qe=Si(Dt.to(),ot.head));var Re=v.ranges.slice(0);Re[g]=Nh(e,new Ee(ge(u,Qe),Ke)),lt(u,qt(e,Re,g),Tn)}}var M=i.wrapper.getBoundingClientRect(),z=0;function R(J){var ne=++z,se=Or(e,J,!0,r.unit=="rectangle");if(se)if(pe(se,k)!=0){e.curOp.focus=ve(te(e)),B(se);var ae=Ri(i,u);(se.line>=ae.to||se.lineM.bottom?20:0;xe&&setTimeout(tt(e,function(){z==ne&&(i.scroller.scrollTop+=xe,R(J))}),50)}}function Y(J){e.state.selectingText=!1,z=1/0,J&&(mt(J),i.input.focus()),Lt(i.wrapper.ownerDocument,"mousemove",Q),Lt(i.wrapper.ownerDocument,"mouseup",V),u.history.lastSelOrigin=null}var Q=tt(e,function(J){J.buttons===0||!Yl(J)?Y(J):R(J)}),V=tt(e,Y);e.state.selectingText=V,ue(i.wrapper.ownerDocument,"mousemove",Q),ue(i.wrapper.ownerDocument,"mouseup",V)}function Nh(e,t){var n=t.anchor,r=t.head,i=oe(e.doc,n.line);if(pe(n,r)==0&&n.sticky==r.sticky)return t;var u=tr(i);if(!u)return t;var h=_n(u,n.ch,n.sticky),g=u[h];if(g.from!=n.ch&&g.to!=n.ch)return t;var v=h+(g.from==n.ch==(g.level!=1)?0:1);if(v==0||v==u.length)return t;var b;if(r.line!=n.line)b=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var w=_n(u,r.ch,r.sticky),k=w-h||(r.ch-n.ch)*(g.level==1?-1:1);w==v-1||w==v?b=k<0:b=k>0}var B=u[v+(b?-1:0)],M=b==(B.level==1),z=M?B.from:B.to,R=M?"after":"before";return n.ch==z&&n.sticky==R?t:new Ee(new X(n.line,z,R),r)}function Hu(e,t,n,r){var i,u;if(t.touches)i=t.touches[0].clientX,u=t.touches[0].clientY;else try{i=t.clientX,u=t.clientY}catch{return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&mt(t);var h=e.display,g=h.lineDiv.getBoundingClientRect();if(u>g.bottom||!It(e,n))return Jo(t);u-=g.top-h.viewOffset;for(var v=0;v=i){var w=_r(e.doc,u),k=e.display.gutterSpecs[v];return je(e,n,e,w,k.className,t),Jo(t)}}}function Qa(e,t){return Hu(e,t,"gutterClick",!0)}function Ru(e,t){ir(e.display,t)||Oh(e,t)||Ve(e,t,"contextmenu")||me||e.display.input.onContextMenu(t)}function Oh(e,t){return It(e,"gutterContextMenu")?Hu(e,t,"gutterContextMenu",!1):!1}function Wu(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Rn(e)}var gn={toString:function(){return"CodeMirror.Init"}},qu={},Vi={};function Ih(e){var t=e.optionHandlers;function n(r,i,u,h){e.defaults[r]=i,u&&(t[r]=h?function(g,v,b){b!=gn&&u(g,v,b)}:u)}e.defineOption=n,e.Init=gn,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,Ra(r)},!0),n("indentUnit",2,Ra,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){Yn(r),Rn(r),bt(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!!i){var u=[],h=r.doc.first;r.doc.iter(function(v){for(var b=0;;){var w=v.text.indexOf(i,b);if(w==-1)break;b=w+i.length,u.push(X(h,w))}h++});for(var g=u.length-1;g>=0;g--)cn(r.doc,i,u[g],X(u[g].line,u[g].ch+i.length))}}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(r,i,u){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),u!=gn&&r.refresh()}),n("specialCharPlaceholder",cd,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",N?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!q),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){Wu(r),Kn(r)},!0),n("keyMap","default",function(r,i,u){var h=Ji(i),g=u!=gn&&Ji(u);g&&g.detach&&g.detach(r,h),h.attach&&h.attach(r,g||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,zh,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=za(i,r.options.lineNumbers),Kn(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?Ea(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return ln(r)},!0),n("scrollbarStyle","native",function(r){js(r),ln(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=za(r.options.gutters,i),Kn(r)},!0),n("firstLineNumber",1,Kn,!0),n("lineNumberFormatter",function(r){return r},Kn,!0),n("showCursorWhenSelecting",!1,Wn,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(on(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Ph),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,Wn,!0),n("singleCursorHeightPerLine",!0,Wn,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Yn,!0),n("addModeClass",!1,Yn,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,Yn,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Ph(e,t,n){var r=n&&n!=gn;if(!t!=!r){var i=e.display.dragFunctions,u=t?ue:Lt;u(e.display.scroller,"dragstart",i.start),u(e.display.scroller,"dragenter",i.enter),u(e.display.scroller,"dragover",i.over),u(e.display.scroller,"dragleave",i.leave),u(e.display.scroller,"drop",i.drop)}}function zh(e){e.options.lineWrapping?(De(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(le(e.display.wrapper,"CodeMirror-wrap"),va(e)),Aa(e),bt(e),Rn(e),setTimeout(function(){return ln(e)},100)}function Oe(e,t){var n=this;if(!(this instanceof Oe))return new Oe(e,t);this.options=t=t?Tt(t):{},Tt(qu,t,!1);var r=t.value;typeof r=="string"?r=new yt(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Oe.inputStyles[t.inputStyle](this),u=this.display=new Jd(e,r,i,t);u.wrapper.CodeMirror=this,Wu(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),js(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new ft,keySeq:null,specialChars:null},t.autofocus&&!N&&u.input.focus(),c&&d<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Hh(this),vh(),Hr(this),this.curOp.forceUpdate=!0,eu(this,r),t.autofocus&&!N||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Ma(n)},20):on(this);for(var h in Vi)Vi.hasOwnProperty(h)&&Vi[h](this,t[h],gn);Ks(this),t.finishInit&&t.finishInit(this);for(var g=0;g20*20}ue(t.scroller,"touchstart",function(v){if(!Ve(e,v)&&!u(v)&&!Qa(e,v)){t.input.ensurePolled(),clearTimeout(n);var b=+new Date;t.activeTouch={start:b,moved:!1,prev:b-r.end<=300?r:null},v.touches.length==1&&(t.activeTouch.left=v.touches[0].pageX,t.activeTouch.top=v.touches[0].pageY)}}),ue(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),ue(t.scroller,"touchend",function(v){var b=t.activeTouch;if(b&&!ir(t,v)&&b.left!=null&&!b.moved&&new Date-b.start<300){var w=e.coordsChar(t.activeTouch,"page"),k;!b.prev||h(b,b.prev)?k=new Ee(w,w):!b.prev.prev||h(b,b.prev.prev)?k=e.findWordAt(w):k=new Ee(X(w.line,0),ge(e.doc,X(w.line+1,0))),e.setSelection(k.anchor,k.head),e.focus(),mt(v)}i()}),ue(t.scroller,"touchcancel",i),ue(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Un(e,t.scroller.scrollTop),Pr(e,t.scroller.scrollLeft,!0),je(e,"scroll",e))}),ue(t.scroller,"mousewheel",function(v){return Qs(e,v)}),ue(t.scroller,"DOMMouseScroll",function(v){return Qs(e,v)}),ue(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(v){Ve(e,v)||Bn(v)},over:function(v){Ve(e,v)||(gh(e,v),Bn(v))},start:function(v){return ph(e,v)},drop:tt(e,hh),leave:function(v){Ve(e,v)||ku(e)}};var g=t.input.getField();ue(g,"keyup",function(v){return Ou.call(e,v)}),ue(g,"keydown",tt(e,Nu)),ue(g,"keypress",tt(e,Iu)),ue(g,"focus",function(v){return Ma(e,v)}),ue(g,"blur",function(v){return on(e,v)})}var Ja=[];Oe.defineInitHook=function(e){return Ja.push(e)};function li(e,t,n,r){var i=e.doc,u;n==null&&(n="add"),n=="smart"&&(i.mode.indent?u=On(e,t).state:n="prev");var h=e.options.tabSize,g=oe(i,t),v=Ye(g.text,null,h);g.stateAfter&&(g.stateAfter=null);var b=g.text.match(/^\s*/)[0],w;if(!r&&!/\S/.test(g.text))w=0,n="not";else if(n=="smart"&&(w=i.mode.indent(u,g.text.slice(b.length),g.text),w==Ze||w>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?w=Ye(oe(i,t-1).text,null,h):w=0:n=="add"?w=v+e.options.indentUnit:n=="subtract"?w=v-e.options.indentUnit:typeof n=="number"&&(w=v+n),w=Math.max(0,w);var k="",B=0;if(e.options.indentWithTabs)for(var M=Math.floor(w/h);M;--M)B+=h,k+=" ";if(Bh,v=ta(t),b=null;if(g&&r.ranges.length>1)if(Ut&&Ut.text.join(` -`)==t){if(r.ranges.length%Ut.text.length==0){b=[];for(var w=0;w=0;B--){var M=r.ranges[B],z=M.from(),R=M.to();M.empty()&&(n&&n>0?z=X(z.line,z.ch-n):e.state.overwrite&&!g?R=X(R.line,Math.min(oe(u,R.line).text.length,R.ch+Ce(v).length)):g&&Ut&&Ut.lineWise&&Ut.text.join(` -`)==v.join(` -`)&&(z=R=X(z.line,0)));var Y={from:z,to:R,text:b?b[B%b.length]:v,origin:i||(g?"paste":e.state.cutIncoming>h?"cut":"+input")};fn(e.doc,Y),et(e,"inputRead",e,Y)}t&&!g&&ju(e,t),an(e),e.curOp.updateInput<2&&(e.curOp.updateInput=k),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Uu(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&kt(t,function(){return $a(t,n,0,null,"paste")}),!0}function ju(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var u=e.getModeAt(i.head),h=!1;if(u.electricChars){for(var g=0;g-1){h=li(e,i.head.line,"smart");break}}else u.electricInput&&u.electricInput.test(oe(e.doc,i.head.line).text.slice(0,i.head.ch))&&(h=li(e,i.head.line,"smart"));h&&et(e,"electricInput",e,i.head.line)}}}function Gu(e){for(var t=[],n=[],r=0;ru&&(li(this,g.head.line,r,!0),u=g.head.line,h==this.doc.sel.primIndex&&an(this));else{var v=g.from(),b=g.to(),w=Math.max(u,v.line);u=Math.min(this.lastLine(),b.line-(b.ch?0:1))+1;for(var k=w;k0&&ja(this.doc,h,new Ee(v,B[h].to()),vt)}}}),getTokenAt:function(r,i){return rs(this,r,i)},getLineTokens:function(r,i){return rs(this,X(r),i,!0)},getTokenTypeAt:function(r){r=ge(this.doc,r);var i=Vl(this,oe(this.doc,r.line)),u=0,h=(i.length-1)/2,g=r.ch,v;if(g==0)v=i[2];else for(;;){var b=u+h>>1;if((b?i[b*2-1]:0)>=g)h=b;else if(i[b*2+1]v&&(r=v,h=!0),g=oe(this.doc,r)}else g=r;return Oi(this,g,{top:0,left:0},i||"page",u||h).top+(h?this.doc.height-nr(g):0)},defaultTextHeight:function(){return rn(this.display)},defaultCharWidth:function(){return nn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,u,h,g){var v=this.display;r=Wt(this,ge(this.doc,r));var b=r.bottom,w=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),v.sizer.appendChild(i),h=="over")b=r.top;else if(h=="above"||h=="near"){var k=Math.max(v.wrapper.clientHeight,this.doc.height),B=Math.max(v.sizer.clientWidth,v.lineSpace.clientWidth);(h=="above"||r.bottom+i.offsetHeight>k)&&r.top>i.offsetHeight?b=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=k&&(b=r.bottom),w+i.offsetWidth>B&&(w=B-i.offsetWidth)}i.style.top=b+"px",i.style.left=i.style.right="",g=="right"?(w=v.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(g=="left"?w=0:g=="middle"&&(w=(v.sizer.clientWidth-i.offsetWidth)/2),i.style.left=w+"px"),u&&Pd(this,{left:w,top:b,right:w+i.offsetWidth,bottom:b+i.offsetHeight})},triggerOnKeyDown:ct(Nu),triggerOnKeyPress:ct(Iu),triggerOnKeyUp:Ou,triggerOnMouseDown:ct(Pu),execCommand:function(r){if(ni.hasOwnProperty(r))return ni[r].call(null,this)},triggerElectric:ct(function(r){ju(this,r)}),findPosH:function(r,i,u,h){var g=1;i<0&&(g=-1,i=-i);for(var v=ge(this.doc,r),b=0;b0&&w(u.charAt(h-1));)--h;for(;g.5||this.options.lineWrapping)&&Aa(this),je(this,"refresh",this)}),swapDoc:ct(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),eu(this,r),Rn(this),this.display.input.reset(),qn(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,et(this,"swapDoc",this,i),i}),phrase:function(r){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,r)?i[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Qr(e),e.registerHelper=function(r,i,u){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=u},e.registerGlobalHelper=function(r,i,u,h){e.registerHelper(r,i,h),n[r]._global.push({pred:u,val:h})}}function el(e,t,n,r,i){var u=t,h=n,g=oe(e,t.line),v=i&&e.direction=="rtl"?-n:n;function b(){var V=t.line+v;return V=e.first+e.size?!1:(t=new X(V,t.ch,t.sticky),g=oe(e,V))}function w(V){var J;if(r=="codepoint"){var ne=g.text.charCodeAt(t.ch+(n>0?0:-1));if(isNaN(ne))J=null;else{var se=n>0?ne>=55296&&ne<56320:ne>=56320&&ne<57343;J=new X(t.line,Math.max(0,Math.min(g.text.length,t.ch+n*(se?2:1))),-n)}}else i?J=Dh(e.cm,g,t,n):J=Xa(g,t,n);if(J==null)if(!V&&b())t=Ka(i,e.cm,g,t.line,v);else return!1;else t=J;return!0}if(r=="char"||r=="codepoint")w();else if(r=="column")w(!0);else if(r=="word"||r=="group")for(var k=null,B=r=="group",M=e.cm&&e.cm.getHelper(t,"wordChars"),z=!0;!(n<0&&!w(!z));z=!1){var R=g.text.charAt(t.ch)||` -`,Y=Ci(R,M)?"w":B&&R==` -`?"n":!B||/\s/.test(R)?null:"p";if(B&&!z&&!Y&&(Y="s"),k&&k!=Y){n<0&&(n=1,w(),t.sticky="after");break}if(Y&&(k=Y),n>0&&!w(!z))break}var Q=Yi(e,t,u,h,!0);return sa(u,Q)&&(Q.hitSide=!0),Q}function Ku(e,t,n,r){var i=e.doc,u=t.left,h;if(r=="page"){var g=Math.min(e.display.wrapper.clientHeight,ye(e).innerHeight||i(e).documentElement.clientHeight),v=Math.max(g-.5*rn(e.display),3);h=(n>0?t.bottom:t.top)+n*v}else r=="line"&&(h=n>0?t.bottom+3:t.top-3);for(var b;b=Ca(e,u,h),!!b.outside;){if(n<0?h<=0:h>=i.height){b.hitSide=!0;break}h+=n*5}return b}var Fe=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ft,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Fe.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;i.contentEditable=!0,Va(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function u(g){for(var v=g.target;v;v=v.parentNode){if(v==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(v.className))break}return!1}ue(i,"paste",function(g){!u(g)||Ve(r,g)||Uu(g,r)||d<=11&&setTimeout(tt(r,function(){return t.updateFromDOM()}),20)}),ue(i,"compositionstart",function(g){t.composing={data:g.data,done:!1}}),ue(i,"compositionupdate",function(g){t.composing||(t.composing={data:g.data,done:!1})}),ue(i,"compositionend",function(g){t.composing&&(g.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ue(i,"touchstart",function(){return n.forceCompositionEnd()}),ue(i,"input",function(){t.composing||t.readFromDOMSoon()});function h(g){if(!(!u(g)||Ve(r,g))){if(r.somethingSelected())eo({lineWise:!1,text:r.getSelections()}),g.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var v=Gu(r);eo({lineWise:!0,text:v.text}),g.type=="cut"&&r.operation(function(){r.setSelections(v.ranges,0,vt),r.replaceSelection("",null,"cut")})}else return;if(g.clipboardData){g.clipboardData.clearData();var b=Ut.text.join(` -`);if(g.clipboardData.setData("Text",b),g.clipboardData.getData("Text")==b){g.preventDefault();return}}var w=Xu(),k=w.firstChild;Va(k),r.display.lineSpace.insertBefore(w,r.display.lineSpace.firstChild),k.value=Ut.text.join(` -`);var B=ve(we(i));A(k),setTimeout(function(){r.display.lineSpace.removeChild(w),B.focus(),B==i&&n.showPrimarySelection()},50)}}ue(i,"copy",h),ue(i,"cut",h)},Fe.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Fe.prototype.prepareSelection=function(){var e=Ps(this.cm,!1);return e.focus=ve(we(this.div))==this.div,e},Fe.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Fe.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Fe.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line=t.display.viewFrom&&Yu(t,r)||{node:g[0].measure.map[2],offset:0},b=i.linee.firstLine()&&(r=X(r.line-1,oe(e.doc,r.line-1).length)),i.ch==oe(e.doc,i.line).text.length&&i.linet.viewTo-1)return!1;var u,h,g;r.line==t.viewFrom||(u=Ir(e,r.line))==0?(h=Ae(t.view[0].line),g=t.view[0].node):(h=Ae(t.view[u].line),g=t.view[u-1].node.nextSibling);var v=Ir(e,i.line),b,w;if(v==t.view.length-1?(b=t.viewTo-1,w=t.lineDiv.lastChild):(b=Ae(t.view[v+1].line)-1,w=t.view[v+1].node.previousSibling),!g)return!1;for(var k=e.doc.splitLines(qh(e,g,w,h,b)),B=Mr(e.doc,X(h,0),X(b,oe(e.doc,b).text.length));k.length>1&&B.length>1;)if(Ce(k)==Ce(B))k.pop(),B.pop(),b--;else if(k[0]==B[0])k.shift(),B.shift(),h++;else break;for(var M=0,z=0,R=k[0],Y=B[0],Q=Math.min(R.length,Y.length);Mr.ch&&V.charCodeAt(V.length-z-1)==J.charCodeAt(J.length-z-1);)M--,z++;k[k.length-1]=V.slice(0,V.length-z).replace(/^\u200b+/,""),k[0]=k[0].slice(M).replace(/\u200b+$/,"");var se=X(h,M),ae=X(b,B.length?Ce(B).length-z:0);if(k.length>1||k[0]||pe(se,ae))return cn(e.doc,k,se,ae,"+input"),!0},Fe.prototype.ensurePolled=function(){this.forceCompositionEnd()},Fe.prototype.reset=function(){this.forceCompositionEnd()},Fe.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Fe.prototype.readFromDOMSoon=function(){var e=this;this.readDOMTimeout==null&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80))},Fe.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&kt(this.cm,function(){return bt(e.cm)})},Fe.prototype.setUneditable=function(e){e.contentEditable="false"},Fe.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||tt(this.cm,$a)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},Fe.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Fe.prototype.onContextMenu=function(){},Fe.prototype.resetPosition=function(){},Fe.prototype.needsContentAttribute=!0;function Yu(e,t){var n=xa(e,t.line);if(!n||n.hidden)return null;var r=oe(e.doc,t.line),i=Cs(n,r,t.line),u=tr(r,e.doc.direction),h="left";if(u){var g=_n(u,t.ch);h=g%2?"right":"left"}var v=Es(i.map,t.ch,h);return v.offset=v.collapse=="right"?v.end:v.start,v}function Wh(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function vn(e,t){return t&&(e.bad=!0),e}function qh(e,t,n,r,i){var u="",h=!1,g=e.doc.lineSeparator(),v=!1;function b(M){return function(z){return z.id==M}}function w(){h&&(u+=g,v&&(u+=g),h=v=!1)}function k(M){M&&(w(),u+=M)}function B(M){if(M.nodeType==1){var z=M.getAttribute("cm-text");if(z){k(z);return}var R=M.getAttribute("cm-marker"),Y;if(R){var Q=e.findMarks(X(r,0),X(i+1,0),b(+R));Q.length&&(Y=Q[0].find(0))&&k(Mr(e.doc,Y.from,Y.to).join(g));return}if(M.getAttribute("contenteditable")=="false")return;var V=/^(pre|div|p|li|table|br)$/i.test(M.nodeName);if(!/^br$/i.test(M.nodeName)&&M.textContent.length==0)return;V&&w();for(var J=0;J=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),ue(i,"paste",function(h){Ve(r,h)||Uu(h,r)||(r.state.pasteIncoming=+new Date,n.fastPoll())});function u(h){if(!Ve(r,h)){if(r.somethingSelected())eo({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var g=Gu(r);eo({lineWise:!0,text:g.text}),h.type=="cut"?r.setSelections(g.ranges,null,vt):(n.prevInput="",i.value=g.text.join(` -`),A(i))}else return;h.type=="cut"&&(r.state.cutIncoming=+new Date)}}ue(i,"cut",u),ue(i,"copy",u),ue(e.scroller,"paste",function(h){if(!(ir(e,h)||Ve(r,h))){if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var g=new Event("paste");g.clipboardData=h.clipboardData,i.dispatchEvent(g)}}),ue(e.lineSpace,"selectstart",function(h){ir(e,h)||mt(h)}),ue(i,"compositionstart",function(){var h=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:h,range:r.markText(h,r.getCursor("to"),{className:"CodeMirror-composing"})}}),ue(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},qe.prototype.createField=function(e){this.wrapper=Xu(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;Va(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},qe.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},qe.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=Ps(e);if(e.options.moveInputWithCursor){var i=Wt(e,n.sel.primary().head,"div"),u=t.wrapper.getBoundingClientRect(),h=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+h.top-u.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+h.left-u.left))}return r},qe.prototype.showSelection=function(e){var t=this.cm,n=t.display;ee(n.cursorDiv,e.cursors),ee(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},qe.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&A(this.textarea),c&&d>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",c&&d>=9&&(this.hasSelection=null));this.resetting=!1}},qe.prototype.getField=function(){return this.textarea},qe.prototype.supportsTouch=function(){return!1},qe.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!N||ve(we(this.textarea))!=this.textarea))try{this.textarea.focus()}catch{}},qe.prototype.blur=function(){this.textarea.blur()},qe.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},qe.prototype.receivedFocus=function(){this.slowPoll()},qe.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},qe.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},qe.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||qc(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(c&&d>=9&&this.hasSelection===i||I&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var u=i.charCodeAt(0);if(u==8203&&!r&&(r="\u200B"),u==8666)return this.reset(),this.cm.execCommand("undo")}for(var h=0,g=Math.min(r.length,i.length);h1e3||i.indexOf(` -`)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},qe.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},qe.prototype.onKeyPress=function(){c&&d>=9&&(this.hasSelection=null),this.fastPoll()},qe.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var u=Or(n,e),h=r.scroller.scrollTop;if(!u||S)return;var g=n.options.resetSelectionOnContextMenu;g&&n.doc.sel.contains(u)==-1&&tt(n,lt)(n.doc,yr(u),vt);var v=i.style.cssText,b=t.wrapper.style.cssText,w=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px; - top: `+(e.clientY-w.top-5)+"px; left: "+(e.clientX-w.left-5)+`px; +b`.split(/\n/).length!=3?function(e){for(var t=0,i=[],r=e.length;t<=r;){var n=e.indexOf(` +`,t);n==-1&&(n=e.length);var u=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),p=u.indexOf("\r");p!=-1?(i.push(u.slice(0,p)),t+=p+1):(i.push(u),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},Xc=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch{return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch{}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Kc=function(){var e=E("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),ia=null;function Yc(e){if(ia!=null)return ia;var t=Y(e,E("span","x")),i=t.getBoundingClientRect(),r=R(t,0,1).getBoundingClientRect();return ia=Math.abs(i.left-r.left)>1}var na={},Jr={};function Zc(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),na[e]=t}function Qc(e,t){Jr[e]=t}function kn(e){if(typeof e=="string"&&Jr.hasOwnProperty(e))e=Jr[e];else if(e&&typeof e.name=="string"&&Jr.hasOwnProperty(e.name)){var t=Jr[e.name];typeof t=="string"&&(t={name:t}),e=Ul(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return kn("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return kn("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function oa(e,t){t=kn(t);var i=na[t.name];if(!i)return oa(e,"text/plain");var r=i(e,t);if(Vr.hasOwnProperty(t.name)){var n=Vr[t.name];for(var u in n)n.hasOwnProperty(u)&&(r.hasOwnProperty(u)&&(r["_"+u]=r[u]),r[u]=n[u])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var p in t.modeProps)r[p]=t.modeProps[p];return r}var Vr={};function Jc(e,t){var i=Vr.hasOwnProperty(e)?Vr[e]:Vr[e]={};Lt(t,i)}function Lr(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var r in t){var n=t[r];n instanceof Array&&(n=n.concat([])),i[r]=n}return i}function aa(e,t){for(var i;e.innerMode&&(i=e.innerMode(t),!(!i||i.mode==e));)t=i.state,e=i.mode;return i||{mode:e,state:t}}function Ql(e,t,i){return e.startState?e.startState(t,i):!0}var Ge=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};Ge.prototype.eol=function(){return this.pos>=this.string.length},Ge.prototype.sol=function(){return this.pos==this.lineStart},Ge.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ge.prototype.next=function(){if(this.post},Ge.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ge.prototype.skipToEnd=function(){this.pos=this.string.length},Ge.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ge.prototype.backUp=function(e){this.pos-=e},Ge.prototype.column=function(){return this.lastColumnPos0?null:(u&&t!==!1&&(this.pos+=u[0].length),u)}},Ge.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ge.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ge.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ge.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ae(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var i=e;!i.lines;)for(var r=0;;++r){var n=i.children[r],u=n.chunkSize();if(t=e.first&&ti?K(i,ae(e,i).text.length):Vc(t,ae(e,t.line).text.length)}function Vc(e,t){var i=e.ch;return i==null||i>t?K(e.line,t):i<0?K(e.line,0):e}function Vl(e,t){for(var i=[],r=0;rthis.maxLookAhead&&(this.maxLookAhead=e),t},Zt.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},Zt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Zt.fromSaved=function(e,t,i){return t instanceof An?new Zt(e,Lr(e.mode,t.state),i,t.lookAhead):new Zt(e,Lr(e.mode,t),i)},Zt.prototype.save=function(e){var t=e!==!1?Lr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new An(t,this.maxLookAhead):t};function $l(e,t,i,r){var n=[e.state.modeGen],u={};os(e,t.text,e.doc.mode,i,function(b,C){return n.push(b,C)},u,r);for(var p=i.state,g=function(b){i.baseTokens=n;var C=e.state.overlays[b],S=1,_=0;i.state=!0,os(e,t.text,C.mode,i,function(M,P){for(var U=S;_M&&n.splice(S,1,M,n[S+1],Z),S+=2,_=Math.min(M,Z)}if(P)if(C.opaque)n.splice(U,S-U,M,"overlay "+P),S=U+2;else for(;Ue.options.maxHighlightLength&&Lr(e.doc.mode,r.state),u=$l(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=u.styles,u.classes?t.styleClasses=u.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function zi(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new Zt(r,!0,t);var u=$c(e,t,i),p=u>r.first&&ae(r,u-1).stateAfter,g=p?Zt.fromSaved(r,p,u):new Zt(r,Ql(r.mode),u);return r.iter(u,t,function(m){ca(e,m.text,g);var b=g.line;m.stateAfter=b==t-1||b%5==0||b>=n.viewFrom&&bt.start)return u}throw new Error("Mode "+e.name+" failed to advance stream.")}var rs=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function is(e,t,i,r){var n=e.doc,u=n.mode,p;t=ve(n,t);var g=ae(n,t.line),m=zi(e,t.line,i),b=new Ge(g.text,e.options.tabSize,m),C;for(r&&(C=[]);(r||b.pose.options.maxHighlightLength?(g=!1,p&&ca(e,t,r,C.pos),C.pos=t.length,S=null):S=ns(da(i,C,r.state,_),u),_){var M=_[0].name;M&&(S="m-"+(S?M+" "+S:M))}if(!g||b!=S){for(;mp;--g){if(g<=u.first)return u.first;var m=ae(u,g-1),b=m.stateAfter;if(b&&(!i||g+(b instanceof An?b.lookAhead:0)<=u.modeFrontier))return g;var C=Ye(m.text,null,e.options.tabSize);(n==null||r>C)&&(n=g-1,r=C)}return n}function ed(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontieri;r--){var n=ae(e,r).stateAfter;if(n&&(!(n instanceof An)||r+n.lookAhead=t:u.to>t);(r||(r=[])).push(new Fn(p,u.from,m?null:u.to))}}return r}function ad(e,t,i){var r;if(e)for(var n=0;n=t:u.to>t);if(g||u.from==t&&p.type=="bookmark"&&(!i||u.marker.insertLeft)){var m=u.from==null||(p.inclusiveLeft?u.from<=t:u.from0&&g)for(var ie=0;ie0)){var C=[m,1],S=me(b.from,g.from),_=me(b.to,g.to);(S<0||!p.inclusiveLeft&&!S)&&C.push({from:b.from,to:g.from}),(_>0||!p.inclusiveRight&&!_)&&C.push({from:g.to,to:b.to}),n.splice.apply(n,C),m+=C.length-3}}return n}function ss(e){var t=e.markedSpans;if(t){for(var i=0;it)&&(!r||pa(r,u.marker)<0)&&(r=u.marker)}return r}function ds(e,t,i,r,n){var u=ae(e,t),p=rr&&u.markedSpans;if(p)for(var g=0;g=0&&S<=0||C<=0&&S>=0)&&(C<=0&&(m.marker.inclusiveRight&&n.inclusiveLeft?me(b.to,i)>=0:me(b.to,i)>0)||C>=0&&(m.marker.inclusiveRight&&n.inclusiveLeft?me(b.from,r)<=0:me(b.from,r)<0)))return!0}}}function qt(e){for(var t;t=cs(e);)e=t.find(-1,!0).line;return e}function ud(e){for(var t;t=Mn(e);)e=t.find(1,!0).line;return e}function fd(e){for(var t,i;t=Mn(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function ga(e,t){var i=ae(e,t),r=qt(i);return i==r?t:Fe(r)}function hs(e,t){if(t>e.lastLine())return t;var i=ae(e,t),r;if(!mr(e,i))return t;for(;r=Mn(i);)i=r.find(1,!0).line;return Fe(i)+1}function mr(e,t){var i=rr&&t.markedSpans;if(i){for(var r=void 0,n=0;nt.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var $r=function(e,t,i){this.text=e,us(this,t),this.height=i?i(this):1};$r.prototype.lineNo=function(){return Fe(this)},Qr($r);function cd(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),ss(e),us(e,i);var n=r?r(e):1;n!=e.height&&Yt(e,n)}function dd(e){e.parent=null,ss(e)}var hd={},pd={};function ps(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?pd:hd;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function gs(e,t){var i=q("span",null,null,v?"padding-right: .1px":null),r={pre:q("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var u=n?t.rest[n-1]:t.line,p=void 0;r.pos=0,r.addToken=md,Gc(e.display.measure)&&(p=tr(u,e.doc.direction))&&(r.addToken=bd(r.addToken,p)),r.map=[];var g=t!=e.display.externalMeasured&&Fe(u);yd(u,r,es(e,u,g)),u.styleClasses&&(u.styleClasses.bgClass&&(r.bgClass=Ee(u.styleClasses.bgClass,r.bgClass||"")),u.styleClasses.textClass&&(r.textClass=Ee(u.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(jc(e.display.measure))),n==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(v){var m=r.content.lastChild;(/\bcm-tab\b/.test(m.className)||m.querySelector&&m.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return je(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=Ee(r.pre.className,r.textClass||"")),r}function gd(e){var t=E("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function md(e,t,i,r,n,u,p){if(t){var g=e.splitSpaces?vd(t,e.trailingSpace):t,m=e.cm.state.specialChars,b=!1,C;if(!m.test(t))e.col+=t.length,C=document.createTextNode(g),e.map.push(e.pos,e.pos+t.length,C),c&&d<9&&(b=!0),e.pos+=t.length;else{C=document.createDocumentFragment();for(var S=0;;){m.lastIndex=S;var _=m.exec(t),M=_?_.index-S:t.length-S;if(M){var P=document.createTextNode(g.slice(S,S+M));c&&d<9?C.appendChild(E("span",[P])):C.appendChild(P),e.map.push(e.pos,e.pos+M,P),e.col+=M,e.pos+=M}if(!_)break;S+=M+1;var U=void 0;if(_[0]==" "){var Z=e.cm.options.tabSize,J=Z-e.col%Z;U=C.appendChild(E("span",pr(J),"cm-tab")),U.setAttribute("role","presentation"),U.setAttribute("cm-text"," "),e.col+=J}else _[0]=="\r"||_[0]==` +`?(U=C.appendChild(E("span",_[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),U.setAttribute("cm-text",_[0]),e.col+=1):(U=e.cm.options.specialCharPlaceholder(_[0]),U.setAttribute("cm-text",_[0]),c&&d<9?C.appendChild(E("span",[U])):C.appendChild(U),e.col+=1);e.map.push(e.pos,e.pos+1,U),e.pos++}}if(e.trailingSpace=g.charCodeAt(t.length-1)==32,i||r||n||b||u||p){var ee=i||"";r&&(ee+=r),n&&(ee+=n);var V=E("span",[C],ee,u);if(p)for(var ie in p)p.hasOwnProperty(ie)&&ie!="style"&&ie!="class"&&V.setAttribute(ie,p[ie]);return e.content.appendChild(V)}e.content.appendChild(C)}}function vd(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;nb&&S.from<=b));_++);if(S.to>=C)return e(i,r,n,u,p,g,m);e(i,r.slice(0,S.to-b),n,u,null,g,m),u=null,r=r.slice(S.to-b),b=S.to}}}function ms(e,t,i,r){var n=!r&&i.widgetNode;n&&e.map.push(e.pos,e.pos+t,n),!r&&e.cm.display.input.needsContentAttribute&&(n||(n=e.content.appendChild(document.createElement("span"))),n.setAttribute("cm-marker",i.id)),n&&(e.cm.display.input.setUneditable(n),e.content.appendChild(n)),e.pos+=t,e.trailingSpace=!1}function yd(e,t,i){var r=e.markedSpans,n=e.text,u=0;if(!r){for(var p=1;pm||we.collapsed&&le.to==m&&le.from==m)){if(le.to!=null&&le.to!=m&&M>le.to&&(M=le.to,U=""),we.className&&(P+=" "+we.className),we.css&&(_=(_?_+";":"")+we.css),we.startStyle&&le.from==m&&(Z+=" "+we.startStyle),we.endStyle&&le.to==M&&(ie||(ie=[])).push(we.endStyle,le.to),we.title&&((ee||(ee={})).title=we.title),we.attributes)for(var Le in we.attributes)(ee||(ee={}))[Le]=we.attributes[Le];we.collapsed&&(!J||pa(J.marker,we)<0)&&(J=le)}else le.from>m&&M>le.from&&(M=le.from)}if(ie)for(var it=0;it=g)break;for(var Et=Math.min(g,M);;){if(C){var wt=m+C.length;if(!J){var Xe=wt>Et?C.slice(0,Et-m):C;t.addToken(t,Xe,S?S+P:P,Z,m+Xe.length==M?U:"",_,ee)}if(wt>=Et){C=C.slice(Et-m),m=Et;break}m=wt,Z=""}C=n.slice(u,u=i[b++]),S=ps(i[b++],t.cm.options)}}}function vs(e,t,i){this.line=t,this.rest=fd(t),this.size=this.rest?Fe(De(this.rest))-i+1:1,this.node=this.text=null,this.hidden=mr(e,t)}function _n(e,t,i){for(var r=[],n,u=t;u2&&u.push((m.bottom+b.top)/2-i.top)}}u.push(i.bottom-i.top)}}function ks(e,t,i){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var r=0;ri)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}}function Ld(e,t){t=qt(t);var i=Fe(t),r=e.display.externalMeasured=new vs(e.doc,t,i);r.lineN=i;var n=r.built=gs(e,r);return r.text=n.pre,Y(e.display.lineMeasure,n.pre),r}function Ss(e,t,i,r){return Jt(e,ti(e,t),i,r)}function wa(e,t){if(t>=e.display.viewFrom&&t=i.lineN&&tt)&&(u=m-g,n=u-1,t>=m&&(p="right")),n!=null){if(r=e[b+2],g==m&&i==(r.insertLeft?"left":"right")&&(p=i),i=="left"&&n==0)for(;b&&e[b-2]==e[b-3]&&e[b-1].insertLeft;)r=e[(b-=3)+2],p="left";if(i=="right"&&n==m-g)for(;b=0&&(i=e[n]).left==i.right;n--);return i}function Bd(e,t,i,r){var n=As(t.map,i,r),u=n.node,p=n.start,g=n.end,m=n.collapse,b;if(u.nodeType==3){for(var C=0;C<4;C++){for(;p&&Qo(t.line.text.charAt(n.coverStart+p));)--p;for(;n.coverStart+g0&&(m=r="right");var S;e.options.lineWrapping&&(S=u.getClientRects()).length>1?b=S[r=="right"?S.length-1:0]:b=u.getBoundingClientRect()}if(c&&d<9&&!p&&(!b||!b.left&&!b.right)){var _=u.parentNode.getClientRects()[0];_?b={left:_.left,right:_.left+ii(e.display),top:_.top,bottom:_.bottom}:b=Es}for(var M=b.top-t.rect.top,P=b.bottom-t.rect.top,U=(M+P)/2,Z=t.view.measure.heights,J=0;J=r.text.length?(m=r.text.length,b="before"):m<=0&&(m=0,b="after"),!g)return p(b=="before"?m-1:m,b=="before");function C(P,U,Z){var J=g[U],ee=J.level==1;return p(Z?P-1:P,ee!=Z)}var S=Mi(g,m,b),_=Li,M=C(m,S,b=="before");return _!=null&&(M.other=C(m,_,b!="before")),M}function _s(e,t){var i=0;t=ve(e.doc,t),e.options.lineWrapping||(i=ii(e.display)*t.ch);var r=ae(e.doc,t.line),n=ir(r)+zn(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function Da(e,t,i,r,n){var u=K(e,t,i);return u.xRel=n,r&&(u.outside=r),u}function ka(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return Da(r.first,0,null,-1,-1);var n=Br(r,i),u=r.first+r.size-1;if(n>u)return Da(r.first+r.size-1,ae(r,u).text.length,null,1,1);t<0&&(t=0);for(var p=ae(r,n);;){var g=zd(e,p,n,t,i),m=sd(p,g.ch+(g.xRel>0||g.outside>0?1:0));if(!m)return g;var b=m.find(1);if(b.line==n)return b;p=ae(r,n=b.line)}}function zs(e,t,i,r){r-=Ca(t);var n=t.text.length,u=Ti(function(p){return Jt(e,i,p-1).bottom<=r},n,0);return n=Ti(function(p){return Jt(e,i,p).top>r},u,n),{begin:u,end:n}}function Ns(e,t,i,r){i||(i=ti(e,t));var n=Nn(e,t,Jt(e,i,r),"line").top;return zs(e,t,i,n)}function Sa(e,t,i,r){return e.bottom<=i?!1:e.top>i?!0:(r?e.left:e.right)>t}function zd(e,t,i,r,n){n-=ir(t);var u=ti(e,t),p=Ca(t),g=0,m=t.text.length,b=!0,C=tr(t,e.doc.direction);if(C){var S=(e.options.lineWrapping?Od:Nd)(e,t,i,u,C,r,n);b=S.level!=1,g=b?S.from:S.to-1,m=b?S.to:S.from-1}var _=null,M=null,P=Ti(function(se){var le=Jt(e,u,se);return le.top+=p,le.bottom+=p,Sa(le,r,n,!1)?(le.top<=n&&le.left<=r&&(_=se,M=le),!0):!1},g,m),U,Z,J=!1;if(M){var ee=r-M.left=ie.bottom?1:0}return P=Gl(t.text,P,1),Da(i,P,Z,J,r-U)}function Nd(e,t,i,r,n,u,p){var g=Ti(function(S){var _=n[S],M=_.level!=1;return Sa(Rt(e,K(i,M?_.to:_.from,M?"before":"after"),"line",t,r),u,p,!0)},0,n.length-1),m=n[g];if(g>0){var b=m.level!=1,C=Rt(e,K(i,b?m.from:m.to,b?"after":"before"),"line",t,r);Sa(C,u,p,!0)&&C.top>p&&(m=n[g-1])}return m}function Od(e,t,i,r,n,u,p){var g=zs(e,t,r,p),m=g.begin,b=g.end;/\s/.test(t.text.charAt(b-1))&&b--;for(var C=null,S=null,_=0;_=b||M.to<=m)){var P=M.level!=1,U=Jt(e,r,P?Math.min(b,M.to)-1:Math.max(m,M.from)).right,Z=UZ)&&(C=M,S=Z)}}return C||(C=n[n.length-1]),C.fromb&&(C={from:C.from,to:b,level:C.level}),C}var zr;function ri(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(zr==null){zr=E("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)zr.appendChild(document.createTextNode("x")),zr.appendChild(E("br"));zr.appendChild(document.createTextNode("x"))}Y(e.measure,zr);var i=zr.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),H(e.measure),i||1}function ii(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=E("span","xxxxxxxxxx"),i=E("pre",[t],"CodeMirror-line-like");Y(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function Ea(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,u=t.gutters.firstChild,p=0;u;u=u.nextSibling,++p){var g=e.display.gutterSpecs[p].className;i[g]=u.offsetLeft+u.clientLeft+n,r[g]=u.clientWidth}return{fixedPos:Aa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Aa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Os(e){var t=ri(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/ii(e.display)-3);return function(n){if(mr(e.doc,n))return 0;var u=0;if(n.widgets)for(var p=0;p0&&(b=ae(e.doc,m.line).text).length==m.ch){var C=Ye(b,b.length,e.options.tabSize)-b.length;m=K(m.line,Math.max(0,Math.round((u-Ds(e.display).left)/ii(e.display))-C))}return m}function Or(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var i=e.display.view,r=0;rt)&&(n.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=n.viewTo)rr&&ga(e.doc,t)n.viewFrom?br(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)br(e);else if(t<=n.viewFrom){var u=In(e,i,i+r,1);u?(n.view=n.view.slice(u.index),n.viewFrom=u.lineN,n.viewTo+=r):br(e)}else if(i>=n.viewTo){var p=In(e,t,t,-1);p?(n.view=n.view.slice(0,p.index),n.viewTo=p.lineN):br(e)}else{var g=In(e,t,t,-1),m=In(e,i,i+r,1);g&&m?(n.view=n.view.slice(0,g.index).concat(_n(e,g.lineN,m.lineN)).concat(n.view.slice(m.index)),n.viewTo+=r):br(e)}var b=n.externalMeasured;b&&(i=n.lineN&&t=r.viewTo)){var u=r.view[Or(e,t)];if(u.node!=null){var p=u.changes||(u.changes=[]);ze(p,i)==-1&&p.push(i)}}}function br(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function In(e,t,i,r){var n=Or(e,t),u,p=e.display.view;if(!rr||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var g=e.display.viewFrom,m=0;m0){if(n==p.length-1)return null;u=g+p[n].size-t,n++}else u=g-t;t+=u,i+=u}for(;ga(e.doc,i)!=i;){if(n==(r<0?0:p.length-1))return null;i+=r*p[n-(r<0?1:0)].size,n+=r}return{index:n,lineN:i}}function Id(e,t,i){var r=e.display,n=r.view;n.length==0||t>=r.viewTo||i<=r.viewFrom?(r.view=_n(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=_n(e,t,r.viewFrom).concat(r.view):r.viewFromi&&(r.view=r.view.slice(0,Or(e,i)))),r.viewTo=i}function Is(e){for(var t=e.display.view,i=0,r=0;r=e.display.viewTo||m.to().line0?p:e.defaultCharWidth())+"px"}if(r.other){var g=i.appendChild(E("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));g.style.display="",g.style.left=r.other.left+"px",g.style.top=r.other.top+"px",g.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Hn(e,t){return e.top-t.top||e.left-t.left}function Hd(e,t,i){var r=e.display,n=e.doc,u=document.createDocumentFragment(),p=Ds(e.display),g=p.left,m=Math.max(r.sizerWidth,_r(e)-r.sizer.offsetLeft)-p.right,b=n.direction=="ltr";function C(V,ie,se,le){ie<0&&(ie=0),ie=Math.round(ie),le=Math.round(le),u.appendChild(E("div",null,"CodeMirror-selected","position: absolute; left: "+V+`px; + top: `+ie+"px; width: "+(se??m-V)+`px; + height: `+(le-ie)+"px"))}function S(V,ie,se){var le=ae(n,V),we=le.text.length,Le,it;function Ie(Xe,Ct){return On(e,K(V,Xe),"div",le,Ct)}function Et(Xe,Ct,ot){var Qe=Ns(e,le,null,Xe),Ke=Ct=="ltr"==(ot=="after")?"left":"right",qe=ot=="after"?Qe.begin:Qe.end-(/\s/.test(le.text.charAt(Qe.end-1))?2:1);return Ie(qe,Ke)[Ke]}var wt=tr(le,n.direction);return Rc(wt,ie||0,se??we,function(Xe,Ct,ot,Qe){var Ke=ot=="ltr",qe=Ie(Xe,Ke?"left":"right"),Dt=Ie(Ct-1,Ke?"right":"left"),mi=ie==null&&Xe==0,kr=se==null&&Ct==we,st=Qe==0,Vt=!wt||Qe==wt.length-1;if(Dt.top-qe.top<=3){var nt=(b?mi:kr)&&st,rl=(b?kr:mi)&&Vt,lr=nt?g:(Ke?qe:Dt).left,Rr=rl?m:(Ke?Dt:qe).right;C(lr,qe.top,Rr-lr,qe.bottom)}else{var Wr,ht,vi,il;Ke?(Wr=b&&mi&&st?g:qe.left,ht=b?m:Et(Xe,ot,"before"),vi=b?g:Et(Ct,ot,"after"),il=b&&kr&&Vt?m:Dt.right):(Wr=b?Et(Xe,ot,"before"):g,ht=!b&&mi&&st?m:qe.right,vi=!b&&kr&&Vt?g:Dt.left,il=b?Et(Ct,ot,"after"):m),C(Wr,qe.top,ht-Wr,qe.bottom),qe.bottom0?t.blinker=setInterval(function(){e.hasFocus()||ni(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Ps(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Ba(e))}function Ma(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&ni(e))},100)}function Ba(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(je(e,"focus",e,t),e.state.focused=!0,be(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),v&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),La(e))}function ni(e,t){e.state.delayingBlurEvent||(e.state.focused&&(je(e,"blur",e,t),e.state.focused=!1,oe(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function Pn(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),n=t.lineDiv.getBoundingClientRect().top,u=0,p=0;p.005||M<-.005)&&(ne.display.sizerWidth){var U=Math.ceil(C/ii(e.display));U>e.display.maxLineLength&&(e.display.maxLineLength=U,e.display.maxLine=g.line,e.display.maxLineChanged=!0)}}}Math.abs(u)>2&&(t.scroller.scrollTop+=u)}function qs(e){if(e.widgets)for(var t=0;t=p&&(u=Br(t,ir(ae(t,m))-e.wrapper.clientHeight),p=m)}return{from:u,to:Math.max(p,u+1)}}function Pd(e,t){if(!$e(e,"scrollCursorIntoView")){var i=e.display,r=i.sizer.getBoundingClientRect(),n=null,u=i.wrapper.ownerDocument;if(t.top+r.top<0?n=!0:t.bottom+r.top>(u.defaultView.innerHeight||u.documentElement.clientHeight)&&(n=!1),n!=null&&!L){var p=E("div","\u200B",null,`position: absolute; + top: `+(t.top-i.viewOffset-zn(e.display))+`px; + height: `+(t.bottom-t.top+Qt(e)+i.barHeight)+`px; + left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(p),p.scrollIntoView(n),e.display.lineSpace.removeChild(p)}}}function qd(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(i=t.sticky=="before"?K(t.line,t.ch+1,"before"):t,t=t.ch?K(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var u=0;u<5;u++){var p=!1,g=Rt(e,t),m=!i||i==t?g:Rt(e,i);n={left:Math.min(g.left,m.left),top:Math.min(g.top,m.top)-r,right:Math.max(g.left,m.left),bottom:Math.max(g.bottom,m.bottom)+r};var b=_a(e,n),C=e.doc.scrollTop,S=e.doc.scrollLeft;if(b.scrollTop!=null&&(Wi(e,b.scrollTop),Math.abs(e.doc.scrollTop-C)>1&&(p=!0)),b.scrollLeft!=null&&(Ir(e,b.scrollLeft),Math.abs(e.doc.scrollLeft-S)>1&&(p=!0)),!p)break}return n}function Rd(e,t){var i=_a(e,t);i.scrollTop!=null&&Wi(e,i.scrollTop),i.scrollLeft!=null&&Ir(e,i.scrollLeft)}function _a(e,t){var i=e.display,r=ri(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,u=xa(e),p={};t.bottom-t.top>u&&(t.bottom=t.top+u);var g=e.doc.height+ya(i),m=t.topg-r;if(t.topn+u){var C=Math.min(t.top,(b?g:t.bottom)-u);C!=n&&(p.scrollTop=C)}var S=e.options.fixedGutter?0:i.gutters.offsetWidth,_=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-S,M=_r(e)-i.gutters.offsetWidth,P=t.right-t.left>M;return P&&(t.right=t.left+M),t.left<10?p.scrollLeft=0:t.left<_?p.scrollLeft=Math.max(0,t.left+S-(P?0:10)):t.right>M+_-3&&(p.scrollLeft=t.right+(P?0:10)-M),p}function za(e,t){t!=null&&(Rn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function oi(e){Rn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Ri(e,t,i){(t!=null||i!=null)&&Rn(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Wd(e,t){Rn(e),e.curOp.scrollToPos=t}function Rn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=_s(e,t.from),r=_s(e,t.to);Rs(e,i,r,t.margin)}}function Rs(e,t,i,r){var n=_a(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-r,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+r});Ri(e,n.scrollLeft,n.scrollTop)}function Wi(e,t){Math.abs(e.doc.scrollTop-t)<2||(s||Oa(e,{top:t}),Ws(e,t,!0),s&&Oa(e),Gi(e,100))}function Ws(e,t,i){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),!(e.display.scroller.scrollTop==t&&!i)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Ir(e,t,i,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),!((i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)&&(e.doc.scrollLeft=t,Ks(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Ui(e){var t=e.display,i=t.gutters.offsetWidth,r=Math.round(e.doc.height+ya(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?i:0,docHeight:r,scrollHeight:r+Qt(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var Hr=function(e,t,i){this.cm=i;var r=this.vert=E("div",[E("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=E("div",[E("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=n.tabIndex=-1,e(r),e(n),ue(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),ue(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,c&&d<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Hr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var n=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+n)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=i?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var u=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+u)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?r:0,bottom:t?r:0}},Hr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Hr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Hr.prototype.zeroWidthHack=function(){var e=O&&!B?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new ct,this.disableVert=new ct},Hr.prototype.enableZeroWidthBar=function(e,t,i){e.style.visibility="";function r(){var n=e.getBoundingClientRect(),u=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);u!=e?e.style.visibility="hidden":t.set(1e3,r)}t.set(1e3,r)},Hr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ji=function(){};ji.prototype.update=function(){return{bottom:0,right:0}},ji.prototype.setScrollLeft=function(){},ji.prototype.setScrollTop=function(){},ji.prototype.clear=function(){};function ai(e,t){t||(t=Ui(e));var i=e.display.barWidth,r=e.display.barHeight;Us(e,t);for(var n=0;n<4&&i!=e.display.barWidth||r!=e.display.barHeight;n++)i!=e.display.barWidth&&e.options.lineWrapping&&Pn(e),Us(e,Ui(e)),i=e.display.barWidth,r=e.display.barHeight}function Us(e,t){var i=e.display,r=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=r.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=r.bottom)+"px",i.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=r.bottom+"px",i.scrollbarFiller.style.width=r.right+"px"):i.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=r.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}var js={native:Hr,null:ji};function Gs(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&oe(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new js[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ue(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?Ir(e,t):Wi(e,t)},e),e.display.scrollbars.addClass&&be(e.display.wrapper,e.display.scrollbars.addClass)}var Ud=0;function Pr(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Ud,markArrays:null},xd(e.curOp)}function qr(e){var t=e.curOp;t&&Cd(t,function(i){for(var r=0;r=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Wn(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Xd(e){e.updatedDisplay=e.mustUpdate&&Na(e.cm,e.update)}function Kd(e){var t=e.cm,i=t.display;e.updatedDisplay&&Pn(t),e.barMeasure=Ui(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Ss(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+Qt(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-_r(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function Yd(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)){var i=+new Date+e.options.workTime,r=zi(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(u){if(r.line>=e.display.viewFrom){var p=u.styles,g=u.text.length>e.options.maxHighlightLength?Lr(t.mode,r.state):null,m=$l(e,u,r,!0);g&&(r.state=g),u.styles=m.styles;var b=u.styleClasses,C=m.classes;C?u.styleClasses=C:b&&(u.styleClasses=null);for(var S=!p||p.length!=u.styles.length||b!=C&&(!b||!C||b.bgClass!=C.bgClass||b.textClass!=C.textClass),_=0;!S&&_i)return Gi(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&St(e,function(){for(var u=0;u=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&Is(e)==0)return!1;Ys(e)&&(br(e),t.dims=Ea(e));var n=r.first+r.size,u=Math.max(t.visible.from-e.options.viewportMargin,r.first),p=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFromp&&i.viewTo-p<20&&(p=Math.min(n,i.viewTo)),rr&&(u=ga(e.doc,u),p=hs(e.doc,p));var g=u!=i.viewFrom||p!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Id(e,u,p),i.viewOffset=ir(ae(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var m=Is(e);if(!g&&m==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var b=Vd(e);return m>4&&(i.lineDiv.style.display="none"),eh(e,i.updateLineNumbers,t.dims),m>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,$d(b),H(i.cursorDiv),H(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,g&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,Gi(e,400)),i.updateLineNumbers=null,!0}function Xs(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==_r(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+ya(e.display)-xa(e),i.top)}),t.visible=qn(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=qn(e.display,e.doc,i));if(!Na(e,t))break;Pn(e);var n=Ui(e);qi(e),ai(e,n),Ha(e,n),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Oa(e,t){var i=new Wn(e,t);if(Na(e,i)){Pn(e),Xs(e,i);var r=Ui(e);qi(e),ai(e,r),Ha(e,r),i.finish()}}function eh(e,t,i){var r=e.display,n=e.options.lineNumbers,u=r.lineDiv,p=u.firstChild;function g(P){var U=P.nextSibling;return v&&O&&e.display.currentWheelTarget==P?P.style.display="none":P.parentNode.removeChild(P),U}for(var m=r.view,b=r.viewFrom,C=0;C-1&&(M=!1),bs(e,S,b,i)),M&&(H(S.lineNumber),S.lineNumber.appendChild(document.createTextNode(sa(e.options,b)))),p=S.node.nextSibling}b+=S.size}for(;p;)p=g(p)}function Ia(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",et(e,"gutterChanged",e)}function Ha(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Qt(e)+"px"}function Ks(e){var t=e.display,i=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var r=Aa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,u=r+"px",p=0;pg.clientWidth,b=g.scrollHeight>g.clientHeight;if(r&&m||n&&b){if(n&&O&&v){e:for(var C=t.target,S=p.view;C!=g;C=C.parentNode)for(var _=0;_=0&&me(e,r.to())<=0)return i}return-1};var Ae=function(e,t){this.anchor=e,this.head=t};Ae.prototype.from=function(){return En(this.anchor,this.head)},Ae.prototype.to=function(){return Sn(this.anchor,this.head)},Ae.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Wt(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(_,M){return me(_.from(),M.from())}),i=ze(t,n);for(var u=1;u0:m>=0){var b=En(g.from(),p.from()),C=Sn(g.to(),p.to()),S=g.empty()?p.from()==p.head:g.from()==g.head;u<=i&&--i,t.splice(--u,2,new Ae(S?C:b,S?b:C))}}return new Bt(t,i)}function yr(e,t){return new Bt([new Ae(e,t||e)],0)}function xr(e){return e.text?K(e.from.line+e.text.length-1,De(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Vs(e,t){if(me(e,t.from)<0)return e;if(me(e,t.to)<=0)return xr(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=xr(t).ch-t.to.ch),K(i,r)}function qa(e,t){for(var i=[],r=0;r1&&e.remove(g.line+1,P-1),e.insert(g.line+1,J)}et(e,"change",e,t)}function wr(e,t,i){function r(n,u,p){if(n.linked)for(var g=0;g1&&!e.done[e.done.length-2].ranges)return e.done.pop(),De(e.done)}function nu(e,t,i,r){var n=e.history;n.undone.length=0;var u=+new Date,p,g;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>u-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(p=oh(n,n.lastOp==r)))g=De(p.changes),me(t.from,t.to)==0&&me(t.from,g.to)==0?g.to=xr(t):p.changes.push(Ua(e,t));else{var m=De(n.done);for((!m||!m.ranges)&&Gn(e.sel,n.done),p={changes:[Ua(e,t)],generation:n.generation},n.done.push(p);n.done.length>n.undoDepth;)n.done.shift(),n.done[0].ranges||n.done.shift()}n.done.push(i),n.generation=++n.maxGeneration,n.lastModTime=n.lastSelTime=u,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,g||je(e,"historyAdded")}function ah(e,t,i,r){var n=t.charAt(0);return n=="*"||n=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function lh(e,t,i,r){var n=e.history,u=r&&r.origin;i==n.lastSelOp||u&&n.lastSelOrigin==u&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==u||ah(e,u,De(n.done),t))?n.done[n.done.length-1]=t:Gn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=u,n.lastSelOp=i,r&&r.clearRedo!==!1&&iu(n.undone)}function Gn(e,t){var i=De(t);i&&i.ranges&&i.equals(e)||t.push(e)}function ou(e,t,i,r){var n=t["spans_"+e.id],u=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(p){p.markedSpans&&((n||(n=t["spans_"+e.id]={}))[u]=p.markedSpans),++u})}function sh(e){if(!e)return null;for(var t,i=0;i-1&&(De(g)[S]=b[S],delete b[S])}}return r}function ja(e,t,i,r){if(r){var n=e.anchor;if(i){var u=me(t,n)<0;u!=me(i,n)<0?(n=t,t=i):u!=me(t,i)<0&&(t=i)}return new Ae(n,t)}else return new Ae(i||t,t)}function Xn(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),lt(e,new Bt([ja(e.sel.primary(),t,i,n)],0),r)}function lu(e,t,i){for(var r=[],n=e.cm&&(e.cm.display.shift||e.extend),u=0;u=t.ch:g.to>t.ch))){if(n&&(je(m,"beforeCursorEnter"),m.explicitlyCleared))if(u.markedSpans){--p;continue}else break;if(!m.atomic)continue;if(i){var S=m.find(r<0?1:-1),_=void 0;if((r<0?C:b)&&(S=hu(e,S,-r,S&&S.line==t.line?u:null)),S&&S.line==t.line&&(_=me(S,i))&&(r<0?_<0:_>0))return si(e,S,t,r,n)}var M=m.find(r<0?-1:1);return(r<0?b:C)&&(M=hu(e,M,r,M.line==t.line?u:null)),M?si(e,M,t,r,n):null}}return t}function Yn(e,t,i,r,n){var u=r||1,p=si(e,t,i,u,n)||!n&&si(e,t,i,u,!0)||si(e,t,i,-u,n)||!n&&si(e,t,i,-u,!0);return p||(e.cantEdit=!0,K(e.first,0))}function hu(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?ve(e,K(t.line-1)):null:i>0&&t.ch==(r||ae(e,t.line)).text.length?t.line=0;--n)mu(e,{from:r[n].from,to:r[n].to,text:n?[""]:t.text,origin:t.origin});else mu(e,t)}}function mu(e,t){if(!(t.text.length==1&&t.text[0]==""&&me(t.from,t.to)==0)){var i=qa(e,t);nu(e,t,i,e.cm?e.cm.curOp.id:NaN),Yi(e,t,i,ha(e,t));var r=[];wr(e,function(n,u){!u&&ze(r,n.history)==-1&&(xu(n.history,t),r.push(n.history)),Yi(n,t,null,ha(n,t))})}}function Zn(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(!(r&&!i)){for(var n=e.history,u,p=e.sel,g=t=="undo"?n.done:n.undone,m=t=="undo"?n.undone:n.done,b=0;b=0;--M){var P=_(M);if(P)return P.v}}}}function vu(e,t){if(t!=0&&(e.first+=t,e.sel=new Bt(Pt(e.sel.ranges,function(n){return new Ae(K(n.anchor.line+t,n.anchor.ch),K(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm)){yt(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;re.lastLine())){if(t.from.lineu&&(t={from:t.from,to:K(u,ae(e,u).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Mr(e,t.from,t.to),i||(i=qa(e,t)),e.cm?ch(e.cm,t,r):Wa(e,t,r),Kn(e,i,vt),e.cantEdit&&Yn(e,K(e.firstLine(),0))&&(e.cantEdit=!1)}}function ch(e,t,i){var r=e.doc,n=e.display,u=t.from,p=t.to,g=!1,m=u.line;e.options.lineWrapping||(m=Fe(qt(ae(r,u.line))),r.iter(m,p.line+1,function(M){if(M==n.maxLine)return g=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Kl(e),Wa(r,t,i,Os(e)),e.options.lineWrapping||(r.iter(m,u.line+t.text.length,function(M){var P=Bn(M);P>n.maxLineLength&&(n.maxLine=M,n.maxLineLength=P,n.maxLineChanged=!0,g=!1)}),g&&(e.curOp.updateMaxLine=!0)),ed(r,u.line),Gi(e,400);var b=t.text.length-(p.line-u.line)-1;t.full?yt(e):u.line==p.line&&t.text.length==1&&!eu(e.doc,t)?vr(e,u.line,"text"):yt(e,u.line,p.line+1,b);var C=Ot(e,"changes"),S=Ot(e,"change");if(S||C){var _={from:u,to:p,text:t.text,removed:t.removed,origin:t.origin};S&&et(e,"change",e,_),C&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(_)}e.display.selForContextMenu=null}function fi(e,t,i,r,n){var u;r||(r=i),me(r,i)<0&&(u=[r,i],i=u[0],r=u[1]),typeof t=="string"&&(t=e.splitLines(t)),ui(e,{from:i,to:r,text:t,origin:n})}function bu(e,t,i,r){i1||!(this.children[0]instanceof Qi))){var g=[];this.collapse(g),this.children=[new Qi(g)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var p=n.lines.length%25+25,g=p;g10);e.parent.maybeSpill()}},iterN:function(e,t,i){for(var r=0;re.display.maxLineLength&&(e.display.maxLine=b,e.display.maxLineLength=C,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&yt(e,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&cu(e.doc)),e&&et(e,"markerCleared",e,this,r,n),t&&qr(e),this.parent&&this.parent.clear()}},Cr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n0||p==0&&u.clearWhenEmpty!==!1)return u;if(u.replacedWith&&(u.collapsed=!0,u.widgetNode=q("span",[u.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||u.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(u.widgetNode.insertLeft=!0)),u.collapsed){if(ds(e,t.line,t,i,u)||t.line!=i.line&&ds(e,i.line,t,i,u))throw new Error("Inserting collapsed marker partially overlapping an existing one");rd()}u.addToHistory&&nu(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var g=t.line,m=e.cm,b;if(e.iter(g,i.line+1,function(S){m&&u.collapsed&&!m.options.lineWrapping&&qt(S)==m.display.maxLine&&(b=!0),u.collapsed&&g!=t.line&&Yt(S,0),nd(S,new Fn(u,g==t.line?t.ch:null,g==i.line?i.ch:null),e.cm&&e.cm.curOp),++g}),u.collapsed&&e.iter(t.line,i.line+1,function(S){mr(e,S)&&Yt(S,0)}),u.clearOnEnter&&ue(u,"beforeCursorEnter",function(){return u.clear()}),u.readOnly&&(td(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),u.collapsed&&(u.id=++Cu,u.atomic=!0),m){if(b&&(m.curOp.updateMaxLine=!0),u.collapsed)yt(m,t.line,i.line+1);else if(u.className||u.startStyle||u.endStyle||u.css||u.attributes||u.title)for(var C=t.line;C<=i.line;C++)vr(m,C,"text");u.atomic&&cu(m.doc),et(m,"markerAdded",m,u)}return u}var $i=function(e,t){this.markers=e,this.primary=t;for(var i=0;i=0;m--)ui(this,r[m]);g?uu(this,g):this.cm&&oi(this.cm)}),undo:rt(function(){Zn(this,"undo")}),redo:rt(function(){Zn(this,"redo")}),undoSelection:rt(function(){Zn(this,"undo",!0)}),redoSelection:rt(function(){Zn(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,r=0;r=e.ch)&&t.push(n.marker.parent||n.marker)}return t},findMarks:function(e,t,i){e=ve(this,e),t=ve(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(u){var p=u.markedSpans;if(p)for(var g=0;g=m.to||m.from==null&&n!=e.line||m.from!=null&&n==t.line&&m.from>=t.ch)&&(!i||i(m.marker))&&r.push(m.marker.parent||m.marker)}++n}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var r=0;re)return t=e,!0;e-=u,++i}),ve(this,K(i,t))},indexFromPos:function(e){e=ve(this,e);var t=e.ch;if(e.linet&&(t=e.from),e.to!=null&&e.to-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var C=e.dataTransfer.getData("Text");if(C){var S;if(t.state.draggingText&&!t.state.draggingText.copy&&(S=t.listSelections()),Kn(t.doc,yr(i,i)),S)for(var _=0;_=0;g--)fi(e.doc,"",r[g].from,r[g].to,"+delete");oi(e)})}function Xa(e,t,i){var r=Gl(e.text,t+i,i);return r<0||r>e.text.length?null:r}function Ka(e,t,i){var r=Xa(e,t.ch,i);return r==null?null:new K(t.line,r,i<0?"after":"before")}function Ya(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var u=tr(i,t.doc.direction);if(u){var p=n<0?De(u):u[0],g=n<0==(p.level==1),m=g?"after":"before",b;if(p.level>0||t.doc.direction=="rtl"){var C=ti(t,i);b=n<0?i.text.length-1:0;var S=Jt(t,C,b).top;b=Ti(function(_){return Jt(t,C,_).top==S},n<0==(p.level==1)?p.from:p.to-1,b),m=="before"&&(b=Xa(i,b,1))}else b=n<0?p.to:p.from;return new K(r,b,m)}}return new K(r,n<0?i.text.length:0,n<0?"before":"after")}function Sh(e,t,i,r){var n=tr(t,e.doc.direction);if(!n)return Ka(t,i,r);i.ch>=t.text.length?(i.ch=t.text.length,i.sticky="before"):i.ch<=0&&(i.ch=0,i.sticky="after");var u=Mi(n,i.ch,i.sticky),p=n[u];if(e.doc.direction=="ltr"&&p.level%2==0&&(r>0?p.to>i.ch:p.from=p.from&&_>=C.begin)){var M=S?"before":"after";return new K(i.line,_,M)}}var P=function(J,ee,V){for(var ie=function(Le,it){return it?new K(i.line,g(Le,1),"before"):new K(i.line,Le,"after")};J>=0&&J0==(se.level!=1),we=le?V.begin:g(V.end,-1);if(se.from<=we&&we0?C.end:g(C.begin,-1);return Z!=null&&!(r>0&&Z==t.text.length)&&(U=P(r>0?0:n.length-1,r,b(Z)),U)?U:null}var rn={selectAll:pu,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),vt)},killLine:function(e){return hi(e,function(t){if(t.empty()){var i=ae(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line0)n=new K(n.line,n.ch+1),e.replaceRange(u.charAt(n.ch-1)+u.charAt(n.ch-2),K(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var p=ae(e.doc,n.line-1).text;p&&(n=new K(n.line,1),e.replaceRange(u.charAt(0)+e.doc.lineSeparator()+p.charAt(p.length-1),K(n.line-1,p.length-1),n,"+transpose"))}}i.push(new Ae(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){return St(e,function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");t=e.listSelections();for(var r=0;re&&me(t,this.pos)==0&&i==this.button};var on,an;function Bh(e,t){var i=+new Date;return an&&an.compare(i,e,t)?(on=an=null,"triple"):on&&on.compare(i,e,t)?(an=new Qa(i,e,t),on=null,"double"):(on=new Qa(i,e,t),an=null,"single")}function Hu(e){var t=this,i=t.display;if(!($e(t,e)||i.activeTouch&&i.input.supportsTouch())){if(i.input.ensurePolled(),i.shift=e.shiftKey,nr(i,e)){v||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(!Ja(t,e)){var r=Nr(t,e),n=Zl(e),u=r?Bh(r,n):"single";xe(t).focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&_h(t,n,r,u,e))&&(n==1?r?Nh(t,r,u,e):$o(e)==i.scroller&&bt(e):n==2?(r&&Xn(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(de?t.display.input.onContextMenu(e):Ma(t)))}}}function _h(e,t,i,r,n){var u="Click";return r=="double"?u="Double"+u:r=="triple"&&(u="Triple"+u),u=(t==1?"Left":t==2?"Middle":"Right")+u,nn(e,Tu(u,n),n,function(p){if(typeof p=="string"&&(p=rn[p]),!p)return!1;var g=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),g=p(e,i)!=Ze}finally{e.state.suppressEdits=!1}return g})}function zh(e,t,i){var r=e.getOption("configureMouse"),n=r?r(e,t,i):{};if(n.unit==null){var u=I?i.shiftKey&&i.metaKey:i.altKey;n.unit=u?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(n.extend==null||e.doc.extend)&&(n.extend=e.doc.extend||i.shiftKey),n.addNew==null&&(n.addNew=O?i.metaKey:i.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(O?i.altKey:i.ctrlKey)),n}function Nh(e,t,i,r){c?setTimeout(mt(Ps,e),0):e.curOp.focus=he(te(e));var n=zh(e,i,r),u=e.doc.sel,p;e.options.dragDrop&&Uc&&!e.isReadOnly()&&i=="single"&&(p=u.contains(t))>-1&&(me((p=u.ranges[p]).from(),t)<0||t.xRel>0)&&(me(p.to(),t)>0||t.xRel<0)?Oh(e,r,t,n):Ih(e,r,t,n)}function Oh(e,t,i,r){var n=e.display,u=!1,p=tt(e,function(b){v&&(n.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:Ma(e)),Mt(n.wrapper.ownerDocument,"mouseup",p),Mt(n.wrapper.ownerDocument,"mousemove",g),Mt(n.scroller,"dragstart",m),Mt(n.scroller,"drop",p),u||(bt(b),r.addNew||Xn(e.doc,i,null,null,r.extend),v&&!F||c&&d==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),g=function(b){u=u||Math.abs(t.clientX-b.clientX)+Math.abs(t.clientY-b.clientY)>=10},m=function(){return u=!0};v&&(n.scroller.draggable=!0),e.state.draggingText=p,p.copy=!r.moveOnDrag,ue(n.wrapper.ownerDocument,"mouseup",p),ue(n.wrapper.ownerDocument,"mousemove",g),ue(n.scroller,"dragstart",m),ue(n.scroller,"drop",p),e.state.delayingBlurEvent=!0,setTimeout(function(){return n.input.focus()},20),n.scroller.dragDrop&&n.scroller.dragDrop()}function Pu(e,t,i){if(i=="char")return new Ae(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new Ae(K(t.line,0),ve(e.doc,K(t.line+1,0)));var r=i(e,t);return new Ae(r.from,r.to)}function Ih(e,t,i,r){c&&Ma(e);var n=e.display,u=e.doc;bt(t);var p,g,m=u.sel,b=m.ranges;if(r.addNew&&!r.extend?(g=u.sel.contains(i),g>-1?p=b[g]:p=new Ae(i,i)):(p=u.sel.primary(),g=u.sel.primIndex),r.unit=="rectangle")r.addNew||(p=new Ae(i,i)),i=Nr(e,t,!0,!0),g=-1;else{var C=Pu(e,i,r.unit);r.extend?p=ja(p,C.anchor,C.head,r.extend):p=C}r.addNew?g==-1?(g=b.length,lt(u,Wt(e,b.concat([p]),g),{scroll:!1,origin:"*mouse"})):b.length>1&&b[g].empty()&&r.unit=="char"&&!r.extend?(lt(u,Wt(e,b.slice(0,g).concat(b.slice(g+1)),0),{scroll:!1,origin:"*mouse"}),m=u.sel):Ga(u,g,p,Fi):(g=0,lt(u,new Bt([p],0),Fi),m=u.sel);var S=i;function _(V){if(me(S,V)!=0)if(S=V,r.unit=="rectangle"){for(var ie=[],se=e.options.tabSize,le=Ye(ae(u,i.line).text,i.ch,se),we=Ye(ae(u,V.line).text,V.ch,se),Le=Math.min(le,we),it=Math.max(le,we),Ie=Math.min(i.line,V.line),Et=Math.min(e.lastLine(),Math.max(i.line,V.line));Ie<=Et;Ie++){var wt=ae(u,Ie).text,Xe=Kt(wt,Le,se);Le==it?ie.push(new Ae(K(Ie,Xe),K(Ie,Xe))):wt.length>Xe&&ie.push(new Ae(K(Ie,Xe),K(Ie,Kt(wt,it,se))))}ie.length||ie.push(new Ae(i,i)),lt(u,Wt(e,m.ranges.slice(0,g).concat(ie),g),{origin:"*mouse",scroll:!1}),e.scrollIntoView(V)}else{var Ct=p,ot=Pu(e,V,r.unit),Qe=Ct.anchor,Ke;me(ot.anchor,Qe)>0?(Ke=ot.head,Qe=En(Ct.from(),ot.anchor)):(Ke=ot.anchor,Qe=Sn(Ct.to(),ot.head));var qe=m.ranges.slice(0);qe[g]=Hh(e,new Ae(ve(u,Qe),Ke)),lt(u,Wt(e,qe,g),Fi)}}var M=n.wrapper.getBoundingClientRect(),P=0;function U(V){var ie=++P,se=Nr(e,V,!0,r.unit=="rectangle");if(se)if(me(se,S)!=0){e.curOp.focus=he(te(e)),_(se);var le=qn(n,u);(se.line>=le.to||se.lineM.bottom?20:0;we&&setTimeout(tt(e,function(){P==ie&&(n.scroller.scrollTop+=we,U(V))}),50)}}function Z(V){e.state.selectingText=!1,P=1/0,V&&(bt(V),n.input.focus()),Mt(n.wrapper.ownerDocument,"mousemove",J),Mt(n.wrapper.ownerDocument,"mouseup",ee),u.history.lastSelOrigin=null}var J=tt(e,function(V){V.buttons===0||!Zl(V)?Z(V):U(V)}),ee=tt(e,Z);e.state.selectingText=ee,ue(n.wrapper.ownerDocument,"mousemove",J),ue(n.wrapper.ownerDocument,"mouseup",ee)}function Hh(e,t){var i=t.anchor,r=t.head,n=ae(e.doc,i.line);if(me(i,r)==0&&i.sticky==r.sticky)return t;var u=tr(n);if(!u)return t;var p=Mi(u,i.ch,i.sticky),g=u[p];if(g.from!=i.ch&&g.to!=i.ch)return t;var m=p+(g.from==i.ch==(g.level!=1)?0:1);if(m==0||m==u.length)return t;var b;if(r.line!=i.line)b=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var C=Mi(u,r.ch,r.sticky),S=C-p||(r.ch-i.ch)*(g.level==1?-1:1);C==m-1||C==m?b=S<0:b=S>0}var _=u[m+(b?-1:0)],M=b==(_.level==1),P=M?_.from:_.to,U=M?"after":"before";return i.ch==P&&i.sticky==U?t:new Ae(new K(i.line,P,U),r)}function qu(e,t,i,r){var n,u;if(t.touches)n=t.touches[0].clientX,u=t.touches[0].clientY;else try{n=t.clientX,u=t.clientY}catch{return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&bt(t);var p=e.display,g=p.lineDiv.getBoundingClientRect();if(u>g.bottom||!Ot(e,i))return Vo(t);u-=g.top-p.viewOffset;for(var m=0;m=n){var C=Br(e.doc,u),S=e.display.gutterSpecs[m];return je(e,i,e,C,S.className,t),Vo(t)}}}function Ja(e,t){return qu(e,t,"gutterClick",!0)}function Ru(e,t){nr(e.display,t)||Ph(e,t)||$e(e,t,"contextmenu")||de||e.display.input.onContextMenu(t)}function Ph(e,t){return Ot(e,"gutterContextMenu")?qu(e,t,"gutterContextMenu",!1):!1}function Wu(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Pi(e)}var pi={toString:function(){return"CodeMirror.Init"}},Uu={},$n={};function qh(e){var t=e.optionHandlers;function i(r,n,u,p){e.defaults[r]=n,u&&(t[r]=p?function(g,m,b){b!=pi&&u(g,m,b)}:u)}e.defineOption=i,e.Init=pi,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,Ra(r)},!0),i("indentUnit",2,Ra,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){Ki(r),Pi(r),yt(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!!n){var u=[],p=r.doc.first;r.doc.iter(function(m){for(var b=0;;){var C=m.text.indexOf(n,b);if(C==-1)break;b=C+n.length,u.push(K(p,C))}p++});for(var g=u.length-1;g>=0;g--)fi(r.doc,n,u[g],K(u[g].line,u[g].ch+n.length))}}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(r,n,u){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),u!=pi&&r.refresh()}),i("specialCharPlaceholder",gd,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",z?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(r,n){return r.getInputField().spellcheck=n},!0),i("autocorrect",!1,function(r,n){return r.getInputField().autocorrect=n},!0),i("autocapitalize",!1,function(r,n){return r.getInputField().autocapitalize=n},!0),i("rtlMoveVisually",!W),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Wu(r),Xi(r)},!0),i("keyMap","default",function(r,n,u){var p=Jn(n),g=u!=pi&&Jn(u);g&&g.detach&&g.detach(r,p),p.attach&&p.attach(r,g||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Wh,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=Pa(n,r.options.lineNumbers),Xi(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?Aa(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return ai(r)},!0),i("scrollbarStyle","native",function(r){Gs(r),ai(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),i("lineNumbers",!1,function(r,n){r.display.gutterSpecs=Pa(r.options.gutters,n),Xi(r)},!0),i("firstLineNumber",1,Xi,!0),i("lineNumberFormatter",function(r){return r},Xi,!0),i("showCursorWhenSelecting",!1,qi,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,n){n=="nocursor"&&(ni(r),r.display.input.blur()),r.display.input.readOnlyChanged(n)}),i("screenReaderLabel",null,function(r,n){n=n===""?null:n,r.display.input.screenReaderLabelChanged(n)}),i("disableInput",!1,function(r,n){n||r.display.input.reset()},!0),i("dragDrop",!0,Rh),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,qi,!0),i("singleCursorHeightPerLine",!0,qi,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,Ki,!0),i("addModeClass",!1,Ki,!0),i("pollInterval",100),i("undoDepth",200,function(r,n){return r.doc.history.undoDepth=n}),i("historyEventDelay",1250),i("viewportMargin",10,function(r){return r.refresh()},!0),i("maxHighlightLength",1e4,Ki,!0),i("moveInputWithCursor",!0,function(r,n){n||r.display.input.resetPosition()}),i("tabindex",null,function(r,n){return r.display.input.getField().tabIndex=n||""}),i("autofocus",null),i("direction","ltr",function(r,n){return r.doc.setDirection(n)},!0),i("phrases",null)}function Rh(e,t,i){var r=i&&i!=pi;if(!t!=!r){var n=e.display.dragFunctions,u=t?ue:Mt;u(e.display.scroller,"dragstart",n.start),u(e.display.scroller,"dragenter",n.enter),u(e.display.scroller,"dragover",n.over),u(e.display.scroller,"dragleave",n.leave),u(e.display.scroller,"drop",n.drop)}}function Wh(e){e.options.lineWrapping?(be(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(oe(e.display.wrapper,"CodeMirror-wrap"),va(e)),Fa(e),yt(e),Pi(e),setTimeout(function(){return ai(e)},100)}function Ne(e,t){var i=this;if(!(this instanceof Ne))return new Ne(e,t);this.options=t=t?Lt(t):{},Lt(Uu,t,!1);var r=t.value;typeof r=="string"?r=new xt(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new Ne.inputStyles[t.inputStyle](this),u=this.display=new th(e,r,n,t);u.wrapper.CodeMirror=this,Wu(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Gs(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new ct,keySeq:null,specialChars:null},t.autofocus&&!z&&u.input.focus(),c&&d<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Uh(this),xh(),Pr(this),this.curOp.forceUpdate=!0,tu(this,r),t.autofocus&&!z||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&Ba(i)},20):ni(this);for(var p in $n)$n.hasOwnProperty(p)&&$n[p](this,t[p],pi);Ys(this),t.finishInit&&t.finishInit(this);for(var g=0;g20*20}ue(t.scroller,"touchstart",function(m){if(!$e(e,m)&&!u(m)&&!Ja(e,m)){t.input.ensurePolled(),clearTimeout(i);var b=+new Date;t.activeTouch={start:b,moved:!1,prev:b-r.end<=300?r:null},m.touches.length==1&&(t.activeTouch.left=m.touches[0].pageX,t.activeTouch.top=m.touches[0].pageY)}}),ue(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),ue(t.scroller,"touchend",function(m){var b=t.activeTouch;if(b&&!nr(t,m)&&b.left!=null&&!b.moved&&new Date-b.start<300){var C=e.coordsChar(t.activeTouch,"page"),S;!b.prev||p(b,b.prev)?S=new Ae(C,C):!b.prev.prev||p(b,b.prev.prev)?S=e.findWordAt(C):S=new Ae(K(C.line,0),ve(e.doc,K(C.line+1,0))),e.setSelection(S.anchor,S.head),e.focus(),bt(m)}n()}),ue(t.scroller,"touchcancel",n),ue(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Wi(e,t.scroller.scrollTop),Ir(e,t.scroller.scrollLeft,!0),je(e,"scroll",e))}),ue(t.scroller,"mousewheel",function(m){return Js(e,m)}),ue(t.scroller,"DOMMouseScroll",function(m){return Js(e,m)}),ue(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(m){$e(e,m)||Bi(m)},over:function(m){$e(e,m)||(yh(e,m),Bi(m))},start:function(m){return bh(e,m)},drop:tt(e,vh),leave:function(m){$e(e,m)||Su(e)}};var g=t.input.getField();ue(g,"keyup",function(m){return Ou.call(e,m)}),ue(g,"keydown",tt(e,Nu)),ue(g,"keypress",tt(e,Iu)),ue(g,"focus",function(m){return Ba(e,m)}),ue(g,"blur",function(m){return ni(e,m)})}var Va=[];Ne.defineInitHook=function(e){return Va.push(e)};function ln(e,t,i,r){var n=e.doc,u;i==null&&(i="add"),i=="smart"&&(n.mode.indent?u=zi(e,t).state:i="prev");var p=e.options.tabSize,g=ae(n,t),m=Ye(g.text,null,p);g.stateAfter&&(g.stateAfter=null);var b=g.text.match(/^\s*/)[0],C;if(!r&&!/\S/.test(g.text))C=0,i="not";else if(i=="smart"&&(C=n.mode.indent(u,g.text.slice(b.length),g.text),C==Ze||C>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?C=Ye(ae(n,t-1).text,null,p):C=0:i=="add"?C=m+e.options.indentUnit:i=="subtract"?C=m-e.options.indentUnit:typeof i=="number"&&(C=m+i),C=Math.max(0,C);var S="",_=0;if(e.options.indentWithTabs)for(var M=Math.floor(C/p);M;--M)_+=p,S+=" ";if(_p,m=ra(t),b=null;if(g&&r.ranges.length>1)if(Ut&&Ut.text.join(` +`)==t){if(r.ranges.length%Ut.text.length==0){b=[];for(var C=0;C=0;_--){var M=r.ranges[_],P=M.from(),U=M.to();M.empty()&&(i&&i>0?P=K(P.line,P.ch-i):e.state.overwrite&&!g?U=K(U.line,Math.min(ae(u,U.line).text.length,U.ch+De(m).length)):g&&Ut&&Ut.lineWise&&Ut.text.join(` +`)==m.join(` +`)&&(P=U=K(P.line,0)));var Z={from:P,to:U,text:b?b[_%b.length]:m,origin:n||(g?"paste":e.state.cutIncoming>p?"cut":"+input")};ui(e.doc,Z),et(e,"inputRead",e,Z)}t&&!g&&Gu(e,t),oi(e),e.curOp.updateInput<2&&(e.curOp.updateInput=S),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ju(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&St(t,function(){return $a(t,i,0,null,"paste")}),!0}function Gu(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var i=e.doc.sel,r=i.ranges.length-1;r>=0;r--){var n=i.ranges[r];if(!(n.head.ch>100||r&&i.ranges[r-1].head.line==n.head.line)){var u=e.getModeAt(n.head),p=!1;if(u.electricChars){for(var g=0;g-1){p=ln(e,n.head.line,"smart");break}}else u.electricInput&&u.electricInput.test(ae(e.doc,n.head.line).text.slice(0,n.head.ch))&&(p=ln(e,n.head.line,"smart"));p&&et(e,"electricInput",e,n.head.line)}}}function Xu(e){for(var t=[],i=[],r=0;ru&&(ln(this,g.head.line,r,!0),u=g.head.line,p==this.doc.sel.primIndex&&oi(this));else{var m=g.from(),b=g.to(),C=Math.max(u,m.line);u=Math.min(this.lastLine(),b.line-(b.ch?0:1))+1;for(var S=C;S0&&Ga(this.doc,p,new Ae(m,_[p].to()),vt)}}}),getTokenAt:function(r,n){return is(this,r,n)},getLineTokens:function(r,n){return is(this,K(r),n,!0)},getTokenTypeAt:function(r){r=ve(this.doc,r);var n=es(this,ae(this.doc,r.line)),u=0,p=(n.length-1)/2,g=r.ch,m;if(g==0)m=n[2];else for(;;){var b=u+p>>1;if((b?n[b*2-1]:0)>=g)p=b;else if(n[b*2+1]m&&(r=m,p=!0),g=ae(this.doc,r)}else g=r;return Nn(this,g,{top:0,left:0},n||"page",u||p).top+(p?this.doc.height-ir(g):0)},defaultTextHeight:function(){return ri(this.display)},defaultCharWidth:function(){return ii(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,u,p,g){var m=this.display;r=Rt(this,ve(this.doc,r));var b=r.bottom,C=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),m.sizer.appendChild(n),p=="over")b=r.top;else if(p=="above"||p=="near"){var S=Math.max(m.wrapper.clientHeight,this.doc.height),_=Math.max(m.sizer.clientWidth,m.lineSpace.clientWidth);(p=="above"||r.bottom+n.offsetHeight>S)&&r.top>n.offsetHeight?b=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=S&&(b=r.bottom),C+n.offsetWidth>_&&(C=_-n.offsetWidth)}n.style.top=b+"px",n.style.left=n.style.right="",g=="right"?(C=m.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(g=="left"?C=0:g=="middle"&&(C=(m.sizer.clientWidth-n.offsetWidth)/2),n.style.left=C+"px"),u&&Rd(this,{left:C,top:b,right:C+n.offsetWidth,bottom:b+n.offsetHeight})},triggerOnKeyDown:dt(Nu),triggerOnKeyPress:dt(Iu),triggerOnKeyUp:Ou,triggerOnMouseDown:dt(Hu),execCommand:function(r){if(rn.hasOwnProperty(r))return rn[r].call(null,this)},triggerElectric:dt(function(r){Gu(this,r)}),findPosH:function(r,n,u,p){var g=1;n<0&&(g=-1,n=-n);for(var m=ve(this.doc,r),b=0;b0&&C(u.charAt(p-1));)--p;for(;g.5||this.options.lineWrapping)&&Fa(this),je(this,"refresh",this)}),swapDoc:dt(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),tu(this,r),Pi(this),this.display.input.reset(),Ri(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,et(this,"swapDoc",this,n),n}),phrase:function(r){var n=this.options.phrases;return n&&Object.prototype.hasOwnProperty.call(n,r)?n[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Qr(e),e.registerHelper=function(r,n,u){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=u},e.registerGlobalHelper=function(r,n,u,p){e.registerHelper(r,n,p),i[r]._global.push({pred:u,val:p})}}function tl(e,t,i,r,n){var u=t,p=i,g=ae(e,t.line),m=n&&e.direction=="rtl"?-i:i;function b(){var ee=t.line+m;return ee=e.first+e.size?!1:(t=new K(ee,t.ch,t.sticky),g=ae(e,ee))}function C(ee){var V;if(r=="codepoint"){var ie=g.text.charCodeAt(t.ch+(i>0?0:-1));if(isNaN(ie))V=null;else{var se=i>0?ie>=55296&&ie<56320:ie>=56320&&ie<57343;V=new K(t.line,Math.max(0,Math.min(g.text.length,t.ch+i*(se?2:1))),-i)}}else n?V=Sh(e.cm,g,t,i):V=Ka(g,t,i);if(V==null)if(!ee&&b())t=Ya(n,e.cm,g,t.line,m);else return!1;else t=V;return!0}if(r=="char"||r=="codepoint")C();else if(r=="column")C(!0);else if(r=="word"||r=="group")for(var S=null,_=r=="group",M=e.cm&&e.cm.getHelper(t,"wordChars"),P=!0;!(i<0&&!C(!P));P=!1){var U=g.text.charAt(t.ch)||` +`,Z=Dn(U,M)?"w":_&&U==` +`?"n":!_||/\s/.test(U)?null:"p";if(_&&!P&&!Z&&(Z="s"),S&&S!=Z){i<0&&(i=1,C(),t.sticky="after");break}if(Z&&(S=Z),i>0&&!C(!P))break}var J=Yn(e,t,u,p,!0);return ua(u,J)&&(J.hitSide=!0),J}function Yu(e,t,i,r){var n=e.doc,u=t.left,p;if(r=="page"){var g=Math.min(e.display.wrapper.clientHeight,xe(e).innerHeight||n(e).documentElement.clientHeight),m=Math.max(g-.5*ri(e.display),3);p=(i>0?t.bottom:t.top)+i*m}else r=="line"&&(p=i>0?t.bottom+3:t.top-3);for(var b;b=ka(e,u,p),!!b.outside;){if(i<0?p<=0:p>=n.height){b.hitSide=!0;break}p+=i*5}return b}var Te=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ct,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Te.prototype.init=function(e){var t=this,i=this,r=i.cm,n=i.div=e.lineDiv;n.contentEditable=!0,el(n,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function u(g){for(var m=g.target;m;m=m.parentNode){if(m==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(m.className))break}return!1}ue(n,"paste",function(g){!u(g)||$e(r,g)||ju(g,r)||d<=11&&setTimeout(tt(r,function(){return t.updateFromDOM()}),20)}),ue(n,"compositionstart",function(g){t.composing={data:g.data,done:!1}}),ue(n,"compositionupdate",function(g){t.composing||(t.composing={data:g.data,done:!1})}),ue(n,"compositionend",function(g){t.composing&&(g.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ue(n,"touchstart",function(){return i.forceCompositionEnd()}),ue(n,"input",function(){t.composing||t.readFromDOMSoon()});function p(g){if(!(!u(g)||$e(r,g))){if(r.somethingSelected())eo({lineWise:!1,text:r.getSelections()}),g.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var m=Xu(r);eo({lineWise:!0,text:m.text}),g.type=="cut"&&r.operation(function(){r.setSelections(m.ranges,0,vt),r.replaceSelection("",null,"cut")})}else return;if(g.clipboardData){g.clipboardData.clearData();var b=Ut.text.join(` +`);if(g.clipboardData.setData("Text",b),g.clipboardData.getData("Text")==b){g.preventDefault();return}}var C=Ku(),S=C.firstChild;el(S),r.display.lineSpace.insertBefore(C,r.display.lineSpace.firstChild),S.value=Ut.text.join(` +`);var _=he(Ce(n));A(S),setTimeout(function(){r.display.lineSpace.removeChild(C),_.focus(),_==n&&i.showPrimarySelection()},50)}}ue(n,"copy",p),ue(n,"cut",p)},Te.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Te.prototype.prepareSelection=function(){var e=Hs(this.cm,!1);return e.focus=he(Ce(this.div))==this.div,e},Te.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Te.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Te.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),r=i.from(),n=i.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||n.line=t.display.viewFrom&&Zu(t,r)||{node:g[0].measure.map[2],offset:0},b=n.linee.firstLine()&&(r=K(r.line-1,ae(e.doc,r.line-1).length)),n.ch==ae(e.doc,n.line).text.length&&n.linet.viewTo-1)return!1;var u,p,g;r.line==t.viewFrom||(u=Or(e,r.line))==0?(p=Fe(t.view[0].line),g=t.view[0].node):(p=Fe(t.view[u].line),g=t.view[u-1].node.nextSibling);var m=Or(e,n.line),b,C;if(m==t.view.length-1?(b=t.viewTo-1,C=t.lineDiv.lastChild):(b=Fe(t.view[m+1].line)-1,C=t.view[m+1].node.previousSibling),!g)return!1;for(var S=e.doc.splitLines(Xh(e,g,C,p,b)),_=Mr(e.doc,K(p,0),K(b,ae(e.doc,b).text.length));S.length>1&&_.length>1;)if(De(S)==De(_))S.pop(),_.pop(),b--;else if(S[0]==_[0])S.shift(),_.shift(),p++;else break;for(var M=0,P=0,U=S[0],Z=_[0],J=Math.min(U.length,Z.length);Mr.ch&&ee.charCodeAt(ee.length-P-1)==V.charCodeAt(V.length-P-1);)M--,P++;S[S.length-1]=ee.slice(0,ee.length-P).replace(/^\u200b+/,""),S[0]=S[0].slice(M).replace(/\u200b+$/,"");var se=K(p,M),le=K(b,_.length?De(_).length-P:0);if(S.length>1||S[0]||me(se,le))return fi(e.doc,S,se,le,"+input"),!0},Te.prototype.ensurePolled=function(){this.forceCompositionEnd()},Te.prototype.reset=function(){this.forceCompositionEnd()},Te.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Te.prototype.readFromDOMSoon=function(){var e=this;this.readDOMTimeout==null&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80))},Te.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&St(this.cm,function(){return yt(e.cm)})},Te.prototype.setUneditable=function(e){e.contentEditable="false"},Te.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||tt(this.cm,$a)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},Te.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Te.prototype.onContextMenu=function(){},Te.prototype.resetPosition=function(){},Te.prototype.needsContentAttribute=!0;function Zu(e,t){var i=wa(e,t.line);if(!i||i.hidden)return null;var r=ae(e.doc,t.line),n=ks(i,r,t.line),u=tr(r,e.doc.direction),p="left";if(u){var g=Mi(u,t.ch);p=g%2?"right":"left"}var m=As(n.map,t.ch,p);return m.offset=m.collapse=="right"?m.end:m.start,m}function Gh(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function gi(e,t){return t&&(e.bad=!0),e}function Xh(e,t,i,r,n){var u="",p=!1,g=e.doc.lineSeparator(),m=!1;function b(M){return function(P){return P.id==M}}function C(){p&&(u+=g,m&&(u+=g),p=m=!1)}function S(M){M&&(C(),u+=M)}function _(M){if(M.nodeType==1){var P=M.getAttribute("cm-text");if(P){S(P);return}var U=M.getAttribute("cm-marker"),Z;if(U){var J=e.findMarks(K(r,0),K(n+1,0),b(+U));J.length&&(Z=J[0].find(0))&&S(Mr(e.doc,Z.from,Z.to).join(g));return}if(M.getAttribute("contenteditable")=="false")return;var ee=/^(pre|div|p|li|table|br)$/i.test(M.nodeName);if(!/^br$/i.test(M.nodeName)&&M.textContent.length==0)return;ee&&C();for(var V=0;V=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),ue(n,"paste",function(p){$e(r,p)||ju(p,r)||(r.state.pasteIncoming=+new Date,i.fastPoll())});function u(p){if(!$e(r,p)){if(r.somethingSelected())eo({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var g=Xu(r);eo({lineWise:!0,text:g.text}),p.type=="cut"?r.setSelections(g.ranges,null,vt):(i.prevInput="",n.value=g.text.join(` +`),A(n))}else return;p.type=="cut"&&(r.state.cutIncoming=+new Date)}}ue(n,"cut",u),ue(n,"copy",u),ue(e.scroller,"paste",function(p){if(!(nr(e,p)||$e(r,p))){if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var g=new Event("paste");g.clipboardData=p.clipboardData,n.dispatchEvent(g)}}),ue(e.lineSpace,"selectstart",function(p){nr(e,p)||bt(p)}),ue(n,"compositionstart",function(){var p=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:p,range:r.markText(p,r.getCursor("to"),{className:"CodeMirror-composing"})}}),ue(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},We.prototype.createField=function(e){this.wrapper=Ku(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;el(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},We.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},We.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=Hs(e);if(e.options.moveInputWithCursor){var n=Rt(e,i.sel.primary().head,"div"),u=t.wrapper.getBoundingClientRect(),p=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+p.top-u.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+p.left-u.left))}return r},We.prototype.showSelection=function(e){var t=this.cm,i=t.display;Y(i.cursorDiv,e.cursors),Y(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},We.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i,t.state.focused&&A(this.textarea),c&&d>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",c&&d>=9&&(this.hasSelection=null));this.resetting=!1}},We.prototype.getField=function(){return this.textarea},We.prototype.supportsTouch=function(){return!1},We.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!z||he(Ce(this.textarea))!=this.textarea))try{this.textarea.focus()}catch{}},We.prototype.blur=function(){this.textarea.blur()},We.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},We.prototype.receivedFocus=function(){this.slowPoll()},We.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},We.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function i(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,i)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,i)},We.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||Xc(i)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var n=i.value;if(n==r&&!t.somethingSelected())return!1;if(c&&d>=9&&this.hasSelection===n||O&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var u=n.charCodeAt(0);if(u==8203&&!r&&(r="\u200B"),u==8666)return this.reset(),this.cm.execCommand("undo")}for(var p=0,g=Math.min(r.length,n.length);p1e3||n.indexOf(` +`)>-1?i.value=e.prevInput="":e.prevInput=n,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},We.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},We.prototype.onKeyPress=function(){c&&d>=9&&(this.hasSelection=null),this.fastPoll()},We.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var u=Nr(i,e),p=r.scroller.scrollTop;if(!u||k)return;var g=i.options.resetSelectionOnContextMenu;g&&i.doc.sel.contains(u)==-1&&tt(i,lt)(i.doc,yr(u),vt);var m=n.style.cssText,b=t.wrapper.style.cssText,C=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",n.style.cssText=`position: absolute; width: 30px; height: 30px; + top: `+(e.clientY-C.top-5)+"px; left: "+(e.clientX-C.left-5)+`px; z-index: 1000; background: `+(c?"rgba(255, 255, 255, .05)":"transparent")+`; - outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var k;m&&(k=i.ownerDocument.defaultView.scrollY),r.input.focus(),m&&i.ownerDocument.defaultView.scrollTo(null,k),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=M,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function B(){if(i.selectionStart!=null){var R=n.somethingSelected(),Y="\u200B"+(R?i.value:"");i.value="\u21DA",i.value=Y,t.prevInput=R?"":"\u200B",i.selectionStart=1,i.selectionEnd=Y.length,r.selForContextMenu=n.doc.sel}}function M(){if(t.contextMenuPending==M&&(t.contextMenuPending=!1,t.wrapper.style.cssText=b,i.style.cssText=v,c&&d<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=h),i.selectionStart!=null)){(!c||c&&d<9)&&B();var R=0,Y=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?tt(n,hu)(n):R++<10?r.detectingSelectAll=setTimeout(Y,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Y,200)}}if(c&&d>=9&&B(),me){Bn(e);var z=function(){Lt(window,"mouseup",z),setTimeout(M,20)};ue(window,"mouseup",z)}else setTimeout(M,50)},qe.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},qe.prototype.setUneditable=function(){},qe.prototype.needsContentAttribute=!1;function jh(e,t){if(t=t?Tt(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=ve(we(e));t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=g.getValue()}var i;if(e.form&&(ue(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var u=e.form;i=u.submit;try{var h=u.submit=function(){r(),u.submit=i,u.submit(),u.submit=h}}catch{}}t.finishInit=function(v){v.save=r,v.getTextArea=function(){return e},v.toTextArea=function(){v.toTextArea=isNaN,r(),e.parentNode.removeChild(v.getWrapperElement()),e.style.display="",e.form&&(Lt(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var g=Oe(function(v){return e.parentNode.insertBefore(v,e.nextSibling)},t);return g}function Gh(e){e.off=Lt,e.on=ue,e.wheelEventPixels=$d,e.Doc=yt,e.splitLines=ta,e.countColumn=Ye,e.findColumn=Kt,e.isWordChar=Yo,e.Pass=Ze,e.signal=je,e.Line=Vr,e.changeEnd=xr,e.scrollbarModel=Us,e.Pos=X,e.cmpPos=pe,e.modes=na,e.mimeModes=Jr,e.resolveMode=ki,e.getMode=ia,e.modeExtensions=$r,e.extendMode=Kc,e.copyState=Lr,e.startState=Zl,e.innerMode=oa,e.commands=ni,e.keyMap=ar,e.keyName=Tu,e.isModifierKey=Au,e.lookupKey=hn,e.normalizeKeyMap=xh,e.StringStream=Ge,e.SharedTextMarker=ei,e.TextMarker=wr,e.LineWidget=Vn,e.e_preventDefault=mt,e.e_stopPropagation=Kl,e.e_stop=Bn,e.addClass=De,e.contains=Z,e.rmClass=le,e.keyNames=Cr}Ih(Oe),Rh(Oe);var Xh="iter insert remove copy getEditor constructor".split(" ");for(var ro in yt.prototype)yt.prototype.hasOwnProperty(ro)&&Ne(Xh,ro)<0&&(Oe.prototype[ro]=function(e){return function(){return e.apply(this.doc,arguments)}}(yt.prototype[ro]));return Qr(yt),Oe.inputStyles={textarea:qe,contenteditable:Fe},Oe.defineMode=function(e){!Oe.defaults.mode&&e!="null"&&(Oe.defaults.mode=e),Gc.apply(this,arguments)},Oe.defineMIME=Xc,Oe.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Oe.defineMIME("text/plain","null"),Oe.defineExtension=function(e,t){Oe.prototype[e]=t},Oe.defineDocExtension=function(e,t){yt.prototype[e]=t},Oe.fromTextArea=jh,Gh(Oe),Oe.version="5.65.21",Oe})});var $u=at((Qu,Ju)=>{(function(o){typeof Qu=="object"&&typeof Ju=="object"?o(Et()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,s=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,a=/[*+-]\s/;o.commands.newlineAndIndentContinueMarkdownList=function(p){if(p.getOption("disableInput"))return o.Pass;for(var c=p.listSelections(),d=[],m=0;m\s*$/.test(_),N=!/>\s*$/.test(_);(O||N)&&p.replaceRange("",{line:y.line,ch:0},{line:y.line,ch:y.ch+1}),d[m]=` -`}else{var I=L[1],P=L[5],q=!(a.test(L[2])||L[2].indexOf(">")>=0),G=q?parseInt(L[3],10)+1+L[4]:L[2].replace("x"," ");d[m]=` -`+I+G+P,q&&f(p,y)}}p.replaceSelections(d)};function f(p,c){var d=c.line,m=0,y=0,x=l.exec(p.getLine(d)),C=x[1];do{m+=1;var S=d+m,F=p.getLine(S),_=l.exec(F);if(_){var L=_[1],T=parseInt(x[3],10)+m-y,O=parseInt(_[3],10),N=O;if(C===L&&!isNaN(O))T===O&&(N=O+1),T>O&&(N=T+1),p.replaceRange(F.replace(l,L+N+_[4]+_[5]),{line:S,ch:0},{line:S,ch:F.length});else{if(C.length>L.length||C.length{var Vu=Et();Vu.commands.tabAndIndentMarkdownList=function(o){var l=o.listSelections(),s=l[0].head,a=o.getStateAfter(s.line),f=a.list!==!1;if(f){o.execCommand("indentMore");return}if(o.options.indentWithTabs)o.execCommand("insertTab");else{var p=Array(o.options.tabSize+1).join(" ");o.replaceSelection(p)}};Vu.commands.shiftTabAndUnindentMarkdownList=function(o){var l=o.listSelections(),s=l[0].head,a=o.getStateAfter(s.line),f=a.list!==!1;if(f){o.execCommand("indentLess");return}if(o.options.indentWithTabs)o.execCommand("insertTab");else{var p=Array(o.options.tabSize+1).join(" ");o.replaceSelection(p)}}});var nf=at((tf,rf)=>{(function(o){typeof tf=="object"&&typeof rf=="object"?o(Et()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("fullScreen",!1,function(a,f,p){p==o.Init&&(p=!1),!p!=!f&&(f?l(a):s(a))});function l(a){var f=a.getWrapperElement();a.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:f.style.width,height:f.style.height},f.style.width="",f.style.height="auto",f.className+=" CodeMirror-fullscreen",document.documentElement.style.overflow="hidden",a.refresh()}function s(a){var f=a.getWrapperElement();f.className=f.className.replace(/\s*CodeMirror-fullscreen\b/,""),document.documentElement.style.overflow="";var p=a.state.fullScreenRestore;f.style.width=p.width,f.style.height=p.height,window.scrollTo(p.scrollLeft,p.scrollTop),a.refresh()}})});var ol=at((of,af)=>{(function(o){typeof of=="object"&&typeof af=="object"?o(Et()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},s={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};o.defineMode("xml",function(a,f){var p=a.indentUnit,c={},d=f.htmlMode?l:s;for(var m in d)c[m]=d[m];for(var m in f)c[m]=f[m];var y,x;function C(E,H){function W(De){return H.tokenize=De,De(E,H)}var Z=E.next();if(Z=="<")return E.eat("!")?E.eat("[")?E.match("CDATA[")?W(_("atom","]]>")):null:E.match("--")?W(_("comment","-->")):E.match("DOCTYPE",!0,!0)?(E.eatWhile(/[\w\._\-]/),W(L(1))):null:E.eat("?")?(E.eatWhile(/[\w\._\-]/),H.tokenize=_("meta","?>"),"meta"):(y=E.eat("/")?"closeTag":"openTag",H.tokenize=S,"tag bracket");if(Z=="&"){var ve;return E.eat("#")?E.eat("x")?ve=E.eatWhile(/[a-fA-F\d]/)&&E.eat(";"):ve=E.eatWhile(/[\d]/)&&E.eat(";"):ve=E.eatWhile(/[\w\.\-:]/)&&E.eat(";"),ve?"atom":"error"}else return E.eatWhile(/[^&<]/),null}C.isInText=!0;function S(E,H){var W=E.next();if(W==">"||W=="/"&&E.eat(">"))return H.tokenize=C,y=W==">"?"endTag":"selfcloseTag","tag bracket";if(W=="=")return y="equals",null;if(W=="<"){H.tokenize=C,H.state=P,H.tagName=H.tagStart=null;var Z=H.tokenize(E,H);return Z?Z+" tag error":"tag error"}else return/[\'\"]/.test(W)?(H.tokenize=F(W),H.stringStartCol=E.column(),H.tokenize(E,H)):(E.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function F(E){var H=function(W,Z){for(;!W.eol();)if(W.next()==E){Z.tokenize=S;break}return"string"};return H.isInAttribute=!0,H}function _(E,H){return function(W,Z){for(;!W.eol();){if(W.match(H)){Z.tokenize=C;break}W.next()}return E}}function L(E){return function(H,W){for(var Z;(Z=H.next())!=null;){if(Z=="<")return W.tokenize=L(E+1),W.tokenize(H,W);if(Z==">")if(E==1){W.tokenize=C;break}else return W.tokenize=L(E-1),W.tokenize(H,W)}return"meta"}}function T(E){return E&&E.toLowerCase()}function O(E,H,W){this.prev=E.context,this.tagName=H||"",this.indent=E.indented,this.startOfLine=W,(c.doNotIndent.hasOwnProperty(H)||E.context&&E.context.noIndent)&&(this.noIndent=!0)}function N(E){E.context&&(E.context=E.context.prev)}function I(E,H){for(var W;;){if(!E.context||(W=E.context.tagName,!c.contextGrabbers.hasOwnProperty(T(W))||!c.contextGrabbers[T(W)].hasOwnProperty(T(H))))return;N(E)}}function P(E,H,W){return E=="openTag"?(W.tagStart=H.column(),q):E=="closeTag"?G:P}function q(E,H,W){return E=="word"?(W.tagName=H.current(),x="tag",U):c.allowMissingTagName&&E=="endTag"?(x="tag bracket",U(E,H,W)):(x="error",q)}function G(E,H,W){if(E=="word"){var Z=H.current();return W.context&&W.context.tagName!=Z&&c.implicitlyClosed.hasOwnProperty(T(W.context.tagName))&&N(W),W.context&&W.context.tagName==Z||c.matchClosing===!1?(x="tag",K):(x="tag error",me)}else return c.allowMissingTagName&&E=="endTag"?(x="tag bracket",K(E,H,W)):(x="error",me)}function K(E,H,W){return E!="endTag"?(x="error",K):(N(W),P)}function me(E,H,W){return x="error",K(E,H,W)}function U(E,H,W){if(E=="word")return x="attribute",le;if(E=="endTag"||E=="selfcloseTag"){var Z=W.tagName,ve=W.tagStart;return W.tagName=W.tagStart=null,E=="selfcloseTag"||c.autoSelfClosers.hasOwnProperty(T(Z))?I(W,Z):(I(W,Z),W.context=new O(W,Z,ve==W.indented)),P}return x="error",U}function le(E,H,W){return E=="equals"?j:(c.allowMissing||(x="error"),U(E,H,W))}function j(E,H,W){return E=="string"?ee:E=="word"&&c.allowUnquoted?(x="string",U):(x="error",U(E,H,W))}function ee(E,H,W){return E=="string"?ee:U(E,H,W)}return{startState:function(E){var H={tokenize:C,state:P,indented:E||0,tagName:null,tagStart:null,context:null};return E!=null&&(H.baseIndent=E),H},token:function(E,H){if(!H.tagName&&E.sol()&&(H.indented=E.indentation()),E.eatSpace())return null;y=null;var W=H.tokenize(E,H);return(W||y)&&W!="comment"&&(x=null,H.state=H.state(y||W,E,H),x&&(W=x=="error"?W+" error":x)),W},indent:function(E,H,W){var Z=E.context;if(E.tokenize.isInAttribute)return E.tagStart==E.indented?E.stringStartCol+1:E.indented+p;if(Z&&Z.noIndent)return o.Pass;if(E.tokenize!=S&&E.tokenize!=C)return W?W.match(/^(\s*)/)[0].length:0;if(E.tagName)return c.multilineTagIndentPastTag!==!1?E.tagStart+E.tagName.length+2:E.tagStart+p*(c.multilineTagIndentFactor||1);if(c.alignCDATA&&/$/,blockCommentStart:"",configuration:c.htmlMode?"html":"xml",helperType:c.htmlMode?"html":"xml",skipAttribute:function(E){E.state==j&&(E.state=U)},xmlCurrentTag:function(E){return E.tagName?{name:E.tagName,close:E.type=="closeTag"}:null},xmlCurrentContext:function(E){for(var H=[],W=E.context;W;W=W.prev)H.push(W.tagName);return H.reverse()}}}),o.defineMIME("text/xml","xml"),o.defineMIME("application/xml","xml"),o.mimeModes.hasOwnProperty("text/html")||o.defineMIME("text/html",{name:"xml",htmlMode:!0})})});var uf=at((lf,sf)=>{(function(o){typeof lf=="object"&&typeof sf=="object"?o(Et()):typeof define=="function"&&define.amd?define(["../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy","cbl"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded JavaScript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"],alias:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var l=0;l-1&&a.substring(c+1,a.length);if(d)return o.findModeByExtension(d)},o.findModeByName=function(a){a=a.toLowerCase();for(var f=0;f{(function(o){typeof ff=="object"&&typeof cf=="object"?o(Et(),ol(),uf()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../xml/xml","../meta"],o):o(CodeMirror)})(function(o){"use strict";o.defineMode("markdown",function(l,s){var a=o.getMode(l,"text/html"),f=a.name=="null";function p(A){if(o.findModeByName){var D=o.findModeByName(A);D&&(A=D.mime||D.mimes[0])}var te=o.getMode(l,A);return te.name=="null"?null:te}s.highlightFormatting===void 0&&(s.highlightFormatting=!1),s.maxBlockquoteDepth===void 0&&(s.maxBlockquoteDepth=0),s.taskLists===void 0&&(s.taskLists=!1),s.strikethrough===void 0&&(s.strikethrough=!1),s.emoji===void 0&&(s.emoji=!1),s.fencedCodeBlockHighlighting===void 0&&(s.fencedCodeBlockHighlighting=!0),s.fencedCodeBlockDefaultMode===void 0&&(s.fencedCodeBlockDefaultMode="text/plain"),s.xml===void 0&&(s.xml=!0),s.tokenTypeOverrides===void 0&&(s.tokenTypeOverrides={});var c={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var d in c)c.hasOwnProperty(d)&&s.tokenTypeOverrides[d]&&(c[d]=s.tokenTypeOverrides[d]);var m=/^([*\-_])(?:\s*\1){2,}\s*$/,y=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,x=/^\[(x| )\](?=\s)/i,C=s.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,S=/^ {0,3}(?:\={1,}|-{2,})\s*$/,F=/^[^#!\[\]*_\\<>` "'(~:]+/,_=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,L=/^\s*\[[^\]]+?\]:.*$/,T=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,O=" ";function N(A,D,te){return D.f=D.inline=te,te(A,D)}function I(A,D,te){return D.f=D.block=te,te(A,D)}function P(A){return!A||!/\S/.test(A.string)}function q(A){if(A.linkTitle=!1,A.linkHref=!1,A.linkText=!1,A.em=!1,A.strong=!1,A.strikethrough=!1,A.quote=0,A.indentedCode=!1,A.f==K){var D=f;if(!D){var te=o.innerMode(a,A.htmlState);D=te.mode.name=="xml"&&te.state.tagStart===null&&!te.state.context&&te.state.tokenize.isInText}D&&(A.f=j,A.block=G,A.htmlState=null)}return A.trailingSpace=0,A.trailingSpaceNewLine=!1,A.prevLine=A.thisLine,A.thisLine={stream:null},null}function G(A,D){var te=A.column()===D.indentation,we=P(D.prevLine.stream),ye=D.indentedCode,gt=D.prevLine.hr,Tt=D.list!==!1,Ye=(D.listStack[D.listStack.length-1]||0)+3;D.indentedCode=!1;var ft=D.indentation;if(D.indentationDiff===null&&(D.indentationDiff=D.indentation,Tt)){for(D.list=null;ft=4&&(ye||D.prevLine.fencedCodeEnd||D.prevLine.header||we))return A.skipToEnd(),D.indentedCode=!0,c.code;if(A.eatSpace())return null;if(te&&D.indentation<=Ye&&(Ze=A.match(C))&&Ze[1].length<=6)return D.quote=0,D.header=Ze[1].length,D.thisLine.header=!0,s.highlightFormatting&&(D.formatting="header"),D.f=D.inline,U(D);if(D.indentation<=Ye&&A.eat(">"))return D.quote=te?1:D.quote+1,s.highlightFormatting&&(D.formatting="quote"),A.eatSpace(),U(D);if(!He&&!D.setext&&te&&D.indentation<=Ye&&(Ze=A.match(y))){var vt=Ze[1]?"ol":"ul";return D.indentation=ft+A.current().length,D.list=!0,D.quote=0,D.listStack.push(D.indentation),D.em=!1,D.strong=!1,D.code=!1,D.strikethrough=!1,s.taskLists&&A.match(x,!1)&&(D.taskList=!0),D.f=D.inline,s.highlightFormatting&&(D.formatting=["list","list-"+vt]),U(D)}else{if(te&&D.indentation<=Ye&&(Ze=A.match(_,!0)))return D.quote=0,D.fencedEndRE=new RegExp(Ze[1]+"+ *$"),D.localMode=s.fencedCodeBlockHighlighting&&p(Ze[2]||s.fencedCodeBlockDefaultMode),D.localMode&&(D.localState=o.startState(D.localMode)),D.f=D.block=me,s.highlightFormatting&&(D.formatting="code-block"),D.code=-1,U(D);if(D.setext||(!Ne||!Tt)&&!D.quote&&D.list===!1&&!D.code&&!He&&!L.test(A.string)&&(Ze=A.lookAhead(1))&&(Ze=Ze.match(S)))return D.setext?(D.header=D.setext,D.setext=0,A.skipToEnd(),s.highlightFormatting&&(D.formatting="header")):(D.header=Ze[0].charAt(0)=="="?1:2,D.setext=D.header),D.thisLine.header=!0,D.f=D.inline,U(D);if(He)return A.skipToEnd(),D.hr=!0,D.thisLine.hr=!0,c.hr;if(A.peek()==="[")return N(A,D,Z)}return N(A,D,D.inline)}function K(A,D){var te=a.token(A,D.htmlState);if(!f){var we=o.innerMode(a,D.htmlState);(we.mode.name=="xml"&&we.state.tagStart===null&&!we.state.context&&we.state.tokenize.isInText||D.md_inside&&A.current().indexOf(">")>-1)&&(D.f=j,D.block=G,D.htmlState=null)}return te}function me(A,D){var te=D.listStack[D.listStack.length-1]||0,we=D.indentation=A.quote?D.push(c.formatting+"-"+A.formatting[te]+"-"+A.quote):D.push("error"))}if(A.taskOpen)return D.push("meta"),D.length?D.join(" "):null;if(A.taskClosed)return D.push("property"),D.length?D.join(" "):null;if(A.linkHref?D.push(c.linkHref,"url"):(A.strong&&D.push(c.strong),A.em&&D.push(c.em),A.strikethrough&&D.push(c.strikethrough),A.emoji&&D.push(c.emoji),A.linkText&&D.push(c.linkText),A.code&&D.push(c.code),A.image&&D.push(c.image),A.imageAltText&&D.push(c.imageAltText,"link"),A.imageMarker&&D.push(c.imageMarker)),A.header&&D.push(c.header,c.header+"-"+A.header),A.quote&&(D.push(c.quote),!s.maxBlockquoteDepth||s.maxBlockquoteDepth>=A.quote?D.push(c.quote+"-"+A.quote):D.push(c.quote+"-"+s.maxBlockquoteDepth)),A.list!==!1){var we=(A.listStack.length-1)%3;we?we===1?D.push(c.list2):D.push(c.list3):D.push(c.list1)}return A.trailingSpaceNewLine?D.push("trailing-space-new-line"):A.trailingSpace&&D.push("trailing-space-"+(A.trailingSpace%2?"a":"b")),D.length?D.join(" "):null}function le(A,D){if(A.match(F,!0))return U(D)}function j(A,D){var te=D.text(A,D);if(typeof te<"u")return te;if(D.list)return D.list=null,U(D);if(D.taskList){var we=A.match(x,!0)[1]===" ";return we?D.taskOpen=!0:D.taskClosed=!0,s.highlightFormatting&&(D.formatting="task"),D.taskList=!1,U(D)}if(D.taskOpen=!1,D.taskClosed=!1,D.header&&A.match(/^#+$/,!0))return s.highlightFormatting&&(D.formatting="header"),U(D);var ye=A.next();if(D.linkTitle){D.linkTitle=!1;var gt=ye;ye==="("&&(gt=")"),gt=(gt+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Tt="^\\s*(?:[^"+gt+"\\\\]+|\\\\\\\\|\\\\.)"+gt;if(A.match(new RegExp(Tt),!0))return c.linkHref}if(ye==="`"){var Ye=D.formatting;s.highlightFormatting&&(D.formatting="code"),A.eatWhile("`");var ft=A.current().length;if(D.code==0&&(!D.quote||ft==1))return D.code=ft,U(D);if(ft==D.code){var Ne=U(D);return D.code=0,Ne}else return D.formatting=Ye,U(D)}else if(D.code)return U(D);if(ye==="\\"&&(A.next(),s.highlightFormatting)){var He=U(D),Ze=c.formatting+"-escape";return He?He+" "+Ze:Ze}if(ye==="!"&&A.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return D.imageMarker=!0,D.image=!0,s.highlightFormatting&&(D.formatting="image"),U(D);if(ye==="["&&D.imageMarker&&A.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return D.imageMarker=!1,D.imageAltText=!0,s.highlightFormatting&&(D.formatting="image"),U(D);if(ye==="]"&&D.imageAltText){s.highlightFormatting&&(D.formatting="image");var He=U(D);return D.imageAltText=!1,D.image=!1,D.inline=D.f=E,He}if(ye==="["&&!D.image)return D.linkText&&A.match(/^.*?\]/)||(D.linkText=!0,s.highlightFormatting&&(D.formatting="link")),U(D);if(ye==="]"&&D.linkText){s.highlightFormatting&&(D.formatting="link");var He=U(D);return D.linkText=!1,D.inline=D.f=A.match(/\(.*?\)| ?\[.*?\]/,!1)?E:j,He}if(ye==="<"&&A.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){D.f=D.inline=ee,s.highlightFormatting&&(D.formatting="link");var He=U(D);return He?He+=" ":He="",He+c.linkInline}if(ye==="<"&&A.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){D.f=D.inline=ee,s.highlightFormatting&&(D.formatting="link");var He=U(D);return He?He+=" ":He="",He+c.linkEmail}if(s.xml&&ye==="<"&&A.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var vt=A.string.indexOf(">",A.pos);if(vt!=-1){var Tn=A.string.substring(A.start,vt);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Tn)&&(D.md_inside=!0)}return A.backUp(1),D.htmlState=o.startState(a),I(A,D,K)}if(s.xml&&ye==="<"&&A.match(/^\/\w*?>/))return D.md_inside=!1,"tag";if(ye==="*"||ye==="_"){for(var Xt=1,Kt=A.pos==1?" ":A.string.charAt(A.pos-2);Xt<3&&A.eat(ye);)Xt++;var zt=A.peek()||" ",pr=!/\s/.test(zt)&&(!T.test(zt)||/\s/.test(Kt)||T.test(Kt)),Ce=!/\s/.test(Kt)&&(!T.test(Kt)||/\s/.test(zt)||T.test(zt)),Ht=null,gr=null;if(Xt%2&&(!D.em&&pr&&(ye==="*"||!Ce||T.test(Kt))?Ht=!0:D.em==ye&&Ce&&(ye==="*"||!pr||T.test(zt))&&(Ht=!1)),Xt>1&&(!D.strong&&pr&&(ye==="*"||!Ce||T.test(Kt))?gr=!0:D.strong==ye&&Ce&&(ye==="*"||!pr||T.test(zt))&&(gr=!1)),gr!=null||Ht!=null){s.highlightFormatting&&(D.formatting=Ht==null?"strong":gr==null?"em":"strong em"),Ht===!0&&(D.em=ye),gr===!0&&(D.strong=ye);var Ne=U(D);return Ht===!1&&(D.em=!1),gr===!1&&(D.strong=!1),Ne}}else if(ye===" "&&(A.eat("*")||A.eat("_"))){if(A.peek()===" ")return U(D);A.backUp(1)}if(s.strikethrough){if(ye==="~"&&A.eatWhile(ye)){if(D.strikethrough){s.highlightFormatting&&(D.formatting="strikethrough");var Ne=U(D);return D.strikethrough=!1,Ne}else if(A.match(/^[^\s]/,!1))return D.strikethrough=!0,s.highlightFormatting&&(D.formatting="strikethrough"),U(D)}else if(ye===" "&&A.match("~~",!0)){if(A.peek()===" ")return U(D);A.backUp(2)}}if(s.emoji&&ye===":"&&A.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){D.emoji=!0,s.highlightFormatting&&(D.formatting="emoji");var wi=U(D);return D.emoji=!1,wi}return ye===" "&&(A.match(/^ +$/,!1)?D.trailingSpace++:D.trailingSpace&&(D.trailingSpaceNewLine=!0)),U(D)}function ee(A,D){var te=A.next();if(te===">"){D.f=D.inline=j,s.highlightFormatting&&(D.formatting="link");var we=U(D);return we?we+=" ":we="",we+c.linkInline}return A.match(/^[^>]+/,!0),c.linkInline}function E(A,D){if(A.eatSpace())return null;var te=A.next();return te==="("||te==="["?(D.f=D.inline=W(te==="("?")":"]"),s.highlightFormatting&&(D.formatting="link-string"),D.linkHref=!0,U(D)):"error"}var H={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function W(A){return function(D,te){var we=D.next();if(we===A){te.f=te.inline=j,s.highlightFormatting&&(te.formatting="link-string");var ye=U(te);return te.linkHref=!1,ye}return D.match(H[A]),te.linkHref=!0,U(te)}}function Z(A,D){return A.match(/^([^\]\\]|\\.)*\]:/,!1)?(D.f=ve,A.next(),s.highlightFormatting&&(D.formatting="link"),D.linkText=!0,U(D)):N(A,D,j)}function ve(A,D){if(A.match("]:",!0)){D.f=D.inline=De,s.highlightFormatting&&(D.formatting="link");var te=U(D);return D.linkText=!1,te}return A.match(/^([^\]\\]|\\.)+/,!0),c.linkText}function De(A,D){return A.eatSpace()?null:(A.match(/^[^\s]+/,!0),A.peek()===void 0?D.linkTitle=!0:A.match(/^(?:\s+(?:"(?:[^"\\]|\\.)+"|'(?:[^'\\]|\\.)+'|\((?:[^)\\]|\\.)+\)))?/,!0),D.f=D.inline=j,c.linkHref+" url")}var Le={startState:function(){return{f:G,prevLine:{stream:null},thisLine:{stream:null},block:G,htmlState:null,indentation:0,inline:j,text:le,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(A){return{f:A.f,prevLine:A.prevLine,thisLine:A.thisLine,block:A.block,htmlState:A.htmlState&&o.copyState(a,A.htmlState),indentation:A.indentation,localMode:A.localMode,localState:A.localMode?o.copyState(A.localMode,A.localState):null,inline:A.inline,text:A.text,formatting:!1,linkText:A.linkText,linkTitle:A.linkTitle,linkHref:A.linkHref,code:A.code,em:A.em,strong:A.strong,strikethrough:A.strikethrough,emoji:A.emoji,header:A.header,setext:A.setext,hr:A.hr,taskList:A.taskList,list:A.list,listStack:A.listStack.slice(0),quote:A.quote,indentedCode:A.indentedCode,trailingSpace:A.trailingSpace,trailingSpaceNewLine:A.trailingSpaceNewLine,md_inside:A.md_inside,fencedEndRE:A.fencedEndRE}},token:function(A,D){if(D.formatting=!1,A!=D.thisLine.stream){if(D.header=0,D.hr=!1,A.match(/^\s*$/,!0))return q(D),null;if(D.prevLine=D.thisLine,D.thisLine={stream:A},D.taskList=!1,D.trailingSpace=0,D.trailingSpaceNewLine=!1,!D.localState&&(D.f=D.block,D.f!=K)){var te=A.match(/^\s*/,!0)[0].replace(/\t/g,O).length;if(D.indentation=te,D.indentationDiff=null,te>0)return null}}return D.f(A,D)},innerMode:function(A){return A.block==K?{state:A.htmlState,mode:a}:A.localState?{state:A.localState,mode:A.localMode}:{state:A,mode:Le}},indent:function(A,D,te){return A.block==K&&a.indent?a.indent(A.htmlState,D,te):A.localState&&A.localMode.indent?A.localMode.indent(A.localState,D,te):o.Pass},blankLine:q,getType:U,blockCommentStart:"",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return Le},"xml"),o.defineMIME("text/markdown","markdown"),o.defineMIME("text/x-markdown","markdown")})});var ll=at((df,hf)=>{(function(o){typeof df=="object"&&typeof hf=="object"?o(Et()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.overlayMode=function(l,s,a){return{startState:function(){return{base:o.startState(l),overlay:o.startState(s),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(f){return{base:o.copyState(l,f.base),overlay:o.copyState(s,f.overlay),basePos:f.basePos,baseCur:null,overlayPos:f.overlayPos,overlayCur:null}},token:function(f,p){return(f!=p.streamSeen||Math.min(p.basePos,p.overlayPos){(function(o){typeof pf=="object"&&typeof gf=="object"?o(Et()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){o.defineOption("placeholder","",function(d,m,y){var x=y&&y!=o.Init;if(m&&!x)d.on("blur",f),d.on("change",p),d.on("swapDoc",p),o.on(d.getInputField(),"compositionupdate",d.state.placeholderCompose=function(){a(d)}),p(d);else if(!m&&x){d.off("blur",f),d.off("change",p),d.off("swapDoc",p),o.off(d.getInputField(),"compositionupdate",d.state.placeholderCompose),l(d);var C=d.getWrapperElement();C.className=C.className.replace(" CodeMirror-empty","")}m&&!d.hasFocus()&&f(d)});function l(d){d.state.placeholder&&(d.state.placeholder.parentNode.removeChild(d.state.placeholder),d.state.placeholder=null)}function s(d){l(d);var m=d.state.placeholder=document.createElement("pre");m.style.cssText="height: 0; overflow: visible",m.style.direction=d.getOption("direction"),m.className="CodeMirror-placeholder CodeMirror-line-like";var y=d.getOption("placeholder");typeof y=="string"&&(y=document.createTextNode(y)),m.appendChild(y),d.display.lineSpace.insertBefore(m,d.display.lineSpace.firstChild)}function a(d){setTimeout(function(){var m=!1;if(d.lineCount()==1){var y=d.getInputField();m=y.nodeName=="TEXTAREA"?!d.getLine(0).length:!/[^\u200b]/.test(y.querySelector(".CodeMirror-line").textContent)}m?s(d):l(d)},20)}function f(d){c(d)&&s(d)}function p(d){var m=d.getWrapperElement(),y=c(d);m.className=m.className.replace(" CodeMirror-empty","")+(y?" CodeMirror-empty":""),y?s(d):l(d)}function c(d){return d.lineCount()===1&&d.getLine(0)===""}})});var yf=at((mf,bf)=>{(function(o){typeof mf=="object"&&typeof bf=="object"?o(Et()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("autoRefresh",!1,function(a,f){a.state.autoRefresh&&(s(a,a.state.autoRefresh),a.state.autoRefresh=null),f&&a.display.wrapper.offsetHeight==0&&l(a,a.state.autoRefresh={delay:f.delay||250})});function l(a,f){function p(){a.display.wrapper.offsetHeight?(s(a,f),a.display.lastWrapHeight!=a.display.wrapper.clientHeight&&a.refresh()):f.timeout=setTimeout(p,f.delay)}f.timeout=setTimeout(p,f.delay),f.hurry=function(){clearTimeout(f.timeout),f.timeout=setTimeout(p,50)},o.on(window,"mouseup",f.hurry),o.on(window,"keyup",f.hurry)}function s(a,f){clearTimeout(f.timeout),o.off(window,"mouseup",f.hurry),o.off(window,"keyup",f.hurry)}})});var wf=at((xf,Df)=>{(function(o){typeof xf=="object"&&typeof Df=="object"?o(Et()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("styleSelectedText",!1,function(x,C,S){var F=S&&S!=o.Init;C&&!F?(x.state.markedSelection=[],x.state.markedSelectionStyle=typeof C=="string"?C:"CodeMirror-selectedtext",m(x),x.on("cursorActivity",l),x.on("change",s)):!C&&F&&(x.off("cursorActivity",l),x.off("change",s),d(x),x.state.markedSelection=x.state.markedSelectionStyle=null)});function l(x){x.state.markedSelection&&x.operation(function(){y(x)})}function s(x){x.state.markedSelection&&x.state.markedSelection.length&&x.operation(function(){d(x)})}var a=8,f=o.Pos,p=o.cmpPos;function c(x,C,S,F){if(p(C,S)!=0)for(var _=x.state.markedSelection,L=x.state.markedSelectionStyle,T=C.line;;){var O=T==C.line?C:f(T,0),N=T+a,I=N>=S.line,P=I?S:f(N,0),q=x.markText(O,P,{className:L});if(F==null?_.push(q):_.splice(F++,0,q),I)break;T=N}}function d(x){for(var C=x.state.markedSelection,S=0;S1)return m(x);var C=x.getCursor("start"),S=x.getCursor("end"),F=x.state.markedSelection;if(!F.length)return c(x,C,S);var _=F[0].find(),L=F[F.length-1].find();if(!_||!L||S.line-C.line<=a||p(C,L.to)>=0||p(S,_.from)<=0)return m(x);for(;p(C,_.from)>0;)F.shift().clear(),_=F[0].find();for(p(C,_.from)<0&&(_.to.line-C.line0&&(S.line-L.from.line{(function(o){typeof Cf=="object"&&typeof kf=="object"?o(Et()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l=o.Pos;function s(T){var O=T.flags;return O??(T.ignoreCase?"i":"")+(T.global?"g":"")+(T.multiline?"m":"")}function a(T,O){for(var N=s(T),I=N,P=0;PG);K++){var me=T.getLine(q++);I=I==null?me:I+` -`+me}P=P*2,O.lastIndex=N.ch;var U=O.exec(I);if(U){var le=I.slice(0,U.index).split(` -`),j=U[0].split(` -`),ee=N.line+le.length-1,E=le[le.length-1].length;return{from:l(ee,E),to:l(ee+j.length-1,j.length==1?E+j[0].length:j[j.length-1].length),match:U}}}}function d(T,O,N){for(var I,P=0;P<=T.length;){O.lastIndex=P;var q=O.exec(T);if(!q)break;var G=q.index+q[0].length;if(G>T.length-N)break;(!I||G>I.index+I[0].length)&&(I=q),P=q.index+1}return I}function m(T,O,N){O=a(O,"g");for(var I=N.line,P=N.ch,q=T.firstLine();I>=q;I--,P=-1){var G=T.getLine(I),K=d(G,O,P<0?0:G.length-P);if(K)return{from:l(I,K.index),to:l(I,K.index+K[0].length),match:K}}}function y(T,O,N){if(!f(O))return m(T,O,N);O=a(O,"gm");for(var I,P=1,q=T.getLine(N.line).length-N.ch,G=N.line,K=T.firstLine();G>=K;){for(var me=0;me=K;me++){var U=T.getLine(G--);I=I==null?U:U+` -`+I}P*=2;var le=d(I,O,q);if(le){var j=I.slice(0,le.index).split(` -`),ee=le[0].split(` -`),E=G+j.length,H=j[j.length-1].length;return{from:l(E,H),to:l(E+ee.length-1,ee.length==1?H+ee[0].length:ee[ee.length-1].length),match:le}}}}var x,C;String.prototype.normalize?(x=function(T){return T.normalize("NFD").toLowerCase()},C=function(T){return T.normalize("NFD")}):(x=function(T){return T.toLowerCase()},C=function(T){return T});function S(T,O,N,I){if(T.length==O.length)return N;for(var P=0,q=N+Math.max(0,T.length-O.length);;){if(P==q)return P;var G=P+q>>1,K=I(T.slice(0,G)).length;if(K==N)return G;K>N?q=G:P=G+1}}function F(T,O,N,I){if(!O.length)return null;var P=I?x:C,q=P(O).split(/\r|\n\r?/);e:for(var G=N.line,K=N.ch,me=T.lastLine()+1-q.length;G<=me;G++,K=0){var U=T.getLine(G).slice(K),le=P(U);if(q.length==1){var j=le.indexOf(q[0]);if(j==-1)continue e;var N=S(U,le,j,P)+K;return{from:l(G,S(U,le,j,P)+K),to:l(G,S(U,le,j+q[0].length,P)+K)}}else{var ee=le.length-q[0].length;if(le.slice(ee)!=q[0])continue e;for(var E=1;E=me;G--,K=-1){var U=T.getLine(G);K>-1&&(U=U.slice(0,K));var le=P(U);if(q.length==1){var j=le.lastIndexOf(q[0]);if(j==-1)continue e;return{from:l(G,S(U,le,j,P)),to:l(G,S(U,le,j+q[0].length,P))}}else{var ee=q[q.length-1];if(le.slice(0,ee.length)!=ee)continue e;for(var E=1,N=G-q.length+1;E(this.doc.getLine(O.line)||"").length&&(O.ch=0,O.line++)),o.cmpPos(O,this.doc.clipPos(O))!=0))return this.atOccurrence=!1;var N=this.matches(T,O);if(this.afterEmptyMatch=N&&o.cmpPos(N.from,N.to)==0,N)return this.pos=N,this.atOccurrence=!0,this.pos.match||!0;var I=l(T?this.doc.firstLine():this.doc.lastLine()+1,0);return this.pos={from:I,to:I},this.atOccurrence=!1},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(T,O){if(this.atOccurrence){var N=o.splitLines(T);this.doc.replaceRange(N,this.pos.from,this.pos.to,O),this.pos.to=l(this.pos.from.line+N.length-1,N[N.length-1].length+(N.length==1?this.pos.from.ch:0))}}},o.defineExtension("getSearchCursor",function(T,O,N){return new L(this.doc,T,O,N)}),o.defineDocExtension("getSearchCursor",function(T,O,N){return new L(this,T,O,N)}),o.defineExtension("selectMatches",function(T,O){for(var N=[],I=this.getSearchCursor(T,this.getCursor("from"),O);I.findNext()&&!(o.cmpPos(I.to(),this.getCursor("to"))>0);)N.push({anchor:I.from(),head:I.to()});N.length&&this.setSelections(N,0)})})});var Ff=at((Ef,Af)=>{(function(o){typeof Ef=="object"&&typeof Af=="object"?o(Et(),al(),ll()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../markdown/markdown","../../addon/mode/overlay"],o):o(CodeMirror)})(function(o){"use strict";var l=/^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i;o.defineMode("gfm",function(s,a){var f=0;function p(y){return y.code=!1,null}var c={startState:function(){return{code:!1,codeBlock:!1,ateSpace:!1}},copyState:function(y){return{code:y.code,codeBlock:y.codeBlock,ateSpace:y.ateSpace}},token:function(y,x){if(x.combineTokens=null,x.codeBlock)return y.match(/^```+/)?(x.codeBlock=!1,null):(y.skipToEnd(),null);if(y.sol()&&(x.code=!1),y.sol()&&y.match(/^```+/))return y.skipToEnd(),x.codeBlock=!0,null;if(y.peek()==="`"){y.next();var C=y.pos;y.eatWhile("`");var S=1+y.pos-C;return x.code?S===f&&(x.code=!1):(f=S,x.code=!0),null}else if(x.code)return y.next(),null;if(y.eatSpace())return x.ateSpace=!0,null;if((y.sol()||x.ateSpace)&&(x.ateSpace=!1,a.gitHubSpice!==!1)){if(y.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?=.{0,6}\d)(?:[a-f0-9]{7,40}\b)/))return x.combineTokens=!0,"link";if(y.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/))return x.combineTokens=!0,"link"}return y.match(l)&&y.string.slice(y.start-2,y.start)!="]("&&(y.start==0||/\W/.test(y.string.charAt(y.start-1)))?(x.combineTokens=!0,"link"):(y.next(),null)},blankLine:p},d={taskLists:!0,strikethrough:!0,emoji:!0};for(var m in a)d[m]=a[m];return d.name="markdown",o.overlayMode(o.getMode(s,d),c)},"markdown"),o.defineMIME("text/x-gfm","gfm")})});var Tf=at(()=>{});var Lf=at((Ig,ul)=>{var sl;(function(){"use strict";sl=function(o,l,s,a){a=a||{},this.dictionary=null,this.rules={},this.dictionaryTable=new Map,this.compoundRules=[],this.compoundRuleCodes={},this.replacementTable=[],this.flags=a.flags||{},this.memoized={},this.loaded=!1;var f=this,p,c,d,m,y;o&&(f.dictionary=o,l&&s?F():(typeof window<"u"?(a.dictionaryPath?p=a.dictionaryPath:p="typo/dictionaries",window.chrome&&window.chrome.runtime&&window.chrome.runtime.getURL?p=window.chrome.runtime.getURL(p):window.browser&&window.browser.runtime&&window.browser.runtime.getURL&&(p=window.browser.runtime.getURL(p))):typeof __dirname<"u"?p=__dirname+"/dictionaries":p="./dictionaries",l||x(p+"/"+o+"/"+o+".aff",C),s||x(p+"/"+o+"/"+o+".dic",S)));function x(_,L){var T=f._readFile(_,null,a?.asyncLoad);a?.asyncLoad?T.then(function(O){L(O)}):L(T)}function C(_){l=_,s&&F()}function S(_){s=_,l&&F()}function F(){for(f.rules=f._parseAFF(l),f.compoundRuleCodes={},c=0,m=f.compoundRules.length;c0&&(q.continuationClasses=I),P!=="."&&(S==="SFX"?q.match=new RegExp(P+"$"):q.match=new RegExp("^"+P)),T!="0"&&(S==="SFX"?q.remove=new RegExp(T+"$"):q.remove=T),L.push(q)}l[F]={type:S,combineable:_==="Y",entries:L},c+=f}else if(S==="COMPOUNDRULE"){for(f=parseInt(C[1],10),d=c+1,y=c+1+f;d0&&(s.get(le)===null&&s.set(le,[]),s.get(le).push(j))}for(var f=1,p=l.length;f1){var x=this.parseRuleCodes(m[1]);(!("NEEDAFFIX"in this.flags)||x.indexOf(this.flags.NEEDAFFIX)===-1)&&a(y,x);for(var C=0,S=x.length;C"u"){if("COMPOUNDMIN"in this.flags&&o.length>=this.flags.COMPOUNDMIN){for(s=0,a=this.compoundRules.length;s"u"&&(s=Array.prototype.concat.apply([],this.dictionaryTable.get(o))),s&&s.indexOf(this.flags[l])!==-1))},alphabet:"",suggest:function(o,l){if(!this.loaded)throw"Dictionary not loaded.";if(l=l||5,this.memoized.hasOwnProperty(o)){var s=this.memoized[o].limit;if(l<=s||this.memoized[o].suggestions.length1&&K[1][1]!==K[1][0]&&(P=K[0]+K[1][1]+K[1][0]+K[1].substring(2),(!F||y.check(P))&&(P in _?_[P]+=1:_[P]=1)),K[1]){var me=K[1].substring(0,1).toUpperCase()===K[1].substring(0,1)?"uppercase":"lowercase";for(T=0;Tee?1:le[0].localeCompare(U[0])}P.sort(q).reverse();var G=[],K="lowercase";S.toUpperCase()===S?K="uppercase":S.substr(0,1).toUpperCase()+S.substr(1).toLowerCase()===S&&(K="capitalized");var me=l;for(N=0;N{"use strict";var Mf=Lf();function Ie(o){if(o=o||{},typeof o.codeMirrorInstance!="function"||typeof o.codeMirrorInstance.defineMode!="function"){console.log("CodeMirror Spell Checker: You must provide an instance of CodeMirror via the option `codeMirrorInstance`");return}String.prototype.includes||(String.prototype.includes=function(){"use strict";return String.prototype.indexOf.apply(this,arguments)!==-1}),o.codeMirrorInstance.defineMode("spell-checker",function(l){if(!Ie.aff_loading){Ie.aff_loading=!0;var s=new XMLHttpRequest;s.open("GET","https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.aff",!0),s.onload=function(){s.readyState===4&&s.status===200&&(Ie.aff_data=s.responseText,Ie.num_loaded++,Ie.num_loaded==2&&(Ie.typo=new Mf("en_US",Ie.aff_data,Ie.dic_data,{platform:"any"})))},s.send(null)}if(!Ie.dic_loading){Ie.dic_loading=!0;var a=new XMLHttpRequest;a.open("GET","https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.dic",!0),a.onload=function(){a.readyState===4&&a.status===200&&(Ie.dic_data=a.responseText,Ie.num_loaded++,Ie.num_loaded==2&&(Ie.typo=new Mf("en_US",Ie.aff_data,Ie.dic_data,{platform:"any"})))},a.send(null)}var f='!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~ ',p={token:function(d){var m=d.peek(),y="";if(f.includes(m))return d.next(),null;for(;(m=d.peek())!=null&&!f.includes(m);)y+=m,d.next();return Ie.typo&&!Ie.typo.check(y)?"spell-error":null}},c=o.codeMirrorInstance.getMode(l,l.backdrop||"text/plain");return o.codeMirrorInstance.overlayMode(c,p,!0)})}Ie.num_loaded=0;Ie.aff_loading=!1;Ie.dic_loading=!1;Ie.aff_data="";Ie.dic_data="";Ie.typo;_f.exports=Ie});var Xf=at(Be=>{"use strict";function Nf(o,l){for(var s=0;so.length)&&(l=o.length);for(var s=0,a=new Array(l);s=o.length?{done:!0}:{done:!1,value:o[a++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Qh(o,l){if(typeof o!="object"||o===null)return o;var s=o[Symbol.toPrimitive];if(s!==void 0){var a=s.call(o,l||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(o)}function Jh(o){var l=Qh(o,"string");return typeof l=="symbol"?l:String(l)}function fl(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}Be.defaults=fl();function $h(o){Be.defaults=o}var qf=/[&<>"']/,Vh=new RegExp(qf.source,"g"),Uf=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,ep=new RegExp(Uf.source,"g"),tp={"&":"&","<":"<",">":">",'"':""","'":"'"},If=function(l){return tp[l]};function ht(o,l){if(l){if(qf.test(o))return o.replace(Vh,If)}else if(Uf.test(o))return o.replace(ep,If);return o}var rp=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function jf(o){return o.replace(rp,function(l,s){return s=s.toLowerCase(),s==="colon"?":":s.charAt(0)==="#"?s.charAt(1)==="x"?String.fromCharCode(parseInt(s.substring(2),16)):String.fromCharCode(+s.substring(1)):""})}var np=/(^|[^\[])\^/g;function Me(o,l){o=typeof o=="string"?o:o.source,l=l||"";var s={replace:function(f,p){return p=p.source||p,p=p.replace(np,"$1"),o=o.replace(f,p),s},getRegex:function(){return new RegExp(o,l)}};return s}var ip=/[^\w:]/g,op=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function Pf(o,l,s){if(o){var a;try{a=decodeURIComponent(jf(s)).replace(ip,"").toLowerCase()}catch{return null}if(a.indexOf("javascript:")===0||a.indexOf("vbscript:")===0||a.indexOf("data:")===0)return null}l&&!op.test(s)&&(s=up(l,s));try{s=encodeURI(s).replace(/%25/g,"%")}catch{return null}return s}var io={},ap=/^[^:]+:\/*[^/]*$/,lp=/^([^:]+:)[\s\S]*$/,sp=/^([^:]+:\/*[^/]*)[\s\S]*$/;function up(o,l){io[" "+o]||(ap.test(o)?io[" "+o]=o+"/":io[" "+o]=oo(o,"/",!0)),o=io[" "+o];var s=o.indexOf(":")===-1;return l.substring(0,2)==="//"?s?l:o.replace(lp,"$1")+l:l.charAt(0)==="/"?s?l:o.replace(sp,"$1")+l:o+l}var ao={exec:function(){}};function zf(o,l){var s=o.replace(/\|/g,function(p,c,d){for(var m=!1,y=c;--y>=0&&d[y]==="\\";)m=!m;return m?"|":" |"}),a=s.split(/ \|/),f=0;if(a[0].trim()||a.shift(),a.length>0&&!a[a.length-1].trim()&&a.pop(),a.length>l)a.splice(l);else for(;a.length1;)l&1&&(s+=o),l>>=1,o+=o;return s+o}function Rf(o,l,s,a){var f=l.href,p=l.title?ht(l.title):null,c=o[1].replace(/\\([\[\]])/g,"$1");if(o[0].charAt(0)!=="!"){a.state.inLink=!0;var d={type:"link",raw:s,href:f,title:p,text:c,tokens:a.inlineTokens(c)};return a.state.inLink=!1,d}return{type:"image",raw:s,href:f,title:p,text:ht(c)}}function dp(o,l){var s=o.match(/^(\s+)(?:```)/);if(s===null)return l;var a=s[1];return l.split(` -`).map(function(f){var p=f.match(/^\s+/);if(p===null)return f;var c=p[0];return c.length>=a.length?f.slice(a.length):f}).join(` -`)}var lo=function(){function o(s){this.options=s||Be.defaults}var l=o.prototype;return l.space=function(a){var f=this.rules.block.newline.exec(a);if(f&&f[0].length>0)return{type:"space",raw:f[0]}},l.code=function(a){var f=this.rules.block.code.exec(a);if(f){var p=f[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:f[0],codeBlockStyle:"indented",text:this.options.pedantic?p:oo(p,` -`)}}},l.fences=function(a){var f=this.rules.block.fences.exec(a);if(f){var p=f[0],c=dp(p,f[3]||"");return{type:"code",raw:p,lang:f[2]?f[2].trim().replace(this.rules.inline._escapes,"$1"):f[2],text:c}}},l.heading=function(a){var f=this.rules.block.heading.exec(a);if(f){var p=f[2].trim();if(/#$/.test(p)){var c=oo(p,"#");(this.options.pedantic||!c||/ $/.test(c))&&(p=c.trim())}return{type:"heading",raw:f[0],depth:f[1].length,text:p,tokens:this.lexer.inline(p)}}},l.hr=function(a){var f=this.rules.block.hr.exec(a);if(f)return{type:"hr",raw:f[0]}},l.blockquote=function(a){var f=this.rules.block.blockquote.exec(a);if(f){var p=f[0].replace(/^ *>[ \t]?/gm,""),c=this.lexer.state.top;this.lexer.state.top=!0;var d=this.lexer.blockTokens(p);return this.lexer.state.top=c,{type:"blockquote",raw:f[0],tokens:d,text:p}}},l.list=function(a){var f=this.rules.block.list.exec(a);if(f){var p,c,d,m,y,x,C,S,F,_,L,T,O=f[1].trim(),N=O.length>1,I={type:"list",raw:"",ordered:N,start:N?+O.slice(0,-1):"",loose:!1,items:[]};O=N?"\\d{1,9}\\"+O.slice(-1):"\\"+O,this.options.pedantic&&(O=N?O:"[*+-]");for(var P=new RegExp("^( {0,3}"+O+")((?:[ ][^\\n]*)?(?:\\n|$))");a&&(T=!1,!(!(f=P.exec(a))||this.rules.block.hr.test(a)));){if(p=f[0],a=a.substring(p.length),S=f[2].split(` -`,1)[0].replace(/^\t+/,function(ee){return" ".repeat(3*ee.length)}),F=a.split(` -`,1)[0],this.options.pedantic?(m=2,L=S.trimLeft()):(m=f[2].search(/[^ ]/),m=m>4?1:m,L=S.slice(m),m+=f[1].length),x=!1,!S&&/^ *$/.test(F)&&(p+=F+` -`,a=a.substring(F.length+1),T=!0),!T)for(var q=new RegExp("^ {0,"+Math.min(3,m-1)+"}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))"),G=new RegExp("^ {0,"+Math.min(3,m-1)+"}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)"),K=new RegExp("^ {0,"+Math.min(3,m-1)+"}(?:```|~~~)"),me=new RegExp("^ {0,"+Math.min(3,m-1)+"}#");a&&(_=a.split(` -`,1)[0],F=_,this.options.pedantic&&(F=F.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!(K.test(F)||me.test(F)||q.test(F)||G.test(a)));){if(F.search(/[^ ]/)>=m||!F.trim())L+=` -`+F.slice(m);else{if(x||S.search(/[^ ]/)>=4||K.test(S)||me.test(S)||G.test(S))break;L+=` -`+F}!x&&!F.trim()&&(x=!0),p+=_+` -`,a=a.substring(_.length+1),S=F.slice(m)}I.loose||(C?I.loose=!0:/\n *\n *$/.test(p)&&(C=!0)),this.options.gfm&&(c=/^\[[ xX]\] /.exec(L),c&&(d=c[0]!=="[ ] ",L=L.replace(/^\[[ xX]\] +/,""))),I.items.push({type:"list_item",raw:p,task:!!c,checked:d,loose:!1,text:L}),I.raw+=p}I.items[I.items.length-1].raw=p.trimRight(),I.items[I.items.length-1].text=L.trimRight(),I.raw=I.raw.trimRight();var U=I.items.length;for(y=0;y0&&le.some(function(ee){return/\n.*\n/.test(ee.raw)});I.loose=j}if(I.loose)for(y=0;y$/,"$1").replace(this.rules.inline._escapes,"$1"):"",d=f[3]?f[3].substring(1,f[3].length-1).replace(this.rules.inline._escapes,"$1"):f[3];return{type:"def",tag:p,raw:f[0],href:c,title:d}}},l.table=function(a){var f=this.rules.block.table.exec(a);if(f){var p={type:"table",header:zf(f[1]).map(function(C){return{text:C}}),align:f[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:f[3]&&f[3].trim()?f[3].replace(/\n[ \t]*$/,"").split(` -`):[]};if(p.header.length===p.align.length){p.raw=f[0];var c=p.align.length,d,m,y,x;for(d=0;d/i.test(f[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(f[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(f[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:f[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(f[0]):ht(f[0]):f[0]}},l.link=function(a){var f=this.rules.inline.link.exec(a);if(f){var p=f[2].trim();if(!this.options.pedantic&&/^$/.test(p))return;var c=oo(p.slice(0,-1),"\\");if((p.length-c.length)%2===0)return}else{var d=fp(f[2],"()");if(d>-1){var m=f[0].indexOf("!")===0?5:4,y=m+f[1].length+d;f[2]=f[2].substring(0,d),f[0]=f[0].substring(0,y).trim(),f[3]=""}}var x=f[2],C="";if(this.options.pedantic){var S=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(x);S&&(x=S[1],C=S[3])}else C=f[3]?f[3].slice(1,-1):"";return x=x.trim(),/^$/.test(p)?x=x.slice(1):x=x.slice(1,-1)),Rf(f,{href:x&&x.replace(this.rules.inline._escapes,"$1"),title:C&&C.replace(this.rules.inline._escapes,"$1")},f[0],this.lexer)}},l.reflink=function(a,f){var p;if((p=this.rules.inline.reflink.exec(a))||(p=this.rules.inline.nolink.exec(a))){var c=(p[2]||p[1]).replace(/\s+/g," ");if(c=f[c.toLowerCase()],!c){var d=p[0].charAt(0);return{type:"text",raw:d,text:d}}return Rf(p,c,p[0],this.lexer)}},l.emStrong=function(a,f,p){p===void 0&&(p="");var c=this.rules.inline.emStrong.lDelim.exec(a);if(c&&!(c[3]&&p.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\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\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\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\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\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-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\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\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDF70-\uDF81\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD837[\uDF00-\uDF1E]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/))){var d=c[1]||c[2]||"";if(!d||d&&(p===""||this.rules.inline.punctuation.exec(p))){var m=c[0].length-1,y,x,C=m,S=0,F=c[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(F.lastIndex=0,f=f.slice(-1*a.length+m);(c=F.exec(f))!=null;)if(y=c[1]||c[2]||c[3]||c[4]||c[5]||c[6],!!y){if(x=y.length,c[3]||c[4]){C+=x;continue}else if((c[5]||c[6])&&m%3&&!((m+x)%3)){S+=x;continue}if(C-=x,!(C>0)){x=Math.min(x,x+C+S);var _=a.slice(0,m+c.index+(c[0].length-y.length)+x);if(Math.min(m,x)%2){var L=_.slice(1,-1);return{type:"em",raw:_,text:L,tokens:this.lexer.inlineTokens(L)}}var T=_.slice(2,-2);return{type:"strong",raw:_,text:T,tokens:this.lexer.inlineTokens(T)}}}}}},l.codespan=function(a){var f=this.rules.inline.code.exec(a);if(f){var p=f[2].replace(/\n/g," "),c=/[^ ]/.test(p),d=/^ /.test(p)&&/ $/.test(p);return c&&d&&(p=p.substring(1,p.length-1)),p=ht(p,!0),{type:"codespan",raw:f[0],text:p}}},l.br=function(a){var f=this.rules.inline.br.exec(a);if(f)return{type:"br",raw:f[0]}},l.del=function(a){var f=this.rules.inline.del.exec(a);if(f)return{type:"del",raw:f[0],text:f[2],tokens:this.lexer.inlineTokens(f[2])}},l.autolink=function(a,f){var p=this.rules.inline.autolink.exec(a);if(p){var c,d;return p[2]==="@"?(c=ht(this.options.mangle?f(p[1]):p[1]),d="mailto:"+c):(c=ht(p[1]),d=c),{type:"link",raw:p[0],text:c,href:d,tokens:[{type:"text",raw:c,text:c}]}}},l.url=function(a,f){var p;if(p=this.rules.inline.url.exec(a)){var c,d;if(p[2]==="@")c=ht(this.options.mangle?f(p[0]):p[0]),d="mailto:"+c;else{var m;do m=p[0],p[0]=this.rules.inline._backpedal.exec(p[0])[0];while(m!==p[0]);c=ht(p[0]),p[1]==="www."?d="http://"+p[0]:d=p[0]}return{type:"link",raw:p[0],text:c,href:d,tokens:[{type:"text",raw:c,text:c}]}}},l.inlineText=function(a,f){var p=this.rules.inline.text.exec(a);if(p){var c;return this.lexer.state.inRawBlock?c=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(p[0]):ht(p[0]):p[0]:c=ht(this.options.smartypants?f(p[0]):p[0]),{type:"text",raw:p[0],text:c}}},o}(),ce={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:ao,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/};ce._label=/(?!\s*\])(?:\\.|[^\[\]\\])+/;ce._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;ce.def=Me(ce.def).replace("label",ce._label).replace("title",ce._title).getRegex();ce.bullet=/(?:[*+-]|\d{1,9}[.)])/;ce.listItemStart=Me(/^( *)(bull) */).replace("bull",ce.bullet).getRegex();ce.list=Me(ce.list).replace(/bull/g,ce.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ce.def.source+")").getRegex();ce._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";ce._comment=/|$)/;ce.html=Me(ce.html,"i").replace("comment",ce._comment).replace("tag",ce._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();ce.paragraph=Me(ce._paragraph).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ce._tag).getRegex();ce.blockquote=Me(ce.blockquote).replace("paragraph",ce.paragraph).getRegex();ce.normal=_t({},ce);ce.gfm=_t({},ce.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"});ce.gfm.table=Me(ce.gfm.table).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ce._tag).getRegex();ce.gfm.paragraph=Me(ce._paragraph).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",ce.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ce._tag).getRegex();ce.pedantic=_t({},ce.normal,{html:Me(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ce._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:ao,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Me(ce.normal._paragraph).replace("hr",ce.hr).replace("heading",` *#{1,6} *[^ -]`).replace("lheading",ce.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var ie={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:ao,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,rDelimUnd:/^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:ao,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~";ie.punctuation=Me(ie.punctuation).replace(/punctuation/g,ie._punctuation).getRegex();ie.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;ie.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g;ie._comment=Me(ce._comment).replace("(?:-->|$)","-->").getRegex();ie.emStrong.lDelim=Me(ie.emStrong.lDelim).replace(/punct/g,ie._punctuation).getRegex();ie.emStrong.rDelimAst=Me(ie.emStrong.rDelimAst,"g").replace(/punct/g,ie._punctuation).getRegex();ie.emStrong.rDelimUnd=Me(ie.emStrong.rDelimUnd,"g").replace(/punct/g,ie._punctuation).getRegex();ie._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;ie._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;ie._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;ie.autolink=Me(ie.autolink).replace("scheme",ie._scheme).replace("email",ie._email).getRegex();ie._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;ie.tag=Me(ie.tag).replace("comment",ie._comment).replace("attribute",ie._attribute).getRegex();ie._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;ie._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;ie._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;ie.link=Me(ie.link).replace("label",ie._label).replace("href",ie._href).replace("title",ie._title).getRegex();ie.reflink=Me(ie.reflink).replace("label",ie._label).replace("ref",ce._label).getRegex();ie.nolink=Me(ie.nolink).replace("ref",ce._label).getRegex();ie.reflinkSearch=Me(ie.reflinkSearch,"g").replace("reflink",ie.reflink).replace("nolink",ie.nolink).getRegex();ie.normal=_t({},ie);ie.pedantic=_t({},ie.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Me(/^!?\[(label)\]\((.*?)\)/).replace("label",ie._label).getRegex(),reflink:Me(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ie._label).getRegex()});ie.gfm=_t({},ie.normal,{escape:Me(ie.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\.5&&(a="x"+a.toString(16)),l+="&#"+a+";";return l}var yn=function(){function o(s){this.tokens=[],this.tokens.links=Object.create(null),this.options=s||Be.defaults,this.options.tokenizer=this.options.tokenizer||new lo,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};var a={block:ce.normal,inline:ie.normal};this.options.pedantic?(a.block=ce.pedantic,a.inline=ie.pedantic):this.options.gfm&&(a.block=ce.gfm,this.options.breaks?a.inline=ie.breaks:a.inline=ie.gfm),this.tokenizer.rules=a}o.lex=function(a,f){var p=new o(f);return p.lex(a)},o.lexInline=function(a,f){var p=new o(f);return p.inlineTokens(a)};var l=o.prototype;return l.lex=function(a){a=a.replace(/\r\n|\r/g,` -`),this.blockTokens(a,this.tokens);for(var f;f=this.inlineQueue.shift();)this.inlineTokens(f.src,f.tokens);return this.tokens},l.blockTokens=function(a,f){var p=this;f===void 0&&(f=[]),this.options.pedantic?a=a.replace(/\t/g," ").replace(/^ +$/gm,""):a=a.replace(/^( *)(\t+)/gm,function(C,S,F){return S+" ".repeat(F.length)});for(var c,d,m,y;a;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(function(C){return(c=C.call({lexer:p},a,f))?(a=a.substring(c.raw.length),f.push(c),!0):!1}))){if(c=this.tokenizer.space(a)){a=a.substring(c.raw.length),c.raw.length===1&&f.length>0?f[f.length-1].raw+=` + outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var S;v&&(S=n.ownerDocument.defaultView.scrollY),r.input.focus(),v&&n.ownerDocument.defaultView.scrollTo(null,S),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=M,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function _(){if(n.selectionStart!=null){var U=i.somethingSelected(),Z="\u200B"+(U?n.value:"");n.value="\u21DA",n.value=Z,t.prevInput=U?"":"\u200B",n.selectionStart=1,n.selectionEnd=Z.length,r.selForContextMenu=i.doc.sel}}function M(){if(t.contextMenuPending==M&&(t.contextMenuPending=!1,t.wrapper.style.cssText=b,n.style.cssText=m,c&&d<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=p),n.selectionStart!=null)){(!c||c&&d<9)&&_();var U=0,Z=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?tt(i,pu)(i):U++<10?r.detectingSelectAll=setTimeout(Z,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Z,200)}}if(c&&d>=9&&_(),de){Bi(e);var P=function(){Mt(window,"mouseup",P),setTimeout(M,20)};ue(window,"mouseup",P)}else setTimeout(M,50)},We.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},We.prototype.setUneditable=function(){},We.prototype.needsContentAttribute=!1;function Yh(e,t){if(t=t?Lt(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var i=he(Ce(e));t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=g.getValue()}var n;if(e.form&&(ue(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var u=e.form;n=u.submit;try{var p=u.submit=function(){r(),u.submit=n,u.submit(),u.submit=p}}catch{}}t.finishInit=function(m){m.save=r,m.getTextArea=function(){return e},m.toTextArea=function(){m.toTextArea=isNaN,r(),e.parentNode.removeChild(m.getWrapperElement()),e.style.display="",e.form&&(Mt(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var g=Ne(function(m){return e.parentNode.insertBefore(m,e.nextSibling)},t);return g}function Zh(e){e.off=Mt,e.on=ue,e.wheelEventPixels=rh,e.Doc=xt,e.splitLines=ra,e.countColumn=Ye,e.findColumn=Kt,e.isWordChar=Zo,e.Pass=Ze,e.signal=je,e.Line=$r,e.changeEnd=xr,e.scrollbarModel=js,e.Pos=K,e.cmpPos=me,e.modes=na,e.mimeModes=Jr,e.resolveMode=kn,e.getMode=oa,e.modeExtensions=Vr,e.extendMode=Jc,e.copyState=Lr,e.startState=Ql,e.innerMode=aa,e.commands=rn,e.keyMap=ar,e.keyName=Lu,e.isModifierKey=Fu,e.lookupKey=di,e.normalizeKeyMap=kh,e.StringStream=Ge,e.SharedTextMarker=$i,e.TextMarker=Cr,e.LineWidget=Vi,e.e_preventDefault=bt,e.e_stopPropagation=Yl,e.e_stop=Bi,e.addClass=be,e.contains=Q,e.rmClass=oe,e.keyNames=Dr}qh(Ne),jh(Ne);var Qh="iter insert remove copy getEditor constructor".split(" ");for(var ro in xt.prototype)xt.prototype.hasOwnProperty(ro)&&ze(Qh,ro)<0&&(Ne.prototype[ro]=function(e){return function(){return e.apply(this.doc,arguments)}}(xt.prototype[ro]));return Qr(xt),Ne.inputStyles={textarea:We,contenteditable:Te},Ne.defineMode=function(e){!Ne.defaults.mode&&e!="null"&&(Ne.defaults.mode=e),Zc.apply(this,arguments)},Ne.defineMIME=Qc,Ne.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Ne.defineMIME("text/plain","null"),Ne.defineExtension=function(e,t){Ne.prototype[e]=t},Ne.defineDocExtension=function(e,t){xt.prototype[e]=t},Ne.fromTextArea=Yh,Zh(Ne),Ne.version="5.65.21",Ne})});var $u=at((Ju,Vu)=>{(function(o){typeof Ju=="object"&&typeof Vu=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,s=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,a=/[*+-]\s/;o.commands.newlineAndIndentContinueMarkdownList=function(h){if(h.getOption("disableInput"))return o.Pass;for(var c=h.listSelections(),d=[],v=0;v\s*$/.test(B),z=!/>\s*$/.test(B);(N||z)&&h.replaceRange("",{line:y.line,ch:0},{line:y.line,ch:y.ch+1}),d[v]=` +`}else{var O=L[1],I=L[5],W=!(a.test(L[2])||L[2].indexOf(">")>=0),G=W?parseInt(L[3],10)+1+L[4]:L[2].replace("x"," ");d[v]=` +`+O+G+I,W&&f(h,y)}}h.replaceSelections(d)};function f(h,c){var d=c.line,v=0,y=0,x=l.exec(h.getLine(d)),D=x[1];do{v+=1;var k=d+v,F=h.getLine(k),B=l.exec(F);if(B){var L=B[1],T=parseInt(x[3],10)+v-y,N=parseInt(B[3],10),z=N;if(D===L&&!isNaN(N))T===N&&(z=N+1),T>N&&(z=T+1),h.replaceRange(F.replace(l,L+z+B[4]+B[5]),{line:k,ch:0},{line:k,ch:F.length});else{if(D.length>L.length||D.length{var ef=At();ef.commands.tabAndIndentMarkdownList=function(o){var l=o.listSelections(),s=l[0].head,a=o.getStateAfter(s.line),f=a.list!==!1;if(f){o.execCommand("indentMore");return}if(o.options.indentWithTabs)o.execCommand("insertTab");else{var h=Array(o.options.tabSize+1).join(" ");o.replaceSelection(h)}};ef.commands.shiftTabAndUnindentMarkdownList=function(o){var l=o.listSelections(),s=l[0].head,a=o.getStateAfter(s.line),f=a.list!==!1;if(f){o.execCommand("indentLess");return}if(o.options.indentWithTabs)o.execCommand("insertTab");else{var h=Array(o.options.tabSize+1).join(" ");o.replaceSelection(h)}}});var of=at((rf,nf)=>{(function(o){typeof rf=="object"&&typeof nf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("fullScreen",!1,function(a,f,h){h==o.Init&&(h=!1),!h!=!f&&(f?l(a):s(a))});function l(a){var f=a.getWrapperElement();a.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:f.style.width,height:f.style.height},f.style.width="",f.style.height="auto",f.className+=" CodeMirror-fullscreen",document.documentElement.style.overflow="hidden",a.refresh()}function s(a){var f=a.getWrapperElement();f.className=f.className.replace(/\s*CodeMirror-fullscreen\b/,""),document.documentElement.style.overflow="";var h=a.state.fullScreenRestore;f.style.width=h.width,f.style.height=h.height,window.scrollTo(h.scrollLeft,h.scrollTop),a.refresh()}})});var al=at((af,lf)=>{(function(o){typeof af=="object"&&typeof lf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},s={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};o.defineMode("xml",function(a,f){var h=a.indentUnit,c={},d=f.htmlMode?l:s;for(var v in d)c[v]=d[v];for(var v in f)c[v]=f[v];var y,x;function D(E,q){function R(be){return q.tokenize=be,be(E,q)}var Q=E.next();if(Q=="<")return E.eat("!")?E.eat("[")?E.match("CDATA[")?R(B("atom","]]>")):null:E.match("--")?R(B("comment","-->")):E.match("DOCTYPE",!0,!0)?(E.eatWhile(/[\w\._\-]/),R(L(1))):null:E.eat("?")?(E.eatWhile(/[\w\._\-]/),q.tokenize=B("meta","?>"),"meta"):(y=E.eat("/")?"closeTag":"openTag",q.tokenize=k,"tag bracket");if(Q=="&"){var he;return E.eat("#")?E.eat("x")?he=E.eatWhile(/[a-fA-F\d]/)&&E.eat(";"):he=E.eatWhile(/[\d]/)&&E.eat(";"):he=E.eatWhile(/[\w\.\-:]/)&&E.eat(";"),he?"atom":"error"}else return E.eatWhile(/[^&<]/),null}D.isInText=!0;function k(E,q){var R=E.next();if(R==">"||R=="/"&&E.eat(">"))return q.tokenize=D,y=R==">"?"endTag":"selfcloseTag","tag bracket";if(R=="=")return y="equals",null;if(R=="<"){q.tokenize=D,q.state=I,q.tagName=q.tagStart=null;var Q=q.tokenize(E,q);return Q?Q+" tag error":"tag error"}else return/[\'\"]/.test(R)?(q.tokenize=F(R),q.stringStartCol=E.column(),q.tokenize(E,q)):(E.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function F(E){var q=function(R,Q){for(;!R.eol();)if(R.next()==E){Q.tokenize=k;break}return"string"};return q.isInAttribute=!0,q}function B(E,q){return function(R,Q){for(;!R.eol();){if(R.match(q)){Q.tokenize=D;break}R.next()}return E}}function L(E){return function(q,R){for(var Q;(Q=q.next())!=null;){if(Q=="<")return R.tokenize=L(E+1),R.tokenize(q,R);if(Q==">")if(E==1){R.tokenize=D;break}else return R.tokenize=L(E-1),R.tokenize(q,R)}return"meta"}}function T(E){return E&&E.toLowerCase()}function N(E,q,R){this.prev=E.context,this.tagName=q||"",this.indent=E.indented,this.startOfLine=R,(c.doNotIndent.hasOwnProperty(q)||E.context&&E.context.noIndent)&&(this.noIndent=!0)}function z(E){E.context&&(E.context=E.context.prev)}function O(E,q){for(var R;;){if(!E.context||(R=E.context.tagName,!c.contextGrabbers.hasOwnProperty(T(R))||!c.contextGrabbers[T(R)].hasOwnProperty(T(q))))return;z(E)}}function I(E,q,R){return E=="openTag"?(R.tagStart=q.column(),W):E=="closeTag"?G:I}function W(E,q,R){return E=="word"?(R.tagName=q.current(),x="tag",j):c.allowMissingTagName&&E=="endTag"?(x="tag bracket",j(E,q,R)):(x="error",W)}function G(E,q,R){if(E=="word"){var Q=q.current();return R.context&&R.context.tagName!=Q&&c.implicitlyClosed.hasOwnProperty(T(R.context.tagName))&&z(R),R.context&&R.context.tagName==Q||c.matchClosing===!1?(x="tag",X):(x="tag error",de)}else return c.allowMissingTagName&&E=="endTag"?(x="tag bracket",X(E,q,R)):(x="error",de)}function X(E,q,R){return E!="endTag"?(x="error",X):(z(R),I)}function de(E,q,R){return x="error",X(E,q,R)}function j(E,q,R){if(E=="word")return x="attribute",oe;if(E=="endTag"||E=="selfcloseTag"){var Q=R.tagName,he=R.tagStart;return R.tagName=R.tagStart=null,E=="selfcloseTag"||c.autoSelfClosers.hasOwnProperty(T(Q))?O(R,Q):(O(R,Q),R.context=new N(R,Q,he==R.indented)),I}return x="error",j}function oe(E,q,R){return E=="equals"?H:(c.allowMissing||(x="error"),j(E,q,R))}function H(E,q,R){return E=="string"?Y:E=="word"&&c.allowUnquoted?(x="string",j):(x="error",j(E,q,R))}function Y(E,q,R){return E=="string"?Y:j(E,q,R)}return{startState:function(E){var q={tokenize:D,state:I,indented:E||0,tagName:null,tagStart:null,context:null};return E!=null&&(q.baseIndent=E),q},token:function(E,q){if(!q.tagName&&E.sol()&&(q.indented=E.indentation()),E.eatSpace())return null;y=null;var R=q.tokenize(E,q);return(R||y)&&R!="comment"&&(x=null,q.state=q.state(y||R,E,q),x&&(R=x=="error"?R+" error":x)),R},indent:function(E,q,R){var Q=E.context;if(E.tokenize.isInAttribute)return E.tagStart==E.indented?E.stringStartCol+1:E.indented+h;if(Q&&Q.noIndent)return o.Pass;if(E.tokenize!=k&&E.tokenize!=D)return R?R.match(/^(\s*)/)[0].length:0;if(E.tagName)return c.multilineTagIndentPastTag!==!1?E.tagStart+E.tagName.length+2:E.tagStart+h*(c.multilineTagIndentFactor||1);if(c.alignCDATA&&/$/,blockCommentStart:"",configuration:c.htmlMode?"html":"xml",helperType:c.htmlMode?"html":"xml",skipAttribute:function(E){E.state==H&&(E.state=j)},xmlCurrentTag:function(E){return E.tagName?{name:E.tagName,close:E.type=="closeTag"}:null},xmlCurrentContext:function(E){for(var q=[],R=E.context;R;R=R.prev)q.push(R.tagName);return q.reverse()}}}),o.defineMIME("text/xml","xml"),o.defineMIME("application/xml","xml"),o.mimeModes.hasOwnProperty("text/html")||o.defineMIME("text/html",{name:"xml",htmlMode:!0})})});var ff=at((sf,uf)=>{(function(o){typeof sf=="object"&&typeof uf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy","cbl"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded JavaScript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"],alias:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var l=0;l-1&&a.substring(c+1,a.length);if(d)return o.findModeByExtension(d)},o.findModeByName=function(a){a=a.toLowerCase();for(var f=0;f{(function(o){typeof cf=="object"&&typeof df=="object"?o(At(),al(),ff()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../xml/xml","../meta"],o):o(CodeMirror)})(function(o){"use strict";o.defineMode("markdown",function(l,s){var a=o.getMode(l,"text/html"),f=a.name=="null";function h(A){if(o.findModeByName){var w=o.findModeByName(A);w&&(A=w.mime||w.mimes[0])}var te=o.getMode(l,A);return te.name=="null"?null:te}s.highlightFormatting===void 0&&(s.highlightFormatting=!1),s.maxBlockquoteDepth===void 0&&(s.maxBlockquoteDepth=0),s.taskLists===void 0&&(s.taskLists=!1),s.strikethrough===void 0&&(s.strikethrough=!1),s.emoji===void 0&&(s.emoji=!1),s.fencedCodeBlockHighlighting===void 0&&(s.fencedCodeBlockHighlighting=!0),s.fencedCodeBlockDefaultMode===void 0&&(s.fencedCodeBlockDefaultMode="text/plain"),s.xml===void 0&&(s.xml=!0),s.tokenTypeOverrides===void 0&&(s.tokenTypeOverrides={});var c={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var d in c)c.hasOwnProperty(d)&&s.tokenTypeOverrides[d]&&(c[d]=s.tokenTypeOverrides[d]);var v=/^([*\-_])(?:\s*\1){2,}\s*$/,y=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,x=/^\[(x| )\](?=\s)/i,D=s.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,k=/^ {0,3}(?:\={1,}|-{2,})\s*$/,F=/^[^#!\[\]*_\\<>` "'(~:]+/,B=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,L=/^\s*\[[^\]]+?\]:.*$/,T=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,N=" ";function z(A,w,te){return w.f=w.inline=te,te(A,w)}function O(A,w,te){return w.f=w.block=te,te(A,w)}function I(A){return!A||!/\S/.test(A.string)}function W(A){if(A.linkTitle=!1,A.linkHref=!1,A.linkText=!1,A.em=!1,A.strong=!1,A.strikethrough=!1,A.quote=0,A.indentedCode=!1,A.f==X){var w=f;if(!w){var te=o.innerMode(a,A.htmlState);w=te.mode.name=="xml"&&te.state.tagStart===null&&!te.state.context&&te.state.tokenize.isInText}w&&(A.f=H,A.block=G,A.htmlState=null)}return A.trailingSpace=0,A.trailingSpaceNewLine=!1,A.prevLine=A.thisLine,A.thisLine={stream:null},null}function G(A,w){var te=A.column()===w.indentation,Ce=I(w.prevLine.stream),xe=w.indentedCode,mt=w.prevLine.hr,Lt=w.list!==!1,Ye=(w.listStack[w.listStack.length-1]||0)+3;w.indentedCode=!1;var ct=w.indentation;if(w.indentationDiff===null&&(w.indentationDiff=w.indentation,Lt)){for(w.list=null;ct=4&&(xe||w.prevLine.fencedCodeEnd||w.prevLine.header||Ce))return A.skipToEnd(),w.indentedCode=!0,c.code;if(A.eatSpace())return null;if(te&&w.indentation<=Ye&&(Ze=A.match(D))&&Ze[1].length<=6)return w.quote=0,w.header=Ze[1].length,w.thisLine.header=!0,s.highlightFormatting&&(w.formatting="header"),w.f=w.inline,j(w);if(w.indentation<=Ye&&A.eat(">"))return w.quote=te?1:w.quote+1,s.highlightFormatting&&(w.formatting="quote"),A.eatSpace(),j(w);if(!Pe&&!w.setext&&te&&w.indentation<=Ye&&(Ze=A.match(y))){var vt=Ze[1]?"ol":"ul";return w.indentation=ct+A.current().length,w.list=!0,w.quote=0,w.listStack.push(w.indentation),w.em=!1,w.strong=!1,w.code=!1,w.strikethrough=!1,s.taskLists&&A.match(x,!1)&&(w.taskList=!0),w.f=w.inline,s.highlightFormatting&&(w.formatting=["list","list-"+vt]),j(w)}else{if(te&&w.indentation<=Ye&&(Ze=A.match(B,!0)))return w.quote=0,w.fencedEndRE=new RegExp(Ze[1]+"+ *$"),w.localMode=s.fencedCodeBlockHighlighting&&h(Ze[2]||s.fencedCodeBlockDefaultMode),w.localMode&&(w.localState=o.startState(w.localMode)),w.f=w.block=de,s.highlightFormatting&&(w.formatting="code-block"),w.code=-1,j(w);if(w.setext||(!ze||!Lt)&&!w.quote&&w.list===!1&&!w.code&&!Pe&&!L.test(A.string)&&(Ze=A.lookAhead(1))&&(Ze=Ze.match(k)))return w.setext?(w.header=w.setext,w.setext=0,A.skipToEnd(),s.highlightFormatting&&(w.formatting="header")):(w.header=Ze[0].charAt(0)=="="?1:2,w.setext=w.header),w.thisLine.header=!0,w.f=w.inline,j(w);if(Pe)return A.skipToEnd(),w.hr=!0,w.thisLine.hr=!0,c.hr;if(A.peek()==="[")return z(A,w,Q)}return z(A,w,w.inline)}function X(A,w){var te=a.token(A,w.htmlState);if(!f){var Ce=o.innerMode(a,w.htmlState);(Ce.mode.name=="xml"&&Ce.state.tagStart===null&&!Ce.state.context&&Ce.state.tokenize.isInText||w.md_inside&&A.current().indexOf(">")>-1)&&(w.f=H,w.block=G,w.htmlState=null)}return te}function de(A,w){var te=w.listStack[w.listStack.length-1]||0,Ce=w.indentation=A.quote?w.push(c.formatting+"-"+A.formatting[te]+"-"+A.quote):w.push("error"))}if(A.taskOpen)return w.push("meta"),w.length?w.join(" "):null;if(A.taskClosed)return w.push("property"),w.length?w.join(" "):null;if(A.linkHref?w.push(c.linkHref,"url"):(A.strong&&w.push(c.strong),A.em&&w.push(c.em),A.strikethrough&&w.push(c.strikethrough),A.emoji&&w.push(c.emoji),A.linkText&&w.push(c.linkText),A.code&&w.push(c.code),A.image&&w.push(c.image),A.imageAltText&&w.push(c.imageAltText,"link"),A.imageMarker&&w.push(c.imageMarker)),A.header&&w.push(c.header,c.header+"-"+A.header),A.quote&&(w.push(c.quote),!s.maxBlockquoteDepth||s.maxBlockquoteDepth>=A.quote?w.push(c.quote+"-"+A.quote):w.push(c.quote+"-"+s.maxBlockquoteDepth)),A.list!==!1){var Ce=(A.listStack.length-1)%3;Ce?Ce===1?w.push(c.list2):w.push(c.list3):w.push(c.list1)}return A.trailingSpaceNewLine?w.push("trailing-space-new-line"):A.trailingSpace&&w.push("trailing-space-"+(A.trailingSpace%2?"a":"b")),w.length?w.join(" "):null}function oe(A,w){if(A.match(F,!0))return j(w)}function H(A,w){var te=w.text(A,w);if(typeof te<"u")return te;if(w.list)return w.list=null,j(w);if(w.taskList){var Ce=A.match(x,!0)[1]===" ";return Ce?w.taskOpen=!0:w.taskClosed=!0,s.highlightFormatting&&(w.formatting="task"),w.taskList=!1,j(w)}if(w.taskOpen=!1,w.taskClosed=!1,w.header&&A.match(/^#+$/,!0))return s.highlightFormatting&&(w.formatting="header"),j(w);var xe=A.next();if(w.linkTitle){w.linkTitle=!1;var mt=xe;xe==="("&&(mt=")"),mt=(mt+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Lt="^\\s*(?:[^"+mt+"\\\\]+|\\\\\\\\|\\\\.)"+mt;if(A.match(new RegExp(Lt),!0))return c.linkHref}if(xe==="`"){var Ye=w.formatting;s.highlightFormatting&&(w.formatting="code"),A.eatWhile("`");var ct=A.current().length;if(w.code==0&&(!w.quote||ct==1))return w.code=ct,j(w);if(ct==w.code){var ze=j(w);return w.code=0,ze}else return w.formatting=Ye,j(w)}else if(w.code)return j(w);if(xe==="\\"&&(A.next(),s.highlightFormatting)){var Pe=j(w),Ze=c.formatting+"-escape";return Pe?Pe+" "+Ze:Ze}if(xe==="!"&&A.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return w.imageMarker=!0,w.image=!0,s.highlightFormatting&&(w.formatting="image"),j(w);if(xe==="["&&w.imageMarker&&A.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return w.imageMarker=!1,w.imageAltText=!0,s.highlightFormatting&&(w.formatting="image"),j(w);if(xe==="]"&&w.imageAltText){s.highlightFormatting&&(w.formatting="image");var Pe=j(w);return w.imageAltText=!1,w.image=!1,w.inline=w.f=E,Pe}if(xe==="["&&!w.image)return w.linkText&&A.match(/^.*?\]/)||(w.linkText=!0,s.highlightFormatting&&(w.formatting="link")),j(w);if(xe==="]"&&w.linkText){s.highlightFormatting&&(w.formatting="link");var Pe=j(w);return w.linkText=!1,w.inline=w.f=A.match(/\(.*?\)| ?\[.*?\]/,!1)?E:H,Pe}if(xe==="<"&&A.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){w.f=w.inline=Y,s.highlightFormatting&&(w.formatting="link");var Pe=j(w);return Pe?Pe+=" ":Pe="",Pe+c.linkInline}if(xe==="<"&&A.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){w.f=w.inline=Y,s.highlightFormatting&&(w.formatting="link");var Pe=j(w);return Pe?Pe+=" ":Pe="",Pe+c.linkEmail}if(s.xml&&xe==="<"&&A.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var vt=A.string.indexOf(">",A.pos);if(vt!=-1){var Fi=A.string.substring(A.start,vt);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Fi)&&(w.md_inside=!0)}return A.backUp(1),w.htmlState=o.startState(a),O(A,w,X)}if(s.xml&&xe==="<"&&A.match(/^\/\w*?>/))return w.md_inside=!1,"tag";if(xe==="*"||xe==="_"){for(var Xt=1,Kt=A.pos==1?" ":A.string.charAt(A.pos-2);Xt<3&&A.eat(xe);)Xt++;var Ht=A.peek()||" ",pr=!/\s/.test(Ht)&&(!T.test(Ht)||/\s/.test(Kt)||T.test(Kt)),De=!/\s/.test(Kt)&&(!T.test(Kt)||/\s/.test(Ht)||T.test(Ht)),Pt=null,gr=null;if(Xt%2&&(!w.em&&pr&&(xe==="*"||!De||T.test(Kt))?Pt=!0:w.em==xe&&De&&(xe==="*"||!pr||T.test(Ht))&&(Pt=!1)),Xt>1&&(!w.strong&&pr&&(xe==="*"||!De||T.test(Kt))?gr=!0:w.strong==xe&&De&&(xe==="*"||!pr||T.test(Ht))&&(gr=!1)),gr!=null||Pt!=null){s.highlightFormatting&&(w.formatting=Pt==null?"strong":gr==null?"em":"strong em"),Pt===!0&&(w.em=xe),gr===!0&&(w.strong=xe);var ze=j(w);return Pt===!1&&(w.em=!1),gr===!1&&(w.strong=!1),ze}}else if(xe===" "&&(A.eat("*")||A.eat("_"))){if(A.peek()===" ")return j(w);A.backUp(1)}if(s.strikethrough){if(xe==="~"&&A.eatWhile(xe)){if(w.strikethrough){s.highlightFormatting&&(w.formatting="strikethrough");var ze=j(w);return w.strikethrough=!1,ze}else if(A.match(/^[^\s]/,!1))return w.strikethrough=!0,s.highlightFormatting&&(w.formatting="strikethrough"),j(w)}else if(xe===" "&&A.match("~~",!0)){if(A.peek()===" ")return j(w);A.backUp(2)}}if(s.emoji&&xe===":"&&A.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){w.emoji=!0,s.highlightFormatting&&(w.formatting="emoji");var Cn=j(w);return w.emoji=!1,Cn}return xe===" "&&(A.match(/^ +$/,!1)?w.trailingSpace++:w.trailingSpace&&(w.trailingSpaceNewLine=!0)),j(w)}function Y(A,w){var te=A.next();if(te===">"){w.f=w.inline=H,s.highlightFormatting&&(w.formatting="link");var Ce=j(w);return Ce?Ce+=" ":Ce="",Ce+c.linkInline}return A.match(/^[^>]+/,!0),c.linkInline}function E(A,w){if(A.eatSpace())return null;var te=A.next();return te==="("||te==="["?(w.f=w.inline=R(te==="("?")":"]"),s.highlightFormatting&&(w.formatting="link-string"),w.linkHref=!0,j(w)):"error"}var q={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function R(A){return function(w,te){var Ce=w.next();if(Ce===A){te.f=te.inline=H,s.highlightFormatting&&(te.formatting="link-string");var xe=j(te);return te.linkHref=!1,xe}return w.match(q[A]),te.linkHref=!0,j(te)}}function Q(A,w){return A.match(/^([^\]\\]|\\.)*\]:/,!1)?(w.f=he,A.next(),s.highlightFormatting&&(w.formatting="link"),w.linkText=!0,j(w)):z(A,w,H)}function he(A,w){if(A.match("]:",!0)){w.f=w.inline=be,s.highlightFormatting&&(w.formatting="link");var te=j(w);return w.linkText=!1,te}return A.match(/^([^\]\\]|\\.)+/,!0),c.linkText}function be(A,w){return A.eatSpace()?null:(A.match(/^[^\s]+/,!0),A.peek()===void 0?w.linkTitle=!0:A.match(/^(?:\s+(?:"(?:[^"\\]|\\.)+"|'(?:[^'\\]|\\.)+'|\((?:[^)\\]|\\.)+\)))?/,!0),w.f=w.inline=H,c.linkHref+" url")}var Ee={startState:function(){return{f:G,prevLine:{stream:null},thisLine:{stream:null},block:G,htmlState:null,indentation:0,inline:H,text:oe,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(A){return{f:A.f,prevLine:A.prevLine,thisLine:A.thisLine,block:A.block,htmlState:A.htmlState&&o.copyState(a,A.htmlState),indentation:A.indentation,localMode:A.localMode,localState:A.localMode?o.copyState(A.localMode,A.localState):null,inline:A.inline,text:A.text,formatting:!1,linkText:A.linkText,linkTitle:A.linkTitle,linkHref:A.linkHref,code:A.code,em:A.em,strong:A.strong,strikethrough:A.strikethrough,emoji:A.emoji,header:A.header,setext:A.setext,hr:A.hr,taskList:A.taskList,list:A.list,listStack:A.listStack.slice(0),quote:A.quote,indentedCode:A.indentedCode,trailingSpace:A.trailingSpace,trailingSpaceNewLine:A.trailingSpaceNewLine,md_inside:A.md_inside,fencedEndRE:A.fencedEndRE}},token:function(A,w){if(w.formatting=!1,A!=w.thisLine.stream){if(w.header=0,w.hr=!1,A.match(/^\s*$/,!0))return W(w),null;if(w.prevLine=w.thisLine,w.thisLine={stream:A},w.taskList=!1,w.trailingSpace=0,w.trailingSpaceNewLine=!1,!w.localState&&(w.f=w.block,w.f!=X)){var te=A.match(/^\s*/,!0)[0].replace(/\t/g,N).length;if(w.indentation=te,w.indentationDiff=null,te>0)return null}}return w.f(A,w)},innerMode:function(A){return A.block==X?{state:A.htmlState,mode:a}:A.localState?{state:A.localState,mode:A.localMode}:{state:A,mode:Ee}},indent:function(A,w,te){return A.block==X&&a.indent?a.indent(A.htmlState,w,te):A.localState&&A.localMode.indent?A.localMode.indent(A.localState,w,te):o.Pass},blankLine:W,getType:j,blockCommentStart:"",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return Ee},"xml"),o.defineMIME("text/markdown","markdown"),o.defineMIME("text/x-markdown","markdown")})});var sl=at((hf,pf)=>{(function(o){typeof hf=="object"&&typeof pf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.overlayMode=function(l,s,a){return{startState:function(){return{base:o.startState(l),overlay:o.startState(s),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(f){return{base:o.copyState(l,f.base),overlay:o.copyState(s,f.overlay),basePos:f.basePos,baseCur:null,overlayPos:f.overlayPos,overlayCur:null}},token:function(f,h){return(f!=h.streamSeen||Math.min(h.basePos,h.overlayPos){(function(o){typeof gf=="object"&&typeof mf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){o.defineOption("placeholder","",function(d,v,y){var x=y&&y!=o.Init;if(v&&!x)d.on("blur",f),d.on("change",h),d.on("swapDoc",h),o.on(d.getInputField(),"compositionupdate",d.state.placeholderCompose=function(){a(d)}),h(d);else if(!v&&x){d.off("blur",f),d.off("change",h),d.off("swapDoc",h),o.off(d.getInputField(),"compositionupdate",d.state.placeholderCompose),l(d);var D=d.getWrapperElement();D.className=D.className.replace(" CodeMirror-empty","")}v&&!d.hasFocus()&&f(d)});function l(d){d.state.placeholder&&(d.state.placeholder.parentNode.removeChild(d.state.placeholder),d.state.placeholder=null)}function s(d){l(d);var v=d.state.placeholder=document.createElement("pre");v.style.cssText="height: 0; overflow: visible",v.style.direction=d.getOption("direction"),v.className="CodeMirror-placeholder CodeMirror-line-like";var y=d.getOption("placeholder");typeof y=="string"&&(y=document.createTextNode(y)),v.appendChild(y),d.display.lineSpace.insertBefore(v,d.display.lineSpace.firstChild)}function a(d){setTimeout(function(){var v=!1;if(d.lineCount()==1){var y=d.getInputField();v=y.nodeName=="TEXTAREA"?!d.getLine(0).length:!/[^\u200b]/.test(y.querySelector(".CodeMirror-line").textContent)}v?s(d):l(d)},20)}function f(d){c(d)&&s(d)}function h(d){var v=d.getWrapperElement(),y=c(d);v.className=v.className.replace(" CodeMirror-empty","")+(y?" CodeMirror-empty":""),y?s(d):l(d)}function c(d){return d.lineCount()===1&&d.getLine(0)===""}})});var xf=at((bf,yf)=>{(function(o){typeof bf=="object"&&typeof yf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("autoRefresh",!1,function(a,f){a.state.autoRefresh&&(s(a,a.state.autoRefresh),a.state.autoRefresh=null),f&&a.display.wrapper.offsetHeight==0&&l(a,a.state.autoRefresh={delay:f.delay||250})});function l(a,f){function h(){a.display.wrapper.offsetHeight?(s(a,f),a.display.lastWrapHeight!=a.display.wrapper.clientHeight&&a.refresh()):f.timeout=setTimeout(h,f.delay)}f.timeout=setTimeout(h,f.delay),f.hurry=function(){clearTimeout(f.timeout),f.timeout=setTimeout(h,50)},o.on(window,"mouseup",f.hurry),o.on(window,"keyup",f.hurry)}function s(a,f){clearTimeout(f.timeout),o.off(window,"mouseup",f.hurry),o.off(window,"keyup",f.hurry)}})});var Df=at((wf,Cf)=>{(function(o){typeof wf=="object"&&typeof Cf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("styleSelectedText",!1,function(x,D,k){var F=k&&k!=o.Init;D&&!F?(x.state.markedSelection=[],x.state.markedSelectionStyle=typeof D=="string"?D:"CodeMirror-selectedtext",v(x),x.on("cursorActivity",l),x.on("change",s)):!D&&F&&(x.off("cursorActivity",l),x.off("change",s),d(x),x.state.markedSelection=x.state.markedSelectionStyle=null)});function l(x){x.state.markedSelection&&x.operation(function(){y(x)})}function s(x){x.state.markedSelection&&x.state.markedSelection.length&&x.operation(function(){d(x)})}var a=8,f=o.Pos,h=o.cmpPos;function c(x,D,k,F){if(h(D,k)!=0)for(var B=x.state.markedSelection,L=x.state.markedSelectionStyle,T=D.line;;){var N=T==D.line?D:f(T,0),z=T+a,O=z>=k.line,I=O?k:f(z,0),W=x.markText(N,I,{className:L});if(F==null?B.push(W):B.splice(F++,0,W),O)break;T=z}}function d(x){for(var D=x.state.markedSelection,k=0;k1)return v(x);var D=x.getCursor("start"),k=x.getCursor("end"),F=x.state.markedSelection;if(!F.length)return c(x,D,k);var B=F[0].find(),L=F[F.length-1].find();if(!B||!L||k.line-D.line<=a||h(D,L.to)>=0||h(k,B.from)<=0)return v(x);for(;h(D,B.from)>0;)F.shift().clear(),B=F[0].find();for(h(D,B.from)<0&&(B.to.line-D.line0&&(k.line-L.from.line{(function(o){typeof kf=="object"&&typeof Sf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l=o.Pos;function s(T){var N=T.flags;return N??(T.ignoreCase?"i":"")+(T.global?"g":"")+(T.multiline?"m":"")}function a(T,N){for(var z=s(T),O=z,I=0;IG);X++){var de=T.getLine(W++);O=O==null?de:O+` +`+de}I=I*2,N.lastIndex=z.ch;var j=N.exec(O);if(j){var oe=O.slice(0,j.index).split(` +`),H=j[0].split(` +`),Y=z.line+oe.length-1,E=oe[oe.length-1].length;return{from:l(Y,E),to:l(Y+H.length-1,H.length==1?E+H[0].length:H[H.length-1].length),match:j}}}}function d(T,N,z){for(var O,I=0;I<=T.length;){N.lastIndex=I;var W=N.exec(T);if(!W)break;var G=W.index+W[0].length;if(G>T.length-z)break;(!O||G>O.index+O[0].length)&&(O=W),I=W.index+1}return O}function v(T,N,z){N=a(N,"g");for(var O=z.line,I=z.ch,W=T.firstLine();O>=W;O--,I=-1){var G=T.getLine(O),X=d(G,N,I<0?0:G.length-I);if(X)return{from:l(O,X.index),to:l(O,X.index+X[0].length),match:X}}}function y(T,N,z){if(!f(N))return v(T,N,z);N=a(N,"gm");for(var O,I=1,W=T.getLine(z.line).length-z.ch,G=z.line,X=T.firstLine();G>=X;){for(var de=0;de=X;de++){var j=T.getLine(G--);O=O==null?j:j+` +`+O}I*=2;var oe=d(O,N,W);if(oe){var H=O.slice(0,oe.index).split(` +`),Y=oe[0].split(` +`),E=G+H.length,q=H[H.length-1].length;return{from:l(E,q),to:l(E+Y.length-1,Y.length==1?q+Y[0].length:Y[Y.length-1].length),match:oe}}}}var x,D;String.prototype.normalize?(x=function(T){return T.normalize("NFD").toLowerCase()},D=function(T){return T.normalize("NFD")}):(x=function(T){return T.toLowerCase()},D=function(T){return T});function k(T,N,z,O){if(T.length==N.length)return z;for(var I=0,W=z+Math.max(0,T.length-N.length);;){if(I==W)return I;var G=I+W>>1,X=O(T.slice(0,G)).length;if(X==z)return G;X>z?W=G:I=G+1}}function F(T,N,z,O){if(!N.length)return null;var I=O?x:D,W=I(N).split(/\r|\n\r?/);e:for(var G=z.line,X=z.ch,de=T.lastLine()+1-W.length;G<=de;G++,X=0){var j=T.getLine(G).slice(X),oe=I(j);if(W.length==1){var H=oe.indexOf(W[0]);if(H==-1)continue e;var z=k(j,oe,H,I)+X;return{from:l(G,k(j,oe,H,I)+X),to:l(G,k(j,oe,H+W[0].length,I)+X)}}else{var Y=oe.length-W[0].length;if(oe.slice(Y)!=W[0])continue e;for(var E=1;E=de;G--,X=-1){var j=T.getLine(G);X>-1&&(j=j.slice(0,X));var oe=I(j);if(W.length==1){var H=oe.lastIndexOf(W[0]);if(H==-1)continue e;return{from:l(G,k(j,oe,H,I)),to:l(G,k(j,oe,H+W[0].length,I))}}else{var Y=W[W.length-1];if(oe.slice(0,Y.length)!=Y)continue e;for(var E=1,z=G-W.length+1;E(this.doc.getLine(N.line)||"").length&&(N.ch=0,N.line++)),o.cmpPos(N,this.doc.clipPos(N))!=0))return this.atOccurrence=!1;var z=this.matches(T,N);if(this.afterEmptyMatch=z&&o.cmpPos(z.from,z.to)==0,z)return this.pos=z,this.atOccurrence=!0,this.pos.match||!0;var O=l(T?this.doc.firstLine():this.doc.lastLine()+1,0);return this.pos={from:O,to:O},this.atOccurrence=!1},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(T,N){if(this.atOccurrence){var z=o.splitLines(T);this.doc.replaceRange(z,this.pos.from,this.pos.to,N),this.pos.to=l(this.pos.from.line+z.length-1,z[z.length-1].length+(z.length==1?this.pos.from.ch:0))}}},o.defineExtension("getSearchCursor",function(T,N,z){return new L(this.doc,T,N,z)}),o.defineDocExtension("getSearchCursor",function(T,N,z){return new L(this,T,N,z)}),o.defineExtension("selectMatches",function(T,N){for(var z=[],O=this.getSearchCursor(T,this.getCursor("from"),N);O.findNext()&&!(o.cmpPos(O.to(),this.getCursor("to"))>0);)z.push({anchor:O.from(),head:O.to()});z.length&&this.setSelections(z,0)})})});var Tf=at((Af,Ff)=>{(function(o){typeof Af=="object"&&typeof Ff=="object"?o(At(),ll(),sl()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../markdown/markdown","../../addon/mode/overlay"],o):o(CodeMirror)})(function(o){"use strict";var l=/^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i;o.defineMode("gfm",function(s,a){var f=0;function h(y){return y.code=!1,null}var c={startState:function(){return{code:!1,codeBlock:!1,ateSpace:!1}},copyState:function(y){return{code:y.code,codeBlock:y.codeBlock,ateSpace:y.ateSpace}},token:function(y,x){if(x.combineTokens=null,x.codeBlock)return y.match(/^```+/)?(x.codeBlock=!1,null):(y.skipToEnd(),null);if(y.sol()&&(x.code=!1),y.sol()&&y.match(/^```+/))return y.skipToEnd(),x.codeBlock=!0,null;if(y.peek()==="`"){y.next();var D=y.pos;y.eatWhile("`");var k=1+y.pos-D;return x.code?k===f&&(x.code=!1):(f=k,x.code=!0),null}else if(x.code)return y.next(),null;if(y.eatSpace())return x.ateSpace=!0,null;if((y.sol()||x.ateSpace)&&(x.ateSpace=!1,a.gitHubSpice!==!1)){if(y.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?=.{0,6}\d)(?:[a-f0-9]{7,40}\b)/))return x.combineTokens=!0,"link";if(y.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/))return x.combineTokens=!0,"link"}return y.match(l)&&y.string.slice(y.start-2,y.start)!="]("&&(y.start==0||/\W/.test(y.string.charAt(y.start-1)))?(x.combineTokens=!0,"link"):(y.next(),null)},blankLine:h},d={taskLists:!0,strikethrough:!0,emoji:!0};for(var v in a)d[v]=a[v];return d.name="markdown",o.overlayMode(o.getMode(s,d),c)},"markdown"),o.defineMIME("text/x-gfm","gfm")})});var Lf=at(()=>{});var Mf=at((j0,fl)=>{var ul;(function(){"use strict";ul=function(o,l,s,a){a=a||{},this.dictionary=null,this.rules={},this.dictionaryTable=new Map,this.compoundRules=[],this.compoundRuleCodes={},this.replacementTable=[],this.flags=a.flags||{},this.memoized={},this.loaded=!1;var f=this,h,c,d,v,y;o&&(f.dictionary=o,l&&s?F():(typeof window<"u"?(a.dictionaryPath?h=a.dictionaryPath:h="typo/dictionaries",window.chrome&&window.chrome.runtime&&window.chrome.runtime.getURL?h=window.chrome.runtime.getURL(h):window.browser&&window.browser.runtime&&window.browser.runtime.getURL&&(h=window.browser.runtime.getURL(h))):typeof __dirname<"u"?h=__dirname+"/dictionaries":h="./dictionaries",l||x(h+"/"+o+"/"+o+".aff",D),s||x(h+"/"+o+"/"+o+".dic",k)));function x(B,L){var T=f._readFile(B,null,a?.asyncLoad);a?.asyncLoad?T.then(function(N){L(N)}):L(T)}function D(B){l=B,s&&F()}function k(B){s=B,l&&F()}function F(){for(f.rules=f._parseAFF(l),f.compoundRuleCodes={},c=0,v=f.compoundRules.length;c0&&(W.continuationClasses=O),I!=="."&&(k==="SFX"?W.match=new RegExp(I+"$"):W.match=new RegExp("^"+I)),T!="0"&&(k==="SFX"?W.remove=new RegExp(T+"$"):W.remove=T),L.push(W)}l[F]={type:k,combineable:B==="Y",entries:L},c+=f}else if(k==="COMPOUNDRULE"){for(f=parseInt(D[1],10),d=c+1,y=c+1+f;d0&&(s.get(oe)===null&&s.set(oe,[]),s.get(oe).push(H))}for(var f=1,h=l.length;f1){var x=this.parseRuleCodes(v[1]);(!("NEEDAFFIX"in this.flags)||x.indexOf(this.flags.NEEDAFFIX)===-1)&&a(y,x);for(var D=0,k=x.length;D"u"){if("COMPOUNDMIN"in this.flags&&o.length>=this.flags.COMPOUNDMIN){for(s=0,a=this.compoundRules.length;s"u"&&(s=Array.prototype.concat.apply([],this.dictionaryTable.get(o))),s&&s.indexOf(this.flags[l])!==-1))},alphabet:"",suggest:function(o,l){if(!this.loaded)throw"Dictionary not loaded.";if(l=l||5,this.memoized.hasOwnProperty(o)){var s=this.memoized[o].limit;if(l<=s||this.memoized[o].suggestions.length1&&X[1][1]!==X[1][0]&&(I=X[0]+X[1][1]+X[1][0]+X[1].substring(2),(!F||y.check(I))&&(I in B?B[I]+=1:B[I]=1)),X[1]){var de=X[1].substring(0,1).toUpperCase()===X[1].substring(0,1)?"uppercase":"lowercase";for(T=0;TY?1:oe[0].localeCompare(j[0])}I.sort(W).reverse();var G=[],X="lowercase";k.toUpperCase()===k?X="uppercase":k.substr(0,1).toUpperCase()+k.substr(1).toLowerCase()===k&&(X="capitalized");var de=l;for(z=0;z{"use strict";var Bf=Mf();function Oe(o){if(o=o||{},typeof o.codeMirrorInstance!="function"||typeof o.codeMirrorInstance.defineMode!="function"){console.log("CodeMirror Spell Checker: You must provide an instance of CodeMirror via the option `codeMirrorInstance`");return}String.prototype.includes||(String.prototype.includes=function(){"use strict";return String.prototype.indexOf.apply(this,arguments)!==-1}),o.codeMirrorInstance.defineMode("spell-checker",function(l){if(!Oe.aff_loading){Oe.aff_loading=!0;var s=new XMLHttpRequest;s.open("GET","https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.aff",!0),s.onload=function(){s.readyState===4&&s.status===200&&(Oe.aff_data=s.responseText,Oe.num_loaded++,Oe.num_loaded==2&&(Oe.typo=new Bf("en_US",Oe.aff_data,Oe.dic_data,{platform:"any"})))},s.send(null)}if(!Oe.dic_loading){Oe.dic_loading=!0;var a=new XMLHttpRequest;a.open("GET","https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.dic",!0),a.onload=function(){a.readyState===4&&a.status===200&&(Oe.dic_data=a.responseText,Oe.num_loaded++,Oe.num_loaded==2&&(Oe.typo=new Bf("en_US",Oe.aff_data,Oe.dic_data,{platform:"any"})))},a.send(null)}var f='!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~ ',h={token:function(d){var v=d.peek(),y="";if(f.includes(v))return d.next(),null;for(;(v=d.peek())!=null&&!f.includes(v);)y+=v,d.next();return Oe.typo&&!Oe.typo.check(y)?"spell-error":null}},c=o.codeMirrorInstance.getMode(l,l.backdrop||"text/plain");return o.codeMirrorInstance.overlayMode(c,h,!0)})}Oe.num_loaded=0;Oe.aff_loading=!1;Oe.dic_loading=!1;Oe.aff_data="";Oe.dic_data="";Oe.typo;_f.exports=Oe});var Kf=at(_e=>{"use strict";function Nf(o,l){for(var s=0;so.length)&&(l=o.length);for(var s=0,a=new Array(l);s=o.length?{done:!0}:{done:!1,value:o[a++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ep(o,l){if(typeof o!="object"||o===null)return o;var s=o[Symbol.toPrimitive];if(s!==void 0){var a=s.call(o,l||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(o)}function tp(o){var l=ep(o,"string");return typeof l=="symbol"?l:String(l)}function cl(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}_e.defaults=cl();function rp(o){_e.defaults=o}var Uf=/[&<>"']/,ip=new RegExp(Uf.source,"g"),jf=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,np=new RegExp(jf.source,"g"),op={"&":"&","<":"<",">":">",'"':""","'":"'"},If=function(l){return op[l]};function pt(o,l){if(l){if(Uf.test(o))return o.replace(ip,If)}else if(jf.test(o))return o.replace(np,If);return o}var ap=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Gf(o){return o.replace(ap,function(l,s){return s=s.toLowerCase(),s==="colon"?":":s.charAt(0)==="#"?s.charAt(1)==="x"?String.fromCharCode(parseInt(s.substring(2),16)):String.fromCharCode(+s.substring(1)):""})}var lp=/(^|[^\[])\^/g;function Me(o,l){o=typeof o=="string"?o:o.source,l=l||"";var s={replace:function(f,h){return h=h.source||h,h=h.replace(lp,"$1"),o=o.replace(f,h),s},getRegex:function(){return new RegExp(o,l)}};return s}var sp=/[^\w:]/g,up=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function Hf(o,l,s){if(o){var a;try{a=decodeURIComponent(Gf(s)).replace(sp,"").toLowerCase()}catch{return null}if(a.indexOf("javascript:")===0||a.indexOf("vbscript:")===0||a.indexOf("data:")===0)return null}l&&!up.test(s)&&(s=hp(l,s));try{s=encodeURI(s).replace(/%25/g,"%")}catch{return null}return s}var no={},fp=/^[^:]+:\/*[^/]*$/,cp=/^([^:]+:)[\s\S]*$/,dp=/^([^:]+:\/*[^/]*)[\s\S]*$/;function hp(o,l){no[" "+o]||(fp.test(o)?no[" "+o]=o+"/":no[" "+o]=oo(o,"/",!0)),o=no[" "+o];var s=o.indexOf(":")===-1;return l.substring(0,2)==="//"?s?l:o.replace(cp,"$1")+l:l.charAt(0)==="/"?s?l:o.replace(dp,"$1")+l:o+l}var ao={exec:function(){}};function Pf(o,l){var s=o.replace(/\|/g,function(h,c,d){for(var v=!1,y=c;--y>=0&&d[y]==="\\";)v=!v;return v?"|":" |"}),a=s.split(/ \|/),f=0;if(a[0].trim()||a.shift(),a.length>0&&!a[a.length-1].trim()&&a.pop(),a.length>l)a.splice(l);else for(;a.length1;)l&1&&(s+=o),l>>=1,o+=o;return s+o}function Rf(o,l,s,a){var f=l.href,h=l.title?pt(l.title):null,c=o[1].replace(/\\([\[\]])/g,"$1");if(o[0].charAt(0)!=="!"){a.state.inLink=!0;var d={type:"link",raw:s,href:f,title:h,text:c,tokens:a.inlineTokens(c)};return a.state.inLink=!1,d}return{type:"image",raw:s,href:f,title:h,text:pt(c)}}function mp(o,l){var s=o.match(/^(\s+)(?:```)/);if(s===null)return l;var a=s[1];return l.split(` +`).map(function(f){var h=f.match(/^\s+/);if(h===null)return f;var c=h[0];return c.length>=a.length?f.slice(a.length):f}).join(` +`)}var lo=function(){function o(s){this.options=s||_e.defaults}var l=o.prototype;return l.space=function(a){var f=this.rules.block.newline.exec(a);if(f&&f[0].length>0)return{type:"space",raw:f[0]}},l.code=function(a){var f=this.rules.block.code.exec(a);if(f){var h=f[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:f[0],codeBlockStyle:"indented",text:this.options.pedantic?h:oo(h,` +`)}}},l.fences=function(a){var f=this.rules.block.fences.exec(a);if(f){var h=f[0],c=mp(h,f[3]||"");return{type:"code",raw:h,lang:f[2]?f[2].trim().replace(this.rules.inline._escapes,"$1"):f[2],text:c}}},l.heading=function(a){var f=this.rules.block.heading.exec(a);if(f){var h=f[2].trim();if(/#$/.test(h)){var c=oo(h,"#");(this.options.pedantic||!c||/ $/.test(c))&&(h=c.trim())}return{type:"heading",raw:f[0],depth:f[1].length,text:h,tokens:this.lexer.inline(h)}}},l.hr=function(a){var f=this.rules.block.hr.exec(a);if(f)return{type:"hr",raw:f[0]}},l.blockquote=function(a){var f=this.rules.block.blockquote.exec(a);if(f){var h=f[0].replace(/^ *>[ \t]?/gm,""),c=this.lexer.state.top;this.lexer.state.top=!0;var d=this.lexer.blockTokens(h);return this.lexer.state.top=c,{type:"blockquote",raw:f[0],tokens:d,text:h}}},l.list=function(a){var f=this.rules.block.list.exec(a);if(f){var h,c,d,v,y,x,D,k,F,B,L,T,N=f[1].trim(),z=N.length>1,O={type:"list",raw:"",ordered:z,start:z?+N.slice(0,-1):"",loose:!1,items:[]};N=z?"\\d{1,9}\\"+N.slice(-1):"\\"+N,this.options.pedantic&&(N=z?N:"[*+-]");for(var I=new RegExp("^( {0,3}"+N+")((?:[ ][^\\n]*)?(?:\\n|$))");a&&(T=!1,!(!(f=I.exec(a))||this.rules.block.hr.test(a)));){if(h=f[0],a=a.substring(h.length),k=f[2].split(` +`,1)[0].replace(/^\t+/,function(Y){return" ".repeat(3*Y.length)}),F=a.split(` +`,1)[0],this.options.pedantic?(v=2,L=k.trimLeft()):(v=f[2].search(/[^ ]/),v=v>4?1:v,L=k.slice(v),v+=f[1].length),x=!1,!k&&/^ *$/.test(F)&&(h+=F+` +`,a=a.substring(F.length+1),T=!0),!T)for(var W=new RegExp("^ {0,"+Math.min(3,v-1)+"}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))"),G=new RegExp("^ {0,"+Math.min(3,v-1)+"}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)"),X=new RegExp("^ {0,"+Math.min(3,v-1)+"}(?:```|~~~)"),de=new RegExp("^ {0,"+Math.min(3,v-1)+"}#");a&&(B=a.split(` +`,1)[0],F=B,this.options.pedantic&&(F=F.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!(X.test(F)||de.test(F)||W.test(F)||G.test(a)));){if(F.search(/[^ ]/)>=v||!F.trim())L+=` +`+F.slice(v);else{if(x||k.search(/[^ ]/)>=4||X.test(k)||de.test(k)||G.test(k))break;L+=` +`+F}!x&&!F.trim()&&(x=!0),h+=B+` +`,a=a.substring(B.length+1),k=F.slice(v)}O.loose||(D?O.loose=!0:/\n *\n *$/.test(h)&&(D=!0)),this.options.gfm&&(c=/^\[[ xX]\] /.exec(L),c&&(d=c[0]!=="[ ] ",L=L.replace(/^\[[ xX]\] +/,""))),O.items.push({type:"list_item",raw:h,task:!!c,checked:d,loose:!1,text:L}),O.raw+=h}O.items[O.items.length-1].raw=h.trimRight(),O.items[O.items.length-1].text=L.trimRight(),O.raw=O.raw.trimRight();var j=O.items.length;for(y=0;y0&&oe.some(function(Y){return/\n.*\n/.test(Y.raw)});O.loose=H}if(O.loose)for(y=0;y$/,"$1").replace(this.rules.inline._escapes,"$1"):"",d=f[3]?f[3].substring(1,f[3].length-1).replace(this.rules.inline._escapes,"$1"):f[3];return{type:"def",tag:h,raw:f[0],href:c,title:d}}},l.table=function(a){var f=this.rules.block.table.exec(a);if(f){var h={type:"table",header:Pf(f[1]).map(function(D){return{text:D}}),align:f[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:f[3]&&f[3].trim()?f[3].replace(/\n[ \t]*$/,"").split(` +`):[]};if(h.header.length===h.align.length){h.raw=f[0];var c=h.align.length,d,v,y,x;for(d=0;d/i.test(f[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(f[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(f[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:f[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(f[0]):pt(f[0]):f[0]}},l.link=function(a){var f=this.rules.inline.link.exec(a);if(f){var h=f[2].trim();if(!this.options.pedantic&&/^$/.test(h))return;var c=oo(h.slice(0,-1),"\\");if((h.length-c.length)%2===0)return}else{var d=pp(f[2],"()");if(d>-1){var v=f[0].indexOf("!")===0?5:4,y=v+f[1].length+d;f[2]=f[2].substring(0,d),f[0]=f[0].substring(0,y).trim(),f[3]=""}}var x=f[2],D="";if(this.options.pedantic){var k=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(x);k&&(x=k[1],D=k[3])}else D=f[3]?f[3].slice(1,-1):"";return x=x.trim(),/^$/.test(h)?x=x.slice(1):x=x.slice(1,-1)),Rf(f,{href:x&&x.replace(this.rules.inline._escapes,"$1"),title:D&&D.replace(this.rules.inline._escapes,"$1")},f[0],this.lexer)}},l.reflink=function(a,f){var h;if((h=this.rules.inline.reflink.exec(a))||(h=this.rules.inline.nolink.exec(a))){var c=(h[2]||h[1]).replace(/\s+/g," ");if(c=f[c.toLowerCase()],!c){var d=h[0].charAt(0);return{type:"text",raw:d,text:d}}return Rf(h,c,h[0],this.lexer)}},l.emStrong=function(a,f,h){h===void 0&&(h="");var c=this.rules.inline.emStrong.lDelim.exec(a);if(c&&!(c[3]&&h.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\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\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\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\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\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-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\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\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDF70-\uDF81\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD837[\uDF00-\uDF1E]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/))){var d=c[1]||c[2]||"";if(!d||d&&(h===""||this.rules.inline.punctuation.exec(h))){var v=c[0].length-1,y,x,D=v,k=0,F=c[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(F.lastIndex=0,f=f.slice(-1*a.length+v);(c=F.exec(f))!=null;)if(y=c[1]||c[2]||c[3]||c[4]||c[5]||c[6],!!y){if(x=y.length,c[3]||c[4]){D+=x;continue}else if((c[5]||c[6])&&v%3&&!((v+x)%3)){k+=x;continue}if(D-=x,!(D>0)){x=Math.min(x,x+D+k);var B=a.slice(0,v+c.index+(c[0].length-y.length)+x);if(Math.min(v,x)%2){var L=B.slice(1,-1);return{type:"em",raw:B,text:L,tokens:this.lexer.inlineTokens(L)}}var T=B.slice(2,-2);return{type:"strong",raw:B,text:T,tokens:this.lexer.inlineTokens(T)}}}}}},l.codespan=function(a){var f=this.rules.inline.code.exec(a);if(f){var h=f[2].replace(/\n/g," "),c=/[^ ]/.test(h),d=/^ /.test(h)&&/ $/.test(h);return c&&d&&(h=h.substring(1,h.length-1)),h=pt(h,!0),{type:"codespan",raw:f[0],text:h}}},l.br=function(a){var f=this.rules.inline.br.exec(a);if(f)return{type:"br",raw:f[0]}},l.del=function(a){var f=this.rules.inline.del.exec(a);if(f)return{type:"del",raw:f[0],text:f[2],tokens:this.lexer.inlineTokens(f[2])}},l.autolink=function(a,f){var h=this.rules.inline.autolink.exec(a);if(h){var c,d;return h[2]==="@"?(c=pt(this.options.mangle?f(h[1]):h[1]),d="mailto:"+c):(c=pt(h[1]),d=c),{type:"link",raw:h[0],text:c,href:d,tokens:[{type:"text",raw:c,text:c}]}}},l.url=function(a,f){var h;if(h=this.rules.inline.url.exec(a)){var c,d;if(h[2]==="@")c=pt(this.options.mangle?f(h[0]):h[0]),d="mailto:"+c;else{var v;do v=h[0],h[0]=this.rules.inline._backpedal.exec(h[0])[0];while(v!==h[0]);c=pt(h[0]),h[1]==="www."?d="http://"+h[0]:d=h[0]}return{type:"link",raw:h[0],text:c,href:d,tokens:[{type:"text",raw:c,text:c}]}}},l.inlineText=function(a,f){var h=this.rules.inline.text.exec(a);if(h){var c;return this.lexer.state.inRawBlock?c=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(h[0]):pt(h[0]):h[0]:c=pt(this.options.smartypants?f(h[0]):h[0]),{type:"text",raw:h[0],text:c}}},o}(),ce={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:ao,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/};ce._label=/(?!\s*\])(?:\\.|[^\[\]\\])+/;ce._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;ce.def=Me(ce.def).replace("label",ce._label).replace("title",ce._title).getRegex();ce.bullet=/(?:[*+-]|\d{1,9}[.)])/;ce.listItemStart=Me(/^( *)(bull) */).replace("bull",ce.bullet).getRegex();ce.list=Me(ce.list).replace(/bull/g,ce.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ce.def.source+")").getRegex();ce._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";ce._comment=/|$)/;ce.html=Me(ce.html,"i").replace("comment",ce._comment).replace("tag",ce._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();ce.paragraph=Me(ce._paragraph).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ce._tag).getRegex();ce.blockquote=Me(ce.blockquote).replace("paragraph",ce.paragraph).getRegex();ce.normal=_t({},ce);ce.gfm=_t({},ce.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"});ce.gfm.table=Me(ce.gfm.table).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ce._tag).getRegex();ce.gfm.paragraph=Me(ce._paragraph).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",ce.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ce._tag).getRegex();ce.pedantic=_t({},ce.normal,{html:Me(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ce._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:ao,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Me(ce.normal._paragraph).replace("hr",ce.hr).replace("heading",` *#{1,6} *[^ +]`).replace("lheading",ce.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var ne={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:ao,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,rDelimUnd:/^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:ao,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~";ne.punctuation=Me(ne.punctuation).replace(/punctuation/g,ne._punctuation).getRegex();ne.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;ne.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g;ne._comment=Me(ce._comment).replace("(?:-->|$)","-->").getRegex();ne.emStrong.lDelim=Me(ne.emStrong.lDelim).replace(/punct/g,ne._punctuation).getRegex();ne.emStrong.rDelimAst=Me(ne.emStrong.rDelimAst,"g").replace(/punct/g,ne._punctuation).getRegex();ne.emStrong.rDelimUnd=Me(ne.emStrong.rDelimUnd,"g").replace(/punct/g,ne._punctuation).getRegex();ne._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;ne._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;ne._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;ne.autolink=Me(ne.autolink).replace("scheme",ne._scheme).replace("email",ne._email).getRegex();ne._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;ne.tag=Me(ne.tag).replace("comment",ne._comment).replace("attribute",ne._attribute).getRegex();ne._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;ne._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;ne._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;ne.link=Me(ne.link).replace("label",ne._label).replace("href",ne._href).replace("title",ne._title).getRegex();ne.reflink=Me(ne.reflink).replace("label",ne._label).replace("ref",ce._label).getRegex();ne.nolink=Me(ne.nolink).replace("ref",ce._label).getRegex();ne.reflinkSearch=Me(ne.reflinkSearch,"g").replace("reflink",ne.reflink).replace("nolink",ne.nolink).getRegex();ne.normal=_t({},ne);ne.pedantic=_t({},ne.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Me(/^!?\[(label)\]\((.*?)\)/).replace("label",ne._label).getRegex(),reflink:Me(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ne._label).getRegex()});ne.gfm=_t({},ne.normal,{escape:Me(ne.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\.5&&(a="x"+a.toString(16)),l+="&#"+a+";";return l}var bi=function(){function o(s){this.tokens=[],this.tokens.links=Object.create(null),this.options=s||_e.defaults,this.options.tokenizer=this.options.tokenizer||new lo,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};var a={block:ce.normal,inline:ne.normal};this.options.pedantic?(a.block=ce.pedantic,a.inline=ne.pedantic):this.options.gfm&&(a.block=ce.gfm,this.options.breaks?a.inline=ne.breaks:a.inline=ne.gfm),this.tokenizer.rules=a}o.lex=function(a,f){var h=new o(f);return h.lex(a)},o.lexInline=function(a,f){var h=new o(f);return h.inlineTokens(a)};var l=o.prototype;return l.lex=function(a){a=a.replace(/\r\n|\r/g,` +`),this.blockTokens(a,this.tokens);for(var f;f=this.inlineQueue.shift();)this.inlineTokens(f.src,f.tokens);return this.tokens},l.blockTokens=function(a,f){var h=this;f===void 0&&(f=[]),this.options.pedantic?a=a.replace(/\t/g," ").replace(/^ +$/gm,""):a=a.replace(/^( *)(\t+)/gm,function(D,k,F){return k+" ".repeat(F.length)});for(var c,d,v,y;a;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(function(D){return(c=D.call({lexer:h},a,f))?(a=a.substring(c.raw.length),f.push(c),!0):!1}))){if(c=this.tokenizer.space(a)){a=a.substring(c.raw.length),c.raw.length===1&&f.length>0?f[f.length-1].raw+=` `:f.push(c);continue}if(c=this.tokenizer.code(a)){a=a.substring(c.raw.length),d=f[f.length-1],d&&(d.type==="paragraph"||d.type==="text")?(d.raw+=` `+c.raw,d.text+=` `+c.text,this.inlineQueue[this.inlineQueue.length-1].src=d.text):f.push(c);continue}if(c=this.tokenizer.fences(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.heading(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.hr(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.blockquote(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.list(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.html(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.def(a)){a=a.substring(c.raw.length),d=f[f.length-1],d&&(d.type==="paragraph"||d.type==="text")?(d.raw+=` `+c.raw,d.text+=` -`+c.raw,this.inlineQueue[this.inlineQueue.length-1].src=d.text):this.tokens.links[c.tag]||(this.tokens.links[c.tag]={href:c.href,title:c.title});continue}if(c=this.tokenizer.table(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.lheading(a)){a=a.substring(c.raw.length),f.push(c);continue}if(m=a,this.options.extensions&&this.options.extensions.startBlock&&function(){var C=1/0,S=a.slice(1),F=void 0;p.options.extensions.startBlock.forEach(function(_){F=_.call({lexer:this},S),typeof F=="number"&&F>=0&&(C=Math.min(C,F))}),C<1/0&&C>=0&&(m=a.substring(0,C+1))}(),this.state.top&&(c=this.tokenizer.paragraph(m))){d=f[f.length-1],y&&d.type==="paragraph"?(d.raw+=` +`+c.raw,this.inlineQueue[this.inlineQueue.length-1].src=d.text):this.tokens.links[c.tag]||(this.tokens.links[c.tag]={href:c.href,title:c.title});continue}if(c=this.tokenizer.table(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.lheading(a)){a=a.substring(c.raw.length),f.push(c);continue}if(v=a,this.options.extensions&&this.options.extensions.startBlock&&function(){var D=1/0,k=a.slice(1),F=void 0;h.options.extensions.startBlock.forEach(function(B){F=B.call({lexer:this},k),typeof F=="number"&&F>=0&&(D=Math.min(D,F))}),D<1/0&&D>=0&&(v=a.substring(0,D+1))}(),this.state.top&&(c=this.tokenizer.paragraph(v))){d=f[f.length-1],y&&d.type==="paragraph"?(d.raw+=` `+c.raw,d.text+=` -`+c.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=d.text):f.push(c),y=m.length!==a.length,a=a.substring(c.raw.length);continue}if(c=this.tokenizer.text(a)){a=a.substring(c.raw.length),d=f[f.length-1],d&&d.type==="text"?(d.raw+=` +`+c.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=d.text):f.push(c),y=v.length!==a.length,a=a.substring(c.raw.length);continue}if(c=this.tokenizer.text(a)){a=a.substring(c.raw.length),d=f[f.length-1],d&&d.type==="text"?(d.raw+=` `+c.raw,d.text+=` -`+c.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=d.text):f.push(c);continue}if(a){var x="Infinite loop on byte: "+a.charCodeAt(0);if(this.options.silent){console.error(x);break}else throw new Error(x)}}return this.state.top=!0,f},l.inline=function(a,f){return f===void 0&&(f=[]),this.inlineQueue.push({src:a,tokens:f}),f},l.inlineTokens=function(a,f){var p=this;f===void 0&&(f=[]);var c,d,m,y=a,x,C,S;if(this.tokens.links){var F=Object.keys(this.tokens.links);if(F.length>0)for(;(x=this.tokenizer.rules.inline.reflinkSearch.exec(y))!=null;)F.includes(x[0].slice(x[0].lastIndexOf("[")+1,-1))&&(y=y.slice(0,x.index)+"["+Hf("a",x[0].length-2)+"]"+y.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(x=this.tokenizer.rules.inline.blockSkip.exec(y))!=null;)y=y.slice(0,x.index)+"["+Hf("a",x[0].length-2)+"]"+y.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(x=this.tokenizer.rules.inline.escapedEmSt.exec(y))!=null;)y=y.slice(0,x.index+x[0].length-2)+"++"+y.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex),this.tokenizer.rules.inline.escapedEmSt.lastIndex--;for(;a;)if(C||(S=""),C=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(function(L){return(c=L.call({lexer:p},a,f))?(a=a.substring(c.raw.length),f.push(c),!0):!1}))){if(c=this.tokenizer.escape(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.tag(a)){a=a.substring(c.raw.length),d=f[f.length-1],d&&c.type==="text"&&d.type==="text"?(d.raw+=c.raw,d.text+=c.text):f.push(c);continue}if(c=this.tokenizer.link(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.reflink(a,this.tokens.links)){a=a.substring(c.raw.length),d=f[f.length-1],d&&c.type==="text"&&d.type==="text"?(d.raw+=c.raw,d.text+=c.text):f.push(c);continue}if(c=this.tokenizer.emStrong(a,y,S)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.codespan(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.br(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.del(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.autolink(a,Wf)){a=a.substring(c.raw.length),f.push(c);continue}if(!this.state.inLink&&(c=this.tokenizer.url(a,Wf))){a=a.substring(c.raw.length),f.push(c);continue}if(m=a,this.options.extensions&&this.options.extensions.startInline&&function(){var L=1/0,T=a.slice(1),O=void 0;p.options.extensions.startInline.forEach(function(N){O=N.call({lexer:this},T),typeof O=="number"&&O>=0&&(L=Math.min(L,O))}),L<1/0&&L>=0&&(m=a.substring(0,L+1))}(),c=this.tokenizer.inlineText(m,hp)){a=a.substring(c.raw.length),c.raw.slice(-1)!=="_"&&(S=c.raw.slice(-1)),C=!0,d=f[f.length-1],d&&d.type==="text"?(d.raw+=c.raw,d.text+=c.text):f.push(c);continue}if(a){var _="Infinite loop on byte: "+a.charCodeAt(0);if(this.options.silent){console.error(_);break}else throw new Error(_)}}return f},Yh(o,null,[{key:"rules",get:function(){return{block:ce,inline:ie}}}]),o}(),so=function(){function o(s){this.options=s||Be.defaults}var l=o.prototype;return l.code=function(a,f,p){var c=(f||"").match(/\S*/)[0];if(this.options.highlight){var d=this.options.highlight(a,c);d!=null&&d!==a&&(p=!0,a=d)}return a=a.replace(/\n$/,"")+` -`,c?'
'+(p?a:ht(a,!0))+`
-`:"
"+(p?a:ht(a,!0))+`
+`+c.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=d.text):f.push(c);continue}if(a){var x="Infinite loop on byte: "+a.charCodeAt(0);if(this.options.silent){console.error(x);break}else throw new Error(x)}}return this.state.top=!0,f},l.inline=function(a,f){return f===void 0&&(f=[]),this.inlineQueue.push({src:a,tokens:f}),f},l.inlineTokens=function(a,f){var h=this;f===void 0&&(f=[]);var c,d,v,y=a,x,D,k;if(this.tokens.links){var F=Object.keys(this.tokens.links);if(F.length>0)for(;(x=this.tokenizer.rules.inline.reflinkSearch.exec(y))!=null;)F.includes(x[0].slice(x[0].lastIndexOf("[")+1,-1))&&(y=y.slice(0,x.index)+"["+qf("a",x[0].length-2)+"]"+y.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(x=this.tokenizer.rules.inline.blockSkip.exec(y))!=null;)y=y.slice(0,x.index)+"["+qf("a",x[0].length-2)+"]"+y.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(x=this.tokenizer.rules.inline.escapedEmSt.exec(y))!=null;)y=y.slice(0,x.index+x[0].length-2)+"++"+y.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex),this.tokenizer.rules.inline.escapedEmSt.lastIndex--;for(;a;)if(D||(k=""),D=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(function(L){return(c=L.call({lexer:h},a,f))?(a=a.substring(c.raw.length),f.push(c),!0):!1}))){if(c=this.tokenizer.escape(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.tag(a)){a=a.substring(c.raw.length),d=f[f.length-1],d&&c.type==="text"&&d.type==="text"?(d.raw+=c.raw,d.text+=c.text):f.push(c);continue}if(c=this.tokenizer.link(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.reflink(a,this.tokens.links)){a=a.substring(c.raw.length),d=f[f.length-1],d&&c.type==="text"&&d.type==="text"?(d.raw+=c.raw,d.text+=c.text):f.push(c);continue}if(c=this.tokenizer.emStrong(a,y,k)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.codespan(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.br(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.del(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.autolink(a,Wf)){a=a.substring(c.raw.length),f.push(c);continue}if(!this.state.inLink&&(c=this.tokenizer.url(a,Wf))){a=a.substring(c.raw.length),f.push(c);continue}if(v=a,this.options.extensions&&this.options.extensions.startInline&&function(){var L=1/0,T=a.slice(1),N=void 0;h.options.extensions.startInline.forEach(function(z){N=z.call({lexer:this},T),typeof N=="number"&&N>=0&&(L=Math.min(L,N))}),L<1/0&&L>=0&&(v=a.substring(0,L+1))}(),c=this.tokenizer.inlineText(v,vp)){a=a.substring(c.raw.length),c.raw.slice(-1)!=="_"&&(k=c.raw.slice(-1)),D=!0,d=f[f.length-1],d&&d.type==="text"?(d.raw+=c.raw,d.text+=c.text):f.push(c);continue}if(a){var B="Infinite loop on byte: "+a.charCodeAt(0);if(this.options.silent){console.error(B);break}else throw new Error(B)}}return f},Vh(o,null,[{key:"rules",get:function(){return{block:ce,inline:ne}}}]),o}(),so=function(){function o(s){this.options=s||_e.defaults}var l=o.prototype;return l.code=function(a,f,h){var c=(f||"").match(/\S*/)[0];if(this.options.highlight){var d=this.options.highlight(a,c);d!=null&&d!==a&&(h=!0,a=d)}return a=a.replace(/\n$/,"")+` +`,c?'
'+(h?a:pt(a,!0))+`
+`:"
"+(h?a:pt(a,!0))+`
`},l.blockquote=function(a){return`
`+a+`
-`},l.html=function(a){return a},l.heading=function(a,f,p,c){if(this.options.headerIds){var d=this.options.headerPrefix+c.slug(p);return"'+a+" +`},l.html=function(a){return a},l.heading=function(a,f,h,c){if(this.options.headerIds){var d=this.options.headerPrefix+c.slug(h);return"'+a+" `}return""+a+" `},l.hr=function(){return this.options.xhtml?`
`:`
-`},l.list=function(a,f,p){var c=f?"ol":"ul",d=f&&p!==1?' start="'+p+'"':"";return"<"+c+d+`> +`},l.list=function(a,f,h){var c=f?"ol":"ul",d=f&&h!==1?' start="'+h+'"':"";return"<"+c+d+`> `+a+" `},l.listitem=function(a){return"
  • "+a+`
  • `},l.checkbox=function(a){return" "},l.paragraph=function(a){return"

    "+a+`

    @@ -72,16 +72,16 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `+f+` `},l.tablerow=function(a){return` `+a+` -`},l.tablecell=function(a,f){var p=f.header?"th":"td",c=f.align?"<"+p+' align="'+f.align+'">':"<"+p+">";return c+a+(" -`)},l.strong=function(a){return""+a+""},l.em=function(a){return""+a+""},l.codespan=function(a){return""+a+""},l.br=function(){return this.options.xhtml?"
    ":"
    "},l.del=function(a){return""+a+""},l.link=function(a,f,p){if(a=Pf(this.options.sanitize,this.options.baseUrl,a),a===null)return p;var c='",c},l.image=function(a,f,p){if(a=Pf(this.options.sanitize,this.options.baseUrl,a),a===null)return p;var c=''+p+'":">",c},l.text=function(a){return a},o}(),cl=function(){function o(){}var l=o.prototype;return l.strong=function(a){return a},l.em=function(a){return a},l.codespan=function(a){return a},l.del=function(a){return a},l.html=function(a){return a},l.text=function(a){return a},l.link=function(a,f,p){return""+p},l.image=function(a,f,p){return""+p},l.br=function(){return""},o}(),dl=function(){function o(){this.seen={}}var l=o.prototype;return l.serialize=function(a){return a.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},l.getNextSafeSlug=function(a,f){var p=a,c=0;if(this.seen.hasOwnProperty(p)){c=this.seen[a];do c++,p=a+"-"+c;while(this.seen.hasOwnProperty(p))}return f||(this.seen[a]=c,this.seen[p]=0),p},l.slug=function(a,f){f===void 0&&(f={});var p=this.serialize(a);return this.getNextSafeSlug(p,f.dryrun)},o}(),xn=function(){function o(s){this.options=s||Be.defaults,this.options.renderer=this.options.renderer||new so,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new cl,this.slugger=new dl}o.parse=function(a,f){var p=new o(f);return p.parse(a)},o.parseInline=function(a,f){var p=new o(f);return p.parseInline(a)};var l=o.prototype;return l.parse=function(a,f){f===void 0&&(f=!0);var p="",c,d,m,y,x,C,S,F,_,L,T,O,N,I,P,q,G,K,me,U=a.length;for(c=0;c0&&P.tokens[0].type==="paragraph"?(P.tokens[0].text=K+" "+P.tokens[0].text,P.tokens[0].tokens&&P.tokens[0].tokens.length>0&&P.tokens[0].tokens[0].type==="text"&&(P.tokens[0].tokens[0].text=K+" "+P.tokens[0].tokens[0].text)):P.tokens.unshift({type:"text",text:K}):I+=K),I+=this.parse(P.tokens,N),_+=this.renderer.listitem(I,G,q);p+=this.renderer.list(_,T,O);continue}case"html":{p+=this.renderer.html(L.text);continue}case"paragraph":{p+=this.renderer.paragraph(this.parseInline(L.tokens));continue}case"text":{for(_=L.tokens?this.parseInline(L.tokens):L.text;c+1";if(l)return Promise.resolve(f);if(s){s(null,f);return}return f}if(l)return Promise.reject(a);if(s){s(a);return}throw a}}function Gf(o,l){return function(s,a,f){typeof a=="function"&&(f=a,a=null);var p=_t({},a);a=_t({},fe.defaults,p);var c=pp(a.silent,a.async,f);if(typeof s>"u"||s===null)return c(new Error("marked(): input parameter is undefined or null"));if(typeof s!="string")return c(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));if(cp(a),a.hooks&&(a.hooks.options=a),f){var d=a.highlight,m;try{a.hooks&&(s=a.hooks.preprocess(s)),m=o(s,a)}catch(F){return c(F)}var y=function(_){var L;if(!_)try{a.walkTokens&&fe.walkTokens(m,a.walkTokens),L=l(m,a),a.hooks&&(L=a.hooks.postprocess(L))}catch(T){_=T}return a.highlight=d,_?c(_):f(null,L)};if(!d||d.length<3||(delete a.highlight,!m.length))return y();var x=0;fe.walkTokens(m,function(F){F.type==="code"&&(x++,setTimeout(function(){d(F.text,F.lang,function(_,L){if(_)return y(_);L!=null&&L!==F.text&&(F.text=L,F.escaped=!0),x--,x===0&&y()})},0))}),x===0&&y();return}if(a.async)return Promise.resolve(a.hooks?a.hooks.preprocess(s):s).then(function(F){return o(F,a)}).then(function(F){return a.walkTokens?Promise.all(fe.walkTokens(F,a.walkTokens)).then(function(){return F}):F}).then(function(F){return l(F,a)}).then(function(F){return a.hooks?a.hooks.postprocess(F):F}).catch(c);try{a.hooks&&(s=a.hooks.preprocess(s));var C=o(s,a);a.walkTokens&&fe.walkTokens(C,a.walkTokens);var S=l(C,a);return a.hooks&&(S=a.hooks.postprocess(S)),S}catch(F){return c(F)}}}function fe(o,l,s){return Gf(yn.lex,xn.parse)(o,l,s)}fe.options=fe.setOptions=function(o){return fe.defaults=_t({},fe.defaults,o),$h(fe.defaults),fe};fe.getDefaults=fl;fe.defaults=Be.defaults;fe.use=function(){for(var o=fe.defaults.extensions||{renderers:{},childTokens:{}},l=arguments.length,s=new Array(l),a=0;a{"use strict";var Dn=Et();$u();ef();nf();al();ll();vf();yf();wf();Sf();Ff();ol();var Cp=Bf(),hl=Xf().marked,Zf=/Mac/.test(navigator.platform),kp=new RegExp(/()+?/g),ui={toggleBold:co,toggleItalic:ho,drawLink:So,toggleHeadingSmaller:fi,toggleHeadingBigger:mo,drawImage:Eo,toggleBlockquote:vo,toggleOrderedList:wo,toggleUnorderedList:Do,toggleCheckList:Co,toggleCodeBlock:go,togglePreview:Mo,toggleStrikethrough:po,toggleHeading1:bo,toggleHeading2:yo,toggleHeading3:xo,toggleHeading4:gl,toggleHeading5:vl,toggleHeading6:ml,cleanBlock:ko,drawTable:Ao,drawHorizontalRule:Fo,undo:To,redo:Lo,toggleSideBySide:wn,toggleFullScreen:jr},Sp={toggleBold:"Cmd-B",toggleItalic:"Cmd-I",drawLink:"Cmd-K",toggleHeadingSmaller:"Cmd-H",toggleHeadingBigger:"Shift-Cmd-H",toggleHeading1:"Ctrl+Alt+1",toggleHeading2:"Ctrl+Alt+2",toggleHeading3:"Ctrl+Alt+3",toggleHeading4:"Ctrl+Alt+4",toggleHeading5:"Ctrl+Alt+5",toggleHeading6:"Ctrl+Alt+6",cleanBlock:"Cmd-E",drawImage:"Cmd-Alt-I",toggleBlockquote:"Cmd-'",toggleOrderedList:"Cmd-Alt-L",toggleUnorderedList:"Cmd-L",toggleCheckList:"Shift-Cmd-L",toggleCodeBlock:"Cmd-Alt-C",togglePreview:"Cmd-P",toggleSideBySide:"F9",toggleFullScreen:"F11"},Ep=function(o){for(var l in ui)if(ui[l]===o)return l;return null},pl=function(){var o=!1;return function(l){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(l)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(l.substr(0,4)))&&(o=!0)}(navigator.userAgent||navigator.vendor||window.opera),o};function Ap(o){for(var l;(l=kp.exec(o))!==null;){var s=l[0];if(s.indexOf("target=")===-1){var a=s.replace(/>$/,' target="_blank">');o=o.replace(s,a)}}return o}function Fp(o){for(var l=new DOMParser,s=l.parseFromString(o,"text/html"),a=s.getElementsByTagName("li"),f=0;f0){for(var F=document.createElement("i"),_=0;_':"<"+h+">";return c+a+(" +`)},l.strong=function(a){return""+a+""},l.em=function(a){return""+a+""},l.codespan=function(a){return""+a+""},l.br=function(){return this.options.xhtml?"
    ":"
    "},l.del=function(a){return""+a+""},l.link=function(a,f,h){if(a=Hf(this.options.sanitize,this.options.baseUrl,a),a===null)return h;var c='
    ",c},l.image=function(a,f,h){if(a=Hf(this.options.sanitize,this.options.baseUrl,a),a===null)return h;var c=''+h+'":">",c},l.text=function(a){return a},o}(),dl=function(){function o(){}var l=o.prototype;return l.strong=function(a){return a},l.em=function(a){return a},l.codespan=function(a){return a},l.del=function(a){return a},l.html=function(a){return a},l.text=function(a){return a},l.link=function(a,f,h){return""+h},l.image=function(a,f,h){return""+h},l.br=function(){return""},o}(),hl=function(){function o(){this.seen={}}var l=o.prototype;return l.serialize=function(a){return a.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},l.getNextSafeSlug=function(a,f){var h=a,c=0;if(this.seen.hasOwnProperty(h)){c=this.seen[a];do c++,h=a+"-"+c;while(this.seen.hasOwnProperty(h))}return f||(this.seen[a]=c,this.seen[h]=0),h},l.slug=function(a,f){f===void 0&&(f={});var h=this.serialize(a);return this.getNextSafeSlug(h,f.dryrun)},o}(),yi=function(){function o(s){this.options=s||_e.defaults,this.options.renderer=this.options.renderer||new so,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new dl,this.slugger=new hl}o.parse=function(a,f){var h=new o(f);return h.parse(a)},o.parseInline=function(a,f){var h=new o(f);return h.parseInline(a)};var l=o.prototype;return l.parse=function(a,f){f===void 0&&(f=!0);var h="",c,d,v,y,x,D,k,F,B,L,T,N,z,O,I,W,G,X,de,j=a.length;for(c=0;c0&&I.tokens[0].type==="paragraph"?(I.tokens[0].text=X+" "+I.tokens[0].text,I.tokens[0].tokens&&I.tokens[0].tokens.length>0&&I.tokens[0].tokens[0].type==="text"&&(I.tokens[0].tokens[0].text=X+" "+I.tokens[0].tokens[0].text)):I.tokens.unshift({type:"text",text:X}):O+=X),O+=this.parse(I.tokens,z),B+=this.renderer.listitem(O,G,W);h+=this.renderer.list(B,T,N);continue}case"html":{h+=this.renderer.html(L.text);continue}case"paragraph":{h+=this.renderer.paragraph(this.parseInline(L.tokens));continue}case"text":{for(B=L.tokens?this.parseInline(L.tokens):L.text;c+1";if(l)return Promise.resolve(f);if(s){s(null,f);return}return f}if(l)return Promise.reject(a);if(s){s(a);return}throw a}}function Xf(o,l){return function(s,a,f){typeof a=="function"&&(f=a,a=null);var h=_t({},a);a=_t({},fe.defaults,h);var c=bp(a.silent,a.async,f);if(typeof s>"u"||s===null)return c(new Error("marked(): input parameter is undefined or null"));if(typeof s!="string")return c(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));if(gp(a),a.hooks&&(a.hooks.options=a),f){var d=a.highlight,v;try{a.hooks&&(s=a.hooks.preprocess(s)),v=o(s,a)}catch(F){return c(F)}var y=function(B){var L;if(!B)try{a.walkTokens&&fe.walkTokens(v,a.walkTokens),L=l(v,a),a.hooks&&(L=a.hooks.postprocess(L))}catch(T){B=T}return a.highlight=d,B?c(B):f(null,L)};if(!d||d.length<3||(delete a.highlight,!v.length))return y();var x=0;fe.walkTokens(v,function(F){F.type==="code"&&(x++,setTimeout(function(){d(F.text,F.lang,function(B,L){if(B)return y(B);L!=null&&L!==F.text&&(F.text=L,F.escaped=!0),x--,x===0&&y()})},0))}),x===0&&y();return}if(a.async)return Promise.resolve(a.hooks?a.hooks.preprocess(s):s).then(function(F){return o(F,a)}).then(function(F){return a.walkTokens?Promise.all(fe.walkTokens(F,a.walkTokens)).then(function(){return F}):F}).then(function(F){return l(F,a)}).then(function(F){return a.hooks?a.hooks.postprocess(F):F}).catch(c);try{a.hooks&&(s=a.hooks.preprocess(s));var D=o(s,a);a.walkTokens&&fe.walkTokens(D,a.walkTokens);var k=l(D,a);return a.hooks&&(k=a.hooks.postprocess(k)),k}catch(F){return c(F)}}}function fe(o,l,s){return Xf(bi.lex,yi.parse)(o,l,s)}fe.options=fe.setOptions=function(o){return fe.defaults=_t({},fe.defaults,o),rp(fe.defaults),fe};fe.getDefaults=cl;fe.defaults=_e.defaults;fe.use=function(){for(var o=fe.defaults.extensions||{renderers:{},childTokens:{}},l=arguments.length,s=new Array(l),a=0;a{"use strict";var xi=At();$u();tf();of();ll();sl();vf();xf();Df();Ef();Tf();al();var Ap=zf(),pl=Kf().marked,Qf=/Mac/.test(navigator.platform),Fp=new RegExp(/()+?/g),un={toggleBold:co,toggleItalic:ho,drawLink:So,toggleHeadingSmaller:fn,toggleHeadingBigger:vo,drawImage:Eo,toggleBlockquote:mo,toggleOrderedList:Co,toggleUnorderedList:wo,toggleCheckList:Do,toggleCodeBlock:go,togglePreview:Mo,toggleStrikethrough:po,toggleHeading1:bo,toggleHeading2:yo,toggleHeading3:xo,toggleHeading4:ml,toggleHeading5:vl,toggleHeading6:bl,cleanBlock:ko,drawTable:Ao,drawHorizontalRule:Fo,undo:To,redo:Lo,toggleSideBySide:wi,toggleFullScreen:jr},Tp={toggleBold:"Cmd-B",toggleItalic:"Cmd-I",drawLink:"Cmd-K",toggleHeadingSmaller:"Cmd-H",toggleHeadingBigger:"Shift-Cmd-H",toggleHeading1:"Ctrl+Alt+1",toggleHeading2:"Ctrl+Alt+2",toggleHeading3:"Ctrl+Alt+3",toggleHeading4:"Ctrl+Alt+4",toggleHeading5:"Ctrl+Alt+5",toggleHeading6:"Ctrl+Alt+6",cleanBlock:"Cmd-E",drawImage:"Cmd-Alt-I",toggleBlockquote:"Cmd-'",toggleOrderedList:"Cmd-Alt-L",toggleUnorderedList:"Cmd-L",toggleCheckList:"Shift-Cmd-L",toggleCodeBlock:"Cmd-Alt-C",togglePreview:"Cmd-P",toggleSideBySide:"F9",toggleFullScreen:"F11"},Lp=function(o){for(var l in un)if(un[l]===o)return l;return null},gl=function(){var o=!1;return function(l){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(l)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(l.substr(0,4)))&&(o=!0)}(navigator.userAgent||navigator.vendor||window.opera),o};function Mp(o){for(var l;(l=Fp.exec(o))!==null;){var s=l[0];if(s.indexOf("target=")===-1){var a=s.replace(/>$/,' target="_blank">');o=o.replace(s,a)}}return o}function Bp(o){for(var l=new DOMParser,s=l.parseFromString(o,"text/html"),a=s.getElementsByTagName("li"),f=0;f0){for(var F=document.createElement("i"),B=0;B=0&&(x=c.getLineHandle(S),!s(x));S--);var O=c.getTokenAt({line:S,ch:1}),N=a(O).fencedChars,I,P,q,G;s(c.getLineHandle(d.line))?(I="",P=d.line):s(c.getLineHandle(d.line-1))?(I="",P=d.line-1):(I=N+` -`,P=d.line),s(c.getLineHandle(m.line))?(q="",G=m.line,m.ch===0&&(G+=1)):m.ch!==0&&s(c.getLineHandle(m.line+1))?(q="",G=m.line+1):(q=N+` -`,G=m.line+1),m.ch===0&&(G-=1),c.operation(function(){c.replaceRange(q,{line:G,ch:0},{line:G+(q?0:1),ch:0}),c.replaceRange(I,{line:P,ch:0},{line:P+(I?0:1),ch:0})}),c.setSelection({line:P+(I?1:0),ch:0},{line:G+(I?1:-1),ch:0}),c.focus()}else{var K=d.line;if(s(c.getLineHandle(d.line))&&(f(c,d.line+1)==="fenced"?(S=d.line,K=d.line+1):(F=d.line,K=d.line-1)),S===void 0)for(S=K;S>=0&&(x=c.getLineHandle(S),!s(x));S--);if(F===void 0)for(_=c.lineCount(),F=K;F<_&&(x=c.getLineHandle(F),!s(x));F++);c.operation(function(){c.replaceRange("",{line:S,ch:0},{line:S+1,ch:0}),c.replaceRange("",{line:F-1,ch:0},{line:F,ch:0})}),c.focus()}else if(C==="indented"){if(d.line!==m.line||d.ch!==m.ch)S=d.line,F=m.line,m.ch===0&&F--;else{for(S=d.line;S>=0;S--)if(x=c.getLineHandle(S),!x.text.match(/^\s*$/)&&f(c,S,x)!=="indented"){S+=1;break}for(_=c.lineCount(),F=d.line;F<_;F++)if(x=c.getLineHandle(F),!x.text.match(/^\s*$/)&&f(c,F,x)!=="indented"){F-=1;break}}var me=c.getLineHandle(F+1),U=me&&c.getTokenAt({line:F+1,ch:me.text.length-1}),le=U&&a(U).indentedCode;le&&c.replaceRange(` -`,{line:F+1,ch:0});for(var j=S;j<=F;j++)c.indentLine(j,"subtract");c.focus()}else{var ee=d.line===m.line&&d.ch===m.ch&&d.ch===0,E=d.line!==m.line;ee||E?p(c,d,m,l):Gr(c,!1,["`","`"])}}function vo(o){_o(o.codemirror,"quote")}function fi(o){Er(o.codemirror,"smaller")}function mo(o){Er(o.codemirror,"bigger")}function bo(o){Er(o.codemirror,void 0,1)}function yo(o){Er(o.codemirror,void 0,2)}function xo(o){Er(o.codemirror,void 0,3)}function gl(o){Er(o.codemirror,void 0,4)}function vl(o){Er(o.codemirror,void 0,5)}function ml(o){Er(o.codemirror,void 0,6)}function Do(o){var l=o.codemirror,s="*";["-","+","*"].includes(o.options.unorderedListStyle)&&(s=o.options.unorderedListStyle),_o(l,"unordered-list",s)}function wo(o){_o(o.codemirror,"ordered-list")}function Co(o){_o(o.codemirror,"check-list")}function ko(o){_p(o.codemirror)}function So(o){var l=o.options,s="https://";if(l.promptURLs){var a=prompt(l.promptTexts.link,s);if(!a)return!1;s=Jf(a)}Vf(o,"link",l.insertTexts.link,s)}function Eo(o){var l=o.options,s="https://";if(l.promptURLs){var a=prompt(l.promptTexts.image,s);if(!a)return!1;s=Jf(a)}Vf(o,"image",l.insertTexts.image,s)}function Jf(o){return encodeURI(o).replace(/([\\()])/g,"\\$1")}function bl(o){o.openBrowseFileWindow()}function $f(o,l){var s=o.codemirror,a=Sr(s),f=o.options,p=l.substr(l.lastIndexOf("/")+1),c=p.substring(p.lastIndexOf(".")+1).replace(/\?.*$/,"").toLowerCase();if(["png","jpg","jpeg","gif","svg","apng","avif","webp"].includes(c))Gr(s,a.image,f.insertTexts.uploadedImage,l);else{var d=f.insertTexts.link;d[0]="["+p,Gr(s,a.link,d,l)}o.updateStatusBar("upload-image",o.options.imageTexts.sbOnUploaded.replace("#image_name#",p)),setTimeout(function(){o.updateStatusBar("upload-image",o.options.imageTexts.sbInit)},1e3)}function Ao(o){var l=o.codemirror,s=Sr(l),a=o.options;Gr(l,s.table,a.insertTexts.table)}function Fo(o){var l=o.codemirror,s=Sr(l),a=o.options;Gr(l,s.image,a.insertTexts.horizontalRule)}function To(o){var l=o.codemirror;l.undo(),l.focus()}function Lo(o){var l=o.codemirror;l.redo(),l.focus()}function wn(o){var l=o.codemirror,s=l.getWrapperElement(),a=s.nextSibling,f=o.toolbarElements&&o.toolbarElements["side-by-side"],p=!1,c=s.parentNode;a.classList.contains("editor-preview-active-side")?(o.options.sideBySideFullscreen===!1&&c.classList.remove("sided--no-fullscreen"),a.classList.remove("editor-preview-active-side"),f&&f.classList.remove("active"),s.classList.remove("CodeMirror-sided")):(setTimeout(function(){l.getOption("fullScreen")||(o.options.sideBySideFullscreen===!1?c.classList.add("sided--no-fullscreen"):jr(o)),a.classList.add("editor-preview-active-side")},1),f&&f.classList.add("active"),s.classList.add("CodeMirror-sided"),p=!0);var d=s.lastChild;if(d.classList.contains("editor-preview-active")){d.classList.remove("editor-preview-active");var m=o.toolbarElements.preview,y=o.toolbar_div;m.classList.remove("active"),y.classList.remove("disabled-for-preview")}var x=function(){var S=o.options.previewRender(o.value(),a);S!=null&&(a.innerHTML=S)};if(l.sideBySideRenderingFunction||(l.sideBySideRenderingFunction=x),p){var C=o.options.previewRender(o.value(),a);C!=null&&(a.innerHTML=C),l.on("update",l.sideBySideRenderingFunction)}else l.off("update",l.sideBySideRenderingFunction);l.refresh()}function Mo(o){var l=o.codemirror,s=l.getWrapperElement(),a=o.toolbar_div,f=o.options.toolbar?o.toolbarElements.preview:!1,p=s.lastChild,c=l.getWrapperElement().nextSibling;if(c.classList.contains("editor-preview-active-side")&&wn(o),!p||!p.classList.contains("editor-preview-full")){if(p=document.createElement("div"),p.className="editor-preview-full",o.options.previewClass)if(Array.isArray(o.options.previewClass))for(var d=0;d\s+/,"unordered-list":a,"ordered-list":a,"check-list":/^(\s*)(- \[[ xX]])(\s+)/},y=function(O,N){var I={quote:">","unordered-list":s,"ordered-list":"%%i.","check-list":"- [ ]"};return I[O].replace("%%i",N)},x=function(O,N){var I={quote:">","unordered-list":"\\"+s,"ordered-list":"\\d+.","check-list":"- \\[[ xX]]"},P=new RegExp(I[O]);return N&&P.test(N)},C=function(O,N,I){var P=a.exec(N),q=y(O,S);return P!==null?(x(O,P[2])&&(q=""),N=P[1]+q+P[3]+N.replace(f,"").replace(m[O],"$1")):I==!1&&(N=q+" "+N),N},S=1,F=["unordered-list","ordered-list","check-list"],_=Object.keys(p)[0];if(!F.includes(_)){var L=o.getLine(c.line);/^\s*- \[[ xX]]\s/.test(L)?_="check-list":/^\s*\d+\.\s/.test(L)?_="ordered-list":/^\s*[*\-+]\s/.test(L)&&(_="unordered-list")}for(var T=c.line;T<=d.line;T++)(function(O){var N=o.getLine(O);p[l]?N=N.replace(m[l],"$1"):F.includes(_)&&F.includes(l)?(N=N.replace(m[_],"$1"),N=C(l,N,!1),S+=1):(N=C(l,N,!1),S+=1),o.replaceRange(N,{line:O,ch:0},{line:O,ch:99999999999999})})(T);o.focus()}}function Vf(o,l,s,a){if(!(!o.codemirror||o.isPreviewActive())){var f=o.codemirror,p=Sr(f),c=p[l];if(!c){Gr(f,c,s,a);return}var d=f.getCursor("start"),m=f.getCursor("end"),y=f.getLine(d.line),x=y.slice(0,d.ch),C=y.slice(d.ch);l=="link"?x=x.replace(/(.*)[^!]\[/,"$1"):l=="image"&&(x=x.replace(/(.*)!\[$/,"$1")),C=C.replace(/]\(.*?\)/,""),f.replaceRange(x+C,{line:d.line,ch:0},{line:d.line,ch:99999999999999}),d.ch-=s[0].length,d!==m&&(m.ch-=s[0].length),f.setSelection(d,m),f.focus()}}function yl(o,l,s,a){if(!(!o.codemirror||o.isPreviewActive())){a=typeof a>"u"?s:a;var f=o.codemirror,p=Sr(f),c,d=s,m=a,y=f.getCursor("start"),x=f.getCursor("end");p[l]?(c=f.getLine(y.line),d=c.slice(0,y.ch),m=c.slice(y.ch),l=="bold"?(d=d.replace(/(\*\*|__)(?![\s\S]*(\*\*|__))/,""),m=m.replace(/(\*\*|__)/,"")):l=="italic"?(d=d.replace(/(\*|_)(?![\s\S]*(\*|_))/,""),m=m.replace(/(\*|_)/,"")):l=="strikethrough"&&(d=d.replace(/(\*\*|~~)(?![\s\S]*(\*\*|~~))/,""),m=m.replace(/(\*\*|~~)/,"")),f.replaceRange(d+m,{line:y.line,ch:0},{line:y.line,ch:99999999999999}),l=="bold"||l=="strikethrough"?(y.ch-=2,y!==x&&(x.ch-=2)):l=="italic"&&(y.ch-=1,y!==x&&(x.ch-=1))):(c=f.getSelection(),l=="bold"?(c=c.split("**").join(""),c=c.split("__").join("")):l=="italic"?(c=c.split("*").join(""),c=c.split("_").join("")):l=="strikethrough"&&(c=c.split("~~").join("")),f.replaceSelection(d+c+m),y.ch+=s.length,x.ch=y.ch+c.length),f.setSelection(y,x),f.focus()}}function _p(o){if(!o.getWrapperElement().lastChild.classList.contains("editor-preview-active"))for(var l=o.getCursor("start"),s=o.getCursor("end"),a,f=l.line;f<=s.line;f++)a=o.getLine(f),a=a.replace(/^[ ]*([# ]+|\*|-|[> ]+|[0-9]+(.|\)))[ ]*/,""),o.replaceRange(a,{line:f,ch:0},{line:f,ch:99999999999999})}function fo(o,l){if(Math.abs(o)<1024)return""+o+l[0];var s=0;do o/=1024,++s;while(Math.abs(o)>=1024&&s=19968?a+=s[f].length:a+=1;return a}var _e={bold:"fa fa-bold",italic:"fa fa-italic",strikethrough:"fa fa-strikethrough",heading:"fa fa-header fa-heading","heading-smaller":"fa fa-header fa-heading header-smaller","heading-bigger":"fa fa-header fa-heading header-bigger","heading-1":"fa fa-header fa-heading header-1","heading-2":"fa fa-header fa-heading header-2","heading-3":"fa fa-header fa-heading header-3",code:"fa fa-code",quote:"fa fa-quote-left","ordered-list":"fa fa-list-ol","unordered-list":"fa fa-list-ul","check-list":"fa fa-check-square-o","clean-block":"fa fa-eraser",link:"fa fa-link",image:"fa fa-image","upload-image":"fa fa-image",table:"fa fa-table","horizontal-rule":"fa fa-minus",preview:"fa fa-eye","side-by-side":"fa fa-columns",fullscreen:"fa fa-arrows-alt",guide:"fa fa-question-circle",undo:"fa fa-undo",redo:"fa fa-repeat fa-redo"},Ur={bold:{name:"bold",action:co,className:_e.bold,title:"Bold",default:!0},italic:{name:"italic",action:ho,className:_e.italic,title:"Italic",default:!0},strikethrough:{name:"strikethrough",action:po,className:_e.strikethrough,title:"Strikethrough"},heading:{name:"heading",action:fi,className:_e.heading,title:"Heading",default:!0},"heading-smaller":{name:"heading-smaller",action:fi,className:_e["heading-smaller"],title:"Smaller Heading"},"heading-bigger":{name:"heading-bigger",action:mo,className:_e["heading-bigger"],title:"Bigger Heading"},"heading-1":{name:"heading-1",action:bo,className:_e["heading-1"],title:"Big Heading"},"heading-2":{name:"heading-2",action:yo,className:_e["heading-2"],title:"Medium Heading"},"heading-3":{name:"heading-3",action:xo,className:_e["heading-3"],title:"Small Heading"},"separator-1":{name:"separator-1"},code:{name:"code",action:go,className:_e.code,title:"Code"},quote:{name:"quote",action:vo,className:_e.quote,title:"Quote",default:!0},"unordered-list":{name:"unordered-list",action:Do,className:_e["unordered-list"],title:"Generic List",default:!0},"ordered-list":{name:"ordered-list",action:wo,className:_e["ordered-list"],title:"Numbered List",default:!0},"check-list":{name:"check-list",action:Co,className:_e["check-list"],title:"Check List",default:!0},"clean-block":{name:"clean-block",action:ko,className:_e["clean-block"],title:"Clean block"},"separator-2":{name:"separator-2"},link:{name:"link",action:So,className:_e.link,title:"Create Link",default:!0},image:{name:"image",action:Eo,className:_e.image,title:"Insert Image",default:!0},"upload-image":{name:"upload-image",action:bl,className:_e["upload-image"],title:"Import an image"},table:{name:"table",action:Ao,className:_e.table,title:"Insert Table"},"horizontal-rule":{name:"horizontal-rule",action:Fo,className:_e["horizontal-rule"],title:"Insert Horizontal Line"},"separator-3":{name:"separator-3"},preview:{name:"preview",action:Mo,className:_e.preview,noDisable:!0,title:"Toggle Preview",default:!0},"side-by-side":{name:"side-by-side",action:wn,className:_e["side-by-side"],noDisable:!0,noMobile:!0,title:"Toggle Side by Side",default:!0},fullscreen:{name:"fullscreen",action:jr,className:_e.fullscreen,noDisable:!0,noMobile:!0,title:"Toggle Fullscreen",default:!0},"separator-4":{name:"separator-4"},guide:{name:"guide",action:"https://www.markdownguide.org/basic-syntax/",className:_e.guide,noDisable:!0,title:"Markdown Guide",default:!0},"separator-5":{name:"separator-5"},undo:{name:"undo",action:To,className:_e.undo,noDisable:!0,title:"Undo"},redo:{name:"redo",action:Lo,className:_e.redo,noDisable:!0,title:"Redo"}},Bp={link:["[","](#url#)"],image:["![","](#url#)"],uploadedImage:["![](#url#)",""],table:["",` +`+he;A&&Ee++,A&&Q.ch===0&&(te=he+` +`,Ee--),Gr(q,!1,[w,te]),q.setSelection({line:be,ch:0},{line:Ee,ch:0})}var c=o.codemirror,d=c.getCursor("start"),v=c.getCursor("end"),y=c.getTokenAt({line:d.line,ch:d.ch||1}),x=c.getLineHandle(d.line),D=f(c,d.line,x,y),k,F,B;if(D==="single"){var L=x.text.slice(0,d.ch).replace("`",""),T=x.text.slice(d.ch).replace("`","");c.replaceRange(L+T,{line:d.line,ch:0},{line:d.line,ch:99999999999999}),d.ch--,d!==v&&v.ch--,c.setSelection(d,v),c.focus()}else if(D==="fenced")if(d.line!==v.line||d.ch!==v.ch){for(k=d.line;k>=0&&(x=c.getLineHandle(k),!s(x));k--);var N=c.getTokenAt({line:k,ch:1}),z=a(N).fencedChars,O,I,W,G;s(c.getLineHandle(d.line))?(O="",I=d.line):s(c.getLineHandle(d.line-1))?(O="",I=d.line-1):(O=z+` +`,I=d.line),s(c.getLineHandle(v.line))?(W="",G=v.line,v.ch===0&&(G+=1)):v.ch!==0&&s(c.getLineHandle(v.line+1))?(W="",G=v.line+1):(W=z+` +`,G=v.line+1),v.ch===0&&(G-=1),c.operation(function(){c.replaceRange(W,{line:G,ch:0},{line:G+(W?0:1),ch:0}),c.replaceRange(O,{line:I,ch:0},{line:I+(O?0:1),ch:0})}),c.setSelection({line:I+(O?1:0),ch:0},{line:G+(O?1:-1),ch:0}),c.focus()}else{var X=d.line;if(s(c.getLineHandle(d.line))&&(f(c,d.line+1)==="fenced"?(k=d.line,X=d.line+1):(F=d.line,X=d.line-1)),k===void 0)for(k=X;k>=0&&(x=c.getLineHandle(k),!s(x));k--);if(F===void 0)for(B=c.lineCount(),F=X;F=0;k--)if(x=c.getLineHandle(k),!x.text.match(/^\s*$/)&&f(c,k,x)!=="indented"){k+=1;break}for(B=c.lineCount(),F=d.line;F\s+/,"unordered-list":a,"ordered-list":a,"check-list":/^(\s*)(- \[[ xX]])(\s+)/},y=function(N,z){var O={quote:">","unordered-list":s,"ordered-list":"%%i.","check-list":"- [ ]"};return O[N].replace("%%i",z)},x=function(N,z){var O={quote:">","unordered-list":"\\"+s,"ordered-list":"\\d+.","check-list":"- \\[[ xX]]"},I=new RegExp(O[N]);return z&&I.test(z)},D=function(N,z,O){var I=a.exec(z),W=y(N,k);return I!==null?(x(N,I[2])&&(W=""),z=I[1]+W+I[3]+z.replace(f,"").replace(v[N],"$1")):O==!1&&(z=W+" "+z),z},k=1,F=["unordered-list","ordered-list","check-list"],B=Object.keys(h)[0];if(!F.includes(B)){var L=o.getLine(c.line);/^\s*- \[[ xX]]\s/.test(L)?B="check-list":/^\s*\d+\.\s/.test(L)?B="ordered-list":/^\s*[*\-+]\s/.test(L)&&(B="unordered-list")}for(var T=c.line;T<=d.line;T++)(function(N){var z=o.getLine(N);h[l]?z=z.replace(v[l],"$1"):F.includes(B)&&F.includes(l)?(z=z.replace(v[B],"$1"),z=D(l,z,!1),k+=1):(z=D(l,z,!1),k+=1),o.replaceRange(z,{line:N,ch:0},{line:N,ch:99999999999999})})(T);o.focus()}}function ec(o,l,s,a){if(!(!o.codemirror||o.isPreviewActive())){var f=o.codemirror,h=Sr(f),c=h[l];if(!c){Gr(f,c,s,a);return}var d=f.getCursor("start"),v=f.getCursor("end"),y=f.getLine(d.line),x=y.slice(0,d.ch),D=y.slice(d.ch);l=="link"?x=x.replace(/(.*)[^!]\[/,"$1"):l=="image"&&(x=x.replace(/(.*)!\[$/,"$1")),D=D.replace(/]\(.*?\)/,""),f.replaceRange(x+D,{line:d.line,ch:0},{line:d.line,ch:99999999999999}),d.ch-=s[0].length,d!==v&&(v.ch-=s[0].length),f.setSelection(d,v),f.focus()}}function xl(o,l,s,a){if(!(!o.codemirror||o.isPreviewActive())){a=typeof a>"u"?s:a;var f=o.codemirror,h=Sr(f),c,d=s,v=a,y=f.getCursor("start"),x=f.getCursor("end");h[l]?(c=f.getLine(y.line),d=c.slice(0,y.ch),v=c.slice(y.ch),l=="bold"?(d=d.replace(/(\*\*|__)(?![\s\S]*(\*\*|__))/,""),v=v.replace(/(\*\*|__)/,"")):l=="italic"?(d=d.replace(/(\*|_)(?![\s\S]*(\*|_))/,""),v=v.replace(/(\*|_)/,"")):l=="strikethrough"&&(d=d.replace(/(\*\*|~~)(?![\s\S]*(\*\*|~~))/,""),v=v.replace(/(\*\*|~~)/,"")),f.replaceRange(d+v,{line:y.line,ch:0},{line:y.line,ch:99999999999999}),l=="bold"||l=="strikethrough"?(y.ch-=2,y!==x&&(x.ch-=2)):l=="italic"&&(y.ch-=1,y!==x&&(x.ch-=1))):(c=f.getSelection(),l=="bold"?(c=c.split("**").join(""),c=c.split("__").join("")):l=="italic"?(c=c.split("*").join(""),c=c.split("_").join("")):l=="strikethrough"&&(c=c.split("~~").join("")),f.replaceSelection(d+c+v),y.ch+=s.length,x.ch=y.ch+c.length),f.setSelection(y,x),f.focus()}}function Op(o){if(!o.getWrapperElement().lastChild.classList.contains("editor-preview-active"))for(var l=o.getCursor("start"),s=o.getCursor("end"),a,f=l.line;f<=s.line;f++)a=o.getLine(f),a=a.replace(/^[ ]*([# ]+|\*|-|[> ]+|[0-9]+(.|\)))[ ]*/,""),o.replaceRange(a,{line:f,ch:0},{line:f,ch:99999999999999})}function fo(o,l){if(Math.abs(o)<1024)return""+o+l[0];var s=0;do o/=1024,++s;while(Math.abs(o)>=1024&&s=19968?a+=s[f].length:a+=1;return a}var Be={bold:"fa fa-bold",italic:"fa fa-italic",strikethrough:"fa fa-strikethrough",heading:"fa fa-header fa-heading","heading-smaller":"fa fa-header fa-heading header-smaller","heading-bigger":"fa fa-header fa-heading header-bigger","heading-1":"fa fa-header fa-heading header-1","heading-2":"fa fa-header fa-heading header-2","heading-3":"fa fa-header fa-heading header-3",code:"fa fa-code",quote:"fa fa-quote-left","ordered-list":"fa fa-list-ol","unordered-list":"fa fa-list-ul","check-list":"fa fa-check-square-o","clean-block":"fa fa-eraser",link:"fa fa-link",image:"fa fa-image","upload-image":"fa fa-image",table:"fa fa-table","horizontal-rule":"fa fa-minus",preview:"fa fa-eye","side-by-side":"fa fa-columns",fullscreen:"fa fa-arrows-alt",guide:"fa fa-question-circle",undo:"fa fa-undo",redo:"fa fa-repeat fa-redo"},Ur={bold:{name:"bold",action:co,className:Be.bold,title:"Bold",default:!0},italic:{name:"italic",action:ho,className:Be.italic,title:"Italic",default:!0},strikethrough:{name:"strikethrough",action:po,className:Be.strikethrough,title:"Strikethrough"},heading:{name:"heading",action:fn,className:Be.heading,title:"Heading",default:!0},"heading-smaller":{name:"heading-smaller",action:fn,className:Be["heading-smaller"],title:"Smaller Heading"},"heading-bigger":{name:"heading-bigger",action:vo,className:Be["heading-bigger"],title:"Bigger Heading"},"heading-1":{name:"heading-1",action:bo,className:Be["heading-1"],title:"Big Heading"},"heading-2":{name:"heading-2",action:yo,className:Be["heading-2"],title:"Medium Heading"},"heading-3":{name:"heading-3",action:xo,className:Be["heading-3"],title:"Small Heading"},"separator-1":{name:"separator-1"},code:{name:"code",action:go,className:Be.code,title:"Code"},quote:{name:"quote",action:mo,className:Be.quote,title:"Quote",default:!0},"unordered-list":{name:"unordered-list",action:wo,className:Be["unordered-list"],title:"Generic List",default:!0},"ordered-list":{name:"ordered-list",action:Co,className:Be["ordered-list"],title:"Numbered List",default:!0},"check-list":{name:"check-list",action:Do,className:Be["check-list"],title:"Check List",default:!0},"clean-block":{name:"clean-block",action:ko,className:Be["clean-block"],title:"Clean block"},"separator-2":{name:"separator-2"},link:{name:"link",action:So,className:Be.link,title:"Create Link",default:!0},image:{name:"image",action:Eo,className:Be.image,title:"Insert Image",default:!0},"upload-image":{name:"upload-image",action:yl,className:Be["upload-image"],title:"Import an image"},table:{name:"table",action:Ao,className:Be.table,title:"Insert Table"},"horizontal-rule":{name:"horizontal-rule",action:Fo,className:Be["horizontal-rule"],title:"Insert Horizontal Line"},"separator-3":{name:"separator-3"},preview:{name:"preview",action:Mo,className:Be.preview,noDisable:!0,title:"Toggle Preview",default:!0},"side-by-side":{name:"side-by-side",action:wi,className:Be["side-by-side"],noDisable:!0,noMobile:!0,title:"Toggle Side by Side",default:!0},fullscreen:{name:"fullscreen",action:jr,className:Be.fullscreen,noDisable:!0,noMobile:!0,title:"Toggle Fullscreen",default:!0},"separator-4":{name:"separator-4"},guide:{name:"guide",action:"https://www.markdownguide.org/basic-syntax/",className:Be.guide,noDisable:!0,title:"Markdown Guide",default:!0},"separator-5":{name:"separator-5"},undo:{name:"undo",action:To,className:Be.undo,noDisable:!0,title:"Undo"},redo:{name:"redo",action:Lo,className:Be.redo,noDisable:!0,title:"Redo"}},Ip={link:["[","](#url#)"],image:["![","](#url#)"],uploadedImage:["![](#url#)",""],table:["",` | Column 1 | Column 2 | Column 3 | | -------- | -------- | -------- | @@ -91,8 +91,8 @@ Please report this to https://github.com/markedjs/marked.`,o){var f="

    An error ----- -`]},Np={link:"URL for the link:",image:"URL of the image:"},Op={locale:"en-US",format:{hour:"2-digit",minute:"2-digit"}},Ip={bold:"**",code:"```",italic:"*"},Pp={sbInit:"Attach files by drag and dropping or pasting from clipboard.",sbOnDragEnter:"Drop image to upload it.",sbOnDrop:"Uploading image #images_names#...",sbProgress:"Uploading #file_name#: #progress#%",sbOnUploaded:"Uploaded #image_name#",sizeUnits:" B, KB, MB"},zp={noFileGiven:"You must select a file.",typeNotAllowed:"This image type is not allowed.",fileTooLarge:`Image #image_name# is too big (#image_size#). -Maximum file size is #image_max_size#.`,importError:"Something went wrong when uploading the image #image_name#."};function re(o){o=o||{},o.parent=this;var l=!0;if(o.autoDownloadFontAwesome===!1&&(l=!1),o.autoDownloadFontAwesome!==!0)for(var s=document.styleSheets,a=0;a-1&&(l=!1);if(l){var f=document.createElement("link");f.rel="stylesheet",f.href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css",document.getElementsByTagName("head")[0].appendChild(f)}if(o.element)this.element=o.element;else if(o.element===null){console.log("EasyMDE: Error. No element was found.");return}if(o.toolbar===void 0){o.toolbar=[];for(var p in Ur)Object.prototype.hasOwnProperty.call(Ur,p)&&(p.indexOf("separator-")!=-1&&o.toolbar.push("|"),(Ur[p].default===!0||o.showIcons&&o.showIcons.constructor===Array&&o.showIcons.indexOf(p)!=-1)&&o.toolbar.push(p))}if(Object.prototype.hasOwnProperty.call(o,"previewClass")||(o.previewClass="editor-preview"),Object.prototype.hasOwnProperty.call(o,"status")||(o.status=["autosave","lines","words","cursor"],o.uploadImage&&o.status.unshift("upload-image")),o.previewRender||(o.previewRender=function(d){return this.parent.markdown(d)}),o.parsingConfig=sr({highlightFormatting:!0},o.parsingConfig||{}),o.insertTexts=sr({},Bp,o.insertTexts||{}),o.promptTexts=sr({},Np,o.promptTexts||{}),o.blockStyles=sr({},Ip,o.blockStyles||{}),o.autosave!=null&&(o.autosave.timeFormat=sr({},Op,o.autosave.timeFormat||{})),o.iconClassMap=sr({},_e,o.iconClassMap||{}),o.shortcuts=sr({},Sp,o.shortcuts||{}),o.maxHeight=o.maxHeight||void 0,o.direction=o.direction||"ltr",typeof o.maxHeight<"u"?o.minHeight=o.maxHeight:o.minHeight=o.minHeight||"300px",o.errorCallback=o.errorCallback||function(d){alert(d)},o.uploadImage=o.uploadImage||!1,o.imageMaxSize=o.imageMaxSize||2097152,o.imageAccept=o.imageAccept||"image/png, image/jpeg, image/gif, image/avif",o.imageTexts=sr({},Pp,o.imageTexts||{}),o.errorMessages=sr({},zp,o.errorMessages||{}),o.imagePathAbsolute=o.imagePathAbsolute||!1,o.imageCSRFName=o.imageCSRFName||"csrfmiddlewaretoken",o.imageCSRFHeader=o.imageCSRFHeader||!1,o.imageInputName=o.imageInputName||"image",o.autosave!=null&&o.autosave.unique_id!=null&&o.autosave.unique_id!=""&&(o.autosave.uniqueId=o.autosave.unique_id),o.overlayMode&&o.overlayMode.combine===void 0&&(o.overlayMode.combine=!0),this.options=o,this.render(),o.initialValue&&(!this.options.autosave||this.options.autosave.foundSavedValue!==!0)&&this.value(o.initialValue),o.uploadImage){var c=this;this.codemirror.on("dragenter",function(d,m){c.updateStatusBar("upload-image",c.options.imageTexts.sbOnDragEnter),m.stopPropagation(),m.preventDefault()}),this.codemirror.on("dragend",function(d,m){c.updateStatusBar("upload-image",c.options.imageTexts.sbInit),m.stopPropagation(),m.preventDefault()}),this.codemirror.on("dragleave",function(d,m){c.updateStatusBar("upload-image",c.options.imageTexts.sbInit),m.stopPropagation(),m.preventDefault()}),this.codemirror.on("dragover",function(d,m){c.updateStatusBar("upload-image",c.options.imageTexts.sbOnDragEnter),m.stopPropagation(),m.preventDefault()}),this.codemirror.on("drop",function(d,m){m.stopPropagation(),m.preventDefault(),o.imageUploadFunction?c.uploadImagesUsingCustomFunction(o.imageUploadFunction,m.dataTransfer.files):c.uploadImages(m.dataTransfer.files)}),this.codemirror.on("paste",function(d,m){o.imageUploadFunction?c.uploadImagesUsingCustomFunction(o.imageUploadFunction,m.clipboardData.files):c.uploadImages(m.clipboardData.files)})}}re.prototype.uploadImages=function(o,l,s){if(o.length!==0){for(var a=[],f=0;f=2){var I=N[1];if(l.imagesPreviewHandler){var P=l.imagesPreviewHandler(N[1]);typeof P=="string"&&(I=P)}if(window.EMDEimagesCache[I])F(O,window.EMDEimagesCache[I]);else{window.EMDEimagesCache[I]={};var q=document.createElement("img");q.onload=function(){window.EMDEimagesCache[I]={naturalWidth:q.naturalWidth,naturalHeight:q.naturalHeight,url:I},F(O,window.EMDEimagesCache[I])},q.src=I}}}})}this.codemirror.on("update",function(){_()}),this.gui.sideBySide=this.createSideBySide(),this._rendered=this.element,(l.autofocus===!0||o.autofocus)&&this.codemirror.focus();var L=this.codemirror;setTimeout(function(){L.refresh()}.bind(L),0)};re.prototype.cleanup=function(){document.removeEventListener("keydown",this.documentOnKeyDown)};function tc(){if(typeof localStorage=="object")try{localStorage.setItem("smde_localStorage",1),localStorage.removeItem("smde_localStorage")}catch{return!1}else return!1;return!0}re.prototype.autosave=function(){if(tc()){var o=this;if(this.options.autosave.uniqueId==null||this.options.autosave.uniqueId==""){console.log("EasyMDE: You must set a uniqueId to use the autosave feature");return}this.options.autosave.binded!==!0&&(o.element.form!=null&&o.element.form!=null&&o.element.form.addEventListener("submit",function(){clearTimeout(o.autosaveTimeoutId),o.autosaveTimeoutId=void 0,localStorage.removeItem("smde_"+o.options.autosave.uniqueId)}),this.options.autosave.binded=!0),this.options.autosave.loaded!==!0&&(typeof localStorage.getItem("smde_"+this.options.autosave.uniqueId)=="string"&&localStorage.getItem("smde_"+this.options.autosave.uniqueId)!=""&&(this.codemirror.setValue(localStorage.getItem("smde_"+this.options.autosave.uniqueId)),this.options.autosave.foundSavedValue=!0),this.options.autosave.loaded=!0);var l=o.value();l!==""?localStorage.setItem("smde_"+this.options.autosave.uniqueId,l):localStorage.removeItem("smde_"+this.options.autosave.uniqueId);var s=document.getElementById("autosaved");if(s!=null&&s!=null&&s!=""){var a=new Date,f=new Intl.DateTimeFormat([this.options.autosave.timeFormat.locale,"en-US"],this.options.autosave.timeFormat.format).format(a),p=this.options.autosave.text==null?"Autosaved: ":this.options.autosave.text;s.innerHTML=p+f}}else console.log("EasyMDE: localStorage not available, cannot autosave")};re.prototype.clearAutosavedValue=function(){if(tc()){if(this.options.autosave==null||this.options.autosave.uniqueId==null||this.options.autosave.uniqueId==""){console.log("EasyMDE: You must set a uniqueId to clear the autosave value");return}localStorage.removeItem("smde_"+this.options.autosave.uniqueId)}else console.log("EasyMDE: localStorage not available, cannot autosave")};re.prototype.openBrowseFileWindow=function(o,l){var s=this,a=this.gui.toolbar.getElementsByClassName("imageInput")[0];a.click();function f(p){s.options.imageUploadFunction?s.uploadImagesUsingCustomFunction(s.options.imageUploadFunction,p.target.files):s.uploadImages(p.target.files,o,l),a.removeEventListener("change",f)}a.addEventListener("change",f)};re.prototype.uploadImage=function(o,l,s){var a=this;l=l||function(y){$f(a,y)};function f(m){a.updateStatusBar("upload-image",m),setTimeout(function(){a.updateStatusBar("upload-image",a.options.imageTexts.sbInit)},1e4),s&&typeof s=="function"&&s(m),a.options.errorCallback(m)}function p(m){var y=a.options.imageTexts.sizeUnits.split(",");return m.replace("#image_name#",o.name).replace("#image_size#",fo(o.size,y)).replace("#image_max_size#",fo(a.options.imageMaxSize,y))}if(o.size>this.options.imageMaxSize){f(p(this.options.errorMessages.fileTooLarge));return}var c=new FormData;c.append("image",o),a.options.imageCSRFToken&&!a.options.imageCSRFHeader&&c.append(a.options.imageCSRFName,a.options.imageCSRFToken);var d=new XMLHttpRequest;d.upload.onprogress=function(m){if(m.lengthComputable){var y=""+Math.round(m.loaded*100/m.total);a.updateStatusBar("upload-image",a.options.imageTexts.sbProgress.replace("#file_name#",o.name).replace("#progress#",y))}},d.open("POST",this.options.imageUploadEndpoint),a.options.imageCSRFToken&&a.options.imageCSRFHeader&&d.setRequestHeader(a.options.imageCSRFName,a.options.imageCSRFToken),d.onload=function(){try{var m=JSON.parse(this.responseText)}catch{console.error("EasyMDE: The server did not return a valid json."),f(p(a.options.errorMessages.importError));return}this.status===200&&m&&!m.error&&m.data&&m.data.filePath?l((a.options.imagePathAbsolute?"":window.location.origin+"/")+m.data.filePath):m.error&&m.error in a.options.errorMessages?f(p(a.options.errorMessages[m.error])):m.error?f(p(m.error)):(console.error("EasyMDE: Received an unexpected response after uploading the image."+this.status+" ("+this.statusText+")"),f(p(a.options.errorMessages.importError)))},d.onerror=function(m){console.error("EasyMDE: An unexpected error occurred when trying to upload the image."+m.target.status+" ("+m.target.statusText+")"),f(a.options.errorMessages.importError)},d.send(c)};re.prototype.uploadImageUsingCustomFunction=function(o,l){var s=this;function a(c){$f(s,c)}function f(c){var d=p(c);s.updateStatusBar("upload-image",d),setTimeout(function(){s.updateStatusBar("upload-image",s.options.imageTexts.sbInit)},1e4),s.options.errorCallback(d)}function p(c){var d=s.options.imageTexts.sizeUnits.split(",");return c.replace("#image_name#",l.name).replace("#image_size#",fo(l.size,d)).replace("#image_max_size#",fo(s.options.imageMaxSize,d))}o.apply(this,[l,a,f])};re.prototype.setPreviewMaxHeight=function(){var o=this.codemirror,l=o.getWrapperElement(),s=l.nextSibling,a=parseInt(window.getComputedStyle(l).paddingTop),f=parseInt(window.getComputedStyle(l).borderTopWidth),p=parseInt(this.options.maxHeight),c=p+a*2+f*2,d=c.toString()+"px";s.style.height=d};re.prototype.createSideBySide=function(){var o=this.codemirror,l=o.getWrapperElement(),s=l.nextSibling;if(!s||!s.classList.contains("editor-preview-side")){if(s=document.createElement("div"),s.className="editor-preview-side",this.options.previewClass)if(Array.isArray(this.options.previewClass))for(var a=0;a"&&(l=l.substring(1)),o)try{if(o.matches)return o.matches(l);if(o.msMatchesSelector)return o.msMatchesSelector(l);if(o.webkitMatchesSelector)return o.webkitMatchesSelector(l)}catch{return!1}return!1}}function gc(o){return o.host&&o!==document&&o.host.nodeType&&o.host!==o?o.host:o.parentNode}function Gt(o,l,s,a){if(o){s=s||document;do{if(l!=null&&(l[0]===">"?o.parentNode===s&&Wo(o,l):Wo(o,l))||a&&o===s)return o;if(o===s)break}while(o=gc(o))}return null}var ac=/\s+/g;function Bt(o,l,s){if(o&&l)if(o.classList)o.classList[s?"add":"remove"](l);else{var a=(" "+o.className+" ").replace(ac," ").replace(" "+l+" "," ");o.className=(a+(s?" "+l:"")).replace(ac," ")}}function de(o,l,s){var a=o&&o.style;if(a){if(s===void 0)return document.defaultView&&document.defaultView.getComputedStyle?s=document.defaultView.getComputedStyle(o,""):o.currentStyle&&(s=o.currentStyle),l===void 0?s:s[l];!(l in a)&&l.indexOf("webkit")===-1&&(l="-webkit-"+l),a[l]=s+(typeof s=="string"?"":"px")}}function An(o,l){var s="";if(typeof o=="string")s=o;else do{var a=de(o,"transform");a&&a!=="none"&&(s=a+" "+s)}while(!l&&(o=o.parentNode));var f=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return f&&new f(s)}function vc(o,l,s){if(o){var a=o.getElementsByTagName(l),f=0,p=a.length;if(s)for(;f=p:c=f<=p,!c)return a;if(a===Vt())break;a=Tr(a,!1)}return!1}function Fn(o,l,s,a){for(var f=0,p=0,c=o.children;p2&&arguments[2]!==void 0?arguments[2]:{},f=a.evt,p=Rp(a,$p);xi.pluginEvent.bind(he)(l,s,er({dragEl:$,parentEl:Ue,ghostEl:be,rootEl:ze,nextEl:Yr,lastDownEl:Po,cloneEl:We,cloneHidden:Fr,dragStarted:ci,putSortable:ut,activeSortable:he.active,originalEvent:f,oldIndex:En,oldDraggableIndex:vi,newIndex:Nt,newDraggableIndex:Ar,hideGhostForTarget:kc,unhideGhostForTarget:Sc,cloneNowHidden:function(){Fr=!0},cloneNowShown:function(){Fr=!1},dispatchSortableEvent:function(d){Ct({sortable:s,name:d,originalEvent:f})}},p))};function Ct(o){Jp(er({putSortable:ut,cloneEl:We,targetEl:$,rootEl:ze,oldIndex:En,oldDraggableIndex:vi,newIndex:Nt,newDraggableIndex:Ar},o))}var $,Ue,be,ze,Yr,Po,We,Fr,En,Nt,vi,Ar,Bo,ut,Sn=!1,qo=!1,Uo=[],Xr,jt,wl,Cl,uc,fc,ci,kn,mi,bi=!1,No=!1,zo,pt,kl=[],Ll=!1,jo=[],Xo=typeof document<"u",Oo=Nl,cc=yi||cr?"cssFloat":"float",Vp=Xo&&!hc&&!Nl&&"draggable"in document.createElement("div"),Dc=function(){if(Xo){if(cr)return!1;var o=document.createElement("x");return o.style.cssText="pointer-events:auto",o.style.pointerEvents==="auto"}}(),wc=function(l,s){var a=de(l),f=parseInt(a.width)-parseInt(a.paddingLeft)-parseInt(a.paddingRight)-parseInt(a.borderLeftWidth)-parseInt(a.borderRightWidth),p=Fn(l,0,s),c=Fn(l,1,s),d=p&&de(p),m=c&&de(c),y=d&&parseInt(d.marginLeft)+parseInt(d.marginRight)+$e(p).width,x=m&&parseInt(m.marginLeft)+parseInt(m.marginRight)+$e(c).width;if(a.display==="flex")return a.flexDirection==="column"||a.flexDirection==="column-reverse"?"vertical":"horizontal";if(a.display==="grid")return a.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(p&&d.float&&d.float!=="none"){var C=d.float==="left"?"left":"right";return c&&(m.clear==="both"||m.clear===C)?"vertical":"horizontal"}return p&&(d.display==="block"||d.display==="flex"||d.display==="table"||d.display==="grid"||y>=f&&a[cc]==="none"||c&&a[cc]==="none"&&y+x>f)?"vertical":"horizontal"},eg=function(l,s,a){var f=a?l.left:l.top,p=a?l.right:l.bottom,c=a?l.width:l.height,d=a?s.left:s.top,m=a?s.right:s.bottom,y=a?s.width:s.height;return f===d||p===m||f+c/2===d+y/2},tg=function(l,s){var a;return Uo.some(function(f){var p=f[Ft].options.emptyInsertThreshold;if(!(!p||Ol(f))){var c=$e(f),d=l>=c.left-p&&l<=c.right+p,m=s>=c.top-p&&s<=c.bottom+p;if(d&&m)return a=f}}),a},Cc=function(l){function s(p,c){return function(d,m,y,x){var C=d.options.group.name&&m.options.group.name&&d.options.group.name===m.options.group.name;if(p==null&&(c||C))return!0;if(p==null||p===!1)return!1;if(c&&p==="clone")return p;if(typeof p=="function")return s(p(d,m,y,x),c)(d,m,y,x);var S=(c?d:m).options.group.name;return p===!0||typeof p=="string"&&p===S||p.join&&p.indexOf(S)>-1}}var a={},f=l.group;(!f||Tl(f)!="object")&&(f={name:f}),a.name=f.name,a.checkPull=s(f.pull,!0),a.checkPut=s(f.put),a.revertClone=f.revertClone,l.group=a},kc=function(){!Dc&&be&&de(be,"display","none")},Sc=function(){!Dc&&be&&de(be,"display","")};Xo&&!hc&&document.addEventListener("click",function(o){if(qo)return o.preventDefault(),o.stopPropagation&&o.stopPropagation(),o.stopImmediatePropagation&&o.stopImmediatePropagation(),qo=!1,!1},!0);var Kr=function(l){if($){l=l.touches?l.touches[0]:l;var s=tg(l.clientX,l.clientY);if(s){var a={};for(var f in l)l.hasOwnProperty(f)&&(a[f]=l[f]);a.target=a.rootEl=s,a.preventDefault=void 0,a.stopPropagation=void 0,s[Ft]._onDragOver(a)}}},rg=function(l){$&&$.parentNode[Ft]._isOutsideThisEl(l.target)};function he(o,l){if(!(o&&o.nodeType&&o.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(o));this.el=o,this.options=l=fr({},l),o[Ft]=this;var s={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(o.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return wc(o,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(c,d){c.setData("Text",d.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:he.supportPointer!==!1&&"PointerEvent"in window&&(!pi||Nl),emptyInsertThreshold:5};xi.initializePlugins(this,o,s);for(var a in s)!(a in l)&&(l[a]=s[a]);Cc(l);for(var f in this)f.charAt(0)==="_"&&typeof this[f]=="function"&&(this[f]=this[f].bind(this));this.nativeDraggable=l.forceFallback?!1:Vp,this.nativeDraggable&&(this.options.touchStartThreshold=1),l.supportPointer?Se(o,"pointerdown",this._onTapStart):(Se(o,"mousedown",this._onTapStart),Se(o,"touchstart",this._onTapStart)),this.nativeDraggable&&(Se(o,"dragover",this),Se(o,"dragenter",this)),Uo.push(this.el),l.store&&l.store.get&&this.sort(l.store.get(this)||[]),fr(this,Yp())}he.prototype={constructor:he,_isOutsideThisEl:function(l){!this.el.contains(l)&&l!==this.el&&(kn=null)},_getDirection:function(l,s){return typeof this.options.direction=="function"?this.options.direction.call(this,l,s,$):this.options.direction},_onTapStart:function(l){if(l.cancelable){var s=this,a=this.el,f=this.options,p=f.preventOnFilter,c=l.type,d=l.touches&&l.touches[0]||l.pointerType&&l.pointerType==="touch"&&l,m=(d||l).target,y=l.target.shadowRoot&&(l.path&&l.path[0]||l.composedPath&&l.composedPath()[0])||m,x=f.filter;if(fg(a),!$&&!(/mousedown|pointerdown/.test(c)&&l.button!==0||f.disabled)&&!y.isContentEditable&&!(!this.nativeDraggable&&pi&&m&&m.tagName.toUpperCase()==="SELECT")&&(m=Gt(m,f.draggable,a,!1),!(m&&m.animated)&&Po!==m)){if(En=Pt(m),vi=Pt(m,f.draggable),typeof x=="function"){if(x.call(this,l,m,this)){Ct({sortable:s,rootEl:y,name:"filter",targetEl:m,toEl:a,fromEl:a}),At("filter",s,{evt:l}),p&&l.preventDefault();return}}else if(x&&(x=x.split(",").some(function(C){if(C=Gt(y,C.trim(),a,!1),C)return Ct({sortable:s,rootEl:C,name:"filter",targetEl:m,fromEl:a,toEl:a}),At("filter",s,{evt:l}),!0}),x)){p&&l.preventDefault();return}f.handle&&!Gt(y,f.handle,a,!1)||this._prepareDragStart(l,d,m)}}},_prepareDragStart:function(l,s,a){var f=this,p=f.el,c=f.options,d=p.ownerDocument,m;if(a&&!$&&a.parentNode===p){var y=$e(a);if(ze=p,$=a,Ue=$.parentNode,Yr=$.nextSibling,Po=a,Bo=c.group,he.dragged=$,Xr={target:$,clientX:(s||l).clientX,clientY:(s||l).clientY},uc=Xr.clientX-y.left,fc=Xr.clientY-y.top,this._lastX=(s||l).clientX,this._lastY=(s||l).clientY,$.style["will-change"]="all",m=function(){if(At("delayEnded",f,{evt:l}),he.eventCanceled){f._onDrop();return}f._disableDelayedDragEvents(),!oc&&f.nativeDraggable&&($.draggable=!0),f._triggerDragStart(l,s),Ct({sortable:f,name:"choose",originalEvent:l}),Bt($,c.chosenClass,!0)},c.ignore.split(",").forEach(function(x){vc($,x.trim(),Sl)}),Se(d,"dragover",Kr),Se(d,"mousemove",Kr),Se(d,"touchmove",Kr),c.supportPointer?(Se(d,"pointerup",f._onDrop),!this.nativeDraggable&&Se(d,"pointercancel",f._onDrop)):(Se(d,"mouseup",f._onDrop),Se(d,"touchend",f._onDrop),Se(d,"touchcancel",f._onDrop)),oc&&this.nativeDraggable&&(this.options.touchStartThreshold=4,$.draggable=!0),At("delayStart",this,{evt:l}),c.delay&&(!c.delayOnTouchOnly||s)&&(!this.nativeDraggable||!(yi||cr))){if(he.eventCanceled){this._onDrop();return}c.supportPointer?(Se(d,"pointerup",f._disableDelayedDrag),Se(d,"pointercancel",f._disableDelayedDrag)):(Se(d,"mouseup",f._disableDelayedDrag),Se(d,"touchend",f._disableDelayedDrag),Se(d,"touchcancel",f._disableDelayedDrag)),Se(d,"mousemove",f._delayedDragTouchMoveHandler),Se(d,"touchmove",f._delayedDragTouchMoveHandler),c.supportPointer&&Se(d,"pointermove",f._delayedDragTouchMoveHandler),f._dragStartTimer=setTimeout(m,c.delay)}else m()}},_delayedDragTouchMoveHandler:function(l){var s=l.touches?l.touches[0]:l;Math.max(Math.abs(s.clientX-this._lastX),Math.abs(s.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){$&&Sl($),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var l=this.el.ownerDocument;ke(l,"mouseup",this._disableDelayedDrag),ke(l,"touchend",this._disableDelayedDrag),ke(l,"touchcancel",this._disableDelayedDrag),ke(l,"pointerup",this._disableDelayedDrag),ke(l,"pointercancel",this._disableDelayedDrag),ke(l,"mousemove",this._delayedDragTouchMoveHandler),ke(l,"touchmove",this._delayedDragTouchMoveHandler),ke(l,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(l,s){s=s||l.pointerType=="touch"&&l,!this.nativeDraggable||s?this.options.supportPointer?Se(document,"pointermove",this._onTouchMove):s?Se(document,"touchmove",this._onTouchMove):Se(document,"mousemove",this._onTouchMove):(Se($,"dragend",this),Se(ze,"dragstart",this._onDragStart));try{document.selection?Ho(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(l,s){if(Sn=!1,ze&&$){At("dragStarted",this,{evt:s}),this.nativeDraggable&&Se(document,"dragover",rg);var a=this.options;!l&&Bt($,a.dragClass,!1),Bt($,a.ghostClass,!0),he.active=this,l&&this._appendGhost(),Ct({sortable:this,name:"start",originalEvent:s})}else this._nulling()},_emulateDragOver:function(){if(jt){this._lastX=jt.clientX,this._lastY=jt.clientY,kc();for(var l=document.elementFromPoint(jt.clientX,jt.clientY),s=l;l&&l.shadowRoot&&(l=l.shadowRoot.elementFromPoint(jt.clientX,jt.clientY),l!==s);)s=l;if($.parentNode[Ft]._isOutsideThisEl(l),s)do{if(s[Ft]){var a=void 0;if(a=s[Ft]._onDragOver({clientX:jt.clientX,clientY:jt.clientY,target:l,rootEl:s}),a&&!this.options.dragoverBubble)break}l=s}while(s=gc(s));Sc()}},_onTouchMove:function(l){if(Xr){var s=this.options,a=s.fallbackTolerance,f=s.fallbackOffset,p=l.touches?l.touches[0]:l,c=be&&An(be,!0),d=be&&c&&c.a,m=be&&c&&c.d,y=Oo&&pt&&sc(pt),x=(p.clientX-Xr.clientX+f.x)/(d||1)+(y?y[0]-kl[0]:0)/(d||1),C=(p.clientY-Xr.clientY+f.y)/(m||1)+(y?y[1]-kl[1]:0)/(m||1);if(!he.active&&!Sn){if(a&&Math.max(Math.abs(p.clientX-this._lastX),Math.abs(p.clientY-this._lastY))=0&&(Ct({rootEl:Ue,name:"add",toEl:Ue,fromEl:ze,originalEvent:l}),Ct({sortable:this,name:"remove",toEl:Ue,originalEvent:l}),Ct({rootEl:Ue,name:"sort",toEl:Ue,fromEl:ze,originalEvent:l}),Ct({sortable:this,name:"sort",toEl:Ue,originalEvent:l})),ut&&ut.save()):Nt!==En&&Nt>=0&&(Ct({sortable:this,name:"update",toEl:Ue,originalEvent:l}),Ct({sortable:this,name:"sort",toEl:Ue,originalEvent:l})),he.active&&((Nt==null||Nt===-1)&&(Nt=En,Ar=vi),Ct({sortable:this,name:"end",toEl:Ue,originalEvent:l}),this.save()))),this._nulling()},_nulling:function(){At("nulling",this),ze=$=Ue=be=Yr=We=Po=Fr=Xr=jt=ci=Nt=Ar=En=vi=kn=mi=ut=Bo=he.dragged=he.ghost=he.clone=he.active=null;var l=this.el;jo.forEach(function(s){l.contains(s)&&(s.checked=!0)}),jo.length=wl=Cl=0},handleEvent:function(l){switch(l.type){case"drop":case"dragend":this._onDrop(l);break;case"dragenter":case"dragover":$&&(this._onDragOver(l),ng(l));break;case"selectstart":l.preventDefault();break}},toArray:function(){for(var l=[],s,a=this.el.children,f=0,p=a.length,c=this.options;ff.right+p||o.clientY>a.bottom&&o.clientX>a.left:o.clientY>f.bottom+p||o.clientX>a.right&&o.clientY>a.top}function lg(o,l,s,a,f,p,c,d){var m=a?o.clientY:o.clientX,y=a?s.height:s.width,x=a?s.top:s.left,C=a?s.bottom:s.right,S=!1;if(!c){if(d&&zox+y*p/2:mC-zo)return-mi}else if(m>x+y*(1-f)/2&&mC-y*p/2)?m>x+y/2?1:-1:0}function sg(o){return Pt($)0||C>0&&S0?"Converting "+l+" photo"+(l>1?"s":"")+"\u2026":"Uploading "+C+" photo"+(C>1?"s":"")+"\u2026",s.details.open=!0):C>0?(s.summary.textContent="\u2713 "+C+" photo"+(C>1?"s":"")+" ready \u2014 tap to review",s.details.open=!1):(s.summary.textContent="Photos (1\u20136)",s.details.open=!0)}}function c(){p(),setTimeout(p,150),setTimeout(p,500)}function d(){var x=o.querySelector('button[type="submit"], input[type="submit"]');if(x&&(x.disabled=l>0),l>0)f("Converting "+l+" photo"+(l>1?"s":"")+"\u2026");else{var C=Fc();C&&/Converting/.test(C.textContent)&&f("")}p()}o.addEventListener("submit",function(x){l>0&&(x.preventDefault(),f("Hang on \u2014 a photo is still converting.","err"))},!0);function m(x){return function(C){var S=C&&C.file;return S?Nc(S).then(function(F){return F?(l++,d(),import("./heic-to-CN7JBE7H.js").then(function(_){var L=_.heicTo||_.default&&_.default.heicTo;return L({blob:S,type:"image/jpeg",quality:.85})}).then(function(_){var L=new File([_],pg(S.name),{type:"image/jpeg"});x.addFile(L)}).catch(function(){f("A photo couldn\u2019t be converted and was skipped \u2014 the others are fine.","err")}).then(function(){l--,d()}),!1):!0}):!0}}var y=0;(function x(){var C=window.GravFilePond&&window.GravFilePond.getInstances?window.GravFilePond.getInstances():[];if(!C.length){y++<120&&setTimeout(x,50);return}C.forEach(function(S){S&&!S._heicHooked&&(S._heicHooked=!0,S.setOptions({beforeAddFile:m(S),allowReorder:!0,itemInsertLocation:"after"}),a=S,["addfile","processfile","processfiles","removefile","error"].forEach(function(F){try{S.on(F,c)}catch{}}),p())})})()}function Ot(o){return document.querySelector('[name="data['+o+']"]')}function mg(){var o=Array.prototype.slice.call(document.querySelectorAll(".advanced-field"));if(o.length){var l=[];if(o.forEach(function(p){var c=p.closest(".form-field");c&&l.indexOf(c)===-1&&l.push(c)}),!!l.length){var s=document.createElement("details");s.className="more-options";var a=document.createElement("summary");a.className="more-options__summary",a.textContent="More options",s.appendChild(a),l[0].parentNode.insertBefore(s,l[0]),l.forEach(function(p){s.appendChild(p)});var f=l.some(function(p){var c=p.querySelector('input[type="text"]');if(c&&c.value.trim())return!0;var d=p.querySelector('input[type="radio"]:checked');if(!d||!d.value)return!1;var m=p.querySelector('input[type="radio"][checked]');return m?d.value!==m.value:d.value!=="0"});f&&(s.open=!0)}}}var bg={0:"Sunny",1:"Partly cloudy",2:"Partly cloudy",3:"Cloudy",45:"Foggy",48:"Foggy",51:"Drizzle",53:"Drizzle",55:"Drizzle",56:"Drizzle",57:"Drizzle",61:"Rain",63:"Rain",65:"Rain",66:"Rain",67:"Rain",80:"Rain",81:"Rain",82:"Rain",71:"Snow",73:"Snow",75:"Snow",77:"Snow",85:"Snow",86:"Snow",95:"Thunderstorm",96:"Thunderstorm",99:"Thunderstorm"};function dr(o,l,s){o&&(o.className="form-status"+(s?" form-status--"+s:""),o.textContent=l||"")}function yg(){var o=document.getElementById("get-location"),l=document.getElementById("get-weather");if(!o&&!l)return;var s=document.getElementById("location-status"),a=document.getElementById("weather-status");function f(){var d=Ot("lat"),m=Ot("lng"),y=d?d.value.trim():"",x=m?m.value.trim():"";return y&&x?{lat:y,lng:x}:null}function p(){if(l){var d=!!f();l.disabled=!d,l.title=d?"":"Get location first"}}p();function c(d,m){var y=Ot("location_city"),x=Ot("location_country");if(!((!y||y.value.trim())&&(!x||x.value.trim()))){var C="https://api.bigdatacloud.net/data/reverse-geocode-client?latitude="+encodeURIComponent(d)+"&longitude="+encodeURIComponent(m)+"&localityLanguage=en";fetch(C).then(function(S){return S.json()}).then(function(S){var F=(S.city||S.locality||"").trim(),_=(S.countryName||"").trim();y&&!y.value.trim()&&F&&(y.value=F),x&&!x.value.trim()&&_&&(x.value=_);var L=[F,_].filter(Boolean).join(", ");L&&dr(s,"\u2713 Location captured \xB7 "+L,"ok")}).catch(function(){})}}o&&o.addEventListener("click",function(){if(!navigator.geolocation){dr(s,"Geolocation is not supported on this device.","err");return}o.classList.add("is-loading"),o.disabled=!0,dr(s,"Getting location\u2026"),navigator.geolocation.getCurrentPosition(function(d){var m=d.coords.latitude.toFixed(6),y=d.coords.longitude.toFixed(6),x=Ot("lat"),C=Ot("lng");x&&(x.value=m),C&&(C.value=y),o.classList.remove("is-loading"),o.disabled=!1,dr(s,"\u2713 Location captured \xB7 "+m+", "+y,"ok"),p(),c(m,y)},function(d){o.classList.remove("is-loading"),o.disabled=!1,dr(s,"\u2717 "+(d&&d.message?d.message:"Could not get location")+" \u2014 enter coordinates manually if needed.","err")},{enableHighAccuracy:!0,timeout:15e3})}),l&&l.addEventListener("click",function(){var d=f();if(!d){dr(a,"Get location first, then fetch weather.","err");return}l.classList.add("is-loading"),l.disabled=!0,dr(a,"Fetching weather\u2026");var m="https://api.open-meteo.com/v1/forecast?latitude="+d.lat+"&longitude="+d.lng+"¤t=temperature_2m,weather_code&temperature_unit=celsius";fetch(m).then(function(y){return y.json()}).then(function(y){var x=Math.round(y.current.temperature_2m),C=bg[y.current.weather_code]||"Cloudy",S=Ot("weather_temp_c"),F=Ot("weather_desc");S&&(S.value=x),F&&(F.value=C),l.classList.remove("is-loading"),p(),dr(a,"\u2713 Weather set \xB7 "+C+" \xB7 "+x+"\xB0C (edit above if needed)","ok")}).catch(function(){l.classList.remove("is-loading"),p(),dr(a,"\u2717 Could not fetch weather \u2014 set it manually above.","err")})})}function xg(){var o=new Date;return o.setSeconds(0,0),o.setMinutes(o.getMinutes()-o.getTimezoneOffset()),o.toISOString().slice(0,16)}function Dg(){var o={title:"Title",date:"Date & time",content:"Content"},l=document.querySelector('form[name="new-entry"]');if(!l)return;var s=Ot("date");s&&!String(s.value).trim()&&(s.value=xg());function a(){l.querySelectorAll(".field-error").forEach(function(c){c.remove()}),l.querySelectorAll(".field-invalid").forEach(function(c){c.classList.remove("field-invalid")})}function f(c,d){c.classList.add("field-invalid");var m=document.createElement("span");m.className="field-error",m.textContent=d,c.parentNode.insertBefore(m,c.nextSibling)}function p(c){var d=l.querySelector(".photos-collapse"),m,y;if(d?(d.open=!0,y=d.querySelector(".photos-collapse__summary"),m=d):(m=document.querySelector(".filepond-root, .form-input-file"),y=m),!y)return m||null;var x=document.createElement("span");return x.className="field-error",x.textContent=c,y.insertAdjacentElement("afterend",x),m||y}l.addEventListener("submit",function(c){a();var d=null;!Ko&&document.querySelectorAll(".filepond--item").length<1&&(d=p("Add at least one photo.")),Object.keys(o).forEach(function(m){var y=Ot(m);y&&!String(y.value).trim()&&(f(y,o[m]+" is required."),d||(d=y))}),d&&(c.preventDefault(),typeof d.focus=="function"&&d.focus(),d.scrollIntoView({behavior:"smooth",block:"center"}))})}var Hl="intotheeast:new-entry-draft";function wg(o){return Array.prototype.slice.call(o.querySelectorAll('[name^="data["]')).filter(function(l){if(l.type==="file")return!1;var s=l.name;return s.indexOf("data[_json")!==0&&s.indexOf("data[photos")!==0})}function Cg(){var o=document.querySelector(".filepond-root, .form-input-file");if(!(!o||!o.parentNode)&&!o.parentNode.querySelector(".photo-reauth-hint")){var l=document.createElement("p");l.className="photo-reauth-hint is-shown",l.textContent="Your text was restored \u2014 photos need re-selecting (they can\u2019t be saved in a draft).",o.parentNode.insertBefore(l,o.nextSibling)}}function kg(){var o=document.querySelector('form[name="new-entry"]');if(!o||Ko)return;if(document.querySelector(".notices.success")){try{localStorage.removeItem(Hl)}catch{}return}function l(){var p={};wg(o).forEach(function(c){c.type==="radio"?c.checked&&(p[c.name]=c.value):p[c.name]=c.value});try{localStorage.setItem(Hl,JSON.stringify(p))}catch{}}var s=null;try{s=localStorage.getItem(Hl)}catch{s=null}if(s){var a=null;try{a=JSON.parse(s)}catch{a=null}if(a){var f=!1;Object.keys(a).forEach(function(p){var c=a[p];if(c!=null&&String(c).trim()&&(f=!0),p!=="data[content]"){var d=o.querySelectorAll('input[type="radio"][name="'+p+'"]');if(d.length){d.forEach(function(y){y.checked=y.value===c});return}var m=o.querySelector('[name="'+p+'"]');m&&m.type!=="file"&&(m.value=c)}}),window.postFormEditor&&a["data[content]"]!=null&&window.postFormEditor.value(a["data[content]"]),f&&Cg()}}o.addEventListener("input",l),o.addEventListener("change",l),window.postFormEditor&&window.postFormEditor.codemirror.on("change",l)}function Sg(){var o=document.querySelector(".post-form-wrap"),l=document.querySelector(".post-form-wrap .notices.success, .post-form-wrap .notices.green");if(!(!o||!l)){var s=document.createElement("div");s.className="post-success";var a=document.createElement("p");a.className="post-success__title",a.textContent="\u2713 Saved to your journal.",s.appendChild(a);var f=document.createElement("div");f.className="post-success__actions";var p=o.getAttribute("data-trip-url");if(p){var c=document.createElement("a");c.className="post-success__view",c.href=p,c.textContent="View your journal \u2192",f.appendChild(c)}var d=document.createElement("a");d.className="post-success__again",d.href=window.location.pathname,d.textContent="Post another",f.appendChild(d),s.appendChild(f),l.parentNode.insertBefore(s,l.nextSibling),["form",".form-action-row","#location-status","#weather-status"].forEach(function(m){var y=o.querySelector(m);y&&(y.style.display="none")}),l.scrollIntoView({behavior:"smooth",block:"start"})}}var Ko=!1;function Tc(o){return new URLSearchParams(window.location.search).get(o)}function hr(o,l){var s=Ot(o);s&&(s.value=l==null?"":String(l))}function Rl(o,l){var s=l?"1":"0",a=document.querySelectorAll('[name="data['+o+']"]');Array.prototype.forEach.call(a,function(f){f.checked=String(f.value)===s})}function Eg(o){var l=o==null?"":String(o);if(window.postFormEditor&&typeof window.postFormEditor.value=="function")window.postFormEditor.value(l);else{var s=Ot("content");s&&(s.value=l)}}function Lc(o,l){var s=o.querySelectorAll("input, textarea, select, button");Array.prototype.forEach.call(s,function(a){a.type==="file"||a.name&&a.name.indexOf("data[photos")===0||(a.disabled=l)}),window.postFormEditor&&window.postFormEditor.codemirror&&window.postFormEditor.codemirror.setOption("readOnly",l?"nocursor":!1)}function Wl(o,l){o&&(o.tagName==="INPUT"?o.value=l:o.textContent=l)}function Ag(o,l){var s=o.querySelector(".post-edit-error");if(s){s.textContent=l;return}var a=document.createElement("div");a.className="post-edit-error",a.setAttribute("role","alert"),a.textContent=l;var f=o.querySelector("h1");f?f.insertAdjacentElement("afterend",a):o.insertBefore(a,o.firstChild)}var Fg=/\.(jpe?g|png|webp|heic|heif|gif)$/i;function Mc(o){var l=/(?:^|\/)photo-0*(\d+)\./i.exec(o);return l?parseInt(l[1],10):Number.MAX_SAFE_INTEGER}function Tg(o,l){var s=Mc(o),a=Mc(l);return s!==a?s-a:ol?1:0}function _c(o,l){var s=String(o||"photo"),a=s.lastIndexOf("."),f=(a>0?s.slice(0,a):s).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"photo",p=l?".jpg":a>0?s.slice(a).toLowerCase():".jpg",c=Date.now().toString(36)+Math.random().toString(36).slice(2,6);return f+"-"+c+p}function Lg(o){var l=document.querySelector('form[name="new-entry"]');if(!l||!o)return;var s=o.split("/").filter(Boolean).pop();if(!s)return;var a=document.querySelector(".filepond-root, .form-input-file"),f=a?a.closest(".form-field"):null;f&&(f.style.display="none");var p=l.querySelector(".photos-collapse");p&&(p.style.display="none");var c=document.createElement("div");c.className="photo-editor",c.innerHTML='

    Photos

    ',f&&f.parentNode?f.parentNode.insertBefore(c,f):l.insertBefore(c,l.firstElementChild);var d=c.querySelector(".photo-editor__grid"),m=c.querySelector(".photo-editor__status"),y=c.querySelector(".photo-editor__add"),x=c.querySelector(".photo-editor__input"),C=[],S=null,F=!1,_=0;function L(j,ee){m.textContent=j||"",m.className="photo-editor__status gpx-status"+(ee?" error":"")}function T(j){F=j,y.disabled=j,Array.prototype.forEach.call(d.querySelectorAll(".photo-editor__del, .photo-editor__confirm-yes, .photo-editor__confirm-no"),function(ee){ee.disabled=j}),S&&S.option("disabled",j)}function O(){return fetch("/api/v1/pages"+o+"/media",{credentials:"include",headers:{Accept:"application/json"}}).then(function(j){if(!j.ok)throw new Error("HTTP "+j.status);return j.json()}).then(function(j){return(j&&j.data||[]).filter(function(ee){return ee&&typeof ee.filename=="string"&&Fg.test(ee.filename)}).map(function(ee){return ee.filename}).sort(Tg)})}function N(j){return Di("/api/v1/entry/"+encodeURIComponent(s)+"/photos/order",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({order:j})})}function I(j){if(C=(j||[]).slice(),S&&(S.destroy(),S=null),d.innerHTML="",!C.length){d.innerHTML='

    No photos yet \u2014 add some.

    ';return}var ee=++_;C.forEach(function(E){var H=document.createElement("div");H.className="photo-editor__cell",H.setAttribute("data-filename",E);var W=document.createElement("img");W.className="photo-editor__img",W.loading="lazy",W.alt=E,W.src=o+"/"+encodeURIComponent(E)+"?v="+ee;var Z=document.createElement("button");Z.type="button",Z.className="photo-editor__del",Z.setAttribute("aria-label","Delete "+E),Z.textContent="\u2715",Z.addEventListener("click",function(){K(H,E)}),H.appendChild(W),H.appendChild(Z),d.appendChild(H)}),C.length>1&&(S=new Ac(d,{animation:150,draggable:".photo-editor__cell",filter:".photo-editor__confirm",onEnd:G}))}function P(){return Array.prototype.map.call(d.querySelectorAll(".photo-editor__cell"),function(j){return j.getAttribute("data-filename")})}function q(j,ee){if(j.length!==ee.length)return!1;for(var E=0;EDelete?',j.appendChild(E),j.classList.add("is-confirming"),E.querySelector(".photo-editor__confirm-no").addEventListener("click",function(){j.classList.remove("is-confirming"),E.remove()}),E.querySelector(".photo-editor__confirm-yes").addEventListener("click",function(){E.querySelector(".photo-editor__confirm-yes").disabled=!0,E.querySelector(".photo-editor__confirm-no").disabled=!0,me(ee)})}}function me(j){var ee=C.slice(),E=C.filter(function(H){return H!==j});T(!0),L("Deleting\u2026"),Di("/api/v1/pages"+o+"/media/"+encodeURIComponent(j),{method:"DELETE"},[204,404]).then(function(){return(E.length?N(E):Promise.resolve()).then(O).then(function(H){L(""),I(H)},function(){L("Photo deleted, but refreshing the list failed \u2014 reload if it looks off.",!0),I(E)})},function(H){L(zl(H,"Couldn\u2019t delete that photo. Try again."),!0),I(ee)}).then(function(){T(!1)})}function U(j){return Nc(j).then(function(ee){return ee?import("./heic-to-CN7JBE7H.js").then(function(E){var H=E.heicTo||E.default&&E.default.heicTo;return H({blob:j,type:"image/jpeg",quality:.85})}).then(function(E){return{blob:E,name:_c(j.name,!0)}}):{blob:j,name:_c(j.name,!1)}})}y.addEventListener("click",function(){F||x.click()}),x.addEventListener("change",function(){var j=Array.prototype.slice.call(x.files||[]);x.value="",j.length&&le(j)});function le(j){T(!0);var ee=j.length,E=0,H=0,W=!1,Z=C.slice(),ve=Promise.resolve();j.forEach(function(De){ve=ve.then(function(){return E++,L("Uploading "+E+" of "+ee+"\u2026"),U(De).then(function(Le){var A=new FormData;return A.append("file",Le.blob,Le.name),Di("/api/v1/pages"+o+"/media",{method:"POST",body:A})}).then(null,function(Le){H++,Le&&(Le.status===401||Le.status===403)&&(W=!0)})})}),ve.then(function(){return L("Finishing\u2026"),O()}).then(function(De){var Le=Z.filter(function(te){return De.indexOf(te)!==-1}),A=De.filter(function(te){return Z.indexOf(te)===-1}),D=Le.concat(A);return D.length?N(D).catch(function(){return N(D)}).catch(function(){return Promise.all(A.map(function(te){return Di("/api/v1/pages"+o+"/media/"+encodeURIComponent(te),{method:"DELETE"},[204,404]).then(function(){return!0},function(){return!1})})).then(function(te){var we=new Error("reorder failed");throw we.rolledBack=!0,we.rollbackIncomplete=te.indexOf(!1)!==-1,we})}).then(O):(I([]),null)}).then(function(De){De&&I(De),H?L(W?"Couldn\u2019t add photos \u2014 your login session expired. Sign in again, then retry.":H+" photo"+(H>1?"s":"")+" couldn\u2019t be added.",!0):L("")}).catch(function(De){var Le;return De&&De.rolledBack?Le=De.rollbackIncomplete?"Couldn\u2019t finish adding photos and cleanup was incomplete \u2014 reload the page and check your photos.":"Couldn\u2019t finish adding photos \u2014 changes were rolled back. Try again.":Le="Couldn\u2019t add photos. Please try again.",L(Le,!0),O().then(I,function(){I(Z)})}).then(function(){T(!1)})}d.innerHTML='

    Loading photos\u2026

    ',O().then(I).catch(function(){L("Couldn\u2019t load photos.",!0),I([])})}function Mg(){var o=document.querySelector('form[name="new-entry"]'),l=document.querySelector(".post-form-wrap");if(!(!o||!l)){var s=Tc("edit");if(s){Ko=!0;var a=l.querySelector("h1");a&&(a.textContent="Edit entry");var f=o.querySelector('button[type="submit"], input[type="submit"]'),p=f?f.tagName==="INPUT"?f.value:f.textContent:"Save changes";Lc(o,!0),Wl(f,"Loading entry\u2026");var c=Tc("return")||l.getAttribute("data-trip-url")||"";o.setAttribute("action","/post?edit="+encodeURIComponent(s)+(c?"&return="+encodeURIComponent(c):"")),fetch("/api/v1/pages"+s,{credentials:"include",headers:{Accept:"application/json"}}).then(function(d){if(!d.ok){var m=new Error("HTTP "+d.status);throw m.status=d.status,m}return d.json()}).then(function(d){var m=d&&d.data||{},y=m.header||{};hr("title",y.title!=null?y.title:m.title),hr("date",y.date?String(y.date).replace(" ","T"):""),Eg(m.content),hr("lat",y.lat),hr("lng",y.lng),hr("location_city",y.location_city),hr("location_country",y.location_country),hr("weather_desc",y.weather_desc),hr("weather_temp_c",y.weather_temp_c),hr("transport_mode",y.transport_mode),Rl("featured",y.featured),Rl("force_connect",y.force_connect),Rl("published",y.published!==void 0?y.published:m.published);var x=Ot("edit_path");x&&(x.value=s+"/entry.md"),Lc(o,!1),Wl(f,"Save changes");var C=o.querySelector(".more-options");C&&(C.open=!0),Lg(s)}).catch(function(d){var m=d&&d.status===404?"This entry no longer exists \u2014 it may have been deleted. Head back to the journal.":"Sorry \u2014 this entry couldn\u2019t be loaded for editing. Check your connection and try again.";Ag(l,m),Wl(f,p)})}}}function Bc(){window.postFormEditor=dg(),Sg(),Mg(),kg(),vg(),mg(),yg(),Dg()}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Bc):Bc(); +`]},Hp={link:"URL for the link:",image:"URL of the image:"},Pp={locale:"en-US",format:{hour:"2-digit",minute:"2-digit"}},qp={bold:"**",code:"```",italic:"*"},Rp={sbInit:"Attach files by drag and dropping or pasting from clipboard.",sbOnDragEnter:"Drop image to upload it.",sbOnDrop:"Uploading image #images_names#...",sbProgress:"Uploading #file_name#: #progress#%",sbOnUploaded:"Uploaded #image_name#",sizeUnits:" B, KB, MB"},Wp={noFileGiven:"You must select a file.",typeNotAllowed:"This image type is not allowed.",fileTooLarge:`Image #image_name# is too big (#image_size#). +Maximum file size is #image_max_size#.`,importError:"Something went wrong when uploading the image #image_name#."};function re(o){o=o||{},o.parent=this;var l=!0;if(o.autoDownloadFontAwesome===!1&&(l=!1),o.autoDownloadFontAwesome!==!0)for(var s=document.styleSheets,a=0;a-1&&(l=!1);if(l){var f=document.createElement("link");f.rel="stylesheet",f.href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css",document.getElementsByTagName("head")[0].appendChild(f)}if(o.element)this.element=o.element;else if(o.element===null){console.log("EasyMDE: Error. No element was found.");return}if(o.toolbar===void 0){o.toolbar=[];for(var h in Ur)Object.prototype.hasOwnProperty.call(Ur,h)&&(h.indexOf("separator-")!=-1&&o.toolbar.push("|"),(Ur[h].default===!0||o.showIcons&&o.showIcons.constructor===Array&&o.showIcons.indexOf(h)!=-1)&&o.toolbar.push(h))}if(Object.prototype.hasOwnProperty.call(o,"previewClass")||(o.previewClass="editor-preview"),Object.prototype.hasOwnProperty.call(o,"status")||(o.status=["autosave","lines","words","cursor"],o.uploadImage&&o.status.unshift("upload-image")),o.previewRender||(o.previewRender=function(d){return this.parent.markdown(d)}),o.parsingConfig=sr({highlightFormatting:!0},o.parsingConfig||{}),o.insertTexts=sr({},Ip,o.insertTexts||{}),o.promptTexts=sr({},Hp,o.promptTexts||{}),o.blockStyles=sr({},qp,o.blockStyles||{}),o.autosave!=null&&(o.autosave.timeFormat=sr({},Pp,o.autosave.timeFormat||{})),o.iconClassMap=sr({},Be,o.iconClassMap||{}),o.shortcuts=sr({},Tp,o.shortcuts||{}),o.maxHeight=o.maxHeight||void 0,o.direction=o.direction||"ltr",typeof o.maxHeight<"u"?o.minHeight=o.maxHeight:o.minHeight=o.minHeight||"300px",o.errorCallback=o.errorCallback||function(d){alert(d)},o.uploadImage=o.uploadImage||!1,o.imageMaxSize=o.imageMaxSize||2097152,o.imageAccept=o.imageAccept||"image/png, image/jpeg, image/gif, image/avif",o.imageTexts=sr({},Rp,o.imageTexts||{}),o.errorMessages=sr({},Wp,o.errorMessages||{}),o.imagePathAbsolute=o.imagePathAbsolute||!1,o.imageCSRFName=o.imageCSRFName||"csrfmiddlewaretoken",o.imageCSRFHeader=o.imageCSRFHeader||!1,o.imageInputName=o.imageInputName||"image",o.autosave!=null&&o.autosave.unique_id!=null&&o.autosave.unique_id!=""&&(o.autosave.uniqueId=o.autosave.unique_id),o.overlayMode&&o.overlayMode.combine===void 0&&(o.overlayMode.combine=!0),this.options=o,this.render(),o.initialValue&&(!this.options.autosave||this.options.autosave.foundSavedValue!==!0)&&this.value(o.initialValue),o.uploadImage){var c=this;this.codemirror.on("dragenter",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbOnDragEnter),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("dragend",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbInit),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("dragleave",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbInit),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("dragover",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbOnDragEnter),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("drop",function(d,v){v.stopPropagation(),v.preventDefault(),o.imageUploadFunction?c.uploadImagesUsingCustomFunction(o.imageUploadFunction,v.dataTransfer.files):c.uploadImages(v.dataTransfer.files)}),this.codemirror.on("paste",function(d,v){o.imageUploadFunction?c.uploadImagesUsingCustomFunction(o.imageUploadFunction,v.clipboardData.files):c.uploadImages(v.clipboardData.files)})}}re.prototype.uploadImages=function(o,l,s){if(o.length!==0){for(var a=[],f=0;f=2){var O=z[1];if(l.imagesPreviewHandler){var I=l.imagesPreviewHandler(z[1]);typeof I=="string"&&(O=I)}if(window.EMDEimagesCache[O])F(N,window.EMDEimagesCache[O]);else{window.EMDEimagesCache[O]={};var W=document.createElement("img");W.onload=function(){window.EMDEimagesCache[O]={naturalWidth:W.naturalWidth,naturalHeight:W.naturalHeight,url:O},F(N,window.EMDEimagesCache[O])},W.src=O}}}})}this.codemirror.on("update",function(){B()}),this.gui.sideBySide=this.createSideBySide(),this._rendered=this.element,(l.autofocus===!0||o.autofocus)&&this.codemirror.focus();var L=this.codemirror;setTimeout(function(){L.refresh()}.bind(L),0)};re.prototype.cleanup=function(){document.removeEventListener("keydown",this.documentOnKeyDown)};function rc(){if(typeof localStorage=="object")try{localStorage.setItem("smde_localStorage",1),localStorage.removeItem("smde_localStorage")}catch{return!1}else return!1;return!0}re.prototype.autosave=function(){if(rc()){var o=this;if(this.options.autosave.uniqueId==null||this.options.autosave.uniqueId==""){console.log("EasyMDE: You must set a uniqueId to use the autosave feature");return}this.options.autosave.binded!==!0&&(o.element.form!=null&&o.element.form!=null&&o.element.form.addEventListener("submit",function(){clearTimeout(o.autosaveTimeoutId),o.autosaveTimeoutId=void 0,localStorage.removeItem("smde_"+o.options.autosave.uniqueId)}),this.options.autosave.binded=!0),this.options.autosave.loaded!==!0&&(typeof localStorage.getItem("smde_"+this.options.autosave.uniqueId)=="string"&&localStorage.getItem("smde_"+this.options.autosave.uniqueId)!=""&&(this.codemirror.setValue(localStorage.getItem("smde_"+this.options.autosave.uniqueId)),this.options.autosave.foundSavedValue=!0),this.options.autosave.loaded=!0);var l=o.value();l!==""?localStorage.setItem("smde_"+this.options.autosave.uniqueId,l):localStorage.removeItem("smde_"+this.options.autosave.uniqueId);var s=document.getElementById("autosaved");if(s!=null&&s!=null&&s!=""){var a=new Date,f=new Intl.DateTimeFormat([this.options.autosave.timeFormat.locale,"en-US"],this.options.autosave.timeFormat.format).format(a),h=this.options.autosave.text==null?"Autosaved: ":this.options.autosave.text;s.innerHTML=h+f}}else console.log("EasyMDE: localStorage not available, cannot autosave")};re.prototype.clearAutosavedValue=function(){if(rc()){if(this.options.autosave==null||this.options.autosave.uniqueId==null||this.options.autosave.uniqueId==""){console.log("EasyMDE: You must set a uniqueId to clear the autosave value");return}localStorage.removeItem("smde_"+this.options.autosave.uniqueId)}else console.log("EasyMDE: localStorage not available, cannot autosave")};re.prototype.openBrowseFileWindow=function(o,l){var s=this,a=this.gui.toolbar.getElementsByClassName("imageInput")[0];a.click();function f(h){s.options.imageUploadFunction?s.uploadImagesUsingCustomFunction(s.options.imageUploadFunction,h.target.files):s.uploadImages(h.target.files,o,l),a.removeEventListener("change",f)}a.addEventListener("change",f)};re.prototype.uploadImage=function(o,l,s){var a=this;l=l||function(y){$f(a,y)};function f(v){a.updateStatusBar("upload-image",v),setTimeout(function(){a.updateStatusBar("upload-image",a.options.imageTexts.sbInit)},1e4),s&&typeof s=="function"&&s(v),a.options.errorCallback(v)}function h(v){var y=a.options.imageTexts.sizeUnits.split(",");return v.replace("#image_name#",o.name).replace("#image_size#",fo(o.size,y)).replace("#image_max_size#",fo(a.options.imageMaxSize,y))}if(o.size>this.options.imageMaxSize){f(h(this.options.errorMessages.fileTooLarge));return}var c=new FormData;c.append("image",o),a.options.imageCSRFToken&&!a.options.imageCSRFHeader&&c.append(a.options.imageCSRFName,a.options.imageCSRFToken);var d=new XMLHttpRequest;d.upload.onprogress=function(v){if(v.lengthComputable){var y=""+Math.round(v.loaded*100/v.total);a.updateStatusBar("upload-image",a.options.imageTexts.sbProgress.replace("#file_name#",o.name).replace("#progress#",y))}},d.open("POST",this.options.imageUploadEndpoint),a.options.imageCSRFToken&&a.options.imageCSRFHeader&&d.setRequestHeader(a.options.imageCSRFName,a.options.imageCSRFToken),d.onload=function(){try{var v=JSON.parse(this.responseText)}catch{console.error("EasyMDE: The server did not return a valid json."),f(h(a.options.errorMessages.importError));return}this.status===200&&v&&!v.error&&v.data&&v.data.filePath?l((a.options.imagePathAbsolute?"":window.location.origin+"/")+v.data.filePath):v.error&&v.error in a.options.errorMessages?f(h(a.options.errorMessages[v.error])):v.error?f(h(v.error)):(console.error("EasyMDE: Received an unexpected response after uploading the image."+this.status+" ("+this.statusText+")"),f(h(a.options.errorMessages.importError)))},d.onerror=function(v){console.error("EasyMDE: An unexpected error occurred when trying to upload the image."+v.target.status+" ("+v.target.statusText+")"),f(a.options.errorMessages.importError)},d.send(c)};re.prototype.uploadImageUsingCustomFunction=function(o,l){var s=this;function a(c){$f(s,c)}function f(c){var d=h(c);s.updateStatusBar("upload-image",d),setTimeout(function(){s.updateStatusBar("upload-image",s.options.imageTexts.sbInit)},1e4),s.options.errorCallback(d)}function h(c){var d=s.options.imageTexts.sizeUnits.split(",");return c.replace("#image_name#",l.name).replace("#image_size#",fo(l.size,d)).replace("#image_max_size#",fo(s.options.imageMaxSize,d))}o.apply(this,[l,a,f])};re.prototype.setPreviewMaxHeight=function(){var o=this.codemirror,l=o.getWrapperElement(),s=l.nextSibling,a=parseInt(window.getComputedStyle(l).paddingTop),f=parseInt(window.getComputedStyle(l).borderTopWidth),h=parseInt(this.options.maxHeight),c=h+a*2+f*2,d=c.toString()+"px";s.style.height=d};re.prototype.createSideBySide=function(){var o=this.codemirror,l=o.getWrapperElement(),s=l.nextSibling;if(!s||!s.classList.contains("editor-preview-side")){if(s=document.createElement("div"),s.className="editor-preview-side",this.options.previewClass)if(Array.isArray(this.options.previewClass))for(var a=0;a"&&(l=l.substring(1)),o)try{if(o.matches)return o.matches(l);if(o.msMatchesSelector)return o.msMatchesSelector(l);if(o.webkitMatchesSelector)return o.webkitMatchesSelector(l)}catch{return!1}return!1}}function mc(o){return o.host&&o!==document&&o.host.nodeType&&o.host!==o?o.host:o.parentNode}function Gt(o,l,s,a){if(o){s=s||document;do{if(l!=null&&(l[0]===">"?o.parentNode===s&&Ro(o,l):Ro(o,l))||a&&o===s)return o;if(o===s)break}while(o=mc(o))}return null}var lc=/\s+/g;function zt(o,l,s){if(o&&l)if(o.classList)o.classList[s?"add":"remove"](l);else{var a=(" "+o.className+" ").replace(lc," ").replace(" "+l+" "," ");o.className=(a+(s?" "+l:"")).replace(lc," ")}}function pe(o,l,s){var a=o&&o.style;if(a){if(s===void 0)return document.defaultView&&document.defaultView.getComputedStyle?s=document.defaultView.getComputedStyle(o,""):o.currentStyle&&(s=o.currentStyle),l===void 0?s:s[l];!(l in a)&&l.indexOf("webkit")===-1&&(l="-webkit-"+l),a[l]=s+(typeof s=="string"?"":"px")}}function Ei(o,l){var s="";if(typeof o=="string")s=o;else do{var a=pe(o,"transform");a&&a!=="none"&&(s=a+" "+s)}while(!l&&(o=o.parentNode));var f=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return f&&new f(s)}function vc(o,l,s){if(o){var a=o.getElementsByTagName(l),f=0,h=a.length;if(s)for(;f=h:c=f<=h,!c)return a;if(a===$t())break;a=Tr(a,!1)}return!1}function Ai(o,l,s,a){for(var f=0,h=0,c=o.children;h2&&arguments[2]!==void 0?arguments[2]:{},f=a.evt,h=jp(a,r0);xn.pluginEvent.bind(ge)(l,s,er({dragEl:$,parentEl:Ue,ghostEl:ye,rootEl:He,nextEl:Yr,lastDownEl:Io,cloneEl:Re,cloneHidden:Fr,dragStarted:cn,putSortable:ut,activeSortable:ge.active,originalEvent:f,oldIndex:Si,oldDraggableIndex:mn,newIndex:Nt,newDraggableIndex:Ar,hideGhostForTarget:Sc,unhideGhostForTarget:Ec,cloneNowHidden:function(){Fr=!0},cloneNowShown:function(){Fr=!1},dispatchSortableEvent:function(d){kt({sortable:s,name:d,originalEvent:f})}},h))};function kt(o){t0(er({putSortable:ut,cloneEl:Re,targetEl:$,rootEl:He,oldIndex:Si,oldDraggableIndex:mn,newIndex:Nt,newDraggableIndex:Ar},o))}var $,Ue,ye,He,Yr,Io,Re,Fr,Si,Nt,mn,Ar,_o,ut,ki=!1,Wo=!1,Uo=[],Xr,jt,Dl,kl,fc,cc,cn,Di,vn,bn=!1,zo=!1,Ho,gt,Sl=[],Ml=!1,jo=[],Xo=typeof document<"u",No=Nl,dc=yn||cr?"cssFloat":"float",i0=Xo&&!pc&&!Nl&&"draggable"in document.createElement("div"),Cc=function(){if(Xo){if(cr)return!1;var o=document.createElement("x");return o.style.cssText="pointer-events:auto",o.style.pointerEvents==="auto"}}(),Dc=function(l,s){var a=pe(l),f=parseInt(a.width)-parseInt(a.paddingLeft)-parseInt(a.paddingRight)-parseInt(a.borderLeftWidth)-parseInt(a.borderRightWidth),h=Ai(l,0,s),c=Ai(l,1,s),d=h&&pe(h),v=c&&pe(c),y=d&&parseInt(d.marginLeft)+parseInt(d.marginRight)+Ve(h).width,x=v&&parseInt(v.marginLeft)+parseInt(v.marginRight)+Ve(c).width;if(a.display==="flex")return a.flexDirection==="column"||a.flexDirection==="column-reverse"?"vertical":"horizontal";if(a.display==="grid")return a.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(h&&d.float&&d.float!=="none"){var D=d.float==="left"?"left":"right";return c&&(v.clear==="both"||v.clear===D)?"vertical":"horizontal"}return h&&(d.display==="block"||d.display==="flex"||d.display==="table"||d.display==="grid"||y>=f&&a[dc]==="none"||c&&a[dc]==="none"&&y+x>f)?"vertical":"horizontal"},n0=function(l,s,a){var f=a?l.left:l.top,h=a?l.right:l.bottom,c=a?l.width:l.height,d=a?s.left:s.top,v=a?s.right:s.bottom,y=a?s.width:s.height;return f===d||h===v||f+c/2===d+y/2},o0=function(l,s){var a;return Uo.some(function(f){var h=f[Tt].options.emptyInsertThreshold;if(!(!h||Ol(f))){var c=Ve(f),d=l>=c.left-h&&l<=c.right+h,v=s>=c.top-h&&s<=c.bottom+h;if(d&&v)return a=f}}),a},kc=function(l){function s(h,c){return function(d,v,y,x){var D=d.options.group.name&&v.options.group.name&&d.options.group.name===v.options.group.name;if(h==null&&(c||D))return!0;if(h==null||h===!1)return!1;if(c&&h==="clone")return h;if(typeof h=="function")return s(h(d,v,y,x),c)(d,v,y,x);var k=(c?d:v).options.group.name;return h===!0||typeof h=="string"&&h===k||h.join&&h.indexOf(k)>-1}}var a={},f=l.group;(!f||Ll(f)!="object")&&(f={name:f}),a.name=f.name,a.checkPull=s(f.pull,!0),a.checkPut=s(f.put),a.revertClone=f.revertClone,l.group=a},Sc=function(){!Cc&&ye&&pe(ye,"display","none")},Ec=function(){!Cc&&ye&&pe(ye,"display","")};Xo&&!pc&&document.addEventListener("click",function(o){if(Wo)return o.preventDefault(),o.stopPropagation&&o.stopPropagation(),o.stopImmediatePropagation&&o.stopImmediatePropagation(),Wo=!1,!1},!0);var Kr=function(l){if($){l=l.touches?l.touches[0]:l;var s=o0(l.clientX,l.clientY);if(s){var a={};for(var f in l)l.hasOwnProperty(f)&&(a[f]=l[f]);a.target=a.rootEl=s,a.preventDefault=void 0,a.stopPropagation=void 0,s[Tt]._onDragOver(a)}}},a0=function(l){$&&$.parentNode[Tt]._isOutsideThisEl(l.target)};function ge(o,l){if(!(o&&o.nodeType&&o.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(o));this.el=o,this.options=l=fr({},l),o[Tt]=this;var s={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(o.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Dc(o,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(c,d){c.setData("Text",d.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:ge.supportPointer!==!1&&"PointerEvent"in window&&(!pn||Nl),emptyInsertThreshold:5};xn.initializePlugins(this,o,s);for(var a in s)!(a in l)&&(l[a]=s[a]);kc(l);for(var f in this)f.charAt(0)==="_"&&typeof this[f]=="function"&&(this[f]=this[f].bind(this));this.nativeDraggable=l.forceFallback?!1:i0,this.nativeDraggable&&(this.options.touchStartThreshold=1),l.supportPointer?Se(o,"pointerdown",this._onTapStart):(Se(o,"mousedown",this._onTapStart),Se(o,"touchstart",this._onTapStart)),this.nativeDraggable&&(Se(o,"dragover",this),Se(o,"dragenter",this)),Uo.push(this.el),l.store&&l.store.get&&this.sort(l.store.get(this)||[]),fr(this,Vp())}ge.prototype={constructor:ge,_isOutsideThisEl:function(l){!this.el.contains(l)&&l!==this.el&&(Di=null)},_getDirection:function(l,s){return typeof this.options.direction=="function"?this.options.direction.call(this,l,s,$):this.options.direction},_onTapStart:function(l){if(l.cancelable){var s=this,a=this.el,f=this.options,h=f.preventOnFilter,c=l.type,d=l.touches&&l.touches[0]||l.pointerType&&l.pointerType==="touch"&&l,v=(d||l).target,y=l.target.shadowRoot&&(l.path&&l.path[0]||l.composedPath&&l.composedPath()[0])||v,x=f.filter;if(p0(a),!$&&!(/mousedown|pointerdown/.test(c)&&l.button!==0||f.disabled)&&!y.isContentEditable&&!(!this.nativeDraggable&&pn&&v&&v.tagName.toUpperCase()==="SELECT")&&(v=Gt(v,f.draggable,a,!1),!(v&&v.animated)&&Io!==v)){if(Si=It(v),mn=It(v,f.draggable),typeof x=="function"){if(x.call(this,l,v,this)){kt({sortable:s,rootEl:y,name:"filter",targetEl:v,toEl:a,fromEl:a}),Ft("filter",s,{evt:l}),h&&l.preventDefault();return}}else if(x&&(x=x.split(",").some(function(D){if(D=Gt(y,D.trim(),a,!1),D)return kt({sortable:s,rootEl:D,name:"filter",targetEl:v,fromEl:a,toEl:a}),Ft("filter",s,{evt:l}),!0}),x)){h&&l.preventDefault();return}f.handle&&!Gt(y,f.handle,a,!1)||this._prepareDragStart(l,d,v)}}},_prepareDragStart:function(l,s,a){var f=this,h=f.el,c=f.options,d=h.ownerDocument,v;if(a&&!$&&a.parentNode===h){var y=Ve(a);if(He=h,$=a,Ue=$.parentNode,Yr=$.nextSibling,Io=a,_o=c.group,ge.dragged=$,Xr={target:$,clientX:(s||l).clientX,clientY:(s||l).clientY},fc=Xr.clientX-y.left,cc=Xr.clientY-y.top,this._lastX=(s||l).clientX,this._lastY=(s||l).clientY,$.style["will-change"]="all",v=function(){if(Ft("delayEnded",f,{evt:l}),ge.eventCanceled){f._onDrop();return}f._disableDelayedDragEvents(),!ac&&f.nativeDraggable&&($.draggable=!0),f._triggerDragStart(l,s),kt({sortable:f,name:"choose",originalEvent:l}),zt($,c.chosenClass,!0)},c.ignore.split(",").forEach(function(x){vc($,x.trim(),El)}),Se(d,"dragover",Kr),Se(d,"mousemove",Kr),Se(d,"touchmove",Kr),c.supportPointer?(Se(d,"pointerup",f._onDrop),!this.nativeDraggable&&Se(d,"pointercancel",f._onDrop)):(Se(d,"mouseup",f._onDrop),Se(d,"touchend",f._onDrop),Se(d,"touchcancel",f._onDrop)),ac&&this.nativeDraggable&&(this.options.touchStartThreshold=4,$.draggable=!0),Ft("delayStart",this,{evt:l}),c.delay&&(!c.delayOnTouchOnly||s)&&(!this.nativeDraggable||!(yn||cr))){if(ge.eventCanceled){this._onDrop();return}c.supportPointer?(Se(d,"pointerup",f._disableDelayedDrag),Se(d,"pointercancel",f._disableDelayedDrag)):(Se(d,"mouseup",f._disableDelayedDrag),Se(d,"touchend",f._disableDelayedDrag),Se(d,"touchcancel",f._disableDelayedDrag)),Se(d,"mousemove",f._delayedDragTouchMoveHandler),Se(d,"touchmove",f._delayedDragTouchMoveHandler),c.supportPointer&&Se(d,"pointermove",f._delayedDragTouchMoveHandler),f._dragStartTimer=setTimeout(v,c.delay)}else v()}},_delayedDragTouchMoveHandler:function(l){var s=l.touches?l.touches[0]:l;Math.max(Math.abs(s.clientX-this._lastX),Math.abs(s.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){$&&El($),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var l=this.el.ownerDocument;ke(l,"mouseup",this._disableDelayedDrag),ke(l,"touchend",this._disableDelayedDrag),ke(l,"touchcancel",this._disableDelayedDrag),ke(l,"pointerup",this._disableDelayedDrag),ke(l,"pointercancel",this._disableDelayedDrag),ke(l,"mousemove",this._delayedDragTouchMoveHandler),ke(l,"touchmove",this._delayedDragTouchMoveHandler),ke(l,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(l,s){s=s||l.pointerType=="touch"&&l,!this.nativeDraggable||s?this.options.supportPointer?Se(document,"pointermove",this._onTouchMove):s?Se(document,"touchmove",this._onTouchMove):Se(document,"mousemove",this._onTouchMove):(Se($,"dragend",this),Se(He,"dragstart",this._onDragStart));try{document.selection?Po(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(l,s){if(ki=!1,He&&$){Ft("dragStarted",this,{evt:s}),this.nativeDraggable&&Se(document,"dragover",a0);var a=this.options;!l&&zt($,a.dragClass,!1),zt($,a.ghostClass,!0),ge.active=this,l&&this._appendGhost(),kt({sortable:this,name:"start",originalEvent:s})}else this._nulling()},_emulateDragOver:function(){if(jt){this._lastX=jt.clientX,this._lastY=jt.clientY,Sc();for(var l=document.elementFromPoint(jt.clientX,jt.clientY),s=l;l&&l.shadowRoot&&(l=l.shadowRoot.elementFromPoint(jt.clientX,jt.clientY),l!==s);)s=l;if($.parentNode[Tt]._isOutsideThisEl(l),s)do{if(s[Tt]){var a=void 0;if(a=s[Tt]._onDragOver({clientX:jt.clientX,clientY:jt.clientY,target:l,rootEl:s}),a&&!this.options.dragoverBubble)break}l=s}while(s=mc(s));Ec()}},_onTouchMove:function(l){if(Xr){var s=this.options,a=s.fallbackTolerance,f=s.fallbackOffset,h=l.touches?l.touches[0]:l,c=ye&&Ei(ye,!0),d=ye&&c&&c.a,v=ye&&c&&c.d,y=No&>&&uc(gt),x=(h.clientX-Xr.clientX+f.x)/(d||1)+(y?y[0]-Sl[0]:0)/(d||1),D=(h.clientY-Xr.clientY+f.y)/(v||1)+(y?y[1]-Sl[1]:0)/(v||1);if(!ge.active&&!ki){if(a&&Math.max(Math.abs(h.clientX-this._lastX),Math.abs(h.clientY-this._lastY))=0&&(kt({rootEl:Ue,name:"add",toEl:Ue,fromEl:He,originalEvent:l}),kt({sortable:this,name:"remove",toEl:Ue,originalEvent:l}),kt({rootEl:Ue,name:"sort",toEl:Ue,fromEl:He,originalEvent:l}),kt({sortable:this,name:"sort",toEl:Ue,originalEvent:l})),ut&&ut.save()):Nt!==Si&&Nt>=0&&(kt({sortable:this,name:"update",toEl:Ue,originalEvent:l}),kt({sortable:this,name:"sort",toEl:Ue,originalEvent:l})),ge.active&&((Nt==null||Nt===-1)&&(Nt=Si,Ar=mn),kt({sortable:this,name:"end",toEl:Ue,originalEvent:l}),this.save()))),this._nulling()},_nulling:function(){Ft("nulling",this),He=$=Ue=ye=Yr=Re=Io=Fr=Xr=jt=cn=Nt=Ar=Si=mn=Di=vn=ut=_o=ge.dragged=ge.ghost=ge.clone=ge.active=null;var l=this.el;jo.forEach(function(s){l.contains(s)&&(s.checked=!0)}),jo.length=Dl=kl=0},handleEvent:function(l){switch(l.type){case"drop":case"dragend":this._onDrop(l);break;case"dragenter":case"dragover":$&&(this._onDragOver(l),l0(l));break;case"selectstart":l.preventDefault();break}},toArray:function(){for(var l=[],s,a=this.el.children,f=0,h=a.length,c=this.options;ff.right+h||o.clientY>a.bottom&&o.clientX>a.left:o.clientY>f.bottom+h||o.clientX>a.right&&o.clientY>a.top}function c0(o,l,s,a,f,h,c,d){var v=a?o.clientY:o.clientX,y=a?s.height:s.width,x=a?s.top:s.left,D=a?s.bottom:s.right,k=!1;if(!c){if(d&&Hox+y*h/2:vD-Ho)return-vn}else if(v>x+y*(1-f)/2&&vD-y*h/2)?v>x+y/2?1:-1:0}function d0(o){return It($)0||D>0&&k0?"Converting "+l+" photo"+(l>1?"s":"")+"\u2026":"Uploading "+D+" photo"+(D>1?"s":"")+"\u2026",s.details.open=!0):D>0?(s.summary.textContent="\u2713 "+D+" photo"+(D>1?"s":"")+" ready \u2014 tap to review",s.details.open=!1):(s.summary.textContent="Photos (1\u20136)",s.details.open=!0)}}function c(){h(),setTimeout(h,150),setTimeout(h,500)}function d(){var x=o.querySelector('button[type="submit"], input[type="submit"]');if(x&&(x.disabled=l>0),l>0)f("Converting "+l+" photo"+(l>1?"s":"")+"\u2026");else{var D=Mc();D&&/Converting/.test(D.textContent)&&f("")}h()}o.addEventListener("submit",function(x){l>0&&(x.preventDefault(),f("Hang on \u2014 a photo is still converting.","err"))},!0);function v(x){return function(D){var k=D&&D.file;return k?Ic(k).then(function(F){return F?(l++,d(),import("./heic-to-CN7JBE7H.js").then(function(B){var L=B.heicTo||B.default&&B.default.heicTo;return L({blob:k,type:"image/jpeg",quality:.85})}).then(function(B){var L=new File([B],y0(k.name),{type:"image/jpeg"});x.addFile(L)}).catch(function(){f("A photo couldn\u2019t be converted and was skipped \u2014 the others are fine.","err")}).then(function(){l--,d()}),!1):!0}):!0}}var y=0;(function x(){var D=window.GravFilePond&&window.GravFilePond.getInstances?window.GravFilePond.getInstances():[];if(!D.length){y++<120&&setTimeout(x,50);return}D.forEach(function(k){k&&!k._heicHooked&&(k._heicHooked=!0,k.setOptions({beforeAddFile:v(k),allowReorder:!0,itemInsertLocation:"after"}),a=k,["addfile","processfile","processfiles","removefile","error"].forEach(function(F){try{k.on(F,c)}catch{}}),h())})})()}function ft(o){return document.querySelector('[name="data['+o+']"]')}function C0(){var o=Array.prototype.slice.call(document.querySelectorAll(".advanced-field"));if(o.length){var l=[];if(o.forEach(function(h){var c=h.closest(".form-field");c&&l.indexOf(c)===-1&&l.push(c)}),!!l.length){var s=document.createElement("details");s.className="more-options";var a=document.createElement("summary");a.className="more-options__summary",a.textContent="More options",s.appendChild(a),l[0].parentNode.insertBefore(s,l[0]),l.forEach(function(h){s.appendChild(h)});var f=l.some(function(h){var c=h.querySelector('input[type="text"]');if(c&&c.value.trim())return!0;var d=h.querySelector('input[type="radio"]:checked');if(!d||!d.value)return!1;var v=h.querySelector('input[type="radio"][checked]');return v?d.value!==v.value:d.value!=="0"});f&&(s.open=!0)}}}var D0={0:"Sunny",1:"Partly cloudy",2:"Partly cloudy",3:"Cloudy",45:"Foggy",48:"Foggy",51:"Drizzle",53:"Drizzle",55:"Drizzle",56:"Drizzle",57:"Drizzle",61:"Rain",63:"Rain",65:"Rain",66:"Rain",67:"Rain",80:"Rain",81:"Rain",82:"Rain",71:"Snow",73:"Snow",75:"Snow",77:"Snow",85:"Snow",86:"Snow",95:"Thunderstorm",96:"Thunderstorm",99:"Thunderstorm"};function dr(o,l,s){o&&(o.className="form-status"+(s?" form-status--"+s:""),o.textContent=l||"")}function k0(){var o=document.getElementById("get-location"),l=document.getElementById("get-weather");if(!o&&!l)return;var s=document.getElementById("location-status"),a=document.getElementById("weather-status");function f(){var d=ft("lat"),v=ft("lng"),y=d?d.value.trim():"",x=v?v.value.trim():"";return y&&x?{lat:y,lng:x}:null}function h(){if(l){var d=!!f();l.disabled=!d,l.title=d?"":"Get location first"}}h();function c(d,v){var y=ft("location_city"),x=ft("location_country");if(!((!y||y.value.trim())&&(!x||x.value.trim()))){var D="https://api.bigdatacloud.net/data/reverse-geocode-client?latitude="+encodeURIComponent(d)+"&longitude="+encodeURIComponent(v)+"&localityLanguage=en";fetch(D).then(function(k){return k.json()}).then(function(k){var F=(k.city||k.locality||"").trim(),B=(k.countryName||"").trim();y&&!y.value.trim()&&F&&(y.value=F),x&&!x.value.trim()&&B&&(x.value=B);var L=[F,B].filter(Boolean).join(", ");L&&dr(s,"\u2713 Location captured \xB7 "+L,"ok")}).catch(function(){})}}o&&o.addEventListener("click",function(){if(!navigator.geolocation){dr(s,"Geolocation is not supported on this device.","err");return}o.classList.add("is-loading"),o.disabled=!0,dr(s,"Getting location\u2026"),navigator.geolocation.getCurrentPosition(function(d){var v=d.coords.latitude.toFixed(6),y=d.coords.longitude.toFixed(6),x=ft("lat"),D=ft("lng");x&&(x.value=v),D&&(D.value=y),o.classList.remove("is-loading"),o.disabled=!1,dr(s,"\u2713 Location captured \xB7 "+v+", "+y,"ok"),h(),c(v,y);var k=document.querySelector(".location-details");k&&k.open&&Hc()},function(d){o.classList.remove("is-loading"),o.disabled=!1,dr(s,"\u2717 "+(d&&d.message?d.message:"Could not get location")+" \u2014 enter coordinates manually if needed.","err")},{enableHighAccuracy:!0,timeout:15e3})}),l&&l.addEventListener("click",function(){var d=f();if(!d){dr(a,"Get location first, then fetch weather.","err");return}l.classList.add("is-loading"),l.disabled=!0,dr(a,"Fetching weather\u2026");var v="https://api.open-meteo.com/v1/forecast?latitude="+d.lat+"&longitude="+d.lng+"¤t=temperature_2m,weather_code&temperature_unit=celsius";fetch(v).then(function(y){return y.json()}).then(function(y){var x=Math.round(y.current.temperature_2m),D=D0[y.current.weather_code]||"Cloudy",k=ft("weather_temp_c"),F=ft("weather_desc");k&&(k.value=x),F&&(F.value=D),l.classList.remove("is-loading"),h(),dr(a,"\u2713 Weather set \xB7 "+D+" \xB7 "+x+"\xB0C (edit above if needed)","ok")}).catch(function(){l.classList.remove("is-loading"),h(),dr(a,"\u2717 Could not fetch weather \u2014 set it manually above.","err")})})}var Hc=function(){};function S0(o,l){var s=null;return function(){var a=arguments;clearTimeout(s),s=setTimeout(function(){o.apply(null,a)},l)}}function E0(o){return[o.name,o.admin1,o.country].filter(Boolean).join(", ")}function A0(){var o=ft("lat"),l=ft("lng");if(!o||!l)return;var s=o.closest(".form-field"),a=l.closest(".form-field");if(!s||!a)return;var f=ft("location_city"),h=ft("location_country"),c=h?h.closest(".form-field"):null,d=c||s,v=document.createElement("details");v.className="location-details";var y=document.createElement("summary");y.className="location-details__summary",y.textContent="More location details",v.appendChild(y);var x=document.createElement("div");x.className="location-details__body";var D=document.createElement("div");D.className="location-search-row";var k=document.createElement("button");k.type="button",k.id="lookup-coords",k.className="btn-action";var F="\u{1F50D} Look up coordinates";k.textContent=F,D.appendChild(k),x.appendChild(D);var B=document.createElement("p");B.id="location-search-hint",B.className="location-search-hint",B.setAttribute("role","status"),x.appendChild(B);var L=document.createElement("ul");L.id="location-search-results",L.className="location-search-results",x.appendChild(L);var T=document.createElement("div");T.id="location-map",T.className="location-map",x.appendChild(T),v.appendChild(x),d.parentNode.insertBefore(v,d.nextSibling),v.appendChild(s),v.appendChild(a);function N(H){return H===o?"location-lat-note":"location-lng-note"}function z(){[o,l].forEach(function(H){H.classList.add("location-field--mismatch"),H.setAttribute("aria-invalid","true");var Y=N(H),E=document.getElementById(Y);E||(E=document.createElement("span"),E.id=Y,E.className="location-field-note",E.setAttribute("role","status"),E.setAttribute("aria-live","polite"),E.textContent="Not reflected on the map yet.",H.parentNode.insertBefore(E,H.nextSibling)),H.setAttribute("aria-describedby",Y)})}function O(){[o,l].forEach(function(H){H.classList.remove("location-field--mismatch"),H.removeAttribute("aria-invalid"),H.removeAttribute("aria-describedby");var Y=document.getElementById(N(H));Y&&Y.parentNode&&Y.parentNode.removeChild(Y)})}var I=null;function W(){var H=parseFloat(o.value),Y=parseFloat(l.value),E=isFinite(H)&&isFinite(Y)&&H>=-90&&H<=90&&Y>=-180&&Y<=180;E?(O(),I&&I.setPin(H,Y)):(o.value.trim()||l.value.trim())&&z()}Hc=W;function G(H){o.value=H.lat.toFixed(6),l.value=H.lng.toFixed(6),O()}v.addEventListener("toggle",function(){v.open&&Lc(T,G).then(function(H){I=H,H.resize(),W()})}),o.addEventListener("blur",W),l.addEventListener("blur",W);var X=S0(W,400);o.addEventListener("input",X),l.addEventListener("input",X);function de(H){B.textContent=H||""}function j(){L.innerHTML=""}function oe(H){H.forEach(function(Y){var E=document.createElement("li"),q=document.createElement("button");q.type="button",q.textContent=E0(Y),q.addEventListener("click",function(){o.value=Number(Y.latitude).toFixed(6),l.value=Number(Y.longitude).toFixed(6),j(),W()}),E.appendChild(q),L.appendChild(E)})}k.addEventListener("click",function(){j();var H=f?f.value.trim():"",Y=h?h.value.trim():"";if(!H&&!Y){de("Enter a city or country first.");return}var E=H||Y;de(""),k.disabled=!0,k.textContent="Searching\u2026";var q="https://geocoding-api.open-meteo.com/v1/search?name="+encodeURIComponent(E)+"&count=10&language=en&format=json";fetch(q).then(function(R){return R.json()}).then(function(R){var Q=R&&R.results||[];if(!Q.length){de("No matches \u2014 try adding a country, or drag the pin on the map.");return}if(Y){var he=Y.toLowerCase(),be=function(Ee){return(Ee.admin1||"").toLowerCase().indexOf(he)!==-1||(Ee.country||"").toLowerCase().indexOf(he)!==-1};Q=Q.slice().sort(function(Ee,A){var w=be(Ee),te=be(A);return w===te?0:w?-1:1})}oe(Q)}).catch(function(){}).then(function(){k.disabled=!1,k.textContent=F})})}function F0(){var o=new Date;return o.setSeconds(0,0),o.setMinutes(o.getMinutes()-o.getTimezoneOffset()),o.toISOString().slice(0,16)}function T0(){var o={title:"Title",date:"Date & time",content:"Content"},l=document.querySelector('form[name="new-entry"]');if(!l)return;var s=ft("date");s&&!String(s.value).trim()&&(s.value=F0());function a(){l.querySelectorAll(".field-error").forEach(function(c){c.remove()}),l.querySelectorAll(".field-invalid").forEach(function(c){c.classList.remove("field-invalid")})}function f(c,d){c.classList.add("field-invalid");var v=document.createElement("span");v.className="field-error",v.textContent=d,c.parentNode.insertBefore(v,c.nextSibling)}function h(c){var d=l.querySelector(".photos-collapse"),v,y;if(d?(d.open=!0,y=d.querySelector(".photos-collapse__summary"),v=d):(v=document.querySelector(".filepond-root, .form-input-file"),y=v),!y)return v||null;var x=document.createElement("span");return x.className="field-error",x.textContent=c,y.insertAdjacentElement("afterend",x),v||y}l.addEventListener("submit",function(c){a();var d=null;!Yo&&document.querySelectorAll(".filepond--item").length<1&&(d=h("Add at least one photo.")),Object.keys(o).forEach(function(v){var y=ft(v);y&&!String(y.value).trim()&&(f(y,o[v]+" is required."),d||(d=y))}),d&&(c.preventDefault(),typeof d.focus=="function"&&d.focus(),d.scrollIntoView({behavior:"smooth",block:"center"}))})}var ql="intotheeast:new-entry-draft";function L0(o){return Array.prototype.slice.call(o.querySelectorAll('[name^="data["]')).filter(function(l){if(l.type==="file")return!1;var s=l.name;return s.indexOf("data[_json")!==0&&s.indexOf("data[photos")!==0})}function M0(){var o=document.querySelector(".filepond-root, .form-input-file");if(!(!o||!o.parentNode)&&!o.parentNode.querySelector(".photo-reauth-hint")){var l=document.createElement("p");l.className="photo-reauth-hint is-shown",l.textContent="Your text was restored \u2014 photos need re-selecting (they can\u2019t be saved in a draft).",o.parentNode.insertBefore(l,o.nextSibling)}}function B0(){var o=document.querySelector('form[name="new-entry"]');if(!o||Yo)return;if(document.querySelector(".notices.success")){try{localStorage.removeItem(ql)}catch{}return}function l(){var h={};L0(o).forEach(function(c){c.type==="radio"?c.checked&&(h[c.name]=c.value):h[c.name]=c.value});try{localStorage.setItem(ql,JSON.stringify(h))}catch{}}var s=null;try{s=localStorage.getItem(ql)}catch{s=null}if(s){var a=null;try{a=JSON.parse(s)}catch{a=null}if(a){var f=!1;Object.keys(a).forEach(function(h){var c=a[h];if(c!=null&&String(c).trim()&&(f=!0),h!=="data[content]"){var d=o.querySelectorAll('input[type="radio"][name="'+h+'"]');if(d.length){d.forEach(function(y){y.checked=y.value===c});return}var v=o.querySelector('[name="'+h+'"]');v&&v.type!=="file"&&(v.value=c)}}),window.postFormEditor&&a["data[content]"]!=null&&window.postFormEditor.value(a["data[content]"]),f&&M0()}}o.addEventListener("input",l),o.addEventListener("change",l),window.postFormEditor&&window.postFormEditor.codemirror.on("change",l)}function _0(){var o=document.querySelector(".post-form-wrap"),l=document.querySelector(".post-form-wrap .notices.success, .post-form-wrap .notices.green");if(!(!o||!l)){var s=document.createElement("div");s.className="post-success";var a=document.createElement("p");a.className="post-success__title",a.textContent="\u2713 Saved to your journal.",s.appendChild(a);var f=document.createElement("div");f.className="post-success__actions";var h=o.getAttribute("data-trip-url");if(h){var c=document.createElement("a");c.className="post-success__view",c.href=h,c.textContent="View your journal \u2192",f.appendChild(c)}var d=document.createElement("a");d.className="post-success__again",d.href=window.location.pathname,d.textContent="Post another",f.appendChild(d),s.appendChild(f),l.parentNode.insertBefore(s,l.nextSibling),["form",".form-action-row","#location-status","#weather-status"].forEach(function(v){var y=o.querySelector(v);y&&(y.style.display="none")}),l.scrollIntoView({behavior:"smooth",block:"start"})}}var Yo=!1;function Bc(o){return new URLSearchParams(window.location.search).get(o)}function hr(o,l){var s=ft(o);s&&(s.value=l==null?"":String(l))}function Rl(o,l){var s=l?"1":"0",a=document.querySelectorAll('[name="data['+o+']"]');Array.prototype.forEach.call(a,function(f){f.checked=String(f.value)===s})}function z0(o){var l=o==null?"":String(o);if(window.postFormEditor&&typeof window.postFormEditor.value=="function")window.postFormEditor.value(l);else{var s=ft("content");s&&(s.value=l)}}function _c(o,l){var s=o.querySelectorAll("input, textarea, select, button");Array.prototype.forEach.call(s,function(a){a.type==="file"||a.name&&a.name.indexOf("data[photos")===0||(a.disabled=l)}),window.postFormEditor&&window.postFormEditor.codemirror&&window.postFormEditor.codemirror.setOption("readOnly",l?"nocursor":!1)}function Wl(o,l){o&&(o.tagName==="INPUT"?o.value=l:o.textContent=l)}function N0(o,l){var s=o.querySelector(".post-edit-error");if(s){s.textContent=l;return}var a=document.createElement("div");a.className="post-edit-error",a.setAttribute("role","alert"),a.textContent=l;var f=o.querySelector("h1");f?f.insertAdjacentElement("afterend",a):o.insertBefore(a,o.firstChild)}var O0=/\.(jpe?g|png|webp|heic|heif|gif)$/i;function zc(o){var l=/(?:^|\/)photo-0*(\d+)\./i.exec(o);return l?parseInt(l[1],10):Number.MAX_SAFE_INTEGER}function I0(o,l){var s=zc(o),a=zc(l);return s!==a?s-a:ol?1:0}function Nc(o,l){var s=String(o||"photo"),a=s.lastIndexOf("."),f=(a>0?s.slice(0,a):s).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"photo",h=l?".jpg":a>0?s.slice(a).toLowerCase():".jpg",c=Date.now().toString(36)+Math.random().toString(36).slice(2,6);return f+"-"+c+h}function H0(o){var l=document.querySelector('form[name="new-entry"]');if(!l||!o)return;var s=o.split("/").filter(Boolean).pop();if(!s)return;var a=document.querySelector(".filepond-root, .form-input-file"),f=a?a.closest(".form-field"):null;f&&(f.style.display="none");var h=l.querySelector(".photos-collapse");h&&(h.style.display="none");var c=document.createElement("div");c.className="photo-editor",c.innerHTML='
    Photos

    ',f&&f.parentNode?f.parentNode.insertBefore(c,f):l.insertBefore(c,l.firstElementChild);var d=c.querySelector(".photo-editor__grid"),v=c.querySelector(".photo-editor__status"),y=c.querySelector(".photo-editor__add"),x=c.querySelector(".photo-editor__input"),D=[],k=null,F=!1,B=0;function L(H,Y){v.textContent=H||"",v.className="photo-editor__status gpx-status"+(Y?" error":"")}function T(H){F=H,y.disabled=H,Array.prototype.forEach.call(d.querySelectorAll(".photo-editor__del, .photo-editor__confirm-yes, .photo-editor__confirm-no"),function(Y){Y.disabled=H}),k&&k.option("disabled",H)}function N(){return fetch("/api/v1/pages"+o+"/media",{credentials:"include",headers:{Accept:"application/json"}}).then(function(H){if(!H.ok)throw new Error("HTTP "+H.status);return H.json()}).then(function(H){return(H&&H.data||[]).filter(function(Y){return Y&&typeof Y.filename=="string"&&O0.test(Y.filename)}).map(function(Y){return Y.filename}).sort(I0)})}function z(H){return wn("/api/v1/entry/"+encodeURIComponent(s)+"/photos/order",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({order:H})})}function O(H){if(D=(H||[]).slice(),k&&(k.destroy(),k=null),d.innerHTML="",!D.length){d.innerHTML='

    No photos yet \u2014 add some.

    ';return}var Y=++B;D.forEach(function(E){var q=document.createElement("div");q.className="photo-editor__cell",q.setAttribute("data-filename",E);var R=document.createElement("img");R.className="photo-editor__img",R.loading="lazy",R.alt=E,R.src=o+"/"+encodeURIComponent(E)+"?v="+Y;var Q=document.createElement("button");Q.type="button",Q.className="photo-editor__del",Q.setAttribute("aria-label","Delete "+E),Q.textContent="\u2715",Q.addEventListener("click",function(){X(q,E)}),q.appendChild(R),q.appendChild(Q),d.appendChild(q)}),D.length>1&&(k=new Fc(d,{animation:150,draggable:".photo-editor__cell",filter:".photo-editor__confirm",onEnd:G}))}function I(){return Array.prototype.map.call(d.querySelectorAll(".photo-editor__cell"),function(H){return H.getAttribute("data-filename")})}function W(H,Y){if(H.length!==Y.length)return!1;for(var E=0;EDelete?',H.appendChild(E),H.classList.add("is-confirming"),E.querySelector(".photo-editor__confirm-no").addEventListener("click",function(){H.classList.remove("is-confirming"),E.remove()}),E.querySelector(".photo-editor__confirm-yes").addEventListener("click",function(){E.querySelector(".photo-editor__confirm-yes").disabled=!0,E.querySelector(".photo-editor__confirm-no").disabled=!0,de(Y)})}}function de(H){var Y=D.slice(),E=D.filter(function(q){return q!==H});T(!0),L("Deleting\u2026"),wn("/api/v1/pages"+o+"/media/"+encodeURIComponent(H),{method:"DELETE"},[204,404]).then(function(){return(E.length?z(E):Promise.resolve()).then(N).then(function(q){L(""),O(q)},function(){L("Photo deleted, but refreshing the list failed \u2014 reload if it looks off.",!0),O(E)})},function(q){L(Pl(q,"Couldn\u2019t delete that photo. Try again."),!0),O(Y)}).then(function(){T(!1)})}function j(H){return Ic(H).then(function(Y){return Y?import("./heic-to-CN7JBE7H.js").then(function(E){var q=E.heicTo||E.default&&E.default.heicTo;return q({blob:H,type:"image/jpeg",quality:.85})}).then(function(E){return{blob:E,name:Nc(H.name,!0)}}):{blob:H,name:Nc(H.name,!1)}})}y.addEventListener("click",function(){F||x.click()}),x.addEventListener("change",function(){var H=Array.prototype.slice.call(x.files||[]);x.value="",H.length&&oe(H)});function oe(H){T(!0);var Y=H.length,E=0,q=0,R=!1,Q=D.slice(),he=Promise.resolve();H.forEach(function(be){he=he.then(function(){return E++,L("Uploading "+E+" of "+Y+"\u2026"),j(be).then(function(Ee){var A=new FormData;return A.append("file",Ee.blob,Ee.name),wn("/api/v1/pages"+o+"/media",{method:"POST",body:A})}).then(null,function(Ee){q++,Ee&&(Ee.status===401||Ee.status===403)&&(R=!0)})})}),he.then(function(){return L("Finishing\u2026"),N()}).then(function(be){var Ee=Q.filter(function(te){return be.indexOf(te)!==-1}),A=be.filter(function(te){return Q.indexOf(te)===-1}),w=Ee.concat(A);return w.length?z(w).catch(function(){return z(w)}).catch(function(){return Promise.all(A.map(function(te){return wn("/api/v1/pages"+o+"/media/"+encodeURIComponent(te),{method:"DELETE"},[204,404]).then(function(){return!0},function(){return!1})})).then(function(te){var Ce=new Error("reorder failed");throw Ce.rolledBack=!0,Ce.rollbackIncomplete=te.indexOf(!1)!==-1,Ce})}).then(N):(O([]),null)}).then(function(be){be&&O(be),q?L(R?"Couldn\u2019t add photos \u2014 your login session expired. Sign in again, then retry.":q+" photo"+(q>1?"s":"")+" couldn\u2019t be added.",!0):L("")}).catch(function(be){var Ee;return be&&be.rolledBack?Ee=be.rollbackIncomplete?"Couldn\u2019t finish adding photos and cleanup was incomplete \u2014 reload the page and check your photos.":"Couldn\u2019t finish adding photos \u2014 changes were rolled back. Try again.":Ee="Couldn\u2019t add photos. Please try again.",L(Ee,!0),N().then(O,function(){O(Q)})}).then(function(){T(!1)})}d.innerHTML='

    Loading photos\u2026

    ',N().then(O).catch(function(){L("Couldn\u2019t load photos.",!0),O([])})}function P0(){var o=document.querySelector('form[name="new-entry"]'),l=document.querySelector(".post-form-wrap");if(!(!o||!l)){var s=Bc("edit");if(s){Yo=!0;var a=l.querySelector("h1");a&&(a.textContent="Edit entry");var f=o.querySelector('button[type="submit"], input[type="submit"]'),h=f?f.tagName==="INPUT"?f.value:f.textContent:"Save changes";_c(o,!0),Wl(f,"Loading entry\u2026");var c=Bc("return")||l.getAttribute("data-trip-url")||"";o.setAttribute("action","/post?edit="+encodeURIComponent(s)+(c?"&return="+encodeURIComponent(c):"")),fetch("/api/v1/pages"+s,{credentials:"include",headers:{Accept:"application/json"}}).then(function(d){if(!d.ok){var v=new Error("HTTP "+d.status);throw v.status=d.status,v}return d.json()}).then(function(d){var v=d&&d.data||{},y=v.header||{};hr("title",y.title!=null?y.title:v.title),hr("date",y.date?String(y.date).replace(" ","T"):""),z0(v.content),hr("lat",y.lat),hr("lng",y.lng),hr("location_city",y.location_city),hr("location_country",y.location_country),hr("weather_desc",y.weather_desc),hr("weather_temp_c",y.weather_temp_c),hr("transport_mode",y.transport_mode),Rl("featured",y.featured),Rl("force_connect",y.force_connect),Rl("published",y.published!==void 0?y.published:v.published);var x=ft("edit_path");x&&(x.value=s+"/entry.md"),_c(o,!1),Wl(f,"Save changes");var D=o.querySelector(".more-options");D&&(D.open=!0),H0(s)}).catch(function(d){var v=d&&d.status===404?"This entry no longer exists \u2014 it may have been deleted. Head back to the journal.":"Sorry \u2014 this entry couldn\u2019t be loaded for editing. Check your connection and try again.";N0(l,v),Wl(f,h)})}}}function Oc(){window.postFormEditor=v0(),_0(),P0(),B0(),w0(),C0(),k0(),A0(),T0()}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Oc):Oc(); /*! Bundled license information: sortablejs/modular/sortable.esm.js: diff --git a/themes/intotheeast/js/src/location-map.js b/themes/intotheeast/js/src/location-map.js new file mode 100644 index 0000000..73b1c42 --- /dev/null +++ b/themes/intotheeast/js/src/location-map.js @@ -0,0 +1,61 @@ +/* + * Single-marker, draggable preview map for the post form's "More location + * details" panel. A dedicated sibling to maplibre-utils.js's initEntryMap + * rather than an extension of it — that engine is built for multi-marker, + * GPX-drawing, popup-bearing read-only maps, none of which this preview + * needs (KTD1). + * + * maplibre-gl itself is lazy-imported on first call (KTD3) so an ordinary + * GPS-only submit, where the panel is never opened, never fetches it. The + * created map/marker are cached in module scope and reused on every + * subsequent call — see the panel's toggle-open handler in post-form.js, + * which calls this on every open and then always calls the returned + * handle's resize() (the container sits under display:none while the panel + * is closed, so the first paint would otherwise get a zero-size canvas). + */ +import { MAP_STYLE } from './map-style.js'; + +var cached = null; // { container, handle } + +function buildPinElement() { + var el = document.createElement('div'); + el.className = 'location-pin'; // visual styling lives in style.css + return el; +} + +export function getOrCreateLocationMap(container, onDragEnd) { + if (cached && cached.container === container) { + return Promise.resolve(cached.handle); + } + + return import('maplibre-gl').then(function (mod) { + var maplibregl = mod.default || mod; + var map = new maplibregl.Map({ + container: container, + style: MAP_STYLE, + center: [0, 20], + zoom: 2, + attributionControl: false + }); + map.addControl(new maplibregl.AttributionControl({ compact: true }), 'bottom-left'); + + var marker = new maplibregl.Marker({ draggable: true, element: buildPinElement() }); + var pinSet = false; // R12: no pin shown until a coordinate is first set + marker.on('dragend', function () { + if (onDragEnd) onDragEnd(marker.getLngLat()); + }); + + var handle = { + setPin: function (lat, lng) { + marker.setLngLat([lng, lat]); + if (!pinSet) { marker.addTo(map); pinSet = true; } + map.panTo([lng, lat]); + }, + hasPin: function () { return pinSet; }, + resize: function () { map.resize(); } + }; + + cached = { container: container, handle: handle }; + return handle; + }); +} diff --git a/themes/intotheeast/js/src/post-form.js b/themes/intotheeast/js/src/post-form.js index feaba15..7b3c1db 100644 --- a/themes/intotheeast/js/src/post-form.js +++ b/themes/intotheeast/js/src/post-form.js @@ -10,8 +10,12 @@ import EasyMDE from 'easymde'; import Sortable from 'sortablejs'; import 'easymde/dist/easymde.min.css'; +// maplibre-gl's CSS is a static import — a dynamically-imported chunk's CSS is +// never auto-linked (R10). The JS itself stays a lazy import (see location-map.js). +import 'maplibre-gl/dist/maplibre-gl.css'; import './post-form.css'; import { apiSend, apiErrorMsg } from './api-utils.js'; +import { getOrCreateLocationMap } from './location-map.js'; /* ── Markdown editor (EasyMDE) ───────────────────────────── */ function initEditor() { @@ -441,6 +445,10 @@ function initGeo() { setStatus(locStatus, '✓ Location captured · ' + lat + ', ' + lng, 'ok'); syncWeatherEnabled(); reverseGeocode(lat, lng); // fill City/Country in the background + // R11/KTD4: only push a live pin update if the panel is already + // open — otherwise the toggle-open handler syncs it on next open. + var openLocationDetails = document.querySelector('.location-details'); + if (openLocationDetails && openLocationDetails.open) syncPinFromFields(); }, function (err) { locBtn.classList.remove('is-loading'); locBtn.disabled = false; @@ -480,6 +488,239 @@ function initGeo() { } } +/* ── "More location details" panel (U2-U5) ───────────────────── + * Closed-by-default disclosure holding a city/country search-by-lookup, a + * single-marker MapLibre preview (lazy-loaded, see location-map.js — KTD1/ + * KTD3), and the relocated lat/lng fields. Built entirely in JS (KTD6), + * mirroring initDisclosure()'s create-via-JS + relocate-wrapper approach, so + * the template needs no structural change. + * + * Exposed at module scope (reassigned once the panel exists) so initGeo()'s + * GPS success handler — defined earlier in this file, but only invoked later + * on user click, after boot() has run initLocationDetails() — can push a live + * pin update when the panel is already open (KTD4). + */ +var syncPinFromFields = function () {}; // no-op until the panel initializes + +function debounce(fn, ms) { + var t = null; + return function () { + var args = arguments; + clearTimeout(t); + t = setTimeout(function () { fn.apply(null, args); }, ms); + }; +} + +function geocodeResultLabel(r) { + return [r.name, r.admin1, r.country].filter(Boolean).join(', '); +} + +function initLocationDetails() { + var latEl = field('lat'); + var lngEl = field('lng'); + if (!latEl || !lngEl) return; // no-op guard: fields absent from the DOM + var latWrap = latEl.closest('.form-field'); + var lngWrap = lngEl.closest('.form-field'); + if (!latWrap || !lngWrap) return; + + var cityEl = field('location_city'); + var countryEl = field('location_country'); + var countryWrap = countryEl ? countryEl.closest('.form-field') : null; + var anchor = countryWrap || latWrap; + + // ── Shell (U2, R1-R3, KTD6) ── + var details = document.createElement('details'); + details.className = 'location-details'; + var summary = document.createElement('summary'); + summary.className = 'location-details__summary'; + summary.textContent = 'More location details'; + details.appendChild(summary); + + var body = document.createElement('div'); + body.className = 'location-details__body'; + + var searchRow = document.createElement('div'); + searchRow.className = 'location-search-row'; + var lookupBtn = document.createElement('button'); + lookupBtn.type = 'button'; + lookupBtn.id = 'lookup-coords'; + lookupBtn.className = 'btn-action'; + var LOOKUP_LABEL = '🔍 Look up coordinates'; + lookupBtn.textContent = LOOKUP_LABEL; + searchRow.appendChild(lookupBtn); + body.appendChild(searchRow); + + var hint = document.createElement('p'); + hint.id = 'location-search-hint'; + hint.className = 'location-search-hint'; + hint.setAttribute('role', 'status'); + body.appendChild(hint); + + var results = document.createElement('ul'); + results.id = 'location-search-results'; + results.className = 'location-search-results'; + body.appendChild(results); + + var mapContainer = document.createElement('div'); + mapContainer.id = 'location-map'; + mapContainer.className = 'location-map'; + body.appendChild(mapContainer); + + details.appendChild(body); + + anchor.parentNode.insertBefore(details, anchor.nextSibling); + details.appendChild(latWrap); + details.appendChild(lngWrap); + + // ── Mismatch flag (U5, R11/R13) ── + function fieldNoteId(el) { return el === latEl ? 'location-lat-note' : 'location-lng-note'; } + + function setMismatch() { + [latEl, lngEl].forEach(function (el) { + el.classList.add('location-field--mismatch'); + el.setAttribute('aria-invalid', 'true'); + var id = fieldNoteId(el); + var note = document.getElementById(id); + if (!note) { + note = document.createElement('span'); + note.id = id; + note.className = 'location-field-note'; + note.setAttribute('role', 'status'); + note.setAttribute('aria-live', 'polite'); + note.textContent = 'Not reflected on the map yet.'; + el.parentNode.insertBefore(note, el.nextSibling); + } + el.setAttribute('aria-describedby', id); + }); + } + + function clearMismatch() { + [latEl, lngEl].forEach(function (el) { + el.classList.remove('location-field--mismatch'); + el.removeAttribute('aria-invalid'); + el.removeAttribute('aria-describedby'); + var note = document.getElementById(fieldNoteId(el)); + if (note && note.parentNode) note.parentNode.removeChild(note); + }); + } + + // ── Map + sync (U4, U5, R9-R14, KTD1/KTD3/KTD4) ── + var mapHandle = null; + + function syncFields() { + var lat = parseFloat(latEl.value); + var lng = parseFloat(lngEl.value); + var valid = isFinite(lat) && isFinite(lng) && + lat >= -90 && lat <= 90 && lng >= -180 && lng <= 180; + if (valid) { + clearMismatch(); + if (mapHandle) mapHandle.setPin(lat, lng); + } else if (latEl.value.trim() || lngEl.value.trim()) { + // Only flag once the traveller has actually typed something — + // fresh blank fields are "no pin yet" (R12), not a mismatch. + setMismatch(); + } + } + syncPinFromFields = syncFields; // expose for initGeo()'s GPS handler + + function onDragEnd(lngLat) { + // Drag writes straight into the fields; it does not call syncFields() + // back, avoiding a feedback loop (KTD4). + latEl.value = lngLat.lat.toFixed(6); + lngEl.value = lngLat.lng.toFixed(6); + clearMismatch(); + } + + details.addEventListener('toggle', function () { + if (!details.open) return; + getOrCreateLocationMap(mapContainer, onDragEnd).then(function (handle) { + mapHandle = handle; + handle.resize(); // fixes the zero-size canvas from painting while display:none + syncFields(); + }); + }); + + latEl.addEventListener('blur', syncFields); + lngEl.addEventListener('blur', syncFields); + var debouncedSync = debounce(syncFields, 400); + latEl.addEventListener('input', debouncedSync); + lngEl.addEventListener('input', debouncedSync); + + // ── Search (U3, R4-R8, KTD2) ── + function setHint(msg) { hint.textContent = msg || ''; } + + function hideResults() { results.innerHTML = ''; } + + function showResults(list) { + list.forEach(function (r) { + var li = document.createElement('li'); + var btn = document.createElement('button'); + btn.type = 'button'; + btn.textContent = geocodeResultLabel(r); // createElement + textContent — no innerHTML for API data (R7) + btn.addEventListener('click', function () { + latEl.value = Number(r.latitude).toFixed(6); + lngEl.value = Number(r.longitude).toFixed(6); + hideResults(); + syncFields(); // R7: sets lat/lng + pin only — never writes City/Country + }); + li.appendChild(btn); + results.appendChild(li); + }); + } + + lookupBtn.addEventListener('click', function () { + hideResults(); + var city = cityEl ? cityEl.value.trim() : ''; + var country = countryEl ? countryEl.value.trim() : ''; + if (!city && !country) { + setHint('Enter a city or country first.'); + return; + } + // R4: never concatenate Country into the query string — verified live, + // it silently breaks disambiguation (e.g. "Paris, Texas"). Query by + // City; Country only ranks results client-side, and is the query term + // only as a fallback when City itself is blank. + var query = city || country; + setHint(''); + lookupBtn.disabled = true; + lookupBtn.textContent = 'Searching…'; + var url = 'https://geocoding-api.open-meteo.com/v1/search?name=' + + encodeURIComponent(query) + '&count=10&language=en&format=json'; + fetch(url).then(function (r) { return r.json(); }).then(function (data) { + var list = (data && data.results) || []; + if (!list.length) { + setHint('No matches — try adding a country, or drag the pin on the map.'); + return; + } + if (country) { + var needle = country.toLowerCase(); + // Match against admin1 (state/region — e.g. "Texas") as well as + // country ("United States"): Open-Meteo's `country` field alone + // never reflects a state/province, so a Country field typed as + // "Texas" would never rank the Texas Paris above the other + // US-state Paris matches without also checking admin1 (verified + // live — see the design doc's Paris/Texas disambiguation case). + var matches = function (r) { + return (r.admin1 || '').toLowerCase().indexOf(needle) !== -1 || + (r.country || '').toLowerCase().indexOf(needle) !== -1; + }; + list = list.slice().sort(function (a, b) { + var am = matches(a); + var bm = matches(b); + if (am === bm) return 0; + return am ? -1 : 1; + }); + } + showResults(list); + }).catch(function () { + // R8: network failure degrades silently — fields untouched. + }).then(function () { + lookupBtn.disabled = false; + lookupBtn.textContent = LOOKUP_LABEL; + }); + }); +} + /* ── Blocking required-field validation (U5, R19) ───────────── * Replaces the template's inline validator. Reads the EasyMDE-synced content * value (initEditor keeps the textarea current) and shows per-field messages. @@ -1206,6 +1447,7 @@ function boot() { initPhotoConversion(); initDisclosure(); initGeo(); + initLocationDetails(); initValidation(); } From 13c76b29a840e8082427e2e29c7cdaeb1ef895b6 Mon Sep 17 00:00:00 2001 From: Mischa Date: Fri, 24 Jul 2026 20:03:01 +0200 Subject: [PATCH 4/8] fix(post): close location-map race, block submit on bad coords Code review (4 independent reviewers) converged on the same bug: the maplibre-gl singleton cached its handle only after import() resolved, so a fast close/reopen of the "More location details" panel could race two Map instances onto one container. Cache the in-flight promise synchronously instead, and propagate/handle import rejection so a failed map load surfaces a hint instead of hanging silently. Also closes a submit-time hole the adversarial pass found: the mismatch flag on lat/lng was purely cosmetic and never blocked form submission, so out-of-range coordinates could be saved. The flag now gates submit like the other required fields, and clears itself when both fields are blanked back out instead of sticking. The geocode fetch gets a 10s timeout via AbortController so a hung response can't leave the lookup button disabled forever. Also moves the location-details CSS out of the site-wide style.css into post-form's own code-split stylesheet, since none of it is used outside the post form. Co-Authored-By: Claude Sonnet 5 --- themes/intotheeast/css-compiled/post-form.css | 2 +- themes/intotheeast/css/style.css | 104 ------------------ themes/intotheeast/js/post/post-form.js | 76 ++++++------- themes/intotheeast/js/src/location-map.js | 27 +++-- themes/intotheeast/js/src/post-form.css | 104 ++++++++++++++++++ themes/intotheeast/js/src/post-form.js | 23 +++- 6 files changed, 184 insertions(+), 152 deletions(-) diff --git a/themes/intotheeast/css-compiled/post-form.css b/themes/intotheeast/css-compiled/post-form.css index bc07458..ff1d200 100644 --- a/themes/intotheeast/css-compiled/post-form.css +++ b/themes/intotheeast/css-compiled/post-form.css @@ -1,4 +1,4 @@ -.CodeMirror{font-family:monospace;height:300px;color:#000;direction:ltr}.CodeMirror-lines{padding:4px 0}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}.CodeMirror-guttermarker{color:#000}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror-cursor{border-left:1px solid #000;border-right:none;width:0}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.cm-fat-cursor .CodeMirror-cursor{width:auto;border:0!important;background:#7e7}.cm-fat-cursor div.CodeMirror-cursors{z-index:1}.cm-fat-cursor .CodeMirror-line::selection,.cm-fat-cursor .CodeMirror-line>span::selection,.cm-fat-cursor .CodeMirror-line>span>span::selection{background:0 0}.cm-fat-cursor .CodeMirror-line::-moz-selection,.cm-fat-cursor .CodeMirror-line>span::-moz-selection,.cm-fat-cursor .CodeMirror-line>span>span::-moz-selection{background:0 0}.cm-fat-cursor{caret-color:transparent}@-moz-keyframes blink{50%{background-color:transparent}}@-webkit-keyframes blink{50%{background-color:transparent}}@keyframes blink{50%{background-color:transparent}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-rulers{position:absolute;inset:-50px 0 0;overflow:hidden}.CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;position:absolute}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:700}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-strikethrough{text-decoration:line-through}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-type,.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta,.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-s-default .cm-error,.cm-invalidchar{color:red}.CodeMirror-composing{border-bottom:2px solid}div.CodeMirror span.CodeMirror-matchingbracket{color:#0b0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#a22}.CodeMirror-matchingtag{background:#ff96004d}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{position:relative;overflow:hidden;background:#fff}.CodeMirror-scroll{overflow:scroll!important;margin-bottom:-50px;margin-right:-50px;padding-bottom:50px;height:100%;outline:0;position:relative;z-index:0}.CodeMirror-sizer{position:relative;border-right:50px solid transparent}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none;outline:0}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;min-height:100%;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;vertical-align:top;margin-bottom:-50px}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;background:0 0!important;border:none!important}.CodeMirror-gutter-background{position:absolute;top:0;bottom:0;z-index:4}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-gutter-wrapper ::selection{background-color:transparent}.CodeMirror-gutter-wrapper ::-moz-selection{background-color:transparent}.CodeMirror-lines{cursor:text;min-height:1px}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent;-webkit-font-variant-ligatures:contextual;font-variant-ligatures:contextual}.CodeMirror-wrap pre.CodeMirror-line,.CodeMirror-wrap pre.CodeMirror-line-like{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-linebackground{position:absolute;inset:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;padding:.1px}.CodeMirror-code{outline:0}.CodeMirror-gutter,.CodeMirror-gutters,.CodeMirror-linenumber,.CodeMirror-scroll,.CodeMirror-sizer{-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-cursor{position:absolute;pointer-events:none}.CodeMirror-measure pre{position:static}div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}div.CodeMirror-dragcursors,.CodeMirror-focused div.CodeMirror-cursors{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.CodeMirror-line::selection,.CodeMirror-line>span::selection,.CodeMirror-line>span>span::selection{background:#d7d4f0}.CodeMirror-line::-moz-selection,.CodeMirror-line>span::-moz-selection,.CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}.cm-searching{background-color:#ffa;background-color:#ff06}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:""}span.CodeMirror-selectedtext{background:0 0}.EasyMDEContainer{display:block}.CodeMirror-rtl pre{direction:rtl}.EasyMDEContainer.sided--no-fullscreen{display:flex;flex-direction:row;flex-wrap:wrap}.EasyMDEContainer .CodeMirror{box-sizing:border-box;height:auto;border:1px solid #ced4da;border-bottom-left-radius:4px;border-bottom-right-radius:4px;padding:10px;font:inherit;z-index:0;word-wrap:break-word}.EasyMDEContainer .CodeMirror-scroll{cursor:text}.EasyMDEContainer .CodeMirror-fullscreen{background:#fff;position:fixed!important;inset:50px 0 0;height:auto;z-index:8;border-right:none!important;border-bottom-right-radius:0!important}.EasyMDEContainer .CodeMirror-sided{width:50%!important}.EasyMDEContainer.sided--no-fullscreen .CodeMirror-sided{border-right:none!important;border-bottom-right-radius:0;position:relative;flex:1 1 auto}.EasyMDEContainer .CodeMirror-placeholder{opacity:.5}.EasyMDEContainer .CodeMirror-focused .CodeMirror-selected{background:#d9d9d9}.editor-toolbar{position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;padding:9px 10px;border-top:1px solid #ced4da;border-left:1px solid #ced4da;border-right:1px solid #ced4da;border-top-left-radius:4px;border-top-right-radius:4px}.editor-toolbar.fullscreen{width:100%;height:50px;padding-top:10px;padding-bottom:10px;box-sizing:border-box;background:#fff;border:0;position:fixed;top:0;left:0;opacity:1;z-index:9}.editor-toolbar.fullscreen:before{width:20px;height:50px;background:-moz-linear-gradient(left,#fff 0,rgba(255,255,255,0) 100%);background:-webkit-gradient(linear,left top,right top,color-stop(0,#fff),color-stop(100%,rgba(255,255,255,0)));background:-webkit-linear-gradient(left,#fff 0,rgba(255,255,255,0) 100%);background:-o-linear-gradient(left,#fff 0,rgba(255,255,255,0) 100%);background:-ms-linear-gradient(left,#fff 0,rgba(255,255,255,0) 100%);background:linear-gradient(to right,#fff 0,#fff0);position:fixed;top:0;left:0;margin:0;padding:0}.editor-toolbar.fullscreen:after{width:20px;height:50px;background:-moz-linear-gradient(left,rgba(255,255,255,0) 0,#fff 100%);background:-webkit-gradient(linear,left top,right top,color-stop(0,rgba(255,255,255,0)),color-stop(100%,#fff));background:-webkit-linear-gradient(left,rgba(255,255,255,0) 0,#fff 100%);background:-o-linear-gradient(left,rgba(255,255,255,0) 0,#fff 100%);background:-ms-linear-gradient(left,rgba(255,255,255,0) 0,#fff 100%);background:linear-gradient(to right,#fff0 0,#fff);position:fixed;top:0;right:0;margin:0;padding:0}.EasyMDEContainer.sided--no-fullscreen .editor-toolbar{width:100%}.editor-toolbar .easymde-dropdown,.editor-toolbar button{background:0 0;display:inline-block;text-align:center;text-decoration:none!important;height:30px;margin:0;padding:0;border:1px solid transparent;border-radius:3px;cursor:pointer}.editor-toolbar button{font-weight:700;min-width:30px;padding:0 6px;white-space:nowrap}.editor-toolbar button.active,.editor-toolbar button:hover{background:#fcfcfc;border-color:#95a5a6}.editor-toolbar i.separator{display:inline-block;width:0;border-left:1px solid #d9d9d9;border-right:1px solid #fff;color:transparent;text-indent:-10px;margin:0 6px}.editor-toolbar button:after{font-family:Arial,Helvetica Neue,Helvetica,sans-serif;font-size:65%;vertical-align:text-bottom;position:relative;top:2px}.editor-toolbar button.heading-1:after{content:"1"}.editor-toolbar button.heading-2:after{content:"2"}.editor-toolbar button.heading-3:after{content:"3"}.editor-toolbar button.heading-bigger:after{content:"\25b2"}.editor-toolbar button.heading-smaller:after{content:"\25bc"}.editor-toolbar.disabled-for-preview button:not(.no-disable){opacity:.6;pointer-events:none}@media only screen and (max-width:700px){.editor-toolbar i.no-mobile{display:none}}.editor-statusbar{padding:8px 10px;font-size:12px;color:#959694;text-align:right}.EasyMDEContainer.sided--no-fullscreen .editor-statusbar{width:100%}.editor-statusbar span{display:inline-block;min-width:4em;margin-left:1em}.editor-statusbar .lines:before{content:"lines: "}.editor-statusbar .words:before{content:"words: "}.editor-statusbar .characters:before{content:"characters: "}.editor-preview-full{position:absolute;width:100%;height:100%;top:0;left:0;z-index:7;overflow:auto;display:none;box-sizing:border-box}.editor-preview-side{position:fixed;bottom:0;width:50%;top:50px;right:0;z-index:9;overflow:auto;display:none;box-sizing:border-box;border:1px solid #ddd;word-wrap:break-word}.editor-preview-active-side{display:block}.EasyMDEContainer.sided--no-fullscreen .editor-preview-active-side{flex:1 1 auto;height:auto;position:static}.editor-preview-active{display:block}.editor-preview{padding:10px;background:#fafafa}.editor-preview>p{margin-top:0}.editor-preview pre{background:#eee;margin-bottom:10px}.editor-preview table td,.editor-preview table th{border:1px solid #ddd;padding:5px}.cm-s-easymde .cm-tag{color:#63a35c}.cm-s-easymde .cm-attribute{color:#795da3}.cm-s-easymde .cm-string{color:#183691}.cm-s-easymde .cm-header-1{font-size:calc(1.375rem + 1.5vw)}.cm-s-easymde .cm-header-2{font-size:calc(1.325rem + .9vw)}.cm-s-easymde .cm-header-3{font-size:calc(1.3rem + .6vw)}.cm-s-easymde .cm-header-4{font-size:calc(1.275rem + .3vw)}.cm-s-easymde .cm-header-5{font-size:1.25rem}.cm-s-easymde .cm-header-6{font-size:1rem}.cm-s-easymde .cm-header-1,.cm-s-easymde .cm-header-2,.cm-s-easymde .cm-header-3,.cm-s-easymde .cm-header-4,.cm-s-easymde .cm-header-5,.cm-s-easymde .cm-header-6{margin-bottom:.5rem;line-height:1.2}.cm-s-easymde .cm-comment{background:#0000000d;border-radius:2px}.cm-s-easymde .cm-link{color:#7f8c8d}.cm-s-easymde .cm-url{color:#aab2b3}.cm-s-easymde .cm-quote{color:#7f8c8d;font-style:italic}.editor-toolbar .easymde-dropdown{position:relative;background:linear-gradient(to bottom right,#fff 0 84%,#333 50% 100%);border-radius:0;border:1px solid #fff}.editor-toolbar .easymde-dropdown:hover{background:linear-gradient(to bottom right,#fff 0 84%,#333 50% 100%)}.easymde-dropdown-content{display:block;visibility:hidden;position:absolute;background-color:#f9f9f9;box-shadow:0 8px 16px #0003;padding:8px;z-index:2;top:30px}.easymde-dropdown:active .easymde-dropdown-content,.easymde-dropdown:focus .easymde-dropdown-content,.easymde-dropdown:focus-within .easymde-dropdown-content{visibility:visible}.easymde-dropdown-content button{display:block}span[data-img-src]:after{content:"";background-image:var(--bg-image);display:block;max-height:100%;max-width:100%;background-size:contain;height:0;padding-top:var(--height);width:var(--width);background-repeat:no-repeat}.CodeMirror .cm-spell-error:not(.cm-url):not(.cm-comment):not(.cm-tag):not(.cm-word){background:#ff000026}.maplibregl-map{font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative;-webkit-tap-highlight-color:rgb(0 0 0/0)}.maplibregl-canvas{left:0;position:absolute;top:0}.maplibregl-map:fullscreen{height:100%;width:100%}.maplibregl-ctrl-group button.maplibregl-ctrl-compass{touch-action:none}.maplibregl-canvas-container.maplibregl-interactive,.maplibregl-ctrl-group button.maplibregl-ctrl-compass{cursor:grab;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:grabbing}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.maplibregl-ctrl-top-left{left:0;top:0}.maplibregl-ctrl-top-right{right:0;top:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{bottom:0;right:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{float:left;margin:10px 0 0 10px}.maplibregl-ctrl-top-right .maplibregl-ctrl{float:right;margin:10px 10px 0 0}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{float:left;margin:0 0 10px 10px}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{float:right;margin:0 10px 10px 0}.maplibregl-ctrl-group{background:#fff;border-radius:4px}.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px #0000001a}@media (forced-colors:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.maplibregl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;padding:0;width:29px}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (forced-colors:active){.maplibregl-ctrl-icon{background-color:transparent}.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl button:disabled{cursor:not-allowed}.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}.maplibregl-ctrl button:not(:disabled):hover{background-color:#0000000d}.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.maplibregl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.maplibregl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.maplibregl-ctrl-group button:focus:only-child{border-radius:inherit}.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%23333' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%2333b5e5' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23aaa' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{animation:maplibregl-spin 2s linear infinite}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23999' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23666' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}}@keyframes maplibregl-spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E");background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (forced-colors:active){a.maplibregl-ctrl-logo{background-color:transparent;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}.maplibregl-ctrl.maplibregl-ctrl-attrib{background-color:#ffffff80;margin:0;padding:0 5px}@media screen{.maplibregl-ctrl-attrib.maplibregl-compact{background-color:#fff;border-radius:12px;box-sizing:content-box;color:#000;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.maplibregl-ctrl-attrib-button{background-color:#ffffff80;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E");border:0;border-radius:12px;box-sizing:border-box;cursor:pointer;display:none;height:24px;outline:none;position:absolute;right:0;top:0;width:24px}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button{-webkit-appearance:none;-moz-appearance:none;appearance:none;list-style:none}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker{display:none}.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button{left:0}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner{display:block}.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button{background-color:#0000000d}.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{right:0;top:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{left:0;top:0}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (forced-colors:active){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%23fff' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}@media screen and (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}.maplibregl-ctrl-attrib a{color:#000000bf;text-decoration:none}.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.maplibregl-attrib-empty{display:none}.maplibregl-ctrl-scale{background-color:#ffffffbf;border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px}.maplibregl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.maplibregl-popup-anchor-top,.maplibregl-popup-anchor-top-left,.maplibregl-popup-anchor-top-right{flex-direction:column}.maplibregl-popup-anchor-bottom,.maplibregl-popup-anchor-bottom-left,.maplibregl-popup-anchor-bottom-right{flex-direction:column-reverse}.maplibregl-popup-anchor-left{flex-direction:row}.maplibregl-popup-anchor-right{flex-direction:row-reverse}.maplibregl-popup-tip{border:10px solid transparent;height:0;width:0;z-index:1}.maplibregl-popup-anchor-top .maplibregl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.maplibregl-popup-anchor-left .maplibregl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.maplibregl-popup-anchor-right .maplibregl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}.maplibregl-popup-close-button{background-color:transparent;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.maplibregl-popup-close-button:hover{background-color:#0000000d}.maplibregl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px #0000001a;padding:15px 10px;pointer-events:auto;position:relative}.maplibregl-popup-anchor-top-left .maplibregl-popup-content{border-top-left-radius:0}.maplibregl-popup-anchor-top-right .maplibregl-popup-content{border-top-right-radius:0}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-content{border-bottom-left-radius:0}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-content{border-bottom-right-radius:0}.maplibregl-popup-track-pointer{display:none}.maplibregl-popup-track-pointer *{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-map:hover .maplibregl-popup-track-pointer{display:flex}.maplibregl-map:active .maplibregl-popup-track-pointer{display:none}.maplibregl-marker{left:0;position:absolute;top:0;transition:opacity .2s;will-change:transform}.maplibregl-user-location-dot,.maplibregl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.maplibregl-user-location-dot:before{animation:maplibregl-user-location-dot-pulse 2s infinite;content:"";position:absolute}.maplibregl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px #00000059;box-sizing:border-box;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px}@keyframes maplibregl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.maplibregl-user-location-dot-stale{background-color:#aaa}.maplibregl-user-location-dot-stale:after{display:none}.maplibregl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.maplibregl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}.maplibregl-cooperative-gesture-screen{align-items:center;background:#0006;color:#fff;display:flex;font-size:1.4em;inset:0;justify-content:center;line-height:1.2;opacity:0;padding:1rem;pointer-events:none;position:absolute;transition:opacity 1s ease 1s;z-index:99999}.maplibregl-cooperative-gesture-screen.maplibregl-show{opacity:1;transition:opacity .05s}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:none}@media (hover:none),(width <= 480px){.maplibregl-cooperative-gesture-screen .maplibregl-desktop-message{display:none}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:block}}.maplibregl-pseudo-fullscreen{height:100%!important;left:0!important;position:fixed!important;top:0!important;width:100%!important;z-index:99999}.post-edit-error{margin:1rem 0;padding:.75rem 1rem;border:1px solid #E5786A;border-radius:8px;background:#e5786a1f;color:#e5786a;font-size:.9rem;line-height:1.4}.editor-toolbar .mde-btn:before{font-style:normal;font-weight:400;font-family:inherit}.editor-toolbar .mde-bold:before{content:"B";font-weight:700}.editor-toolbar .mde-italic:before{content:"I";font-style:italic}.editor-toolbar .mde-ul:before{content:"\2022\2002\2014"}.editor-toolbar .mde-link:before{content:"\1f517"}.editor-toolbar .mde-preview:before{content:"\1f441"}.EasyMDEContainer .CodeMirror{min-height:180px}.photo-convert-status:empty{display:none}.photo-convert-status{font-size:var(--text-sm);margin-top:var(--space-2)}.photo-reauth-hint{display:none;font-size:var(--text-sm);color:var(--color-ink-muted);margin-top:var(--space-2)}.photo-reauth-hint.is-shown{display:block}.post-form-wrap select{width:100%;font-family:var(--font-ui);font-size:var(--text-base);padding:.875rem 2.5rem .875rem 1rem;min-height:44px;border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-canvas);color:var(--color-ink);-webkit-appearance:none;appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2390887E' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 1rem center}.post-form-wrap select:focus{outline:2px solid var(--color-accent);outline-offset:1px;border-color:var(--color-accent)}.post-form-wrap input[type=number]{width:100%;font-family:var(--font-ui);font-size:var(--text-base);padding:.875rem 1rem;min-height:44px;border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-canvas);color:var(--color-ink);-webkit-appearance:none;appearance:none}.post-form-wrap input[type=number]:focus{outline:2px solid var(--color-accent);outline-offset:1px;border-color:var(--color-accent)}.more-options{margin-bottom:var(--space-5);border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-canvas)}.more-options__summary{cursor:pointer;padding:.875rem 1rem;min-height:44px;display:flex;align-items:center;font-family:var(--font-ui);font-size:var(--text-sm);font-weight:600;color:var(--color-ink);list-style:none;user-select:none}.more-options__summary::-webkit-details-marker{display:none}.more-options__summary:before{content:"\25b8";margin-right:var(--space-2);color:var(--color-ink-muted);transition:transform .15s}.more-options[open] .more-options__summary:before{transform:rotate(90deg)}.more-options[open] .more-options__summary{border-bottom:1px solid var(--color-border)}.more-options>.form-field{padding:0 1rem}.more-options>.form-field:first-of-type{padding-top:var(--space-4)}.more-options>.form-field:last-child{padding-bottom:var(--space-4);margin-bottom:0}.btn-action.is-loading{position:relative;color:transparent;pointer-events:none}.btn-action.is-loading:after{content:"";position:absolute;top:50%;left:50%;width:16px;height:16px;margin:-8px 0 0 -8px;border:2px solid var(--color-ink-muted);border-top-color:var(--color-accent);border-radius:50%;animation:post-spin .7s linear infinite}.btn-action[disabled]{opacity:.5;cursor:not-allowed}@keyframes post-spin{to{transform:rotate(360deg)}}.post-form-wrap .notices{padding:1rem 1.1rem;border-radius:var(--radius-md);font-size:var(--text-base);margin:0 0 var(--space-5);background:var(--color-canvas);color:var(--color-ink);border-left:4px solid var(--color-accent)}.post-form-wrap .notices p{margin:0}.post-form-wrap .notices.error,.post-form-wrap .notices.red{border-left-color:var(--color-error)}.post-form-wrap .notices.success,.post-form-wrap .notices.green{border-left-color:var(--color-accent)}.post-success{margin:0 0 var(--space-5);padding:1.1rem;border-radius:var(--radius-md);background:var(--color-accent-light);border:1px solid var(--color-accent)}.post-success__title{font-family:var(--font-ui);font-size:var(--text-md);font-weight:600;color:var(--color-ink);margin:0 0 var(--space-3)}.post-success__actions{display:flex;flex-wrap:wrap;gap:var(--space-3)}.post-success__view{flex:1;min-width:140px;text-align:center;padding:.8rem 1rem;min-height:44px;border-radius:var(--radius-md);background:var(--color-accent);color:var(--color-accent-on);font-weight:600;text-decoration:none}.post-success__again{flex:1;min-width:140px;text-align:center;padding:.8rem 1rem;min-height:44px;border-radius:var(--radius-md);background:transparent;color:var(--color-ink);border:1px solid var(--color-border);font-weight:600;text-decoration:none}.filepond--credits{display:none!important}.filepond--root{font-family:var(--font-ui);font-size:var(--text-base)}.filepond--panel-root{background-color:var(--color-canvas);border:1px solid var(--color-border);border-radius:var(--radius-md)}.filepond--drop-label,.filepond--drop-label label{color:var(--color-ink-muted)}.filepond--label-action{color:var(--color-accent);text-decoration-color:var(--color-accent)}.filepond--item-panel{background-color:var(--color-surface-raised);border-radius:var(--radius-md)}.filepond--drip-blob{background-color:var(--color-accent)}.filepond--file{color:var(--color-ink)}.filepond--file-action-button{color:var(--color-ink);background-color:#00000073}.filepond--file-action-button:hover{background-color:#000000a6}.filepond--image-preview-overlay{display:none!important}.filepond--item[data-filepond-item-state=processing-complete] .filepond--file-info,.filepond--item[data-filepond-item-state=processing-complete] .filepond--file-status{opacity:0}.filepond--item[data-filepond-item-state=processing-complete]:after{content:"\2713";position:absolute;top:8px;right:8px;z-index:5;width:24px;height:24px;line-height:24px;text-align:center;border-radius:50%;background:var(--color-accent);color:#fff;font-size:15px;font-weight:700;box-shadow:0 1px 3px #00000059;pointer-events:none}.filepond--list.filepond--list{margin:.25rem}.filepond--item{width:calc(33.333% - .5rem)}.filepond--item .filepond--panel-root,.filepond--item .filepond--image-preview-wrapper{border-radius:var(--radius-sm)}.filepond--image-preview,.filepond--image-preview-wrapper,.filepond--image-clip,.filepond--image-preview canvas,.filepond--image-bitmap,.filepond--file img{-webkit-user-drag:none;-khtml-user-drag:none;user-drag:none}.filepond--item[data-filepond-item-state=idle] .filepond--file-info,.filepond--item[data-filepond-item-state=idle] .filepond--file-status{opacity:0}.photos-collapse{margin-bottom:var(--space-5);border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-canvas)}.photos-collapse__summary{cursor:pointer;padding:.875rem 1rem;min-height:44px;display:flex;align-items:center;font-family:var(--font-ui);font-size:var(--text-sm);font-weight:600;color:var(--color-ink);list-style:none;user-select:none}.photos-collapse__summary::-webkit-details-marker{display:none}.photos-collapse__summary:before{content:"\25b8";margin-right:var(--space-2);color:var(--color-ink-muted);transition:transform .15s}.photos-collapse[open] .photos-collapse__summary:before{transform:rotate(90deg)}.photos-collapse[open] .photos-collapse__summary{border-bottom:1px solid var(--color-border)}.photos-collapse>:not(summary){padding-left:1rem;padding-right:1rem}.photos-collapse[open] .filepond--root,.photos-collapse[open] .filepond-root{margin:var(--space-4) 0}.photos-collapse[open]>.photo-convert-status:last-child,.photos-collapse[open]>.photo-reauth-hint:last-child{padding-bottom:var(--space-4)}.EasyMDEContainer .CodeMirror{background:var(--color-canvas);color:var(--color-ink);border:1px solid var(--color-border);border-radius:0 0 var(--radius-md) var(--radius-md);font-family:var(--font-ui);font-size:var(--text-base);line-height:var(--leading-normal);padding:var(--space-1)}.EasyMDEContainer .CodeMirror-cursor{border-color:var(--color-ink)}.EasyMDEContainer .CodeMirror-selected{background:var(--color-accent-light)!important}.EasyMDEContainer .editor-toolbar{background:var(--color-surface-raised);border:1px solid var(--color-border);border-bottom:none;border-radius:var(--radius-md) var(--radius-md) 0 0;opacity:1}.EasyMDEContainer .editor-toolbar button{color:var(--color-ink)!important;min-width:34px;height:34px}.EasyMDEContainer .editor-toolbar button:hover,.EasyMDEContainer .editor-toolbar button.active{background:var(--color-accent-light);border-color:var(--color-border)}.EasyMDEContainer .editor-toolbar i.separator{border-color:var(--color-border)}.EasyMDEContainer .editor-preview,.EasyMDEContainer .editor-preview-side{background:var(--color-canvas);color:var(--color-ink)}.EasyMDEContainer .editor-preview a{color:var(--color-accent)}.photo-editor{margin-bottom:var(--space-5)}.photo-editor__head{display:flex;align-items:center;justify-content:space-between;gap:var(--space-3);margin-bottom:var(--space-2)}.photo-editor__label{font-family:var(--font-ui);font-size:var(--text-base);font-weight:600;color:var(--color-ink)}.photo-editor__add{font-family:var(--font-ui);font-size:var(--text-sm);background:var(--color-accent);color:#fff;border:none;border-radius:var(--radius-sm);padding:var(--space-2) var(--space-4);cursor:pointer}.photo-editor__add:disabled{opacity:.5;cursor:default}.photo-editor__status{font-size:var(--text-sm);color:var(--color-ink-muted);min-height:1.2em;margin:0 0 var(--space-2)}.photo-editor__status.error{color:var(--color-error)}.photo-editor__grid{display:grid;grid-template-columns:repeat(3,1fr);gap:var(--space-2)}@media (min-width: 600px){.photo-editor__grid{grid-template-columns:repeat(4,1fr)}}.photo-editor__loading,.photo-editor__empty{grid-column:1 / -1;color:var(--color-ink-muted);font-size:var(--text-sm);padding:var(--space-4) 0}.photo-editor__cell{position:relative;aspect-ratio:1 / 1;border-radius:var(--radius-sm);overflow:hidden;background:var(--color-surface-raised);cursor:grab;touch-action:none}.photo-editor__cell:active{cursor:grabbing}.photo-editor__img{width:100%;height:100%;object-fit:cover;display:block;-webkit-user-drag:none;user-select:none;pointer-events:none}.photo-editor__cell:first-child:after{content:"Cover";position:absolute;left:var(--space-1);bottom:var(--space-1);font-family:var(--font-ui);font-size:var(--text-xs, .7rem);font-weight:600;color:#fff;background:var(--color-accent);padding:1px 6px;border-radius:var(--radius-sm);pointer-events:none}.photo-editor__del{position:absolute;top:var(--space-1);right:var(--space-1);width:24px;height:24px;line-height:1;display:flex;align-items:center;justify-content:center;border:none;border-radius:50%;background:#0000008c;color:#fff;font-size:.85rem;cursor:pointer}.photo-editor__del:hover{background:#000000bf}.photo-editor__del:disabled{opacity:.4;cursor:default}.photo-editor__confirm{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--space-1);padding:var(--space-2);background:#000000b8;text-align:center}.photo-editor__confirm-q{color:#fff;font-family:var(--font-ui);font-size:var(--text-sm)}.photo-editor__confirm button{font-family:var(--font-ui);font-size:var(--text-xs, .72rem);border:none;border-radius:var(--radius-sm);padding:3px 10px;cursor:pointer}.photo-editor__confirm-yes{background:var(--color-error);color:#fff}.photo-editor__confirm-no{background:#fff;color:var(--color-ink)}.photo-editor__confirm button:disabled{opacity:.5;cursor:default}.photo-editor__cell.sortable-ghost{opacity:.4}.photo-editor__cell.sortable-chosen{outline:2px solid var(--color-accent)} +.CodeMirror{font-family:monospace;height:300px;color:#000;direction:ltr}.CodeMirror-lines{padding:4px 0}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}.CodeMirror-guttermarker{color:#000}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror-cursor{border-left:1px solid #000;border-right:none;width:0}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.cm-fat-cursor .CodeMirror-cursor{width:auto;border:0!important;background:#7e7}.cm-fat-cursor div.CodeMirror-cursors{z-index:1}.cm-fat-cursor .CodeMirror-line::selection,.cm-fat-cursor .CodeMirror-line>span::selection,.cm-fat-cursor .CodeMirror-line>span>span::selection{background:0 0}.cm-fat-cursor .CodeMirror-line::-moz-selection,.cm-fat-cursor .CodeMirror-line>span::-moz-selection,.cm-fat-cursor .CodeMirror-line>span>span::-moz-selection{background:0 0}.cm-fat-cursor{caret-color:transparent}@-moz-keyframes blink{50%{background-color:transparent}}@-webkit-keyframes blink{50%{background-color:transparent}}@keyframes blink{50%{background-color:transparent}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-rulers{position:absolute;inset:-50px 0 0;overflow:hidden}.CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;position:absolute}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:700}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-strikethrough{text-decoration:line-through}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-type,.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta,.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-s-default .cm-error,.cm-invalidchar{color:red}.CodeMirror-composing{border-bottom:2px solid}div.CodeMirror span.CodeMirror-matchingbracket{color:#0b0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#a22}.CodeMirror-matchingtag{background:#ff96004d}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{position:relative;overflow:hidden;background:#fff}.CodeMirror-scroll{overflow:scroll!important;margin-bottom:-50px;margin-right:-50px;padding-bottom:50px;height:100%;outline:0;position:relative;z-index:0}.CodeMirror-sizer{position:relative;border-right:50px solid transparent}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none;outline:0}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;min-height:100%;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;vertical-align:top;margin-bottom:-50px}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;background:0 0!important;border:none!important}.CodeMirror-gutter-background{position:absolute;top:0;bottom:0;z-index:4}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-gutter-wrapper ::selection{background-color:transparent}.CodeMirror-gutter-wrapper ::-moz-selection{background-color:transparent}.CodeMirror-lines{cursor:text;min-height:1px}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent;-webkit-font-variant-ligatures:contextual;font-variant-ligatures:contextual}.CodeMirror-wrap pre.CodeMirror-line,.CodeMirror-wrap pre.CodeMirror-line-like{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-linebackground{position:absolute;inset:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;padding:.1px}.CodeMirror-code{outline:0}.CodeMirror-gutter,.CodeMirror-gutters,.CodeMirror-linenumber,.CodeMirror-scroll,.CodeMirror-sizer{-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-cursor{position:absolute;pointer-events:none}.CodeMirror-measure pre{position:static}div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}div.CodeMirror-dragcursors,.CodeMirror-focused div.CodeMirror-cursors{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.CodeMirror-line::selection,.CodeMirror-line>span::selection,.CodeMirror-line>span>span::selection{background:#d7d4f0}.CodeMirror-line::-moz-selection,.CodeMirror-line>span::-moz-selection,.CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}.cm-searching{background-color:#ffa;background-color:#ff06}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:""}span.CodeMirror-selectedtext{background:0 0}.EasyMDEContainer{display:block}.CodeMirror-rtl pre{direction:rtl}.EasyMDEContainer.sided--no-fullscreen{display:flex;flex-direction:row;flex-wrap:wrap}.EasyMDEContainer .CodeMirror{box-sizing:border-box;height:auto;border:1px solid #ced4da;border-bottom-left-radius:4px;border-bottom-right-radius:4px;padding:10px;font:inherit;z-index:0;word-wrap:break-word}.EasyMDEContainer .CodeMirror-scroll{cursor:text}.EasyMDEContainer .CodeMirror-fullscreen{background:#fff;position:fixed!important;inset:50px 0 0;height:auto;z-index:8;border-right:none!important;border-bottom-right-radius:0!important}.EasyMDEContainer .CodeMirror-sided{width:50%!important}.EasyMDEContainer.sided--no-fullscreen .CodeMirror-sided{border-right:none!important;border-bottom-right-radius:0;position:relative;flex:1 1 auto}.EasyMDEContainer .CodeMirror-placeholder{opacity:.5}.EasyMDEContainer .CodeMirror-focused .CodeMirror-selected{background:#d9d9d9}.editor-toolbar{position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;padding:9px 10px;border-top:1px solid #ced4da;border-left:1px solid #ced4da;border-right:1px solid #ced4da;border-top-left-radius:4px;border-top-right-radius:4px}.editor-toolbar.fullscreen{width:100%;height:50px;padding-top:10px;padding-bottom:10px;box-sizing:border-box;background:#fff;border:0;position:fixed;top:0;left:0;opacity:1;z-index:9}.editor-toolbar.fullscreen:before{width:20px;height:50px;background:-moz-linear-gradient(left,#fff 0,rgba(255,255,255,0) 100%);background:-webkit-gradient(linear,left top,right top,color-stop(0,#fff),color-stop(100%,rgba(255,255,255,0)));background:-webkit-linear-gradient(left,#fff 0,rgba(255,255,255,0) 100%);background:-o-linear-gradient(left,#fff 0,rgba(255,255,255,0) 100%);background:-ms-linear-gradient(left,#fff 0,rgba(255,255,255,0) 100%);background:linear-gradient(to right,#fff 0,#fff0);position:fixed;top:0;left:0;margin:0;padding:0}.editor-toolbar.fullscreen:after{width:20px;height:50px;background:-moz-linear-gradient(left,rgba(255,255,255,0) 0,#fff 100%);background:-webkit-gradient(linear,left top,right top,color-stop(0,rgba(255,255,255,0)),color-stop(100%,#fff));background:-webkit-linear-gradient(left,rgba(255,255,255,0) 0,#fff 100%);background:-o-linear-gradient(left,rgba(255,255,255,0) 0,#fff 100%);background:-ms-linear-gradient(left,rgba(255,255,255,0) 0,#fff 100%);background:linear-gradient(to right,#fff0 0,#fff);position:fixed;top:0;right:0;margin:0;padding:0}.EasyMDEContainer.sided--no-fullscreen .editor-toolbar{width:100%}.editor-toolbar .easymde-dropdown,.editor-toolbar button{background:0 0;display:inline-block;text-align:center;text-decoration:none!important;height:30px;margin:0;padding:0;border:1px solid transparent;border-radius:3px;cursor:pointer}.editor-toolbar button{font-weight:700;min-width:30px;padding:0 6px;white-space:nowrap}.editor-toolbar button.active,.editor-toolbar button:hover{background:#fcfcfc;border-color:#95a5a6}.editor-toolbar i.separator{display:inline-block;width:0;border-left:1px solid #d9d9d9;border-right:1px solid #fff;color:transparent;text-indent:-10px;margin:0 6px}.editor-toolbar button:after{font-family:Arial,Helvetica Neue,Helvetica,sans-serif;font-size:65%;vertical-align:text-bottom;position:relative;top:2px}.editor-toolbar button.heading-1:after{content:"1"}.editor-toolbar button.heading-2:after{content:"2"}.editor-toolbar button.heading-3:after{content:"3"}.editor-toolbar button.heading-bigger:after{content:"\25b2"}.editor-toolbar button.heading-smaller:after{content:"\25bc"}.editor-toolbar.disabled-for-preview button:not(.no-disable){opacity:.6;pointer-events:none}@media only screen and (max-width:700px){.editor-toolbar i.no-mobile{display:none}}.editor-statusbar{padding:8px 10px;font-size:12px;color:#959694;text-align:right}.EasyMDEContainer.sided--no-fullscreen .editor-statusbar{width:100%}.editor-statusbar span{display:inline-block;min-width:4em;margin-left:1em}.editor-statusbar .lines:before{content:"lines: "}.editor-statusbar .words:before{content:"words: "}.editor-statusbar .characters:before{content:"characters: "}.editor-preview-full{position:absolute;width:100%;height:100%;top:0;left:0;z-index:7;overflow:auto;display:none;box-sizing:border-box}.editor-preview-side{position:fixed;bottom:0;width:50%;top:50px;right:0;z-index:9;overflow:auto;display:none;box-sizing:border-box;border:1px solid #ddd;word-wrap:break-word}.editor-preview-active-side{display:block}.EasyMDEContainer.sided--no-fullscreen .editor-preview-active-side{flex:1 1 auto;height:auto;position:static}.editor-preview-active{display:block}.editor-preview{padding:10px;background:#fafafa}.editor-preview>p{margin-top:0}.editor-preview pre{background:#eee;margin-bottom:10px}.editor-preview table td,.editor-preview table th{border:1px solid #ddd;padding:5px}.cm-s-easymde .cm-tag{color:#63a35c}.cm-s-easymde .cm-attribute{color:#795da3}.cm-s-easymde .cm-string{color:#183691}.cm-s-easymde .cm-header-1{font-size:calc(1.375rem + 1.5vw)}.cm-s-easymde .cm-header-2{font-size:calc(1.325rem + .9vw)}.cm-s-easymde .cm-header-3{font-size:calc(1.3rem + .6vw)}.cm-s-easymde .cm-header-4{font-size:calc(1.275rem + .3vw)}.cm-s-easymde .cm-header-5{font-size:1.25rem}.cm-s-easymde .cm-header-6{font-size:1rem}.cm-s-easymde .cm-header-1,.cm-s-easymde .cm-header-2,.cm-s-easymde .cm-header-3,.cm-s-easymde .cm-header-4,.cm-s-easymde .cm-header-5,.cm-s-easymde .cm-header-6{margin-bottom:.5rem;line-height:1.2}.cm-s-easymde .cm-comment{background:#0000000d;border-radius:2px}.cm-s-easymde .cm-link{color:#7f8c8d}.cm-s-easymde .cm-url{color:#aab2b3}.cm-s-easymde .cm-quote{color:#7f8c8d;font-style:italic}.editor-toolbar .easymde-dropdown{position:relative;background:linear-gradient(to bottom right,#fff 0 84%,#333 50% 100%);border-radius:0;border:1px solid #fff}.editor-toolbar .easymde-dropdown:hover{background:linear-gradient(to bottom right,#fff 0 84%,#333 50% 100%)}.easymde-dropdown-content{display:block;visibility:hidden;position:absolute;background-color:#f9f9f9;box-shadow:0 8px 16px #0003;padding:8px;z-index:2;top:30px}.easymde-dropdown:active .easymde-dropdown-content,.easymde-dropdown:focus .easymde-dropdown-content,.easymde-dropdown:focus-within .easymde-dropdown-content{visibility:visible}.easymde-dropdown-content button{display:block}span[data-img-src]:after{content:"";background-image:var(--bg-image);display:block;max-height:100%;max-width:100%;background-size:contain;height:0;padding-top:var(--height);width:var(--width);background-repeat:no-repeat}.CodeMirror .cm-spell-error:not(.cm-url):not(.cm-comment):not(.cm-tag):not(.cm-word){background:#ff000026}.maplibregl-map{font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative;-webkit-tap-highlight-color:rgb(0 0 0/0)}.maplibregl-canvas{left:0;position:absolute;top:0}.maplibregl-map:fullscreen{height:100%;width:100%}.maplibregl-ctrl-group button.maplibregl-ctrl-compass{touch-action:none}.maplibregl-canvas-container.maplibregl-interactive,.maplibregl-ctrl-group button.maplibregl-ctrl-compass{cursor:grab;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:grabbing}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.maplibregl-ctrl-top-left{left:0;top:0}.maplibregl-ctrl-top-right{right:0;top:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{bottom:0;right:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{float:left;margin:10px 0 0 10px}.maplibregl-ctrl-top-right .maplibregl-ctrl{float:right;margin:10px 10px 0 0}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{float:left;margin:0 0 10px 10px}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{float:right;margin:0 10px 10px 0}.maplibregl-ctrl-group{background:#fff;border-radius:4px}.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px #0000001a}@media (forced-colors:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.maplibregl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;padding:0;width:29px}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (forced-colors:active){.maplibregl-ctrl-icon{background-color:transparent}.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl button:disabled{cursor:not-allowed}.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}.maplibregl-ctrl button:not(:disabled):hover{background-color:#0000000d}.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.maplibregl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.maplibregl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.maplibregl-ctrl-group button:focus:only-child{border-radius:inherit}.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%23333' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%2333b5e5' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23aaa' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{animation:maplibregl-spin 2s linear infinite}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23999' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23666' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}}@keyframes maplibregl-spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E");background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (forced-colors:active){a.maplibregl-ctrl-logo{background-color:transparent;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}.maplibregl-ctrl.maplibregl-ctrl-attrib{background-color:#ffffff80;margin:0;padding:0 5px}@media screen{.maplibregl-ctrl-attrib.maplibregl-compact{background-color:#fff;border-radius:12px;box-sizing:content-box;color:#000;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.maplibregl-ctrl-attrib-button{background-color:#ffffff80;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E");border:0;border-radius:12px;box-sizing:border-box;cursor:pointer;display:none;height:24px;outline:none;position:absolute;right:0;top:0;width:24px}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button{-webkit-appearance:none;-moz-appearance:none;appearance:none;list-style:none}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker{display:none}.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button{left:0}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner{display:block}.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button{background-color:#0000000d}.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{right:0;top:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{left:0;top:0}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (forced-colors:active){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%23fff' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}@media screen and (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}.maplibregl-ctrl-attrib a{color:#000000bf;text-decoration:none}.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.maplibregl-attrib-empty{display:none}.maplibregl-ctrl-scale{background-color:#ffffffbf;border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px}.maplibregl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.maplibregl-popup-anchor-top,.maplibregl-popup-anchor-top-left,.maplibregl-popup-anchor-top-right{flex-direction:column}.maplibregl-popup-anchor-bottom,.maplibregl-popup-anchor-bottom-left,.maplibregl-popup-anchor-bottom-right{flex-direction:column-reverse}.maplibregl-popup-anchor-left{flex-direction:row}.maplibregl-popup-anchor-right{flex-direction:row-reverse}.maplibregl-popup-tip{border:10px solid transparent;height:0;width:0;z-index:1}.maplibregl-popup-anchor-top .maplibregl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.maplibregl-popup-anchor-left .maplibregl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.maplibregl-popup-anchor-right .maplibregl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}.maplibregl-popup-close-button{background-color:transparent;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.maplibregl-popup-close-button:hover{background-color:#0000000d}.maplibregl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px #0000001a;padding:15px 10px;pointer-events:auto;position:relative}.maplibregl-popup-anchor-top-left .maplibregl-popup-content{border-top-left-radius:0}.maplibregl-popup-anchor-top-right .maplibregl-popup-content{border-top-right-radius:0}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-content{border-bottom-left-radius:0}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-content{border-bottom-right-radius:0}.maplibregl-popup-track-pointer{display:none}.maplibregl-popup-track-pointer *{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-map:hover .maplibregl-popup-track-pointer{display:flex}.maplibregl-map:active .maplibregl-popup-track-pointer{display:none}.maplibregl-marker{left:0;position:absolute;top:0;transition:opacity .2s;will-change:transform}.maplibregl-user-location-dot,.maplibregl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.maplibregl-user-location-dot:before{animation:maplibregl-user-location-dot-pulse 2s infinite;content:"";position:absolute}.maplibregl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px #00000059;box-sizing:border-box;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px}@keyframes maplibregl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.maplibregl-user-location-dot-stale{background-color:#aaa}.maplibregl-user-location-dot-stale:after{display:none}.maplibregl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.maplibregl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}.maplibregl-cooperative-gesture-screen{align-items:center;background:#0006;color:#fff;display:flex;font-size:1.4em;inset:0;justify-content:center;line-height:1.2;opacity:0;padding:1rem;pointer-events:none;position:absolute;transition:opacity 1s ease 1s;z-index:99999}.maplibregl-cooperative-gesture-screen.maplibregl-show{opacity:1;transition:opacity .05s}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:none}@media (hover:none),(width <= 480px){.maplibregl-cooperative-gesture-screen .maplibregl-desktop-message{display:none}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:block}}.maplibregl-pseudo-fullscreen{height:100%!important;left:0!important;position:fixed!important;top:0!important;width:100%!important;z-index:99999}.post-edit-error{margin:1rem 0;padding:.75rem 1rem;border:1px solid #E5786A;border-radius:8px;background:#e5786a1f;color:#e5786a;font-size:.9rem;line-height:1.4}.editor-toolbar .mde-btn:before{font-style:normal;font-weight:400;font-family:inherit}.editor-toolbar .mde-bold:before{content:"B";font-weight:700}.editor-toolbar .mde-italic:before{content:"I";font-style:italic}.editor-toolbar .mde-ul:before{content:"\2022\2002\2014"}.editor-toolbar .mde-link:before{content:"\1f517"}.editor-toolbar .mde-preview:before{content:"\1f441"}.EasyMDEContainer .CodeMirror{min-height:180px}.photo-convert-status:empty{display:none}.photo-convert-status{font-size:var(--text-sm);margin-top:var(--space-2)}.photo-reauth-hint{display:none;font-size:var(--text-sm);color:var(--color-ink-muted);margin-top:var(--space-2)}.photo-reauth-hint.is-shown{display:block}.post-form-wrap select{width:100%;font-family:var(--font-ui);font-size:var(--text-base);padding:.875rem 2.5rem .875rem 1rem;min-height:44px;border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-canvas);color:var(--color-ink);-webkit-appearance:none;appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2390887E' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 1rem center}.post-form-wrap select:focus{outline:2px solid var(--color-accent);outline-offset:1px;border-color:var(--color-accent)}.post-form-wrap input[type=number]{width:100%;font-family:var(--font-ui);font-size:var(--text-base);padding:.875rem 1rem;min-height:44px;border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-canvas);color:var(--color-ink);-webkit-appearance:none;appearance:none}.post-form-wrap input[type=number]:focus{outline:2px solid var(--color-accent);outline-offset:1px;border-color:var(--color-accent)}.more-options{margin-bottom:var(--space-5);border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-canvas)}.more-options__summary{cursor:pointer;padding:.875rem 1rem;min-height:44px;display:flex;align-items:center;font-family:var(--font-ui);font-size:var(--text-sm);font-weight:600;color:var(--color-ink);list-style:none;user-select:none}.more-options__summary::-webkit-details-marker{display:none}.more-options__summary:before{content:"\25b8";margin-right:var(--space-2);color:var(--color-ink-muted);transition:transform .15s}.more-options[open] .more-options__summary:before{transform:rotate(90deg)}.more-options[open] .more-options__summary{border-bottom:1px solid var(--color-border)}.more-options>.form-field{padding:0 1rem}.more-options>.form-field:first-of-type{padding-top:var(--space-4)}.more-options>.form-field:last-child{padding-bottom:var(--space-4);margin-bottom:0}.btn-action.is-loading{position:relative;color:transparent;pointer-events:none}.btn-action.is-loading:after{content:"";position:absolute;top:50%;left:50%;width:16px;height:16px;margin:-8px 0 0 -8px;border:2px solid var(--color-ink-muted);border-top-color:var(--color-accent);border-radius:50%;animation:post-spin .7s linear infinite}.btn-action[disabled]{opacity:.5;cursor:not-allowed}@keyframes post-spin{to{transform:rotate(360deg)}}.post-form-wrap .notices{padding:1rem 1.1rem;border-radius:var(--radius-md);font-size:var(--text-base);margin:0 0 var(--space-5);background:var(--color-canvas);color:var(--color-ink);border-left:4px solid var(--color-accent)}.post-form-wrap .notices p{margin:0}.post-form-wrap .notices.error,.post-form-wrap .notices.red{border-left-color:var(--color-error)}.post-form-wrap .notices.success,.post-form-wrap .notices.green{border-left-color:var(--color-accent)}.post-success{margin:0 0 var(--space-5);padding:1.1rem;border-radius:var(--radius-md);background:var(--color-accent-light);border:1px solid var(--color-accent)}.post-success__title{font-family:var(--font-ui);font-size:var(--text-md);font-weight:600;color:var(--color-ink);margin:0 0 var(--space-3)}.post-success__actions{display:flex;flex-wrap:wrap;gap:var(--space-3)}.post-success__view{flex:1;min-width:140px;text-align:center;padding:.8rem 1rem;min-height:44px;border-radius:var(--radius-md);background:var(--color-accent);color:var(--color-accent-on);font-weight:600;text-decoration:none}.post-success__again{flex:1;min-width:140px;text-align:center;padding:.8rem 1rem;min-height:44px;border-radius:var(--radius-md);background:transparent;color:var(--color-ink);border:1px solid var(--color-border);font-weight:600;text-decoration:none}.filepond--credits{display:none!important}.filepond--root{font-family:var(--font-ui);font-size:var(--text-base)}.filepond--panel-root{background-color:var(--color-canvas);border:1px solid var(--color-border);border-radius:var(--radius-md)}.filepond--drop-label,.filepond--drop-label label{color:var(--color-ink-muted)}.filepond--label-action{color:var(--color-accent);text-decoration-color:var(--color-accent)}.filepond--item-panel{background-color:var(--color-surface-raised);border-radius:var(--radius-md)}.filepond--drip-blob{background-color:var(--color-accent)}.filepond--file{color:var(--color-ink)}.filepond--file-action-button{color:var(--color-ink);background-color:#00000073}.filepond--file-action-button:hover{background-color:#000000a6}.filepond--image-preview-overlay{display:none!important}.filepond--item[data-filepond-item-state=processing-complete] .filepond--file-info,.filepond--item[data-filepond-item-state=processing-complete] .filepond--file-status{opacity:0}.filepond--item[data-filepond-item-state=processing-complete]:after{content:"\2713";position:absolute;top:8px;right:8px;z-index:5;width:24px;height:24px;line-height:24px;text-align:center;border-radius:50%;background:var(--color-accent);color:#fff;font-size:15px;font-weight:700;box-shadow:0 1px 3px #00000059;pointer-events:none}.filepond--list.filepond--list{margin:.25rem}.filepond--item{width:calc(33.333% - .5rem)}.filepond--item .filepond--panel-root,.filepond--item .filepond--image-preview-wrapper{border-radius:var(--radius-sm)}.filepond--image-preview,.filepond--image-preview-wrapper,.filepond--image-clip,.filepond--image-preview canvas,.filepond--image-bitmap,.filepond--file img{-webkit-user-drag:none;-khtml-user-drag:none;user-drag:none}.filepond--item[data-filepond-item-state=idle] .filepond--file-info,.filepond--item[data-filepond-item-state=idle] .filepond--file-status{opacity:0}.photos-collapse{margin-bottom:var(--space-5);border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-canvas)}.photos-collapse__summary{cursor:pointer;padding:.875rem 1rem;min-height:44px;display:flex;align-items:center;font-family:var(--font-ui);font-size:var(--text-sm);font-weight:600;color:var(--color-ink);list-style:none;user-select:none}.photos-collapse__summary::-webkit-details-marker{display:none}.photos-collapse__summary:before{content:"\25b8";margin-right:var(--space-2);color:var(--color-ink-muted);transition:transform .15s}.photos-collapse[open] .photos-collapse__summary:before{transform:rotate(90deg)}.photos-collapse[open] .photos-collapse__summary{border-bottom:1px solid var(--color-border)}.photos-collapse>:not(summary){padding-left:1rem;padding-right:1rem}.photos-collapse[open] .filepond--root,.photos-collapse[open] .filepond-root{margin:var(--space-4) 0}.photos-collapse[open]>.photo-convert-status:last-child,.photos-collapse[open]>.photo-reauth-hint:last-child{padding-bottom:var(--space-4)}.EasyMDEContainer .CodeMirror{background:var(--color-canvas);color:var(--color-ink);border:1px solid var(--color-border);border-radius:0 0 var(--radius-md) var(--radius-md);font-family:var(--font-ui);font-size:var(--text-base);line-height:var(--leading-normal);padding:var(--space-1)}.EasyMDEContainer .CodeMirror-cursor{border-color:var(--color-ink)}.EasyMDEContainer .CodeMirror-selected{background:var(--color-accent-light)!important}.EasyMDEContainer .editor-toolbar{background:var(--color-surface-raised);border:1px solid var(--color-border);border-bottom:none;border-radius:var(--radius-md) var(--radius-md) 0 0;opacity:1}.EasyMDEContainer .editor-toolbar button{color:var(--color-ink)!important;min-width:34px;height:34px}.EasyMDEContainer .editor-toolbar button:hover,.EasyMDEContainer .editor-toolbar button.active{background:var(--color-accent-light);border-color:var(--color-border)}.EasyMDEContainer .editor-toolbar i.separator{border-color:var(--color-border)}.EasyMDEContainer .editor-preview,.EasyMDEContainer .editor-preview-side{background:var(--color-canvas);color:var(--color-ink)}.EasyMDEContainer .editor-preview a{color:var(--color-accent)}.photo-editor{margin-bottom:var(--space-5)}.photo-editor__head{display:flex;align-items:center;justify-content:space-between;gap:var(--space-3);margin-bottom:var(--space-2)}.photo-editor__label{font-family:var(--font-ui);font-size:var(--text-base);font-weight:600;color:var(--color-ink)}.photo-editor__add{font-family:var(--font-ui);font-size:var(--text-sm);background:var(--color-accent);color:#fff;border:none;border-radius:var(--radius-sm);padding:var(--space-2) var(--space-4);cursor:pointer}.photo-editor__add:disabled{opacity:.5;cursor:default}.photo-editor__status{font-size:var(--text-sm);color:var(--color-ink-muted);min-height:1.2em;margin:0 0 var(--space-2)}.photo-editor__status.error{color:var(--color-error)}.photo-editor__grid{display:grid;grid-template-columns:repeat(3,1fr);gap:var(--space-2)}@media (min-width: 600px){.photo-editor__grid{grid-template-columns:repeat(4,1fr)}}.photo-editor__loading,.photo-editor__empty{grid-column:1 / -1;color:var(--color-ink-muted);font-size:var(--text-sm);padding:var(--space-4) 0}.photo-editor__cell{position:relative;aspect-ratio:1 / 1;border-radius:var(--radius-sm);overflow:hidden;background:var(--color-surface-raised);cursor:grab;touch-action:none}.photo-editor__cell:active{cursor:grabbing}.photo-editor__img{width:100%;height:100%;object-fit:cover;display:block;-webkit-user-drag:none;user-select:none;pointer-events:none}.photo-editor__cell:first-child:after{content:"Cover";position:absolute;left:var(--space-1);bottom:var(--space-1);font-family:var(--font-ui);font-size:var(--text-xs, .7rem);font-weight:600;color:#fff;background:var(--color-accent);padding:1px 6px;border-radius:var(--radius-sm);pointer-events:none}.photo-editor__del{position:absolute;top:var(--space-1);right:var(--space-1);width:24px;height:24px;line-height:1;display:flex;align-items:center;justify-content:center;border:none;border-radius:50%;background:#0000008c;color:#fff;font-size:.85rem;cursor:pointer}.photo-editor__del:hover{background:#000000bf}.photo-editor__del:disabled{opacity:.4;cursor:default}.photo-editor__confirm{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--space-1);padding:var(--space-2);background:#000000b8;text-align:center}.photo-editor__confirm-q{color:#fff;font-family:var(--font-ui);font-size:var(--text-sm)}.photo-editor__confirm button{font-family:var(--font-ui);font-size:var(--text-xs, .72rem);border:none;border-radius:var(--radius-sm);padding:3px 10px;cursor:pointer}.photo-editor__confirm-yes{background:var(--color-error);color:#fff}.photo-editor__confirm-no{background:#fff;color:var(--color-ink)}.photo-editor__confirm button:disabled{opacity:.5;cursor:default}.photo-editor__cell.sortable-ghost{opacity:.4}.photo-editor__cell.sortable-chosen{outline:2px solid var(--color-accent)}.location-details{margin-bottom:var(--space-5);border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-canvas)}.location-details__summary{cursor:pointer;padding:.875rem 1rem;min-height:44px;display:flex;align-items:center;font-family:var(--font-ui);font-size:var(--text-sm);font-weight:600;color:var(--color-ink);list-style:none;user-select:none}.location-details__summary::-webkit-details-marker{display:none}.location-details__summary:before{content:"\25b8";margin-right:var(--space-2);color:var(--color-ink-muted);transition:transform .15s}.location-details[open] .location-details__summary:before{transform:rotate(90deg)}.location-details[open] .location-details__summary{border-bottom:1px solid var(--color-border)}.location-details>.form-field{padding:0 1rem}.location-details>.form-field:first-of-type{padding-top:var(--space-4)}.location-details>.form-field:last-of-type{padding-bottom:var(--space-2)}.location-details__body{padding:1rem}.location-search-row{display:flex;gap:var(--space-3);align-items:center;flex-wrap:wrap}.location-search-hint{font-size:var(--text-sm);color:var(--color-ink-muted);margin-top:var(--space-2)}.location-search-hint:empty{display:none}.location-search-results{list-style:none;margin:var(--space-3) 0 0;padding:0;border:1px solid var(--color-border);border-radius:var(--radius-md);overflow:hidden}.location-search-results:empty{display:none;margin:0;border:none}.location-search-results li+li{border-top:1px solid var(--color-border)}.location-search-results button{display:block;width:100%;text-align:left;padding:.75rem 1rem;min-height:44px;background:var(--color-canvas);border:none;font-family:var(--font-ui);font-size:var(--text-sm);color:var(--color-ink);cursor:pointer}.location-search-results button:hover,.location-search-results button:focus-visible{background:var(--color-paper)}.location-map{position:relative;width:100%;height:240px;margin-top:var(--space-4);border-radius:var(--radius-md);overflow:hidden;background:var(--color-paper)}.location-map .maplibregl-canvas{border-radius:var(--radius-md)}.location-pin{width:44px;height:44px;border-radius:50%;background:var(--color-accent);border:3px solid #fff;box-shadow:0 1px 6px #00000080;cursor:grab}.location-pin:active{cursor:grabbing}.location-field--mismatch{border-color:var(--color-error)!important;outline-color:var(--color-error)!important}.location-field-note{display:block;font-size:var(--text-sm);color:var(--color-error);margin-top:var(--space-1)} /*! Bundled license information: easymde/dist/easymde.min.css: diff --git a/themes/intotheeast/css/style.css b/themes/intotheeast/css/style.css index 1755786..32efa2e 100644 --- a/themes/intotheeast/css/style.css +++ b/themes/intotheeast/css/style.css @@ -833,110 +833,6 @@ body::after { color: var(--color-ink); } -/* "More location details" disclosure — search + map preview for setting an - entry's coordinates without live GPS. Mirrors .more-options's disclosure - look (post-form.css); the lat/lng fields (relocated here by JS) and the - lookup button reuse this file's existing .btn-action/.form-status/ - .field-invalid conventions unmodified. */ -.location-details { - margin-bottom: var(--space-5); - border: 1px solid var(--color-border); - border-radius: var(--radius-md); - background: var(--color-canvas); -} -.location-details__summary { - cursor: pointer; - padding: 0.875rem 1rem; - min-height: 44px; - display: flex; - align-items: center; - font-family: var(--font-ui); - font-size: var(--text-sm); - font-weight: 600; - color: var(--color-ink); - list-style: none; - user-select: none; -} -.location-details__summary::-webkit-details-marker { display: none; } -.location-details__summary::before { - content: '▸'; - margin-right: var(--space-2); - color: var(--color-ink-muted); - transition: transform 0.15s; -} -.location-details[open] .location-details__summary::before { transform: rotate(90deg); } -.location-details[open] .location-details__summary { border-bottom: 1px solid var(--color-border); } -.location-details > .form-field { padding: 0 1rem; } -.location-details > .form-field:first-of-type { padding-top: var(--space-4); } -.location-details > .form-field:last-of-type { padding-bottom: var(--space-2); } -.location-details__body { padding: 1rem; } - -.location-search-row { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; } - -.location-search-hint { - font-size: var(--text-sm); - color: var(--color-ink-muted); - margin-top: var(--space-2); -} -.location-search-hint:empty { display: none; } - -.location-search-results { - list-style: none; - margin: var(--space-3) 0 0; - padding: 0; - border: 1px solid var(--color-border); - border-radius: var(--radius-md); - overflow: hidden; -} -.location-search-results:empty { display: none; margin: 0; border: none; } -.location-search-results li + li { border-top: 1px solid var(--color-border); } -.location-search-results button { - display: block; - width: 100%; - text-align: left; - padding: 0.75rem 1rem; - min-height: 44px; - background: var(--color-canvas); - border: none; - font-family: var(--font-ui); - font-size: var(--text-sm); - color: var(--color-ink); - cursor: pointer; -} -.location-search-results button:hover, -.location-search-results button:focus-visible { background: var(--color-paper); } - -.location-map { - position: relative; - width: 100%; - height: 240px; - margin-top: var(--space-4); - border-radius: var(--radius-md); - overflow: hidden; - background: var(--color-paper); -} -.location-map .maplibregl-canvas { border-radius: var(--radius-md); } - -.location-pin { - width: 44px; - height: 44px; - border-radius: 50%; - background: var(--color-accent); - border: 3px solid #fff; - box-shadow: 0 1px 6px rgba(0, 0, 0, 0.5); - cursor: grab; -} -.location-pin:active { cursor: grabbing; } - -/* Mismatch flag: a typed lat/lng that doesn't (yet) parse to a valid pin. */ -.location-field--mismatch { border-color: var(--color-error) !important; outline-color: var(--color-error) !important; } -.location-field-note { - display: block; - font-size: var(--text-sm); - color: var(--color-error); - margin-top: var(--space-1); -} - /* Grav form field inputs */ .post-form-wrap .form-field { margin-bottom: var(--space-5); } .post-form-wrap .form-label label { diff --git a/themes/intotheeast/js/post/post-form.js b/themes/intotheeast/js/post/post-form.js index cbf492f..cca0f09 100644 --- a/themes/intotheeast/js/post/post-form.js +++ b/themes/intotheeast/js/post/post-form.js @@ -1,49 +1,49 @@ -import{a as Qu,b as at,c as Jh}from"./chunk-ZWRDP37E.js";var At=at((nl,ol)=>{(function(o,l){typeof nl=="object"&&typeof ol<"u"?ol.exports=l():typeof define=="function"&&define.amd?define(l):(o=o||self,o.CodeMirror=l())})(nl,function(){"use strict";var o=navigator.userAgent,l=navigator.platform,s=/gecko\/\d/i.test(o),a=/MSIE \d/.test(o),f=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(o),h=/Edge\/(\d+)/.exec(o),c=a||f||h,d=c&&(a?document.documentMode||6:+(h||f)[1]),v=!h&&/WebKit\//.test(o),y=v&&/Qt\/\d+\.\d+/.test(o),x=!h&&/Chrome\/(\d+)/.exec(o),D=x&&+x[1],k=/Opera\//.test(o),F=/Apple Computer/.test(navigator.vendor),B=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(o),L=/PhantomJS/.test(o),T=F&&(/Mobile\/\w+/.test(o)||navigator.maxTouchPoints>2),N=/Android/.test(o),z=T||N||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(o),O=T||/Mac/.test(l),I=/\bCrOS\b/.test(o),W=/win/i.test(l),G=k&&o.match(/Version\/(\d*\.\d*)/);G&&(G=Number(G[1])),G&&G>=15&&(k=!1,v=!0);var X=O&&(y||k&&(G==null||G<12.11)),de=s||c&&d>=9;function j(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var oe=function(e,t){var i=e.className,r=j(t).exec(i);if(r){var n=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(n?r[1]+n:"")}};function H(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function Y(e,t){return H(e).appendChild(t)}function E(e,t,i,r){var n=document.createElement(e);if(i&&(n.className=i),r&&(n.style.cssText=r),typeof t=="string")n.appendChild(document.createTextNode(t));else if(t)for(var u=0;u=t)return p+(t-u);p+=g-u,p+=i-p%i,u=g+1}}var ct=function(){this.id=null,this.f=null,this.time=0,this.handler=mt(this.onTimeout,this)};ct.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ct.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i=t)return r+Math.min(p,t-n);if(n+=u-r,n+=i-n%i,r=u+1,n>=t)return r}}var Ht=[""];function pr(e){for(;Ht.length<=e;)Ht.push(De(Ht)+" ");return Ht[e]}function De(e){return e[e.length-1]}function Pt(e,t){for(var i=[],r=0;r"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Pc.test(e))}function Dn(e,t){return t?t.source.indexOf("\\w")>-1&&Zo(e)?!0:t.test(e):Zo(e)}function jl(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var qc=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Qo(e){return e.charCodeAt(0)>=768&&qc.test(e)}function Gl(e,t,i){for(;(i<0?t>0:ti?-1:1;;){if(t==i)return t;var n=(t+i)/2,u=r<0?Math.ceil(n):Math.floor(n);if(u==t)return e(u)?t:i;e(u)?i=u:t=u+r}}function Rc(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,u=0;ut||t==i&&p.to==t)&&(r(Math.max(p.from,t),Math.min(p.to,i),p.level==1?"rtl":"ltr",u),n=!0)}n||r(t,i,"ltr")}var Li=null;function Mi(e,t,i){var r;Li=null;for(var n=0;nt)return n;u.to==t&&(u.from!=u.to&&i=="before"?r=n:Li=n),u.from==t&&(u.from!=u.to&&i!="before"?r=n:Li=n)}return r??Li}var Wc=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(b){return b<=247?e.charAt(b):1424<=b&&b<=1524?"R":1536<=b&&b<=1785?t.charAt(b-1536):1774<=b&&b<=2220?"r":8192<=b&&b<=8203?"w":b==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,u=/[LRr]/,p=/[Lb1n]/,g=/[1n]/;function m(b,C,S){this.level=b,this.from=C,this.to=S}return function(b,C){var S=C=="ltr"?"L":"R";if(b.length==0||C=="ltr"&&!r.test(b))return!1;for(var _=b.length,M=[],P=0;P<_;++P)M.push(i(b.charCodeAt(P)));for(var U=0,Z=S;U<_;++U){var J=M[U];J=="m"?M[U]=Z:Z=J}for(var ee=0,V=S;ee<_;++ee){var ie=M[ee];ie=="1"&&V=="r"?M[ee]="n":u.test(ie)&&(V=ie,ie=="r"&&(M[ee]="R"))}for(var se=1,le=M[0];se<_-1;++se){var we=M[se];we=="+"&&le=="1"&&M[se+1]=="1"?M[se]="1":we==","&&le==M[se+1]&&(le=="1"||le=="n")&&(M[se]=le),le=we}for(var Le=0;Le<_;++Le){var it=M[Le];if(it==",")M[Le]="N";else if(it=="%"){var Ie=void 0;for(Ie=Le+1;Ie<_&&M[Ie]=="%";++Ie);for(var Et=Le&&M[Le-1]=="!"||Ie<_&&M[Ie]=="1"?"1":"N",wt=Le;wt-1&&(r[t]=n.slice(0,u).concat(n.slice(u+1)))}}}function je(e,t){var i=Jo(e,t);if(i.length)for(var r=Array.prototype.slice.call(arguments,2),n=0;n0}function Qr(e){e.prototype.on=function(t,i){ue(this,t,i)},e.prototype.off=function(t,i){Mt(this,t,i)}}function bt(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Yl(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Vo(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function Bi(e){bt(e),Yl(e)}function $o(e){return e.target||e.srcElement}function Zl(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),O&&e.ctrlKey&&t==1&&(t=3),t}var Uc=function(){if(c&&d<9)return!1;var e=E("div");return"draggable"in e||"dragDrop"in e}(),ea;function jc(e){if(ea==null){var t=E("span","\u200B");Y(e,E("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(ea=t.offsetWidth<=1&&t.offsetHeight>2&&!(c&&d<8))}var i=ea?E("span","\u200B"):E("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var ta;function Gc(e){if(ta!=null)return ta;var t=Y(e,document.createTextNode("A\u062EA")),i=R(t,0,1).getBoundingClientRect(),r=R(t,1,2).getBoundingClientRect();return H(e),!i||i.left==i.right?!1:ta=r.right-i.right<3}var ra=` +import{a as Qu,b as at,c as Jh}from"./chunk-ZWRDP37E.js";var At=at((nl,ol)=>{(function(o,l){typeof nl=="object"&&typeof ol<"u"?ol.exports=l():typeof define=="function"&&define.amd?define(l):(o=o||self,o.CodeMirror=l())})(nl,function(){"use strict";var o=navigator.userAgent,l=navigator.platform,s=/gecko\/\d/i.test(o),a=/MSIE \d/.test(o),f=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(o),h=/Edge\/(\d+)/.exec(o),c=a||f||h,d=c&&(a?document.documentMode||6:+(h||f)[1]),v=!h&&/WebKit\//.test(o),y=v&&/Qt\/\d+\.\d+/.test(o),x=!h&&/Chrome\/(\d+)/.exec(o),D=x&&+x[1],k=/Opera\//.test(o),F=/Apple Computer/.test(navigator.vendor),B=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(o),L=/PhantomJS/.test(o),T=F&&(/Mobile\/\w+/.test(o)||navigator.maxTouchPoints>2),N=/Android/.test(o),z=T||N||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(o),O=T||/Mac/.test(l),I=/\bCrOS\b/.test(o),R=/win/i.test(l),G=k&&o.match(/Version\/(\d*\.\d*)/);G&&(G=Number(G[1])),G&&G>=15&&(k=!1,v=!0);var X=O&&(y||k&&(G==null||G<12.11)),he=s||c&&d>=9;function j(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var oe=function(e,t){var i=e.className,r=j(t).exec(i);if(r){var n=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(n?r[1]+n:"")}};function H(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function Y(e,t){return H(e).appendChild(t)}function E(e,t,i,r){var n=document.createElement(e);if(i&&(n.className=i),r&&(n.style.cssText=r),typeof t=="string")n.appendChild(document.createTextNode(t));else if(t)for(var u=0;u=t)return p+(t-u);p+=g-u,p+=i-p%i,u=g+1}}var ct=function(){this.id=null,this.f=null,this.time=0,this.handler=mt(this.onTimeout,this)};ct.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ct.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i=t)return r+Math.min(p,t-n);if(n+=u-r,n+=i-n%i,r=u+1,n>=t)return r}}var Ht=[""];function pr(e){for(;Ht.length<=e;)Ht.push(De(Ht)+" ");return Ht[e]}function De(e){return e[e.length-1]}function Pt(e,t){for(var i=[],r=0;r"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Pc.test(e))}function kn(e,t){return t?t.source.indexOf("\\w")>-1&&Zo(e)?!0:t.test(e):Zo(e)}function jl(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var qc=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Qo(e){return e.charCodeAt(0)>=768&&qc.test(e)}function Gl(e,t,i){for(;(i<0?t>0:ti?-1:1;;){if(t==i)return t;var n=(t+i)/2,u=r<0?Math.ceil(n):Math.floor(n);if(u==t)return e(u)?t:i;e(u)?i=u:t=u+r}}function Rc(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,u=0;ut||t==i&&p.to==t)&&(r(Math.max(p.from,t),Math.min(p.to,i),p.level==1?"rtl":"ltr",u),n=!0)}n||r(t,i,"ltr")}var Mi=null;function Bi(e,t,i){var r;Mi=null;for(var n=0;nt)return n;u.to==t&&(u.from!=u.to&&i=="before"?r=n:Mi=n),u.from==t&&(u.from!=u.to&&i!="before"?r=n:Mi=n)}return r??Mi}var Wc=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(b){return b<=247?e.charAt(b):1424<=b&&b<=1524?"R":1536<=b&&b<=1785?t.charAt(b-1536):1774<=b&&b<=2220?"r":8192<=b&&b<=8203?"w":b==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,u=/[LRr]/,p=/[Lb1n]/,g=/[1n]/;function m(b,C,S){this.level=b,this.from=C,this.to=S}return function(b,C){var S=C=="ltr"?"L":"R";if(b.length==0||C=="ltr"&&!r.test(b))return!1;for(var _=b.length,M=[],P=0;P<_;++P)M.push(i(b.charCodeAt(P)));for(var U=0,Z=S;U<_;++U){var J=M[U];J=="m"?M[U]=Z:Z=J}for(var ee=0,V=S;ee<_;++ee){var ie=M[ee];ie=="1"&&V=="r"?M[ee]="n":u.test(ie)&&(V=ie,ie=="r"&&(M[ee]="R"))}for(var se=1,le=M[0];se<_-1;++se){var we=M[se];we=="+"&&le=="1"&&M[se+1]=="1"?M[se]="1":we==","&&le==M[se+1]&&(le=="1"||le=="n")&&(M[se]=le),le=we}for(var Le=0;Le<_;++Le){var it=M[Le];if(it==",")M[Le]="N";else if(it=="%"){var Ie=void 0;for(Ie=Le+1;Ie<_&&M[Ie]=="%";++Ie);for(var Et=Le&&M[Le-1]=="!"||Ie<_&&M[Ie]=="1"?"1":"N",wt=Le;wt-1&&(r[t]=n.slice(0,u).concat(n.slice(u+1)))}}}function je(e,t){var i=Jo(e,t);if(i.length)for(var r=Array.prototype.slice.call(arguments,2),n=0;n0}function Jr(e){e.prototype.on=function(t,i){ue(this,t,i)},e.prototype.off=function(t,i){Mt(this,t,i)}}function bt(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Yl(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Vo(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function _i(e){bt(e),Yl(e)}function $o(e){return e.target||e.srcElement}function Zl(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),O&&e.ctrlKey&&t==1&&(t=3),t}var Uc=function(){if(c&&d<9)return!1;var e=E("div");return"draggable"in e||"dragDrop"in e}(),ea;function jc(e){if(ea==null){var t=E("span","\u200B");Y(e,E("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(ea=t.offsetWidth<=1&&t.offsetHeight>2&&!(c&&d<8))}var i=ea?E("span","\u200B"):E("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var ta;function Gc(e){if(ta!=null)return ta;var t=Y(e,document.createTextNode("A\u062EA")),i=W(t,0,1).getBoundingClientRect(),r=W(t,1,2).getBoundingClientRect();return H(e),!i||i.left==i.right?!1:ta=r.right-i.right<3}var ra=` b`.split(/\n/).length!=3?function(e){for(var t=0,i=[],r=e.length;t<=r;){var n=e.indexOf(` -`,t);n==-1&&(n=e.length);var u=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),p=u.indexOf("\r");p!=-1?(i.push(u.slice(0,p)),t+=p+1):(i.push(u),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},Xc=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch{return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch{}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Kc=function(){var e=E("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),ia=null;function Yc(e){if(ia!=null)return ia;var t=Y(e,E("span","x")),i=t.getBoundingClientRect(),r=R(t,0,1).getBoundingClientRect();return ia=Math.abs(i.left-r.left)>1}var na={},Jr={};function Zc(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),na[e]=t}function Qc(e,t){Jr[e]=t}function kn(e){if(typeof e=="string"&&Jr.hasOwnProperty(e))e=Jr[e];else if(e&&typeof e.name=="string"&&Jr.hasOwnProperty(e.name)){var t=Jr[e.name];typeof t=="string"&&(t={name:t}),e=Ul(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return kn("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return kn("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function oa(e,t){t=kn(t);var i=na[t.name];if(!i)return oa(e,"text/plain");var r=i(e,t);if(Vr.hasOwnProperty(t.name)){var n=Vr[t.name];for(var u in n)n.hasOwnProperty(u)&&(r.hasOwnProperty(u)&&(r["_"+u]=r[u]),r[u]=n[u])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var p in t.modeProps)r[p]=t.modeProps[p];return r}var Vr={};function Jc(e,t){var i=Vr.hasOwnProperty(e)?Vr[e]:Vr[e]={};Lt(t,i)}function Lr(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var r in t){var n=t[r];n instanceof Array&&(n=n.concat([])),i[r]=n}return i}function aa(e,t){for(var i;e.innerMode&&(i=e.innerMode(t),!(!i||i.mode==e));)t=i.state,e=i.mode;return i||{mode:e,state:t}}function Ql(e,t,i){return e.startState?e.startState(t,i):!0}var Ge=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};Ge.prototype.eol=function(){return this.pos>=this.string.length},Ge.prototype.sol=function(){return this.pos==this.lineStart},Ge.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ge.prototype.next=function(){if(this.post},Ge.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ge.prototype.skipToEnd=function(){this.pos=this.string.length},Ge.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ge.prototype.backUp=function(e){this.pos-=e},Ge.prototype.column=function(){return this.lastColumnPos0?null:(u&&t!==!1&&(this.pos+=u[0].length),u)}},Ge.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ge.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ge.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ge.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ae(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var i=e;!i.lines;)for(var r=0;;++r){var n=i.children[r],u=n.chunkSize();if(t=e.first&&ti?K(i,ae(e,i).text.length):Vc(t,ae(e,t.line).text.length)}function Vc(e,t){var i=e.ch;return i==null||i>t?K(e.line,t):i<0?K(e.line,0):e}function Vl(e,t){for(var i=[],r=0;rthis.maxLookAhead&&(this.maxLookAhead=e),t},Zt.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},Zt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Zt.fromSaved=function(e,t,i){return t instanceof An?new Zt(e,Lr(e.mode,t.state),i,t.lookAhead):new Zt(e,Lr(e.mode,t),i)},Zt.prototype.save=function(e){var t=e!==!1?Lr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new An(t,this.maxLookAhead):t};function $l(e,t,i,r){var n=[e.state.modeGen],u={};os(e,t.text,e.doc.mode,i,function(b,C){return n.push(b,C)},u,r);for(var p=i.state,g=function(b){i.baseTokens=n;var C=e.state.overlays[b],S=1,_=0;i.state=!0,os(e,t.text,C.mode,i,function(M,P){for(var U=S;_M&&n.splice(S,1,M,n[S+1],Z),S+=2,_=Math.min(M,Z)}if(P)if(C.opaque)n.splice(U,S-U,M,"overlay "+P),S=U+2;else for(;Ue.options.maxHighlightLength&&Lr(e.doc.mode,r.state),u=$l(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=u.styles,u.classes?t.styleClasses=u.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function zi(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new Zt(r,!0,t);var u=$c(e,t,i),p=u>r.first&&ae(r,u-1).stateAfter,g=p?Zt.fromSaved(r,p,u):new Zt(r,Ql(r.mode),u);return r.iter(u,t,function(m){ca(e,m.text,g);var b=g.line;m.stateAfter=b==t-1||b%5==0||b>=n.viewFrom&&bt.start)return u}throw new Error("Mode "+e.name+" failed to advance stream.")}var rs=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function is(e,t,i,r){var n=e.doc,u=n.mode,p;t=ve(n,t);var g=ae(n,t.line),m=zi(e,t.line,i),b=new Ge(g.text,e.options.tabSize,m),C;for(r&&(C=[]);(r||b.pose.options.maxHighlightLength?(g=!1,p&&ca(e,t,r,C.pos),C.pos=t.length,S=null):S=ns(da(i,C,r.state,_),u),_){var M=_[0].name;M&&(S="m-"+(S?M+" "+S:M))}if(!g||b!=S){for(;mp;--g){if(g<=u.first)return u.first;var m=ae(u,g-1),b=m.stateAfter;if(b&&(!i||g+(b instanceof An?b.lookAhead:0)<=u.modeFrontier))return g;var C=Ye(m.text,null,e.options.tabSize);(n==null||r>C)&&(n=g-1,r=C)}return n}function ed(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontieri;r--){var n=ae(e,r).stateAfter;if(n&&(!(n instanceof An)||r+n.lookAhead=t:u.to>t);(r||(r=[])).push(new Fn(p,u.from,m?null:u.to))}}return r}function ad(e,t,i){var r;if(e)for(var n=0;n=t:u.to>t);if(g||u.from==t&&p.type=="bookmark"&&(!i||u.marker.insertLeft)){var m=u.from==null||(p.inclusiveLeft?u.from<=t:u.from0&&g)for(var ie=0;ie0)){var C=[m,1],S=me(b.from,g.from),_=me(b.to,g.to);(S<0||!p.inclusiveLeft&&!S)&&C.push({from:b.from,to:g.from}),(_>0||!p.inclusiveRight&&!_)&&C.push({from:g.to,to:b.to}),n.splice.apply(n,C),m+=C.length-3}}return n}function ss(e){var t=e.markedSpans;if(t){for(var i=0;it)&&(!r||pa(r,u.marker)<0)&&(r=u.marker)}return r}function ds(e,t,i,r,n){var u=ae(e,t),p=rr&&u.markedSpans;if(p)for(var g=0;g=0&&S<=0||C<=0&&S>=0)&&(C<=0&&(m.marker.inclusiveRight&&n.inclusiveLeft?me(b.to,i)>=0:me(b.to,i)>0)||C>=0&&(m.marker.inclusiveRight&&n.inclusiveLeft?me(b.from,r)<=0:me(b.from,r)<0)))return!0}}}function qt(e){for(var t;t=cs(e);)e=t.find(-1,!0).line;return e}function ud(e){for(var t;t=Mn(e);)e=t.find(1,!0).line;return e}function fd(e){for(var t,i;t=Mn(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function ga(e,t){var i=ae(e,t),r=qt(i);return i==r?t:Fe(r)}function hs(e,t){if(t>e.lastLine())return t;var i=ae(e,t),r;if(!mr(e,i))return t;for(;r=Mn(i);)i=r.find(1,!0).line;return Fe(i)+1}function mr(e,t){var i=rr&&t.markedSpans;if(i){for(var r=void 0,n=0;nt.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var $r=function(e,t,i){this.text=e,us(this,t),this.height=i?i(this):1};$r.prototype.lineNo=function(){return Fe(this)},Qr($r);function cd(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),ss(e),us(e,i);var n=r?r(e):1;n!=e.height&&Yt(e,n)}function dd(e){e.parent=null,ss(e)}var hd={},pd={};function ps(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?pd:hd;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function gs(e,t){var i=q("span",null,null,v?"padding-right: .1px":null),r={pre:q("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var u=n?t.rest[n-1]:t.line,p=void 0;r.pos=0,r.addToken=md,Gc(e.display.measure)&&(p=tr(u,e.doc.direction))&&(r.addToken=bd(r.addToken,p)),r.map=[];var g=t!=e.display.externalMeasured&&Fe(u);yd(u,r,es(e,u,g)),u.styleClasses&&(u.styleClasses.bgClass&&(r.bgClass=Ee(u.styleClasses.bgClass,r.bgClass||"")),u.styleClasses.textClass&&(r.textClass=Ee(u.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(jc(e.display.measure))),n==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(v){var m=r.content.lastChild;(/\bcm-tab\b/.test(m.className)||m.querySelector&&m.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return je(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=Ee(r.pre.className,r.textClass||"")),r}function gd(e){var t=E("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function md(e,t,i,r,n,u,p){if(t){var g=e.splitSpaces?vd(t,e.trailingSpace):t,m=e.cm.state.specialChars,b=!1,C;if(!m.test(t))e.col+=t.length,C=document.createTextNode(g),e.map.push(e.pos,e.pos+t.length,C),c&&d<9&&(b=!0),e.pos+=t.length;else{C=document.createDocumentFragment();for(var S=0;;){m.lastIndex=S;var _=m.exec(t),M=_?_.index-S:t.length-S;if(M){var P=document.createTextNode(g.slice(S,S+M));c&&d<9?C.appendChild(E("span",[P])):C.appendChild(P),e.map.push(e.pos,e.pos+M,P),e.col+=M,e.pos+=M}if(!_)break;S+=M+1;var U=void 0;if(_[0]==" "){var Z=e.cm.options.tabSize,J=Z-e.col%Z;U=C.appendChild(E("span",pr(J),"cm-tab")),U.setAttribute("role","presentation"),U.setAttribute("cm-text"," "),e.col+=J}else _[0]=="\r"||_[0]==` -`?(U=C.appendChild(E("span",_[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),U.setAttribute("cm-text",_[0]),e.col+=1):(U=e.cm.options.specialCharPlaceholder(_[0]),U.setAttribute("cm-text",_[0]),c&&d<9?C.appendChild(E("span",[U])):C.appendChild(U),e.col+=1);e.map.push(e.pos,e.pos+1,U),e.pos++}}if(e.trailingSpace=g.charCodeAt(t.length-1)==32,i||r||n||b||u||p){var ee=i||"";r&&(ee+=r),n&&(ee+=n);var V=E("span",[C],ee,u);if(p)for(var ie in p)p.hasOwnProperty(ie)&&ie!="style"&&ie!="class"&&V.setAttribute(ie,p[ie]);return e.content.appendChild(V)}e.content.appendChild(C)}}function vd(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;nb&&S.from<=b));_++);if(S.to>=C)return e(i,r,n,u,p,g,m);e(i,r.slice(0,S.to-b),n,u,null,g,m),u=null,r=r.slice(S.to-b),b=S.to}}}function ms(e,t,i,r){var n=!r&&i.widgetNode;n&&e.map.push(e.pos,e.pos+t,n),!r&&e.cm.display.input.needsContentAttribute&&(n||(n=e.content.appendChild(document.createElement("span"))),n.setAttribute("cm-marker",i.id)),n&&(e.cm.display.input.setUneditable(n),e.content.appendChild(n)),e.pos+=t,e.trailingSpace=!1}function yd(e,t,i){var r=e.markedSpans,n=e.text,u=0;if(!r){for(var p=1;pm||we.collapsed&&le.to==m&&le.from==m)){if(le.to!=null&&le.to!=m&&M>le.to&&(M=le.to,U=""),we.className&&(P+=" "+we.className),we.css&&(_=(_?_+";":"")+we.css),we.startStyle&&le.from==m&&(Z+=" "+we.startStyle),we.endStyle&&le.to==M&&(ie||(ie=[])).push(we.endStyle,le.to),we.title&&((ee||(ee={})).title=we.title),we.attributes)for(var Le in we.attributes)(ee||(ee={}))[Le]=we.attributes[Le];we.collapsed&&(!J||pa(J.marker,we)<0)&&(J=le)}else le.from>m&&M>le.from&&(M=le.from)}if(ie)for(var it=0;it=g)break;for(var Et=Math.min(g,M);;){if(C){var wt=m+C.length;if(!J){var Xe=wt>Et?C.slice(0,Et-m):C;t.addToken(t,Xe,S?S+P:P,Z,m+Xe.length==M?U:"",_,ee)}if(wt>=Et){C=C.slice(Et-m),m=Et;break}m=wt,Z=""}C=n.slice(u,u=i[b++]),S=ps(i[b++],t.cm.options)}}}function vs(e,t,i){this.line=t,this.rest=fd(t),this.size=this.rest?Fe(De(this.rest))-i+1:1,this.node=this.text=null,this.hidden=mr(e,t)}function _n(e,t,i){for(var r=[],n,u=t;u2&&u.push((m.bottom+b.top)/2-i.top)}}u.push(i.bottom-i.top)}}function ks(e,t,i){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var r=0;ri)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}}function Ld(e,t){t=qt(t);var i=Fe(t),r=e.display.externalMeasured=new vs(e.doc,t,i);r.lineN=i;var n=r.built=gs(e,r);return r.text=n.pre,Y(e.display.lineMeasure,n.pre),r}function Ss(e,t,i,r){return Jt(e,ti(e,t),i,r)}function wa(e,t){if(t>=e.display.viewFrom&&t=i.lineN&&tt)&&(u=m-g,n=u-1,t>=m&&(p="right")),n!=null){if(r=e[b+2],g==m&&i==(r.insertLeft?"left":"right")&&(p=i),i=="left"&&n==0)for(;b&&e[b-2]==e[b-3]&&e[b-1].insertLeft;)r=e[(b-=3)+2],p="left";if(i=="right"&&n==m-g)for(;b=0&&(i=e[n]).left==i.right;n--);return i}function Bd(e,t,i,r){var n=As(t.map,i,r),u=n.node,p=n.start,g=n.end,m=n.collapse,b;if(u.nodeType==3){for(var C=0;C<4;C++){for(;p&&Qo(t.line.text.charAt(n.coverStart+p));)--p;for(;n.coverStart+g0&&(m=r="right");var S;e.options.lineWrapping&&(S=u.getClientRects()).length>1?b=S[r=="right"?S.length-1:0]:b=u.getBoundingClientRect()}if(c&&d<9&&!p&&(!b||!b.left&&!b.right)){var _=u.parentNode.getClientRects()[0];_?b={left:_.left,right:_.left+ii(e.display),top:_.top,bottom:_.bottom}:b=Es}for(var M=b.top-t.rect.top,P=b.bottom-t.rect.top,U=(M+P)/2,Z=t.view.measure.heights,J=0;J=r.text.length?(m=r.text.length,b="before"):m<=0&&(m=0,b="after"),!g)return p(b=="before"?m-1:m,b=="before");function C(P,U,Z){var J=g[U],ee=J.level==1;return p(Z?P-1:P,ee!=Z)}var S=Mi(g,m,b),_=Li,M=C(m,S,b=="before");return _!=null&&(M.other=C(m,_,b!="before")),M}function _s(e,t){var i=0;t=ve(e.doc,t),e.options.lineWrapping||(i=ii(e.display)*t.ch);var r=ae(e.doc,t.line),n=ir(r)+zn(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function Da(e,t,i,r,n){var u=K(e,t,i);return u.xRel=n,r&&(u.outside=r),u}function ka(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return Da(r.first,0,null,-1,-1);var n=Br(r,i),u=r.first+r.size-1;if(n>u)return Da(r.first+r.size-1,ae(r,u).text.length,null,1,1);t<0&&(t=0);for(var p=ae(r,n);;){var g=zd(e,p,n,t,i),m=sd(p,g.ch+(g.xRel>0||g.outside>0?1:0));if(!m)return g;var b=m.find(1);if(b.line==n)return b;p=ae(r,n=b.line)}}function zs(e,t,i,r){r-=Ca(t);var n=t.text.length,u=Ti(function(p){return Jt(e,i,p-1).bottom<=r},n,0);return n=Ti(function(p){return Jt(e,i,p).top>r},u,n),{begin:u,end:n}}function Ns(e,t,i,r){i||(i=ti(e,t));var n=Nn(e,t,Jt(e,i,r),"line").top;return zs(e,t,i,n)}function Sa(e,t,i,r){return e.bottom<=i?!1:e.top>i?!0:(r?e.left:e.right)>t}function zd(e,t,i,r,n){n-=ir(t);var u=ti(e,t),p=Ca(t),g=0,m=t.text.length,b=!0,C=tr(t,e.doc.direction);if(C){var S=(e.options.lineWrapping?Od:Nd)(e,t,i,u,C,r,n);b=S.level!=1,g=b?S.from:S.to-1,m=b?S.to:S.from-1}var _=null,M=null,P=Ti(function(se){var le=Jt(e,u,se);return le.top+=p,le.bottom+=p,Sa(le,r,n,!1)?(le.top<=n&&le.left<=r&&(_=se,M=le),!0):!1},g,m),U,Z,J=!1;if(M){var ee=r-M.left=ie.bottom?1:0}return P=Gl(t.text,P,1),Da(i,P,Z,J,r-U)}function Nd(e,t,i,r,n,u,p){var g=Ti(function(S){var _=n[S],M=_.level!=1;return Sa(Rt(e,K(i,M?_.to:_.from,M?"before":"after"),"line",t,r),u,p,!0)},0,n.length-1),m=n[g];if(g>0){var b=m.level!=1,C=Rt(e,K(i,b?m.from:m.to,b?"after":"before"),"line",t,r);Sa(C,u,p,!0)&&C.top>p&&(m=n[g-1])}return m}function Od(e,t,i,r,n,u,p){var g=zs(e,t,r,p),m=g.begin,b=g.end;/\s/.test(t.text.charAt(b-1))&&b--;for(var C=null,S=null,_=0;_=b||M.to<=m)){var P=M.level!=1,U=Jt(e,r,P?Math.min(b,M.to)-1:Math.max(m,M.from)).right,Z=UZ)&&(C=M,S=Z)}}return C||(C=n[n.length-1]),C.fromb&&(C={from:C.from,to:b,level:C.level}),C}var zr;function ri(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(zr==null){zr=E("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)zr.appendChild(document.createTextNode("x")),zr.appendChild(E("br"));zr.appendChild(document.createTextNode("x"))}Y(e.measure,zr);var i=zr.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),H(e.measure),i||1}function ii(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=E("span","xxxxxxxxxx"),i=E("pre",[t],"CodeMirror-line-like");Y(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function Ea(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,u=t.gutters.firstChild,p=0;u;u=u.nextSibling,++p){var g=e.display.gutterSpecs[p].className;i[g]=u.offsetLeft+u.clientLeft+n,r[g]=u.clientWidth}return{fixedPos:Aa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Aa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Os(e){var t=ri(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/ii(e.display)-3);return function(n){if(mr(e.doc,n))return 0;var u=0;if(n.widgets)for(var p=0;p0&&(b=ae(e.doc,m.line).text).length==m.ch){var C=Ye(b,b.length,e.options.tabSize)-b.length;m=K(m.line,Math.max(0,Math.round((u-Ds(e.display).left)/ii(e.display))-C))}return m}function Or(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var i=e.display.view,r=0;rt)&&(n.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=n.viewTo)rr&&ga(e.doc,t)n.viewFrom?br(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)br(e);else if(t<=n.viewFrom){var u=In(e,i,i+r,1);u?(n.view=n.view.slice(u.index),n.viewFrom=u.lineN,n.viewTo+=r):br(e)}else if(i>=n.viewTo){var p=In(e,t,t,-1);p?(n.view=n.view.slice(0,p.index),n.viewTo=p.lineN):br(e)}else{var g=In(e,t,t,-1),m=In(e,i,i+r,1);g&&m?(n.view=n.view.slice(0,g.index).concat(_n(e,g.lineN,m.lineN)).concat(n.view.slice(m.index)),n.viewTo+=r):br(e)}var b=n.externalMeasured;b&&(i=n.lineN&&t=r.viewTo)){var u=r.view[Or(e,t)];if(u.node!=null){var p=u.changes||(u.changes=[]);ze(p,i)==-1&&p.push(i)}}}function br(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function In(e,t,i,r){var n=Or(e,t),u,p=e.display.view;if(!rr||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var g=e.display.viewFrom,m=0;m0){if(n==p.length-1)return null;u=g+p[n].size-t,n++}else u=g-t;t+=u,i+=u}for(;ga(e.doc,i)!=i;){if(n==(r<0?0:p.length-1))return null;i+=r*p[n-(r<0?1:0)].size,n+=r}return{index:n,lineN:i}}function Id(e,t,i){var r=e.display,n=r.view;n.length==0||t>=r.viewTo||i<=r.viewFrom?(r.view=_n(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=_n(e,t,r.viewFrom).concat(r.view):r.viewFromi&&(r.view=r.view.slice(0,Or(e,i)))),r.viewTo=i}function Is(e){for(var t=e.display.view,i=0,r=0;r=e.display.viewTo||m.to().line0?p:e.defaultCharWidth())+"px"}if(r.other){var g=i.appendChild(E("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));g.style.display="",g.style.left=r.other.left+"px",g.style.top=r.other.top+"px",g.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Hn(e,t){return e.top-t.top||e.left-t.left}function Hd(e,t,i){var r=e.display,n=e.doc,u=document.createDocumentFragment(),p=Ds(e.display),g=p.left,m=Math.max(r.sizerWidth,_r(e)-r.sizer.offsetLeft)-p.right,b=n.direction=="ltr";function C(V,ie,se,le){ie<0&&(ie=0),ie=Math.round(ie),le=Math.round(le),u.appendChild(E("div",null,"CodeMirror-selected","position: absolute; left: "+V+`px; +`,t);n==-1&&(n=e.length);var u=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),p=u.indexOf("\r");p!=-1?(i.push(u.slice(0,p)),t+=p+1):(i.push(u),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},Xc=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch{return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch{}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Kc=function(){var e=E("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),ia=null;function Yc(e){if(ia!=null)return ia;var t=Y(e,E("span","x")),i=t.getBoundingClientRect(),r=W(t,0,1).getBoundingClientRect();return ia=Math.abs(i.left-r.left)>1}var na={},Vr={};function Zc(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),na[e]=t}function Qc(e,t){Vr[e]=t}function Sn(e){if(typeof e=="string"&&Vr.hasOwnProperty(e))e=Vr[e];else if(e&&typeof e.name=="string"&&Vr.hasOwnProperty(e.name)){var t=Vr[e.name];typeof t=="string"&&(t={name:t}),e=Ul(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Sn("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Sn("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function oa(e,t){t=Sn(t);var i=na[t.name];if(!i)return oa(e,"text/plain");var r=i(e,t);if($r.hasOwnProperty(t.name)){var n=$r[t.name];for(var u in n)n.hasOwnProperty(u)&&(r.hasOwnProperty(u)&&(r["_"+u]=r[u]),r[u]=n[u])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var p in t.modeProps)r[p]=t.modeProps[p];return r}var $r={};function Jc(e,t){var i=$r.hasOwnProperty(e)?$r[e]:$r[e]={};Lt(t,i)}function Lr(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var r in t){var n=t[r];n instanceof Array&&(n=n.concat([])),i[r]=n}return i}function aa(e,t){for(var i;e.innerMode&&(i=e.innerMode(t),!(!i||i.mode==e));)t=i.state,e=i.mode;return i||{mode:e,state:t}}function Ql(e,t,i){return e.startState?e.startState(t,i):!0}var Ge=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};Ge.prototype.eol=function(){return this.pos>=this.string.length},Ge.prototype.sol=function(){return this.pos==this.lineStart},Ge.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ge.prototype.next=function(){if(this.post},Ge.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ge.prototype.skipToEnd=function(){this.pos=this.string.length},Ge.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ge.prototype.backUp=function(e){this.pos-=e},Ge.prototype.column=function(){return this.lastColumnPos0?null:(u&&t!==!1&&(this.pos+=u[0].length),u)}},Ge.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ge.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ge.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ge.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ae(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var i=e;!i.lines;)for(var r=0;;++r){var n=i.children[r],u=n.chunkSize();if(t=e.first&&ti?K(i,ae(e,i).text.length):Vc(t,ae(e,t.line).text.length)}function Vc(e,t){var i=e.ch;return i==null||i>t?K(e.line,t):i<0?K(e.line,0):e}function Vl(e,t){for(var i=[],r=0;rthis.maxLookAhead&&(this.maxLookAhead=e),t},Zt.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},Zt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Zt.fromSaved=function(e,t,i){return t instanceof Fn?new Zt(e,Lr(e.mode,t.state),i,t.lookAhead):new Zt(e,Lr(e.mode,t),i)},Zt.prototype.save=function(e){var t=e!==!1?Lr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Fn(t,this.maxLookAhead):t};function $l(e,t,i,r){var n=[e.state.modeGen],u={};os(e,t.text,e.doc.mode,i,function(b,C){return n.push(b,C)},u,r);for(var p=i.state,g=function(b){i.baseTokens=n;var C=e.state.overlays[b],S=1,_=0;i.state=!0,os(e,t.text,C.mode,i,function(M,P){for(var U=S;_M&&n.splice(S,1,M,n[S+1],Z),S+=2,_=Math.min(M,Z)}if(P)if(C.opaque)n.splice(U,S-U,M,"overlay "+P),S=U+2;else for(;Ue.options.maxHighlightLength&&Lr(e.doc.mode,r.state),u=$l(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=u.styles,u.classes?t.styleClasses=u.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Ni(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new Zt(r,!0,t);var u=$c(e,t,i),p=u>r.first&&ae(r,u-1).stateAfter,g=p?Zt.fromSaved(r,p,u):new Zt(r,Ql(r.mode),u);return r.iter(u,t,function(m){ca(e,m.text,g);var b=g.line;m.stateAfter=b==t-1||b%5==0||b>=n.viewFrom&&bt.start)return u}throw new Error("Mode "+e.name+" failed to advance stream.")}var rs=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function is(e,t,i,r){var n=e.doc,u=n.mode,p;t=ve(n,t);var g=ae(n,t.line),m=Ni(e,t.line,i),b=new Ge(g.text,e.options.tabSize,m),C;for(r&&(C=[]);(r||b.pose.options.maxHighlightLength?(g=!1,p&&ca(e,t,r,C.pos),C.pos=t.length,S=null):S=ns(da(i,C,r.state,_),u),_){var M=_[0].name;M&&(S="m-"+(S?M+" "+S:M))}if(!g||b!=S){for(;mp;--g){if(g<=u.first)return u.first;var m=ae(u,g-1),b=m.stateAfter;if(b&&(!i||g+(b instanceof Fn?b.lookAhead:0)<=u.modeFrontier))return g;var C=Ye(m.text,null,e.options.tabSize);(n==null||r>C)&&(n=g-1,r=C)}return n}function ed(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontieri;r--){var n=ae(e,r).stateAfter;if(n&&(!(n instanceof Fn)||r+n.lookAhead=t:u.to>t);(r||(r=[])).push(new Tn(p,u.from,m?null:u.to))}}return r}function ad(e,t,i){var r;if(e)for(var n=0;n=t:u.to>t);if(g||u.from==t&&p.type=="bookmark"&&(!i||u.marker.insertLeft)){var m=u.from==null||(p.inclusiveLeft?u.from<=t:u.from0&&g)for(var ie=0;ie0)){var C=[m,1],S=me(b.from,g.from),_=me(b.to,g.to);(S<0||!p.inclusiveLeft&&!S)&&C.push({from:b.from,to:g.from}),(_>0||!p.inclusiveRight&&!_)&&C.push({from:g.to,to:b.to}),n.splice.apply(n,C),m+=C.length-3}}return n}function ss(e){var t=e.markedSpans;if(t){for(var i=0;it)&&(!r||pa(r,u.marker)<0)&&(r=u.marker)}return r}function ds(e,t,i,r,n){var u=ae(e,t),p=rr&&u.markedSpans;if(p)for(var g=0;g=0&&S<=0||C<=0&&S>=0)&&(C<=0&&(m.marker.inclusiveRight&&n.inclusiveLeft?me(b.to,i)>=0:me(b.to,i)>0)||C>=0&&(m.marker.inclusiveRight&&n.inclusiveLeft?me(b.from,r)<=0:me(b.from,r)<0)))return!0}}}function qt(e){for(var t;t=cs(e);)e=t.find(-1,!0).line;return e}function ud(e){for(var t;t=Bn(e);)e=t.find(1,!0).line;return e}function fd(e){for(var t,i;t=Bn(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function ga(e,t){var i=ae(e,t),r=qt(i);return i==r?t:Fe(r)}function hs(e,t){if(t>e.lastLine())return t;var i=ae(e,t),r;if(!mr(e,i))return t;for(;r=Bn(i);)i=r.find(1,!0).line;return Fe(i)+1}function mr(e,t){var i=rr&&t.markedSpans;if(i){for(var r=void 0,n=0;nt.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var ei=function(e,t,i){this.text=e,us(this,t),this.height=i?i(this):1};ei.prototype.lineNo=function(){return Fe(this)},Jr(ei);function cd(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),ss(e),us(e,i);var n=r?r(e):1;n!=e.height&&Yt(e,n)}function dd(e){e.parent=null,ss(e)}var hd={},pd={};function ps(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?pd:hd;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function gs(e,t){var i=q("span",null,null,v?"padding-right: .1px":null),r={pre:q("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var u=n?t.rest[n-1]:t.line,p=void 0;r.pos=0,r.addToken=md,Gc(e.display.measure)&&(p=tr(u,e.doc.direction))&&(r.addToken=bd(r.addToken,p)),r.map=[];var g=t!=e.display.externalMeasured&&Fe(u);yd(u,r,es(e,u,g)),u.styleClasses&&(u.styleClasses.bgClass&&(r.bgClass=Ae(u.styleClasses.bgClass,r.bgClass||"")),u.styleClasses.textClass&&(r.textClass=Ae(u.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(jc(e.display.measure))),n==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(v){var m=r.content.lastChild;(/\bcm-tab\b/.test(m.className)||m.querySelector&&m.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return je(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=Ae(r.pre.className,r.textClass||"")),r}function gd(e){var t=E("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function md(e,t,i,r,n,u,p){if(t){var g=e.splitSpaces?vd(t,e.trailingSpace):t,m=e.cm.state.specialChars,b=!1,C;if(!m.test(t))e.col+=t.length,C=document.createTextNode(g),e.map.push(e.pos,e.pos+t.length,C),c&&d<9&&(b=!0),e.pos+=t.length;else{C=document.createDocumentFragment();for(var S=0;;){m.lastIndex=S;var _=m.exec(t),M=_?_.index-S:t.length-S;if(M){var P=document.createTextNode(g.slice(S,S+M));c&&d<9?C.appendChild(E("span",[P])):C.appendChild(P),e.map.push(e.pos,e.pos+M,P),e.col+=M,e.pos+=M}if(!_)break;S+=M+1;var U=void 0;if(_[0]==" "){var Z=e.cm.options.tabSize,J=Z-e.col%Z;U=C.appendChild(E("span",pr(J),"cm-tab")),U.setAttribute("role","presentation"),U.setAttribute("cm-text"," "),e.col+=J}else _[0]=="\r"||_[0]==` +`?(U=C.appendChild(E("span",_[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),U.setAttribute("cm-text",_[0]),e.col+=1):(U=e.cm.options.specialCharPlaceholder(_[0]),U.setAttribute("cm-text",_[0]),c&&d<9?C.appendChild(E("span",[U])):C.appendChild(U),e.col+=1);e.map.push(e.pos,e.pos+1,U),e.pos++}}if(e.trailingSpace=g.charCodeAt(t.length-1)==32,i||r||n||b||u||p){var ee=i||"";r&&(ee+=r),n&&(ee+=n);var V=E("span",[C],ee,u);if(p)for(var ie in p)p.hasOwnProperty(ie)&&ie!="style"&&ie!="class"&&V.setAttribute(ie,p[ie]);return e.content.appendChild(V)}e.content.appendChild(C)}}function vd(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;nb&&S.from<=b));_++);if(S.to>=C)return e(i,r,n,u,p,g,m);e(i,r.slice(0,S.to-b),n,u,null,g,m),u=null,r=r.slice(S.to-b),b=S.to}}}function ms(e,t,i,r){var n=!r&&i.widgetNode;n&&e.map.push(e.pos,e.pos+t,n),!r&&e.cm.display.input.needsContentAttribute&&(n||(n=e.content.appendChild(document.createElement("span"))),n.setAttribute("cm-marker",i.id)),n&&(e.cm.display.input.setUneditable(n),e.content.appendChild(n)),e.pos+=t,e.trailingSpace=!1}function yd(e,t,i){var r=e.markedSpans,n=e.text,u=0;if(!r){for(var p=1;pm||we.collapsed&&le.to==m&&le.from==m)){if(le.to!=null&&le.to!=m&&M>le.to&&(M=le.to,U=""),we.className&&(P+=" "+we.className),we.css&&(_=(_?_+";":"")+we.css),we.startStyle&&le.from==m&&(Z+=" "+we.startStyle),we.endStyle&&le.to==M&&(ie||(ie=[])).push(we.endStyle,le.to),we.title&&((ee||(ee={})).title=we.title),we.attributes)for(var Le in we.attributes)(ee||(ee={}))[Le]=we.attributes[Le];we.collapsed&&(!J||pa(J.marker,we)<0)&&(J=le)}else le.from>m&&M>le.from&&(M=le.from)}if(ie)for(var it=0;it=g)break;for(var Et=Math.min(g,M);;){if(C){var wt=m+C.length;if(!J){var Xe=wt>Et?C.slice(0,Et-m):C;t.addToken(t,Xe,S?S+P:P,Z,m+Xe.length==M?U:"",_,ee)}if(wt>=Et){C=C.slice(Et-m),m=Et;break}m=wt,Z=""}C=n.slice(u,u=i[b++]),S=ps(i[b++],t.cm.options)}}}function vs(e,t,i){this.line=t,this.rest=fd(t),this.size=this.rest?Fe(De(this.rest))-i+1:1,this.node=this.text=null,this.hidden=mr(e,t)}function zn(e,t,i){for(var r=[],n,u=t;u2&&u.push((m.bottom+b.top)/2-i.top)}}u.push(i.bottom-i.top)}}function ks(e,t,i){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var r=0;ri)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}}function Ld(e,t){t=qt(t);var i=Fe(t),r=e.display.externalMeasured=new vs(e.doc,t,i);r.lineN=i;var n=r.built=gs(e,r);return r.text=n.pre,Y(e.display.lineMeasure,n.pre),r}function Ss(e,t,i,r){return Jt(e,ri(e,t),i,r)}function wa(e,t){if(t>=e.display.viewFrom&&t=i.lineN&&tt)&&(u=m-g,n=u-1,t>=m&&(p="right")),n!=null){if(r=e[b+2],g==m&&i==(r.insertLeft?"left":"right")&&(p=i),i=="left"&&n==0)for(;b&&e[b-2]==e[b-3]&&e[b-1].insertLeft;)r=e[(b-=3)+2],p="left";if(i=="right"&&n==m-g)for(;b=0&&(i=e[n]).left==i.right;n--);return i}function Bd(e,t,i,r){var n=As(t.map,i,r),u=n.node,p=n.start,g=n.end,m=n.collapse,b;if(u.nodeType==3){for(var C=0;C<4;C++){for(;p&&Qo(t.line.text.charAt(n.coverStart+p));)--p;for(;n.coverStart+g0&&(m=r="right");var S;e.options.lineWrapping&&(S=u.getClientRects()).length>1?b=S[r=="right"?S.length-1:0]:b=u.getBoundingClientRect()}if(c&&d<9&&!p&&(!b||!b.left&&!b.right)){var _=u.parentNode.getClientRects()[0];_?b={left:_.left,right:_.left+ni(e.display),top:_.top,bottom:_.bottom}:b=Es}for(var M=b.top-t.rect.top,P=b.bottom-t.rect.top,U=(M+P)/2,Z=t.view.measure.heights,J=0;J=r.text.length?(m=r.text.length,b="before"):m<=0&&(m=0,b="after"),!g)return p(b=="before"?m-1:m,b=="before");function C(P,U,Z){var J=g[U],ee=J.level==1;return p(Z?P-1:P,ee!=Z)}var S=Bi(g,m,b),_=Mi,M=C(m,S,b=="before");return _!=null&&(M.other=C(m,_,b!="before")),M}function _s(e,t){var i=0;t=ve(e.doc,t),e.options.lineWrapping||(i=ni(e.display)*t.ch);var r=ae(e.doc,t.line),n=ir(r)+Nn(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function Da(e,t,i,r,n){var u=K(e,t,i);return u.xRel=n,r&&(u.outside=r),u}function ka(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return Da(r.first,0,null,-1,-1);var n=Br(r,i),u=r.first+r.size-1;if(n>u)return Da(r.first+r.size-1,ae(r,u).text.length,null,1,1);t<0&&(t=0);for(var p=ae(r,n);;){var g=zd(e,p,n,t,i),m=sd(p,g.ch+(g.xRel>0||g.outside>0?1:0));if(!m)return g;var b=m.find(1);if(b.line==n)return b;p=ae(r,n=b.line)}}function zs(e,t,i,r){r-=Ca(t);var n=t.text.length,u=Li(function(p){return Jt(e,i,p-1).bottom<=r},n,0);return n=Li(function(p){return Jt(e,i,p).top>r},u,n),{begin:u,end:n}}function Ns(e,t,i,r){i||(i=ri(e,t));var n=On(e,t,Jt(e,i,r),"line").top;return zs(e,t,i,n)}function Sa(e,t,i,r){return e.bottom<=i?!1:e.top>i?!0:(r?e.left:e.right)>t}function zd(e,t,i,r,n){n-=ir(t);var u=ri(e,t),p=Ca(t),g=0,m=t.text.length,b=!0,C=tr(t,e.doc.direction);if(C){var S=(e.options.lineWrapping?Od:Nd)(e,t,i,u,C,r,n);b=S.level!=1,g=b?S.from:S.to-1,m=b?S.to:S.from-1}var _=null,M=null,P=Li(function(se){var le=Jt(e,u,se);return le.top+=p,le.bottom+=p,Sa(le,r,n,!1)?(le.top<=n&&le.left<=r&&(_=se,M=le),!0):!1},g,m),U,Z,J=!1;if(M){var ee=r-M.left=ie.bottom?1:0}return P=Gl(t.text,P,1),Da(i,P,Z,J,r-U)}function Nd(e,t,i,r,n,u,p){var g=Li(function(S){var _=n[S],M=_.level!=1;return Sa(Rt(e,K(i,M?_.to:_.from,M?"before":"after"),"line",t,r),u,p,!0)},0,n.length-1),m=n[g];if(g>0){var b=m.level!=1,C=Rt(e,K(i,b?m.from:m.to,b?"after":"before"),"line",t,r);Sa(C,u,p,!0)&&C.top>p&&(m=n[g-1])}return m}function Od(e,t,i,r,n,u,p){var g=zs(e,t,r,p),m=g.begin,b=g.end;/\s/.test(t.text.charAt(b-1))&&b--;for(var C=null,S=null,_=0;_=b||M.to<=m)){var P=M.level!=1,U=Jt(e,r,P?Math.min(b,M.to)-1:Math.max(m,M.from)).right,Z=UZ)&&(C=M,S=Z)}}return C||(C=n[n.length-1]),C.fromb&&(C={from:C.from,to:b,level:C.level}),C}var zr;function ii(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(zr==null){zr=E("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)zr.appendChild(document.createTextNode("x")),zr.appendChild(E("br"));zr.appendChild(document.createTextNode("x"))}Y(e.measure,zr);var i=zr.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),H(e.measure),i||1}function ni(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=E("span","xxxxxxxxxx"),i=E("pre",[t],"CodeMirror-line-like");Y(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function Ea(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,u=t.gutters.firstChild,p=0;u;u=u.nextSibling,++p){var g=e.display.gutterSpecs[p].className;i[g]=u.offsetLeft+u.clientLeft+n,r[g]=u.clientWidth}return{fixedPos:Aa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Aa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Os(e){var t=ii(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/ni(e.display)-3);return function(n){if(mr(e.doc,n))return 0;var u=0;if(n.widgets)for(var p=0;p0&&(b=ae(e.doc,m.line).text).length==m.ch){var C=Ye(b,b.length,e.options.tabSize)-b.length;m=K(m.line,Math.max(0,Math.round((u-Ds(e.display).left)/ni(e.display))-C))}return m}function Or(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var i=e.display.view,r=0;rt)&&(n.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=n.viewTo)rr&&ga(e.doc,t)n.viewFrom?br(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)br(e);else if(t<=n.viewFrom){var u=Hn(e,i,i+r,1);u?(n.view=n.view.slice(u.index),n.viewFrom=u.lineN,n.viewTo+=r):br(e)}else if(i>=n.viewTo){var p=Hn(e,t,t,-1);p?(n.view=n.view.slice(0,p.index),n.viewTo=p.lineN):br(e)}else{var g=Hn(e,t,t,-1),m=Hn(e,i,i+r,1);g&&m?(n.view=n.view.slice(0,g.index).concat(zn(e,g.lineN,m.lineN)).concat(n.view.slice(m.index)),n.viewTo+=r):br(e)}var b=n.externalMeasured;b&&(i=n.lineN&&t=r.viewTo)){var u=r.view[Or(e,t)];if(u.node!=null){var p=u.changes||(u.changes=[]);ze(p,i)==-1&&p.push(i)}}}function br(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Hn(e,t,i,r){var n=Or(e,t),u,p=e.display.view;if(!rr||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var g=e.display.viewFrom,m=0;m0){if(n==p.length-1)return null;u=g+p[n].size-t,n++}else u=g-t;t+=u,i+=u}for(;ga(e.doc,i)!=i;){if(n==(r<0?0:p.length-1))return null;i+=r*p[n-(r<0?1:0)].size,n+=r}return{index:n,lineN:i}}function Id(e,t,i){var r=e.display,n=r.view;n.length==0||t>=r.viewTo||i<=r.viewFrom?(r.view=zn(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=zn(e,t,r.viewFrom).concat(r.view):r.viewFromi&&(r.view=r.view.slice(0,Or(e,i)))),r.viewTo=i}function Is(e){for(var t=e.display.view,i=0,r=0;r=e.display.viewTo||m.to().line0?p:e.defaultCharWidth())+"px"}if(r.other){var g=i.appendChild(E("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));g.style.display="",g.style.left=r.other.left+"px",g.style.top=r.other.top+"px",g.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Pn(e,t){return e.top-t.top||e.left-t.left}function Hd(e,t,i){var r=e.display,n=e.doc,u=document.createDocumentFragment(),p=Ds(e.display),g=p.left,m=Math.max(r.sizerWidth,_r(e)-r.sizer.offsetLeft)-p.right,b=n.direction=="ltr";function C(V,ie,se,le){ie<0&&(ie=0),ie=Math.round(ie),le=Math.round(le),u.appendChild(E("div",null,"CodeMirror-selected","position: absolute; left: "+V+`px; top: `+ie+"px; width: "+(se??m-V)+`px; - height: `+(le-ie)+"px"))}function S(V,ie,se){var le=ae(n,V),we=le.text.length,Le,it;function Ie(Xe,Ct){return On(e,K(V,Xe),"div",le,Ct)}function Et(Xe,Ct,ot){var Qe=Ns(e,le,null,Xe),Ke=Ct=="ltr"==(ot=="after")?"left":"right",qe=ot=="after"?Qe.begin:Qe.end-(/\s/.test(le.text.charAt(Qe.end-1))?2:1);return Ie(qe,Ke)[Ke]}var wt=tr(le,n.direction);return Rc(wt,ie||0,se??we,function(Xe,Ct,ot,Qe){var Ke=ot=="ltr",qe=Ie(Xe,Ke?"left":"right"),Dt=Ie(Ct-1,Ke?"right":"left"),mi=ie==null&&Xe==0,kr=se==null&&Ct==we,st=Qe==0,Vt=!wt||Qe==wt.length-1;if(Dt.top-qe.top<=3){var nt=(b?mi:kr)&&st,rl=(b?kr:mi)&&Vt,lr=nt?g:(Ke?qe:Dt).left,Rr=rl?m:(Ke?Dt:qe).right;C(lr,qe.top,Rr-lr,qe.bottom)}else{var Wr,ht,vi,il;Ke?(Wr=b&&mi&&st?g:qe.left,ht=b?m:Et(Xe,ot,"before"),vi=b?g:Et(Ct,ot,"after"),il=b&&kr&&Vt?m:Dt.right):(Wr=b?Et(Xe,ot,"before"):g,ht=!b&&mi&&st?m:qe.right,vi=!b&&kr&&Vt?g:Dt.left,il=b?Et(Ct,ot,"after"):m),C(Wr,qe.top,ht-Wr,qe.bottom),qe.bottom0?t.blinker=setInterval(function(){e.hasFocus()||ni(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Ps(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Ba(e))}function Ma(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&ni(e))},100)}function Ba(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(je(e,"focus",e,t),e.state.focused=!0,be(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),v&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),La(e))}function ni(e,t){e.state.delayingBlurEvent||(e.state.focused&&(je(e,"blur",e,t),e.state.focused=!1,oe(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function Pn(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),n=t.lineDiv.getBoundingClientRect().top,u=0,p=0;p.005||M<-.005)&&(ne.display.sizerWidth){var U=Math.ceil(C/ii(e.display));U>e.display.maxLineLength&&(e.display.maxLineLength=U,e.display.maxLine=g.line,e.display.maxLineChanged=!0)}}}Math.abs(u)>2&&(t.scroller.scrollTop+=u)}function qs(e){if(e.widgets)for(var t=0;t=p&&(u=Br(t,ir(ae(t,m))-e.wrapper.clientHeight),p=m)}return{from:u,to:Math.max(p,u+1)}}function Pd(e,t){if(!$e(e,"scrollCursorIntoView")){var i=e.display,r=i.sizer.getBoundingClientRect(),n=null,u=i.wrapper.ownerDocument;if(t.top+r.top<0?n=!0:t.bottom+r.top>(u.defaultView.innerHeight||u.documentElement.clientHeight)&&(n=!1),n!=null&&!L){var p=E("div","\u200B",null,`position: absolute; - top: `+(t.top-i.viewOffset-zn(e.display))+`px; + height: `+(le-ie)+"px"))}function S(V,ie,se){var le=ae(n,V),we=le.text.length,Le,it;function Ie(Xe,Ct){return In(e,K(V,Xe),"div",le,Ct)}function Et(Xe,Ct,ot){var Qe=Ns(e,le,null,Xe),Ke=Ct=="ltr"==(ot=="after")?"left":"right",qe=ot=="after"?Qe.begin:Qe.end-(/\s/.test(le.text.charAt(Qe.end-1))?2:1);return Ie(qe,Ke)[Ke]}var wt=tr(le,n.direction);return Rc(wt,ie||0,se??we,function(Xe,Ct,ot,Qe){var Ke=ot=="ltr",qe=Ie(Xe,Ke?"left":"right"),Dt=Ie(Ct-1,Ke?"right":"left"),vi=ie==null&&Xe==0,kr=se==null&&Ct==we,st=Qe==0,Vt=!wt||Qe==wt.length-1;if(Dt.top-qe.top<=3){var nt=(b?vi:kr)&&st,rl=(b?kr:vi)&&Vt,lr=nt?g:(Ke?qe:Dt).left,Rr=rl?m:(Ke?Dt:qe).right;C(lr,qe.top,Rr-lr,qe.bottom)}else{var Wr,ht,bi,il;Ke?(Wr=b&&vi&&st?g:qe.left,ht=b?m:Et(Xe,ot,"before"),bi=b?g:Et(Ct,ot,"after"),il=b&&kr&&Vt?m:Dt.right):(Wr=b?Et(Xe,ot,"before"):g,ht=!b&&vi&&st?m:qe.right,bi=!b&&kr&&Vt?g:Dt.left,il=b?Et(Ct,ot,"after"):m),C(Wr,qe.top,ht-Wr,qe.bottom),qe.bottom0?t.blinker=setInterval(function(){e.hasFocus()||oi(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Ps(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Ba(e))}function Ma(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&oi(e))},100)}function Ba(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(je(e,"focus",e,t),e.state.focused=!0,be(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),v&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),La(e))}function oi(e,t){e.state.delayingBlurEvent||(e.state.focused&&(je(e,"blur",e,t),e.state.focused=!1,oe(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function qn(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),n=t.lineDiv.getBoundingClientRect().top,u=0,p=0;p.005||M<-.005)&&(ne.display.sizerWidth){var U=Math.ceil(C/ni(e.display));U>e.display.maxLineLength&&(e.display.maxLineLength=U,e.display.maxLine=g.line,e.display.maxLineChanged=!0)}}}Math.abs(u)>2&&(t.scroller.scrollTop+=u)}function qs(e){if(e.widgets)for(var t=0;t=p&&(u=Br(t,ir(ae(t,m))-e.wrapper.clientHeight),p=m)}return{from:u,to:Math.max(p,u+1)}}function Pd(e,t){if(!$e(e,"scrollCursorIntoView")){var i=e.display,r=i.sizer.getBoundingClientRect(),n=null,u=i.wrapper.ownerDocument;if(t.top+r.top<0?n=!0:t.bottom+r.top>(u.defaultView.innerHeight||u.documentElement.clientHeight)&&(n=!1),n!=null&&!L){var p=E("div","\u200B",null,`position: absolute; + top: `+(t.top-i.viewOffset-Nn(e.display))+`px; height: `+(t.bottom-t.top+Qt(e)+i.barHeight)+`px; - left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(p),p.scrollIntoView(n),e.display.lineSpace.removeChild(p)}}}function qd(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(i=t.sticky=="before"?K(t.line,t.ch+1,"before"):t,t=t.ch?K(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var u=0;u<5;u++){var p=!1,g=Rt(e,t),m=!i||i==t?g:Rt(e,i);n={left:Math.min(g.left,m.left),top:Math.min(g.top,m.top)-r,right:Math.max(g.left,m.left),bottom:Math.max(g.bottom,m.bottom)+r};var b=_a(e,n),C=e.doc.scrollTop,S=e.doc.scrollLeft;if(b.scrollTop!=null&&(Wi(e,b.scrollTop),Math.abs(e.doc.scrollTop-C)>1&&(p=!0)),b.scrollLeft!=null&&(Ir(e,b.scrollLeft),Math.abs(e.doc.scrollLeft-S)>1&&(p=!0)),!p)break}return n}function Rd(e,t){var i=_a(e,t);i.scrollTop!=null&&Wi(e,i.scrollTop),i.scrollLeft!=null&&Ir(e,i.scrollLeft)}function _a(e,t){var i=e.display,r=ri(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,u=xa(e),p={};t.bottom-t.top>u&&(t.bottom=t.top+u);var g=e.doc.height+ya(i),m=t.topg-r;if(t.topn+u){var C=Math.min(t.top,(b?g:t.bottom)-u);C!=n&&(p.scrollTop=C)}var S=e.options.fixedGutter?0:i.gutters.offsetWidth,_=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-S,M=_r(e)-i.gutters.offsetWidth,P=t.right-t.left>M;return P&&(t.right=t.left+M),t.left<10?p.scrollLeft=0:t.left<_?p.scrollLeft=Math.max(0,t.left+S-(P?0:10)):t.right>M+_-3&&(p.scrollLeft=t.right+(P?0:10)-M),p}function za(e,t){t!=null&&(Rn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function oi(e){Rn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Ri(e,t,i){(t!=null||i!=null)&&Rn(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Wd(e,t){Rn(e),e.curOp.scrollToPos=t}function Rn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=_s(e,t.from),r=_s(e,t.to);Rs(e,i,r,t.margin)}}function Rs(e,t,i,r){var n=_a(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-r,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+r});Ri(e,n.scrollLeft,n.scrollTop)}function Wi(e,t){Math.abs(e.doc.scrollTop-t)<2||(s||Oa(e,{top:t}),Ws(e,t,!0),s&&Oa(e),Gi(e,100))}function Ws(e,t,i){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),!(e.display.scroller.scrollTop==t&&!i)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Ir(e,t,i,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),!((i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)&&(e.doc.scrollLeft=t,Ks(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Ui(e){var t=e.display,i=t.gutters.offsetWidth,r=Math.round(e.doc.height+ya(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?i:0,docHeight:r,scrollHeight:r+Qt(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var Hr=function(e,t,i){this.cm=i;var r=this.vert=E("div",[E("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=E("div",[E("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=n.tabIndex=-1,e(r),e(n),ue(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),ue(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,c&&d<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Hr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var n=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+n)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=i?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var u=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+u)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?r:0,bottom:t?r:0}},Hr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Hr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Hr.prototype.zeroWidthHack=function(){var e=O&&!B?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new ct,this.disableVert=new ct},Hr.prototype.enableZeroWidthBar=function(e,t,i){e.style.visibility="";function r(){var n=e.getBoundingClientRect(),u=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);u!=e?e.style.visibility="hidden":t.set(1e3,r)}t.set(1e3,r)},Hr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ji=function(){};ji.prototype.update=function(){return{bottom:0,right:0}},ji.prototype.setScrollLeft=function(){},ji.prototype.setScrollTop=function(){},ji.prototype.clear=function(){};function ai(e,t){t||(t=Ui(e));var i=e.display.barWidth,r=e.display.barHeight;Us(e,t);for(var n=0;n<4&&i!=e.display.barWidth||r!=e.display.barHeight;n++)i!=e.display.barWidth&&e.options.lineWrapping&&Pn(e),Us(e,Ui(e)),i=e.display.barWidth,r=e.display.barHeight}function Us(e,t){var i=e.display,r=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=r.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=r.bottom)+"px",i.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=r.bottom+"px",i.scrollbarFiller.style.width=r.right+"px"):i.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=r.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}var js={native:Hr,null:ji};function Gs(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&oe(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new js[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ue(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?Ir(e,t):Wi(e,t)},e),e.display.scrollbars.addClass&&be(e.display.wrapper,e.display.scrollbars.addClass)}var Ud=0;function Pr(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Ud,markArrays:null},xd(e.curOp)}function qr(e){var t=e.curOp;t&&Cd(t,function(i){for(var r=0;r=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Wn(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Xd(e){e.updatedDisplay=e.mustUpdate&&Na(e.cm,e.update)}function Kd(e){var t=e.cm,i=t.display;e.updatedDisplay&&Pn(t),e.barMeasure=Ui(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Ss(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+Qt(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-_r(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function Yd(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)){var i=+new Date+e.options.workTime,r=zi(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(u){if(r.line>=e.display.viewFrom){var p=u.styles,g=u.text.length>e.options.maxHighlightLength?Lr(t.mode,r.state):null,m=$l(e,u,r,!0);g&&(r.state=g),u.styles=m.styles;var b=u.styleClasses,C=m.classes;C?u.styleClasses=C:b&&(u.styleClasses=null);for(var S=!p||p.length!=u.styles.length||b!=C&&(!b||!C||b.bgClass!=C.bgClass||b.textClass!=C.textClass),_=0;!S&&_i)return Gi(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&St(e,function(){for(var u=0;u=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&Is(e)==0)return!1;Ys(e)&&(br(e),t.dims=Ea(e));var n=r.first+r.size,u=Math.max(t.visible.from-e.options.viewportMargin,r.first),p=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFromp&&i.viewTo-p<20&&(p=Math.min(n,i.viewTo)),rr&&(u=ga(e.doc,u),p=hs(e.doc,p));var g=u!=i.viewFrom||p!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Id(e,u,p),i.viewOffset=ir(ae(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var m=Is(e);if(!g&&m==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var b=Vd(e);return m>4&&(i.lineDiv.style.display="none"),eh(e,i.updateLineNumbers,t.dims),m>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,$d(b),H(i.cursorDiv),H(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,g&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,Gi(e,400)),i.updateLineNumbers=null,!0}function Xs(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==_r(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+ya(e.display)-xa(e),i.top)}),t.visible=qn(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=qn(e.display,e.doc,i));if(!Na(e,t))break;Pn(e);var n=Ui(e);qi(e),ai(e,n),Ha(e,n),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Oa(e,t){var i=new Wn(e,t);if(Na(e,i)){Pn(e),Xs(e,i);var r=Ui(e);qi(e),ai(e,r),Ha(e,r),i.finish()}}function eh(e,t,i){var r=e.display,n=e.options.lineNumbers,u=r.lineDiv,p=u.firstChild;function g(P){var U=P.nextSibling;return v&&O&&e.display.currentWheelTarget==P?P.style.display="none":P.parentNode.removeChild(P),U}for(var m=r.view,b=r.viewFrom,C=0;C-1&&(M=!1),bs(e,S,b,i)),M&&(H(S.lineNumber),S.lineNumber.appendChild(document.createTextNode(sa(e.options,b)))),p=S.node.nextSibling}b+=S.size}for(;p;)p=g(p)}function Ia(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",et(e,"gutterChanged",e)}function Ha(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Qt(e)+"px"}function Ks(e){var t=e.display,i=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var r=Aa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,u=r+"px",p=0;pg.clientWidth,b=g.scrollHeight>g.clientHeight;if(r&&m||n&&b){if(n&&O&&v){e:for(var C=t.target,S=p.view;C!=g;C=C.parentNode)for(var _=0;_=0&&me(e,r.to())<=0)return i}return-1};var Ae=function(e,t){this.anchor=e,this.head=t};Ae.prototype.from=function(){return En(this.anchor,this.head)},Ae.prototype.to=function(){return Sn(this.anchor,this.head)},Ae.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Wt(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(_,M){return me(_.from(),M.from())}),i=ze(t,n);for(var u=1;u0:m>=0){var b=En(g.from(),p.from()),C=Sn(g.to(),p.to()),S=g.empty()?p.from()==p.head:g.from()==g.head;u<=i&&--i,t.splice(--u,2,new Ae(S?C:b,S?b:C))}}return new Bt(t,i)}function yr(e,t){return new Bt([new Ae(e,t||e)],0)}function xr(e){return e.text?K(e.from.line+e.text.length-1,De(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Vs(e,t){if(me(e,t.from)<0)return e;if(me(e,t.to)<=0)return xr(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=xr(t).ch-t.to.ch),K(i,r)}function qa(e,t){for(var i=[],r=0;r1&&e.remove(g.line+1,P-1),e.insert(g.line+1,J)}et(e,"change",e,t)}function wr(e,t,i){function r(n,u,p){if(n.linked)for(var g=0;g1&&!e.done[e.done.length-2].ranges)return e.done.pop(),De(e.done)}function nu(e,t,i,r){var n=e.history;n.undone.length=0;var u=+new Date,p,g;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>u-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(p=oh(n,n.lastOp==r)))g=De(p.changes),me(t.from,t.to)==0&&me(t.from,g.to)==0?g.to=xr(t):p.changes.push(Ua(e,t));else{var m=De(n.done);for((!m||!m.ranges)&&Gn(e.sel,n.done),p={changes:[Ua(e,t)],generation:n.generation},n.done.push(p);n.done.length>n.undoDepth;)n.done.shift(),n.done[0].ranges||n.done.shift()}n.done.push(i),n.generation=++n.maxGeneration,n.lastModTime=n.lastSelTime=u,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,g||je(e,"historyAdded")}function ah(e,t,i,r){var n=t.charAt(0);return n=="*"||n=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function lh(e,t,i,r){var n=e.history,u=r&&r.origin;i==n.lastSelOp||u&&n.lastSelOrigin==u&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==u||ah(e,u,De(n.done),t))?n.done[n.done.length-1]=t:Gn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=u,n.lastSelOp=i,r&&r.clearRedo!==!1&&iu(n.undone)}function Gn(e,t){var i=De(t);i&&i.ranges&&i.equals(e)||t.push(e)}function ou(e,t,i,r){var n=t["spans_"+e.id],u=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(p){p.markedSpans&&((n||(n=t["spans_"+e.id]={}))[u]=p.markedSpans),++u})}function sh(e){if(!e)return null;for(var t,i=0;i-1&&(De(g)[S]=b[S],delete b[S])}}return r}function ja(e,t,i,r){if(r){var n=e.anchor;if(i){var u=me(t,n)<0;u!=me(i,n)<0?(n=t,t=i):u!=me(t,i)<0&&(t=i)}return new Ae(n,t)}else return new Ae(i||t,t)}function Xn(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),lt(e,new Bt([ja(e.sel.primary(),t,i,n)],0),r)}function lu(e,t,i){for(var r=[],n=e.cm&&(e.cm.display.shift||e.extend),u=0;u=t.ch:g.to>t.ch))){if(n&&(je(m,"beforeCursorEnter"),m.explicitlyCleared))if(u.markedSpans){--p;continue}else break;if(!m.atomic)continue;if(i){var S=m.find(r<0?1:-1),_=void 0;if((r<0?C:b)&&(S=hu(e,S,-r,S&&S.line==t.line?u:null)),S&&S.line==t.line&&(_=me(S,i))&&(r<0?_<0:_>0))return si(e,S,t,r,n)}var M=m.find(r<0?-1:1);return(r<0?b:C)&&(M=hu(e,M,r,M.line==t.line?u:null)),M?si(e,M,t,r,n):null}}return t}function Yn(e,t,i,r,n){var u=r||1,p=si(e,t,i,u,n)||!n&&si(e,t,i,u,!0)||si(e,t,i,-u,n)||!n&&si(e,t,i,-u,!0);return p||(e.cantEdit=!0,K(e.first,0))}function hu(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?ve(e,K(t.line-1)):null:i>0&&t.ch==(r||ae(e,t.line)).text.length?t.line=0;--n)mu(e,{from:r[n].from,to:r[n].to,text:n?[""]:t.text,origin:t.origin});else mu(e,t)}}function mu(e,t){if(!(t.text.length==1&&t.text[0]==""&&me(t.from,t.to)==0)){var i=qa(e,t);nu(e,t,i,e.cm?e.cm.curOp.id:NaN),Yi(e,t,i,ha(e,t));var r=[];wr(e,function(n,u){!u&&ze(r,n.history)==-1&&(xu(n.history,t),r.push(n.history)),Yi(n,t,null,ha(n,t))})}}function Zn(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(!(r&&!i)){for(var n=e.history,u,p=e.sel,g=t=="undo"?n.done:n.undone,m=t=="undo"?n.undone:n.done,b=0;b=0;--M){var P=_(M);if(P)return P.v}}}}function vu(e,t){if(t!=0&&(e.first+=t,e.sel=new Bt(Pt(e.sel.ranges,function(n){return new Ae(K(n.anchor.line+t,n.anchor.ch),K(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm)){yt(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;re.lastLine())){if(t.from.lineu&&(t={from:t.from,to:K(u,ae(e,u).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Mr(e,t.from,t.to),i||(i=qa(e,t)),e.cm?ch(e.cm,t,r):Wa(e,t,r),Kn(e,i,vt),e.cantEdit&&Yn(e,K(e.firstLine(),0))&&(e.cantEdit=!1)}}function ch(e,t,i){var r=e.doc,n=e.display,u=t.from,p=t.to,g=!1,m=u.line;e.options.lineWrapping||(m=Fe(qt(ae(r,u.line))),r.iter(m,p.line+1,function(M){if(M==n.maxLine)return g=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Kl(e),Wa(r,t,i,Os(e)),e.options.lineWrapping||(r.iter(m,u.line+t.text.length,function(M){var P=Bn(M);P>n.maxLineLength&&(n.maxLine=M,n.maxLineLength=P,n.maxLineChanged=!0,g=!1)}),g&&(e.curOp.updateMaxLine=!0)),ed(r,u.line),Gi(e,400);var b=t.text.length-(p.line-u.line)-1;t.full?yt(e):u.line==p.line&&t.text.length==1&&!eu(e.doc,t)?vr(e,u.line,"text"):yt(e,u.line,p.line+1,b);var C=Ot(e,"changes"),S=Ot(e,"change");if(S||C){var _={from:u,to:p,text:t.text,removed:t.removed,origin:t.origin};S&&et(e,"change",e,_),C&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(_)}e.display.selForContextMenu=null}function fi(e,t,i,r,n){var u;r||(r=i),me(r,i)<0&&(u=[r,i],i=u[0],r=u[1]),typeof t=="string"&&(t=e.splitLines(t)),ui(e,{from:i,to:r,text:t,origin:n})}function bu(e,t,i,r){i1||!(this.children[0]instanceof Qi))){var g=[];this.collapse(g),this.children=[new Qi(g)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var p=n.lines.length%25+25,g=p;g10);e.parent.maybeSpill()}},iterN:function(e,t,i){for(var r=0;re.display.maxLineLength&&(e.display.maxLine=b,e.display.maxLineLength=C,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&yt(e,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&cu(e.doc)),e&&et(e,"markerCleared",e,this,r,n),t&&qr(e),this.parent&&this.parent.clear()}},Cr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n0||p==0&&u.clearWhenEmpty!==!1)return u;if(u.replacedWith&&(u.collapsed=!0,u.widgetNode=q("span",[u.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||u.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(u.widgetNode.insertLeft=!0)),u.collapsed){if(ds(e,t.line,t,i,u)||t.line!=i.line&&ds(e,i.line,t,i,u))throw new Error("Inserting collapsed marker partially overlapping an existing one");rd()}u.addToHistory&&nu(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var g=t.line,m=e.cm,b;if(e.iter(g,i.line+1,function(S){m&&u.collapsed&&!m.options.lineWrapping&&qt(S)==m.display.maxLine&&(b=!0),u.collapsed&&g!=t.line&&Yt(S,0),nd(S,new Fn(u,g==t.line?t.ch:null,g==i.line?i.ch:null),e.cm&&e.cm.curOp),++g}),u.collapsed&&e.iter(t.line,i.line+1,function(S){mr(e,S)&&Yt(S,0)}),u.clearOnEnter&&ue(u,"beforeCursorEnter",function(){return u.clear()}),u.readOnly&&(td(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),u.collapsed&&(u.id=++Cu,u.atomic=!0),m){if(b&&(m.curOp.updateMaxLine=!0),u.collapsed)yt(m,t.line,i.line+1);else if(u.className||u.startStyle||u.endStyle||u.css||u.attributes||u.title)for(var C=t.line;C<=i.line;C++)vr(m,C,"text");u.atomic&&cu(m.doc),et(m,"markerAdded",m,u)}return u}var $i=function(e,t){this.markers=e,this.primary=t;for(var i=0;i=0;m--)ui(this,r[m]);g?uu(this,g):this.cm&&oi(this.cm)}),undo:rt(function(){Zn(this,"undo")}),redo:rt(function(){Zn(this,"redo")}),undoSelection:rt(function(){Zn(this,"undo",!0)}),redoSelection:rt(function(){Zn(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,r=0;r=e.ch)&&t.push(n.marker.parent||n.marker)}return t},findMarks:function(e,t,i){e=ve(this,e),t=ve(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(u){var p=u.markedSpans;if(p)for(var g=0;g=m.to||m.from==null&&n!=e.line||m.from!=null&&n==t.line&&m.from>=t.ch)&&(!i||i(m.marker))&&r.push(m.marker.parent||m.marker)}++n}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var r=0;re)return t=e,!0;e-=u,++i}),ve(this,K(i,t))},indexFromPos:function(e){e=ve(this,e);var t=e.ch;if(e.linet&&(t=e.from),e.to!=null&&e.to-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var C=e.dataTransfer.getData("Text");if(C){var S;if(t.state.draggingText&&!t.state.draggingText.copy&&(S=t.listSelections()),Kn(t.doc,yr(i,i)),S)for(var _=0;_=0;g--)fi(e.doc,"",r[g].from,r[g].to,"+delete");oi(e)})}function Xa(e,t,i){var r=Gl(e.text,t+i,i);return r<0||r>e.text.length?null:r}function Ka(e,t,i){var r=Xa(e,t.ch,i);return r==null?null:new K(t.line,r,i<0?"after":"before")}function Ya(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var u=tr(i,t.doc.direction);if(u){var p=n<0?De(u):u[0],g=n<0==(p.level==1),m=g?"after":"before",b;if(p.level>0||t.doc.direction=="rtl"){var C=ti(t,i);b=n<0?i.text.length-1:0;var S=Jt(t,C,b).top;b=Ti(function(_){return Jt(t,C,_).top==S},n<0==(p.level==1)?p.from:p.to-1,b),m=="before"&&(b=Xa(i,b,1))}else b=n<0?p.to:p.from;return new K(r,b,m)}}return new K(r,n<0?i.text.length:0,n<0?"before":"after")}function Sh(e,t,i,r){var n=tr(t,e.doc.direction);if(!n)return Ka(t,i,r);i.ch>=t.text.length?(i.ch=t.text.length,i.sticky="before"):i.ch<=0&&(i.ch=0,i.sticky="after");var u=Mi(n,i.ch,i.sticky),p=n[u];if(e.doc.direction=="ltr"&&p.level%2==0&&(r>0?p.to>i.ch:p.from=p.from&&_>=C.begin)){var M=S?"before":"after";return new K(i.line,_,M)}}var P=function(J,ee,V){for(var ie=function(Le,it){return it?new K(i.line,g(Le,1),"before"):new K(i.line,Le,"after")};J>=0&&J0==(se.level!=1),we=le?V.begin:g(V.end,-1);if(se.from<=we&&we0?C.end:g(C.begin,-1);return Z!=null&&!(r>0&&Z==t.text.length)&&(U=P(r>0?0:n.length-1,r,b(Z)),U)?U:null}var rn={selectAll:pu,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),vt)},killLine:function(e){return hi(e,function(t){if(t.empty()){var i=ae(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line0)n=new K(n.line,n.ch+1),e.replaceRange(u.charAt(n.ch-1)+u.charAt(n.ch-2),K(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var p=ae(e.doc,n.line-1).text;p&&(n=new K(n.line,1),e.replaceRange(u.charAt(0)+e.doc.lineSeparator()+p.charAt(p.length-1),K(n.line-1,p.length-1),n,"+transpose"))}}i.push(new Ae(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){return St(e,function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");t=e.listSelections();for(var r=0;re&&me(t,this.pos)==0&&i==this.button};var on,an;function Bh(e,t){var i=+new Date;return an&&an.compare(i,e,t)?(on=an=null,"triple"):on&&on.compare(i,e,t)?(an=new Qa(i,e,t),on=null,"double"):(on=new Qa(i,e,t),an=null,"single")}function Hu(e){var t=this,i=t.display;if(!($e(t,e)||i.activeTouch&&i.input.supportsTouch())){if(i.input.ensurePolled(),i.shift=e.shiftKey,nr(i,e)){v||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(!Ja(t,e)){var r=Nr(t,e),n=Zl(e),u=r?Bh(r,n):"single";xe(t).focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&_h(t,n,r,u,e))&&(n==1?r?Nh(t,r,u,e):$o(e)==i.scroller&&bt(e):n==2?(r&&Xn(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(de?t.display.input.onContextMenu(e):Ma(t)))}}}function _h(e,t,i,r,n){var u="Click";return r=="double"?u="Double"+u:r=="triple"&&(u="Triple"+u),u=(t==1?"Left":t==2?"Middle":"Right")+u,nn(e,Tu(u,n),n,function(p){if(typeof p=="string"&&(p=rn[p]),!p)return!1;var g=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),g=p(e,i)!=Ze}finally{e.state.suppressEdits=!1}return g})}function zh(e,t,i){var r=e.getOption("configureMouse"),n=r?r(e,t,i):{};if(n.unit==null){var u=I?i.shiftKey&&i.metaKey:i.altKey;n.unit=u?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(n.extend==null||e.doc.extend)&&(n.extend=e.doc.extend||i.shiftKey),n.addNew==null&&(n.addNew=O?i.metaKey:i.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(O?i.altKey:i.ctrlKey)),n}function Nh(e,t,i,r){c?setTimeout(mt(Ps,e),0):e.curOp.focus=he(te(e));var n=zh(e,i,r),u=e.doc.sel,p;e.options.dragDrop&&Uc&&!e.isReadOnly()&&i=="single"&&(p=u.contains(t))>-1&&(me((p=u.ranges[p]).from(),t)<0||t.xRel>0)&&(me(p.to(),t)>0||t.xRel<0)?Oh(e,r,t,n):Ih(e,r,t,n)}function Oh(e,t,i,r){var n=e.display,u=!1,p=tt(e,function(b){v&&(n.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:Ma(e)),Mt(n.wrapper.ownerDocument,"mouseup",p),Mt(n.wrapper.ownerDocument,"mousemove",g),Mt(n.scroller,"dragstart",m),Mt(n.scroller,"drop",p),u||(bt(b),r.addNew||Xn(e.doc,i,null,null,r.extend),v&&!F||c&&d==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),g=function(b){u=u||Math.abs(t.clientX-b.clientX)+Math.abs(t.clientY-b.clientY)>=10},m=function(){return u=!0};v&&(n.scroller.draggable=!0),e.state.draggingText=p,p.copy=!r.moveOnDrag,ue(n.wrapper.ownerDocument,"mouseup",p),ue(n.wrapper.ownerDocument,"mousemove",g),ue(n.scroller,"dragstart",m),ue(n.scroller,"drop",p),e.state.delayingBlurEvent=!0,setTimeout(function(){return n.input.focus()},20),n.scroller.dragDrop&&n.scroller.dragDrop()}function Pu(e,t,i){if(i=="char")return new Ae(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new Ae(K(t.line,0),ve(e.doc,K(t.line+1,0)));var r=i(e,t);return new Ae(r.from,r.to)}function Ih(e,t,i,r){c&&Ma(e);var n=e.display,u=e.doc;bt(t);var p,g,m=u.sel,b=m.ranges;if(r.addNew&&!r.extend?(g=u.sel.contains(i),g>-1?p=b[g]:p=new Ae(i,i)):(p=u.sel.primary(),g=u.sel.primIndex),r.unit=="rectangle")r.addNew||(p=new Ae(i,i)),i=Nr(e,t,!0,!0),g=-1;else{var C=Pu(e,i,r.unit);r.extend?p=ja(p,C.anchor,C.head,r.extend):p=C}r.addNew?g==-1?(g=b.length,lt(u,Wt(e,b.concat([p]),g),{scroll:!1,origin:"*mouse"})):b.length>1&&b[g].empty()&&r.unit=="char"&&!r.extend?(lt(u,Wt(e,b.slice(0,g).concat(b.slice(g+1)),0),{scroll:!1,origin:"*mouse"}),m=u.sel):Ga(u,g,p,Fi):(g=0,lt(u,new Bt([p],0),Fi),m=u.sel);var S=i;function _(V){if(me(S,V)!=0)if(S=V,r.unit=="rectangle"){for(var ie=[],se=e.options.tabSize,le=Ye(ae(u,i.line).text,i.ch,se),we=Ye(ae(u,V.line).text,V.ch,se),Le=Math.min(le,we),it=Math.max(le,we),Ie=Math.min(i.line,V.line),Et=Math.min(e.lastLine(),Math.max(i.line,V.line));Ie<=Et;Ie++){var wt=ae(u,Ie).text,Xe=Kt(wt,Le,se);Le==it?ie.push(new Ae(K(Ie,Xe),K(Ie,Xe))):wt.length>Xe&&ie.push(new Ae(K(Ie,Xe),K(Ie,Kt(wt,it,se))))}ie.length||ie.push(new Ae(i,i)),lt(u,Wt(e,m.ranges.slice(0,g).concat(ie),g),{origin:"*mouse",scroll:!1}),e.scrollIntoView(V)}else{var Ct=p,ot=Pu(e,V,r.unit),Qe=Ct.anchor,Ke;me(ot.anchor,Qe)>0?(Ke=ot.head,Qe=En(Ct.from(),ot.anchor)):(Ke=ot.anchor,Qe=Sn(Ct.to(),ot.head));var qe=m.ranges.slice(0);qe[g]=Hh(e,new Ae(ve(u,Qe),Ke)),lt(u,Wt(e,qe,g),Fi)}}var M=n.wrapper.getBoundingClientRect(),P=0;function U(V){var ie=++P,se=Nr(e,V,!0,r.unit=="rectangle");if(se)if(me(se,S)!=0){e.curOp.focus=he(te(e)),_(se);var le=qn(n,u);(se.line>=le.to||se.lineM.bottom?20:0;we&&setTimeout(tt(e,function(){P==ie&&(n.scroller.scrollTop+=we,U(V))}),50)}}function Z(V){e.state.selectingText=!1,P=1/0,V&&(bt(V),n.input.focus()),Mt(n.wrapper.ownerDocument,"mousemove",J),Mt(n.wrapper.ownerDocument,"mouseup",ee),u.history.lastSelOrigin=null}var J=tt(e,function(V){V.buttons===0||!Zl(V)?Z(V):U(V)}),ee=tt(e,Z);e.state.selectingText=ee,ue(n.wrapper.ownerDocument,"mousemove",J),ue(n.wrapper.ownerDocument,"mouseup",ee)}function Hh(e,t){var i=t.anchor,r=t.head,n=ae(e.doc,i.line);if(me(i,r)==0&&i.sticky==r.sticky)return t;var u=tr(n);if(!u)return t;var p=Mi(u,i.ch,i.sticky),g=u[p];if(g.from!=i.ch&&g.to!=i.ch)return t;var m=p+(g.from==i.ch==(g.level!=1)?0:1);if(m==0||m==u.length)return t;var b;if(r.line!=i.line)b=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var C=Mi(u,r.ch,r.sticky),S=C-p||(r.ch-i.ch)*(g.level==1?-1:1);C==m-1||C==m?b=S<0:b=S>0}var _=u[m+(b?-1:0)],M=b==(_.level==1),P=M?_.from:_.to,U=M?"after":"before";return i.ch==P&&i.sticky==U?t:new Ae(new K(i.line,P,U),r)}function qu(e,t,i,r){var n,u;if(t.touches)n=t.touches[0].clientX,u=t.touches[0].clientY;else try{n=t.clientX,u=t.clientY}catch{return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&bt(t);var p=e.display,g=p.lineDiv.getBoundingClientRect();if(u>g.bottom||!Ot(e,i))return Vo(t);u-=g.top-p.viewOffset;for(var m=0;m=n){var C=Br(e.doc,u),S=e.display.gutterSpecs[m];return je(e,i,e,C,S.className,t),Vo(t)}}}function Ja(e,t){return qu(e,t,"gutterClick",!0)}function Ru(e,t){nr(e.display,t)||Ph(e,t)||$e(e,t,"contextmenu")||de||e.display.input.onContextMenu(t)}function Ph(e,t){return Ot(e,"gutterContextMenu")?qu(e,t,"gutterContextMenu",!1):!1}function Wu(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Pi(e)}var pi={toString:function(){return"CodeMirror.Init"}},Uu={},$n={};function qh(e){var t=e.optionHandlers;function i(r,n,u,p){e.defaults[r]=n,u&&(t[r]=p?function(g,m,b){b!=pi&&u(g,m,b)}:u)}e.defineOption=i,e.Init=pi,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,Ra(r)},!0),i("indentUnit",2,Ra,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){Ki(r),Pi(r),yt(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!!n){var u=[],p=r.doc.first;r.doc.iter(function(m){for(var b=0;;){var C=m.text.indexOf(n,b);if(C==-1)break;b=C+n.length,u.push(K(p,C))}p++});for(var g=u.length-1;g>=0;g--)fi(r.doc,n,u[g],K(u[g].line,u[g].ch+n.length))}}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(r,n,u){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),u!=pi&&r.refresh()}),i("specialCharPlaceholder",gd,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",z?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(r,n){return r.getInputField().spellcheck=n},!0),i("autocorrect",!1,function(r,n){return r.getInputField().autocorrect=n},!0),i("autocapitalize",!1,function(r,n){return r.getInputField().autocapitalize=n},!0),i("rtlMoveVisually",!W),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Wu(r),Xi(r)},!0),i("keyMap","default",function(r,n,u){var p=Jn(n),g=u!=pi&&Jn(u);g&&g.detach&&g.detach(r,p),p.attach&&p.attach(r,g||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Wh,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=Pa(n,r.options.lineNumbers),Xi(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?Aa(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return ai(r)},!0),i("scrollbarStyle","native",function(r){Gs(r),ai(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),i("lineNumbers",!1,function(r,n){r.display.gutterSpecs=Pa(r.options.gutters,n),Xi(r)},!0),i("firstLineNumber",1,Xi,!0),i("lineNumberFormatter",function(r){return r},Xi,!0),i("showCursorWhenSelecting",!1,qi,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,n){n=="nocursor"&&(ni(r),r.display.input.blur()),r.display.input.readOnlyChanged(n)}),i("screenReaderLabel",null,function(r,n){n=n===""?null:n,r.display.input.screenReaderLabelChanged(n)}),i("disableInput",!1,function(r,n){n||r.display.input.reset()},!0),i("dragDrop",!0,Rh),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,qi,!0),i("singleCursorHeightPerLine",!0,qi,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,Ki,!0),i("addModeClass",!1,Ki,!0),i("pollInterval",100),i("undoDepth",200,function(r,n){return r.doc.history.undoDepth=n}),i("historyEventDelay",1250),i("viewportMargin",10,function(r){return r.refresh()},!0),i("maxHighlightLength",1e4,Ki,!0),i("moveInputWithCursor",!0,function(r,n){n||r.display.input.resetPosition()}),i("tabindex",null,function(r,n){return r.display.input.getField().tabIndex=n||""}),i("autofocus",null),i("direction","ltr",function(r,n){return r.doc.setDirection(n)},!0),i("phrases",null)}function Rh(e,t,i){var r=i&&i!=pi;if(!t!=!r){var n=e.display.dragFunctions,u=t?ue:Mt;u(e.display.scroller,"dragstart",n.start),u(e.display.scroller,"dragenter",n.enter),u(e.display.scroller,"dragover",n.over),u(e.display.scroller,"dragleave",n.leave),u(e.display.scroller,"drop",n.drop)}}function Wh(e){e.options.lineWrapping?(be(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(oe(e.display.wrapper,"CodeMirror-wrap"),va(e)),Fa(e),yt(e),Pi(e),setTimeout(function(){return ai(e)},100)}function Ne(e,t){var i=this;if(!(this instanceof Ne))return new Ne(e,t);this.options=t=t?Lt(t):{},Lt(Uu,t,!1);var r=t.value;typeof r=="string"?r=new xt(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new Ne.inputStyles[t.inputStyle](this),u=this.display=new th(e,r,n,t);u.wrapper.CodeMirror=this,Wu(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Gs(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new ct,keySeq:null,specialChars:null},t.autofocus&&!z&&u.input.focus(),c&&d<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Uh(this),xh(),Pr(this),this.curOp.forceUpdate=!0,tu(this,r),t.autofocus&&!z||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&Ba(i)},20):ni(this);for(var p in $n)$n.hasOwnProperty(p)&&$n[p](this,t[p],pi);Ys(this),t.finishInit&&t.finishInit(this);for(var g=0;g20*20}ue(t.scroller,"touchstart",function(m){if(!$e(e,m)&&!u(m)&&!Ja(e,m)){t.input.ensurePolled(),clearTimeout(i);var b=+new Date;t.activeTouch={start:b,moved:!1,prev:b-r.end<=300?r:null},m.touches.length==1&&(t.activeTouch.left=m.touches[0].pageX,t.activeTouch.top=m.touches[0].pageY)}}),ue(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),ue(t.scroller,"touchend",function(m){var b=t.activeTouch;if(b&&!nr(t,m)&&b.left!=null&&!b.moved&&new Date-b.start<300){var C=e.coordsChar(t.activeTouch,"page"),S;!b.prev||p(b,b.prev)?S=new Ae(C,C):!b.prev.prev||p(b,b.prev.prev)?S=e.findWordAt(C):S=new Ae(K(C.line,0),ve(e.doc,K(C.line+1,0))),e.setSelection(S.anchor,S.head),e.focus(),bt(m)}n()}),ue(t.scroller,"touchcancel",n),ue(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Wi(e,t.scroller.scrollTop),Ir(e,t.scroller.scrollLeft,!0),je(e,"scroll",e))}),ue(t.scroller,"mousewheel",function(m){return Js(e,m)}),ue(t.scroller,"DOMMouseScroll",function(m){return Js(e,m)}),ue(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(m){$e(e,m)||Bi(m)},over:function(m){$e(e,m)||(yh(e,m),Bi(m))},start:function(m){return bh(e,m)},drop:tt(e,vh),leave:function(m){$e(e,m)||Su(e)}};var g=t.input.getField();ue(g,"keyup",function(m){return Ou.call(e,m)}),ue(g,"keydown",tt(e,Nu)),ue(g,"keypress",tt(e,Iu)),ue(g,"focus",function(m){return Ba(e,m)}),ue(g,"blur",function(m){return ni(e,m)})}var Va=[];Ne.defineInitHook=function(e){return Va.push(e)};function ln(e,t,i,r){var n=e.doc,u;i==null&&(i="add"),i=="smart"&&(n.mode.indent?u=zi(e,t).state:i="prev");var p=e.options.tabSize,g=ae(n,t),m=Ye(g.text,null,p);g.stateAfter&&(g.stateAfter=null);var b=g.text.match(/^\s*/)[0],C;if(!r&&!/\S/.test(g.text))C=0,i="not";else if(i=="smart"&&(C=n.mode.indent(u,g.text.slice(b.length),g.text),C==Ze||C>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?C=Ye(ae(n,t-1).text,null,p):C=0:i=="add"?C=m+e.options.indentUnit:i=="subtract"?C=m-e.options.indentUnit:typeof i=="number"&&(C=m+i),C=Math.max(0,C);var S="",_=0;if(e.options.indentWithTabs)for(var M=Math.floor(C/p);M;--M)_+=p,S+=" ";if(_p,m=ra(t),b=null;if(g&&r.ranges.length>1)if(Ut&&Ut.text.join(` + left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(p),p.scrollIntoView(n),e.display.lineSpace.removeChild(p)}}}function qd(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(i=t.sticky=="before"?K(t.line,t.ch+1,"before"):t,t=t.ch?K(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var u=0;u<5;u++){var p=!1,g=Rt(e,t),m=!i||i==t?g:Rt(e,i);n={left:Math.min(g.left,m.left),top:Math.min(g.top,m.top)-r,right:Math.max(g.left,m.left),bottom:Math.max(g.bottom,m.bottom)+r};var b=_a(e,n),C=e.doc.scrollTop,S=e.doc.scrollLeft;if(b.scrollTop!=null&&(Ui(e,b.scrollTop),Math.abs(e.doc.scrollTop-C)>1&&(p=!0)),b.scrollLeft!=null&&(Ir(e,b.scrollLeft),Math.abs(e.doc.scrollLeft-S)>1&&(p=!0)),!p)break}return n}function Rd(e,t){var i=_a(e,t);i.scrollTop!=null&&Ui(e,i.scrollTop),i.scrollLeft!=null&&Ir(e,i.scrollLeft)}function _a(e,t){var i=e.display,r=ii(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,u=xa(e),p={};t.bottom-t.top>u&&(t.bottom=t.top+u);var g=e.doc.height+ya(i),m=t.topg-r;if(t.topn+u){var C=Math.min(t.top,(b?g:t.bottom)-u);C!=n&&(p.scrollTop=C)}var S=e.options.fixedGutter?0:i.gutters.offsetWidth,_=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-S,M=_r(e)-i.gutters.offsetWidth,P=t.right-t.left>M;return P&&(t.right=t.left+M),t.left<10?p.scrollLeft=0:t.left<_?p.scrollLeft=Math.max(0,t.left+S-(P?0:10)):t.right>M+_-3&&(p.scrollLeft=t.right+(P?0:10)-M),p}function za(e,t){t!=null&&(Wn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function ai(e){Wn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Wi(e,t,i){(t!=null||i!=null)&&Wn(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Wd(e,t){Wn(e),e.curOp.scrollToPos=t}function Wn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=_s(e,t.from),r=_s(e,t.to);Rs(e,i,r,t.margin)}}function Rs(e,t,i,r){var n=_a(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-r,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+r});Wi(e,n.scrollLeft,n.scrollTop)}function Ui(e,t){Math.abs(e.doc.scrollTop-t)<2||(s||Oa(e,{top:t}),Ws(e,t,!0),s&&Oa(e),Xi(e,100))}function Ws(e,t,i){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),!(e.display.scroller.scrollTop==t&&!i)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Ir(e,t,i,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),!((i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)&&(e.doc.scrollLeft=t,Ks(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function ji(e){var t=e.display,i=t.gutters.offsetWidth,r=Math.round(e.doc.height+ya(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?i:0,docHeight:r,scrollHeight:r+Qt(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var Hr=function(e,t,i){this.cm=i;var r=this.vert=E("div",[E("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=E("div",[E("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=n.tabIndex=-1,e(r),e(n),ue(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),ue(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,c&&d<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Hr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var n=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+n)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=i?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var u=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+u)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?r:0,bottom:t?r:0}},Hr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Hr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Hr.prototype.zeroWidthHack=function(){var e=O&&!B?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new ct,this.disableVert=new ct},Hr.prototype.enableZeroWidthBar=function(e,t,i){e.style.visibility="";function r(){var n=e.getBoundingClientRect(),u=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);u!=e?e.style.visibility="hidden":t.set(1e3,r)}t.set(1e3,r)},Hr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Gi=function(){};Gi.prototype.update=function(){return{bottom:0,right:0}},Gi.prototype.setScrollLeft=function(){},Gi.prototype.setScrollTop=function(){},Gi.prototype.clear=function(){};function li(e,t){t||(t=ji(e));var i=e.display.barWidth,r=e.display.barHeight;Us(e,t);for(var n=0;n<4&&i!=e.display.barWidth||r!=e.display.barHeight;n++)i!=e.display.barWidth&&e.options.lineWrapping&&qn(e),Us(e,ji(e)),i=e.display.barWidth,r=e.display.barHeight}function Us(e,t){var i=e.display,r=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=r.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=r.bottom)+"px",i.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=r.bottom+"px",i.scrollbarFiller.style.width=r.right+"px"):i.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=r.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}var js={native:Hr,null:Gi};function Gs(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&oe(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new js[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ue(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?Ir(e,t):Ui(e,t)},e),e.display.scrollbars.addClass&&be(e.display.wrapper,e.display.scrollbars.addClass)}var Ud=0;function Pr(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Ud,markArrays:null},xd(e.curOp)}function qr(e){var t=e.curOp;t&&Cd(t,function(i){for(var r=0;r=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Un(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Xd(e){e.updatedDisplay=e.mustUpdate&&Na(e.cm,e.update)}function Kd(e){var t=e.cm,i=t.display;e.updatedDisplay&&qn(t),e.barMeasure=ji(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Ss(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+Qt(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-_r(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function Yd(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)){var i=+new Date+e.options.workTime,r=Ni(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(u){if(r.line>=e.display.viewFrom){var p=u.styles,g=u.text.length>e.options.maxHighlightLength?Lr(t.mode,r.state):null,m=$l(e,u,r,!0);g&&(r.state=g),u.styles=m.styles;var b=u.styleClasses,C=m.classes;C?u.styleClasses=C:b&&(u.styleClasses=null);for(var S=!p||p.length!=u.styles.length||b!=C&&(!b||!C||b.bgClass!=C.bgClass||b.textClass!=C.textClass),_=0;!S&&_i)return Xi(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&St(e,function(){for(var u=0;u=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&Is(e)==0)return!1;Ys(e)&&(br(e),t.dims=Ea(e));var n=r.first+r.size,u=Math.max(t.visible.from-e.options.viewportMargin,r.first),p=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFromp&&i.viewTo-p<20&&(p=Math.min(n,i.viewTo)),rr&&(u=ga(e.doc,u),p=hs(e.doc,p));var g=u!=i.viewFrom||p!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Id(e,u,p),i.viewOffset=ir(ae(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var m=Is(e);if(!g&&m==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var b=Vd(e);return m>4&&(i.lineDiv.style.display="none"),eh(e,i.updateLineNumbers,t.dims),m>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,$d(b),H(i.cursorDiv),H(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,g&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,Xi(e,400)),i.updateLineNumbers=null,!0}function Xs(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==_r(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+ya(e.display)-xa(e),i.top)}),t.visible=Rn(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Rn(e.display,e.doc,i));if(!Na(e,t))break;qn(e);var n=ji(e);Ri(e),li(e,n),Ha(e,n),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Oa(e,t){var i=new Un(e,t);if(Na(e,i)){qn(e),Xs(e,i);var r=ji(e);Ri(e),li(e,r),Ha(e,r),i.finish()}}function eh(e,t,i){var r=e.display,n=e.options.lineNumbers,u=r.lineDiv,p=u.firstChild;function g(P){var U=P.nextSibling;return v&&O&&e.display.currentWheelTarget==P?P.style.display="none":P.parentNode.removeChild(P),U}for(var m=r.view,b=r.viewFrom,C=0;C-1&&(M=!1),bs(e,S,b,i)),M&&(H(S.lineNumber),S.lineNumber.appendChild(document.createTextNode(sa(e.options,b)))),p=S.node.nextSibling}b+=S.size}for(;p;)p=g(p)}function Ia(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",et(e,"gutterChanged",e)}function Ha(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Qt(e)+"px"}function Ks(e){var t=e.display,i=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var r=Aa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,u=r+"px",p=0;pg.clientWidth,b=g.scrollHeight>g.clientHeight;if(r&&m||n&&b){if(n&&O&&v){e:for(var C=t.target,S=p.view;C!=g;C=C.parentNode)for(var _=0;_=0&&me(e,r.to())<=0)return i}return-1};var Ee=function(e,t){this.anchor=e,this.head=t};Ee.prototype.from=function(){return An(this.anchor,this.head)},Ee.prototype.to=function(){return En(this.anchor,this.head)},Ee.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Wt(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(_,M){return me(_.from(),M.from())}),i=ze(t,n);for(var u=1;u0:m>=0){var b=An(g.from(),p.from()),C=En(g.to(),p.to()),S=g.empty()?p.from()==p.head:g.from()==g.head;u<=i&&--i,t.splice(--u,2,new Ee(S?C:b,S?b:C))}}return new Bt(t,i)}function yr(e,t){return new Bt([new Ee(e,t||e)],0)}function xr(e){return e.text?K(e.from.line+e.text.length-1,De(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Vs(e,t){if(me(e,t.from)<0)return e;if(me(e,t.to)<=0)return xr(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=xr(t).ch-t.to.ch),K(i,r)}function qa(e,t){for(var i=[],r=0;r1&&e.remove(g.line+1,P-1),e.insert(g.line+1,J)}et(e,"change",e,t)}function wr(e,t,i){function r(n,u,p){if(n.linked)for(var g=0;g1&&!e.done[e.done.length-2].ranges)return e.done.pop(),De(e.done)}function nu(e,t,i,r){var n=e.history;n.undone.length=0;var u=+new Date,p,g;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>u-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(p=oh(n,n.lastOp==r)))g=De(p.changes),me(t.from,t.to)==0&&me(t.from,g.to)==0?g.to=xr(t):p.changes.push(Ua(e,t));else{var m=De(n.done);for((!m||!m.ranges)&&Xn(e.sel,n.done),p={changes:[Ua(e,t)],generation:n.generation},n.done.push(p);n.done.length>n.undoDepth;)n.done.shift(),n.done[0].ranges||n.done.shift()}n.done.push(i),n.generation=++n.maxGeneration,n.lastModTime=n.lastSelTime=u,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,g||je(e,"historyAdded")}function ah(e,t,i,r){var n=t.charAt(0);return n=="*"||n=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function lh(e,t,i,r){var n=e.history,u=r&&r.origin;i==n.lastSelOp||u&&n.lastSelOrigin==u&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==u||ah(e,u,De(n.done),t))?n.done[n.done.length-1]=t:Xn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=u,n.lastSelOp=i,r&&r.clearRedo!==!1&&iu(n.undone)}function Xn(e,t){var i=De(t);i&&i.ranges&&i.equals(e)||t.push(e)}function ou(e,t,i,r){var n=t["spans_"+e.id],u=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(p){p.markedSpans&&((n||(n=t["spans_"+e.id]={}))[u]=p.markedSpans),++u})}function sh(e){if(!e)return null;for(var t,i=0;i-1&&(De(g)[S]=b[S],delete b[S])}}return r}function ja(e,t,i,r){if(r){var n=e.anchor;if(i){var u=me(t,n)<0;u!=me(i,n)<0?(n=t,t=i):u!=me(t,i)<0&&(t=i)}return new Ee(n,t)}else return new Ee(i||t,t)}function Kn(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),lt(e,new Bt([ja(e.sel.primary(),t,i,n)],0),r)}function lu(e,t,i){for(var r=[],n=e.cm&&(e.cm.display.shift||e.extend),u=0;u=t.ch:g.to>t.ch))){if(n&&(je(m,"beforeCursorEnter"),m.explicitlyCleared))if(u.markedSpans){--p;continue}else break;if(!m.atomic)continue;if(i){var S=m.find(r<0?1:-1),_=void 0;if((r<0?C:b)&&(S=hu(e,S,-r,S&&S.line==t.line?u:null)),S&&S.line==t.line&&(_=me(S,i))&&(r<0?_<0:_>0))return ui(e,S,t,r,n)}var M=m.find(r<0?-1:1);return(r<0?b:C)&&(M=hu(e,M,r,M.line==t.line?u:null)),M?ui(e,M,t,r,n):null}}return t}function Zn(e,t,i,r,n){var u=r||1,p=ui(e,t,i,u,n)||!n&&ui(e,t,i,u,!0)||ui(e,t,i,-u,n)||!n&&ui(e,t,i,-u,!0);return p||(e.cantEdit=!0,K(e.first,0))}function hu(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?ve(e,K(t.line-1)):null:i>0&&t.ch==(r||ae(e,t.line)).text.length?t.line=0;--n)mu(e,{from:r[n].from,to:r[n].to,text:n?[""]:t.text,origin:t.origin});else mu(e,t)}}function mu(e,t){if(!(t.text.length==1&&t.text[0]==""&&me(t.from,t.to)==0)){var i=qa(e,t);nu(e,t,i,e.cm?e.cm.curOp.id:NaN),Zi(e,t,i,ha(e,t));var r=[];wr(e,function(n,u){!u&&ze(r,n.history)==-1&&(xu(n.history,t),r.push(n.history)),Zi(n,t,null,ha(n,t))})}}function Qn(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(!(r&&!i)){for(var n=e.history,u,p=e.sel,g=t=="undo"?n.done:n.undone,m=t=="undo"?n.undone:n.done,b=0;b=0;--M){var P=_(M);if(P)return P.v}}}}function vu(e,t){if(t!=0&&(e.first+=t,e.sel=new Bt(Pt(e.sel.ranges,function(n){return new Ee(K(n.anchor.line+t,n.anchor.ch),K(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm)){yt(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;re.lastLine())){if(t.from.lineu&&(t={from:t.from,to:K(u,ae(e,u).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Mr(e,t.from,t.to),i||(i=qa(e,t)),e.cm?ch(e.cm,t,r):Wa(e,t,r),Yn(e,i,vt),e.cantEdit&&Zn(e,K(e.firstLine(),0))&&(e.cantEdit=!1)}}function ch(e,t,i){var r=e.doc,n=e.display,u=t.from,p=t.to,g=!1,m=u.line;e.options.lineWrapping||(m=Fe(qt(ae(r,u.line))),r.iter(m,p.line+1,function(M){if(M==n.maxLine)return g=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Kl(e),Wa(r,t,i,Os(e)),e.options.lineWrapping||(r.iter(m,u.line+t.text.length,function(M){var P=_n(M);P>n.maxLineLength&&(n.maxLine=M,n.maxLineLength=P,n.maxLineChanged=!0,g=!1)}),g&&(e.curOp.updateMaxLine=!0)),ed(r,u.line),Xi(e,400);var b=t.text.length-(p.line-u.line)-1;t.full?yt(e):u.line==p.line&&t.text.length==1&&!eu(e.doc,t)?vr(e,u.line,"text"):yt(e,u.line,p.line+1,b);var C=Ot(e,"changes"),S=Ot(e,"change");if(S||C){var _={from:u,to:p,text:t.text,removed:t.removed,origin:t.origin};S&&et(e,"change",e,_),C&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(_)}e.display.selForContextMenu=null}function ci(e,t,i,r,n){var u;r||(r=i),me(r,i)<0&&(u=[r,i],i=u[0],r=u[1]),typeof t=="string"&&(t=e.splitLines(t)),fi(e,{from:i,to:r,text:t,origin:n})}function bu(e,t,i,r){i1||!(this.children[0]instanceof Ji))){var g=[];this.collapse(g),this.children=[new Ji(g)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var p=n.lines.length%25+25,g=p;g10);e.parent.maybeSpill()}},iterN:function(e,t,i){for(var r=0;re.display.maxLineLength&&(e.display.maxLine=b,e.display.maxLineLength=C,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&yt(e,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&cu(e.doc)),e&&et(e,"markerCleared",e,this,r,n),t&&qr(e),this.parent&&this.parent.clear()}},Cr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n0||p==0&&u.clearWhenEmpty!==!1)return u;if(u.replacedWith&&(u.collapsed=!0,u.widgetNode=q("span",[u.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||u.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(u.widgetNode.insertLeft=!0)),u.collapsed){if(ds(e,t.line,t,i,u)||t.line!=i.line&&ds(e,i.line,t,i,u))throw new Error("Inserting collapsed marker partially overlapping an existing one");rd()}u.addToHistory&&nu(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var g=t.line,m=e.cm,b;if(e.iter(g,i.line+1,function(S){m&&u.collapsed&&!m.options.lineWrapping&&qt(S)==m.display.maxLine&&(b=!0),u.collapsed&&g!=t.line&&Yt(S,0),nd(S,new Tn(u,g==t.line?t.ch:null,g==i.line?i.ch:null),e.cm&&e.cm.curOp),++g}),u.collapsed&&e.iter(t.line,i.line+1,function(S){mr(e,S)&&Yt(S,0)}),u.clearOnEnter&&ue(u,"beforeCursorEnter",function(){return u.clear()}),u.readOnly&&(td(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),u.collapsed&&(u.id=++Cu,u.atomic=!0),m){if(b&&(m.curOp.updateMaxLine=!0),u.collapsed)yt(m,t.line,i.line+1);else if(u.className||u.startStyle||u.endStyle||u.css||u.attributes||u.title)for(var C=t.line;C<=i.line;C++)vr(m,C,"text");u.atomic&&cu(m.doc),et(m,"markerAdded",m,u)}return u}var en=function(e,t){this.markers=e,this.primary=t;for(var i=0;i=0;m--)fi(this,r[m]);g?uu(this,g):this.cm&&ai(this.cm)}),undo:rt(function(){Qn(this,"undo")}),redo:rt(function(){Qn(this,"redo")}),undoSelection:rt(function(){Qn(this,"undo",!0)}),redoSelection:rt(function(){Qn(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,r=0;r=e.ch)&&t.push(n.marker.parent||n.marker)}return t},findMarks:function(e,t,i){e=ve(this,e),t=ve(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(u){var p=u.markedSpans;if(p)for(var g=0;g=m.to||m.from==null&&n!=e.line||m.from!=null&&n==t.line&&m.from>=t.ch)&&(!i||i(m.marker))&&r.push(m.marker.parent||m.marker)}++n}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var r=0;re)return t=e,!0;e-=u,++i}),ve(this,K(i,t))},indexFromPos:function(e){e=ve(this,e);var t=e.ch;if(e.linet&&(t=e.from),e.to!=null&&e.to-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var C=e.dataTransfer.getData("Text");if(C){var S;if(t.state.draggingText&&!t.state.draggingText.copy&&(S=t.listSelections()),Yn(t.doc,yr(i,i)),S)for(var _=0;_=0;g--)ci(e.doc,"",r[g].from,r[g].to,"+delete");ai(e)})}function Xa(e,t,i){var r=Gl(e.text,t+i,i);return r<0||r>e.text.length?null:r}function Ka(e,t,i){var r=Xa(e,t.ch,i);return r==null?null:new K(t.line,r,i<0?"after":"before")}function Ya(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var u=tr(i,t.doc.direction);if(u){var p=n<0?De(u):u[0],g=n<0==(p.level==1),m=g?"after":"before",b;if(p.level>0||t.doc.direction=="rtl"){var C=ri(t,i);b=n<0?i.text.length-1:0;var S=Jt(t,C,b).top;b=Li(function(_){return Jt(t,C,_).top==S},n<0==(p.level==1)?p.from:p.to-1,b),m=="before"&&(b=Xa(i,b,1))}else b=n<0?p.to:p.from;return new K(r,b,m)}}return new K(r,n<0?i.text.length:0,n<0?"before":"after")}function Sh(e,t,i,r){var n=tr(t,e.doc.direction);if(!n)return Ka(t,i,r);i.ch>=t.text.length?(i.ch=t.text.length,i.sticky="before"):i.ch<=0&&(i.ch=0,i.sticky="after");var u=Bi(n,i.ch,i.sticky),p=n[u];if(e.doc.direction=="ltr"&&p.level%2==0&&(r>0?p.to>i.ch:p.from=p.from&&_>=C.begin)){var M=S?"before":"after";return new K(i.line,_,M)}}var P=function(J,ee,V){for(var ie=function(Le,it){return it?new K(i.line,g(Le,1),"before"):new K(i.line,Le,"after")};J>=0&&J0==(se.level!=1),we=le?V.begin:g(V.end,-1);if(se.from<=we&&we0?C.end:g(C.begin,-1);return Z!=null&&!(r>0&&Z==t.text.length)&&(U=P(r>0?0:n.length-1,r,b(Z)),U)?U:null}var nn={selectAll:pu,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),vt)},killLine:function(e){return pi(e,function(t){if(t.empty()){var i=ae(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line0)n=new K(n.line,n.ch+1),e.replaceRange(u.charAt(n.ch-1)+u.charAt(n.ch-2),K(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var p=ae(e.doc,n.line-1).text;p&&(n=new K(n.line,1),e.replaceRange(u.charAt(0)+e.doc.lineSeparator()+p.charAt(p.length-1),K(n.line-1,p.length-1),n,"+transpose"))}}i.push(new Ee(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){return St(e,function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");t=e.listSelections();for(var r=0;re&&me(t,this.pos)==0&&i==this.button};var an,ln;function Bh(e,t){var i=+new Date;return ln&&ln.compare(i,e,t)?(an=ln=null,"triple"):an&&an.compare(i,e,t)?(ln=new Qa(i,e,t),an=null,"double"):(an=new Qa(i,e,t),ln=null,"single")}function Hu(e){var t=this,i=t.display;if(!($e(t,e)||i.activeTouch&&i.input.supportsTouch())){if(i.input.ensurePolled(),i.shift=e.shiftKey,nr(i,e)){v||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(!Ja(t,e)){var r=Nr(t,e),n=Zl(e),u=r?Bh(r,n):"single";ye(t).focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&_h(t,n,r,u,e))&&(n==1?r?Nh(t,r,u,e):$o(e)==i.scroller&&bt(e):n==2?(r&&Kn(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(he?t.display.input.onContextMenu(e):Ma(t)))}}}function _h(e,t,i,r,n){var u="Click";return r=="double"?u="Double"+u:r=="triple"&&(u="Triple"+u),u=(t==1?"Left":t==2?"Middle":"Right")+u,on(e,Tu(u,n),n,function(p){if(typeof p=="string"&&(p=nn[p]),!p)return!1;var g=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),g=p(e,i)!=Ze}finally{e.state.suppressEdits=!1}return g})}function zh(e,t,i){var r=e.getOption("configureMouse"),n=r?r(e,t,i):{};if(n.unit==null){var u=I?i.shiftKey&&i.metaKey:i.altKey;n.unit=u?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(n.extend==null||e.doc.extend)&&(n.extend=e.doc.extend||i.shiftKey),n.addNew==null&&(n.addNew=O?i.metaKey:i.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(O?i.altKey:i.ctrlKey)),n}function Nh(e,t,i,r){c?setTimeout(mt(Ps,e),0):e.curOp.focus=de(te(e));var n=zh(e,i,r),u=e.doc.sel,p;e.options.dragDrop&&Uc&&!e.isReadOnly()&&i=="single"&&(p=u.contains(t))>-1&&(me((p=u.ranges[p]).from(),t)<0||t.xRel>0)&&(me(p.to(),t)>0||t.xRel<0)?Oh(e,r,t,n):Ih(e,r,t,n)}function Oh(e,t,i,r){var n=e.display,u=!1,p=tt(e,function(b){v&&(n.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:Ma(e)),Mt(n.wrapper.ownerDocument,"mouseup",p),Mt(n.wrapper.ownerDocument,"mousemove",g),Mt(n.scroller,"dragstart",m),Mt(n.scroller,"drop",p),u||(bt(b),r.addNew||Kn(e.doc,i,null,null,r.extend),v&&!F||c&&d==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),g=function(b){u=u||Math.abs(t.clientX-b.clientX)+Math.abs(t.clientY-b.clientY)>=10},m=function(){return u=!0};v&&(n.scroller.draggable=!0),e.state.draggingText=p,p.copy=!r.moveOnDrag,ue(n.wrapper.ownerDocument,"mouseup",p),ue(n.wrapper.ownerDocument,"mousemove",g),ue(n.scroller,"dragstart",m),ue(n.scroller,"drop",p),e.state.delayingBlurEvent=!0,setTimeout(function(){return n.input.focus()},20),n.scroller.dragDrop&&n.scroller.dragDrop()}function Pu(e,t,i){if(i=="char")return new Ee(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new Ee(K(t.line,0),ve(e.doc,K(t.line+1,0)));var r=i(e,t);return new Ee(r.from,r.to)}function Ih(e,t,i,r){c&&Ma(e);var n=e.display,u=e.doc;bt(t);var p,g,m=u.sel,b=m.ranges;if(r.addNew&&!r.extend?(g=u.sel.contains(i),g>-1?p=b[g]:p=new Ee(i,i)):(p=u.sel.primary(),g=u.sel.primIndex),r.unit=="rectangle")r.addNew||(p=new Ee(i,i)),i=Nr(e,t,!0,!0),g=-1;else{var C=Pu(e,i,r.unit);r.extend?p=ja(p,C.anchor,C.head,r.extend):p=C}r.addNew?g==-1?(g=b.length,lt(u,Wt(e,b.concat([p]),g),{scroll:!1,origin:"*mouse"})):b.length>1&&b[g].empty()&&r.unit=="char"&&!r.extend?(lt(u,Wt(e,b.slice(0,g).concat(b.slice(g+1)),0),{scroll:!1,origin:"*mouse"}),m=u.sel):Ga(u,g,p,Ti):(g=0,lt(u,new Bt([p],0),Ti),m=u.sel);var S=i;function _(V){if(me(S,V)!=0)if(S=V,r.unit=="rectangle"){for(var ie=[],se=e.options.tabSize,le=Ye(ae(u,i.line).text,i.ch,se),we=Ye(ae(u,V.line).text,V.ch,se),Le=Math.min(le,we),it=Math.max(le,we),Ie=Math.min(i.line,V.line),Et=Math.min(e.lastLine(),Math.max(i.line,V.line));Ie<=Et;Ie++){var wt=ae(u,Ie).text,Xe=Kt(wt,Le,se);Le==it?ie.push(new Ee(K(Ie,Xe),K(Ie,Xe))):wt.length>Xe&&ie.push(new Ee(K(Ie,Xe),K(Ie,Kt(wt,it,se))))}ie.length||ie.push(new Ee(i,i)),lt(u,Wt(e,m.ranges.slice(0,g).concat(ie),g),{origin:"*mouse",scroll:!1}),e.scrollIntoView(V)}else{var Ct=p,ot=Pu(e,V,r.unit),Qe=Ct.anchor,Ke;me(ot.anchor,Qe)>0?(Ke=ot.head,Qe=An(Ct.from(),ot.anchor)):(Ke=ot.anchor,Qe=En(Ct.to(),ot.head));var qe=m.ranges.slice(0);qe[g]=Hh(e,new Ee(ve(u,Qe),Ke)),lt(u,Wt(e,qe,g),Ti)}}var M=n.wrapper.getBoundingClientRect(),P=0;function U(V){var ie=++P,se=Nr(e,V,!0,r.unit=="rectangle");if(se)if(me(se,S)!=0){e.curOp.focus=de(te(e)),_(se);var le=Rn(n,u);(se.line>=le.to||se.lineM.bottom?20:0;we&&setTimeout(tt(e,function(){P==ie&&(n.scroller.scrollTop+=we,U(V))}),50)}}function Z(V){e.state.selectingText=!1,P=1/0,V&&(bt(V),n.input.focus()),Mt(n.wrapper.ownerDocument,"mousemove",J),Mt(n.wrapper.ownerDocument,"mouseup",ee),u.history.lastSelOrigin=null}var J=tt(e,function(V){V.buttons===0||!Zl(V)?Z(V):U(V)}),ee=tt(e,Z);e.state.selectingText=ee,ue(n.wrapper.ownerDocument,"mousemove",J),ue(n.wrapper.ownerDocument,"mouseup",ee)}function Hh(e,t){var i=t.anchor,r=t.head,n=ae(e.doc,i.line);if(me(i,r)==0&&i.sticky==r.sticky)return t;var u=tr(n);if(!u)return t;var p=Bi(u,i.ch,i.sticky),g=u[p];if(g.from!=i.ch&&g.to!=i.ch)return t;var m=p+(g.from==i.ch==(g.level!=1)?0:1);if(m==0||m==u.length)return t;var b;if(r.line!=i.line)b=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var C=Bi(u,r.ch,r.sticky),S=C-p||(r.ch-i.ch)*(g.level==1?-1:1);C==m-1||C==m?b=S<0:b=S>0}var _=u[m+(b?-1:0)],M=b==(_.level==1),P=M?_.from:_.to,U=M?"after":"before";return i.ch==P&&i.sticky==U?t:new Ee(new K(i.line,P,U),r)}function qu(e,t,i,r){var n,u;if(t.touches)n=t.touches[0].clientX,u=t.touches[0].clientY;else try{n=t.clientX,u=t.clientY}catch{return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&bt(t);var p=e.display,g=p.lineDiv.getBoundingClientRect();if(u>g.bottom||!Ot(e,i))return Vo(t);u-=g.top-p.viewOffset;for(var m=0;m=n){var C=Br(e.doc,u),S=e.display.gutterSpecs[m];return je(e,i,e,C,S.className,t),Vo(t)}}}function Ja(e,t){return qu(e,t,"gutterClick",!0)}function Ru(e,t){nr(e.display,t)||Ph(e,t)||$e(e,t,"contextmenu")||he||e.display.input.onContextMenu(t)}function Ph(e,t){return Ot(e,"gutterContextMenu")?qu(e,t,"gutterContextMenu",!1):!1}function Wu(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),qi(e)}var gi={toString:function(){return"CodeMirror.Init"}},Uu={},eo={};function qh(e){var t=e.optionHandlers;function i(r,n,u,p){e.defaults[r]=n,u&&(t[r]=p?function(g,m,b){b!=gi&&u(g,m,b)}:u)}e.defineOption=i,e.Init=gi,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,Ra(r)},!0),i("indentUnit",2,Ra,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){Yi(r),qi(r),yt(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!!n){var u=[],p=r.doc.first;r.doc.iter(function(m){for(var b=0;;){var C=m.text.indexOf(n,b);if(C==-1)break;b=C+n.length,u.push(K(p,C))}p++});for(var g=u.length-1;g>=0;g--)ci(r.doc,n,u[g],K(u[g].line,u[g].ch+n.length))}}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(r,n,u){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),u!=gi&&r.refresh()}),i("specialCharPlaceholder",gd,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",z?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(r,n){return r.getInputField().spellcheck=n},!0),i("autocorrect",!1,function(r,n){return r.getInputField().autocorrect=n},!0),i("autocapitalize",!1,function(r,n){return r.getInputField().autocapitalize=n},!0),i("rtlMoveVisually",!R),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Wu(r),Ki(r)},!0),i("keyMap","default",function(r,n,u){var p=Vn(n),g=u!=gi&&Vn(u);g&&g.detach&&g.detach(r,p),p.attach&&p.attach(r,g||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Wh,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=Pa(n,r.options.lineNumbers),Ki(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?Aa(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return li(r)},!0),i("scrollbarStyle","native",function(r){Gs(r),li(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),i("lineNumbers",!1,function(r,n){r.display.gutterSpecs=Pa(r.options.gutters,n),Ki(r)},!0),i("firstLineNumber",1,Ki,!0),i("lineNumberFormatter",function(r){return r},Ki,!0),i("showCursorWhenSelecting",!1,Ri,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,n){n=="nocursor"&&(oi(r),r.display.input.blur()),r.display.input.readOnlyChanged(n)}),i("screenReaderLabel",null,function(r,n){n=n===""?null:n,r.display.input.screenReaderLabelChanged(n)}),i("disableInput",!1,function(r,n){n||r.display.input.reset()},!0),i("dragDrop",!0,Rh),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,Ri,!0),i("singleCursorHeightPerLine",!0,Ri,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,Yi,!0),i("addModeClass",!1,Yi,!0),i("pollInterval",100),i("undoDepth",200,function(r,n){return r.doc.history.undoDepth=n}),i("historyEventDelay",1250),i("viewportMargin",10,function(r){return r.refresh()},!0),i("maxHighlightLength",1e4,Yi,!0),i("moveInputWithCursor",!0,function(r,n){n||r.display.input.resetPosition()}),i("tabindex",null,function(r,n){return r.display.input.getField().tabIndex=n||""}),i("autofocus",null),i("direction","ltr",function(r,n){return r.doc.setDirection(n)},!0),i("phrases",null)}function Rh(e,t,i){var r=i&&i!=gi;if(!t!=!r){var n=e.display.dragFunctions,u=t?ue:Mt;u(e.display.scroller,"dragstart",n.start),u(e.display.scroller,"dragenter",n.enter),u(e.display.scroller,"dragover",n.over),u(e.display.scroller,"dragleave",n.leave),u(e.display.scroller,"drop",n.drop)}}function Wh(e){e.options.lineWrapping?(be(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(oe(e.display.wrapper,"CodeMirror-wrap"),va(e)),Fa(e),yt(e),qi(e),setTimeout(function(){return li(e)},100)}function Ne(e,t){var i=this;if(!(this instanceof Ne))return new Ne(e,t);this.options=t=t?Lt(t):{},Lt(Uu,t,!1);var r=t.value;typeof r=="string"?r=new xt(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new Ne.inputStyles[t.inputStyle](this),u=this.display=new th(e,r,n,t);u.wrapper.CodeMirror=this,Wu(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Gs(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new ct,keySeq:null,specialChars:null},t.autofocus&&!z&&u.input.focus(),c&&d<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Uh(this),xh(),Pr(this),this.curOp.forceUpdate=!0,tu(this,r),t.autofocus&&!z||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&Ba(i)},20):oi(this);for(var p in eo)eo.hasOwnProperty(p)&&eo[p](this,t[p],gi);Ys(this),t.finishInit&&t.finishInit(this);for(var g=0;g20*20}ue(t.scroller,"touchstart",function(m){if(!$e(e,m)&&!u(m)&&!Ja(e,m)){t.input.ensurePolled(),clearTimeout(i);var b=+new Date;t.activeTouch={start:b,moved:!1,prev:b-r.end<=300?r:null},m.touches.length==1&&(t.activeTouch.left=m.touches[0].pageX,t.activeTouch.top=m.touches[0].pageY)}}),ue(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),ue(t.scroller,"touchend",function(m){var b=t.activeTouch;if(b&&!nr(t,m)&&b.left!=null&&!b.moved&&new Date-b.start<300){var C=e.coordsChar(t.activeTouch,"page"),S;!b.prev||p(b,b.prev)?S=new Ee(C,C):!b.prev.prev||p(b,b.prev.prev)?S=e.findWordAt(C):S=new Ee(K(C.line,0),ve(e.doc,K(C.line+1,0))),e.setSelection(S.anchor,S.head),e.focus(),bt(m)}n()}),ue(t.scroller,"touchcancel",n),ue(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Ui(e,t.scroller.scrollTop),Ir(e,t.scroller.scrollLeft,!0),je(e,"scroll",e))}),ue(t.scroller,"mousewheel",function(m){return Js(e,m)}),ue(t.scroller,"DOMMouseScroll",function(m){return Js(e,m)}),ue(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(m){$e(e,m)||_i(m)},over:function(m){$e(e,m)||(yh(e,m),_i(m))},start:function(m){return bh(e,m)},drop:tt(e,vh),leave:function(m){$e(e,m)||Su(e)}};var g=t.input.getField();ue(g,"keyup",function(m){return Ou.call(e,m)}),ue(g,"keydown",tt(e,Nu)),ue(g,"keypress",tt(e,Iu)),ue(g,"focus",function(m){return Ba(e,m)}),ue(g,"blur",function(m){return oi(e,m)})}var Va=[];Ne.defineInitHook=function(e){return Va.push(e)};function sn(e,t,i,r){var n=e.doc,u;i==null&&(i="add"),i=="smart"&&(n.mode.indent?u=Ni(e,t).state:i="prev");var p=e.options.tabSize,g=ae(n,t),m=Ye(g.text,null,p);g.stateAfter&&(g.stateAfter=null);var b=g.text.match(/^\s*/)[0],C;if(!r&&!/\S/.test(g.text))C=0,i="not";else if(i=="smart"&&(C=n.mode.indent(u,g.text.slice(b.length),g.text),C==Ze||C>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?C=Ye(ae(n,t-1).text,null,p):C=0:i=="add"?C=m+e.options.indentUnit:i=="subtract"?C=m-e.options.indentUnit:typeof i=="number"&&(C=m+i),C=Math.max(0,C);var S="",_=0;if(e.options.indentWithTabs)for(var M=Math.floor(C/p);M;--M)_+=p,S+=" ";if(_p,m=ra(t),b=null;if(g&&r.ranges.length>1)if(Ut&&Ut.text.join(` `)==t){if(r.ranges.length%Ut.text.length==0){b=[];for(var C=0;C=0;_--){var M=r.ranges[_],P=M.from(),U=M.to();M.empty()&&(i&&i>0?P=K(P.line,P.ch-i):e.state.overwrite&&!g?U=K(U.line,Math.min(ae(u,U.line).text.length,U.ch+De(m).length)):g&&Ut&&Ut.lineWise&&Ut.text.join(` `)==m.join(` -`)&&(P=U=K(P.line,0)));var Z={from:P,to:U,text:b?b[_%b.length]:m,origin:n||(g?"paste":e.state.cutIncoming>p?"cut":"+input")};ui(e.doc,Z),et(e,"inputRead",e,Z)}t&&!g&&Gu(e,t),oi(e),e.curOp.updateInput<2&&(e.curOp.updateInput=S),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ju(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&St(t,function(){return $a(t,i,0,null,"paste")}),!0}function Gu(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var i=e.doc.sel,r=i.ranges.length-1;r>=0;r--){var n=i.ranges[r];if(!(n.head.ch>100||r&&i.ranges[r-1].head.line==n.head.line)){var u=e.getModeAt(n.head),p=!1;if(u.electricChars){for(var g=0;g-1){p=ln(e,n.head.line,"smart");break}}else u.electricInput&&u.electricInput.test(ae(e.doc,n.head.line).text.slice(0,n.head.ch))&&(p=ln(e,n.head.line,"smart"));p&&et(e,"electricInput",e,n.head.line)}}}function Xu(e){for(var t=[],i=[],r=0;ru&&(ln(this,g.head.line,r,!0),u=g.head.line,p==this.doc.sel.primIndex&&oi(this));else{var m=g.from(),b=g.to(),C=Math.max(u,m.line);u=Math.min(this.lastLine(),b.line-(b.ch?0:1))+1;for(var S=C;S0&&Ga(this.doc,p,new Ae(m,_[p].to()),vt)}}}),getTokenAt:function(r,n){return is(this,r,n)},getLineTokens:function(r,n){return is(this,K(r),n,!0)},getTokenTypeAt:function(r){r=ve(this.doc,r);var n=es(this,ae(this.doc,r.line)),u=0,p=(n.length-1)/2,g=r.ch,m;if(g==0)m=n[2];else for(;;){var b=u+p>>1;if((b?n[b*2-1]:0)>=g)p=b;else if(n[b*2+1]m&&(r=m,p=!0),g=ae(this.doc,r)}else g=r;return Nn(this,g,{top:0,left:0},n||"page",u||p).top+(p?this.doc.height-ir(g):0)},defaultTextHeight:function(){return ri(this.display)},defaultCharWidth:function(){return ii(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,u,p,g){var m=this.display;r=Rt(this,ve(this.doc,r));var b=r.bottom,C=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),m.sizer.appendChild(n),p=="over")b=r.top;else if(p=="above"||p=="near"){var S=Math.max(m.wrapper.clientHeight,this.doc.height),_=Math.max(m.sizer.clientWidth,m.lineSpace.clientWidth);(p=="above"||r.bottom+n.offsetHeight>S)&&r.top>n.offsetHeight?b=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=S&&(b=r.bottom),C+n.offsetWidth>_&&(C=_-n.offsetWidth)}n.style.top=b+"px",n.style.left=n.style.right="",g=="right"?(C=m.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(g=="left"?C=0:g=="middle"&&(C=(m.sizer.clientWidth-n.offsetWidth)/2),n.style.left=C+"px"),u&&Rd(this,{left:C,top:b,right:C+n.offsetWidth,bottom:b+n.offsetHeight})},triggerOnKeyDown:dt(Nu),triggerOnKeyPress:dt(Iu),triggerOnKeyUp:Ou,triggerOnMouseDown:dt(Hu),execCommand:function(r){if(rn.hasOwnProperty(r))return rn[r].call(null,this)},triggerElectric:dt(function(r){Gu(this,r)}),findPosH:function(r,n,u,p){var g=1;n<0&&(g=-1,n=-n);for(var m=ve(this.doc,r),b=0;b0&&C(u.charAt(p-1));)--p;for(;g.5||this.options.lineWrapping)&&Fa(this),je(this,"refresh",this)}),swapDoc:dt(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),tu(this,r),Pi(this),this.display.input.reset(),Ri(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,et(this,"swapDoc",this,n),n}),phrase:function(r){var n=this.options.phrases;return n&&Object.prototype.hasOwnProperty.call(n,r)?n[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Qr(e),e.registerHelper=function(r,n,u){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=u},e.registerGlobalHelper=function(r,n,u,p){e.registerHelper(r,n,p),i[r]._global.push({pred:u,val:p})}}function tl(e,t,i,r,n){var u=t,p=i,g=ae(e,t.line),m=n&&e.direction=="rtl"?-i:i;function b(){var ee=t.line+m;return ee=e.first+e.size?!1:(t=new K(ee,t.ch,t.sticky),g=ae(e,ee))}function C(ee){var V;if(r=="codepoint"){var ie=g.text.charCodeAt(t.ch+(i>0?0:-1));if(isNaN(ie))V=null;else{var se=i>0?ie>=55296&&ie<56320:ie>=56320&&ie<57343;V=new K(t.line,Math.max(0,Math.min(g.text.length,t.ch+i*(se?2:1))),-i)}}else n?V=Sh(e.cm,g,t,i):V=Ka(g,t,i);if(V==null)if(!ee&&b())t=Ya(n,e.cm,g,t.line,m);else return!1;else t=V;return!0}if(r=="char"||r=="codepoint")C();else if(r=="column")C(!0);else if(r=="word"||r=="group")for(var S=null,_=r=="group",M=e.cm&&e.cm.getHelper(t,"wordChars"),P=!0;!(i<0&&!C(!P));P=!1){var U=g.text.charAt(t.ch)||` -`,Z=Dn(U,M)?"w":_&&U==` -`?"n":!_||/\s/.test(U)?null:"p";if(_&&!P&&!Z&&(Z="s"),S&&S!=Z){i<0&&(i=1,C(),t.sticky="after");break}if(Z&&(S=Z),i>0&&!C(!P))break}var J=Yn(e,t,u,p,!0);return ua(u,J)&&(J.hitSide=!0),J}function Yu(e,t,i,r){var n=e.doc,u=t.left,p;if(r=="page"){var g=Math.min(e.display.wrapper.clientHeight,xe(e).innerHeight||n(e).documentElement.clientHeight),m=Math.max(g-.5*ri(e.display),3);p=(i>0?t.bottom:t.top)+i*m}else r=="line"&&(p=i>0?t.bottom+3:t.top-3);for(var b;b=ka(e,u,p),!!b.outside;){if(i<0?p<=0:p>=n.height){b.hitSide=!0;break}p+=i*5}return b}var Te=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ct,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Te.prototype.init=function(e){var t=this,i=this,r=i.cm,n=i.div=e.lineDiv;n.contentEditable=!0,el(n,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function u(g){for(var m=g.target;m;m=m.parentNode){if(m==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(m.className))break}return!1}ue(n,"paste",function(g){!u(g)||$e(r,g)||ju(g,r)||d<=11&&setTimeout(tt(r,function(){return t.updateFromDOM()}),20)}),ue(n,"compositionstart",function(g){t.composing={data:g.data,done:!1}}),ue(n,"compositionupdate",function(g){t.composing||(t.composing={data:g.data,done:!1})}),ue(n,"compositionend",function(g){t.composing&&(g.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ue(n,"touchstart",function(){return i.forceCompositionEnd()}),ue(n,"input",function(){t.composing||t.readFromDOMSoon()});function p(g){if(!(!u(g)||$e(r,g))){if(r.somethingSelected())eo({lineWise:!1,text:r.getSelections()}),g.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var m=Xu(r);eo({lineWise:!0,text:m.text}),g.type=="cut"&&r.operation(function(){r.setSelections(m.ranges,0,vt),r.replaceSelection("",null,"cut")})}else return;if(g.clipboardData){g.clipboardData.clearData();var b=Ut.text.join(` +`)&&(P=U=K(P.line,0)));var Z={from:P,to:U,text:b?b[_%b.length]:m,origin:n||(g?"paste":e.state.cutIncoming>p?"cut":"+input")};fi(e.doc,Z),et(e,"inputRead",e,Z)}t&&!g&&Gu(e,t),ai(e),e.curOp.updateInput<2&&(e.curOp.updateInput=S),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ju(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&St(t,function(){return $a(t,i,0,null,"paste")}),!0}function Gu(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var i=e.doc.sel,r=i.ranges.length-1;r>=0;r--){var n=i.ranges[r];if(!(n.head.ch>100||r&&i.ranges[r-1].head.line==n.head.line)){var u=e.getModeAt(n.head),p=!1;if(u.electricChars){for(var g=0;g-1){p=sn(e,n.head.line,"smart");break}}else u.electricInput&&u.electricInput.test(ae(e.doc,n.head.line).text.slice(0,n.head.ch))&&(p=sn(e,n.head.line,"smart"));p&&et(e,"electricInput",e,n.head.line)}}}function Xu(e){for(var t=[],i=[],r=0;ru&&(sn(this,g.head.line,r,!0),u=g.head.line,p==this.doc.sel.primIndex&&ai(this));else{var m=g.from(),b=g.to(),C=Math.max(u,m.line);u=Math.min(this.lastLine(),b.line-(b.ch?0:1))+1;for(var S=C;S0&&Ga(this.doc,p,new Ee(m,_[p].to()),vt)}}}),getTokenAt:function(r,n){return is(this,r,n)},getLineTokens:function(r,n){return is(this,K(r),n,!0)},getTokenTypeAt:function(r){r=ve(this.doc,r);var n=es(this,ae(this.doc,r.line)),u=0,p=(n.length-1)/2,g=r.ch,m;if(g==0)m=n[2];else for(;;){var b=u+p>>1;if((b?n[b*2-1]:0)>=g)p=b;else if(n[b*2+1]m&&(r=m,p=!0),g=ae(this.doc,r)}else g=r;return On(this,g,{top:0,left:0},n||"page",u||p).top+(p?this.doc.height-ir(g):0)},defaultTextHeight:function(){return ii(this.display)},defaultCharWidth:function(){return ni(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,u,p,g){var m=this.display;r=Rt(this,ve(this.doc,r));var b=r.bottom,C=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),m.sizer.appendChild(n),p=="over")b=r.top;else if(p=="above"||p=="near"){var S=Math.max(m.wrapper.clientHeight,this.doc.height),_=Math.max(m.sizer.clientWidth,m.lineSpace.clientWidth);(p=="above"||r.bottom+n.offsetHeight>S)&&r.top>n.offsetHeight?b=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=S&&(b=r.bottom),C+n.offsetWidth>_&&(C=_-n.offsetWidth)}n.style.top=b+"px",n.style.left=n.style.right="",g=="right"?(C=m.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(g=="left"?C=0:g=="middle"&&(C=(m.sizer.clientWidth-n.offsetWidth)/2),n.style.left=C+"px"),u&&Rd(this,{left:C,top:b,right:C+n.offsetWidth,bottom:b+n.offsetHeight})},triggerOnKeyDown:dt(Nu),triggerOnKeyPress:dt(Iu),triggerOnKeyUp:Ou,triggerOnMouseDown:dt(Hu),execCommand:function(r){if(nn.hasOwnProperty(r))return nn[r].call(null,this)},triggerElectric:dt(function(r){Gu(this,r)}),findPosH:function(r,n,u,p){var g=1;n<0&&(g=-1,n=-n);for(var m=ve(this.doc,r),b=0;b0&&C(u.charAt(p-1));)--p;for(;g.5||this.options.lineWrapping)&&Fa(this),je(this,"refresh",this)}),swapDoc:dt(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),tu(this,r),qi(this),this.display.input.reset(),Wi(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,et(this,"swapDoc",this,n),n}),phrase:function(r){var n=this.options.phrases;return n&&Object.prototype.hasOwnProperty.call(n,r)?n[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Jr(e),e.registerHelper=function(r,n,u){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=u},e.registerGlobalHelper=function(r,n,u,p){e.registerHelper(r,n,p),i[r]._global.push({pred:u,val:p})}}function tl(e,t,i,r,n){var u=t,p=i,g=ae(e,t.line),m=n&&e.direction=="rtl"?-i:i;function b(){var ee=t.line+m;return ee=e.first+e.size?!1:(t=new K(ee,t.ch,t.sticky),g=ae(e,ee))}function C(ee){var V;if(r=="codepoint"){var ie=g.text.charCodeAt(t.ch+(i>0?0:-1));if(isNaN(ie))V=null;else{var se=i>0?ie>=55296&&ie<56320:ie>=56320&&ie<57343;V=new K(t.line,Math.max(0,Math.min(g.text.length,t.ch+i*(se?2:1))),-i)}}else n?V=Sh(e.cm,g,t,i):V=Ka(g,t,i);if(V==null)if(!ee&&b())t=Ya(n,e.cm,g,t.line,m);else return!1;else t=V;return!0}if(r=="char"||r=="codepoint")C();else if(r=="column")C(!0);else if(r=="word"||r=="group")for(var S=null,_=r=="group",M=e.cm&&e.cm.getHelper(t,"wordChars"),P=!0;!(i<0&&!C(!P));P=!1){var U=g.text.charAt(t.ch)||` +`,Z=kn(U,M)?"w":_&&U==` +`?"n":!_||/\s/.test(U)?null:"p";if(_&&!P&&!Z&&(Z="s"),S&&S!=Z){i<0&&(i=1,C(),t.sticky="after");break}if(Z&&(S=Z),i>0&&!C(!P))break}var J=Zn(e,t,u,p,!0);return ua(u,J)&&(J.hitSide=!0),J}function Yu(e,t,i,r){var n=e.doc,u=t.left,p;if(r=="page"){var g=Math.min(e.display.wrapper.clientHeight,ye(e).innerHeight||n(e).documentElement.clientHeight),m=Math.max(g-.5*ii(e.display),3);p=(i>0?t.bottom:t.top)+i*m}else r=="line"&&(p=i>0?t.bottom+3:t.top-3);for(var b;b=ka(e,u,p),!!b.outside;){if(i<0?p<=0:p>=n.height){b.hitSide=!0;break}p+=i*5}return b}var Te=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ct,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Te.prototype.init=function(e){var t=this,i=this,r=i.cm,n=i.div=e.lineDiv;n.contentEditable=!0,el(n,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function u(g){for(var m=g.target;m;m=m.parentNode){if(m==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(m.className))break}return!1}ue(n,"paste",function(g){!u(g)||$e(r,g)||ju(g,r)||d<=11&&setTimeout(tt(r,function(){return t.updateFromDOM()}),20)}),ue(n,"compositionstart",function(g){t.composing={data:g.data,done:!1}}),ue(n,"compositionupdate",function(g){t.composing||(t.composing={data:g.data,done:!1})}),ue(n,"compositionend",function(g){t.composing&&(g.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ue(n,"touchstart",function(){return i.forceCompositionEnd()}),ue(n,"input",function(){t.composing||t.readFromDOMSoon()});function p(g){if(!(!u(g)||$e(r,g))){if(r.somethingSelected())to({lineWise:!1,text:r.getSelections()}),g.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var m=Xu(r);to({lineWise:!0,text:m.text}),g.type=="cut"&&r.operation(function(){r.setSelections(m.ranges,0,vt),r.replaceSelection("",null,"cut")})}else return;if(g.clipboardData){g.clipboardData.clearData();var b=Ut.text.join(` `);if(g.clipboardData.setData("Text",b),g.clipboardData.getData("Text")==b){g.preventDefault();return}}var C=Ku(),S=C.firstChild;el(S),r.display.lineSpace.insertBefore(C,r.display.lineSpace.firstChild),S.value=Ut.text.join(` -`);var _=he(Ce(n));A(S),setTimeout(function(){r.display.lineSpace.removeChild(C),_.focus(),_==n&&i.showPrimarySelection()},50)}}ue(n,"copy",p),ue(n,"cut",p)},Te.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Te.prototype.prepareSelection=function(){var e=Hs(this.cm,!1);return e.focus=he(Ce(this.div))==this.div,e},Te.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Te.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Te.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),r=i.from(),n=i.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||n.line=t.display.viewFrom&&Zu(t,r)||{node:g[0].measure.map[2],offset:0},b=n.linee.firstLine()&&(r=K(r.line-1,ae(e.doc,r.line-1).length)),n.ch==ae(e.doc,n.line).text.length&&n.linet.viewTo-1)return!1;var u,p,g;r.line==t.viewFrom||(u=Or(e,r.line))==0?(p=Fe(t.view[0].line),g=t.view[0].node):(p=Fe(t.view[u].line),g=t.view[u-1].node.nextSibling);var m=Or(e,n.line),b,C;if(m==t.view.length-1?(b=t.viewTo-1,C=t.lineDiv.lastChild):(b=Fe(t.view[m+1].line)-1,C=t.view[m+1].node.previousSibling),!g)return!1;for(var S=e.doc.splitLines(Xh(e,g,C,p,b)),_=Mr(e.doc,K(p,0),K(b,ae(e.doc,b).text.length));S.length>1&&_.length>1;)if(De(S)==De(_))S.pop(),_.pop(),b--;else if(S[0]==_[0])S.shift(),_.shift(),p++;else break;for(var M=0,P=0,U=S[0],Z=_[0],J=Math.min(U.length,Z.length);Mr.ch&&ee.charCodeAt(ee.length-P-1)==V.charCodeAt(V.length-P-1);)M--,P++;S[S.length-1]=ee.slice(0,ee.length-P).replace(/^\u200b+/,""),S[0]=S[0].slice(M).replace(/\u200b+$/,"");var se=K(p,M),le=K(b,_.length?De(_).length-P:0);if(S.length>1||S[0]||me(se,le))return fi(e.doc,S,se,le,"+input"),!0},Te.prototype.ensurePolled=function(){this.forceCompositionEnd()},Te.prototype.reset=function(){this.forceCompositionEnd()},Te.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Te.prototype.readFromDOMSoon=function(){var e=this;this.readDOMTimeout==null&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80))},Te.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&St(this.cm,function(){return yt(e.cm)})},Te.prototype.setUneditable=function(e){e.contentEditable="false"},Te.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||tt(this.cm,$a)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},Te.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Te.prototype.onContextMenu=function(){},Te.prototype.resetPosition=function(){},Te.prototype.needsContentAttribute=!0;function Zu(e,t){var i=wa(e,t.line);if(!i||i.hidden)return null;var r=ae(e.doc,t.line),n=ks(i,r,t.line),u=tr(r,e.doc.direction),p="left";if(u){var g=Mi(u,t.ch);p=g%2?"right":"left"}var m=As(n.map,t.ch,p);return m.offset=m.collapse=="right"?m.end:m.start,m}function Gh(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function gi(e,t){return t&&(e.bad=!0),e}function Xh(e,t,i,r,n){var u="",p=!1,g=e.doc.lineSeparator(),m=!1;function b(M){return function(P){return P.id==M}}function C(){p&&(u+=g,m&&(u+=g),p=m=!1)}function S(M){M&&(C(),u+=M)}function _(M){if(M.nodeType==1){var P=M.getAttribute("cm-text");if(P){S(P);return}var U=M.getAttribute("cm-marker"),Z;if(U){var J=e.findMarks(K(r,0),K(n+1,0),b(+U));J.length&&(Z=J[0].find(0))&&S(Mr(e.doc,Z.from,Z.to).join(g));return}if(M.getAttribute("contenteditable")=="false")return;var ee=/^(pre|div|p|li|table|br)$/i.test(M.nodeName);if(!/^br$/i.test(M.nodeName)&&M.textContent.length==0)return;ee&&C();for(var V=0;V=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),ue(n,"paste",function(p){$e(r,p)||ju(p,r)||(r.state.pasteIncoming=+new Date,i.fastPoll())});function u(p){if(!$e(r,p)){if(r.somethingSelected())eo({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var g=Xu(r);eo({lineWise:!0,text:g.text}),p.type=="cut"?r.setSelections(g.ranges,null,vt):(i.prevInput="",n.value=g.text.join(` -`),A(n))}else return;p.type=="cut"&&(r.state.cutIncoming=+new Date)}}ue(n,"cut",u),ue(n,"copy",u),ue(e.scroller,"paste",function(p){if(!(nr(e,p)||$e(r,p))){if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var g=new Event("paste");g.clipboardData=p.clipboardData,n.dispatchEvent(g)}}),ue(e.lineSpace,"selectstart",function(p){nr(e,p)||bt(p)}),ue(n,"compositionstart",function(){var p=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:p,range:r.markText(p,r.getCursor("to"),{className:"CodeMirror-composing"})}}),ue(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},We.prototype.createField=function(e){this.wrapper=Ku(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;el(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},We.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},We.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=Hs(e);if(e.options.moveInputWithCursor){var n=Rt(e,i.sel.primary().head,"div"),u=t.wrapper.getBoundingClientRect(),p=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+p.top-u.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+p.left-u.left))}return r},We.prototype.showSelection=function(e){var t=this.cm,i=t.display;Y(i.cursorDiv,e.cursors),Y(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},We.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i,t.state.focused&&A(this.textarea),c&&d>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",c&&d>=9&&(this.hasSelection=null));this.resetting=!1}},We.prototype.getField=function(){return this.textarea},We.prototype.supportsTouch=function(){return!1},We.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!z||he(Ce(this.textarea))!=this.textarea))try{this.textarea.focus()}catch{}},We.prototype.blur=function(){this.textarea.blur()},We.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},We.prototype.receivedFocus=function(){this.slowPoll()},We.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},We.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function i(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,i)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,i)},We.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||Xc(i)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var n=i.value;if(n==r&&!t.somethingSelected())return!1;if(c&&d>=9&&this.hasSelection===n||O&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var u=n.charCodeAt(0);if(u==8203&&!r&&(r="\u200B"),u==8666)return this.reset(),this.cm.execCommand("undo")}for(var p=0,g=Math.min(r.length,n.length);p1e3||n.indexOf(` +`);var _=de(Ce(n));A(S),setTimeout(function(){r.display.lineSpace.removeChild(C),_.focus(),_==n&&i.showPrimarySelection()},50)}}ue(n,"copy",p),ue(n,"cut",p)},Te.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Te.prototype.prepareSelection=function(){var e=Hs(this.cm,!1);return e.focus=de(Ce(this.div))==this.div,e},Te.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Te.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Te.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),r=i.from(),n=i.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||n.line=t.display.viewFrom&&Zu(t,r)||{node:g[0].measure.map[2],offset:0},b=n.linee.firstLine()&&(r=K(r.line-1,ae(e.doc,r.line-1).length)),n.ch==ae(e.doc,n.line).text.length&&n.linet.viewTo-1)return!1;var u,p,g;r.line==t.viewFrom||(u=Or(e,r.line))==0?(p=Fe(t.view[0].line),g=t.view[0].node):(p=Fe(t.view[u].line),g=t.view[u-1].node.nextSibling);var m=Or(e,n.line),b,C;if(m==t.view.length-1?(b=t.viewTo-1,C=t.lineDiv.lastChild):(b=Fe(t.view[m+1].line)-1,C=t.view[m+1].node.previousSibling),!g)return!1;for(var S=e.doc.splitLines(Xh(e,g,C,p,b)),_=Mr(e.doc,K(p,0),K(b,ae(e.doc,b).text.length));S.length>1&&_.length>1;)if(De(S)==De(_))S.pop(),_.pop(),b--;else if(S[0]==_[0])S.shift(),_.shift(),p++;else break;for(var M=0,P=0,U=S[0],Z=_[0],J=Math.min(U.length,Z.length);Mr.ch&&ee.charCodeAt(ee.length-P-1)==V.charCodeAt(V.length-P-1);)M--,P++;S[S.length-1]=ee.slice(0,ee.length-P).replace(/^\u200b+/,""),S[0]=S[0].slice(M).replace(/\u200b+$/,"");var se=K(p,M),le=K(b,_.length?De(_).length-P:0);if(S.length>1||S[0]||me(se,le))return ci(e.doc,S,se,le,"+input"),!0},Te.prototype.ensurePolled=function(){this.forceCompositionEnd()},Te.prototype.reset=function(){this.forceCompositionEnd()},Te.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Te.prototype.readFromDOMSoon=function(){var e=this;this.readDOMTimeout==null&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80))},Te.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&St(this.cm,function(){return yt(e.cm)})},Te.prototype.setUneditable=function(e){e.contentEditable="false"},Te.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||tt(this.cm,$a)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},Te.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Te.prototype.onContextMenu=function(){},Te.prototype.resetPosition=function(){},Te.prototype.needsContentAttribute=!0;function Zu(e,t){var i=wa(e,t.line);if(!i||i.hidden)return null;var r=ae(e.doc,t.line),n=ks(i,r,t.line),u=tr(r,e.doc.direction),p="left";if(u){var g=Bi(u,t.ch);p=g%2?"right":"left"}var m=As(n.map,t.ch,p);return m.offset=m.collapse=="right"?m.end:m.start,m}function Gh(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function mi(e,t){return t&&(e.bad=!0),e}function Xh(e,t,i,r,n){var u="",p=!1,g=e.doc.lineSeparator(),m=!1;function b(M){return function(P){return P.id==M}}function C(){p&&(u+=g,m&&(u+=g),p=m=!1)}function S(M){M&&(C(),u+=M)}function _(M){if(M.nodeType==1){var P=M.getAttribute("cm-text");if(P){S(P);return}var U=M.getAttribute("cm-marker"),Z;if(U){var J=e.findMarks(K(r,0),K(n+1,0),b(+U));J.length&&(Z=J[0].find(0))&&S(Mr(e.doc,Z.from,Z.to).join(g));return}if(M.getAttribute("contenteditable")=="false")return;var ee=/^(pre|div|p|li|table|br)$/i.test(M.nodeName);if(!/^br$/i.test(M.nodeName)&&M.textContent.length==0)return;ee&&C();for(var V=0;V=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),ue(n,"paste",function(p){$e(r,p)||ju(p,r)||(r.state.pasteIncoming=+new Date,i.fastPoll())});function u(p){if(!$e(r,p)){if(r.somethingSelected())to({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var g=Xu(r);to({lineWise:!0,text:g.text}),p.type=="cut"?r.setSelections(g.ranges,null,vt):(i.prevInput="",n.value=g.text.join(` +`),A(n))}else return;p.type=="cut"&&(r.state.cutIncoming=+new Date)}}ue(n,"cut",u),ue(n,"copy",u),ue(e.scroller,"paste",function(p){if(!(nr(e,p)||$e(r,p))){if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var g=new Event("paste");g.clipboardData=p.clipboardData,n.dispatchEvent(g)}}),ue(e.lineSpace,"selectstart",function(p){nr(e,p)||bt(p)}),ue(n,"compositionstart",function(){var p=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:p,range:r.markText(p,r.getCursor("to"),{className:"CodeMirror-composing"})}}),ue(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},We.prototype.createField=function(e){this.wrapper=Ku(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;el(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},We.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},We.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=Hs(e);if(e.options.moveInputWithCursor){var n=Rt(e,i.sel.primary().head,"div"),u=t.wrapper.getBoundingClientRect(),p=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+p.top-u.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+p.left-u.left))}return r},We.prototype.showSelection=function(e){var t=this.cm,i=t.display;Y(i.cursorDiv,e.cursors),Y(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},We.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i,t.state.focused&&A(this.textarea),c&&d>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",c&&d>=9&&(this.hasSelection=null));this.resetting=!1}},We.prototype.getField=function(){return this.textarea},We.prototype.supportsTouch=function(){return!1},We.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!z||de(Ce(this.textarea))!=this.textarea))try{this.textarea.focus()}catch{}},We.prototype.blur=function(){this.textarea.blur()},We.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},We.prototype.receivedFocus=function(){this.slowPoll()},We.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},We.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function i(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,i)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,i)},We.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||Xc(i)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var n=i.value;if(n==r&&!t.somethingSelected())return!1;if(c&&d>=9&&this.hasSelection===n||O&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var u=n.charCodeAt(0);if(u==8203&&!r&&(r="\u200B"),u==8666)return this.reset(),this.cm.execCommand("undo")}for(var p=0,g=Math.min(r.length,n.length);p1e3||n.indexOf(` `)>-1?i.value=e.prevInput="":e.prevInput=n,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},We.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},We.prototype.onKeyPress=function(){c&&d>=9&&(this.hasSelection=null),this.fastPoll()},We.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var u=Nr(i,e),p=r.scroller.scrollTop;if(!u||k)return;var g=i.options.resetSelectionOnContextMenu;g&&i.doc.sel.contains(u)==-1&&tt(i,lt)(i.doc,yr(u),vt);var m=n.style.cssText,b=t.wrapper.style.cssText,C=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",n.style.cssText=`position: absolute; width: 30px; height: 30px; top: `+(e.clientY-C.top-5)+"px; left: "+(e.clientX-C.left-5)+`px; z-index: 1000; background: `+(c?"rgba(255, 255, 255, .05)":"transparent")+`; - outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var S;v&&(S=n.ownerDocument.defaultView.scrollY),r.input.focus(),v&&n.ownerDocument.defaultView.scrollTo(null,S),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=M,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function _(){if(n.selectionStart!=null){var U=i.somethingSelected(),Z="\u200B"+(U?n.value:"");n.value="\u21DA",n.value=Z,t.prevInput=U?"":"\u200B",n.selectionStart=1,n.selectionEnd=Z.length,r.selForContextMenu=i.doc.sel}}function M(){if(t.contextMenuPending==M&&(t.contextMenuPending=!1,t.wrapper.style.cssText=b,n.style.cssText=m,c&&d<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=p),n.selectionStart!=null)){(!c||c&&d<9)&&_();var U=0,Z=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?tt(i,pu)(i):U++<10?r.detectingSelectAll=setTimeout(Z,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Z,200)}}if(c&&d>=9&&_(),de){Bi(e);var P=function(){Mt(window,"mouseup",P),setTimeout(M,20)};ue(window,"mouseup",P)}else setTimeout(M,50)},We.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},We.prototype.setUneditable=function(){},We.prototype.needsContentAttribute=!1;function Yh(e,t){if(t=t?Lt(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var i=he(Ce(e));t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=g.getValue()}var n;if(e.form&&(ue(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var u=e.form;n=u.submit;try{var p=u.submit=function(){r(),u.submit=n,u.submit(),u.submit=p}}catch{}}t.finishInit=function(m){m.save=r,m.getTextArea=function(){return e},m.toTextArea=function(){m.toTextArea=isNaN,r(),e.parentNode.removeChild(m.getWrapperElement()),e.style.display="",e.form&&(Mt(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var g=Ne(function(m){return e.parentNode.insertBefore(m,e.nextSibling)},t);return g}function Zh(e){e.off=Mt,e.on=ue,e.wheelEventPixels=rh,e.Doc=xt,e.splitLines=ra,e.countColumn=Ye,e.findColumn=Kt,e.isWordChar=Zo,e.Pass=Ze,e.signal=je,e.Line=$r,e.changeEnd=xr,e.scrollbarModel=js,e.Pos=K,e.cmpPos=me,e.modes=na,e.mimeModes=Jr,e.resolveMode=kn,e.getMode=oa,e.modeExtensions=Vr,e.extendMode=Jc,e.copyState=Lr,e.startState=Ql,e.innerMode=aa,e.commands=rn,e.keyMap=ar,e.keyName=Lu,e.isModifierKey=Fu,e.lookupKey=di,e.normalizeKeyMap=kh,e.StringStream=Ge,e.SharedTextMarker=$i,e.TextMarker=Cr,e.LineWidget=Vi,e.e_preventDefault=bt,e.e_stopPropagation=Yl,e.e_stop=Bi,e.addClass=be,e.contains=Q,e.rmClass=oe,e.keyNames=Dr}qh(Ne),jh(Ne);var Qh="iter insert remove copy getEditor constructor".split(" ");for(var ro in xt.prototype)xt.prototype.hasOwnProperty(ro)&&ze(Qh,ro)<0&&(Ne.prototype[ro]=function(e){return function(){return e.apply(this.doc,arguments)}}(xt.prototype[ro]));return Qr(xt),Ne.inputStyles={textarea:We,contenteditable:Te},Ne.defineMode=function(e){!Ne.defaults.mode&&e!="null"&&(Ne.defaults.mode=e),Zc.apply(this,arguments)},Ne.defineMIME=Qc,Ne.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Ne.defineMIME("text/plain","null"),Ne.defineExtension=function(e,t){Ne.prototype[e]=t},Ne.defineDocExtension=function(e,t){xt.prototype[e]=t},Ne.fromTextArea=Yh,Zh(Ne),Ne.version="5.65.21",Ne})});var $u=at((Ju,Vu)=>{(function(o){typeof Ju=="object"&&typeof Vu=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,s=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,a=/[*+-]\s/;o.commands.newlineAndIndentContinueMarkdownList=function(h){if(h.getOption("disableInput"))return o.Pass;for(var c=h.listSelections(),d=[],v=0;v\s*$/.test(B),z=!/>\s*$/.test(B);(N||z)&&h.replaceRange("",{line:y.line,ch:0},{line:y.line,ch:y.ch+1}),d[v]=` -`}else{var O=L[1],I=L[5],W=!(a.test(L[2])||L[2].indexOf(">")>=0),G=W?parseInt(L[3],10)+1+L[4]:L[2].replace("x"," ");d[v]=` -`+O+G+I,W&&f(h,y)}}h.replaceSelections(d)};function f(h,c){var d=c.line,v=0,y=0,x=l.exec(h.getLine(d)),D=x[1];do{v+=1;var k=d+v,F=h.getLine(k),B=l.exec(F);if(B){var L=B[1],T=parseInt(x[3],10)+v-y,N=parseInt(B[3],10),z=N;if(D===L&&!isNaN(N))T===N&&(z=N+1),T>N&&(z=T+1),h.replaceRange(F.replace(l,L+z+B[4]+B[5]),{line:k,ch:0},{line:k,ch:F.length});else{if(D.length>L.length||D.length{var ef=At();ef.commands.tabAndIndentMarkdownList=function(o){var l=o.listSelections(),s=l[0].head,a=o.getStateAfter(s.line),f=a.list!==!1;if(f){o.execCommand("indentMore");return}if(o.options.indentWithTabs)o.execCommand("insertTab");else{var h=Array(o.options.tabSize+1).join(" ");o.replaceSelection(h)}};ef.commands.shiftTabAndUnindentMarkdownList=function(o){var l=o.listSelections(),s=l[0].head,a=o.getStateAfter(s.line),f=a.list!==!1;if(f){o.execCommand("indentLess");return}if(o.options.indentWithTabs)o.execCommand("insertTab");else{var h=Array(o.options.tabSize+1).join(" ");o.replaceSelection(h)}}});var of=at((rf,nf)=>{(function(o){typeof rf=="object"&&typeof nf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("fullScreen",!1,function(a,f,h){h==o.Init&&(h=!1),!h!=!f&&(f?l(a):s(a))});function l(a){var f=a.getWrapperElement();a.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:f.style.width,height:f.style.height},f.style.width="",f.style.height="auto",f.className+=" CodeMirror-fullscreen",document.documentElement.style.overflow="hidden",a.refresh()}function s(a){var f=a.getWrapperElement();f.className=f.className.replace(/\s*CodeMirror-fullscreen\b/,""),document.documentElement.style.overflow="";var h=a.state.fullScreenRestore;f.style.width=h.width,f.style.height=h.height,window.scrollTo(h.scrollLeft,h.scrollTop),a.refresh()}})});var al=at((af,lf)=>{(function(o){typeof af=="object"&&typeof lf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},s={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};o.defineMode("xml",function(a,f){var h=a.indentUnit,c={},d=f.htmlMode?l:s;for(var v in d)c[v]=d[v];for(var v in f)c[v]=f[v];var y,x;function D(E,q){function R(be){return q.tokenize=be,be(E,q)}var Q=E.next();if(Q=="<")return E.eat("!")?E.eat("[")?E.match("CDATA[")?R(B("atom","]]>")):null:E.match("--")?R(B("comment","-->")):E.match("DOCTYPE",!0,!0)?(E.eatWhile(/[\w\._\-]/),R(L(1))):null:E.eat("?")?(E.eatWhile(/[\w\._\-]/),q.tokenize=B("meta","?>"),"meta"):(y=E.eat("/")?"closeTag":"openTag",q.tokenize=k,"tag bracket");if(Q=="&"){var he;return E.eat("#")?E.eat("x")?he=E.eatWhile(/[a-fA-F\d]/)&&E.eat(";"):he=E.eatWhile(/[\d]/)&&E.eat(";"):he=E.eatWhile(/[\w\.\-:]/)&&E.eat(";"),he?"atom":"error"}else return E.eatWhile(/[^&<]/),null}D.isInText=!0;function k(E,q){var R=E.next();if(R==">"||R=="/"&&E.eat(">"))return q.tokenize=D,y=R==">"?"endTag":"selfcloseTag","tag bracket";if(R=="=")return y="equals",null;if(R=="<"){q.tokenize=D,q.state=I,q.tagName=q.tagStart=null;var Q=q.tokenize(E,q);return Q?Q+" tag error":"tag error"}else return/[\'\"]/.test(R)?(q.tokenize=F(R),q.stringStartCol=E.column(),q.tokenize(E,q)):(E.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function F(E){var q=function(R,Q){for(;!R.eol();)if(R.next()==E){Q.tokenize=k;break}return"string"};return q.isInAttribute=!0,q}function B(E,q){return function(R,Q){for(;!R.eol();){if(R.match(q)){Q.tokenize=D;break}R.next()}return E}}function L(E){return function(q,R){for(var Q;(Q=q.next())!=null;){if(Q=="<")return R.tokenize=L(E+1),R.tokenize(q,R);if(Q==">")if(E==1){R.tokenize=D;break}else return R.tokenize=L(E-1),R.tokenize(q,R)}return"meta"}}function T(E){return E&&E.toLowerCase()}function N(E,q,R){this.prev=E.context,this.tagName=q||"",this.indent=E.indented,this.startOfLine=R,(c.doNotIndent.hasOwnProperty(q)||E.context&&E.context.noIndent)&&(this.noIndent=!0)}function z(E){E.context&&(E.context=E.context.prev)}function O(E,q){for(var R;;){if(!E.context||(R=E.context.tagName,!c.contextGrabbers.hasOwnProperty(T(R))||!c.contextGrabbers[T(R)].hasOwnProperty(T(q))))return;z(E)}}function I(E,q,R){return E=="openTag"?(R.tagStart=q.column(),W):E=="closeTag"?G:I}function W(E,q,R){return E=="word"?(R.tagName=q.current(),x="tag",j):c.allowMissingTagName&&E=="endTag"?(x="tag bracket",j(E,q,R)):(x="error",W)}function G(E,q,R){if(E=="word"){var Q=q.current();return R.context&&R.context.tagName!=Q&&c.implicitlyClosed.hasOwnProperty(T(R.context.tagName))&&z(R),R.context&&R.context.tagName==Q||c.matchClosing===!1?(x="tag",X):(x="tag error",de)}else return c.allowMissingTagName&&E=="endTag"?(x="tag bracket",X(E,q,R)):(x="error",de)}function X(E,q,R){return E!="endTag"?(x="error",X):(z(R),I)}function de(E,q,R){return x="error",X(E,q,R)}function j(E,q,R){if(E=="word")return x="attribute",oe;if(E=="endTag"||E=="selfcloseTag"){var Q=R.tagName,he=R.tagStart;return R.tagName=R.tagStart=null,E=="selfcloseTag"||c.autoSelfClosers.hasOwnProperty(T(Q))?O(R,Q):(O(R,Q),R.context=new N(R,Q,he==R.indented)),I}return x="error",j}function oe(E,q,R){return E=="equals"?H:(c.allowMissing||(x="error"),j(E,q,R))}function H(E,q,R){return E=="string"?Y:E=="word"&&c.allowUnquoted?(x="string",j):(x="error",j(E,q,R))}function Y(E,q,R){return E=="string"?Y:j(E,q,R)}return{startState:function(E){var q={tokenize:D,state:I,indented:E||0,tagName:null,tagStart:null,context:null};return E!=null&&(q.baseIndent=E),q},token:function(E,q){if(!q.tagName&&E.sol()&&(q.indented=E.indentation()),E.eatSpace())return null;y=null;var R=q.tokenize(E,q);return(R||y)&&R!="comment"&&(x=null,q.state=q.state(y||R,E,q),x&&(R=x=="error"?R+" error":x)),R},indent:function(E,q,R){var Q=E.context;if(E.tokenize.isInAttribute)return E.tagStart==E.indented?E.stringStartCol+1:E.indented+h;if(Q&&Q.noIndent)return o.Pass;if(E.tokenize!=k&&E.tokenize!=D)return R?R.match(/^(\s*)/)[0].length:0;if(E.tagName)return c.multilineTagIndentPastTag!==!1?E.tagStart+E.tagName.length+2:E.tagStart+h*(c.multilineTagIndentFactor||1);if(c.alignCDATA&&/$/,blockCommentStart:"",configuration:c.htmlMode?"html":"xml",helperType:c.htmlMode?"html":"xml",skipAttribute:function(E){E.state==H&&(E.state=j)},xmlCurrentTag:function(E){return E.tagName?{name:E.tagName,close:E.type=="closeTag"}:null},xmlCurrentContext:function(E){for(var q=[],R=E.context;R;R=R.prev)q.push(R.tagName);return q.reverse()}}}),o.defineMIME("text/xml","xml"),o.defineMIME("application/xml","xml"),o.mimeModes.hasOwnProperty("text/html")||o.defineMIME("text/html",{name:"xml",htmlMode:!0})})});var ff=at((sf,uf)=>{(function(o){typeof sf=="object"&&typeof uf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy","cbl"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded JavaScript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"],alias:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var l=0;l-1&&a.substring(c+1,a.length);if(d)return o.findModeByExtension(d)},o.findModeByName=function(a){a=a.toLowerCase();for(var f=0;f{(function(o){typeof cf=="object"&&typeof df=="object"?o(At(),al(),ff()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../xml/xml","../meta"],o):o(CodeMirror)})(function(o){"use strict";o.defineMode("markdown",function(l,s){var a=o.getMode(l,"text/html"),f=a.name=="null";function h(A){if(o.findModeByName){var w=o.findModeByName(A);w&&(A=w.mime||w.mimes[0])}var te=o.getMode(l,A);return te.name=="null"?null:te}s.highlightFormatting===void 0&&(s.highlightFormatting=!1),s.maxBlockquoteDepth===void 0&&(s.maxBlockquoteDepth=0),s.taskLists===void 0&&(s.taskLists=!1),s.strikethrough===void 0&&(s.strikethrough=!1),s.emoji===void 0&&(s.emoji=!1),s.fencedCodeBlockHighlighting===void 0&&(s.fencedCodeBlockHighlighting=!0),s.fencedCodeBlockDefaultMode===void 0&&(s.fencedCodeBlockDefaultMode="text/plain"),s.xml===void 0&&(s.xml=!0),s.tokenTypeOverrides===void 0&&(s.tokenTypeOverrides={});var c={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var d in c)c.hasOwnProperty(d)&&s.tokenTypeOverrides[d]&&(c[d]=s.tokenTypeOverrides[d]);var v=/^([*\-_])(?:\s*\1){2,}\s*$/,y=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,x=/^\[(x| )\](?=\s)/i,D=s.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,k=/^ {0,3}(?:\={1,}|-{2,})\s*$/,F=/^[^#!\[\]*_\\<>` "'(~:]+/,B=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,L=/^\s*\[[^\]]+?\]:.*$/,T=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,N=" ";function z(A,w,te){return w.f=w.inline=te,te(A,w)}function O(A,w,te){return w.f=w.block=te,te(A,w)}function I(A){return!A||!/\S/.test(A.string)}function W(A){if(A.linkTitle=!1,A.linkHref=!1,A.linkText=!1,A.em=!1,A.strong=!1,A.strikethrough=!1,A.quote=0,A.indentedCode=!1,A.f==X){var w=f;if(!w){var te=o.innerMode(a,A.htmlState);w=te.mode.name=="xml"&&te.state.tagStart===null&&!te.state.context&&te.state.tokenize.isInText}w&&(A.f=H,A.block=G,A.htmlState=null)}return A.trailingSpace=0,A.trailingSpaceNewLine=!1,A.prevLine=A.thisLine,A.thisLine={stream:null},null}function G(A,w){var te=A.column()===w.indentation,Ce=I(w.prevLine.stream),xe=w.indentedCode,mt=w.prevLine.hr,Lt=w.list!==!1,Ye=(w.listStack[w.listStack.length-1]||0)+3;w.indentedCode=!1;var ct=w.indentation;if(w.indentationDiff===null&&(w.indentationDiff=w.indentation,Lt)){for(w.list=null;ct=4&&(xe||w.prevLine.fencedCodeEnd||w.prevLine.header||Ce))return A.skipToEnd(),w.indentedCode=!0,c.code;if(A.eatSpace())return null;if(te&&w.indentation<=Ye&&(Ze=A.match(D))&&Ze[1].length<=6)return w.quote=0,w.header=Ze[1].length,w.thisLine.header=!0,s.highlightFormatting&&(w.formatting="header"),w.f=w.inline,j(w);if(w.indentation<=Ye&&A.eat(">"))return w.quote=te?1:w.quote+1,s.highlightFormatting&&(w.formatting="quote"),A.eatSpace(),j(w);if(!Pe&&!w.setext&&te&&w.indentation<=Ye&&(Ze=A.match(y))){var vt=Ze[1]?"ol":"ul";return w.indentation=ct+A.current().length,w.list=!0,w.quote=0,w.listStack.push(w.indentation),w.em=!1,w.strong=!1,w.code=!1,w.strikethrough=!1,s.taskLists&&A.match(x,!1)&&(w.taskList=!0),w.f=w.inline,s.highlightFormatting&&(w.formatting=["list","list-"+vt]),j(w)}else{if(te&&w.indentation<=Ye&&(Ze=A.match(B,!0)))return w.quote=0,w.fencedEndRE=new RegExp(Ze[1]+"+ *$"),w.localMode=s.fencedCodeBlockHighlighting&&h(Ze[2]||s.fencedCodeBlockDefaultMode),w.localMode&&(w.localState=o.startState(w.localMode)),w.f=w.block=de,s.highlightFormatting&&(w.formatting="code-block"),w.code=-1,j(w);if(w.setext||(!ze||!Lt)&&!w.quote&&w.list===!1&&!w.code&&!Pe&&!L.test(A.string)&&(Ze=A.lookAhead(1))&&(Ze=Ze.match(k)))return w.setext?(w.header=w.setext,w.setext=0,A.skipToEnd(),s.highlightFormatting&&(w.formatting="header")):(w.header=Ze[0].charAt(0)=="="?1:2,w.setext=w.header),w.thisLine.header=!0,w.f=w.inline,j(w);if(Pe)return A.skipToEnd(),w.hr=!0,w.thisLine.hr=!0,c.hr;if(A.peek()==="[")return z(A,w,Q)}return z(A,w,w.inline)}function X(A,w){var te=a.token(A,w.htmlState);if(!f){var Ce=o.innerMode(a,w.htmlState);(Ce.mode.name=="xml"&&Ce.state.tagStart===null&&!Ce.state.context&&Ce.state.tokenize.isInText||w.md_inside&&A.current().indexOf(">")>-1)&&(w.f=H,w.block=G,w.htmlState=null)}return te}function de(A,w){var te=w.listStack[w.listStack.length-1]||0,Ce=w.indentation=A.quote?w.push(c.formatting+"-"+A.formatting[te]+"-"+A.quote):w.push("error"))}if(A.taskOpen)return w.push("meta"),w.length?w.join(" "):null;if(A.taskClosed)return w.push("property"),w.length?w.join(" "):null;if(A.linkHref?w.push(c.linkHref,"url"):(A.strong&&w.push(c.strong),A.em&&w.push(c.em),A.strikethrough&&w.push(c.strikethrough),A.emoji&&w.push(c.emoji),A.linkText&&w.push(c.linkText),A.code&&w.push(c.code),A.image&&w.push(c.image),A.imageAltText&&w.push(c.imageAltText,"link"),A.imageMarker&&w.push(c.imageMarker)),A.header&&w.push(c.header,c.header+"-"+A.header),A.quote&&(w.push(c.quote),!s.maxBlockquoteDepth||s.maxBlockquoteDepth>=A.quote?w.push(c.quote+"-"+A.quote):w.push(c.quote+"-"+s.maxBlockquoteDepth)),A.list!==!1){var Ce=(A.listStack.length-1)%3;Ce?Ce===1?w.push(c.list2):w.push(c.list3):w.push(c.list1)}return A.trailingSpaceNewLine?w.push("trailing-space-new-line"):A.trailingSpace&&w.push("trailing-space-"+(A.trailingSpace%2?"a":"b")),w.length?w.join(" "):null}function oe(A,w){if(A.match(F,!0))return j(w)}function H(A,w){var te=w.text(A,w);if(typeof te<"u")return te;if(w.list)return w.list=null,j(w);if(w.taskList){var Ce=A.match(x,!0)[1]===" ";return Ce?w.taskOpen=!0:w.taskClosed=!0,s.highlightFormatting&&(w.formatting="task"),w.taskList=!1,j(w)}if(w.taskOpen=!1,w.taskClosed=!1,w.header&&A.match(/^#+$/,!0))return s.highlightFormatting&&(w.formatting="header"),j(w);var xe=A.next();if(w.linkTitle){w.linkTitle=!1;var mt=xe;xe==="("&&(mt=")"),mt=(mt+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Lt="^\\s*(?:[^"+mt+"\\\\]+|\\\\\\\\|\\\\.)"+mt;if(A.match(new RegExp(Lt),!0))return c.linkHref}if(xe==="`"){var Ye=w.formatting;s.highlightFormatting&&(w.formatting="code"),A.eatWhile("`");var ct=A.current().length;if(w.code==0&&(!w.quote||ct==1))return w.code=ct,j(w);if(ct==w.code){var ze=j(w);return w.code=0,ze}else return w.formatting=Ye,j(w)}else if(w.code)return j(w);if(xe==="\\"&&(A.next(),s.highlightFormatting)){var Pe=j(w),Ze=c.formatting+"-escape";return Pe?Pe+" "+Ze:Ze}if(xe==="!"&&A.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return w.imageMarker=!0,w.image=!0,s.highlightFormatting&&(w.formatting="image"),j(w);if(xe==="["&&w.imageMarker&&A.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return w.imageMarker=!1,w.imageAltText=!0,s.highlightFormatting&&(w.formatting="image"),j(w);if(xe==="]"&&w.imageAltText){s.highlightFormatting&&(w.formatting="image");var Pe=j(w);return w.imageAltText=!1,w.image=!1,w.inline=w.f=E,Pe}if(xe==="["&&!w.image)return w.linkText&&A.match(/^.*?\]/)||(w.linkText=!0,s.highlightFormatting&&(w.formatting="link")),j(w);if(xe==="]"&&w.linkText){s.highlightFormatting&&(w.formatting="link");var Pe=j(w);return w.linkText=!1,w.inline=w.f=A.match(/\(.*?\)| ?\[.*?\]/,!1)?E:H,Pe}if(xe==="<"&&A.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){w.f=w.inline=Y,s.highlightFormatting&&(w.formatting="link");var Pe=j(w);return Pe?Pe+=" ":Pe="",Pe+c.linkInline}if(xe==="<"&&A.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){w.f=w.inline=Y,s.highlightFormatting&&(w.formatting="link");var Pe=j(w);return Pe?Pe+=" ":Pe="",Pe+c.linkEmail}if(s.xml&&xe==="<"&&A.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var vt=A.string.indexOf(">",A.pos);if(vt!=-1){var Fi=A.string.substring(A.start,vt);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Fi)&&(w.md_inside=!0)}return A.backUp(1),w.htmlState=o.startState(a),O(A,w,X)}if(s.xml&&xe==="<"&&A.match(/^\/\w*?>/))return w.md_inside=!1,"tag";if(xe==="*"||xe==="_"){for(var Xt=1,Kt=A.pos==1?" ":A.string.charAt(A.pos-2);Xt<3&&A.eat(xe);)Xt++;var Ht=A.peek()||" ",pr=!/\s/.test(Ht)&&(!T.test(Ht)||/\s/.test(Kt)||T.test(Kt)),De=!/\s/.test(Kt)&&(!T.test(Kt)||/\s/.test(Ht)||T.test(Ht)),Pt=null,gr=null;if(Xt%2&&(!w.em&&pr&&(xe==="*"||!De||T.test(Kt))?Pt=!0:w.em==xe&&De&&(xe==="*"||!pr||T.test(Ht))&&(Pt=!1)),Xt>1&&(!w.strong&&pr&&(xe==="*"||!De||T.test(Kt))?gr=!0:w.strong==xe&&De&&(xe==="*"||!pr||T.test(Ht))&&(gr=!1)),gr!=null||Pt!=null){s.highlightFormatting&&(w.formatting=Pt==null?"strong":gr==null?"em":"strong em"),Pt===!0&&(w.em=xe),gr===!0&&(w.strong=xe);var ze=j(w);return Pt===!1&&(w.em=!1),gr===!1&&(w.strong=!1),ze}}else if(xe===" "&&(A.eat("*")||A.eat("_"))){if(A.peek()===" ")return j(w);A.backUp(1)}if(s.strikethrough){if(xe==="~"&&A.eatWhile(xe)){if(w.strikethrough){s.highlightFormatting&&(w.formatting="strikethrough");var ze=j(w);return w.strikethrough=!1,ze}else if(A.match(/^[^\s]/,!1))return w.strikethrough=!0,s.highlightFormatting&&(w.formatting="strikethrough"),j(w)}else if(xe===" "&&A.match("~~",!0)){if(A.peek()===" ")return j(w);A.backUp(2)}}if(s.emoji&&xe===":"&&A.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){w.emoji=!0,s.highlightFormatting&&(w.formatting="emoji");var Cn=j(w);return w.emoji=!1,Cn}return xe===" "&&(A.match(/^ +$/,!1)?w.trailingSpace++:w.trailingSpace&&(w.trailingSpaceNewLine=!0)),j(w)}function Y(A,w){var te=A.next();if(te===">"){w.f=w.inline=H,s.highlightFormatting&&(w.formatting="link");var Ce=j(w);return Ce?Ce+=" ":Ce="",Ce+c.linkInline}return A.match(/^[^>]+/,!0),c.linkInline}function E(A,w){if(A.eatSpace())return null;var te=A.next();return te==="("||te==="["?(w.f=w.inline=R(te==="("?")":"]"),s.highlightFormatting&&(w.formatting="link-string"),w.linkHref=!0,j(w)):"error"}var q={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function R(A){return function(w,te){var Ce=w.next();if(Ce===A){te.f=te.inline=H,s.highlightFormatting&&(te.formatting="link-string");var xe=j(te);return te.linkHref=!1,xe}return w.match(q[A]),te.linkHref=!0,j(te)}}function Q(A,w){return A.match(/^([^\]\\]|\\.)*\]:/,!1)?(w.f=he,A.next(),s.highlightFormatting&&(w.formatting="link"),w.linkText=!0,j(w)):z(A,w,H)}function he(A,w){if(A.match("]:",!0)){w.f=w.inline=be,s.highlightFormatting&&(w.formatting="link");var te=j(w);return w.linkText=!1,te}return A.match(/^([^\]\\]|\\.)+/,!0),c.linkText}function be(A,w){return A.eatSpace()?null:(A.match(/^[^\s]+/,!0),A.peek()===void 0?w.linkTitle=!0:A.match(/^(?:\s+(?:"(?:[^"\\]|\\.)+"|'(?:[^'\\]|\\.)+'|\((?:[^)\\]|\\.)+\)))?/,!0),w.f=w.inline=H,c.linkHref+" url")}var Ee={startState:function(){return{f:G,prevLine:{stream:null},thisLine:{stream:null},block:G,htmlState:null,indentation:0,inline:H,text:oe,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(A){return{f:A.f,prevLine:A.prevLine,thisLine:A.thisLine,block:A.block,htmlState:A.htmlState&&o.copyState(a,A.htmlState),indentation:A.indentation,localMode:A.localMode,localState:A.localMode?o.copyState(A.localMode,A.localState):null,inline:A.inline,text:A.text,formatting:!1,linkText:A.linkText,linkTitle:A.linkTitle,linkHref:A.linkHref,code:A.code,em:A.em,strong:A.strong,strikethrough:A.strikethrough,emoji:A.emoji,header:A.header,setext:A.setext,hr:A.hr,taskList:A.taskList,list:A.list,listStack:A.listStack.slice(0),quote:A.quote,indentedCode:A.indentedCode,trailingSpace:A.trailingSpace,trailingSpaceNewLine:A.trailingSpaceNewLine,md_inside:A.md_inside,fencedEndRE:A.fencedEndRE}},token:function(A,w){if(w.formatting=!1,A!=w.thisLine.stream){if(w.header=0,w.hr=!1,A.match(/^\s*$/,!0))return W(w),null;if(w.prevLine=w.thisLine,w.thisLine={stream:A},w.taskList=!1,w.trailingSpace=0,w.trailingSpaceNewLine=!1,!w.localState&&(w.f=w.block,w.f!=X)){var te=A.match(/^\s*/,!0)[0].replace(/\t/g,N).length;if(w.indentation=te,w.indentationDiff=null,te>0)return null}}return w.f(A,w)},innerMode:function(A){return A.block==X?{state:A.htmlState,mode:a}:A.localState?{state:A.localState,mode:A.localMode}:{state:A,mode:Ee}},indent:function(A,w,te){return A.block==X&&a.indent?a.indent(A.htmlState,w,te):A.localState&&A.localMode.indent?A.localMode.indent(A.localState,w,te):o.Pass},blankLine:W,getType:j,blockCommentStart:"",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return Ee},"xml"),o.defineMIME("text/markdown","markdown"),o.defineMIME("text/x-markdown","markdown")})});var sl=at((hf,pf)=>{(function(o){typeof hf=="object"&&typeof pf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.overlayMode=function(l,s,a){return{startState:function(){return{base:o.startState(l),overlay:o.startState(s),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(f){return{base:o.copyState(l,f.base),overlay:o.copyState(s,f.overlay),basePos:f.basePos,baseCur:null,overlayPos:f.overlayPos,overlayCur:null}},token:function(f,h){return(f!=h.streamSeen||Math.min(h.basePos,h.overlayPos){(function(o){typeof gf=="object"&&typeof mf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){o.defineOption("placeholder","",function(d,v,y){var x=y&&y!=o.Init;if(v&&!x)d.on("blur",f),d.on("change",h),d.on("swapDoc",h),o.on(d.getInputField(),"compositionupdate",d.state.placeholderCompose=function(){a(d)}),h(d);else if(!v&&x){d.off("blur",f),d.off("change",h),d.off("swapDoc",h),o.off(d.getInputField(),"compositionupdate",d.state.placeholderCompose),l(d);var D=d.getWrapperElement();D.className=D.className.replace(" CodeMirror-empty","")}v&&!d.hasFocus()&&f(d)});function l(d){d.state.placeholder&&(d.state.placeholder.parentNode.removeChild(d.state.placeholder),d.state.placeholder=null)}function s(d){l(d);var v=d.state.placeholder=document.createElement("pre");v.style.cssText="height: 0; overflow: visible",v.style.direction=d.getOption("direction"),v.className="CodeMirror-placeholder CodeMirror-line-like";var y=d.getOption("placeholder");typeof y=="string"&&(y=document.createTextNode(y)),v.appendChild(y),d.display.lineSpace.insertBefore(v,d.display.lineSpace.firstChild)}function a(d){setTimeout(function(){var v=!1;if(d.lineCount()==1){var y=d.getInputField();v=y.nodeName=="TEXTAREA"?!d.getLine(0).length:!/[^\u200b]/.test(y.querySelector(".CodeMirror-line").textContent)}v?s(d):l(d)},20)}function f(d){c(d)&&s(d)}function h(d){var v=d.getWrapperElement(),y=c(d);v.className=v.className.replace(" CodeMirror-empty","")+(y?" CodeMirror-empty":""),y?s(d):l(d)}function c(d){return d.lineCount()===1&&d.getLine(0)===""}})});var xf=at((bf,yf)=>{(function(o){typeof bf=="object"&&typeof yf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("autoRefresh",!1,function(a,f){a.state.autoRefresh&&(s(a,a.state.autoRefresh),a.state.autoRefresh=null),f&&a.display.wrapper.offsetHeight==0&&l(a,a.state.autoRefresh={delay:f.delay||250})});function l(a,f){function h(){a.display.wrapper.offsetHeight?(s(a,f),a.display.lastWrapHeight!=a.display.wrapper.clientHeight&&a.refresh()):f.timeout=setTimeout(h,f.delay)}f.timeout=setTimeout(h,f.delay),f.hurry=function(){clearTimeout(f.timeout),f.timeout=setTimeout(h,50)},o.on(window,"mouseup",f.hurry),o.on(window,"keyup",f.hurry)}function s(a,f){clearTimeout(f.timeout),o.off(window,"mouseup",f.hurry),o.off(window,"keyup",f.hurry)}})});var Df=at((wf,Cf)=>{(function(o){typeof wf=="object"&&typeof Cf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("styleSelectedText",!1,function(x,D,k){var F=k&&k!=o.Init;D&&!F?(x.state.markedSelection=[],x.state.markedSelectionStyle=typeof D=="string"?D:"CodeMirror-selectedtext",v(x),x.on("cursorActivity",l),x.on("change",s)):!D&&F&&(x.off("cursorActivity",l),x.off("change",s),d(x),x.state.markedSelection=x.state.markedSelectionStyle=null)});function l(x){x.state.markedSelection&&x.operation(function(){y(x)})}function s(x){x.state.markedSelection&&x.state.markedSelection.length&&x.operation(function(){d(x)})}var a=8,f=o.Pos,h=o.cmpPos;function c(x,D,k,F){if(h(D,k)!=0)for(var B=x.state.markedSelection,L=x.state.markedSelectionStyle,T=D.line;;){var N=T==D.line?D:f(T,0),z=T+a,O=z>=k.line,I=O?k:f(z,0),W=x.markText(N,I,{className:L});if(F==null?B.push(W):B.splice(F++,0,W),O)break;T=z}}function d(x){for(var D=x.state.markedSelection,k=0;k1)return v(x);var D=x.getCursor("start"),k=x.getCursor("end"),F=x.state.markedSelection;if(!F.length)return c(x,D,k);var B=F[0].find(),L=F[F.length-1].find();if(!B||!L||k.line-D.line<=a||h(D,L.to)>=0||h(k,B.from)<=0)return v(x);for(;h(D,B.from)>0;)F.shift().clear(),B=F[0].find();for(h(D,B.from)<0&&(B.to.line-D.line0&&(k.line-L.from.line{(function(o){typeof kf=="object"&&typeof Sf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l=o.Pos;function s(T){var N=T.flags;return N??(T.ignoreCase?"i":"")+(T.global?"g":"")+(T.multiline?"m":"")}function a(T,N){for(var z=s(T),O=z,I=0;IG);X++){var de=T.getLine(W++);O=O==null?de:O+` -`+de}I=I*2,N.lastIndex=z.ch;var j=N.exec(O);if(j){var oe=O.slice(0,j.index).split(` + outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var S;v&&(S=n.ownerDocument.defaultView.scrollY),r.input.focus(),v&&n.ownerDocument.defaultView.scrollTo(null,S),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=M,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function _(){if(n.selectionStart!=null){var U=i.somethingSelected(),Z="\u200B"+(U?n.value:"");n.value="\u21DA",n.value=Z,t.prevInput=U?"":"\u200B",n.selectionStart=1,n.selectionEnd=Z.length,r.selForContextMenu=i.doc.sel}}function M(){if(t.contextMenuPending==M&&(t.contextMenuPending=!1,t.wrapper.style.cssText=b,n.style.cssText=m,c&&d<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=p),n.selectionStart!=null)){(!c||c&&d<9)&&_();var U=0,Z=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?tt(i,pu)(i):U++<10?r.detectingSelectAll=setTimeout(Z,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Z,200)}}if(c&&d>=9&&_(),he){_i(e);var P=function(){Mt(window,"mouseup",P),setTimeout(M,20)};ue(window,"mouseup",P)}else setTimeout(M,50)},We.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},We.prototype.setUneditable=function(){},We.prototype.needsContentAttribute=!1;function Yh(e,t){if(t=t?Lt(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var i=de(Ce(e));t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=g.getValue()}var n;if(e.form&&(ue(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var u=e.form;n=u.submit;try{var p=u.submit=function(){r(),u.submit=n,u.submit(),u.submit=p}}catch{}}t.finishInit=function(m){m.save=r,m.getTextArea=function(){return e},m.toTextArea=function(){m.toTextArea=isNaN,r(),e.parentNode.removeChild(m.getWrapperElement()),e.style.display="",e.form&&(Mt(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var g=Ne(function(m){return e.parentNode.insertBefore(m,e.nextSibling)},t);return g}function Zh(e){e.off=Mt,e.on=ue,e.wheelEventPixels=rh,e.Doc=xt,e.splitLines=ra,e.countColumn=Ye,e.findColumn=Kt,e.isWordChar=Zo,e.Pass=Ze,e.signal=je,e.Line=ei,e.changeEnd=xr,e.scrollbarModel=js,e.Pos=K,e.cmpPos=me,e.modes=na,e.mimeModes=Vr,e.resolveMode=Sn,e.getMode=oa,e.modeExtensions=$r,e.extendMode=Jc,e.copyState=Lr,e.startState=Ql,e.innerMode=aa,e.commands=nn,e.keyMap=ar,e.keyName=Lu,e.isModifierKey=Fu,e.lookupKey=hi,e.normalizeKeyMap=kh,e.StringStream=Ge,e.SharedTextMarker=en,e.TextMarker=Cr,e.LineWidget=$i,e.e_preventDefault=bt,e.e_stopPropagation=Yl,e.e_stop=_i,e.addClass=be,e.contains=Q,e.rmClass=oe,e.keyNames=Dr}qh(Ne),jh(Ne);var Qh="iter insert remove copy getEditor constructor".split(" ");for(var io in xt.prototype)xt.prototype.hasOwnProperty(io)&&ze(Qh,io)<0&&(Ne.prototype[io]=function(e){return function(){return e.apply(this.doc,arguments)}}(xt.prototype[io]));return Jr(xt),Ne.inputStyles={textarea:We,contenteditable:Te},Ne.defineMode=function(e){!Ne.defaults.mode&&e!="null"&&(Ne.defaults.mode=e),Zc.apply(this,arguments)},Ne.defineMIME=Qc,Ne.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Ne.defineMIME("text/plain","null"),Ne.defineExtension=function(e,t){Ne.prototype[e]=t},Ne.defineDocExtension=function(e,t){xt.prototype[e]=t},Ne.fromTextArea=Yh,Zh(Ne),Ne.version="5.65.21",Ne})});var $u=at((Ju,Vu)=>{(function(o){typeof Ju=="object"&&typeof Vu=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,s=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,a=/[*+-]\s/;o.commands.newlineAndIndentContinueMarkdownList=function(h){if(h.getOption("disableInput"))return o.Pass;for(var c=h.listSelections(),d=[],v=0;v\s*$/.test(B),z=!/>\s*$/.test(B);(N||z)&&h.replaceRange("",{line:y.line,ch:0},{line:y.line,ch:y.ch+1}),d[v]=` +`}else{var O=L[1],I=L[5],R=!(a.test(L[2])||L[2].indexOf(">")>=0),G=R?parseInt(L[3],10)+1+L[4]:L[2].replace("x"," ");d[v]=` +`+O+G+I,R&&f(h,y)}}h.replaceSelections(d)};function f(h,c){var d=c.line,v=0,y=0,x=l.exec(h.getLine(d)),D=x[1];do{v+=1;var k=d+v,F=h.getLine(k),B=l.exec(F);if(B){var L=B[1],T=parseInt(x[3],10)+v-y,N=parseInt(B[3],10),z=N;if(D===L&&!isNaN(N))T===N&&(z=N+1),T>N&&(z=T+1),h.replaceRange(F.replace(l,L+z+B[4]+B[5]),{line:k,ch:0},{line:k,ch:F.length});else{if(D.length>L.length||D.length{var ef=At();ef.commands.tabAndIndentMarkdownList=function(o){var l=o.listSelections(),s=l[0].head,a=o.getStateAfter(s.line),f=a.list!==!1;if(f){o.execCommand("indentMore");return}if(o.options.indentWithTabs)o.execCommand("insertTab");else{var h=Array(o.options.tabSize+1).join(" ");o.replaceSelection(h)}};ef.commands.shiftTabAndUnindentMarkdownList=function(o){var l=o.listSelections(),s=l[0].head,a=o.getStateAfter(s.line),f=a.list!==!1;if(f){o.execCommand("indentLess");return}if(o.options.indentWithTabs)o.execCommand("insertTab");else{var h=Array(o.options.tabSize+1).join(" ");o.replaceSelection(h)}}});var of=at((rf,nf)=>{(function(o){typeof rf=="object"&&typeof nf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("fullScreen",!1,function(a,f,h){h==o.Init&&(h=!1),!h!=!f&&(f?l(a):s(a))});function l(a){var f=a.getWrapperElement();a.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:f.style.width,height:f.style.height},f.style.width="",f.style.height="auto",f.className+=" CodeMirror-fullscreen",document.documentElement.style.overflow="hidden",a.refresh()}function s(a){var f=a.getWrapperElement();f.className=f.className.replace(/\s*CodeMirror-fullscreen\b/,""),document.documentElement.style.overflow="";var h=a.state.fullScreenRestore;f.style.width=h.width,f.style.height=h.height,window.scrollTo(h.scrollLeft,h.scrollTop),a.refresh()}})});var al=at((af,lf)=>{(function(o){typeof af=="object"&&typeof lf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},s={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};o.defineMode("xml",function(a,f){var h=a.indentUnit,c={},d=f.htmlMode?l:s;for(var v in d)c[v]=d[v];for(var v in f)c[v]=f[v];var y,x;function D(E,q){function W(be){return q.tokenize=be,be(E,q)}var Q=E.next();if(Q=="<")return E.eat("!")?E.eat("[")?E.match("CDATA[")?W(B("atom","]]>")):null:E.match("--")?W(B("comment","-->")):E.match("DOCTYPE",!0,!0)?(E.eatWhile(/[\w\._\-]/),W(L(1))):null:E.eat("?")?(E.eatWhile(/[\w\._\-]/),q.tokenize=B("meta","?>"),"meta"):(y=E.eat("/")?"closeTag":"openTag",q.tokenize=k,"tag bracket");if(Q=="&"){var de;return E.eat("#")?E.eat("x")?de=E.eatWhile(/[a-fA-F\d]/)&&E.eat(";"):de=E.eatWhile(/[\d]/)&&E.eat(";"):de=E.eatWhile(/[\w\.\-:]/)&&E.eat(";"),de?"atom":"error"}else return E.eatWhile(/[^&<]/),null}D.isInText=!0;function k(E,q){var W=E.next();if(W==">"||W=="/"&&E.eat(">"))return q.tokenize=D,y=W==">"?"endTag":"selfcloseTag","tag bracket";if(W=="=")return y="equals",null;if(W=="<"){q.tokenize=D,q.state=I,q.tagName=q.tagStart=null;var Q=q.tokenize(E,q);return Q?Q+" tag error":"tag error"}else return/[\'\"]/.test(W)?(q.tokenize=F(W),q.stringStartCol=E.column(),q.tokenize(E,q)):(E.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function F(E){var q=function(W,Q){for(;!W.eol();)if(W.next()==E){Q.tokenize=k;break}return"string"};return q.isInAttribute=!0,q}function B(E,q){return function(W,Q){for(;!W.eol();){if(W.match(q)){Q.tokenize=D;break}W.next()}return E}}function L(E){return function(q,W){for(var Q;(Q=q.next())!=null;){if(Q=="<")return W.tokenize=L(E+1),W.tokenize(q,W);if(Q==">")if(E==1){W.tokenize=D;break}else return W.tokenize=L(E-1),W.tokenize(q,W)}return"meta"}}function T(E){return E&&E.toLowerCase()}function N(E,q,W){this.prev=E.context,this.tagName=q||"",this.indent=E.indented,this.startOfLine=W,(c.doNotIndent.hasOwnProperty(q)||E.context&&E.context.noIndent)&&(this.noIndent=!0)}function z(E){E.context&&(E.context=E.context.prev)}function O(E,q){for(var W;;){if(!E.context||(W=E.context.tagName,!c.contextGrabbers.hasOwnProperty(T(W))||!c.contextGrabbers[T(W)].hasOwnProperty(T(q))))return;z(E)}}function I(E,q,W){return E=="openTag"?(W.tagStart=q.column(),R):E=="closeTag"?G:I}function R(E,q,W){return E=="word"?(W.tagName=q.current(),x="tag",j):c.allowMissingTagName&&E=="endTag"?(x="tag bracket",j(E,q,W)):(x="error",R)}function G(E,q,W){if(E=="word"){var Q=q.current();return W.context&&W.context.tagName!=Q&&c.implicitlyClosed.hasOwnProperty(T(W.context.tagName))&&z(W),W.context&&W.context.tagName==Q||c.matchClosing===!1?(x="tag",X):(x="tag error",he)}else return c.allowMissingTagName&&E=="endTag"?(x="tag bracket",X(E,q,W)):(x="error",he)}function X(E,q,W){return E!="endTag"?(x="error",X):(z(W),I)}function he(E,q,W){return x="error",X(E,q,W)}function j(E,q,W){if(E=="word")return x="attribute",oe;if(E=="endTag"||E=="selfcloseTag"){var Q=W.tagName,de=W.tagStart;return W.tagName=W.tagStart=null,E=="selfcloseTag"||c.autoSelfClosers.hasOwnProperty(T(Q))?O(W,Q):(O(W,Q),W.context=new N(W,Q,de==W.indented)),I}return x="error",j}function oe(E,q,W){return E=="equals"?H:(c.allowMissing||(x="error"),j(E,q,W))}function H(E,q,W){return E=="string"?Y:E=="word"&&c.allowUnquoted?(x="string",j):(x="error",j(E,q,W))}function Y(E,q,W){return E=="string"?Y:j(E,q,W)}return{startState:function(E){var q={tokenize:D,state:I,indented:E||0,tagName:null,tagStart:null,context:null};return E!=null&&(q.baseIndent=E),q},token:function(E,q){if(!q.tagName&&E.sol()&&(q.indented=E.indentation()),E.eatSpace())return null;y=null;var W=q.tokenize(E,q);return(W||y)&&W!="comment"&&(x=null,q.state=q.state(y||W,E,q),x&&(W=x=="error"?W+" error":x)),W},indent:function(E,q,W){var Q=E.context;if(E.tokenize.isInAttribute)return E.tagStart==E.indented?E.stringStartCol+1:E.indented+h;if(Q&&Q.noIndent)return o.Pass;if(E.tokenize!=k&&E.tokenize!=D)return W?W.match(/^(\s*)/)[0].length:0;if(E.tagName)return c.multilineTagIndentPastTag!==!1?E.tagStart+E.tagName.length+2:E.tagStart+h*(c.multilineTagIndentFactor||1);if(c.alignCDATA&&/$/,blockCommentStart:"",configuration:c.htmlMode?"html":"xml",helperType:c.htmlMode?"html":"xml",skipAttribute:function(E){E.state==H&&(E.state=j)},xmlCurrentTag:function(E){return E.tagName?{name:E.tagName,close:E.type=="closeTag"}:null},xmlCurrentContext:function(E){for(var q=[],W=E.context;W;W=W.prev)q.push(W.tagName);return q.reverse()}}}),o.defineMIME("text/xml","xml"),o.defineMIME("application/xml","xml"),o.mimeModes.hasOwnProperty("text/html")||o.defineMIME("text/html",{name:"xml",htmlMode:!0})})});var ff=at((sf,uf)=>{(function(o){typeof sf=="object"&&typeof uf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy","cbl"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded JavaScript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"],alias:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var l=0;l-1&&a.substring(c+1,a.length);if(d)return o.findModeByExtension(d)},o.findModeByName=function(a){a=a.toLowerCase();for(var f=0;f{(function(o){typeof cf=="object"&&typeof df=="object"?o(At(),al(),ff()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../xml/xml","../meta"],o):o(CodeMirror)})(function(o){"use strict";o.defineMode("markdown",function(l,s){var a=o.getMode(l,"text/html"),f=a.name=="null";function h(A){if(o.findModeByName){var w=o.findModeByName(A);w&&(A=w.mime||w.mimes[0])}var te=o.getMode(l,A);return te.name=="null"?null:te}s.highlightFormatting===void 0&&(s.highlightFormatting=!1),s.maxBlockquoteDepth===void 0&&(s.maxBlockquoteDepth=0),s.taskLists===void 0&&(s.taskLists=!1),s.strikethrough===void 0&&(s.strikethrough=!1),s.emoji===void 0&&(s.emoji=!1),s.fencedCodeBlockHighlighting===void 0&&(s.fencedCodeBlockHighlighting=!0),s.fencedCodeBlockDefaultMode===void 0&&(s.fencedCodeBlockDefaultMode="text/plain"),s.xml===void 0&&(s.xml=!0),s.tokenTypeOverrides===void 0&&(s.tokenTypeOverrides={});var c={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var d in c)c.hasOwnProperty(d)&&s.tokenTypeOverrides[d]&&(c[d]=s.tokenTypeOverrides[d]);var v=/^([*\-_])(?:\s*\1){2,}\s*$/,y=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,x=/^\[(x| )\](?=\s)/i,D=s.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,k=/^ {0,3}(?:\={1,}|-{2,})\s*$/,F=/^[^#!\[\]*_\\<>` "'(~:]+/,B=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,L=/^\s*\[[^\]]+?\]:.*$/,T=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,N=" ";function z(A,w,te){return w.f=w.inline=te,te(A,w)}function O(A,w,te){return w.f=w.block=te,te(A,w)}function I(A){return!A||!/\S/.test(A.string)}function R(A){if(A.linkTitle=!1,A.linkHref=!1,A.linkText=!1,A.em=!1,A.strong=!1,A.strikethrough=!1,A.quote=0,A.indentedCode=!1,A.f==X){var w=f;if(!w){var te=o.innerMode(a,A.htmlState);w=te.mode.name=="xml"&&te.state.tagStart===null&&!te.state.context&&te.state.tokenize.isInText}w&&(A.f=H,A.block=G,A.htmlState=null)}return A.trailingSpace=0,A.trailingSpaceNewLine=!1,A.prevLine=A.thisLine,A.thisLine={stream:null},null}function G(A,w){var te=A.column()===w.indentation,Ce=I(w.prevLine.stream),ye=w.indentedCode,mt=w.prevLine.hr,Lt=w.list!==!1,Ye=(w.listStack[w.listStack.length-1]||0)+3;w.indentedCode=!1;var ct=w.indentation;if(w.indentationDiff===null&&(w.indentationDiff=w.indentation,Lt)){for(w.list=null;ct=4&&(ye||w.prevLine.fencedCodeEnd||w.prevLine.header||Ce))return A.skipToEnd(),w.indentedCode=!0,c.code;if(A.eatSpace())return null;if(te&&w.indentation<=Ye&&(Ze=A.match(D))&&Ze[1].length<=6)return w.quote=0,w.header=Ze[1].length,w.thisLine.header=!0,s.highlightFormatting&&(w.formatting="header"),w.f=w.inline,j(w);if(w.indentation<=Ye&&A.eat(">"))return w.quote=te?1:w.quote+1,s.highlightFormatting&&(w.formatting="quote"),A.eatSpace(),j(w);if(!Pe&&!w.setext&&te&&w.indentation<=Ye&&(Ze=A.match(y))){var vt=Ze[1]?"ol":"ul";return w.indentation=ct+A.current().length,w.list=!0,w.quote=0,w.listStack.push(w.indentation),w.em=!1,w.strong=!1,w.code=!1,w.strikethrough=!1,s.taskLists&&A.match(x,!1)&&(w.taskList=!0),w.f=w.inline,s.highlightFormatting&&(w.formatting=["list","list-"+vt]),j(w)}else{if(te&&w.indentation<=Ye&&(Ze=A.match(B,!0)))return w.quote=0,w.fencedEndRE=new RegExp(Ze[1]+"+ *$"),w.localMode=s.fencedCodeBlockHighlighting&&h(Ze[2]||s.fencedCodeBlockDefaultMode),w.localMode&&(w.localState=o.startState(w.localMode)),w.f=w.block=he,s.highlightFormatting&&(w.formatting="code-block"),w.code=-1,j(w);if(w.setext||(!ze||!Lt)&&!w.quote&&w.list===!1&&!w.code&&!Pe&&!L.test(A.string)&&(Ze=A.lookAhead(1))&&(Ze=Ze.match(k)))return w.setext?(w.header=w.setext,w.setext=0,A.skipToEnd(),s.highlightFormatting&&(w.formatting="header")):(w.header=Ze[0].charAt(0)=="="?1:2,w.setext=w.header),w.thisLine.header=!0,w.f=w.inline,j(w);if(Pe)return A.skipToEnd(),w.hr=!0,w.thisLine.hr=!0,c.hr;if(A.peek()==="[")return z(A,w,Q)}return z(A,w,w.inline)}function X(A,w){var te=a.token(A,w.htmlState);if(!f){var Ce=o.innerMode(a,w.htmlState);(Ce.mode.name=="xml"&&Ce.state.tagStart===null&&!Ce.state.context&&Ce.state.tokenize.isInText||w.md_inside&&A.current().indexOf(">")>-1)&&(w.f=H,w.block=G,w.htmlState=null)}return te}function he(A,w){var te=w.listStack[w.listStack.length-1]||0,Ce=w.indentation=A.quote?w.push(c.formatting+"-"+A.formatting[te]+"-"+A.quote):w.push("error"))}if(A.taskOpen)return w.push("meta"),w.length?w.join(" "):null;if(A.taskClosed)return w.push("property"),w.length?w.join(" "):null;if(A.linkHref?w.push(c.linkHref,"url"):(A.strong&&w.push(c.strong),A.em&&w.push(c.em),A.strikethrough&&w.push(c.strikethrough),A.emoji&&w.push(c.emoji),A.linkText&&w.push(c.linkText),A.code&&w.push(c.code),A.image&&w.push(c.image),A.imageAltText&&w.push(c.imageAltText,"link"),A.imageMarker&&w.push(c.imageMarker)),A.header&&w.push(c.header,c.header+"-"+A.header),A.quote&&(w.push(c.quote),!s.maxBlockquoteDepth||s.maxBlockquoteDepth>=A.quote?w.push(c.quote+"-"+A.quote):w.push(c.quote+"-"+s.maxBlockquoteDepth)),A.list!==!1){var Ce=(A.listStack.length-1)%3;Ce?Ce===1?w.push(c.list2):w.push(c.list3):w.push(c.list1)}return A.trailingSpaceNewLine?w.push("trailing-space-new-line"):A.trailingSpace&&w.push("trailing-space-"+(A.trailingSpace%2?"a":"b")),w.length?w.join(" "):null}function oe(A,w){if(A.match(F,!0))return j(w)}function H(A,w){var te=w.text(A,w);if(typeof te<"u")return te;if(w.list)return w.list=null,j(w);if(w.taskList){var Ce=A.match(x,!0)[1]===" ";return Ce?w.taskOpen=!0:w.taskClosed=!0,s.highlightFormatting&&(w.formatting="task"),w.taskList=!1,j(w)}if(w.taskOpen=!1,w.taskClosed=!1,w.header&&A.match(/^#+$/,!0))return s.highlightFormatting&&(w.formatting="header"),j(w);var ye=A.next();if(w.linkTitle){w.linkTitle=!1;var mt=ye;ye==="("&&(mt=")"),mt=(mt+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Lt="^\\s*(?:[^"+mt+"\\\\]+|\\\\\\\\|\\\\.)"+mt;if(A.match(new RegExp(Lt),!0))return c.linkHref}if(ye==="`"){var Ye=w.formatting;s.highlightFormatting&&(w.formatting="code"),A.eatWhile("`");var ct=A.current().length;if(w.code==0&&(!w.quote||ct==1))return w.code=ct,j(w);if(ct==w.code){var ze=j(w);return w.code=0,ze}else return w.formatting=Ye,j(w)}else if(w.code)return j(w);if(ye==="\\"&&(A.next(),s.highlightFormatting)){var Pe=j(w),Ze=c.formatting+"-escape";return Pe?Pe+" "+Ze:Ze}if(ye==="!"&&A.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return w.imageMarker=!0,w.image=!0,s.highlightFormatting&&(w.formatting="image"),j(w);if(ye==="["&&w.imageMarker&&A.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return w.imageMarker=!1,w.imageAltText=!0,s.highlightFormatting&&(w.formatting="image"),j(w);if(ye==="]"&&w.imageAltText){s.highlightFormatting&&(w.formatting="image");var Pe=j(w);return w.imageAltText=!1,w.image=!1,w.inline=w.f=E,Pe}if(ye==="["&&!w.image)return w.linkText&&A.match(/^.*?\]/)||(w.linkText=!0,s.highlightFormatting&&(w.formatting="link")),j(w);if(ye==="]"&&w.linkText){s.highlightFormatting&&(w.formatting="link");var Pe=j(w);return w.linkText=!1,w.inline=w.f=A.match(/\(.*?\)| ?\[.*?\]/,!1)?E:H,Pe}if(ye==="<"&&A.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){w.f=w.inline=Y,s.highlightFormatting&&(w.formatting="link");var Pe=j(w);return Pe?Pe+=" ":Pe="",Pe+c.linkInline}if(ye==="<"&&A.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){w.f=w.inline=Y,s.highlightFormatting&&(w.formatting="link");var Pe=j(w);return Pe?Pe+=" ":Pe="",Pe+c.linkEmail}if(s.xml&&ye==="<"&&A.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var vt=A.string.indexOf(">",A.pos);if(vt!=-1){var Ti=A.string.substring(A.start,vt);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Ti)&&(w.md_inside=!0)}return A.backUp(1),w.htmlState=o.startState(a),O(A,w,X)}if(s.xml&&ye==="<"&&A.match(/^\/\w*?>/))return w.md_inside=!1,"tag";if(ye==="*"||ye==="_"){for(var Xt=1,Kt=A.pos==1?" ":A.string.charAt(A.pos-2);Xt<3&&A.eat(ye);)Xt++;var Ht=A.peek()||" ",pr=!/\s/.test(Ht)&&(!T.test(Ht)||/\s/.test(Kt)||T.test(Kt)),De=!/\s/.test(Kt)&&(!T.test(Kt)||/\s/.test(Ht)||T.test(Ht)),Pt=null,gr=null;if(Xt%2&&(!w.em&&pr&&(ye==="*"||!De||T.test(Kt))?Pt=!0:w.em==ye&&De&&(ye==="*"||!pr||T.test(Ht))&&(Pt=!1)),Xt>1&&(!w.strong&&pr&&(ye==="*"||!De||T.test(Kt))?gr=!0:w.strong==ye&&De&&(ye==="*"||!pr||T.test(Ht))&&(gr=!1)),gr!=null||Pt!=null){s.highlightFormatting&&(w.formatting=Pt==null?"strong":gr==null?"em":"strong em"),Pt===!0&&(w.em=ye),gr===!0&&(w.strong=ye);var ze=j(w);return Pt===!1&&(w.em=!1),gr===!1&&(w.strong=!1),ze}}else if(ye===" "&&(A.eat("*")||A.eat("_"))){if(A.peek()===" ")return j(w);A.backUp(1)}if(s.strikethrough){if(ye==="~"&&A.eatWhile(ye)){if(w.strikethrough){s.highlightFormatting&&(w.formatting="strikethrough");var ze=j(w);return w.strikethrough=!1,ze}else if(A.match(/^[^\s]/,!1))return w.strikethrough=!0,s.highlightFormatting&&(w.formatting="strikethrough"),j(w)}else if(ye===" "&&A.match("~~",!0)){if(A.peek()===" ")return j(w);A.backUp(2)}}if(s.emoji&&ye===":"&&A.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){w.emoji=!0,s.highlightFormatting&&(w.formatting="emoji");var Dn=j(w);return w.emoji=!1,Dn}return ye===" "&&(A.match(/^ +$/,!1)?w.trailingSpace++:w.trailingSpace&&(w.trailingSpaceNewLine=!0)),j(w)}function Y(A,w){var te=A.next();if(te===">"){w.f=w.inline=H,s.highlightFormatting&&(w.formatting="link");var Ce=j(w);return Ce?Ce+=" ":Ce="",Ce+c.linkInline}return A.match(/^[^>]+/,!0),c.linkInline}function E(A,w){if(A.eatSpace())return null;var te=A.next();return te==="("||te==="["?(w.f=w.inline=W(te==="("?")":"]"),s.highlightFormatting&&(w.formatting="link-string"),w.linkHref=!0,j(w)):"error"}var q={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function W(A){return function(w,te){var Ce=w.next();if(Ce===A){te.f=te.inline=H,s.highlightFormatting&&(te.formatting="link-string");var ye=j(te);return te.linkHref=!1,ye}return w.match(q[A]),te.linkHref=!0,j(te)}}function Q(A,w){return A.match(/^([^\]\\]|\\.)*\]:/,!1)?(w.f=de,A.next(),s.highlightFormatting&&(w.formatting="link"),w.linkText=!0,j(w)):z(A,w,H)}function de(A,w){if(A.match("]:",!0)){w.f=w.inline=be,s.highlightFormatting&&(w.formatting="link");var te=j(w);return w.linkText=!1,te}return A.match(/^([^\]\\]|\\.)+/,!0),c.linkText}function be(A,w){return A.eatSpace()?null:(A.match(/^[^\s]+/,!0),A.peek()===void 0?w.linkTitle=!0:A.match(/^(?:\s+(?:"(?:[^"\\]|\\.)+"|'(?:[^'\\]|\\.)+'|\((?:[^)\\]|\\.)+\)))?/,!0),w.f=w.inline=H,c.linkHref+" url")}var Ae={startState:function(){return{f:G,prevLine:{stream:null},thisLine:{stream:null},block:G,htmlState:null,indentation:0,inline:H,text:oe,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(A){return{f:A.f,prevLine:A.prevLine,thisLine:A.thisLine,block:A.block,htmlState:A.htmlState&&o.copyState(a,A.htmlState),indentation:A.indentation,localMode:A.localMode,localState:A.localMode?o.copyState(A.localMode,A.localState):null,inline:A.inline,text:A.text,formatting:!1,linkText:A.linkText,linkTitle:A.linkTitle,linkHref:A.linkHref,code:A.code,em:A.em,strong:A.strong,strikethrough:A.strikethrough,emoji:A.emoji,header:A.header,setext:A.setext,hr:A.hr,taskList:A.taskList,list:A.list,listStack:A.listStack.slice(0),quote:A.quote,indentedCode:A.indentedCode,trailingSpace:A.trailingSpace,trailingSpaceNewLine:A.trailingSpaceNewLine,md_inside:A.md_inside,fencedEndRE:A.fencedEndRE}},token:function(A,w){if(w.formatting=!1,A!=w.thisLine.stream){if(w.header=0,w.hr=!1,A.match(/^\s*$/,!0))return R(w),null;if(w.prevLine=w.thisLine,w.thisLine={stream:A},w.taskList=!1,w.trailingSpace=0,w.trailingSpaceNewLine=!1,!w.localState&&(w.f=w.block,w.f!=X)){var te=A.match(/^\s*/,!0)[0].replace(/\t/g,N).length;if(w.indentation=te,w.indentationDiff=null,te>0)return null}}return w.f(A,w)},innerMode:function(A){return A.block==X?{state:A.htmlState,mode:a}:A.localState?{state:A.localState,mode:A.localMode}:{state:A,mode:Ae}},indent:function(A,w,te){return A.block==X&&a.indent?a.indent(A.htmlState,w,te):A.localState&&A.localMode.indent?A.localMode.indent(A.localState,w,te):o.Pass},blankLine:R,getType:j,blockCommentStart:"",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return Ae},"xml"),o.defineMIME("text/markdown","markdown"),o.defineMIME("text/x-markdown","markdown")})});var sl=at((hf,pf)=>{(function(o){typeof hf=="object"&&typeof pf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.overlayMode=function(l,s,a){return{startState:function(){return{base:o.startState(l),overlay:o.startState(s),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(f){return{base:o.copyState(l,f.base),overlay:o.copyState(s,f.overlay),basePos:f.basePos,baseCur:null,overlayPos:f.overlayPos,overlayCur:null}},token:function(f,h){return(f!=h.streamSeen||Math.min(h.basePos,h.overlayPos){(function(o){typeof gf=="object"&&typeof mf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){o.defineOption("placeholder","",function(d,v,y){var x=y&&y!=o.Init;if(v&&!x)d.on("blur",f),d.on("change",h),d.on("swapDoc",h),o.on(d.getInputField(),"compositionupdate",d.state.placeholderCompose=function(){a(d)}),h(d);else if(!v&&x){d.off("blur",f),d.off("change",h),d.off("swapDoc",h),o.off(d.getInputField(),"compositionupdate",d.state.placeholderCompose),l(d);var D=d.getWrapperElement();D.className=D.className.replace(" CodeMirror-empty","")}v&&!d.hasFocus()&&f(d)});function l(d){d.state.placeholder&&(d.state.placeholder.parentNode.removeChild(d.state.placeholder),d.state.placeholder=null)}function s(d){l(d);var v=d.state.placeholder=document.createElement("pre");v.style.cssText="height: 0; overflow: visible",v.style.direction=d.getOption("direction"),v.className="CodeMirror-placeholder CodeMirror-line-like";var y=d.getOption("placeholder");typeof y=="string"&&(y=document.createTextNode(y)),v.appendChild(y),d.display.lineSpace.insertBefore(v,d.display.lineSpace.firstChild)}function a(d){setTimeout(function(){var v=!1;if(d.lineCount()==1){var y=d.getInputField();v=y.nodeName=="TEXTAREA"?!d.getLine(0).length:!/[^\u200b]/.test(y.querySelector(".CodeMirror-line").textContent)}v?s(d):l(d)},20)}function f(d){c(d)&&s(d)}function h(d){var v=d.getWrapperElement(),y=c(d);v.className=v.className.replace(" CodeMirror-empty","")+(y?" CodeMirror-empty":""),y?s(d):l(d)}function c(d){return d.lineCount()===1&&d.getLine(0)===""}})});var xf=at((bf,yf)=>{(function(o){typeof bf=="object"&&typeof yf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("autoRefresh",!1,function(a,f){a.state.autoRefresh&&(s(a,a.state.autoRefresh),a.state.autoRefresh=null),f&&a.display.wrapper.offsetHeight==0&&l(a,a.state.autoRefresh={delay:f.delay||250})});function l(a,f){function h(){a.display.wrapper.offsetHeight?(s(a,f),a.display.lastWrapHeight!=a.display.wrapper.clientHeight&&a.refresh()):f.timeout=setTimeout(h,f.delay)}f.timeout=setTimeout(h,f.delay),f.hurry=function(){clearTimeout(f.timeout),f.timeout=setTimeout(h,50)},o.on(window,"mouseup",f.hurry),o.on(window,"keyup",f.hurry)}function s(a,f){clearTimeout(f.timeout),o.off(window,"mouseup",f.hurry),o.off(window,"keyup",f.hurry)}})});var Df=at((wf,Cf)=>{(function(o){typeof wf=="object"&&typeof Cf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("styleSelectedText",!1,function(x,D,k){var F=k&&k!=o.Init;D&&!F?(x.state.markedSelection=[],x.state.markedSelectionStyle=typeof D=="string"?D:"CodeMirror-selectedtext",v(x),x.on("cursorActivity",l),x.on("change",s)):!D&&F&&(x.off("cursorActivity",l),x.off("change",s),d(x),x.state.markedSelection=x.state.markedSelectionStyle=null)});function l(x){x.state.markedSelection&&x.operation(function(){y(x)})}function s(x){x.state.markedSelection&&x.state.markedSelection.length&&x.operation(function(){d(x)})}var a=8,f=o.Pos,h=o.cmpPos;function c(x,D,k,F){if(h(D,k)!=0)for(var B=x.state.markedSelection,L=x.state.markedSelectionStyle,T=D.line;;){var N=T==D.line?D:f(T,0),z=T+a,O=z>=k.line,I=O?k:f(z,0),R=x.markText(N,I,{className:L});if(F==null?B.push(R):B.splice(F++,0,R),O)break;T=z}}function d(x){for(var D=x.state.markedSelection,k=0;k1)return v(x);var D=x.getCursor("start"),k=x.getCursor("end"),F=x.state.markedSelection;if(!F.length)return c(x,D,k);var B=F[0].find(),L=F[F.length-1].find();if(!B||!L||k.line-D.line<=a||h(D,L.to)>=0||h(k,B.from)<=0)return v(x);for(;h(D,B.from)>0;)F.shift().clear(),B=F[0].find();for(h(D,B.from)<0&&(B.to.line-D.line0&&(k.line-L.from.line{(function(o){typeof kf=="object"&&typeof Sf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l=o.Pos;function s(T){var N=T.flags;return N??(T.ignoreCase?"i":"")+(T.global?"g":"")+(T.multiline?"m":"")}function a(T,N){for(var z=s(T),O=z,I=0;IG);X++){var he=T.getLine(R++);O=O==null?he:O+` +`+he}I=I*2,N.lastIndex=z.ch;var j=N.exec(O);if(j){var oe=O.slice(0,j.index).split(` `),H=j[0].split(` -`),Y=z.line+oe.length-1,E=oe[oe.length-1].length;return{from:l(Y,E),to:l(Y+H.length-1,H.length==1?E+H[0].length:H[H.length-1].length),match:j}}}}function d(T,N,z){for(var O,I=0;I<=T.length;){N.lastIndex=I;var W=N.exec(T);if(!W)break;var G=W.index+W[0].length;if(G>T.length-z)break;(!O||G>O.index+O[0].length)&&(O=W),I=W.index+1}return O}function v(T,N,z){N=a(N,"g");for(var O=z.line,I=z.ch,W=T.firstLine();O>=W;O--,I=-1){var G=T.getLine(O),X=d(G,N,I<0?0:G.length-I);if(X)return{from:l(O,X.index),to:l(O,X.index+X[0].length),match:X}}}function y(T,N,z){if(!f(N))return v(T,N,z);N=a(N,"gm");for(var O,I=1,W=T.getLine(z.line).length-z.ch,G=z.line,X=T.firstLine();G>=X;){for(var de=0;de=X;de++){var j=T.getLine(G--);O=O==null?j:j+` -`+O}I*=2;var oe=d(O,N,W);if(oe){var H=O.slice(0,oe.index).split(` +`),Y=z.line+oe.length-1,E=oe[oe.length-1].length;return{from:l(Y,E),to:l(Y+H.length-1,H.length==1?E+H[0].length:H[H.length-1].length),match:j}}}}function d(T,N,z){for(var O,I=0;I<=T.length;){N.lastIndex=I;var R=N.exec(T);if(!R)break;var G=R.index+R[0].length;if(G>T.length-z)break;(!O||G>O.index+O[0].length)&&(O=R),I=R.index+1}return O}function v(T,N,z){N=a(N,"g");for(var O=z.line,I=z.ch,R=T.firstLine();O>=R;O--,I=-1){var G=T.getLine(O),X=d(G,N,I<0?0:G.length-I);if(X)return{from:l(O,X.index),to:l(O,X.index+X[0].length),match:X}}}function y(T,N,z){if(!f(N))return v(T,N,z);N=a(N,"gm");for(var O,I=1,R=T.getLine(z.line).length-z.ch,G=z.line,X=T.firstLine();G>=X;){for(var he=0;he=X;he++){var j=T.getLine(G--);O=O==null?j:j+` +`+O}I*=2;var oe=d(O,N,R);if(oe){var H=O.slice(0,oe.index).split(` `),Y=oe[0].split(` -`),E=G+H.length,q=H[H.length-1].length;return{from:l(E,q),to:l(E+Y.length-1,Y.length==1?q+Y[0].length:Y[Y.length-1].length),match:oe}}}}var x,D;String.prototype.normalize?(x=function(T){return T.normalize("NFD").toLowerCase()},D=function(T){return T.normalize("NFD")}):(x=function(T){return T.toLowerCase()},D=function(T){return T});function k(T,N,z,O){if(T.length==N.length)return z;for(var I=0,W=z+Math.max(0,T.length-N.length);;){if(I==W)return I;var G=I+W>>1,X=O(T.slice(0,G)).length;if(X==z)return G;X>z?W=G:I=G+1}}function F(T,N,z,O){if(!N.length)return null;var I=O?x:D,W=I(N).split(/\r|\n\r?/);e:for(var G=z.line,X=z.ch,de=T.lastLine()+1-W.length;G<=de;G++,X=0){var j=T.getLine(G).slice(X),oe=I(j);if(W.length==1){var H=oe.indexOf(W[0]);if(H==-1)continue e;var z=k(j,oe,H,I)+X;return{from:l(G,k(j,oe,H,I)+X),to:l(G,k(j,oe,H+W[0].length,I)+X)}}else{var Y=oe.length-W[0].length;if(oe.slice(Y)!=W[0])continue e;for(var E=1;E=de;G--,X=-1){var j=T.getLine(G);X>-1&&(j=j.slice(0,X));var oe=I(j);if(W.length==1){var H=oe.lastIndexOf(W[0]);if(H==-1)continue e;return{from:l(G,k(j,oe,H,I)),to:l(G,k(j,oe,H+W[0].length,I))}}else{var Y=W[W.length-1];if(oe.slice(0,Y.length)!=Y)continue e;for(var E=1,z=G-W.length+1;E(this.doc.getLine(N.line)||"").length&&(N.ch=0,N.line++)),o.cmpPos(N,this.doc.clipPos(N))!=0))return this.atOccurrence=!1;var z=this.matches(T,N);if(this.afterEmptyMatch=z&&o.cmpPos(z.from,z.to)==0,z)return this.pos=z,this.atOccurrence=!0,this.pos.match||!0;var O=l(T?this.doc.firstLine():this.doc.lastLine()+1,0);return this.pos={from:O,to:O},this.atOccurrence=!1},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(T,N){if(this.atOccurrence){var z=o.splitLines(T);this.doc.replaceRange(z,this.pos.from,this.pos.to,N),this.pos.to=l(this.pos.from.line+z.length-1,z[z.length-1].length+(z.length==1?this.pos.from.ch:0))}}},o.defineExtension("getSearchCursor",function(T,N,z){return new L(this.doc,T,N,z)}),o.defineDocExtension("getSearchCursor",function(T,N,z){return new L(this,T,N,z)}),o.defineExtension("selectMatches",function(T,N){for(var z=[],O=this.getSearchCursor(T,this.getCursor("from"),N);O.findNext()&&!(o.cmpPos(O.to(),this.getCursor("to"))>0);)z.push({anchor:O.from(),head:O.to()});z.length&&this.setSelections(z,0)})})});var Tf=at((Af,Ff)=>{(function(o){typeof Af=="object"&&typeof Ff=="object"?o(At(),ll(),sl()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../markdown/markdown","../../addon/mode/overlay"],o):o(CodeMirror)})(function(o){"use strict";var l=/^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i;o.defineMode("gfm",function(s,a){var f=0;function h(y){return y.code=!1,null}var c={startState:function(){return{code:!1,codeBlock:!1,ateSpace:!1}},copyState:function(y){return{code:y.code,codeBlock:y.codeBlock,ateSpace:y.ateSpace}},token:function(y,x){if(x.combineTokens=null,x.codeBlock)return y.match(/^```+/)?(x.codeBlock=!1,null):(y.skipToEnd(),null);if(y.sol()&&(x.code=!1),y.sol()&&y.match(/^```+/))return y.skipToEnd(),x.codeBlock=!0,null;if(y.peek()==="`"){y.next();var D=y.pos;y.eatWhile("`");var k=1+y.pos-D;return x.code?k===f&&(x.code=!1):(f=k,x.code=!0),null}else if(x.code)return y.next(),null;if(y.eatSpace())return x.ateSpace=!0,null;if((y.sol()||x.ateSpace)&&(x.ateSpace=!1,a.gitHubSpice!==!1)){if(y.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?=.{0,6}\d)(?:[a-f0-9]{7,40}\b)/))return x.combineTokens=!0,"link";if(y.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/))return x.combineTokens=!0,"link"}return y.match(l)&&y.string.slice(y.start-2,y.start)!="]("&&(y.start==0||/\W/.test(y.string.charAt(y.start-1)))?(x.combineTokens=!0,"link"):(y.next(),null)},blankLine:h},d={taskLists:!0,strikethrough:!0,emoji:!0};for(var v in a)d[v]=a[v];return d.name="markdown",o.overlayMode(o.getMode(s,d),c)},"markdown"),o.defineMIME("text/x-gfm","gfm")})});var Lf=at(()=>{});var Mf=at((j0,fl)=>{var ul;(function(){"use strict";ul=function(o,l,s,a){a=a||{},this.dictionary=null,this.rules={},this.dictionaryTable=new Map,this.compoundRules=[],this.compoundRuleCodes={},this.replacementTable=[],this.flags=a.flags||{},this.memoized={},this.loaded=!1;var f=this,h,c,d,v,y;o&&(f.dictionary=o,l&&s?F():(typeof window<"u"?(a.dictionaryPath?h=a.dictionaryPath:h="typo/dictionaries",window.chrome&&window.chrome.runtime&&window.chrome.runtime.getURL?h=window.chrome.runtime.getURL(h):window.browser&&window.browser.runtime&&window.browser.runtime.getURL&&(h=window.browser.runtime.getURL(h))):typeof __dirname<"u"?h=__dirname+"/dictionaries":h="./dictionaries",l||x(h+"/"+o+"/"+o+".aff",D),s||x(h+"/"+o+"/"+o+".dic",k)));function x(B,L){var T=f._readFile(B,null,a?.asyncLoad);a?.asyncLoad?T.then(function(N){L(N)}):L(T)}function D(B){l=B,s&&F()}function k(B){s=B,l&&F()}function F(){for(f.rules=f._parseAFF(l),f.compoundRuleCodes={},c=0,v=f.compoundRules.length;c0&&(W.continuationClasses=O),I!=="."&&(k==="SFX"?W.match=new RegExp(I+"$"):W.match=new RegExp("^"+I)),T!="0"&&(k==="SFX"?W.remove=new RegExp(T+"$"):W.remove=T),L.push(W)}l[F]={type:k,combineable:B==="Y",entries:L},c+=f}else if(k==="COMPOUNDRULE"){for(f=parseInt(D[1],10),d=c+1,y=c+1+f;d0&&(s.get(oe)===null&&s.set(oe,[]),s.get(oe).push(H))}for(var f=1,h=l.length;f1){var x=this.parseRuleCodes(v[1]);(!("NEEDAFFIX"in this.flags)||x.indexOf(this.flags.NEEDAFFIX)===-1)&&a(y,x);for(var D=0,k=x.length;D"u"){if("COMPOUNDMIN"in this.flags&&o.length>=this.flags.COMPOUNDMIN){for(s=0,a=this.compoundRules.length;s"u"&&(s=Array.prototype.concat.apply([],this.dictionaryTable.get(o))),s&&s.indexOf(this.flags[l])!==-1))},alphabet:"",suggest:function(o,l){if(!this.loaded)throw"Dictionary not loaded.";if(l=l||5,this.memoized.hasOwnProperty(o)){var s=this.memoized[o].limit;if(l<=s||this.memoized[o].suggestions.length1&&X[1][1]!==X[1][0]&&(I=X[0]+X[1][1]+X[1][0]+X[1].substring(2),(!F||y.check(I))&&(I in B?B[I]+=1:B[I]=1)),X[1]){var de=X[1].substring(0,1).toUpperCase()===X[1].substring(0,1)?"uppercase":"lowercase";for(T=0;TY?1:oe[0].localeCompare(j[0])}I.sort(W).reverse();var G=[],X="lowercase";k.toUpperCase()===k?X="uppercase":k.substr(0,1).toUpperCase()+k.substr(1).toLowerCase()===k&&(X="capitalized");var de=l;for(z=0;z{"use strict";var Bf=Mf();function Oe(o){if(o=o||{},typeof o.codeMirrorInstance!="function"||typeof o.codeMirrorInstance.defineMode!="function"){console.log("CodeMirror Spell Checker: You must provide an instance of CodeMirror via the option `codeMirrorInstance`");return}String.prototype.includes||(String.prototype.includes=function(){"use strict";return String.prototype.indexOf.apply(this,arguments)!==-1}),o.codeMirrorInstance.defineMode("spell-checker",function(l){if(!Oe.aff_loading){Oe.aff_loading=!0;var s=new XMLHttpRequest;s.open("GET","https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.aff",!0),s.onload=function(){s.readyState===4&&s.status===200&&(Oe.aff_data=s.responseText,Oe.num_loaded++,Oe.num_loaded==2&&(Oe.typo=new Bf("en_US",Oe.aff_data,Oe.dic_data,{platform:"any"})))},s.send(null)}if(!Oe.dic_loading){Oe.dic_loading=!0;var a=new XMLHttpRequest;a.open("GET","https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.dic",!0),a.onload=function(){a.readyState===4&&a.status===200&&(Oe.dic_data=a.responseText,Oe.num_loaded++,Oe.num_loaded==2&&(Oe.typo=new Bf("en_US",Oe.aff_data,Oe.dic_data,{platform:"any"})))},a.send(null)}var f='!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~ ',h={token:function(d){var v=d.peek(),y="";if(f.includes(v))return d.next(),null;for(;(v=d.peek())!=null&&!f.includes(v);)y+=v,d.next();return Oe.typo&&!Oe.typo.check(y)?"spell-error":null}},c=o.codeMirrorInstance.getMode(l,l.backdrop||"text/plain");return o.codeMirrorInstance.overlayMode(c,h,!0)})}Oe.num_loaded=0;Oe.aff_loading=!1;Oe.dic_loading=!1;Oe.aff_data="";Oe.dic_data="";Oe.typo;_f.exports=Oe});var Kf=at(_e=>{"use strict";function Nf(o,l){for(var s=0;so.length)&&(l=o.length);for(var s=0,a=new Array(l);s=o.length?{done:!0}:{done:!1,value:o[a++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ep(o,l){if(typeof o!="object"||o===null)return o;var s=o[Symbol.toPrimitive];if(s!==void 0){var a=s.call(o,l||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(o)}function tp(o){var l=ep(o,"string");return typeof l=="symbol"?l:String(l)}function cl(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}_e.defaults=cl();function rp(o){_e.defaults=o}var Uf=/[&<>"']/,ip=new RegExp(Uf.source,"g"),jf=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,np=new RegExp(jf.source,"g"),op={"&":"&","<":"<",">":">",'"':""","'":"'"},If=function(l){return op[l]};function pt(o,l){if(l){if(Uf.test(o))return o.replace(ip,If)}else if(jf.test(o))return o.replace(np,If);return o}var ap=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Gf(o){return o.replace(ap,function(l,s){return s=s.toLowerCase(),s==="colon"?":":s.charAt(0)==="#"?s.charAt(1)==="x"?String.fromCharCode(parseInt(s.substring(2),16)):String.fromCharCode(+s.substring(1)):""})}var lp=/(^|[^\[])\^/g;function Me(o,l){o=typeof o=="string"?o:o.source,l=l||"";var s={replace:function(f,h){return h=h.source||h,h=h.replace(lp,"$1"),o=o.replace(f,h),s},getRegex:function(){return new RegExp(o,l)}};return s}var sp=/[^\w:]/g,up=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function Hf(o,l,s){if(o){var a;try{a=decodeURIComponent(Gf(s)).replace(sp,"").toLowerCase()}catch{return null}if(a.indexOf("javascript:")===0||a.indexOf("vbscript:")===0||a.indexOf("data:")===0)return null}l&&!up.test(s)&&(s=hp(l,s));try{s=encodeURI(s).replace(/%25/g,"%")}catch{return null}return s}var no={},fp=/^[^:]+:\/*[^/]*$/,cp=/^([^:]+:)[\s\S]*$/,dp=/^([^:]+:\/*[^/]*)[\s\S]*$/;function hp(o,l){no[" "+o]||(fp.test(o)?no[" "+o]=o+"/":no[" "+o]=oo(o,"/",!0)),o=no[" "+o];var s=o.indexOf(":")===-1;return l.substring(0,2)==="//"?s?l:o.replace(cp,"$1")+l:l.charAt(0)==="/"?s?l:o.replace(dp,"$1")+l:o+l}var ao={exec:function(){}};function Pf(o,l){var s=o.replace(/\|/g,function(h,c,d){for(var v=!1,y=c;--y>=0&&d[y]==="\\";)v=!v;return v?"|":" |"}),a=s.split(/ \|/),f=0;if(a[0].trim()||a.shift(),a.length>0&&!a[a.length-1].trim()&&a.pop(),a.length>l)a.splice(l);else for(;a.length1;)l&1&&(s+=o),l>>=1,o+=o;return s+o}function Rf(o,l,s,a){var f=l.href,h=l.title?pt(l.title):null,c=o[1].replace(/\\([\[\]])/g,"$1");if(o[0].charAt(0)!=="!"){a.state.inLink=!0;var d={type:"link",raw:s,href:f,title:h,text:c,tokens:a.inlineTokens(c)};return a.state.inLink=!1,d}return{type:"image",raw:s,href:f,title:h,text:pt(c)}}function mp(o,l){var s=o.match(/^(\s+)(?:```)/);if(s===null)return l;var a=s[1];return l.split(` +`),E=G+H.length,q=H[H.length-1].length;return{from:l(E,q),to:l(E+Y.length-1,Y.length==1?q+Y[0].length:Y[Y.length-1].length),match:oe}}}}var x,D;String.prototype.normalize?(x=function(T){return T.normalize("NFD").toLowerCase()},D=function(T){return T.normalize("NFD")}):(x=function(T){return T.toLowerCase()},D=function(T){return T});function k(T,N,z,O){if(T.length==N.length)return z;for(var I=0,R=z+Math.max(0,T.length-N.length);;){if(I==R)return I;var G=I+R>>1,X=O(T.slice(0,G)).length;if(X==z)return G;X>z?R=G:I=G+1}}function F(T,N,z,O){if(!N.length)return null;var I=O?x:D,R=I(N).split(/\r|\n\r?/);e:for(var G=z.line,X=z.ch,he=T.lastLine()+1-R.length;G<=he;G++,X=0){var j=T.getLine(G).slice(X),oe=I(j);if(R.length==1){var H=oe.indexOf(R[0]);if(H==-1)continue e;var z=k(j,oe,H,I)+X;return{from:l(G,k(j,oe,H,I)+X),to:l(G,k(j,oe,H+R[0].length,I)+X)}}else{var Y=oe.length-R[0].length;if(oe.slice(Y)!=R[0])continue e;for(var E=1;E=he;G--,X=-1){var j=T.getLine(G);X>-1&&(j=j.slice(0,X));var oe=I(j);if(R.length==1){var H=oe.lastIndexOf(R[0]);if(H==-1)continue e;return{from:l(G,k(j,oe,H,I)),to:l(G,k(j,oe,H+R[0].length,I))}}else{var Y=R[R.length-1];if(oe.slice(0,Y.length)!=Y)continue e;for(var E=1,z=G-R.length+1;E(this.doc.getLine(N.line)||"").length&&(N.ch=0,N.line++)),o.cmpPos(N,this.doc.clipPos(N))!=0))return this.atOccurrence=!1;var z=this.matches(T,N);if(this.afterEmptyMatch=z&&o.cmpPos(z.from,z.to)==0,z)return this.pos=z,this.atOccurrence=!0,this.pos.match||!0;var O=l(T?this.doc.firstLine():this.doc.lastLine()+1,0);return this.pos={from:O,to:O},this.atOccurrence=!1},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(T,N){if(this.atOccurrence){var z=o.splitLines(T);this.doc.replaceRange(z,this.pos.from,this.pos.to,N),this.pos.to=l(this.pos.from.line+z.length-1,z[z.length-1].length+(z.length==1?this.pos.from.ch:0))}}},o.defineExtension("getSearchCursor",function(T,N,z){return new L(this.doc,T,N,z)}),o.defineDocExtension("getSearchCursor",function(T,N,z){return new L(this,T,N,z)}),o.defineExtension("selectMatches",function(T,N){for(var z=[],O=this.getSearchCursor(T,this.getCursor("from"),N);O.findNext()&&!(o.cmpPos(O.to(),this.getCursor("to"))>0);)z.push({anchor:O.from(),head:O.to()});z.length&&this.setSelections(z,0)})})});var Tf=at((Af,Ff)=>{(function(o){typeof Af=="object"&&typeof Ff=="object"?o(At(),ll(),sl()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../markdown/markdown","../../addon/mode/overlay"],o):o(CodeMirror)})(function(o){"use strict";var l=/^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i;o.defineMode("gfm",function(s,a){var f=0;function h(y){return y.code=!1,null}var c={startState:function(){return{code:!1,codeBlock:!1,ateSpace:!1}},copyState:function(y){return{code:y.code,codeBlock:y.codeBlock,ateSpace:y.ateSpace}},token:function(y,x){if(x.combineTokens=null,x.codeBlock)return y.match(/^```+/)?(x.codeBlock=!1,null):(y.skipToEnd(),null);if(y.sol()&&(x.code=!1),y.sol()&&y.match(/^```+/))return y.skipToEnd(),x.codeBlock=!0,null;if(y.peek()==="`"){y.next();var D=y.pos;y.eatWhile("`");var k=1+y.pos-D;return x.code?k===f&&(x.code=!1):(f=k,x.code=!0),null}else if(x.code)return y.next(),null;if(y.eatSpace())return x.ateSpace=!0,null;if((y.sol()||x.ateSpace)&&(x.ateSpace=!1,a.gitHubSpice!==!1)){if(y.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?=.{0,6}\d)(?:[a-f0-9]{7,40}\b)/))return x.combineTokens=!0,"link";if(y.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/))return x.combineTokens=!0,"link"}return y.match(l)&&y.string.slice(y.start-2,y.start)!="]("&&(y.start==0||/\W/.test(y.string.charAt(y.start-1)))?(x.combineTokens=!0,"link"):(y.next(),null)},blankLine:h},d={taskLists:!0,strikethrough:!0,emoji:!0};for(var v in a)d[v]=a[v];return d.name="markdown",o.overlayMode(o.getMode(s,d),c)},"markdown"),o.defineMIME("text/x-gfm","gfm")})});var Lf=at(()=>{});var Mf=at((j0,fl)=>{var ul;(function(){"use strict";ul=function(o,l,s,a){a=a||{},this.dictionary=null,this.rules={},this.dictionaryTable=new Map,this.compoundRules=[],this.compoundRuleCodes={},this.replacementTable=[],this.flags=a.flags||{},this.memoized={},this.loaded=!1;var f=this,h,c,d,v,y;o&&(f.dictionary=o,l&&s?F():(typeof window<"u"?(a.dictionaryPath?h=a.dictionaryPath:h="typo/dictionaries",window.chrome&&window.chrome.runtime&&window.chrome.runtime.getURL?h=window.chrome.runtime.getURL(h):window.browser&&window.browser.runtime&&window.browser.runtime.getURL&&(h=window.browser.runtime.getURL(h))):typeof __dirname<"u"?h=__dirname+"/dictionaries":h="./dictionaries",l||x(h+"/"+o+"/"+o+".aff",D),s||x(h+"/"+o+"/"+o+".dic",k)));function x(B,L){var T=f._readFile(B,null,a?.asyncLoad);a?.asyncLoad?T.then(function(N){L(N)}):L(T)}function D(B){l=B,s&&F()}function k(B){s=B,l&&F()}function F(){for(f.rules=f._parseAFF(l),f.compoundRuleCodes={},c=0,v=f.compoundRules.length;c0&&(R.continuationClasses=O),I!=="."&&(k==="SFX"?R.match=new RegExp(I+"$"):R.match=new RegExp("^"+I)),T!="0"&&(k==="SFX"?R.remove=new RegExp(T+"$"):R.remove=T),L.push(R)}l[F]={type:k,combineable:B==="Y",entries:L},c+=f}else if(k==="COMPOUNDRULE"){for(f=parseInt(D[1],10),d=c+1,y=c+1+f;d0&&(s.get(oe)===null&&s.set(oe,[]),s.get(oe).push(H))}for(var f=1,h=l.length;f1){var x=this.parseRuleCodes(v[1]);(!("NEEDAFFIX"in this.flags)||x.indexOf(this.flags.NEEDAFFIX)===-1)&&a(y,x);for(var D=0,k=x.length;D"u"){if("COMPOUNDMIN"in this.flags&&o.length>=this.flags.COMPOUNDMIN){for(s=0,a=this.compoundRules.length;s"u"&&(s=Array.prototype.concat.apply([],this.dictionaryTable.get(o))),s&&s.indexOf(this.flags[l])!==-1))},alphabet:"",suggest:function(o,l){if(!this.loaded)throw"Dictionary not loaded.";if(l=l||5,this.memoized.hasOwnProperty(o)){var s=this.memoized[o].limit;if(l<=s||this.memoized[o].suggestions.length1&&X[1][1]!==X[1][0]&&(I=X[0]+X[1][1]+X[1][0]+X[1].substring(2),(!F||y.check(I))&&(I in B?B[I]+=1:B[I]=1)),X[1]){var he=X[1].substring(0,1).toUpperCase()===X[1].substring(0,1)?"uppercase":"lowercase";for(T=0;TY?1:oe[0].localeCompare(j[0])}I.sort(R).reverse();var G=[],X="lowercase";k.toUpperCase()===k?X="uppercase":k.substr(0,1).toUpperCase()+k.substr(1).toLowerCase()===k&&(X="capitalized");var he=l;for(z=0;z{"use strict";var Bf=Mf();function Oe(o){if(o=o||{},typeof o.codeMirrorInstance!="function"||typeof o.codeMirrorInstance.defineMode!="function"){console.log("CodeMirror Spell Checker: You must provide an instance of CodeMirror via the option `codeMirrorInstance`");return}String.prototype.includes||(String.prototype.includes=function(){"use strict";return String.prototype.indexOf.apply(this,arguments)!==-1}),o.codeMirrorInstance.defineMode("spell-checker",function(l){if(!Oe.aff_loading){Oe.aff_loading=!0;var s=new XMLHttpRequest;s.open("GET","https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.aff",!0),s.onload=function(){s.readyState===4&&s.status===200&&(Oe.aff_data=s.responseText,Oe.num_loaded++,Oe.num_loaded==2&&(Oe.typo=new Bf("en_US",Oe.aff_data,Oe.dic_data,{platform:"any"})))},s.send(null)}if(!Oe.dic_loading){Oe.dic_loading=!0;var a=new XMLHttpRequest;a.open("GET","https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.dic",!0),a.onload=function(){a.readyState===4&&a.status===200&&(Oe.dic_data=a.responseText,Oe.num_loaded++,Oe.num_loaded==2&&(Oe.typo=new Bf("en_US",Oe.aff_data,Oe.dic_data,{platform:"any"})))},a.send(null)}var f='!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~ ',h={token:function(d){var v=d.peek(),y="";if(f.includes(v))return d.next(),null;for(;(v=d.peek())!=null&&!f.includes(v);)y+=v,d.next();return Oe.typo&&!Oe.typo.check(y)?"spell-error":null}},c=o.codeMirrorInstance.getMode(l,l.backdrop||"text/plain");return o.codeMirrorInstance.overlayMode(c,h,!0)})}Oe.num_loaded=0;Oe.aff_loading=!1;Oe.dic_loading=!1;Oe.aff_data="";Oe.dic_data="";Oe.typo;_f.exports=Oe});var Kf=at(_e=>{"use strict";function Nf(o,l){for(var s=0;so.length)&&(l=o.length);for(var s=0,a=new Array(l);s=o.length?{done:!0}:{done:!1,value:o[a++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ep(o,l){if(typeof o!="object"||o===null)return o;var s=o[Symbol.toPrimitive];if(s!==void 0){var a=s.call(o,l||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(o)}function tp(o){var l=ep(o,"string");return typeof l=="symbol"?l:String(l)}function cl(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}_e.defaults=cl();function rp(o){_e.defaults=o}var Uf=/[&<>"']/,ip=new RegExp(Uf.source,"g"),jf=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,np=new RegExp(jf.source,"g"),op={"&":"&","<":"<",">":">",'"':""","'":"'"},If=function(l){return op[l]};function pt(o,l){if(l){if(Uf.test(o))return o.replace(ip,If)}else if(jf.test(o))return o.replace(np,If);return o}var ap=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Gf(o){return o.replace(ap,function(l,s){return s=s.toLowerCase(),s==="colon"?":":s.charAt(0)==="#"?s.charAt(1)==="x"?String.fromCharCode(parseInt(s.substring(2),16)):String.fromCharCode(+s.substring(1)):""})}var lp=/(^|[^\[])\^/g;function Me(o,l){o=typeof o=="string"?o:o.source,l=l||"";var s={replace:function(f,h){return h=h.source||h,h=h.replace(lp,"$1"),o=o.replace(f,h),s},getRegex:function(){return new RegExp(o,l)}};return s}var sp=/[^\w:]/g,up=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function Hf(o,l,s){if(o){var a;try{a=decodeURIComponent(Gf(s)).replace(sp,"").toLowerCase()}catch{return null}if(a.indexOf("javascript:")===0||a.indexOf("vbscript:")===0||a.indexOf("data:")===0)return null}l&&!up.test(s)&&(s=hp(l,s));try{s=encodeURI(s).replace(/%25/g,"%")}catch{return null}return s}var oo={},fp=/^[^:]+:\/*[^/]*$/,cp=/^([^:]+:)[\s\S]*$/,dp=/^([^:]+:\/*[^/]*)[\s\S]*$/;function hp(o,l){oo[" "+o]||(fp.test(o)?oo[" "+o]=o+"/":oo[" "+o]=ao(o,"/",!0)),o=oo[" "+o];var s=o.indexOf(":")===-1;return l.substring(0,2)==="//"?s?l:o.replace(cp,"$1")+l:l.charAt(0)==="/"?s?l:o.replace(dp,"$1")+l:o+l}var lo={exec:function(){}};function Pf(o,l){var s=o.replace(/\|/g,function(h,c,d){for(var v=!1,y=c;--y>=0&&d[y]==="\\";)v=!v;return v?"|":" |"}),a=s.split(/ \|/),f=0;if(a[0].trim()||a.shift(),a.length>0&&!a[a.length-1].trim()&&a.pop(),a.length>l)a.splice(l);else for(;a.length1;)l&1&&(s+=o),l>>=1,o+=o;return s+o}function Rf(o,l,s,a){var f=l.href,h=l.title?pt(l.title):null,c=o[1].replace(/\\([\[\]])/g,"$1");if(o[0].charAt(0)!=="!"){a.state.inLink=!0;var d={type:"link",raw:s,href:f,title:h,text:c,tokens:a.inlineTokens(c)};return a.state.inLink=!1,d}return{type:"image",raw:s,href:f,title:h,text:pt(c)}}function mp(o,l){var s=o.match(/^(\s+)(?:```)/);if(s===null)return l;var a=s[1];return l.split(` `).map(function(f){var h=f.match(/^\s+/);if(h===null)return f;var c=h[0];return c.length>=a.length?f.slice(a.length):f}).join(` -`)}var lo=function(){function o(s){this.options=s||_e.defaults}var l=o.prototype;return l.space=function(a){var f=this.rules.block.newline.exec(a);if(f&&f[0].length>0)return{type:"space",raw:f[0]}},l.code=function(a){var f=this.rules.block.code.exec(a);if(f){var h=f[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:f[0],codeBlockStyle:"indented",text:this.options.pedantic?h:oo(h,` -`)}}},l.fences=function(a){var f=this.rules.block.fences.exec(a);if(f){var h=f[0],c=mp(h,f[3]||"");return{type:"code",raw:h,lang:f[2]?f[2].trim().replace(this.rules.inline._escapes,"$1"):f[2],text:c}}},l.heading=function(a){var f=this.rules.block.heading.exec(a);if(f){var h=f[2].trim();if(/#$/.test(h)){var c=oo(h,"#");(this.options.pedantic||!c||/ $/.test(c))&&(h=c.trim())}return{type:"heading",raw:f[0],depth:f[1].length,text:h,tokens:this.lexer.inline(h)}}},l.hr=function(a){var f=this.rules.block.hr.exec(a);if(f)return{type:"hr",raw:f[0]}},l.blockquote=function(a){var f=this.rules.block.blockquote.exec(a);if(f){var h=f[0].replace(/^ *>[ \t]?/gm,""),c=this.lexer.state.top;this.lexer.state.top=!0;var d=this.lexer.blockTokens(h);return this.lexer.state.top=c,{type:"blockquote",raw:f[0],tokens:d,text:h}}},l.list=function(a){var f=this.rules.block.list.exec(a);if(f){var h,c,d,v,y,x,D,k,F,B,L,T,N=f[1].trim(),z=N.length>1,O={type:"list",raw:"",ordered:z,start:z?+N.slice(0,-1):"",loose:!1,items:[]};N=z?"\\d{1,9}\\"+N.slice(-1):"\\"+N,this.options.pedantic&&(N=z?N:"[*+-]");for(var I=new RegExp("^( {0,3}"+N+")((?:[ ][^\\n]*)?(?:\\n|$))");a&&(T=!1,!(!(f=I.exec(a))||this.rules.block.hr.test(a)));){if(h=f[0],a=a.substring(h.length),k=f[2].split(` +`)}var so=function(){function o(s){this.options=s||_e.defaults}var l=o.prototype;return l.space=function(a){var f=this.rules.block.newline.exec(a);if(f&&f[0].length>0)return{type:"space",raw:f[0]}},l.code=function(a){var f=this.rules.block.code.exec(a);if(f){var h=f[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:f[0],codeBlockStyle:"indented",text:this.options.pedantic?h:ao(h,` +`)}}},l.fences=function(a){var f=this.rules.block.fences.exec(a);if(f){var h=f[0],c=mp(h,f[3]||"");return{type:"code",raw:h,lang:f[2]?f[2].trim().replace(this.rules.inline._escapes,"$1"):f[2],text:c}}},l.heading=function(a){var f=this.rules.block.heading.exec(a);if(f){var h=f[2].trim();if(/#$/.test(h)){var c=ao(h,"#");(this.options.pedantic||!c||/ $/.test(c))&&(h=c.trim())}return{type:"heading",raw:f[0],depth:f[1].length,text:h,tokens:this.lexer.inline(h)}}},l.hr=function(a){var f=this.rules.block.hr.exec(a);if(f)return{type:"hr",raw:f[0]}},l.blockquote=function(a){var f=this.rules.block.blockquote.exec(a);if(f){var h=f[0].replace(/^ *>[ \t]?/gm,""),c=this.lexer.state.top;this.lexer.state.top=!0;var d=this.lexer.blockTokens(h);return this.lexer.state.top=c,{type:"blockquote",raw:f[0],tokens:d,text:h}}},l.list=function(a){var f=this.rules.block.list.exec(a);if(f){var h,c,d,v,y,x,D,k,F,B,L,T,N=f[1].trim(),z=N.length>1,O={type:"list",raw:"",ordered:z,start:z?+N.slice(0,-1):"",loose:!1,items:[]};N=z?"\\d{1,9}\\"+N.slice(-1):"\\"+N,this.options.pedantic&&(N=z?N:"[*+-]");for(var I=new RegExp("^( {0,3}"+N+")((?:[ ][^\\n]*)?(?:\\n|$))");a&&(T=!1,!(!(f=I.exec(a))||this.rules.block.hr.test(a)));){if(h=f[0],a=a.substring(h.length),k=f[2].split(` `,1)[0].replace(/^\t+/,function(Y){return" ".repeat(3*Y.length)}),F=a.split(` `,1)[0],this.options.pedantic?(v=2,L=k.trimLeft()):(v=f[2].search(/[^ ]/),v=v>4?1:v,L=k.slice(v),v+=f[1].length),x=!1,!k&&/^ *$/.test(F)&&(h+=F+` -`,a=a.substring(F.length+1),T=!0),!T)for(var W=new RegExp("^ {0,"+Math.min(3,v-1)+"}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))"),G=new RegExp("^ {0,"+Math.min(3,v-1)+"}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)"),X=new RegExp("^ {0,"+Math.min(3,v-1)+"}(?:```|~~~)"),de=new RegExp("^ {0,"+Math.min(3,v-1)+"}#");a&&(B=a.split(` -`,1)[0],F=B,this.options.pedantic&&(F=F.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!(X.test(F)||de.test(F)||W.test(F)||G.test(a)));){if(F.search(/[^ ]/)>=v||!F.trim())L+=` -`+F.slice(v);else{if(x||k.search(/[^ ]/)>=4||X.test(k)||de.test(k)||G.test(k))break;L+=` +`,a=a.substring(F.length+1),T=!0),!T)for(var R=new RegExp("^ {0,"+Math.min(3,v-1)+"}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))"),G=new RegExp("^ {0,"+Math.min(3,v-1)+"}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)"),X=new RegExp("^ {0,"+Math.min(3,v-1)+"}(?:```|~~~)"),he=new RegExp("^ {0,"+Math.min(3,v-1)+"}#");a&&(B=a.split(` +`,1)[0],F=B,this.options.pedantic&&(F=F.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!(X.test(F)||he.test(F)||R.test(F)||G.test(a)));){if(F.search(/[^ ]/)>=v||!F.trim())L+=` +`+F.slice(v);else{if(x||k.search(/[^ ]/)>=4||X.test(k)||he.test(k)||G.test(k))break;L+=` `+F}!x&&!F.trim()&&(x=!0),h+=B+` `,a=a.substring(B.length+1),k=F.slice(v)}O.loose||(D?O.loose=!0:/\n *\n *$/.test(h)&&(D=!0)),this.options.gfm&&(c=/^\[[ xX]\] /.exec(L),c&&(d=c[0]!=="[ ] ",L=L.replace(/^\[[ xX]\] +/,""))),O.items.push({type:"list_item",raw:h,task:!!c,checked:d,loose:!1,text:L}),O.raw+=h}O.items[O.items.length-1].raw=h.trimRight(),O.items[O.items.length-1].text=L.trimRight(),O.raw=O.raw.trimRight();var j=O.items.length;for(y=0;y0&&oe.some(function(Y){return/\n.*\n/.test(Y.raw)});O.loose=H}if(O.loose)for(y=0;y$/,"$1").replace(this.rules.inline._escapes,"$1"):"",d=f[3]?f[3].substring(1,f[3].length-1).replace(this.rules.inline._escapes,"$1"):f[3];return{type:"def",tag:h,raw:f[0],href:c,title:d}}},l.table=function(a){var f=this.rules.block.table.exec(a);if(f){var h={type:"table",header:Pf(f[1]).map(function(D){return{text:D}}),align:f[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:f[3]&&f[3].trim()?f[3].replace(/\n[ \t]*$/,"").split(` `):[]};if(h.header.length===h.align.length){h.raw=f[0];var c=h.align.length,d,v,y,x;for(d=0;d/i.test(f[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(f[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(f[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:f[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(f[0]):pt(f[0]):f[0]}},l.link=function(a){var f=this.rules.inline.link.exec(a);if(f){var h=f[2].trim();if(!this.options.pedantic&&/^$/.test(h))return;var c=oo(h.slice(0,-1),"\\");if((h.length-c.length)%2===0)return}else{var d=pp(f[2],"()");if(d>-1){var v=f[0].indexOf("!")===0?5:4,y=v+f[1].length+d;f[2]=f[2].substring(0,d),f[0]=f[0].substring(0,y).trim(),f[3]=""}}var x=f[2],D="";if(this.options.pedantic){var k=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(x);k&&(x=k[1],D=k[3])}else D=f[3]?f[3].slice(1,-1):"";return x=x.trim(),/^$/.test(h)?x=x.slice(1):x=x.slice(1,-1)),Rf(f,{href:x&&x.replace(this.rules.inline._escapes,"$1"),title:D&&D.replace(this.rules.inline._escapes,"$1")},f[0],this.lexer)}},l.reflink=function(a,f){var h;if((h=this.rules.inline.reflink.exec(a))||(h=this.rules.inline.nolink.exec(a))){var c=(h[2]||h[1]).replace(/\s+/g," ");if(c=f[c.toLowerCase()],!c){var d=h[0].charAt(0);return{type:"text",raw:d,text:d}}return Rf(h,c,h[0],this.lexer)}},l.emStrong=function(a,f,h){h===void 0&&(h="");var c=this.rules.inline.emStrong.lDelim.exec(a);if(c&&!(c[3]&&h.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\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\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\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\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\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-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\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\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDF70-\uDF81\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD837[\uDF00-\uDF1E]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/))){var d=c[1]||c[2]||"";if(!d||d&&(h===""||this.rules.inline.punctuation.exec(h))){var v=c[0].length-1,y,x,D=v,k=0,F=c[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(F.lastIndex=0,f=f.slice(-1*a.length+v);(c=F.exec(f))!=null;)if(y=c[1]||c[2]||c[3]||c[4]||c[5]||c[6],!!y){if(x=y.length,c[3]||c[4]){D+=x;continue}else if((c[5]||c[6])&&v%3&&!((v+x)%3)){k+=x;continue}if(D-=x,!(D>0)){x=Math.min(x,x+D+k);var B=a.slice(0,v+c.index+(c[0].length-y.length)+x);if(Math.min(v,x)%2){var L=B.slice(1,-1);return{type:"em",raw:B,text:L,tokens:this.lexer.inlineTokens(L)}}var T=B.slice(2,-2);return{type:"strong",raw:B,text:T,tokens:this.lexer.inlineTokens(T)}}}}}},l.codespan=function(a){var f=this.rules.inline.code.exec(a);if(f){var h=f[2].replace(/\n/g," "),c=/[^ ]/.test(h),d=/^ /.test(h)&&/ $/.test(h);return c&&d&&(h=h.substring(1,h.length-1)),h=pt(h,!0),{type:"codespan",raw:f[0],text:h}}},l.br=function(a){var f=this.rules.inline.br.exec(a);if(f)return{type:"br",raw:f[0]}},l.del=function(a){var f=this.rules.inline.del.exec(a);if(f)return{type:"del",raw:f[0],text:f[2],tokens:this.lexer.inlineTokens(f[2])}},l.autolink=function(a,f){var h=this.rules.inline.autolink.exec(a);if(h){var c,d;return h[2]==="@"?(c=pt(this.options.mangle?f(h[1]):h[1]),d="mailto:"+c):(c=pt(h[1]),d=c),{type:"link",raw:h[0],text:c,href:d,tokens:[{type:"text",raw:c,text:c}]}}},l.url=function(a,f){var h;if(h=this.rules.inline.url.exec(a)){var c,d;if(h[2]==="@")c=pt(this.options.mangle?f(h[0]):h[0]),d="mailto:"+c;else{var v;do v=h[0],h[0]=this.rules.inline._backpedal.exec(h[0])[0];while(v!==h[0]);c=pt(h[0]),h[1]==="www."?d="http://"+h[0]:d=h[0]}return{type:"link",raw:h[0],text:c,href:d,tokens:[{type:"text",raw:c,text:c}]}}},l.inlineText=function(a,f){var h=this.rules.inline.text.exec(a);if(h){var c;return this.lexer.state.inRawBlock?c=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(h[0]):pt(h[0]):h[0]:c=pt(this.options.smartypants?f(h[0]):h[0]),{type:"text",raw:h[0],text:c}}},o}(),ce={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:ao,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/};ce._label=/(?!\s*\])(?:\\.|[^\[\]\\])+/;ce._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;ce.def=Me(ce.def).replace("label",ce._label).replace("title",ce._title).getRegex();ce.bullet=/(?:[*+-]|\d{1,9}[.)])/;ce.listItemStart=Me(/^( *)(bull) */).replace("bull",ce.bullet).getRegex();ce.list=Me(ce.list).replace(/bull/g,ce.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ce.def.source+")").getRegex();ce._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";ce._comment=/|$)/;ce.html=Me(ce.html,"i").replace("comment",ce._comment).replace("tag",ce._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();ce.paragraph=Me(ce._paragraph).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ce._tag).getRegex();ce.blockquote=Me(ce.blockquote).replace("paragraph",ce.paragraph).getRegex();ce.normal=_t({},ce);ce.gfm=_t({},ce.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"});ce.gfm.table=Me(ce.gfm.table).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ce._tag).getRegex();ce.gfm.paragraph=Me(ce._paragraph).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",ce.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ce._tag).getRegex();ce.pedantic=_t({},ce.normal,{html:Me(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ce._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:ao,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Me(ce.normal._paragraph).replace("hr",ce.hr).replace("heading",` *#{1,6} *[^ -]`).replace("lheading",ce.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var ne={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:ao,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,rDelimUnd:/^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:ao,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~";ne.punctuation=Me(ne.punctuation).replace(/punctuation/g,ne._punctuation).getRegex();ne.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;ne.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g;ne._comment=Me(ce._comment).replace("(?:-->|$)","-->").getRegex();ne.emStrong.lDelim=Me(ne.emStrong.lDelim).replace(/punct/g,ne._punctuation).getRegex();ne.emStrong.rDelimAst=Me(ne.emStrong.rDelimAst,"g").replace(/punct/g,ne._punctuation).getRegex();ne.emStrong.rDelimUnd=Me(ne.emStrong.rDelimUnd,"g").replace(/punct/g,ne._punctuation).getRegex();ne._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;ne._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;ne._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;ne.autolink=Me(ne.autolink).replace("scheme",ne._scheme).replace("email",ne._email).getRegex();ne._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;ne.tag=Me(ne.tag).replace("comment",ne._comment).replace("attribute",ne._attribute).getRegex();ne._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;ne._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;ne._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;ne.link=Me(ne.link).replace("label",ne._label).replace("href",ne._href).replace("title",ne._title).getRegex();ne.reflink=Me(ne.reflink).replace("label",ne._label).replace("ref",ce._label).getRegex();ne.nolink=Me(ne.nolink).replace("ref",ce._label).getRegex();ne.reflinkSearch=Me(ne.reflinkSearch,"g").replace("reflink",ne.reflink).replace("nolink",ne.nolink).getRegex();ne.normal=_t({},ne);ne.pedantic=_t({},ne.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Me(/^!?\[(label)\]\((.*?)\)/).replace("label",ne._label).getRegex(),reflink:Me(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ne._label).getRegex()});ne.gfm=_t({},ne.normal,{escape:Me(ne.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\.5&&(a="x"+a.toString(16)),l+="&#"+a+";";return l}var bi=function(){function o(s){this.tokens=[],this.tokens.links=Object.create(null),this.options=s||_e.defaults,this.options.tokenizer=this.options.tokenizer||new lo,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};var a={block:ce.normal,inline:ne.normal};this.options.pedantic?(a.block=ce.pedantic,a.inline=ne.pedantic):this.options.gfm&&(a.block=ce.gfm,this.options.breaks?a.inline=ne.breaks:a.inline=ne.gfm),this.tokenizer.rules=a}o.lex=function(a,f){var h=new o(f);return h.lex(a)},o.lexInline=function(a,f){var h=new o(f);return h.inlineTokens(a)};var l=o.prototype;return l.lex=function(a){a=a.replace(/\r\n|\r/g,` +`?f[1].slice(0,-1):f[1];return{type:"paragraph",raw:f[0],text:h,tokens:this.lexer.inline(h)}}},l.text=function(a){var f=this.rules.block.text.exec(a);if(f)return{type:"text",raw:f[0],text:f[0],tokens:this.lexer.inline(f[0])}},l.escape=function(a){var f=this.rules.inline.escape.exec(a);if(f)return{type:"escape",raw:f[0],text:pt(f[1])}},l.tag=function(a){var f=this.rules.inline.tag.exec(a);if(f)return!this.lexer.state.inLink&&/^
    /i.test(f[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(f[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(f[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:f[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(f[0]):pt(f[0]):f[0]}},l.link=function(a){var f=this.rules.inline.link.exec(a);if(f){var h=f[2].trim();if(!this.options.pedantic&&/^$/.test(h))return;var c=ao(h.slice(0,-1),"\\");if((h.length-c.length)%2===0)return}else{var d=pp(f[2],"()");if(d>-1){var v=f[0].indexOf("!")===0?5:4,y=v+f[1].length+d;f[2]=f[2].substring(0,d),f[0]=f[0].substring(0,y).trim(),f[3]=""}}var x=f[2],D="";if(this.options.pedantic){var k=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(x);k&&(x=k[1],D=k[3])}else D=f[3]?f[3].slice(1,-1):"";return x=x.trim(),/^$/.test(h)?x=x.slice(1):x=x.slice(1,-1)),Rf(f,{href:x&&x.replace(this.rules.inline._escapes,"$1"),title:D&&D.replace(this.rules.inline._escapes,"$1")},f[0],this.lexer)}},l.reflink=function(a,f){var h;if((h=this.rules.inline.reflink.exec(a))||(h=this.rules.inline.nolink.exec(a))){var c=(h[2]||h[1]).replace(/\s+/g," ");if(c=f[c.toLowerCase()],!c){var d=h[0].charAt(0);return{type:"text",raw:d,text:d}}return Rf(h,c,h[0],this.lexer)}},l.emStrong=function(a,f,h){h===void 0&&(h="");var c=this.rules.inline.emStrong.lDelim.exec(a);if(c&&!(c[3]&&h.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\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\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\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\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\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-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\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\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDF70-\uDF81\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD837[\uDF00-\uDF1E]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/))){var d=c[1]||c[2]||"";if(!d||d&&(h===""||this.rules.inline.punctuation.exec(h))){var v=c[0].length-1,y,x,D=v,k=0,F=c[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(F.lastIndex=0,f=f.slice(-1*a.length+v);(c=F.exec(f))!=null;)if(y=c[1]||c[2]||c[3]||c[4]||c[5]||c[6],!!y){if(x=y.length,c[3]||c[4]){D+=x;continue}else if((c[5]||c[6])&&v%3&&!((v+x)%3)){k+=x;continue}if(D-=x,!(D>0)){x=Math.min(x,x+D+k);var B=a.slice(0,v+c.index+(c[0].length-y.length)+x);if(Math.min(v,x)%2){var L=B.slice(1,-1);return{type:"em",raw:B,text:L,tokens:this.lexer.inlineTokens(L)}}var T=B.slice(2,-2);return{type:"strong",raw:B,text:T,tokens:this.lexer.inlineTokens(T)}}}}}},l.codespan=function(a){var f=this.rules.inline.code.exec(a);if(f){var h=f[2].replace(/\n/g," "),c=/[^ ]/.test(h),d=/^ /.test(h)&&/ $/.test(h);return c&&d&&(h=h.substring(1,h.length-1)),h=pt(h,!0),{type:"codespan",raw:f[0],text:h}}},l.br=function(a){var f=this.rules.inline.br.exec(a);if(f)return{type:"br",raw:f[0]}},l.del=function(a){var f=this.rules.inline.del.exec(a);if(f)return{type:"del",raw:f[0],text:f[2],tokens:this.lexer.inlineTokens(f[2])}},l.autolink=function(a,f){var h=this.rules.inline.autolink.exec(a);if(h){var c,d;return h[2]==="@"?(c=pt(this.options.mangle?f(h[1]):h[1]),d="mailto:"+c):(c=pt(h[1]),d=c),{type:"link",raw:h[0],text:c,href:d,tokens:[{type:"text",raw:c,text:c}]}}},l.url=function(a,f){var h;if(h=this.rules.inline.url.exec(a)){var c,d;if(h[2]==="@")c=pt(this.options.mangle?f(h[0]):h[0]),d="mailto:"+c;else{var v;do v=h[0],h[0]=this.rules.inline._backpedal.exec(h[0])[0];while(v!==h[0]);c=pt(h[0]),h[1]==="www."?d="http://"+h[0]:d=h[0]}return{type:"link",raw:h[0],text:c,href:d,tokens:[{type:"text",raw:c,text:c}]}}},l.inlineText=function(a,f){var h=this.rules.inline.text.exec(a);if(h){var c;return this.lexer.state.inRawBlock?c=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(h[0]):pt(h[0]):h[0]:c=pt(this.options.smartypants?f(h[0]):h[0]),{type:"text",raw:h[0],text:c}}},o}(),ce={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:lo,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/};ce._label=/(?!\s*\])(?:\\.|[^\[\]\\])+/;ce._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;ce.def=Me(ce.def).replace("label",ce._label).replace("title",ce._title).getRegex();ce.bullet=/(?:[*+-]|\d{1,9}[.)])/;ce.listItemStart=Me(/^( *)(bull) */).replace("bull",ce.bullet).getRegex();ce.list=Me(ce.list).replace(/bull/g,ce.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ce.def.source+")").getRegex();ce._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";ce._comment=/|$)/;ce.html=Me(ce.html,"i").replace("comment",ce._comment).replace("tag",ce._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();ce.paragraph=Me(ce._paragraph).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ce._tag).getRegex();ce.blockquote=Me(ce.blockquote).replace("paragraph",ce.paragraph).getRegex();ce.normal=_t({},ce);ce.gfm=_t({},ce.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"});ce.gfm.table=Me(ce.gfm.table).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ce._tag).getRegex();ce.gfm.paragraph=Me(ce._paragraph).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",ce.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ce._tag).getRegex();ce.pedantic=_t({},ce.normal,{html:Me(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ce._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:lo,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Me(ce.normal._paragraph).replace("hr",ce.hr).replace("heading",` *#{1,6} *[^ +]`).replace("lheading",ce.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var ne={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:lo,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,rDelimUnd:/^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:lo,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~";ne.punctuation=Me(ne.punctuation).replace(/punctuation/g,ne._punctuation).getRegex();ne.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;ne.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g;ne._comment=Me(ce._comment).replace("(?:-->|$)","-->").getRegex();ne.emStrong.lDelim=Me(ne.emStrong.lDelim).replace(/punct/g,ne._punctuation).getRegex();ne.emStrong.rDelimAst=Me(ne.emStrong.rDelimAst,"g").replace(/punct/g,ne._punctuation).getRegex();ne.emStrong.rDelimUnd=Me(ne.emStrong.rDelimUnd,"g").replace(/punct/g,ne._punctuation).getRegex();ne._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;ne._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;ne._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;ne.autolink=Me(ne.autolink).replace("scheme",ne._scheme).replace("email",ne._email).getRegex();ne._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;ne.tag=Me(ne.tag).replace("comment",ne._comment).replace("attribute",ne._attribute).getRegex();ne._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;ne._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;ne._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;ne.link=Me(ne.link).replace("label",ne._label).replace("href",ne._href).replace("title",ne._title).getRegex();ne.reflink=Me(ne.reflink).replace("label",ne._label).replace("ref",ce._label).getRegex();ne.nolink=Me(ne.nolink).replace("ref",ce._label).getRegex();ne.reflinkSearch=Me(ne.reflinkSearch,"g").replace("reflink",ne.reflink).replace("nolink",ne.nolink).getRegex();ne.normal=_t({},ne);ne.pedantic=_t({},ne.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Me(/^!?\[(label)\]\((.*?)\)/).replace("label",ne._label).getRegex(),reflink:Me(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ne._label).getRegex()});ne.gfm=_t({},ne.normal,{escape:Me(ne.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\.5&&(a="x"+a.toString(16)),l+="&#"+a+";";return l}var yi=function(){function o(s){this.tokens=[],this.tokens.links=Object.create(null),this.options=s||_e.defaults,this.options.tokenizer=this.options.tokenizer||new so,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};var a={block:ce.normal,inline:ne.normal};this.options.pedantic?(a.block=ce.pedantic,a.inline=ne.pedantic):this.options.gfm&&(a.block=ce.gfm,this.options.breaks?a.inline=ne.breaks:a.inline=ne.gfm),this.tokenizer.rules=a}o.lex=function(a,f){var h=new o(f);return h.lex(a)},o.lexInline=function(a,f){var h=new o(f);return h.inlineTokens(a)};var l=o.prototype;return l.lex=function(a){a=a.replace(/\r\n|\r/g,` `),this.blockTokens(a,this.tokens);for(var f;f=this.inlineQueue.shift();)this.inlineTokens(f.src,f.tokens);return this.tokens},l.blockTokens=function(a,f){var h=this;f===void 0&&(f=[]),this.options.pedantic?a=a.replace(/\t/g," ").replace(/^ +$/gm,""):a=a.replace(/^( *)(\t+)/gm,function(D,k,F){return k+" ".repeat(F.length)});for(var c,d,v,y;a;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(function(D){return(c=D.call({lexer:h},a,f))?(a=a.substring(c.raw.length),f.push(c),!0):!1}))){if(c=this.tokenizer.space(a)){a=a.substring(c.raw.length),c.raw.length===1&&f.length>0?f[f.length-1].raw+=` `:f.push(c);continue}if(c=this.tokenizer.code(a)){a=a.substring(c.raw.length),d=f[f.length-1],d&&(d.type==="paragraph"||d.type==="text")?(d.raw+=` `+c.raw,d.text+=` @@ -53,7 +53,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `+c.raw,d.text+=` `+c.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=d.text):f.push(c),y=v.length!==a.length,a=a.substring(c.raw.length);continue}if(c=this.tokenizer.text(a)){a=a.substring(c.raw.length),d=f[f.length-1],d&&d.type==="text"?(d.raw+=` `+c.raw,d.text+=` -`+c.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=d.text):f.push(c);continue}if(a){var x="Infinite loop on byte: "+a.charCodeAt(0);if(this.options.silent){console.error(x);break}else throw new Error(x)}}return this.state.top=!0,f},l.inline=function(a,f){return f===void 0&&(f=[]),this.inlineQueue.push({src:a,tokens:f}),f},l.inlineTokens=function(a,f){var h=this;f===void 0&&(f=[]);var c,d,v,y=a,x,D,k;if(this.tokens.links){var F=Object.keys(this.tokens.links);if(F.length>0)for(;(x=this.tokenizer.rules.inline.reflinkSearch.exec(y))!=null;)F.includes(x[0].slice(x[0].lastIndexOf("[")+1,-1))&&(y=y.slice(0,x.index)+"["+qf("a",x[0].length-2)+"]"+y.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(x=this.tokenizer.rules.inline.blockSkip.exec(y))!=null;)y=y.slice(0,x.index)+"["+qf("a",x[0].length-2)+"]"+y.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(x=this.tokenizer.rules.inline.escapedEmSt.exec(y))!=null;)y=y.slice(0,x.index+x[0].length-2)+"++"+y.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex),this.tokenizer.rules.inline.escapedEmSt.lastIndex--;for(;a;)if(D||(k=""),D=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(function(L){return(c=L.call({lexer:h},a,f))?(a=a.substring(c.raw.length),f.push(c),!0):!1}))){if(c=this.tokenizer.escape(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.tag(a)){a=a.substring(c.raw.length),d=f[f.length-1],d&&c.type==="text"&&d.type==="text"?(d.raw+=c.raw,d.text+=c.text):f.push(c);continue}if(c=this.tokenizer.link(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.reflink(a,this.tokens.links)){a=a.substring(c.raw.length),d=f[f.length-1],d&&c.type==="text"&&d.type==="text"?(d.raw+=c.raw,d.text+=c.text):f.push(c);continue}if(c=this.tokenizer.emStrong(a,y,k)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.codespan(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.br(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.del(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.autolink(a,Wf)){a=a.substring(c.raw.length),f.push(c);continue}if(!this.state.inLink&&(c=this.tokenizer.url(a,Wf))){a=a.substring(c.raw.length),f.push(c);continue}if(v=a,this.options.extensions&&this.options.extensions.startInline&&function(){var L=1/0,T=a.slice(1),N=void 0;h.options.extensions.startInline.forEach(function(z){N=z.call({lexer:this},T),typeof N=="number"&&N>=0&&(L=Math.min(L,N))}),L<1/0&&L>=0&&(v=a.substring(0,L+1))}(),c=this.tokenizer.inlineText(v,vp)){a=a.substring(c.raw.length),c.raw.slice(-1)!=="_"&&(k=c.raw.slice(-1)),D=!0,d=f[f.length-1],d&&d.type==="text"?(d.raw+=c.raw,d.text+=c.text):f.push(c);continue}if(a){var B="Infinite loop on byte: "+a.charCodeAt(0);if(this.options.silent){console.error(B);break}else throw new Error(B)}}return f},Vh(o,null,[{key:"rules",get:function(){return{block:ce,inline:ne}}}]),o}(),so=function(){function o(s){this.options=s||_e.defaults}var l=o.prototype;return l.code=function(a,f,h){var c=(f||"").match(/\S*/)[0];if(this.options.highlight){var d=this.options.highlight(a,c);d!=null&&d!==a&&(h=!0,a=d)}return a=a.replace(/\n$/,"")+` +`+c.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=d.text):f.push(c);continue}if(a){var x="Infinite loop on byte: "+a.charCodeAt(0);if(this.options.silent){console.error(x);break}else throw new Error(x)}}return this.state.top=!0,f},l.inline=function(a,f){return f===void 0&&(f=[]),this.inlineQueue.push({src:a,tokens:f}),f},l.inlineTokens=function(a,f){var h=this;f===void 0&&(f=[]);var c,d,v,y=a,x,D,k;if(this.tokens.links){var F=Object.keys(this.tokens.links);if(F.length>0)for(;(x=this.tokenizer.rules.inline.reflinkSearch.exec(y))!=null;)F.includes(x[0].slice(x[0].lastIndexOf("[")+1,-1))&&(y=y.slice(0,x.index)+"["+qf("a",x[0].length-2)+"]"+y.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(x=this.tokenizer.rules.inline.blockSkip.exec(y))!=null;)y=y.slice(0,x.index)+"["+qf("a",x[0].length-2)+"]"+y.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(x=this.tokenizer.rules.inline.escapedEmSt.exec(y))!=null;)y=y.slice(0,x.index+x[0].length-2)+"++"+y.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex),this.tokenizer.rules.inline.escapedEmSt.lastIndex--;for(;a;)if(D||(k=""),D=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(function(L){return(c=L.call({lexer:h},a,f))?(a=a.substring(c.raw.length),f.push(c),!0):!1}))){if(c=this.tokenizer.escape(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.tag(a)){a=a.substring(c.raw.length),d=f[f.length-1],d&&c.type==="text"&&d.type==="text"?(d.raw+=c.raw,d.text+=c.text):f.push(c);continue}if(c=this.tokenizer.link(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.reflink(a,this.tokens.links)){a=a.substring(c.raw.length),d=f[f.length-1],d&&c.type==="text"&&d.type==="text"?(d.raw+=c.raw,d.text+=c.text):f.push(c);continue}if(c=this.tokenizer.emStrong(a,y,k)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.codespan(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.br(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.del(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.autolink(a,Wf)){a=a.substring(c.raw.length),f.push(c);continue}if(!this.state.inLink&&(c=this.tokenizer.url(a,Wf))){a=a.substring(c.raw.length),f.push(c);continue}if(v=a,this.options.extensions&&this.options.extensions.startInline&&function(){var L=1/0,T=a.slice(1),N=void 0;h.options.extensions.startInline.forEach(function(z){N=z.call({lexer:this},T),typeof N=="number"&&N>=0&&(L=Math.min(L,N))}),L<1/0&&L>=0&&(v=a.substring(0,L+1))}(),c=this.tokenizer.inlineText(v,vp)){a=a.substring(c.raw.length),c.raw.slice(-1)!=="_"&&(k=c.raw.slice(-1)),D=!0,d=f[f.length-1],d&&d.type==="text"?(d.raw+=c.raw,d.text+=c.text):f.push(c);continue}if(a){var B="Infinite loop on byte: "+a.charCodeAt(0);if(this.options.silent){console.error(B);break}else throw new Error(B)}}return f},Vh(o,null,[{key:"rules",get:function(){return{block:ce,inline:ne}}}]),o}(),uo=function(){function o(s){this.options=s||_e.defaults}var l=o.prototype;return l.code=function(a,f,h){var c=(f||"").match(/\S*/)[0];if(this.options.highlight){var d=this.options.highlight(a,c);d!=null&&d!==a&&(h=!0,a=d)}return a=a.replace(/\n$/,"")+` `,c?'
    '+(h?a:pt(a,!0))+`
    `:"
    "+(h?a:pt(a,!0))+`
    `},l.blockquote=function(a){return`
    @@ -73,15 +73,15 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `},l.tablerow=function(a){return` `+a+` `},l.tablecell=function(a,f){var h=f.header?"th":"td",c=f.align?"<"+h+' align="'+f.align+'">':"<"+h+">";return c+a+(" -`)},l.strong=function(a){return""+a+""},l.em=function(a){return""+a+""},l.codespan=function(a){return""+a+""},l.br=function(){return this.options.xhtml?"
    ":"
    "},l.del=function(a){return""+a+""},l.link=function(a,f,h){if(a=Hf(this.options.sanitize,this.options.baseUrl,a),a===null)return h;var c='
    ",c},l.image=function(a,f,h){if(a=Hf(this.options.sanitize,this.options.baseUrl,a),a===null)return h;var c=''+h+'":">",c},l.text=function(a){return a},o}(),dl=function(){function o(){}var l=o.prototype;return l.strong=function(a){return a},l.em=function(a){return a},l.codespan=function(a){return a},l.del=function(a){return a},l.html=function(a){return a},l.text=function(a){return a},l.link=function(a,f,h){return""+h},l.image=function(a,f,h){return""+h},l.br=function(){return""},o}(),hl=function(){function o(){this.seen={}}var l=o.prototype;return l.serialize=function(a){return a.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},l.getNextSafeSlug=function(a,f){var h=a,c=0;if(this.seen.hasOwnProperty(h)){c=this.seen[a];do c++,h=a+"-"+c;while(this.seen.hasOwnProperty(h))}return f||(this.seen[a]=c,this.seen[h]=0),h},l.slug=function(a,f){f===void 0&&(f={});var h=this.serialize(a);return this.getNextSafeSlug(h,f.dryrun)},o}(),yi=function(){function o(s){this.options=s||_e.defaults,this.options.renderer=this.options.renderer||new so,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new dl,this.slugger=new hl}o.parse=function(a,f){var h=new o(f);return h.parse(a)},o.parseInline=function(a,f){var h=new o(f);return h.parseInline(a)};var l=o.prototype;return l.parse=function(a,f){f===void 0&&(f=!0);var h="",c,d,v,y,x,D,k,F,B,L,T,N,z,O,I,W,G,X,de,j=a.length;for(c=0;c0&&I.tokens[0].type==="paragraph"?(I.tokens[0].text=X+" "+I.tokens[0].text,I.tokens[0].tokens&&I.tokens[0].tokens.length>0&&I.tokens[0].tokens[0].type==="text"&&(I.tokens[0].tokens[0].text=X+" "+I.tokens[0].tokens[0].text)):I.tokens.unshift({type:"text",text:X}):O+=X),O+=this.parse(I.tokens,z),B+=this.renderer.listitem(O,G,W);h+=this.renderer.list(B,T,N);continue}case"html":{h+=this.renderer.html(L.text);continue}case"paragraph":{h+=this.renderer.paragraph(this.parseInline(L.tokens));continue}case"text":{for(B=L.tokens?this.parseInline(L.tokens):L.text;c+1";if(l)return Promise.resolve(f);if(s){s(null,f);return}return f}if(l)return Promise.reject(a);if(s){s(a);return}throw a}}function Xf(o,l){return function(s,a,f){typeof a=="function"&&(f=a,a=null);var h=_t({},a);a=_t({},fe.defaults,h);var c=bp(a.silent,a.async,f);if(typeof s>"u"||s===null)return c(new Error("marked(): input parameter is undefined or null"));if(typeof s!="string")return c(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));if(gp(a),a.hooks&&(a.hooks.options=a),f){var d=a.highlight,v;try{a.hooks&&(s=a.hooks.preprocess(s)),v=o(s,a)}catch(F){return c(F)}var y=function(B){var L;if(!B)try{a.walkTokens&&fe.walkTokens(v,a.walkTokens),L=l(v,a),a.hooks&&(L=a.hooks.postprocess(L))}catch(T){B=T}return a.highlight=d,B?c(B):f(null,L)};if(!d||d.length<3||(delete a.highlight,!v.length))return y();var x=0;fe.walkTokens(v,function(F){F.type==="code"&&(x++,setTimeout(function(){d(F.text,F.lang,function(B,L){if(B)return y(B);L!=null&&L!==F.text&&(F.text=L,F.escaped=!0),x--,x===0&&y()})},0))}),x===0&&y();return}if(a.async)return Promise.resolve(a.hooks?a.hooks.preprocess(s):s).then(function(F){return o(F,a)}).then(function(F){return a.walkTokens?Promise.all(fe.walkTokens(F,a.walkTokens)).then(function(){return F}):F}).then(function(F){return l(F,a)}).then(function(F){return a.hooks?a.hooks.postprocess(F):F}).catch(c);try{a.hooks&&(s=a.hooks.preprocess(s));var D=o(s,a);a.walkTokens&&fe.walkTokens(D,a.walkTokens);var k=l(D,a);return a.hooks&&(k=a.hooks.postprocess(k)),k}catch(F){return c(F)}}}function fe(o,l,s){return Xf(bi.lex,yi.parse)(o,l,s)}fe.options=fe.setOptions=function(o){return fe.defaults=_t({},fe.defaults,o),rp(fe.defaults),fe};fe.getDefaults=cl;fe.defaults=_e.defaults;fe.use=function(){for(var o=fe.defaults.extensions||{renderers:{},childTokens:{}},l=arguments.length,s=new Array(l),a=0;a{"use strict";var xi=At();$u();tf();of();ll();sl();vf();xf();Df();Ef();Tf();al();var Ap=zf(),pl=Kf().marked,Qf=/Mac/.test(navigator.platform),Fp=new RegExp(/()+?/g),un={toggleBold:co,toggleItalic:ho,drawLink:So,toggleHeadingSmaller:fn,toggleHeadingBigger:vo,drawImage:Eo,toggleBlockquote:mo,toggleOrderedList:Co,toggleUnorderedList:wo,toggleCheckList:Do,toggleCodeBlock:go,togglePreview:Mo,toggleStrikethrough:po,toggleHeading1:bo,toggleHeading2:yo,toggleHeading3:xo,toggleHeading4:ml,toggleHeading5:vl,toggleHeading6:bl,cleanBlock:ko,drawTable:Ao,drawHorizontalRule:Fo,undo:To,redo:Lo,toggleSideBySide:wi,toggleFullScreen:jr},Tp={toggleBold:"Cmd-B",toggleItalic:"Cmd-I",drawLink:"Cmd-K",toggleHeadingSmaller:"Cmd-H",toggleHeadingBigger:"Shift-Cmd-H",toggleHeading1:"Ctrl+Alt+1",toggleHeading2:"Ctrl+Alt+2",toggleHeading3:"Ctrl+Alt+3",toggleHeading4:"Ctrl+Alt+4",toggleHeading5:"Ctrl+Alt+5",toggleHeading6:"Ctrl+Alt+6",cleanBlock:"Cmd-E",drawImage:"Cmd-Alt-I",toggleBlockquote:"Cmd-'",toggleOrderedList:"Cmd-Alt-L",toggleUnorderedList:"Cmd-L",toggleCheckList:"Shift-Cmd-L",toggleCodeBlock:"Cmd-Alt-C",togglePreview:"Cmd-P",toggleSideBySide:"F9",toggleFullScreen:"F11"},Lp=function(o){for(var l in un)if(un[l]===o)return l;return null},gl=function(){var o=!1;return function(l){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(l)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(l.substr(0,4)))&&(o=!0)}(navigator.userAgent||navigator.vendor||window.opera),o};function Mp(o){for(var l;(l=Fp.exec(o))!==null;){var s=l[0];if(s.indexOf("target=")===-1){var a=s.replace(/>$/,' target="_blank">');o=o.replace(s,a)}}return o}function Bp(o){for(var l=new DOMParser,s=l.parseFromString(o,"text/html"),a=s.getElementsByTagName("li"),f=0;f0){for(var F=document.createElement("i"),B=0;B"+a+""},l.em=function(a){return""+a+""},l.codespan=function(a){return""+a+""},l.br=function(){return this.options.xhtml?"
    ":"
    "},l.del=function(a){return""+a+""},l.link=function(a,f,h){if(a=Hf(this.options.sanitize,this.options.baseUrl,a),a===null)return h;var c='
    ",c},l.image=function(a,f,h){if(a=Hf(this.options.sanitize,this.options.baseUrl,a),a===null)return h;var c=''+h+'":">",c},l.text=function(a){return a},o}(),dl=function(){function o(){}var l=o.prototype;return l.strong=function(a){return a},l.em=function(a){return a},l.codespan=function(a){return a},l.del=function(a){return a},l.html=function(a){return a},l.text=function(a){return a},l.link=function(a,f,h){return""+h},l.image=function(a,f,h){return""+h},l.br=function(){return""},o}(),hl=function(){function o(){this.seen={}}var l=o.prototype;return l.serialize=function(a){return a.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},l.getNextSafeSlug=function(a,f){var h=a,c=0;if(this.seen.hasOwnProperty(h)){c=this.seen[a];do c++,h=a+"-"+c;while(this.seen.hasOwnProperty(h))}return f||(this.seen[a]=c,this.seen[h]=0),h},l.slug=function(a,f){f===void 0&&(f={});var h=this.serialize(a);return this.getNextSafeSlug(h,f.dryrun)},o}(),xi=function(){function o(s){this.options=s||_e.defaults,this.options.renderer=this.options.renderer||new uo,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new dl,this.slugger=new hl}o.parse=function(a,f){var h=new o(f);return h.parse(a)},o.parseInline=function(a,f){var h=new o(f);return h.parseInline(a)};var l=o.prototype;return l.parse=function(a,f){f===void 0&&(f=!0);var h="",c,d,v,y,x,D,k,F,B,L,T,N,z,O,I,R,G,X,he,j=a.length;for(c=0;c0&&I.tokens[0].type==="paragraph"?(I.tokens[0].text=X+" "+I.tokens[0].text,I.tokens[0].tokens&&I.tokens[0].tokens.length>0&&I.tokens[0].tokens[0].type==="text"&&(I.tokens[0].tokens[0].text=X+" "+I.tokens[0].tokens[0].text)):I.tokens.unshift({type:"text",text:X}):O+=X),O+=this.parse(I.tokens,z),B+=this.renderer.listitem(O,G,R);h+=this.renderer.list(B,T,N);continue}case"html":{h+=this.renderer.html(L.text);continue}case"paragraph":{h+=this.renderer.paragraph(this.parseInline(L.tokens));continue}case"text":{for(B=L.tokens?this.parseInline(L.tokens):L.text;c+1";if(l)return Promise.resolve(f);if(s){s(null,f);return}return f}if(l)return Promise.reject(a);if(s){s(a);return}throw a}}function Xf(o,l){return function(s,a,f){typeof a=="function"&&(f=a,a=null);var h=_t({},a);a=_t({},fe.defaults,h);var c=bp(a.silent,a.async,f);if(typeof s>"u"||s===null)return c(new Error("marked(): input parameter is undefined or null"));if(typeof s!="string")return c(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));if(gp(a),a.hooks&&(a.hooks.options=a),f){var d=a.highlight,v;try{a.hooks&&(s=a.hooks.preprocess(s)),v=o(s,a)}catch(F){return c(F)}var y=function(B){var L;if(!B)try{a.walkTokens&&fe.walkTokens(v,a.walkTokens),L=l(v,a),a.hooks&&(L=a.hooks.postprocess(L))}catch(T){B=T}return a.highlight=d,B?c(B):f(null,L)};if(!d||d.length<3||(delete a.highlight,!v.length))return y();var x=0;fe.walkTokens(v,function(F){F.type==="code"&&(x++,setTimeout(function(){d(F.text,F.lang,function(B,L){if(B)return y(B);L!=null&&L!==F.text&&(F.text=L,F.escaped=!0),x--,x===0&&y()})},0))}),x===0&&y();return}if(a.async)return Promise.resolve(a.hooks?a.hooks.preprocess(s):s).then(function(F){return o(F,a)}).then(function(F){return a.walkTokens?Promise.all(fe.walkTokens(F,a.walkTokens)).then(function(){return F}):F}).then(function(F){return l(F,a)}).then(function(F){return a.hooks?a.hooks.postprocess(F):F}).catch(c);try{a.hooks&&(s=a.hooks.preprocess(s));var D=o(s,a);a.walkTokens&&fe.walkTokens(D,a.walkTokens);var k=l(D,a);return a.hooks&&(k=a.hooks.postprocess(k)),k}catch(F){return c(F)}}}function fe(o,l,s){return Xf(yi.lex,xi.parse)(o,l,s)}fe.options=fe.setOptions=function(o){return fe.defaults=_t({},fe.defaults,o),rp(fe.defaults),fe};fe.getDefaults=cl;fe.defaults=_e.defaults;fe.use=function(){for(var o=fe.defaults.extensions||{renderers:{},childTokens:{}},l=arguments.length,s=new Array(l),a=0;a{"use strict";var wi=At();$u();tf();of();ll();sl();vf();xf();Df();Ef();Tf();al();var Ap=zf(),pl=Kf().marked,Qf=/Mac/.test(navigator.platform),Fp=new RegExp(/()+?/g),fn={toggleBold:ho,toggleItalic:po,drawLink:Eo,toggleHeadingSmaller:cn,toggleHeadingBigger:bo,drawImage:Ao,toggleBlockquote:vo,toggleOrderedList:Do,toggleUnorderedList:Co,toggleCheckList:ko,toggleCodeBlock:mo,togglePreview:Bo,toggleStrikethrough:go,toggleHeading1:yo,toggleHeading2:xo,toggleHeading3:wo,toggleHeading4:ml,toggleHeading5:vl,toggleHeading6:bl,cleanBlock:So,drawTable:Fo,drawHorizontalRule:To,undo:Lo,redo:Mo,toggleSideBySide:Ci,toggleFullScreen:jr},Tp={toggleBold:"Cmd-B",toggleItalic:"Cmd-I",drawLink:"Cmd-K",toggleHeadingSmaller:"Cmd-H",toggleHeadingBigger:"Shift-Cmd-H",toggleHeading1:"Ctrl+Alt+1",toggleHeading2:"Ctrl+Alt+2",toggleHeading3:"Ctrl+Alt+3",toggleHeading4:"Ctrl+Alt+4",toggleHeading5:"Ctrl+Alt+5",toggleHeading6:"Ctrl+Alt+6",cleanBlock:"Cmd-E",drawImage:"Cmd-Alt-I",toggleBlockquote:"Cmd-'",toggleOrderedList:"Cmd-Alt-L",toggleUnorderedList:"Cmd-L",toggleCheckList:"Shift-Cmd-L",toggleCodeBlock:"Cmd-Alt-C",togglePreview:"Cmd-P",toggleSideBySide:"F9",toggleFullScreen:"F11"},Lp=function(o){for(var l in fn)if(fn[l]===o)return l;return null},gl=function(){var o=!1;return function(l){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(l)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(l.substr(0,4)))&&(o=!0)}(navigator.userAgent||navigator.vendor||window.opera),o};function Mp(o){for(var l;(l=Fp.exec(o))!==null;){var s=l[0];if(s.indexOf("target=")===-1){var a=s.replace(/>$/,' target="_blank">');o=o.replace(s,a)}}return o}function Bp(o){for(var l=new DOMParser,s=l.parseFromString(o,"text/html"),a=s.getElementsByTagName("li"),f=0;f0){for(var F=document.createElement("i"),B=0;B=0&&(x=c.getLineHandle(k),!s(x));k--);var N=c.getTokenAt({line:k,ch:1}),z=a(N).fencedChars,O,I,W,G;s(c.getLineHandle(d.line))?(O="",I=d.line):s(c.getLineHandle(d.line-1))?(O="",I=d.line-1):(O=z+` -`,I=d.line),s(c.getLineHandle(v.line))?(W="",G=v.line,v.ch===0&&(G+=1)):v.ch!==0&&s(c.getLineHandle(v.line+1))?(W="",G=v.line+1):(W=z+` -`,G=v.line+1),v.ch===0&&(G-=1),c.operation(function(){c.replaceRange(W,{line:G,ch:0},{line:G+(W?0:1),ch:0}),c.replaceRange(O,{line:I,ch:0},{line:I+(O?0:1),ch:0})}),c.setSelection({line:I+(O?1:0),ch:0},{line:G+(O?1:-1),ch:0}),c.focus()}else{var X=d.line;if(s(c.getLineHandle(d.line))&&(f(c,d.line+1)==="fenced"?(k=d.line,X=d.line+1):(F=d.line,X=d.line-1)),k===void 0)for(k=X;k>=0&&(x=c.getLineHandle(k),!s(x));k--);if(F===void 0)for(B=c.lineCount(),F=X;F=0;k--)if(x=c.getLineHandle(k),!x.text.match(/^\s*$/)&&f(c,k,x)!=="indented"){k+=1;break}for(B=c.lineCount(),F=d.line;F\s+/,"unordered-list":a,"ordered-list":a,"check-list":/^(\s*)(- \[[ xX]])(\s+)/},y=function(N,z){var O={quote:">","unordered-list":s,"ordered-list":"%%i.","check-list":"- [ ]"};return O[N].replace("%%i",z)},x=function(N,z){var O={quote:">","unordered-list":"\\"+s,"ordered-list":"\\d+.","check-list":"- \\[[ xX]]"},I=new RegExp(O[N]);return z&&I.test(z)},D=function(N,z,O){var I=a.exec(z),W=y(N,k);return I!==null?(x(N,I[2])&&(W=""),z=I[1]+W+I[3]+z.replace(f,"").replace(v[N],"$1")):O==!1&&(z=W+" "+z),z},k=1,F=["unordered-list","ordered-list","check-list"],B=Object.keys(h)[0];if(!F.includes(B)){var L=o.getLine(c.line);/^\s*- \[[ xX]]\s/.test(L)?B="check-list":/^\s*\d+\.\s/.test(L)?B="ordered-list":/^\s*[*\-+]\s/.test(L)&&(B="unordered-list")}for(var T=c.line;T<=d.line;T++)(function(N){var z=o.getLine(N);h[l]?z=z.replace(v[l],"$1"):F.includes(B)&&F.includes(l)?(z=z.replace(v[B],"$1"),z=D(l,z,!1),k+=1):(z=D(l,z,!1),k+=1),o.replaceRange(z,{line:N,ch:0},{line:N,ch:99999999999999})})(T);o.focus()}}function ec(o,l,s,a){if(!(!o.codemirror||o.isPreviewActive())){var f=o.codemirror,h=Sr(f),c=h[l];if(!c){Gr(f,c,s,a);return}var d=f.getCursor("start"),v=f.getCursor("end"),y=f.getLine(d.line),x=y.slice(0,d.ch),D=y.slice(d.ch);l=="link"?x=x.replace(/(.*)[^!]\[/,"$1"):l=="image"&&(x=x.replace(/(.*)!\[$/,"$1")),D=D.replace(/]\(.*?\)/,""),f.replaceRange(x+D,{line:d.line,ch:0},{line:d.line,ch:99999999999999}),d.ch-=s[0].length,d!==v&&(v.ch-=s[0].length),f.setSelection(d,v),f.focus()}}function xl(o,l,s,a){if(!(!o.codemirror||o.isPreviewActive())){a=typeof a>"u"?s:a;var f=o.codemirror,h=Sr(f),c,d=s,v=a,y=f.getCursor("start"),x=f.getCursor("end");h[l]?(c=f.getLine(y.line),d=c.slice(0,y.ch),v=c.slice(y.ch),l=="bold"?(d=d.replace(/(\*\*|__)(?![\s\S]*(\*\*|__))/,""),v=v.replace(/(\*\*|__)/,"")):l=="italic"?(d=d.replace(/(\*|_)(?![\s\S]*(\*|_))/,""),v=v.replace(/(\*|_)/,"")):l=="strikethrough"&&(d=d.replace(/(\*\*|~~)(?![\s\S]*(\*\*|~~))/,""),v=v.replace(/(\*\*|~~)/,"")),f.replaceRange(d+v,{line:y.line,ch:0},{line:y.line,ch:99999999999999}),l=="bold"||l=="strikethrough"?(y.ch-=2,y!==x&&(x.ch-=2)):l=="italic"&&(y.ch-=1,y!==x&&(x.ch-=1))):(c=f.getSelection(),l=="bold"?(c=c.split("**").join(""),c=c.split("__").join("")):l=="italic"?(c=c.split("*").join(""),c=c.split("_").join("")):l=="strikethrough"&&(c=c.split("~~").join("")),f.replaceSelection(d+c+v),y.ch+=s.length,x.ch=y.ch+c.length),f.setSelection(y,x),f.focus()}}function Op(o){if(!o.getWrapperElement().lastChild.classList.contains("editor-preview-active"))for(var l=o.getCursor("start"),s=o.getCursor("end"),a,f=l.line;f<=s.line;f++)a=o.getLine(f),a=a.replace(/^[ ]*([# ]+|\*|-|[> ]+|[0-9]+(.|\)))[ ]*/,""),o.replaceRange(a,{line:f,ch:0},{line:f,ch:99999999999999})}function fo(o,l){if(Math.abs(o)<1024)return""+o+l[0];var s=0;do o/=1024,++s;while(Math.abs(o)>=1024&&s=19968?a+=s[f].length:a+=1;return a}var Be={bold:"fa fa-bold",italic:"fa fa-italic",strikethrough:"fa fa-strikethrough",heading:"fa fa-header fa-heading","heading-smaller":"fa fa-header fa-heading header-smaller","heading-bigger":"fa fa-header fa-heading header-bigger","heading-1":"fa fa-header fa-heading header-1","heading-2":"fa fa-header fa-heading header-2","heading-3":"fa fa-header fa-heading header-3",code:"fa fa-code",quote:"fa fa-quote-left","ordered-list":"fa fa-list-ol","unordered-list":"fa fa-list-ul","check-list":"fa fa-check-square-o","clean-block":"fa fa-eraser",link:"fa fa-link",image:"fa fa-image","upload-image":"fa fa-image",table:"fa fa-table","horizontal-rule":"fa fa-minus",preview:"fa fa-eye","side-by-side":"fa fa-columns",fullscreen:"fa fa-arrows-alt",guide:"fa fa-question-circle",undo:"fa fa-undo",redo:"fa fa-repeat fa-redo"},Ur={bold:{name:"bold",action:co,className:Be.bold,title:"Bold",default:!0},italic:{name:"italic",action:ho,className:Be.italic,title:"Italic",default:!0},strikethrough:{name:"strikethrough",action:po,className:Be.strikethrough,title:"Strikethrough"},heading:{name:"heading",action:fn,className:Be.heading,title:"Heading",default:!0},"heading-smaller":{name:"heading-smaller",action:fn,className:Be["heading-smaller"],title:"Smaller Heading"},"heading-bigger":{name:"heading-bigger",action:vo,className:Be["heading-bigger"],title:"Bigger Heading"},"heading-1":{name:"heading-1",action:bo,className:Be["heading-1"],title:"Big Heading"},"heading-2":{name:"heading-2",action:yo,className:Be["heading-2"],title:"Medium Heading"},"heading-3":{name:"heading-3",action:xo,className:Be["heading-3"],title:"Small Heading"},"separator-1":{name:"separator-1"},code:{name:"code",action:go,className:Be.code,title:"Code"},quote:{name:"quote",action:mo,className:Be.quote,title:"Quote",default:!0},"unordered-list":{name:"unordered-list",action:wo,className:Be["unordered-list"],title:"Generic List",default:!0},"ordered-list":{name:"ordered-list",action:Co,className:Be["ordered-list"],title:"Numbered List",default:!0},"check-list":{name:"check-list",action:Do,className:Be["check-list"],title:"Check List",default:!0},"clean-block":{name:"clean-block",action:ko,className:Be["clean-block"],title:"Clean block"},"separator-2":{name:"separator-2"},link:{name:"link",action:So,className:Be.link,title:"Create Link",default:!0},image:{name:"image",action:Eo,className:Be.image,title:"Insert Image",default:!0},"upload-image":{name:"upload-image",action:yl,className:Be["upload-image"],title:"Import an image"},table:{name:"table",action:Ao,className:Be.table,title:"Insert Table"},"horizontal-rule":{name:"horizontal-rule",action:Fo,className:Be["horizontal-rule"],title:"Insert Horizontal Line"},"separator-3":{name:"separator-3"},preview:{name:"preview",action:Mo,className:Be.preview,noDisable:!0,title:"Toggle Preview",default:!0},"side-by-side":{name:"side-by-side",action:wi,className:Be["side-by-side"],noDisable:!0,noMobile:!0,title:"Toggle Side by Side",default:!0},fullscreen:{name:"fullscreen",action:jr,className:Be.fullscreen,noDisable:!0,noMobile:!0,title:"Toggle Fullscreen",default:!0},"separator-4":{name:"separator-4"},guide:{name:"guide",action:"https://www.markdownguide.org/basic-syntax/",className:Be.guide,noDisable:!0,title:"Markdown Guide",default:!0},"separator-5":{name:"separator-5"},undo:{name:"undo",action:To,className:Be.undo,noDisable:!0,title:"Undo"},redo:{name:"redo",action:Lo,className:Be.redo,noDisable:!0,title:"Redo"}},Ip={link:["[","](#url#)"],image:["![","](#url#)"],uploadedImage:["![](#url#)",""],table:["",` +`+de;A&&Ae++,A&&Q.ch===0&&(te=de+` +`,Ae--),Gr(q,!1,[w,te]),q.setSelection({line:be,ch:0},{line:Ae,ch:0})}var c=o.codemirror,d=c.getCursor("start"),v=c.getCursor("end"),y=c.getTokenAt({line:d.line,ch:d.ch||1}),x=c.getLineHandle(d.line),D=f(c,d.line,x,y),k,F,B;if(D==="single"){var L=x.text.slice(0,d.ch).replace("`",""),T=x.text.slice(d.ch).replace("`","");c.replaceRange(L+T,{line:d.line,ch:0},{line:d.line,ch:99999999999999}),d.ch--,d!==v&&v.ch--,c.setSelection(d,v),c.focus()}else if(D==="fenced")if(d.line!==v.line||d.ch!==v.ch){for(k=d.line;k>=0&&(x=c.getLineHandle(k),!s(x));k--);var N=c.getTokenAt({line:k,ch:1}),z=a(N).fencedChars,O,I,R,G;s(c.getLineHandle(d.line))?(O="",I=d.line):s(c.getLineHandle(d.line-1))?(O="",I=d.line-1):(O=z+` +`,I=d.line),s(c.getLineHandle(v.line))?(R="",G=v.line,v.ch===0&&(G+=1)):v.ch!==0&&s(c.getLineHandle(v.line+1))?(R="",G=v.line+1):(R=z+` +`,G=v.line+1),v.ch===0&&(G-=1),c.operation(function(){c.replaceRange(R,{line:G,ch:0},{line:G+(R?0:1),ch:0}),c.replaceRange(O,{line:I,ch:0},{line:I+(O?0:1),ch:0})}),c.setSelection({line:I+(O?1:0),ch:0},{line:G+(O?1:-1),ch:0}),c.focus()}else{var X=d.line;if(s(c.getLineHandle(d.line))&&(f(c,d.line+1)==="fenced"?(k=d.line,X=d.line+1):(F=d.line,X=d.line-1)),k===void 0)for(k=X;k>=0&&(x=c.getLineHandle(k),!s(x));k--);if(F===void 0)for(B=c.lineCount(),F=X;F=0;k--)if(x=c.getLineHandle(k),!x.text.match(/^\s*$/)&&f(c,k,x)!=="indented"){k+=1;break}for(B=c.lineCount(),F=d.line;F\s+/,"unordered-list":a,"ordered-list":a,"check-list":/^(\s*)(- \[[ xX]])(\s+)/},y=function(N,z){var O={quote:">","unordered-list":s,"ordered-list":"%%i.","check-list":"- [ ]"};return O[N].replace("%%i",z)},x=function(N,z){var O={quote:">","unordered-list":"\\"+s,"ordered-list":"\\d+.","check-list":"- \\[[ xX]]"},I=new RegExp(O[N]);return z&&I.test(z)},D=function(N,z,O){var I=a.exec(z),R=y(N,k);return I!==null?(x(N,I[2])&&(R=""),z=I[1]+R+I[3]+z.replace(f,"").replace(v[N],"$1")):O==!1&&(z=R+" "+z),z},k=1,F=["unordered-list","ordered-list","check-list"],B=Object.keys(h)[0];if(!F.includes(B)){var L=o.getLine(c.line);/^\s*- \[[ xX]]\s/.test(L)?B="check-list":/^\s*\d+\.\s/.test(L)?B="ordered-list":/^\s*[*\-+]\s/.test(L)&&(B="unordered-list")}for(var T=c.line;T<=d.line;T++)(function(N){var z=o.getLine(N);h[l]?z=z.replace(v[l],"$1"):F.includes(B)&&F.includes(l)?(z=z.replace(v[B],"$1"),z=D(l,z,!1),k+=1):(z=D(l,z,!1),k+=1),o.replaceRange(z,{line:N,ch:0},{line:N,ch:99999999999999})})(T);o.focus()}}function ec(o,l,s,a){if(!(!o.codemirror||o.isPreviewActive())){var f=o.codemirror,h=Sr(f),c=h[l];if(!c){Gr(f,c,s,a);return}var d=f.getCursor("start"),v=f.getCursor("end"),y=f.getLine(d.line),x=y.slice(0,d.ch),D=y.slice(d.ch);l=="link"?x=x.replace(/(.*)[^!]\[/,"$1"):l=="image"&&(x=x.replace(/(.*)!\[$/,"$1")),D=D.replace(/]\(.*?\)/,""),f.replaceRange(x+D,{line:d.line,ch:0},{line:d.line,ch:99999999999999}),d.ch-=s[0].length,d!==v&&(v.ch-=s[0].length),f.setSelection(d,v),f.focus()}}function xl(o,l,s,a){if(!(!o.codemirror||o.isPreviewActive())){a=typeof a>"u"?s:a;var f=o.codemirror,h=Sr(f),c,d=s,v=a,y=f.getCursor("start"),x=f.getCursor("end");h[l]?(c=f.getLine(y.line),d=c.slice(0,y.ch),v=c.slice(y.ch),l=="bold"?(d=d.replace(/(\*\*|__)(?![\s\S]*(\*\*|__))/,""),v=v.replace(/(\*\*|__)/,"")):l=="italic"?(d=d.replace(/(\*|_)(?![\s\S]*(\*|_))/,""),v=v.replace(/(\*|_)/,"")):l=="strikethrough"&&(d=d.replace(/(\*\*|~~)(?![\s\S]*(\*\*|~~))/,""),v=v.replace(/(\*\*|~~)/,"")),f.replaceRange(d+v,{line:y.line,ch:0},{line:y.line,ch:99999999999999}),l=="bold"||l=="strikethrough"?(y.ch-=2,y!==x&&(x.ch-=2)):l=="italic"&&(y.ch-=1,y!==x&&(x.ch-=1))):(c=f.getSelection(),l=="bold"?(c=c.split("**").join(""),c=c.split("__").join("")):l=="italic"?(c=c.split("*").join(""),c=c.split("_").join("")):l=="strikethrough"&&(c=c.split("~~").join("")),f.replaceSelection(d+c+v),y.ch+=s.length,x.ch=y.ch+c.length),f.setSelection(y,x),f.focus()}}function Op(o){if(!o.getWrapperElement().lastChild.classList.contains("editor-preview-active"))for(var l=o.getCursor("start"),s=o.getCursor("end"),a,f=l.line;f<=s.line;f++)a=o.getLine(f),a=a.replace(/^[ ]*([# ]+|\*|-|[> ]+|[0-9]+(.|\)))[ ]*/,""),o.replaceRange(a,{line:f,ch:0},{line:f,ch:99999999999999})}function co(o,l){if(Math.abs(o)<1024)return""+o+l[0];var s=0;do o/=1024,++s;while(Math.abs(o)>=1024&&s=19968?a+=s[f].length:a+=1;return a}var Be={bold:"fa fa-bold",italic:"fa fa-italic",strikethrough:"fa fa-strikethrough",heading:"fa fa-header fa-heading","heading-smaller":"fa fa-header fa-heading header-smaller","heading-bigger":"fa fa-header fa-heading header-bigger","heading-1":"fa fa-header fa-heading header-1","heading-2":"fa fa-header fa-heading header-2","heading-3":"fa fa-header fa-heading header-3",code:"fa fa-code",quote:"fa fa-quote-left","ordered-list":"fa fa-list-ol","unordered-list":"fa fa-list-ul","check-list":"fa fa-check-square-o","clean-block":"fa fa-eraser",link:"fa fa-link",image:"fa fa-image","upload-image":"fa fa-image",table:"fa fa-table","horizontal-rule":"fa fa-minus",preview:"fa fa-eye","side-by-side":"fa fa-columns",fullscreen:"fa fa-arrows-alt",guide:"fa fa-question-circle",undo:"fa fa-undo",redo:"fa fa-repeat fa-redo"},Ur={bold:{name:"bold",action:ho,className:Be.bold,title:"Bold",default:!0},italic:{name:"italic",action:po,className:Be.italic,title:"Italic",default:!0},strikethrough:{name:"strikethrough",action:go,className:Be.strikethrough,title:"Strikethrough"},heading:{name:"heading",action:cn,className:Be.heading,title:"Heading",default:!0},"heading-smaller":{name:"heading-smaller",action:cn,className:Be["heading-smaller"],title:"Smaller Heading"},"heading-bigger":{name:"heading-bigger",action:bo,className:Be["heading-bigger"],title:"Bigger Heading"},"heading-1":{name:"heading-1",action:yo,className:Be["heading-1"],title:"Big Heading"},"heading-2":{name:"heading-2",action:xo,className:Be["heading-2"],title:"Medium Heading"},"heading-3":{name:"heading-3",action:wo,className:Be["heading-3"],title:"Small Heading"},"separator-1":{name:"separator-1"},code:{name:"code",action:mo,className:Be.code,title:"Code"},quote:{name:"quote",action:vo,className:Be.quote,title:"Quote",default:!0},"unordered-list":{name:"unordered-list",action:Co,className:Be["unordered-list"],title:"Generic List",default:!0},"ordered-list":{name:"ordered-list",action:Do,className:Be["ordered-list"],title:"Numbered List",default:!0},"check-list":{name:"check-list",action:ko,className:Be["check-list"],title:"Check List",default:!0},"clean-block":{name:"clean-block",action:So,className:Be["clean-block"],title:"Clean block"},"separator-2":{name:"separator-2"},link:{name:"link",action:Eo,className:Be.link,title:"Create Link",default:!0},image:{name:"image",action:Ao,className:Be.image,title:"Insert Image",default:!0},"upload-image":{name:"upload-image",action:yl,className:Be["upload-image"],title:"Import an image"},table:{name:"table",action:Fo,className:Be.table,title:"Insert Table"},"horizontal-rule":{name:"horizontal-rule",action:To,className:Be["horizontal-rule"],title:"Insert Horizontal Line"},"separator-3":{name:"separator-3"},preview:{name:"preview",action:Bo,className:Be.preview,noDisable:!0,title:"Toggle Preview",default:!0},"side-by-side":{name:"side-by-side",action:Ci,className:Be["side-by-side"],noDisable:!0,noMobile:!0,title:"Toggle Side by Side",default:!0},fullscreen:{name:"fullscreen",action:jr,className:Be.fullscreen,noDisable:!0,noMobile:!0,title:"Toggle Fullscreen",default:!0},"separator-4":{name:"separator-4"},guide:{name:"guide",action:"https://www.markdownguide.org/basic-syntax/",className:Be.guide,noDisable:!0,title:"Markdown Guide",default:!0},"separator-5":{name:"separator-5"},undo:{name:"undo",action:Lo,className:Be.undo,noDisable:!0,title:"Undo"},redo:{name:"redo",action:Mo,className:Be.redo,noDisable:!0,title:"Redo"}},Ip={link:["[","](#url#)"],image:["![","](#url#)"],uploadedImage:["![](#url#)",""],table:["",` | Column 1 | Column 2 | Column 3 | | -------- | -------- | -------- | @@ -92,7 +92,7 @@ Please report this to https://github.com/markedjs/marked.`,o){var f="

    An error ----- `]},Hp={link:"URL for the link:",image:"URL of the image:"},Pp={locale:"en-US",format:{hour:"2-digit",minute:"2-digit"}},qp={bold:"**",code:"```",italic:"*"},Rp={sbInit:"Attach files by drag and dropping or pasting from clipboard.",sbOnDragEnter:"Drop image to upload it.",sbOnDrop:"Uploading image #images_names#...",sbProgress:"Uploading #file_name#: #progress#%",sbOnUploaded:"Uploaded #image_name#",sizeUnits:" B, KB, MB"},Wp={noFileGiven:"You must select a file.",typeNotAllowed:"This image type is not allowed.",fileTooLarge:`Image #image_name# is too big (#image_size#). -Maximum file size is #image_max_size#.`,importError:"Something went wrong when uploading the image #image_name#."};function re(o){o=o||{},o.parent=this;var l=!0;if(o.autoDownloadFontAwesome===!1&&(l=!1),o.autoDownloadFontAwesome!==!0)for(var s=document.styleSheets,a=0;a-1&&(l=!1);if(l){var f=document.createElement("link");f.rel="stylesheet",f.href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css",document.getElementsByTagName("head")[0].appendChild(f)}if(o.element)this.element=o.element;else if(o.element===null){console.log("EasyMDE: Error. No element was found.");return}if(o.toolbar===void 0){o.toolbar=[];for(var h in Ur)Object.prototype.hasOwnProperty.call(Ur,h)&&(h.indexOf("separator-")!=-1&&o.toolbar.push("|"),(Ur[h].default===!0||o.showIcons&&o.showIcons.constructor===Array&&o.showIcons.indexOf(h)!=-1)&&o.toolbar.push(h))}if(Object.prototype.hasOwnProperty.call(o,"previewClass")||(o.previewClass="editor-preview"),Object.prototype.hasOwnProperty.call(o,"status")||(o.status=["autosave","lines","words","cursor"],o.uploadImage&&o.status.unshift("upload-image")),o.previewRender||(o.previewRender=function(d){return this.parent.markdown(d)}),o.parsingConfig=sr({highlightFormatting:!0},o.parsingConfig||{}),o.insertTexts=sr({},Ip,o.insertTexts||{}),o.promptTexts=sr({},Hp,o.promptTexts||{}),o.blockStyles=sr({},qp,o.blockStyles||{}),o.autosave!=null&&(o.autosave.timeFormat=sr({},Pp,o.autosave.timeFormat||{})),o.iconClassMap=sr({},Be,o.iconClassMap||{}),o.shortcuts=sr({},Tp,o.shortcuts||{}),o.maxHeight=o.maxHeight||void 0,o.direction=o.direction||"ltr",typeof o.maxHeight<"u"?o.minHeight=o.maxHeight:o.minHeight=o.minHeight||"300px",o.errorCallback=o.errorCallback||function(d){alert(d)},o.uploadImage=o.uploadImage||!1,o.imageMaxSize=o.imageMaxSize||2097152,o.imageAccept=o.imageAccept||"image/png, image/jpeg, image/gif, image/avif",o.imageTexts=sr({},Rp,o.imageTexts||{}),o.errorMessages=sr({},Wp,o.errorMessages||{}),o.imagePathAbsolute=o.imagePathAbsolute||!1,o.imageCSRFName=o.imageCSRFName||"csrfmiddlewaretoken",o.imageCSRFHeader=o.imageCSRFHeader||!1,o.imageInputName=o.imageInputName||"image",o.autosave!=null&&o.autosave.unique_id!=null&&o.autosave.unique_id!=""&&(o.autosave.uniqueId=o.autosave.unique_id),o.overlayMode&&o.overlayMode.combine===void 0&&(o.overlayMode.combine=!0),this.options=o,this.render(),o.initialValue&&(!this.options.autosave||this.options.autosave.foundSavedValue!==!0)&&this.value(o.initialValue),o.uploadImage){var c=this;this.codemirror.on("dragenter",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbOnDragEnter),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("dragend",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbInit),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("dragleave",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbInit),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("dragover",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbOnDragEnter),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("drop",function(d,v){v.stopPropagation(),v.preventDefault(),o.imageUploadFunction?c.uploadImagesUsingCustomFunction(o.imageUploadFunction,v.dataTransfer.files):c.uploadImages(v.dataTransfer.files)}),this.codemirror.on("paste",function(d,v){o.imageUploadFunction?c.uploadImagesUsingCustomFunction(o.imageUploadFunction,v.clipboardData.files):c.uploadImages(v.clipboardData.files)})}}re.prototype.uploadImages=function(o,l,s){if(o.length!==0){for(var a=[],f=0;f=2){var O=z[1];if(l.imagesPreviewHandler){var I=l.imagesPreviewHandler(z[1]);typeof I=="string"&&(O=I)}if(window.EMDEimagesCache[O])F(N,window.EMDEimagesCache[O]);else{window.EMDEimagesCache[O]={};var W=document.createElement("img");W.onload=function(){window.EMDEimagesCache[O]={naturalWidth:W.naturalWidth,naturalHeight:W.naturalHeight,url:O},F(N,window.EMDEimagesCache[O])},W.src=O}}}})}this.codemirror.on("update",function(){B()}),this.gui.sideBySide=this.createSideBySide(),this._rendered=this.element,(l.autofocus===!0||o.autofocus)&&this.codemirror.focus();var L=this.codemirror;setTimeout(function(){L.refresh()}.bind(L),0)};re.prototype.cleanup=function(){document.removeEventListener("keydown",this.documentOnKeyDown)};function rc(){if(typeof localStorage=="object")try{localStorage.setItem("smde_localStorage",1),localStorage.removeItem("smde_localStorage")}catch{return!1}else return!1;return!0}re.prototype.autosave=function(){if(rc()){var o=this;if(this.options.autosave.uniqueId==null||this.options.autosave.uniqueId==""){console.log("EasyMDE: You must set a uniqueId to use the autosave feature");return}this.options.autosave.binded!==!0&&(o.element.form!=null&&o.element.form!=null&&o.element.form.addEventListener("submit",function(){clearTimeout(o.autosaveTimeoutId),o.autosaveTimeoutId=void 0,localStorage.removeItem("smde_"+o.options.autosave.uniqueId)}),this.options.autosave.binded=!0),this.options.autosave.loaded!==!0&&(typeof localStorage.getItem("smde_"+this.options.autosave.uniqueId)=="string"&&localStorage.getItem("smde_"+this.options.autosave.uniqueId)!=""&&(this.codemirror.setValue(localStorage.getItem("smde_"+this.options.autosave.uniqueId)),this.options.autosave.foundSavedValue=!0),this.options.autosave.loaded=!0);var l=o.value();l!==""?localStorage.setItem("smde_"+this.options.autosave.uniqueId,l):localStorage.removeItem("smde_"+this.options.autosave.uniqueId);var s=document.getElementById("autosaved");if(s!=null&&s!=null&&s!=""){var a=new Date,f=new Intl.DateTimeFormat([this.options.autosave.timeFormat.locale,"en-US"],this.options.autosave.timeFormat.format).format(a),h=this.options.autosave.text==null?"Autosaved: ":this.options.autosave.text;s.innerHTML=h+f}}else console.log("EasyMDE: localStorage not available, cannot autosave")};re.prototype.clearAutosavedValue=function(){if(rc()){if(this.options.autosave==null||this.options.autosave.uniqueId==null||this.options.autosave.uniqueId==""){console.log("EasyMDE: You must set a uniqueId to clear the autosave value");return}localStorage.removeItem("smde_"+this.options.autosave.uniqueId)}else console.log("EasyMDE: localStorage not available, cannot autosave")};re.prototype.openBrowseFileWindow=function(o,l){var s=this,a=this.gui.toolbar.getElementsByClassName("imageInput")[0];a.click();function f(h){s.options.imageUploadFunction?s.uploadImagesUsingCustomFunction(s.options.imageUploadFunction,h.target.files):s.uploadImages(h.target.files,o,l),a.removeEventListener("change",f)}a.addEventListener("change",f)};re.prototype.uploadImage=function(o,l,s){var a=this;l=l||function(y){$f(a,y)};function f(v){a.updateStatusBar("upload-image",v),setTimeout(function(){a.updateStatusBar("upload-image",a.options.imageTexts.sbInit)},1e4),s&&typeof s=="function"&&s(v),a.options.errorCallback(v)}function h(v){var y=a.options.imageTexts.sizeUnits.split(",");return v.replace("#image_name#",o.name).replace("#image_size#",fo(o.size,y)).replace("#image_max_size#",fo(a.options.imageMaxSize,y))}if(o.size>this.options.imageMaxSize){f(h(this.options.errorMessages.fileTooLarge));return}var c=new FormData;c.append("image",o),a.options.imageCSRFToken&&!a.options.imageCSRFHeader&&c.append(a.options.imageCSRFName,a.options.imageCSRFToken);var d=new XMLHttpRequest;d.upload.onprogress=function(v){if(v.lengthComputable){var y=""+Math.round(v.loaded*100/v.total);a.updateStatusBar("upload-image",a.options.imageTexts.sbProgress.replace("#file_name#",o.name).replace("#progress#",y))}},d.open("POST",this.options.imageUploadEndpoint),a.options.imageCSRFToken&&a.options.imageCSRFHeader&&d.setRequestHeader(a.options.imageCSRFName,a.options.imageCSRFToken),d.onload=function(){try{var v=JSON.parse(this.responseText)}catch{console.error("EasyMDE: The server did not return a valid json."),f(h(a.options.errorMessages.importError));return}this.status===200&&v&&!v.error&&v.data&&v.data.filePath?l((a.options.imagePathAbsolute?"":window.location.origin+"/")+v.data.filePath):v.error&&v.error in a.options.errorMessages?f(h(a.options.errorMessages[v.error])):v.error?f(h(v.error)):(console.error("EasyMDE: Received an unexpected response after uploading the image."+this.status+" ("+this.statusText+")"),f(h(a.options.errorMessages.importError)))},d.onerror=function(v){console.error("EasyMDE: An unexpected error occurred when trying to upload the image."+v.target.status+" ("+v.target.statusText+")"),f(a.options.errorMessages.importError)},d.send(c)};re.prototype.uploadImageUsingCustomFunction=function(o,l){var s=this;function a(c){$f(s,c)}function f(c){var d=h(c);s.updateStatusBar("upload-image",d),setTimeout(function(){s.updateStatusBar("upload-image",s.options.imageTexts.sbInit)},1e4),s.options.errorCallback(d)}function h(c){var d=s.options.imageTexts.sizeUnits.split(",");return c.replace("#image_name#",l.name).replace("#image_size#",fo(l.size,d)).replace("#image_max_size#",fo(s.options.imageMaxSize,d))}o.apply(this,[l,a,f])};re.prototype.setPreviewMaxHeight=function(){var o=this.codemirror,l=o.getWrapperElement(),s=l.nextSibling,a=parseInt(window.getComputedStyle(l).paddingTop),f=parseInt(window.getComputedStyle(l).borderTopWidth),h=parseInt(this.options.maxHeight),c=h+a*2+f*2,d=c.toString()+"px";s.style.height=d};re.prototype.createSideBySide=function(){var o=this.codemirror,l=o.getWrapperElement(),s=l.nextSibling;if(!s||!s.classList.contains("editor-preview-side")){if(s=document.createElement("div"),s.className="editor-preview-side",this.options.previewClass)if(Array.isArray(this.options.previewClass))for(var a=0;a"&&(l=l.substring(1)),o)try{if(o.matches)return o.matches(l);if(o.msMatchesSelector)return o.msMatchesSelector(l);if(o.webkitMatchesSelector)return o.webkitMatchesSelector(l)}catch{return!1}return!1}}function mc(o){return o.host&&o!==document&&o.host.nodeType&&o.host!==o?o.host:o.parentNode}function Gt(o,l,s,a){if(o){s=s||document;do{if(l!=null&&(l[0]===">"?o.parentNode===s&&Ro(o,l):Ro(o,l))||a&&o===s)return o;if(o===s)break}while(o=mc(o))}return null}var lc=/\s+/g;function zt(o,l,s){if(o&&l)if(o.classList)o.classList[s?"add":"remove"](l);else{var a=(" "+o.className+" ").replace(lc," ").replace(" "+l+" "," ");o.className=(a+(s?" "+l:"")).replace(lc," ")}}function pe(o,l,s){var a=o&&o.style;if(a){if(s===void 0)return document.defaultView&&document.defaultView.getComputedStyle?s=document.defaultView.getComputedStyle(o,""):o.currentStyle&&(s=o.currentStyle),l===void 0?s:s[l];!(l in a)&&l.indexOf("webkit")===-1&&(l="-webkit-"+l),a[l]=s+(typeof s=="string"?"":"px")}}function Ei(o,l){var s="";if(typeof o=="string")s=o;else do{var a=pe(o,"transform");a&&a!=="none"&&(s=a+" "+s)}while(!l&&(o=o.parentNode));var f=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return f&&new f(s)}function vc(o,l,s){if(o){var a=o.getElementsByTagName(l),f=0,h=a.length;if(s)for(;f=h:c=f<=h,!c)return a;if(a===$t())break;a=Tr(a,!1)}return!1}function Ai(o,l,s,a){for(var f=0,h=0,c=o.children;h2&&arguments[2]!==void 0?arguments[2]:{},f=a.evt,h=jp(a,r0);xn.pluginEvent.bind(ge)(l,s,er({dragEl:$,parentEl:Ue,ghostEl:ye,rootEl:He,nextEl:Yr,lastDownEl:Io,cloneEl:Re,cloneHidden:Fr,dragStarted:cn,putSortable:ut,activeSortable:ge.active,originalEvent:f,oldIndex:Si,oldDraggableIndex:mn,newIndex:Nt,newDraggableIndex:Ar,hideGhostForTarget:Sc,unhideGhostForTarget:Ec,cloneNowHidden:function(){Fr=!0},cloneNowShown:function(){Fr=!1},dispatchSortableEvent:function(d){kt({sortable:s,name:d,originalEvent:f})}},h))};function kt(o){t0(er({putSortable:ut,cloneEl:Re,targetEl:$,rootEl:He,oldIndex:Si,oldDraggableIndex:mn,newIndex:Nt,newDraggableIndex:Ar},o))}var $,Ue,ye,He,Yr,Io,Re,Fr,Si,Nt,mn,Ar,_o,ut,ki=!1,Wo=!1,Uo=[],Xr,jt,Dl,kl,fc,cc,cn,Di,vn,bn=!1,zo=!1,Ho,gt,Sl=[],Ml=!1,jo=[],Xo=typeof document<"u",No=Nl,dc=yn||cr?"cssFloat":"float",i0=Xo&&!pc&&!Nl&&"draggable"in document.createElement("div"),Cc=function(){if(Xo){if(cr)return!1;var o=document.createElement("x");return o.style.cssText="pointer-events:auto",o.style.pointerEvents==="auto"}}(),Dc=function(l,s){var a=pe(l),f=parseInt(a.width)-parseInt(a.paddingLeft)-parseInt(a.paddingRight)-parseInt(a.borderLeftWidth)-parseInt(a.borderRightWidth),h=Ai(l,0,s),c=Ai(l,1,s),d=h&&pe(h),v=c&&pe(c),y=d&&parseInt(d.marginLeft)+parseInt(d.marginRight)+Ve(h).width,x=v&&parseInt(v.marginLeft)+parseInt(v.marginRight)+Ve(c).width;if(a.display==="flex")return a.flexDirection==="column"||a.flexDirection==="column-reverse"?"vertical":"horizontal";if(a.display==="grid")return a.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(h&&d.float&&d.float!=="none"){var D=d.float==="left"?"left":"right";return c&&(v.clear==="both"||v.clear===D)?"vertical":"horizontal"}return h&&(d.display==="block"||d.display==="flex"||d.display==="table"||d.display==="grid"||y>=f&&a[dc]==="none"||c&&a[dc]==="none"&&y+x>f)?"vertical":"horizontal"},n0=function(l,s,a){var f=a?l.left:l.top,h=a?l.right:l.bottom,c=a?l.width:l.height,d=a?s.left:s.top,v=a?s.right:s.bottom,y=a?s.width:s.height;return f===d||h===v||f+c/2===d+y/2},o0=function(l,s){var a;return Uo.some(function(f){var h=f[Tt].options.emptyInsertThreshold;if(!(!h||Ol(f))){var c=Ve(f),d=l>=c.left-h&&l<=c.right+h,v=s>=c.top-h&&s<=c.bottom+h;if(d&&v)return a=f}}),a},kc=function(l){function s(h,c){return function(d,v,y,x){var D=d.options.group.name&&v.options.group.name&&d.options.group.name===v.options.group.name;if(h==null&&(c||D))return!0;if(h==null||h===!1)return!1;if(c&&h==="clone")return h;if(typeof h=="function")return s(h(d,v,y,x),c)(d,v,y,x);var k=(c?d:v).options.group.name;return h===!0||typeof h=="string"&&h===k||h.join&&h.indexOf(k)>-1}}var a={},f=l.group;(!f||Ll(f)!="object")&&(f={name:f}),a.name=f.name,a.checkPull=s(f.pull,!0),a.checkPut=s(f.put),a.revertClone=f.revertClone,l.group=a},Sc=function(){!Cc&&ye&&pe(ye,"display","none")},Ec=function(){!Cc&&ye&&pe(ye,"display","")};Xo&&!pc&&document.addEventListener("click",function(o){if(Wo)return o.preventDefault(),o.stopPropagation&&o.stopPropagation(),o.stopImmediatePropagation&&o.stopImmediatePropagation(),Wo=!1,!1},!0);var Kr=function(l){if($){l=l.touches?l.touches[0]:l;var s=o0(l.clientX,l.clientY);if(s){var a={};for(var f in l)l.hasOwnProperty(f)&&(a[f]=l[f]);a.target=a.rootEl=s,a.preventDefault=void 0,a.stopPropagation=void 0,s[Tt]._onDragOver(a)}}},a0=function(l){$&&$.parentNode[Tt]._isOutsideThisEl(l.target)};function ge(o,l){if(!(o&&o.nodeType&&o.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(o));this.el=o,this.options=l=fr({},l),o[Tt]=this;var s={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(o.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Dc(o,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(c,d){c.setData("Text",d.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:ge.supportPointer!==!1&&"PointerEvent"in window&&(!pn||Nl),emptyInsertThreshold:5};xn.initializePlugins(this,o,s);for(var a in s)!(a in l)&&(l[a]=s[a]);kc(l);for(var f in this)f.charAt(0)==="_"&&typeof this[f]=="function"&&(this[f]=this[f].bind(this));this.nativeDraggable=l.forceFallback?!1:i0,this.nativeDraggable&&(this.options.touchStartThreshold=1),l.supportPointer?Se(o,"pointerdown",this._onTapStart):(Se(o,"mousedown",this._onTapStart),Se(o,"touchstart",this._onTapStart)),this.nativeDraggable&&(Se(o,"dragover",this),Se(o,"dragenter",this)),Uo.push(this.el),l.store&&l.store.get&&this.sort(l.store.get(this)||[]),fr(this,Vp())}ge.prototype={constructor:ge,_isOutsideThisEl:function(l){!this.el.contains(l)&&l!==this.el&&(Di=null)},_getDirection:function(l,s){return typeof this.options.direction=="function"?this.options.direction.call(this,l,s,$):this.options.direction},_onTapStart:function(l){if(l.cancelable){var s=this,a=this.el,f=this.options,h=f.preventOnFilter,c=l.type,d=l.touches&&l.touches[0]||l.pointerType&&l.pointerType==="touch"&&l,v=(d||l).target,y=l.target.shadowRoot&&(l.path&&l.path[0]||l.composedPath&&l.composedPath()[0])||v,x=f.filter;if(p0(a),!$&&!(/mousedown|pointerdown/.test(c)&&l.button!==0||f.disabled)&&!y.isContentEditable&&!(!this.nativeDraggable&&pn&&v&&v.tagName.toUpperCase()==="SELECT")&&(v=Gt(v,f.draggable,a,!1),!(v&&v.animated)&&Io!==v)){if(Si=It(v),mn=It(v,f.draggable),typeof x=="function"){if(x.call(this,l,v,this)){kt({sortable:s,rootEl:y,name:"filter",targetEl:v,toEl:a,fromEl:a}),Ft("filter",s,{evt:l}),h&&l.preventDefault();return}}else if(x&&(x=x.split(",").some(function(D){if(D=Gt(y,D.trim(),a,!1),D)return kt({sortable:s,rootEl:D,name:"filter",targetEl:v,fromEl:a,toEl:a}),Ft("filter",s,{evt:l}),!0}),x)){h&&l.preventDefault();return}f.handle&&!Gt(y,f.handle,a,!1)||this._prepareDragStart(l,d,v)}}},_prepareDragStart:function(l,s,a){var f=this,h=f.el,c=f.options,d=h.ownerDocument,v;if(a&&!$&&a.parentNode===h){var y=Ve(a);if(He=h,$=a,Ue=$.parentNode,Yr=$.nextSibling,Io=a,_o=c.group,ge.dragged=$,Xr={target:$,clientX:(s||l).clientX,clientY:(s||l).clientY},fc=Xr.clientX-y.left,cc=Xr.clientY-y.top,this._lastX=(s||l).clientX,this._lastY=(s||l).clientY,$.style["will-change"]="all",v=function(){if(Ft("delayEnded",f,{evt:l}),ge.eventCanceled){f._onDrop();return}f._disableDelayedDragEvents(),!ac&&f.nativeDraggable&&($.draggable=!0),f._triggerDragStart(l,s),kt({sortable:f,name:"choose",originalEvent:l}),zt($,c.chosenClass,!0)},c.ignore.split(",").forEach(function(x){vc($,x.trim(),El)}),Se(d,"dragover",Kr),Se(d,"mousemove",Kr),Se(d,"touchmove",Kr),c.supportPointer?(Se(d,"pointerup",f._onDrop),!this.nativeDraggable&&Se(d,"pointercancel",f._onDrop)):(Se(d,"mouseup",f._onDrop),Se(d,"touchend",f._onDrop),Se(d,"touchcancel",f._onDrop)),ac&&this.nativeDraggable&&(this.options.touchStartThreshold=4,$.draggable=!0),Ft("delayStart",this,{evt:l}),c.delay&&(!c.delayOnTouchOnly||s)&&(!this.nativeDraggable||!(yn||cr))){if(ge.eventCanceled){this._onDrop();return}c.supportPointer?(Se(d,"pointerup",f._disableDelayedDrag),Se(d,"pointercancel",f._disableDelayedDrag)):(Se(d,"mouseup",f._disableDelayedDrag),Se(d,"touchend",f._disableDelayedDrag),Se(d,"touchcancel",f._disableDelayedDrag)),Se(d,"mousemove",f._delayedDragTouchMoveHandler),Se(d,"touchmove",f._delayedDragTouchMoveHandler),c.supportPointer&&Se(d,"pointermove",f._delayedDragTouchMoveHandler),f._dragStartTimer=setTimeout(v,c.delay)}else v()}},_delayedDragTouchMoveHandler:function(l){var s=l.touches?l.touches[0]:l;Math.max(Math.abs(s.clientX-this._lastX),Math.abs(s.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){$&&El($),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var l=this.el.ownerDocument;ke(l,"mouseup",this._disableDelayedDrag),ke(l,"touchend",this._disableDelayedDrag),ke(l,"touchcancel",this._disableDelayedDrag),ke(l,"pointerup",this._disableDelayedDrag),ke(l,"pointercancel",this._disableDelayedDrag),ke(l,"mousemove",this._delayedDragTouchMoveHandler),ke(l,"touchmove",this._delayedDragTouchMoveHandler),ke(l,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(l,s){s=s||l.pointerType=="touch"&&l,!this.nativeDraggable||s?this.options.supportPointer?Se(document,"pointermove",this._onTouchMove):s?Se(document,"touchmove",this._onTouchMove):Se(document,"mousemove",this._onTouchMove):(Se($,"dragend",this),Se(He,"dragstart",this._onDragStart));try{document.selection?Po(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(l,s){if(ki=!1,He&&$){Ft("dragStarted",this,{evt:s}),this.nativeDraggable&&Se(document,"dragover",a0);var a=this.options;!l&&zt($,a.dragClass,!1),zt($,a.ghostClass,!0),ge.active=this,l&&this._appendGhost(),kt({sortable:this,name:"start",originalEvent:s})}else this._nulling()},_emulateDragOver:function(){if(jt){this._lastX=jt.clientX,this._lastY=jt.clientY,Sc();for(var l=document.elementFromPoint(jt.clientX,jt.clientY),s=l;l&&l.shadowRoot&&(l=l.shadowRoot.elementFromPoint(jt.clientX,jt.clientY),l!==s);)s=l;if($.parentNode[Tt]._isOutsideThisEl(l),s)do{if(s[Tt]){var a=void 0;if(a=s[Tt]._onDragOver({clientX:jt.clientX,clientY:jt.clientY,target:l,rootEl:s}),a&&!this.options.dragoverBubble)break}l=s}while(s=mc(s));Ec()}},_onTouchMove:function(l){if(Xr){var s=this.options,a=s.fallbackTolerance,f=s.fallbackOffset,h=l.touches?l.touches[0]:l,c=ye&&Ei(ye,!0),d=ye&&c&&c.a,v=ye&&c&&c.d,y=No&>&&uc(gt),x=(h.clientX-Xr.clientX+f.x)/(d||1)+(y?y[0]-Sl[0]:0)/(d||1),D=(h.clientY-Xr.clientY+f.y)/(v||1)+(y?y[1]-Sl[1]:0)/(v||1);if(!ge.active&&!ki){if(a&&Math.max(Math.abs(h.clientX-this._lastX),Math.abs(h.clientY-this._lastY))=0&&(kt({rootEl:Ue,name:"add",toEl:Ue,fromEl:He,originalEvent:l}),kt({sortable:this,name:"remove",toEl:Ue,originalEvent:l}),kt({rootEl:Ue,name:"sort",toEl:Ue,fromEl:He,originalEvent:l}),kt({sortable:this,name:"sort",toEl:Ue,originalEvent:l})),ut&&ut.save()):Nt!==Si&&Nt>=0&&(kt({sortable:this,name:"update",toEl:Ue,originalEvent:l}),kt({sortable:this,name:"sort",toEl:Ue,originalEvent:l})),ge.active&&((Nt==null||Nt===-1)&&(Nt=Si,Ar=mn),kt({sortable:this,name:"end",toEl:Ue,originalEvent:l}),this.save()))),this._nulling()},_nulling:function(){Ft("nulling",this),He=$=Ue=ye=Yr=Re=Io=Fr=Xr=jt=cn=Nt=Ar=Si=mn=Di=vn=ut=_o=ge.dragged=ge.ghost=ge.clone=ge.active=null;var l=this.el;jo.forEach(function(s){l.contains(s)&&(s.checked=!0)}),jo.length=Dl=kl=0},handleEvent:function(l){switch(l.type){case"drop":case"dragend":this._onDrop(l);break;case"dragenter":case"dragover":$&&(this._onDragOver(l),l0(l));break;case"selectstart":l.preventDefault();break}},toArray:function(){for(var l=[],s,a=this.el.children,f=0,h=a.length,c=this.options;ff.right+h||o.clientY>a.bottom&&o.clientX>a.left:o.clientY>f.bottom+h||o.clientX>a.right&&o.clientY>a.top}function c0(o,l,s,a,f,h,c,d){var v=a?o.clientY:o.clientX,y=a?s.height:s.width,x=a?s.top:s.left,D=a?s.bottom:s.right,k=!1;if(!c){if(d&&Hox+y*h/2:vD-Ho)return-vn}else if(v>x+y*(1-f)/2&&vD-y*h/2)?v>x+y/2?1:-1:0}function d0(o){return It($)0||D>0&&k0?"Converting "+l+" photo"+(l>1?"s":"")+"\u2026":"Uploading "+D+" photo"+(D>1?"s":"")+"\u2026",s.details.open=!0):D>0?(s.summary.textContent="\u2713 "+D+" photo"+(D>1?"s":"")+" ready \u2014 tap to review",s.details.open=!1):(s.summary.textContent="Photos (1\u20136)",s.details.open=!0)}}function c(){h(),setTimeout(h,150),setTimeout(h,500)}function d(){var x=o.querySelector('button[type="submit"], input[type="submit"]');if(x&&(x.disabled=l>0),l>0)f("Converting "+l+" photo"+(l>1?"s":"")+"\u2026");else{var D=Mc();D&&/Converting/.test(D.textContent)&&f("")}h()}o.addEventListener("submit",function(x){l>0&&(x.preventDefault(),f("Hang on \u2014 a photo is still converting.","err"))},!0);function v(x){return function(D){var k=D&&D.file;return k?Ic(k).then(function(F){return F?(l++,d(),import("./heic-to-CN7JBE7H.js").then(function(B){var L=B.heicTo||B.default&&B.default.heicTo;return L({blob:k,type:"image/jpeg",quality:.85})}).then(function(B){var L=new File([B],y0(k.name),{type:"image/jpeg"});x.addFile(L)}).catch(function(){f("A photo couldn\u2019t be converted and was skipped \u2014 the others are fine.","err")}).then(function(){l--,d()}),!1):!0}):!0}}var y=0;(function x(){var D=window.GravFilePond&&window.GravFilePond.getInstances?window.GravFilePond.getInstances():[];if(!D.length){y++<120&&setTimeout(x,50);return}D.forEach(function(k){k&&!k._heicHooked&&(k._heicHooked=!0,k.setOptions({beforeAddFile:v(k),allowReorder:!0,itemInsertLocation:"after"}),a=k,["addfile","processfile","processfiles","removefile","error"].forEach(function(F){try{k.on(F,c)}catch{}}),h())})})()}function ft(o){return document.querySelector('[name="data['+o+']"]')}function C0(){var o=Array.prototype.slice.call(document.querySelectorAll(".advanced-field"));if(o.length){var l=[];if(o.forEach(function(h){var c=h.closest(".form-field");c&&l.indexOf(c)===-1&&l.push(c)}),!!l.length){var s=document.createElement("details");s.className="more-options";var a=document.createElement("summary");a.className="more-options__summary",a.textContent="More options",s.appendChild(a),l[0].parentNode.insertBefore(s,l[0]),l.forEach(function(h){s.appendChild(h)});var f=l.some(function(h){var c=h.querySelector('input[type="text"]');if(c&&c.value.trim())return!0;var d=h.querySelector('input[type="radio"]:checked');if(!d||!d.value)return!1;var v=h.querySelector('input[type="radio"][checked]');return v?d.value!==v.value:d.value!=="0"});f&&(s.open=!0)}}}var D0={0:"Sunny",1:"Partly cloudy",2:"Partly cloudy",3:"Cloudy",45:"Foggy",48:"Foggy",51:"Drizzle",53:"Drizzle",55:"Drizzle",56:"Drizzle",57:"Drizzle",61:"Rain",63:"Rain",65:"Rain",66:"Rain",67:"Rain",80:"Rain",81:"Rain",82:"Rain",71:"Snow",73:"Snow",75:"Snow",77:"Snow",85:"Snow",86:"Snow",95:"Thunderstorm",96:"Thunderstorm",99:"Thunderstorm"};function dr(o,l,s){o&&(o.className="form-status"+(s?" form-status--"+s:""),o.textContent=l||"")}function k0(){var o=document.getElementById("get-location"),l=document.getElementById("get-weather");if(!o&&!l)return;var s=document.getElementById("location-status"),a=document.getElementById("weather-status");function f(){var d=ft("lat"),v=ft("lng"),y=d?d.value.trim():"",x=v?v.value.trim():"";return y&&x?{lat:y,lng:x}:null}function h(){if(l){var d=!!f();l.disabled=!d,l.title=d?"":"Get location first"}}h();function c(d,v){var y=ft("location_city"),x=ft("location_country");if(!((!y||y.value.trim())&&(!x||x.value.trim()))){var D="https://api.bigdatacloud.net/data/reverse-geocode-client?latitude="+encodeURIComponent(d)+"&longitude="+encodeURIComponent(v)+"&localityLanguage=en";fetch(D).then(function(k){return k.json()}).then(function(k){var F=(k.city||k.locality||"").trim(),B=(k.countryName||"").trim();y&&!y.value.trim()&&F&&(y.value=F),x&&!x.value.trim()&&B&&(x.value=B);var L=[F,B].filter(Boolean).join(", ");L&&dr(s,"\u2713 Location captured \xB7 "+L,"ok")}).catch(function(){})}}o&&o.addEventListener("click",function(){if(!navigator.geolocation){dr(s,"Geolocation is not supported on this device.","err");return}o.classList.add("is-loading"),o.disabled=!0,dr(s,"Getting location\u2026"),navigator.geolocation.getCurrentPosition(function(d){var v=d.coords.latitude.toFixed(6),y=d.coords.longitude.toFixed(6),x=ft("lat"),D=ft("lng");x&&(x.value=v),D&&(D.value=y),o.classList.remove("is-loading"),o.disabled=!1,dr(s,"\u2713 Location captured \xB7 "+v+", "+y,"ok"),h(),c(v,y);var k=document.querySelector(".location-details");k&&k.open&&Hc()},function(d){o.classList.remove("is-loading"),o.disabled=!1,dr(s,"\u2717 "+(d&&d.message?d.message:"Could not get location")+" \u2014 enter coordinates manually if needed.","err")},{enableHighAccuracy:!0,timeout:15e3})}),l&&l.addEventListener("click",function(){var d=f();if(!d){dr(a,"Get location first, then fetch weather.","err");return}l.classList.add("is-loading"),l.disabled=!0,dr(a,"Fetching weather\u2026");var v="https://api.open-meteo.com/v1/forecast?latitude="+d.lat+"&longitude="+d.lng+"¤t=temperature_2m,weather_code&temperature_unit=celsius";fetch(v).then(function(y){return y.json()}).then(function(y){var x=Math.round(y.current.temperature_2m),D=D0[y.current.weather_code]||"Cloudy",k=ft("weather_temp_c"),F=ft("weather_desc");k&&(k.value=x),F&&(F.value=D),l.classList.remove("is-loading"),h(),dr(a,"\u2713 Weather set \xB7 "+D+" \xB7 "+x+"\xB0C (edit above if needed)","ok")}).catch(function(){l.classList.remove("is-loading"),h(),dr(a,"\u2717 Could not fetch weather \u2014 set it manually above.","err")})})}var Hc=function(){};function S0(o,l){var s=null;return function(){var a=arguments;clearTimeout(s),s=setTimeout(function(){o.apply(null,a)},l)}}function E0(o){return[o.name,o.admin1,o.country].filter(Boolean).join(", ")}function A0(){var o=ft("lat"),l=ft("lng");if(!o||!l)return;var s=o.closest(".form-field"),a=l.closest(".form-field");if(!s||!a)return;var f=ft("location_city"),h=ft("location_country"),c=h?h.closest(".form-field"):null,d=c||s,v=document.createElement("details");v.className="location-details";var y=document.createElement("summary");y.className="location-details__summary",y.textContent="More location details",v.appendChild(y);var x=document.createElement("div");x.className="location-details__body";var D=document.createElement("div");D.className="location-search-row";var k=document.createElement("button");k.type="button",k.id="lookup-coords",k.className="btn-action";var F="\u{1F50D} Look up coordinates";k.textContent=F,D.appendChild(k),x.appendChild(D);var B=document.createElement("p");B.id="location-search-hint",B.className="location-search-hint",B.setAttribute("role","status"),x.appendChild(B);var L=document.createElement("ul");L.id="location-search-results",L.className="location-search-results",x.appendChild(L);var T=document.createElement("div");T.id="location-map",T.className="location-map",x.appendChild(T),v.appendChild(x),d.parentNode.insertBefore(v,d.nextSibling),v.appendChild(s),v.appendChild(a);function N(H){return H===o?"location-lat-note":"location-lng-note"}function z(){[o,l].forEach(function(H){H.classList.add("location-field--mismatch"),H.setAttribute("aria-invalid","true");var Y=N(H),E=document.getElementById(Y);E||(E=document.createElement("span"),E.id=Y,E.className="location-field-note",E.setAttribute("role","status"),E.setAttribute("aria-live","polite"),E.textContent="Not reflected on the map yet.",H.parentNode.insertBefore(E,H.nextSibling)),H.setAttribute("aria-describedby",Y)})}function O(){[o,l].forEach(function(H){H.classList.remove("location-field--mismatch"),H.removeAttribute("aria-invalid"),H.removeAttribute("aria-describedby");var Y=document.getElementById(N(H));Y&&Y.parentNode&&Y.parentNode.removeChild(Y)})}var I=null;function W(){var H=parseFloat(o.value),Y=parseFloat(l.value),E=isFinite(H)&&isFinite(Y)&&H>=-90&&H<=90&&Y>=-180&&Y<=180;E?(O(),I&&I.setPin(H,Y)):(o.value.trim()||l.value.trim())&&z()}Hc=W;function G(H){o.value=H.lat.toFixed(6),l.value=H.lng.toFixed(6),O()}v.addEventListener("toggle",function(){v.open&&Lc(T,G).then(function(H){I=H,H.resize(),W()})}),o.addEventListener("blur",W),l.addEventListener("blur",W);var X=S0(W,400);o.addEventListener("input",X),l.addEventListener("input",X);function de(H){B.textContent=H||""}function j(){L.innerHTML=""}function oe(H){H.forEach(function(Y){var E=document.createElement("li"),q=document.createElement("button");q.type="button",q.textContent=E0(Y),q.addEventListener("click",function(){o.value=Number(Y.latitude).toFixed(6),l.value=Number(Y.longitude).toFixed(6),j(),W()}),E.appendChild(q),L.appendChild(E)})}k.addEventListener("click",function(){j();var H=f?f.value.trim():"",Y=h?h.value.trim():"";if(!H&&!Y){de("Enter a city or country first.");return}var E=H||Y;de(""),k.disabled=!0,k.textContent="Searching\u2026";var q="https://geocoding-api.open-meteo.com/v1/search?name="+encodeURIComponent(E)+"&count=10&language=en&format=json";fetch(q).then(function(R){return R.json()}).then(function(R){var Q=R&&R.results||[];if(!Q.length){de("No matches \u2014 try adding a country, or drag the pin on the map.");return}if(Y){var he=Y.toLowerCase(),be=function(Ee){return(Ee.admin1||"").toLowerCase().indexOf(he)!==-1||(Ee.country||"").toLowerCase().indexOf(he)!==-1};Q=Q.slice().sort(function(Ee,A){var w=be(Ee),te=be(A);return w===te?0:w?-1:1})}oe(Q)}).catch(function(){}).then(function(){k.disabled=!1,k.textContent=F})})}function F0(){var o=new Date;return o.setSeconds(0,0),o.setMinutes(o.getMinutes()-o.getTimezoneOffset()),o.toISOString().slice(0,16)}function T0(){var o={title:"Title",date:"Date & time",content:"Content"},l=document.querySelector('form[name="new-entry"]');if(!l)return;var s=ft("date");s&&!String(s.value).trim()&&(s.value=F0());function a(){l.querySelectorAll(".field-error").forEach(function(c){c.remove()}),l.querySelectorAll(".field-invalid").forEach(function(c){c.classList.remove("field-invalid")})}function f(c,d){c.classList.add("field-invalid");var v=document.createElement("span");v.className="field-error",v.textContent=d,c.parentNode.insertBefore(v,c.nextSibling)}function h(c){var d=l.querySelector(".photos-collapse"),v,y;if(d?(d.open=!0,y=d.querySelector(".photos-collapse__summary"),v=d):(v=document.querySelector(".filepond-root, .form-input-file"),y=v),!y)return v||null;var x=document.createElement("span");return x.className="field-error",x.textContent=c,y.insertAdjacentElement("afterend",x),v||y}l.addEventListener("submit",function(c){a();var d=null;!Yo&&document.querySelectorAll(".filepond--item").length<1&&(d=h("Add at least one photo.")),Object.keys(o).forEach(function(v){var y=ft(v);y&&!String(y.value).trim()&&(f(y,o[v]+" is required."),d||(d=y))}),d&&(c.preventDefault(),typeof d.focus=="function"&&d.focus(),d.scrollIntoView({behavior:"smooth",block:"center"}))})}var ql="intotheeast:new-entry-draft";function L0(o){return Array.prototype.slice.call(o.querySelectorAll('[name^="data["]')).filter(function(l){if(l.type==="file")return!1;var s=l.name;return s.indexOf("data[_json")!==0&&s.indexOf("data[photos")!==0})}function M0(){var o=document.querySelector(".filepond-root, .form-input-file");if(!(!o||!o.parentNode)&&!o.parentNode.querySelector(".photo-reauth-hint")){var l=document.createElement("p");l.className="photo-reauth-hint is-shown",l.textContent="Your text was restored \u2014 photos need re-selecting (they can\u2019t be saved in a draft).",o.parentNode.insertBefore(l,o.nextSibling)}}function B0(){var o=document.querySelector('form[name="new-entry"]');if(!o||Yo)return;if(document.querySelector(".notices.success")){try{localStorage.removeItem(ql)}catch{}return}function l(){var h={};L0(o).forEach(function(c){c.type==="radio"?c.checked&&(h[c.name]=c.value):h[c.name]=c.value});try{localStorage.setItem(ql,JSON.stringify(h))}catch{}}var s=null;try{s=localStorage.getItem(ql)}catch{s=null}if(s){var a=null;try{a=JSON.parse(s)}catch{a=null}if(a){var f=!1;Object.keys(a).forEach(function(h){var c=a[h];if(c!=null&&String(c).trim()&&(f=!0),h!=="data[content]"){var d=o.querySelectorAll('input[type="radio"][name="'+h+'"]');if(d.length){d.forEach(function(y){y.checked=y.value===c});return}var v=o.querySelector('[name="'+h+'"]');v&&v.type!=="file"&&(v.value=c)}}),window.postFormEditor&&a["data[content]"]!=null&&window.postFormEditor.value(a["data[content]"]),f&&M0()}}o.addEventListener("input",l),o.addEventListener("change",l),window.postFormEditor&&window.postFormEditor.codemirror.on("change",l)}function _0(){var o=document.querySelector(".post-form-wrap"),l=document.querySelector(".post-form-wrap .notices.success, .post-form-wrap .notices.green");if(!(!o||!l)){var s=document.createElement("div");s.className="post-success";var a=document.createElement("p");a.className="post-success__title",a.textContent="\u2713 Saved to your journal.",s.appendChild(a);var f=document.createElement("div");f.className="post-success__actions";var h=o.getAttribute("data-trip-url");if(h){var c=document.createElement("a");c.className="post-success__view",c.href=h,c.textContent="View your journal \u2192",f.appendChild(c)}var d=document.createElement("a");d.className="post-success__again",d.href=window.location.pathname,d.textContent="Post another",f.appendChild(d),s.appendChild(f),l.parentNode.insertBefore(s,l.nextSibling),["form",".form-action-row","#location-status","#weather-status"].forEach(function(v){var y=o.querySelector(v);y&&(y.style.display="none")}),l.scrollIntoView({behavior:"smooth",block:"start"})}}var Yo=!1;function Bc(o){return new URLSearchParams(window.location.search).get(o)}function hr(o,l){var s=ft(o);s&&(s.value=l==null?"":String(l))}function Rl(o,l){var s=l?"1":"0",a=document.querySelectorAll('[name="data['+o+']"]');Array.prototype.forEach.call(a,function(f){f.checked=String(f.value)===s})}function z0(o){var l=o==null?"":String(o);if(window.postFormEditor&&typeof window.postFormEditor.value=="function")window.postFormEditor.value(l);else{var s=ft("content");s&&(s.value=l)}}function _c(o,l){var s=o.querySelectorAll("input, textarea, select, button");Array.prototype.forEach.call(s,function(a){a.type==="file"||a.name&&a.name.indexOf("data[photos")===0||(a.disabled=l)}),window.postFormEditor&&window.postFormEditor.codemirror&&window.postFormEditor.codemirror.setOption("readOnly",l?"nocursor":!1)}function Wl(o,l){o&&(o.tagName==="INPUT"?o.value=l:o.textContent=l)}function N0(o,l){var s=o.querySelector(".post-edit-error");if(s){s.textContent=l;return}var a=document.createElement("div");a.className="post-edit-error",a.setAttribute("role","alert"),a.textContent=l;var f=o.querySelector("h1");f?f.insertAdjacentElement("afterend",a):o.insertBefore(a,o.firstChild)}var O0=/\.(jpe?g|png|webp|heic|heif|gif)$/i;function zc(o){var l=/(?:^|\/)photo-0*(\d+)\./i.exec(o);return l?parseInt(l[1],10):Number.MAX_SAFE_INTEGER}function I0(o,l){var s=zc(o),a=zc(l);return s!==a?s-a:ol?1:0}function Nc(o,l){var s=String(o||"photo"),a=s.lastIndexOf("."),f=(a>0?s.slice(0,a):s).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"photo",h=l?".jpg":a>0?s.slice(a).toLowerCase():".jpg",c=Date.now().toString(36)+Math.random().toString(36).slice(2,6);return f+"-"+c+h}function H0(o){var l=document.querySelector('form[name="new-entry"]');if(!l||!o)return;var s=o.split("/").filter(Boolean).pop();if(!s)return;var a=document.querySelector(".filepond-root, .form-input-file"),f=a?a.closest(".form-field"):null;f&&(f.style.display="none");var h=l.querySelector(".photos-collapse");h&&(h.style.display="none");var c=document.createElement("div");c.className="photo-editor",c.innerHTML='

    Photos

    ',f&&f.parentNode?f.parentNode.insertBefore(c,f):l.insertBefore(c,l.firstElementChild);var d=c.querySelector(".photo-editor__grid"),v=c.querySelector(".photo-editor__status"),y=c.querySelector(".photo-editor__add"),x=c.querySelector(".photo-editor__input"),D=[],k=null,F=!1,B=0;function L(H,Y){v.textContent=H||"",v.className="photo-editor__status gpx-status"+(Y?" error":"")}function T(H){F=H,y.disabled=H,Array.prototype.forEach.call(d.querySelectorAll(".photo-editor__del, .photo-editor__confirm-yes, .photo-editor__confirm-no"),function(Y){Y.disabled=H}),k&&k.option("disabled",H)}function N(){return fetch("/api/v1/pages"+o+"/media",{credentials:"include",headers:{Accept:"application/json"}}).then(function(H){if(!H.ok)throw new Error("HTTP "+H.status);return H.json()}).then(function(H){return(H&&H.data||[]).filter(function(Y){return Y&&typeof Y.filename=="string"&&O0.test(Y.filename)}).map(function(Y){return Y.filename}).sort(I0)})}function z(H){return wn("/api/v1/entry/"+encodeURIComponent(s)+"/photos/order",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({order:H})})}function O(H){if(D=(H||[]).slice(),k&&(k.destroy(),k=null),d.innerHTML="",!D.length){d.innerHTML='

    No photos yet \u2014 add some.

    ';return}var Y=++B;D.forEach(function(E){var q=document.createElement("div");q.className="photo-editor__cell",q.setAttribute("data-filename",E);var R=document.createElement("img");R.className="photo-editor__img",R.loading="lazy",R.alt=E,R.src=o+"/"+encodeURIComponent(E)+"?v="+Y;var Q=document.createElement("button");Q.type="button",Q.className="photo-editor__del",Q.setAttribute("aria-label","Delete "+E),Q.textContent="\u2715",Q.addEventListener("click",function(){X(q,E)}),q.appendChild(R),q.appendChild(Q),d.appendChild(q)}),D.length>1&&(k=new Fc(d,{animation:150,draggable:".photo-editor__cell",filter:".photo-editor__confirm",onEnd:G}))}function I(){return Array.prototype.map.call(d.querySelectorAll(".photo-editor__cell"),function(H){return H.getAttribute("data-filename")})}function W(H,Y){if(H.length!==Y.length)return!1;for(var E=0;EDelete?',H.appendChild(E),H.classList.add("is-confirming"),E.querySelector(".photo-editor__confirm-no").addEventListener("click",function(){H.classList.remove("is-confirming"),E.remove()}),E.querySelector(".photo-editor__confirm-yes").addEventListener("click",function(){E.querySelector(".photo-editor__confirm-yes").disabled=!0,E.querySelector(".photo-editor__confirm-no").disabled=!0,de(Y)})}}function de(H){var Y=D.slice(),E=D.filter(function(q){return q!==H});T(!0),L("Deleting\u2026"),wn("/api/v1/pages"+o+"/media/"+encodeURIComponent(H),{method:"DELETE"},[204,404]).then(function(){return(E.length?z(E):Promise.resolve()).then(N).then(function(q){L(""),O(q)},function(){L("Photo deleted, but refreshing the list failed \u2014 reload if it looks off.",!0),O(E)})},function(q){L(Pl(q,"Couldn\u2019t delete that photo. Try again."),!0),O(Y)}).then(function(){T(!1)})}function j(H){return Ic(H).then(function(Y){return Y?import("./heic-to-CN7JBE7H.js").then(function(E){var q=E.heicTo||E.default&&E.default.heicTo;return q({blob:H,type:"image/jpeg",quality:.85})}).then(function(E){return{blob:E,name:Nc(H.name,!0)}}):{blob:H,name:Nc(H.name,!1)}})}y.addEventListener("click",function(){F||x.click()}),x.addEventListener("change",function(){var H=Array.prototype.slice.call(x.files||[]);x.value="",H.length&&oe(H)});function oe(H){T(!0);var Y=H.length,E=0,q=0,R=!1,Q=D.slice(),he=Promise.resolve();H.forEach(function(be){he=he.then(function(){return E++,L("Uploading "+E+" of "+Y+"\u2026"),j(be).then(function(Ee){var A=new FormData;return A.append("file",Ee.blob,Ee.name),wn("/api/v1/pages"+o+"/media",{method:"POST",body:A})}).then(null,function(Ee){q++,Ee&&(Ee.status===401||Ee.status===403)&&(R=!0)})})}),he.then(function(){return L("Finishing\u2026"),N()}).then(function(be){var Ee=Q.filter(function(te){return be.indexOf(te)!==-1}),A=be.filter(function(te){return Q.indexOf(te)===-1}),w=Ee.concat(A);return w.length?z(w).catch(function(){return z(w)}).catch(function(){return Promise.all(A.map(function(te){return wn("/api/v1/pages"+o+"/media/"+encodeURIComponent(te),{method:"DELETE"},[204,404]).then(function(){return!0},function(){return!1})})).then(function(te){var Ce=new Error("reorder failed");throw Ce.rolledBack=!0,Ce.rollbackIncomplete=te.indexOf(!1)!==-1,Ce})}).then(N):(O([]),null)}).then(function(be){be&&O(be),q?L(R?"Couldn\u2019t add photos \u2014 your login session expired. Sign in again, then retry.":q+" photo"+(q>1?"s":"")+" couldn\u2019t be added.",!0):L("")}).catch(function(be){var Ee;return be&&be.rolledBack?Ee=be.rollbackIncomplete?"Couldn\u2019t finish adding photos and cleanup was incomplete \u2014 reload the page and check your photos.":"Couldn\u2019t finish adding photos \u2014 changes were rolled back. Try again.":Ee="Couldn\u2019t add photos. Please try again.",L(Ee,!0),N().then(O,function(){O(Q)})}).then(function(){T(!1)})}d.innerHTML='

    Loading photos\u2026

    ',N().then(O).catch(function(){L("Couldn\u2019t load photos.",!0),O([])})}function P0(){var o=document.querySelector('form[name="new-entry"]'),l=document.querySelector(".post-form-wrap");if(!(!o||!l)){var s=Bc("edit");if(s){Yo=!0;var a=l.querySelector("h1");a&&(a.textContent="Edit entry");var f=o.querySelector('button[type="submit"], input[type="submit"]'),h=f?f.tagName==="INPUT"?f.value:f.textContent:"Save changes";_c(o,!0),Wl(f,"Loading entry\u2026");var c=Bc("return")||l.getAttribute("data-trip-url")||"";o.setAttribute("action","/post?edit="+encodeURIComponent(s)+(c?"&return="+encodeURIComponent(c):"")),fetch("/api/v1/pages"+s,{credentials:"include",headers:{Accept:"application/json"}}).then(function(d){if(!d.ok){var v=new Error("HTTP "+d.status);throw v.status=d.status,v}return d.json()}).then(function(d){var v=d&&d.data||{},y=v.header||{};hr("title",y.title!=null?y.title:v.title),hr("date",y.date?String(y.date).replace(" ","T"):""),z0(v.content),hr("lat",y.lat),hr("lng",y.lng),hr("location_city",y.location_city),hr("location_country",y.location_country),hr("weather_desc",y.weather_desc),hr("weather_temp_c",y.weather_temp_c),hr("transport_mode",y.transport_mode),Rl("featured",y.featured),Rl("force_connect",y.force_connect),Rl("published",y.published!==void 0?y.published:v.published);var x=ft("edit_path");x&&(x.value=s+"/entry.md"),_c(o,!1),Wl(f,"Save changes");var D=o.querySelector(".more-options");D&&(D.open=!0),H0(s)}).catch(function(d){var v=d&&d.status===404?"This entry no longer exists \u2014 it may have been deleted. Head back to the journal.":"Sorry \u2014 this entry couldn\u2019t be loaded for editing. Check your connection and try again.";N0(l,v),Wl(f,h)})}}}function Oc(){window.postFormEditor=v0(),_0(),P0(),B0(),w0(),C0(),k0(),A0(),T0()}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Oc):Oc(); +Maximum file size is #image_max_size#.`,importError:"Something went wrong when uploading the image #image_name#."};function re(o){o=o||{},o.parent=this;var l=!0;if(o.autoDownloadFontAwesome===!1&&(l=!1),o.autoDownloadFontAwesome!==!0)for(var s=document.styleSheets,a=0;a-1&&(l=!1);if(l){var f=document.createElement("link");f.rel="stylesheet",f.href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css",document.getElementsByTagName("head")[0].appendChild(f)}if(o.element)this.element=o.element;else if(o.element===null){console.log("EasyMDE: Error. No element was found.");return}if(o.toolbar===void 0){o.toolbar=[];for(var h in Ur)Object.prototype.hasOwnProperty.call(Ur,h)&&(h.indexOf("separator-")!=-1&&o.toolbar.push("|"),(Ur[h].default===!0||o.showIcons&&o.showIcons.constructor===Array&&o.showIcons.indexOf(h)!=-1)&&o.toolbar.push(h))}if(Object.prototype.hasOwnProperty.call(o,"previewClass")||(o.previewClass="editor-preview"),Object.prototype.hasOwnProperty.call(o,"status")||(o.status=["autosave","lines","words","cursor"],o.uploadImage&&o.status.unshift("upload-image")),o.previewRender||(o.previewRender=function(d){return this.parent.markdown(d)}),o.parsingConfig=sr({highlightFormatting:!0},o.parsingConfig||{}),o.insertTexts=sr({},Ip,o.insertTexts||{}),o.promptTexts=sr({},Hp,o.promptTexts||{}),o.blockStyles=sr({},qp,o.blockStyles||{}),o.autosave!=null&&(o.autosave.timeFormat=sr({},Pp,o.autosave.timeFormat||{})),o.iconClassMap=sr({},Be,o.iconClassMap||{}),o.shortcuts=sr({},Tp,o.shortcuts||{}),o.maxHeight=o.maxHeight||void 0,o.direction=o.direction||"ltr",typeof o.maxHeight<"u"?o.minHeight=o.maxHeight:o.minHeight=o.minHeight||"300px",o.errorCallback=o.errorCallback||function(d){alert(d)},o.uploadImage=o.uploadImage||!1,o.imageMaxSize=o.imageMaxSize||2097152,o.imageAccept=o.imageAccept||"image/png, image/jpeg, image/gif, image/avif",o.imageTexts=sr({},Rp,o.imageTexts||{}),o.errorMessages=sr({},Wp,o.errorMessages||{}),o.imagePathAbsolute=o.imagePathAbsolute||!1,o.imageCSRFName=o.imageCSRFName||"csrfmiddlewaretoken",o.imageCSRFHeader=o.imageCSRFHeader||!1,o.imageInputName=o.imageInputName||"image",o.autosave!=null&&o.autosave.unique_id!=null&&o.autosave.unique_id!=""&&(o.autosave.uniqueId=o.autosave.unique_id),o.overlayMode&&o.overlayMode.combine===void 0&&(o.overlayMode.combine=!0),this.options=o,this.render(),o.initialValue&&(!this.options.autosave||this.options.autosave.foundSavedValue!==!0)&&this.value(o.initialValue),o.uploadImage){var c=this;this.codemirror.on("dragenter",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbOnDragEnter),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("dragend",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbInit),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("dragleave",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbInit),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("dragover",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbOnDragEnter),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("drop",function(d,v){v.stopPropagation(),v.preventDefault(),o.imageUploadFunction?c.uploadImagesUsingCustomFunction(o.imageUploadFunction,v.dataTransfer.files):c.uploadImages(v.dataTransfer.files)}),this.codemirror.on("paste",function(d,v){o.imageUploadFunction?c.uploadImagesUsingCustomFunction(o.imageUploadFunction,v.clipboardData.files):c.uploadImages(v.clipboardData.files)})}}re.prototype.uploadImages=function(o,l,s){if(o.length!==0){for(var a=[],f=0;f=2){var O=z[1];if(l.imagesPreviewHandler){var I=l.imagesPreviewHandler(z[1]);typeof I=="string"&&(O=I)}if(window.EMDEimagesCache[O])F(N,window.EMDEimagesCache[O]);else{window.EMDEimagesCache[O]={};var R=document.createElement("img");R.onload=function(){window.EMDEimagesCache[O]={naturalWidth:R.naturalWidth,naturalHeight:R.naturalHeight,url:O},F(N,window.EMDEimagesCache[O])},R.src=O}}}})}this.codemirror.on("update",function(){B()}),this.gui.sideBySide=this.createSideBySide(),this._rendered=this.element,(l.autofocus===!0||o.autofocus)&&this.codemirror.focus();var L=this.codemirror;setTimeout(function(){L.refresh()}.bind(L),0)};re.prototype.cleanup=function(){document.removeEventListener("keydown",this.documentOnKeyDown)};function rc(){if(typeof localStorage=="object")try{localStorage.setItem("smde_localStorage",1),localStorage.removeItem("smde_localStorage")}catch{return!1}else return!1;return!0}re.prototype.autosave=function(){if(rc()){var o=this;if(this.options.autosave.uniqueId==null||this.options.autosave.uniqueId==""){console.log("EasyMDE: You must set a uniqueId to use the autosave feature");return}this.options.autosave.binded!==!0&&(o.element.form!=null&&o.element.form!=null&&o.element.form.addEventListener("submit",function(){clearTimeout(o.autosaveTimeoutId),o.autosaveTimeoutId=void 0,localStorage.removeItem("smde_"+o.options.autosave.uniqueId)}),this.options.autosave.binded=!0),this.options.autosave.loaded!==!0&&(typeof localStorage.getItem("smde_"+this.options.autosave.uniqueId)=="string"&&localStorage.getItem("smde_"+this.options.autosave.uniqueId)!=""&&(this.codemirror.setValue(localStorage.getItem("smde_"+this.options.autosave.uniqueId)),this.options.autosave.foundSavedValue=!0),this.options.autosave.loaded=!0);var l=o.value();l!==""?localStorage.setItem("smde_"+this.options.autosave.uniqueId,l):localStorage.removeItem("smde_"+this.options.autosave.uniqueId);var s=document.getElementById("autosaved");if(s!=null&&s!=null&&s!=""){var a=new Date,f=new Intl.DateTimeFormat([this.options.autosave.timeFormat.locale,"en-US"],this.options.autosave.timeFormat.format).format(a),h=this.options.autosave.text==null?"Autosaved: ":this.options.autosave.text;s.innerHTML=h+f}}else console.log("EasyMDE: localStorage not available, cannot autosave")};re.prototype.clearAutosavedValue=function(){if(rc()){if(this.options.autosave==null||this.options.autosave.uniqueId==null||this.options.autosave.uniqueId==""){console.log("EasyMDE: You must set a uniqueId to clear the autosave value");return}localStorage.removeItem("smde_"+this.options.autosave.uniqueId)}else console.log("EasyMDE: localStorage not available, cannot autosave")};re.prototype.openBrowseFileWindow=function(o,l){var s=this,a=this.gui.toolbar.getElementsByClassName("imageInput")[0];a.click();function f(h){s.options.imageUploadFunction?s.uploadImagesUsingCustomFunction(s.options.imageUploadFunction,h.target.files):s.uploadImages(h.target.files,o,l),a.removeEventListener("change",f)}a.addEventListener("change",f)};re.prototype.uploadImage=function(o,l,s){var a=this;l=l||function(y){$f(a,y)};function f(v){a.updateStatusBar("upload-image",v),setTimeout(function(){a.updateStatusBar("upload-image",a.options.imageTexts.sbInit)},1e4),s&&typeof s=="function"&&s(v),a.options.errorCallback(v)}function h(v){var y=a.options.imageTexts.sizeUnits.split(",");return v.replace("#image_name#",o.name).replace("#image_size#",co(o.size,y)).replace("#image_max_size#",co(a.options.imageMaxSize,y))}if(o.size>this.options.imageMaxSize){f(h(this.options.errorMessages.fileTooLarge));return}var c=new FormData;c.append("image",o),a.options.imageCSRFToken&&!a.options.imageCSRFHeader&&c.append(a.options.imageCSRFName,a.options.imageCSRFToken);var d=new XMLHttpRequest;d.upload.onprogress=function(v){if(v.lengthComputable){var y=""+Math.round(v.loaded*100/v.total);a.updateStatusBar("upload-image",a.options.imageTexts.sbProgress.replace("#file_name#",o.name).replace("#progress#",y))}},d.open("POST",this.options.imageUploadEndpoint),a.options.imageCSRFToken&&a.options.imageCSRFHeader&&d.setRequestHeader(a.options.imageCSRFName,a.options.imageCSRFToken),d.onload=function(){try{var v=JSON.parse(this.responseText)}catch{console.error("EasyMDE: The server did not return a valid json."),f(h(a.options.errorMessages.importError));return}this.status===200&&v&&!v.error&&v.data&&v.data.filePath?l((a.options.imagePathAbsolute?"":window.location.origin+"/")+v.data.filePath):v.error&&v.error in a.options.errorMessages?f(h(a.options.errorMessages[v.error])):v.error?f(h(v.error)):(console.error("EasyMDE: Received an unexpected response after uploading the image."+this.status+" ("+this.statusText+")"),f(h(a.options.errorMessages.importError)))},d.onerror=function(v){console.error("EasyMDE: An unexpected error occurred when trying to upload the image."+v.target.status+" ("+v.target.statusText+")"),f(a.options.errorMessages.importError)},d.send(c)};re.prototype.uploadImageUsingCustomFunction=function(o,l){var s=this;function a(c){$f(s,c)}function f(c){var d=h(c);s.updateStatusBar("upload-image",d),setTimeout(function(){s.updateStatusBar("upload-image",s.options.imageTexts.sbInit)},1e4),s.options.errorCallback(d)}function h(c){var d=s.options.imageTexts.sizeUnits.split(",");return c.replace("#image_name#",l.name).replace("#image_size#",co(l.size,d)).replace("#image_max_size#",co(s.options.imageMaxSize,d))}o.apply(this,[l,a,f])};re.prototype.setPreviewMaxHeight=function(){var o=this.codemirror,l=o.getWrapperElement(),s=l.nextSibling,a=parseInt(window.getComputedStyle(l).paddingTop),f=parseInt(window.getComputedStyle(l).borderTopWidth),h=parseInt(this.options.maxHeight),c=h+a*2+f*2,d=c.toString()+"px";s.style.height=d};re.prototype.createSideBySide=function(){var o=this.codemirror,l=o.getWrapperElement(),s=l.nextSibling;if(!s||!s.classList.contains("editor-preview-side")){if(s=document.createElement("div"),s.className="editor-preview-side",this.options.previewClass)if(Array.isArray(this.options.previewClass))for(var a=0;a"&&(l=l.substring(1)),o)try{if(o.matches)return o.matches(l);if(o.msMatchesSelector)return o.msMatchesSelector(l);if(o.webkitMatchesSelector)return o.webkitMatchesSelector(l)}catch{return!1}return!1}}function mc(o){return o.host&&o!==document&&o.host.nodeType&&o.host!==o?o.host:o.parentNode}function Gt(o,l,s,a){if(o){s=s||document;do{if(l!=null&&(l[0]===">"?o.parentNode===s&&Wo(o,l):Wo(o,l))||a&&o===s)return o;if(o===s)break}while(o=mc(o))}return null}var lc=/\s+/g;function zt(o,l,s){if(o&&l)if(o.classList)o.classList[s?"add":"remove"](l);else{var a=(" "+o.className+" ").replace(lc," ").replace(" "+l+" "," ");o.className=(a+(s?" "+l:"")).replace(lc," ")}}function pe(o,l,s){var a=o&&o.style;if(a){if(s===void 0)return document.defaultView&&document.defaultView.getComputedStyle?s=document.defaultView.getComputedStyle(o,""):o.currentStyle&&(s=o.currentStyle),l===void 0?s:s[l];!(l in a)&&l.indexOf("webkit")===-1&&(l="-webkit-"+l),a[l]=s+(typeof s=="string"?"":"px")}}function Ai(o,l){var s="";if(typeof o=="string")s=o;else do{var a=pe(o,"transform");a&&a!=="none"&&(s=a+" "+s)}while(!l&&(o=o.parentNode));var f=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return f&&new f(s)}function vc(o,l,s){if(o){var a=o.getElementsByTagName(l),f=0,h=a.length;if(s)for(;f=h:c=f<=h,!c)return a;if(a===$t())break;a=Tr(a,!1)}return!1}function Fi(o,l,s,a){for(var f=0,h=0,c=o.children;h2&&arguments[2]!==void 0?arguments[2]:{},f=a.evt,h=jp(a,r0);wn.pluginEvent.bind(ge)(l,s,er({dragEl:$,parentEl:Ue,ghostEl:xe,rootEl:He,nextEl:Yr,lastDownEl:Ho,cloneEl:Re,cloneHidden:Fr,dragStarted:dn,putSortable:ut,activeSortable:ge.active,originalEvent:f,oldIndex:Ei,oldDraggableIndex:vn,newIndex:Nt,newDraggableIndex:Ar,hideGhostForTarget:Sc,unhideGhostForTarget:Ec,cloneNowHidden:function(){Fr=!0},cloneNowShown:function(){Fr=!1},dispatchSortableEvent:function(d){kt({sortable:s,name:d,originalEvent:f})}},h))};function kt(o){t0(er({putSortable:ut,cloneEl:Re,targetEl:$,rootEl:He,oldIndex:Ei,oldDraggableIndex:vn,newIndex:Nt,newDraggableIndex:Ar},o))}var $,Ue,xe,He,Yr,Ho,Re,Fr,Ei,Nt,vn,Ar,zo,ut,Si=!1,Uo=!1,jo=[],Xr,jt,Dl,kl,fc,cc,dn,ki,bn,yn=!1,No=!1,Po,gt,Sl=[],Ml=!1,Go=[],Ko=typeof document<"u",Oo=Nl,dc=xn||cr?"cssFloat":"float",i0=Ko&&!pc&&!Nl&&"draggable"in document.createElement("div"),Cc=function(){if(Ko){if(cr)return!1;var o=document.createElement("x");return o.style.cssText="pointer-events:auto",o.style.pointerEvents==="auto"}}(),Dc=function(l,s){var a=pe(l),f=parseInt(a.width)-parseInt(a.paddingLeft)-parseInt(a.paddingRight)-parseInt(a.borderLeftWidth)-parseInt(a.borderRightWidth),h=Fi(l,0,s),c=Fi(l,1,s),d=h&&pe(h),v=c&&pe(c),y=d&&parseInt(d.marginLeft)+parseInt(d.marginRight)+Ve(h).width,x=v&&parseInt(v.marginLeft)+parseInt(v.marginRight)+Ve(c).width;if(a.display==="flex")return a.flexDirection==="column"||a.flexDirection==="column-reverse"?"vertical":"horizontal";if(a.display==="grid")return a.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(h&&d.float&&d.float!=="none"){var D=d.float==="left"?"left":"right";return c&&(v.clear==="both"||v.clear===D)?"vertical":"horizontal"}return h&&(d.display==="block"||d.display==="flex"||d.display==="table"||d.display==="grid"||y>=f&&a[dc]==="none"||c&&a[dc]==="none"&&y+x>f)?"vertical":"horizontal"},n0=function(l,s,a){var f=a?l.left:l.top,h=a?l.right:l.bottom,c=a?l.width:l.height,d=a?s.left:s.top,v=a?s.right:s.bottom,y=a?s.width:s.height;return f===d||h===v||f+c/2===d+y/2},o0=function(l,s){var a;return jo.some(function(f){var h=f[Tt].options.emptyInsertThreshold;if(!(!h||Ol(f))){var c=Ve(f),d=l>=c.left-h&&l<=c.right+h,v=s>=c.top-h&&s<=c.bottom+h;if(d&&v)return a=f}}),a},kc=function(l){function s(h,c){return function(d,v,y,x){var D=d.options.group.name&&v.options.group.name&&d.options.group.name===v.options.group.name;if(h==null&&(c||D))return!0;if(h==null||h===!1)return!1;if(c&&h==="clone")return h;if(typeof h=="function")return s(h(d,v,y,x),c)(d,v,y,x);var k=(c?d:v).options.group.name;return h===!0||typeof h=="string"&&h===k||h.join&&h.indexOf(k)>-1}}var a={},f=l.group;(!f||Ll(f)!="object")&&(f={name:f}),a.name=f.name,a.checkPull=s(f.pull,!0),a.checkPut=s(f.put),a.revertClone=f.revertClone,l.group=a},Sc=function(){!Cc&&xe&&pe(xe,"display","none")},Ec=function(){!Cc&&xe&&pe(xe,"display","")};Ko&&!pc&&document.addEventListener("click",function(o){if(Uo)return o.preventDefault(),o.stopPropagation&&o.stopPropagation(),o.stopImmediatePropagation&&o.stopImmediatePropagation(),Uo=!1,!1},!0);var Kr=function(l){if($){l=l.touches?l.touches[0]:l;var s=o0(l.clientX,l.clientY);if(s){var a={};for(var f in l)l.hasOwnProperty(f)&&(a[f]=l[f]);a.target=a.rootEl=s,a.preventDefault=void 0,a.stopPropagation=void 0,s[Tt]._onDragOver(a)}}},a0=function(l){$&&$.parentNode[Tt]._isOutsideThisEl(l.target)};function ge(o,l){if(!(o&&o.nodeType&&o.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(o));this.el=o,this.options=l=fr({},l),o[Tt]=this;var s={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(o.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Dc(o,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(c,d){c.setData("Text",d.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:ge.supportPointer!==!1&&"PointerEvent"in window&&(!gn||Nl),emptyInsertThreshold:5};wn.initializePlugins(this,o,s);for(var a in s)!(a in l)&&(l[a]=s[a]);kc(l);for(var f in this)f.charAt(0)==="_"&&typeof this[f]=="function"&&(this[f]=this[f].bind(this));this.nativeDraggable=l.forceFallback?!1:i0,this.nativeDraggable&&(this.options.touchStartThreshold=1),l.supportPointer?Se(o,"pointerdown",this._onTapStart):(Se(o,"mousedown",this._onTapStart),Se(o,"touchstart",this._onTapStart)),this.nativeDraggable&&(Se(o,"dragover",this),Se(o,"dragenter",this)),jo.push(this.el),l.store&&l.store.get&&this.sort(l.store.get(this)||[]),fr(this,Vp())}ge.prototype={constructor:ge,_isOutsideThisEl:function(l){!this.el.contains(l)&&l!==this.el&&(ki=null)},_getDirection:function(l,s){return typeof this.options.direction=="function"?this.options.direction.call(this,l,s,$):this.options.direction},_onTapStart:function(l){if(l.cancelable){var s=this,a=this.el,f=this.options,h=f.preventOnFilter,c=l.type,d=l.touches&&l.touches[0]||l.pointerType&&l.pointerType==="touch"&&l,v=(d||l).target,y=l.target.shadowRoot&&(l.path&&l.path[0]||l.composedPath&&l.composedPath()[0])||v,x=f.filter;if(p0(a),!$&&!(/mousedown|pointerdown/.test(c)&&l.button!==0||f.disabled)&&!y.isContentEditable&&!(!this.nativeDraggable&&gn&&v&&v.tagName.toUpperCase()==="SELECT")&&(v=Gt(v,f.draggable,a,!1),!(v&&v.animated)&&Ho!==v)){if(Ei=It(v),vn=It(v,f.draggable),typeof x=="function"){if(x.call(this,l,v,this)){kt({sortable:s,rootEl:y,name:"filter",targetEl:v,toEl:a,fromEl:a}),Ft("filter",s,{evt:l}),h&&l.preventDefault();return}}else if(x&&(x=x.split(",").some(function(D){if(D=Gt(y,D.trim(),a,!1),D)return kt({sortable:s,rootEl:D,name:"filter",targetEl:v,fromEl:a,toEl:a}),Ft("filter",s,{evt:l}),!0}),x)){h&&l.preventDefault();return}f.handle&&!Gt(y,f.handle,a,!1)||this._prepareDragStart(l,d,v)}}},_prepareDragStart:function(l,s,a){var f=this,h=f.el,c=f.options,d=h.ownerDocument,v;if(a&&!$&&a.parentNode===h){var y=Ve(a);if(He=h,$=a,Ue=$.parentNode,Yr=$.nextSibling,Ho=a,zo=c.group,ge.dragged=$,Xr={target:$,clientX:(s||l).clientX,clientY:(s||l).clientY},fc=Xr.clientX-y.left,cc=Xr.clientY-y.top,this._lastX=(s||l).clientX,this._lastY=(s||l).clientY,$.style["will-change"]="all",v=function(){if(Ft("delayEnded",f,{evt:l}),ge.eventCanceled){f._onDrop();return}f._disableDelayedDragEvents(),!ac&&f.nativeDraggable&&($.draggable=!0),f._triggerDragStart(l,s),kt({sortable:f,name:"choose",originalEvent:l}),zt($,c.chosenClass,!0)},c.ignore.split(",").forEach(function(x){vc($,x.trim(),El)}),Se(d,"dragover",Kr),Se(d,"mousemove",Kr),Se(d,"touchmove",Kr),c.supportPointer?(Se(d,"pointerup",f._onDrop),!this.nativeDraggable&&Se(d,"pointercancel",f._onDrop)):(Se(d,"mouseup",f._onDrop),Se(d,"touchend",f._onDrop),Se(d,"touchcancel",f._onDrop)),ac&&this.nativeDraggable&&(this.options.touchStartThreshold=4,$.draggable=!0),Ft("delayStart",this,{evt:l}),c.delay&&(!c.delayOnTouchOnly||s)&&(!this.nativeDraggable||!(xn||cr))){if(ge.eventCanceled){this._onDrop();return}c.supportPointer?(Se(d,"pointerup",f._disableDelayedDrag),Se(d,"pointercancel",f._disableDelayedDrag)):(Se(d,"mouseup",f._disableDelayedDrag),Se(d,"touchend",f._disableDelayedDrag),Se(d,"touchcancel",f._disableDelayedDrag)),Se(d,"mousemove",f._delayedDragTouchMoveHandler),Se(d,"touchmove",f._delayedDragTouchMoveHandler),c.supportPointer&&Se(d,"pointermove",f._delayedDragTouchMoveHandler),f._dragStartTimer=setTimeout(v,c.delay)}else v()}},_delayedDragTouchMoveHandler:function(l){var s=l.touches?l.touches[0]:l;Math.max(Math.abs(s.clientX-this._lastX),Math.abs(s.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){$&&El($),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var l=this.el.ownerDocument;ke(l,"mouseup",this._disableDelayedDrag),ke(l,"touchend",this._disableDelayedDrag),ke(l,"touchcancel",this._disableDelayedDrag),ke(l,"pointerup",this._disableDelayedDrag),ke(l,"pointercancel",this._disableDelayedDrag),ke(l,"mousemove",this._delayedDragTouchMoveHandler),ke(l,"touchmove",this._delayedDragTouchMoveHandler),ke(l,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(l,s){s=s||l.pointerType=="touch"&&l,!this.nativeDraggable||s?this.options.supportPointer?Se(document,"pointermove",this._onTouchMove):s?Se(document,"touchmove",this._onTouchMove):Se(document,"mousemove",this._onTouchMove):(Se($,"dragend",this),Se(He,"dragstart",this._onDragStart));try{document.selection?qo(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(l,s){if(Si=!1,He&&$){Ft("dragStarted",this,{evt:s}),this.nativeDraggable&&Se(document,"dragover",a0);var a=this.options;!l&&zt($,a.dragClass,!1),zt($,a.ghostClass,!0),ge.active=this,l&&this._appendGhost(),kt({sortable:this,name:"start",originalEvent:s})}else this._nulling()},_emulateDragOver:function(){if(jt){this._lastX=jt.clientX,this._lastY=jt.clientY,Sc();for(var l=document.elementFromPoint(jt.clientX,jt.clientY),s=l;l&&l.shadowRoot&&(l=l.shadowRoot.elementFromPoint(jt.clientX,jt.clientY),l!==s);)s=l;if($.parentNode[Tt]._isOutsideThisEl(l),s)do{if(s[Tt]){var a=void 0;if(a=s[Tt]._onDragOver({clientX:jt.clientX,clientY:jt.clientY,target:l,rootEl:s}),a&&!this.options.dragoverBubble)break}l=s}while(s=mc(s));Ec()}},_onTouchMove:function(l){if(Xr){var s=this.options,a=s.fallbackTolerance,f=s.fallbackOffset,h=l.touches?l.touches[0]:l,c=xe&&Ai(xe,!0),d=xe&&c&&c.a,v=xe&&c&&c.d,y=Oo&>&&uc(gt),x=(h.clientX-Xr.clientX+f.x)/(d||1)+(y?y[0]-Sl[0]:0)/(d||1),D=(h.clientY-Xr.clientY+f.y)/(v||1)+(y?y[1]-Sl[1]:0)/(v||1);if(!ge.active&&!Si){if(a&&Math.max(Math.abs(h.clientX-this._lastX),Math.abs(h.clientY-this._lastY))=0&&(kt({rootEl:Ue,name:"add",toEl:Ue,fromEl:He,originalEvent:l}),kt({sortable:this,name:"remove",toEl:Ue,originalEvent:l}),kt({rootEl:Ue,name:"sort",toEl:Ue,fromEl:He,originalEvent:l}),kt({sortable:this,name:"sort",toEl:Ue,originalEvent:l})),ut&&ut.save()):Nt!==Ei&&Nt>=0&&(kt({sortable:this,name:"update",toEl:Ue,originalEvent:l}),kt({sortable:this,name:"sort",toEl:Ue,originalEvent:l})),ge.active&&((Nt==null||Nt===-1)&&(Nt=Ei,Ar=vn),kt({sortable:this,name:"end",toEl:Ue,originalEvent:l}),this.save()))),this._nulling()},_nulling:function(){Ft("nulling",this),He=$=Ue=xe=Yr=Re=Ho=Fr=Xr=jt=dn=Nt=Ar=Ei=vn=ki=bn=ut=zo=ge.dragged=ge.ghost=ge.clone=ge.active=null;var l=this.el;Go.forEach(function(s){l.contains(s)&&(s.checked=!0)}),Go.length=Dl=kl=0},handleEvent:function(l){switch(l.type){case"drop":case"dragend":this._onDrop(l);break;case"dragenter":case"dragover":$&&(this._onDragOver(l),l0(l));break;case"selectstart":l.preventDefault();break}},toArray:function(){for(var l=[],s,a=this.el.children,f=0,h=a.length,c=this.options;ff.right+h||o.clientY>a.bottom&&o.clientX>a.left:o.clientY>f.bottom+h||o.clientX>a.right&&o.clientY>a.top}function c0(o,l,s,a,f,h,c,d){var v=a?o.clientY:o.clientX,y=a?s.height:s.width,x=a?s.top:s.left,D=a?s.bottom:s.right,k=!1;if(!c){if(d&&Pox+y*h/2:vD-Po)return-bn}else if(v>x+y*(1-f)/2&&vD-y*h/2)?v>x+y/2?1:-1:0}function d0(o){return It($)0||D>0&&k0?"Converting "+l+" photo"+(l>1?"s":"")+"\u2026":"Uploading "+D+" photo"+(D>1?"s":"")+"\u2026",s.details.open=!0):D>0?(s.summary.textContent="\u2713 "+D+" photo"+(D>1?"s":"")+" ready \u2014 tap to review",s.details.open=!1):(s.summary.textContent="Photos (1\u20136)",s.details.open=!0)}}function c(){h(),setTimeout(h,150),setTimeout(h,500)}function d(){var x=o.querySelector('button[type="submit"], input[type="submit"]');if(x&&(x.disabled=l>0),l>0)f("Converting "+l+" photo"+(l>1?"s":"")+"\u2026");else{var D=Mc();D&&/Converting/.test(D.textContent)&&f("")}h()}o.addEventListener("submit",function(x){l>0&&(x.preventDefault(),f("Hang on \u2014 a photo is still converting.","err"))},!0);function v(x){return function(D){var k=D&&D.file;return k?Ic(k).then(function(F){return F?(l++,d(),import("./heic-to-CN7JBE7H.js").then(function(B){var L=B.heicTo||B.default&&B.default.heicTo;return L({blob:k,type:"image/jpeg",quality:.85})}).then(function(B){var L=new File([B],y0(k.name),{type:"image/jpeg"});x.addFile(L)}).catch(function(){f("A photo couldn\u2019t be converted and was skipped \u2014 the others are fine.","err")}).then(function(){l--,d()}),!1):!0}):!0}}var y=0;(function x(){var D=window.GravFilePond&&window.GravFilePond.getInstances?window.GravFilePond.getInstances():[];if(!D.length){y++<120&&setTimeout(x,50);return}D.forEach(function(k){k&&!k._heicHooked&&(k._heicHooked=!0,k.setOptions({beforeAddFile:v(k),allowReorder:!0,itemInsertLocation:"after"}),a=k,["addfile","processfile","processfiles","removefile","error"].forEach(function(F){try{k.on(F,c)}catch{}}),h())})})()}function ft(o){return document.querySelector('[name="data['+o+']"]')}function C0(){var o=Array.prototype.slice.call(document.querySelectorAll(".advanced-field"));if(o.length){var l=[];if(o.forEach(function(h){var c=h.closest(".form-field");c&&l.indexOf(c)===-1&&l.push(c)}),!!l.length){var s=document.createElement("details");s.className="more-options";var a=document.createElement("summary");a.className="more-options__summary",a.textContent="More options",s.appendChild(a),l[0].parentNode.insertBefore(s,l[0]),l.forEach(function(h){s.appendChild(h)});var f=l.some(function(h){var c=h.querySelector('input[type="text"]');if(c&&c.value.trim())return!0;var d=h.querySelector('input[type="radio"]:checked');if(!d||!d.value)return!1;var v=h.querySelector('input[type="radio"][checked]');return v?d.value!==v.value:d.value!=="0"});f&&(s.open=!0)}}}var D0={0:"Sunny",1:"Partly cloudy",2:"Partly cloudy",3:"Cloudy",45:"Foggy",48:"Foggy",51:"Drizzle",53:"Drizzle",55:"Drizzle",56:"Drizzle",57:"Drizzle",61:"Rain",63:"Rain",65:"Rain",66:"Rain",67:"Rain",80:"Rain",81:"Rain",82:"Rain",71:"Snow",73:"Snow",75:"Snow",77:"Snow",85:"Snow",86:"Snow",95:"Thunderstorm",96:"Thunderstorm",99:"Thunderstorm"};function dr(o,l,s){o&&(o.className="form-status"+(s?" form-status--"+s:""),o.textContent=l||"")}function k0(){var o=document.getElementById("get-location"),l=document.getElementById("get-weather");if(!o&&!l)return;var s=document.getElementById("location-status"),a=document.getElementById("weather-status");function f(){var d=ft("lat"),v=ft("lng"),y=d?d.value.trim():"",x=v?v.value.trim():"";return y&&x?{lat:y,lng:x}:null}function h(){if(l){var d=!!f();l.disabled=!d,l.title=d?"":"Get location first"}}h();function c(d,v){var y=ft("location_city"),x=ft("location_country");if(!((!y||y.value.trim())&&(!x||x.value.trim()))){var D="https://api.bigdatacloud.net/data/reverse-geocode-client?latitude="+encodeURIComponent(d)+"&longitude="+encodeURIComponent(v)+"&localityLanguage=en";fetch(D).then(function(k){return k.json()}).then(function(k){var F=(k.city||k.locality||"").trim(),B=(k.countryName||"").trim();y&&!y.value.trim()&&F&&(y.value=F),x&&!x.value.trim()&&B&&(x.value=B);var L=[F,B].filter(Boolean).join(", ");L&&dr(s,"\u2713 Location captured \xB7 "+L,"ok")}).catch(function(){})}}o&&o.addEventListener("click",function(){if(!navigator.geolocation){dr(s,"Geolocation is not supported on this device.","err");return}o.classList.add("is-loading"),o.disabled=!0,dr(s,"Getting location\u2026"),navigator.geolocation.getCurrentPosition(function(d){var v=d.coords.latitude.toFixed(6),y=d.coords.longitude.toFixed(6),x=ft("lat"),D=ft("lng");x&&(x.value=v),D&&(D.value=y),o.classList.remove("is-loading"),o.disabled=!1,dr(s,"\u2713 Location captured \xB7 "+v+", "+y,"ok"),h(),c(v,y);var k=document.querySelector(".location-details");k&&k.open&&Hc()},function(d){o.classList.remove("is-loading"),o.disabled=!1,dr(s,"\u2717 "+(d&&d.message?d.message:"Could not get location")+" \u2014 enter coordinates manually if needed.","err")},{enableHighAccuracy:!0,timeout:15e3})}),l&&l.addEventListener("click",function(){var d=f();if(!d){dr(a,"Get location first, then fetch weather.","err");return}l.classList.add("is-loading"),l.disabled=!0,dr(a,"Fetching weather\u2026");var v="https://api.open-meteo.com/v1/forecast?latitude="+d.lat+"&longitude="+d.lng+"¤t=temperature_2m,weather_code&temperature_unit=celsius";fetch(v).then(function(y){return y.json()}).then(function(y){var x=Math.round(y.current.temperature_2m),D=D0[y.current.weather_code]||"Cloudy",k=ft("weather_temp_c"),F=ft("weather_desc");k&&(k.value=x),F&&(F.value=D),l.classList.remove("is-loading"),h(),dr(a,"\u2713 Weather set \xB7 "+D+" \xB7 "+x+"\xB0C (edit above if needed)","ok")}).catch(function(){l.classList.remove("is-loading"),h(),dr(a,"\u2717 Could not fetch weather \u2014 set it manually above.","err")})})}var Hc=function(){};function S0(o,l){var s=null;return function(){var a=arguments;clearTimeout(s),s=setTimeout(function(){o.apply(null,a)},l)}}function E0(o){return[o.name,o.admin1,o.country].filter(Boolean).join(", ")}function A0(){var o=ft("lat"),l=ft("lng");if(!o||!l)return;var s=o.closest(".form-field"),a=l.closest(".form-field");if(!s||!a)return;var f=ft("location_city"),h=ft("location_country"),c=h?h.closest(".form-field"):null,d=c||s,v=document.createElement("details");v.className="location-details";var y=document.createElement("summary");y.className="location-details__summary",y.textContent="More location details",v.appendChild(y);var x=document.createElement("div");x.className="location-details__body";var D=document.createElement("div");D.className="location-search-row";var k=document.createElement("button");k.type="button",k.id="lookup-coords",k.className="btn-action";var F="\u{1F50D} Look up coordinates";k.textContent=F,D.appendChild(k),x.appendChild(D);var B=document.createElement("p");B.id="location-search-hint",B.className="location-search-hint",B.setAttribute("role","status"),x.appendChild(B);var L=document.createElement("ul");L.id="location-search-results",L.className="location-search-results",x.appendChild(L);var T=document.createElement("div");T.id="location-map",T.className="location-map",x.appendChild(T),v.appendChild(x),d.parentNode.insertBefore(v,d.nextSibling),v.appendChild(s),v.appendChild(a);function N(H){return H===o?"location-lat-note":"location-lng-note"}function z(){[o,l].forEach(function(H){H.classList.add("location-field--mismatch"),H.setAttribute("aria-invalid","true");var Y=N(H),E=document.getElementById(Y);E||(E=document.createElement("span"),E.id=Y,E.className="location-field-note",E.setAttribute("role","status"),E.setAttribute("aria-live","polite"),E.textContent="Not reflected on the map yet.",H.parentNode.insertBefore(E,H.nextSibling)),H.setAttribute("aria-describedby",Y)})}function O(){[o,l].forEach(function(H){H.classList.remove("location-field--mismatch"),H.removeAttribute("aria-invalid"),H.removeAttribute("aria-describedby");var Y=document.getElementById(N(H));Y&&Y.parentNode&&Y.parentNode.removeChild(Y)})}var I=null;function R(){var H=parseFloat(o.value),Y=parseFloat(l.value),E=isFinite(H)&&isFinite(Y)&&H>=-90&&H<=90&&Y>=-180&&Y<=180;E?(O(),I&&I.setPin(H,Y)):o.value.trim()||l.value.trim()?z():O()}Hc=R;function G(H){o.value=H.lat.toFixed(6),l.value=H.lng.toFixed(6),O()}v.addEventListener("toggle",function(){v.open&&Lc(T,G).then(function(H){I=H,H.resize(),R()}).catch(function(){he("Map preview unavailable \u2014 you can still enter coordinates directly.")})}),o.addEventListener("blur",R),l.addEventListener("blur",R);var X=S0(R,400);o.addEventListener("input",X),l.addEventListener("input",X);function he(H){B.textContent=H||""}function j(){L.innerHTML=""}function oe(H){H.forEach(function(Y){var E=document.createElement("li"),q=document.createElement("button");q.type="button",q.textContent=E0(Y),q.addEventListener("click",function(){o.value=Number(Y.latitude).toFixed(6),l.value=Number(Y.longitude).toFixed(6),j(),R()}),E.appendChild(q),L.appendChild(E)})}k.addEventListener("click",function(){j();var H=f?f.value.trim():"",Y=h?h.value.trim():"";if(!H&&!Y){he("Enter a city or country first.");return}var E=H||Y;he(""),k.disabled=!0,k.textContent="Searching\u2026";var q="https://geocoding-api.open-meteo.com/v1/search?name="+encodeURIComponent(E)+"&count=10&language=en&format=json",W=new AbortController,Q=setTimeout(function(){W.abort()},1e4);fetch(q,{signal:W.signal}).then(function(de){return de.json()}).then(function(de){var be=de&&de.results||[];if(!be.length){he("No matches \u2014 try adding a country, or drag the pin on the map.");return}if(Y){var Ae=Y.toLowerCase(),A=function(w){return(w.admin1||"").toLowerCase().indexOf(Ae)!==-1||(w.country||"").toLowerCase().indexOf(Ae)!==-1};be=be.slice().sort(function(w,te){var Ce=A(w),ye=A(te);return Ce===ye?0:Ce?-1:1})}oe(be)}).catch(function(){}).then(function(){clearTimeout(Q),k.disabled=!1,k.textContent=F})})}function F0(){var o=new Date;return o.setSeconds(0,0),o.setMinutes(o.getMinutes()-o.getTimezoneOffset()),o.toISOString().slice(0,16)}function T0(){var o={title:"Title",date:"Date & time",content:"Content"},l=document.querySelector('form[name="new-entry"]');if(!l)return;var s=ft("date");s&&!String(s.value).trim()&&(s.value=F0());function a(){l.querySelectorAll(".field-error").forEach(function(c){c.remove()}),l.querySelectorAll(".field-invalid").forEach(function(c){c.classList.remove("field-invalid")})}function f(c,d){c.classList.add("field-invalid");var v=document.createElement("span");v.className="field-error",v.textContent=d,c.parentNode.insertBefore(v,c.nextSibling)}function h(c){var d=l.querySelector(".photos-collapse"),v,y;if(d?(d.open=!0,y=d.querySelector(".photos-collapse__summary"),v=d):(v=document.querySelector(".filepond-root, .form-input-file"),y=v),!y)return v||null;var x=document.createElement("span");return x.className="field-error",x.textContent=c,y.insertAdjacentElement("afterend",x),v||y}l.addEventListener("submit",function(c){a();var d=null;!Yo&&document.querySelectorAll(".filepond--item").length<1&&(d=h("Add at least one photo.")),Object.keys(o).forEach(function(y){var x=ft(y);x&&!String(x.value).trim()&&(f(x,o[y]+" is required."),d||(d=x))});var v=l.querySelector(".location-field--mismatch");v&&!d&&(d=v),d&&(c.preventDefault(),typeof d.focus=="function"&&d.focus(),d.scrollIntoView({behavior:"smooth",block:"center"}))})}var ql="intotheeast:new-entry-draft";function L0(o){return Array.prototype.slice.call(o.querySelectorAll('[name^="data["]')).filter(function(l){if(l.type==="file")return!1;var s=l.name;return s.indexOf("data[_json")!==0&&s.indexOf("data[photos")!==0})}function M0(){var o=document.querySelector(".filepond-root, .form-input-file");if(!(!o||!o.parentNode)&&!o.parentNode.querySelector(".photo-reauth-hint")){var l=document.createElement("p");l.className="photo-reauth-hint is-shown",l.textContent="Your text was restored \u2014 photos need re-selecting (they can\u2019t be saved in a draft).",o.parentNode.insertBefore(l,o.nextSibling)}}function B0(){var o=document.querySelector('form[name="new-entry"]');if(!o||Yo)return;if(document.querySelector(".notices.success")){try{localStorage.removeItem(ql)}catch{}return}function l(){var h={};L0(o).forEach(function(c){c.type==="radio"?c.checked&&(h[c.name]=c.value):h[c.name]=c.value});try{localStorage.setItem(ql,JSON.stringify(h))}catch{}}var s=null;try{s=localStorage.getItem(ql)}catch{s=null}if(s){var a=null;try{a=JSON.parse(s)}catch{a=null}if(a){var f=!1;Object.keys(a).forEach(function(h){var c=a[h];if(c!=null&&String(c).trim()&&(f=!0),h!=="data[content]"){var d=o.querySelectorAll('input[type="radio"][name="'+h+'"]');if(d.length){d.forEach(function(y){y.checked=y.value===c});return}var v=o.querySelector('[name="'+h+'"]');v&&v.type!=="file"&&(v.value=c)}}),window.postFormEditor&&a["data[content]"]!=null&&window.postFormEditor.value(a["data[content]"]),f&&M0()}}o.addEventListener("input",l),o.addEventListener("change",l),window.postFormEditor&&window.postFormEditor.codemirror.on("change",l)}function _0(){var o=document.querySelector(".post-form-wrap"),l=document.querySelector(".post-form-wrap .notices.success, .post-form-wrap .notices.green");if(!(!o||!l)){var s=document.createElement("div");s.className="post-success";var a=document.createElement("p");a.className="post-success__title",a.textContent="\u2713 Saved to your journal.",s.appendChild(a);var f=document.createElement("div");f.className="post-success__actions";var h=o.getAttribute("data-trip-url");if(h){var c=document.createElement("a");c.className="post-success__view",c.href=h,c.textContent="View your journal \u2192",f.appendChild(c)}var d=document.createElement("a");d.className="post-success__again",d.href=window.location.pathname,d.textContent="Post another",f.appendChild(d),s.appendChild(f),l.parentNode.insertBefore(s,l.nextSibling),["form",".form-action-row","#location-status","#weather-status"].forEach(function(v){var y=o.querySelector(v);y&&(y.style.display="none")}),l.scrollIntoView({behavior:"smooth",block:"start"})}}var Yo=!1;function Bc(o){return new URLSearchParams(window.location.search).get(o)}function hr(o,l){var s=ft(o);s&&(s.value=l==null?"":String(l))}function Rl(o,l){var s=l?"1":"0",a=document.querySelectorAll('[name="data['+o+']"]');Array.prototype.forEach.call(a,function(f){f.checked=String(f.value)===s})}function z0(o){var l=o==null?"":String(o);if(window.postFormEditor&&typeof window.postFormEditor.value=="function")window.postFormEditor.value(l);else{var s=ft("content");s&&(s.value=l)}}function _c(o,l){var s=o.querySelectorAll("input, textarea, select, button");Array.prototype.forEach.call(s,function(a){a.type==="file"||a.name&&a.name.indexOf("data[photos")===0||(a.disabled=l)}),window.postFormEditor&&window.postFormEditor.codemirror&&window.postFormEditor.codemirror.setOption("readOnly",l?"nocursor":!1)}function Wl(o,l){o&&(o.tagName==="INPUT"?o.value=l:o.textContent=l)}function N0(o,l){var s=o.querySelector(".post-edit-error");if(s){s.textContent=l;return}var a=document.createElement("div");a.className="post-edit-error",a.setAttribute("role","alert"),a.textContent=l;var f=o.querySelector("h1");f?f.insertAdjacentElement("afterend",a):o.insertBefore(a,o.firstChild)}var O0=/\.(jpe?g|png|webp|heic|heif|gif)$/i;function zc(o){var l=/(?:^|\/)photo-0*(\d+)\./i.exec(o);return l?parseInt(l[1],10):Number.MAX_SAFE_INTEGER}function I0(o,l){var s=zc(o),a=zc(l);return s!==a?s-a:ol?1:0}function Nc(o,l){var s=String(o||"photo"),a=s.lastIndexOf("."),f=(a>0?s.slice(0,a):s).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"photo",h=l?".jpg":a>0?s.slice(a).toLowerCase():".jpg",c=Date.now().toString(36)+Math.random().toString(36).slice(2,6);return f+"-"+c+h}function H0(o){var l=document.querySelector('form[name="new-entry"]');if(!l||!o)return;var s=o.split("/").filter(Boolean).pop();if(!s)return;var a=document.querySelector(".filepond-root, .form-input-file"),f=a?a.closest(".form-field"):null;f&&(f.style.display="none");var h=l.querySelector(".photos-collapse");h&&(h.style.display="none");var c=document.createElement("div");c.className="photo-editor",c.innerHTML='
    Photos

    ',f&&f.parentNode?f.parentNode.insertBefore(c,f):l.insertBefore(c,l.firstElementChild);var d=c.querySelector(".photo-editor__grid"),v=c.querySelector(".photo-editor__status"),y=c.querySelector(".photo-editor__add"),x=c.querySelector(".photo-editor__input"),D=[],k=null,F=!1,B=0;function L(H,Y){v.textContent=H||"",v.className="photo-editor__status gpx-status"+(Y?" error":"")}function T(H){F=H,y.disabled=H,Array.prototype.forEach.call(d.querySelectorAll(".photo-editor__del, .photo-editor__confirm-yes, .photo-editor__confirm-no"),function(Y){Y.disabled=H}),k&&k.option("disabled",H)}function N(){return fetch("/api/v1/pages"+o+"/media",{credentials:"include",headers:{Accept:"application/json"}}).then(function(H){if(!H.ok)throw new Error("HTTP "+H.status);return H.json()}).then(function(H){return(H&&H.data||[]).filter(function(Y){return Y&&typeof Y.filename=="string"&&O0.test(Y.filename)}).map(function(Y){return Y.filename}).sort(I0)})}function z(H){return Cn("/api/v1/entry/"+encodeURIComponent(s)+"/photos/order",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({order:H})})}function O(H){if(D=(H||[]).slice(),k&&(k.destroy(),k=null),d.innerHTML="",!D.length){d.innerHTML='

    No photos yet \u2014 add some.

    ';return}var Y=++B;D.forEach(function(E){var q=document.createElement("div");q.className="photo-editor__cell",q.setAttribute("data-filename",E);var W=document.createElement("img");W.className="photo-editor__img",W.loading="lazy",W.alt=E,W.src=o+"/"+encodeURIComponent(E)+"?v="+Y;var Q=document.createElement("button");Q.type="button",Q.className="photo-editor__del",Q.setAttribute("aria-label","Delete "+E),Q.textContent="\u2715",Q.addEventListener("click",function(){X(q,E)}),q.appendChild(W),q.appendChild(Q),d.appendChild(q)}),D.length>1&&(k=new Fc(d,{animation:150,draggable:".photo-editor__cell",filter:".photo-editor__confirm",onEnd:G}))}function I(){return Array.prototype.map.call(d.querySelectorAll(".photo-editor__cell"),function(H){return H.getAttribute("data-filename")})}function R(H,Y){if(H.length!==Y.length)return!1;for(var E=0;EDelete?',H.appendChild(E),H.classList.add("is-confirming"),E.querySelector(".photo-editor__confirm-no").addEventListener("click",function(){H.classList.remove("is-confirming"),E.remove()}),E.querySelector(".photo-editor__confirm-yes").addEventListener("click",function(){E.querySelector(".photo-editor__confirm-yes").disabled=!0,E.querySelector(".photo-editor__confirm-no").disabled=!0,he(Y)})}}function he(H){var Y=D.slice(),E=D.filter(function(q){return q!==H});T(!0),L("Deleting\u2026"),Cn("/api/v1/pages"+o+"/media/"+encodeURIComponent(H),{method:"DELETE"},[204,404]).then(function(){return(E.length?z(E):Promise.resolve()).then(N).then(function(q){L(""),O(q)},function(){L("Photo deleted, but refreshing the list failed \u2014 reload if it looks off.",!0),O(E)})},function(q){L(Pl(q,"Couldn\u2019t delete that photo. Try again."),!0),O(Y)}).then(function(){T(!1)})}function j(H){return Ic(H).then(function(Y){return Y?import("./heic-to-CN7JBE7H.js").then(function(E){var q=E.heicTo||E.default&&E.default.heicTo;return q({blob:H,type:"image/jpeg",quality:.85})}).then(function(E){return{blob:E,name:Nc(H.name,!0)}}):{blob:H,name:Nc(H.name,!1)}})}y.addEventListener("click",function(){F||x.click()}),x.addEventListener("change",function(){var H=Array.prototype.slice.call(x.files||[]);x.value="",H.length&&oe(H)});function oe(H){T(!0);var Y=H.length,E=0,q=0,W=!1,Q=D.slice(),de=Promise.resolve();H.forEach(function(be){de=de.then(function(){return E++,L("Uploading "+E+" of "+Y+"\u2026"),j(be).then(function(Ae){var A=new FormData;return A.append("file",Ae.blob,Ae.name),Cn("/api/v1/pages"+o+"/media",{method:"POST",body:A})}).then(null,function(Ae){q++,Ae&&(Ae.status===401||Ae.status===403)&&(W=!0)})})}),de.then(function(){return L("Finishing\u2026"),N()}).then(function(be){var Ae=Q.filter(function(te){return be.indexOf(te)!==-1}),A=be.filter(function(te){return Q.indexOf(te)===-1}),w=Ae.concat(A);return w.length?z(w).catch(function(){return z(w)}).catch(function(){return Promise.all(A.map(function(te){return Cn("/api/v1/pages"+o+"/media/"+encodeURIComponent(te),{method:"DELETE"},[204,404]).then(function(){return!0},function(){return!1})})).then(function(te){var Ce=new Error("reorder failed");throw Ce.rolledBack=!0,Ce.rollbackIncomplete=te.indexOf(!1)!==-1,Ce})}).then(N):(O([]),null)}).then(function(be){be&&O(be),q?L(W?"Couldn\u2019t add photos \u2014 your login session expired. Sign in again, then retry.":q+" photo"+(q>1?"s":"")+" couldn\u2019t be added.",!0):L("")}).catch(function(be){var Ae;return be&&be.rolledBack?Ae=be.rollbackIncomplete?"Couldn\u2019t finish adding photos and cleanup was incomplete \u2014 reload the page and check your photos.":"Couldn\u2019t finish adding photos \u2014 changes were rolled back. Try again.":Ae="Couldn\u2019t add photos. Please try again.",L(Ae,!0),N().then(O,function(){O(Q)})}).then(function(){T(!1)})}d.innerHTML='

    Loading photos\u2026

    ',N().then(O).catch(function(){L("Couldn\u2019t load photos.",!0),O([])})}function P0(){var o=document.querySelector('form[name="new-entry"]'),l=document.querySelector(".post-form-wrap");if(!(!o||!l)){var s=Bc("edit");if(s){Yo=!0;var a=l.querySelector("h1");a&&(a.textContent="Edit entry");var f=o.querySelector('button[type="submit"], input[type="submit"]'),h=f?f.tagName==="INPUT"?f.value:f.textContent:"Save changes";_c(o,!0),Wl(f,"Loading entry\u2026");var c=Bc("return")||l.getAttribute("data-trip-url")||"";o.setAttribute("action","/post?edit="+encodeURIComponent(s)+(c?"&return="+encodeURIComponent(c):"")),fetch("/api/v1/pages"+s,{credentials:"include",headers:{Accept:"application/json"}}).then(function(d){if(!d.ok){var v=new Error("HTTP "+d.status);throw v.status=d.status,v}return d.json()}).then(function(d){var v=d&&d.data||{},y=v.header||{};hr("title",y.title!=null?y.title:v.title),hr("date",y.date?String(y.date).replace(" ","T"):""),z0(v.content),hr("lat",y.lat),hr("lng",y.lng),hr("location_city",y.location_city),hr("location_country",y.location_country),hr("weather_desc",y.weather_desc),hr("weather_temp_c",y.weather_temp_c),hr("transport_mode",y.transport_mode),Rl("featured",y.featured),Rl("force_connect",y.force_connect),Rl("published",y.published!==void 0?y.published:v.published);var x=ft("edit_path");x&&(x.value=s+"/entry.md"),_c(o,!1),Wl(f,"Save changes");var D=o.querySelector(".more-options");D&&(D.open=!0),H0(s)}).catch(function(d){var v=d&&d.status===404?"This entry no longer exists \u2014 it may have been deleted. Head back to the journal.":"Sorry \u2014 this entry couldn\u2019t be loaded for editing. Check your connection and try again.";N0(l,v),Wl(f,h)})}}}function Oc(){window.postFormEditor=v0(),_0(),P0(),B0(),w0(),C0(),k0(),A0(),T0()}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Oc):Oc(); /*! Bundled license information: sortablejs/modular/sortable.esm.js: diff --git a/themes/intotheeast/js/src/location-map.js b/themes/intotheeast/js/src/location-map.js index 73b1c42..6256b29 100644 --- a/themes/intotheeast/js/src/location-map.js +++ b/themes/intotheeast/js/src/location-map.js @@ -12,10 +12,17 @@ * which calls this on every open and then always calls the returned * handle's resize() (the container sits under display:none while the panel * is closed, so the first paint would otherwise get a zero-size canvas). + * + * The cache stores the in-flight PROMISE, not just the resolved handle — + * written synchronously before import() settles. A close/reopen of the panel + * while the maplibre-gl chunk is still loading would otherwise re-enter this + * function and race a second import().then() into building a second Map + * against the same container (caught in code review — confirmed independently + * by four reviewers). */ import { MAP_STYLE } from './map-style.js'; -var cached = null; // { container, handle } +var cached = null; // { container, promise } function buildPinElement() { var el = document.createElement('div'); @@ -25,10 +32,10 @@ function buildPinElement() { export function getOrCreateLocationMap(container, onDragEnd) { if (cached && cached.container === container) { - return Promise.resolve(cached.handle); + return cached.promise; } - return import('maplibre-gl').then(function (mod) { + var promise = import('maplibre-gl').then(function (mod) { var maplibregl = mod.default || mod; var map = new maplibregl.Map({ container: container, @@ -45,7 +52,7 @@ export function getOrCreateLocationMap(container, onDragEnd) { if (onDragEnd) onDragEnd(marker.getLngLat()); }); - var handle = { + return { setPin: function (lat, lng) { marker.setLngLat([lng, lat]); if (!pinSet) { marker.addTo(map); pinSet = true; } @@ -54,8 +61,14 @@ export function getOrCreateLocationMap(container, onDragEnd) { hasPin: function () { return pinSet; }, resize: function () { map.resize(); } }; - - cached = { container: container, handle: handle }; - return handle; + }).catch(function (err) { + // Leave the cache clear so a later retry (e.g. after transient network + // failure) re-attempts the import instead of permanently returning a + // rejected promise for this container. + if (cached && cached.container === container) cached = null; + throw err; }); + + cached = { container: container, promise: promise }; + return promise; } diff --git a/themes/intotheeast/js/src/post-form.css b/themes/intotheeast/js/src/post-form.css index b59c166..87b94fd 100644 --- a/themes/intotheeast/js/src/post-form.css +++ b/themes/intotheeast/js/src/post-form.css @@ -519,3 +519,107 @@ /* SortableJS drag feedback. */ .photo-editor__cell.sortable-ghost { opacity: 0.4; } .photo-editor__cell.sortable-chosen { outline: 2px solid var(--color-accent); } + +/* "More location details" disclosure — search + map preview for setting an + entry's coordinates without live GPS. Mirrors .more-options's disclosure + look (above); the lat/lng fields (relocated here by JS) and the lookup + button reuse style.css's existing .btn-action/.form-status/.field-invalid + conventions unmodified. */ +.location-details { + margin-bottom: var(--space-5); + border: 1px solid var(--color-border); + border-radius: var(--radius-md); + background: var(--color-canvas); +} +.location-details__summary { + cursor: pointer; + padding: 0.875rem 1rem; + min-height: 44px; + display: flex; + align-items: center; + font-family: var(--font-ui); + font-size: var(--text-sm); + font-weight: 600; + color: var(--color-ink); + list-style: none; + user-select: none; +} +.location-details__summary::-webkit-details-marker { display: none; } +.location-details__summary::before { + content: '▸'; + margin-right: var(--space-2); + color: var(--color-ink-muted); + transition: transform 0.15s; +} +.location-details[open] .location-details__summary::before { transform: rotate(90deg); } +.location-details[open] .location-details__summary { border-bottom: 1px solid var(--color-border); } +.location-details > .form-field { padding: 0 1rem; } +.location-details > .form-field:first-of-type { padding-top: var(--space-4); } +.location-details > .form-field:last-of-type { padding-bottom: var(--space-2); } +.location-details__body { padding: 1rem; } + +.location-search-row { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; } + +.location-search-hint { + font-size: var(--text-sm); + color: var(--color-ink-muted); + margin-top: var(--space-2); +} +.location-search-hint:empty { display: none; } + +.location-search-results { + list-style: none; + margin: var(--space-3) 0 0; + padding: 0; + border: 1px solid var(--color-border); + border-radius: var(--radius-md); + overflow: hidden; +} +.location-search-results:empty { display: none; margin: 0; border: none; } +.location-search-results li + li { border-top: 1px solid var(--color-border); } +.location-search-results button { + display: block; + width: 100%; + text-align: left; + padding: 0.75rem 1rem; + min-height: 44px; + background: var(--color-canvas); + border: none; + font-family: var(--font-ui); + font-size: var(--text-sm); + color: var(--color-ink); + cursor: pointer; +} +.location-search-results button:hover, +.location-search-results button:focus-visible { background: var(--color-paper); } + +.location-map { + position: relative; + width: 100%; + height: 240px; + margin-top: var(--space-4); + border-radius: var(--radius-md); + overflow: hidden; + background: var(--color-paper); +} +.location-map .maplibregl-canvas { border-radius: var(--radius-md); } + +.location-pin { + width: 44px; + height: 44px; + border-radius: 50%; + background: var(--color-accent); + border: 3px solid #fff; + box-shadow: 0 1px 6px rgba(0, 0, 0, 0.5); + cursor: grab; +} +.location-pin:active { cursor: grabbing; } + +/* Mismatch flag: a typed lat/lng that doesn't (yet) parse to a valid pin. */ +.location-field--mismatch { border-color: var(--color-error) !important; outline-color: var(--color-error) !important; } +.location-field-note { + display: block; + font-size: var(--text-sm); + color: var(--color-error); + margin-top: var(--space-1); +} diff --git a/themes/intotheeast/js/src/post-form.js b/themes/intotheeast/js/src/post-form.js index 7b3c1db..ebc0036 100644 --- a/themes/intotheeast/js/src/post-form.js +++ b/themes/intotheeast/js/src/post-form.js @@ -619,6 +619,10 @@ function initLocationDetails() { // Only flag once the traveller has actually typed something — // fresh blank fields are "no pin yet" (R12), not a mismatch. setMismatch(); + } else { + // Both blanked back out after being flagged — nothing left to submit, + // so the flag no longer applies. + clearMismatch(); } } syncPinFromFields = syncFields; // expose for initGeo()'s GPS handler @@ -637,6 +641,8 @@ function initLocationDetails() { mapHandle = handle; handle.resize(); // fixes the zero-size canvas from painting while display:none syncFields(); + }).catch(function () { + setHint('Map preview unavailable — you can still enter coordinates directly.'); }); }); @@ -686,7 +692,11 @@ function initLocationDetails() { lookupBtn.textContent = 'Searching…'; var url = 'https://geocoding-api.open-meteo.com/v1/search?name=' + encodeURIComponent(query) + '&count=10&language=en&format=json'; - fetch(url).then(function (r) { return r.json(); }).then(function (data) { + // Bound the request so a hung/never-resolving response can't leave the + // button stuck disabled on "Searching…" forever. + var controller = new AbortController(); + var timeoutId = setTimeout(function () { controller.abort(); }, 10000); + fetch(url, { signal: controller.signal }).then(function (r) { return r.json(); }).then(function (data) { var list = (data && data.results) || []; if (!list.length) { setHint('No matches — try adding a country, or drag the pin on the map.'); @@ -713,8 +723,10 @@ function initLocationDetails() { } showResults(list); }).catch(function () { - // R8: network failure degrades silently — fields untouched. + // R8: network failure (including our own timeout abort) degrades + // silently — fields untouched. }).then(function () { + clearTimeout(timeoutId); lookupBtn.disabled = false; lookupBtn.textContent = LOOKUP_LABEL; }); @@ -805,6 +817,13 @@ function initValidation() { if (!firstInvalid) firstInvalid = el; } }); + + // A flagged-but-unresolved lat/lng (typed garbage, never fixed or + // cleared) must not reach the server — the mismatch styling alone + // doesn't block submission (caught in code review). + var mismatchEl = form.querySelector('.location-field--mismatch'); + if (mismatchEl && !firstInvalid) firstInvalid = mismatchEl; + if (firstInvalid) { e.preventDefault(); if (typeof firstInvalid.focus === 'function') firstInvalid.focus(); From a5993b2091f26993ec9319b133ab0f9c9806b33d Mon Sep 17 00:00:00 2001 From: Mischa Date: Fri, 24 Jul 2026 21:34:17 +0200 Subject: [PATCH 5/8] fix(review): strict coordinate parse, close the gate bypass, drop the stale pin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Code-review fixes to the location-override panel. parseFloat is a prefix parser, so '48abc', '48,85' (comma-decimal paste) and '35.0116S' (hemisphere suffix, silently flipped to the wrong side of the equator) all passed the isFinite + range check, cleared the mismatch flag and were POSTed verbatim — the same silent-corruption class this feature exists to end. Replaced with a whole-value decimal check, and the valid branch now normalises to the 6dp the GPS handler and onDragEnd already write, so the pin and the submitted value cannot disagree. The submit gate keyed on the .location-field--mismatch class, which was only ever set by syncFields() on blur / debounced input / toggle-open-success / GPS — never at init. Three paths therefore reached the server unflagged: a draft restored by initDraft() (which runs before initLocationDetails() and assigns .value directly, firing no events), an edit-mode async prefill, and an open panel whose maplibre chunk failed to load. syncFields() now runs once at the end of initLocationDetails(), in the toggle handler's catch arm, and after the edit prefill writes lat/lng. Blanking both fields left the marker behind, presenting a stale coordinate as if it were still the entry's — added clearPin() to the map handle and call it. Removed hasPin(), which had no caller. Corrected two comments that named the wrong stylesheet and claimed .field-invalid reuse the code does not do. Co-Authored-By: Claude Opus 5 --- themes/intotheeast/js/post/post-form.js | 98 +++++++++++------------ themes/intotheeast/js/src/location-map.js | 6 +- themes/intotheeast/js/src/post-form.css | 9 ++- themes/intotheeast/js/src/post-form.js | 42 +++++++++- 4 files changed, 98 insertions(+), 57 deletions(-) diff --git a/themes/intotheeast/js/post/post-form.js b/themes/intotheeast/js/post/post-form.js index cca0f09..067ec52 100644 --- a/themes/intotheeast/js/post/post-form.js +++ b/themes/intotheeast/js/post/post-form.js @@ -1,61 +1,61 @@ -import{a as Qu,b as at,c as Jh}from"./chunk-ZWRDP37E.js";var At=at((nl,ol)=>{(function(o,l){typeof nl=="object"&&typeof ol<"u"?ol.exports=l():typeof define=="function"&&define.amd?define(l):(o=o||self,o.CodeMirror=l())})(nl,function(){"use strict";var o=navigator.userAgent,l=navigator.platform,s=/gecko\/\d/i.test(o),a=/MSIE \d/.test(o),f=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(o),h=/Edge\/(\d+)/.exec(o),c=a||f||h,d=c&&(a?document.documentMode||6:+(h||f)[1]),v=!h&&/WebKit\//.test(o),y=v&&/Qt\/\d+\.\d+/.test(o),x=!h&&/Chrome\/(\d+)/.exec(o),D=x&&+x[1],k=/Opera\//.test(o),F=/Apple Computer/.test(navigator.vendor),B=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(o),L=/PhantomJS/.test(o),T=F&&(/Mobile\/\w+/.test(o)||navigator.maxTouchPoints>2),N=/Android/.test(o),z=T||N||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(o),O=T||/Mac/.test(l),I=/\bCrOS\b/.test(o),R=/win/i.test(l),G=k&&o.match(/Version\/(\d*\.\d*)/);G&&(G=Number(G[1])),G&&G>=15&&(k=!1,v=!0);var X=O&&(y||k&&(G==null||G<12.11)),he=s||c&&d>=9;function j(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var oe=function(e,t){var i=e.className,r=j(t).exec(i);if(r){var n=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(n?r[1]+n:"")}};function H(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function Y(e,t){return H(e).appendChild(t)}function E(e,t,i,r){var n=document.createElement(e);if(i&&(n.className=i),r&&(n.style.cssText=r),typeof t=="string")n.appendChild(document.createTextNode(t));else if(t)for(var u=0;u=t)return p+(t-u);p+=g-u,p+=i-p%i,u=g+1}}var ct=function(){this.id=null,this.f=null,this.time=0,this.handler=mt(this.onTimeout,this)};ct.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ct.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i=t)return r+Math.min(p,t-n);if(n+=u-r,n+=i-n%i,r=u+1,n>=t)return r}}var Ht=[""];function pr(e){for(;Ht.length<=e;)Ht.push(De(Ht)+" ");return Ht[e]}function De(e){return e[e.length-1]}function Pt(e,t){for(var i=[],r=0;r"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Pc.test(e))}function kn(e,t){return t?t.source.indexOf("\\w")>-1&&Zo(e)?!0:t.test(e):Zo(e)}function jl(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var qc=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Qo(e){return e.charCodeAt(0)>=768&&qc.test(e)}function Gl(e,t,i){for(;(i<0?t>0:ti?-1:1;;){if(t==i)return t;var n=(t+i)/2,u=r<0?Math.ceil(n):Math.floor(n);if(u==t)return e(u)?t:i;e(u)?i=u:t=u+r}}function Rc(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,u=0;ut||t==i&&p.to==t)&&(r(Math.max(p.from,t),Math.min(p.to,i),p.level==1?"rtl":"ltr",u),n=!0)}n||r(t,i,"ltr")}var Mi=null;function Bi(e,t,i){var r;Mi=null;for(var n=0;nt)return n;u.to==t&&(u.from!=u.to&&i=="before"?r=n:Mi=n),u.from==t&&(u.from!=u.to&&i!="before"?r=n:Mi=n)}return r??Mi}var Wc=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(b){return b<=247?e.charAt(b):1424<=b&&b<=1524?"R":1536<=b&&b<=1785?t.charAt(b-1536):1774<=b&&b<=2220?"r":8192<=b&&b<=8203?"w":b==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,u=/[LRr]/,p=/[Lb1n]/,g=/[1n]/;function m(b,C,S){this.level=b,this.from=C,this.to=S}return function(b,C){var S=C=="ltr"?"L":"R";if(b.length==0||C=="ltr"&&!r.test(b))return!1;for(var _=b.length,M=[],P=0;P<_;++P)M.push(i(b.charCodeAt(P)));for(var U=0,Z=S;U<_;++U){var J=M[U];J=="m"?M[U]=Z:Z=J}for(var ee=0,V=S;ee<_;++ee){var ie=M[ee];ie=="1"&&V=="r"?M[ee]="n":u.test(ie)&&(V=ie,ie=="r"&&(M[ee]="R"))}for(var se=1,le=M[0];se<_-1;++se){var we=M[se];we=="+"&&le=="1"&&M[se+1]=="1"?M[se]="1":we==","&&le==M[se+1]&&(le=="1"||le=="n")&&(M[se]=le),le=we}for(var Le=0;Le<_;++Le){var it=M[Le];if(it==",")M[Le]="N";else if(it=="%"){var Ie=void 0;for(Ie=Le+1;Ie<_&&M[Ie]=="%";++Ie);for(var Et=Le&&M[Le-1]=="!"||Ie<_&&M[Ie]=="1"?"1":"N",wt=Le;wt-1&&(r[t]=n.slice(0,u).concat(n.slice(u+1)))}}}function je(e,t){var i=Jo(e,t);if(i.length)for(var r=Array.prototype.slice.call(arguments,2),n=0;n0}function Jr(e){e.prototype.on=function(t,i){ue(this,t,i)},e.prototype.off=function(t,i){Mt(this,t,i)}}function bt(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Yl(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Vo(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function _i(e){bt(e),Yl(e)}function $o(e){return e.target||e.srcElement}function Zl(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),O&&e.ctrlKey&&t==1&&(t=3),t}var Uc=function(){if(c&&d<9)return!1;var e=E("div");return"draggable"in e||"dragDrop"in e}(),ea;function jc(e){if(ea==null){var t=E("span","\u200B");Y(e,E("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(ea=t.offsetWidth<=1&&t.offsetHeight>2&&!(c&&d<8))}var i=ea?E("span","\u200B"):E("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var ta;function Gc(e){if(ta!=null)return ta;var t=Y(e,document.createTextNode("A\u062EA")),i=W(t,0,1).getBoundingClientRect(),r=W(t,1,2).getBoundingClientRect();return H(e),!i||i.left==i.right?!1:ta=r.right-i.right<3}var ra=` +import{a as Ju,b as at,c as Jh}from"./chunk-ZWRDP37E.js";var At=at((nl,ol)=>{(function(o,l){typeof nl=="object"&&typeof ol<"u"?ol.exports=l():typeof define=="function"&&define.amd?define(l):(o=o||self,o.CodeMirror=l())})(nl,function(){"use strict";var o=navigator.userAgent,l=navigator.platform,s=/gecko\/\d/i.test(o),a=/MSIE \d/.test(o),f=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(o),h=/Edge\/(\d+)/.exec(o),c=a||f||h,d=c&&(a?document.documentMode||6:+(h||f)[1]),v=!h&&/WebKit\//.test(o),y=v&&/Qt\/\d+\.\d+/.test(o),x=!h&&/Chrome\/(\d+)/.exec(o),D=x&&+x[1],S=/Opera\//.test(o),F=/Apple Computer/.test(navigator.vendor),B=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(o),L=/PhantomJS/.test(o),T=F&&(/Mobile\/\w+/.test(o)||navigator.maxTouchPoints>2),N=/Android/.test(o),z=T||N||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(o),O=T||/Mac/.test(l),I=/\bCrOS\b/.test(o),W=/win/i.test(l),j=S&&o.match(/Version\/(\d*\.\d*)/);j&&(j=Number(j[1])),j&&j>=15&&(S=!1,v=!0);var K=O&&(y||S&&(j==null||j<12.11)),de=s||c&&d>=9;function U(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var oe=function(e,t){var i=e.className,r=U(t).exec(i);if(r){var n=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(n?r[1]+n:"")}};function X(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function G(e,t){return X(e).appendChild(t)}function k(e,t,i,r){var n=document.createElement(e);if(i&&(n.className=i),r&&(n.style.cssText=r),typeof t=="string")n.appendChild(document.createTextNode(t));else if(t)for(var u=0;u=t)return p+(t-u);p+=g-u,p+=i-p%i,u=g+1}}var dt=function(){this.id=null,this.f=null,this.time=0,this.handler=lt(this.onTimeout,this)};dt.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},dt.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i=t)return r+Math.min(p,t-n);if(n+=u-r,n+=i-n%i,r=u+1,n>=t)return r}}var Ht=[""];function pr(e){for(;Ht.length<=e;)Ht.push(De(Ht)+" ");return Ht[e]}function De(e){return e[e.length-1]}function Pt(e,t){for(var i=[],r=0;r"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Pc.test(e))}function kn(e,t){return t?t.source.indexOf("\\w")>-1&&Zo(e)?!0:t.test(e):Zo(e)}function Gl(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var qc=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Qo(e){return e.charCodeAt(0)>=768&&qc.test(e)}function Xl(e,t,i){for(;(i<0?t>0:ti?-1:1;;){if(t==i)return t;var n=(t+i)/2,u=r<0?Math.ceil(n):Math.floor(n);if(u==t)return e(u)?t:i;e(u)?i=u:t=u+r}}function Rc(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,u=0;ut||t==i&&p.to==t)&&(r(Math.max(p.from,t),Math.min(p.to,i),p.level==1?"rtl":"ltr",u),n=!0)}n||r(t,i,"ltr")}var Mi=null;function Bi(e,t,i){var r;Mi=null;for(var n=0;nt)return n;u.to==t&&(u.from!=u.to&&i=="before"?r=n:Mi=n),u.from==t&&(u.from!=u.to&&i!="before"?r=n:Mi=n)}return r??Mi}var Wc=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(b){return b<=247?e.charAt(b):1424<=b&&b<=1524?"R":1536<=b&&b<=1785?t.charAt(b-1536):1774<=b&&b<=2220?"r":8192<=b&&b<=8203?"w":b==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,u=/[LRr]/,p=/[Lb1n]/,g=/[1n]/;function m(b,C,E){this.level=b,this.from=C,this.to=E}return function(b,C){var E=C=="ltr"?"L":"R";if(b.length==0||C=="ltr"&&!r.test(b))return!1;for(var _=b.length,M=[],P=0;P<_;++P)M.push(i(b.charCodeAt(P)));for(var R=0,Z=E;R<_;++R){var J=M[R];J=="m"?M[R]=Z:Z=J}for(var te=0,V=E;te<_;++te){var ie=M[te];ie=="1"&&V=="r"?M[te]="n":u.test(ie)&&(V=ie,ie=="r"&&(M[te]="R"))}for(var se=1,le=M[0];se<_-1;++se){var we=M[se];we=="+"&&le=="1"&&M[se+1]=="1"?M[se]="1":we==","&&le==M[se+1]&&(le=="1"||le=="n")&&(M[se]=le),le=we}for(var Le=0;Le<_;++Le){var it=M[Le];if(it==",")M[Le]="N";else if(it=="%"){var Ie=void 0;for(Ie=Le+1;Ie<_&&M[Ie]=="%";++Ie);for(var Et=Le&&M[Le-1]=="!"||Ie<_&&M[Ie]=="1"?"1":"N",wt=Le;wt-1&&(r[t]=n.slice(0,u).concat(n.slice(u+1)))}}}function je(e,t){var i=Jo(e,t);if(i.length)for(var r=Array.prototype.slice.call(arguments,2),n=0;n0}function Jr(e){e.prototype.on=function(t,i){ue(this,t,i)},e.prototype.off=function(t,i){Mt(this,t,i)}}function bt(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Zl(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Vo(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function _i(e){bt(e),Zl(e)}function $o(e){return e.target||e.srcElement}function Ql(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),O&&e.ctrlKey&&t==1&&(t=3),t}var Uc=function(){if(c&&d<9)return!1;var e=k("div");return"draggable"in e||"dragDrop"in e}(),ea;function jc(e){if(ea==null){var t=k("span","\u200B");G(e,k("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(ea=t.offsetWidth<=1&&t.offsetHeight>2&&!(c&&d<8))}var i=ea?k("span","\u200B"):k("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var ta;function Gc(e){if(ta!=null)return ta;var t=G(e,document.createTextNode("A\u062EA")),i=q(t,0,1).getBoundingClientRect(),r=q(t,1,2).getBoundingClientRect();return X(e),!i||i.left==i.right?!1:ta=r.right-i.right<3}var ra=` b`.split(/\n/).length!=3?function(e){for(var t=0,i=[],r=e.length;t<=r;){var n=e.indexOf(` -`,t);n==-1&&(n=e.length);var u=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),p=u.indexOf("\r");p!=-1?(i.push(u.slice(0,p)),t+=p+1):(i.push(u),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},Xc=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch{return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch{}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Kc=function(){var e=E("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),ia=null;function Yc(e){if(ia!=null)return ia;var t=Y(e,E("span","x")),i=t.getBoundingClientRect(),r=W(t,0,1).getBoundingClientRect();return ia=Math.abs(i.left-r.left)>1}var na={},Vr={};function Zc(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),na[e]=t}function Qc(e,t){Vr[e]=t}function Sn(e){if(typeof e=="string"&&Vr.hasOwnProperty(e))e=Vr[e];else if(e&&typeof e.name=="string"&&Vr.hasOwnProperty(e.name)){var t=Vr[e.name];typeof t=="string"&&(t={name:t}),e=Ul(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Sn("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Sn("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function oa(e,t){t=Sn(t);var i=na[t.name];if(!i)return oa(e,"text/plain");var r=i(e,t);if($r.hasOwnProperty(t.name)){var n=$r[t.name];for(var u in n)n.hasOwnProperty(u)&&(r.hasOwnProperty(u)&&(r["_"+u]=r[u]),r[u]=n[u])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var p in t.modeProps)r[p]=t.modeProps[p];return r}var $r={};function Jc(e,t){var i=$r.hasOwnProperty(e)?$r[e]:$r[e]={};Lt(t,i)}function Lr(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var r in t){var n=t[r];n instanceof Array&&(n=n.concat([])),i[r]=n}return i}function aa(e,t){for(var i;e.innerMode&&(i=e.innerMode(t),!(!i||i.mode==e));)t=i.state,e=i.mode;return i||{mode:e,state:t}}function Ql(e,t,i){return e.startState?e.startState(t,i):!0}var Ge=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};Ge.prototype.eol=function(){return this.pos>=this.string.length},Ge.prototype.sol=function(){return this.pos==this.lineStart},Ge.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ge.prototype.next=function(){if(this.post},Ge.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ge.prototype.skipToEnd=function(){this.pos=this.string.length},Ge.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ge.prototype.backUp=function(e){this.pos-=e},Ge.prototype.column=function(){return this.lastColumnPos0?null:(u&&t!==!1&&(this.pos+=u[0].length),u)}},Ge.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ge.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ge.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ge.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ae(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var i=e;!i.lines;)for(var r=0;;++r){var n=i.children[r],u=n.chunkSize();if(t=e.first&&ti?K(i,ae(e,i).text.length):Vc(t,ae(e,t.line).text.length)}function Vc(e,t){var i=e.ch;return i==null||i>t?K(e.line,t):i<0?K(e.line,0):e}function Vl(e,t){for(var i=[],r=0;rthis.maxLookAhead&&(this.maxLookAhead=e),t},Zt.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},Zt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Zt.fromSaved=function(e,t,i){return t instanceof Fn?new Zt(e,Lr(e.mode,t.state),i,t.lookAhead):new Zt(e,Lr(e.mode,t),i)},Zt.prototype.save=function(e){var t=e!==!1?Lr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Fn(t,this.maxLookAhead):t};function $l(e,t,i,r){var n=[e.state.modeGen],u={};os(e,t.text,e.doc.mode,i,function(b,C){return n.push(b,C)},u,r);for(var p=i.state,g=function(b){i.baseTokens=n;var C=e.state.overlays[b],S=1,_=0;i.state=!0,os(e,t.text,C.mode,i,function(M,P){for(var U=S;_M&&n.splice(S,1,M,n[S+1],Z),S+=2,_=Math.min(M,Z)}if(P)if(C.opaque)n.splice(U,S-U,M,"overlay "+P),S=U+2;else for(;Ue.options.maxHighlightLength&&Lr(e.doc.mode,r.state),u=$l(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=u.styles,u.classes?t.styleClasses=u.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Ni(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new Zt(r,!0,t);var u=$c(e,t,i),p=u>r.first&&ae(r,u-1).stateAfter,g=p?Zt.fromSaved(r,p,u):new Zt(r,Ql(r.mode),u);return r.iter(u,t,function(m){ca(e,m.text,g);var b=g.line;m.stateAfter=b==t-1||b%5==0||b>=n.viewFrom&&bt.start)return u}throw new Error("Mode "+e.name+" failed to advance stream.")}var rs=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function is(e,t,i,r){var n=e.doc,u=n.mode,p;t=ve(n,t);var g=ae(n,t.line),m=Ni(e,t.line,i),b=new Ge(g.text,e.options.tabSize,m),C;for(r&&(C=[]);(r||b.pose.options.maxHighlightLength?(g=!1,p&&ca(e,t,r,C.pos),C.pos=t.length,S=null):S=ns(da(i,C,r.state,_),u),_){var M=_[0].name;M&&(S="m-"+(S?M+" "+S:M))}if(!g||b!=S){for(;mp;--g){if(g<=u.first)return u.first;var m=ae(u,g-1),b=m.stateAfter;if(b&&(!i||g+(b instanceof Fn?b.lookAhead:0)<=u.modeFrontier))return g;var C=Ye(m.text,null,e.options.tabSize);(n==null||r>C)&&(n=g-1,r=C)}return n}function ed(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontieri;r--){var n=ae(e,r).stateAfter;if(n&&(!(n instanceof Fn)||r+n.lookAhead=t:u.to>t);(r||(r=[])).push(new Tn(p,u.from,m?null:u.to))}}return r}function ad(e,t,i){var r;if(e)for(var n=0;n=t:u.to>t);if(g||u.from==t&&p.type=="bookmark"&&(!i||u.marker.insertLeft)){var m=u.from==null||(p.inclusiveLeft?u.from<=t:u.from0&&g)for(var ie=0;ie0)){var C=[m,1],S=me(b.from,g.from),_=me(b.to,g.to);(S<0||!p.inclusiveLeft&&!S)&&C.push({from:b.from,to:g.from}),(_>0||!p.inclusiveRight&&!_)&&C.push({from:g.to,to:b.to}),n.splice.apply(n,C),m+=C.length-3}}return n}function ss(e){var t=e.markedSpans;if(t){for(var i=0;it)&&(!r||pa(r,u.marker)<0)&&(r=u.marker)}return r}function ds(e,t,i,r,n){var u=ae(e,t),p=rr&&u.markedSpans;if(p)for(var g=0;g=0&&S<=0||C<=0&&S>=0)&&(C<=0&&(m.marker.inclusiveRight&&n.inclusiveLeft?me(b.to,i)>=0:me(b.to,i)>0)||C>=0&&(m.marker.inclusiveRight&&n.inclusiveLeft?me(b.from,r)<=0:me(b.from,r)<0)))return!0}}}function qt(e){for(var t;t=cs(e);)e=t.find(-1,!0).line;return e}function ud(e){for(var t;t=Bn(e);)e=t.find(1,!0).line;return e}function fd(e){for(var t,i;t=Bn(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function ga(e,t){var i=ae(e,t),r=qt(i);return i==r?t:Fe(r)}function hs(e,t){if(t>e.lastLine())return t;var i=ae(e,t),r;if(!mr(e,i))return t;for(;r=Bn(i);)i=r.find(1,!0).line;return Fe(i)+1}function mr(e,t){var i=rr&&t.markedSpans;if(i){for(var r=void 0,n=0;nt.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var ei=function(e,t,i){this.text=e,us(this,t),this.height=i?i(this):1};ei.prototype.lineNo=function(){return Fe(this)},Jr(ei);function cd(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),ss(e),us(e,i);var n=r?r(e):1;n!=e.height&&Yt(e,n)}function dd(e){e.parent=null,ss(e)}var hd={},pd={};function ps(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?pd:hd;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function gs(e,t){var i=q("span",null,null,v?"padding-right: .1px":null),r={pre:q("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var u=n?t.rest[n-1]:t.line,p=void 0;r.pos=0,r.addToken=md,Gc(e.display.measure)&&(p=tr(u,e.doc.direction))&&(r.addToken=bd(r.addToken,p)),r.map=[];var g=t!=e.display.externalMeasured&&Fe(u);yd(u,r,es(e,u,g)),u.styleClasses&&(u.styleClasses.bgClass&&(r.bgClass=Ae(u.styleClasses.bgClass,r.bgClass||"")),u.styleClasses.textClass&&(r.textClass=Ae(u.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(jc(e.display.measure))),n==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(v){var m=r.content.lastChild;(/\bcm-tab\b/.test(m.className)||m.querySelector&&m.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return je(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=Ae(r.pre.className,r.textClass||"")),r}function gd(e){var t=E("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function md(e,t,i,r,n,u,p){if(t){var g=e.splitSpaces?vd(t,e.trailingSpace):t,m=e.cm.state.specialChars,b=!1,C;if(!m.test(t))e.col+=t.length,C=document.createTextNode(g),e.map.push(e.pos,e.pos+t.length,C),c&&d<9&&(b=!0),e.pos+=t.length;else{C=document.createDocumentFragment();for(var S=0;;){m.lastIndex=S;var _=m.exec(t),M=_?_.index-S:t.length-S;if(M){var P=document.createTextNode(g.slice(S,S+M));c&&d<9?C.appendChild(E("span",[P])):C.appendChild(P),e.map.push(e.pos,e.pos+M,P),e.col+=M,e.pos+=M}if(!_)break;S+=M+1;var U=void 0;if(_[0]==" "){var Z=e.cm.options.tabSize,J=Z-e.col%Z;U=C.appendChild(E("span",pr(J),"cm-tab")),U.setAttribute("role","presentation"),U.setAttribute("cm-text"," "),e.col+=J}else _[0]=="\r"||_[0]==` -`?(U=C.appendChild(E("span",_[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),U.setAttribute("cm-text",_[0]),e.col+=1):(U=e.cm.options.specialCharPlaceholder(_[0]),U.setAttribute("cm-text",_[0]),c&&d<9?C.appendChild(E("span",[U])):C.appendChild(U),e.col+=1);e.map.push(e.pos,e.pos+1,U),e.pos++}}if(e.trailingSpace=g.charCodeAt(t.length-1)==32,i||r||n||b||u||p){var ee=i||"";r&&(ee+=r),n&&(ee+=n);var V=E("span",[C],ee,u);if(p)for(var ie in p)p.hasOwnProperty(ie)&&ie!="style"&&ie!="class"&&V.setAttribute(ie,p[ie]);return e.content.appendChild(V)}e.content.appendChild(C)}}function vd(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;nb&&S.from<=b));_++);if(S.to>=C)return e(i,r,n,u,p,g,m);e(i,r.slice(0,S.to-b),n,u,null,g,m),u=null,r=r.slice(S.to-b),b=S.to}}}function ms(e,t,i,r){var n=!r&&i.widgetNode;n&&e.map.push(e.pos,e.pos+t,n),!r&&e.cm.display.input.needsContentAttribute&&(n||(n=e.content.appendChild(document.createElement("span"))),n.setAttribute("cm-marker",i.id)),n&&(e.cm.display.input.setUneditable(n),e.content.appendChild(n)),e.pos+=t,e.trailingSpace=!1}function yd(e,t,i){var r=e.markedSpans,n=e.text,u=0;if(!r){for(var p=1;pm||we.collapsed&&le.to==m&&le.from==m)){if(le.to!=null&&le.to!=m&&M>le.to&&(M=le.to,U=""),we.className&&(P+=" "+we.className),we.css&&(_=(_?_+";":"")+we.css),we.startStyle&&le.from==m&&(Z+=" "+we.startStyle),we.endStyle&&le.to==M&&(ie||(ie=[])).push(we.endStyle,le.to),we.title&&((ee||(ee={})).title=we.title),we.attributes)for(var Le in we.attributes)(ee||(ee={}))[Le]=we.attributes[Le];we.collapsed&&(!J||pa(J.marker,we)<0)&&(J=le)}else le.from>m&&M>le.from&&(M=le.from)}if(ie)for(var it=0;it=g)break;for(var Et=Math.min(g,M);;){if(C){var wt=m+C.length;if(!J){var Xe=wt>Et?C.slice(0,Et-m):C;t.addToken(t,Xe,S?S+P:P,Z,m+Xe.length==M?U:"",_,ee)}if(wt>=Et){C=C.slice(Et-m),m=Et;break}m=wt,Z=""}C=n.slice(u,u=i[b++]),S=ps(i[b++],t.cm.options)}}}function vs(e,t,i){this.line=t,this.rest=fd(t),this.size=this.rest?Fe(De(this.rest))-i+1:1,this.node=this.text=null,this.hidden=mr(e,t)}function zn(e,t,i){for(var r=[],n,u=t;u2&&u.push((m.bottom+b.top)/2-i.top)}}u.push(i.bottom-i.top)}}function ks(e,t,i){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var r=0;ri)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}}function Ld(e,t){t=qt(t);var i=Fe(t),r=e.display.externalMeasured=new vs(e.doc,t,i);r.lineN=i;var n=r.built=gs(e,r);return r.text=n.pre,Y(e.display.lineMeasure,n.pre),r}function Ss(e,t,i,r){return Jt(e,ri(e,t),i,r)}function wa(e,t){if(t>=e.display.viewFrom&&t=i.lineN&&tt)&&(u=m-g,n=u-1,t>=m&&(p="right")),n!=null){if(r=e[b+2],g==m&&i==(r.insertLeft?"left":"right")&&(p=i),i=="left"&&n==0)for(;b&&e[b-2]==e[b-3]&&e[b-1].insertLeft;)r=e[(b-=3)+2],p="left";if(i=="right"&&n==m-g)for(;b=0&&(i=e[n]).left==i.right;n--);return i}function Bd(e,t,i,r){var n=As(t.map,i,r),u=n.node,p=n.start,g=n.end,m=n.collapse,b;if(u.nodeType==3){for(var C=0;C<4;C++){for(;p&&Qo(t.line.text.charAt(n.coverStart+p));)--p;for(;n.coverStart+g0&&(m=r="right");var S;e.options.lineWrapping&&(S=u.getClientRects()).length>1?b=S[r=="right"?S.length-1:0]:b=u.getBoundingClientRect()}if(c&&d<9&&!p&&(!b||!b.left&&!b.right)){var _=u.parentNode.getClientRects()[0];_?b={left:_.left,right:_.left+ni(e.display),top:_.top,bottom:_.bottom}:b=Es}for(var M=b.top-t.rect.top,P=b.bottom-t.rect.top,U=(M+P)/2,Z=t.view.measure.heights,J=0;J=r.text.length?(m=r.text.length,b="before"):m<=0&&(m=0,b="after"),!g)return p(b=="before"?m-1:m,b=="before");function C(P,U,Z){var J=g[U],ee=J.level==1;return p(Z?P-1:P,ee!=Z)}var S=Bi(g,m,b),_=Mi,M=C(m,S,b=="before");return _!=null&&(M.other=C(m,_,b!="before")),M}function _s(e,t){var i=0;t=ve(e.doc,t),e.options.lineWrapping||(i=ni(e.display)*t.ch);var r=ae(e.doc,t.line),n=ir(r)+Nn(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function Da(e,t,i,r,n){var u=K(e,t,i);return u.xRel=n,r&&(u.outside=r),u}function ka(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return Da(r.first,0,null,-1,-1);var n=Br(r,i),u=r.first+r.size-1;if(n>u)return Da(r.first+r.size-1,ae(r,u).text.length,null,1,1);t<0&&(t=0);for(var p=ae(r,n);;){var g=zd(e,p,n,t,i),m=sd(p,g.ch+(g.xRel>0||g.outside>0?1:0));if(!m)return g;var b=m.find(1);if(b.line==n)return b;p=ae(r,n=b.line)}}function zs(e,t,i,r){r-=Ca(t);var n=t.text.length,u=Li(function(p){return Jt(e,i,p-1).bottom<=r},n,0);return n=Li(function(p){return Jt(e,i,p).top>r},u,n),{begin:u,end:n}}function Ns(e,t,i,r){i||(i=ri(e,t));var n=On(e,t,Jt(e,i,r),"line").top;return zs(e,t,i,n)}function Sa(e,t,i,r){return e.bottom<=i?!1:e.top>i?!0:(r?e.left:e.right)>t}function zd(e,t,i,r,n){n-=ir(t);var u=ri(e,t),p=Ca(t),g=0,m=t.text.length,b=!0,C=tr(t,e.doc.direction);if(C){var S=(e.options.lineWrapping?Od:Nd)(e,t,i,u,C,r,n);b=S.level!=1,g=b?S.from:S.to-1,m=b?S.to:S.from-1}var _=null,M=null,P=Li(function(se){var le=Jt(e,u,se);return le.top+=p,le.bottom+=p,Sa(le,r,n,!1)?(le.top<=n&&le.left<=r&&(_=se,M=le),!0):!1},g,m),U,Z,J=!1;if(M){var ee=r-M.left=ie.bottom?1:0}return P=Gl(t.text,P,1),Da(i,P,Z,J,r-U)}function Nd(e,t,i,r,n,u,p){var g=Li(function(S){var _=n[S],M=_.level!=1;return Sa(Rt(e,K(i,M?_.to:_.from,M?"before":"after"),"line",t,r),u,p,!0)},0,n.length-1),m=n[g];if(g>0){var b=m.level!=1,C=Rt(e,K(i,b?m.from:m.to,b?"after":"before"),"line",t,r);Sa(C,u,p,!0)&&C.top>p&&(m=n[g-1])}return m}function Od(e,t,i,r,n,u,p){var g=zs(e,t,r,p),m=g.begin,b=g.end;/\s/.test(t.text.charAt(b-1))&&b--;for(var C=null,S=null,_=0;_=b||M.to<=m)){var P=M.level!=1,U=Jt(e,r,P?Math.min(b,M.to)-1:Math.max(m,M.from)).right,Z=UZ)&&(C=M,S=Z)}}return C||(C=n[n.length-1]),C.fromb&&(C={from:C.from,to:b,level:C.level}),C}var zr;function ii(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(zr==null){zr=E("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)zr.appendChild(document.createTextNode("x")),zr.appendChild(E("br"));zr.appendChild(document.createTextNode("x"))}Y(e.measure,zr);var i=zr.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),H(e.measure),i||1}function ni(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=E("span","xxxxxxxxxx"),i=E("pre",[t],"CodeMirror-line-like");Y(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function Ea(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,u=t.gutters.firstChild,p=0;u;u=u.nextSibling,++p){var g=e.display.gutterSpecs[p].className;i[g]=u.offsetLeft+u.clientLeft+n,r[g]=u.clientWidth}return{fixedPos:Aa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Aa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Os(e){var t=ii(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/ni(e.display)-3);return function(n){if(mr(e.doc,n))return 0;var u=0;if(n.widgets)for(var p=0;p0&&(b=ae(e.doc,m.line).text).length==m.ch){var C=Ye(b,b.length,e.options.tabSize)-b.length;m=K(m.line,Math.max(0,Math.round((u-Ds(e.display).left)/ni(e.display))-C))}return m}function Or(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var i=e.display.view,r=0;rt)&&(n.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=n.viewTo)rr&&ga(e.doc,t)n.viewFrom?br(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)br(e);else if(t<=n.viewFrom){var u=Hn(e,i,i+r,1);u?(n.view=n.view.slice(u.index),n.viewFrom=u.lineN,n.viewTo+=r):br(e)}else if(i>=n.viewTo){var p=Hn(e,t,t,-1);p?(n.view=n.view.slice(0,p.index),n.viewTo=p.lineN):br(e)}else{var g=Hn(e,t,t,-1),m=Hn(e,i,i+r,1);g&&m?(n.view=n.view.slice(0,g.index).concat(zn(e,g.lineN,m.lineN)).concat(n.view.slice(m.index)),n.viewTo+=r):br(e)}var b=n.externalMeasured;b&&(i=n.lineN&&t=r.viewTo)){var u=r.view[Or(e,t)];if(u.node!=null){var p=u.changes||(u.changes=[]);ze(p,i)==-1&&p.push(i)}}}function br(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Hn(e,t,i,r){var n=Or(e,t),u,p=e.display.view;if(!rr||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var g=e.display.viewFrom,m=0;m0){if(n==p.length-1)return null;u=g+p[n].size-t,n++}else u=g-t;t+=u,i+=u}for(;ga(e.doc,i)!=i;){if(n==(r<0?0:p.length-1))return null;i+=r*p[n-(r<0?1:0)].size,n+=r}return{index:n,lineN:i}}function Id(e,t,i){var r=e.display,n=r.view;n.length==0||t>=r.viewTo||i<=r.viewFrom?(r.view=zn(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=zn(e,t,r.viewFrom).concat(r.view):r.viewFromi&&(r.view=r.view.slice(0,Or(e,i)))),r.viewTo=i}function Is(e){for(var t=e.display.view,i=0,r=0;r=e.display.viewTo||m.to().line0?p:e.defaultCharWidth())+"px"}if(r.other){var g=i.appendChild(E("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));g.style.display="",g.style.left=r.other.left+"px",g.style.top=r.other.top+"px",g.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Pn(e,t){return e.top-t.top||e.left-t.left}function Hd(e,t,i){var r=e.display,n=e.doc,u=document.createDocumentFragment(),p=Ds(e.display),g=p.left,m=Math.max(r.sizerWidth,_r(e)-r.sizer.offsetLeft)-p.right,b=n.direction=="ltr";function C(V,ie,se,le){ie<0&&(ie=0),ie=Math.round(ie),le=Math.round(le),u.appendChild(E("div",null,"CodeMirror-selected","position: absolute; left: "+V+`px; +`,t);n==-1&&(n=e.length);var u=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),p=u.indexOf("\r");p!=-1?(i.push(u.slice(0,p)),t+=p+1):(i.push(u),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},Xc=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch{return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch{}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Kc=function(){var e=k("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),ia=null;function Yc(e){if(ia!=null)return ia;var t=G(e,k("span","x")),i=t.getBoundingClientRect(),r=q(t,0,1).getBoundingClientRect();return ia=Math.abs(i.left-r.left)>1}var na={},Vr={};function Zc(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),na[e]=t}function Qc(e,t){Vr[e]=t}function Sn(e){if(typeof e=="string"&&Vr.hasOwnProperty(e))e=Vr[e];else if(e&&typeof e.name=="string"&&Vr.hasOwnProperty(e.name)){var t=Vr[e.name];typeof t=="string"&&(t={name:t}),e=jl(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Sn("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Sn("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function oa(e,t){t=Sn(t);var i=na[t.name];if(!i)return oa(e,"text/plain");var r=i(e,t);if($r.hasOwnProperty(t.name)){var n=$r[t.name];for(var u in n)n.hasOwnProperty(u)&&(r.hasOwnProperty(u)&&(r["_"+u]=r[u]),r[u]=n[u])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var p in t.modeProps)r[p]=t.modeProps[p];return r}var $r={};function Jc(e,t){var i=$r.hasOwnProperty(e)?$r[e]:$r[e]={};Lt(t,i)}function Lr(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var r in t){var n=t[r];n instanceof Array&&(n=n.concat([])),i[r]=n}return i}function aa(e,t){for(var i;e.innerMode&&(i=e.innerMode(t),!(!i||i.mode==e));)t=i.state,e=i.mode;return i||{mode:e,state:t}}function Jl(e,t,i){return e.startState?e.startState(t,i):!0}var Ge=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};Ge.prototype.eol=function(){return this.pos>=this.string.length},Ge.prototype.sol=function(){return this.pos==this.lineStart},Ge.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ge.prototype.next=function(){if(this.post},Ge.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ge.prototype.skipToEnd=function(){this.pos=this.string.length},Ge.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ge.prototype.backUp=function(e){this.pos-=e},Ge.prototype.column=function(){return this.lastColumnPos0?null:(u&&t!==!1&&(this.pos+=u[0].length),u)}},Ge.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ge.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ge.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ge.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ae(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var i=e;!i.lines;)for(var r=0;;++r){var n=i.children[r],u=n.chunkSize();if(t=e.first&&ti?Y(i,ae(e,i).text.length):Vc(t,ae(e,t.line).text.length)}function Vc(e,t){var i=e.ch;return i==null||i>t?Y(e.line,t):i<0?Y(e.line,0):e}function $l(e,t){for(var i=[],r=0;rthis.maxLookAhead&&(this.maxLookAhead=e),t},Zt.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},Zt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Zt.fromSaved=function(e,t,i){return t instanceof Fn?new Zt(e,Lr(e.mode,t.state),i,t.lookAhead):new Zt(e,Lr(e.mode,t),i)},Zt.prototype.save=function(e){var t=e!==!1?Lr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Fn(t,this.maxLookAhead):t};function es(e,t,i,r){var n=[e.state.modeGen],u={};as(e,t.text,e.doc.mode,i,function(b,C){return n.push(b,C)},u,r);for(var p=i.state,g=function(b){i.baseTokens=n;var C=e.state.overlays[b],E=1,_=0;i.state=!0,as(e,t.text,C.mode,i,function(M,P){for(var R=E;_M&&n.splice(E,1,M,n[E+1],Z),E+=2,_=Math.min(M,Z)}if(P)if(C.opaque)n.splice(R,E-R,M,"overlay "+P),E=R+2;else for(;Re.options.maxHighlightLength&&Lr(e.doc.mode,r.state),u=es(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=u.styles,u.classes?t.styleClasses=u.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Ni(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new Zt(r,!0,t);var u=$c(e,t,i),p=u>r.first&&ae(r,u-1).stateAfter,g=p?Zt.fromSaved(r,p,u):new Zt(r,Jl(r.mode),u);return r.iter(u,t,function(m){ca(e,m.text,g);var b=g.line;m.stateAfter=b==t-1||b%5==0||b>=n.viewFrom&&bt.start)return u}throw new Error("Mode "+e.name+" failed to advance stream.")}var is=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function ns(e,t,i,r){var n=e.doc,u=n.mode,p;t=ve(n,t);var g=ae(n,t.line),m=Ni(e,t.line,i),b=new Ge(g.text,e.options.tabSize,m),C;for(r&&(C=[]);(r||b.pose.options.maxHighlightLength?(g=!1,p&&ca(e,t,r,C.pos),C.pos=t.length,E=null):E=os(da(i,C,r.state,_),u),_){var M=_[0].name;M&&(E="m-"+(E?M+" "+E:M))}if(!g||b!=E){for(;mp;--g){if(g<=u.first)return u.first;var m=ae(u,g-1),b=m.stateAfter;if(b&&(!i||g+(b instanceof Fn?b.lookAhead:0)<=u.modeFrontier))return g;var C=Ye(m.text,null,e.options.tabSize);(n==null||r>C)&&(n=g-1,r=C)}return n}function ed(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontieri;r--){var n=ae(e,r).stateAfter;if(n&&(!(n instanceof Fn)||r+n.lookAhead=t:u.to>t);(r||(r=[])).push(new Tn(p,u.from,m?null:u.to))}}return r}function ad(e,t,i){var r;if(e)for(var n=0;n=t:u.to>t);if(g||u.from==t&&p.type=="bookmark"&&(!i||u.marker.insertLeft)){var m=u.from==null||(p.inclusiveLeft?u.from<=t:u.from0&&g)for(var ie=0;ie0)){var C=[m,1],E=me(b.from,g.from),_=me(b.to,g.to);(E<0||!p.inclusiveLeft&&!E)&&C.push({from:b.from,to:g.from}),(_>0||!p.inclusiveRight&&!_)&&C.push({from:g.to,to:b.to}),n.splice.apply(n,C),m+=C.length-3}}return n}function us(e){var t=e.markedSpans;if(t){for(var i=0;it)&&(!r||pa(r,u.marker)<0)&&(r=u.marker)}return r}function hs(e,t,i,r,n){var u=ae(e,t),p=rr&&u.markedSpans;if(p)for(var g=0;g=0&&E<=0||C<=0&&E>=0)&&(C<=0&&(m.marker.inclusiveRight&&n.inclusiveLeft?me(b.to,i)>=0:me(b.to,i)>0)||C>=0&&(m.marker.inclusiveRight&&n.inclusiveLeft?me(b.from,r)<=0:me(b.from,r)<0)))return!0}}}function qt(e){for(var t;t=ds(e);)e=t.find(-1,!0).line;return e}function ud(e){for(var t;t=Bn(e);)e=t.find(1,!0).line;return e}function fd(e){for(var t,i;t=Bn(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function ga(e,t){var i=ae(e,t),r=qt(i);return i==r?t:Fe(r)}function ps(e,t){if(t>e.lastLine())return t;var i=ae(e,t),r;if(!mr(e,i))return t;for(;r=Bn(i);)i=r.find(1,!0).line;return Fe(i)+1}function mr(e,t){var i=rr&&t.markedSpans;if(i){for(var r=void 0,n=0;nt.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var ei=function(e,t,i){this.text=e,fs(this,t),this.height=i?i(this):1};ei.prototype.lineNo=function(){return Fe(this)},Jr(ei);function cd(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),us(e),fs(e,i);var n=r?r(e):1;n!=e.height&&Yt(e,n)}function dd(e){e.parent=null,us(e)}var hd={},pd={};function gs(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?pd:hd;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function ms(e,t){var i=H("span",null,null,v?"padding-right: .1px":null),r={pre:H("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var u=n?t.rest[n-1]:t.line,p=void 0;r.pos=0,r.addToken=md,Gc(e.display.measure)&&(p=tr(u,e.doc.direction))&&(r.addToken=bd(r.addToken,p)),r.map=[];var g=t!=e.display.externalMeasured&&Fe(u);yd(u,r,ts(e,u,g)),u.styleClasses&&(u.styleClasses.bgClass&&(r.bgClass=Ee(u.styleClasses.bgClass,r.bgClass||"")),u.styleClasses.textClass&&(r.textClass=Ee(u.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(jc(e.display.measure))),n==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(v){var m=r.content.lastChild;(/\bcm-tab\b/.test(m.className)||m.querySelector&&m.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return je(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=Ee(r.pre.className,r.textClass||"")),r}function gd(e){var t=k("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function md(e,t,i,r,n,u,p){if(t){var g=e.splitSpaces?vd(t,e.trailingSpace):t,m=e.cm.state.specialChars,b=!1,C;if(!m.test(t))e.col+=t.length,C=document.createTextNode(g),e.map.push(e.pos,e.pos+t.length,C),c&&d<9&&(b=!0),e.pos+=t.length;else{C=document.createDocumentFragment();for(var E=0;;){m.lastIndex=E;var _=m.exec(t),M=_?_.index-E:t.length-E;if(M){var P=document.createTextNode(g.slice(E,E+M));c&&d<9?C.appendChild(k("span",[P])):C.appendChild(P),e.map.push(e.pos,e.pos+M,P),e.col+=M,e.pos+=M}if(!_)break;E+=M+1;var R=void 0;if(_[0]==" "){var Z=e.cm.options.tabSize,J=Z-e.col%Z;R=C.appendChild(k("span",pr(J),"cm-tab")),R.setAttribute("role","presentation"),R.setAttribute("cm-text"," "),e.col+=J}else _[0]=="\r"||_[0]==` +`?(R=C.appendChild(k("span",_[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),R.setAttribute("cm-text",_[0]),e.col+=1):(R=e.cm.options.specialCharPlaceholder(_[0]),R.setAttribute("cm-text",_[0]),c&&d<9?C.appendChild(k("span",[R])):C.appendChild(R),e.col+=1);e.map.push(e.pos,e.pos+1,R),e.pos++}}if(e.trailingSpace=g.charCodeAt(t.length-1)==32,i||r||n||b||u||p){var te=i||"";r&&(te+=r),n&&(te+=n);var V=k("span",[C],te,u);if(p)for(var ie in p)p.hasOwnProperty(ie)&&ie!="style"&&ie!="class"&&V.setAttribute(ie,p[ie]);return e.content.appendChild(V)}e.content.appendChild(C)}}function vd(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;nb&&E.from<=b));_++);if(E.to>=C)return e(i,r,n,u,p,g,m);e(i,r.slice(0,E.to-b),n,u,null,g,m),u=null,r=r.slice(E.to-b),b=E.to}}}function vs(e,t,i,r){var n=!r&&i.widgetNode;n&&e.map.push(e.pos,e.pos+t,n),!r&&e.cm.display.input.needsContentAttribute&&(n||(n=e.content.appendChild(document.createElement("span"))),n.setAttribute("cm-marker",i.id)),n&&(e.cm.display.input.setUneditable(n),e.content.appendChild(n)),e.pos+=t,e.trailingSpace=!1}function yd(e,t,i){var r=e.markedSpans,n=e.text,u=0;if(!r){for(var p=1;pm||we.collapsed&&le.to==m&&le.from==m)){if(le.to!=null&&le.to!=m&&M>le.to&&(M=le.to,R=""),we.className&&(P+=" "+we.className),we.css&&(_=(_?_+";":"")+we.css),we.startStyle&&le.from==m&&(Z+=" "+we.startStyle),we.endStyle&&le.to==M&&(ie||(ie=[])).push(we.endStyle,le.to),we.title&&((te||(te={})).title=we.title),we.attributes)for(var Le in we.attributes)(te||(te={}))[Le]=we.attributes[Le];we.collapsed&&(!J||pa(J.marker,we)<0)&&(J=le)}else le.from>m&&M>le.from&&(M=le.from)}if(ie)for(var it=0;it=g)break;for(var Et=Math.min(g,M);;){if(C){var wt=m+C.length;if(!J){var Xe=wt>Et?C.slice(0,Et-m):C;t.addToken(t,Xe,E?E+P:P,Z,m+Xe.length==M?R:"",_,te)}if(wt>=Et){C=C.slice(Et-m),m=Et;break}m=wt,Z=""}C=n.slice(u,u=i[b++]),E=gs(i[b++],t.cm.options)}}}function bs(e,t,i){this.line=t,this.rest=fd(t),this.size=this.rest?Fe(De(this.rest))-i+1:1,this.node=this.text=null,this.hidden=mr(e,t)}function zn(e,t,i){for(var r=[],n,u=t;u2&&u.push((m.bottom+b.top)/2-i.top)}}u.push(i.bottom-i.top)}}function Ss(e,t,i){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var r=0;ri)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}}function Ld(e,t){t=qt(t);var i=Fe(t),r=e.display.externalMeasured=new bs(e.doc,t,i);r.lineN=i;var n=r.built=ms(e,r);return r.text=n.pre,G(e.display.lineMeasure,n.pre),r}function Es(e,t,i,r){return Jt(e,ri(e,t),i,r)}function wa(e,t){if(t>=e.display.viewFrom&&t=i.lineN&&tt)&&(u=m-g,n=u-1,t>=m&&(p="right")),n!=null){if(r=e[b+2],g==m&&i==(r.insertLeft?"left":"right")&&(p=i),i=="left"&&n==0)for(;b&&e[b-2]==e[b-3]&&e[b-1].insertLeft;)r=e[(b-=3)+2],p="left";if(i=="right"&&n==m-g)for(;b=0&&(i=e[n]).left==i.right;n--);return i}function Bd(e,t,i,r){var n=Fs(t.map,i,r),u=n.node,p=n.start,g=n.end,m=n.collapse,b;if(u.nodeType==3){for(var C=0;C<4;C++){for(;p&&Qo(t.line.text.charAt(n.coverStart+p));)--p;for(;n.coverStart+g0&&(m=r="right");var E;e.options.lineWrapping&&(E=u.getClientRects()).length>1?b=E[r=="right"?E.length-1:0]:b=u.getBoundingClientRect()}if(c&&d<9&&!p&&(!b||!b.left&&!b.right)){var _=u.parentNode.getClientRects()[0];_?b={left:_.left,right:_.left+ni(e.display),top:_.top,bottom:_.bottom}:b=As}for(var M=b.top-t.rect.top,P=b.bottom-t.rect.top,R=(M+P)/2,Z=t.view.measure.heights,J=0;J=r.text.length?(m=r.text.length,b="before"):m<=0&&(m=0,b="after"),!g)return p(b=="before"?m-1:m,b=="before");function C(P,R,Z){var J=g[R],te=J.level==1;return p(Z?P-1:P,te!=Z)}var E=Bi(g,m,b),_=Mi,M=C(m,E,b=="before");return _!=null&&(M.other=C(m,_,b!="before")),M}function zs(e,t){var i=0;t=ve(e.doc,t),e.options.lineWrapping||(i=ni(e.display)*t.ch);var r=ae(e.doc,t.line),n=ir(r)+Nn(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function Da(e,t,i,r,n){var u=Y(e,t,i);return u.xRel=n,r&&(u.outside=r),u}function ka(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return Da(r.first,0,null,-1,-1);var n=Br(r,i),u=r.first+r.size-1;if(n>u)return Da(r.first+r.size-1,ae(r,u).text.length,null,1,1);t<0&&(t=0);for(var p=ae(r,n);;){var g=zd(e,p,n,t,i),m=sd(p,g.ch+(g.xRel>0||g.outside>0?1:0));if(!m)return g;var b=m.find(1);if(b.line==n)return b;p=ae(r,n=b.line)}}function Ns(e,t,i,r){r-=Ca(t);var n=t.text.length,u=Li(function(p){return Jt(e,i,p-1).bottom<=r},n,0);return n=Li(function(p){return Jt(e,i,p).top>r},u,n),{begin:u,end:n}}function Os(e,t,i,r){i||(i=ri(e,t));var n=On(e,t,Jt(e,i,r),"line").top;return Ns(e,t,i,n)}function Sa(e,t,i,r){return e.bottom<=i?!1:e.top>i?!0:(r?e.left:e.right)>t}function zd(e,t,i,r,n){n-=ir(t);var u=ri(e,t),p=Ca(t),g=0,m=t.text.length,b=!0,C=tr(t,e.doc.direction);if(C){var E=(e.options.lineWrapping?Od:Nd)(e,t,i,u,C,r,n);b=E.level!=1,g=b?E.from:E.to-1,m=b?E.to:E.from-1}var _=null,M=null,P=Li(function(se){var le=Jt(e,u,se);return le.top+=p,le.bottom+=p,Sa(le,r,n,!1)?(le.top<=n&&le.left<=r&&(_=se,M=le),!0):!1},g,m),R,Z,J=!1;if(M){var te=r-M.left=ie.bottom?1:0}return P=Xl(t.text,P,1),Da(i,P,Z,J,r-R)}function Nd(e,t,i,r,n,u,p){var g=Li(function(E){var _=n[E],M=_.level!=1;return Sa(Rt(e,Y(i,M?_.to:_.from,M?"before":"after"),"line",t,r),u,p,!0)},0,n.length-1),m=n[g];if(g>0){var b=m.level!=1,C=Rt(e,Y(i,b?m.from:m.to,b?"after":"before"),"line",t,r);Sa(C,u,p,!0)&&C.top>p&&(m=n[g-1])}return m}function Od(e,t,i,r,n,u,p){var g=Ns(e,t,r,p),m=g.begin,b=g.end;/\s/.test(t.text.charAt(b-1))&&b--;for(var C=null,E=null,_=0;_=b||M.to<=m)){var P=M.level!=1,R=Jt(e,r,P?Math.min(b,M.to)-1:Math.max(m,M.from)).right,Z=RZ)&&(C=M,E=Z)}}return C||(C=n[n.length-1]),C.fromb&&(C={from:C.from,to:b,level:C.level}),C}var zr;function ii(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(zr==null){zr=k("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)zr.appendChild(document.createTextNode("x")),zr.appendChild(k("br"));zr.appendChild(document.createTextNode("x"))}G(e.measure,zr);var i=zr.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),X(e.measure),i||1}function ni(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=k("span","xxxxxxxxxx"),i=k("pre",[t],"CodeMirror-line-like");G(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function Ea(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,u=t.gutters.firstChild,p=0;u;u=u.nextSibling,++p){var g=e.display.gutterSpecs[p].className;i[g]=u.offsetLeft+u.clientLeft+n,r[g]=u.clientWidth}return{fixedPos:Aa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Aa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Is(e){var t=ii(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/ni(e.display)-3);return function(n){if(mr(e.doc,n))return 0;var u=0;if(n.widgets)for(var p=0;p0&&(b=ae(e.doc,m.line).text).length==m.ch){var C=Ye(b,b.length,e.options.tabSize)-b.length;m=Y(m.line,Math.max(0,Math.round((u-ks(e.display).left)/ni(e.display))-C))}return m}function Or(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var i=e.display.view,r=0;rt)&&(n.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=n.viewTo)rr&&ga(e.doc,t)n.viewFrom?br(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)br(e);else if(t<=n.viewFrom){var u=Hn(e,i,i+r,1);u?(n.view=n.view.slice(u.index),n.viewFrom=u.lineN,n.viewTo+=r):br(e)}else if(i>=n.viewTo){var p=Hn(e,t,t,-1);p?(n.view=n.view.slice(0,p.index),n.viewTo=p.lineN):br(e)}else{var g=Hn(e,t,t,-1),m=Hn(e,i,i+r,1);g&&m?(n.view=n.view.slice(0,g.index).concat(zn(e,g.lineN,m.lineN)).concat(n.view.slice(m.index)),n.viewTo+=r):br(e)}var b=n.externalMeasured;b&&(i=n.lineN&&t=r.viewTo)){var u=r.view[Or(e,t)];if(u.node!=null){var p=u.changes||(u.changes=[]);ze(p,i)==-1&&p.push(i)}}}function br(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Hn(e,t,i,r){var n=Or(e,t),u,p=e.display.view;if(!rr||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var g=e.display.viewFrom,m=0;m0){if(n==p.length-1)return null;u=g+p[n].size-t,n++}else u=g-t;t+=u,i+=u}for(;ga(e.doc,i)!=i;){if(n==(r<0?0:p.length-1))return null;i+=r*p[n-(r<0?1:0)].size,n+=r}return{index:n,lineN:i}}function Id(e,t,i){var r=e.display,n=r.view;n.length==0||t>=r.viewTo||i<=r.viewFrom?(r.view=zn(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=zn(e,t,r.viewFrom).concat(r.view):r.viewFromi&&(r.view=r.view.slice(0,Or(e,i)))),r.viewTo=i}function Hs(e){for(var t=e.display.view,i=0,r=0;r=e.display.viewTo||m.to().line0?p:e.defaultCharWidth())+"px"}if(r.other){var g=i.appendChild(k("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));g.style.display="",g.style.left=r.other.left+"px",g.style.top=r.other.top+"px",g.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Pn(e,t){return e.top-t.top||e.left-t.left}function Hd(e,t,i){var r=e.display,n=e.doc,u=document.createDocumentFragment(),p=ks(e.display),g=p.left,m=Math.max(r.sizerWidth,_r(e)-r.sizer.offsetLeft)-p.right,b=n.direction=="ltr";function C(V,ie,se,le){ie<0&&(ie=0),ie=Math.round(ie),le=Math.round(le),u.appendChild(k("div",null,"CodeMirror-selected","position: absolute; left: "+V+`px; top: `+ie+"px; width: "+(se??m-V)+`px; - height: `+(le-ie)+"px"))}function S(V,ie,se){var le=ae(n,V),we=le.text.length,Le,it;function Ie(Xe,Ct){return In(e,K(V,Xe),"div",le,Ct)}function Et(Xe,Ct,ot){var Qe=Ns(e,le,null,Xe),Ke=Ct=="ltr"==(ot=="after")?"left":"right",qe=ot=="after"?Qe.begin:Qe.end-(/\s/.test(le.text.charAt(Qe.end-1))?2:1);return Ie(qe,Ke)[Ke]}var wt=tr(le,n.direction);return Rc(wt,ie||0,se??we,function(Xe,Ct,ot,Qe){var Ke=ot=="ltr",qe=Ie(Xe,Ke?"left":"right"),Dt=Ie(Ct-1,Ke?"right":"left"),vi=ie==null&&Xe==0,kr=se==null&&Ct==we,st=Qe==0,Vt=!wt||Qe==wt.length-1;if(Dt.top-qe.top<=3){var nt=(b?vi:kr)&&st,rl=(b?kr:vi)&&Vt,lr=nt?g:(Ke?qe:Dt).left,Rr=rl?m:(Ke?Dt:qe).right;C(lr,qe.top,Rr-lr,qe.bottom)}else{var Wr,ht,bi,il;Ke?(Wr=b&&vi&&st?g:qe.left,ht=b?m:Et(Xe,ot,"before"),bi=b?g:Et(Ct,ot,"after"),il=b&&kr&&Vt?m:Dt.right):(Wr=b?Et(Xe,ot,"before"):g,ht=!b&&vi&&st?m:qe.right,bi=!b&&kr&&Vt?g:Dt.left,il=b?Et(Ct,ot,"after"):m),C(Wr,qe.top,ht-Wr,qe.bottom),qe.bottom0?t.blinker=setInterval(function(){e.hasFocus()||oi(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Ps(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Ba(e))}function Ma(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&oi(e))},100)}function Ba(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(je(e,"focus",e,t),e.state.focused=!0,be(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),v&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),La(e))}function oi(e,t){e.state.delayingBlurEvent||(e.state.focused&&(je(e,"blur",e,t),e.state.focused=!1,oe(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function qn(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),n=t.lineDiv.getBoundingClientRect().top,u=0,p=0;p.005||M<-.005)&&(ne.display.sizerWidth){var U=Math.ceil(C/ni(e.display));U>e.display.maxLineLength&&(e.display.maxLineLength=U,e.display.maxLine=g.line,e.display.maxLineChanged=!0)}}}Math.abs(u)>2&&(t.scroller.scrollTop+=u)}function qs(e){if(e.widgets)for(var t=0;t=p&&(u=Br(t,ir(ae(t,m))-e.wrapper.clientHeight),p=m)}return{from:u,to:Math.max(p,u+1)}}function Pd(e,t){if(!$e(e,"scrollCursorIntoView")){var i=e.display,r=i.sizer.getBoundingClientRect(),n=null,u=i.wrapper.ownerDocument;if(t.top+r.top<0?n=!0:t.bottom+r.top>(u.defaultView.innerHeight||u.documentElement.clientHeight)&&(n=!1),n!=null&&!L){var p=E("div","\u200B",null,`position: absolute; + height: `+(le-ie)+"px"))}function E(V,ie,se){var le=ae(n,V),we=le.text.length,Le,it;function Ie(Xe,Ct){return In(e,Y(V,Xe),"div",le,Ct)}function Et(Xe,Ct,ot){var Qe=Os(e,le,null,Xe),Ke=Ct=="ltr"==(ot=="after")?"left":"right",qe=ot=="after"?Qe.begin:Qe.end-(/\s/.test(le.text.charAt(Qe.end-1))?2:1);return Ie(qe,Ke)[Ke]}var wt=tr(le,n.direction);return Rc(wt,ie||0,se??we,function(Xe,Ct,ot,Qe){var Ke=ot=="ltr",qe=Ie(Xe,Ke?"left":"right"),Dt=Ie(Ct-1,Ke?"right":"left"),vi=ie==null&&Xe==0,kr=se==null&&Ct==we,ut=Qe==0,Vt=!wt||Qe==wt.length-1;if(Dt.top-qe.top<=3){var nt=(b?vi:kr)&&ut,rl=(b?kr:vi)&&Vt,lr=nt?g:(Ke?qe:Dt).left,Rr=rl?m:(Ke?Dt:qe).right;C(lr,qe.top,Rr-lr,qe.bottom)}else{var Wr,pt,bi,il;Ke?(Wr=b&&vi&&ut?g:qe.left,pt=b?m:Et(Xe,ot,"before"),bi=b?g:Et(Ct,ot,"after"),il=b&&kr&&Vt?m:Dt.right):(Wr=b?Et(Xe,ot,"before"):g,pt=!b&&vi&&ut?m:qe.right,bi=!b&&kr&&Vt?g:Dt.left,il=b?Et(Ct,ot,"after"):m),C(Wr,qe.top,pt-Wr,qe.bottom),qe.bottom0?t.blinker=setInterval(function(){e.hasFocus()||oi(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function qs(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Ba(e))}function Ma(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&oi(e))},100)}function Ba(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(je(e,"focus",e,t),e.state.focused=!0,be(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),v&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),La(e))}function oi(e,t){e.state.delayingBlurEvent||(e.state.focused&&(je(e,"blur",e,t),e.state.focused=!1,oe(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function qn(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),n=t.lineDiv.getBoundingClientRect().top,u=0,p=0;p.005||M<-.005)&&(ne.display.sizerWidth){var R=Math.ceil(C/ni(e.display));R>e.display.maxLineLength&&(e.display.maxLineLength=R,e.display.maxLine=g.line,e.display.maxLineChanged=!0)}}}Math.abs(u)>2&&(t.scroller.scrollTop+=u)}function Rs(e){if(e.widgets)for(var t=0;t=p&&(u=Br(t,ir(ae(t,m))-e.wrapper.clientHeight),p=m)}return{from:u,to:Math.max(p,u+1)}}function Pd(e,t){if(!$e(e,"scrollCursorIntoView")){var i=e.display,r=i.sizer.getBoundingClientRect(),n=null,u=i.wrapper.ownerDocument;if(t.top+r.top<0?n=!0:t.bottom+r.top>(u.defaultView.innerHeight||u.documentElement.clientHeight)&&(n=!1),n!=null&&!L){var p=k("div","\u200B",null,`position: absolute; top: `+(t.top-i.viewOffset-Nn(e.display))+`px; height: `+(t.bottom-t.top+Qt(e)+i.barHeight)+`px; - left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(p),p.scrollIntoView(n),e.display.lineSpace.removeChild(p)}}}function qd(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(i=t.sticky=="before"?K(t.line,t.ch+1,"before"):t,t=t.ch?K(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var u=0;u<5;u++){var p=!1,g=Rt(e,t),m=!i||i==t?g:Rt(e,i);n={left:Math.min(g.left,m.left),top:Math.min(g.top,m.top)-r,right:Math.max(g.left,m.left),bottom:Math.max(g.bottom,m.bottom)+r};var b=_a(e,n),C=e.doc.scrollTop,S=e.doc.scrollLeft;if(b.scrollTop!=null&&(Ui(e,b.scrollTop),Math.abs(e.doc.scrollTop-C)>1&&(p=!0)),b.scrollLeft!=null&&(Ir(e,b.scrollLeft),Math.abs(e.doc.scrollLeft-S)>1&&(p=!0)),!p)break}return n}function Rd(e,t){var i=_a(e,t);i.scrollTop!=null&&Ui(e,i.scrollTop),i.scrollLeft!=null&&Ir(e,i.scrollLeft)}function _a(e,t){var i=e.display,r=ii(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,u=xa(e),p={};t.bottom-t.top>u&&(t.bottom=t.top+u);var g=e.doc.height+ya(i),m=t.topg-r;if(t.topn+u){var C=Math.min(t.top,(b?g:t.bottom)-u);C!=n&&(p.scrollTop=C)}var S=e.options.fixedGutter?0:i.gutters.offsetWidth,_=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-S,M=_r(e)-i.gutters.offsetWidth,P=t.right-t.left>M;return P&&(t.right=t.left+M),t.left<10?p.scrollLeft=0:t.left<_?p.scrollLeft=Math.max(0,t.left+S-(P?0:10)):t.right>M+_-3&&(p.scrollLeft=t.right+(P?0:10)-M),p}function za(e,t){t!=null&&(Wn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function ai(e){Wn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Wi(e,t,i){(t!=null||i!=null)&&Wn(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Wd(e,t){Wn(e),e.curOp.scrollToPos=t}function Wn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=_s(e,t.from),r=_s(e,t.to);Rs(e,i,r,t.margin)}}function Rs(e,t,i,r){var n=_a(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-r,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+r});Wi(e,n.scrollLeft,n.scrollTop)}function Ui(e,t){Math.abs(e.doc.scrollTop-t)<2||(s||Oa(e,{top:t}),Ws(e,t,!0),s&&Oa(e),Xi(e,100))}function Ws(e,t,i){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),!(e.display.scroller.scrollTop==t&&!i)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Ir(e,t,i,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),!((i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)&&(e.doc.scrollLeft=t,Ks(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function ji(e){var t=e.display,i=t.gutters.offsetWidth,r=Math.round(e.doc.height+ya(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?i:0,docHeight:r,scrollHeight:r+Qt(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var Hr=function(e,t,i){this.cm=i;var r=this.vert=E("div",[E("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=E("div",[E("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=n.tabIndex=-1,e(r),e(n),ue(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),ue(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,c&&d<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Hr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var n=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+n)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=i?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var u=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+u)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?r:0,bottom:t?r:0}},Hr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Hr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Hr.prototype.zeroWidthHack=function(){var e=O&&!B?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new ct,this.disableVert=new ct},Hr.prototype.enableZeroWidthBar=function(e,t,i){e.style.visibility="";function r(){var n=e.getBoundingClientRect(),u=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);u!=e?e.style.visibility="hidden":t.set(1e3,r)}t.set(1e3,r)},Hr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Gi=function(){};Gi.prototype.update=function(){return{bottom:0,right:0}},Gi.prototype.setScrollLeft=function(){},Gi.prototype.setScrollTop=function(){},Gi.prototype.clear=function(){};function li(e,t){t||(t=ji(e));var i=e.display.barWidth,r=e.display.barHeight;Us(e,t);for(var n=0;n<4&&i!=e.display.barWidth||r!=e.display.barHeight;n++)i!=e.display.barWidth&&e.options.lineWrapping&&qn(e),Us(e,ji(e)),i=e.display.barWidth,r=e.display.barHeight}function Us(e,t){var i=e.display,r=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=r.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=r.bottom)+"px",i.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=r.bottom+"px",i.scrollbarFiller.style.width=r.right+"px"):i.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=r.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}var js={native:Hr,null:Gi};function Gs(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&oe(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new js[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ue(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?Ir(e,t):Ui(e,t)},e),e.display.scrollbars.addClass&&be(e.display.wrapper,e.display.scrollbars.addClass)}var Ud=0;function Pr(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Ud,markArrays:null},xd(e.curOp)}function qr(e){var t=e.curOp;t&&Cd(t,function(i){for(var r=0;r=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Un(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Xd(e){e.updatedDisplay=e.mustUpdate&&Na(e.cm,e.update)}function Kd(e){var t=e.cm,i=t.display;e.updatedDisplay&&qn(t),e.barMeasure=ji(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Ss(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+Qt(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-_r(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function Yd(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)){var i=+new Date+e.options.workTime,r=Ni(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(u){if(r.line>=e.display.viewFrom){var p=u.styles,g=u.text.length>e.options.maxHighlightLength?Lr(t.mode,r.state):null,m=$l(e,u,r,!0);g&&(r.state=g),u.styles=m.styles;var b=u.styleClasses,C=m.classes;C?u.styleClasses=C:b&&(u.styleClasses=null);for(var S=!p||p.length!=u.styles.length||b!=C&&(!b||!C||b.bgClass!=C.bgClass||b.textClass!=C.textClass),_=0;!S&&_i)return Xi(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&St(e,function(){for(var u=0;u=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&Is(e)==0)return!1;Ys(e)&&(br(e),t.dims=Ea(e));var n=r.first+r.size,u=Math.max(t.visible.from-e.options.viewportMargin,r.first),p=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFromp&&i.viewTo-p<20&&(p=Math.min(n,i.viewTo)),rr&&(u=ga(e.doc,u),p=hs(e.doc,p));var g=u!=i.viewFrom||p!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Id(e,u,p),i.viewOffset=ir(ae(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var m=Is(e);if(!g&&m==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var b=Vd(e);return m>4&&(i.lineDiv.style.display="none"),eh(e,i.updateLineNumbers,t.dims),m>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,$d(b),H(i.cursorDiv),H(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,g&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,Xi(e,400)),i.updateLineNumbers=null,!0}function Xs(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==_r(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+ya(e.display)-xa(e),i.top)}),t.visible=Rn(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Rn(e.display,e.doc,i));if(!Na(e,t))break;qn(e);var n=ji(e);Ri(e),li(e,n),Ha(e,n),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Oa(e,t){var i=new Un(e,t);if(Na(e,i)){qn(e),Xs(e,i);var r=ji(e);Ri(e),li(e,r),Ha(e,r),i.finish()}}function eh(e,t,i){var r=e.display,n=e.options.lineNumbers,u=r.lineDiv,p=u.firstChild;function g(P){var U=P.nextSibling;return v&&O&&e.display.currentWheelTarget==P?P.style.display="none":P.parentNode.removeChild(P),U}for(var m=r.view,b=r.viewFrom,C=0;C-1&&(M=!1),bs(e,S,b,i)),M&&(H(S.lineNumber),S.lineNumber.appendChild(document.createTextNode(sa(e.options,b)))),p=S.node.nextSibling}b+=S.size}for(;p;)p=g(p)}function Ia(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",et(e,"gutterChanged",e)}function Ha(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Qt(e)+"px"}function Ks(e){var t=e.display,i=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var r=Aa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,u=r+"px",p=0;pg.clientWidth,b=g.scrollHeight>g.clientHeight;if(r&&m||n&&b){if(n&&O&&v){e:for(var C=t.target,S=p.view;C!=g;C=C.parentNode)for(var _=0;_=0&&me(e,r.to())<=0)return i}return-1};var Ee=function(e,t){this.anchor=e,this.head=t};Ee.prototype.from=function(){return An(this.anchor,this.head)},Ee.prototype.to=function(){return En(this.anchor,this.head)},Ee.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Wt(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(_,M){return me(_.from(),M.from())}),i=ze(t,n);for(var u=1;u0:m>=0){var b=An(g.from(),p.from()),C=En(g.to(),p.to()),S=g.empty()?p.from()==p.head:g.from()==g.head;u<=i&&--i,t.splice(--u,2,new Ee(S?C:b,S?b:C))}}return new Bt(t,i)}function yr(e,t){return new Bt([new Ee(e,t||e)],0)}function xr(e){return e.text?K(e.from.line+e.text.length-1,De(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Vs(e,t){if(me(e,t.from)<0)return e;if(me(e,t.to)<=0)return xr(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=xr(t).ch-t.to.ch),K(i,r)}function qa(e,t){for(var i=[],r=0;r1&&e.remove(g.line+1,P-1),e.insert(g.line+1,J)}et(e,"change",e,t)}function wr(e,t,i){function r(n,u,p){if(n.linked)for(var g=0;g1&&!e.done[e.done.length-2].ranges)return e.done.pop(),De(e.done)}function nu(e,t,i,r){var n=e.history;n.undone.length=0;var u=+new Date,p,g;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>u-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(p=oh(n,n.lastOp==r)))g=De(p.changes),me(t.from,t.to)==0&&me(t.from,g.to)==0?g.to=xr(t):p.changes.push(Ua(e,t));else{var m=De(n.done);for((!m||!m.ranges)&&Xn(e.sel,n.done),p={changes:[Ua(e,t)],generation:n.generation},n.done.push(p);n.done.length>n.undoDepth;)n.done.shift(),n.done[0].ranges||n.done.shift()}n.done.push(i),n.generation=++n.maxGeneration,n.lastModTime=n.lastSelTime=u,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,g||je(e,"historyAdded")}function ah(e,t,i,r){var n=t.charAt(0);return n=="*"||n=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function lh(e,t,i,r){var n=e.history,u=r&&r.origin;i==n.lastSelOp||u&&n.lastSelOrigin==u&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==u||ah(e,u,De(n.done),t))?n.done[n.done.length-1]=t:Xn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=u,n.lastSelOp=i,r&&r.clearRedo!==!1&&iu(n.undone)}function Xn(e,t){var i=De(t);i&&i.ranges&&i.equals(e)||t.push(e)}function ou(e,t,i,r){var n=t["spans_"+e.id],u=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(p){p.markedSpans&&((n||(n=t["spans_"+e.id]={}))[u]=p.markedSpans),++u})}function sh(e){if(!e)return null;for(var t,i=0;i-1&&(De(g)[S]=b[S],delete b[S])}}return r}function ja(e,t,i,r){if(r){var n=e.anchor;if(i){var u=me(t,n)<0;u!=me(i,n)<0?(n=t,t=i):u!=me(t,i)<0&&(t=i)}return new Ee(n,t)}else return new Ee(i||t,t)}function Kn(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),lt(e,new Bt([ja(e.sel.primary(),t,i,n)],0),r)}function lu(e,t,i){for(var r=[],n=e.cm&&(e.cm.display.shift||e.extend),u=0;u=t.ch:g.to>t.ch))){if(n&&(je(m,"beforeCursorEnter"),m.explicitlyCleared))if(u.markedSpans){--p;continue}else break;if(!m.atomic)continue;if(i){var S=m.find(r<0?1:-1),_=void 0;if((r<0?C:b)&&(S=hu(e,S,-r,S&&S.line==t.line?u:null)),S&&S.line==t.line&&(_=me(S,i))&&(r<0?_<0:_>0))return ui(e,S,t,r,n)}var M=m.find(r<0?-1:1);return(r<0?b:C)&&(M=hu(e,M,r,M.line==t.line?u:null)),M?ui(e,M,t,r,n):null}}return t}function Zn(e,t,i,r,n){var u=r||1,p=ui(e,t,i,u,n)||!n&&ui(e,t,i,u,!0)||ui(e,t,i,-u,n)||!n&&ui(e,t,i,-u,!0);return p||(e.cantEdit=!0,K(e.first,0))}function hu(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?ve(e,K(t.line-1)):null:i>0&&t.ch==(r||ae(e,t.line)).text.length?t.line=0;--n)mu(e,{from:r[n].from,to:r[n].to,text:n?[""]:t.text,origin:t.origin});else mu(e,t)}}function mu(e,t){if(!(t.text.length==1&&t.text[0]==""&&me(t.from,t.to)==0)){var i=qa(e,t);nu(e,t,i,e.cm?e.cm.curOp.id:NaN),Zi(e,t,i,ha(e,t));var r=[];wr(e,function(n,u){!u&&ze(r,n.history)==-1&&(xu(n.history,t),r.push(n.history)),Zi(n,t,null,ha(n,t))})}}function Qn(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(!(r&&!i)){for(var n=e.history,u,p=e.sel,g=t=="undo"?n.done:n.undone,m=t=="undo"?n.undone:n.done,b=0;b=0;--M){var P=_(M);if(P)return P.v}}}}function vu(e,t){if(t!=0&&(e.first+=t,e.sel=new Bt(Pt(e.sel.ranges,function(n){return new Ee(K(n.anchor.line+t,n.anchor.ch),K(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm)){yt(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;re.lastLine())){if(t.from.lineu&&(t={from:t.from,to:K(u,ae(e,u).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Mr(e,t.from,t.to),i||(i=qa(e,t)),e.cm?ch(e.cm,t,r):Wa(e,t,r),Yn(e,i,vt),e.cantEdit&&Zn(e,K(e.firstLine(),0))&&(e.cantEdit=!1)}}function ch(e,t,i){var r=e.doc,n=e.display,u=t.from,p=t.to,g=!1,m=u.line;e.options.lineWrapping||(m=Fe(qt(ae(r,u.line))),r.iter(m,p.line+1,function(M){if(M==n.maxLine)return g=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Kl(e),Wa(r,t,i,Os(e)),e.options.lineWrapping||(r.iter(m,u.line+t.text.length,function(M){var P=_n(M);P>n.maxLineLength&&(n.maxLine=M,n.maxLineLength=P,n.maxLineChanged=!0,g=!1)}),g&&(e.curOp.updateMaxLine=!0)),ed(r,u.line),Xi(e,400);var b=t.text.length-(p.line-u.line)-1;t.full?yt(e):u.line==p.line&&t.text.length==1&&!eu(e.doc,t)?vr(e,u.line,"text"):yt(e,u.line,p.line+1,b);var C=Ot(e,"changes"),S=Ot(e,"change");if(S||C){var _={from:u,to:p,text:t.text,removed:t.removed,origin:t.origin};S&&et(e,"change",e,_),C&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(_)}e.display.selForContextMenu=null}function ci(e,t,i,r,n){var u;r||(r=i),me(r,i)<0&&(u=[r,i],i=u[0],r=u[1]),typeof t=="string"&&(t=e.splitLines(t)),fi(e,{from:i,to:r,text:t,origin:n})}function bu(e,t,i,r){i1||!(this.children[0]instanceof Ji))){var g=[];this.collapse(g),this.children=[new Ji(g)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var p=n.lines.length%25+25,g=p;g10);e.parent.maybeSpill()}},iterN:function(e,t,i){for(var r=0;re.display.maxLineLength&&(e.display.maxLine=b,e.display.maxLineLength=C,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&yt(e,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&cu(e.doc)),e&&et(e,"markerCleared",e,this,r,n),t&&qr(e),this.parent&&this.parent.clear()}},Cr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n0||p==0&&u.clearWhenEmpty!==!1)return u;if(u.replacedWith&&(u.collapsed=!0,u.widgetNode=q("span",[u.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||u.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(u.widgetNode.insertLeft=!0)),u.collapsed){if(ds(e,t.line,t,i,u)||t.line!=i.line&&ds(e,i.line,t,i,u))throw new Error("Inserting collapsed marker partially overlapping an existing one");rd()}u.addToHistory&&nu(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var g=t.line,m=e.cm,b;if(e.iter(g,i.line+1,function(S){m&&u.collapsed&&!m.options.lineWrapping&&qt(S)==m.display.maxLine&&(b=!0),u.collapsed&&g!=t.line&&Yt(S,0),nd(S,new Tn(u,g==t.line?t.ch:null,g==i.line?i.ch:null),e.cm&&e.cm.curOp),++g}),u.collapsed&&e.iter(t.line,i.line+1,function(S){mr(e,S)&&Yt(S,0)}),u.clearOnEnter&&ue(u,"beforeCursorEnter",function(){return u.clear()}),u.readOnly&&(td(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),u.collapsed&&(u.id=++Cu,u.atomic=!0),m){if(b&&(m.curOp.updateMaxLine=!0),u.collapsed)yt(m,t.line,i.line+1);else if(u.className||u.startStyle||u.endStyle||u.css||u.attributes||u.title)for(var C=t.line;C<=i.line;C++)vr(m,C,"text");u.atomic&&cu(m.doc),et(m,"markerAdded",m,u)}return u}var en=function(e,t){this.markers=e,this.primary=t;for(var i=0;i=0;m--)fi(this,r[m]);g?uu(this,g):this.cm&&ai(this.cm)}),undo:rt(function(){Qn(this,"undo")}),redo:rt(function(){Qn(this,"redo")}),undoSelection:rt(function(){Qn(this,"undo",!0)}),redoSelection:rt(function(){Qn(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,r=0;r=e.ch)&&t.push(n.marker.parent||n.marker)}return t},findMarks:function(e,t,i){e=ve(this,e),t=ve(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(u){var p=u.markedSpans;if(p)for(var g=0;g=m.to||m.from==null&&n!=e.line||m.from!=null&&n==t.line&&m.from>=t.ch)&&(!i||i(m.marker))&&r.push(m.marker.parent||m.marker)}++n}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var r=0;re)return t=e,!0;e-=u,++i}),ve(this,K(i,t))},indexFromPos:function(e){e=ve(this,e);var t=e.ch;if(e.linet&&(t=e.from),e.to!=null&&e.to-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var C=e.dataTransfer.getData("Text");if(C){var S;if(t.state.draggingText&&!t.state.draggingText.copy&&(S=t.listSelections()),Yn(t.doc,yr(i,i)),S)for(var _=0;_=0;g--)ci(e.doc,"",r[g].from,r[g].to,"+delete");ai(e)})}function Xa(e,t,i){var r=Gl(e.text,t+i,i);return r<0||r>e.text.length?null:r}function Ka(e,t,i){var r=Xa(e,t.ch,i);return r==null?null:new K(t.line,r,i<0?"after":"before")}function Ya(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var u=tr(i,t.doc.direction);if(u){var p=n<0?De(u):u[0],g=n<0==(p.level==1),m=g?"after":"before",b;if(p.level>0||t.doc.direction=="rtl"){var C=ri(t,i);b=n<0?i.text.length-1:0;var S=Jt(t,C,b).top;b=Li(function(_){return Jt(t,C,_).top==S},n<0==(p.level==1)?p.from:p.to-1,b),m=="before"&&(b=Xa(i,b,1))}else b=n<0?p.to:p.from;return new K(r,b,m)}}return new K(r,n<0?i.text.length:0,n<0?"before":"after")}function Sh(e,t,i,r){var n=tr(t,e.doc.direction);if(!n)return Ka(t,i,r);i.ch>=t.text.length?(i.ch=t.text.length,i.sticky="before"):i.ch<=0&&(i.ch=0,i.sticky="after");var u=Bi(n,i.ch,i.sticky),p=n[u];if(e.doc.direction=="ltr"&&p.level%2==0&&(r>0?p.to>i.ch:p.from=p.from&&_>=C.begin)){var M=S?"before":"after";return new K(i.line,_,M)}}var P=function(J,ee,V){for(var ie=function(Le,it){return it?new K(i.line,g(Le,1),"before"):new K(i.line,Le,"after")};J>=0&&J0==(se.level!=1),we=le?V.begin:g(V.end,-1);if(se.from<=we&&we0?C.end:g(C.begin,-1);return Z!=null&&!(r>0&&Z==t.text.length)&&(U=P(r>0?0:n.length-1,r,b(Z)),U)?U:null}var nn={selectAll:pu,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),vt)},killLine:function(e){return pi(e,function(t){if(t.empty()){var i=ae(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line0)n=new K(n.line,n.ch+1),e.replaceRange(u.charAt(n.ch-1)+u.charAt(n.ch-2),K(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var p=ae(e.doc,n.line-1).text;p&&(n=new K(n.line,1),e.replaceRange(u.charAt(0)+e.doc.lineSeparator()+p.charAt(p.length-1),K(n.line-1,p.length-1),n,"+transpose"))}}i.push(new Ee(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){return St(e,function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");t=e.listSelections();for(var r=0;re&&me(t,this.pos)==0&&i==this.button};var an,ln;function Bh(e,t){var i=+new Date;return ln&&ln.compare(i,e,t)?(an=ln=null,"triple"):an&&an.compare(i,e,t)?(ln=new Qa(i,e,t),an=null,"double"):(an=new Qa(i,e,t),ln=null,"single")}function Hu(e){var t=this,i=t.display;if(!($e(t,e)||i.activeTouch&&i.input.supportsTouch())){if(i.input.ensurePolled(),i.shift=e.shiftKey,nr(i,e)){v||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(!Ja(t,e)){var r=Nr(t,e),n=Zl(e),u=r?Bh(r,n):"single";ye(t).focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&_h(t,n,r,u,e))&&(n==1?r?Nh(t,r,u,e):$o(e)==i.scroller&&bt(e):n==2?(r&&Kn(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(he?t.display.input.onContextMenu(e):Ma(t)))}}}function _h(e,t,i,r,n){var u="Click";return r=="double"?u="Double"+u:r=="triple"&&(u="Triple"+u),u=(t==1?"Left":t==2?"Middle":"Right")+u,on(e,Tu(u,n),n,function(p){if(typeof p=="string"&&(p=nn[p]),!p)return!1;var g=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),g=p(e,i)!=Ze}finally{e.state.suppressEdits=!1}return g})}function zh(e,t,i){var r=e.getOption("configureMouse"),n=r?r(e,t,i):{};if(n.unit==null){var u=I?i.shiftKey&&i.metaKey:i.altKey;n.unit=u?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(n.extend==null||e.doc.extend)&&(n.extend=e.doc.extend||i.shiftKey),n.addNew==null&&(n.addNew=O?i.metaKey:i.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(O?i.altKey:i.ctrlKey)),n}function Nh(e,t,i,r){c?setTimeout(mt(Ps,e),0):e.curOp.focus=de(te(e));var n=zh(e,i,r),u=e.doc.sel,p;e.options.dragDrop&&Uc&&!e.isReadOnly()&&i=="single"&&(p=u.contains(t))>-1&&(me((p=u.ranges[p]).from(),t)<0||t.xRel>0)&&(me(p.to(),t)>0||t.xRel<0)?Oh(e,r,t,n):Ih(e,r,t,n)}function Oh(e,t,i,r){var n=e.display,u=!1,p=tt(e,function(b){v&&(n.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:Ma(e)),Mt(n.wrapper.ownerDocument,"mouseup",p),Mt(n.wrapper.ownerDocument,"mousemove",g),Mt(n.scroller,"dragstart",m),Mt(n.scroller,"drop",p),u||(bt(b),r.addNew||Kn(e.doc,i,null,null,r.extend),v&&!F||c&&d==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),g=function(b){u=u||Math.abs(t.clientX-b.clientX)+Math.abs(t.clientY-b.clientY)>=10},m=function(){return u=!0};v&&(n.scroller.draggable=!0),e.state.draggingText=p,p.copy=!r.moveOnDrag,ue(n.wrapper.ownerDocument,"mouseup",p),ue(n.wrapper.ownerDocument,"mousemove",g),ue(n.scroller,"dragstart",m),ue(n.scroller,"drop",p),e.state.delayingBlurEvent=!0,setTimeout(function(){return n.input.focus()},20),n.scroller.dragDrop&&n.scroller.dragDrop()}function Pu(e,t,i){if(i=="char")return new Ee(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new Ee(K(t.line,0),ve(e.doc,K(t.line+1,0)));var r=i(e,t);return new Ee(r.from,r.to)}function Ih(e,t,i,r){c&&Ma(e);var n=e.display,u=e.doc;bt(t);var p,g,m=u.sel,b=m.ranges;if(r.addNew&&!r.extend?(g=u.sel.contains(i),g>-1?p=b[g]:p=new Ee(i,i)):(p=u.sel.primary(),g=u.sel.primIndex),r.unit=="rectangle")r.addNew||(p=new Ee(i,i)),i=Nr(e,t,!0,!0),g=-1;else{var C=Pu(e,i,r.unit);r.extend?p=ja(p,C.anchor,C.head,r.extend):p=C}r.addNew?g==-1?(g=b.length,lt(u,Wt(e,b.concat([p]),g),{scroll:!1,origin:"*mouse"})):b.length>1&&b[g].empty()&&r.unit=="char"&&!r.extend?(lt(u,Wt(e,b.slice(0,g).concat(b.slice(g+1)),0),{scroll:!1,origin:"*mouse"}),m=u.sel):Ga(u,g,p,Ti):(g=0,lt(u,new Bt([p],0),Ti),m=u.sel);var S=i;function _(V){if(me(S,V)!=0)if(S=V,r.unit=="rectangle"){for(var ie=[],se=e.options.tabSize,le=Ye(ae(u,i.line).text,i.ch,se),we=Ye(ae(u,V.line).text,V.ch,se),Le=Math.min(le,we),it=Math.max(le,we),Ie=Math.min(i.line,V.line),Et=Math.min(e.lastLine(),Math.max(i.line,V.line));Ie<=Et;Ie++){var wt=ae(u,Ie).text,Xe=Kt(wt,Le,se);Le==it?ie.push(new Ee(K(Ie,Xe),K(Ie,Xe))):wt.length>Xe&&ie.push(new Ee(K(Ie,Xe),K(Ie,Kt(wt,it,se))))}ie.length||ie.push(new Ee(i,i)),lt(u,Wt(e,m.ranges.slice(0,g).concat(ie),g),{origin:"*mouse",scroll:!1}),e.scrollIntoView(V)}else{var Ct=p,ot=Pu(e,V,r.unit),Qe=Ct.anchor,Ke;me(ot.anchor,Qe)>0?(Ke=ot.head,Qe=An(Ct.from(),ot.anchor)):(Ke=ot.anchor,Qe=En(Ct.to(),ot.head));var qe=m.ranges.slice(0);qe[g]=Hh(e,new Ee(ve(u,Qe),Ke)),lt(u,Wt(e,qe,g),Ti)}}var M=n.wrapper.getBoundingClientRect(),P=0;function U(V){var ie=++P,se=Nr(e,V,!0,r.unit=="rectangle");if(se)if(me(se,S)!=0){e.curOp.focus=de(te(e)),_(se);var le=Rn(n,u);(se.line>=le.to||se.lineM.bottom?20:0;we&&setTimeout(tt(e,function(){P==ie&&(n.scroller.scrollTop+=we,U(V))}),50)}}function Z(V){e.state.selectingText=!1,P=1/0,V&&(bt(V),n.input.focus()),Mt(n.wrapper.ownerDocument,"mousemove",J),Mt(n.wrapper.ownerDocument,"mouseup",ee),u.history.lastSelOrigin=null}var J=tt(e,function(V){V.buttons===0||!Zl(V)?Z(V):U(V)}),ee=tt(e,Z);e.state.selectingText=ee,ue(n.wrapper.ownerDocument,"mousemove",J),ue(n.wrapper.ownerDocument,"mouseup",ee)}function Hh(e,t){var i=t.anchor,r=t.head,n=ae(e.doc,i.line);if(me(i,r)==0&&i.sticky==r.sticky)return t;var u=tr(n);if(!u)return t;var p=Bi(u,i.ch,i.sticky),g=u[p];if(g.from!=i.ch&&g.to!=i.ch)return t;var m=p+(g.from==i.ch==(g.level!=1)?0:1);if(m==0||m==u.length)return t;var b;if(r.line!=i.line)b=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var C=Bi(u,r.ch,r.sticky),S=C-p||(r.ch-i.ch)*(g.level==1?-1:1);C==m-1||C==m?b=S<0:b=S>0}var _=u[m+(b?-1:0)],M=b==(_.level==1),P=M?_.from:_.to,U=M?"after":"before";return i.ch==P&&i.sticky==U?t:new Ee(new K(i.line,P,U),r)}function qu(e,t,i,r){var n,u;if(t.touches)n=t.touches[0].clientX,u=t.touches[0].clientY;else try{n=t.clientX,u=t.clientY}catch{return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&bt(t);var p=e.display,g=p.lineDiv.getBoundingClientRect();if(u>g.bottom||!Ot(e,i))return Vo(t);u-=g.top-p.viewOffset;for(var m=0;m=n){var C=Br(e.doc,u),S=e.display.gutterSpecs[m];return je(e,i,e,C,S.className,t),Vo(t)}}}function Ja(e,t){return qu(e,t,"gutterClick",!0)}function Ru(e,t){nr(e.display,t)||Ph(e,t)||$e(e,t,"contextmenu")||he||e.display.input.onContextMenu(t)}function Ph(e,t){return Ot(e,"gutterContextMenu")?qu(e,t,"gutterContextMenu",!1):!1}function Wu(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),qi(e)}var gi={toString:function(){return"CodeMirror.Init"}},Uu={},eo={};function qh(e){var t=e.optionHandlers;function i(r,n,u,p){e.defaults[r]=n,u&&(t[r]=p?function(g,m,b){b!=gi&&u(g,m,b)}:u)}e.defineOption=i,e.Init=gi,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,Ra(r)},!0),i("indentUnit",2,Ra,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){Yi(r),qi(r),yt(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!!n){var u=[],p=r.doc.first;r.doc.iter(function(m){for(var b=0;;){var C=m.text.indexOf(n,b);if(C==-1)break;b=C+n.length,u.push(K(p,C))}p++});for(var g=u.length-1;g>=0;g--)ci(r.doc,n,u[g],K(u[g].line,u[g].ch+n.length))}}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(r,n,u){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),u!=gi&&r.refresh()}),i("specialCharPlaceholder",gd,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",z?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(r,n){return r.getInputField().spellcheck=n},!0),i("autocorrect",!1,function(r,n){return r.getInputField().autocorrect=n},!0),i("autocapitalize",!1,function(r,n){return r.getInputField().autocapitalize=n},!0),i("rtlMoveVisually",!R),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Wu(r),Ki(r)},!0),i("keyMap","default",function(r,n,u){var p=Vn(n),g=u!=gi&&Vn(u);g&&g.detach&&g.detach(r,p),p.attach&&p.attach(r,g||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Wh,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=Pa(n,r.options.lineNumbers),Ki(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?Aa(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return li(r)},!0),i("scrollbarStyle","native",function(r){Gs(r),li(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),i("lineNumbers",!1,function(r,n){r.display.gutterSpecs=Pa(r.options.gutters,n),Ki(r)},!0),i("firstLineNumber",1,Ki,!0),i("lineNumberFormatter",function(r){return r},Ki,!0),i("showCursorWhenSelecting",!1,Ri,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,n){n=="nocursor"&&(oi(r),r.display.input.blur()),r.display.input.readOnlyChanged(n)}),i("screenReaderLabel",null,function(r,n){n=n===""?null:n,r.display.input.screenReaderLabelChanged(n)}),i("disableInput",!1,function(r,n){n||r.display.input.reset()},!0),i("dragDrop",!0,Rh),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,Ri,!0),i("singleCursorHeightPerLine",!0,Ri,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,Yi,!0),i("addModeClass",!1,Yi,!0),i("pollInterval",100),i("undoDepth",200,function(r,n){return r.doc.history.undoDepth=n}),i("historyEventDelay",1250),i("viewportMargin",10,function(r){return r.refresh()},!0),i("maxHighlightLength",1e4,Yi,!0),i("moveInputWithCursor",!0,function(r,n){n||r.display.input.resetPosition()}),i("tabindex",null,function(r,n){return r.display.input.getField().tabIndex=n||""}),i("autofocus",null),i("direction","ltr",function(r,n){return r.doc.setDirection(n)},!0),i("phrases",null)}function Rh(e,t,i){var r=i&&i!=gi;if(!t!=!r){var n=e.display.dragFunctions,u=t?ue:Mt;u(e.display.scroller,"dragstart",n.start),u(e.display.scroller,"dragenter",n.enter),u(e.display.scroller,"dragover",n.over),u(e.display.scroller,"dragleave",n.leave),u(e.display.scroller,"drop",n.drop)}}function Wh(e){e.options.lineWrapping?(be(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(oe(e.display.wrapper,"CodeMirror-wrap"),va(e)),Fa(e),yt(e),qi(e),setTimeout(function(){return li(e)},100)}function Ne(e,t){var i=this;if(!(this instanceof Ne))return new Ne(e,t);this.options=t=t?Lt(t):{},Lt(Uu,t,!1);var r=t.value;typeof r=="string"?r=new xt(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new Ne.inputStyles[t.inputStyle](this),u=this.display=new th(e,r,n,t);u.wrapper.CodeMirror=this,Wu(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Gs(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new ct,keySeq:null,specialChars:null},t.autofocus&&!z&&u.input.focus(),c&&d<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Uh(this),xh(),Pr(this),this.curOp.forceUpdate=!0,tu(this,r),t.autofocus&&!z||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&Ba(i)},20):oi(this);for(var p in eo)eo.hasOwnProperty(p)&&eo[p](this,t[p],gi);Ys(this),t.finishInit&&t.finishInit(this);for(var g=0;g20*20}ue(t.scroller,"touchstart",function(m){if(!$e(e,m)&&!u(m)&&!Ja(e,m)){t.input.ensurePolled(),clearTimeout(i);var b=+new Date;t.activeTouch={start:b,moved:!1,prev:b-r.end<=300?r:null},m.touches.length==1&&(t.activeTouch.left=m.touches[0].pageX,t.activeTouch.top=m.touches[0].pageY)}}),ue(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),ue(t.scroller,"touchend",function(m){var b=t.activeTouch;if(b&&!nr(t,m)&&b.left!=null&&!b.moved&&new Date-b.start<300){var C=e.coordsChar(t.activeTouch,"page"),S;!b.prev||p(b,b.prev)?S=new Ee(C,C):!b.prev.prev||p(b,b.prev.prev)?S=e.findWordAt(C):S=new Ee(K(C.line,0),ve(e.doc,K(C.line+1,0))),e.setSelection(S.anchor,S.head),e.focus(),bt(m)}n()}),ue(t.scroller,"touchcancel",n),ue(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Ui(e,t.scroller.scrollTop),Ir(e,t.scroller.scrollLeft,!0),je(e,"scroll",e))}),ue(t.scroller,"mousewheel",function(m){return Js(e,m)}),ue(t.scroller,"DOMMouseScroll",function(m){return Js(e,m)}),ue(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(m){$e(e,m)||_i(m)},over:function(m){$e(e,m)||(yh(e,m),_i(m))},start:function(m){return bh(e,m)},drop:tt(e,vh),leave:function(m){$e(e,m)||Su(e)}};var g=t.input.getField();ue(g,"keyup",function(m){return Ou.call(e,m)}),ue(g,"keydown",tt(e,Nu)),ue(g,"keypress",tt(e,Iu)),ue(g,"focus",function(m){return Ba(e,m)}),ue(g,"blur",function(m){return oi(e,m)})}var Va=[];Ne.defineInitHook=function(e){return Va.push(e)};function sn(e,t,i,r){var n=e.doc,u;i==null&&(i="add"),i=="smart"&&(n.mode.indent?u=Ni(e,t).state:i="prev");var p=e.options.tabSize,g=ae(n,t),m=Ye(g.text,null,p);g.stateAfter&&(g.stateAfter=null);var b=g.text.match(/^\s*/)[0],C;if(!r&&!/\S/.test(g.text))C=0,i="not";else if(i=="smart"&&(C=n.mode.indent(u,g.text.slice(b.length),g.text),C==Ze||C>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?C=Ye(ae(n,t-1).text,null,p):C=0:i=="add"?C=m+e.options.indentUnit:i=="subtract"?C=m-e.options.indentUnit:typeof i=="number"&&(C=m+i),C=Math.max(0,C);var S="",_=0;if(e.options.indentWithTabs)for(var M=Math.floor(C/p);M;--M)_+=p,S+=" ";if(_p,m=ra(t),b=null;if(g&&r.ranges.length>1)if(Ut&&Ut.text.join(` -`)==t){if(r.ranges.length%Ut.text.length==0){b=[];for(var C=0;C=0;_--){var M=r.ranges[_],P=M.from(),U=M.to();M.empty()&&(i&&i>0?P=K(P.line,P.ch-i):e.state.overwrite&&!g?U=K(U.line,Math.min(ae(u,U.line).text.length,U.ch+De(m).length)):g&&Ut&&Ut.lineWise&&Ut.text.join(` + left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(p),p.scrollIntoView(n),e.display.lineSpace.removeChild(p)}}}function qd(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(i=t.sticky=="before"?Y(t.line,t.ch+1,"before"):t,t=t.ch?Y(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var u=0;u<5;u++){var p=!1,g=Rt(e,t),m=!i||i==t?g:Rt(e,i);n={left:Math.min(g.left,m.left),top:Math.min(g.top,m.top)-r,right:Math.max(g.left,m.left),bottom:Math.max(g.bottom,m.bottom)+r};var b=_a(e,n),C=e.doc.scrollTop,E=e.doc.scrollLeft;if(b.scrollTop!=null&&(Ui(e,b.scrollTop),Math.abs(e.doc.scrollTop-C)>1&&(p=!0)),b.scrollLeft!=null&&(Ir(e,b.scrollLeft),Math.abs(e.doc.scrollLeft-E)>1&&(p=!0)),!p)break}return n}function Rd(e,t){var i=_a(e,t);i.scrollTop!=null&&Ui(e,i.scrollTop),i.scrollLeft!=null&&Ir(e,i.scrollLeft)}function _a(e,t){var i=e.display,r=ii(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,u=xa(e),p={};t.bottom-t.top>u&&(t.bottom=t.top+u);var g=e.doc.height+ya(i),m=t.topg-r;if(t.topn+u){var C=Math.min(t.top,(b?g:t.bottom)-u);C!=n&&(p.scrollTop=C)}var E=e.options.fixedGutter?0:i.gutters.offsetWidth,_=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-E,M=_r(e)-i.gutters.offsetWidth,P=t.right-t.left>M;return P&&(t.right=t.left+M),t.left<10?p.scrollLeft=0:t.left<_?p.scrollLeft=Math.max(0,t.left+E-(P?0:10)):t.right>M+_-3&&(p.scrollLeft=t.right+(P?0:10)-M),p}function za(e,t){t!=null&&(Wn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function ai(e){Wn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Wi(e,t,i){(t!=null||i!=null)&&Wn(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Wd(e,t){Wn(e),e.curOp.scrollToPos=t}function Wn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=zs(e,t.from),r=zs(e,t.to);Ws(e,i,r,t.margin)}}function Ws(e,t,i,r){var n=_a(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-r,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+r});Wi(e,n.scrollLeft,n.scrollTop)}function Ui(e,t){Math.abs(e.doc.scrollTop-t)<2||(s||Oa(e,{top:t}),Us(e,t,!0),s&&Oa(e),Xi(e,100))}function Us(e,t,i){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),!(e.display.scroller.scrollTop==t&&!i)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Ir(e,t,i,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),!((i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)&&(e.doc.scrollLeft=t,Ys(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function ji(e){var t=e.display,i=t.gutters.offsetWidth,r=Math.round(e.doc.height+ya(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?i:0,docHeight:r,scrollHeight:r+Qt(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var Hr=function(e,t,i){this.cm=i;var r=this.vert=k("div",[k("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=k("div",[k("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=n.tabIndex=-1,e(r),e(n),ue(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),ue(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,c&&d<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Hr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var n=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+n)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=i?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var u=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+u)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?r:0,bottom:t?r:0}},Hr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Hr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Hr.prototype.zeroWidthHack=function(){var e=O&&!B?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new dt,this.disableVert=new dt},Hr.prototype.enableZeroWidthBar=function(e,t,i){e.style.visibility="";function r(){var n=e.getBoundingClientRect(),u=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);u!=e?e.style.visibility="hidden":t.set(1e3,r)}t.set(1e3,r)},Hr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Gi=function(){};Gi.prototype.update=function(){return{bottom:0,right:0}},Gi.prototype.setScrollLeft=function(){},Gi.prototype.setScrollTop=function(){},Gi.prototype.clear=function(){};function li(e,t){t||(t=ji(e));var i=e.display.barWidth,r=e.display.barHeight;js(e,t);for(var n=0;n<4&&i!=e.display.barWidth||r!=e.display.barHeight;n++)i!=e.display.barWidth&&e.options.lineWrapping&&qn(e),js(e,ji(e)),i=e.display.barWidth,r=e.display.barHeight}function js(e,t){var i=e.display,r=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=r.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=r.bottom)+"px",i.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=r.bottom+"px",i.scrollbarFiller.style.width=r.right+"px"):i.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=r.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}var Gs={native:Hr,null:Gi};function Xs(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&oe(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Gs[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ue(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?Ir(e,t):Ui(e,t)},e),e.display.scrollbars.addClass&&be(e.display.wrapper,e.display.scrollbars.addClass)}var Ud=0;function Pr(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Ud,markArrays:null},xd(e.curOp)}function qr(e){var t=e.curOp;t&&Cd(t,function(i){for(var r=0;r=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Un(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Xd(e){e.updatedDisplay=e.mustUpdate&&Na(e.cm,e.update)}function Kd(e){var t=e.cm,i=t.display;e.updatedDisplay&&qn(t),e.barMeasure=ji(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Es(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+Qt(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-_r(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function Yd(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)){var i=+new Date+e.options.workTime,r=Ni(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(u){if(r.line>=e.display.viewFrom){var p=u.styles,g=u.text.length>e.options.maxHighlightLength?Lr(t.mode,r.state):null,m=es(e,u,r,!0);g&&(r.state=g),u.styles=m.styles;var b=u.styleClasses,C=m.classes;C?u.styleClasses=C:b&&(u.styleClasses=null);for(var E=!p||p.length!=u.styles.length||b!=C&&(!b||!C||b.bgClass!=C.bgClass||b.textClass!=C.textClass),_=0;!E&&_i)return Xi(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&St(e,function(){for(var u=0;u=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&Hs(e)==0)return!1;Zs(e)&&(br(e),t.dims=Ea(e));var n=r.first+r.size,u=Math.max(t.visible.from-e.options.viewportMargin,r.first),p=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFromp&&i.viewTo-p<20&&(p=Math.min(n,i.viewTo)),rr&&(u=ga(e.doc,u),p=ps(e.doc,p));var g=u!=i.viewFrom||p!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Id(e,u,p),i.viewOffset=ir(ae(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var m=Hs(e);if(!g&&m==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var b=Vd(e);return m>4&&(i.lineDiv.style.display="none"),eh(e,i.updateLineNumbers,t.dims),m>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,$d(b),X(i.cursorDiv),X(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,g&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,Xi(e,400)),i.updateLineNumbers=null,!0}function Ks(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==_r(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+ya(e.display)-xa(e),i.top)}),t.visible=Rn(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Rn(e.display,e.doc,i));if(!Na(e,t))break;qn(e);var n=ji(e);Ri(e),li(e,n),Ha(e,n),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Oa(e,t){var i=new Un(e,t);if(Na(e,i)){qn(e),Ks(e,i);var r=ji(e);Ri(e),li(e,r),Ha(e,r),i.finish()}}function eh(e,t,i){var r=e.display,n=e.options.lineNumbers,u=r.lineDiv,p=u.firstChild;function g(P){var R=P.nextSibling;return v&&O&&e.display.currentWheelTarget==P?P.style.display="none":P.parentNode.removeChild(P),R}for(var m=r.view,b=r.viewFrom,C=0;C-1&&(M=!1),ys(e,E,b,i)),M&&(X(E.lineNumber),E.lineNumber.appendChild(document.createTextNode(sa(e.options,b)))),p=E.node.nextSibling}b+=E.size}for(;p;)p=g(p)}function Ia(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",et(e,"gutterChanged",e)}function Ha(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Qt(e)+"px"}function Ys(e){var t=e.display,i=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var r=Aa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,u=r+"px",p=0;pg.clientWidth,b=g.scrollHeight>g.clientHeight;if(r&&m||n&&b){if(n&&O&&v){e:for(var C=t.target,E=p.view;C!=g;C=C.parentNode)for(var _=0;_=0&&me(e,r.to())<=0)return i}return-1};var Ae=function(e,t){this.anchor=e,this.head=t};Ae.prototype.from=function(){return An(this.anchor,this.head)},Ae.prototype.to=function(){return En(this.anchor,this.head)},Ae.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Wt(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(_,M){return me(_.from(),M.from())}),i=ze(t,n);for(var u=1;u0:m>=0){var b=An(g.from(),p.from()),C=En(g.to(),p.to()),E=g.empty()?p.from()==p.head:g.from()==g.head;u<=i&&--i,t.splice(--u,2,new Ae(E?C:b,E?b:C))}}return new Bt(t,i)}function yr(e,t){return new Bt([new Ae(e,t||e)],0)}function xr(e){return e.text?Y(e.from.line+e.text.length-1,De(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function $s(e,t){if(me(e,t.from)<0)return e;if(me(e,t.to)<=0)return xr(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=xr(t).ch-t.to.ch),Y(i,r)}function qa(e,t){for(var i=[],r=0;r1&&e.remove(g.line+1,P-1),e.insert(g.line+1,J)}et(e,"change",e,t)}function wr(e,t,i){function r(n,u,p){if(n.linked)for(var g=0;g1&&!e.done[e.done.length-2].ranges)return e.done.pop(),De(e.done)}function ou(e,t,i,r){var n=e.history;n.undone.length=0;var u=+new Date,p,g;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>u-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(p=oh(n,n.lastOp==r)))g=De(p.changes),me(t.from,t.to)==0&&me(t.from,g.to)==0?g.to=xr(t):p.changes.push(Ua(e,t));else{var m=De(n.done);for((!m||!m.ranges)&&Xn(e.sel,n.done),p={changes:[Ua(e,t)],generation:n.generation},n.done.push(p);n.done.length>n.undoDepth;)n.done.shift(),n.done[0].ranges||n.done.shift()}n.done.push(i),n.generation=++n.maxGeneration,n.lastModTime=n.lastSelTime=u,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,g||je(e,"historyAdded")}function ah(e,t,i,r){var n=t.charAt(0);return n=="*"||n=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function lh(e,t,i,r){var n=e.history,u=r&&r.origin;i==n.lastSelOp||u&&n.lastSelOrigin==u&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==u||ah(e,u,De(n.done),t))?n.done[n.done.length-1]=t:Xn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=u,n.lastSelOp=i,r&&r.clearRedo!==!1&&nu(n.undone)}function Xn(e,t){var i=De(t);i&&i.ranges&&i.equals(e)||t.push(e)}function au(e,t,i,r){var n=t["spans_"+e.id],u=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(p){p.markedSpans&&((n||(n=t["spans_"+e.id]={}))[u]=p.markedSpans),++u})}function sh(e){if(!e)return null;for(var t,i=0;i-1&&(De(g)[E]=b[E],delete b[E])}}return r}function ja(e,t,i,r){if(r){var n=e.anchor;if(i){var u=me(t,n)<0;u!=me(i,n)<0?(n=t,t=i):u!=me(t,i)<0&&(t=i)}return new Ae(n,t)}else return new Ae(i||t,t)}function Kn(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),st(e,new Bt([ja(e.sel.primary(),t,i,n)],0),r)}function su(e,t,i){for(var r=[],n=e.cm&&(e.cm.display.shift||e.extend),u=0;u=t.ch:g.to>t.ch))){if(n&&(je(m,"beforeCursorEnter"),m.explicitlyCleared))if(u.markedSpans){--p;continue}else break;if(!m.atomic)continue;if(i){var E=m.find(r<0?1:-1),_=void 0;if((r<0?C:b)&&(E=pu(e,E,-r,E&&E.line==t.line?u:null)),E&&E.line==t.line&&(_=me(E,i))&&(r<0?_<0:_>0))return ui(e,E,t,r,n)}var M=m.find(r<0?-1:1);return(r<0?b:C)&&(M=pu(e,M,r,M.line==t.line?u:null)),M?ui(e,M,t,r,n):null}}return t}function Zn(e,t,i,r,n){var u=r||1,p=ui(e,t,i,u,n)||!n&&ui(e,t,i,u,!0)||ui(e,t,i,-u,n)||!n&&ui(e,t,i,-u,!0);return p||(e.cantEdit=!0,Y(e.first,0))}function pu(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?ve(e,Y(t.line-1)):null:i>0&&t.ch==(r||ae(e,t.line)).text.length?t.line=0;--n)vu(e,{from:r[n].from,to:r[n].to,text:n?[""]:t.text,origin:t.origin});else vu(e,t)}}function vu(e,t){if(!(t.text.length==1&&t.text[0]==""&&me(t.from,t.to)==0)){var i=qa(e,t);ou(e,t,i,e.cm?e.cm.curOp.id:NaN),Zi(e,t,i,ha(e,t));var r=[];wr(e,function(n,u){!u&&ze(r,n.history)==-1&&(wu(n.history,t),r.push(n.history)),Zi(n,t,null,ha(n,t))})}}function Qn(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(!(r&&!i)){for(var n=e.history,u,p=e.sel,g=t=="undo"?n.done:n.undone,m=t=="undo"?n.undone:n.done,b=0;b=0;--M){var P=_(M);if(P)return P.v}}}}function bu(e,t){if(t!=0&&(e.first+=t,e.sel=new Bt(Pt(e.sel.ranges,function(n){return new Ae(Y(n.anchor.line+t,n.anchor.ch),Y(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm)){yt(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;re.lastLine())){if(t.from.lineu&&(t={from:t.from,to:Y(u,ae(e,u).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Mr(e,t.from,t.to),i||(i=qa(e,t)),e.cm?ch(e.cm,t,r):Wa(e,t,r),Yn(e,i,vt),e.cantEdit&&Zn(e,Y(e.firstLine(),0))&&(e.cantEdit=!1)}}function ch(e,t,i){var r=e.doc,n=e.display,u=t.from,p=t.to,g=!1,m=u.line;e.options.lineWrapping||(m=Fe(qt(ae(r,u.line))),r.iter(m,p.line+1,function(M){if(M==n.maxLine)return g=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Yl(e),Wa(r,t,i,Is(e)),e.options.lineWrapping||(r.iter(m,u.line+t.text.length,function(M){var P=_n(M);P>n.maxLineLength&&(n.maxLine=M,n.maxLineLength=P,n.maxLineChanged=!0,g=!1)}),g&&(e.curOp.updateMaxLine=!0)),ed(r,u.line),Xi(e,400);var b=t.text.length-(p.line-u.line)-1;t.full?yt(e):u.line==p.line&&t.text.length==1&&!tu(e.doc,t)?vr(e,u.line,"text"):yt(e,u.line,p.line+1,b);var C=Ot(e,"changes"),E=Ot(e,"change");if(E||C){var _={from:u,to:p,text:t.text,removed:t.removed,origin:t.origin};E&&et(e,"change",e,_),C&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(_)}e.display.selForContextMenu=null}function ci(e,t,i,r,n){var u;r||(r=i),me(r,i)<0&&(u=[r,i],i=u[0],r=u[1]),typeof t=="string"&&(t=e.splitLines(t)),fi(e,{from:i,to:r,text:t,origin:n})}function yu(e,t,i,r){i1||!(this.children[0]instanceof Ji))){var g=[];this.collapse(g),this.children=[new Ji(g)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var p=n.lines.length%25+25,g=p;g10);e.parent.maybeSpill()}},iterN:function(e,t,i){for(var r=0;re.display.maxLineLength&&(e.display.maxLine=b,e.display.maxLineLength=C,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&yt(e,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&du(e.doc)),e&&et(e,"markerCleared",e,this,r,n),t&&qr(e),this.parent&&this.parent.clear()}},Cr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n0||p==0&&u.clearWhenEmpty!==!1)return u;if(u.replacedWith&&(u.collapsed=!0,u.widgetNode=H("span",[u.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||u.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(u.widgetNode.insertLeft=!0)),u.collapsed){if(hs(e,t.line,t,i,u)||t.line!=i.line&&hs(e,i.line,t,i,u))throw new Error("Inserting collapsed marker partially overlapping an existing one");rd()}u.addToHistory&&ou(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var g=t.line,m=e.cm,b;if(e.iter(g,i.line+1,function(E){m&&u.collapsed&&!m.options.lineWrapping&&qt(E)==m.display.maxLine&&(b=!0),u.collapsed&&g!=t.line&&Yt(E,0),nd(E,new Tn(u,g==t.line?t.ch:null,g==i.line?i.ch:null),e.cm&&e.cm.curOp),++g}),u.collapsed&&e.iter(t.line,i.line+1,function(E){mr(e,E)&&Yt(E,0)}),u.clearOnEnter&&ue(u,"beforeCursorEnter",function(){return u.clear()}),u.readOnly&&(td(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),u.collapsed&&(u.id=++Du,u.atomic=!0),m){if(b&&(m.curOp.updateMaxLine=!0),u.collapsed)yt(m,t.line,i.line+1);else if(u.className||u.startStyle||u.endStyle||u.css||u.attributes||u.title)for(var C=t.line;C<=i.line;C++)vr(m,C,"text");u.atomic&&du(m.doc),et(m,"markerAdded",m,u)}return u}var en=function(e,t){this.markers=e,this.primary=t;for(var i=0;i=0;m--)fi(this,r[m]);g?fu(this,g):this.cm&&ai(this.cm)}),undo:rt(function(){Qn(this,"undo")}),redo:rt(function(){Qn(this,"redo")}),undoSelection:rt(function(){Qn(this,"undo",!0)}),redoSelection:rt(function(){Qn(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,r=0;r=e.ch)&&t.push(n.marker.parent||n.marker)}return t},findMarks:function(e,t,i){e=ve(this,e),t=ve(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(u){var p=u.markedSpans;if(p)for(var g=0;g=m.to||m.from==null&&n!=e.line||m.from!=null&&n==t.line&&m.from>=t.ch)&&(!i||i(m.marker))&&r.push(m.marker.parent||m.marker)}++n}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var r=0;re)return t=e,!0;e-=u,++i}),ve(this,Y(i,t))},indexFromPos:function(e){e=ve(this,e);var t=e.ch;if(e.linet&&(t=e.from),e.to!=null&&e.to-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var C=e.dataTransfer.getData("Text");if(C){var E;if(t.state.draggingText&&!t.state.draggingText.copy&&(E=t.listSelections()),Yn(t.doc,yr(i,i)),E)for(var _=0;_=0;g--)ci(e.doc,"",r[g].from,r[g].to,"+delete");ai(e)})}function Xa(e,t,i){var r=Xl(e.text,t+i,i);return r<0||r>e.text.length?null:r}function Ka(e,t,i){var r=Xa(e,t.ch,i);return r==null?null:new Y(t.line,r,i<0?"after":"before")}function Ya(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var u=tr(i,t.doc.direction);if(u){var p=n<0?De(u):u[0],g=n<0==(p.level==1),m=g?"after":"before",b;if(p.level>0||t.doc.direction=="rtl"){var C=ri(t,i);b=n<0?i.text.length-1:0;var E=Jt(t,C,b).top;b=Li(function(_){return Jt(t,C,_).top==E},n<0==(p.level==1)?p.from:p.to-1,b),m=="before"&&(b=Xa(i,b,1))}else b=n<0?p.to:p.from;return new Y(r,b,m)}}return new Y(r,n<0?i.text.length:0,n<0?"before":"after")}function Sh(e,t,i,r){var n=tr(t,e.doc.direction);if(!n)return Ka(t,i,r);i.ch>=t.text.length?(i.ch=t.text.length,i.sticky="before"):i.ch<=0&&(i.ch=0,i.sticky="after");var u=Bi(n,i.ch,i.sticky),p=n[u];if(e.doc.direction=="ltr"&&p.level%2==0&&(r>0?p.to>i.ch:p.from=p.from&&_>=C.begin)){var M=E?"before":"after";return new Y(i.line,_,M)}}var P=function(J,te,V){for(var ie=function(Le,it){return it?new Y(i.line,g(Le,1),"before"):new Y(i.line,Le,"after")};J>=0&&J0==(se.level!=1),we=le?V.begin:g(V.end,-1);if(se.from<=we&&we0?C.end:g(C.begin,-1);return Z!=null&&!(r>0&&Z==t.text.length)&&(R=P(r>0?0:n.length-1,r,b(Z)),R)?R:null}var nn={selectAll:gu,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),vt)},killLine:function(e){return pi(e,function(t){if(t.empty()){var i=ae(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line0)n=new Y(n.line,n.ch+1),e.replaceRange(u.charAt(n.ch-1)+u.charAt(n.ch-2),Y(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var p=ae(e.doc,n.line-1).text;p&&(n=new Y(n.line,1),e.replaceRange(u.charAt(0)+e.doc.lineSeparator()+p.charAt(p.length-1),Y(n.line-1,p.length-1),n,"+transpose"))}}i.push(new Ae(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){return St(e,function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");t=e.listSelections();for(var r=0;re&&me(t,this.pos)==0&&i==this.button};var an,ln;function Bh(e,t){var i=+new Date;return ln&&ln.compare(i,e,t)?(an=ln=null,"triple"):an&&an.compare(i,e,t)?(ln=new Qa(i,e,t),an=null,"double"):(an=new Qa(i,e,t),ln=null,"single")}function Pu(e){var t=this,i=t.display;if(!($e(t,e)||i.activeTouch&&i.input.supportsTouch())){if(i.input.ensurePolled(),i.shift=e.shiftKey,nr(i,e)){v||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(!Ja(t,e)){var r=Nr(t,e),n=Ql(e),u=r?Bh(r,n):"single";ye(t).focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&_h(t,n,r,u,e))&&(n==1?r?Nh(t,r,u,e):$o(e)==i.scroller&&bt(e):n==2?(r&&Kn(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(de?t.display.input.onContextMenu(e):Ma(t)))}}}function _h(e,t,i,r,n){var u="Click";return r=="double"?u="Double"+u:r=="triple"&&(u="Triple"+u),u=(t==1?"Left":t==2?"Middle":"Right")+u,on(e,Lu(u,n),n,function(p){if(typeof p=="string"&&(p=nn[p]),!p)return!1;var g=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),g=p(e,i)!=Ze}finally{e.state.suppressEdits=!1}return g})}function zh(e,t,i){var r=e.getOption("configureMouse"),n=r?r(e,t,i):{};if(n.unit==null){var u=I?i.shiftKey&&i.metaKey:i.altKey;n.unit=u?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(n.extend==null||e.doc.extend)&&(n.extend=e.doc.extend||i.shiftKey),n.addNew==null&&(n.addNew=O?i.metaKey:i.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(O?i.altKey:i.ctrlKey)),n}function Nh(e,t,i,r){c?setTimeout(lt(qs,e),0):e.curOp.focus=he(ee(e));var n=zh(e,i,r),u=e.doc.sel,p;e.options.dragDrop&&Uc&&!e.isReadOnly()&&i=="single"&&(p=u.contains(t))>-1&&(me((p=u.ranges[p]).from(),t)<0||t.xRel>0)&&(me(p.to(),t)>0||t.xRel<0)?Oh(e,r,t,n):Ih(e,r,t,n)}function Oh(e,t,i,r){var n=e.display,u=!1,p=tt(e,function(b){v&&(n.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:Ma(e)),Mt(n.wrapper.ownerDocument,"mouseup",p),Mt(n.wrapper.ownerDocument,"mousemove",g),Mt(n.scroller,"dragstart",m),Mt(n.scroller,"drop",p),u||(bt(b),r.addNew||Kn(e.doc,i,null,null,r.extend),v&&!F||c&&d==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),g=function(b){u=u||Math.abs(t.clientX-b.clientX)+Math.abs(t.clientY-b.clientY)>=10},m=function(){return u=!0};v&&(n.scroller.draggable=!0),e.state.draggingText=p,p.copy=!r.moveOnDrag,ue(n.wrapper.ownerDocument,"mouseup",p),ue(n.wrapper.ownerDocument,"mousemove",g),ue(n.scroller,"dragstart",m),ue(n.scroller,"drop",p),e.state.delayingBlurEvent=!0,setTimeout(function(){return n.input.focus()},20),n.scroller.dragDrop&&n.scroller.dragDrop()}function qu(e,t,i){if(i=="char")return new Ae(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new Ae(Y(t.line,0),ve(e.doc,Y(t.line+1,0)));var r=i(e,t);return new Ae(r.from,r.to)}function Ih(e,t,i,r){c&&Ma(e);var n=e.display,u=e.doc;bt(t);var p,g,m=u.sel,b=m.ranges;if(r.addNew&&!r.extend?(g=u.sel.contains(i),g>-1?p=b[g]:p=new Ae(i,i)):(p=u.sel.primary(),g=u.sel.primIndex),r.unit=="rectangle")r.addNew||(p=new Ae(i,i)),i=Nr(e,t,!0,!0),g=-1;else{var C=qu(e,i,r.unit);r.extend?p=ja(p,C.anchor,C.head,r.extend):p=C}r.addNew?g==-1?(g=b.length,st(u,Wt(e,b.concat([p]),g),{scroll:!1,origin:"*mouse"})):b.length>1&&b[g].empty()&&r.unit=="char"&&!r.extend?(st(u,Wt(e,b.slice(0,g).concat(b.slice(g+1)),0),{scroll:!1,origin:"*mouse"}),m=u.sel):Ga(u,g,p,Ti):(g=0,st(u,new Bt([p],0),Ti),m=u.sel);var E=i;function _(V){if(me(E,V)!=0)if(E=V,r.unit=="rectangle"){for(var ie=[],se=e.options.tabSize,le=Ye(ae(u,i.line).text,i.ch,se),we=Ye(ae(u,V.line).text,V.ch,se),Le=Math.min(le,we),it=Math.max(le,we),Ie=Math.min(i.line,V.line),Et=Math.min(e.lastLine(),Math.max(i.line,V.line));Ie<=Et;Ie++){var wt=ae(u,Ie).text,Xe=Kt(wt,Le,se);Le==it?ie.push(new Ae(Y(Ie,Xe),Y(Ie,Xe))):wt.length>Xe&&ie.push(new Ae(Y(Ie,Xe),Y(Ie,Kt(wt,it,se))))}ie.length||ie.push(new Ae(i,i)),st(u,Wt(e,m.ranges.slice(0,g).concat(ie),g),{origin:"*mouse",scroll:!1}),e.scrollIntoView(V)}else{var Ct=p,ot=qu(e,V,r.unit),Qe=Ct.anchor,Ke;me(ot.anchor,Qe)>0?(Ke=ot.head,Qe=An(Ct.from(),ot.anchor)):(Ke=ot.anchor,Qe=En(Ct.to(),ot.head));var qe=m.ranges.slice(0);qe[g]=Hh(e,new Ae(ve(u,Qe),Ke)),st(u,Wt(e,qe,g),Ti)}}var M=n.wrapper.getBoundingClientRect(),P=0;function R(V){var ie=++P,se=Nr(e,V,!0,r.unit=="rectangle");if(se)if(me(se,E)!=0){e.curOp.focus=he(ee(e)),_(se);var le=Rn(n,u);(se.line>=le.to||se.lineM.bottom?20:0;we&&setTimeout(tt(e,function(){P==ie&&(n.scroller.scrollTop+=we,R(V))}),50)}}function Z(V){e.state.selectingText=!1,P=1/0,V&&(bt(V),n.input.focus()),Mt(n.wrapper.ownerDocument,"mousemove",J),Mt(n.wrapper.ownerDocument,"mouseup",te),u.history.lastSelOrigin=null}var J=tt(e,function(V){V.buttons===0||!Ql(V)?Z(V):R(V)}),te=tt(e,Z);e.state.selectingText=te,ue(n.wrapper.ownerDocument,"mousemove",J),ue(n.wrapper.ownerDocument,"mouseup",te)}function Hh(e,t){var i=t.anchor,r=t.head,n=ae(e.doc,i.line);if(me(i,r)==0&&i.sticky==r.sticky)return t;var u=tr(n);if(!u)return t;var p=Bi(u,i.ch,i.sticky),g=u[p];if(g.from!=i.ch&&g.to!=i.ch)return t;var m=p+(g.from==i.ch==(g.level!=1)?0:1);if(m==0||m==u.length)return t;var b;if(r.line!=i.line)b=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var C=Bi(u,r.ch,r.sticky),E=C-p||(r.ch-i.ch)*(g.level==1?-1:1);C==m-1||C==m?b=E<0:b=E>0}var _=u[m+(b?-1:0)],M=b==(_.level==1),P=M?_.from:_.to,R=M?"after":"before";return i.ch==P&&i.sticky==R?t:new Ae(new Y(i.line,P,R),r)}function Ru(e,t,i,r){var n,u;if(t.touches)n=t.touches[0].clientX,u=t.touches[0].clientY;else try{n=t.clientX,u=t.clientY}catch{return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&bt(t);var p=e.display,g=p.lineDiv.getBoundingClientRect();if(u>g.bottom||!Ot(e,i))return Vo(t);u-=g.top-p.viewOffset;for(var m=0;m=n){var C=Br(e.doc,u),E=e.display.gutterSpecs[m];return je(e,i,e,C,E.className,t),Vo(t)}}}function Ja(e,t){return Ru(e,t,"gutterClick",!0)}function Wu(e,t){nr(e.display,t)||Ph(e,t)||$e(e,t,"contextmenu")||de||e.display.input.onContextMenu(t)}function Ph(e,t){return Ot(e,"gutterContextMenu")?Ru(e,t,"gutterContextMenu",!1):!1}function Uu(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),qi(e)}var gi={toString:function(){return"CodeMirror.Init"}},ju={},eo={};function qh(e){var t=e.optionHandlers;function i(r,n,u,p){e.defaults[r]=n,u&&(t[r]=p?function(g,m,b){b!=gi&&u(g,m,b)}:u)}e.defineOption=i,e.Init=gi,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,Ra(r)},!0),i("indentUnit",2,Ra,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){Yi(r),qi(r),yt(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!!n){var u=[],p=r.doc.first;r.doc.iter(function(m){for(var b=0;;){var C=m.text.indexOf(n,b);if(C==-1)break;b=C+n.length,u.push(Y(p,C))}p++});for(var g=u.length-1;g>=0;g--)ci(r.doc,n,u[g],Y(u[g].line,u[g].ch+n.length))}}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(r,n,u){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),u!=gi&&r.refresh()}),i("specialCharPlaceholder",gd,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",z?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(r,n){return r.getInputField().spellcheck=n},!0),i("autocorrect",!1,function(r,n){return r.getInputField().autocorrect=n},!0),i("autocapitalize",!1,function(r,n){return r.getInputField().autocapitalize=n},!0),i("rtlMoveVisually",!W),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Uu(r),Ki(r)},!0),i("keyMap","default",function(r,n,u){var p=Vn(n),g=u!=gi&&Vn(u);g&&g.detach&&g.detach(r,p),p.attach&&p.attach(r,g||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Wh,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=Pa(n,r.options.lineNumbers),Ki(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?Aa(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return li(r)},!0),i("scrollbarStyle","native",function(r){Xs(r),li(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),i("lineNumbers",!1,function(r,n){r.display.gutterSpecs=Pa(r.options.gutters,n),Ki(r)},!0),i("firstLineNumber",1,Ki,!0),i("lineNumberFormatter",function(r){return r},Ki,!0),i("showCursorWhenSelecting",!1,Ri,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,n){n=="nocursor"&&(oi(r),r.display.input.blur()),r.display.input.readOnlyChanged(n)}),i("screenReaderLabel",null,function(r,n){n=n===""?null:n,r.display.input.screenReaderLabelChanged(n)}),i("disableInput",!1,function(r,n){n||r.display.input.reset()},!0),i("dragDrop",!0,Rh),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,Ri,!0),i("singleCursorHeightPerLine",!0,Ri,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,Yi,!0),i("addModeClass",!1,Yi,!0),i("pollInterval",100),i("undoDepth",200,function(r,n){return r.doc.history.undoDepth=n}),i("historyEventDelay",1250),i("viewportMargin",10,function(r){return r.refresh()},!0),i("maxHighlightLength",1e4,Yi,!0),i("moveInputWithCursor",!0,function(r,n){n||r.display.input.resetPosition()}),i("tabindex",null,function(r,n){return r.display.input.getField().tabIndex=n||""}),i("autofocus",null),i("direction","ltr",function(r,n){return r.doc.setDirection(n)},!0),i("phrases",null)}function Rh(e,t,i){var r=i&&i!=gi;if(!t!=!r){var n=e.display.dragFunctions,u=t?ue:Mt;u(e.display.scroller,"dragstart",n.start),u(e.display.scroller,"dragenter",n.enter),u(e.display.scroller,"dragover",n.over),u(e.display.scroller,"dragleave",n.leave),u(e.display.scroller,"drop",n.drop)}}function Wh(e){e.options.lineWrapping?(be(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(oe(e.display.wrapper,"CodeMirror-wrap"),va(e)),Fa(e),yt(e),qi(e),setTimeout(function(){return li(e)},100)}function Ne(e,t){var i=this;if(!(this instanceof Ne))return new Ne(e,t);this.options=t=t?Lt(t):{},Lt(ju,t,!1);var r=t.value;typeof r=="string"?r=new xt(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new Ne.inputStyles[t.inputStyle](this),u=this.display=new th(e,r,n,t);u.wrapper.CodeMirror=this,Uu(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Xs(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new dt,keySeq:null,specialChars:null},t.autofocus&&!z&&u.input.focus(),c&&d<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Uh(this),xh(),Pr(this),this.curOp.forceUpdate=!0,ru(this,r),t.autofocus&&!z||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&Ba(i)},20):oi(this);for(var p in eo)eo.hasOwnProperty(p)&&eo[p](this,t[p],gi);Zs(this),t.finishInit&&t.finishInit(this);for(var g=0;g20*20}ue(t.scroller,"touchstart",function(m){if(!$e(e,m)&&!u(m)&&!Ja(e,m)){t.input.ensurePolled(),clearTimeout(i);var b=+new Date;t.activeTouch={start:b,moved:!1,prev:b-r.end<=300?r:null},m.touches.length==1&&(t.activeTouch.left=m.touches[0].pageX,t.activeTouch.top=m.touches[0].pageY)}}),ue(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),ue(t.scroller,"touchend",function(m){var b=t.activeTouch;if(b&&!nr(t,m)&&b.left!=null&&!b.moved&&new Date-b.start<300){var C=e.coordsChar(t.activeTouch,"page"),E;!b.prev||p(b,b.prev)?E=new Ae(C,C):!b.prev.prev||p(b,b.prev.prev)?E=e.findWordAt(C):E=new Ae(Y(C.line,0),ve(e.doc,Y(C.line+1,0))),e.setSelection(E.anchor,E.head),e.focus(),bt(m)}n()}),ue(t.scroller,"touchcancel",n),ue(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Ui(e,t.scroller.scrollTop),Ir(e,t.scroller.scrollLeft,!0),je(e,"scroll",e))}),ue(t.scroller,"mousewheel",function(m){return Vs(e,m)}),ue(t.scroller,"DOMMouseScroll",function(m){return Vs(e,m)}),ue(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(m){$e(e,m)||_i(m)},over:function(m){$e(e,m)||(yh(e,m),_i(m))},start:function(m){return bh(e,m)},drop:tt(e,vh),leave:function(m){$e(e,m)||Eu(e)}};var g=t.input.getField();ue(g,"keyup",function(m){return Iu.call(e,m)}),ue(g,"keydown",tt(e,Ou)),ue(g,"keypress",tt(e,Hu)),ue(g,"focus",function(m){return Ba(e,m)}),ue(g,"blur",function(m){return oi(e,m)})}var Va=[];Ne.defineInitHook=function(e){return Va.push(e)};function sn(e,t,i,r){var n=e.doc,u;i==null&&(i="add"),i=="smart"&&(n.mode.indent?u=Ni(e,t).state:i="prev");var p=e.options.tabSize,g=ae(n,t),m=Ye(g.text,null,p);g.stateAfter&&(g.stateAfter=null);var b=g.text.match(/^\s*/)[0],C;if(!r&&!/\S/.test(g.text))C=0,i="not";else if(i=="smart"&&(C=n.mode.indent(u,g.text.slice(b.length),g.text),C==Ze||C>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?C=Ye(ae(n,t-1).text,null,p):C=0:i=="add"?C=m+e.options.indentUnit:i=="subtract"?C=m-e.options.indentUnit:typeof i=="number"&&(C=m+i),C=Math.max(0,C);var E="",_=0;if(e.options.indentWithTabs)for(var M=Math.floor(C/p);M;--M)_+=p,E+=" ";if(_p,m=ra(t),b=null;if(g&&r.ranges.length>1)if(Ut&&Ut.text.join(` +`)==t){if(r.ranges.length%Ut.text.length==0){b=[];for(var C=0;C=0;_--){var M=r.ranges[_],P=M.from(),R=M.to();M.empty()&&(i&&i>0?P=Y(P.line,P.ch-i):e.state.overwrite&&!g?R=Y(R.line,Math.min(ae(u,R.line).text.length,R.ch+De(m).length)):g&&Ut&&Ut.lineWise&&Ut.text.join(` `)==m.join(` -`)&&(P=U=K(P.line,0)));var Z={from:P,to:U,text:b?b[_%b.length]:m,origin:n||(g?"paste":e.state.cutIncoming>p?"cut":"+input")};fi(e.doc,Z),et(e,"inputRead",e,Z)}t&&!g&&Gu(e,t),ai(e),e.curOp.updateInput<2&&(e.curOp.updateInput=S),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ju(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&St(t,function(){return $a(t,i,0,null,"paste")}),!0}function Gu(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var i=e.doc.sel,r=i.ranges.length-1;r>=0;r--){var n=i.ranges[r];if(!(n.head.ch>100||r&&i.ranges[r-1].head.line==n.head.line)){var u=e.getModeAt(n.head),p=!1;if(u.electricChars){for(var g=0;g-1){p=sn(e,n.head.line,"smart");break}}else u.electricInput&&u.electricInput.test(ae(e.doc,n.head.line).text.slice(0,n.head.ch))&&(p=sn(e,n.head.line,"smart"));p&&et(e,"electricInput",e,n.head.line)}}}function Xu(e){for(var t=[],i=[],r=0;ru&&(sn(this,g.head.line,r,!0),u=g.head.line,p==this.doc.sel.primIndex&&ai(this));else{var m=g.from(),b=g.to(),C=Math.max(u,m.line);u=Math.min(this.lastLine(),b.line-(b.ch?0:1))+1;for(var S=C;S0&&Ga(this.doc,p,new Ee(m,_[p].to()),vt)}}}),getTokenAt:function(r,n){return is(this,r,n)},getLineTokens:function(r,n){return is(this,K(r),n,!0)},getTokenTypeAt:function(r){r=ve(this.doc,r);var n=es(this,ae(this.doc,r.line)),u=0,p=(n.length-1)/2,g=r.ch,m;if(g==0)m=n[2];else for(;;){var b=u+p>>1;if((b?n[b*2-1]:0)>=g)p=b;else if(n[b*2+1]m&&(r=m,p=!0),g=ae(this.doc,r)}else g=r;return On(this,g,{top:0,left:0},n||"page",u||p).top+(p?this.doc.height-ir(g):0)},defaultTextHeight:function(){return ii(this.display)},defaultCharWidth:function(){return ni(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,u,p,g){var m=this.display;r=Rt(this,ve(this.doc,r));var b=r.bottom,C=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),m.sizer.appendChild(n),p=="over")b=r.top;else if(p=="above"||p=="near"){var S=Math.max(m.wrapper.clientHeight,this.doc.height),_=Math.max(m.sizer.clientWidth,m.lineSpace.clientWidth);(p=="above"||r.bottom+n.offsetHeight>S)&&r.top>n.offsetHeight?b=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=S&&(b=r.bottom),C+n.offsetWidth>_&&(C=_-n.offsetWidth)}n.style.top=b+"px",n.style.left=n.style.right="",g=="right"?(C=m.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(g=="left"?C=0:g=="middle"&&(C=(m.sizer.clientWidth-n.offsetWidth)/2),n.style.left=C+"px"),u&&Rd(this,{left:C,top:b,right:C+n.offsetWidth,bottom:b+n.offsetHeight})},triggerOnKeyDown:dt(Nu),triggerOnKeyPress:dt(Iu),triggerOnKeyUp:Ou,triggerOnMouseDown:dt(Hu),execCommand:function(r){if(nn.hasOwnProperty(r))return nn[r].call(null,this)},triggerElectric:dt(function(r){Gu(this,r)}),findPosH:function(r,n,u,p){var g=1;n<0&&(g=-1,n=-n);for(var m=ve(this.doc,r),b=0;b0&&C(u.charAt(p-1));)--p;for(;g.5||this.options.lineWrapping)&&Fa(this),je(this,"refresh",this)}),swapDoc:dt(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),tu(this,r),qi(this),this.display.input.reset(),Wi(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,et(this,"swapDoc",this,n),n}),phrase:function(r){var n=this.options.phrases;return n&&Object.prototype.hasOwnProperty.call(n,r)?n[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Jr(e),e.registerHelper=function(r,n,u){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=u},e.registerGlobalHelper=function(r,n,u,p){e.registerHelper(r,n,p),i[r]._global.push({pred:u,val:p})}}function tl(e,t,i,r,n){var u=t,p=i,g=ae(e,t.line),m=n&&e.direction=="rtl"?-i:i;function b(){var ee=t.line+m;return ee=e.first+e.size?!1:(t=new K(ee,t.ch,t.sticky),g=ae(e,ee))}function C(ee){var V;if(r=="codepoint"){var ie=g.text.charCodeAt(t.ch+(i>0?0:-1));if(isNaN(ie))V=null;else{var se=i>0?ie>=55296&&ie<56320:ie>=56320&&ie<57343;V=new K(t.line,Math.max(0,Math.min(g.text.length,t.ch+i*(se?2:1))),-i)}}else n?V=Sh(e.cm,g,t,i):V=Ka(g,t,i);if(V==null)if(!ee&&b())t=Ya(n,e.cm,g,t.line,m);else return!1;else t=V;return!0}if(r=="char"||r=="codepoint")C();else if(r=="column")C(!0);else if(r=="word"||r=="group")for(var S=null,_=r=="group",M=e.cm&&e.cm.getHelper(t,"wordChars"),P=!0;!(i<0&&!C(!P));P=!1){var U=g.text.charAt(t.ch)||` -`,Z=kn(U,M)?"w":_&&U==` -`?"n":!_||/\s/.test(U)?null:"p";if(_&&!P&&!Z&&(Z="s"),S&&S!=Z){i<0&&(i=1,C(),t.sticky="after");break}if(Z&&(S=Z),i>0&&!C(!P))break}var J=Zn(e,t,u,p,!0);return ua(u,J)&&(J.hitSide=!0),J}function Yu(e,t,i,r){var n=e.doc,u=t.left,p;if(r=="page"){var g=Math.min(e.display.wrapper.clientHeight,ye(e).innerHeight||n(e).documentElement.clientHeight),m=Math.max(g-.5*ii(e.display),3);p=(i>0?t.bottom:t.top)+i*m}else r=="line"&&(p=i>0?t.bottom+3:t.top-3);for(var b;b=ka(e,u,p),!!b.outside;){if(i<0?p<=0:p>=n.height){b.hitSide=!0;break}p+=i*5}return b}var Te=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ct,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Te.prototype.init=function(e){var t=this,i=this,r=i.cm,n=i.div=e.lineDiv;n.contentEditable=!0,el(n,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function u(g){for(var m=g.target;m;m=m.parentNode){if(m==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(m.className))break}return!1}ue(n,"paste",function(g){!u(g)||$e(r,g)||ju(g,r)||d<=11&&setTimeout(tt(r,function(){return t.updateFromDOM()}),20)}),ue(n,"compositionstart",function(g){t.composing={data:g.data,done:!1}}),ue(n,"compositionupdate",function(g){t.composing||(t.composing={data:g.data,done:!1})}),ue(n,"compositionend",function(g){t.composing&&(g.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ue(n,"touchstart",function(){return i.forceCompositionEnd()}),ue(n,"input",function(){t.composing||t.readFromDOMSoon()});function p(g){if(!(!u(g)||$e(r,g))){if(r.somethingSelected())to({lineWise:!1,text:r.getSelections()}),g.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var m=Xu(r);to({lineWise:!0,text:m.text}),g.type=="cut"&&r.operation(function(){r.setSelections(m.ranges,0,vt),r.replaceSelection("",null,"cut")})}else return;if(g.clipboardData){g.clipboardData.clearData();var b=Ut.text.join(` -`);if(g.clipboardData.setData("Text",b),g.clipboardData.getData("Text")==b){g.preventDefault();return}}var C=Ku(),S=C.firstChild;el(S),r.display.lineSpace.insertBefore(C,r.display.lineSpace.firstChild),S.value=Ut.text.join(` -`);var _=de(Ce(n));A(S),setTimeout(function(){r.display.lineSpace.removeChild(C),_.focus(),_==n&&i.showPrimarySelection()},50)}}ue(n,"copy",p),ue(n,"cut",p)},Te.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Te.prototype.prepareSelection=function(){var e=Hs(this.cm,!1);return e.focus=de(Ce(this.div))==this.div,e},Te.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Te.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Te.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),r=i.from(),n=i.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||n.line=t.display.viewFrom&&Zu(t,r)||{node:g[0].measure.map[2],offset:0},b=n.linee.firstLine()&&(r=K(r.line-1,ae(e.doc,r.line-1).length)),n.ch==ae(e.doc,n.line).text.length&&n.linet.viewTo-1)return!1;var u,p,g;r.line==t.viewFrom||(u=Or(e,r.line))==0?(p=Fe(t.view[0].line),g=t.view[0].node):(p=Fe(t.view[u].line),g=t.view[u-1].node.nextSibling);var m=Or(e,n.line),b,C;if(m==t.view.length-1?(b=t.viewTo-1,C=t.lineDiv.lastChild):(b=Fe(t.view[m+1].line)-1,C=t.view[m+1].node.previousSibling),!g)return!1;for(var S=e.doc.splitLines(Xh(e,g,C,p,b)),_=Mr(e.doc,K(p,0),K(b,ae(e.doc,b).text.length));S.length>1&&_.length>1;)if(De(S)==De(_))S.pop(),_.pop(),b--;else if(S[0]==_[0])S.shift(),_.shift(),p++;else break;for(var M=0,P=0,U=S[0],Z=_[0],J=Math.min(U.length,Z.length);Mr.ch&&ee.charCodeAt(ee.length-P-1)==V.charCodeAt(V.length-P-1);)M--,P++;S[S.length-1]=ee.slice(0,ee.length-P).replace(/^\u200b+/,""),S[0]=S[0].slice(M).replace(/\u200b+$/,"");var se=K(p,M),le=K(b,_.length?De(_).length-P:0);if(S.length>1||S[0]||me(se,le))return ci(e.doc,S,se,le,"+input"),!0},Te.prototype.ensurePolled=function(){this.forceCompositionEnd()},Te.prototype.reset=function(){this.forceCompositionEnd()},Te.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Te.prototype.readFromDOMSoon=function(){var e=this;this.readDOMTimeout==null&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80))},Te.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&St(this.cm,function(){return yt(e.cm)})},Te.prototype.setUneditable=function(e){e.contentEditable="false"},Te.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||tt(this.cm,$a)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},Te.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Te.prototype.onContextMenu=function(){},Te.prototype.resetPosition=function(){},Te.prototype.needsContentAttribute=!0;function Zu(e,t){var i=wa(e,t.line);if(!i||i.hidden)return null;var r=ae(e.doc,t.line),n=ks(i,r,t.line),u=tr(r,e.doc.direction),p="left";if(u){var g=Bi(u,t.ch);p=g%2?"right":"left"}var m=As(n.map,t.ch,p);return m.offset=m.collapse=="right"?m.end:m.start,m}function Gh(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function mi(e,t){return t&&(e.bad=!0),e}function Xh(e,t,i,r,n){var u="",p=!1,g=e.doc.lineSeparator(),m=!1;function b(M){return function(P){return P.id==M}}function C(){p&&(u+=g,m&&(u+=g),p=m=!1)}function S(M){M&&(C(),u+=M)}function _(M){if(M.nodeType==1){var P=M.getAttribute("cm-text");if(P){S(P);return}var U=M.getAttribute("cm-marker"),Z;if(U){var J=e.findMarks(K(r,0),K(n+1,0),b(+U));J.length&&(Z=J[0].find(0))&&S(Mr(e.doc,Z.from,Z.to).join(g));return}if(M.getAttribute("contenteditable")=="false")return;var ee=/^(pre|div|p|li|table|br)$/i.test(M.nodeName);if(!/^br$/i.test(M.nodeName)&&M.textContent.length==0)return;ee&&C();for(var V=0;V=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),ue(n,"paste",function(p){$e(r,p)||ju(p,r)||(r.state.pasteIncoming=+new Date,i.fastPoll())});function u(p){if(!$e(r,p)){if(r.somethingSelected())to({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var g=Xu(r);to({lineWise:!0,text:g.text}),p.type=="cut"?r.setSelections(g.ranges,null,vt):(i.prevInput="",n.value=g.text.join(` -`),A(n))}else return;p.type=="cut"&&(r.state.cutIncoming=+new Date)}}ue(n,"cut",u),ue(n,"copy",u),ue(e.scroller,"paste",function(p){if(!(nr(e,p)||$e(r,p))){if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var g=new Event("paste");g.clipboardData=p.clipboardData,n.dispatchEvent(g)}}),ue(e.lineSpace,"selectstart",function(p){nr(e,p)||bt(p)}),ue(n,"compositionstart",function(){var p=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:p,range:r.markText(p,r.getCursor("to"),{className:"CodeMirror-composing"})}}),ue(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},We.prototype.createField=function(e){this.wrapper=Ku(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;el(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},We.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},We.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=Hs(e);if(e.options.moveInputWithCursor){var n=Rt(e,i.sel.primary().head,"div"),u=t.wrapper.getBoundingClientRect(),p=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+p.top-u.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+p.left-u.left))}return r},We.prototype.showSelection=function(e){var t=this.cm,i=t.display;Y(i.cursorDiv,e.cursors),Y(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},We.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i,t.state.focused&&A(this.textarea),c&&d>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",c&&d>=9&&(this.hasSelection=null));this.resetting=!1}},We.prototype.getField=function(){return this.textarea},We.prototype.supportsTouch=function(){return!1},We.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!z||de(Ce(this.textarea))!=this.textarea))try{this.textarea.focus()}catch{}},We.prototype.blur=function(){this.textarea.blur()},We.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},We.prototype.receivedFocus=function(){this.slowPoll()},We.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},We.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function i(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,i)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,i)},We.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||Xc(i)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var n=i.value;if(n==r&&!t.somethingSelected())return!1;if(c&&d>=9&&this.hasSelection===n||O&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var u=n.charCodeAt(0);if(u==8203&&!r&&(r="\u200B"),u==8666)return this.reset(),this.cm.execCommand("undo")}for(var p=0,g=Math.min(r.length,n.length);p1e3||n.indexOf(` -`)>-1?i.value=e.prevInput="":e.prevInput=n,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},We.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},We.prototype.onKeyPress=function(){c&&d>=9&&(this.hasSelection=null),this.fastPoll()},We.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var u=Nr(i,e),p=r.scroller.scrollTop;if(!u||k)return;var g=i.options.resetSelectionOnContextMenu;g&&i.doc.sel.contains(u)==-1&&tt(i,lt)(i.doc,yr(u),vt);var m=n.style.cssText,b=t.wrapper.style.cssText,C=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",n.style.cssText=`position: absolute; width: 30px; height: 30px; +`)&&(P=R=Y(P.line,0)));var Z={from:P,to:R,text:b?b[_%b.length]:m,origin:n||(g?"paste":e.state.cutIncoming>p?"cut":"+input")};fi(e.doc,Z),et(e,"inputRead",e,Z)}t&&!g&&Xu(e,t),ai(e),e.curOp.updateInput<2&&(e.curOp.updateInput=E),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Gu(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&St(t,function(){return $a(t,i,0,null,"paste")}),!0}function Xu(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var i=e.doc.sel,r=i.ranges.length-1;r>=0;r--){var n=i.ranges[r];if(!(n.head.ch>100||r&&i.ranges[r-1].head.line==n.head.line)){var u=e.getModeAt(n.head),p=!1;if(u.electricChars){for(var g=0;g-1){p=sn(e,n.head.line,"smart");break}}else u.electricInput&&u.electricInput.test(ae(e.doc,n.head.line).text.slice(0,n.head.ch))&&(p=sn(e,n.head.line,"smart"));p&&et(e,"electricInput",e,n.head.line)}}}function Ku(e){for(var t=[],i=[],r=0;ru&&(sn(this,g.head.line,r,!0),u=g.head.line,p==this.doc.sel.primIndex&&ai(this));else{var m=g.from(),b=g.to(),C=Math.max(u,m.line);u=Math.min(this.lastLine(),b.line-(b.ch?0:1))+1;for(var E=C;E0&&Ga(this.doc,p,new Ae(m,_[p].to()),vt)}}}),getTokenAt:function(r,n){return ns(this,r,n)},getLineTokens:function(r,n){return ns(this,Y(r),n,!0)},getTokenTypeAt:function(r){r=ve(this.doc,r);var n=ts(this,ae(this.doc,r.line)),u=0,p=(n.length-1)/2,g=r.ch,m;if(g==0)m=n[2];else for(;;){var b=u+p>>1;if((b?n[b*2-1]:0)>=g)p=b;else if(n[b*2+1]m&&(r=m,p=!0),g=ae(this.doc,r)}else g=r;return On(this,g,{top:0,left:0},n||"page",u||p).top+(p?this.doc.height-ir(g):0)},defaultTextHeight:function(){return ii(this.display)},defaultCharWidth:function(){return ni(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,u,p,g){var m=this.display;r=Rt(this,ve(this.doc,r));var b=r.bottom,C=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),m.sizer.appendChild(n),p=="over")b=r.top;else if(p=="above"||p=="near"){var E=Math.max(m.wrapper.clientHeight,this.doc.height),_=Math.max(m.sizer.clientWidth,m.lineSpace.clientWidth);(p=="above"||r.bottom+n.offsetHeight>E)&&r.top>n.offsetHeight?b=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=E&&(b=r.bottom),C+n.offsetWidth>_&&(C=_-n.offsetWidth)}n.style.top=b+"px",n.style.left=n.style.right="",g=="right"?(C=m.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(g=="left"?C=0:g=="middle"&&(C=(m.sizer.clientWidth-n.offsetWidth)/2),n.style.left=C+"px"),u&&Rd(this,{left:C,top:b,right:C+n.offsetWidth,bottom:b+n.offsetHeight})},triggerOnKeyDown:ht(Ou),triggerOnKeyPress:ht(Hu),triggerOnKeyUp:Iu,triggerOnMouseDown:ht(Pu),execCommand:function(r){if(nn.hasOwnProperty(r))return nn[r].call(null,this)},triggerElectric:ht(function(r){Xu(this,r)}),findPosH:function(r,n,u,p){var g=1;n<0&&(g=-1,n=-n);for(var m=ve(this.doc,r),b=0;b0&&C(u.charAt(p-1));)--p;for(;g.5||this.options.lineWrapping)&&Fa(this),je(this,"refresh",this)}),swapDoc:ht(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),ru(this,r),qi(this),this.display.input.reset(),Wi(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,et(this,"swapDoc",this,n),n}),phrase:function(r){var n=this.options.phrases;return n&&Object.prototype.hasOwnProperty.call(n,r)?n[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Jr(e),e.registerHelper=function(r,n,u){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=u},e.registerGlobalHelper=function(r,n,u,p){e.registerHelper(r,n,p),i[r]._global.push({pred:u,val:p})}}function tl(e,t,i,r,n){var u=t,p=i,g=ae(e,t.line),m=n&&e.direction=="rtl"?-i:i;function b(){var te=t.line+m;return te=e.first+e.size?!1:(t=new Y(te,t.ch,t.sticky),g=ae(e,te))}function C(te){var V;if(r=="codepoint"){var ie=g.text.charCodeAt(t.ch+(i>0?0:-1));if(isNaN(ie))V=null;else{var se=i>0?ie>=55296&&ie<56320:ie>=56320&&ie<57343;V=new Y(t.line,Math.max(0,Math.min(g.text.length,t.ch+i*(se?2:1))),-i)}}else n?V=Sh(e.cm,g,t,i):V=Ka(g,t,i);if(V==null)if(!te&&b())t=Ya(n,e.cm,g,t.line,m);else return!1;else t=V;return!0}if(r=="char"||r=="codepoint")C();else if(r=="column")C(!0);else if(r=="word"||r=="group")for(var E=null,_=r=="group",M=e.cm&&e.cm.getHelper(t,"wordChars"),P=!0;!(i<0&&!C(!P));P=!1){var R=g.text.charAt(t.ch)||` +`,Z=kn(R,M)?"w":_&&R==` +`?"n":!_||/\s/.test(R)?null:"p";if(_&&!P&&!Z&&(Z="s"),E&&E!=Z){i<0&&(i=1,C(),t.sticky="after");break}if(Z&&(E=Z),i>0&&!C(!P))break}var J=Zn(e,t,u,p,!0);return ua(u,J)&&(J.hitSide=!0),J}function Zu(e,t,i,r){var n=e.doc,u=t.left,p;if(r=="page"){var g=Math.min(e.display.wrapper.clientHeight,ye(e).innerHeight||n(e).documentElement.clientHeight),m=Math.max(g-.5*ii(e.display),3);p=(i>0?t.bottom:t.top)+i*m}else r=="line"&&(p=i>0?t.bottom+3:t.top-3);for(var b;b=ka(e,u,p),!!b.outside;){if(i<0?p<=0:p>=n.height){b.hitSide=!0;break}p+=i*5}return b}var Te=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new dt,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Te.prototype.init=function(e){var t=this,i=this,r=i.cm,n=i.div=e.lineDiv;n.contentEditable=!0,el(n,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function u(g){for(var m=g.target;m;m=m.parentNode){if(m==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(m.className))break}return!1}ue(n,"paste",function(g){!u(g)||$e(r,g)||Gu(g,r)||d<=11&&setTimeout(tt(r,function(){return t.updateFromDOM()}),20)}),ue(n,"compositionstart",function(g){t.composing={data:g.data,done:!1}}),ue(n,"compositionupdate",function(g){t.composing||(t.composing={data:g.data,done:!1})}),ue(n,"compositionend",function(g){t.composing&&(g.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ue(n,"touchstart",function(){return i.forceCompositionEnd()}),ue(n,"input",function(){t.composing||t.readFromDOMSoon()});function p(g){if(!(!u(g)||$e(r,g))){if(r.somethingSelected())to({lineWise:!1,text:r.getSelections()}),g.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var m=Ku(r);to({lineWise:!0,text:m.text}),g.type=="cut"&&r.operation(function(){r.setSelections(m.ranges,0,vt),r.replaceSelection("",null,"cut")})}else return;if(g.clipboardData){g.clipboardData.clearData();var b=Ut.text.join(` +`);if(g.clipboardData.setData("Text",b),g.clipboardData.getData("Text")==b){g.preventDefault();return}}var C=Yu(),E=C.firstChild;el(E),r.display.lineSpace.insertBefore(C,r.display.lineSpace.firstChild),E.value=Ut.text.join(` +`);var _=he(Ce(n));A(E),setTimeout(function(){r.display.lineSpace.removeChild(C),_.focus(),_==n&&i.showPrimarySelection()},50)}}ue(n,"copy",p),ue(n,"cut",p)},Te.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Te.prototype.prepareSelection=function(){var e=Ps(this.cm,!1);return e.focus=he(Ce(this.div))==this.div,e},Te.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Te.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Te.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),r=i.from(),n=i.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||n.line=t.display.viewFrom&&Qu(t,r)||{node:g[0].measure.map[2],offset:0},b=n.linee.firstLine()&&(r=Y(r.line-1,ae(e.doc,r.line-1).length)),n.ch==ae(e.doc,n.line).text.length&&n.linet.viewTo-1)return!1;var u,p,g;r.line==t.viewFrom||(u=Or(e,r.line))==0?(p=Fe(t.view[0].line),g=t.view[0].node):(p=Fe(t.view[u].line),g=t.view[u-1].node.nextSibling);var m=Or(e,n.line),b,C;if(m==t.view.length-1?(b=t.viewTo-1,C=t.lineDiv.lastChild):(b=Fe(t.view[m+1].line)-1,C=t.view[m+1].node.previousSibling),!g)return!1;for(var E=e.doc.splitLines(Xh(e,g,C,p,b)),_=Mr(e.doc,Y(p,0),Y(b,ae(e.doc,b).text.length));E.length>1&&_.length>1;)if(De(E)==De(_))E.pop(),_.pop(),b--;else if(E[0]==_[0])E.shift(),_.shift(),p++;else break;for(var M=0,P=0,R=E[0],Z=_[0],J=Math.min(R.length,Z.length);Mr.ch&&te.charCodeAt(te.length-P-1)==V.charCodeAt(V.length-P-1);)M--,P++;E[E.length-1]=te.slice(0,te.length-P).replace(/^\u200b+/,""),E[0]=E[0].slice(M).replace(/\u200b+$/,"");var se=Y(p,M),le=Y(b,_.length?De(_).length-P:0);if(E.length>1||E[0]||me(se,le))return ci(e.doc,E,se,le,"+input"),!0},Te.prototype.ensurePolled=function(){this.forceCompositionEnd()},Te.prototype.reset=function(){this.forceCompositionEnd()},Te.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Te.prototype.readFromDOMSoon=function(){var e=this;this.readDOMTimeout==null&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80))},Te.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&St(this.cm,function(){return yt(e.cm)})},Te.prototype.setUneditable=function(e){e.contentEditable="false"},Te.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||tt(this.cm,$a)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},Te.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Te.prototype.onContextMenu=function(){},Te.prototype.resetPosition=function(){},Te.prototype.needsContentAttribute=!0;function Qu(e,t){var i=wa(e,t.line);if(!i||i.hidden)return null;var r=ae(e.doc,t.line),n=Ss(i,r,t.line),u=tr(r,e.doc.direction),p="left";if(u){var g=Bi(u,t.ch);p=g%2?"right":"left"}var m=Fs(n.map,t.ch,p);return m.offset=m.collapse=="right"?m.end:m.start,m}function Gh(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function mi(e,t){return t&&(e.bad=!0),e}function Xh(e,t,i,r,n){var u="",p=!1,g=e.doc.lineSeparator(),m=!1;function b(M){return function(P){return P.id==M}}function C(){p&&(u+=g,m&&(u+=g),p=m=!1)}function E(M){M&&(C(),u+=M)}function _(M){if(M.nodeType==1){var P=M.getAttribute("cm-text");if(P){E(P);return}var R=M.getAttribute("cm-marker"),Z;if(R){var J=e.findMarks(Y(r,0),Y(n+1,0),b(+R));J.length&&(Z=J[0].find(0))&&E(Mr(e.doc,Z.from,Z.to).join(g));return}if(M.getAttribute("contenteditable")=="false")return;var te=/^(pre|div|p|li|table|br)$/i.test(M.nodeName);if(!/^br$/i.test(M.nodeName)&&M.textContent.length==0)return;te&&C();for(var V=0;V=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),ue(n,"paste",function(p){$e(r,p)||Gu(p,r)||(r.state.pasteIncoming=+new Date,i.fastPoll())});function u(p){if(!$e(r,p)){if(r.somethingSelected())to({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var g=Ku(r);to({lineWise:!0,text:g.text}),p.type=="cut"?r.setSelections(g.ranges,null,vt):(i.prevInput="",n.value=g.text.join(` +`),A(n))}else return;p.type=="cut"&&(r.state.cutIncoming=+new Date)}}ue(n,"cut",u),ue(n,"copy",u),ue(e.scroller,"paste",function(p){if(!(nr(e,p)||$e(r,p))){if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var g=new Event("paste");g.clipboardData=p.clipboardData,n.dispatchEvent(g)}}),ue(e.lineSpace,"selectstart",function(p){nr(e,p)||bt(p)}),ue(n,"compositionstart",function(){var p=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:p,range:r.markText(p,r.getCursor("to"),{className:"CodeMirror-composing"})}}),ue(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},We.prototype.createField=function(e){this.wrapper=Yu(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;el(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},We.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},We.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=Ps(e);if(e.options.moveInputWithCursor){var n=Rt(e,i.sel.primary().head,"div"),u=t.wrapper.getBoundingClientRect(),p=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+p.top-u.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+p.left-u.left))}return r},We.prototype.showSelection=function(e){var t=this.cm,i=t.display;G(i.cursorDiv,e.cursors),G(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},We.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i,t.state.focused&&A(this.textarea),c&&d>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",c&&d>=9&&(this.hasSelection=null));this.resetting=!1}},We.prototype.getField=function(){return this.textarea},We.prototype.supportsTouch=function(){return!1},We.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!z||he(Ce(this.textarea))!=this.textarea))try{this.textarea.focus()}catch{}},We.prototype.blur=function(){this.textarea.blur()},We.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},We.prototype.receivedFocus=function(){this.slowPoll()},We.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},We.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function i(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,i)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,i)},We.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||Xc(i)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var n=i.value;if(n==r&&!t.somethingSelected())return!1;if(c&&d>=9&&this.hasSelection===n||O&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var u=n.charCodeAt(0);if(u==8203&&!r&&(r="\u200B"),u==8666)return this.reset(),this.cm.execCommand("undo")}for(var p=0,g=Math.min(r.length,n.length);p1e3||n.indexOf(` +`)>-1?i.value=e.prevInput="":e.prevInput=n,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},We.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},We.prototype.onKeyPress=function(){c&&d>=9&&(this.hasSelection=null),this.fastPoll()},We.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var u=Nr(i,e),p=r.scroller.scrollTop;if(!u||S)return;var g=i.options.resetSelectionOnContextMenu;g&&i.doc.sel.contains(u)==-1&&tt(i,st)(i.doc,yr(u),vt);var m=n.style.cssText,b=t.wrapper.style.cssText,C=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",n.style.cssText=`position: absolute; width: 30px; height: 30px; top: `+(e.clientY-C.top-5)+"px; left: "+(e.clientX-C.left-5)+`px; z-index: 1000; background: `+(c?"rgba(255, 255, 255, .05)":"transparent")+`; - outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var S;v&&(S=n.ownerDocument.defaultView.scrollY),r.input.focus(),v&&n.ownerDocument.defaultView.scrollTo(null,S),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=M,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function _(){if(n.selectionStart!=null){var U=i.somethingSelected(),Z="\u200B"+(U?n.value:"");n.value="\u21DA",n.value=Z,t.prevInput=U?"":"\u200B",n.selectionStart=1,n.selectionEnd=Z.length,r.selForContextMenu=i.doc.sel}}function M(){if(t.contextMenuPending==M&&(t.contextMenuPending=!1,t.wrapper.style.cssText=b,n.style.cssText=m,c&&d<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=p),n.selectionStart!=null)){(!c||c&&d<9)&&_();var U=0,Z=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?tt(i,pu)(i):U++<10?r.detectingSelectAll=setTimeout(Z,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Z,200)}}if(c&&d>=9&&_(),he){_i(e);var P=function(){Mt(window,"mouseup",P),setTimeout(M,20)};ue(window,"mouseup",P)}else setTimeout(M,50)},We.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},We.prototype.setUneditable=function(){},We.prototype.needsContentAttribute=!1;function Yh(e,t){if(t=t?Lt(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var i=de(Ce(e));t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=g.getValue()}var n;if(e.form&&(ue(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var u=e.form;n=u.submit;try{var p=u.submit=function(){r(),u.submit=n,u.submit(),u.submit=p}}catch{}}t.finishInit=function(m){m.save=r,m.getTextArea=function(){return e},m.toTextArea=function(){m.toTextArea=isNaN,r(),e.parentNode.removeChild(m.getWrapperElement()),e.style.display="",e.form&&(Mt(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var g=Ne(function(m){return e.parentNode.insertBefore(m,e.nextSibling)},t);return g}function Zh(e){e.off=Mt,e.on=ue,e.wheelEventPixels=rh,e.Doc=xt,e.splitLines=ra,e.countColumn=Ye,e.findColumn=Kt,e.isWordChar=Zo,e.Pass=Ze,e.signal=je,e.Line=ei,e.changeEnd=xr,e.scrollbarModel=js,e.Pos=K,e.cmpPos=me,e.modes=na,e.mimeModes=Vr,e.resolveMode=Sn,e.getMode=oa,e.modeExtensions=$r,e.extendMode=Jc,e.copyState=Lr,e.startState=Ql,e.innerMode=aa,e.commands=nn,e.keyMap=ar,e.keyName=Lu,e.isModifierKey=Fu,e.lookupKey=hi,e.normalizeKeyMap=kh,e.StringStream=Ge,e.SharedTextMarker=en,e.TextMarker=Cr,e.LineWidget=$i,e.e_preventDefault=bt,e.e_stopPropagation=Yl,e.e_stop=_i,e.addClass=be,e.contains=Q,e.rmClass=oe,e.keyNames=Dr}qh(Ne),jh(Ne);var Qh="iter insert remove copy getEditor constructor".split(" ");for(var io in xt.prototype)xt.prototype.hasOwnProperty(io)&&ze(Qh,io)<0&&(Ne.prototype[io]=function(e){return function(){return e.apply(this.doc,arguments)}}(xt.prototype[io]));return Jr(xt),Ne.inputStyles={textarea:We,contenteditable:Te},Ne.defineMode=function(e){!Ne.defaults.mode&&e!="null"&&(Ne.defaults.mode=e),Zc.apply(this,arguments)},Ne.defineMIME=Qc,Ne.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Ne.defineMIME("text/plain","null"),Ne.defineExtension=function(e,t){Ne.prototype[e]=t},Ne.defineDocExtension=function(e,t){xt.prototype[e]=t},Ne.fromTextArea=Yh,Zh(Ne),Ne.version="5.65.21",Ne})});var $u=at((Ju,Vu)=>{(function(o){typeof Ju=="object"&&typeof Vu=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,s=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,a=/[*+-]\s/;o.commands.newlineAndIndentContinueMarkdownList=function(h){if(h.getOption("disableInput"))return o.Pass;for(var c=h.listSelections(),d=[],v=0;v\s*$/.test(B),z=!/>\s*$/.test(B);(N||z)&&h.replaceRange("",{line:y.line,ch:0},{line:y.line,ch:y.ch+1}),d[v]=` -`}else{var O=L[1],I=L[5],R=!(a.test(L[2])||L[2].indexOf(">")>=0),G=R?parseInt(L[3],10)+1+L[4]:L[2].replace("x"," ");d[v]=` -`+O+G+I,R&&f(h,y)}}h.replaceSelections(d)};function f(h,c){var d=c.line,v=0,y=0,x=l.exec(h.getLine(d)),D=x[1];do{v+=1;var k=d+v,F=h.getLine(k),B=l.exec(F);if(B){var L=B[1],T=parseInt(x[3],10)+v-y,N=parseInt(B[3],10),z=N;if(D===L&&!isNaN(N))T===N&&(z=N+1),T>N&&(z=T+1),h.replaceRange(F.replace(l,L+z+B[4]+B[5]),{line:k,ch:0},{line:k,ch:F.length});else{if(D.length>L.length||D.length{var ef=At();ef.commands.tabAndIndentMarkdownList=function(o){var l=o.listSelections(),s=l[0].head,a=o.getStateAfter(s.line),f=a.list!==!1;if(f){o.execCommand("indentMore");return}if(o.options.indentWithTabs)o.execCommand("insertTab");else{var h=Array(o.options.tabSize+1).join(" ");o.replaceSelection(h)}};ef.commands.shiftTabAndUnindentMarkdownList=function(o){var l=o.listSelections(),s=l[0].head,a=o.getStateAfter(s.line),f=a.list!==!1;if(f){o.execCommand("indentLess");return}if(o.options.indentWithTabs)o.execCommand("insertTab");else{var h=Array(o.options.tabSize+1).join(" ");o.replaceSelection(h)}}});var of=at((rf,nf)=>{(function(o){typeof rf=="object"&&typeof nf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("fullScreen",!1,function(a,f,h){h==o.Init&&(h=!1),!h!=!f&&(f?l(a):s(a))});function l(a){var f=a.getWrapperElement();a.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:f.style.width,height:f.style.height},f.style.width="",f.style.height="auto",f.className+=" CodeMirror-fullscreen",document.documentElement.style.overflow="hidden",a.refresh()}function s(a){var f=a.getWrapperElement();f.className=f.className.replace(/\s*CodeMirror-fullscreen\b/,""),document.documentElement.style.overflow="";var h=a.state.fullScreenRestore;f.style.width=h.width,f.style.height=h.height,window.scrollTo(h.scrollLeft,h.scrollTop),a.refresh()}})});var al=at((af,lf)=>{(function(o){typeof af=="object"&&typeof lf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},s={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};o.defineMode("xml",function(a,f){var h=a.indentUnit,c={},d=f.htmlMode?l:s;for(var v in d)c[v]=d[v];for(var v in f)c[v]=f[v];var y,x;function D(E,q){function W(be){return q.tokenize=be,be(E,q)}var Q=E.next();if(Q=="<")return E.eat("!")?E.eat("[")?E.match("CDATA[")?W(B("atom","]]>")):null:E.match("--")?W(B("comment","-->")):E.match("DOCTYPE",!0,!0)?(E.eatWhile(/[\w\._\-]/),W(L(1))):null:E.eat("?")?(E.eatWhile(/[\w\._\-]/),q.tokenize=B("meta","?>"),"meta"):(y=E.eat("/")?"closeTag":"openTag",q.tokenize=k,"tag bracket");if(Q=="&"){var de;return E.eat("#")?E.eat("x")?de=E.eatWhile(/[a-fA-F\d]/)&&E.eat(";"):de=E.eatWhile(/[\d]/)&&E.eat(";"):de=E.eatWhile(/[\w\.\-:]/)&&E.eat(";"),de?"atom":"error"}else return E.eatWhile(/[^&<]/),null}D.isInText=!0;function k(E,q){var W=E.next();if(W==">"||W=="/"&&E.eat(">"))return q.tokenize=D,y=W==">"?"endTag":"selfcloseTag","tag bracket";if(W=="=")return y="equals",null;if(W=="<"){q.tokenize=D,q.state=I,q.tagName=q.tagStart=null;var Q=q.tokenize(E,q);return Q?Q+" tag error":"tag error"}else return/[\'\"]/.test(W)?(q.tokenize=F(W),q.stringStartCol=E.column(),q.tokenize(E,q)):(E.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function F(E){var q=function(W,Q){for(;!W.eol();)if(W.next()==E){Q.tokenize=k;break}return"string"};return q.isInAttribute=!0,q}function B(E,q){return function(W,Q){for(;!W.eol();){if(W.match(q)){Q.tokenize=D;break}W.next()}return E}}function L(E){return function(q,W){for(var Q;(Q=q.next())!=null;){if(Q=="<")return W.tokenize=L(E+1),W.tokenize(q,W);if(Q==">")if(E==1){W.tokenize=D;break}else return W.tokenize=L(E-1),W.tokenize(q,W)}return"meta"}}function T(E){return E&&E.toLowerCase()}function N(E,q,W){this.prev=E.context,this.tagName=q||"",this.indent=E.indented,this.startOfLine=W,(c.doNotIndent.hasOwnProperty(q)||E.context&&E.context.noIndent)&&(this.noIndent=!0)}function z(E){E.context&&(E.context=E.context.prev)}function O(E,q){for(var W;;){if(!E.context||(W=E.context.tagName,!c.contextGrabbers.hasOwnProperty(T(W))||!c.contextGrabbers[T(W)].hasOwnProperty(T(q))))return;z(E)}}function I(E,q,W){return E=="openTag"?(W.tagStart=q.column(),R):E=="closeTag"?G:I}function R(E,q,W){return E=="word"?(W.tagName=q.current(),x="tag",j):c.allowMissingTagName&&E=="endTag"?(x="tag bracket",j(E,q,W)):(x="error",R)}function G(E,q,W){if(E=="word"){var Q=q.current();return W.context&&W.context.tagName!=Q&&c.implicitlyClosed.hasOwnProperty(T(W.context.tagName))&&z(W),W.context&&W.context.tagName==Q||c.matchClosing===!1?(x="tag",X):(x="tag error",he)}else return c.allowMissingTagName&&E=="endTag"?(x="tag bracket",X(E,q,W)):(x="error",he)}function X(E,q,W){return E!="endTag"?(x="error",X):(z(W),I)}function he(E,q,W){return x="error",X(E,q,W)}function j(E,q,W){if(E=="word")return x="attribute",oe;if(E=="endTag"||E=="selfcloseTag"){var Q=W.tagName,de=W.tagStart;return W.tagName=W.tagStart=null,E=="selfcloseTag"||c.autoSelfClosers.hasOwnProperty(T(Q))?O(W,Q):(O(W,Q),W.context=new N(W,Q,de==W.indented)),I}return x="error",j}function oe(E,q,W){return E=="equals"?H:(c.allowMissing||(x="error"),j(E,q,W))}function H(E,q,W){return E=="string"?Y:E=="word"&&c.allowUnquoted?(x="string",j):(x="error",j(E,q,W))}function Y(E,q,W){return E=="string"?Y:j(E,q,W)}return{startState:function(E){var q={tokenize:D,state:I,indented:E||0,tagName:null,tagStart:null,context:null};return E!=null&&(q.baseIndent=E),q},token:function(E,q){if(!q.tagName&&E.sol()&&(q.indented=E.indentation()),E.eatSpace())return null;y=null;var W=q.tokenize(E,q);return(W||y)&&W!="comment"&&(x=null,q.state=q.state(y||W,E,q),x&&(W=x=="error"?W+" error":x)),W},indent:function(E,q,W){var Q=E.context;if(E.tokenize.isInAttribute)return E.tagStart==E.indented?E.stringStartCol+1:E.indented+h;if(Q&&Q.noIndent)return o.Pass;if(E.tokenize!=k&&E.tokenize!=D)return W?W.match(/^(\s*)/)[0].length:0;if(E.tagName)return c.multilineTagIndentPastTag!==!1?E.tagStart+E.tagName.length+2:E.tagStart+h*(c.multilineTagIndentFactor||1);if(c.alignCDATA&&/$/,blockCommentStart:"",configuration:c.htmlMode?"html":"xml",helperType:c.htmlMode?"html":"xml",skipAttribute:function(E){E.state==H&&(E.state=j)},xmlCurrentTag:function(E){return E.tagName?{name:E.tagName,close:E.type=="closeTag"}:null},xmlCurrentContext:function(E){for(var q=[],W=E.context;W;W=W.prev)q.push(W.tagName);return q.reverse()}}}),o.defineMIME("text/xml","xml"),o.defineMIME("application/xml","xml"),o.mimeModes.hasOwnProperty("text/html")||o.defineMIME("text/html",{name:"xml",htmlMode:!0})})});var ff=at((sf,uf)=>{(function(o){typeof sf=="object"&&typeof uf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy","cbl"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded JavaScript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"],alias:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var l=0;l-1&&a.substring(c+1,a.length);if(d)return o.findModeByExtension(d)},o.findModeByName=function(a){a=a.toLowerCase();for(var f=0;f{(function(o){typeof cf=="object"&&typeof df=="object"?o(At(),al(),ff()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../xml/xml","../meta"],o):o(CodeMirror)})(function(o){"use strict";o.defineMode("markdown",function(l,s){var a=o.getMode(l,"text/html"),f=a.name=="null";function h(A){if(o.findModeByName){var w=o.findModeByName(A);w&&(A=w.mime||w.mimes[0])}var te=o.getMode(l,A);return te.name=="null"?null:te}s.highlightFormatting===void 0&&(s.highlightFormatting=!1),s.maxBlockquoteDepth===void 0&&(s.maxBlockquoteDepth=0),s.taskLists===void 0&&(s.taskLists=!1),s.strikethrough===void 0&&(s.strikethrough=!1),s.emoji===void 0&&(s.emoji=!1),s.fencedCodeBlockHighlighting===void 0&&(s.fencedCodeBlockHighlighting=!0),s.fencedCodeBlockDefaultMode===void 0&&(s.fencedCodeBlockDefaultMode="text/plain"),s.xml===void 0&&(s.xml=!0),s.tokenTypeOverrides===void 0&&(s.tokenTypeOverrides={});var c={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var d in c)c.hasOwnProperty(d)&&s.tokenTypeOverrides[d]&&(c[d]=s.tokenTypeOverrides[d]);var v=/^([*\-_])(?:\s*\1){2,}\s*$/,y=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,x=/^\[(x| )\](?=\s)/i,D=s.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,k=/^ {0,3}(?:\={1,}|-{2,})\s*$/,F=/^[^#!\[\]*_\\<>` "'(~:]+/,B=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,L=/^\s*\[[^\]]+?\]:.*$/,T=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,N=" ";function z(A,w,te){return w.f=w.inline=te,te(A,w)}function O(A,w,te){return w.f=w.block=te,te(A,w)}function I(A){return!A||!/\S/.test(A.string)}function R(A){if(A.linkTitle=!1,A.linkHref=!1,A.linkText=!1,A.em=!1,A.strong=!1,A.strikethrough=!1,A.quote=0,A.indentedCode=!1,A.f==X){var w=f;if(!w){var te=o.innerMode(a,A.htmlState);w=te.mode.name=="xml"&&te.state.tagStart===null&&!te.state.context&&te.state.tokenize.isInText}w&&(A.f=H,A.block=G,A.htmlState=null)}return A.trailingSpace=0,A.trailingSpaceNewLine=!1,A.prevLine=A.thisLine,A.thisLine={stream:null},null}function G(A,w){var te=A.column()===w.indentation,Ce=I(w.prevLine.stream),ye=w.indentedCode,mt=w.prevLine.hr,Lt=w.list!==!1,Ye=(w.listStack[w.listStack.length-1]||0)+3;w.indentedCode=!1;var ct=w.indentation;if(w.indentationDiff===null&&(w.indentationDiff=w.indentation,Lt)){for(w.list=null;ct=4&&(ye||w.prevLine.fencedCodeEnd||w.prevLine.header||Ce))return A.skipToEnd(),w.indentedCode=!0,c.code;if(A.eatSpace())return null;if(te&&w.indentation<=Ye&&(Ze=A.match(D))&&Ze[1].length<=6)return w.quote=0,w.header=Ze[1].length,w.thisLine.header=!0,s.highlightFormatting&&(w.formatting="header"),w.f=w.inline,j(w);if(w.indentation<=Ye&&A.eat(">"))return w.quote=te?1:w.quote+1,s.highlightFormatting&&(w.formatting="quote"),A.eatSpace(),j(w);if(!Pe&&!w.setext&&te&&w.indentation<=Ye&&(Ze=A.match(y))){var vt=Ze[1]?"ol":"ul";return w.indentation=ct+A.current().length,w.list=!0,w.quote=0,w.listStack.push(w.indentation),w.em=!1,w.strong=!1,w.code=!1,w.strikethrough=!1,s.taskLists&&A.match(x,!1)&&(w.taskList=!0),w.f=w.inline,s.highlightFormatting&&(w.formatting=["list","list-"+vt]),j(w)}else{if(te&&w.indentation<=Ye&&(Ze=A.match(B,!0)))return w.quote=0,w.fencedEndRE=new RegExp(Ze[1]+"+ *$"),w.localMode=s.fencedCodeBlockHighlighting&&h(Ze[2]||s.fencedCodeBlockDefaultMode),w.localMode&&(w.localState=o.startState(w.localMode)),w.f=w.block=he,s.highlightFormatting&&(w.formatting="code-block"),w.code=-1,j(w);if(w.setext||(!ze||!Lt)&&!w.quote&&w.list===!1&&!w.code&&!Pe&&!L.test(A.string)&&(Ze=A.lookAhead(1))&&(Ze=Ze.match(k)))return w.setext?(w.header=w.setext,w.setext=0,A.skipToEnd(),s.highlightFormatting&&(w.formatting="header")):(w.header=Ze[0].charAt(0)=="="?1:2,w.setext=w.header),w.thisLine.header=!0,w.f=w.inline,j(w);if(Pe)return A.skipToEnd(),w.hr=!0,w.thisLine.hr=!0,c.hr;if(A.peek()==="[")return z(A,w,Q)}return z(A,w,w.inline)}function X(A,w){var te=a.token(A,w.htmlState);if(!f){var Ce=o.innerMode(a,w.htmlState);(Ce.mode.name=="xml"&&Ce.state.tagStart===null&&!Ce.state.context&&Ce.state.tokenize.isInText||w.md_inside&&A.current().indexOf(">")>-1)&&(w.f=H,w.block=G,w.htmlState=null)}return te}function he(A,w){var te=w.listStack[w.listStack.length-1]||0,Ce=w.indentation=A.quote?w.push(c.formatting+"-"+A.formatting[te]+"-"+A.quote):w.push("error"))}if(A.taskOpen)return w.push("meta"),w.length?w.join(" "):null;if(A.taskClosed)return w.push("property"),w.length?w.join(" "):null;if(A.linkHref?w.push(c.linkHref,"url"):(A.strong&&w.push(c.strong),A.em&&w.push(c.em),A.strikethrough&&w.push(c.strikethrough),A.emoji&&w.push(c.emoji),A.linkText&&w.push(c.linkText),A.code&&w.push(c.code),A.image&&w.push(c.image),A.imageAltText&&w.push(c.imageAltText,"link"),A.imageMarker&&w.push(c.imageMarker)),A.header&&w.push(c.header,c.header+"-"+A.header),A.quote&&(w.push(c.quote),!s.maxBlockquoteDepth||s.maxBlockquoteDepth>=A.quote?w.push(c.quote+"-"+A.quote):w.push(c.quote+"-"+s.maxBlockquoteDepth)),A.list!==!1){var Ce=(A.listStack.length-1)%3;Ce?Ce===1?w.push(c.list2):w.push(c.list3):w.push(c.list1)}return A.trailingSpaceNewLine?w.push("trailing-space-new-line"):A.trailingSpace&&w.push("trailing-space-"+(A.trailingSpace%2?"a":"b")),w.length?w.join(" "):null}function oe(A,w){if(A.match(F,!0))return j(w)}function H(A,w){var te=w.text(A,w);if(typeof te<"u")return te;if(w.list)return w.list=null,j(w);if(w.taskList){var Ce=A.match(x,!0)[1]===" ";return Ce?w.taskOpen=!0:w.taskClosed=!0,s.highlightFormatting&&(w.formatting="task"),w.taskList=!1,j(w)}if(w.taskOpen=!1,w.taskClosed=!1,w.header&&A.match(/^#+$/,!0))return s.highlightFormatting&&(w.formatting="header"),j(w);var ye=A.next();if(w.linkTitle){w.linkTitle=!1;var mt=ye;ye==="("&&(mt=")"),mt=(mt+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Lt="^\\s*(?:[^"+mt+"\\\\]+|\\\\\\\\|\\\\.)"+mt;if(A.match(new RegExp(Lt),!0))return c.linkHref}if(ye==="`"){var Ye=w.formatting;s.highlightFormatting&&(w.formatting="code"),A.eatWhile("`");var ct=A.current().length;if(w.code==0&&(!w.quote||ct==1))return w.code=ct,j(w);if(ct==w.code){var ze=j(w);return w.code=0,ze}else return w.formatting=Ye,j(w)}else if(w.code)return j(w);if(ye==="\\"&&(A.next(),s.highlightFormatting)){var Pe=j(w),Ze=c.formatting+"-escape";return Pe?Pe+" "+Ze:Ze}if(ye==="!"&&A.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return w.imageMarker=!0,w.image=!0,s.highlightFormatting&&(w.formatting="image"),j(w);if(ye==="["&&w.imageMarker&&A.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return w.imageMarker=!1,w.imageAltText=!0,s.highlightFormatting&&(w.formatting="image"),j(w);if(ye==="]"&&w.imageAltText){s.highlightFormatting&&(w.formatting="image");var Pe=j(w);return w.imageAltText=!1,w.image=!1,w.inline=w.f=E,Pe}if(ye==="["&&!w.image)return w.linkText&&A.match(/^.*?\]/)||(w.linkText=!0,s.highlightFormatting&&(w.formatting="link")),j(w);if(ye==="]"&&w.linkText){s.highlightFormatting&&(w.formatting="link");var Pe=j(w);return w.linkText=!1,w.inline=w.f=A.match(/\(.*?\)| ?\[.*?\]/,!1)?E:H,Pe}if(ye==="<"&&A.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){w.f=w.inline=Y,s.highlightFormatting&&(w.formatting="link");var Pe=j(w);return Pe?Pe+=" ":Pe="",Pe+c.linkInline}if(ye==="<"&&A.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){w.f=w.inline=Y,s.highlightFormatting&&(w.formatting="link");var Pe=j(w);return Pe?Pe+=" ":Pe="",Pe+c.linkEmail}if(s.xml&&ye==="<"&&A.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var vt=A.string.indexOf(">",A.pos);if(vt!=-1){var Ti=A.string.substring(A.start,vt);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Ti)&&(w.md_inside=!0)}return A.backUp(1),w.htmlState=o.startState(a),O(A,w,X)}if(s.xml&&ye==="<"&&A.match(/^\/\w*?>/))return w.md_inside=!1,"tag";if(ye==="*"||ye==="_"){for(var Xt=1,Kt=A.pos==1?" ":A.string.charAt(A.pos-2);Xt<3&&A.eat(ye);)Xt++;var Ht=A.peek()||" ",pr=!/\s/.test(Ht)&&(!T.test(Ht)||/\s/.test(Kt)||T.test(Kt)),De=!/\s/.test(Kt)&&(!T.test(Kt)||/\s/.test(Ht)||T.test(Ht)),Pt=null,gr=null;if(Xt%2&&(!w.em&&pr&&(ye==="*"||!De||T.test(Kt))?Pt=!0:w.em==ye&&De&&(ye==="*"||!pr||T.test(Ht))&&(Pt=!1)),Xt>1&&(!w.strong&&pr&&(ye==="*"||!De||T.test(Kt))?gr=!0:w.strong==ye&&De&&(ye==="*"||!pr||T.test(Ht))&&(gr=!1)),gr!=null||Pt!=null){s.highlightFormatting&&(w.formatting=Pt==null?"strong":gr==null?"em":"strong em"),Pt===!0&&(w.em=ye),gr===!0&&(w.strong=ye);var ze=j(w);return Pt===!1&&(w.em=!1),gr===!1&&(w.strong=!1),ze}}else if(ye===" "&&(A.eat("*")||A.eat("_"))){if(A.peek()===" ")return j(w);A.backUp(1)}if(s.strikethrough){if(ye==="~"&&A.eatWhile(ye)){if(w.strikethrough){s.highlightFormatting&&(w.formatting="strikethrough");var ze=j(w);return w.strikethrough=!1,ze}else if(A.match(/^[^\s]/,!1))return w.strikethrough=!0,s.highlightFormatting&&(w.formatting="strikethrough"),j(w)}else if(ye===" "&&A.match("~~",!0)){if(A.peek()===" ")return j(w);A.backUp(2)}}if(s.emoji&&ye===":"&&A.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){w.emoji=!0,s.highlightFormatting&&(w.formatting="emoji");var Dn=j(w);return w.emoji=!1,Dn}return ye===" "&&(A.match(/^ +$/,!1)?w.trailingSpace++:w.trailingSpace&&(w.trailingSpaceNewLine=!0)),j(w)}function Y(A,w){var te=A.next();if(te===">"){w.f=w.inline=H,s.highlightFormatting&&(w.formatting="link");var Ce=j(w);return Ce?Ce+=" ":Ce="",Ce+c.linkInline}return A.match(/^[^>]+/,!0),c.linkInline}function E(A,w){if(A.eatSpace())return null;var te=A.next();return te==="("||te==="["?(w.f=w.inline=W(te==="("?")":"]"),s.highlightFormatting&&(w.formatting="link-string"),w.linkHref=!0,j(w)):"error"}var q={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function W(A){return function(w,te){var Ce=w.next();if(Ce===A){te.f=te.inline=H,s.highlightFormatting&&(te.formatting="link-string");var ye=j(te);return te.linkHref=!1,ye}return w.match(q[A]),te.linkHref=!0,j(te)}}function Q(A,w){return A.match(/^([^\]\\]|\\.)*\]:/,!1)?(w.f=de,A.next(),s.highlightFormatting&&(w.formatting="link"),w.linkText=!0,j(w)):z(A,w,H)}function de(A,w){if(A.match("]:",!0)){w.f=w.inline=be,s.highlightFormatting&&(w.formatting="link");var te=j(w);return w.linkText=!1,te}return A.match(/^([^\]\\]|\\.)+/,!0),c.linkText}function be(A,w){return A.eatSpace()?null:(A.match(/^[^\s]+/,!0),A.peek()===void 0?w.linkTitle=!0:A.match(/^(?:\s+(?:"(?:[^"\\]|\\.)+"|'(?:[^'\\]|\\.)+'|\((?:[^)\\]|\\.)+\)))?/,!0),w.f=w.inline=H,c.linkHref+" url")}var Ae={startState:function(){return{f:G,prevLine:{stream:null},thisLine:{stream:null},block:G,htmlState:null,indentation:0,inline:H,text:oe,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(A){return{f:A.f,prevLine:A.prevLine,thisLine:A.thisLine,block:A.block,htmlState:A.htmlState&&o.copyState(a,A.htmlState),indentation:A.indentation,localMode:A.localMode,localState:A.localMode?o.copyState(A.localMode,A.localState):null,inline:A.inline,text:A.text,formatting:!1,linkText:A.linkText,linkTitle:A.linkTitle,linkHref:A.linkHref,code:A.code,em:A.em,strong:A.strong,strikethrough:A.strikethrough,emoji:A.emoji,header:A.header,setext:A.setext,hr:A.hr,taskList:A.taskList,list:A.list,listStack:A.listStack.slice(0),quote:A.quote,indentedCode:A.indentedCode,trailingSpace:A.trailingSpace,trailingSpaceNewLine:A.trailingSpaceNewLine,md_inside:A.md_inside,fencedEndRE:A.fencedEndRE}},token:function(A,w){if(w.formatting=!1,A!=w.thisLine.stream){if(w.header=0,w.hr=!1,A.match(/^\s*$/,!0))return R(w),null;if(w.prevLine=w.thisLine,w.thisLine={stream:A},w.taskList=!1,w.trailingSpace=0,w.trailingSpaceNewLine=!1,!w.localState&&(w.f=w.block,w.f!=X)){var te=A.match(/^\s*/,!0)[0].replace(/\t/g,N).length;if(w.indentation=te,w.indentationDiff=null,te>0)return null}}return w.f(A,w)},innerMode:function(A){return A.block==X?{state:A.htmlState,mode:a}:A.localState?{state:A.localState,mode:A.localMode}:{state:A,mode:Ae}},indent:function(A,w,te){return A.block==X&&a.indent?a.indent(A.htmlState,w,te):A.localState&&A.localMode.indent?A.localMode.indent(A.localState,w,te):o.Pass},blankLine:R,getType:j,blockCommentStart:"",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return Ae},"xml"),o.defineMIME("text/markdown","markdown"),o.defineMIME("text/x-markdown","markdown")})});var sl=at((hf,pf)=>{(function(o){typeof hf=="object"&&typeof pf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.overlayMode=function(l,s,a){return{startState:function(){return{base:o.startState(l),overlay:o.startState(s),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(f){return{base:o.copyState(l,f.base),overlay:o.copyState(s,f.overlay),basePos:f.basePos,baseCur:null,overlayPos:f.overlayPos,overlayCur:null}},token:function(f,h){return(f!=h.streamSeen||Math.min(h.basePos,h.overlayPos){(function(o){typeof gf=="object"&&typeof mf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){o.defineOption("placeholder","",function(d,v,y){var x=y&&y!=o.Init;if(v&&!x)d.on("blur",f),d.on("change",h),d.on("swapDoc",h),o.on(d.getInputField(),"compositionupdate",d.state.placeholderCompose=function(){a(d)}),h(d);else if(!v&&x){d.off("blur",f),d.off("change",h),d.off("swapDoc",h),o.off(d.getInputField(),"compositionupdate",d.state.placeholderCompose),l(d);var D=d.getWrapperElement();D.className=D.className.replace(" CodeMirror-empty","")}v&&!d.hasFocus()&&f(d)});function l(d){d.state.placeholder&&(d.state.placeholder.parentNode.removeChild(d.state.placeholder),d.state.placeholder=null)}function s(d){l(d);var v=d.state.placeholder=document.createElement("pre");v.style.cssText="height: 0; overflow: visible",v.style.direction=d.getOption("direction"),v.className="CodeMirror-placeholder CodeMirror-line-like";var y=d.getOption("placeholder");typeof y=="string"&&(y=document.createTextNode(y)),v.appendChild(y),d.display.lineSpace.insertBefore(v,d.display.lineSpace.firstChild)}function a(d){setTimeout(function(){var v=!1;if(d.lineCount()==1){var y=d.getInputField();v=y.nodeName=="TEXTAREA"?!d.getLine(0).length:!/[^\u200b]/.test(y.querySelector(".CodeMirror-line").textContent)}v?s(d):l(d)},20)}function f(d){c(d)&&s(d)}function h(d){var v=d.getWrapperElement(),y=c(d);v.className=v.className.replace(" CodeMirror-empty","")+(y?" CodeMirror-empty":""),y?s(d):l(d)}function c(d){return d.lineCount()===1&&d.getLine(0)===""}})});var xf=at((bf,yf)=>{(function(o){typeof bf=="object"&&typeof yf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("autoRefresh",!1,function(a,f){a.state.autoRefresh&&(s(a,a.state.autoRefresh),a.state.autoRefresh=null),f&&a.display.wrapper.offsetHeight==0&&l(a,a.state.autoRefresh={delay:f.delay||250})});function l(a,f){function h(){a.display.wrapper.offsetHeight?(s(a,f),a.display.lastWrapHeight!=a.display.wrapper.clientHeight&&a.refresh()):f.timeout=setTimeout(h,f.delay)}f.timeout=setTimeout(h,f.delay),f.hurry=function(){clearTimeout(f.timeout),f.timeout=setTimeout(h,50)},o.on(window,"mouseup",f.hurry),o.on(window,"keyup",f.hurry)}function s(a,f){clearTimeout(f.timeout),o.off(window,"mouseup",f.hurry),o.off(window,"keyup",f.hurry)}})});var Df=at((wf,Cf)=>{(function(o){typeof wf=="object"&&typeof Cf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("styleSelectedText",!1,function(x,D,k){var F=k&&k!=o.Init;D&&!F?(x.state.markedSelection=[],x.state.markedSelectionStyle=typeof D=="string"?D:"CodeMirror-selectedtext",v(x),x.on("cursorActivity",l),x.on("change",s)):!D&&F&&(x.off("cursorActivity",l),x.off("change",s),d(x),x.state.markedSelection=x.state.markedSelectionStyle=null)});function l(x){x.state.markedSelection&&x.operation(function(){y(x)})}function s(x){x.state.markedSelection&&x.state.markedSelection.length&&x.operation(function(){d(x)})}var a=8,f=o.Pos,h=o.cmpPos;function c(x,D,k,F){if(h(D,k)!=0)for(var B=x.state.markedSelection,L=x.state.markedSelectionStyle,T=D.line;;){var N=T==D.line?D:f(T,0),z=T+a,O=z>=k.line,I=O?k:f(z,0),R=x.markText(N,I,{className:L});if(F==null?B.push(R):B.splice(F++,0,R),O)break;T=z}}function d(x){for(var D=x.state.markedSelection,k=0;k1)return v(x);var D=x.getCursor("start"),k=x.getCursor("end"),F=x.state.markedSelection;if(!F.length)return c(x,D,k);var B=F[0].find(),L=F[F.length-1].find();if(!B||!L||k.line-D.line<=a||h(D,L.to)>=0||h(k,B.from)<=0)return v(x);for(;h(D,B.from)>0;)F.shift().clear(),B=F[0].find();for(h(D,B.from)<0&&(B.to.line-D.line0&&(k.line-L.from.line{(function(o){typeof kf=="object"&&typeof Sf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l=o.Pos;function s(T){var N=T.flags;return N??(T.ignoreCase?"i":"")+(T.global?"g":"")+(T.multiline?"m":"")}function a(T,N){for(var z=s(T),O=z,I=0;IG);X++){var he=T.getLine(R++);O=O==null?he:O+` -`+he}I=I*2,N.lastIndex=z.ch;var j=N.exec(O);if(j){var oe=O.slice(0,j.index).split(` -`),H=j[0].split(` -`),Y=z.line+oe.length-1,E=oe[oe.length-1].length;return{from:l(Y,E),to:l(Y+H.length-1,H.length==1?E+H[0].length:H[H.length-1].length),match:j}}}}function d(T,N,z){for(var O,I=0;I<=T.length;){N.lastIndex=I;var R=N.exec(T);if(!R)break;var G=R.index+R[0].length;if(G>T.length-z)break;(!O||G>O.index+O[0].length)&&(O=R),I=R.index+1}return O}function v(T,N,z){N=a(N,"g");for(var O=z.line,I=z.ch,R=T.firstLine();O>=R;O--,I=-1){var G=T.getLine(O),X=d(G,N,I<0?0:G.length-I);if(X)return{from:l(O,X.index),to:l(O,X.index+X[0].length),match:X}}}function y(T,N,z){if(!f(N))return v(T,N,z);N=a(N,"gm");for(var O,I=1,R=T.getLine(z.line).length-z.ch,G=z.line,X=T.firstLine();G>=X;){for(var he=0;he=X;he++){var j=T.getLine(G--);O=O==null?j:j+` -`+O}I*=2;var oe=d(O,N,R);if(oe){var H=O.slice(0,oe.index).split(` -`),Y=oe[0].split(` -`),E=G+H.length,q=H[H.length-1].length;return{from:l(E,q),to:l(E+Y.length-1,Y.length==1?q+Y[0].length:Y[Y.length-1].length),match:oe}}}}var x,D;String.prototype.normalize?(x=function(T){return T.normalize("NFD").toLowerCase()},D=function(T){return T.normalize("NFD")}):(x=function(T){return T.toLowerCase()},D=function(T){return T});function k(T,N,z,O){if(T.length==N.length)return z;for(var I=0,R=z+Math.max(0,T.length-N.length);;){if(I==R)return I;var G=I+R>>1,X=O(T.slice(0,G)).length;if(X==z)return G;X>z?R=G:I=G+1}}function F(T,N,z,O){if(!N.length)return null;var I=O?x:D,R=I(N).split(/\r|\n\r?/);e:for(var G=z.line,X=z.ch,he=T.lastLine()+1-R.length;G<=he;G++,X=0){var j=T.getLine(G).slice(X),oe=I(j);if(R.length==1){var H=oe.indexOf(R[0]);if(H==-1)continue e;var z=k(j,oe,H,I)+X;return{from:l(G,k(j,oe,H,I)+X),to:l(G,k(j,oe,H+R[0].length,I)+X)}}else{var Y=oe.length-R[0].length;if(oe.slice(Y)!=R[0])continue e;for(var E=1;E=he;G--,X=-1){var j=T.getLine(G);X>-1&&(j=j.slice(0,X));var oe=I(j);if(R.length==1){var H=oe.lastIndexOf(R[0]);if(H==-1)continue e;return{from:l(G,k(j,oe,H,I)),to:l(G,k(j,oe,H+R[0].length,I))}}else{var Y=R[R.length-1];if(oe.slice(0,Y.length)!=Y)continue e;for(var E=1,z=G-R.length+1;E(this.doc.getLine(N.line)||"").length&&(N.ch=0,N.line++)),o.cmpPos(N,this.doc.clipPos(N))!=0))return this.atOccurrence=!1;var z=this.matches(T,N);if(this.afterEmptyMatch=z&&o.cmpPos(z.from,z.to)==0,z)return this.pos=z,this.atOccurrence=!0,this.pos.match||!0;var O=l(T?this.doc.firstLine():this.doc.lastLine()+1,0);return this.pos={from:O,to:O},this.atOccurrence=!1},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(T,N){if(this.atOccurrence){var z=o.splitLines(T);this.doc.replaceRange(z,this.pos.from,this.pos.to,N),this.pos.to=l(this.pos.from.line+z.length-1,z[z.length-1].length+(z.length==1?this.pos.from.ch:0))}}},o.defineExtension("getSearchCursor",function(T,N,z){return new L(this.doc,T,N,z)}),o.defineDocExtension("getSearchCursor",function(T,N,z){return new L(this,T,N,z)}),o.defineExtension("selectMatches",function(T,N){for(var z=[],O=this.getSearchCursor(T,this.getCursor("from"),N);O.findNext()&&!(o.cmpPos(O.to(),this.getCursor("to"))>0);)z.push({anchor:O.from(),head:O.to()});z.length&&this.setSelections(z,0)})})});var Tf=at((Af,Ff)=>{(function(o){typeof Af=="object"&&typeof Ff=="object"?o(At(),ll(),sl()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../markdown/markdown","../../addon/mode/overlay"],o):o(CodeMirror)})(function(o){"use strict";var l=/^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i;o.defineMode("gfm",function(s,a){var f=0;function h(y){return y.code=!1,null}var c={startState:function(){return{code:!1,codeBlock:!1,ateSpace:!1}},copyState:function(y){return{code:y.code,codeBlock:y.codeBlock,ateSpace:y.ateSpace}},token:function(y,x){if(x.combineTokens=null,x.codeBlock)return y.match(/^```+/)?(x.codeBlock=!1,null):(y.skipToEnd(),null);if(y.sol()&&(x.code=!1),y.sol()&&y.match(/^```+/))return y.skipToEnd(),x.codeBlock=!0,null;if(y.peek()==="`"){y.next();var D=y.pos;y.eatWhile("`");var k=1+y.pos-D;return x.code?k===f&&(x.code=!1):(f=k,x.code=!0),null}else if(x.code)return y.next(),null;if(y.eatSpace())return x.ateSpace=!0,null;if((y.sol()||x.ateSpace)&&(x.ateSpace=!1,a.gitHubSpice!==!1)){if(y.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?=.{0,6}\d)(?:[a-f0-9]{7,40}\b)/))return x.combineTokens=!0,"link";if(y.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/))return x.combineTokens=!0,"link"}return y.match(l)&&y.string.slice(y.start-2,y.start)!="]("&&(y.start==0||/\W/.test(y.string.charAt(y.start-1)))?(x.combineTokens=!0,"link"):(y.next(),null)},blankLine:h},d={taskLists:!0,strikethrough:!0,emoji:!0};for(var v in a)d[v]=a[v];return d.name="markdown",o.overlayMode(o.getMode(s,d),c)},"markdown"),o.defineMIME("text/x-gfm","gfm")})});var Lf=at(()=>{});var Mf=at((j0,fl)=>{var ul;(function(){"use strict";ul=function(o,l,s,a){a=a||{},this.dictionary=null,this.rules={},this.dictionaryTable=new Map,this.compoundRules=[],this.compoundRuleCodes={},this.replacementTable=[],this.flags=a.flags||{},this.memoized={},this.loaded=!1;var f=this,h,c,d,v,y;o&&(f.dictionary=o,l&&s?F():(typeof window<"u"?(a.dictionaryPath?h=a.dictionaryPath:h="typo/dictionaries",window.chrome&&window.chrome.runtime&&window.chrome.runtime.getURL?h=window.chrome.runtime.getURL(h):window.browser&&window.browser.runtime&&window.browser.runtime.getURL&&(h=window.browser.runtime.getURL(h))):typeof __dirname<"u"?h=__dirname+"/dictionaries":h="./dictionaries",l||x(h+"/"+o+"/"+o+".aff",D),s||x(h+"/"+o+"/"+o+".dic",k)));function x(B,L){var T=f._readFile(B,null,a?.asyncLoad);a?.asyncLoad?T.then(function(N){L(N)}):L(T)}function D(B){l=B,s&&F()}function k(B){s=B,l&&F()}function F(){for(f.rules=f._parseAFF(l),f.compoundRuleCodes={},c=0,v=f.compoundRules.length;c0&&(R.continuationClasses=O),I!=="."&&(k==="SFX"?R.match=new RegExp(I+"$"):R.match=new RegExp("^"+I)),T!="0"&&(k==="SFX"?R.remove=new RegExp(T+"$"):R.remove=T),L.push(R)}l[F]={type:k,combineable:B==="Y",entries:L},c+=f}else if(k==="COMPOUNDRULE"){for(f=parseInt(D[1],10),d=c+1,y=c+1+f;d0&&(s.get(oe)===null&&s.set(oe,[]),s.get(oe).push(H))}for(var f=1,h=l.length;f1){var x=this.parseRuleCodes(v[1]);(!("NEEDAFFIX"in this.flags)||x.indexOf(this.flags.NEEDAFFIX)===-1)&&a(y,x);for(var D=0,k=x.length;D"u"){if("COMPOUNDMIN"in this.flags&&o.length>=this.flags.COMPOUNDMIN){for(s=0,a=this.compoundRules.length;s"u"&&(s=Array.prototype.concat.apply([],this.dictionaryTable.get(o))),s&&s.indexOf(this.flags[l])!==-1))},alphabet:"",suggest:function(o,l){if(!this.loaded)throw"Dictionary not loaded.";if(l=l||5,this.memoized.hasOwnProperty(o)){var s=this.memoized[o].limit;if(l<=s||this.memoized[o].suggestions.length1&&X[1][1]!==X[1][0]&&(I=X[0]+X[1][1]+X[1][0]+X[1].substring(2),(!F||y.check(I))&&(I in B?B[I]+=1:B[I]=1)),X[1]){var he=X[1].substring(0,1).toUpperCase()===X[1].substring(0,1)?"uppercase":"lowercase";for(T=0;TY?1:oe[0].localeCompare(j[0])}I.sort(R).reverse();var G=[],X="lowercase";k.toUpperCase()===k?X="uppercase":k.substr(0,1).toUpperCase()+k.substr(1).toLowerCase()===k&&(X="capitalized");var he=l;for(z=0;z{"use strict";var Bf=Mf();function Oe(o){if(o=o||{},typeof o.codeMirrorInstance!="function"||typeof o.codeMirrorInstance.defineMode!="function"){console.log("CodeMirror Spell Checker: You must provide an instance of CodeMirror via the option `codeMirrorInstance`");return}String.prototype.includes||(String.prototype.includes=function(){"use strict";return String.prototype.indexOf.apply(this,arguments)!==-1}),o.codeMirrorInstance.defineMode("spell-checker",function(l){if(!Oe.aff_loading){Oe.aff_loading=!0;var s=new XMLHttpRequest;s.open("GET","https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.aff",!0),s.onload=function(){s.readyState===4&&s.status===200&&(Oe.aff_data=s.responseText,Oe.num_loaded++,Oe.num_loaded==2&&(Oe.typo=new Bf("en_US",Oe.aff_data,Oe.dic_data,{platform:"any"})))},s.send(null)}if(!Oe.dic_loading){Oe.dic_loading=!0;var a=new XMLHttpRequest;a.open("GET","https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.dic",!0),a.onload=function(){a.readyState===4&&a.status===200&&(Oe.dic_data=a.responseText,Oe.num_loaded++,Oe.num_loaded==2&&(Oe.typo=new Bf("en_US",Oe.aff_data,Oe.dic_data,{platform:"any"})))},a.send(null)}var f='!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~ ',h={token:function(d){var v=d.peek(),y="";if(f.includes(v))return d.next(),null;for(;(v=d.peek())!=null&&!f.includes(v);)y+=v,d.next();return Oe.typo&&!Oe.typo.check(y)?"spell-error":null}},c=o.codeMirrorInstance.getMode(l,l.backdrop||"text/plain");return o.codeMirrorInstance.overlayMode(c,h,!0)})}Oe.num_loaded=0;Oe.aff_loading=!1;Oe.dic_loading=!1;Oe.aff_data="";Oe.dic_data="";Oe.typo;_f.exports=Oe});var Kf=at(_e=>{"use strict";function Nf(o,l){for(var s=0;so.length)&&(l=o.length);for(var s=0,a=new Array(l);s=o.length?{done:!0}:{done:!1,value:o[a++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ep(o,l){if(typeof o!="object"||o===null)return o;var s=o[Symbol.toPrimitive];if(s!==void 0){var a=s.call(o,l||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(o)}function tp(o){var l=ep(o,"string");return typeof l=="symbol"?l:String(l)}function cl(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}_e.defaults=cl();function rp(o){_e.defaults=o}var Uf=/[&<>"']/,ip=new RegExp(Uf.source,"g"),jf=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,np=new RegExp(jf.source,"g"),op={"&":"&","<":"<",">":">",'"':""","'":"'"},If=function(l){return op[l]};function pt(o,l){if(l){if(Uf.test(o))return o.replace(ip,If)}else if(jf.test(o))return o.replace(np,If);return o}var ap=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Gf(o){return o.replace(ap,function(l,s){return s=s.toLowerCase(),s==="colon"?":":s.charAt(0)==="#"?s.charAt(1)==="x"?String.fromCharCode(parseInt(s.substring(2),16)):String.fromCharCode(+s.substring(1)):""})}var lp=/(^|[^\[])\^/g;function Me(o,l){o=typeof o=="string"?o:o.source,l=l||"";var s={replace:function(f,h){return h=h.source||h,h=h.replace(lp,"$1"),o=o.replace(f,h),s},getRegex:function(){return new RegExp(o,l)}};return s}var sp=/[^\w:]/g,up=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function Hf(o,l,s){if(o){var a;try{a=decodeURIComponent(Gf(s)).replace(sp,"").toLowerCase()}catch{return null}if(a.indexOf("javascript:")===0||a.indexOf("vbscript:")===0||a.indexOf("data:")===0)return null}l&&!up.test(s)&&(s=hp(l,s));try{s=encodeURI(s).replace(/%25/g,"%")}catch{return null}return s}var oo={},fp=/^[^:]+:\/*[^/]*$/,cp=/^([^:]+:)[\s\S]*$/,dp=/^([^:]+:\/*[^/]*)[\s\S]*$/;function hp(o,l){oo[" "+o]||(fp.test(o)?oo[" "+o]=o+"/":oo[" "+o]=ao(o,"/",!0)),o=oo[" "+o];var s=o.indexOf(":")===-1;return l.substring(0,2)==="//"?s?l:o.replace(cp,"$1")+l:l.charAt(0)==="/"?s?l:o.replace(dp,"$1")+l:o+l}var lo={exec:function(){}};function Pf(o,l){var s=o.replace(/\|/g,function(h,c,d){for(var v=!1,y=c;--y>=0&&d[y]==="\\";)v=!v;return v?"|":" |"}),a=s.split(/ \|/),f=0;if(a[0].trim()||a.shift(),a.length>0&&!a[a.length-1].trim()&&a.pop(),a.length>l)a.splice(l);else for(;a.length1;)l&1&&(s+=o),l>>=1,o+=o;return s+o}function Rf(o,l,s,a){var f=l.href,h=l.title?pt(l.title):null,c=o[1].replace(/\\([\[\]])/g,"$1");if(o[0].charAt(0)!=="!"){a.state.inLink=!0;var d={type:"link",raw:s,href:f,title:h,text:c,tokens:a.inlineTokens(c)};return a.state.inLink=!1,d}return{type:"image",raw:s,href:f,title:h,text:pt(c)}}function mp(o,l){var s=o.match(/^(\s+)(?:```)/);if(s===null)return l;var a=s[1];return l.split(` + outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var E;v&&(E=n.ownerDocument.defaultView.scrollY),r.input.focus(),v&&n.ownerDocument.defaultView.scrollTo(null,E),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=M,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function _(){if(n.selectionStart!=null){var R=i.somethingSelected(),Z="\u200B"+(R?n.value:"");n.value="\u21DA",n.value=Z,t.prevInput=R?"":"\u200B",n.selectionStart=1,n.selectionEnd=Z.length,r.selForContextMenu=i.doc.sel}}function M(){if(t.contextMenuPending==M&&(t.contextMenuPending=!1,t.wrapper.style.cssText=b,n.style.cssText=m,c&&d<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=p),n.selectionStart!=null)){(!c||c&&d<9)&&_();var R=0,Z=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?tt(i,gu)(i):R++<10?r.detectingSelectAll=setTimeout(Z,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Z,200)}}if(c&&d>=9&&_(),de){_i(e);var P=function(){Mt(window,"mouseup",P),setTimeout(M,20)};ue(window,"mouseup",P)}else setTimeout(M,50)},We.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},We.prototype.setUneditable=function(){},We.prototype.needsContentAttribute=!1;function Yh(e,t){if(t=t?Lt(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var i=he(Ce(e));t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=g.getValue()}var n;if(e.form&&(ue(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var u=e.form;n=u.submit;try{var p=u.submit=function(){r(),u.submit=n,u.submit(),u.submit=p}}catch{}}t.finishInit=function(m){m.save=r,m.getTextArea=function(){return e},m.toTextArea=function(){m.toTextArea=isNaN,r(),e.parentNode.removeChild(m.getWrapperElement()),e.style.display="",e.form&&(Mt(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var g=Ne(function(m){return e.parentNode.insertBefore(m,e.nextSibling)},t);return g}function Zh(e){e.off=Mt,e.on=ue,e.wheelEventPixels=rh,e.Doc=xt,e.splitLines=ra,e.countColumn=Ye,e.findColumn=Kt,e.isWordChar=Zo,e.Pass=Ze,e.signal=je,e.Line=ei,e.changeEnd=xr,e.scrollbarModel=Gs,e.Pos=Y,e.cmpPos=me,e.modes=na,e.mimeModes=Vr,e.resolveMode=Sn,e.getMode=oa,e.modeExtensions=$r,e.extendMode=Jc,e.copyState=Lr,e.startState=Jl,e.innerMode=aa,e.commands=nn,e.keyMap=ar,e.keyName=Mu,e.isModifierKey=Tu,e.lookupKey=hi,e.normalizeKeyMap=kh,e.StringStream=Ge,e.SharedTextMarker=en,e.TextMarker=Cr,e.LineWidget=$i,e.e_preventDefault=bt,e.e_stopPropagation=Zl,e.e_stop=_i,e.addClass=be,e.contains=Q,e.rmClass=oe,e.keyNames=Dr}qh(Ne),jh(Ne);var Qh="iter insert remove copy getEditor constructor".split(" ");for(var io in xt.prototype)xt.prototype.hasOwnProperty(io)&&ze(Qh,io)<0&&(Ne.prototype[io]=function(e){return function(){return e.apply(this.doc,arguments)}}(xt.prototype[io]));return Jr(xt),Ne.inputStyles={textarea:We,contenteditable:Te},Ne.defineMode=function(e){!Ne.defaults.mode&&e!="null"&&(Ne.defaults.mode=e),Zc.apply(this,arguments)},Ne.defineMIME=Qc,Ne.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Ne.defineMIME("text/plain","null"),Ne.defineExtension=function(e,t){Ne.prototype[e]=t},Ne.defineDocExtension=function(e,t){xt.prototype[e]=t},Ne.fromTextArea=Yh,Zh(Ne),Ne.version="5.65.21",Ne})});var ef=at((Vu,$u)=>{(function(o){typeof Vu=="object"&&typeof $u=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,s=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,a=/[*+-]\s/;o.commands.newlineAndIndentContinueMarkdownList=function(h){if(h.getOption("disableInput"))return o.Pass;for(var c=h.listSelections(),d=[],v=0;v\s*$/.test(B),z=!/>\s*$/.test(B);(N||z)&&h.replaceRange("",{line:y.line,ch:0},{line:y.line,ch:y.ch+1}),d[v]=` +`}else{var O=L[1],I=L[5],W=!(a.test(L[2])||L[2].indexOf(">")>=0),j=W?parseInt(L[3],10)+1+L[4]:L[2].replace("x"," ");d[v]=` +`+O+j+I,W&&f(h,y)}}h.replaceSelections(d)};function f(h,c){var d=c.line,v=0,y=0,x=l.exec(h.getLine(d)),D=x[1];do{v+=1;var S=d+v,F=h.getLine(S),B=l.exec(F);if(B){var L=B[1],T=parseInt(x[3],10)+v-y,N=parseInt(B[3],10),z=N;if(D===L&&!isNaN(N))T===N&&(z=N+1),T>N&&(z=T+1),h.replaceRange(F.replace(l,L+z+B[4]+B[5]),{line:S,ch:0},{line:S,ch:F.length});else{if(D.length>L.length||D.length{var tf=At();tf.commands.tabAndIndentMarkdownList=function(o){var l=o.listSelections(),s=l[0].head,a=o.getStateAfter(s.line),f=a.list!==!1;if(f){o.execCommand("indentMore");return}if(o.options.indentWithTabs)o.execCommand("insertTab");else{var h=Array(o.options.tabSize+1).join(" ");o.replaceSelection(h)}};tf.commands.shiftTabAndUnindentMarkdownList=function(o){var l=o.listSelections(),s=l[0].head,a=o.getStateAfter(s.line),f=a.list!==!1;if(f){o.execCommand("indentLess");return}if(o.options.indentWithTabs)o.execCommand("insertTab");else{var h=Array(o.options.tabSize+1).join(" ");o.replaceSelection(h)}}});var af=at((nf,of)=>{(function(o){typeof nf=="object"&&typeof of=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("fullScreen",!1,function(a,f,h){h==o.Init&&(h=!1),!h!=!f&&(f?l(a):s(a))});function l(a){var f=a.getWrapperElement();a.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:f.style.width,height:f.style.height},f.style.width="",f.style.height="auto",f.className+=" CodeMirror-fullscreen",document.documentElement.style.overflow="hidden",a.refresh()}function s(a){var f=a.getWrapperElement();f.className=f.className.replace(/\s*CodeMirror-fullscreen\b/,""),document.documentElement.style.overflow="";var h=a.state.fullScreenRestore;f.style.width=h.width,f.style.height=h.height,window.scrollTo(h.scrollLeft,h.scrollTop),a.refresh()}})});var al=at((lf,sf)=>{(function(o){typeof lf=="object"&&typeof sf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},s={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};o.defineMode("xml",function(a,f){var h=a.indentUnit,c={},d=f.htmlMode?l:s;for(var v in d)c[v]=d[v];for(var v in f)c[v]=f[v];var y,x;function D(k,H){function q(be){return H.tokenize=be,be(k,H)}var Q=k.next();if(Q=="<")return k.eat("!")?k.eat("[")?k.match("CDATA[")?q(B("atom","]]>")):null:k.match("--")?q(B("comment","-->")):k.match("DOCTYPE",!0,!0)?(k.eatWhile(/[\w\._\-]/),q(L(1))):null:k.eat("?")?(k.eatWhile(/[\w\._\-]/),H.tokenize=B("meta","?>"),"meta"):(y=k.eat("/")?"closeTag":"openTag",H.tokenize=S,"tag bracket");if(Q=="&"){var he;return k.eat("#")?k.eat("x")?he=k.eatWhile(/[a-fA-F\d]/)&&k.eat(";"):he=k.eatWhile(/[\d]/)&&k.eat(";"):he=k.eatWhile(/[\w\.\-:]/)&&k.eat(";"),he?"atom":"error"}else return k.eatWhile(/[^&<]/),null}D.isInText=!0;function S(k,H){var q=k.next();if(q==">"||q=="/"&&k.eat(">"))return H.tokenize=D,y=q==">"?"endTag":"selfcloseTag","tag bracket";if(q=="=")return y="equals",null;if(q=="<"){H.tokenize=D,H.state=I,H.tagName=H.tagStart=null;var Q=H.tokenize(k,H);return Q?Q+" tag error":"tag error"}else return/[\'\"]/.test(q)?(H.tokenize=F(q),H.stringStartCol=k.column(),H.tokenize(k,H)):(k.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function F(k){var H=function(q,Q){for(;!q.eol();)if(q.next()==k){Q.tokenize=S;break}return"string"};return H.isInAttribute=!0,H}function B(k,H){return function(q,Q){for(;!q.eol();){if(q.match(H)){Q.tokenize=D;break}q.next()}return k}}function L(k){return function(H,q){for(var Q;(Q=H.next())!=null;){if(Q=="<")return q.tokenize=L(k+1),q.tokenize(H,q);if(Q==">")if(k==1){q.tokenize=D;break}else return q.tokenize=L(k-1),q.tokenize(H,q)}return"meta"}}function T(k){return k&&k.toLowerCase()}function N(k,H,q){this.prev=k.context,this.tagName=H||"",this.indent=k.indented,this.startOfLine=q,(c.doNotIndent.hasOwnProperty(H)||k.context&&k.context.noIndent)&&(this.noIndent=!0)}function z(k){k.context&&(k.context=k.context.prev)}function O(k,H){for(var q;;){if(!k.context||(q=k.context.tagName,!c.contextGrabbers.hasOwnProperty(T(q))||!c.contextGrabbers[T(q)].hasOwnProperty(T(H))))return;z(k)}}function I(k,H,q){return k=="openTag"?(q.tagStart=H.column(),W):k=="closeTag"?j:I}function W(k,H,q){return k=="word"?(q.tagName=H.current(),x="tag",U):c.allowMissingTagName&&k=="endTag"?(x="tag bracket",U(k,H,q)):(x="error",W)}function j(k,H,q){if(k=="word"){var Q=H.current();return q.context&&q.context.tagName!=Q&&c.implicitlyClosed.hasOwnProperty(T(q.context.tagName))&&z(q),q.context&&q.context.tagName==Q||c.matchClosing===!1?(x="tag",K):(x="tag error",de)}else return c.allowMissingTagName&&k=="endTag"?(x="tag bracket",K(k,H,q)):(x="error",de)}function K(k,H,q){return k!="endTag"?(x="error",K):(z(q),I)}function de(k,H,q){return x="error",K(k,H,q)}function U(k,H,q){if(k=="word")return x="attribute",oe;if(k=="endTag"||k=="selfcloseTag"){var Q=q.tagName,he=q.tagStart;return q.tagName=q.tagStart=null,k=="selfcloseTag"||c.autoSelfClosers.hasOwnProperty(T(Q))?O(q,Q):(O(q,Q),q.context=new N(q,Q,he==q.indented)),I}return x="error",U}function oe(k,H,q){return k=="equals"?X:(c.allowMissing||(x="error"),U(k,H,q))}function X(k,H,q){return k=="string"?G:k=="word"&&c.allowUnquoted?(x="string",U):(x="error",U(k,H,q))}function G(k,H,q){return k=="string"?G:U(k,H,q)}return{startState:function(k){var H={tokenize:D,state:I,indented:k||0,tagName:null,tagStart:null,context:null};return k!=null&&(H.baseIndent=k),H},token:function(k,H){if(!H.tagName&&k.sol()&&(H.indented=k.indentation()),k.eatSpace())return null;y=null;var q=H.tokenize(k,H);return(q||y)&&q!="comment"&&(x=null,H.state=H.state(y||q,k,H),x&&(q=x=="error"?q+" error":x)),q},indent:function(k,H,q){var Q=k.context;if(k.tokenize.isInAttribute)return k.tagStart==k.indented?k.stringStartCol+1:k.indented+h;if(Q&&Q.noIndent)return o.Pass;if(k.tokenize!=S&&k.tokenize!=D)return q?q.match(/^(\s*)/)[0].length:0;if(k.tagName)return c.multilineTagIndentPastTag!==!1?k.tagStart+k.tagName.length+2:k.tagStart+h*(c.multilineTagIndentFactor||1);if(c.alignCDATA&&/$/,blockCommentStart:"",configuration:c.htmlMode?"html":"xml",helperType:c.htmlMode?"html":"xml",skipAttribute:function(k){k.state==X&&(k.state=U)},xmlCurrentTag:function(k){return k.tagName?{name:k.tagName,close:k.type=="closeTag"}:null},xmlCurrentContext:function(k){for(var H=[],q=k.context;q;q=q.prev)H.push(q.tagName);return H.reverse()}}}),o.defineMIME("text/xml","xml"),o.defineMIME("application/xml","xml"),o.mimeModes.hasOwnProperty("text/html")||o.defineMIME("text/html",{name:"xml",htmlMode:!0})})});var cf=at((uf,ff)=>{(function(o){typeof uf=="object"&&typeof ff=="object"?o(At()):typeof define=="function"&&define.amd?define(["../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy","cbl"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded JavaScript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"],alias:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var l=0;l-1&&a.substring(c+1,a.length);if(d)return o.findModeByExtension(d)},o.findModeByName=function(a){a=a.toLowerCase();for(var f=0;f{(function(o){typeof df=="object"&&typeof hf=="object"?o(At(),al(),cf()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../xml/xml","../meta"],o):o(CodeMirror)})(function(o){"use strict";o.defineMode("markdown",function(l,s){var a=o.getMode(l,"text/html"),f=a.name=="null";function h(A){if(o.findModeByName){var w=o.findModeByName(A);w&&(A=w.mime||w.mimes[0])}var ee=o.getMode(l,A);return ee.name=="null"?null:ee}s.highlightFormatting===void 0&&(s.highlightFormatting=!1),s.maxBlockquoteDepth===void 0&&(s.maxBlockquoteDepth=0),s.taskLists===void 0&&(s.taskLists=!1),s.strikethrough===void 0&&(s.strikethrough=!1),s.emoji===void 0&&(s.emoji=!1),s.fencedCodeBlockHighlighting===void 0&&(s.fencedCodeBlockHighlighting=!0),s.fencedCodeBlockDefaultMode===void 0&&(s.fencedCodeBlockDefaultMode="text/plain"),s.xml===void 0&&(s.xml=!0),s.tokenTypeOverrides===void 0&&(s.tokenTypeOverrides={});var c={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var d in c)c.hasOwnProperty(d)&&s.tokenTypeOverrides[d]&&(c[d]=s.tokenTypeOverrides[d]);var v=/^([*\-_])(?:\s*\1){2,}\s*$/,y=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,x=/^\[(x| )\](?=\s)/i,D=s.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,S=/^ {0,3}(?:\={1,}|-{2,})\s*$/,F=/^[^#!\[\]*_\\<>` "'(~:]+/,B=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,L=/^\s*\[[^\]]+?\]:.*$/,T=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,N=" ";function z(A,w,ee){return w.f=w.inline=ee,ee(A,w)}function O(A,w,ee){return w.f=w.block=ee,ee(A,w)}function I(A){return!A||!/\S/.test(A.string)}function W(A){if(A.linkTitle=!1,A.linkHref=!1,A.linkText=!1,A.em=!1,A.strong=!1,A.strikethrough=!1,A.quote=0,A.indentedCode=!1,A.f==K){var w=f;if(!w){var ee=o.innerMode(a,A.htmlState);w=ee.mode.name=="xml"&&ee.state.tagStart===null&&!ee.state.context&&ee.state.tokenize.isInText}w&&(A.f=X,A.block=j,A.htmlState=null)}return A.trailingSpace=0,A.trailingSpaceNewLine=!1,A.prevLine=A.thisLine,A.thisLine={stream:null},null}function j(A,w){var ee=A.column()===w.indentation,Ce=I(w.prevLine.stream),ye=w.indentedCode,lt=w.prevLine.hr,Lt=w.list!==!1,Ye=(w.listStack[w.listStack.length-1]||0)+3;w.indentedCode=!1;var dt=w.indentation;if(w.indentationDiff===null&&(w.indentationDiff=w.indentation,Lt)){for(w.list=null;dt=4&&(ye||w.prevLine.fencedCodeEnd||w.prevLine.header||Ce))return A.skipToEnd(),w.indentedCode=!0,c.code;if(A.eatSpace())return null;if(ee&&w.indentation<=Ye&&(Ze=A.match(D))&&Ze[1].length<=6)return w.quote=0,w.header=Ze[1].length,w.thisLine.header=!0,s.highlightFormatting&&(w.formatting="header"),w.f=w.inline,U(w);if(w.indentation<=Ye&&A.eat(">"))return w.quote=ee?1:w.quote+1,s.highlightFormatting&&(w.formatting="quote"),A.eatSpace(),U(w);if(!Pe&&!w.setext&&ee&&w.indentation<=Ye&&(Ze=A.match(y))){var vt=Ze[1]?"ol":"ul";return w.indentation=dt+A.current().length,w.list=!0,w.quote=0,w.listStack.push(w.indentation),w.em=!1,w.strong=!1,w.code=!1,w.strikethrough=!1,s.taskLists&&A.match(x,!1)&&(w.taskList=!0),w.f=w.inline,s.highlightFormatting&&(w.formatting=["list","list-"+vt]),U(w)}else{if(ee&&w.indentation<=Ye&&(Ze=A.match(B,!0)))return w.quote=0,w.fencedEndRE=new RegExp(Ze[1]+"+ *$"),w.localMode=s.fencedCodeBlockHighlighting&&h(Ze[2]||s.fencedCodeBlockDefaultMode),w.localMode&&(w.localState=o.startState(w.localMode)),w.f=w.block=de,s.highlightFormatting&&(w.formatting="code-block"),w.code=-1,U(w);if(w.setext||(!ze||!Lt)&&!w.quote&&w.list===!1&&!w.code&&!Pe&&!L.test(A.string)&&(Ze=A.lookAhead(1))&&(Ze=Ze.match(S)))return w.setext?(w.header=w.setext,w.setext=0,A.skipToEnd(),s.highlightFormatting&&(w.formatting="header")):(w.header=Ze[0].charAt(0)=="="?1:2,w.setext=w.header),w.thisLine.header=!0,w.f=w.inline,U(w);if(Pe)return A.skipToEnd(),w.hr=!0,w.thisLine.hr=!0,c.hr;if(A.peek()==="[")return z(A,w,Q)}return z(A,w,w.inline)}function K(A,w){var ee=a.token(A,w.htmlState);if(!f){var Ce=o.innerMode(a,w.htmlState);(Ce.mode.name=="xml"&&Ce.state.tagStart===null&&!Ce.state.context&&Ce.state.tokenize.isInText||w.md_inside&&A.current().indexOf(">")>-1)&&(w.f=X,w.block=j,w.htmlState=null)}return ee}function de(A,w){var ee=w.listStack[w.listStack.length-1]||0,Ce=w.indentation=A.quote?w.push(c.formatting+"-"+A.formatting[ee]+"-"+A.quote):w.push("error"))}if(A.taskOpen)return w.push("meta"),w.length?w.join(" "):null;if(A.taskClosed)return w.push("property"),w.length?w.join(" "):null;if(A.linkHref?w.push(c.linkHref,"url"):(A.strong&&w.push(c.strong),A.em&&w.push(c.em),A.strikethrough&&w.push(c.strikethrough),A.emoji&&w.push(c.emoji),A.linkText&&w.push(c.linkText),A.code&&w.push(c.code),A.image&&w.push(c.image),A.imageAltText&&w.push(c.imageAltText,"link"),A.imageMarker&&w.push(c.imageMarker)),A.header&&w.push(c.header,c.header+"-"+A.header),A.quote&&(w.push(c.quote),!s.maxBlockquoteDepth||s.maxBlockquoteDepth>=A.quote?w.push(c.quote+"-"+A.quote):w.push(c.quote+"-"+s.maxBlockquoteDepth)),A.list!==!1){var Ce=(A.listStack.length-1)%3;Ce?Ce===1?w.push(c.list2):w.push(c.list3):w.push(c.list1)}return A.trailingSpaceNewLine?w.push("trailing-space-new-line"):A.trailingSpace&&w.push("trailing-space-"+(A.trailingSpace%2?"a":"b")),w.length?w.join(" "):null}function oe(A,w){if(A.match(F,!0))return U(w)}function X(A,w){var ee=w.text(A,w);if(typeof ee<"u")return ee;if(w.list)return w.list=null,U(w);if(w.taskList){var Ce=A.match(x,!0)[1]===" ";return Ce?w.taskOpen=!0:w.taskClosed=!0,s.highlightFormatting&&(w.formatting="task"),w.taskList=!1,U(w)}if(w.taskOpen=!1,w.taskClosed=!1,w.header&&A.match(/^#+$/,!0))return s.highlightFormatting&&(w.formatting="header"),U(w);var ye=A.next();if(w.linkTitle){w.linkTitle=!1;var lt=ye;ye==="("&&(lt=")"),lt=(lt+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Lt="^\\s*(?:[^"+lt+"\\\\]+|\\\\\\\\|\\\\.)"+lt;if(A.match(new RegExp(Lt),!0))return c.linkHref}if(ye==="`"){var Ye=w.formatting;s.highlightFormatting&&(w.formatting="code"),A.eatWhile("`");var dt=A.current().length;if(w.code==0&&(!w.quote||dt==1))return w.code=dt,U(w);if(dt==w.code){var ze=U(w);return w.code=0,ze}else return w.formatting=Ye,U(w)}else if(w.code)return U(w);if(ye==="\\"&&(A.next(),s.highlightFormatting)){var Pe=U(w),Ze=c.formatting+"-escape";return Pe?Pe+" "+Ze:Ze}if(ye==="!"&&A.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return w.imageMarker=!0,w.image=!0,s.highlightFormatting&&(w.formatting="image"),U(w);if(ye==="["&&w.imageMarker&&A.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return w.imageMarker=!1,w.imageAltText=!0,s.highlightFormatting&&(w.formatting="image"),U(w);if(ye==="]"&&w.imageAltText){s.highlightFormatting&&(w.formatting="image");var Pe=U(w);return w.imageAltText=!1,w.image=!1,w.inline=w.f=k,Pe}if(ye==="["&&!w.image)return w.linkText&&A.match(/^.*?\]/)||(w.linkText=!0,s.highlightFormatting&&(w.formatting="link")),U(w);if(ye==="]"&&w.linkText){s.highlightFormatting&&(w.formatting="link");var Pe=U(w);return w.linkText=!1,w.inline=w.f=A.match(/\(.*?\)| ?\[.*?\]/,!1)?k:X,Pe}if(ye==="<"&&A.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){w.f=w.inline=G,s.highlightFormatting&&(w.formatting="link");var Pe=U(w);return Pe?Pe+=" ":Pe="",Pe+c.linkInline}if(ye==="<"&&A.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){w.f=w.inline=G,s.highlightFormatting&&(w.formatting="link");var Pe=U(w);return Pe?Pe+=" ":Pe="",Pe+c.linkEmail}if(s.xml&&ye==="<"&&A.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var vt=A.string.indexOf(">",A.pos);if(vt!=-1){var Ti=A.string.substring(A.start,vt);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Ti)&&(w.md_inside=!0)}return A.backUp(1),w.htmlState=o.startState(a),O(A,w,K)}if(s.xml&&ye==="<"&&A.match(/^\/\w*?>/))return w.md_inside=!1,"tag";if(ye==="*"||ye==="_"){for(var Xt=1,Kt=A.pos==1?" ":A.string.charAt(A.pos-2);Xt<3&&A.eat(ye);)Xt++;var Ht=A.peek()||" ",pr=!/\s/.test(Ht)&&(!T.test(Ht)||/\s/.test(Kt)||T.test(Kt)),De=!/\s/.test(Kt)&&(!T.test(Kt)||/\s/.test(Ht)||T.test(Ht)),Pt=null,gr=null;if(Xt%2&&(!w.em&&pr&&(ye==="*"||!De||T.test(Kt))?Pt=!0:w.em==ye&&De&&(ye==="*"||!pr||T.test(Ht))&&(Pt=!1)),Xt>1&&(!w.strong&&pr&&(ye==="*"||!De||T.test(Kt))?gr=!0:w.strong==ye&&De&&(ye==="*"||!pr||T.test(Ht))&&(gr=!1)),gr!=null||Pt!=null){s.highlightFormatting&&(w.formatting=Pt==null?"strong":gr==null?"em":"strong em"),Pt===!0&&(w.em=ye),gr===!0&&(w.strong=ye);var ze=U(w);return Pt===!1&&(w.em=!1),gr===!1&&(w.strong=!1),ze}}else if(ye===" "&&(A.eat("*")||A.eat("_"))){if(A.peek()===" ")return U(w);A.backUp(1)}if(s.strikethrough){if(ye==="~"&&A.eatWhile(ye)){if(w.strikethrough){s.highlightFormatting&&(w.formatting="strikethrough");var ze=U(w);return w.strikethrough=!1,ze}else if(A.match(/^[^\s]/,!1))return w.strikethrough=!0,s.highlightFormatting&&(w.formatting="strikethrough"),U(w)}else if(ye===" "&&A.match("~~",!0)){if(A.peek()===" ")return U(w);A.backUp(2)}}if(s.emoji&&ye===":"&&A.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){w.emoji=!0,s.highlightFormatting&&(w.formatting="emoji");var Dn=U(w);return w.emoji=!1,Dn}return ye===" "&&(A.match(/^ +$/,!1)?w.trailingSpace++:w.trailingSpace&&(w.trailingSpaceNewLine=!0)),U(w)}function G(A,w){var ee=A.next();if(ee===">"){w.f=w.inline=X,s.highlightFormatting&&(w.formatting="link");var Ce=U(w);return Ce?Ce+=" ":Ce="",Ce+c.linkInline}return A.match(/^[^>]+/,!0),c.linkInline}function k(A,w){if(A.eatSpace())return null;var ee=A.next();return ee==="("||ee==="["?(w.f=w.inline=q(ee==="("?")":"]"),s.highlightFormatting&&(w.formatting="link-string"),w.linkHref=!0,U(w)):"error"}var H={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function q(A){return function(w,ee){var Ce=w.next();if(Ce===A){ee.f=ee.inline=X,s.highlightFormatting&&(ee.formatting="link-string");var ye=U(ee);return ee.linkHref=!1,ye}return w.match(H[A]),ee.linkHref=!0,U(ee)}}function Q(A,w){return A.match(/^([^\]\\]|\\.)*\]:/,!1)?(w.f=he,A.next(),s.highlightFormatting&&(w.formatting="link"),w.linkText=!0,U(w)):z(A,w,X)}function he(A,w){if(A.match("]:",!0)){w.f=w.inline=be,s.highlightFormatting&&(w.formatting="link");var ee=U(w);return w.linkText=!1,ee}return A.match(/^([^\]\\]|\\.)+/,!0),c.linkText}function be(A,w){return A.eatSpace()?null:(A.match(/^[^\s]+/,!0),A.peek()===void 0?w.linkTitle=!0:A.match(/^(?:\s+(?:"(?:[^"\\]|\\.)+"|'(?:[^'\\]|\\.)+'|\((?:[^)\\]|\\.)+\)))?/,!0),w.f=w.inline=X,c.linkHref+" url")}var Ee={startState:function(){return{f:j,prevLine:{stream:null},thisLine:{stream:null},block:j,htmlState:null,indentation:0,inline:X,text:oe,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(A){return{f:A.f,prevLine:A.prevLine,thisLine:A.thisLine,block:A.block,htmlState:A.htmlState&&o.copyState(a,A.htmlState),indentation:A.indentation,localMode:A.localMode,localState:A.localMode?o.copyState(A.localMode,A.localState):null,inline:A.inline,text:A.text,formatting:!1,linkText:A.linkText,linkTitle:A.linkTitle,linkHref:A.linkHref,code:A.code,em:A.em,strong:A.strong,strikethrough:A.strikethrough,emoji:A.emoji,header:A.header,setext:A.setext,hr:A.hr,taskList:A.taskList,list:A.list,listStack:A.listStack.slice(0),quote:A.quote,indentedCode:A.indentedCode,trailingSpace:A.trailingSpace,trailingSpaceNewLine:A.trailingSpaceNewLine,md_inside:A.md_inside,fencedEndRE:A.fencedEndRE}},token:function(A,w){if(w.formatting=!1,A!=w.thisLine.stream){if(w.header=0,w.hr=!1,A.match(/^\s*$/,!0))return W(w),null;if(w.prevLine=w.thisLine,w.thisLine={stream:A},w.taskList=!1,w.trailingSpace=0,w.trailingSpaceNewLine=!1,!w.localState&&(w.f=w.block,w.f!=K)){var ee=A.match(/^\s*/,!0)[0].replace(/\t/g,N).length;if(w.indentation=ee,w.indentationDiff=null,ee>0)return null}}return w.f(A,w)},innerMode:function(A){return A.block==K?{state:A.htmlState,mode:a}:A.localState?{state:A.localState,mode:A.localMode}:{state:A,mode:Ee}},indent:function(A,w,ee){return A.block==K&&a.indent?a.indent(A.htmlState,w,ee):A.localState&&A.localMode.indent?A.localMode.indent(A.localState,w,ee):o.Pass},blankLine:W,getType:U,blockCommentStart:"",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return Ee},"xml"),o.defineMIME("text/markdown","markdown"),o.defineMIME("text/x-markdown","markdown")})});var sl=at((pf,gf)=>{(function(o){typeof pf=="object"&&typeof gf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.overlayMode=function(l,s,a){return{startState:function(){return{base:o.startState(l),overlay:o.startState(s),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(f){return{base:o.copyState(l,f.base),overlay:o.copyState(s,f.overlay),basePos:f.basePos,baseCur:null,overlayPos:f.overlayPos,overlayCur:null}},token:function(f,h){return(f!=h.streamSeen||Math.min(h.basePos,h.overlayPos){(function(o){typeof mf=="object"&&typeof vf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){o.defineOption("placeholder","",function(d,v,y){var x=y&&y!=o.Init;if(v&&!x)d.on("blur",f),d.on("change",h),d.on("swapDoc",h),o.on(d.getInputField(),"compositionupdate",d.state.placeholderCompose=function(){a(d)}),h(d);else if(!v&&x){d.off("blur",f),d.off("change",h),d.off("swapDoc",h),o.off(d.getInputField(),"compositionupdate",d.state.placeholderCompose),l(d);var D=d.getWrapperElement();D.className=D.className.replace(" CodeMirror-empty","")}v&&!d.hasFocus()&&f(d)});function l(d){d.state.placeholder&&(d.state.placeholder.parentNode.removeChild(d.state.placeholder),d.state.placeholder=null)}function s(d){l(d);var v=d.state.placeholder=document.createElement("pre");v.style.cssText="height: 0; overflow: visible",v.style.direction=d.getOption("direction"),v.className="CodeMirror-placeholder CodeMirror-line-like";var y=d.getOption("placeholder");typeof y=="string"&&(y=document.createTextNode(y)),v.appendChild(y),d.display.lineSpace.insertBefore(v,d.display.lineSpace.firstChild)}function a(d){setTimeout(function(){var v=!1;if(d.lineCount()==1){var y=d.getInputField();v=y.nodeName=="TEXTAREA"?!d.getLine(0).length:!/[^\u200b]/.test(y.querySelector(".CodeMirror-line").textContent)}v?s(d):l(d)},20)}function f(d){c(d)&&s(d)}function h(d){var v=d.getWrapperElement(),y=c(d);v.className=v.className.replace(" CodeMirror-empty","")+(y?" CodeMirror-empty":""),y?s(d):l(d)}function c(d){return d.lineCount()===1&&d.getLine(0)===""}})});var wf=at((yf,xf)=>{(function(o){typeof yf=="object"&&typeof xf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("autoRefresh",!1,function(a,f){a.state.autoRefresh&&(s(a,a.state.autoRefresh),a.state.autoRefresh=null),f&&a.display.wrapper.offsetHeight==0&&l(a,a.state.autoRefresh={delay:f.delay||250})});function l(a,f){function h(){a.display.wrapper.offsetHeight?(s(a,f),a.display.lastWrapHeight!=a.display.wrapper.clientHeight&&a.refresh()):f.timeout=setTimeout(h,f.delay)}f.timeout=setTimeout(h,f.delay),f.hurry=function(){clearTimeout(f.timeout),f.timeout=setTimeout(h,50)},o.on(window,"mouseup",f.hurry),o.on(window,"keyup",f.hurry)}function s(a,f){clearTimeout(f.timeout),o.off(window,"mouseup",f.hurry),o.off(window,"keyup",f.hurry)}})});var kf=at((Cf,Df)=>{(function(o){typeof Cf=="object"&&typeof Df=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("styleSelectedText",!1,function(x,D,S){var F=S&&S!=o.Init;D&&!F?(x.state.markedSelection=[],x.state.markedSelectionStyle=typeof D=="string"?D:"CodeMirror-selectedtext",v(x),x.on("cursorActivity",l),x.on("change",s)):!D&&F&&(x.off("cursorActivity",l),x.off("change",s),d(x),x.state.markedSelection=x.state.markedSelectionStyle=null)});function l(x){x.state.markedSelection&&x.operation(function(){y(x)})}function s(x){x.state.markedSelection&&x.state.markedSelection.length&&x.operation(function(){d(x)})}var a=8,f=o.Pos,h=o.cmpPos;function c(x,D,S,F){if(h(D,S)!=0)for(var B=x.state.markedSelection,L=x.state.markedSelectionStyle,T=D.line;;){var N=T==D.line?D:f(T,0),z=T+a,O=z>=S.line,I=O?S:f(z,0),W=x.markText(N,I,{className:L});if(F==null?B.push(W):B.splice(F++,0,W),O)break;T=z}}function d(x){for(var D=x.state.markedSelection,S=0;S1)return v(x);var D=x.getCursor("start"),S=x.getCursor("end"),F=x.state.markedSelection;if(!F.length)return c(x,D,S);var B=F[0].find(),L=F[F.length-1].find();if(!B||!L||S.line-D.line<=a||h(D,L.to)>=0||h(S,B.from)<=0)return v(x);for(;h(D,B.from)>0;)F.shift().clear(),B=F[0].find();for(h(D,B.from)<0&&(B.to.line-D.line0&&(S.line-L.from.line{(function(o){typeof Sf=="object"&&typeof Ef=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l=o.Pos;function s(T){var N=T.flags;return N??(T.ignoreCase?"i":"")+(T.global?"g":"")+(T.multiline?"m":"")}function a(T,N){for(var z=s(T),O=z,I=0;Ij);K++){var de=T.getLine(W++);O=O==null?de:O+` +`+de}I=I*2,N.lastIndex=z.ch;var U=N.exec(O);if(U){var oe=O.slice(0,U.index).split(` +`),X=U[0].split(` +`),G=z.line+oe.length-1,k=oe[oe.length-1].length;return{from:l(G,k),to:l(G+X.length-1,X.length==1?k+X[0].length:X[X.length-1].length),match:U}}}}function d(T,N,z){for(var O,I=0;I<=T.length;){N.lastIndex=I;var W=N.exec(T);if(!W)break;var j=W.index+W[0].length;if(j>T.length-z)break;(!O||j>O.index+O[0].length)&&(O=W),I=W.index+1}return O}function v(T,N,z){N=a(N,"g");for(var O=z.line,I=z.ch,W=T.firstLine();O>=W;O--,I=-1){var j=T.getLine(O),K=d(j,N,I<0?0:j.length-I);if(K)return{from:l(O,K.index),to:l(O,K.index+K[0].length),match:K}}}function y(T,N,z){if(!f(N))return v(T,N,z);N=a(N,"gm");for(var O,I=1,W=T.getLine(z.line).length-z.ch,j=z.line,K=T.firstLine();j>=K;){for(var de=0;de=K;de++){var U=T.getLine(j--);O=O==null?U:U+` +`+O}I*=2;var oe=d(O,N,W);if(oe){var X=O.slice(0,oe.index).split(` +`),G=oe[0].split(` +`),k=j+X.length,H=X[X.length-1].length;return{from:l(k,H),to:l(k+G.length-1,G.length==1?H+G[0].length:G[G.length-1].length),match:oe}}}}var x,D;String.prototype.normalize?(x=function(T){return T.normalize("NFD").toLowerCase()},D=function(T){return T.normalize("NFD")}):(x=function(T){return T.toLowerCase()},D=function(T){return T});function S(T,N,z,O){if(T.length==N.length)return z;for(var I=0,W=z+Math.max(0,T.length-N.length);;){if(I==W)return I;var j=I+W>>1,K=O(T.slice(0,j)).length;if(K==z)return j;K>z?W=j:I=j+1}}function F(T,N,z,O){if(!N.length)return null;var I=O?x:D,W=I(N).split(/\r|\n\r?/);e:for(var j=z.line,K=z.ch,de=T.lastLine()+1-W.length;j<=de;j++,K=0){var U=T.getLine(j).slice(K),oe=I(U);if(W.length==1){var X=oe.indexOf(W[0]);if(X==-1)continue e;var z=S(U,oe,X,I)+K;return{from:l(j,S(U,oe,X,I)+K),to:l(j,S(U,oe,X+W[0].length,I)+K)}}else{var G=oe.length-W[0].length;if(oe.slice(G)!=W[0])continue e;for(var k=1;k=de;j--,K=-1){var U=T.getLine(j);K>-1&&(U=U.slice(0,K));var oe=I(U);if(W.length==1){var X=oe.lastIndexOf(W[0]);if(X==-1)continue e;return{from:l(j,S(U,oe,X,I)),to:l(j,S(U,oe,X+W[0].length,I))}}else{var G=W[W.length-1];if(oe.slice(0,G.length)!=G)continue e;for(var k=1,z=j-W.length+1;k(this.doc.getLine(N.line)||"").length&&(N.ch=0,N.line++)),o.cmpPos(N,this.doc.clipPos(N))!=0))return this.atOccurrence=!1;var z=this.matches(T,N);if(this.afterEmptyMatch=z&&o.cmpPos(z.from,z.to)==0,z)return this.pos=z,this.atOccurrence=!0,this.pos.match||!0;var O=l(T?this.doc.firstLine():this.doc.lastLine()+1,0);return this.pos={from:O,to:O},this.atOccurrence=!1},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(T,N){if(this.atOccurrence){var z=o.splitLines(T);this.doc.replaceRange(z,this.pos.from,this.pos.to,N),this.pos.to=l(this.pos.from.line+z.length-1,z[z.length-1].length+(z.length==1?this.pos.from.ch:0))}}},o.defineExtension("getSearchCursor",function(T,N,z){return new L(this.doc,T,N,z)}),o.defineDocExtension("getSearchCursor",function(T,N,z){return new L(this,T,N,z)}),o.defineExtension("selectMatches",function(T,N){for(var z=[],O=this.getSearchCursor(T,this.getCursor("from"),N);O.findNext()&&!(o.cmpPos(O.to(),this.getCursor("to"))>0);)z.push({anchor:O.from(),head:O.to()});z.length&&this.setSelections(z,0)})})});var Lf=at((Ff,Tf)=>{(function(o){typeof Ff=="object"&&typeof Tf=="object"?o(At(),ll(),sl()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../markdown/markdown","../../addon/mode/overlay"],o):o(CodeMirror)})(function(o){"use strict";var l=/^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i;o.defineMode("gfm",function(s,a){var f=0;function h(y){return y.code=!1,null}var c={startState:function(){return{code:!1,codeBlock:!1,ateSpace:!1}},copyState:function(y){return{code:y.code,codeBlock:y.codeBlock,ateSpace:y.ateSpace}},token:function(y,x){if(x.combineTokens=null,x.codeBlock)return y.match(/^```+/)?(x.codeBlock=!1,null):(y.skipToEnd(),null);if(y.sol()&&(x.code=!1),y.sol()&&y.match(/^```+/))return y.skipToEnd(),x.codeBlock=!0,null;if(y.peek()==="`"){y.next();var D=y.pos;y.eatWhile("`");var S=1+y.pos-D;return x.code?S===f&&(x.code=!1):(f=S,x.code=!0),null}else if(x.code)return y.next(),null;if(y.eatSpace())return x.ateSpace=!0,null;if((y.sol()||x.ateSpace)&&(x.ateSpace=!1,a.gitHubSpice!==!1)){if(y.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?=.{0,6}\d)(?:[a-f0-9]{7,40}\b)/))return x.combineTokens=!0,"link";if(y.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/))return x.combineTokens=!0,"link"}return y.match(l)&&y.string.slice(y.start-2,y.start)!="]("&&(y.start==0||/\W/.test(y.string.charAt(y.start-1)))?(x.combineTokens=!0,"link"):(y.next(),null)},blankLine:h},d={taskLists:!0,strikethrough:!0,emoji:!0};for(var v in a)d[v]=a[v];return d.name="markdown",o.overlayMode(o.getMode(s,d),c)},"markdown"),o.defineMIME("text/x-gfm","gfm")})});var Mf=at(()=>{});var Bf=at((j0,fl)=>{var ul;(function(){"use strict";ul=function(o,l,s,a){a=a||{},this.dictionary=null,this.rules={},this.dictionaryTable=new Map,this.compoundRules=[],this.compoundRuleCodes={},this.replacementTable=[],this.flags=a.flags||{},this.memoized={},this.loaded=!1;var f=this,h,c,d,v,y;o&&(f.dictionary=o,l&&s?F():(typeof window<"u"?(a.dictionaryPath?h=a.dictionaryPath:h="typo/dictionaries",window.chrome&&window.chrome.runtime&&window.chrome.runtime.getURL?h=window.chrome.runtime.getURL(h):window.browser&&window.browser.runtime&&window.browser.runtime.getURL&&(h=window.browser.runtime.getURL(h))):typeof __dirname<"u"?h=__dirname+"/dictionaries":h="./dictionaries",l||x(h+"/"+o+"/"+o+".aff",D),s||x(h+"/"+o+"/"+o+".dic",S)));function x(B,L){var T=f._readFile(B,null,a?.asyncLoad);a?.asyncLoad?T.then(function(N){L(N)}):L(T)}function D(B){l=B,s&&F()}function S(B){s=B,l&&F()}function F(){for(f.rules=f._parseAFF(l),f.compoundRuleCodes={},c=0,v=f.compoundRules.length;c0&&(W.continuationClasses=O),I!=="."&&(S==="SFX"?W.match=new RegExp(I+"$"):W.match=new RegExp("^"+I)),T!="0"&&(S==="SFX"?W.remove=new RegExp(T+"$"):W.remove=T),L.push(W)}l[F]={type:S,combineable:B==="Y",entries:L},c+=f}else if(S==="COMPOUNDRULE"){for(f=parseInt(D[1],10),d=c+1,y=c+1+f;d0&&(s.get(oe)===null&&s.set(oe,[]),s.get(oe).push(X))}for(var f=1,h=l.length;f1){var x=this.parseRuleCodes(v[1]);(!("NEEDAFFIX"in this.flags)||x.indexOf(this.flags.NEEDAFFIX)===-1)&&a(y,x);for(var D=0,S=x.length;D"u"){if("COMPOUNDMIN"in this.flags&&o.length>=this.flags.COMPOUNDMIN){for(s=0,a=this.compoundRules.length;s"u"&&(s=Array.prototype.concat.apply([],this.dictionaryTable.get(o))),s&&s.indexOf(this.flags[l])!==-1))},alphabet:"",suggest:function(o,l){if(!this.loaded)throw"Dictionary not loaded.";if(l=l||5,this.memoized.hasOwnProperty(o)){var s=this.memoized[o].limit;if(l<=s||this.memoized[o].suggestions.length1&&K[1][1]!==K[1][0]&&(I=K[0]+K[1][1]+K[1][0]+K[1].substring(2),(!F||y.check(I))&&(I in B?B[I]+=1:B[I]=1)),K[1]){var de=K[1].substring(0,1).toUpperCase()===K[1].substring(0,1)?"uppercase":"lowercase";for(T=0;TG?1:oe[0].localeCompare(U[0])}I.sort(W).reverse();var j=[],K="lowercase";S.toUpperCase()===S?K="uppercase":S.substr(0,1).toUpperCase()+S.substr(1).toLowerCase()===S&&(K="capitalized");var de=l;for(z=0;z{"use strict";var _f=Bf();function Oe(o){if(o=o||{},typeof o.codeMirrorInstance!="function"||typeof o.codeMirrorInstance.defineMode!="function"){console.log("CodeMirror Spell Checker: You must provide an instance of CodeMirror via the option `codeMirrorInstance`");return}String.prototype.includes||(String.prototype.includes=function(){"use strict";return String.prototype.indexOf.apply(this,arguments)!==-1}),o.codeMirrorInstance.defineMode("spell-checker",function(l){if(!Oe.aff_loading){Oe.aff_loading=!0;var s=new XMLHttpRequest;s.open("GET","https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.aff",!0),s.onload=function(){s.readyState===4&&s.status===200&&(Oe.aff_data=s.responseText,Oe.num_loaded++,Oe.num_loaded==2&&(Oe.typo=new _f("en_US",Oe.aff_data,Oe.dic_data,{platform:"any"})))},s.send(null)}if(!Oe.dic_loading){Oe.dic_loading=!0;var a=new XMLHttpRequest;a.open("GET","https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.dic",!0),a.onload=function(){a.readyState===4&&a.status===200&&(Oe.dic_data=a.responseText,Oe.num_loaded++,Oe.num_loaded==2&&(Oe.typo=new _f("en_US",Oe.aff_data,Oe.dic_data,{platform:"any"})))},a.send(null)}var f='!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~ ',h={token:function(d){var v=d.peek(),y="";if(f.includes(v))return d.next(),null;for(;(v=d.peek())!=null&&!f.includes(v);)y+=v,d.next();return Oe.typo&&!Oe.typo.check(y)?"spell-error":null}},c=o.codeMirrorInstance.getMode(l,l.backdrop||"text/plain");return o.codeMirrorInstance.overlayMode(c,h,!0)})}Oe.num_loaded=0;Oe.aff_loading=!1;Oe.dic_loading=!1;Oe.aff_data="";Oe.dic_data="";Oe.typo;zf.exports=Oe});var Yf=at(_e=>{"use strict";function Of(o,l){for(var s=0;so.length)&&(l=o.length);for(var s=0,a=new Array(l);s=o.length?{done:!0}:{done:!1,value:o[a++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ep(o,l){if(typeof o!="object"||o===null)return o;var s=o[Symbol.toPrimitive];if(s!==void 0){var a=s.call(o,l||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(o)}function tp(o){var l=ep(o,"string");return typeof l=="symbol"?l:String(l)}function cl(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}_e.defaults=cl();function rp(o){_e.defaults=o}var jf=/[&<>"']/,ip=new RegExp(jf.source,"g"),Gf=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,np=new RegExp(Gf.source,"g"),op={"&":"&","<":"<",">":">",'"':""","'":"'"},Hf=function(l){return op[l]};function gt(o,l){if(l){if(jf.test(o))return o.replace(ip,Hf)}else if(Gf.test(o))return o.replace(np,Hf);return o}var ap=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Xf(o){return o.replace(ap,function(l,s){return s=s.toLowerCase(),s==="colon"?":":s.charAt(0)==="#"?s.charAt(1)==="x"?String.fromCharCode(parseInt(s.substring(2),16)):String.fromCharCode(+s.substring(1)):""})}var lp=/(^|[^\[])\^/g;function Me(o,l){o=typeof o=="string"?o:o.source,l=l||"";var s={replace:function(f,h){return h=h.source||h,h=h.replace(lp,"$1"),o=o.replace(f,h),s},getRegex:function(){return new RegExp(o,l)}};return s}var sp=/[^\w:]/g,up=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function Pf(o,l,s){if(o){var a;try{a=decodeURIComponent(Xf(s)).replace(sp,"").toLowerCase()}catch{return null}if(a.indexOf("javascript:")===0||a.indexOf("vbscript:")===0||a.indexOf("data:")===0)return null}l&&!up.test(s)&&(s=hp(l,s));try{s=encodeURI(s).replace(/%25/g,"%")}catch{return null}return s}var oo={},fp=/^[^:]+:\/*[^/]*$/,cp=/^([^:]+:)[\s\S]*$/,dp=/^([^:]+:\/*[^/]*)[\s\S]*$/;function hp(o,l){oo[" "+o]||(fp.test(o)?oo[" "+o]=o+"/":oo[" "+o]=ao(o,"/",!0)),o=oo[" "+o];var s=o.indexOf(":")===-1;return l.substring(0,2)==="//"?s?l:o.replace(cp,"$1")+l:l.charAt(0)==="/"?s?l:o.replace(dp,"$1")+l:o+l}var lo={exec:function(){}};function qf(o,l){var s=o.replace(/\|/g,function(h,c,d){for(var v=!1,y=c;--y>=0&&d[y]==="\\";)v=!v;return v?"|":" |"}),a=s.split(/ \|/),f=0;if(a[0].trim()||a.shift(),a.length>0&&!a[a.length-1].trim()&&a.pop(),a.length>l)a.splice(l);else for(;a.length1;)l&1&&(s+=o),l>>=1,o+=o;return s+o}function Wf(o,l,s,a){var f=l.href,h=l.title?gt(l.title):null,c=o[1].replace(/\\([\[\]])/g,"$1");if(o[0].charAt(0)!=="!"){a.state.inLink=!0;var d={type:"link",raw:s,href:f,title:h,text:c,tokens:a.inlineTokens(c)};return a.state.inLink=!1,d}return{type:"image",raw:s,href:f,title:h,text:gt(c)}}function mp(o,l){var s=o.match(/^(\s+)(?:```)/);if(s===null)return l;var a=s[1];return l.split(` `).map(function(f){var h=f.match(/^\s+/);if(h===null)return f;var c=h[0];return c.length>=a.length?f.slice(a.length):f}).join(` `)}var so=function(){function o(s){this.options=s||_e.defaults}var l=o.prototype;return l.space=function(a){var f=this.rules.block.newline.exec(a);if(f&&f[0].length>0)return{type:"space",raw:f[0]}},l.code=function(a){var f=this.rules.block.code.exec(a);if(f){var h=f[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:f[0],codeBlockStyle:"indented",text:this.options.pedantic?h:ao(h,` -`)}}},l.fences=function(a){var f=this.rules.block.fences.exec(a);if(f){var h=f[0],c=mp(h,f[3]||"");return{type:"code",raw:h,lang:f[2]?f[2].trim().replace(this.rules.inline._escapes,"$1"):f[2],text:c}}},l.heading=function(a){var f=this.rules.block.heading.exec(a);if(f){var h=f[2].trim();if(/#$/.test(h)){var c=ao(h,"#");(this.options.pedantic||!c||/ $/.test(c))&&(h=c.trim())}return{type:"heading",raw:f[0],depth:f[1].length,text:h,tokens:this.lexer.inline(h)}}},l.hr=function(a){var f=this.rules.block.hr.exec(a);if(f)return{type:"hr",raw:f[0]}},l.blockquote=function(a){var f=this.rules.block.blockquote.exec(a);if(f){var h=f[0].replace(/^ *>[ \t]?/gm,""),c=this.lexer.state.top;this.lexer.state.top=!0;var d=this.lexer.blockTokens(h);return this.lexer.state.top=c,{type:"blockquote",raw:f[0],tokens:d,text:h}}},l.list=function(a){var f=this.rules.block.list.exec(a);if(f){var h,c,d,v,y,x,D,k,F,B,L,T,N=f[1].trim(),z=N.length>1,O={type:"list",raw:"",ordered:z,start:z?+N.slice(0,-1):"",loose:!1,items:[]};N=z?"\\d{1,9}\\"+N.slice(-1):"\\"+N,this.options.pedantic&&(N=z?N:"[*+-]");for(var I=new RegExp("^( {0,3}"+N+")((?:[ ][^\\n]*)?(?:\\n|$))");a&&(T=!1,!(!(f=I.exec(a))||this.rules.block.hr.test(a)));){if(h=f[0],a=a.substring(h.length),k=f[2].split(` -`,1)[0].replace(/^\t+/,function(Y){return" ".repeat(3*Y.length)}),F=a.split(` -`,1)[0],this.options.pedantic?(v=2,L=k.trimLeft()):(v=f[2].search(/[^ ]/),v=v>4?1:v,L=k.slice(v),v+=f[1].length),x=!1,!k&&/^ *$/.test(F)&&(h+=F+` -`,a=a.substring(F.length+1),T=!0),!T)for(var R=new RegExp("^ {0,"+Math.min(3,v-1)+"}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))"),G=new RegExp("^ {0,"+Math.min(3,v-1)+"}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)"),X=new RegExp("^ {0,"+Math.min(3,v-1)+"}(?:```|~~~)"),he=new RegExp("^ {0,"+Math.min(3,v-1)+"}#");a&&(B=a.split(` -`,1)[0],F=B,this.options.pedantic&&(F=F.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!(X.test(F)||he.test(F)||R.test(F)||G.test(a)));){if(F.search(/[^ ]/)>=v||!F.trim())L+=` -`+F.slice(v);else{if(x||k.search(/[^ ]/)>=4||X.test(k)||he.test(k)||G.test(k))break;L+=` +`)}}},l.fences=function(a){var f=this.rules.block.fences.exec(a);if(f){var h=f[0],c=mp(h,f[3]||"");return{type:"code",raw:h,lang:f[2]?f[2].trim().replace(this.rules.inline._escapes,"$1"):f[2],text:c}}},l.heading=function(a){var f=this.rules.block.heading.exec(a);if(f){var h=f[2].trim();if(/#$/.test(h)){var c=ao(h,"#");(this.options.pedantic||!c||/ $/.test(c))&&(h=c.trim())}return{type:"heading",raw:f[0],depth:f[1].length,text:h,tokens:this.lexer.inline(h)}}},l.hr=function(a){var f=this.rules.block.hr.exec(a);if(f)return{type:"hr",raw:f[0]}},l.blockquote=function(a){var f=this.rules.block.blockquote.exec(a);if(f){var h=f[0].replace(/^ *>[ \t]?/gm,""),c=this.lexer.state.top;this.lexer.state.top=!0;var d=this.lexer.blockTokens(h);return this.lexer.state.top=c,{type:"blockquote",raw:f[0],tokens:d,text:h}}},l.list=function(a){var f=this.rules.block.list.exec(a);if(f){var h,c,d,v,y,x,D,S,F,B,L,T,N=f[1].trim(),z=N.length>1,O={type:"list",raw:"",ordered:z,start:z?+N.slice(0,-1):"",loose:!1,items:[]};N=z?"\\d{1,9}\\"+N.slice(-1):"\\"+N,this.options.pedantic&&(N=z?N:"[*+-]");for(var I=new RegExp("^( {0,3}"+N+")((?:[ ][^\\n]*)?(?:\\n|$))");a&&(T=!1,!(!(f=I.exec(a))||this.rules.block.hr.test(a)));){if(h=f[0],a=a.substring(h.length),S=f[2].split(` +`,1)[0].replace(/^\t+/,function(G){return" ".repeat(3*G.length)}),F=a.split(` +`,1)[0],this.options.pedantic?(v=2,L=S.trimLeft()):(v=f[2].search(/[^ ]/),v=v>4?1:v,L=S.slice(v),v+=f[1].length),x=!1,!S&&/^ *$/.test(F)&&(h+=F+` +`,a=a.substring(F.length+1),T=!0),!T)for(var W=new RegExp("^ {0,"+Math.min(3,v-1)+"}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))"),j=new RegExp("^ {0,"+Math.min(3,v-1)+"}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)"),K=new RegExp("^ {0,"+Math.min(3,v-1)+"}(?:```|~~~)"),de=new RegExp("^ {0,"+Math.min(3,v-1)+"}#");a&&(B=a.split(` +`,1)[0],F=B,this.options.pedantic&&(F=F.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!(K.test(F)||de.test(F)||W.test(F)||j.test(a)));){if(F.search(/[^ ]/)>=v||!F.trim())L+=` +`+F.slice(v);else{if(x||S.search(/[^ ]/)>=4||K.test(S)||de.test(S)||j.test(S))break;L+=` `+F}!x&&!F.trim()&&(x=!0),h+=B+` -`,a=a.substring(B.length+1),k=F.slice(v)}O.loose||(D?O.loose=!0:/\n *\n *$/.test(h)&&(D=!0)),this.options.gfm&&(c=/^\[[ xX]\] /.exec(L),c&&(d=c[0]!=="[ ] ",L=L.replace(/^\[[ xX]\] +/,""))),O.items.push({type:"list_item",raw:h,task:!!c,checked:d,loose:!1,text:L}),O.raw+=h}O.items[O.items.length-1].raw=h.trimRight(),O.items[O.items.length-1].text=L.trimRight(),O.raw=O.raw.trimRight();var j=O.items.length;for(y=0;y0&&oe.some(function(Y){return/\n.*\n/.test(Y.raw)});O.loose=H}if(O.loose)for(y=0;y$/,"$1").replace(this.rules.inline._escapes,"$1"):"",d=f[3]?f[3].substring(1,f[3].length-1).replace(this.rules.inline._escapes,"$1"):f[3];return{type:"def",tag:h,raw:f[0],href:c,title:d}}},l.table=function(a){var f=this.rules.block.table.exec(a);if(f){var h={type:"table",header:Pf(f[1]).map(function(D){return{text:D}}),align:f[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:f[3]&&f[3].trim()?f[3].replace(/\n[ \t]*$/,"").split(` -`):[]};if(h.header.length===h.align.length){h.raw=f[0];var c=h.align.length,d,v,y,x;for(d=0;d/i.test(f[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(f[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(f[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:f[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(f[0]):pt(f[0]):f[0]}},l.link=function(a){var f=this.rules.inline.link.exec(a);if(f){var h=f[2].trim();if(!this.options.pedantic&&/^$/.test(h))return;var c=ao(h.slice(0,-1),"\\");if((h.length-c.length)%2===0)return}else{var d=pp(f[2],"()");if(d>-1){var v=f[0].indexOf("!")===0?5:4,y=v+f[1].length+d;f[2]=f[2].substring(0,d),f[0]=f[0].substring(0,y).trim(),f[3]=""}}var x=f[2],D="";if(this.options.pedantic){var k=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(x);k&&(x=k[1],D=k[3])}else D=f[3]?f[3].slice(1,-1):"";return x=x.trim(),/^$/.test(h)?x=x.slice(1):x=x.slice(1,-1)),Rf(f,{href:x&&x.replace(this.rules.inline._escapes,"$1"),title:D&&D.replace(this.rules.inline._escapes,"$1")},f[0],this.lexer)}},l.reflink=function(a,f){var h;if((h=this.rules.inline.reflink.exec(a))||(h=this.rules.inline.nolink.exec(a))){var c=(h[2]||h[1]).replace(/\s+/g," ");if(c=f[c.toLowerCase()],!c){var d=h[0].charAt(0);return{type:"text",raw:d,text:d}}return Rf(h,c,h[0],this.lexer)}},l.emStrong=function(a,f,h){h===void 0&&(h="");var c=this.rules.inline.emStrong.lDelim.exec(a);if(c&&!(c[3]&&h.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\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\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\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\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\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-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\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\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDF70-\uDF81\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD837[\uDF00-\uDF1E]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/))){var d=c[1]||c[2]||"";if(!d||d&&(h===""||this.rules.inline.punctuation.exec(h))){var v=c[0].length-1,y,x,D=v,k=0,F=c[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(F.lastIndex=0,f=f.slice(-1*a.length+v);(c=F.exec(f))!=null;)if(y=c[1]||c[2]||c[3]||c[4]||c[5]||c[6],!!y){if(x=y.length,c[3]||c[4]){D+=x;continue}else if((c[5]||c[6])&&v%3&&!((v+x)%3)){k+=x;continue}if(D-=x,!(D>0)){x=Math.min(x,x+D+k);var B=a.slice(0,v+c.index+(c[0].length-y.length)+x);if(Math.min(v,x)%2){var L=B.slice(1,-1);return{type:"em",raw:B,text:L,tokens:this.lexer.inlineTokens(L)}}var T=B.slice(2,-2);return{type:"strong",raw:B,text:T,tokens:this.lexer.inlineTokens(T)}}}}}},l.codespan=function(a){var f=this.rules.inline.code.exec(a);if(f){var h=f[2].replace(/\n/g," "),c=/[^ ]/.test(h),d=/^ /.test(h)&&/ $/.test(h);return c&&d&&(h=h.substring(1,h.length-1)),h=pt(h,!0),{type:"codespan",raw:f[0],text:h}}},l.br=function(a){var f=this.rules.inline.br.exec(a);if(f)return{type:"br",raw:f[0]}},l.del=function(a){var f=this.rules.inline.del.exec(a);if(f)return{type:"del",raw:f[0],text:f[2],tokens:this.lexer.inlineTokens(f[2])}},l.autolink=function(a,f){var h=this.rules.inline.autolink.exec(a);if(h){var c,d;return h[2]==="@"?(c=pt(this.options.mangle?f(h[1]):h[1]),d="mailto:"+c):(c=pt(h[1]),d=c),{type:"link",raw:h[0],text:c,href:d,tokens:[{type:"text",raw:c,text:c}]}}},l.url=function(a,f){var h;if(h=this.rules.inline.url.exec(a)){var c,d;if(h[2]==="@")c=pt(this.options.mangle?f(h[0]):h[0]),d="mailto:"+c;else{var v;do v=h[0],h[0]=this.rules.inline._backpedal.exec(h[0])[0];while(v!==h[0]);c=pt(h[0]),h[1]==="www."?d="http://"+h[0]:d=h[0]}return{type:"link",raw:h[0],text:c,href:d,tokens:[{type:"text",raw:c,text:c}]}}},l.inlineText=function(a,f){var h=this.rules.inline.text.exec(a);if(h){var c;return this.lexer.state.inRawBlock?c=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(h[0]):pt(h[0]):h[0]:c=pt(this.options.smartypants?f(h[0]):h[0]),{type:"text",raw:h[0],text:c}}},o}(),ce={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:lo,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/};ce._label=/(?!\s*\])(?:\\.|[^\[\]\\])+/;ce._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;ce.def=Me(ce.def).replace("label",ce._label).replace("title",ce._title).getRegex();ce.bullet=/(?:[*+-]|\d{1,9}[.)])/;ce.listItemStart=Me(/^( *)(bull) */).replace("bull",ce.bullet).getRegex();ce.list=Me(ce.list).replace(/bull/g,ce.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ce.def.source+")").getRegex();ce._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";ce._comment=/|$)/;ce.html=Me(ce.html,"i").replace("comment",ce._comment).replace("tag",ce._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();ce.paragraph=Me(ce._paragraph).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ce._tag).getRegex();ce.blockquote=Me(ce.blockquote).replace("paragraph",ce.paragraph).getRegex();ce.normal=_t({},ce);ce.gfm=_t({},ce.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"});ce.gfm.table=Me(ce.gfm.table).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ce._tag).getRegex();ce.gfm.paragraph=Me(ce._paragraph).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",ce.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ce._tag).getRegex();ce.pedantic=_t({},ce.normal,{html:Me(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ce._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:lo,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Me(ce.normal._paragraph).replace("hr",ce.hr).replace("heading",` *#{1,6} *[^ -]`).replace("lheading",ce.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var ne={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:lo,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,rDelimUnd:/^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:lo,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~";ne.punctuation=Me(ne.punctuation).replace(/punctuation/g,ne._punctuation).getRegex();ne.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;ne.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g;ne._comment=Me(ce._comment).replace("(?:-->|$)","-->").getRegex();ne.emStrong.lDelim=Me(ne.emStrong.lDelim).replace(/punct/g,ne._punctuation).getRegex();ne.emStrong.rDelimAst=Me(ne.emStrong.rDelimAst,"g").replace(/punct/g,ne._punctuation).getRegex();ne.emStrong.rDelimUnd=Me(ne.emStrong.rDelimUnd,"g").replace(/punct/g,ne._punctuation).getRegex();ne._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;ne._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;ne._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;ne.autolink=Me(ne.autolink).replace("scheme",ne._scheme).replace("email",ne._email).getRegex();ne._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;ne.tag=Me(ne.tag).replace("comment",ne._comment).replace("attribute",ne._attribute).getRegex();ne._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;ne._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;ne._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;ne.link=Me(ne.link).replace("label",ne._label).replace("href",ne._href).replace("title",ne._title).getRegex();ne.reflink=Me(ne.reflink).replace("label",ne._label).replace("ref",ce._label).getRegex();ne.nolink=Me(ne.nolink).replace("ref",ce._label).getRegex();ne.reflinkSearch=Me(ne.reflinkSearch,"g").replace("reflink",ne.reflink).replace("nolink",ne.nolink).getRegex();ne.normal=_t({},ne);ne.pedantic=_t({},ne.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Me(/^!?\[(label)\]\((.*?)\)/).replace("label",ne._label).getRegex(),reflink:Me(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ne._label).getRegex()});ne.gfm=_t({},ne.normal,{escape:Me(ne.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\.5&&(a="x"+a.toString(16)),l+="&#"+a+";";return l}var yi=function(){function o(s){this.tokens=[],this.tokens.links=Object.create(null),this.options=s||_e.defaults,this.options.tokenizer=this.options.tokenizer||new so,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};var a={block:ce.normal,inline:ne.normal};this.options.pedantic?(a.block=ce.pedantic,a.inline=ne.pedantic):this.options.gfm&&(a.block=ce.gfm,this.options.breaks?a.inline=ne.breaks:a.inline=ne.gfm),this.tokenizer.rules=a}o.lex=function(a,f){var h=new o(f);return h.lex(a)},o.lexInline=function(a,f){var h=new o(f);return h.inlineTokens(a)};var l=o.prototype;return l.lex=function(a){a=a.replace(/\r\n|\r/g,` -`),this.blockTokens(a,this.tokens);for(var f;f=this.inlineQueue.shift();)this.inlineTokens(f.src,f.tokens);return this.tokens},l.blockTokens=function(a,f){var h=this;f===void 0&&(f=[]),this.options.pedantic?a=a.replace(/\t/g," ").replace(/^ +$/gm,""):a=a.replace(/^( *)(\t+)/gm,function(D,k,F){return k+" ".repeat(F.length)});for(var c,d,v,y;a;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(function(D){return(c=D.call({lexer:h},a,f))?(a=a.substring(c.raw.length),f.push(c),!0):!1}))){if(c=this.tokenizer.space(a)){a=a.substring(c.raw.length),c.raw.length===1&&f.length>0?f[f.length-1].raw+=` +`,a=a.substring(B.length+1),S=F.slice(v)}O.loose||(D?O.loose=!0:/\n *\n *$/.test(h)&&(D=!0)),this.options.gfm&&(c=/^\[[ xX]\] /.exec(L),c&&(d=c[0]!=="[ ] ",L=L.replace(/^\[[ xX]\] +/,""))),O.items.push({type:"list_item",raw:h,task:!!c,checked:d,loose:!1,text:L}),O.raw+=h}O.items[O.items.length-1].raw=h.trimRight(),O.items[O.items.length-1].text=L.trimRight(),O.raw=O.raw.trimRight();var U=O.items.length;for(y=0;y0&&oe.some(function(G){return/\n.*\n/.test(G.raw)});O.loose=X}if(O.loose)for(y=0;y$/,"$1").replace(this.rules.inline._escapes,"$1"):"",d=f[3]?f[3].substring(1,f[3].length-1).replace(this.rules.inline._escapes,"$1"):f[3];return{type:"def",tag:h,raw:f[0],href:c,title:d}}},l.table=function(a){var f=this.rules.block.table.exec(a);if(f){var h={type:"table",header:qf(f[1]).map(function(D){return{text:D}}),align:f[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:f[3]&&f[3].trim()?f[3].replace(/\n[ \t]*$/,"").split(` +`):[]};if(h.header.length===h.align.length){h.raw=f[0];var c=h.align.length,d,v,y,x;for(d=0;d/i.test(f[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(f[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(f[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:f[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(f[0]):gt(f[0]):f[0]}},l.link=function(a){var f=this.rules.inline.link.exec(a);if(f){var h=f[2].trim();if(!this.options.pedantic&&/^$/.test(h))return;var c=ao(h.slice(0,-1),"\\");if((h.length-c.length)%2===0)return}else{var d=pp(f[2],"()");if(d>-1){var v=f[0].indexOf("!")===0?5:4,y=v+f[1].length+d;f[2]=f[2].substring(0,d),f[0]=f[0].substring(0,y).trim(),f[3]=""}}var x=f[2],D="";if(this.options.pedantic){var S=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(x);S&&(x=S[1],D=S[3])}else D=f[3]?f[3].slice(1,-1):"";return x=x.trim(),/^$/.test(h)?x=x.slice(1):x=x.slice(1,-1)),Wf(f,{href:x&&x.replace(this.rules.inline._escapes,"$1"),title:D&&D.replace(this.rules.inline._escapes,"$1")},f[0],this.lexer)}},l.reflink=function(a,f){var h;if((h=this.rules.inline.reflink.exec(a))||(h=this.rules.inline.nolink.exec(a))){var c=(h[2]||h[1]).replace(/\s+/g," ");if(c=f[c.toLowerCase()],!c){var d=h[0].charAt(0);return{type:"text",raw:d,text:d}}return Wf(h,c,h[0],this.lexer)}},l.emStrong=function(a,f,h){h===void 0&&(h="");var c=this.rules.inline.emStrong.lDelim.exec(a);if(c&&!(c[3]&&h.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\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\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\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\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\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-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\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\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDF70-\uDF81\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD837[\uDF00-\uDF1E]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/))){var d=c[1]||c[2]||"";if(!d||d&&(h===""||this.rules.inline.punctuation.exec(h))){var v=c[0].length-1,y,x,D=v,S=0,F=c[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(F.lastIndex=0,f=f.slice(-1*a.length+v);(c=F.exec(f))!=null;)if(y=c[1]||c[2]||c[3]||c[4]||c[5]||c[6],!!y){if(x=y.length,c[3]||c[4]){D+=x;continue}else if((c[5]||c[6])&&v%3&&!((v+x)%3)){S+=x;continue}if(D-=x,!(D>0)){x=Math.min(x,x+D+S);var B=a.slice(0,v+c.index+(c[0].length-y.length)+x);if(Math.min(v,x)%2){var L=B.slice(1,-1);return{type:"em",raw:B,text:L,tokens:this.lexer.inlineTokens(L)}}var T=B.slice(2,-2);return{type:"strong",raw:B,text:T,tokens:this.lexer.inlineTokens(T)}}}}}},l.codespan=function(a){var f=this.rules.inline.code.exec(a);if(f){var h=f[2].replace(/\n/g," "),c=/[^ ]/.test(h),d=/^ /.test(h)&&/ $/.test(h);return c&&d&&(h=h.substring(1,h.length-1)),h=gt(h,!0),{type:"codespan",raw:f[0],text:h}}},l.br=function(a){var f=this.rules.inline.br.exec(a);if(f)return{type:"br",raw:f[0]}},l.del=function(a){var f=this.rules.inline.del.exec(a);if(f)return{type:"del",raw:f[0],text:f[2],tokens:this.lexer.inlineTokens(f[2])}},l.autolink=function(a,f){var h=this.rules.inline.autolink.exec(a);if(h){var c,d;return h[2]==="@"?(c=gt(this.options.mangle?f(h[1]):h[1]),d="mailto:"+c):(c=gt(h[1]),d=c),{type:"link",raw:h[0],text:c,href:d,tokens:[{type:"text",raw:c,text:c}]}}},l.url=function(a,f){var h;if(h=this.rules.inline.url.exec(a)){var c,d;if(h[2]==="@")c=gt(this.options.mangle?f(h[0]):h[0]),d="mailto:"+c;else{var v;do v=h[0],h[0]=this.rules.inline._backpedal.exec(h[0])[0];while(v!==h[0]);c=gt(h[0]),h[1]==="www."?d="http://"+h[0]:d=h[0]}return{type:"link",raw:h[0],text:c,href:d,tokens:[{type:"text",raw:c,text:c}]}}},l.inlineText=function(a,f){var h=this.rules.inline.text.exec(a);if(h){var c;return this.lexer.state.inRawBlock?c=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(h[0]):gt(h[0]):h[0]:c=gt(this.options.smartypants?f(h[0]):h[0]),{type:"text",raw:h[0],text:c}}},o}(),ce={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:lo,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/};ce._label=/(?!\s*\])(?:\\.|[^\[\]\\])+/;ce._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;ce.def=Me(ce.def).replace("label",ce._label).replace("title",ce._title).getRegex();ce.bullet=/(?:[*+-]|\d{1,9}[.)])/;ce.listItemStart=Me(/^( *)(bull) */).replace("bull",ce.bullet).getRegex();ce.list=Me(ce.list).replace(/bull/g,ce.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ce.def.source+")").getRegex();ce._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";ce._comment=/|$)/;ce.html=Me(ce.html,"i").replace("comment",ce._comment).replace("tag",ce._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();ce.paragraph=Me(ce._paragraph).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ce._tag).getRegex();ce.blockquote=Me(ce.blockquote).replace("paragraph",ce.paragraph).getRegex();ce.normal=_t({},ce);ce.gfm=_t({},ce.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"});ce.gfm.table=Me(ce.gfm.table).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ce._tag).getRegex();ce.gfm.paragraph=Me(ce._paragraph).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",ce.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ce._tag).getRegex();ce.pedantic=_t({},ce.normal,{html:Me(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ce._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:lo,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Me(ce.normal._paragraph).replace("hr",ce.hr).replace("heading",` *#{1,6} *[^ +]`).replace("lheading",ce.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var ne={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:lo,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,rDelimUnd:/^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:lo,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~";ne.punctuation=Me(ne.punctuation).replace(/punctuation/g,ne._punctuation).getRegex();ne.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;ne.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g;ne._comment=Me(ce._comment).replace("(?:-->|$)","-->").getRegex();ne.emStrong.lDelim=Me(ne.emStrong.lDelim).replace(/punct/g,ne._punctuation).getRegex();ne.emStrong.rDelimAst=Me(ne.emStrong.rDelimAst,"g").replace(/punct/g,ne._punctuation).getRegex();ne.emStrong.rDelimUnd=Me(ne.emStrong.rDelimUnd,"g").replace(/punct/g,ne._punctuation).getRegex();ne._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;ne._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;ne._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;ne.autolink=Me(ne.autolink).replace("scheme",ne._scheme).replace("email",ne._email).getRegex();ne._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;ne.tag=Me(ne.tag).replace("comment",ne._comment).replace("attribute",ne._attribute).getRegex();ne._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;ne._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;ne._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;ne.link=Me(ne.link).replace("label",ne._label).replace("href",ne._href).replace("title",ne._title).getRegex();ne.reflink=Me(ne.reflink).replace("label",ne._label).replace("ref",ce._label).getRegex();ne.nolink=Me(ne.nolink).replace("ref",ce._label).getRegex();ne.reflinkSearch=Me(ne.reflinkSearch,"g").replace("reflink",ne.reflink).replace("nolink",ne.nolink).getRegex();ne.normal=_t({},ne);ne.pedantic=_t({},ne.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Me(/^!?\[(label)\]\((.*?)\)/).replace("label",ne._label).getRegex(),reflink:Me(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ne._label).getRegex()});ne.gfm=_t({},ne.normal,{escape:Me(ne.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\.5&&(a="x"+a.toString(16)),l+="&#"+a+";";return l}var yi=function(){function o(s){this.tokens=[],this.tokens.links=Object.create(null),this.options=s||_e.defaults,this.options.tokenizer=this.options.tokenizer||new so,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};var a={block:ce.normal,inline:ne.normal};this.options.pedantic?(a.block=ce.pedantic,a.inline=ne.pedantic):this.options.gfm&&(a.block=ce.gfm,this.options.breaks?a.inline=ne.breaks:a.inline=ne.gfm),this.tokenizer.rules=a}o.lex=function(a,f){var h=new o(f);return h.lex(a)},o.lexInline=function(a,f){var h=new o(f);return h.inlineTokens(a)};var l=o.prototype;return l.lex=function(a){a=a.replace(/\r\n|\r/g,` +`),this.blockTokens(a,this.tokens);for(var f;f=this.inlineQueue.shift();)this.inlineTokens(f.src,f.tokens);return this.tokens},l.blockTokens=function(a,f){var h=this;f===void 0&&(f=[]),this.options.pedantic?a=a.replace(/\t/g," ").replace(/^ +$/gm,""):a=a.replace(/^( *)(\t+)/gm,function(D,S,F){return S+" ".repeat(F.length)});for(var c,d,v,y;a;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(function(D){return(c=D.call({lexer:h},a,f))?(a=a.substring(c.raw.length),f.push(c),!0):!1}))){if(c=this.tokenizer.space(a)){a=a.substring(c.raw.length),c.raw.length===1&&f.length>0?f[f.length-1].raw+=` `:f.push(c);continue}if(c=this.tokenizer.code(a)){a=a.substring(c.raw.length),d=f[f.length-1],d&&(d.type==="paragraph"||d.type==="text")?(d.raw+=` `+c.raw,d.text+=` `+c.text,this.inlineQueue[this.inlineQueue.length-1].src=d.text):f.push(c);continue}if(c=this.tokenizer.fences(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.heading(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.hr(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.blockquote(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.list(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.html(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.def(a)){a=a.substring(c.raw.length),d=f[f.length-1],d&&(d.type==="paragraph"||d.type==="text")?(d.raw+=` `+c.raw,d.text+=` -`+c.raw,this.inlineQueue[this.inlineQueue.length-1].src=d.text):this.tokens.links[c.tag]||(this.tokens.links[c.tag]={href:c.href,title:c.title});continue}if(c=this.tokenizer.table(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.lheading(a)){a=a.substring(c.raw.length),f.push(c);continue}if(v=a,this.options.extensions&&this.options.extensions.startBlock&&function(){var D=1/0,k=a.slice(1),F=void 0;h.options.extensions.startBlock.forEach(function(B){F=B.call({lexer:this},k),typeof F=="number"&&F>=0&&(D=Math.min(D,F))}),D<1/0&&D>=0&&(v=a.substring(0,D+1))}(),this.state.top&&(c=this.tokenizer.paragraph(v))){d=f[f.length-1],y&&d.type==="paragraph"?(d.raw+=` +`+c.raw,this.inlineQueue[this.inlineQueue.length-1].src=d.text):this.tokens.links[c.tag]||(this.tokens.links[c.tag]={href:c.href,title:c.title});continue}if(c=this.tokenizer.table(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.lheading(a)){a=a.substring(c.raw.length),f.push(c);continue}if(v=a,this.options.extensions&&this.options.extensions.startBlock&&function(){var D=1/0,S=a.slice(1),F=void 0;h.options.extensions.startBlock.forEach(function(B){F=B.call({lexer:this},S),typeof F=="number"&&F>=0&&(D=Math.min(D,F))}),D<1/0&&D>=0&&(v=a.substring(0,D+1))}(),this.state.top&&(c=this.tokenizer.paragraph(v))){d=f[f.length-1],y&&d.type==="paragraph"?(d.raw+=` `+c.raw,d.text+=` `+c.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=d.text):f.push(c),y=v.length!==a.length,a=a.substring(c.raw.length);continue}if(c=this.tokenizer.text(a)){a=a.substring(c.raw.length),d=f[f.length-1],d&&d.type==="text"?(d.raw+=` `+c.raw,d.text+=` -`+c.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=d.text):f.push(c);continue}if(a){var x="Infinite loop on byte: "+a.charCodeAt(0);if(this.options.silent){console.error(x);break}else throw new Error(x)}}return this.state.top=!0,f},l.inline=function(a,f){return f===void 0&&(f=[]),this.inlineQueue.push({src:a,tokens:f}),f},l.inlineTokens=function(a,f){var h=this;f===void 0&&(f=[]);var c,d,v,y=a,x,D,k;if(this.tokens.links){var F=Object.keys(this.tokens.links);if(F.length>0)for(;(x=this.tokenizer.rules.inline.reflinkSearch.exec(y))!=null;)F.includes(x[0].slice(x[0].lastIndexOf("[")+1,-1))&&(y=y.slice(0,x.index)+"["+qf("a",x[0].length-2)+"]"+y.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(x=this.tokenizer.rules.inline.blockSkip.exec(y))!=null;)y=y.slice(0,x.index)+"["+qf("a",x[0].length-2)+"]"+y.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(x=this.tokenizer.rules.inline.escapedEmSt.exec(y))!=null;)y=y.slice(0,x.index+x[0].length-2)+"++"+y.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex),this.tokenizer.rules.inline.escapedEmSt.lastIndex--;for(;a;)if(D||(k=""),D=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(function(L){return(c=L.call({lexer:h},a,f))?(a=a.substring(c.raw.length),f.push(c),!0):!1}))){if(c=this.tokenizer.escape(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.tag(a)){a=a.substring(c.raw.length),d=f[f.length-1],d&&c.type==="text"&&d.type==="text"?(d.raw+=c.raw,d.text+=c.text):f.push(c);continue}if(c=this.tokenizer.link(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.reflink(a,this.tokens.links)){a=a.substring(c.raw.length),d=f[f.length-1],d&&c.type==="text"&&d.type==="text"?(d.raw+=c.raw,d.text+=c.text):f.push(c);continue}if(c=this.tokenizer.emStrong(a,y,k)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.codespan(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.br(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.del(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.autolink(a,Wf)){a=a.substring(c.raw.length),f.push(c);continue}if(!this.state.inLink&&(c=this.tokenizer.url(a,Wf))){a=a.substring(c.raw.length),f.push(c);continue}if(v=a,this.options.extensions&&this.options.extensions.startInline&&function(){var L=1/0,T=a.slice(1),N=void 0;h.options.extensions.startInline.forEach(function(z){N=z.call({lexer:this},T),typeof N=="number"&&N>=0&&(L=Math.min(L,N))}),L<1/0&&L>=0&&(v=a.substring(0,L+1))}(),c=this.tokenizer.inlineText(v,vp)){a=a.substring(c.raw.length),c.raw.slice(-1)!=="_"&&(k=c.raw.slice(-1)),D=!0,d=f[f.length-1],d&&d.type==="text"?(d.raw+=c.raw,d.text+=c.text):f.push(c);continue}if(a){var B="Infinite loop on byte: "+a.charCodeAt(0);if(this.options.silent){console.error(B);break}else throw new Error(B)}}return f},Vh(o,null,[{key:"rules",get:function(){return{block:ce,inline:ne}}}]),o}(),uo=function(){function o(s){this.options=s||_e.defaults}var l=o.prototype;return l.code=function(a,f,h){var c=(f||"").match(/\S*/)[0];if(this.options.highlight){var d=this.options.highlight(a,c);d!=null&&d!==a&&(h=!0,a=d)}return a=a.replace(/\n$/,"")+` -`,c?'
    '+(h?a:pt(a,!0))+`
    -`:"
    "+(h?a:pt(a,!0))+`
    +`+c.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=d.text):f.push(c);continue}if(a){var x="Infinite loop on byte: "+a.charCodeAt(0);if(this.options.silent){console.error(x);break}else throw new Error(x)}}return this.state.top=!0,f},l.inline=function(a,f){return f===void 0&&(f=[]),this.inlineQueue.push({src:a,tokens:f}),f},l.inlineTokens=function(a,f){var h=this;f===void 0&&(f=[]);var c,d,v,y=a,x,D,S;if(this.tokens.links){var F=Object.keys(this.tokens.links);if(F.length>0)for(;(x=this.tokenizer.rules.inline.reflinkSearch.exec(y))!=null;)F.includes(x[0].slice(x[0].lastIndexOf("[")+1,-1))&&(y=y.slice(0,x.index)+"["+Rf("a",x[0].length-2)+"]"+y.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(x=this.tokenizer.rules.inline.blockSkip.exec(y))!=null;)y=y.slice(0,x.index)+"["+Rf("a",x[0].length-2)+"]"+y.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(x=this.tokenizer.rules.inline.escapedEmSt.exec(y))!=null;)y=y.slice(0,x.index+x[0].length-2)+"++"+y.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex),this.tokenizer.rules.inline.escapedEmSt.lastIndex--;for(;a;)if(D||(S=""),D=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(function(L){return(c=L.call({lexer:h},a,f))?(a=a.substring(c.raw.length),f.push(c),!0):!1}))){if(c=this.tokenizer.escape(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.tag(a)){a=a.substring(c.raw.length),d=f[f.length-1],d&&c.type==="text"&&d.type==="text"?(d.raw+=c.raw,d.text+=c.text):f.push(c);continue}if(c=this.tokenizer.link(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.reflink(a,this.tokens.links)){a=a.substring(c.raw.length),d=f[f.length-1],d&&c.type==="text"&&d.type==="text"?(d.raw+=c.raw,d.text+=c.text):f.push(c);continue}if(c=this.tokenizer.emStrong(a,y,S)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.codespan(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.br(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.del(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.autolink(a,Uf)){a=a.substring(c.raw.length),f.push(c);continue}if(!this.state.inLink&&(c=this.tokenizer.url(a,Uf))){a=a.substring(c.raw.length),f.push(c);continue}if(v=a,this.options.extensions&&this.options.extensions.startInline&&function(){var L=1/0,T=a.slice(1),N=void 0;h.options.extensions.startInline.forEach(function(z){N=z.call({lexer:this},T),typeof N=="number"&&N>=0&&(L=Math.min(L,N))}),L<1/0&&L>=0&&(v=a.substring(0,L+1))}(),c=this.tokenizer.inlineText(v,vp)){a=a.substring(c.raw.length),c.raw.slice(-1)!=="_"&&(S=c.raw.slice(-1)),D=!0,d=f[f.length-1],d&&d.type==="text"?(d.raw+=c.raw,d.text+=c.text):f.push(c);continue}if(a){var B="Infinite loop on byte: "+a.charCodeAt(0);if(this.options.silent){console.error(B);break}else throw new Error(B)}}return f},Vh(o,null,[{key:"rules",get:function(){return{block:ce,inline:ne}}}]),o}(),uo=function(){function o(s){this.options=s||_e.defaults}var l=o.prototype;return l.code=function(a,f,h){var c=(f||"").match(/\S*/)[0];if(this.options.highlight){var d=this.options.highlight(a,c);d!=null&&d!==a&&(h=!0,a=d)}return a=a.replace(/\n$/,"")+` +`,c?'
    '+(h?a:gt(a,!0))+`
    +`:"
    "+(h?a:gt(a,!0))+`
    `},l.blockquote=function(a){return`
    `+a+`
    `},l.html=function(a){return a},l.heading=function(a,f,h,c){if(this.options.headerIds){var d=this.options.headerPrefix+c.slug(h);return"'+a+" @@ -73,15 +73,15 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `},l.tablerow=function(a){return` `+a+` `},l.tablecell=function(a,f){var h=f.header?"th":"td",c=f.align?"<"+h+' align="'+f.align+'">':"<"+h+">";return c+a+(" -`)},l.strong=function(a){return""+a+""},l.em=function(a){return""+a+""},l.codespan=function(a){return""+a+""},l.br=function(){return this.options.xhtml?"
    ":"
    "},l.del=function(a){return""+a+""},l.link=function(a,f,h){if(a=Hf(this.options.sanitize,this.options.baseUrl,a),a===null)return h;var c='
    ",c},l.image=function(a,f,h){if(a=Hf(this.options.sanitize,this.options.baseUrl,a),a===null)return h;var c=''+h+'":">",c},l.text=function(a){return a},o}(),dl=function(){function o(){}var l=o.prototype;return l.strong=function(a){return a},l.em=function(a){return a},l.codespan=function(a){return a},l.del=function(a){return a},l.html=function(a){return a},l.text=function(a){return a},l.link=function(a,f,h){return""+h},l.image=function(a,f,h){return""+h},l.br=function(){return""},o}(),hl=function(){function o(){this.seen={}}var l=o.prototype;return l.serialize=function(a){return a.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},l.getNextSafeSlug=function(a,f){var h=a,c=0;if(this.seen.hasOwnProperty(h)){c=this.seen[a];do c++,h=a+"-"+c;while(this.seen.hasOwnProperty(h))}return f||(this.seen[a]=c,this.seen[h]=0),h},l.slug=function(a,f){f===void 0&&(f={});var h=this.serialize(a);return this.getNextSafeSlug(h,f.dryrun)},o}(),xi=function(){function o(s){this.options=s||_e.defaults,this.options.renderer=this.options.renderer||new uo,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new dl,this.slugger=new hl}o.parse=function(a,f){var h=new o(f);return h.parse(a)},o.parseInline=function(a,f){var h=new o(f);return h.parseInline(a)};var l=o.prototype;return l.parse=function(a,f){f===void 0&&(f=!0);var h="",c,d,v,y,x,D,k,F,B,L,T,N,z,O,I,R,G,X,he,j=a.length;for(c=0;c0&&I.tokens[0].type==="paragraph"?(I.tokens[0].text=X+" "+I.tokens[0].text,I.tokens[0].tokens&&I.tokens[0].tokens.length>0&&I.tokens[0].tokens[0].type==="text"&&(I.tokens[0].tokens[0].text=X+" "+I.tokens[0].tokens[0].text)):I.tokens.unshift({type:"text",text:X}):O+=X),O+=this.parse(I.tokens,z),B+=this.renderer.listitem(O,G,R);h+=this.renderer.list(B,T,N);continue}case"html":{h+=this.renderer.html(L.text);continue}case"paragraph":{h+=this.renderer.paragraph(this.parseInline(L.tokens));continue}case"text":{for(B=L.tokens?this.parseInline(L.tokens):L.text;c+1"+a+""},l.em=function(a){return""+a+""},l.codespan=function(a){return""+a+""},l.br=function(){return this.options.xhtml?"
    ":"
    "},l.del=function(a){return""+a+""},l.link=function(a,f,h){if(a=Pf(this.options.sanitize,this.options.baseUrl,a),a===null)return h;var c='
    ",c},l.image=function(a,f,h){if(a=Pf(this.options.sanitize,this.options.baseUrl,a),a===null)return h;var c=''+h+'":">",c},l.text=function(a){return a},o}(),dl=function(){function o(){}var l=o.prototype;return l.strong=function(a){return a},l.em=function(a){return a},l.codespan=function(a){return a},l.del=function(a){return a},l.html=function(a){return a},l.text=function(a){return a},l.link=function(a,f,h){return""+h},l.image=function(a,f,h){return""+h},l.br=function(){return""},o}(),hl=function(){function o(){this.seen={}}var l=o.prototype;return l.serialize=function(a){return a.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},l.getNextSafeSlug=function(a,f){var h=a,c=0;if(this.seen.hasOwnProperty(h)){c=this.seen[a];do c++,h=a+"-"+c;while(this.seen.hasOwnProperty(h))}return f||(this.seen[a]=c,this.seen[h]=0),h},l.slug=function(a,f){f===void 0&&(f={});var h=this.serialize(a);return this.getNextSafeSlug(h,f.dryrun)},o}(),xi=function(){function o(s){this.options=s||_e.defaults,this.options.renderer=this.options.renderer||new uo,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new dl,this.slugger=new hl}o.parse=function(a,f){var h=new o(f);return h.parse(a)},o.parseInline=function(a,f){var h=new o(f);return h.parseInline(a)};var l=o.prototype;return l.parse=function(a,f){f===void 0&&(f=!0);var h="",c,d,v,y,x,D,S,F,B,L,T,N,z,O,I,W,j,K,de,U=a.length;for(c=0;c0&&I.tokens[0].type==="paragraph"?(I.tokens[0].text=K+" "+I.tokens[0].text,I.tokens[0].tokens&&I.tokens[0].tokens.length>0&&I.tokens[0].tokens[0].type==="text"&&(I.tokens[0].tokens[0].text=K+" "+I.tokens[0].tokens[0].text)):I.tokens.unshift({type:"text",text:K}):O+=K),O+=this.parse(I.tokens,z),B+=this.renderer.listitem(O,j,W);h+=this.renderer.list(B,T,N);continue}case"html":{h+=this.renderer.html(L.text);continue}case"paragraph":{h+=this.renderer.paragraph(this.parseInline(L.tokens));continue}case"text":{for(B=L.tokens?this.parseInline(L.tokens):L.text;c+1";if(l)return Promise.resolve(f);if(s){s(null,f);return}return f}if(l)return Promise.reject(a);if(s){s(a);return}throw a}}function Xf(o,l){return function(s,a,f){typeof a=="function"&&(f=a,a=null);var h=_t({},a);a=_t({},fe.defaults,h);var c=bp(a.silent,a.async,f);if(typeof s>"u"||s===null)return c(new Error("marked(): input parameter is undefined or null"));if(typeof s!="string")return c(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));if(gp(a),a.hooks&&(a.hooks.options=a),f){var d=a.highlight,v;try{a.hooks&&(s=a.hooks.preprocess(s)),v=o(s,a)}catch(F){return c(F)}var y=function(B){var L;if(!B)try{a.walkTokens&&fe.walkTokens(v,a.walkTokens),L=l(v,a),a.hooks&&(L=a.hooks.postprocess(L))}catch(T){B=T}return a.highlight=d,B?c(B):f(null,L)};if(!d||d.length<3||(delete a.highlight,!v.length))return y();var x=0;fe.walkTokens(v,function(F){F.type==="code"&&(x++,setTimeout(function(){d(F.text,F.lang,function(B,L){if(B)return y(B);L!=null&&L!==F.text&&(F.text=L,F.escaped=!0),x--,x===0&&y()})},0))}),x===0&&y();return}if(a.async)return Promise.resolve(a.hooks?a.hooks.preprocess(s):s).then(function(F){return o(F,a)}).then(function(F){return a.walkTokens?Promise.all(fe.walkTokens(F,a.walkTokens)).then(function(){return F}):F}).then(function(F){return l(F,a)}).then(function(F){return a.hooks?a.hooks.postprocess(F):F}).catch(c);try{a.hooks&&(s=a.hooks.preprocess(s));var D=o(s,a);a.walkTokens&&fe.walkTokens(D,a.walkTokens);var k=l(D,a);return a.hooks&&(k=a.hooks.postprocess(k)),k}catch(F){return c(F)}}}function fe(o,l,s){return Xf(yi.lex,xi.parse)(o,l,s)}fe.options=fe.setOptions=function(o){return fe.defaults=_t({},fe.defaults,o),rp(fe.defaults),fe};fe.getDefaults=cl;fe.defaults=_e.defaults;fe.use=function(){for(var o=fe.defaults.extensions||{renderers:{},childTokens:{}},l=arguments.length,s=new Array(l),a=0;a{"use strict";var wi=At();$u();tf();of();ll();sl();vf();xf();Df();Ef();Tf();al();var Ap=zf(),pl=Kf().marked,Qf=/Mac/.test(navigator.platform),Fp=new RegExp(/()+?/g),fn={toggleBold:ho,toggleItalic:po,drawLink:Eo,toggleHeadingSmaller:cn,toggleHeadingBigger:bo,drawImage:Ao,toggleBlockquote:vo,toggleOrderedList:Do,toggleUnorderedList:Co,toggleCheckList:ko,toggleCodeBlock:mo,togglePreview:Bo,toggleStrikethrough:go,toggleHeading1:yo,toggleHeading2:xo,toggleHeading3:wo,toggleHeading4:ml,toggleHeading5:vl,toggleHeading6:bl,cleanBlock:So,drawTable:Fo,drawHorizontalRule:To,undo:Lo,redo:Mo,toggleSideBySide:Ci,toggleFullScreen:jr},Tp={toggleBold:"Cmd-B",toggleItalic:"Cmd-I",drawLink:"Cmd-K",toggleHeadingSmaller:"Cmd-H",toggleHeadingBigger:"Shift-Cmd-H",toggleHeading1:"Ctrl+Alt+1",toggleHeading2:"Ctrl+Alt+2",toggleHeading3:"Ctrl+Alt+3",toggleHeading4:"Ctrl+Alt+4",toggleHeading5:"Ctrl+Alt+5",toggleHeading6:"Ctrl+Alt+6",cleanBlock:"Cmd-E",drawImage:"Cmd-Alt-I",toggleBlockquote:"Cmd-'",toggleOrderedList:"Cmd-Alt-L",toggleUnorderedList:"Cmd-L",toggleCheckList:"Shift-Cmd-L",toggleCodeBlock:"Cmd-Alt-C",togglePreview:"Cmd-P",toggleSideBySide:"F9",toggleFullScreen:"F11"},Lp=function(o){for(var l in fn)if(fn[l]===o)return l;return null},gl=function(){var o=!1;return function(l){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(l)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(l.substr(0,4)))&&(o=!0)}(navigator.userAgent||navigator.vendor||window.opera),o};function Mp(o){for(var l;(l=Fp.exec(o))!==null;){var s=l[0];if(s.indexOf("target=")===-1){var a=s.replace(/>$/,' target="_blank">');o=o.replace(s,a)}}return o}function Bp(o){for(var l=new DOMParser,s=l.parseFromString(o,"text/html"),a=s.getElementsByTagName("li"),f=0;f0){for(var F=document.createElement("i"),B=0;B=0&&(x=c.getLineHandle(k),!s(x));k--);var N=c.getTokenAt({line:k,ch:1}),z=a(N).fencedChars,O,I,R,G;s(c.getLineHandle(d.line))?(O="",I=d.line):s(c.getLineHandle(d.line-1))?(O="",I=d.line-1):(O=z+` -`,I=d.line),s(c.getLineHandle(v.line))?(R="",G=v.line,v.ch===0&&(G+=1)):v.ch!==0&&s(c.getLineHandle(v.line+1))?(R="",G=v.line+1):(R=z+` -`,G=v.line+1),v.ch===0&&(G-=1),c.operation(function(){c.replaceRange(R,{line:G,ch:0},{line:G+(R?0:1),ch:0}),c.replaceRange(O,{line:I,ch:0},{line:I+(O?0:1),ch:0})}),c.setSelection({line:I+(O?1:0),ch:0},{line:G+(O?1:-1),ch:0}),c.focus()}else{var X=d.line;if(s(c.getLineHandle(d.line))&&(f(c,d.line+1)==="fenced"?(k=d.line,X=d.line+1):(F=d.line,X=d.line-1)),k===void 0)for(k=X;k>=0&&(x=c.getLineHandle(k),!s(x));k--);if(F===void 0)for(B=c.lineCount(),F=X;F=0;k--)if(x=c.getLineHandle(k),!x.text.match(/^\s*$/)&&f(c,k,x)!=="indented"){k+=1;break}for(B=c.lineCount(),F=d.line;F\s+/,"unordered-list":a,"ordered-list":a,"check-list":/^(\s*)(- \[[ xX]])(\s+)/},y=function(N,z){var O={quote:">","unordered-list":s,"ordered-list":"%%i.","check-list":"- [ ]"};return O[N].replace("%%i",z)},x=function(N,z){var O={quote:">","unordered-list":"\\"+s,"ordered-list":"\\d+.","check-list":"- \\[[ xX]]"},I=new RegExp(O[N]);return z&&I.test(z)},D=function(N,z,O){var I=a.exec(z),R=y(N,k);return I!==null?(x(N,I[2])&&(R=""),z=I[1]+R+I[3]+z.replace(f,"").replace(v[N],"$1")):O==!1&&(z=R+" "+z),z},k=1,F=["unordered-list","ordered-list","check-list"],B=Object.keys(h)[0];if(!F.includes(B)){var L=o.getLine(c.line);/^\s*- \[[ xX]]\s/.test(L)?B="check-list":/^\s*\d+\.\s/.test(L)?B="ordered-list":/^\s*[*\-+]\s/.test(L)&&(B="unordered-list")}for(var T=c.line;T<=d.line;T++)(function(N){var z=o.getLine(N);h[l]?z=z.replace(v[l],"$1"):F.includes(B)&&F.includes(l)?(z=z.replace(v[B],"$1"),z=D(l,z,!1),k+=1):(z=D(l,z,!1),k+=1),o.replaceRange(z,{line:N,ch:0},{line:N,ch:99999999999999})})(T);o.focus()}}function ec(o,l,s,a){if(!(!o.codemirror||o.isPreviewActive())){var f=o.codemirror,h=Sr(f),c=h[l];if(!c){Gr(f,c,s,a);return}var d=f.getCursor("start"),v=f.getCursor("end"),y=f.getLine(d.line),x=y.slice(0,d.ch),D=y.slice(d.ch);l=="link"?x=x.replace(/(.*)[^!]\[/,"$1"):l=="image"&&(x=x.replace(/(.*)!\[$/,"$1")),D=D.replace(/]\(.*?\)/,""),f.replaceRange(x+D,{line:d.line,ch:0},{line:d.line,ch:99999999999999}),d.ch-=s[0].length,d!==v&&(v.ch-=s[0].length),f.setSelection(d,v),f.focus()}}function xl(o,l,s,a){if(!(!o.codemirror||o.isPreviewActive())){a=typeof a>"u"?s:a;var f=o.codemirror,h=Sr(f),c,d=s,v=a,y=f.getCursor("start"),x=f.getCursor("end");h[l]?(c=f.getLine(y.line),d=c.slice(0,y.ch),v=c.slice(y.ch),l=="bold"?(d=d.replace(/(\*\*|__)(?![\s\S]*(\*\*|__))/,""),v=v.replace(/(\*\*|__)/,"")):l=="italic"?(d=d.replace(/(\*|_)(?![\s\S]*(\*|_))/,""),v=v.replace(/(\*|_)/,"")):l=="strikethrough"&&(d=d.replace(/(\*\*|~~)(?![\s\S]*(\*\*|~~))/,""),v=v.replace(/(\*\*|~~)/,"")),f.replaceRange(d+v,{line:y.line,ch:0},{line:y.line,ch:99999999999999}),l=="bold"||l=="strikethrough"?(y.ch-=2,y!==x&&(x.ch-=2)):l=="italic"&&(y.ch-=1,y!==x&&(x.ch-=1))):(c=f.getSelection(),l=="bold"?(c=c.split("**").join(""),c=c.split("__").join("")):l=="italic"?(c=c.split("*").join(""),c=c.split("_").join("")):l=="strikethrough"&&(c=c.split("~~").join("")),f.replaceSelection(d+c+v),y.ch+=s.length,x.ch=y.ch+c.length),f.setSelection(y,x),f.focus()}}function Op(o){if(!o.getWrapperElement().lastChild.classList.contains("editor-preview-active"))for(var l=o.getCursor("start"),s=o.getCursor("end"),a,f=l.line;f<=s.line;f++)a=o.getLine(f),a=a.replace(/^[ ]*([# ]+|\*|-|[> ]+|[0-9]+(.|\)))[ ]*/,""),o.replaceRange(a,{line:f,ch:0},{line:f,ch:99999999999999})}function co(o,l){if(Math.abs(o)<1024)return""+o+l[0];var s=0;do o/=1024,++s;while(Math.abs(o)>=1024&&s=19968?a+=s[f].length:a+=1;return a}var Be={bold:"fa fa-bold",italic:"fa fa-italic",strikethrough:"fa fa-strikethrough",heading:"fa fa-header fa-heading","heading-smaller":"fa fa-header fa-heading header-smaller","heading-bigger":"fa fa-header fa-heading header-bigger","heading-1":"fa fa-header fa-heading header-1","heading-2":"fa fa-header fa-heading header-2","heading-3":"fa fa-header fa-heading header-3",code:"fa fa-code",quote:"fa fa-quote-left","ordered-list":"fa fa-list-ol","unordered-list":"fa fa-list-ul","check-list":"fa fa-check-square-o","clean-block":"fa fa-eraser",link:"fa fa-link",image:"fa fa-image","upload-image":"fa fa-image",table:"fa fa-table","horizontal-rule":"fa fa-minus",preview:"fa fa-eye","side-by-side":"fa fa-columns",fullscreen:"fa fa-arrows-alt",guide:"fa fa-question-circle",undo:"fa fa-undo",redo:"fa fa-repeat fa-redo"},Ur={bold:{name:"bold",action:ho,className:Be.bold,title:"Bold",default:!0},italic:{name:"italic",action:po,className:Be.italic,title:"Italic",default:!0},strikethrough:{name:"strikethrough",action:go,className:Be.strikethrough,title:"Strikethrough"},heading:{name:"heading",action:cn,className:Be.heading,title:"Heading",default:!0},"heading-smaller":{name:"heading-smaller",action:cn,className:Be["heading-smaller"],title:"Smaller Heading"},"heading-bigger":{name:"heading-bigger",action:bo,className:Be["heading-bigger"],title:"Bigger Heading"},"heading-1":{name:"heading-1",action:yo,className:Be["heading-1"],title:"Big Heading"},"heading-2":{name:"heading-2",action:xo,className:Be["heading-2"],title:"Medium Heading"},"heading-3":{name:"heading-3",action:wo,className:Be["heading-3"],title:"Small Heading"},"separator-1":{name:"separator-1"},code:{name:"code",action:mo,className:Be.code,title:"Code"},quote:{name:"quote",action:vo,className:Be.quote,title:"Quote",default:!0},"unordered-list":{name:"unordered-list",action:Co,className:Be["unordered-list"],title:"Generic List",default:!0},"ordered-list":{name:"ordered-list",action:Do,className:Be["ordered-list"],title:"Numbered List",default:!0},"check-list":{name:"check-list",action:ko,className:Be["check-list"],title:"Check List",default:!0},"clean-block":{name:"clean-block",action:So,className:Be["clean-block"],title:"Clean block"},"separator-2":{name:"separator-2"},link:{name:"link",action:Eo,className:Be.link,title:"Create Link",default:!0},image:{name:"image",action:Ao,className:Be.image,title:"Insert Image",default:!0},"upload-image":{name:"upload-image",action:yl,className:Be["upload-image"],title:"Import an image"},table:{name:"table",action:Fo,className:Be.table,title:"Insert Table"},"horizontal-rule":{name:"horizontal-rule",action:To,className:Be["horizontal-rule"],title:"Insert Horizontal Line"},"separator-3":{name:"separator-3"},preview:{name:"preview",action:Bo,className:Be.preview,noDisable:!0,title:"Toggle Preview",default:!0},"side-by-side":{name:"side-by-side",action:Ci,className:Be["side-by-side"],noDisable:!0,noMobile:!0,title:"Toggle Side by Side",default:!0},fullscreen:{name:"fullscreen",action:jr,className:Be.fullscreen,noDisable:!0,noMobile:!0,title:"Toggle Fullscreen",default:!0},"separator-4":{name:"separator-4"},guide:{name:"guide",action:"https://www.markdownguide.org/basic-syntax/",className:Be.guide,noDisable:!0,title:"Markdown Guide",default:!0},"separator-5":{name:"separator-5"},undo:{name:"undo",action:Lo,className:Be.undo,noDisable:!0,title:"Undo"},redo:{name:"redo",action:Mo,className:Be.redo,noDisable:!0,title:"Redo"}},Ip={link:["[","](#url#)"],image:["![","](#url#)"],uploadedImage:["![](#url#)",""],table:["",` +Please report this to https://github.com/markedjs/marked.`,o){var f="

    An error occurred:

    "+gt(a.message+"",!0)+"
    ";if(l)return Promise.resolve(f);if(s){s(null,f);return}return f}if(l)return Promise.reject(a);if(s){s(a);return}throw a}}function Kf(o,l){return function(s,a,f){typeof a=="function"&&(f=a,a=null);var h=_t({},a);a=_t({},fe.defaults,h);var c=bp(a.silent,a.async,f);if(typeof s>"u"||s===null)return c(new Error("marked(): input parameter is undefined or null"));if(typeof s!="string")return c(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));if(gp(a),a.hooks&&(a.hooks.options=a),f){var d=a.highlight,v;try{a.hooks&&(s=a.hooks.preprocess(s)),v=o(s,a)}catch(F){return c(F)}var y=function(B){var L;if(!B)try{a.walkTokens&&fe.walkTokens(v,a.walkTokens),L=l(v,a),a.hooks&&(L=a.hooks.postprocess(L))}catch(T){B=T}return a.highlight=d,B?c(B):f(null,L)};if(!d||d.length<3||(delete a.highlight,!v.length))return y();var x=0;fe.walkTokens(v,function(F){F.type==="code"&&(x++,setTimeout(function(){d(F.text,F.lang,function(B,L){if(B)return y(B);L!=null&&L!==F.text&&(F.text=L,F.escaped=!0),x--,x===0&&y()})},0))}),x===0&&y();return}if(a.async)return Promise.resolve(a.hooks?a.hooks.preprocess(s):s).then(function(F){return o(F,a)}).then(function(F){return a.walkTokens?Promise.all(fe.walkTokens(F,a.walkTokens)).then(function(){return F}):F}).then(function(F){return l(F,a)}).then(function(F){return a.hooks?a.hooks.postprocess(F):F}).catch(c);try{a.hooks&&(s=a.hooks.preprocess(s));var D=o(s,a);a.walkTokens&&fe.walkTokens(D,a.walkTokens);var S=l(D,a);return a.hooks&&(S=a.hooks.postprocess(S)),S}catch(F){return c(F)}}}function fe(o,l,s){return Kf(yi.lex,xi.parse)(o,l,s)}fe.options=fe.setOptions=function(o){return fe.defaults=_t({},fe.defaults,o),rp(fe.defaults),fe};fe.getDefaults=cl;fe.defaults=_e.defaults;fe.use=function(){for(var o=fe.defaults.extensions||{renderers:{},childTokens:{}},l=arguments.length,s=new Array(l),a=0;a{"use strict";var wi=At();ef();rf();af();ll();sl();bf();wf();kf();Af();Lf();al();var Ap=Nf(),pl=Yf().marked,Jf=/Mac/.test(navigator.platform),Fp=new RegExp(/()+?/g),fn={toggleBold:ho,toggleItalic:po,drawLink:Eo,toggleHeadingSmaller:cn,toggleHeadingBigger:bo,drawImage:Ao,toggleBlockquote:vo,toggleOrderedList:Do,toggleUnorderedList:Co,toggleCheckList:ko,toggleCodeBlock:mo,togglePreview:Bo,toggleStrikethrough:go,toggleHeading1:yo,toggleHeading2:xo,toggleHeading3:wo,toggleHeading4:ml,toggleHeading5:vl,toggleHeading6:bl,cleanBlock:So,drawTable:Fo,drawHorizontalRule:To,undo:Lo,redo:Mo,toggleSideBySide:Ci,toggleFullScreen:jr},Tp={toggleBold:"Cmd-B",toggleItalic:"Cmd-I",drawLink:"Cmd-K",toggleHeadingSmaller:"Cmd-H",toggleHeadingBigger:"Shift-Cmd-H",toggleHeading1:"Ctrl+Alt+1",toggleHeading2:"Ctrl+Alt+2",toggleHeading3:"Ctrl+Alt+3",toggleHeading4:"Ctrl+Alt+4",toggleHeading5:"Ctrl+Alt+5",toggleHeading6:"Ctrl+Alt+6",cleanBlock:"Cmd-E",drawImage:"Cmd-Alt-I",toggleBlockquote:"Cmd-'",toggleOrderedList:"Cmd-Alt-L",toggleUnorderedList:"Cmd-L",toggleCheckList:"Shift-Cmd-L",toggleCodeBlock:"Cmd-Alt-C",togglePreview:"Cmd-P",toggleSideBySide:"F9",toggleFullScreen:"F11"},Lp=function(o){for(var l in fn)if(fn[l]===o)return l;return null},gl=function(){var o=!1;return function(l){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(l)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(l.substr(0,4)))&&(o=!0)}(navigator.userAgent||navigator.vendor||window.opera),o};function Mp(o){for(var l;(l=Fp.exec(o))!==null;){var s=l[0];if(s.indexOf("target=")===-1){var a=s.replace(/>$/,' target="_blank">');o=o.replace(s,a)}}return o}function Bp(o){for(var l=new DOMParser,s=l.parseFromString(o,"text/html"),a=s.getElementsByTagName("li"),f=0;f0){for(var F=document.createElement("i"),B=0;B=0&&(x=c.getLineHandle(S),!s(x));S--);var N=c.getTokenAt({line:S,ch:1}),z=a(N).fencedChars,O,I,W,j;s(c.getLineHandle(d.line))?(O="",I=d.line):s(c.getLineHandle(d.line-1))?(O="",I=d.line-1):(O=z+` +`,I=d.line),s(c.getLineHandle(v.line))?(W="",j=v.line,v.ch===0&&(j+=1)):v.ch!==0&&s(c.getLineHandle(v.line+1))?(W="",j=v.line+1):(W=z+` +`,j=v.line+1),v.ch===0&&(j-=1),c.operation(function(){c.replaceRange(W,{line:j,ch:0},{line:j+(W?0:1),ch:0}),c.replaceRange(O,{line:I,ch:0},{line:I+(O?0:1),ch:0})}),c.setSelection({line:I+(O?1:0),ch:0},{line:j+(O?1:-1),ch:0}),c.focus()}else{var K=d.line;if(s(c.getLineHandle(d.line))&&(f(c,d.line+1)==="fenced"?(S=d.line,K=d.line+1):(F=d.line,K=d.line-1)),S===void 0)for(S=K;S>=0&&(x=c.getLineHandle(S),!s(x));S--);if(F===void 0)for(B=c.lineCount(),F=K;F=0;S--)if(x=c.getLineHandle(S),!x.text.match(/^\s*$/)&&f(c,S,x)!=="indented"){S+=1;break}for(B=c.lineCount(),F=d.line;F\s+/,"unordered-list":a,"ordered-list":a,"check-list":/^(\s*)(- \[[ xX]])(\s+)/},y=function(N,z){var O={quote:">","unordered-list":s,"ordered-list":"%%i.","check-list":"- [ ]"};return O[N].replace("%%i",z)},x=function(N,z){var O={quote:">","unordered-list":"\\"+s,"ordered-list":"\\d+.","check-list":"- \\[[ xX]]"},I=new RegExp(O[N]);return z&&I.test(z)},D=function(N,z,O){var I=a.exec(z),W=y(N,S);return I!==null?(x(N,I[2])&&(W=""),z=I[1]+W+I[3]+z.replace(f,"").replace(v[N],"$1")):O==!1&&(z=W+" "+z),z},S=1,F=["unordered-list","ordered-list","check-list"],B=Object.keys(h)[0];if(!F.includes(B)){var L=o.getLine(c.line);/^\s*- \[[ xX]]\s/.test(L)?B="check-list":/^\s*\d+\.\s/.test(L)?B="ordered-list":/^\s*[*\-+]\s/.test(L)&&(B="unordered-list")}for(var T=c.line;T<=d.line;T++)(function(N){var z=o.getLine(N);h[l]?z=z.replace(v[l],"$1"):F.includes(B)&&F.includes(l)?(z=z.replace(v[B],"$1"),z=D(l,z,!1),S+=1):(z=D(l,z,!1),S+=1),o.replaceRange(z,{line:N,ch:0},{line:N,ch:99999999999999})})(T);o.focus()}}function tc(o,l,s,a){if(!(!o.codemirror||o.isPreviewActive())){var f=o.codemirror,h=Sr(f),c=h[l];if(!c){Gr(f,c,s,a);return}var d=f.getCursor("start"),v=f.getCursor("end"),y=f.getLine(d.line),x=y.slice(0,d.ch),D=y.slice(d.ch);l=="link"?x=x.replace(/(.*)[^!]\[/,"$1"):l=="image"&&(x=x.replace(/(.*)!\[$/,"$1")),D=D.replace(/]\(.*?\)/,""),f.replaceRange(x+D,{line:d.line,ch:0},{line:d.line,ch:99999999999999}),d.ch-=s[0].length,d!==v&&(v.ch-=s[0].length),f.setSelection(d,v),f.focus()}}function xl(o,l,s,a){if(!(!o.codemirror||o.isPreviewActive())){a=typeof a>"u"?s:a;var f=o.codemirror,h=Sr(f),c,d=s,v=a,y=f.getCursor("start"),x=f.getCursor("end");h[l]?(c=f.getLine(y.line),d=c.slice(0,y.ch),v=c.slice(y.ch),l=="bold"?(d=d.replace(/(\*\*|__)(?![\s\S]*(\*\*|__))/,""),v=v.replace(/(\*\*|__)/,"")):l=="italic"?(d=d.replace(/(\*|_)(?![\s\S]*(\*|_))/,""),v=v.replace(/(\*|_)/,"")):l=="strikethrough"&&(d=d.replace(/(\*\*|~~)(?![\s\S]*(\*\*|~~))/,""),v=v.replace(/(\*\*|~~)/,"")),f.replaceRange(d+v,{line:y.line,ch:0},{line:y.line,ch:99999999999999}),l=="bold"||l=="strikethrough"?(y.ch-=2,y!==x&&(x.ch-=2)):l=="italic"&&(y.ch-=1,y!==x&&(x.ch-=1))):(c=f.getSelection(),l=="bold"?(c=c.split("**").join(""),c=c.split("__").join("")):l=="italic"?(c=c.split("*").join(""),c=c.split("_").join("")):l=="strikethrough"&&(c=c.split("~~").join("")),f.replaceSelection(d+c+v),y.ch+=s.length,x.ch=y.ch+c.length),f.setSelection(y,x),f.focus()}}function Op(o){if(!o.getWrapperElement().lastChild.classList.contains("editor-preview-active"))for(var l=o.getCursor("start"),s=o.getCursor("end"),a,f=l.line;f<=s.line;f++)a=o.getLine(f),a=a.replace(/^[ ]*([# ]+|\*|-|[> ]+|[0-9]+(.|\)))[ ]*/,""),o.replaceRange(a,{line:f,ch:0},{line:f,ch:99999999999999})}function co(o,l){if(Math.abs(o)<1024)return""+o+l[0];var s=0;do o/=1024,++s;while(Math.abs(o)>=1024&&s=19968?a+=s[f].length:a+=1;return a}var Be={bold:"fa fa-bold",italic:"fa fa-italic",strikethrough:"fa fa-strikethrough",heading:"fa fa-header fa-heading","heading-smaller":"fa fa-header fa-heading header-smaller","heading-bigger":"fa fa-header fa-heading header-bigger","heading-1":"fa fa-header fa-heading header-1","heading-2":"fa fa-header fa-heading header-2","heading-3":"fa fa-header fa-heading header-3",code:"fa fa-code",quote:"fa fa-quote-left","ordered-list":"fa fa-list-ol","unordered-list":"fa fa-list-ul","check-list":"fa fa-check-square-o","clean-block":"fa fa-eraser",link:"fa fa-link",image:"fa fa-image","upload-image":"fa fa-image",table:"fa fa-table","horizontal-rule":"fa fa-minus",preview:"fa fa-eye","side-by-side":"fa fa-columns",fullscreen:"fa fa-arrows-alt",guide:"fa fa-question-circle",undo:"fa fa-undo",redo:"fa fa-repeat fa-redo"},Ur={bold:{name:"bold",action:ho,className:Be.bold,title:"Bold",default:!0},italic:{name:"italic",action:po,className:Be.italic,title:"Italic",default:!0},strikethrough:{name:"strikethrough",action:go,className:Be.strikethrough,title:"Strikethrough"},heading:{name:"heading",action:cn,className:Be.heading,title:"Heading",default:!0},"heading-smaller":{name:"heading-smaller",action:cn,className:Be["heading-smaller"],title:"Smaller Heading"},"heading-bigger":{name:"heading-bigger",action:bo,className:Be["heading-bigger"],title:"Bigger Heading"},"heading-1":{name:"heading-1",action:yo,className:Be["heading-1"],title:"Big Heading"},"heading-2":{name:"heading-2",action:xo,className:Be["heading-2"],title:"Medium Heading"},"heading-3":{name:"heading-3",action:wo,className:Be["heading-3"],title:"Small Heading"},"separator-1":{name:"separator-1"},code:{name:"code",action:mo,className:Be.code,title:"Code"},quote:{name:"quote",action:vo,className:Be.quote,title:"Quote",default:!0},"unordered-list":{name:"unordered-list",action:Co,className:Be["unordered-list"],title:"Generic List",default:!0},"ordered-list":{name:"ordered-list",action:Do,className:Be["ordered-list"],title:"Numbered List",default:!0},"check-list":{name:"check-list",action:ko,className:Be["check-list"],title:"Check List",default:!0},"clean-block":{name:"clean-block",action:So,className:Be["clean-block"],title:"Clean block"},"separator-2":{name:"separator-2"},link:{name:"link",action:Eo,className:Be.link,title:"Create Link",default:!0},image:{name:"image",action:Ao,className:Be.image,title:"Insert Image",default:!0},"upload-image":{name:"upload-image",action:yl,className:Be["upload-image"],title:"Import an image"},table:{name:"table",action:Fo,className:Be.table,title:"Insert Table"},"horizontal-rule":{name:"horizontal-rule",action:To,className:Be["horizontal-rule"],title:"Insert Horizontal Line"},"separator-3":{name:"separator-3"},preview:{name:"preview",action:Bo,className:Be.preview,noDisable:!0,title:"Toggle Preview",default:!0},"side-by-side":{name:"side-by-side",action:Ci,className:Be["side-by-side"],noDisable:!0,noMobile:!0,title:"Toggle Side by Side",default:!0},fullscreen:{name:"fullscreen",action:jr,className:Be.fullscreen,noDisable:!0,noMobile:!0,title:"Toggle Fullscreen",default:!0},"separator-4":{name:"separator-4"},guide:{name:"guide",action:"https://www.markdownguide.org/basic-syntax/",className:Be.guide,noDisable:!0,title:"Markdown Guide",default:!0},"separator-5":{name:"separator-5"},undo:{name:"undo",action:Lo,className:Be.undo,noDisable:!0,title:"Undo"},redo:{name:"redo",action:Mo,className:Be.redo,noDisable:!0,title:"Redo"}},Ip={link:["[","](#url#)"],image:["![","](#url#)"],uploadedImage:["![](#url#)",""],table:["",` | Column 1 | Column 2 | Column 3 | | -------- | -------- | -------- | @@ -92,7 +92,7 @@ Please report this to https://github.com/markedjs/marked.`,o){var f="

    An error ----- `]},Hp={link:"URL for the link:",image:"URL of the image:"},Pp={locale:"en-US",format:{hour:"2-digit",minute:"2-digit"}},qp={bold:"**",code:"```",italic:"*"},Rp={sbInit:"Attach files by drag and dropping or pasting from clipboard.",sbOnDragEnter:"Drop image to upload it.",sbOnDrop:"Uploading image #images_names#...",sbProgress:"Uploading #file_name#: #progress#%",sbOnUploaded:"Uploaded #image_name#",sizeUnits:" B, KB, MB"},Wp={noFileGiven:"You must select a file.",typeNotAllowed:"This image type is not allowed.",fileTooLarge:`Image #image_name# is too big (#image_size#). -Maximum file size is #image_max_size#.`,importError:"Something went wrong when uploading the image #image_name#."};function re(o){o=o||{},o.parent=this;var l=!0;if(o.autoDownloadFontAwesome===!1&&(l=!1),o.autoDownloadFontAwesome!==!0)for(var s=document.styleSheets,a=0;a-1&&(l=!1);if(l){var f=document.createElement("link");f.rel="stylesheet",f.href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css",document.getElementsByTagName("head")[0].appendChild(f)}if(o.element)this.element=o.element;else if(o.element===null){console.log("EasyMDE: Error. No element was found.");return}if(o.toolbar===void 0){o.toolbar=[];for(var h in Ur)Object.prototype.hasOwnProperty.call(Ur,h)&&(h.indexOf("separator-")!=-1&&o.toolbar.push("|"),(Ur[h].default===!0||o.showIcons&&o.showIcons.constructor===Array&&o.showIcons.indexOf(h)!=-1)&&o.toolbar.push(h))}if(Object.prototype.hasOwnProperty.call(o,"previewClass")||(o.previewClass="editor-preview"),Object.prototype.hasOwnProperty.call(o,"status")||(o.status=["autosave","lines","words","cursor"],o.uploadImage&&o.status.unshift("upload-image")),o.previewRender||(o.previewRender=function(d){return this.parent.markdown(d)}),o.parsingConfig=sr({highlightFormatting:!0},o.parsingConfig||{}),o.insertTexts=sr({},Ip,o.insertTexts||{}),o.promptTexts=sr({},Hp,o.promptTexts||{}),o.blockStyles=sr({},qp,o.blockStyles||{}),o.autosave!=null&&(o.autosave.timeFormat=sr({},Pp,o.autosave.timeFormat||{})),o.iconClassMap=sr({},Be,o.iconClassMap||{}),o.shortcuts=sr({},Tp,o.shortcuts||{}),o.maxHeight=o.maxHeight||void 0,o.direction=o.direction||"ltr",typeof o.maxHeight<"u"?o.minHeight=o.maxHeight:o.minHeight=o.minHeight||"300px",o.errorCallback=o.errorCallback||function(d){alert(d)},o.uploadImage=o.uploadImage||!1,o.imageMaxSize=o.imageMaxSize||2097152,o.imageAccept=o.imageAccept||"image/png, image/jpeg, image/gif, image/avif",o.imageTexts=sr({},Rp,o.imageTexts||{}),o.errorMessages=sr({},Wp,o.errorMessages||{}),o.imagePathAbsolute=o.imagePathAbsolute||!1,o.imageCSRFName=o.imageCSRFName||"csrfmiddlewaretoken",o.imageCSRFHeader=o.imageCSRFHeader||!1,o.imageInputName=o.imageInputName||"image",o.autosave!=null&&o.autosave.unique_id!=null&&o.autosave.unique_id!=""&&(o.autosave.uniqueId=o.autosave.unique_id),o.overlayMode&&o.overlayMode.combine===void 0&&(o.overlayMode.combine=!0),this.options=o,this.render(),o.initialValue&&(!this.options.autosave||this.options.autosave.foundSavedValue!==!0)&&this.value(o.initialValue),o.uploadImage){var c=this;this.codemirror.on("dragenter",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbOnDragEnter),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("dragend",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbInit),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("dragleave",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbInit),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("dragover",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbOnDragEnter),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("drop",function(d,v){v.stopPropagation(),v.preventDefault(),o.imageUploadFunction?c.uploadImagesUsingCustomFunction(o.imageUploadFunction,v.dataTransfer.files):c.uploadImages(v.dataTransfer.files)}),this.codemirror.on("paste",function(d,v){o.imageUploadFunction?c.uploadImagesUsingCustomFunction(o.imageUploadFunction,v.clipboardData.files):c.uploadImages(v.clipboardData.files)})}}re.prototype.uploadImages=function(o,l,s){if(o.length!==0){for(var a=[],f=0;f=2){var O=z[1];if(l.imagesPreviewHandler){var I=l.imagesPreviewHandler(z[1]);typeof I=="string"&&(O=I)}if(window.EMDEimagesCache[O])F(N,window.EMDEimagesCache[O]);else{window.EMDEimagesCache[O]={};var R=document.createElement("img");R.onload=function(){window.EMDEimagesCache[O]={naturalWidth:R.naturalWidth,naturalHeight:R.naturalHeight,url:O},F(N,window.EMDEimagesCache[O])},R.src=O}}}})}this.codemirror.on("update",function(){B()}),this.gui.sideBySide=this.createSideBySide(),this._rendered=this.element,(l.autofocus===!0||o.autofocus)&&this.codemirror.focus();var L=this.codemirror;setTimeout(function(){L.refresh()}.bind(L),0)};re.prototype.cleanup=function(){document.removeEventListener("keydown",this.documentOnKeyDown)};function rc(){if(typeof localStorage=="object")try{localStorage.setItem("smde_localStorage",1),localStorage.removeItem("smde_localStorage")}catch{return!1}else return!1;return!0}re.prototype.autosave=function(){if(rc()){var o=this;if(this.options.autosave.uniqueId==null||this.options.autosave.uniqueId==""){console.log("EasyMDE: You must set a uniqueId to use the autosave feature");return}this.options.autosave.binded!==!0&&(o.element.form!=null&&o.element.form!=null&&o.element.form.addEventListener("submit",function(){clearTimeout(o.autosaveTimeoutId),o.autosaveTimeoutId=void 0,localStorage.removeItem("smde_"+o.options.autosave.uniqueId)}),this.options.autosave.binded=!0),this.options.autosave.loaded!==!0&&(typeof localStorage.getItem("smde_"+this.options.autosave.uniqueId)=="string"&&localStorage.getItem("smde_"+this.options.autosave.uniqueId)!=""&&(this.codemirror.setValue(localStorage.getItem("smde_"+this.options.autosave.uniqueId)),this.options.autosave.foundSavedValue=!0),this.options.autosave.loaded=!0);var l=o.value();l!==""?localStorage.setItem("smde_"+this.options.autosave.uniqueId,l):localStorage.removeItem("smde_"+this.options.autosave.uniqueId);var s=document.getElementById("autosaved");if(s!=null&&s!=null&&s!=""){var a=new Date,f=new Intl.DateTimeFormat([this.options.autosave.timeFormat.locale,"en-US"],this.options.autosave.timeFormat.format).format(a),h=this.options.autosave.text==null?"Autosaved: ":this.options.autosave.text;s.innerHTML=h+f}}else console.log("EasyMDE: localStorage not available, cannot autosave")};re.prototype.clearAutosavedValue=function(){if(rc()){if(this.options.autosave==null||this.options.autosave.uniqueId==null||this.options.autosave.uniqueId==""){console.log("EasyMDE: You must set a uniqueId to clear the autosave value");return}localStorage.removeItem("smde_"+this.options.autosave.uniqueId)}else console.log("EasyMDE: localStorage not available, cannot autosave")};re.prototype.openBrowseFileWindow=function(o,l){var s=this,a=this.gui.toolbar.getElementsByClassName("imageInput")[0];a.click();function f(h){s.options.imageUploadFunction?s.uploadImagesUsingCustomFunction(s.options.imageUploadFunction,h.target.files):s.uploadImages(h.target.files,o,l),a.removeEventListener("change",f)}a.addEventListener("change",f)};re.prototype.uploadImage=function(o,l,s){var a=this;l=l||function(y){$f(a,y)};function f(v){a.updateStatusBar("upload-image",v),setTimeout(function(){a.updateStatusBar("upload-image",a.options.imageTexts.sbInit)},1e4),s&&typeof s=="function"&&s(v),a.options.errorCallback(v)}function h(v){var y=a.options.imageTexts.sizeUnits.split(",");return v.replace("#image_name#",o.name).replace("#image_size#",co(o.size,y)).replace("#image_max_size#",co(a.options.imageMaxSize,y))}if(o.size>this.options.imageMaxSize){f(h(this.options.errorMessages.fileTooLarge));return}var c=new FormData;c.append("image",o),a.options.imageCSRFToken&&!a.options.imageCSRFHeader&&c.append(a.options.imageCSRFName,a.options.imageCSRFToken);var d=new XMLHttpRequest;d.upload.onprogress=function(v){if(v.lengthComputable){var y=""+Math.round(v.loaded*100/v.total);a.updateStatusBar("upload-image",a.options.imageTexts.sbProgress.replace("#file_name#",o.name).replace("#progress#",y))}},d.open("POST",this.options.imageUploadEndpoint),a.options.imageCSRFToken&&a.options.imageCSRFHeader&&d.setRequestHeader(a.options.imageCSRFName,a.options.imageCSRFToken),d.onload=function(){try{var v=JSON.parse(this.responseText)}catch{console.error("EasyMDE: The server did not return a valid json."),f(h(a.options.errorMessages.importError));return}this.status===200&&v&&!v.error&&v.data&&v.data.filePath?l((a.options.imagePathAbsolute?"":window.location.origin+"/")+v.data.filePath):v.error&&v.error in a.options.errorMessages?f(h(a.options.errorMessages[v.error])):v.error?f(h(v.error)):(console.error("EasyMDE: Received an unexpected response after uploading the image."+this.status+" ("+this.statusText+")"),f(h(a.options.errorMessages.importError)))},d.onerror=function(v){console.error("EasyMDE: An unexpected error occurred when trying to upload the image."+v.target.status+" ("+v.target.statusText+")"),f(a.options.errorMessages.importError)},d.send(c)};re.prototype.uploadImageUsingCustomFunction=function(o,l){var s=this;function a(c){$f(s,c)}function f(c){var d=h(c);s.updateStatusBar("upload-image",d),setTimeout(function(){s.updateStatusBar("upload-image",s.options.imageTexts.sbInit)},1e4),s.options.errorCallback(d)}function h(c){var d=s.options.imageTexts.sizeUnits.split(",");return c.replace("#image_name#",l.name).replace("#image_size#",co(l.size,d)).replace("#image_max_size#",co(s.options.imageMaxSize,d))}o.apply(this,[l,a,f])};re.prototype.setPreviewMaxHeight=function(){var o=this.codemirror,l=o.getWrapperElement(),s=l.nextSibling,a=parseInt(window.getComputedStyle(l).paddingTop),f=parseInt(window.getComputedStyle(l).borderTopWidth),h=parseInt(this.options.maxHeight),c=h+a*2+f*2,d=c.toString()+"px";s.style.height=d};re.prototype.createSideBySide=function(){var o=this.codemirror,l=o.getWrapperElement(),s=l.nextSibling;if(!s||!s.classList.contains("editor-preview-side")){if(s=document.createElement("div"),s.className="editor-preview-side",this.options.previewClass)if(Array.isArray(this.options.previewClass))for(var a=0;a"&&(l=l.substring(1)),o)try{if(o.matches)return o.matches(l);if(o.msMatchesSelector)return o.msMatchesSelector(l);if(o.webkitMatchesSelector)return o.webkitMatchesSelector(l)}catch{return!1}return!1}}function mc(o){return o.host&&o!==document&&o.host.nodeType&&o.host!==o?o.host:o.parentNode}function Gt(o,l,s,a){if(o){s=s||document;do{if(l!=null&&(l[0]===">"?o.parentNode===s&&Wo(o,l):Wo(o,l))||a&&o===s)return o;if(o===s)break}while(o=mc(o))}return null}var lc=/\s+/g;function zt(o,l,s){if(o&&l)if(o.classList)o.classList[s?"add":"remove"](l);else{var a=(" "+o.className+" ").replace(lc," ").replace(" "+l+" "," ");o.className=(a+(s?" "+l:"")).replace(lc," ")}}function pe(o,l,s){var a=o&&o.style;if(a){if(s===void 0)return document.defaultView&&document.defaultView.getComputedStyle?s=document.defaultView.getComputedStyle(o,""):o.currentStyle&&(s=o.currentStyle),l===void 0?s:s[l];!(l in a)&&l.indexOf("webkit")===-1&&(l="-webkit-"+l),a[l]=s+(typeof s=="string"?"":"px")}}function Ai(o,l){var s="";if(typeof o=="string")s=o;else do{var a=pe(o,"transform");a&&a!=="none"&&(s=a+" "+s)}while(!l&&(o=o.parentNode));var f=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return f&&new f(s)}function vc(o,l,s){if(o){var a=o.getElementsByTagName(l),f=0,h=a.length;if(s)for(;f=h:c=f<=h,!c)return a;if(a===$t())break;a=Tr(a,!1)}return!1}function Fi(o,l,s,a){for(var f=0,h=0,c=o.children;h2&&arguments[2]!==void 0?arguments[2]:{},f=a.evt,h=jp(a,r0);wn.pluginEvent.bind(ge)(l,s,er({dragEl:$,parentEl:Ue,ghostEl:xe,rootEl:He,nextEl:Yr,lastDownEl:Ho,cloneEl:Re,cloneHidden:Fr,dragStarted:dn,putSortable:ut,activeSortable:ge.active,originalEvent:f,oldIndex:Ei,oldDraggableIndex:vn,newIndex:Nt,newDraggableIndex:Ar,hideGhostForTarget:Sc,unhideGhostForTarget:Ec,cloneNowHidden:function(){Fr=!0},cloneNowShown:function(){Fr=!1},dispatchSortableEvent:function(d){kt({sortable:s,name:d,originalEvent:f})}},h))};function kt(o){t0(er({putSortable:ut,cloneEl:Re,targetEl:$,rootEl:He,oldIndex:Ei,oldDraggableIndex:vn,newIndex:Nt,newDraggableIndex:Ar},o))}var $,Ue,xe,He,Yr,Ho,Re,Fr,Ei,Nt,vn,Ar,zo,ut,Si=!1,Uo=!1,jo=[],Xr,jt,Dl,kl,fc,cc,dn,ki,bn,yn=!1,No=!1,Po,gt,Sl=[],Ml=!1,Go=[],Ko=typeof document<"u",Oo=Nl,dc=xn||cr?"cssFloat":"float",i0=Ko&&!pc&&!Nl&&"draggable"in document.createElement("div"),Cc=function(){if(Ko){if(cr)return!1;var o=document.createElement("x");return o.style.cssText="pointer-events:auto",o.style.pointerEvents==="auto"}}(),Dc=function(l,s){var a=pe(l),f=parseInt(a.width)-parseInt(a.paddingLeft)-parseInt(a.paddingRight)-parseInt(a.borderLeftWidth)-parseInt(a.borderRightWidth),h=Fi(l,0,s),c=Fi(l,1,s),d=h&&pe(h),v=c&&pe(c),y=d&&parseInt(d.marginLeft)+parseInt(d.marginRight)+Ve(h).width,x=v&&parseInt(v.marginLeft)+parseInt(v.marginRight)+Ve(c).width;if(a.display==="flex")return a.flexDirection==="column"||a.flexDirection==="column-reverse"?"vertical":"horizontal";if(a.display==="grid")return a.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(h&&d.float&&d.float!=="none"){var D=d.float==="left"?"left":"right";return c&&(v.clear==="both"||v.clear===D)?"vertical":"horizontal"}return h&&(d.display==="block"||d.display==="flex"||d.display==="table"||d.display==="grid"||y>=f&&a[dc]==="none"||c&&a[dc]==="none"&&y+x>f)?"vertical":"horizontal"},n0=function(l,s,a){var f=a?l.left:l.top,h=a?l.right:l.bottom,c=a?l.width:l.height,d=a?s.left:s.top,v=a?s.right:s.bottom,y=a?s.width:s.height;return f===d||h===v||f+c/2===d+y/2},o0=function(l,s){var a;return jo.some(function(f){var h=f[Tt].options.emptyInsertThreshold;if(!(!h||Ol(f))){var c=Ve(f),d=l>=c.left-h&&l<=c.right+h,v=s>=c.top-h&&s<=c.bottom+h;if(d&&v)return a=f}}),a},kc=function(l){function s(h,c){return function(d,v,y,x){var D=d.options.group.name&&v.options.group.name&&d.options.group.name===v.options.group.name;if(h==null&&(c||D))return!0;if(h==null||h===!1)return!1;if(c&&h==="clone")return h;if(typeof h=="function")return s(h(d,v,y,x),c)(d,v,y,x);var k=(c?d:v).options.group.name;return h===!0||typeof h=="string"&&h===k||h.join&&h.indexOf(k)>-1}}var a={},f=l.group;(!f||Ll(f)!="object")&&(f={name:f}),a.name=f.name,a.checkPull=s(f.pull,!0),a.checkPut=s(f.put),a.revertClone=f.revertClone,l.group=a},Sc=function(){!Cc&&xe&&pe(xe,"display","none")},Ec=function(){!Cc&&xe&&pe(xe,"display","")};Ko&&!pc&&document.addEventListener("click",function(o){if(Uo)return o.preventDefault(),o.stopPropagation&&o.stopPropagation(),o.stopImmediatePropagation&&o.stopImmediatePropagation(),Uo=!1,!1},!0);var Kr=function(l){if($){l=l.touches?l.touches[0]:l;var s=o0(l.clientX,l.clientY);if(s){var a={};for(var f in l)l.hasOwnProperty(f)&&(a[f]=l[f]);a.target=a.rootEl=s,a.preventDefault=void 0,a.stopPropagation=void 0,s[Tt]._onDragOver(a)}}},a0=function(l){$&&$.parentNode[Tt]._isOutsideThisEl(l.target)};function ge(o,l){if(!(o&&o.nodeType&&o.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(o));this.el=o,this.options=l=fr({},l),o[Tt]=this;var s={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(o.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Dc(o,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(c,d){c.setData("Text",d.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:ge.supportPointer!==!1&&"PointerEvent"in window&&(!gn||Nl),emptyInsertThreshold:5};wn.initializePlugins(this,o,s);for(var a in s)!(a in l)&&(l[a]=s[a]);kc(l);for(var f in this)f.charAt(0)==="_"&&typeof this[f]=="function"&&(this[f]=this[f].bind(this));this.nativeDraggable=l.forceFallback?!1:i0,this.nativeDraggable&&(this.options.touchStartThreshold=1),l.supportPointer?Se(o,"pointerdown",this._onTapStart):(Se(o,"mousedown",this._onTapStart),Se(o,"touchstart",this._onTapStart)),this.nativeDraggable&&(Se(o,"dragover",this),Se(o,"dragenter",this)),jo.push(this.el),l.store&&l.store.get&&this.sort(l.store.get(this)||[]),fr(this,Vp())}ge.prototype={constructor:ge,_isOutsideThisEl:function(l){!this.el.contains(l)&&l!==this.el&&(ki=null)},_getDirection:function(l,s){return typeof this.options.direction=="function"?this.options.direction.call(this,l,s,$):this.options.direction},_onTapStart:function(l){if(l.cancelable){var s=this,a=this.el,f=this.options,h=f.preventOnFilter,c=l.type,d=l.touches&&l.touches[0]||l.pointerType&&l.pointerType==="touch"&&l,v=(d||l).target,y=l.target.shadowRoot&&(l.path&&l.path[0]||l.composedPath&&l.composedPath()[0])||v,x=f.filter;if(p0(a),!$&&!(/mousedown|pointerdown/.test(c)&&l.button!==0||f.disabled)&&!y.isContentEditable&&!(!this.nativeDraggable&&gn&&v&&v.tagName.toUpperCase()==="SELECT")&&(v=Gt(v,f.draggable,a,!1),!(v&&v.animated)&&Ho!==v)){if(Ei=It(v),vn=It(v,f.draggable),typeof x=="function"){if(x.call(this,l,v,this)){kt({sortable:s,rootEl:y,name:"filter",targetEl:v,toEl:a,fromEl:a}),Ft("filter",s,{evt:l}),h&&l.preventDefault();return}}else if(x&&(x=x.split(",").some(function(D){if(D=Gt(y,D.trim(),a,!1),D)return kt({sortable:s,rootEl:D,name:"filter",targetEl:v,fromEl:a,toEl:a}),Ft("filter",s,{evt:l}),!0}),x)){h&&l.preventDefault();return}f.handle&&!Gt(y,f.handle,a,!1)||this._prepareDragStart(l,d,v)}}},_prepareDragStart:function(l,s,a){var f=this,h=f.el,c=f.options,d=h.ownerDocument,v;if(a&&!$&&a.parentNode===h){var y=Ve(a);if(He=h,$=a,Ue=$.parentNode,Yr=$.nextSibling,Ho=a,zo=c.group,ge.dragged=$,Xr={target:$,clientX:(s||l).clientX,clientY:(s||l).clientY},fc=Xr.clientX-y.left,cc=Xr.clientY-y.top,this._lastX=(s||l).clientX,this._lastY=(s||l).clientY,$.style["will-change"]="all",v=function(){if(Ft("delayEnded",f,{evt:l}),ge.eventCanceled){f._onDrop();return}f._disableDelayedDragEvents(),!ac&&f.nativeDraggable&&($.draggable=!0),f._triggerDragStart(l,s),kt({sortable:f,name:"choose",originalEvent:l}),zt($,c.chosenClass,!0)},c.ignore.split(",").forEach(function(x){vc($,x.trim(),El)}),Se(d,"dragover",Kr),Se(d,"mousemove",Kr),Se(d,"touchmove",Kr),c.supportPointer?(Se(d,"pointerup",f._onDrop),!this.nativeDraggable&&Se(d,"pointercancel",f._onDrop)):(Se(d,"mouseup",f._onDrop),Se(d,"touchend",f._onDrop),Se(d,"touchcancel",f._onDrop)),ac&&this.nativeDraggable&&(this.options.touchStartThreshold=4,$.draggable=!0),Ft("delayStart",this,{evt:l}),c.delay&&(!c.delayOnTouchOnly||s)&&(!this.nativeDraggable||!(xn||cr))){if(ge.eventCanceled){this._onDrop();return}c.supportPointer?(Se(d,"pointerup",f._disableDelayedDrag),Se(d,"pointercancel",f._disableDelayedDrag)):(Se(d,"mouseup",f._disableDelayedDrag),Se(d,"touchend",f._disableDelayedDrag),Se(d,"touchcancel",f._disableDelayedDrag)),Se(d,"mousemove",f._delayedDragTouchMoveHandler),Se(d,"touchmove",f._delayedDragTouchMoveHandler),c.supportPointer&&Se(d,"pointermove",f._delayedDragTouchMoveHandler),f._dragStartTimer=setTimeout(v,c.delay)}else v()}},_delayedDragTouchMoveHandler:function(l){var s=l.touches?l.touches[0]:l;Math.max(Math.abs(s.clientX-this._lastX),Math.abs(s.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){$&&El($),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var l=this.el.ownerDocument;ke(l,"mouseup",this._disableDelayedDrag),ke(l,"touchend",this._disableDelayedDrag),ke(l,"touchcancel",this._disableDelayedDrag),ke(l,"pointerup",this._disableDelayedDrag),ke(l,"pointercancel",this._disableDelayedDrag),ke(l,"mousemove",this._delayedDragTouchMoveHandler),ke(l,"touchmove",this._delayedDragTouchMoveHandler),ke(l,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(l,s){s=s||l.pointerType=="touch"&&l,!this.nativeDraggable||s?this.options.supportPointer?Se(document,"pointermove",this._onTouchMove):s?Se(document,"touchmove",this._onTouchMove):Se(document,"mousemove",this._onTouchMove):(Se($,"dragend",this),Se(He,"dragstart",this._onDragStart));try{document.selection?qo(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(l,s){if(Si=!1,He&&$){Ft("dragStarted",this,{evt:s}),this.nativeDraggable&&Se(document,"dragover",a0);var a=this.options;!l&&zt($,a.dragClass,!1),zt($,a.ghostClass,!0),ge.active=this,l&&this._appendGhost(),kt({sortable:this,name:"start",originalEvent:s})}else this._nulling()},_emulateDragOver:function(){if(jt){this._lastX=jt.clientX,this._lastY=jt.clientY,Sc();for(var l=document.elementFromPoint(jt.clientX,jt.clientY),s=l;l&&l.shadowRoot&&(l=l.shadowRoot.elementFromPoint(jt.clientX,jt.clientY),l!==s);)s=l;if($.parentNode[Tt]._isOutsideThisEl(l),s)do{if(s[Tt]){var a=void 0;if(a=s[Tt]._onDragOver({clientX:jt.clientX,clientY:jt.clientY,target:l,rootEl:s}),a&&!this.options.dragoverBubble)break}l=s}while(s=mc(s));Ec()}},_onTouchMove:function(l){if(Xr){var s=this.options,a=s.fallbackTolerance,f=s.fallbackOffset,h=l.touches?l.touches[0]:l,c=xe&&Ai(xe,!0),d=xe&&c&&c.a,v=xe&&c&&c.d,y=Oo&>&&uc(gt),x=(h.clientX-Xr.clientX+f.x)/(d||1)+(y?y[0]-Sl[0]:0)/(d||1),D=(h.clientY-Xr.clientY+f.y)/(v||1)+(y?y[1]-Sl[1]:0)/(v||1);if(!ge.active&&!Si){if(a&&Math.max(Math.abs(h.clientX-this._lastX),Math.abs(h.clientY-this._lastY))=0&&(kt({rootEl:Ue,name:"add",toEl:Ue,fromEl:He,originalEvent:l}),kt({sortable:this,name:"remove",toEl:Ue,originalEvent:l}),kt({rootEl:Ue,name:"sort",toEl:Ue,fromEl:He,originalEvent:l}),kt({sortable:this,name:"sort",toEl:Ue,originalEvent:l})),ut&&ut.save()):Nt!==Ei&&Nt>=0&&(kt({sortable:this,name:"update",toEl:Ue,originalEvent:l}),kt({sortable:this,name:"sort",toEl:Ue,originalEvent:l})),ge.active&&((Nt==null||Nt===-1)&&(Nt=Ei,Ar=vn),kt({sortable:this,name:"end",toEl:Ue,originalEvent:l}),this.save()))),this._nulling()},_nulling:function(){Ft("nulling",this),He=$=Ue=xe=Yr=Re=Ho=Fr=Xr=jt=dn=Nt=Ar=Ei=vn=ki=bn=ut=zo=ge.dragged=ge.ghost=ge.clone=ge.active=null;var l=this.el;Go.forEach(function(s){l.contains(s)&&(s.checked=!0)}),Go.length=Dl=kl=0},handleEvent:function(l){switch(l.type){case"drop":case"dragend":this._onDrop(l);break;case"dragenter":case"dragover":$&&(this._onDragOver(l),l0(l));break;case"selectstart":l.preventDefault();break}},toArray:function(){for(var l=[],s,a=this.el.children,f=0,h=a.length,c=this.options;ff.right+h||o.clientY>a.bottom&&o.clientX>a.left:o.clientY>f.bottom+h||o.clientX>a.right&&o.clientY>a.top}function c0(o,l,s,a,f,h,c,d){var v=a?o.clientY:o.clientX,y=a?s.height:s.width,x=a?s.top:s.left,D=a?s.bottom:s.right,k=!1;if(!c){if(d&&Pox+y*h/2:vD-Po)return-bn}else if(v>x+y*(1-f)/2&&vD-y*h/2)?v>x+y/2?1:-1:0}function d0(o){return It($)0||D>0&&k0?"Converting "+l+" photo"+(l>1?"s":"")+"\u2026":"Uploading "+D+" photo"+(D>1?"s":"")+"\u2026",s.details.open=!0):D>0?(s.summary.textContent="\u2713 "+D+" photo"+(D>1?"s":"")+" ready \u2014 tap to review",s.details.open=!1):(s.summary.textContent="Photos (1\u20136)",s.details.open=!0)}}function c(){h(),setTimeout(h,150),setTimeout(h,500)}function d(){var x=o.querySelector('button[type="submit"], input[type="submit"]');if(x&&(x.disabled=l>0),l>0)f("Converting "+l+" photo"+(l>1?"s":"")+"\u2026");else{var D=Mc();D&&/Converting/.test(D.textContent)&&f("")}h()}o.addEventListener("submit",function(x){l>0&&(x.preventDefault(),f("Hang on \u2014 a photo is still converting.","err"))},!0);function v(x){return function(D){var k=D&&D.file;return k?Ic(k).then(function(F){return F?(l++,d(),import("./heic-to-CN7JBE7H.js").then(function(B){var L=B.heicTo||B.default&&B.default.heicTo;return L({blob:k,type:"image/jpeg",quality:.85})}).then(function(B){var L=new File([B],y0(k.name),{type:"image/jpeg"});x.addFile(L)}).catch(function(){f("A photo couldn\u2019t be converted and was skipped \u2014 the others are fine.","err")}).then(function(){l--,d()}),!1):!0}):!0}}var y=0;(function x(){var D=window.GravFilePond&&window.GravFilePond.getInstances?window.GravFilePond.getInstances():[];if(!D.length){y++<120&&setTimeout(x,50);return}D.forEach(function(k){k&&!k._heicHooked&&(k._heicHooked=!0,k.setOptions({beforeAddFile:v(k),allowReorder:!0,itemInsertLocation:"after"}),a=k,["addfile","processfile","processfiles","removefile","error"].forEach(function(F){try{k.on(F,c)}catch{}}),h())})})()}function ft(o){return document.querySelector('[name="data['+o+']"]')}function C0(){var o=Array.prototype.slice.call(document.querySelectorAll(".advanced-field"));if(o.length){var l=[];if(o.forEach(function(h){var c=h.closest(".form-field");c&&l.indexOf(c)===-1&&l.push(c)}),!!l.length){var s=document.createElement("details");s.className="more-options";var a=document.createElement("summary");a.className="more-options__summary",a.textContent="More options",s.appendChild(a),l[0].parentNode.insertBefore(s,l[0]),l.forEach(function(h){s.appendChild(h)});var f=l.some(function(h){var c=h.querySelector('input[type="text"]');if(c&&c.value.trim())return!0;var d=h.querySelector('input[type="radio"]:checked');if(!d||!d.value)return!1;var v=h.querySelector('input[type="radio"][checked]');return v?d.value!==v.value:d.value!=="0"});f&&(s.open=!0)}}}var D0={0:"Sunny",1:"Partly cloudy",2:"Partly cloudy",3:"Cloudy",45:"Foggy",48:"Foggy",51:"Drizzle",53:"Drizzle",55:"Drizzle",56:"Drizzle",57:"Drizzle",61:"Rain",63:"Rain",65:"Rain",66:"Rain",67:"Rain",80:"Rain",81:"Rain",82:"Rain",71:"Snow",73:"Snow",75:"Snow",77:"Snow",85:"Snow",86:"Snow",95:"Thunderstorm",96:"Thunderstorm",99:"Thunderstorm"};function dr(o,l,s){o&&(o.className="form-status"+(s?" form-status--"+s:""),o.textContent=l||"")}function k0(){var o=document.getElementById("get-location"),l=document.getElementById("get-weather");if(!o&&!l)return;var s=document.getElementById("location-status"),a=document.getElementById("weather-status");function f(){var d=ft("lat"),v=ft("lng"),y=d?d.value.trim():"",x=v?v.value.trim():"";return y&&x?{lat:y,lng:x}:null}function h(){if(l){var d=!!f();l.disabled=!d,l.title=d?"":"Get location first"}}h();function c(d,v){var y=ft("location_city"),x=ft("location_country");if(!((!y||y.value.trim())&&(!x||x.value.trim()))){var D="https://api.bigdatacloud.net/data/reverse-geocode-client?latitude="+encodeURIComponent(d)+"&longitude="+encodeURIComponent(v)+"&localityLanguage=en";fetch(D).then(function(k){return k.json()}).then(function(k){var F=(k.city||k.locality||"").trim(),B=(k.countryName||"").trim();y&&!y.value.trim()&&F&&(y.value=F),x&&!x.value.trim()&&B&&(x.value=B);var L=[F,B].filter(Boolean).join(", ");L&&dr(s,"\u2713 Location captured \xB7 "+L,"ok")}).catch(function(){})}}o&&o.addEventListener("click",function(){if(!navigator.geolocation){dr(s,"Geolocation is not supported on this device.","err");return}o.classList.add("is-loading"),o.disabled=!0,dr(s,"Getting location\u2026"),navigator.geolocation.getCurrentPosition(function(d){var v=d.coords.latitude.toFixed(6),y=d.coords.longitude.toFixed(6),x=ft("lat"),D=ft("lng");x&&(x.value=v),D&&(D.value=y),o.classList.remove("is-loading"),o.disabled=!1,dr(s,"\u2713 Location captured \xB7 "+v+", "+y,"ok"),h(),c(v,y);var k=document.querySelector(".location-details");k&&k.open&&Hc()},function(d){o.classList.remove("is-loading"),o.disabled=!1,dr(s,"\u2717 "+(d&&d.message?d.message:"Could not get location")+" \u2014 enter coordinates manually if needed.","err")},{enableHighAccuracy:!0,timeout:15e3})}),l&&l.addEventListener("click",function(){var d=f();if(!d){dr(a,"Get location first, then fetch weather.","err");return}l.classList.add("is-loading"),l.disabled=!0,dr(a,"Fetching weather\u2026");var v="https://api.open-meteo.com/v1/forecast?latitude="+d.lat+"&longitude="+d.lng+"¤t=temperature_2m,weather_code&temperature_unit=celsius";fetch(v).then(function(y){return y.json()}).then(function(y){var x=Math.round(y.current.temperature_2m),D=D0[y.current.weather_code]||"Cloudy",k=ft("weather_temp_c"),F=ft("weather_desc");k&&(k.value=x),F&&(F.value=D),l.classList.remove("is-loading"),h(),dr(a,"\u2713 Weather set \xB7 "+D+" \xB7 "+x+"\xB0C (edit above if needed)","ok")}).catch(function(){l.classList.remove("is-loading"),h(),dr(a,"\u2717 Could not fetch weather \u2014 set it manually above.","err")})})}var Hc=function(){};function S0(o,l){var s=null;return function(){var a=arguments;clearTimeout(s),s=setTimeout(function(){o.apply(null,a)},l)}}function E0(o){return[o.name,o.admin1,o.country].filter(Boolean).join(", ")}function A0(){var o=ft("lat"),l=ft("lng");if(!o||!l)return;var s=o.closest(".form-field"),a=l.closest(".form-field");if(!s||!a)return;var f=ft("location_city"),h=ft("location_country"),c=h?h.closest(".form-field"):null,d=c||s,v=document.createElement("details");v.className="location-details";var y=document.createElement("summary");y.className="location-details__summary",y.textContent="More location details",v.appendChild(y);var x=document.createElement("div");x.className="location-details__body";var D=document.createElement("div");D.className="location-search-row";var k=document.createElement("button");k.type="button",k.id="lookup-coords",k.className="btn-action";var F="\u{1F50D} Look up coordinates";k.textContent=F,D.appendChild(k),x.appendChild(D);var B=document.createElement("p");B.id="location-search-hint",B.className="location-search-hint",B.setAttribute("role","status"),x.appendChild(B);var L=document.createElement("ul");L.id="location-search-results",L.className="location-search-results",x.appendChild(L);var T=document.createElement("div");T.id="location-map",T.className="location-map",x.appendChild(T),v.appendChild(x),d.parentNode.insertBefore(v,d.nextSibling),v.appendChild(s),v.appendChild(a);function N(H){return H===o?"location-lat-note":"location-lng-note"}function z(){[o,l].forEach(function(H){H.classList.add("location-field--mismatch"),H.setAttribute("aria-invalid","true");var Y=N(H),E=document.getElementById(Y);E||(E=document.createElement("span"),E.id=Y,E.className="location-field-note",E.setAttribute("role","status"),E.setAttribute("aria-live","polite"),E.textContent="Not reflected on the map yet.",H.parentNode.insertBefore(E,H.nextSibling)),H.setAttribute("aria-describedby",Y)})}function O(){[o,l].forEach(function(H){H.classList.remove("location-field--mismatch"),H.removeAttribute("aria-invalid"),H.removeAttribute("aria-describedby");var Y=document.getElementById(N(H));Y&&Y.parentNode&&Y.parentNode.removeChild(Y)})}var I=null;function R(){var H=parseFloat(o.value),Y=parseFloat(l.value),E=isFinite(H)&&isFinite(Y)&&H>=-90&&H<=90&&Y>=-180&&Y<=180;E?(O(),I&&I.setPin(H,Y)):o.value.trim()||l.value.trim()?z():O()}Hc=R;function G(H){o.value=H.lat.toFixed(6),l.value=H.lng.toFixed(6),O()}v.addEventListener("toggle",function(){v.open&&Lc(T,G).then(function(H){I=H,H.resize(),R()}).catch(function(){he("Map preview unavailable \u2014 you can still enter coordinates directly.")})}),o.addEventListener("blur",R),l.addEventListener("blur",R);var X=S0(R,400);o.addEventListener("input",X),l.addEventListener("input",X);function he(H){B.textContent=H||""}function j(){L.innerHTML=""}function oe(H){H.forEach(function(Y){var E=document.createElement("li"),q=document.createElement("button");q.type="button",q.textContent=E0(Y),q.addEventListener("click",function(){o.value=Number(Y.latitude).toFixed(6),l.value=Number(Y.longitude).toFixed(6),j(),R()}),E.appendChild(q),L.appendChild(E)})}k.addEventListener("click",function(){j();var H=f?f.value.trim():"",Y=h?h.value.trim():"";if(!H&&!Y){he("Enter a city or country first.");return}var E=H||Y;he(""),k.disabled=!0,k.textContent="Searching\u2026";var q="https://geocoding-api.open-meteo.com/v1/search?name="+encodeURIComponent(E)+"&count=10&language=en&format=json",W=new AbortController,Q=setTimeout(function(){W.abort()},1e4);fetch(q,{signal:W.signal}).then(function(de){return de.json()}).then(function(de){var be=de&&de.results||[];if(!be.length){he("No matches \u2014 try adding a country, or drag the pin on the map.");return}if(Y){var Ae=Y.toLowerCase(),A=function(w){return(w.admin1||"").toLowerCase().indexOf(Ae)!==-1||(w.country||"").toLowerCase().indexOf(Ae)!==-1};be=be.slice().sort(function(w,te){var Ce=A(w),ye=A(te);return Ce===ye?0:Ce?-1:1})}oe(be)}).catch(function(){}).then(function(){clearTimeout(Q),k.disabled=!1,k.textContent=F})})}function F0(){var o=new Date;return o.setSeconds(0,0),o.setMinutes(o.getMinutes()-o.getTimezoneOffset()),o.toISOString().slice(0,16)}function T0(){var o={title:"Title",date:"Date & time",content:"Content"},l=document.querySelector('form[name="new-entry"]');if(!l)return;var s=ft("date");s&&!String(s.value).trim()&&(s.value=F0());function a(){l.querySelectorAll(".field-error").forEach(function(c){c.remove()}),l.querySelectorAll(".field-invalid").forEach(function(c){c.classList.remove("field-invalid")})}function f(c,d){c.classList.add("field-invalid");var v=document.createElement("span");v.className="field-error",v.textContent=d,c.parentNode.insertBefore(v,c.nextSibling)}function h(c){var d=l.querySelector(".photos-collapse"),v,y;if(d?(d.open=!0,y=d.querySelector(".photos-collapse__summary"),v=d):(v=document.querySelector(".filepond-root, .form-input-file"),y=v),!y)return v||null;var x=document.createElement("span");return x.className="field-error",x.textContent=c,y.insertAdjacentElement("afterend",x),v||y}l.addEventListener("submit",function(c){a();var d=null;!Yo&&document.querySelectorAll(".filepond--item").length<1&&(d=h("Add at least one photo.")),Object.keys(o).forEach(function(y){var x=ft(y);x&&!String(x.value).trim()&&(f(x,o[y]+" is required."),d||(d=x))});var v=l.querySelector(".location-field--mismatch");v&&!d&&(d=v),d&&(c.preventDefault(),typeof d.focus=="function"&&d.focus(),d.scrollIntoView({behavior:"smooth",block:"center"}))})}var ql="intotheeast:new-entry-draft";function L0(o){return Array.prototype.slice.call(o.querySelectorAll('[name^="data["]')).filter(function(l){if(l.type==="file")return!1;var s=l.name;return s.indexOf("data[_json")!==0&&s.indexOf("data[photos")!==0})}function M0(){var o=document.querySelector(".filepond-root, .form-input-file");if(!(!o||!o.parentNode)&&!o.parentNode.querySelector(".photo-reauth-hint")){var l=document.createElement("p");l.className="photo-reauth-hint is-shown",l.textContent="Your text was restored \u2014 photos need re-selecting (they can\u2019t be saved in a draft).",o.parentNode.insertBefore(l,o.nextSibling)}}function B0(){var o=document.querySelector('form[name="new-entry"]');if(!o||Yo)return;if(document.querySelector(".notices.success")){try{localStorage.removeItem(ql)}catch{}return}function l(){var h={};L0(o).forEach(function(c){c.type==="radio"?c.checked&&(h[c.name]=c.value):h[c.name]=c.value});try{localStorage.setItem(ql,JSON.stringify(h))}catch{}}var s=null;try{s=localStorage.getItem(ql)}catch{s=null}if(s){var a=null;try{a=JSON.parse(s)}catch{a=null}if(a){var f=!1;Object.keys(a).forEach(function(h){var c=a[h];if(c!=null&&String(c).trim()&&(f=!0),h!=="data[content]"){var d=o.querySelectorAll('input[type="radio"][name="'+h+'"]');if(d.length){d.forEach(function(y){y.checked=y.value===c});return}var v=o.querySelector('[name="'+h+'"]');v&&v.type!=="file"&&(v.value=c)}}),window.postFormEditor&&a["data[content]"]!=null&&window.postFormEditor.value(a["data[content]"]),f&&M0()}}o.addEventListener("input",l),o.addEventListener("change",l),window.postFormEditor&&window.postFormEditor.codemirror.on("change",l)}function _0(){var o=document.querySelector(".post-form-wrap"),l=document.querySelector(".post-form-wrap .notices.success, .post-form-wrap .notices.green");if(!(!o||!l)){var s=document.createElement("div");s.className="post-success";var a=document.createElement("p");a.className="post-success__title",a.textContent="\u2713 Saved to your journal.",s.appendChild(a);var f=document.createElement("div");f.className="post-success__actions";var h=o.getAttribute("data-trip-url");if(h){var c=document.createElement("a");c.className="post-success__view",c.href=h,c.textContent="View your journal \u2192",f.appendChild(c)}var d=document.createElement("a");d.className="post-success__again",d.href=window.location.pathname,d.textContent="Post another",f.appendChild(d),s.appendChild(f),l.parentNode.insertBefore(s,l.nextSibling),["form",".form-action-row","#location-status","#weather-status"].forEach(function(v){var y=o.querySelector(v);y&&(y.style.display="none")}),l.scrollIntoView({behavior:"smooth",block:"start"})}}var Yo=!1;function Bc(o){return new URLSearchParams(window.location.search).get(o)}function hr(o,l){var s=ft(o);s&&(s.value=l==null?"":String(l))}function Rl(o,l){var s=l?"1":"0",a=document.querySelectorAll('[name="data['+o+']"]');Array.prototype.forEach.call(a,function(f){f.checked=String(f.value)===s})}function z0(o){var l=o==null?"":String(o);if(window.postFormEditor&&typeof window.postFormEditor.value=="function")window.postFormEditor.value(l);else{var s=ft("content");s&&(s.value=l)}}function _c(o,l){var s=o.querySelectorAll("input, textarea, select, button");Array.prototype.forEach.call(s,function(a){a.type==="file"||a.name&&a.name.indexOf("data[photos")===0||(a.disabled=l)}),window.postFormEditor&&window.postFormEditor.codemirror&&window.postFormEditor.codemirror.setOption("readOnly",l?"nocursor":!1)}function Wl(o,l){o&&(o.tagName==="INPUT"?o.value=l:o.textContent=l)}function N0(o,l){var s=o.querySelector(".post-edit-error");if(s){s.textContent=l;return}var a=document.createElement("div");a.className="post-edit-error",a.setAttribute("role","alert"),a.textContent=l;var f=o.querySelector("h1");f?f.insertAdjacentElement("afterend",a):o.insertBefore(a,o.firstChild)}var O0=/\.(jpe?g|png|webp|heic|heif|gif)$/i;function zc(o){var l=/(?:^|\/)photo-0*(\d+)\./i.exec(o);return l?parseInt(l[1],10):Number.MAX_SAFE_INTEGER}function I0(o,l){var s=zc(o),a=zc(l);return s!==a?s-a:ol?1:0}function Nc(o,l){var s=String(o||"photo"),a=s.lastIndexOf("."),f=(a>0?s.slice(0,a):s).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"photo",h=l?".jpg":a>0?s.slice(a).toLowerCase():".jpg",c=Date.now().toString(36)+Math.random().toString(36).slice(2,6);return f+"-"+c+h}function H0(o){var l=document.querySelector('form[name="new-entry"]');if(!l||!o)return;var s=o.split("/").filter(Boolean).pop();if(!s)return;var a=document.querySelector(".filepond-root, .form-input-file"),f=a?a.closest(".form-field"):null;f&&(f.style.display="none");var h=l.querySelector(".photos-collapse");h&&(h.style.display="none");var c=document.createElement("div");c.className="photo-editor",c.innerHTML='

    Photos

    ',f&&f.parentNode?f.parentNode.insertBefore(c,f):l.insertBefore(c,l.firstElementChild);var d=c.querySelector(".photo-editor__grid"),v=c.querySelector(".photo-editor__status"),y=c.querySelector(".photo-editor__add"),x=c.querySelector(".photo-editor__input"),D=[],k=null,F=!1,B=0;function L(H,Y){v.textContent=H||"",v.className="photo-editor__status gpx-status"+(Y?" error":"")}function T(H){F=H,y.disabled=H,Array.prototype.forEach.call(d.querySelectorAll(".photo-editor__del, .photo-editor__confirm-yes, .photo-editor__confirm-no"),function(Y){Y.disabled=H}),k&&k.option("disabled",H)}function N(){return fetch("/api/v1/pages"+o+"/media",{credentials:"include",headers:{Accept:"application/json"}}).then(function(H){if(!H.ok)throw new Error("HTTP "+H.status);return H.json()}).then(function(H){return(H&&H.data||[]).filter(function(Y){return Y&&typeof Y.filename=="string"&&O0.test(Y.filename)}).map(function(Y){return Y.filename}).sort(I0)})}function z(H){return Cn("/api/v1/entry/"+encodeURIComponent(s)+"/photos/order",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({order:H})})}function O(H){if(D=(H||[]).slice(),k&&(k.destroy(),k=null),d.innerHTML="",!D.length){d.innerHTML='

    No photos yet \u2014 add some.

    ';return}var Y=++B;D.forEach(function(E){var q=document.createElement("div");q.className="photo-editor__cell",q.setAttribute("data-filename",E);var W=document.createElement("img");W.className="photo-editor__img",W.loading="lazy",W.alt=E,W.src=o+"/"+encodeURIComponent(E)+"?v="+Y;var Q=document.createElement("button");Q.type="button",Q.className="photo-editor__del",Q.setAttribute("aria-label","Delete "+E),Q.textContent="\u2715",Q.addEventListener("click",function(){X(q,E)}),q.appendChild(W),q.appendChild(Q),d.appendChild(q)}),D.length>1&&(k=new Fc(d,{animation:150,draggable:".photo-editor__cell",filter:".photo-editor__confirm",onEnd:G}))}function I(){return Array.prototype.map.call(d.querySelectorAll(".photo-editor__cell"),function(H){return H.getAttribute("data-filename")})}function R(H,Y){if(H.length!==Y.length)return!1;for(var E=0;EDelete?',H.appendChild(E),H.classList.add("is-confirming"),E.querySelector(".photo-editor__confirm-no").addEventListener("click",function(){H.classList.remove("is-confirming"),E.remove()}),E.querySelector(".photo-editor__confirm-yes").addEventListener("click",function(){E.querySelector(".photo-editor__confirm-yes").disabled=!0,E.querySelector(".photo-editor__confirm-no").disabled=!0,he(Y)})}}function he(H){var Y=D.slice(),E=D.filter(function(q){return q!==H});T(!0),L("Deleting\u2026"),Cn("/api/v1/pages"+o+"/media/"+encodeURIComponent(H),{method:"DELETE"},[204,404]).then(function(){return(E.length?z(E):Promise.resolve()).then(N).then(function(q){L(""),O(q)},function(){L("Photo deleted, but refreshing the list failed \u2014 reload if it looks off.",!0),O(E)})},function(q){L(Pl(q,"Couldn\u2019t delete that photo. Try again."),!0),O(Y)}).then(function(){T(!1)})}function j(H){return Ic(H).then(function(Y){return Y?import("./heic-to-CN7JBE7H.js").then(function(E){var q=E.heicTo||E.default&&E.default.heicTo;return q({blob:H,type:"image/jpeg",quality:.85})}).then(function(E){return{blob:E,name:Nc(H.name,!0)}}):{blob:H,name:Nc(H.name,!1)}})}y.addEventListener("click",function(){F||x.click()}),x.addEventListener("change",function(){var H=Array.prototype.slice.call(x.files||[]);x.value="",H.length&&oe(H)});function oe(H){T(!0);var Y=H.length,E=0,q=0,W=!1,Q=D.slice(),de=Promise.resolve();H.forEach(function(be){de=de.then(function(){return E++,L("Uploading "+E+" of "+Y+"\u2026"),j(be).then(function(Ae){var A=new FormData;return A.append("file",Ae.blob,Ae.name),Cn("/api/v1/pages"+o+"/media",{method:"POST",body:A})}).then(null,function(Ae){q++,Ae&&(Ae.status===401||Ae.status===403)&&(W=!0)})})}),de.then(function(){return L("Finishing\u2026"),N()}).then(function(be){var Ae=Q.filter(function(te){return be.indexOf(te)!==-1}),A=be.filter(function(te){return Q.indexOf(te)===-1}),w=Ae.concat(A);return w.length?z(w).catch(function(){return z(w)}).catch(function(){return Promise.all(A.map(function(te){return Cn("/api/v1/pages"+o+"/media/"+encodeURIComponent(te),{method:"DELETE"},[204,404]).then(function(){return!0},function(){return!1})})).then(function(te){var Ce=new Error("reorder failed");throw Ce.rolledBack=!0,Ce.rollbackIncomplete=te.indexOf(!1)!==-1,Ce})}).then(N):(O([]),null)}).then(function(be){be&&O(be),q?L(W?"Couldn\u2019t add photos \u2014 your login session expired. Sign in again, then retry.":q+" photo"+(q>1?"s":"")+" couldn\u2019t be added.",!0):L("")}).catch(function(be){var Ae;return be&&be.rolledBack?Ae=be.rollbackIncomplete?"Couldn\u2019t finish adding photos and cleanup was incomplete \u2014 reload the page and check your photos.":"Couldn\u2019t finish adding photos \u2014 changes were rolled back. Try again.":Ae="Couldn\u2019t add photos. Please try again.",L(Ae,!0),N().then(O,function(){O(Q)})}).then(function(){T(!1)})}d.innerHTML='

    Loading photos\u2026

    ',N().then(O).catch(function(){L("Couldn\u2019t load photos.",!0),O([])})}function P0(){var o=document.querySelector('form[name="new-entry"]'),l=document.querySelector(".post-form-wrap");if(!(!o||!l)){var s=Bc("edit");if(s){Yo=!0;var a=l.querySelector("h1");a&&(a.textContent="Edit entry");var f=o.querySelector('button[type="submit"], input[type="submit"]'),h=f?f.tagName==="INPUT"?f.value:f.textContent:"Save changes";_c(o,!0),Wl(f,"Loading entry\u2026");var c=Bc("return")||l.getAttribute("data-trip-url")||"";o.setAttribute("action","/post?edit="+encodeURIComponent(s)+(c?"&return="+encodeURIComponent(c):"")),fetch("/api/v1/pages"+s,{credentials:"include",headers:{Accept:"application/json"}}).then(function(d){if(!d.ok){var v=new Error("HTTP "+d.status);throw v.status=d.status,v}return d.json()}).then(function(d){var v=d&&d.data||{},y=v.header||{};hr("title",y.title!=null?y.title:v.title),hr("date",y.date?String(y.date).replace(" ","T"):""),z0(v.content),hr("lat",y.lat),hr("lng",y.lng),hr("location_city",y.location_city),hr("location_country",y.location_country),hr("weather_desc",y.weather_desc),hr("weather_temp_c",y.weather_temp_c),hr("transport_mode",y.transport_mode),Rl("featured",y.featured),Rl("force_connect",y.force_connect),Rl("published",y.published!==void 0?y.published:v.published);var x=ft("edit_path");x&&(x.value=s+"/entry.md"),_c(o,!1),Wl(f,"Save changes");var D=o.querySelector(".more-options");D&&(D.open=!0),H0(s)}).catch(function(d){var v=d&&d.status===404?"This entry no longer exists \u2014 it may have been deleted. Head back to the journal.":"Sorry \u2014 this entry couldn\u2019t be loaded for editing. Check your connection and try again.";N0(l,v),Wl(f,h)})}}}function Oc(){window.postFormEditor=v0(),_0(),P0(),B0(),w0(),C0(),k0(),A0(),T0()}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Oc):Oc(); +Maximum file size is #image_max_size#.`,importError:"Something went wrong when uploading the image #image_name#."};function re(o){o=o||{},o.parent=this;var l=!0;if(o.autoDownloadFontAwesome===!1&&(l=!1),o.autoDownloadFontAwesome!==!0)for(var s=document.styleSheets,a=0;a-1&&(l=!1);if(l){var f=document.createElement("link");f.rel="stylesheet",f.href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css",document.getElementsByTagName("head")[0].appendChild(f)}if(o.element)this.element=o.element;else if(o.element===null){console.log("EasyMDE: Error. No element was found.");return}if(o.toolbar===void 0){o.toolbar=[];for(var h in Ur)Object.prototype.hasOwnProperty.call(Ur,h)&&(h.indexOf("separator-")!=-1&&o.toolbar.push("|"),(Ur[h].default===!0||o.showIcons&&o.showIcons.constructor===Array&&o.showIcons.indexOf(h)!=-1)&&o.toolbar.push(h))}if(Object.prototype.hasOwnProperty.call(o,"previewClass")||(o.previewClass="editor-preview"),Object.prototype.hasOwnProperty.call(o,"status")||(o.status=["autosave","lines","words","cursor"],o.uploadImage&&o.status.unshift("upload-image")),o.previewRender||(o.previewRender=function(d){return this.parent.markdown(d)}),o.parsingConfig=sr({highlightFormatting:!0},o.parsingConfig||{}),o.insertTexts=sr({},Ip,o.insertTexts||{}),o.promptTexts=sr({},Hp,o.promptTexts||{}),o.blockStyles=sr({},qp,o.blockStyles||{}),o.autosave!=null&&(o.autosave.timeFormat=sr({},Pp,o.autosave.timeFormat||{})),o.iconClassMap=sr({},Be,o.iconClassMap||{}),o.shortcuts=sr({},Tp,o.shortcuts||{}),o.maxHeight=o.maxHeight||void 0,o.direction=o.direction||"ltr",typeof o.maxHeight<"u"?o.minHeight=o.maxHeight:o.minHeight=o.minHeight||"300px",o.errorCallback=o.errorCallback||function(d){alert(d)},o.uploadImage=o.uploadImage||!1,o.imageMaxSize=o.imageMaxSize||2097152,o.imageAccept=o.imageAccept||"image/png, image/jpeg, image/gif, image/avif",o.imageTexts=sr({},Rp,o.imageTexts||{}),o.errorMessages=sr({},Wp,o.errorMessages||{}),o.imagePathAbsolute=o.imagePathAbsolute||!1,o.imageCSRFName=o.imageCSRFName||"csrfmiddlewaretoken",o.imageCSRFHeader=o.imageCSRFHeader||!1,o.imageInputName=o.imageInputName||"image",o.autosave!=null&&o.autosave.unique_id!=null&&o.autosave.unique_id!=""&&(o.autosave.uniqueId=o.autosave.unique_id),o.overlayMode&&o.overlayMode.combine===void 0&&(o.overlayMode.combine=!0),this.options=o,this.render(),o.initialValue&&(!this.options.autosave||this.options.autosave.foundSavedValue!==!0)&&this.value(o.initialValue),o.uploadImage){var c=this;this.codemirror.on("dragenter",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbOnDragEnter),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("dragend",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbInit),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("dragleave",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbInit),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("dragover",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbOnDragEnter),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("drop",function(d,v){v.stopPropagation(),v.preventDefault(),o.imageUploadFunction?c.uploadImagesUsingCustomFunction(o.imageUploadFunction,v.dataTransfer.files):c.uploadImages(v.dataTransfer.files)}),this.codemirror.on("paste",function(d,v){o.imageUploadFunction?c.uploadImagesUsingCustomFunction(o.imageUploadFunction,v.clipboardData.files):c.uploadImages(v.clipboardData.files)})}}re.prototype.uploadImages=function(o,l,s){if(o.length!==0){for(var a=[],f=0;f=2){var O=z[1];if(l.imagesPreviewHandler){var I=l.imagesPreviewHandler(z[1]);typeof I=="string"&&(O=I)}if(window.EMDEimagesCache[O])F(N,window.EMDEimagesCache[O]);else{window.EMDEimagesCache[O]={};var W=document.createElement("img");W.onload=function(){window.EMDEimagesCache[O]={naturalWidth:W.naturalWidth,naturalHeight:W.naturalHeight,url:O},F(N,window.EMDEimagesCache[O])},W.src=O}}}})}this.codemirror.on("update",function(){B()}),this.gui.sideBySide=this.createSideBySide(),this._rendered=this.element,(l.autofocus===!0||o.autofocus)&&this.codemirror.focus();var L=this.codemirror;setTimeout(function(){L.refresh()}.bind(L),0)};re.prototype.cleanup=function(){document.removeEventListener("keydown",this.documentOnKeyDown)};function ic(){if(typeof localStorage=="object")try{localStorage.setItem("smde_localStorage",1),localStorage.removeItem("smde_localStorage")}catch{return!1}else return!1;return!0}re.prototype.autosave=function(){if(ic()){var o=this;if(this.options.autosave.uniqueId==null||this.options.autosave.uniqueId==""){console.log("EasyMDE: You must set a uniqueId to use the autosave feature");return}this.options.autosave.binded!==!0&&(o.element.form!=null&&o.element.form!=null&&o.element.form.addEventListener("submit",function(){clearTimeout(o.autosaveTimeoutId),o.autosaveTimeoutId=void 0,localStorage.removeItem("smde_"+o.options.autosave.uniqueId)}),this.options.autosave.binded=!0),this.options.autosave.loaded!==!0&&(typeof localStorage.getItem("smde_"+this.options.autosave.uniqueId)=="string"&&localStorage.getItem("smde_"+this.options.autosave.uniqueId)!=""&&(this.codemirror.setValue(localStorage.getItem("smde_"+this.options.autosave.uniqueId)),this.options.autosave.foundSavedValue=!0),this.options.autosave.loaded=!0);var l=o.value();l!==""?localStorage.setItem("smde_"+this.options.autosave.uniqueId,l):localStorage.removeItem("smde_"+this.options.autosave.uniqueId);var s=document.getElementById("autosaved");if(s!=null&&s!=null&&s!=""){var a=new Date,f=new Intl.DateTimeFormat([this.options.autosave.timeFormat.locale,"en-US"],this.options.autosave.timeFormat.format).format(a),h=this.options.autosave.text==null?"Autosaved: ":this.options.autosave.text;s.innerHTML=h+f}}else console.log("EasyMDE: localStorage not available, cannot autosave")};re.prototype.clearAutosavedValue=function(){if(ic()){if(this.options.autosave==null||this.options.autosave.uniqueId==null||this.options.autosave.uniqueId==""){console.log("EasyMDE: You must set a uniqueId to clear the autosave value");return}localStorage.removeItem("smde_"+this.options.autosave.uniqueId)}else console.log("EasyMDE: localStorage not available, cannot autosave")};re.prototype.openBrowseFileWindow=function(o,l){var s=this,a=this.gui.toolbar.getElementsByClassName("imageInput")[0];a.click();function f(h){s.options.imageUploadFunction?s.uploadImagesUsingCustomFunction(s.options.imageUploadFunction,h.target.files):s.uploadImages(h.target.files,o,l),a.removeEventListener("change",f)}a.addEventListener("change",f)};re.prototype.uploadImage=function(o,l,s){var a=this;l=l||function(y){ec(a,y)};function f(v){a.updateStatusBar("upload-image",v),setTimeout(function(){a.updateStatusBar("upload-image",a.options.imageTexts.sbInit)},1e4),s&&typeof s=="function"&&s(v),a.options.errorCallback(v)}function h(v){var y=a.options.imageTexts.sizeUnits.split(",");return v.replace("#image_name#",o.name).replace("#image_size#",co(o.size,y)).replace("#image_max_size#",co(a.options.imageMaxSize,y))}if(o.size>this.options.imageMaxSize){f(h(this.options.errorMessages.fileTooLarge));return}var c=new FormData;c.append("image",o),a.options.imageCSRFToken&&!a.options.imageCSRFHeader&&c.append(a.options.imageCSRFName,a.options.imageCSRFToken);var d=new XMLHttpRequest;d.upload.onprogress=function(v){if(v.lengthComputable){var y=""+Math.round(v.loaded*100/v.total);a.updateStatusBar("upload-image",a.options.imageTexts.sbProgress.replace("#file_name#",o.name).replace("#progress#",y))}},d.open("POST",this.options.imageUploadEndpoint),a.options.imageCSRFToken&&a.options.imageCSRFHeader&&d.setRequestHeader(a.options.imageCSRFName,a.options.imageCSRFToken),d.onload=function(){try{var v=JSON.parse(this.responseText)}catch{console.error("EasyMDE: The server did not return a valid json."),f(h(a.options.errorMessages.importError));return}this.status===200&&v&&!v.error&&v.data&&v.data.filePath?l((a.options.imagePathAbsolute?"":window.location.origin+"/")+v.data.filePath):v.error&&v.error in a.options.errorMessages?f(h(a.options.errorMessages[v.error])):v.error?f(h(v.error)):(console.error("EasyMDE: Received an unexpected response after uploading the image."+this.status+" ("+this.statusText+")"),f(h(a.options.errorMessages.importError)))},d.onerror=function(v){console.error("EasyMDE: An unexpected error occurred when trying to upload the image."+v.target.status+" ("+v.target.statusText+")"),f(a.options.errorMessages.importError)},d.send(c)};re.prototype.uploadImageUsingCustomFunction=function(o,l){var s=this;function a(c){ec(s,c)}function f(c){var d=h(c);s.updateStatusBar("upload-image",d),setTimeout(function(){s.updateStatusBar("upload-image",s.options.imageTexts.sbInit)},1e4),s.options.errorCallback(d)}function h(c){var d=s.options.imageTexts.sizeUnits.split(",");return c.replace("#image_name#",l.name).replace("#image_size#",co(l.size,d)).replace("#image_max_size#",co(s.options.imageMaxSize,d))}o.apply(this,[l,a,f])};re.prototype.setPreviewMaxHeight=function(){var o=this.codemirror,l=o.getWrapperElement(),s=l.nextSibling,a=parseInt(window.getComputedStyle(l).paddingTop),f=parseInt(window.getComputedStyle(l).borderTopWidth),h=parseInt(this.options.maxHeight),c=h+a*2+f*2,d=c.toString()+"px";s.style.height=d};re.prototype.createSideBySide=function(){var o=this.codemirror,l=o.getWrapperElement(),s=l.nextSibling;if(!s||!s.classList.contains("editor-preview-side")){if(s=document.createElement("div"),s.className="editor-preview-side",this.options.previewClass)if(Array.isArray(this.options.previewClass))for(var a=0;a"&&(l=l.substring(1)),o)try{if(o.matches)return o.matches(l);if(o.msMatchesSelector)return o.msMatchesSelector(l);if(o.webkitMatchesSelector)return o.webkitMatchesSelector(l)}catch{return!1}return!1}}function vc(o){return o.host&&o!==document&&o.host.nodeType&&o.host!==o?o.host:o.parentNode}function Gt(o,l,s,a){if(o){s=s||document;do{if(l!=null&&(l[0]===">"?o.parentNode===s&&Wo(o,l):Wo(o,l))||a&&o===s)return o;if(o===s)break}while(o=vc(o))}return null}var sc=/\s+/g;function zt(o,l,s){if(o&&l)if(o.classList)o.classList[s?"add":"remove"](l);else{var a=(" "+o.className+" ").replace(sc," ").replace(" "+l+" "," ");o.className=(a+(s?" "+l:"")).replace(sc," ")}}function pe(o,l,s){var a=o&&o.style;if(a){if(s===void 0)return document.defaultView&&document.defaultView.getComputedStyle?s=document.defaultView.getComputedStyle(o,""):o.currentStyle&&(s=o.currentStyle),l===void 0?s:s[l];!(l in a)&&l.indexOf("webkit")===-1&&(l="-webkit-"+l),a[l]=s+(typeof s=="string"?"":"px")}}function Ai(o,l){var s="";if(typeof o=="string")s=o;else do{var a=pe(o,"transform");a&&a!=="none"&&(s=a+" "+s)}while(!l&&(o=o.parentNode));var f=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return f&&new f(s)}function bc(o,l,s){if(o){var a=o.getElementsByTagName(l),f=0,h=a.length;if(s)for(;f=h:c=f<=h,!c)return a;if(a===$t())break;a=Tr(a,!1)}return!1}function Fi(o,l,s,a){for(var f=0,h=0,c=o.children;h2&&arguments[2]!==void 0?arguments[2]:{},f=a.evt,h=jp(a,r0);wn.pluginEvent.bind(ge)(l,s,er({dragEl:$,parentEl:Ue,ghostEl:xe,rootEl:He,nextEl:Yr,lastDownEl:Ho,cloneEl:Re,cloneHidden:Fr,dragStarted:dn,putSortable:ft,activeSortable:ge.active,originalEvent:f,oldIndex:Ei,oldDraggableIndex:vn,newIndex:Nt,newDraggableIndex:Ar,hideGhostForTarget:Ec,unhideGhostForTarget:Ac,cloneNowHidden:function(){Fr=!0},cloneNowShown:function(){Fr=!1},dispatchSortableEvent:function(d){kt({sortable:s,name:d,originalEvent:f})}},h))};function kt(o){t0(er({putSortable:ft,cloneEl:Re,targetEl:$,rootEl:He,oldIndex:Ei,oldDraggableIndex:vn,newIndex:Nt,newDraggableIndex:Ar},o))}var $,Ue,xe,He,Yr,Ho,Re,Fr,Ei,Nt,vn,Ar,zo,ft,Si=!1,Uo=!1,jo=[],Xr,jt,Dl,kl,cc,dc,dn,ki,bn,yn=!1,No=!1,Po,mt,Sl=[],Ml=!1,Go=[],Ko=typeof document<"u",Oo=Nl,hc=xn||cr?"cssFloat":"float",i0=Ko&&!gc&&!Nl&&"draggable"in document.createElement("div"),Dc=function(){if(Ko){if(cr)return!1;var o=document.createElement("x");return o.style.cssText="pointer-events:auto",o.style.pointerEvents==="auto"}}(),kc=function(l,s){var a=pe(l),f=parseInt(a.width)-parseInt(a.paddingLeft)-parseInt(a.paddingRight)-parseInt(a.borderLeftWidth)-parseInt(a.borderRightWidth),h=Fi(l,0,s),c=Fi(l,1,s),d=h&&pe(h),v=c&&pe(c),y=d&&parseInt(d.marginLeft)+parseInt(d.marginRight)+Ve(h).width,x=v&&parseInt(v.marginLeft)+parseInt(v.marginRight)+Ve(c).width;if(a.display==="flex")return a.flexDirection==="column"||a.flexDirection==="column-reverse"?"vertical":"horizontal";if(a.display==="grid")return a.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(h&&d.float&&d.float!=="none"){var D=d.float==="left"?"left":"right";return c&&(v.clear==="both"||v.clear===D)?"vertical":"horizontal"}return h&&(d.display==="block"||d.display==="flex"||d.display==="table"||d.display==="grid"||y>=f&&a[hc]==="none"||c&&a[hc]==="none"&&y+x>f)?"vertical":"horizontal"},n0=function(l,s,a){var f=a?l.left:l.top,h=a?l.right:l.bottom,c=a?l.width:l.height,d=a?s.left:s.top,v=a?s.right:s.bottom,y=a?s.width:s.height;return f===d||h===v||f+c/2===d+y/2},o0=function(l,s){var a;return jo.some(function(f){var h=f[Tt].options.emptyInsertThreshold;if(!(!h||Ol(f))){var c=Ve(f),d=l>=c.left-h&&l<=c.right+h,v=s>=c.top-h&&s<=c.bottom+h;if(d&&v)return a=f}}),a},Sc=function(l){function s(h,c){return function(d,v,y,x){var D=d.options.group.name&&v.options.group.name&&d.options.group.name===v.options.group.name;if(h==null&&(c||D))return!0;if(h==null||h===!1)return!1;if(c&&h==="clone")return h;if(typeof h=="function")return s(h(d,v,y,x),c)(d,v,y,x);var S=(c?d:v).options.group.name;return h===!0||typeof h=="string"&&h===S||h.join&&h.indexOf(S)>-1}}var a={},f=l.group;(!f||Ll(f)!="object")&&(f={name:f}),a.name=f.name,a.checkPull=s(f.pull,!0),a.checkPut=s(f.put),a.revertClone=f.revertClone,l.group=a},Ec=function(){!Dc&&xe&&pe(xe,"display","none")},Ac=function(){!Dc&&xe&&pe(xe,"display","")};Ko&&!gc&&document.addEventListener("click",function(o){if(Uo)return o.preventDefault(),o.stopPropagation&&o.stopPropagation(),o.stopImmediatePropagation&&o.stopImmediatePropagation(),Uo=!1,!1},!0);var Kr=function(l){if($){l=l.touches?l.touches[0]:l;var s=o0(l.clientX,l.clientY);if(s){var a={};for(var f in l)l.hasOwnProperty(f)&&(a[f]=l[f]);a.target=a.rootEl=s,a.preventDefault=void 0,a.stopPropagation=void 0,s[Tt]._onDragOver(a)}}},a0=function(l){$&&$.parentNode[Tt]._isOutsideThisEl(l.target)};function ge(o,l){if(!(o&&o.nodeType&&o.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(o));this.el=o,this.options=l=fr({},l),o[Tt]=this;var s={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(o.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return kc(o,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(c,d){c.setData("Text",d.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:ge.supportPointer!==!1&&"PointerEvent"in window&&(!gn||Nl),emptyInsertThreshold:5};wn.initializePlugins(this,o,s);for(var a in s)!(a in l)&&(l[a]=s[a]);Sc(l);for(var f in this)f.charAt(0)==="_"&&typeof this[f]=="function"&&(this[f]=this[f].bind(this));this.nativeDraggable=l.forceFallback?!1:i0,this.nativeDraggable&&(this.options.touchStartThreshold=1),l.supportPointer?Se(o,"pointerdown",this._onTapStart):(Se(o,"mousedown",this._onTapStart),Se(o,"touchstart",this._onTapStart)),this.nativeDraggable&&(Se(o,"dragover",this),Se(o,"dragenter",this)),jo.push(this.el),l.store&&l.store.get&&this.sort(l.store.get(this)||[]),fr(this,Vp())}ge.prototype={constructor:ge,_isOutsideThisEl:function(l){!this.el.contains(l)&&l!==this.el&&(ki=null)},_getDirection:function(l,s){return typeof this.options.direction=="function"?this.options.direction.call(this,l,s,$):this.options.direction},_onTapStart:function(l){if(l.cancelable){var s=this,a=this.el,f=this.options,h=f.preventOnFilter,c=l.type,d=l.touches&&l.touches[0]||l.pointerType&&l.pointerType==="touch"&&l,v=(d||l).target,y=l.target.shadowRoot&&(l.path&&l.path[0]||l.composedPath&&l.composedPath()[0])||v,x=f.filter;if(p0(a),!$&&!(/mousedown|pointerdown/.test(c)&&l.button!==0||f.disabled)&&!y.isContentEditable&&!(!this.nativeDraggable&&gn&&v&&v.tagName.toUpperCase()==="SELECT")&&(v=Gt(v,f.draggable,a,!1),!(v&&v.animated)&&Ho!==v)){if(Ei=It(v),vn=It(v,f.draggable),typeof x=="function"){if(x.call(this,l,v,this)){kt({sortable:s,rootEl:y,name:"filter",targetEl:v,toEl:a,fromEl:a}),Ft("filter",s,{evt:l}),h&&l.preventDefault();return}}else if(x&&(x=x.split(",").some(function(D){if(D=Gt(y,D.trim(),a,!1),D)return kt({sortable:s,rootEl:D,name:"filter",targetEl:v,fromEl:a,toEl:a}),Ft("filter",s,{evt:l}),!0}),x)){h&&l.preventDefault();return}f.handle&&!Gt(y,f.handle,a,!1)||this._prepareDragStart(l,d,v)}}},_prepareDragStart:function(l,s,a){var f=this,h=f.el,c=f.options,d=h.ownerDocument,v;if(a&&!$&&a.parentNode===h){var y=Ve(a);if(He=h,$=a,Ue=$.parentNode,Yr=$.nextSibling,Ho=a,zo=c.group,ge.dragged=$,Xr={target:$,clientX:(s||l).clientX,clientY:(s||l).clientY},cc=Xr.clientX-y.left,dc=Xr.clientY-y.top,this._lastX=(s||l).clientX,this._lastY=(s||l).clientY,$.style["will-change"]="all",v=function(){if(Ft("delayEnded",f,{evt:l}),ge.eventCanceled){f._onDrop();return}f._disableDelayedDragEvents(),!lc&&f.nativeDraggable&&($.draggable=!0),f._triggerDragStart(l,s),kt({sortable:f,name:"choose",originalEvent:l}),zt($,c.chosenClass,!0)},c.ignore.split(",").forEach(function(x){bc($,x.trim(),El)}),Se(d,"dragover",Kr),Se(d,"mousemove",Kr),Se(d,"touchmove",Kr),c.supportPointer?(Se(d,"pointerup",f._onDrop),!this.nativeDraggable&&Se(d,"pointercancel",f._onDrop)):(Se(d,"mouseup",f._onDrop),Se(d,"touchend",f._onDrop),Se(d,"touchcancel",f._onDrop)),lc&&this.nativeDraggable&&(this.options.touchStartThreshold=4,$.draggable=!0),Ft("delayStart",this,{evt:l}),c.delay&&(!c.delayOnTouchOnly||s)&&(!this.nativeDraggable||!(xn||cr))){if(ge.eventCanceled){this._onDrop();return}c.supportPointer?(Se(d,"pointerup",f._disableDelayedDrag),Se(d,"pointercancel",f._disableDelayedDrag)):(Se(d,"mouseup",f._disableDelayedDrag),Se(d,"touchend",f._disableDelayedDrag),Se(d,"touchcancel",f._disableDelayedDrag)),Se(d,"mousemove",f._delayedDragTouchMoveHandler),Se(d,"touchmove",f._delayedDragTouchMoveHandler),c.supportPointer&&Se(d,"pointermove",f._delayedDragTouchMoveHandler),f._dragStartTimer=setTimeout(v,c.delay)}else v()}},_delayedDragTouchMoveHandler:function(l){var s=l.touches?l.touches[0]:l;Math.max(Math.abs(s.clientX-this._lastX),Math.abs(s.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){$&&El($),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var l=this.el.ownerDocument;ke(l,"mouseup",this._disableDelayedDrag),ke(l,"touchend",this._disableDelayedDrag),ke(l,"touchcancel",this._disableDelayedDrag),ke(l,"pointerup",this._disableDelayedDrag),ke(l,"pointercancel",this._disableDelayedDrag),ke(l,"mousemove",this._delayedDragTouchMoveHandler),ke(l,"touchmove",this._delayedDragTouchMoveHandler),ke(l,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(l,s){s=s||l.pointerType=="touch"&&l,!this.nativeDraggable||s?this.options.supportPointer?Se(document,"pointermove",this._onTouchMove):s?Se(document,"touchmove",this._onTouchMove):Se(document,"mousemove",this._onTouchMove):(Se($,"dragend",this),Se(He,"dragstart",this._onDragStart));try{document.selection?qo(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(l,s){if(Si=!1,He&&$){Ft("dragStarted",this,{evt:s}),this.nativeDraggable&&Se(document,"dragover",a0);var a=this.options;!l&&zt($,a.dragClass,!1),zt($,a.ghostClass,!0),ge.active=this,l&&this._appendGhost(),kt({sortable:this,name:"start",originalEvent:s})}else this._nulling()},_emulateDragOver:function(){if(jt){this._lastX=jt.clientX,this._lastY=jt.clientY,Ec();for(var l=document.elementFromPoint(jt.clientX,jt.clientY),s=l;l&&l.shadowRoot&&(l=l.shadowRoot.elementFromPoint(jt.clientX,jt.clientY),l!==s);)s=l;if($.parentNode[Tt]._isOutsideThisEl(l),s)do{if(s[Tt]){var a=void 0;if(a=s[Tt]._onDragOver({clientX:jt.clientX,clientY:jt.clientY,target:l,rootEl:s}),a&&!this.options.dragoverBubble)break}l=s}while(s=vc(s));Ac()}},_onTouchMove:function(l){if(Xr){var s=this.options,a=s.fallbackTolerance,f=s.fallbackOffset,h=l.touches?l.touches[0]:l,c=xe&&Ai(xe,!0),d=xe&&c&&c.a,v=xe&&c&&c.d,y=Oo&&mt&&fc(mt),x=(h.clientX-Xr.clientX+f.x)/(d||1)+(y?y[0]-Sl[0]:0)/(d||1),D=(h.clientY-Xr.clientY+f.y)/(v||1)+(y?y[1]-Sl[1]:0)/(v||1);if(!ge.active&&!Si){if(a&&Math.max(Math.abs(h.clientX-this._lastX),Math.abs(h.clientY-this._lastY))=0&&(kt({rootEl:Ue,name:"add",toEl:Ue,fromEl:He,originalEvent:l}),kt({sortable:this,name:"remove",toEl:Ue,originalEvent:l}),kt({rootEl:Ue,name:"sort",toEl:Ue,fromEl:He,originalEvent:l}),kt({sortable:this,name:"sort",toEl:Ue,originalEvent:l})),ft&&ft.save()):Nt!==Ei&&Nt>=0&&(kt({sortable:this,name:"update",toEl:Ue,originalEvent:l}),kt({sortable:this,name:"sort",toEl:Ue,originalEvent:l})),ge.active&&((Nt==null||Nt===-1)&&(Nt=Ei,Ar=vn),kt({sortable:this,name:"end",toEl:Ue,originalEvent:l}),this.save()))),this._nulling()},_nulling:function(){Ft("nulling",this),He=$=Ue=xe=Yr=Re=Ho=Fr=Xr=jt=dn=Nt=Ar=Ei=vn=ki=bn=ft=zo=ge.dragged=ge.ghost=ge.clone=ge.active=null;var l=this.el;Go.forEach(function(s){l.contains(s)&&(s.checked=!0)}),Go.length=Dl=kl=0},handleEvent:function(l){switch(l.type){case"drop":case"dragend":this._onDrop(l);break;case"dragenter":case"dragover":$&&(this._onDragOver(l),l0(l));break;case"selectstart":l.preventDefault();break}},toArray:function(){for(var l=[],s,a=this.el.children,f=0,h=a.length,c=this.options;ff.right+h||o.clientY>a.bottom&&o.clientX>a.left:o.clientY>f.bottom+h||o.clientX>a.right&&o.clientY>a.top}function c0(o,l,s,a,f,h,c,d){var v=a?o.clientY:o.clientX,y=a?s.height:s.width,x=a?s.top:s.left,D=a?s.bottom:s.right,S=!1;if(!c){if(d&&Pox+y*h/2:vD-Po)return-bn}else if(v>x+y*(1-f)/2&&vD-y*h/2)?v>x+y/2?1:-1:0}function d0(o){return It($)0||D>0&&S0?"Converting "+l+" photo"+(l>1?"s":"")+"\u2026":"Uploading "+D+" photo"+(D>1?"s":"")+"\u2026",s.details.open=!0):D>0?(s.summary.textContent="\u2713 "+D+" photo"+(D>1?"s":"")+" ready \u2014 tap to review",s.details.open=!1):(s.summary.textContent="Photos (1\u20136)",s.details.open=!0)}}function c(){h(),setTimeout(h,150),setTimeout(h,500)}function d(){var x=o.querySelector('button[type="submit"], input[type="submit"]');if(x&&(x.disabled=l>0),l>0)f("Converting "+l+" photo"+(l>1?"s":"")+"\u2026");else{var D=Bc();D&&/Converting/.test(D.textContent)&&f("")}h()}o.addEventListener("submit",function(x){l>0&&(x.preventDefault(),f("Hang on \u2014 a photo is still converting.","err"))},!0);function v(x){return function(D){var S=D&&D.file;return S?Hc(S).then(function(F){return F?(l++,d(),import("./heic-to-CN7JBE7H.js").then(function(B){var L=B.heicTo||B.default&&B.default.heicTo;return L({blob:S,type:"image/jpeg",quality:.85})}).then(function(B){var L=new File([B],y0(S.name),{type:"image/jpeg"});x.addFile(L)}).catch(function(){f("A photo couldn\u2019t be converted and was skipped \u2014 the others are fine.","err")}).then(function(){l--,d()}),!1):!0}):!0}}var y=0;(function x(){var D=window.GravFilePond&&window.GravFilePond.getInstances?window.GravFilePond.getInstances():[];if(!D.length){y++<120&&setTimeout(x,50);return}D.forEach(function(S){S&&!S._heicHooked&&(S._heicHooked=!0,S.setOptions({beforeAddFile:v(S),allowReorder:!0,itemInsertLocation:"after"}),a=S,["addfile","processfile","processfiles","removefile","error"].forEach(function(F){try{S.on(F,c)}catch{}}),h())})})()}function ct(o){return document.querySelector('[name="data['+o+']"]')}function C0(){var o=Array.prototype.slice.call(document.querySelectorAll(".advanced-field"));if(o.length){var l=[];if(o.forEach(function(h){var c=h.closest(".form-field");c&&l.indexOf(c)===-1&&l.push(c)}),!!l.length){var s=document.createElement("details");s.className="more-options";var a=document.createElement("summary");a.className="more-options__summary",a.textContent="More options",s.appendChild(a),l[0].parentNode.insertBefore(s,l[0]),l.forEach(function(h){s.appendChild(h)});var f=l.some(function(h){var c=h.querySelector('input[type="text"]');if(c&&c.value.trim())return!0;var d=h.querySelector('input[type="radio"]:checked');if(!d||!d.value)return!1;var v=h.querySelector('input[type="radio"][checked]');return v?d.value!==v.value:d.value!=="0"});f&&(s.open=!0)}}}var D0={0:"Sunny",1:"Partly cloudy",2:"Partly cloudy",3:"Cloudy",45:"Foggy",48:"Foggy",51:"Drizzle",53:"Drizzle",55:"Drizzle",56:"Drizzle",57:"Drizzle",61:"Rain",63:"Rain",65:"Rain",66:"Rain",67:"Rain",80:"Rain",81:"Rain",82:"Rain",71:"Snow",73:"Snow",75:"Snow",77:"Snow",85:"Snow",86:"Snow",95:"Thunderstorm",96:"Thunderstorm",99:"Thunderstorm"};function dr(o,l,s){o&&(o.className="form-status"+(s?" form-status--"+s:""),o.textContent=l||"")}function k0(){var o=document.getElementById("get-location"),l=document.getElementById("get-weather");if(!o&&!l)return;var s=document.getElementById("location-status"),a=document.getElementById("weather-status");function f(){var d=ct("lat"),v=ct("lng"),y=d?d.value.trim():"",x=v?v.value.trim():"";return y&&x?{lat:y,lng:x}:null}function h(){if(l){var d=!!f();l.disabled=!d,l.title=d?"":"Get location first"}}h();function c(d,v){var y=ct("location_city"),x=ct("location_country");if(!((!y||y.value.trim())&&(!x||x.value.trim()))){var D="https://api.bigdatacloud.net/data/reverse-geocode-client?latitude="+encodeURIComponent(d)+"&longitude="+encodeURIComponent(v)+"&localityLanguage=en";fetch(D).then(function(S){return S.json()}).then(function(S){var F=(S.city||S.locality||"").trim(),B=(S.countryName||"").trim();y&&!y.value.trim()&&F&&(y.value=F),x&&!x.value.trim()&&B&&(x.value=B);var L=[F,B].filter(Boolean).join(", ");L&&dr(s,"\u2713 Location captured \xB7 "+L,"ok")}).catch(function(){})}}o&&o.addEventListener("click",function(){if(!navigator.geolocation){dr(s,"Geolocation is not supported on this device.","err");return}o.classList.add("is-loading"),o.disabled=!0,dr(s,"Getting location\u2026"),navigator.geolocation.getCurrentPosition(function(d){var v=d.coords.latitude.toFixed(6),y=d.coords.longitude.toFixed(6),x=ct("lat"),D=ct("lng");x&&(x.value=v),D&&(D.value=y),o.classList.remove("is-loading"),o.disabled=!1,dr(s,"\u2713 Location captured \xB7 "+v+", "+y,"ok"),h(),c(v,y);var S=document.querySelector(".location-details");S&&S.open&&Ul()},function(d){o.classList.remove("is-loading"),o.disabled=!1,dr(s,"\u2717 "+(d&&d.message?d.message:"Could not get location")+" \u2014 enter coordinates manually if needed.","err")},{enableHighAccuracy:!0,timeout:15e3})}),l&&l.addEventListener("click",function(){var d=f();if(!d){dr(a,"Get location first, then fetch weather.","err");return}l.classList.add("is-loading"),l.disabled=!0,dr(a,"Fetching weather\u2026");var v="https://api.open-meteo.com/v1/forecast?latitude="+d.lat+"&longitude="+d.lng+"¤t=temperature_2m,weather_code&temperature_unit=celsius";fetch(v).then(function(y){return y.json()}).then(function(y){var x=Math.round(y.current.temperature_2m),D=D0[y.current.weather_code]||"Cloudy",S=ct("weather_temp_c"),F=ct("weather_desc");S&&(S.value=x),F&&(F.value=D),l.classList.remove("is-loading"),h(),dr(a,"\u2713 Weather set \xB7 "+D+" \xB7 "+x+"\xB0C (edit above if needed)","ok")}).catch(function(){l.classList.remove("is-loading"),h(),dr(a,"\u2717 Could not fetch weather \u2014 set it manually above.","err")})})}var Ul=function(){};function S0(o,l){var s=null;return function(){var a=arguments;clearTimeout(s),s=setTimeout(function(){o.apply(null,a)},l)}}function E0(o){return[o.name,o.admin1,o.country].filter(Boolean).join(", ")}function A0(){var o=ct("lat"),l=ct("lng");if(!o||!l)return;var s=o.closest(".form-field"),a=l.closest(".form-field");if(!s||!a)return;var f=ct("location_city"),h=ct("location_country"),c=h?h.closest(".form-field"):null,d=c||s,v=document.createElement("details");v.className="location-details";var y=document.createElement("summary");y.className="location-details__summary",y.textContent="More location details",v.appendChild(y);var x=document.createElement("div");x.className="location-details__body";var D=document.createElement("div");D.className="location-search-row";var S=document.createElement("button");S.type="button",S.id="lookup-coords",S.className="btn-action";var F="\u{1F50D} Look up coordinates";S.textContent=F,D.appendChild(S),x.appendChild(D);var B=document.createElement("p");B.id="location-search-hint",B.className="location-search-hint",B.setAttribute("role","status"),x.appendChild(B);var L=document.createElement("ul");L.id="location-search-results",L.className="location-search-results",x.appendChild(L);var T=document.createElement("div");T.id="location-map",T.className="location-map",x.appendChild(T),v.appendChild(x),d.parentNode.insertBefore(v,d.nextSibling),v.appendChild(s),v.appendChild(a);function N(G){return G===o?"location-lat-note":"location-lng-note"}function z(){[o,l].forEach(function(G){G.classList.add("location-field--mismatch"),G.setAttribute("aria-invalid","true");var k=N(G),H=document.getElementById(k);H||(H=document.createElement("span"),H.id=k,H.className="location-field-note",H.setAttribute("role","status"),H.setAttribute("aria-live","polite"),H.textContent="Not reflected on the map yet.",G.parentNode.insertBefore(H,G.nextSibling)),G.setAttribute("aria-describedby",k)})}function O(){[o,l].forEach(function(G){G.classList.remove("location-field--mismatch"),G.removeAttribute("aria-invalid"),G.removeAttribute("aria-describedby");var k=document.getElementById(N(G));k&&k.parentNode&&k.parentNode.removeChild(k)})}var I=null;function W(G){var k=String(G).trim();return!k||!/^[+-]?(\d+(\.\d*)?|\.\d+)$/.test(k)?NaN:Number(k)}function j(){var G=W(o.value),k=W(l.value),H=isFinite(G)&&isFinite(k)&&G>=-90&&G<=90&&k>=-180&&k<=180;H?(o.value=G.toFixed(6),l.value=k.toFixed(6),O(),I&&I.setPin(G,k)):o.value.trim()||l.value.trim()?z():(O(),I&&I.clearPin())}Ul=j;function K(G){o.value=G.lat.toFixed(6),l.value=G.lng.toFixed(6),O()}v.addEventListener("toggle",function(){v.open&&Mc(T,K).then(function(G){I=G,G.resize(),j()}).catch(function(){U("Map preview unavailable \u2014 you can still enter coordinates directly."),j()})}),o.addEventListener("blur",j),l.addEventListener("blur",j);var de=S0(j,400);o.addEventListener("input",de),l.addEventListener("input",de);function U(G){B.textContent=G||""}function oe(){L.innerHTML=""}function X(G){G.forEach(function(k){var H=document.createElement("li"),q=document.createElement("button");q.type="button",q.textContent=E0(k),q.addEventListener("click",function(){o.value=Number(k.latitude).toFixed(6),l.value=Number(k.longitude).toFixed(6),oe(),j()}),H.appendChild(q),L.appendChild(H)})}S.addEventListener("click",function(){oe();var G=f?f.value.trim():"",k=h?h.value.trim():"";if(!G&&!k){U("Enter a city or country first.");return}var H=G||k;U(""),S.disabled=!0,S.textContent="Searching\u2026";var q="https://geocoding-api.open-meteo.com/v1/search?name="+encodeURIComponent(H)+"&count=10&language=en&format=json",Q=new AbortController,he=setTimeout(function(){Q.abort()},1e4);fetch(q,{signal:Q.signal}).then(function(be){return be.json()}).then(function(be){var Ee=be&&be.results||[];if(!Ee.length){U("No matches \u2014 try adding a country, or drag the pin on the map.");return}if(k){var A=k.toLowerCase(),w=function(ee){return(ee.admin1||"").toLowerCase().indexOf(A)!==-1||(ee.country||"").toLowerCase().indexOf(A)!==-1};Ee=Ee.slice().sort(function(ee,Ce){var ye=w(ee),lt=w(Ce);return ye===lt?0:ye?-1:1})}X(Ee)}).catch(function(){}).then(function(){clearTimeout(he),S.disabled=!1,S.textContent=F})}),j()}function F0(){var o=new Date;return o.setSeconds(0,0),o.setMinutes(o.getMinutes()-o.getTimezoneOffset()),o.toISOString().slice(0,16)}function T0(){var o={title:"Title",date:"Date & time",content:"Content"},l=document.querySelector('form[name="new-entry"]');if(!l)return;var s=ct("date");s&&!String(s.value).trim()&&(s.value=F0());function a(){l.querySelectorAll(".field-error").forEach(function(c){c.remove()}),l.querySelectorAll(".field-invalid").forEach(function(c){c.classList.remove("field-invalid")})}function f(c,d){c.classList.add("field-invalid");var v=document.createElement("span");v.className="field-error",v.textContent=d,c.parentNode.insertBefore(v,c.nextSibling)}function h(c){var d=l.querySelector(".photos-collapse"),v,y;if(d?(d.open=!0,y=d.querySelector(".photos-collapse__summary"),v=d):(v=document.querySelector(".filepond-root, .form-input-file"),y=v),!y)return v||null;var x=document.createElement("span");return x.className="field-error",x.textContent=c,y.insertAdjacentElement("afterend",x),v||y}l.addEventListener("submit",function(c){a();var d=null;!Yo&&document.querySelectorAll(".filepond--item").length<1&&(d=h("Add at least one photo.")),Object.keys(o).forEach(function(y){var x=ct(y);x&&!String(x.value).trim()&&(f(x,o[y]+" is required."),d||(d=x))});var v=l.querySelector(".location-field--mismatch");v&&!d&&(d=v),d&&(c.preventDefault(),typeof d.focus=="function"&&d.focus(),d.scrollIntoView({behavior:"smooth",block:"center"}))})}var ql="intotheeast:new-entry-draft";function L0(o){return Array.prototype.slice.call(o.querySelectorAll('[name^="data["]')).filter(function(l){if(l.type==="file")return!1;var s=l.name;return s.indexOf("data[_json")!==0&&s.indexOf("data[photos")!==0})}function M0(){var o=document.querySelector(".filepond-root, .form-input-file");if(!(!o||!o.parentNode)&&!o.parentNode.querySelector(".photo-reauth-hint")){var l=document.createElement("p");l.className="photo-reauth-hint is-shown",l.textContent="Your text was restored \u2014 photos need re-selecting (they can\u2019t be saved in a draft).",o.parentNode.insertBefore(l,o.nextSibling)}}function B0(){var o=document.querySelector('form[name="new-entry"]');if(!o||Yo)return;if(document.querySelector(".notices.success")){try{localStorage.removeItem(ql)}catch{}return}function l(){var h={};L0(o).forEach(function(c){c.type==="radio"?c.checked&&(h[c.name]=c.value):h[c.name]=c.value});try{localStorage.setItem(ql,JSON.stringify(h))}catch{}}var s=null;try{s=localStorage.getItem(ql)}catch{s=null}if(s){var a=null;try{a=JSON.parse(s)}catch{a=null}if(a){var f=!1;Object.keys(a).forEach(function(h){var c=a[h];if(c!=null&&String(c).trim()&&(f=!0),h!=="data[content]"){var d=o.querySelectorAll('input[type="radio"][name="'+h+'"]');if(d.length){d.forEach(function(y){y.checked=y.value===c});return}var v=o.querySelector('[name="'+h+'"]');v&&v.type!=="file"&&(v.value=c)}}),window.postFormEditor&&a["data[content]"]!=null&&window.postFormEditor.value(a["data[content]"]),f&&M0()}}o.addEventListener("input",l),o.addEventListener("change",l),window.postFormEditor&&window.postFormEditor.codemirror.on("change",l)}function _0(){var o=document.querySelector(".post-form-wrap"),l=document.querySelector(".post-form-wrap .notices.success, .post-form-wrap .notices.green");if(!(!o||!l)){var s=document.createElement("div");s.className="post-success";var a=document.createElement("p");a.className="post-success__title",a.textContent="\u2713 Saved to your journal.",s.appendChild(a);var f=document.createElement("div");f.className="post-success__actions";var h=o.getAttribute("data-trip-url");if(h){var c=document.createElement("a");c.className="post-success__view",c.href=h,c.textContent="View your journal \u2192",f.appendChild(c)}var d=document.createElement("a");d.className="post-success__again",d.href=window.location.pathname,d.textContent="Post another",f.appendChild(d),s.appendChild(f),l.parentNode.insertBefore(s,l.nextSibling),["form",".form-action-row","#location-status","#weather-status"].forEach(function(v){var y=o.querySelector(v);y&&(y.style.display="none")}),l.scrollIntoView({behavior:"smooth",block:"start"})}}var Yo=!1;function _c(o){return new URLSearchParams(window.location.search).get(o)}function hr(o,l){var s=ct(o);s&&(s.value=l==null?"":String(l))}function Rl(o,l){var s=l?"1":"0",a=document.querySelectorAll('[name="data['+o+']"]');Array.prototype.forEach.call(a,function(f){f.checked=String(f.value)===s})}function z0(o){var l=o==null?"":String(o);if(window.postFormEditor&&typeof window.postFormEditor.value=="function")window.postFormEditor.value(l);else{var s=ct("content");s&&(s.value=l)}}function zc(o,l){var s=o.querySelectorAll("input, textarea, select, button");Array.prototype.forEach.call(s,function(a){a.type==="file"||a.name&&a.name.indexOf("data[photos")===0||(a.disabled=l)}),window.postFormEditor&&window.postFormEditor.codemirror&&window.postFormEditor.codemirror.setOption("readOnly",l?"nocursor":!1)}function Wl(o,l){o&&(o.tagName==="INPUT"?o.value=l:o.textContent=l)}function N0(o,l){var s=o.querySelector(".post-edit-error");if(s){s.textContent=l;return}var a=document.createElement("div");a.className="post-edit-error",a.setAttribute("role","alert"),a.textContent=l;var f=o.querySelector("h1");f?f.insertAdjacentElement("afterend",a):o.insertBefore(a,o.firstChild)}var O0=/\.(jpe?g|png|webp|heic|heif|gif)$/i;function Nc(o){var l=/(?:^|\/)photo-0*(\d+)\./i.exec(o);return l?parseInt(l[1],10):Number.MAX_SAFE_INTEGER}function I0(o,l){var s=Nc(o),a=Nc(l);return s!==a?s-a:ol?1:0}function Oc(o,l){var s=String(o||"photo"),a=s.lastIndexOf("."),f=(a>0?s.slice(0,a):s).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"photo",h=l?".jpg":a>0?s.slice(a).toLowerCase():".jpg",c=Date.now().toString(36)+Math.random().toString(36).slice(2,6);return f+"-"+c+h}function H0(o){var l=document.querySelector('form[name="new-entry"]');if(!l||!o)return;var s=o.split("/").filter(Boolean).pop();if(!s)return;var a=document.querySelector(".filepond-root, .form-input-file"),f=a?a.closest(".form-field"):null;f&&(f.style.display="none");var h=l.querySelector(".photos-collapse");h&&(h.style.display="none");var c=document.createElement("div");c.className="photo-editor",c.innerHTML='
    Photos

    ',f&&f.parentNode?f.parentNode.insertBefore(c,f):l.insertBefore(c,l.firstElementChild);var d=c.querySelector(".photo-editor__grid"),v=c.querySelector(".photo-editor__status"),y=c.querySelector(".photo-editor__add"),x=c.querySelector(".photo-editor__input"),D=[],S=null,F=!1,B=0;function L(X,G){v.textContent=X||"",v.className="photo-editor__status gpx-status"+(G?" error":"")}function T(X){F=X,y.disabled=X,Array.prototype.forEach.call(d.querySelectorAll(".photo-editor__del, .photo-editor__confirm-yes, .photo-editor__confirm-no"),function(G){G.disabled=X}),S&&S.option("disabled",X)}function N(){return fetch("/api/v1/pages"+o+"/media",{credentials:"include",headers:{Accept:"application/json"}}).then(function(X){if(!X.ok)throw new Error("HTTP "+X.status);return X.json()}).then(function(X){return(X&&X.data||[]).filter(function(G){return G&&typeof G.filename=="string"&&O0.test(G.filename)}).map(function(G){return G.filename}).sort(I0)})}function z(X){return Cn("/api/v1/entry/"+encodeURIComponent(s)+"/photos/order",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({order:X})})}function O(X){if(D=(X||[]).slice(),S&&(S.destroy(),S=null),d.innerHTML="",!D.length){d.innerHTML='

    No photos yet \u2014 add some.

    ';return}var G=++B;D.forEach(function(k){var H=document.createElement("div");H.className="photo-editor__cell",H.setAttribute("data-filename",k);var q=document.createElement("img");q.className="photo-editor__img",q.loading="lazy",q.alt=k,q.src=o+"/"+encodeURIComponent(k)+"?v="+G;var Q=document.createElement("button");Q.type="button",Q.className="photo-editor__del",Q.setAttribute("aria-label","Delete "+k),Q.textContent="\u2715",Q.addEventListener("click",function(){K(H,k)}),H.appendChild(q),H.appendChild(Q),d.appendChild(H)}),D.length>1&&(S=new Tc(d,{animation:150,draggable:".photo-editor__cell",filter:".photo-editor__confirm",onEnd:j}))}function I(){return Array.prototype.map.call(d.querySelectorAll(".photo-editor__cell"),function(X){return X.getAttribute("data-filename")})}function W(X,G){if(X.length!==G.length)return!1;for(var k=0;kDelete?',X.appendChild(k),X.classList.add("is-confirming"),k.querySelector(".photo-editor__confirm-no").addEventListener("click",function(){X.classList.remove("is-confirming"),k.remove()}),k.querySelector(".photo-editor__confirm-yes").addEventListener("click",function(){k.querySelector(".photo-editor__confirm-yes").disabled=!0,k.querySelector(".photo-editor__confirm-no").disabled=!0,de(G)})}}function de(X){var G=D.slice(),k=D.filter(function(H){return H!==X});T(!0),L("Deleting\u2026"),Cn("/api/v1/pages"+o+"/media/"+encodeURIComponent(X),{method:"DELETE"},[204,404]).then(function(){return(k.length?z(k):Promise.resolve()).then(N).then(function(H){L(""),O(H)},function(){L("Photo deleted, but refreshing the list failed \u2014 reload if it looks off.",!0),O(k)})},function(H){L(Pl(H,"Couldn\u2019t delete that photo. Try again."),!0),O(G)}).then(function(){T(!1)})}function U(X){return Hc(X).then(function(G){return G?import("./heic-to-CN7JBE7H.js").then(function(k){var H=k.heicTo||k.default&&k.default.heicTo;return H({blob:X,type:"image/jpeg",quality:.85})}).then(function(k){return{blob:k,name:Oc(X.name,!0)}}):{blob:X,name:Oc(X.name,!1)}})}y.addEventListener("click",function(){F||x.click()}),x.addEventListener("change",function(){var X=Array.prototype.slice.call(x.files||[]);x.value="",X.length&&oe(X)});function oe(X){T(!0);var G=X.length,k=0,H=0,q=!1,Q=D.slice(),he=Promise.resolve();X.forEach(function(be){he=he.then(function(){return k++,L("Uploading "+k+" of "+G+"\u2026"),U(be).then(function(Ee){var A=new FormData;return A.append("file",Ee.blob,Ee.name),Cn("/api/v1/pages"+o+"/media",{method:"POST",body:A})}).then(null,function(Ee){H++,Ee&&(Ee.status===401||Ee.status===403)&&(q=!0)})})}),he.then(function(){return L("Finishing\u2026"),N()}).then(function(be){var Ee=Q.filter(function(ee){return be.indexOf(ee)!==-1}),A=be.filter(function(ee){return Q.indexOf(ee)===-1}),w=Ee.concat(A);return w.length?z(w).catch(function(){return z(w)}).catch(function(){return Promise.all(A.map(function(ee){return Cn("/api/v1/pages"+o+"/media/"+encodeURIComponent(ee),{method:"DELETE"},[204,404]).then(function(){return!0},function(){return!1})})).then(function(ee){var Ce=new Error("reorder failed");throw Ce.rolledBack=!0,Ce.rollbackIncomplete=ee.indexOf(!1)!==-1,Ce})}).then(N):(O([]),null)}).then(function(be){be&&O(be),H?L(q?"Couldn\u2019t add photos \u2014 your login session expired. Sign in again, then retry.":H+" photo"+(H>1?"s":"")+" couldn\u2019t be added.",!0):L("")}).catch(function(be){var Ee;return be&&be.rolledBack?Ee=be.rollbackIncomplete?"Couldn\u2019t finish adding photos and cleanup was incomplete \u2014 reload the page and check your photos.":"Couldn\u2019t finish adding photos \u2014 changes were rolled back. Try again.":Ee="Couldn\u2019t add photos. Please try again.",L(Ee,!0),N().then(O,function(){O(Q)})}).then(function(){T(!1)})}d.innerHTML='

    Loading photos\u2026

    ',N().then(O).catch(function(){L("Couldn\u2019t load photos.",!0),O([])})}function P0(){var o=document.querySelector('form[name="new-entry"]'),l=document.querySelector(".post-form-wrap");if(!(!o||!l)){var s=_c("edit");if(s){Yo=!0;var a=l.querySelector("h1");a&&(a.textContent="Edit entry");var f=o.querySelector('button[type="submit"], input[type="submit"]'),h=f?f.tagName==="INPUT"?f.value:f.textContent:"Save changes";zc(o,!0),Wl(f,"Loading entry\u2026");var c=_c("return")||l.getAttribute("data-trip-url")||"";o.setAttribute("action","/post?edit="+encodeURIComponent(s)+(c?"&return="+encodeURIComponent(c):"")),fetch("/api/v1/pages"+s,{credentials:"include",headers:{Accept:"application/json"}}).then(function(d){if(!d.ok){var v=new Error("HTTP "+d.status);throw v.status=d.status,v}return d.json()}).then(function(d){var v=d&&d.data||{},y=v.header||{};hr("title",y.title!=null?y.title:v.title),hr("date",y.date?String(y.date).replace(" ","T"):""),z0(v.content),hr("lat",y.lat),hr("lng",y.lng),Ul(),hr("location_city",y.location_city),hr("location_country",y.location_country),hr("weather_desc",y.weather_desc),hr("weather_temp_c",y.weather_temp_c),hr("transport_mode",y.transport_mode),Rl("featured",y.featured),Rl("force_connect",y.force_connect),Rl("published",y.published!==void 0?y.published:v.published);var x=ct("edit_path");x&&(x.value=s+"/entry.md"),zc(o,!1),Wl(f,"Save changes");var D=o.querySelector(".more-options");D&&(D.open=!0),H0(s)}).catch(function(d){var v=d&&d.status===404?"This entry no longer exists \u2014 it may have been deleted. Head back to the journal.":"Sorry \u2014 this entry couldn\u2019t be loaded for editing. Check your connection and try again.";N0(l,v),Wl(f,h)})}}}function Ic(){window.postFormEditor=v0(),_0(),P0(),B0(),w0(),C0(),k0(),A0(),T0()}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Ic):Ic(); /*! Bundled license information: sortablejs/modular/sortable.esm.js: diff --git a/themes/intotheeast/js/src/location-map.js b/themes/intotheeast/js/src/location-map.js index 6256b29..96986a9 100644 --- a/themes/intotheeast/js/src/location-map.js +++ b/themes/intotheeast/js/src/location-map.js @@ -26,7 +26,7 @@ var cached = null; // { container, promise } function buildPinElement() { var el = document.createElement('div'); - el.className = 'location-pin'; // visual styling lives in style.css + el.className = 'location-pin'; // visual styling lives in post-form.css return el; } @@ -58,7 +58,9 @@ export function getOrCreateLocationMap(container, onDragEnd) { if (!pinSet) { marker.addTo(map); pinSet = true; } map.panTo([lng, lat]); }, - hasPin: function () { return pinSet; }, + clearPin: function () { + if (pinSet) { marker.remove(); pinSet = false; } + }, resize: function () { map.resize(); } }; }).catch(function (err) { diff --git a/themes/intotheeast/js/src/post-form.css b/themes/intotheeast/js/src/post-form.css index 87b94fd..ba877a3 100644 --- a/themes/intotheeast/js/src/post-form.css +++ b/themes/intotheeast/js/src/post-form.css @@ -522,9 +522,12 @@ /* "More location details" disclosure — search + map preview for setting an entry's coordinates without live GPS. Mirrors .more-options's disclosure - look (above); the lat/lng fields (relocated here by JS) and the lookup - button reuse style.css's existing .btn-action/.form-status/.field-invalid - conventions unmodified. */ + look (above); the lookup button reuses style.css's existing .btn-action / + .form-status conventions unmodified. The relocated lat/lng fields do NOT + reuse .field-invalid — the panel adds its own .location-field--mismatch / + .location-field-note pair below, because the mismatch state is advisory and + carries live aria-invalid / aria-describedby wiring that showError() does + not. Worth consolidating with .field-invalid if that ever gains the same. */ .location-details { margin-bottom: var(--space-5); border: 1px solid var(--color-border); diff --git a/themes/intotheeast/js/src/post-form.js b/themes/intotheeast/js/src/post-form.js index ebc0036..992928f 100644 --- a/themes/intotheeast/js/src/post-form.js +++ b/themes/intotheeast/js/src/post-form.js @@ -607,12 +607,29 @@ function initLocationDetails() { // ── Map + sync (U4, U5, R9-R14, KTD1/KTD3/KTD4) ── var mapHandle = null; + // parseFloat is a PREFIX parser and must not be used here: '48abc' → 48, + // '48,85' → 48 (comma-decimal paste), '35.0116S' → +35.0116 (hemisphere + // suffix silently flipped to the wrong side of the equator). All three pass + // an isFinite + range check, clear the flag, and post the original string — + // the exact silent-corruption class this feature exists to end. Require the + // whole value to be a plain decimal instead. Not bare Number(): Number('') + // is 0, which would make a blank pair "valid" and pin it at Null Island. + function parseCoord(v) { + var s = String(v).trim(); + if (!s || !/^[+-]?(\d+(\.\d*)?|\.\d+)$/.test(s)) return NaN; + return Number(s); + } + function syncFields() { - var lat = parseFloat(latEl.value); - var lng = parseFloat(lngEl.value); + var lat = parseCoord(latEl.value); + var lng = parseCoord(lngEl.value); var valid = isFinite(lat) && isFinite(lng) && lat >= -90 && lat <= 90 && lng >= -180 && lng <= 180; if (valid) { + // Normalise to the same precision the GPS handler and onDragEnd + // write, so what the pin shows is exactly what gets submitted. + latEl.value = lat.toFixed(6); + lngEl.value = lng.toFixed(6); clearMismatch(); if (mapHandle) mapHandle.setPin(lat, lng); } else if (latEl.value.trim() || lngEl.value.trim()) { @@ -621,8 +638,10 @@ function initLocationDetails() { setMismatch(); } else { // Both blanked back out after being flagged — nothing left to submit, - // so the flag no longer applies. + // so the flag no longer applies. Drop the pin too: leaving it behind + // would present a stale coordinate as if it were still the entry's. clearMismatch(); + if (mapHandle) mapHandle.clearPin(); } } syncPinFromFields = syncFields; // expose for initGeo()'s GPS handler @@ -643,6 +662,10 @@ function initLocationDetails() { syncFields(); }).catch(function () { setHint('Map preview unavailable — you can still enter coordinates directly.'); + // Still validate: syncFields tolerates a null mapHandle, and without + // this an offline traveller could open the panel and submit an + // invalid coordinate that was never flagged. + syncFields(); }); }); @@ -731,6 +754,14 @@ function initLocationDetails() { lookupBtn.textContent = LOOKUP_LABEL; }); }); + + // Validate whatever is already in the fields at boot. initDraft() restores + // data[lat]/data[lng] from localStorage before this runs, and edit-mode + // prefills them asynchronously — both by direct .value assignment, which + // fires no events. Without this the submit gate in initValidation (which + // keys on .location-field--mismatch) sees no flag and lets a restored + // invalid coordinate straight through. + syncFields(); } /* ── Blocking required-field validation (U5, R19) ───────────── @@ -1418,6 +1449,11 @@ function initEditMode() { editSetContent(d.content); editSetText('lat', h.lat); editSetText('lng', h.lng); + // Direct .value writes fire no events, so flag/pin state would stay + // stale — and an entry stored with an out-of-range coordinate would + // never be flagged. initLocationDetails() has already replaced the + // no-op by the time this async prefill resolves. + syncPinFromFields(); editSetText('location_city', h.location_city); editSetText('location_country', h.location_country); editSetText('weather_desc', h.weather_desc); From e873a9cb2341008c3d0fbe481e79000cac729c9d Mon Sep 17 00:00:00 2001 From: Mischa Date: Fri, 24 Jul 2026 21:48:20 +0200 Subject: [PATCH 6/8] fix(review): land cleanCoordinate server-side guard; surface geocode failures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two code-review follow-ups. cleanCoordinate() — the server-side coordinate sanitizer the design doc and plan both describe as already shipped — had never actually been committed; it existed only as uncommitted work in another checkout, so this branch had no server-side validation of lat/lng at all (the blueprint fields are plain `type: text` with no `validate:` key). Landing it here makes the spec's stated safety net real. Also corrected its onAdminSave comment, which justified that hook by saying the public form's lat/lng inputs are CSS-hidden and GPS-filled — true before this feature, inverted by it. Both hooks are needed: this branch makes /post the primary hand-entry path, not Admin2. The geocode lookup swallowed every failure and reset the button, leaving the DOM byte-identical to the pre-click state — a traveller on flaky mobile data could not distinguish a failed lookup from a broken button. It now shows a distinct hint, and checks r.ok first so a 4xx/5xx body no longer parses as "no results" and tells the traveller their city does not exist. R8's actual guarantee (fields untouched on failure) is preserved. Co-Authored-By: Claude Opus 5 --- plugins/cache-on-save/cache-on-save.php | 85 +++++++++++++++++++++++++ themes/intotheeast/js/post/post-form.js | 54 ++++++++-------- themes/intotheeast/js/src/post-form.js | 18 +++++- 3 files changed, 127 insertions(+), 30 deletions(-) diff --git a/plugins/cache-on-save/cache-on-save.php b/plugins/cache-on-save/cache-on-save.php index ed5562e..64dad8d 100644 --- a/plugins/cache-on-save/cache-on-save.php +++ b/plugins/cache-on-save/cache-on-save.php @@ -3,6 +3,7 @@ namespace Grav\Plugin; use Grav\Common\Cache; use Grav\Common\Data\ValidationException; +use Grav\Common\Page\Interfaces\PageInterface; use Grav\Common\Plugin; use RocketTheme\Toolbox\Event\Event; @@ -43,6 +44,16 @@ class CacheOnSavePlugin extends Plugin // (priority 0) has created the page and copied the uploaded files — // we reorder those files, then clear the page-tree cache. 'onFormProcessed' => ['onFormProcessed', -100], + // Fired by the api plugin (PagesController) on every Admin2-driven + // create/update/translate, right before $page->save(). + // onFormValidationProcessed (above) does not fire for Admin2 saves, + // so BOTH hooks are needed to cover every path lat/lng can arrive + // through: this one for Admin2/API, that one for the public /post + // form. (Until the location-override panel shipped, the public + // form's lat/lng inputs were CSS-hidden and GPS-filled, making + // Admin2 the only realistic hand-entry route. They are now visible + // and directly editable, so the /post path is the primary one.) + 'onAdminSave' => ['onAdminSave', 0], ]; } @@ -74,6 +85,7 @@ class CacheOnSavePlugin extends Plugin } $form->setData('parent', $this->resolveDailiesParent($activeTrip)); + $this->sanitizeCoordinates($form); // One shared /post form drives both create and edit (KTD1). add-page-by-form // reads overwrite_mode from the /post page header's pageconfig (not form @@ -149,6 +161,79 @@ class CacheOnSavePlugin extends Plugin return '/' . $trip . '/dailies'; } + /** + * Strip invisible Unicode formatting characters (bidi marks, zero-width + * joiners, etc. — Unicode category "Cf") from a pasted lat/lng value, then + * validate the result is a real coordinate. + * + * Root cause this guards against: coordinates copied from a maps app can + * carry an invisible mark (e.g. U+200E LEFT-TO-RIGHT MARK) that neither + * JS `.trim()` nor PHP's numeric-string coercion strip. Twig's + * `number_format` filter then silently float-casts the corrupted string + * to 0.0 (PHP does not raise a warning), placing the entry at Null Island + * instead of failing loudly. + * + * Coordinates are optional (some entries intentionally have none), so a + * blank value cleans to '' with no error — only a non-blank value that + * still fails to parse as an in-range decimal after cleaning is rejected. + * + * @return string the cleaned value to write back + * @throws ValidationException if non-blank but still invalid after cleaning + */ + private function cleanCoordinate(string $field, string $raw, float $bound): string + { + $clean = trim(preg_replace('/\p{Cf}/u', '', $raw) ?? $raw); + if ($clean === '') { + return $clean; + } + if (!is_numeric($clean) || abs((float) $clean) > $bound) { + throw new ValidationException(sprintf( + '%s "%s" is not a valid coordinate — check for stray characters from pasting.', + $field === 'lat' ? 'Latitude' : 'Longitude', + $raw + )); + } + return $clean; + } + + /** Post-form entry point (see cleanCoordinate) — 'lat'/'lng' as top-level form fields. */ + private function sanitizeCoordinates($form): void + { + foreach (['lat' => 90.0, 'lng' => 180.0] as $field => $bound) { + $raw = $form->value($field); + if (!is_string($raw)) { + continue; + } + $form->setData($field, $this->cleanCoordinate($field, $raw, $bound)); + } + } + + /** + * Admin2/API entry point (see cleanCoordinate) — 'header.lat'/'header.lng' + * on the Page object the api plugin is about to save. Fires on every + * create/update/translate (PagesController::create/update/translatePage), + * so this also re-validates already-clean values on every subsequent edit + * — harmless, since a clean value round-trips unchanged. + */ + public function onAdminSave(Event $event): void + { + $page = $event['page'] ?? $event['object'] ?? null; + if (!$page instanceof PageInterface) { + return; + } + $header = $page->header(); + if (!$header) { + return; + } + foreach (['lat' => 90.0, 'lng' => 180.0] as $field => $bound) { + $raw = $header->{$field} ?? null; + if (!is_string($raw)) { + continue; // unset, null, or already a native number — nothing to clean + } + $header->{$field} = $this->cleanCoordinate($field, $raw, $bound); + } + } + /** * The photo order the user arranged in the form, sent explicitly by * post-form.js as a JSON array of filenames in the dedicated diff --git a/themes/intotheeast/js/post/post-form.js b/themes/intotheeast/js/post/post-form.js index 067ec52..53af4f3 100644 --- a/themes/intotheeast/js/post/post-form.js +++ b/themes/intotheeast/js/post/post-form.js @@ -1,46 +1,46 @@ -import{a as Ju,b as at,c as Jh}from"./chunk-ZWRDP37E.js";var At=at((nl,ol)=>{(function(o,l){typeof nl=="object"&&typeof ol<"u"?ol.exports=l():typeof define=="function"&&define.amd?define(l):(o=o||self,o.CodeMirror=l())})(nl,function(){"use strict";var o=navigator.userAgent,l=navigator.platform,s=/gecko\/\d/i.test(o),a=/MSIE \d/.test(o),f=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(o),h=/Edge\/(\d+)/.exec(o),c=a||f||h,d=c&&(a?document.documentMode||6:+(h||f)[1]),v=!h&&/WebKit\//.test(o),y=v&&/Qt\/\d+\.\d+/.test(o),x=!h&&/Chrome\/(\d+)/.exec(o),D=x&&+x[1],S=/Opera\//.test(o),F=/Apple Computer/.test(navigator.vendor),B=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(o),L=/PhantomJS/.test(o),T=F&&(/Mobile\/\w+/.test(o)||navigator.maxTouchPoints>2),N=/Android/.test(o),z=T||N||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(o),O=T||/Mac/.test(l),I=/\bCrOS\b/.test(o),W=/win/i.test(l),j=S&&o.match(/Version\/(\d*\.\d*)/);j&&(j=Number(j[1])),j&&j>=15&&(S=!1,v=!0);var K=O&&(y||S&&(j==null||j<12.11)),de=s||c&&d>=9;function U(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var oe=function(e,t){var i=e.className,r=U(t).exec(i);if(r){var n=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(n?r[1]+n:"")}};function X(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function G(e,t){return X(e).appendChild(t)}function k(e,t,i,r){var n=document.createElement(e);if(i&&(n.className=i),r&&(n.style.cssText=r),typeof t=="string")n.appendChild(document.createTextNode(t));else if(t)for(var u=0;u=t)return p+(t-u);p+=g-u,p+=i-p%i,u=g+1}}var dt=function(){this.id=null,this.f=null,this.time=0,this.handler=lt(this.onTimeout,this)};dt.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},dt.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i=t)return r+Math.min(p,t-n);if(n+=u-r,n+=i-n%i,r=u+1,n>=t)return r}}var Ht=[""];function pr(e){for(;Ht.length<=e;)Ht.push(De(Ht)+" ");return Ht[e]}function De(e){return e[e.length-1]}function Pt(e,t){for(var i=[],r=0;r"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Pc.test(e))}function kn(e,t){return t?t.source.indexOf("\\w")>-1&&Zo(e)?!0:t.test(e):Zo(e)}function Gl(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var qc=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Qo(e){return e.charCodeAt(0)>=768&&qc.test(e)}function Xl(e,t,i){for(;(i<0?t>0:ti?-1:1;;){if(t==i)return t;var n=(t+i)/2,u=r<0?Math.ceil(n):Math.floor(n);if(u==t)return e(u)?t:i;e(u)?i=u:t=u+r}}function Rc(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,u=0;ut||t==i&&p.to==t)&&(r(Math.max(p.from,t),Math.min(p.to,i),p.level==1?"rtl":"ltr",u),n=!0)}n||r(t,i,"ltr")}var Mi=null;function Bi(e,t,i){var r;Mi=null;for(var n=0;nt)return n;u.to==t&&(u.from!=u.to&&i=="before"?r=n:Mi=n),u.from==t&&(u.from!=u.to&&i!="before"?r=n:Mi=n)}return r??Mi}var Wc=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(b){return b<=247?e.charAt(b):1424<=b&&b<=1524?"R":1536<=b&&b<=1785?t.charAt(b-1536):1774<=b&&b<=2220?"r":8192<=b&&b<=8203?"w":b==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,u=/[LRr]/,p=/[Lb1n]/,g=/[1n]/;function m(b,C,E){this.level=b,this.from=C,this.to=E}return function(b,C){var E=C=="ltr"?"L":"R";if(b.length==0||C=="ltr"&&!r.test(b))return!1;for(var _=b.length,M=[],P=0;P<_;++P)M.push(i(b.charCodeAt(P)));for(var R=0,Z=E;R<_;++R){var J=M[R];J=="m"?M[R]=Z:Z=J}for(var te=0,V=E;te<_;++te){var ie=M[te];ie=="1"&&V=="r"?M[te]="n":u.test(ie)&&(V=ie,ie=="r"&&(M[te]="R"))}for(var se=1,le=M[0];se<_-1;++se){var we=M[se];we=="+"&&le=="1"&&M[se+1]=="1"?M[se]="1":we==","&&le==M[se+1]&&(le=="1"||le=="n")&&(M[se]=le),le=we}for(var Le=0;Le<_;++Le){var it=M[Le];if(it==",")M[Le]="N";else if(it=="%"){var Ie=void 0;for(Ie=Le+1;Ie<_&&M[Ie]=="%";++Ie);for(var Et=Le&&M[Le-1]=="!"||Ie<_&&M[Ie]=="1"?"1":"N",wt=Le;wt-1&&(r[t]=n.slice(0,u).concat(n.slice(u+1)))}}}function je(e,t){var i=Jo(e,t);if(i.length)for(var r=Array.prototype.slice.call(arguments,2),n=0;n0}function Jr(e){e.prototype.on=function(t,i){ue(this,t,i)},e.prototype.off=function(t,i){Mt(this,t,i)}}function bt(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Zl(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Vo(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function _i(e){bt(e),Zl(e)}function $o(e){return e.target||e.srcElement}function Ql(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),O&&e.ctrlKey&&t==1&&(t=3),t}var Uc=function(){if(c&&d<9)return!1;var e=k("div");return"draggable"in e||"dragDrop"in e}(),ea;function jc(e){if(ea==null){var t=k("span","\u200B");G(e,k("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(ea=t.offsetWidth<=1&&t.offsetHeight>2&&!(c&&d<8))}var i=ea?k("span","\u200B"):k("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var ta;function Gc(e){if(ta!=null)return ta;var t=G(e,document.createTextNode("A\u062EA")),i=q(t,0,1).getBoundingClientRect(),r=q(t,1,2).getBoundingClientRect();return X(e),!i||i.left==i.right?!1:ta=r.right-i.right<3}var ra=` +import{a as Ju,b as at,c as Jh}from"./chunk-ZWRDP37E.js";var At=at((nl,ol)=>{(function(o,l){typeof nl=="object"&&typeof ol<"u"?ol.exports=l():typeof define=="function"&&define.amd?define(l):(o=o||self,o.CodeMirror=l())})(nl,function(){"use strict";var o=navigator.userAgent,l=navigator.platform,s=/gecko\/\d/i.test(o),a=/MSIE \d/.test(o),f=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(o),h=/Edge\/(\d+)/.exec(o),c=a||f||h,d=c&&(a?document.documentMode||6:+(h||f)[1]),v=!h&&/WebKit\//.test(o),y=v&&/Qt\/\d+\.\d+/.test(o),x=!h&&/Chrome\/(\d+)/.exec(o),D=x&&+x[1],S=/Opera\//.test(o),F=/Apple Computer/.test(navigator.vendor),B=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(o),L=/PhantomJS/.test(o),T=F&&(/Mobile\/\w+/.test(o)||navigator.maxTouchPoints>2),N=/Android/.test(o),z=T||N||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(o),O=T||/Mac/.test(l),I=/\bCrOS\b/.test(o),U=/win/i.test(l),j=S&&o.match(/Version\/(\d*\.\d*)/);j&&(j=Number(j[1])),j&&j>=15&&(S=!1,v=!0);var K=O&&(y||S&&(j==null||j<12.11)),de=s||c&&d>=9;function W(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var oe=function(e,t){var i=e.className,r=W(t).exec(i);if(r){var n=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(n?r[1]+n:"")}};function X(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function G(e,t){return X(e).appendChild(t)}function k(e,t,i,r){var n=document.createElement(e);if(i&&(n.className=i),r&&(n.style.cssText=r),typeof t=="string")n.appendChild(document.createTextNode(t));else if(t)for(var u=0;u=t)return p+(t-u);p+=g-u,p+=i-p%i,u=g+1}}var dt=function(){this.id=null,this.f=null,this.time=0,this.handler=lt(this.onTimeout,this)};dt.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},dt.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i=t)return r+Math.min(p,t-n);if(n+=u-r,n+=i-n%i,r=u+1,n>=t)return r}}var Ht=[""];function pr(e){for(;Ht.length<=e;)Ht.push(De(Ht)+" ");return Ht[e]}function De(e){return e[e.length-1]}function Pt(e,t){for(var i=[],r=0;r"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Pc.test(e))}function kn(e,t){return t?t.source.indexOf("\\w")>-1&&Zo(e)?!0:t.test(e):Zo(e)}function Gl(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var qc=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Qo(e){return e.charCodeAt(0)>=768&&qc.test(e)}function Xl(e,t,i){for(;(i<0?t>0:ti?-1:1;;){if(t==i)return t;var n=(t+i)/2,u=r<0?Math.ceil(n):Math.floor(n);if(u==t)return e(u)?t:i;e(u)?i=u:t=u+r}}function Rc(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,u=0;ut||t==i&&p.to==t)&&(r(Math.max(p.from,t),Math.min(p.to,i),p.level==1?"rtl":"ltr",u),n=!0)}n||r(t,i,"ltr")}var Mi=null;function Bi(e,t,i){var r;Mi=null;for(var n=0;nt)return n;u.to==t&&(u.from!=u.to&&i=="before"?r=n:Mi=n),u.from==t&&(u.from!=u.to&&i!="before"?r=n:Mi=n)}return r??Mi}var Wc=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(b){return b<=247?e.charAt(b):1424<=b&&b<=1524?"R":1536<=b&&b<=1785?t.charAt(b-1536):1774<=b&&b<=2220?"r":8192<=b&&b<=8203?"w":b==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,u=/[LRr]/,p=/[Lb1n]/,g=/[1n]/;function m(b,C,E){this.level=b,this.from=C,this.to=E}return function(b,C){var E=C=="ltr"?"L":"R";if(b.length==0||C=="ltr"&&!r.test(b))return!1;for(var _=b.length,M=[],P=0;P<_;++P)M.push(i(b.charCodeAt(P)));for(var R=0,Z=E;R<_;++R){var J=M[R];J=="m"?M[R]=Z:Z=J}for(var te=0,V=E;te<_;++te){var ie=M[te];ie=="1"&&V=="r"?M[te]="n":u.test(ie)&&(V=ie,ie=="r"&&(M[te]="R"))}for(var se=1,le=M[0];se<_-1;++se){var we=M[se];we=="+"&&le=="1"&&M[se+1]=="1"?M[se]="1":we==","&&le==M[se+1]&&(le=="1"||le=="n")&&(M[se]=le),le=we}for(var Le=0;Le<_;++Le){var it=M[Le];if(it==",")M[Le]="N";else if(it=="%"){var Ie=void 0;for(Ie=Le+1;Ie<_&&M[Ie]=="%";++Ie);for(var Et=Le&&M[Le-1]=="!"||Ie<_&&M[Ie]=="1"?"1":"N",wt=Le;wt-1&&(r[t]=n.slice(0,u).concat(n.slice(u+1)))}}}function je(e,t){var i=Jo(e,t);if(i.length)for(var r=Array.prototype.slice.call(arguments,2),n=0;n0}function Jr(e){e.prototype.on=function(t,i){ue(this,t,i)},e.prototype.off=function(t,i){Mt(this,t,i)}}function bt(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Zl(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Vo(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function _i(e){bt(e),Zl(e)}function $o(e){return e.target||e.srcElement}function Ql(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),O&&e.ctrlKey&&t==1&&(t=3),t}var Uc=function(){if(c&&d<9)return!1;var e=k("div");return"draggable"in e||"dragDrop"in e}(),ea;function jc(e){if(ea==null){var t=k("span","\u200B");G(e,k("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(ea=t.offsetWidth<=1&&t.offsetHeight>2&&!(c&&d<8))}var i=ea?k("span","\u200B"):k("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var ta;function Gc(e){if(ta!=null)return ta;var t=G(e,document.createTextNode("A\u062EA")),i=q(t,0,1).getBoundingClientRect(),r=q(t,1,2).getBoundingClientRect();return X(e),!i||i.left==i.right?!1:ta=r.right-i.right<3}var ra=` b`.split(/\n/).length!=3?function(e){for(var t=0,i=[],r=e.length;t<=r;){var n=e.indexOf(` -`,t);n==-1&&(n=e.length);var u=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),p=u.indexOf("\r");p!=-1?(i.push(u.slice(0,p)),t+=p+1):(i.push(u),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},Xc=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch{return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch{}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Kc=function(){var e=k("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),ia=null;function Yc(e){if(ia!=null)return ia;var t=G(e,k("span","x")),i=t.getBoundingClientRect(),r=q(t,0,1).getBoundingClientRect();return ia=Math.abs(i.left-r.left)>1}var na={},Vr={};function Zc(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),na[e]=t}function Qc(e,t){Vr[e]=t}function Sn(e){if(typeof e=="string"&&Vr.hasOwnProperty(e))e=Vr[e];else if(e&&typeof e.name=="string"&&Vr.hasOwnProperty(e.name)){var t=Vr[e.name];typeof t=="string"&&(t={name:t}),e=jl(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Sn("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Sn("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function oa(e,t){t=Sn(t);var i=na[t.name];if(!i)return oa(e,"text/plain");var r=i(e,t);if($r.hasOwnProperty(t.name)){var n=$r[t.name];for(var u in n)n.hasOwnProperty(u)&&(r.hasOwnProperty(u)&&(r["_"+u]=r[u]),r[u]=n[u])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var p in t.modeProps)r[p]=t.modeProps[p];return r}var $r={};function Jc(e,t){var i=$r.hasOwnProperty(e)?$r[e]:$r[e]={};Lt(t,i)}function Lr(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var r in t){var n=t[r];n instanceof Array&&(n=n.concat([])),i[r]=n}return i}function aa(e,t){for(var i;e.innerMode&&(i=e.innerMode(t),!(!i||i.mode==e));)t=i.state,e=i.mode;return i||{mode:e,state:t}}function Jl(e,t,i){return e.startState?e.startState(t,i):!0}var Ge=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};Ge.prototype.eol=function(){return this.pos>=this.string.length},Ge.prototype.sol=function(){return this.pos==this.lineStart},Ge.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ge.prototype.next=function(){if(this.post},Ge.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ge.prototype.skipToEnd=function(){this.pos=this.string.length},Ge.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ge.prototype.backUp=function(e){this.pos-=e},Ge.prototype.column=function(){return this.lastColumnPos0?null:(u&&t!==!1&&(this.pos+=u[0].length),u)}},Ge.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ge.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ge.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ge.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ae(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var i=e;!i.lines;)for(var r=0;;++r){var n=i.children[r],u=n.chunkSize();if(t=e.first&&ti?Y(i,ae(e,i).text.length):Vc(t,ae(e,t.line).text.length)}function Vc(e,t){var i=e.ch;return i==null||i>t?Y(e.line,t):i<0?Y(e.line,0):e}function $l(e,t){for(var i=[],r=0;rthis.maxLookAhead&&(this.maxLookAhead=e),t},Zt.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},Zt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Zt.fromSaved=function(e,t,i){return t instanceof Fn?new Zt(e,Lr(e.mode,t.state),i,t.lookAhead):new Zt(e,Lr(e.mode,t),i)},Zt.prototype.save=function(e){var t=e!==!1?Lr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Fn(t,this.maxLookAhead):t};function es(e,t,i,r){var n=[e.state.modeGen],u={};as(e,t.text,e.doc.mode,i,function(b,C){return n.push(b,C)},u,r);for(var p=i.state,g=function(b){i.baseTokens=n;var C=e.state.overlays[b],E=1,_=0;i.state=!0,as(e,t.text,C.mode,i,function(M,P){for(var R=E;_M&&n.splice(E,1,M,n[E+1],Z),E+=2,_=Math.min(M,Z)}if(P)if(C.opaque)n.splice(R,E-R,M,"overlay "+P),E=R+2;else for(;Re.options.maxHighlightLength&&Lr(e.doc.mode,r.state),u=es(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=u.styles,u.classes?t.styleClasses=u.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Ni(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new Zt(r,!0,t);var u=$c(e,t,i),p=u>r.first&&ae(r,u-1).stateAfter,g=p?Zt.fromSaved(r,p,u):new Zt(r,Jl(r.mode),u);return r.iter(u,t,function(m){ca(e,m.text,g);var b=g.line;m.stateAfter=b==t-1||b%5==0||b>=n.viewFrom&&bt.start)return u}throw new Error("Mode "+e.name+" failed to advance stream.")}var is=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function ns(e,t,i,r){var n=e.doc,u=n.mode,p;t=ve(n,t);var g=ae(n,t.line),m=Ni(e,t.line,i),b=new Ge(g.text,e.options.tabSize,m),C;for(r&&(C=[]);(r||b.pose.options.maxHighlightLength?(g=!1,p&&ca(e,t,r,C.pos),C.pos=t.length,E=null):E=os(da(i,C,r.state,_),u),_){var M=_[0].name;M&&(E="m-"+(E?M+" "+E:M))}if(!g||b!=E){for(;mp;--g){if(g<=u.first)return u.first;var m=ae(u,g-1),b=m.stateAfter;if(b&&(!i||g+(b instanceof Fn?b.lookAhead:0)<=u.modeFrontier))return g;var C=Ye(m.text,null,e.options.tabSize);(n==null||r>C)&&(n=g-1,r=C)}return n}function ed(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontieri;r--){var n=ae(e,r).stateAfter;if(n&&(!(n instanceof Fn)||r+n.lookAhead=t:u.to>t);(r||(r=[])).push(new Tn(p,u.from,m?null:u.to))}}return r}function ad(e,t,i){var r;if(e)for(var n=0;n=t:u.to>t);if(g||u.from==t&&p.type=="bookmark"&&(!i||u.marker.insertLeft)){var m=u.from==null||(p.inclusiveLeft?u.from<=t:u.from0&&g)for(var ie=0;ie0)){var C=[m,1],E=me(b.from,g.from),_=me(b.to,g.to);(E<0||!p.inclusiveLeft&&!E)&&C.push({from:b.from,to:g.from}),(_>0||!p.inclusiveRight&&!_)&&C.push({from:g.to,to:b.to}),n.splice.apply(n,C),m+=C.length-3}}return n}function us(e){var t=e.markedSpans;if(t){for(var i=0;it)&&(!r||pa(r,u.marker)<0)&&(r=u.marker)}return r}function hs(e,t,i,r,n){var u=ae(e,t),p=rr&&u.markedSpans;if(p)for(var g=0;g=0&&E<=0||C<=0&&E>=0)&&(C<=0&&(m.marker.inclusiveRight&&n.inclusiveLeft?me(b.to,i)>=0:me(b.to,i)>0)||C>=0&&(m.marker.inclusiveRight&&n.inclusiveLeft?me(b.from,r)<=0:me(b.from,r)<0)))return!0}}}function qt(e){for(var t;t=ds(e);)e=t.find(-1,!0).line;return e}function ud(e){for(var t;t=Bn(e);)e=t.find(1,!0).line;return e}function fd(e){for(var t,i;t=Bn(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function ga(e,t){var i=ae(e,t),r=qt(i);return i==r?t:Fe(r)}function ps(e,t){if(t>e.lastLine())return t;var i=ae(e,t),r;if(!mr(e,i))return t;for(;r=Bn(i);)i=r.find(1,!0).line;return Fe(i)+1}function mr(e,t){var i=rr&&t.markedSpans;if(i){for(var r=void 0,n=0;nt.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var ei=function(e,t,i){this.text=e,fs(this,t),this.height=i?i(this):1};ei.prototype.lineNo=function(){return Fe(this)},Jr(ei);function cd(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),us(e),fs(e,i);var n=r?r(e):1;n!=e.height&&Yt(e,n)}function dd(e){e.parent=null,us(e)}var hd={},pd={};function gs(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?pd:hd;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function ms(e,t){var i=H("span",null,null,v?"padding-right: .1px":null),r={pre:H("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var u=n?t.rest[n-1]:t.line,p=void 0;r.pos=0,r.addToken=md,Gc(e.display.measure)&&(p=tr(u,e.doc.direction))&&(r.addToken=bd(r.addToken,p)),r.map=[];var g=t!=e.display.externalMeasured&&Fe(u);yd(u,r,ts(e,u,g)),u.styleClasses&&(u.styleClasses.bgClass&&(r.bgClass=Ee(u.styleClasses.bgClass,r.bgClass||"")),u.styleClasses.textClass&&(r.textClass=Ee(u.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(jc(e.display.measure))),n==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(v){var m=r.content.lastChild;(/\bcm-tab\b/.test(m.className)||m.querySelector&&m.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return je(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=Ee(r.pre.className,r.textClass||"")),r}function gd(e){var t=k("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function md(e,t,i,r,n,u,p){if(t){var g=e.splitSpaces?vd(t,e.trailingSpace):t,m=e.cm.state.specialChars,b=!1,C;if(!m.test(t))e.col+=t.length,C=document.createTextNode(g),e.map.push(e.pos,e.pos+t.length,C),c&&d<9&&(b=!0),e.pos+=t.length;else{C=document.createDocumentFragment();for(var E=0;;){m.lastIndex=E;var _=m.exec(t),M=_?_.index-E:t.length-E;if(M){var P=document.createTextNode(g.slice(E,E+M));c&&d<9?C.appendChild(k("span",[P])):C.appendChild(P),e.map.push(e.pos,e.pos+M,P),e.col+=M,e.pos+=M}if(!_)break;E+=M+1;var R=void 0;if(_[0]==" "){var Z=e.cm.options.tabSize,J=Z-e.col%Z;R=C.appendChild(k("span",pr(J),"cm-tab")),R.setAttribute("role","presentation"),R.setAttribute("cm-text"," "),e.col+=J}else _[0]=="\r"||_[0]==` -`?(R=C.appendChild(k("span",_[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),R.setAttribute("cm-text",_[0]),e.col+=1):(R=e.cm.options.specialCharPlaceholder(_[0]),R.setAttribute("cm-text",_[0]),c&&d<9?C.appendChild(k("span",[R])):C.appendChild(R),e.col+=1);e.map.push(e.pos,e.pos+1,R),e.pos++}}if(e.trailingSpace=g.charCodeAt(t.length-1)==32,i||r||n||b||u||p){var te=i||"";r&&(te+=r),n&&(te+=n);var V=k("span",[C],te,u);if(p)for(var ie in p)p.hasOwnProperty(ie)&&ie!="style"&&ie!="class"&&V.setAttribute(ie,p[ie]);return e.content.appendChild(V)}e.content.appendChild(C)}}function vd(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;nb&&E.from<=b));_++);if(E.to>=C)return e(i,r,n,u,p,g,m);e(i,r.slice(0,E.to-b),n,u,null,g,m),u=null,r=r.slice(E.to-b),b=E.to}}}function vs(e,t,i,r){var n=!r&&i.widgetNode;n&&e.map.push(e.pos,e.pos+t,n),!r&&e.cm.display.input.needsContentAttribute&&(n||(n=e.content.appendChild(document.createElement("span"))),n.setAttribute("cm-marker",i.id)),n&&(e.cm.display.input.setUneditable(n),e.content.appendChild(n)),e.pos+=t,e.trailingSpace=!1}function yd(e,t,i){var r=e.markedSpans,n=e.text,u=0;if(!r){for(var p=1;pm||we.collapsed&&le.to==m&&le.from==m)){if(le.to!=null&&le.to!=m&&M>le.to&&(M=le.to,R=""),we.className&&(P+=" "+we.className),we.css&&(_=(_?_+";":"")+we.css),we.startStyle&&le.from==m&&(Z+=" "+we.startStyle),we.endStyle&&le.to==M&&(ie||(ie=[])).push(we.endStyle,le.to),we.title&&((te||(te={})).title=we.title),we.attributes)for(var Le in we.attributes)(te||(te={}))[Le]=we.attributes[Le];we.collapsed&&(!J||pa(J.marker,we)<0)&&(J=le)}else le.from>m&&M>le.from&&(M=le.from)}if(ie)for(var it=0;it=g)break;for(var Et=Math.min(g,M);;){if(C){var wt=m+C.length;if(!J){var Xe=wt>Et?C.slice(0,Et-m):C;t.addToken(t,Xe,E?E+P:P,Z,m+Xe.length==M?R:"",_,te)}if(wt>=Et){C=C.slice(Et-m),m=Et;break}m=wt,Z=""}C=n.slice(u,u=i[b++]),E=gs(i[b++],t.cm.options)}}}function bs(e,t,i){this.line=t,this.rest=fd(t),this.size=this.rest?Fe(De(this.rest))-i+1:1,this.node=this.text=null,this.hidden=mr(e,t)}function zn(e,t,i){for(var r=[],n,u=t;u2&&u.push((m.bottom+b.top)/2-i.top)}}u.push(i.bottom-i.top)}}function Ss(e,t,i){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var r=0;ri)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}}function Ld(e,t){t=qt(t);var i=Fe(t),r=e.display.externalMeasured=new bs(e.doc,t,i);r.lineN=i;var n=r.built=ms(e,r);return r.text=n.pre,G(e.display.lineMeasure,n.pre),r}function Es(e,t,i,r){return Jt(e,ri(e,t),i,r)}function wa(e,t){if(t>=e.display.viewFrom&&t=i.lineN&&tt)&&(u=m-g,n=u-1,t>=m&&(p="right")),n!=null){if(r=e[b+2],g==m&&i==(r.insertLeft?"left":"right")&&(p=i),i=="left"&&n==0)for(;b&&e[b-2]==e[b-3]&&e[b-1].insertLeft;)r=e[(b-=3)+2],p="left";if(i=="right"&&n==m-g)for(;b=0&&(i=e[n]).left==i.right;n--);return i}function Bd(e,t,i,r){var n=Fs(t.map,i,r),u=n.node,p=n.start,g=n.end,m=n.collapse,b;if(u.nodeType==3){for(var C=0;C<4;C++){for(;p&&Qo(t.line.text.charAt(n.coverStart+p));)--p;for(;n.coverStart+g0&&(m=r="right");var E;e.options.lineWrapping&&(E=u.getClientRects()).length>1?b=E[r=="right"?E.length-1:0]:b=u.getBoundingClientRect()}if(c&&d<9&&!p&&(!b||!b.left&&!b.right)){var _=u.parentNode.getClientRects()[0];_?b={left:_.left,right:_.left+ni(e.display),top:_.top,bottom:_.bottom}:b=As}for(var M=b.top-t.rect.top,P=b.bottom-t.rect.top,R=(M+P)/2,Z=t.view.measure.heights,J=0;J=r.text.length?(m=r.text.length,b="before"):m<=0&&(m=0,b="after"),!g)return p(b=="before"?m-1:m,b=="before");function C(P,R,Z){var J=g[R],te=J.level==1;return p(Z?P-1:P,te!=Z)}var E=Bi(g,m,b),_=Mi,M=C(m,E,b=="before");return _!=null&&(M.other=C(m,_,b!="before")),M}function zs(e,t){var i=0;t=ve(e.doc,t),e.options.lineWrapping||(i=ni(e.display)*t.ch);var r=ae(e.doc,t.line),n=ir(r)+Nn(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function Da(e,t,i,r,n){var u=Y(e,t,i);return u.xRel=n,r&&(u.outside=r),u}function ka(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return Da(r.first,0,null,-1,-1);var n=Br(r,i),u=r.first+r.size-1;if(n>u)return Da(r.first+r.size-1,ae(r,u).text.length,null,1,1);t<0&&(t=0);for(var p=ae(r,n);;){var g=zd(e,p,n,t,i),m=sd(p,g.ch+(g.xRel>0||g.outside>0?1:0));if(!m)return g;var b=m.find(1);if(b.line==n)return b;p=ae(r,n=b.line)}}function Ns(e,t,i,r){r-=Ca(t);var n=t.text.length,u=Li(function(p){return Jt(e,i,p-1).bottom<=r},n,0);return n=Li(function(p){return Jt(e,i,p).top>r},u,n),{begin:u,end:n}}function Os(e,t,i,r){i||(i=ri(e,t));var n=On(e,t,Jt(e,i,r),"line").top;return Ns(e,t,i,n)}function Sa(e,t,i,r){return e.bottom<=i?!1:e.top>i?!0:(r?e.left:e.right)>t}function zd(e,t,i,r,n){n-=ir(t);var u=ri(e,t),p=Ca(t),g=0,m=t.text.length,b=!0,C=tr(t,e.doc.direction);if(C){var E=(e.options.lineWrapping?Od:Nd)(e,t,i,u,C,r,n);b=E.level!=1,g=b?E.from:E.to-1,m=b?E.to:E.from-1}var _=null,M=null,P=Li(function(se){var le=Jt(e,u,se);return le.top+=p,le.bottom+=p,Sa(le,r,n,!1)?(le.top<=n&&le.left<=r&&(_=se,M=le),!0):!1},g,m),R,Z,J=!1;if(M){var te=r-M.left=ie.bottom?1:0}return P=Xl(t.text,P,1),Da(i,P,Z,J,r-R)}function Nd(e,t,i,r,n,u,p){var g=Li(function(E){var _=n[E],M=_.level!=1;return Sa(Rt(e,Y(i,M?_.to:_.from,M?"before":"after"),"line",t,r),u,p,!0)},0,n.length-1),m=n[g];if(g>0){var b=m.level!=1,C=Rt(e,Y(i,b?m.from:m.to,b?"after":"before"),"line",t,r);Sa(C,u,p,!0)&&C.top>p&&(m=n[g-1])}return m}function Od(e,t,i,r,n,u,p){var g=Ns(e,t,r,p),m=g.begin,b=g.end;/\s/.test(t.text.charAt(b-1))&&b--;for(var C=null,E=null,_=0;_=b||M.to<=m)){var P=M.level!=1,R=Jt(e,r,P?Math.min(b,M.to)-1:Math.max(m,M.from)).right,Z=RZ)&&(C=M,E=Z)}}return C||(C=n[n.length-1]),C.fromb&&(C={from:C.from,to:b,level:C.level}),C}var zr;function ii(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(zr==null){zr=k("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)zr.appendChild(document.createTextNode("x")),zr.appendChild(k("br"));zr.appendChild(document.createTextNode("x"))}G(e.measure,zr);var i=zr.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),X(e.measure),i||1}function ni(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=k("span","xxxxxxxxxx"),i=k("pre",[t],"CodeMirror-line-like");G(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function Ea(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,u=t.gutters.firstChild,p=0;u;u=u.nextSibling,++p){var g=e.display.gutterSpecs[p].className;i[g]=u.offsetLeft+u.clientLeft+n,r[g]=u.clientWidth}return{fixedPos:Aa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Aa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Is(e){var t=ii(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/ni(e.display)-3);return function(n){if(mr(e.doc,n))return 0;var u=0;if(n.widgets)for(var p=0;p0&&(b=ae(e.doc,m.line).text).length==m.ch){var C=Ye(b,b.length,e.options.tabSize)-b.length;m=Y(m.line,Math.max(0,Math.round((u-ks(e.display).left)/ni(e.display))-C))}return m}function Or(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var i=e.display.view,r=0;rt)&&(n.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=n.viewTo)rr&&ga(e.doc,t)n.viewFrom?br(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)br(e);else if(t<=n.viewFrom){var u=Hn(e,i,i+r,1);u?(n.view=n.view.slice(u.index),n.viewFrom=u.lineN,n.viewTo+=r):br(e)}else if(i>=n.viewTo){var p=Hn(e,t,t,-1);p?(n.view=n.view.slice(0,p.index),n.viewTo=p.lineN):br(e)}else{var g=Hn(e,t,t,-1),m=Hn(e,i,i+r,1);g&&m?(n.view=n.view.slice(0,g.index).concat(zn(e,g.lineN,m.lineN)).concat(n.view.slice(m.index)),n.viewTo+=r):br(e)}var b=n.externalMeasured;b&&(i=n.lineN&&t=r.viewTo)){var u=r.view[Or(e,t)];if(u.node!=null){var p=u.changes||(u.changes=[]);ze(p,i)==-1&&p.push(i)}}}function br(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Hn(e,t,i,r){var n=Or(e,t),u,p=e.display.view;if(!rr||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var g=e.display.viewFrom,m=0;m0){if(n==p.length-1)return null;u=g+p[n].size-t,n++}else u=g-t;t+=u,i+=u}for(;ga(e.doc,i)!=i;){if(n==(r<0?0:p.length-1))return null;i+=r*p[n-(r<0?1:0)].size,n+=r}return{index:n,lineN:i}}function Id(e,t,i){var r=e.display,n=r.view;n.length==0||t>=r.viewTo||i<=r.viewFrom?(r.view=zn(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=zn(e,t,r.viewFrom).concat(r.view):r.viewFromi&&(r.view=r.view.slice(0,Or(e,i)))),r.viewTo=i}function Hs(e){for(var t=e.display.view,i=0,r=0;r=e.display.viewTo||m.to().line0?p:e.defaultCharWidth())+"px"}if(r.other){var g=i.appendChild(k("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));g.style.display="",g.style.left=r.other.left+"px",g.style.top=r.other.top+"px",g.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Pn(e,t){return e.top-t.top||e.left-t.left}function Hd(e,t,i){var r=e.display,n=e.doc,u=document.createDocumentFragment(),p=ks(e.display),g=p.left,m=Math.max(r.sizerWidth,_r(e)-r.sizer.offsetLeft)-p.right,b=n.direction=="ltr";function C(V,ie,se,le){ie<0&&(ie=0),ie=Math.round(ie),le=Math.round(le),u.appendChild(k("div",null,"CodeMirror-selected","position: absolute; left: "+V+`px; +`,t);n==-1&&(n=e.length);var u=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),p=u.indexOf("\r");p!=-1?(i.push(u.slice(0,p)),t+=p+1):(i.push(u),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},Xc=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch{return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch{}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Kc=function(){var e=k("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),ia=null;function Yc(e){if(ia!=null)return ia;var t=G(e,k("span","x")),i=t.getBoundingClientRect(),r=q(t,0,1).getBoundingClientRect();return ia=Math.abs(i.left-r.left)>1}var na={},Vr={};function Zc(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),na[e]=t}function Qc(e,t){Vr[e]=t}function Sn(e){if(typeof e=="string"&&Vr.hasOwnProperty(e))e=Vr[e];else if(e&&typeof e.name=="string"&&Vr.hasOwnProperty(e.name)){var t=Vr[e.name];typeof t=="string"&&(t={name:t}),e=jl(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Sn("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Sn("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function oa(e,t){t=Sn(t);var i=na[t.name];if(!i)return oa(e,"text/plain");var r=i(e,t);if($r.hasOwnProperty(t.name)){var n=$r[t.name];for(var u in n)n.hasOwnProperty(u)&&(r.hasOwnProperty(u)&&(r["_"+u]=r[u]),r[u]=n[u])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var p in t.modeProps)r[p]=t.modeProps[p];return r}var $r={};function Jc(e,t){var i=$r.hasOwnProperty(e)?$r[e]:$r[e]={};Lt(t,i)}function Lr(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var r in t){var n=t[r];n instanceof Array&&(n=n.concat([])),i[r]=n}return i}function aa(e,t){for(var i;e.innerMode&&(i=e.innerMode(t),!(!i||i.mode==e));)t=i.state,e=i.mode;return i||{mode:e,state:t}}function Jl(e,t,i){return e.startState?e.startState(t,i):!0}var Ge=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};Ge.prototype.eol=function(){return this.pos>=this.string.length},Ge.prototype.sol=function(){return this.pos==this.lineStart},Ge.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ge.prototype.next=function(){if(this.post},Ge.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ge.prototype.skipToEnd=function(){this.pos=this.string.length},Ge.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ge.prototype.backUp=function(e){this.pos-=e},Ge.prototype.column=function(){return this.lastColumnPos0?null:(u&&t!==!1&&(this.pos+=u[0].length),u)}},Ge.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ge.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ge.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ge.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ae(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var i=e;!i.lines;)for(var r=0;;++r){var n=i.children[r],u=n.chunkSize();if(t=e.first&&ti?Y(i,ae(e,i).text.length):Vc(t,ae(e,t.line).text.length)}function Vc(e,t){var i=e.ch;return i==null||i>t?Y(e.line,t):i<0?Y(e.line,0):e}function $l(e,t){for(var i=[],r=0;rthis.maxLookAhead&&(this.maxLookAhead=e),t},Zt.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},Zt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Zt.fromSaved=function(e,t,i){return t instanceof Fn?new Zt(e,Lr(e.mode,t.state),i,t.lookAhead):new Zt(e,Lr(e.mode,t),i)},Zt.prototype.save=function(e){var t=e!==!1?Lr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Fn(t,this.maxLookAhead):t};function es(e,t,i,r){var n=[e.state.modeGen],u={};as(e,t.text,e.doc.mode,i,function(b,C){return n.push(b,C)},u,r);for(var p=i.state,g=function(b){i.baseTokens=n;var C=e.state.overlays[b],E=1,_=0;i.state=!0,as(e,t.text,C.mode,i,function(M,P){for(var R=E;_M&&n.splice(E,1,M,n[E+1],Z),E+=2,_=Math.min(M,Z)}if(P)if(C.opaque)n.splice(R,E-R,M,"overlay "+P),E=R+2;else for(;Re.options.maxHighlightLength&&Lr(e.doc.mode,r.state),u=es(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=u.styles,u.classes?t.styleClasses=u.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Ni(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new Zt(r,!0,t);var u=$c(e,t,i),p=u>r.first&&ae(r,u-1).stateAfter,g=p?Zt.fromSaved(r,p,u):new Zt(r,Jl(r.mode),u);return r.iter(u,t,function(m){ca(e,m.text,g);var b=g.line;m.stateAfter=b==t-1||b%5==0||b>=n.viewFrom&&bt.start)return u}throw new Error("Mode "+e.name+" failed to advance stream.")}var is=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function ns(e,t,i,r){var n=e.doc,u=n.mode,p;t=be(n,t);var g=ae(n,t.line),m=Ni(e,t.line,i),b=new Ge(g.text,e.options.tabSize,m),C;for(r&&(C=[]);(r||b.pose.options.maxHighlightLength?(g=!1,p&&ca(e,t,r,C.pos),C.pos=t.length,E=null):E=os(da(i,C,r.state,_),u),_){var M=_[0].name;M&&(E="m-"+(E?M+" "+E:M))}if(!g||b!=E){for(;mp;--g){if(g<=u.first)return u.first;var m=ae(u,g-1),b=m.stateAfter;if(b&&(!i||g+(b instanceof Fn?b.lookAhead:0)<=u.modeFrontier))return g;var C=Ye(m.text,null,e.options.tabSize);(n==null||r>C)&&(n=g-1,r=C)}return n}function ed(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontieri;r--){var n=ae(e,r).stateAfter;if(n&&(!(n instanceof Fn)||r+n.lookAhead=t:u.to>t);(r||(r=[])).push(new Tn(p,u.from,m?null:u.to))}}return r}function ad(e,t,i){var r;if(e)for(var n=0;n=t:u.to>t);if(g||u.from==t&&p.type=="bookmark"&&(!i||u.marker.insertLeft)){var m=u.from==null||(p.inclusiveLeft?u.from<=t:u.from0&&g)for(var ie=0;ie0)){var C=[m,1],E=ve(b.from,g.from),_=ve(b.to,g.to);(E<0||!p.inclusiveLeft&&!E)&&C.push({from:b.from,to:g.from}),(_>0||!p.inclusiveRight&&!_)&&C.push({from:g.to,to:b.to}),n.splice.apply(n,C),m+=C.length-3}}return n}function us(e){var t=e.markedSpans;if(t){for(var i=0;it)&&(!r||pa(r,u.marker)<0)&&(r=u.marker)}return r}function hs(e,t,i,r,n){var u=ae(e,t),p=rr&&u.markedSpans;if(p)for(var g=0;g=0&&E<=0||C<=0&&E>=0)&&(C<=0&&(m.marker.inclusiveRight&&n.inclusiveLeft?ve(b.to,i)>=0:ve(b.to,i)>0)||C>=0&&(m.marker.inclusiveRight&&n.inclusiveLeft?ve(b.from,r)<=0:ve(b.from,r)<0)))return!0}}}function qt(e){for(var t;t=ds(e);)e=t.find(-1,!0).line;return e}function ud(e){for(var t;t=Bn(e);)e=t.find(1,!0).line;return e}function fd(e){for(var t,i;t=Bn(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function ga(e,t){var i=ae(e,t),r=qt(i);return i==r?t:Fe(r)}function ps(e,t){if(t>e.lastLine())return t;var i=ae(e,t),r;if(!mr(e,i))return t;for(;r=Bn(i);)i=r.find(1,!0).line;return Fe(i)+1}function mr(e,t){var i=rr&&t.markedSpans;if(i){for(var r=void 0,n=0;nt.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var ei=function(e,t,i){this.text=e,fs(this,t),this.height=i?i(this):1};ei.prototype.lineNo=function(){return Fe(this)},Jr(ei);function cd(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),us(e),fs(e,i);var n=r?r(e):1;n!=e.height&&Yt(e,n)}function dd(e){e.parent=null,us(e)}var hd={},pd={};function gs(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?pd:hd;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function ms(e,t){var i=H("span",null,null,v?"padding-right: .1px":null),r={pre:H("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var u=n?t.rest[n-1]:t.line,p=void 0;r.pos=0,r.addToken=md,Gc(e.display.measure)&&(p=tr(u,e.doc.direction))&&(r.addToken=bd(r.addToken,p)),r.map=[];var g=t!=e.display.externalMeasured&&Fe(u);yd(u,r,ts(e,u,g)),u.styleClasses&&(u.styleClasses.bgClass&&(r.bgClass=Ee(u.styleClasses.bgClass,r.bgClass||"")),u.styleClasses.textClass&&(r.textClass=Ee(u.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(jc(e.display.measure))),n==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(v){var m=r.content.lastChild;(/\bcm-tab\b/.test(m.className)||m.querySelector&&m.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return je(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=Ee(r.pre.className,r.textClass||"")),r}function gd(e){var t=k("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function md(e,t,i,r,n,u,p){if(t){var g=e.splitSpaces?vd(t,e.trailingSpace):t,m=e.cm.state.specialChars,b=!1,C;if(!m.test(t))e.col+=t.length,C=document.createTextNode(g),e.map.push(e.pos,e.pos+t.length,C),c&&d<9&&(b=!0),e.pos+=t.length;else{C=document.createDocumentFragment();for(var E=0;;){m.lastIndex=E;var _=m.exec(t),M=_?_.index-E:t.length-E;if(M){var P=document.createTextNode(g.slice(E,E+M));c&&d<9?C.appendChild(k("span",[P])):C.appendChild(P),e.map.push(e.pos,e.pos+M,P),e.col+=M,e.pos+=M}if(!_)break;E+=M+1;var R=void 0;if(_[0]==" "){var Z=e.cm.options.tabSize,J=Z-e.col%Z;R=C.appendChild(k("span",pr(J),"cm-tab")),R.setAttribute("role","presentation"),R.setAttribute("cm-text"," "),e.col+=J}else _[0]=="\r"||_[0]==` +`?(R=C.appendChild(k("span",_[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),R.setAttribute("cm-text",_[0]),e.col+=1):(R=e.cm.options.specialCharPlaceholder(_[0]),R.setAttribute("cm-text",_[0]),c&&d<9?C.appendChild(k("span",[R])):C.appendChild(R),e.col+=1);e.map.push(e.pos,e.pos+1,R),e.pos++}}if(e.trailingSpace=g.charCodeAt(t.length-1)==32,i||r||n||b||u||p){var te=i||"";r&&(te+=r),n&&(te+=n);var V=k("span",[C],te,u);if(p)for(var ie in p)p.hasOwnProperty(ie)&&ie!="style"&&ie!="class"&&V.setAttribute(ie,p[ie]);return e.content.appendChild(V)}e.content.appendChild(C)}}function vd(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;nb&&E.from<=b));_++);if(E.to>=C)return e(i,r,n,u,p,g,m);e(i,r.slice(0,E.to-b),n,u,null,g,m),u=null,r=r.slice(E.to-b),b=E.to}}}function vs(e,t,i,r){var n=!r&&i.widgetNode;n&&e.map.push(e.pos,e.pos+t,n),!r&&e.cm.display.input.needsContentAttribute&&(n||(n=e.content.appendChild(document.createElement("span"))),n.setAttribute("cm-marker",i.id)),n&&(e.cm.display.input.setUneditable(n),e.content.appendChild(n)),e.pos+=t,e.trailingSpace=!1}function yd(e,t,i){var r=e.markedSpans,n=e.text,u=0;if(!r){for(var p=1;pm||we.collapsed&&le.to==m&&le.from==m)){if(le.to!=null&&le.to!=m&&M>le.to&&(M=le.to,R=""),we.className&&(P+=" "+we.className),we.css&&(_=(_?_+";":"")+we.css),we.startStyle&&le.from==m&&(Z+=" "+we.startStyle),we.endStyle&&le.to==M&&(ie||(ie=[])).push(we.endStyle,le.to),we.title&&((te||(te={})).title=we.title),we.attributes)for(var Le in we.attributes)(te||(te={}))[Le]=we.attributes[Le];we.collapsed&&(!J||pa(J.marker,we)<0)&&(J=le)}else le.from>m&&M>le.from&&(M=le.from)}if(ie)for(var it=0;it=g)break;for(var Et=Math.min(g,M);;){if(C){var wt=m+C.length;if(!J){var Xe=wt>Et?C.slice(0,Et-m):C;t.addToken(t,Xe,E?E+P:P,Z,m+Xe.length==M?R:"",_,te)}if(wt>=Et){C=C.slice(Et-m),m=Et;break}m=wt,Z=""}C=n.slice(u,u=i[b++]),E=gs(i[b++],t.cm.options)}}}function bs(e,t,i){this.line=t,this.rest=fd(t),this.size=this.rest?Fe(De(this.rest))-i+1:1,this.node=this.text=null,this.hidden=mr(e,t)}function zn(e,t,i){for(var r=[],n,u=t;u2&&u.push((m.bottom+b.top)/2-i.top)}}u.push(i.bottom-i.top)}}function Ss(e,t,i){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var r=0;ri)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}}function Ld(e,t){t=qt(t);var i=Fe(t),r=e.display.externalMeasured=new bs(e.doc,t,i);r.lineN=i;var n=r.built=ms(e,r);return r.text=n.pre,G(e.display.lineMeasure,n.pre),r}function Es(e,t,i,r){return Jt(e,ri(e,t),i,r)}function wa(e,t){if(t>=e.display.viewFrom&&t=i.lineN&&tt)&&(u=m-g,n=u-1,t>=m&&(p="right")),n!=null){if(r=e[b+2],g==m&&i==(r.insertLeft?"left":"right")&&(p=i),i=="left"&&n==0)for(;b&&e[b-2]==e[b-3]&&e[b-1].insertLeft;)r=e[(b-=3)+2],p="left";if(i=="right"&&n==m-g)for(;b=0&&(i=e[n]).left==i.right;n--);return i}function Bd(e,t,i,r){var n=Fs(t.map,i,r),u=n.node,p=n.start,g=n.end,m=n.collapse,b;if(u.nodeType==3){for(var C=0;C<4;C++){for(;p&&Qo(t.line.text.charAt(n.coverStart+p));)--p;for(;n.coverStart+g0&&(m=r="right");var E;e.options.lineWrapping&&(E=u.getClientRects()).length>1?b=E[r=="right"?E.length-1:0]:b=u.getBoundingClientRect()}if(c&&d<9&&!p&&(!b||!b.left&&!b.right)){var _=u.parentNode.getClientRects()[0];_?b={left:_.left,right:_.left+ni(e.display),top:_.top,bottom:_.bottom}:b=As}for(var M=b.top-t.rect.top,P=b.bottom-t.rect.top,R=(M+P)/2,Z=t.view.measure.heights,J=0;J=r.text.length?(m=r.text.length,b="before"):m<=0&&(m=0,b="after"),!g)return p(b=="before"?m-1:m,b=="before");function C(P,R,Z){var J=g[R],te=J.level==1;return p(Z?P-1:P,te!=Z)}var E=Bi(g,m,b),_=Mi,M=C(m,E,b=="before");return _!=null&&(M.other=C(m,_,b!="before")),M}function zs(e,t){var i=0;t=be(e.doc,t),e.options.lineWrapping||(i=ni(e.display)*t.ch);var r=ae(e.doc,t.line),n=ir(r)+Nn(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function Da(e,t,i,r,n){var u=Y(e,t,i);return u.xRel=n,r&&(u.outside=r),u}function ka(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return Da(r.first,0,null,-1,-1);var n=Br(r,i),u=r.first+r.size-1;if(n>u)return Da(r.first+r.size-1,ae(r,u).text.length,null,1,1);t<0&&(t=0);for(var p=ae(r,n);;){var g=zd(e,p,n,t,i),m=sd(p,g.ch+(g.xRel>0||g.outside>0?1:0));if(!m)return g;var b=m.find(1);if(b.line==n)return b;p=ae(r,n=b.line)}}function Ns(e,t,i,r){r-=Ca(t);var n=t.text.length,u=Li(function(p){return Jt(e,i,p-1).bottom<=r},n,0);return n=Li(function(p){return Jt(e,i,p).top>r},u,n),{begin:u,end:n}}function Os(e,t,i,r){i||(i=ri(e,t));var n=On(e,t,Jt(e,i,r),"line").top;return Ns(e,t,i,n)}function Sa(e,t,i,r){return e.bottom<=i?!1:e.top>i?!0:(r?e.left:e.right)>t}function zd(e,t,i,r,n){n-=ir(t);var u=ri(e,t),p=Ca(t),g=0,m=t.text.length,b=!0,C=tr(t,e.doc.direction);if(C){var E=(e.options.lineWrapping?Od:Nd)(e,t,i,u,C,r,n);b=E.level!=1,g=b?E.from:E.to-1,m=b?E.to:E.from-1}var _=null,M=null,P=Li(function(se){var le=Jt(e,u,se);return le.top+=p,le.bottom+=p,Sa(le,r,n,!1)?(le.top<=n&&le.left<=r&&(_=se,M=le),!0):!1},g,m),R,Z,J=!1;if(M){var te=r-M.left=ie.bottom?1:0}return P=Xl(t.text,P,1),Da(i,P,Z,J,r-R)}function Nd(e,t,i,r,n,u,p){var g=Li(function(E){var _=n[E],M=_.level!=1;return Sa(Rt(e,Y(i,M?_.to:_.from,M?"before":"after"),"line",t,r),u,p,!0)},0,n.length-1),m=n[g];if(g>0){var b=m.level!=1,C=Rt(e,Y(i,b?m.from:m.to,b?"after":"before"),"line",t,r);Sa(C,u,p,!0)&&C.top>p&&(m=n[g-1])}return m}function Od(e,t,i,r,n,u,p){var g=Ns(e,t,r,p),m=g.begin,b=g.end;/\s/.test(t.text.charAt(b-1))&&b--;for(var C=null,E=null,_=0;_=b||M.to<=m)){var P=M.level!=1,R=Jt(e,r,P?Math.min(b,M.to)-1:Math.max(m,M.from)).right,Z=RZ)&&(C=M,E=Z)}}return C||(C=n[n.length-1]),C.fromb&&(C={from:C.from,to:b,level:C.level}),C}var zr;function ii(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(zr==null){zr=k("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)zr.appendChild(document.createTextNode("x")),zr.appendChild(k("br"));zr.appendChild(document.createTextNode("x"))}G(e.measure,zr);var i=zr.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),X(e.measure),i||1}function ni(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=k("span","xxxxxxxxxx"),i=k("pre",[t],"CodeMirror-line-like");G(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function Ea(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,u=t.gutters.firstChild,p=0;u;u=u.nextSibling,++p){var g=e.display.gutterSpecs[p].className;i[g]=u.offsetLeft+u.clientLeft+n,r[g]=u.clientWidth}return{fixedPos:Aa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Aa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Is(e){var t=ii(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/ni(e.display)-3);return function(n){if(mr(e.doc,n))return 0;var u=0;if(n.widgets)for(var p=0;p0&&(b=ae(e.doc,m.line).text).length==m.ch){var C=Ye(b,b.length,e.options.tabSize)-b.length;m=Y(m.line,Math.max(0,Math.round((u-ks(e.display).left)/ni(e.display))-C))}return m}function Or(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var i=e.display.view,r=0;rt)&&(n.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=n.viewTo)rr&&ga(e.doc,t)n.viewFrom?br(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)br(e);else if(t<=n.viewFrom){var u=Hn(e,i,i+r,1);u?(n.view=n.view.slice(u.index),n.viewFrom=u.lineN,n.viewTo+=r):br(e)}else if(i>=n.viewTo){var p=Hn(e,t,t,-1);p?(n.view=n.view.slice(0,p.index),n.viewTo=p.lineN):br(e)}else{var g=Hn(e,t,t,-1),m=Hn(e,i,i+r,1);g&&m?(n.view=n.view.slice(0,g.index).concat(zn(e,g.lineN,m.lineN)).concat(n.view.slice(m.index)),n.viewTo+=r):br(e)}var b=n.externalMeasured;b&&(i=n.lineN&&t=r.viewTo)){var u=r.view[Or(e,t)];if(u.node!=null){var p=u.changes||(u.changes=[]);ze(p,i)==-1&&p.push(i)}}}function br(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Hn(e,t,i,r){var n=Or(e,t),u,p=e.display.view;if(!rr||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var g=e.display.viewFrom,m=0;m0){if(n==p.length-1)return null;u=g+p[n].size-t,n++}else u=g-t;t+=u,i+=u}for(;ga(e.doc,i)!=i;){if(n==(r<0?0:p.length-1))return null;i+=r*p[n-(r<0?1:0)].size,n+=r}return{index:n,lineN:i}}function Id(e,t,i){var r=e.display,n=r.view;n.length==0||t>=r.viewTo||i<=r.viewFrom?(r.view=zn(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=zn(e,t,r.viewFrom).concat(r.view):r.viewFromi&&(r.view=r.view.slice(0,Or(e,i)))),r.viewTo=i}function Hs(e){for(var t=e.display.view,i=0,r=0;r=e.display.viewTo||m.to().line0?p:e.defaultCharWidth())+"px"}if(r.other){var g=i.appendChild(k("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));g.style.display="",g.style.left=r.other.left+"px",g.style.top=r.other.top+"px",g.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Pn(e,t){return e.top-t.top||e.left-t.left}function Hd(e,t,i){var r=e.display,n=e.doc,u=document.createDocumentFragment(),p=ks(e.display),g=p.left,m=Math.max(r.sizerWidth,_r(e)-r.sizer.offsetLeft)-p.right,b=n.direction=="ltr";function C(V,ie,se,le){ie<0&&(ie=0),ie=Math.round(ie),le=Math.round(le),u.appendChild(k("div",null,"CodeMirror-selected","position: absolute; left: "+V+`px; top: `+ie+"px; width: "+(se??m-V)+`px; - height: `+(le-ie)+"px"))}function E(V,ie,se){var le=ae(n,V),we=le.text.length,Le,it;function Ie(Xe,Ct){return In(e,Y(V,Xe),"div",le,Ct)}function Et(Xe,Ct,ot){var Qe=Os(e,le,null,Xe),Ke=Ct=="ltr"==(ot=="after")?"left":"right",qe=ot=="after"?Qe.begin:Qe.end-(/\s/.test(le.text.charAt(Qe.end-1))?2:1);return Ie(qe,Ke)[Ke]}var wt=tr(le,n.direction);return Rc(wt,ie||0,se??we,function(Xe,Ct,ot,Qe){var Ke=ot=="ltr",qe=Ie(Xe,Ke?"left":"right"),Dt=Ie(Ct-1,Ke?"right":"left"),vi=ie==null&&Xe==0,kr=se==null&&Ct==we,ut=Qe==0,Vt=!wt||Qe==wt.length-1;if(Dt.top-qe.top<=3){var nt=(b?vi:kr)&&ut,rl=(b?kr:vi)&&Vt,lr=nt?g:(Ke?qe:Dt).left,Rr=rl?m:(Ke?Dt:qe).right;C(lr,qe.top,Rr-lr,qe.bottom)}else{var Wr,pt,bi,il;Ke?(Wr=b&&vi&&ut?g:qe.left,pt=b?m:Et(Xe,ot,"before"),bi=b?g:Et(Ct,ot,"after"),il=b&&kr&&Vt?m:Dt.right):(Wr=b?Et(Xe,ot,"before"):g,pt=!b&&vi&&ut?m:qe.right,bi=!b&&kr&&Vt?g:Dt.left,il=b?Et(Ct,ot,"after"):m),C(Wr,qe.top,pt-Wr,qe.bottom),qe.bottom0?t.blinker=setInterval(function(){e.hasFocus()||oi(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function qs(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Ba(e))}function Ma(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&oi(e))},100)}function Ba(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(je(e,"focus",e,t),e.state.focused=!0,be(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),v&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),La(e))}function oi(e,t){e.state.delayingBlurEvent||(e.state.focused&&(je(e,"blur",e,t),e.state.focused=!1,oe(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function qn(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),n=t.lineDiv.getBoundingClientRect().top,u=0,p=0;p.005||M<-.005)&&(ne.display.sizerWidth){var R=Math.ceil(C/ni(e.display));R>e.display.maxLineLength&&(e.display.maxLineLength=R,e.display.maxLine=g.line,e.display.maxLineChanged=!0)}}}Math.abs(u)>2&&(t.scroller.scrollTop+=u)}function Rs(e){if(e.widgets)for(var t=0;t=p&&(u=Br(t,ir(ae(t,m))-e.wrapper.clientHeight),p=m)}return{from:u,to:Math.max(p,u+1)}}function Pd(e,t){if(!$e(e,"scrollCursorIntoView")){var i=e.display,r=i.sizer.getBoundingClientRect(),n=null,u=i.wrapper.ownerDocument;if(t.top+r.top<0?n=!0:t.bottom+r.top>(u.defaultView.innerHeight||u.documentElement.clientHeight)&&(n=!1),n!=null&&!L){var p=k("div","\u200B",null,`position: absolute; + height: `+(le-ie)+"px"))}function E(V,ie,se){var le=ae(n,V),we=le.text.length,Le,it;function Ie(Xe,Ct){return In(e,Y(V,Xe),"div",le,Ct)}function Et(Xe,Ct,ot){var Qe=Os(e,le,null,Xe),Ke=Ct=="ltr"==(ot=="after")?"left":"right",qe=ot=="after"?Qe.begin:Qe.end-(/\s/.test(le.text.charAt(Qe.end-1))?2:1);return Ie(qe,Ke)[Ke]}var wt=tr(le,n.direction);return Rc(wt,ie||0,se??we,function(Xe,Ct,ot,Qe){var Ke=ot=="ltr",qe=Ie(Xe,Ke?"left":"right"),Dt=Ie(Ct-1,Ke?"right":"left"),vi=ie==null&&Xe==0,kr=se==null&&Ct==we,ut=Qe==0,Vt=!wt||Qe==wt.length-1;if(Dt.top-qe.top<=3){var nt=(b?vi:kr)&&ut,rl=(b?kr:vi)&&Vt,lr=nt?g:(Ke?qe:Dt).left,Rr=rl?m:(Ke?Dt:qe).right;C(lr,qe.top,Rr-lr,qe.bottom)}else{var Wr,pt,bi,il;Ke?(Wr=b&&vi&&ut?g:qe.left,pt=b?m:Et(Xe,ot,"before"),bi=b?g:Et(Ct,ot,"after"),il=b&&kr&&Vt?m:Dt.right):(Wr=b?Et(Xe,ot,"before"):g,pt=!b&&vi&&ut?m:qe.right,bi=!b&&kr&&Vt?g:Dt.left,il=b?Et(Ct,ot,"after"):m),C(Wr,qe.top,pt-Wr,qe.bottom),qe.bottom0?t.blinker=setInterval(function(){e.hasFocus()||oi(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function qs(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Ba(e))}function Ma(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&oi(e))},100)}function Ba(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(je(e,"focus",e,t),e.state.focused=!0,pe(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),v&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),La(e))}function oi(e,t){e.state.delayingBlurEvent||(e.state.focused&&(je(e,"blur",e,t),e.state.focused=!1,oe(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function qn(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),n=t.lineDiv.getBoundingClientRect().top,u=0,p=0;p.005||M<-.005)&&(ne.display.sizerWidth){var R=Math.ceil(C/ni(e.display));R>e.display.maxLineLength&&(e.display.maxLineLength=R,e.display.maxLine=g.line,e.display.maxLineChanged=!0)}}}Math.abs(u)>2&&(t.scroller.scrollTop+=u)}function Rs(e){if(e.widgets)for(var t=0;t=p&&(u=Br(t,ir(ae(t,m))-e.wrapper.clientHeight),p=m)}return{from:u,to:Math.max(p,u+1)}}function Pd(e,t){if(!$e(e,"scrollCursorIntoView")){var i=e.display,r=i.sizer.getBoundingClientRect(),n=null,u=i.wrapper.ownerDocument;if(t.top+r.top<0?n=!0:t.bottom+r.top>(u.defaultView.innerHeight||u.documentElement.clientHeight)&&(n=!1),n!=null&&!L){var p=k("div","\u200B",null,`position: absolute; top: `+(t.top-i.viewOffset-Nn(e.display))+`px; height: `+(t.bottom-t.top+Qt(e)+i.barHeight)+`px; - left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(p),p.scrollIntoView(n),e.display.lineSpace.removeChild(p)}}}function qd(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(i=t.sticky=="before"?Y(t.line,t.ch+1,"before"):t,t=t.ch?Y(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var u=0;u<5;u++){var p=!1,g=Rt(e,t),m=!i||i==t?g:Rt(e,i);n={left:Math.min(g.left,m.left),top:Math.min(g.top,m.top)-r,right:Math.max(g.left,m.left),bottom:Math.max(g.bottom,m.bottom)+r};var b=_a(e,n),C=e.doc.scrollTop,E=e.doc.scrollLeft;if(b.scrollTop!=null&&(Ui(e,b.scrollTop),Math.abs(e.doc.scrollTop-C)>1&&(p=!0)),b.scrollLeft!=null&&(Ir(e,b.scrollLeft),Math.abs(e.doc.scrollLeft-E)>1&&(p=!0)),!p)break}return n}function Rd(e,t){var i=_a(e,t);i.scrollTop!=null&&Ui(e,i.scrollTop),i.scrollLeft!=null&&Ir(e,i.scrollLeft)}function _a(e,t){var i=e.display,r=ii(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,u=xa(e),p={};t.bottom-t.top>u&&(t.bottom=t.top+u);var g=e.doc.height+ya(i),m=t.topg-r;if(t.topn+u){var C=Math.min(t.top,(b?g:t.bottom)-u);C!=n&&(p.scrollTop=C)}var E=e.options.fixedGutter?0:i.gutters.offsetWidth,_=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-E,M=_r(e)-i.gutters.offsetWidth,P=t.right-t.left>M;return P&&(t.right=t.left+M),t.left<10?p.scrollLeft=0:t.left<_?p.scrollLeft=Math.max(0,t.left+E-(P?0:10)):t.right>M+_-3&&(p.scrollLeft=t.right+(P?0:10)-M),p}function za(e,t){t!=null&&(Wn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function ai(e){Wn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Wi(e,t,i){(t!=null||i!=null)&&Wn(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Wd(e,t){Wn(e),e.curOp.scrollToPos=t}function Wn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=zs(e,t.from),r=zs(e,t.to);Ws(e,i,r,t.margin)}}function Ws(e,t,i,r){var n=_a(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-r,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+r});Wi(e,n.scrollLeft,n.scrollTop)}function Ui(e,t){Math.abs(e.doc.scrollTop-t)<2||(s||Oa(e,{top:t}),Us(e,t,!0),s&&Oa(e),Xi(e,100))}function Us(e,t,i){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),!(e.display.scroller.scrollTop==t&&!i)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Ir(e,t,i,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),!((i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)&&(e.doc.scrollLeft=t,Ys(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function ji(e){var t=e.display,i=t.gutters.offsetWidth,r=Math.round(e.doc.height+ya(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?i:0,docHeight:r,scrollHeight:r+Qt(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var Hr=function(e,t,i){this.cm=i;var r=this.vert=k("div",[k("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=k("div",[k("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=n.tabIndex=-1,e(r),e(n),ue(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),ue(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,c&&d<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Hr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var n=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+n)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=i?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var u=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+u)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?r:0,bottom:t?r:0}},Hr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Hr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Hr.prototype.zeroWidthHack=function(){var e=O&&!B?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new dt,this.disableVert=new dt},Hr.prototype.enableZeroWidthBar=function(e,t,i){e.style.visibility="";function r(){var n=e.getBoundingClientRect(),u=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);u!=e?e.style.visibility="hidden":t.set(1e3,r)}t.set(1e3,r)},Hr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Gi=function(){};Gi.prototype.update=function(){return{bottom:0,right:0}},Gi.prototype.setScrollLeft=function(){},Gi.prototype.setScrollTop=function(){},Gi.prototype.clear=function(){};function li(e,t){t||(t=ji(e));var i=e.display.barWidth,r=e.display.barHeight;js(e,t);for(var n=0;n<4&&i!=e.display.barWidth||r!=e.display.barHeight;n++)i!=e.display.barWidth&&e.options.lineWrapping&&qn(e),js(e,ji(e)),i=e.display.barWidth,r=e.display.barHeight}function js(e,t){var i=e.display,r=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=r.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=r.bottom)+"px",i.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=r.bottom+"px",i.scrollbarFiller.style.width=r.right+"px"):i.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=r.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}var Gs={native:Hr,null:Gi};function Xs(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&oe(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Gs[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ue(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?Ir(e,t):Ui(e,t)},e),e.display.scrollbars.addClass&&be(e.display.wrapper,e.display.scrollbars.addClass)}var Ud=0;function Pr(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Ud,markArrays:null},xd(e.curOp)}function qr(e){var t=e.curOp;t&&Cd(t,function(i){for(var r=0;r=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Un(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Xd(e){e.updatedDisplay=e.mustUpdate&&Na(e.cm,e.update)}function Kd(e){var t=e.cm,i=t.display;e.updatedDisplay&&qn(t),e.barMeasure=ji(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Es(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+Qt(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-_r(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function Yd(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)){var i=+new Date+e.options.workTime,r=Ni(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(u){if(r.line>=e.display.viewFrom){var p=u.styles,g=u.text.length>e.options.maxHighlightLength?Lr(t.mode,r.state):null,m=es(e,u,r,!0);g&&(r.state=g),u.styles=m.styles;var b=u.styleClasses,C=m.classes;C?u.styleClasses=C:b&&(u.styleClasses=null);for(var E=!p||p.length!=u.styles.length||b!=C&&(!b||!C||b.bgClass!=C.bgClass||b.textClass!=C.textClass),_=0;!E&&_i)return Xi(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&St(e,function(){for(var u=0;u=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&Hs(e)==0)return!1;Zs(e)&&(br(e),t.dims=Ea(e));var n=r.first+r.size,u=Math.max(t.visible.from-e.options.viewportMargin,r.first),p=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFromp&&i.viewTo-p<20&&(p=Math.min(n,i.viewTo)),rr&&(u=ga(e.doc,u),p=ps(e.doc,p));var g=u!=i.viewFrom||p!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Id(e,u,p),i.viewOffset=ir(ae(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var m=Hs(e);if(!g&&m==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var b=Vd(e);return m>4&&(i.lineDiv.style.display="none"),eh(e,i.updateLineNumbers,t.dims),m>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,$d(b),X(i.cursorDiv),X(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,g&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,Xi(e,400)),i.updateLineNumbers=null,!0}function Ks(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==_r(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+ya(e.display)-xa(e),i.top)}),t.visible=Rn(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Rn(e.display,e.doc,i));if(!Na(e,t))break;qn(e);var n=ji(e);Ri(e),li(e,n),Ha(e,n),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Oa(e,t){var i=new Un(e,t);if(Na(e,i)){qn(e),Ks(e,i);var r=ji(e);Ri(e),li(e,r),Ha(e,r),i.finish()}}function eh(e,t,i){var r=e.display,n=e.options.lineNumbers,u=r.lineDiv,p=u.firstChild;function g(P){var R=P.nextSibling;return v&&O&&e.display.currentWheelTarget==P?P.style.display="none":P.parentNode.removeChild(P),R}for(var m=r.view,b=r.viewFrom,C=0;C-1&&(M=!1),ys(e,E,b,i)),M&&(X(E.lineNumber),E.lineNumber.appendChild(document.createTextNode(sa(e.options,b)))),p=E.node.nextSibling}b+=E.size}for(;p;)p=g(p)}function Ia(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",et(e,"gutterChanged",e)}function Ha(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Qt(e)+"px"}function Ys(e){var t=e.display,i=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var r=Aa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,u=r+"px",p=0;pg.clientWidth,b=g.scrollHeight>g.clientHeight;if(r&&m||n&&b){if(n&&O&&v){e:for(var C=t.target,E=p.view;C!=g;C=C.parentNode)for(var _=0;_=0&&me(e,r.to())<=0)return i}return-1};var Ae=function(e,t){this.anchor=e,this.head=t};Ae.prototype.from=function(){return An(this.anchor,this.head)},Ae.prototype.to=function(){return En(this.anchor,this.head)},Ae.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Wt(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(_,M){return me(_.from(),M.from())}),i=ze(t,n);for(var u=1;u0:m>=0){var b=An(g.from(),p.from()),C=En(g.to(),p.to()),E=g.empty()?p.from()==p.head:g.from()==g.head;u<=i&&--i,t.splice(--u,2,new Ae(E?C:b,E?b:C))}}return new Bt(t,i)}function yr(e,t){return new Bt([new Ae(e,t||e)],0)}function xr(e){return e.text?Y(e.from.line+e.text.length-1,De(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function $s(e,t){if(me(e,t.from)<0)return e;if(me(e,t.to)<=0)return xr(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=xr(t).ch-t.to.ch),Y(i,r)}function qa(e,t){for(var i=[],r=0;r1&&e.remove(g.line+1,P-1),e.insert(g.line+1,J)}et(e,"change",e,t)}function wr(e,t,i){function r(n,u,p){if(n.linked)for(var g=0;g1&&!e.done[e.done.length-2].ranges)return e.done.pop(),De(e.done)}function ou(e,t,i,r){var n=e.history;n.undone.length=0;var u=+new Date,p,g;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>u-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(p=oh(n,n.lastOp==r)))g=De(p.changes),me(t.from,t.to)==0&&me(t.from,g.to)==0?g.to=xr(t):p.changes.push(Ua(e,t));else{var m=De(n.done);for((!m||!m.ranges)&&Xn(e.sel,n.done),p={changes:[Ua(e,t)],generation:n.generation},n.done.push(p);n.done.length>n.undoDepth;)n.done.shift(),n.done[0].ranges||n.done.shift()}n.done.push(i),n.generation=++n.maxGeneration,n.lastModTime=n.lastSelTime=u,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,g||je(e,"historyAdded")}function ah(e,t,i,r){var n=t.charAt(0);return n=="*"||n=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function lh(e,t,i,r){var n=e.history,u=r&&r.origin;i==n.lastSelOp||u&&n.lastSelOrigin==u&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==u||ah(e,u,De(n.done),t))?n.done[n.done.length-1]=t:Xn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=u,n.lastSelOp=i,r&&r.clearRedo!==!1&&nu(n.undone)}function Xn(e,t){var i=De(t);i&&i.ranges&&i.equals(e)||t.push(e)}function au(e,t,i,r){var n=t["spans_"+e.id],u=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(p){p.markedSpans&&((n||(n=t["spans_"+e.id]={}))[u]=p.markedSpans),++u})}function sh(e){if(!e)return null;for(var t,i=0;i-1&&(De(g)[E]=b[E],delete b[E])}}return r}function ja(e,t,i,r){if(r){var n=e.anchor;if(i){var u=me(t,n)<0;u!=me(i,n)<0?(n=t,t=i):u!=me(t,i)<0&&(t=i)}return new Ae(n,t)}else return new Ae(i||t,t)}function Kn(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),st(e,new Bt([ja(e.sel.primary(),t,i,n)],0),r)}function su(e,t,i){for(var r=[],n=e.cm&&(e.cm.display.shift||e.extend),u=0;u=t.ch:g.to>t.ch))){if(n&&(je(m,"beforeCursorEnter"),m.explicitlyCleared))if(u.markedSpans){--p;continue}else break;if(!m.atomic)continue;if(i){var E=m.find(r<0?1:-1),_=void 0;if((r<0?C:b)&&(E=pu(e,E,-r,E&&E.line==t.line?u:null)),E&&E.line==t.line&&(_=me(E,i))&&(r<0?_<0:_>0))return ui(e,E,t,r,n)}var M=m.find(r<0?-1:1);return(r<0?b:C)&&(M=pu(e,M,r,M.line==t.line?u:null)),M?ui(e,M,t,r,n):null}}return t}function Zn(e,t,i,r,n){var u=r||1,p=ui(e,t,i,u,n)||!n&&ui(e,t,i,u,!0)||ui(e,t,i,-u,n)||!n&&ui(e,t,i,-u,!0);return p||(e.cantEdit=!0,Y(e.first,0))}function pu(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?ve(e,Y(t.line-1)):null:i>0&&t.ch==(r||ae(e,t.line)).text.length?t.line=0;--n)vu(e,{from:r[n].from,to:r[n].to,text:n?[""]:t.text,origin:t.origin});else vu(e,t)}}function vu(e,t){if(!(t.text.length==1&&t.text[0]==""&&me(t.from,t.to)==0)){var i=qa(e,t);ou(e,t,i,e.cm?e.cm.curOp.id:NaN),Zi(e,t,i,ha(e,t));var r=[];wr(e,function(n,u){!u&&ze(r,n.history)==-1&&(wu(n.history,t),r.push(n.history)),Zi(n,t,null,ha(n,t))})}}function Qn(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(!(r&&!i)){for(var n=e.history,u,p=e.sel,g=t=="undo"?n.done:n.undone,m=t=="undo"?n.undone:n.done,b=0;b=0;--M){var P=_(M);if(P)return P.v}}}}function bu(e,t){if(t!=0&&(e.first+=t,e.sel=new Bt(Pt(e.sel.ranges,function(n){return new Ae(Y(n.anchor.line+t,n.anchor.ch),Y(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm)){yt(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;re.lastLine())){if(t.from.lineu&&(t={from:t.from,to:Y(u,ae(e,u).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Mr(e,t.from,t.to),i||(i=qa(e,t)),e.cm?ch(e.cm,t,r):Wa(e,t,r),Yn(e,i,vt),e.cantEdit&&Zn(e,Y(e.firstLine(),0))&&(e.cantEdit=!1)}}function ch(e,t,i){var r=e.doc,n=e.display,u=t.from,p=t.to,g=!1,m=u.line;e.options.lineWrapping||(m=Fe(qt(ae(r,u.line))),r.iter(m,p.line+1,function(M){if(M==n.maxLine)return g=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Yl(e),Wa(r,t,i,Is(e)),e.options.lineWrapping||(r.iter(m,u.line+t.text.length,function(M){var P=_n(M);P>n.maxLineLength&&(n.maxLine=M,n.maxLineLength=P,n.maxLineChanged=!0,g=!1)}),g&&(e.curOp.updateMaxLine=!0)),ed(r,u.line),Xi(e,400);var b=t.text.length-(p.line-u.line)-1;t.full?yt(e):u.line==p.line&&t.text.length==1&&!tu(e.doc,t)?vr(e,u.line,"text"):yt(e,u.line,p.line+1,b);var C=Ot(e,"changes"),E=Ot(e,"change");if(E||C){var _={from:u,to:p,text:t.text,removed:t.removed,origin:t.origin};E&&et(e,"change",e,_),C&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(_)}e.display.selForContextMenu=null}function ci(e,t,i,r,n){var u;r||(r=i),me(r,i)<0&&(u=[r,i],i=u[0],r=u[1]),typeof t=="string"&&(t=e.splitLines(t)),fi(e,{from:i,to:r,text:t,origin:n})}function yu(e,t,i,r){i1||!(this.children[0]instanceof Ji))){var g=[];this.collapse(g),this.children=[new Ji(g)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var p=n.lines.length%25+25,g=p;g10);e.parent.maybeSpill()}},iterN:function(e,t,i){for(var r=0;re.display.maxLineLength&&(e.display.maxLine=b,e.display.maxLineLength=C,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&yt(e,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&du(e.doc)),e&&et(e,"markerCleared",e,this,r,n),t&&qr(e),this.parent&&this.parent.clear()}},Cr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n0||p==0&&u.clearWhenEmpty!==!1)return u;if(u.replacedWith&&(u.collapsed=!0,u.widgetNode=H("span",[u.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||u.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(u.widgetNode.insertLeft=!0)),u.collapsed){if(hs(e,t.line,t,i,u)||t.line!=i.line&&hs(e,i.line,t,i,u))throw new Error("Inserting collapsed marker partially overlapping an existing one");rd()}u.addToHistory&&ou(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var g=t.line,m=e.cm,b;if(e.iter(g,i.line+1,function(E){m&&u.collapsed&&!m.options.lineWrapping&&qt(E)==m.display.maxLine&&(b=!0),u.collapsed&&g!=t.line&&Yt(E,0),nd(E,new Tn(u,g==t.line?t.ch:null,g==i.line?i.ch:null),e.cm&&e.cm.curOp),++g}),u.collapsed&&e.iter(t.line,i.line+1,function(E){mr(e,E)&&Yt(E,0)}),u.clearOnEnter&&ue(u,"beforeCursorEnter",function(){return u.clear()}),u.readOnly&&(td(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),u.collapsed&&(u.id=++Du,u.atomic=!0),m){if(b&&(m.curOp.updateMaxLine=!0),u.collapsed)yt(m,t.line,i.line+1);else if(u.className||u.startStyle||u.endStyle||u.css||u.attributes||u.title)for(var C=t.line;C<=i.line;C++)vr(m,C,"text");u.atomic&&du(m.doc),et(m,"markerAdded",m,u)}return u}var en=function(e,t){this.markers=e,this.primary=t;for(var i=0;i=0;m--)fi(this,r[m]);g?fu(this,g):this.cm&&ai(this.cm)}),undo:rt(function(){Qn(this,"undo")}),redo:rt(function(){Qn(this,"redo")}),undoSelection:rt(function(){Qn(this,"undo",!0)}),redoSelection:rt(function(){Qn(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,r=0;r=e.ch)&&t.push(n.marker.parent||n.marker)}return t},findMarks:function(e,t,i){e=ve(this,e),t=ve(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(u){var p=u.markedSpans;if(p)for(var g=0;g=m.to||m.from==null&&n!=e.line||m.from!=null&&n==t.line&&m.from>=t.ch)&&(!i||i(m.marker))&&r.push(m.marker.parent||m.marker)}++n}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var r=0;re)return t=e,!0;e-=u,++i}),ve(this,Y(i,t))},indexFromPos:function(e){e=ve(this,e);var t=e.ch;if(e.linet&&(t=e.from),e.to!=null&&e.to-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var C=e.dataTransfer.getData("Text");if(C){var E;if(t.state.draggingText&&!t.state.draggingText.copy&&(E=t.listSelections()),Yn(t.doc,yr(i,i)),E)for(var _=0;_=0;g--)ci(e.doc,"",r[g].from,r[g].to,"+delete");ai(e)})}function Xa(e,t,i){var r=Xl(e.text,t+i,i);return r<0||r>e.text.length?null:r}function Ka(e,t,i){var r=Xa(e,t.ch,i);return r==null?null:new Y(t.line,r,i<0?"after":"before")}function Ya(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var u=tr(i,t.doc.direction);if(u){var p=n<0?De(u):u[0],g=n<0==(p.level==1),m=g?"after":"before",b;if(p.level>0||t.doc.direction=="rtl"){var C=ri(t,i);b=n<0?i.text.length-1:0;var E=Jt(t,C,b).top;b=Li(function(_){return Jt(t,C,_).top==E},n<0==(p.level==1)?p.from:p.to-1,b),m=="before"&&(b=Xa(i,b,1))}else b=n<0?p.to:p.from;return new Y(r,b,m)}}return new Y(r,n<0?i.text.length:0,n<0?"before":"after")}function Sh(e,t,i,r){var n=tr(t,e.doc.direction);if(!n)return Ka(t,i,r);i.ch>=t.text.length?(i.ch=t.text.length,i.sticky="before"):i.ch<=0&&(i.ch=0,i.sticky="after");var u=Bi(n,i.ch,i.sticky),p=n[u];if(e.doc.direction=="ltr"&&p.level%2==0&&(r>0?p.to>i.ch:p.from=p.from&&_>=C.begin)){var M=E?"before":"after";return new Y(i.line,_,M)}}var P=function(J,te,V){for(var ie=function(Le,it){return it?new Y(i.line,g(Le,1),"before"):new Y(i.line,Le,"after")};J>=0&&J0==(se.level!=1),we=le?V.begin:g(V.end,-1);if(se.from<=we&&we0?C.end:g(C.begin,-1);return Z!=null&&!(r>0&&Z==t.text.length)&&(R=P(r>0?0:n.length-1,r,b(Z)),R)?R:null}var nn={selectAll:gu,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),vt)},killLine:function(e){return pi(e,function(t){if(t.empty()){var i=ae(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line0)n=new Y(n.line,n.ch+1),e.replaceRange(u.charAt(n.ch-1)+u.charAt(n.ch-2),Y(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var p=ae(e.doc,n.line-1).text;p&&(n=new Y(n.line,1),e.replaceRange(u.charAt(0)+e.doc.lineSeparator()+p.charAt(p.length-1),Y(n.line-1,p.length-1),n,"+transpose"))}}i.push(new Ae(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){return St(e,function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");t=e.listSelections();for(var r=0;re&&me(t,this.pos)==0&&i==this.button};var an,ln;function Bh(e,t){var i=+new Date;return ln&&ln.compare(i,e,t)?(an=ln=null,"triple"):an&&an.compare(i,e,t)?(ln=new Qa(i,e,t),an=null,"double"):(an=new Qa(i,e,t),ln=null,"single")}function Pu(e){var t=this,i=t.display;if(!($e(t,e)||i.activeTouch&&i.input.supportsTouch())){if(i.input.ensurePolled(),i.shift=e.shiftKey,nr(i,e)){v||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(!Ja(t,e)){var r=Nr(t,e),n=Ql(e),u=r?Bh(r,n):"single";ye(t).focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&_h(t,n,r,u,e))&&(n==1?r?Nh(t,r,u,e):$o(e)==i.scroller&&bt(e):n==2?(r&&Kn(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(de?t.display.input.onContextMenu(e):Ma(t)))}}}function _h(e,t,i,r,n){var u="Click";return r=="double"?u="Double"+u:r=="triple"&&(u="Triple"+u),u=(t==1?"Left":t==2?"Middle":"Right")+u,on(e,Lu(u,n),n,function(p){if(typeof p=="string"&&(p=nn[p]),!p)return!1;var g=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),g=p(e,i)!=Ze}finally{e.state.suppressEdits=!1}return g})}function zh(e,t,i){var r=e.getOption("configureMouse"),n=r?r(e,t,i):{};if(n.unit==null){var u=I?i.shiftKey&&i.metaKey:i.altKey;n.unit=u?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(n.extend==null||e.doc.extend)&&(n.extend=e.doc.extend||i.shiftKey),n.addNew==null&&(n.addNew=O?i.metaKey:i.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(O?i.altKey:i.ctrlKey)),n}function Nh(e,t,i,r){c?setTimeout(lt(qs,e),0):e.curOp.focus=he(ee(e));var n=zh(e,i,r),u=e.doc.sel,p;e.options.dragDrop&&Uc&&!e.isReadOnly()&&i=="single"&&(p=u.contains(t))>-1&&(me((p=u.ranges[p]).from(),t)<0||t.xRel>0)&&(me(p.to(),t)>0||t.xRel<0)?Oh(e,r,t,n):Ih(e,r,t,n)}function Oh(e,t,i,r){var n=e.display,u=!1,p=tt(e,function(b){v&&(n.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:Ma(e)),Mt(n.wrapper.ownerDocument,"mouseup",p),Mt(n.wrapper.ownerDocument,"mousemove",g),Mt(n.scroller,"dragstart",m),Mt(n.scroller,"drop",p),u||(bt(b),r.addNew||Kn(e.doc,i,null,null,r.extend),v&&!F||c&&d==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),g=function(b){u=u||Math.abs(t.clientX-b.clientX)+Math.abs(t.clientY-b.clientY)>=10},m=function(){return u=!0};v&&(n.scroller.draggable=!0),e.state.draggingText=p,p.copy=!r.moveOnDrag,ue(n.wrapper.ownerDocument,"mouseup",p),ue(n.wrapper.ownerDocument,"mousemove",g),ue(n.scroller,"dragstart",m),ue(n.scroller,"drop",p),e.state.delayingBlurEvent=!0,setTimeout(function(){return n.input.focus()},20),n.scroller.dragDrop&&n.scroller.dragDrop()}function qu(e,t,i){if(i=="char")return new Ae(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new Ae(Y(t.line,0),ve(e.doc,Y(t.line+1,0)));var r=i(e,t);return new Ae(r.from,r.to)}function Ih(e,t,i,r){c&&Ma(e);var n=e.display,u=e.doc;bt(t);var p,g,m=u.sel,b=m.ranges;if(r.addNew&&!r.extend?(g=u.sel.contains(i),g>-1?p=b[g]:p=new Ae(i,i)):(p=u.sel.primary(),g=u.sel.primIndex),r.unit=="rectangle")r.addNew||(p=new Ae(i,i)),i=Nr(e,t,!0,!0),g=-1;else{var C=qu(e,i,r.unit);r.extend?p=ja(p,C.anchor,C.head,r.extend):p=C}r.addNew?g==-1?(g=b.length,st(u,Wt(e,b.concat([p]),g),{scroll:!1,origin:"*mouse"})):b.length>1&&b[g].empty()&&r.unit=="char"&&!r.extend?(st(u,Wt(e,b.slice(0,g).concat(b.slice(g+1)),0),{scroll:!1,origin:"*mouse"}),m=u.sel):Ga(u,g,p,Ti):(g=0,st(u,new Bt([p],0),Ti),m=u.sel);var E=i;function _(V){if(me(E,V)!=0)if(E=V,r.unit=="rectangle"){for(var ie=[],se=e.options.tabSize,le=Ye(ae(u,i.line).text,i.ch,se),we=Ye(ae(u,V.line).text,V.ch,se),Le=Math.min(le,we),it=Math.max(le,we),Ie=Math.min(i.line,V.line),Et=Math.min(e.lastLine(),Math.max(i.line,V.line));Ie<=Et;Ie++){var wt=ae(u,Ie).text,Xe=Kt(wt,Le,se);Le==it?ie.push(new Ae(Y(Ie,Xe),Y(Ie,Xe))):wt.length>Xe&&ie.push(new Ae(Y(Ie,Xe),Y(Ie,Kt(wt,it,se))))}ie.length||ie.push(new Ae(i,i)),st(u,Wt(e,m.ranges.slice(0,g).concat(ie),g),{origin:"*mouse",scroll:!1}),e.scrollIntoView(V)}else{var Ct=p,ot=qu(e,V,r.unit),Qe=Ct.anchor,Ke;me(ot.anchor,Qe)>0?(Ke=ot.head,Qe=An(Ct.from(),ot.anchor)):(Ke=ot.anchor,Qe=En(Ct.to(),ot.head));var qe=m.ranges.slice(0);qe[g]=Hh(e,new Ae(ve(u,Qe),Ke)),st(u,Wt(e,qe,g),Ti)}}var M=n.wrapper.getBoundingClientRect(),P=0;function R(V){var ie=++P,se=Nr(e,V,!0,r.unit=="rectangle");if(se)if(me(se,E)!=0){e.curOp.focus=he(ee(e)),_(se);var le=Rn(n,u);(se.line>=le.to||se.lineM.bottom?20:0;we&&setTimeout(tt(e,function(){P==ie&&(n.scroller.scrollTop+=we,R(V))}),50)}}function Z(V){e.state.selectingText=!1,P=1/0,V&&(bt(V),n.input.focus()),Mt(n.wrapper.ownerDocument,"mousemove",J),Mt(n.wrapper.ownerDocument,"mouseup",te),u.history.lastSelOrigin=null}var J=tt(e,function(V){V.buttons===0||!Ql(V)?Z(V):R(V)}),te=tt(e,Z);e.state.selectingText=te,ue(n.wrapper.ownerDocument,"mousemove",J),ue(n.wrapper.ownerDocument,"mouseup",te)}function Hh(e,t){var i=t.anchor,r=t.head,n=ae(e.doc,i.line);if(me(i,r)==0&&i.sticky==r.sticky)return t;var u=tr(n);if(!u)return t;var p=Bi(u,i.ch,i.sticky),g=u[p];if(g.from!=i.ch&&g.to!=i.ch)return t;var m=p+(g.from==i.ch==(g.level!=1)?0:1);if(m==0||m==u.length)return t;var b;if(r.line!=i.line)b=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var C=Bi(u,r.ch,r.sticky),E=C-p||(r.ch-i.ch)*(g.level==1?-1:1);C==m-1||C==m?b=E<0:b=E>0}var _=u[m+(b?-1:0)],M=b==(_.level==1),P=M?_.from:_.to,R=M?"after":"before";return i.ch==P&&i.sticky==R?t:new Ae(new Y(i.line,P,R),r)}function Ru(e,t,i,r){var n,u;if(t.touches)n=t.touches[0].clientX,u=t.touches[0].clientY;else try{n=t.clientX,u=t.clientY}catch{return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&bt(t);var p=e.display,g=p.lineDiv.getBoundingClientRect();if(u>g.bottom||!Ot(e,i))return Vo(t);u-=g.top-p.viewOffset;for(var m=0;m=n){var C=Br(e.doc,u),E=e.display.gutterSpecs[m];return je(e,i,e,C,E.className,t),Vo(t)}}}function Ja(e,t){return Ru(e,t,"gutterClick",!0)}function Wu(e,t){nr(e.display,t)||Ph(e,t)||$e(e,t,"contextmenu")||de||e.display.input.onContextMenu(t)}function Ph(e,t){return Ot(e,"gutterContextMenu")?Ru(e,t,"gutterContextMenu",!1):!1}function Uu(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),qi(e)}var gi={toString:function(){return"CodeMirror.Init"}},ju={},eo={};function qh(e){var t=e.optionHandlers;function i(r,n,u,p){e.defaults[r]=n,u&&(t[r]=p?function(g,m,b){b!=gi&&u(g,m,b)}:u)}e.defineOption=i,e.Init=gi,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,Ra(r)},!0),i("indentUnit",2,Ra,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){Yi(r),qi(r),yt(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!!n){var u=[],p=r.doc.first;r.doc.iter(function(m){for(var b=0;;){var C=m.text.indexOf(n,b);if(C==-1)break;b=C+n.length,u.push(Y(p,C))}p++});for(var g=u.length-1;g>=0;g--)ci(r.doc,n,u[g],Y(u[g].line,u[g].ch+n.length))}}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(r,n,u){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),u!=gi&&r.refresh()}),i("specialCharPlaceholder",gd,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",z?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(r,n){return r.getInputField().spellcheck=n},!0),i("autocorrect",!1,function(r,n){return r.getInputField().autocorrect=n},!0),i("autocapitalize",!1,function(r,n){return r.getInputField().autocapitalize=n},!0),i("rtlMoveVisually",!W),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Uu(r),Ki(r)},!0),i("keyMap","default",function(r,n,u){var p=Vn(n),g=u!=gi&&Vn(u);g&&g.detach&&g.detach(r,p),p.attach&&p.attach(r,g||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Wh,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=Pa(n,r.options.lineNumbers),Ki(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?Aa(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return li(r)},!0),i("scrollbarStyle","native",function(r){Xs(r),li(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),i("lineNumbers",!1,function(r,n){r.display.gutterSpecs=Pa(r.options.gutters,n),Ki(r)},!0),i("firstLineNumber",1,Ki,!0),i("lineNumberFormatter",function(r){return r},Ki,!0),i("showCursorWhenSelecting",!1,Ri,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,n){n=="nocursor"&&(oi(r),r.display.input.blur()),r.display.input.readOnlyChanged(n)}),i("screenReaderLabel",null,function(r,n){n=n===""?null:n,r.display.input.screenReaderLabelChanged(n)}),i("disableInput",!1,function(r,n){n||r.display.input.reset()},!0),i("dragDrop",!0,Rh),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,Ri,!0),i("singleCursorHeightPerLine",!0,Ri,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,Yi,!0),i("addModeClass",!1,Yi,!0),i("pollInterval",100),i("undoDepth",200,function(r,n){return r.doc.history.undoDepth=n}),i("historyEventDelay",1250),i("viewportMargin",10,function(r){return r.refresh()},!0),i("maxHighlightLength",1e4,Yi,!0),i("moveInputWithCursor",!0,function(r,n){n||r.display.input.resetPosition()}),i("tabindex",null,function(r,n){return r.display.input.getField().tabIndex=n||""}),i("autofocus",null),i("direction","ltr",function(r,n){return r.doc.setDirection(n)},!0),i("phrases",null)}function Rh(e,t,i){var r=i&&i!=gi;if(!t!=!r){var n=e.display.dragFunctions,u=t?ue:Mt;u(e.display.scroller,"dragstart",n.start),u(e.display.scroller,"dragenter",n.enter),u(e.display.scroller,"dragover",n.over),u(e.display.scroller,"dragleave",n.leave),u(e.display.scroller,"drop",n.drop)}}function Wh(e){e.options.lineWrapping?(be(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(oe(e.display.wrapper,"CodeMirror-wrap"),va(e)),Fa(e),yt(e),qi(e),setTimeout(function(){return li(e)},100)}function Ne(e,t){var i=this;if(!(this instanceof Ne))return new Ne(e,t);this.options=t=t?Lt(t):{},Lt(ju,t,!1);var r=t.value;typeof r=="string"?r=new xt(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new Ne.inputStyles[t.inputStyle](this),u=this.display=new th(e,r,n,t);u.wrapper.CodeMirror=this,Uu(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Xs(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new dt,keySeq:null,specialChars:null},t.autofocus&&!z&&u.input.focus(),c&&d<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Uh(this),xh(),Pr(this),this.curOp.forceUpdate=!0,ru(this,r),t.autofocus&&!z||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&Ba(i)},20):oi(this);for(var p in eo)eo.hasOwnProperty(p)&&eo[p](this,t[p],gi);Zs(this),t.finishInit&&t.finishInit(this);for(var g=0;g20*20}ue(t.scroller,"touchstart",function(m){if(!$e(e,m)&&!u(m)&&!Ja(e,m)){t.input.ensurePolled(),clearTimeout(i);var b=+new Date;t.activeTouch={start:b,moved:!1,prev:b-r.end<=300?r:null},m.touches.length==1&&(t.activeTouch.left=m.touches[0].pageX,t.activeTouch.top=m.touches[0].pageY)}}),ue(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),ue(t.scroller,"touchend",function(m){var b=t.activeTouch;if(b&&!nr(t,m)&&b.left!=null&&!b.moved&&new Date-b.start<300){var C=e.coordsChar(t.activeTouch,"page"),E;!b.prev||p(b,b.prev)?E=new Ae(C,C):!b.prev.prev||p(b,b.prev.prev)?E=e.findWordAt(C):E=new Ae(Y(C.line,0),ve(e.doc,Y(C.line+1,0))),e.setSelection(E.anchor,E.head),e.focus(),bt(m)}n()}),ue(t.scroller,"touchcancel",n),ue(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Ui(e,t.scroller.scrollTop),Ir(e,t.scroller.scrollLeft,!0),je(e,"scroll",e))}),ue(t.scroller,"mousewheel",function(m){return Vs(e,m)}),ue(t.scroller,"DOMMouseScroll",function(m){return Vs(e,m)}),ue(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(m){$e(e,m)||_i(m)},over:function(m){$e(e,m)||(yh(e,m),_i(m))},start:function(m){return bh(e,m)},drop:tt(e,vh),leave:function(m){$e(e,m)||Eu(e)}};var g=t.input.getField();ue(g,"keyup",function(m){return Iu.call(e,m)}),ue(g,"keydown",tt(e,Ou)),ue(g,"keypress",tt(e,Hu)),ue(g,"focus",function(m){return Ba(e,m)}),ue(g,"blur",function(m){return oi(e,m)})}var Va=[];Ne.defineInitHook=function(e){return Va.push(e)};function sn(e,t,i,r){var n=e.doc,u;i==null&&(i="add"),i=="smart"&&(n.mode.indent?u=Ni(e,t).state:i="prev");var p=e.options.tabSize,g=ae(n,t),m=Ye(g.text,null,p);g.stateAfter&&(g.stateAfter=null);var b=g.text.match(/^\s*/)[0],C;if(!r&&!/\S/.test(g.text))C=0,i="not";else if(i=="smart"&&(C=n.mode.indent(u,g.text.slice(b.length),g.text),C==Ze||C>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?C=Ye(ae(n,t-1).text,null,p):C=0:i=="add"?C=m+e.options.indentUnit:i=="subtract"?C=m-e.options.indentUnit:typeof i=="number"&&(C=m+i),C=Math.max(0,C);var E="",_=0;if(e.options.indentWithTabs)for(var M=Math.floor(C/p);M;--M)_+=p,E+=" ";if(_p,m=ra(t),b=null;if(g&&r.ranges.length>1)if(Ut&&Ut.text.join(` + left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(p),p.scrollIntoView(n),e.display.lineSpace.removeChild(p)}}}function qd(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(i=t.sticky=="before"?Y(t.line,t.ch+1,"before"):t,t=t.ch?Y(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var u=0;u<5;u++){var p=!1,g=Rt(e,t),m=!i||i==t?g:Rt(e,i);n={left:Math.min(g.left,m.left),top:Math.min(g.top,m.top)-r,right:Math.max(g.left,m.left),bottom:Math.max(g.bottom,m.bottom)+r};var b=_a(e,n),C=e.doc.scrollTop,E=e.doc.scrollLeft;if(b.scrollTop!=null&&(Ui(e,b.scrollTop),Math.abs(e.doc.scrollTop-C)>1&&(p=!0)),b.scrollLeft!=null&&(Ir(e,b.scrollLeft),Math.abs(e.doc.scrollLeft-E)>1&&(p=!0)),!p)break}return n}function Rd(e,t){var i=_a(e,t);i.scrollTop!=null&&Ui(e,i.scrollTop),i.scrollLeft!=null&&Ir(e,i.scrollLeft)}function _a(e,t){var i=e.display,r=ii(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,u=xa(e),p={};t.bottom-t.top>u&&(t.bottom=t.top+u);var g=e.doc.height+ya(i),m=t.topg-r;if(t.topn+u){var C=Math.min(t.top,(b?g:t.bottom)-u);C!=n&&(p.scrollTop=C)}var E=e.options.fixedGutter?0:i.gutters.offsetWidth,_=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-E,M=_r(e)-i.gutters.offsetWidth,P=t.right-t.left>M;return P&&(t.right=t.left+M),t.left<10?p.scrollLeft=0:t.left<_?p.scrollLeft=Math.max(0,t.left+E-(P?0:10)):t.right>M+_-3&&(p.scrollLeft=t.right+(P?0:10)-M),p}function za(e,t){t!=null&&(Wn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function ai(e){Wn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Wi(e,t,i){(t!=null||i!=null)&&Wn(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Wd(e,t){Wn(e),e.curOp.scrollToPos=t}function Wn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=zs(e,t.from),r=zs(e,t.to);Ws(e,i,r,t.margin)}}function Ws(e,t,i,r){var n=_a(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-r,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+r});Wi(e,n.scrollLeft,n.scrollTop)}function Ui(e,t){Math.abs(e.doc.scrollTop-t)<2||(s||Oa(e,{top:t}),Us(e,t,!0),s&&Oa(e),Xi(e,100))}function Us(e,t,i){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),!(e.display.scroller.scrollTop==t&&!i)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Ir(e,t,i,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),!((i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)&&(e.doc.scrollLeft=t,Ys(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function ji(e){var t=e.display,i=t.gutters.offsetWidth,r=Math.round(e.doc.height+ya(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?i:0,docHeight:r,scrollHeight:r+Qt(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var Hr=function(e,t,i){this.cm=i;var r=this.vert=k("div",[k("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=k("div",[k("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=n.tabIndex=-1,e(r),e(n),ue(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),ue(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,c&&d<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Hr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var n=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+n)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=i?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var u=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+u)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?r:0,bottom:t?r:0}},Hr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Hr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Hr.prototype.zeroWidthHack=function(){var e=O&&!B?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new dt,this.disableVert=new dt},Hr.prototype.enableZeroWidthBar=function(e,t,i){e.style.visibility="";function r(){var n=e.getBoundingClientRect(),u=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);u!=e?e.style.visibility="hidden":t.set(1e3,r)}t.set(1e3,r)},Hr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Gi=function(){};Gi.prototype.update=function(){return{bottom:0,right:0}},Gi.prototype.setScrollLeft=function(){},Gi.prototype.setScrollTop=function(){},Gi.prototype.clear=function(){};function li(e,t){t||(t=ji(e));var i=e.display.barWidth,r=e.display.barHeight;js(e,t);for(var n=0;n<4&&i!=e.display.barWidth||r!=e.display.barHeight;n++)i!=e.display.barWidth&&e.options.lineWrapping&&qn(e),js(e,ji(e)),i=e.display.barWidth,r=e.display.barHeight}function js(e,t){var i=e.display,r=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=r.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=r.bottom)+"px",i.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=r.bottom+"px",i.scrollbarFiller.style.width=r.right+"px"):i.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=r.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}var Gs={native:Hr,null:Gi};function Xs(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&oe(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Gs[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ue(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?Ir(e,t):Ui(e,t)},e),e.display.scrollbars.addClass&&pe(e.display.wrapper,e.display.scrollbars.addClass)}var Ud=0;function Pr(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Ud,markArrays:null},xd(e.curOp)}function qr(e){var t=e.curOp;t&&Cd(t,function(i){for(var r=0;r=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Un(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Xd(e){e.updatedDisplay=e.mustUpdate&&Na(e.cm,e.update)}function Kd(e){var t=e.cm,i=t.display;e.updatedDisplay&&qn(t),e.barMeasure=ji(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Es(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+Qt(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-_r(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function Yd(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)){var i=+new Date+e.options.workTime,r=Ni(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(u){if(r.line>=e.display.viewFrom){var p=u.styles,g=u.text.length>e.options.maxHighlightLength?Lr(t.mode,r.state):null,m=es(e,u,r,!0);g&&(r.state=g),u.styles=m.styles;var b=u.styleClasses,C=m.classes;C?u.styleClasses=C:b&&(u.styleClasses=null);for(var E=!p||p.length!=u.styles.length||b!=C&&(!b||!C||b.bgClass!=C.bgClass||b.textClass!=C.textClass),_=0;!E&&_i)return Xi(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&St(e,function(){for(var u=0;u=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&Hs(e)==0)return!1;Zs(e)&&(br(e),t.dims=Ea(e));var n=r.first+r.size,u=Math.max(t.visible.from-e.options.viewportMargin,r.first),p=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFromp&&i.viewTo-p<20&&(p=Math.min(n,i.viewTo)),rr&&(u=ga(e.doc,u),p=ps(e.doc,p));var g=u!=i.viewFrom||p!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Id(e,u,p),i.viewOffset=ir(ae(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var m=Hs(e);if(!g&&m==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var b=Vd(e);return m>4&&(i.lineDiv.style.display="none"),eh(e,i.updateLineNumbers,t.dims),m>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,$d(b),X(i.cursorDiv),X(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,g&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,Xi(e,400)),i.updateLineNumbers=null,!0}function Ks(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==_r(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+ya(e.display)-xa(e),i.top)}),t.visible=Rn(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Rn(e.display,e.doc,i));if(!Na(e,t))break;qn(e);var n=ji(e);Ri(e),li(e,n),Ha(e,n),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Oa(e,t){var i=new Un(e,t);if(Na(e,i)){qn(e),Ks(e,i);var r=ji(e);Ri(e),li(e,r),Ha(e,r),i.finish()}}function eh(e,t,i){var r=e.display,n=e.options.lineNumbers,u=r.lineDiv,p=u.firstChild;function g(P){var R=P.nextSibling;return v&&O&&e.display.currentWheelTarget==P?P.style.display="none":P.parentNode.removeChild(P),R}for(var m=r.view,b=r.viewFrom,C=0;C-1&&(M=!1),ys(e,E,b,i)),M&&(X(E.lineNumber),E.lineNumber.appendChild(document.createTextNode(sa(e.options,b)))),p=E.node.nextSibling}b+=E.size}for(;p;)p=g(p)}function Ia(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",et(e,"gutterChanged",e)}function Ha(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Qt(e)+"px"}function Ys(e){var t=e.display,i=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var r=Aa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,u=r+"px",p=0;pg.clientWidth,b=g.scrollHeight>g.clientHeight;if(r&&m||n&&b){if(n&&O&&v){e:for(var C=t.target,E=p.view;C!=g;C=C.parentNode)for(var _=0;_=0&&ve(e,r.to())<=0)return i}return-1};var Ae=function(e,t){this.anchor=e,this.head=t};Ae.prototype.from=function(){return An(this.anchor,this.head)},Ae.prototype.to=function(){return En(this.anchor,this.head)},Ae.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Wt(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(_,M){return ve(_.from(),M.from())}),i=ze(t,n);for(var u=1;u0:m>=0){var b=An(g.from(),p.from()),C=En(g.to(),p.to()),E=g.empty()?p.from()==p.head:g.from()==g.head;u<=i&&--i,t.splice(--u,2,new Ae(E?C:b,E?b:C))}}return new Bt(t,i)}function yr(e,t){return new Bt([new Ae(e,t||e)],0)}function xr(e){return e.text?Y(e.from.line+e.text.length-1,De(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function $s(e,t){if(ve(e,t.from)<0)return e;if(ve(e,t.to)<=0)return xr(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=xr(t).ch-t.to.ch),Y(i,r)}function qa(e,t){for(var i=[],r=0;r1&&e.remove(g.line+1,P-1),e.insert(g.line+1,J)}et(e,"change",e,t)}function wr(e,t,i){function r(n,u,p){if(n.linked)for(var g=0;g1&&!e.done[e.done.length-2].ranges)return e.done.pop(),De(e.done)}function ou(e,t,i,r){var n=e.history;n.undone.length=0;var u=+new Date,p,g;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>u-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(p=oh(n,n.lastOp==r)))g=De(p.changes),ve(t.from,t.to)==0&&ve(t.from,g.to)==0?g.to=xr(t):p.changes.push(Ua(e,t));else{var m=De(n.done);for((!m||!m.ranges)&&Xn(e.sel,n.done),p={changes:[Ua(e,t)],generation:n.generation},n.done.push(p);n.done.length>n.undoDepth;)n.done.shift(),n.done[0].ranges||n.done.shift()}n.done.push(i),n.generation=++n.maxGeneration,n.lastModTime=n.lastSelTime=u,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,g||je(e,"historyAdded")}function ah(e,t,i,r){var n=t.charAt(0);return n=="*"||n=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function lh(e,t,i,r){var n=e.history,u=r&&r.origin;i==n.lastSelOp||u&&n.lastSelOrigin==u&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==u||ah(e,u,De(n.done),t))?n.done[n.done.length-1]=t:Xn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=u,n.lastSelOp=i,r&&r.clearRedo!==!1&&nu(n.undone)}function Xn(e,t){var i=De(t);i&&i.ranges&&i.equals(e)||t.push(e)}function au(e,t,i,r){var n=t["spans_"+e.id],u=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(p){p.markedSpans&&((n||(n=t["spans_"+e.id]={}))[u]=p.markedSpans),++u})}function sh(e){if(!e)return null;for(var t,i=0;i-1&&(De(g)[E]=b[E],delete b[E])}}return r}function ja(e,t,i,r){if(r){var n=e.anchor;if(i){var u=ve(t,n)<0;u!=ve(i,n)<0?(n=t,t=i):u!=ve(t,i)<0&&(t=i)}return new Ae(n,t)}else return new Ae(i||t,t)}function Kn(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),st(e,new Bt([ja(e.sel.primary(),t,i,n)],0),r)}function su(e,t,i){for(var r=[],n=e.cm&&(e.cm.display.shift||e.extend),u=0;u=t.ch:g.to>t.ch))){if(n&&(je(m,"beforeCursorEnter"),m.explicitlyCleared))if(u.markedSpans){--p;continue}else break;if(!m.atomic)continue;if(i){var E=m.find(r<0?1:-1),_=void 0;if((r<0?C:b)&&(E=pu(e,E,-r,E&&E.line==t.line?u:null)),E&&E.line==t.line&&(_=ve(E,i))&&(r<0?_<0:_>0))return ui(e,E,t,r,n)}var M=m.find(r<0?-1:1);return(r<0?b:C)&&(M=pu(e,M,r,M.line==t.line?u:null)),M?ui(e,M,t,r,n):null}}return t}function Zn(e,t,i,r,n){var u=r||1,p=ui(e,t,i,u,n)||!n&&ui(e,t,i,u,!0)||ui(e,t,i,-u,n)||!n&&ui(e,t,i,-u,!0);return p||(e.cantEdit=!0,Y(e.first,0))}function pu(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?be(e,Y(t.line-1)):null:i>0&&t.ch==(r||ae(e,t.line)).text.length?t.line=0;--n)vu(e,{from:r[n].from,to:r[n].to,text:n?[""]:t.text,origin:t.origin});else vu(e,t)}}function vu(e,t){if(!(t.text.length==1&&t.text[0]==""&&ve(t.from,t.to)==0)){var i=qa(e,t);ou(e,t,i,e.cm?e.cm.curOp.id:NaN),Zi(e,t,i,ha(e,t));var r=[];wr(e,function(n,u){!u&&ze(r,n.history)==-1&&(wu(n.history,t),r.push(n.history)),Zi(n,t,null,ha(n,t))})}}function Qn(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(!(r&&!i)){for(var n=e.history,u,p=e.sel,g=t=="undo"?n.done:n.undone,m=t=="undo"?n.undone:n.done,b=0;b=0;--M){var P=_(M);if(P)return P.v}}}}function bu(e,t){if(t!=0&&(e.first+=t,e.sel=new Bt(Pt(e.sel.ranges,function(n){return new Ae(Y(n.anchor.line+t,n.anchor.ch),Y(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm)){yt(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;re.lastLine())){if(t.from.lineu&&(t={from:t.from,to:Y(u,ae(e,u).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Mr(e,t.from,t.to),i||(i=qa(e,t)),e.cm?ch(e.cm,t,r):Wa(e,t,r),Yn(e,i,vt),e.cantEdit&&Zn(e,Y(e.firstLine(),0))&&(e.cantEdit=!1)}}function ch(e,t,i){var r=e.doc,n=e.display,u=t.from,p=t.to,g=!1,m=u.line;e.options.lineWrapping||(m=Fe(qt(ae(r,u.line))),r.iter(m,p.line+1,function(M){if(M==n.maxLine)return g=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Yl(e),Wa(r,t,i,Is(e)),e.options.lineWrapping||(r.iter(m,u.line+t.text.length,function(M){var P=_n(M);P>n.maxLineLength&&(n.maxLine=M,n.maxLineLength=P,n.maxLineChanged=!0,g=!1)}),g&&(e.curOp.updateMaxLine=!0)),ed(r,u.line),Xi(e,400);var b=t.text.length-(p.line-u.line)-1;t.full?yt(e):u.line==p.line&&t.text.length==1&&!tu(e.doc,t)?vr(e,u.line,"text"):yt(e,u.line,p.line+1,b);var C=Ot(e,"changes"),E=Ot(e,"change");if(E||C){var _={from:u,to:p,text:t.text,removed:t.removed,origin:t.origin};E&&et(e,"change",e,_),C&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(_)}e.display.selForContextMenu=null}function ci(e,t,i,r,n){var u;r||(r=i),ve(r,i)<0&&(u=[r,i],i=u[0],r=u[1]),typeof t=="string"&&(t=e.splitLines(t)),fi(e,{from:i,to:r,text:t,origin:n})}function yu(e,t,i,r){i1||!(this.children[0]instanceof Ji))){var g=[];this.collapse(g),this.children=[new Ji(g)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var p=n.lines.length%25+25,g=p;g10);e.parent.maybeSpill()}},iterN:function(e,t,i){for(var r=0;re.display.maxLineLength&&(e.display.maxLine=b,e.display.maxLineLength=C,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&yt(e,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&du(e.doc)),e&&et(e,"markerCleared",e,this,r,n),t&&qr(e),this.parent&&this.parent.clear()}},Cr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n0||p==0&&u.clearWhenEmpty!==!1)return u;if(u.replacedWith&&(u.collapsed=!0,u.widgetNode=H("span",[u.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||u.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(u.widgetNode.insertLeft=!0)),u.collapsed){if(hs(e,t.line,t,i,u)||t.line!=i.line&&hs(e,i.line,t,i,u))throw new Error("Inserting collapsed marker partially overlapping an existing one");rd()}u.addToHistory&&ou(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var g=t.line,m=e.cm,b;if(e.iter(g,i.line+1,function(E){m&&u.collapsed&&!m.options.lineWrapping&&qt(E)==m.display.maxLine&&(b=!0),u.collapsed&&g!=t.line&&Yt(E,0),nd(E,new Tn(u,g==t.line?t.ch:null,g==i.line?i.ch:null),e.cm&&e.cm.curOp),++g}),u.collapsed&&e.iter(t.line,i.line+1,function(E){mr(e,E)&&Yt(E,0)}),u.clearOnEnter&&ue(u,"beforeCursorEnter",function(){return u.clear()}),u.readOnly&&(td(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),u.collapsed&&(u.id=++Du,u.atomic=!0),m){if(b&&(m.curOp.updateMaxLine=!0),u.collapsed)yt(m,t.line,i.line+1);else if(u.className||u.startStyle||u.endStyle||u.css||u.attributes||u.title)for(var C=t.line;C<=i.line;C++)vr(m,C,"text");u.atomic&&du(m.doc),et(m,"markerAdded",m,u)}return u}var en=function(e,t){this.markers=e,this.primary=t;for(var i=0;i=0;m--)fi(this,r[m]);g?fu(this,g):this.cm&&ai(this.cm)}),undo:rt(function(){Qn(this,"undo")}),redo:rt(function(){Qn(this,"redo")}),undoSelection:rt(function(){Qn(this,"undo",!0)}),redoSelection:rt(function(){Qn(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,r=0;r=e.ch)&&t.push(n.marker.parent||n.marker)}return t},findMarks:function(e,t,i){e=be(this,e),t=be(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(u){var p=u.markedSpans;if(p)for(var g=0;g=m.to||m.from==null&&n!=e.line||m.from!=null&&n==t.line&&m.from>=t.ch)&&(!i||i(m.marker))&&r.push(m.marker.parent||m.marker)}++n}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var r=0;re)return t=e,!0;e-=u,++i}),be(this,Y(i,t))},indexFromPos:function(e){e=be(this,e);var t=e.ch;if(e.linet&&(t=e.from),e.to!=null&&e.to-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var C=e.dataTransfer.getData("Text");if(C){var E;if(t.state.draggingText&&!t.state.draggingText.copy&&(E=t.listSelections()),Yn(t.doc,yr(i,i)),E)for(var _=0;_=0;g--)ci(e.doc,"",r[g].from,r[g].to,"+delete");ai(e)})}function Xa(e,t,i){var r=Xl(e.text,t+i,i);return r<0||r>e.text.length?null:r}function Ka(e,t,i){var r=Xa(e,t.ch,i);return r==null?null:new Y(t.line,r,i<0?"after":"before")}function Ya(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var u=tr(i,t.doc.direction);if(u){var p=n<0?De(u):u[0],g=n<0==(p.level==1),m=g?"after":"before",b;if(p.level>0||t.doc.direction=="rtl"){var C=ri(t,i);b=n<0?i.text.length-1:0;var E=Jt(t,C,b).top;b=Li(function(_){return Jt(t,C,_).top==E},n<0==(p.level==1)?p.from:p.to-1,b),m=="before"&&(b=Xa(i,b,1))}else b=n<0?p.to:p.from;return new Y(r,b,m)}}return new Y(r,n<0?i.text.length:0,n<0?"before":"after")}function Sh(e,t,i,r){var n=tr(t,e.doc.direction);if(!n)return Ka(t,i,r);i.ch>=t.text.length?(i.ch=t.text.length,i.sticky="before"):i.ch<=0&&(i.ch=0,i.sticky="after");var u=Bi(n,i.ch,i.sticky),p=n[u];if(e.doc.direction=="ltr"&&p.level%2==0&&(r>0?p.to>i.ch:p.from=p.from&&_>=C.begin)){var M=E?"before":"after";return new Y(i.line,_,M)}}var P=function(J,te,V){for(var ie=function(Le,it){return it?new Y(i.line,g(Le,1),"before"):new Y(i.line,Le,"after")};J>=0&&J0==(se.level!=1),we=le?V.begin:g(V.end,-1);if(se.from<=we&&we0?C.end:g(C.begin,-1);return Z!=null&&!(r>0&&Z==t.text.length)&&(R=P(r>0?0:n.length-1,r,b(Z)),R)?R:null}var nn={selectAll:gu,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),vt)},killLine:function(e){return pi(e,function(t){if(t.empty()){var i=ae(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line0)n=new Y(n.line,n.ch+1),e.replaceRange(u.charAt(n.ch-1)+u.charAt(n.ch-2),Y(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var p=ae(e.doc,n.line-1).text;p&&(n=new Y(n.line,1),e.replaceRange(u.charAt(0)+e.doc.lineSeparator()+p.charAt(p.length-1),Y(n.line-1,p.length-1),n,"+transpose"))}}i.push(new Ae(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){return St(e,function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");t=e.listSelections();for(var r=0;re&&ve(t,this.pos)==0&&i==this.button};var an,ln;function Bh(e,t){var i=+new Date;return ln&&ln.compare(i,e,t)?(an=ln=null,"triple"):an&&an.compare(i,e,t)?(ln=new Qa(i,e,t),an=null,"double"):(an=new Qa(i,e,t),ln=null,"single")}function Pu(e){var t=this,i=t.display;if(!($e(t,e)||i.activeTouch&&i.input.supportsTouch())){if(i.input.ensurePolled(),i.shift=e.shiftKey,nr(i,e)){v||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(!Ja(t,e)){var r=Nr(t,e),n=Ql(e),u=r?Bh(r,n):"single";ye(t).focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&_h(t,n,r,u,e))&&(n==1?r?Nh(t,r,u,e):$o(e)==i.scroller&&bt(e):n==2?(r&&Kn(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(de?t.display.input.onContextMenu(e):Ma(t)))}}}function _h(e,t,i,r,n){var u="Click";return r=="double"?u="Double"+u:r=="triple"&&(u="Triple"+u),u=(t==1?"Left":t==2?"Middle":"Right")+u,on(e,Lu(u,n),n,function(p){if(typeof p=="string"&&(p=nn[p]),!p)return!1;var g=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),g=p(e,i)!=Ze}finally{e.state.suppressEdits=!1}return g})}function zh(e,t,i){var r=e.getOption("configureMouse"),n=r?r(e,t,i):{};if(n.unit==null){var u=I?i.shiftKey&&i.metaKey:i.altKey;n.unit=u?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(n.extend==null||e.doc.extend)&&(n.extend=e.doc.extend||i.shiftKey),n.addNew==null&&(n.addNew=O?i.metaKey:i.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(O?i.altKey:i.ctrlKey)),n}function Nh(e,t,i,r){c?setTimeout(lt(qs,e),0):e.curOp.focus=he(ee(e));var n=zh(e,i,r),u=e.doc.sel,p;e.options.dragDrop&&Uc&&!e.isReadOnly()&&i=="single"&&(p=u.contains(t))>-1&&(ve((p=u.ranges[p]).from(),t)<0||t.xRel>0)&&(ve(p.to(),t)>0||t.xRel<0)?Oh(e,r,t,n):Ih(e,r,t,n)}function Oh(e,t,i,r){var n=e.display,u=!1,p=tt(e,function(b){v&&(n.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:Ma(e)),Mt(n.wrapper.ownerDocument,"mouseup",p),Mt(n.wrapper.ownerDocument,"mousemove",g),Mt(n.scroller,"dragstart",m),Mt(n.scroller,"drop",p),u||(bt(b),r.addNew||Kn(e.doc,i,null,null,r.extend),v&&!F||c&&d==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),g=function(b){u=u||Math.abs(t.clientX-b.clientX)+Math.abs(t.clientY-b.clientY)>=10},m=function(){return u=!0};v&&(n.scroller.draggable=!0),e.state.draggingText=p,p.copy=!r.moveOnDrag,ue(n.wrapper.ownerDocument,"mouseup",p),ue(n.wrapper.ownerDocument,"mousemove",g),ue(n.scroller,"dragstart",m),ue(n.scroller,"drop",p),e.state.delayingBlurEvent=!0,setTimeout(function(){return n.input.focus()},20),n.scroller.dragDrop&&n.scroller.dragDrop()}function qu(e,t,i){if(i=="char")return new Ae(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new Ae(Y(t.line,0),be(e.doc,Y(t.line+1,0)));var r=i(e,t);return new Ae(r.from,r.to)}function Ih(e,t,i,r){c&&Ma(e);var n=e.display,u=e.doc;bt(t);var p,g,m=u.sel,b=m.ranges;if(r.addNew&&!r.extend?(g=u.sel.contains(i),g>-1?p=b[g]:p=new Ae(i,i)):(p=u.sel.primary(),g=u.sel.primIndex),r.unit=="rectangle")r.addNew||(p=new Ae(i,i)),i=Nr(e,t,!0,!0),g=-1;else{var C=qu(e,i,r.unit);r.extend?p=ja(p,C.anchor,C.head,r.extend):p=C}r.addNew?g==-1?(g=b.length,st(u,Wt(e,b.concat([p]),g),{scroll:!1,origin:"*mouse"})):b.length>1&&b[g].empty()&&r.unit=="char"&&!r.extend?(st(u,Wt(e,b.slice(0,g).concat(b.slice(g+1)),0),{scroll:!1,origin:"*mouse"}),m=u.sel):Ga(u,g,p,Ti):(g=0,st(u,new Bt([p],0),Ti),m=u.sel);var E=i;function _(V){if(ve(E,V)!=0)if(E=V,r.unit=="rectangle"){for(var ie=[],se=e.options.tabSize,le=Ye(ae(u,i.line).text,i.ch,se),we=Ye(ae(u,V.line).text,V.ch,se),Le=Math.min(le,we),it=Math.max(le,we),Ie=Math.min(i.line,V.line),Et=Math.min(e.lastLine(),Math.max(i.line,V.line));Ie<=Et;Ie++){var wt=ae(u,Ie).text,Xe=Kt(wt,Le,se);Le==it?ie.push(new Ae(Y(Ie,Xe),Y(Ie,Xe))):wt.length>Xe&&ie.push(new Ae(Y(Ie,Xe),Y(Ie,Kt(wt,it,se))))}ie.length||ie.push(new Ae(i,i)),st(u,Wt(e,m.ranges.slice(0,g).concat(ie),g),{origin:"*mouse",scroll:!1}),e.scrollIntoView(V)}else{var Ct=p,ot=qu(e,V,r.unit),Qe=Ct.anchor,Ke;ve(ot.anchor,Qe)>0?(Ke=ot.head,Qe=An(Ct.from(),ot.anchor)):(Ke=ot.anchor,Qe=En(Ct.to(),ot.head));var qe=m.ranges.slice(0);qe[g]=Hh(e,new Ae(be(u,Qe),Ke)),st(u,Wt(e,qe,g),Ti)}}var M=n.wrapper.getBoundingClientRect(),P=0;function R(V){var ie=++P,se=Nr(e,V,!0,r.unit=="rectangle");if(se)if(ve(se,E)!=0){e.curOp.focus=he(ee(e)),_(se);var le=Rn(n,u);(se.line>=le.to||se.lineM.bottom?20:0;we&&setTimeout(tt(e,function(){P==ie&&(n.scroller.scrollTop+=we,R(V))}),50)}}function Z(V){e.state.selectingText=!1,P=1/0,V&&(bt(V),n.input.focus()),Mt(n.wrapper.ownerDocument,"mousemove",J),Mt(n.wrapper.ownerDocument,"mouseup",te),u.history.lastSelOrigin=null}var J=tt(e,function(V){V.buttons===0||!Ql(V)?Z(V):R(V)}),te=tt(e,Z);e.state.selectingText=te,ue(n.wrapper.ownerDocument,"mousemove",J),ue(n.wrapper.ownerDocument,"mouseup",te)}function Hh(e,t){var i=t.anchor,r=t.head,n=ae(e.doc,i.line);if(ve(i,r)==0&&i.sticky==r.sticky)return t;var u=tr(n);if(!u)return t;var p=Bi(u,i.ch,i.sticky),g=u[p];if(g.from!=i.ch&&g.to!=i.ch)return t;var m=p+(g.from==i.ch==(g.level!=1)?0:1);if(m==0||m==u.length)return t;var b;if(r.line!=i.line)b=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var C=Bi(u,r.ch,r.sticky),E=C-p||(r.ch-i.ch)*(g.level==1?-1:1);C==m-1||C==m?b=E<0:b=E>0}var _=u[m+(b?-1:0)],M=b==(_.level==1),P=M?_.from:_.to,R=M?"after":"before";return i.ch==P&&i.sticky==R?t:new Ae(new Y(i.line,P,R),r)}function Ru(e,t,i,r){var n,u;if(t.touches)n=t.touches[0].clientX,u=t.touches[0].clientY;else try{n=t.clientX,u=t.clientY}catch{return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&bt(t);var p=e.display,g=p.lineDiv.getBoundingClientRect();if(u>g.bottom||!Ot(e,i))return Vo(t);u-=g.top-p.viewOffset;for(var m=0;m=n){var C=Br(e.doc,u),E=e.display.gutterSpecs[m];return je(e,i,e,C,E.className,t),Vo(t)}}}function Ja(e,t){return Ru(e,t,"gutterClick",!0)}function Wu(e,t){nr(e.display,t)||Ph(e,t)||$e(e,t,"contextmenu")||de||e.display.input.onContextMenu(t)}function Ph(e,t){return Ot(e,"gutterContextMenu")?Ru(e,t,"gutterContextMenu",!1):!1}function Uu(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),qi(e)}var gi={toString:function(){return"CodeMirror.Init"}},ju={},eo={};function qh(e){var t=e.optionHandlers;function i(r,n,u,p){e.defaults[r]=n,u&&(t[r]=p?function(g,m,b){b!=gi&&u(g,m,b)}:u)}e.defineOption=i,e.Init=gi,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,Ra(r)},!0),i("indentUnit",2,Ra,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){Yi(r),qi(r),yt(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!!n){var u=[],p=r.doc.first;r.doc.iter(function(m){for(var b=0;;){var C=m.text.indexOf(n,b);if(C==-1)break;b=C+n.length,u.push(Y(p,C))}p++});for(var g=u.length-1;g>=0;g--)ci(r.doc,n,u[g],Y(u[g].line,u[g].ch+n.length))}}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(r,n,u){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),u!=gi&&r.refresh()}),i("specialCharPlaceholder",gd,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",z?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(r,n){return r.getInputField().spellcheck=n},!0),i("autocorrect",!1,function(r,n){return r.getInputField().autocorrect=n},!0),i("autocapitalize",!1,function(r,n){return r.getInputField().autocapitalize=n},!0),i("rtlMoveVisually",!U),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Uu(r),Ki(r)},!0),i("keyMap","default",function(r,n,u){var p=Vn(n),g=u!=gi&&Vn(u);g&&g.detach&&g.detach(r,p),p.attach&&p.attach(r,g||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Wh,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=Pa(n,r.options.lineNumbers),Ki(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?Aa(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return li(r)},!0),i("scrollbarStyle","native",function(r){Xs(r),li(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),i("lineNumbers",!1,function(r,n){r.display.gutterSpecs=Pa(r.options.gutters,n),Ki(r)},!0),i("firstLineNumber",1,Ki,!0),i("lineNumberFormatter",function(r){return r},Ki,!0),i("showCursorWhenSelecting",!1,Ri,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,n){n=="nocursor"&&(oi(r),r.display.input.blur()),r.display.input.readOnlyChanged(n)}),i("screenReaderLabel",null,function(r,n){n=n===""?null:n,r.display.input.screenReaderLabelChanged(n)}),i("disableInput",!1,function(r,n){n||r.display.input.reset()},!0),i("dragDrop",!0,Rh),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,Ri,!0),i("singleCursorHeightPerLine",!0,Ri,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,Yi,!0),i("addModeClass",!1,Yi,!0),i("pollInterval",100),i("undoDepth",200,function(r,n){return r.doc.history.undoDepth=n}),i("historyEventDelay",1250),i("viewportMargin",10,function(r){return r.refresh()},!0),i("maxHighlightLength",1e4,Yi,!0),i("moveInputWithCursor",!0,function(r,n){n||r.display.input.resetPosition()}),i("tabindex",null,function(r,n){return r.display.input.getField().tabIndex=n||""}),i("autofocus",null),i("direction","ltr",function(r,n){return r.doc.setDirection(n)},!0),i("phrases",null)}function Rh(e,t,i){var r=i&&i!=gi;if(!t!=!r){var n=e.display.dragFunctions,u=t?ue:Mt;u(e.display.scroller,"dragstart",n.start),u(e.display.scroller,"dragenter",n.enter),u(e.display.scroller,"dragover",n.over),u(e.display.scroller,"dragleave",n.leave),u(e.display.scroller,"drop",n.drop)}}function Wh(e){e.options.lineWrapping?(pe(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(oe(e.display.wrapper,"CodeMirror-wrap"),va(e)),Fa(e),yt(e),qi(e),setTimeout(function(){return li(e)},100)}function Ne(e,t){var i=this;if(!(this instanceof Ne))return new Ne(e,t);this.options=t=t?Lt(t):{},Lt(ju,t,!1);var r=t.value;typeof r=="string"?r=new xt(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new Ne.inputStyles[t.inputStyle](this),u=this.display=new th(e,r,n,t);u.wrapper.CodeMirror=this,Uu(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Xs(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new dt,keySeq:null,specialChars:null},t.autofocus&&!z&&u.input.focus(),c&&d<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Uh(this),xh(),Pr(this),this.curOp.forceUpdate=!0,ru(this,r),t.autofocus&&!z||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&Ba(i)},20):oi(this);for(var p in eo)eo.hasOwnProperty(p)&&eo[p](this,t[p],gi);Zs(this),t.finishInit&&t.finishInit(this);for(var g=0;g20*20}ue(t.scroller,"touchstart",function(m){if(!$e(e,m)&&!u(m)&&!Ja(e,m)){t.input.ensurePolled(),clearTimeout(i);var b=+new Date;t.activeTouch={start:b,moved:!1,prev:b-r.end<=300?r:null},m.touches.length==1&&(t.activeTouch.left=m.touches[0].pageX,t.activeTouch.top=m.touches[0].pageY)}}),ue(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),ue(t.scroller,"touchend",function(m){var b=t.activeTouch;if(b&&!nr(t,m)&&b.left!=null&&!b.moved&&new Date-b.start<300){var C=e.coordsChar(t.activeTouch,"page"),E;!b.prev||p(b,b.prev)?E=new Ae(C,C):!b.prev.prev||p(b,b.prev.prev)?E=e.findWordAt(C):E=new Ae(Y(C.line,0),be(e.doc,Y(C.line+1,0))),e.setSelection(E.anchor,E.head),e.focus(),bt(m)}n()}),ue(t.scroller,"touchcancel",n),ue(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Ui(e,t.scroller.scrollTop),Ir(e,t.scroller.scrollLeft,!0),je(e,"scroll",e))}),ue(t.scroller,"mousewheel",function(m){return Vs(e,m)}),ue(t.scroller,"DOMMouseScroll",function(m){return Vs(e,m)}),ue(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(m){$e(e,m)||_i(m)},over:function(m){$e(e,m)||(yh(e,m),_i(m))},start:function(m){return bh(e,m)},drop:tt(e,vh),leave:function(m){$e(e,m)||Eu(e)}};var g=t.input.getField();ue(g,"keyup",function(m){return Iu.call(e,m)}),ue(g,"keydown",tt(e,Ou)),ue(g,"keypress",tt(e,Hu)),ue(g,"focus",function(m){return Ba(e,m)}),ue(g,"blur",function(m){return oi(e,m)})}var Va=[];Ne.defineInitHook=function(e){return Va.push(e)};function sn(e,t,i,r){var n=e.doc,u;i==null&&(i="add"),i=="smart"&&(n.mode.indent?u=Ni(e,t).state:i="prev");var p=e.options.tabSize,g=ae(n,t),m=Ye(g.text,null,p);g.stateAfter&&(g.stateAfter=null);var b=g.text.match(/^\s*/)[0],C;if(!r&&!/\S/.test(g.text))C=0,i="not";else if(i=="smart"&&(C=n.mode.indent(u,g.text.slice(b.length),g.text),C==Ze||C>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?C=Ye(ae(n,t-1).text,null,p):C=0:i=="add"?C=m+e.options.indentUnit:i=="subtract"?C=m-e.options.indentUnit:typeof i=="number"&&(C=m+i),C=Math.max(0,C);var E="",_=0;if(e.options.indentWithTabs)for(var M=Math.floor(C/p);M;--M)_+=p,E+=" ";if(_p,m=ra(t),b=null;if(g&&r.ranges.length>1)if(Ut&&Ut.text.join(` `)==t){if(r.ranges.length%Ut.text.length==0){b=[];for(var C=0;C=0;_--){var M=r.ranges[_],P=M.from(),R=M.to();M.empty()&&(i&&i>0?P=Y(P.line,P.ch-i):e.state.overwrite&&!g?R=Y(R.line,Math.min(ae(u,R.line).text.length,R.ch+De(m).length)):g&&Ut&&Ut.lineWise&&Ut.text.join(` `)==m.join(` -`)&&(P=R=Y(P.line,0)));var Z={from:P,to:R,text:b?b[_%b.length]:m,origin:n||(g?"paste":e.state.cutIncoming>p?"cut":"+input")};fi(e.doc,Z),et(e,"inputRead",e,Z)}t&&!g&&Xu(e,t),ai(e),e.curOp.updateInput<2&&(e.curOp.updateInput=E),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Gu(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&St(t,function(){return $a(t,i,0,null,"paste")}),!0}function Xu(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var i=e.doc.sel,r=i.ranges.length-1;r>=0;r--){var n=i.ranges[r];if(!(n.head.ch>100||r&&i.ranges[r-1].head.line==n.head.line)){var u=e.getModeAt(n.head),p=!1;if(u.electricChars){for(var g=0;g-1){p=sn(e,n.head.line,"smart");break}}else u.electricInput&&u.electricInput.test(ae(e.doc,n.head.line).text.slice(0,n.head.ch))&&(p=sn(e,n.head.line,"smart"));p&&et(e,"electricInput",e,n.head.line)}}}function Ku(e){for(var t=[],i=[],r=0;ru&&(sn(this,g.head.line,r,!0),u=g.head.line,p==this.doc.sel.primIndex&&ai(this));else{var m=g.from(),b=g.to(),C=Math.max(u,m.line);u=Math.min(this.lastLine(),b.line-(b.ch?0:1))+1;for(var E=C;E0&&Ga(this.doc,p,new Ae(m,_[p].to()),vt)}}}),getTokenAt:function(r,n){return ns(this,r,n)},getLineTokens:function(r,n){return ns(this,Y(r),n,!0)},getTokenTypeAt:function(r){r=ve(this.doc,r);var n=ts(this,ae(this.doc,r.line)),u=0,p=(n.length-1)/2,g=r.ch,m;if(g==0)m=n[2];else for(;;){var b=u+p>>1;if((b?n[b*2-1]:0)>=g)p=b;else if(n[b*2+1]m&&(r=m,p=!0),g=ae(this.doc,r)}else g=r;return On(this,g,{top:0,left:0},n||"page",u||p).top+(p?this.doc.height-ir(g):0)},defaultTextHeight:function(){return ii(this.display)},defaultCharWidth:function(){return ni(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,u,p,g){var m=this.display;r=Rt(this,ve(this.doc,r));var b=r.bottom,C=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),m.sizer.appendChild(n),p=="over")b=r.top;else if(p=="above"||p=="near"){var E=Math.max(m.wrapper.clientHeight,this.doc.height),_=Math.max(m.sizer.clientWidth,m.lineSpace.clientWidth);(p=="above"||r.bottom+n.offsetHeight>E)&&r.top>n.offsetHeight?b=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=E&&(b=r.bottom),C+n.offsetWidth>_&&(C=_-n.offsetWidth)}n.style.top=b+"px",n.style.left=n.style.right="",g=="right"?(C=m.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(g=="left"?C=0:g=="middle"&&(C=(m.sizer.clientWidth-n.offsetWidth)/2),n.style.left=C+"px"),u&&Rd(this,{left:C,top:b,right:C+n.offsetWidth,bottom:b+n.offsetHeight})},triggerOnKeyDown:ht(Ou),triggerOnKeyPress:ht(Hu),triggerOnKeyUp:Iu,triggerOnMouseDown:ht(Pu),execCommand:function(r){if(nn.hasOwnProperty(r))return nn[r].call(null,this)},triggerElectric:ht(function(r){Xu(this,r)}),findPosH:function(r,n,u,p){var g=1;n<0&&(g=-1,n=-n);for(var m=ve(this.doc,r),b=0;b0&&C(u.charAt(p-1));)--p;for(;g.5||this.options.lineWrapping)&&Fa(this),je(this,"refresh",this)}),swapDoc:ht(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),ru(this,r),qi(this),this.display.input.reset(),Wi(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,et(this,"swapDoc",this,n),n}),phrase:function(r){var n=this.options.phrases;return n&&Object.prototype.hasOwnProperty.call(n,r)?n[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Jr(e),e.registerHelper=function(r,n,u){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=u},e.registerGlobalHelper=function(r,n,u,p){e.registerHelper(r,n,p),i[r]._global.push({pred:u,val:p})}}function tl(e,t,i,r,n){var u=t,p=i,g=ae(e,t.line),m=n&&e.direction=="rtl"?-i:i;function b(){var te=t.line+m;return te=e.first+e.size?!1:(t=new Y(te,t.ch,t.sticky),g=ae(e,te))}function C(te){var V;if(r=="codepoint"){var ie=g.text.charCodeAt(t.ch+(i>0?0:-1));if(isNaN(ie))V=null;else{var se=i>0?ie>=55296&&ie<56320:ie>=56320&&ie<57343;V=new Y(t.line,Math.max(0,Math.min(g.text.length,t.ch+i*(se?2:1))),-i)}}else n?V=Sh(e.cm,g,t,i):V=Ka(g,t,i);if(V==null)if(!te&&b())t=Ya(n,e.cm,g,t.line,m);else return!1;else t=V;return!0}if(r=="char"||r=="codepoint")C();else if(r=="column")C(!0);else if(r=="word"||r=="group")for(var E=null,_=r=="group",M=e.cm&&e.cm.getHelper(t,"wordChars"),P=!0;!(i<0&&!C(!P));P=!1){var R=g.text.charAt(t.ch)||` +`)&&(P=R=Y(P.line,0)));var Z={from:P,to:R,text:b?b[_%b.length]:m,origin:n||(g?"paste":e.state.cutIncoming>p?"cut":"+input")};fi(e.doc,Z),et(e,"inputRead",e,Z)}t&&!g&&Xu(e,t),ai(e),e.curOp.updateInput<2&&(e.curOp.updateInput=E),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Gu(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&St(t,function(){return $a(t,i,0,null,"paste")}),!0}function Xu(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var i=e.doc.sel,r=i.ranges.length-1;r>=0;r--){var n=i.ranges[r];if(!(n.head.ch>100||r&&i.ranges[r-1].head.line==n.head.line)){var u=e.getModeAt(n.head),p=!1;if(u.electricChars){for(var g=0;g-1){p=sn(e,n.head.line,"smart");break}}else u.electricInput&&u.electricInput.test(ae(e.doc,n.head.line).text.slice(0,n.head.ch))&&(p=sn(e,n.head.line,"smart"));p&&et(e,"electricInput",e,n.head.line)}}}function Ku(e){for(var t=[],i=[],r=0;ru&&(sn(this,g.head.line,r,!0),u=g.head.line,p==this.doc.sel.primIndex&&ai(this));else{var m=g.from(),b=g.to(),C=Math.max(u,m.line);u=Math.min(this.lastLine(),b.line-(b.ch?0:1))+1;for(var E=C;E0&&Ga(this.doc,p,new Ae(m,_[p].to()),vt)}}}),getTokenAt:function(r,n){return ns(this,r,n)},getLineTokens:function(r,n){return ns(this,Y(r),n,!0)},getTokenTypeAt:function(r){r=be(this.doc,r);var n=ts(this,ae(this.doc,r.line)),u=0,p=(n.length-1)/2,g=r.ch,m;if(g==0)m=n[2];else for(;;){var b=u+p>>1;if((b?n[b*2-1]:0)>=g)p=b;else if(n[b*2+1]m&&(r=m,p=!0),g=ae(this.doc,r)}else g=r;return On(this,g,{top:0,left:0},n||"page",u||p).top+(p?this.doc.height-ir(g):0)},defaultTextHeight:function(){return ii(this.display)},defaultCharWidth:function(){return ni(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,u,p,g){var m=this.display;r=Rt(this,be(this.doc,r));var b=r.bottom,C=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),m.sizer.appendChild(n),p=="over")b=r.top;else if(p=="above"||p=="near"){var E=Math.max(m.wrapper.clientHeight,this.doc.height),_=Math.max(m.sizer.clientWidth,m.lineSpace.clientWidth);(p=="above"||r.bottom+n.offsetHeight>E)&&r.top>n.offsetHeight?b=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=E&&(b=r.bottom),C+n.offsetWidth>_&&(C=_-n.offsetWidth)}n.style.top=b+"px",n.style.left=n.style.right="",g=="right"?(C=m.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(g=="left"?C=0:g=="middle"&&(C=(m.sizer.clientWidth-n.offsetWidth)/2),n.style.left=C+"px"),u&&Rd(this,{left:C,top:b,right:C+n.offsetWidth,bottom:b+n.offsetHeight})},triggerOnKeyDown:ht(Ou),triggerOnKeyPress:ht(Hu),triggerOnKeyUp:Iu,triggerOnMouseDown:ht(Pu),execCommand:function(r){if(nn.hasOwnProperty(r))return nn[r].call(null,this)},triggerElectric:ht(function(r){Xu(this,r)}),findPosH:function(r,n,u,p){var g=1;n<0&&(g=-1,n=-n);for(var m=be(this.doc,r),b=0;b0&&C(u.charAt(p-1));)--p;for(;g.5||this.options.lineWrapping)&&Fa(this),je(this,"refresh",this)}),swapDoc:ht(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),ru(this,r),qi(this),this.display.input.reset(),Wi(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,et(this,"swapDoc",this,n),n}),phrase:function(r){var n=this.options.phrases;return n&&Object.prototype.hasOwnProperty.call(n,r)?n[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Jr(e),e.registerHelper=function(r,n,u){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=u},e.registerGlobalHelper=function(r,n,u,p){e.registerHelper(r,n,p),i[r]._global.push({pred:u,val:p})}}function tl(e,t,i,r,n){var u=t,p=i,g=ae(e,t.line),m=n&&e.direction=="rtl"?-i:i;function b(){var te=t.line+m;return te=e.first+e.size?!1:(t=new Y(te,t.ch,t.sticky),g=ae(e,te))}function C(te){var V;if(r=="codepoint"){var ie=g.text.charCodeAt(t.ch+(i>0?0:-1));if(isNaN(ie))V=null;else{var se=i>0?ie>=55296&&ie<56320:ie>=56320&&ie<57343;V=new Y(t.line,Math.max(0,Math.min(g.text.length,t.ch+i*(se?2:1))),-i)}}else n?V=Sh(e.cm,g,t,i):V=Ka(g,t,i);if(V==null)if(!te&&b())t=Ya(n,e.cm,g,t.line,m);else return!1;else t=V;return!0}if(r=="char"||r=="codepoint")C();else if(r=="column")C(!0);else if(r=="word"||r=="group")for(var E=null,_=r=="group",M=e.cm&&e.cm.getHelper(t,"wordChars"),P=!0;!(i<0&&!C(!P));P=!1){var R=g.text.charAt(t.ch)||` `,Z=kn(R,M)?"w":_&&R==` `?"n":!_||/\s/.test(R)?null:"p";if(_&&!P&&!Z&&(Z="s"),E&&E!=Z){i<0&&(i=1,C(),t.sticky="after");break}if(Z&&(E=Z),i>0&&!C(!P))break}var J=Zn(e,t,u,p,!0);return ua(u,J)&&(J.hitSide=!0),J}function Zu(e,t,i,r){var n=e.doc,u=t.left,p;if(r=="page"){var g=Math.min(e.display.wrapper.clientHeight,ye(e).innerHeight||n(e).documentElement.clientHeight),m=Math.max(g-.5*ii(e.display),3);p=(i>0?t.bottom:t.top)+i*m}else r=="line"&&(p=i>0?t.bottom+3:t.top-3);for(var b;b=ka(e,u,p),!!b.outside;){if(i<0?p<=0:p>=n.height){b.hitSide=!0;break}p+=i*5}return b}var Te=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new dt,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Te.prototype.init=function(e){var t=this,i=this,r=i.cm,n=i.div=e.lineDiv;n.contentEditable=!0,el(n,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function u(g){for(var m=g.target;m;m=m.parentNode){if(m==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(m.className))break}return!1}ue(n,"paste",function(g){!u(g)||$e(r,g)||Gu(g,r)||d<=11&&setTimeout(tt(r,function(){return t.updateFromDOM()}),20)}),ue(n,"compositionstart",function(g){t.composing={data:g.data,done:!1}}),ue(n,"compositionupdate",function(g){t.composing||(t.composing={data:g.data,done:!1})}),ue(n,"compositionend",function(g){t.composing&&(g.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ue(n,"touchstart",function(){return i.forceCompositionEnd()}),ue(n,"input",function(){t.composing||t.readFromDOMSoon()});function p(g){if(!(!u(g)||$e(r,g))){if(r.somethingSelected())to({lineWise:!1,text:r.getSelections()}),g.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var m=Ku(r);to({lineWise:!0,text:m.text}),g.type=="cut"&&r.operation(function(){r.setSelections(m.ranges,0,vt),r.replaceSelection("",null,"cut")})}else return;if(g.clipboardData){g.clipboardData.clearData();var b=Ut.text.join(` `);if(g.clipboardData.setData("Text",b),g.clipboardData.getData("Text")==b){g.preventDefault();return}}var C=Yu(),E=C.firstChild;el(E),r.display.lineSpace.insertBefore(C,r.display.lineSpace.firstChild),E.value=Ut.text.join(` -`);var _=he(Ce(n));A(E),setTimeout(function(){r.display.lineSpace.removeChild(C),_.focus(),_==n&&i.showPrimarySelection()},50)}}ue(n,"copy",p),ue(n,"cut",p)},Te.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Te.prototype.prepareSelection=function(){var e=Ps(this.cm,!1);return e.focus=he(Ce(this.div))==this.div,e},Te.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Te.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Te.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),r=i.from(),n=i.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||n.line=t.display.viewFrom&&Qu(t,r)||{node:g[0].measure.map[2],offset:0},b=n.linee.firstLine()&&(r=Y(r.line-1,ae(e.doc,r.line-1).length)),n.ch==ae(e.doc,n.line).text.length&&n.linet.viewTo-1)return!1;var u,p,g;r.line==t.viewFrom||(u=Or(e,r.line))==0?(p=Fe(t.view[0].line),g=t.view[0].node):(p=Fe(t.view[u].line),g=t.view[u-1].node.nextSibling);var m=Or(e,n.line),b,C;if(m==t.view.length-1?(b=t.viewTo-1,C=t.lineDiv.lastChild):(b=Fe(t.view[m+1].line)-1,C=t.view[m+1].node.previousSibling),!g)return!1;for(var E=e.doc.splitLines(Xh(e,g,C,p,b)),_=Mr(e.doc,Y(p,0),Y(b,ae(e.doc,b).text.length));E.length>1&&_.length>1;)if(De(E)==De(_))E.pop(),_.pop(),b--;else if(E[0]==_[0])E.shift(),_.shift(),p++;else break;for(var M=0,P=0,R=E[0],Z=_[0],J=Math.min(R.length,Z.length);Mr.ch&&te.charCodeAt(te.length-P-1)==V.charCodeAt(V.length-P-1);)M--,P++;E[E.length-1]=te.slice(0,te.length-P).replace(/^\u200b+/,""),E[0]=E[0].slice(M).replace(/\u200b+$/,"");var se=Y(p,M),le=Y(b,_.length?De(_).length-P:0);if(E.length>1||E[0]||me(se,le))return ci(e.doc,E,se,le,"+input"),!0},Te.prototype.ensurePolled=function(){this.forceCompositionEnd()},Te.prototype.reset=function(){this.forceCompositionEnd()},Te.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Te.prototype.readFromDOMSoon=function(){var e=this;this.readDOMTimeout==null&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80))},Te.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&St(this.cm,function(){return yt(e.cm)})},Te.prototype.setUneditable=function(e){e.contentEditable="false"},Te.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||tt(this.cm,$a)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},Te.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Te.prototype.onContextMenu=function(){},Te.prototype.resetPosition=function(){},Te.prototype.needsContentAttribute=!0;function Qu(e,t){var i=wa(e,t.line);if(!i||i.hidden)return null;var r=ae(e.doc,t.line),n=Ss(i,r,t.line),u=tr(r,e.doc.direction),p="left";if(u){var g=Bi(u,t.ch);p=g%2?"right":"left"}var m=Fs(n.map,t.ch,p);return m.offset=m.collapse=="right"?m.end:m.start,m}function Gh(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function mi(e,t){return t&&(e.bad=!0),e}function Xh(e,t,i,r,n){var u="",p=!1,g=e.doc.lineSeparator(),m=!1;function b(M){return function(P){return P.id==M}}function C(){p&&(u+=g,m&&(u+=g),p=m=!1)}function E(M){M&&(C(),u+=M)}function _(M){if(M.nodeType==1){var P=M.getAttribute("cm-text");if(P){E(P);return}var R=M.getAttribute("cm-marker"),Z;if(R){var J=e.findMarks(Y(r,0),Y(n+1,0),b(+R));J.length&&(Z=J[0].find(0))&&E(Mr(e.doc,Z.from,Z.to).join(g));return}if(M.getAttribute("contenteditable")=="false")return;var te=/^(pre|div|p|li|table|br)$/i.test(M.nodeName);if(!/^br$/i.test(M.nodeName)&&M.textContent.length==0)return;te&&C();for(var V=0;V=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),ue(n,"paste",function(p){$e(r,p)||Gu(p,r)||(r.state.pasteIncoming=+new Date,i.fastPoll())});function u(p){if(!$e(r,p)){if(r.somethingSelected())to({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var g=Ku(r);to({lineWise:!0,text:g.text}),p.type=="cut"?r.setSelections(g.ranges,null,vt):(i.prevInput="",n.value=g.text.join(` +`);var _=he(Ce(n));A(E),setTimeout(function(){r.display.lineSpace.removeChild(C),_.focus(),_==n&&i.showPrimarySelection()},50)}}ue(n,"copy",p),ue(n,"cut",p)},Te.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Te.prototype.prepareSelection=function(){var e=Ps(this.cm,!1);return e.focus=he(Ce(this.div))==this.div,e},Te.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Te.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Te.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),r=i.from(),n=i.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||n.line=t.display.viewFrom&&Qu(t,r)||{node:g[0].measure.map[2],offset:0},b=n.linee.firstLine()&&(r=Y(r.line-1,ae(e.doc,r.line-1).length)),n.ch==ae(e.doc,n.line).text.length&&n.linet.viewTo-1)return!1;var u,p,g;r.line==t.viewFrom||(u=Or(e,r.line))==0?(p=Fe(t.view[0].line),g=t.view[0].node):(p=Fe(t.view[u].line),g=t.view[u-1].node.nextSibling);var m=Or(e,n.line),b,C;if(m==t.view.length-1?(b=t.viewTo-1,C=t.lineDiv.lastChild):(b=Fe(t.view[m+1].line)-1,C=t.view[m+1].node.previousSibling),!g)return!1;for(var E=e.doc.splitLines(Xh(e,g,C,p,b)),_=Mr(e.doc,Y(p,0),Y(b,ae(e.doc,b).text.length));E.length>1&&_.length>1;)if(De(E)==De(_))E.pop(),_.pop(),b--;else if(E[0]==_[0])E.shift(),_.shift(),p++;else break;for(var M=0,P=0,R=E[0],Z=_[0],J=Math.min(R.length,Z.length);Mr.ch&&te.charCodeAt(te.length-P-1)==V.charCodeAt(V.length-P-1);)M--,P++;E[E.length-1]=te.slice(0,te.length-P).replace(/^\u200b+/,""),E[0]=E[0].slice(M).replace(/\u200b+$/,"");var se=Y(p,M),le=Y(b,_.length?De(_).length-P:0);if(E.length>1||E[0]||ve(se,le))return ci(e.doc,E,se,le,"+input"),!0},Te.prototype.ensurePolled=function(){this.forceCompositionEnd()},Te.prototype.reset=function(){this.forceCompositionEnd()},Te.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Te.prototype.readFromDOMSoon=function(){var e=this;this.readDOMTimeout==null&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80))},Te.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&St(this.cm,function(){return yt(e.cm)})},Te.prototype.setUneditable=function(e){e.contentEditable="false"},Te.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||tt(this.cm,$a)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},Te.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Te.prototype.onContextMenu=function(){},Te.prototype.resetPosition=function(){},Te.prototype.needsContentAttribute=!0;function Qu(e,t){var i=wa(e,t.line);if(!i||i.hidden)return null;var r=ae(e.doc,t.line),n=Ss(i,r,t.line),u=tr(r,e.doc.direction),p="left";if(u){var g=Bi(u,t.ch);p=g%2?"right":"left"}var m=Fs(n.map,t.ch,p);return m.offset=m.collapse=="right"?m.end:m.start,m}function Gh(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function mi(e,t){return t&&(e.bad=!0),e}function Xh(e,t,i,r,n){var u="",p=!1,g=e.doc.lineSeparator(),m=!1;function b(M){return function(P){return P.id==M}}function C(){p&&(u+=g,m&&(u+=g),p=m=!1)}function E(M){M&&(C(),u+=M)}function _(M){if(M.nodeType==1){var P=M.getAttribute("cm-text");if(P){E(P);return}var R=M.getAttribute("cm-marker"),Z;if(R){var J=e.findMarks(Y(r,0),Y(n+1,0),b(+R));J.length&&(Z=J[0].find(0))&&E(Mr(e.doc,Z.from,Z.to).join(g));return}if(M.getAttribute("contenteditable")=="false")return;var te=/^(pre|div|p|li|table|br)$/i.test(M.nodeName);if(!/^br$/i.test(M.nodeName)&&M.textContent.length==0)return;te&&C();for(var V=0;V=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),ue(n,"paste",function(p){$e(r,p)||Gu(p,r)||(r.state.pasteIncoming=+new Date,i.fastPoll())});function u(p){if(!$e(r,p)){if(r.somethingSelected())to({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var g=Ku(r);to({lineWise:!0,text:g.text}),p.type=="cut"?r.setSelections(g.ranges,null,vt):(i.prevInput="",n.value=g.text.join(` `),A(n))}else return;p.type=="cut"&&(r.state.cutIncoming=+new Date)}}ue(n,"cut",u),ue(n,"copy",u),ue(e.scroller,"paste",function(p){if(!(nr(e,p)||$e(r,p))){if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var g=new Event("paste");g.clipboardData=p.clipboardData,n.dispatchEvent(g)}}),ue(e.lineSpace,"selectstart",function(p){nr(e,p)||bt(p)}),ue(n,"compositionstart",function(){var p=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:p,range:r.markText(p,r.getCursor("to"),{className:"CodeMirror-composing"})}}),ue(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},We.prototype.createField=function(e){this.wrapper=Yu(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;el(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},We.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},We.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=Ps(e);if(e.options.moveInputWithCursor){var n=Rt(e,i.sel.primary().head,"div"),u=t.wrapper.getBoundingClientRect(),p=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+p.top-u.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+p.left-u.left))}return r},We.prototype.showSelection=function(e){var t=this.cm,i=t.display;G(i.cursorDiv,e.cursors),G(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},We.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i,t.state.focused&&A(this.textarea),c&&d>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",c&&d>=9&&(this.hasSelection=null));this.resetting=!1}},We.prototype.getField=function(){return this.textarea},We.prototype.supportsTouch=function(){return!1},We.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!z||he(Ce(this.textarea))!=this.textarea))try{this.textarea.focus()}catch{}},We.prototype.blur=function(){this.textarea.blur()},We.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},We.prototype.receivedFocus=function(){this.slowPoll()},We.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},We.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function i(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,i)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,i)},We.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||Xc(i)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var n=i.value;if(n==r&&!t.somethingSelected())return!1;if(c&&d>=9&&this.hasSelection===n||O&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var u=n.charCodeAt(0);if(u==8203&&!r&&(r="\u200B"),u==8666)return this.reset(),this.cm.execCommand("undo")}for(var p=0,g=Math.min(r.length,n.length);p1e3||n.indexOf(` `)>-1?i.value=e.prevInput="":e.prevInput=n,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},We.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},We.prototype.onKeyPress=function(){c&&d>=9&&(this.hasSelection=null),this.fastPoll()},We.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var u=Nr(i,e),p=r.scroller.scrollTop;if(!u||S)return;var g=i.options.resetSelectionOnContextMenu;g&&i.doc.sel.contains(u)==-1&&tt(i,st)(i.doc,yr(u),vt);var m=n.style.cssText,b=t.wrapper.style.cssText,C=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",n.style.cssText=`position: absolute; width: 30px; height: 30px; top: `+(e.clientY-C.top-5)+"px; left: "+(e.clientX-C.left-5)+`px; z-index: 1000; background: `+(c?"rgba(255, 255, 255, .05)":"transparent")+`; - outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var E;v&&(E=n.ownerDocument.defaultView.scrollY),r.input.focus(),v&&n.ownerDocument.defaultView.scrollTo(null,E),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=M,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function _(){if(n.selectionStart!=null){var R=i.somethingSelected(),Z="\u200B"+(R?n.value:"");n.value="\u21DA",n.value=Z,t.prevInput=R?"":"\u200B",n.selectionStart=1,n.selectionEnd=Z.length,r.selForContextMenu=i.doc.sel}}function M(){if(t.contextMenuPending==M&&(t.contextMenuPending=!1,t.wrapper.style.cssText=b,n.style.cssText=m,c&&d<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=p),n.selectionStart!=null)){(!c||c&&d<9)&&_();var R=0,Z=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?tt(i,gu)(i):R++<10?r.detectingSelectAll=setTimeout(Z,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Z,200)}}if(c&&d>=9&&_(),de){_i(e);var P=function(){Mt(window,"mouseup",P),setTimeout(M,20)};ue(window,"mouseup",P)}else setTimeout(M,50)},We.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},We.prototype.setUneditable=function(){},We.prototype.needsContentAttribute=!1;function Yh(e,t){if(t=t?Lt(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var i=he(Ce(e));t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=g.getValue()}var n;if(e.form&&(ue(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var u=e.form;n=u.submit;try{var p=u.submit=function(){r(),u.submit=n,u.submit(),u.submit=p}}catch{}}t.finishInit=function(m){m.save=r,m.getTextArea=function(){return e},m.toTextArea=function(){m.toTextArea=isNaN,r(),e.parentNode.removeChild(m.getWrapperElement()),e.style.display="",e.form&&(Mt(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var g=Ne(function(m){return e.parentNode.insertBefore(m,e.nextSibling)},t);return g}function Zh(e){e.off=Mt,e.on=ue,e.wheelEventPixels=rh,e.Doc=xt,e.splitLines=ra,e.countColumn=Ye,e.findColumn=Kt,e.isWordChar=Zo,e.Pass=Ze,e.signal=je,e.Line=ei,e.changeEnd=xr,e.scrollbarModel=Gs,e.Pos=Y,e.cmpPos=me,e.modes=na,e.mimeModes=Vr,e.resolveMode=Sn,e.getMode=oa,e.modeExtensions=$r,e.extendMode=Jc,e.copyState=Lr,e.startState=Jl,e.innerMode=aa,e.commands=nn,e.keyMap=ar,e.keyName=Mu,e.isModifierKey=Tu,e.lookupKey=hi,e.normalizeKeyMap=kh,e.StringStream=Ge,e.SharedTextMarker=en,e.TextMarker=Cr,e.LineWidget=$i,e.e_preventDefault=bt,e.e_stopPropagation=Zl,e.e_stop=_i,e.addClass=be,e.contains=Q,e.rmClass=oe,e.keyNames=Dr}qh(Ne),jh(Ne);var Qh="iter insert remove copy getEditor constructor".split(" ");for(var io in xt.prototype)xt.prototype.hasOwnProperty(io)&&ze(Qh,io)<0&&(Ne.prototype[io]=function(e){return function(){return e.apply(this.doc,arguments)}}(xt.prototype[io]));return Jr(xt),Ne.inputStyles={textarea:We,contenteditable:Te},Ne.defineMode=function(e){!Ne.defaults.mode&&e!="null"&&(Ne.defaults.mode=e),Zc.apply(this,arguments)},Ne.defineMIME=Qc,Ne.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Ne.defineMIME("text/plain","null"),Ne.defineExtension=function(e,t){Ne.prototype[e]=t},Ne.defineDocExtension=function(e,t){xt.prototype[e]=t},Ne.fromTextArea=Yh,Zh(Ne),Ne.version="5.65.21",Ne})});var ef=at((Vu,$u)=>{(function(o){typeof Vu=="object"&&typeof $u=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,s=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,a=/[*+-]\s/;o.commands.newlineAndIndentContinueMarkdownList=function(h){if(h.getOption("disableInput"))return o.Pass;for(var c=h.listSelections(),d=[],v=0;v\s*$/.test(B),z=!/>\s*$/.test(B);(N||z)&&h.replaceRange("",{line:y.line,ch:0},{line:y.line,ch:y.ch+1}),d[v]=` -`}else{var O=L[1],I=L[5],W=!(a.test(L[2])||L[2].indexOf(">")>=0),j=W?parseInt(L[3],10)+1+L[4]:L[2].replace("x"," ");d[v]=` -`+O+j+I,W&&f(h,y)}}h.replaceSelections(d)};function f(h,c){var d=c.line,v=0,y=0,x=l.exec(h.getLine(d)),D=x[1];do{v+=1;var S=d+v,F=h.getLine(S),B=l.exec(F);if(B){var L=B[1],T=parseInt(x[3],10)+v-y,N=parseInt(B[3],10),z=N;if(D===L&&!isNaN(N))T===N&&(z=N+1),T>N&&(z=T+1),h.replaceRange(F.replace(l,L+z+B[4]+B[5]),{line:S,ch:0},{line:S,ch:F.length});else{if(D.length>L.length||D.length{var tf=At();tf.commands.tabAndIndentMarkdownList=function(o){var l=o.listSelections(),s=l[0].head,a=o.getStateAfter(s.line),f=a.list!==!1;if(f){o.execCommand("indentMore");return}if(o.options.indentWithTabs)o.execCommand("insertTab");else{var h=Array(o.options.tabSize+1).join(" ");o.replaceSelection(h)}};tf.commands.shiftTabAndUnindentMarkdownList=function(o){var l=o.listSelections(),s=l[0].head,a=o.getStateAfter(s.line),f=a.list!==!1;if(f){o.execCommand("indentLess");return}if(o.options.indentWithTabs)o.execCommand("insertTab");else{var h=Array(o.options.tabSize+1).join(" ");o.replaceSelection(h)}}});var af=at((nf,of)=>{(function(o){typeof nf=="object"&&typeof of=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("fullScreen",!1,function(a,f,h){h==o.Init&&(h=!1),!h!=!f&&(f?l(a):s(a))});function l(a){var f=a.getWrapperElement();a.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:f.style.width,height:f.style.height},f.style.width="",f.style.height="auto",f.className+=" CodeMirror-fullscreen",document.documentElement.style.overflow="hidden",a.refresh()}function s(a){var f=a.getWrapperElement();f.className=f.className.replace(/\s*CodeMirror-fullscreen\b/,""),document.documentElement.style.overflow="";var h=a.state.fullScreenRestore;f.style.width=h.width,f.style.height=h.height,window.scrollTo(h.scrollLeft,h.scrollTop),a.refresh()}})});var al=at((lf,sf)=>{(function(o){typeof lf=="object"&&typeof sf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},s={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};o.defineMode("xml",function(a,f){var h=a.indentUnit,c={},d=f.htmlMode?l:s;for(var v in d)c[v]=d[v];for(var v in f)c[v]=f[v];var y,x;function D(k,H){function q(be){return H.tokenize=be,be(k,H)}var Q=k.next();if(Q=="<")return k.eat("!")?k.eat("[")?k.match("CDATA[")?q(B("atom","]]>")):null:k.match("--")?q(B("comment","-->")):k.match("DOCTYPE",!0,!0)?(k.eatWhile(/[\w\._\-]/),q(L(1))):null:k.eat("?")?(k.eatWhile(/[\w\._\-]/),H.tokenize=B("meta","?>"),"meta"):(y=k.eat("/")?"closeTag":"openTag",H.tokenize=S,"tag bracket");if(Q=="&"){var he;return k.eat("#")?k.eat("x")?he=k.eatWhile(/[a-fA-F\d]/)&&k.eat(";"):he=k.eatWhile(/[\d]/)&&k.eat(";"):he=k.eatWhile(/[\w\.\-:]/)&&k.eat(";"),he?"atom":"error"}else return k.eatWhile(/[^&<]/),null}D.isInText=!0;function S(k,H){var q=k.next();if(q==">"||q=="/"&&k.eat(">"))return H.tokenize=D,y=q==">"?"endTag":"selfcloseTag","tag bracket";if(q=="=")return y="equals",null;if(q=="<"){H.tokenize=D,H.state=I,H.tagName=H.tagStart=null;var Q=H.tokenize(k,H);return Q?Q+" tag error":"tag error"}else return/[\'\"]/.test(q)?(H.tokenize=F(q),H.stringStartCol=k.column(),H.tokenize(k,H)):(k.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function F(k){var H=function(q,Q){for(;!q.eol();)if(q.next()==k){Q.tokenize=S;break}return"string"};return H.isInAttribute=!0,H}function B(k,H){return function(q,Q){for(;!q.eol();){if(q.match(H)){Q.tokenize=D;break}q.next()}return k}}function L(k){return function(H,q){for(var Q;(Q=H.next())!=null;){if(Q=="<")return q.tokenize=L(k+1),q.tokenize(H,q);if(Q==">")if(k==1){q.tokenize=D;break}else return q.tokenize=L(k-1),q.tokenize(H,q)}return"meta"}}function T(k){return k&&k.toLowerCase()}function N(k,H,q){this.prev=k.context,this.tagName=H||"",this.indent=k.indented,this.startOfLine=q,(c.doNotIndent.hasOwnProperty(H)||k.context&&k.context.noIndent)&&(this.noIndent=!0)}function z(k){k.context&&(k.context=k.context.prev)}function O(k,H){for(var q;;){if(!k.context||(q=k.context.tagName,!c.contextGrabbers.hasOwnProperty(T(q))||!c.contextGrabbers[T(q)].hasOwnProperty(T(H))))return;z(k)}}function I(k,H,q){return k=="openTag"?(q.tagStart=H.column(),W):k=="closeTag"?j:I}function W(k,H,q){return k=="word"?(q.tagName=H.current(),x="tag",U):c.allowMissingTagName&&k=="endTag"?(x="tag bracket",U(k,H,q)):(x="error",W)}function j(k,H,q){if(k=="word"){var Q=H.current();return q.context&&q.context.tagName!=Q&&c.implicitlyClosed.hasOwnProperty(T(q.context.tagName))&&z(q),q.context&&q.context.tagName==Q||c.matchClosing===!1?(x="tag",K):(x="tag error",de)}else return c.allowMissingTagName&&k=="endTag"?(x="tag bracket",K(k,H,q)):(x="error",de)}function K(k,H,q){return k!="endTag"?(x="error",K):(z(q),I)}function de(k,H,q){return x="error",K(k,H,q)}function U(k,H,q){if(k=="word")return x="attribute",oe;if(k=="endTag"||k=="selfcloseTag"){var Q=q.tagName,he=q.tagStart;return q.tagName=q.tagStart=null,k=="selfcloseTag"||c.autoSelfClosers.hasOwnProperty(T(Q))?O(q,Q):(O(q,Q),q.context=new N(q,Q,he==q.indented)),I}return x="error",U}function oe(k,H,q){return k=="equals"?X:(c.allowMissing||(x="error"),U(k,H,q))}function X(k,H,q){return k=="string"?G:k=="word"&&c.allowUnquoted?(x="string",U):(x="error",U(k,H,q))}function G(k,H,q){return k=="string"?G:U(k,H,q)}return{startState:function(k){var H={tokenize:D,state:I,indented:k||0,tagName:null,tagStart:null,context:null};return k!=null&&(H.baseIndent=k),H},token:function(k,H){if(!H.tagName&&k.sol()&&(H.indented=k.indentation()),k.eatSpace())return null;y=null;var q=H.tokenize(k,H);return(q||y)&&q!="comment"&&(x=null,H.state=H.state(y||q,k,H),x&&(q=x=="error"?q+" error":x)),q},indent:function(k,H,q){var Q=k.context;if(k.tokenize.isInAttribute)return k.tagStart==k.indented?k.stringStartCol+1:k.indented+h;if(Q&&Q.noIndent)return o.Pass;if(k.tokenize!=S&&k.tokenize!=D)return q?q.match(/^(\s*)/)[0].length:0;if(k.tagName)return c.multilineTagIndentPastTag!==!1?k.tagStart+k.tagName.length+2:k.tagStart+h*(c.multilineTagIndentFactor||1);if(c.alignCDATA&&/$/,blockCommentStart:"",configuration:c.htmlMode?"html":"xml",helperType:c.htmlMode?"html":"xml",skipAttribute:function(k){k.state==X&&(k.state=U)},xmlCurrentTag:function(k){return k.tagName?{name:k.tagName,close:k.type=="closeTag"}:null},xmlCurrentContext:function(k){for(var H=[],q=k.context;q;q=q.prev)H.push(q.tagName);return H.reverse()}}}),o.defineMIME("text/xml","xml"),o.defineMIME("application/xml","xml"),o.mimeModes.hasOwnProperty("text/html")||o.defineMIME("text/html",{name:"xml",htmlMode:!0})})});var cf=at((uf,ff)=>{(function(o){typeof uf=="object"&&typeof ff=="object"?o(At()):typeof define=="function"&&define.amd?define(["../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy","cbl"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded JavaScript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"],alias:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var l=0;l-1&&a.substring(c+1,a.length);if(d)return o.findModeByExtension(d)},o.findModeByName=function(a){a=a.toLowerCase();for(var f=0;f{(function(o){typeof df=="object"&&typeof hf=="object"?o(At(),al(),cf()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../xml/xml","../meta"],o):o(CodeMirror)})(function(o){"use strict";o.defineMode("markdown",function(l,s){var a=o.getMode(l,"text/html"),f=a.name=="null";function h(A){if(o.findModeByName){var w=o.findModeByName(A);w&&(A=w.mime||w.mimes[0])}var ee=o.getMode(l,A);return ee.name=="null"?null:ee}s.highlightFormatting===void 0&&(s.highlightFormatting=!1),s.maxBlockquoteDepth===void 0&&(s.maxBlockquoteDepth=0),s.taskLists===void 0&&(s.taskLists=!1),s.strikethrough===void 0&&(s.strikethrough=!1),s.emoji===void 0&&(s.emoji=!1),s.fencedCodeBlockHighlighting===void 0&&(s.fencedCodeBlockHighlighting=!0),s.fencedCodeBlockDefaultMode===void 0&&(s.fencedCodeBlockDefaultMode="text/plain"),s.xml===void 0&&(s.xml=!0),s.tokenTypeOverrides===void 0&&(s.tokenTypeOverrides={});var c={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var d in c)c.hasOwnProperty(d)&&s.tokenTypeOverrides[d]&&(c[d]=s.tokenTypeOverrides[d]);var v=/^([*\-_])(?:\s*\1){2,}\s*$/,y=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,x=/^\[(x| )\](?=\s)/i,D=s.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,S=/^ {0,3}(?:\={1,}|-{2,})\s*$/,F=/^[^#!\[\]*_\\<>` "'(~:]+/,B=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,L=/^\s*\[[^\]]+?\]:.*$/,T=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,N=" ";function z(A,w,ee){return w.f=w.inline=ee,ee(A,w)}function O(A,w,ee){return w.f=w.block=ee,ee(A,w)}function I(A){return!A||!/\S/.test(A.string)}function W(A){if(A.linkTitle=!1,A.linkHref=!1,A.linkText=!1,A.em=!1,A.strong=!1,A.strikethrough=!1,A.quote=0,A.indentedCode=!1,A.f==K){var w=f;if(!w){var ee=o.innerMode(a,A.htmlState);w=ee.mode.name=="xml"&&ee.state.tagStart===null&&!ee.state.context&&ee.state.tokenize.isInText}w&&(A.f=X,A.block=j,A.htmlState=null)}return A.trailingSpace=0,A.trailingSpaceNewLine=!1,A.prevLine=A.thisLine,A.thisLine={stream:null},null}function j(A,w){var ee=A.column()===w.indentation,Ce=I(w.prevLine.stream),ye=w.indentedCode,lt=w.prevLine.hr,Lt=w.list!==!1,Ye=(w.listStack[w.listStack.length-1]||0)+3;w.indentedCode=!1;var dt=w.indentation;if(w.indentationDiff===null&&(w.indentationDiff=w.indentation,Lt)){for(w.list=null;dt=4&&(ye||w.prevLine.fencedCodeEnd||w.prevLine.header||Ce))return A.skipToEnd(),w.indentedCode=!0,c.code;if(A.eatSpace())return null;if(ee&&w.indentation<=Ye&&(Ze=A.match(D))&&Ze[1].length<=6)return w.quote=0,w.header=Ze[1].length,w.thisLine.header=!0,s.highlightFormatting&&(w.formatting="header"),w.f=w.inline,U(w);if(w.indentation<=Ye&&A.eat(">"))return w.quote=ee?1:w.quote+1,s.highlightFormatting&&(w.formatting="quote"),A.eatSpace(),U(w);if(!Pe&&!w.setext&&ee&&w.indentation<=Ye&&(Ze=A.match(y))){var vt=Ze[1]?"ol":"ul";return w.indentation=dt+A.current().length,w.list=!0,w.quote=0,w.listStack.push(w.indentation),w.em=!1,w.strong=!1,w.code=!1,w.strikethrough=!1,s.taskLists&&A.match(x,!1)&&(w.taskList=!0),w.f=w.inline,s.highlightFormatting&&(w.formatting=["list","list-"+vt]),U(w)}else{if(ee&&w.indentation<=Ye&&(Ze=A.match(B,!0)))return w.quote=0,w.fencedEndRE=new RegExp(Ze[1]+"+ *$"),w.localMode=s.fencedCodeBlockHighlighting&&h(Ze[2]||s.fencedCodeBlockDefaultMode),w.localMode&&(w.localState=o.startState(w.localMode)),w.f=w.block=de,s.highlightFormatting&&(w.formatting="code-block"),w.code=-1,U(w);if(w.setext||(!ze||!Lt)&&!w.quote&&w.list===!1&&!w.code&&!Pe&&!L.test(A.string)&&(Ze=A.lookAhead(1))&&(Ze=Ze.match(S)))return w.setext?(w.header=w.setext,w.setext=0,A.skipToEnd(),s.highlightFormatting&&(w.formatting="header")):(w.header=Ze[0].charAt(0)=="="?1:2,w.setext=w.header),w.thisLine.header=!0,w.f=w.inline,U(w);if(Pe)return A.skipToEnd(),w.hr=!0,w.thisLine.hr=!0,c.hr;if(A.peek()==="[")return z(A,w,Q)}return z(A,w,w.inline)}function K(A,w){var ee=a.token(A,w.htmlState);if(!f){var Ce=o.innerMode(a,w.htmlState);(Ce.mode.name=="xml"&&Ce.state.tagStart===null&&!Ce.state.context&&Ce.state.tokenize.isInText||w.md_inside&&A.current().indexOf(">")>-1)&&(w.f=X,w.block=j,w.htmlState=null)}return ee}function de(A,w){var ee=w.listStack[w.listStack.length-1]||0,Ce=w.indentation=A.quote?w.push(c.formatting+"-"+A.formatting[ee]+"-"+A.quote):w.push("error"))}if(A.taskOpen)return w.push("meta"),w.length?w.join(" "):null;if(A.taskClosed)return w.push("property"),w.length?w.join(" "):null;if(A.linkHref?w.push(c.linkHref,"url"):(A.strong&&w.push(c.strong),A.em&&w.push(c.em),A.strikethrough&&w.push(c.strikethrough),A.emoji&&w.push(c.emoji),A.linkText&&w.push(c.linkText),A.code&&w.push(c.code),A.image&&w.push(c.image),A.imageAltText&&w.push(c.imageAltText,"link"),A.imageMarker&&w.push(c.imageMarker)),A.header&&w.push(c.header,c.header+"-"+A.header),A.quote&&(w.push(c.quote),!s.maxBlockquoteDepth||s.maxBlockquoteDepth>=A.quote?w.push(c.quote+"-"+A.quote):w.push(c.quote+"-"+s.maxBlockquoteDepth)),A.list!==!1){var Ce=(A.listStack.length-1)%3;Ce?Ce===1?w.push(c.list2):w.push(c.list3):w.push(c.list1)}return A.trailingSpaceNewLine?w.push("trailing-space-new-line"):A.trailingSpace&&w.push("trailing-space-"+(A.trailingSpace%2?"a":"b")),w.length?w.join(" "):null}function oe(A,w){if(A.match(F,!0))return U(w)}function X(A,w){var ee=w.text(A,w);if(typeof ee<"u")return ee;if(w.list)return w.list=null,U(w);if(w.taskList){var Ce=A.match(x,!0)[1]===" ";return Ce?w.taskOpen=!0:w.taskClosed=!0,s.highlightFormatting&&(w.formatting="task"),w.taskList=!1,U(w)}if(w.taskOpen=!1,w.taskClosed=!1,w.header&&A.match(/^#+$/,!0))return s.highlightFormatting&&(w.formatting="header"),U(w);var ye=A.next();if(w.linkTitle){w.linkTitle=!1;var lt=ye;ye==="("&&(lt=")"),lt=(lt+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Lt="^\\s*(?:[^"+lt+"\\\\]+|\\\\\\\\|\\\\.)"+lt;if(A.match(new RegExp(Lt),!0))return c.linkHref}if(ye==="`"){var Ye=w.formatting;s.highlightFormatting&&(w.formatting="code"),A.eatWhile("`");var dt=A.current().length;if(w.code==0&&(!w.quote||dt==1))return w.code=dt,U(w);if(dt==w.code){var ze=U(w);return w.code=0,ze}else return w.formatting=Ye,U(w)}else if(w.code)return U(w);if(ye==="\\"&&(A.next(),s.highlightFormatting)){var Pe=U(w),Ze=c.formatting+"-escape";return Pe?Pe+" "+Ze:Ze}if(ye==="!"&&A.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return w.imageMarker=!0,w.image=!0,s.highlightFormatting&&(w.formatting="image"),U(w);if(ye==="["&&w.imageMarker&&A.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return w.imageMarker=!1,w.imageAltText=!0,s.highlightFormatting&&(w.formatting="image"),U(w);if(ye==="]"&&w.imageAltText){s.highlightFormatting&&(w.formatting="image");var Pe=U(w);return w.imageAltText=!1,w.image=!1,w.inline=w.f=k,Pe}if(ye==="["&&!w.image)return w.linkText&&A.match(/^.*?\]/)||(w.linkText=!0,s.highlightFormatting&&(w.formatting="link")),U(w);if(ye==="]"&&w.linkText){s.highlightFormatting&&(w.formatting="link");var Pe=U(w);return w.linkText=!1,w.inline=w.f=A.match(/\(.*?\)| ?\[.*?\]/,!1)?k:X,Pe}if(ye==="<"&&A.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){w.f=w.inline=G,s.highlightFormatting&&(w.formatting="link");var Pe=U(w);return Pe?Pe+=" ":Pe="",Pe+c.linkInline}if(ye==="<"&&A.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){w.f=w.inline=G,s.highlightFormatting&&(w.formatting="link");var Pe=U(w);return Pe?Pe+=" ":Pe="",Pe+c.linkEmail}if(s.xml&&ye==="<"&&A.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var vt=A.string.indexOf(">",A.pos);if(vt!=-1){var Ti=A.string.substring(A.start,vt);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Ti)&&(w.md_inside=!0)}return A.backUp(1),w.htmlState=o.startState(a),O(A,w,K)}if(s.xml&&ye==="<"&&A.match(/^\/\w*?>/))return w.md_inside=!1,"tag";if(ye==="*"||ye==="_"){for(var Xt=1,Kt=A.pos==1?" ":A.string.charAt(A.pos-2);Xt<3&&A.eat(ye);)Xt++;var Ht=A.peek()||" ",pr=!/\s/.test(Ht)&&(!T.test(Ht)||/\s/.test(Kt)||T.test(Kt)),De=!/\s/.test(Kt)&&(!T.test(Kt)||/\s/.test(Ht)||T.test(Ht)),Pt=null,gr=null;if(Xt%2&&(!w.em&&pr&&(ye==="*"||!De||T.test(Kt))?Pt=!0:w.em==ye&&De&&(ye==="*"||!pr||T.test(Ht))&&(Pt=!1)),Xt>1&&(!w.strong&&pr&&(ye==="*"||!De||T.test(Kt))?gr=!0:w.strong==ye&&De&&(ye==="*"||!pr||T.test(Ht))&&(gr=!1)),gr!=null||Pt!=null){s.highlightFormatting&&(w.formatting=Pt==null?"strong":gr==null?"em":"strong em"),Pt===!0&&(w.em=ye),gr===!0&&(w.strong=ye);var ze=U(w);return Pt===!1&&(w.em=!1),gr===!1&&(w.strong=!1),ze}}else if(ye===" "&&(A.eat("*")||A.eat("_"))){if(A.peek()===" ")return U(w);A.backUp(1)}if(s.strikethrough){if(ye==="~"&&A.eatWhile(ye)){if(w.strikethrough){s.highlightFormatting&&(w.formatting="strikethrough");var ze=U(w);return w.strikethrough=!1,ze}else if(A.match(/^[^\s]/,!1))return w.strikethrough=!0,s.highlightFormatting&&(w.formatting="strikethrough"),U(w)}else if(ye===" "&&A.match("~~",!0)){if(A.peek()===" ")return U(w);A.backUp(2)}}if(s.emoji&&ye===":"&&A.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){w.emoji=!0,s.highlightFormatting&&(w.formatting="emoji");var Dn=U(w);return w.emoji=!1,Dn}return ye===" "&&(A.match(/^ +$/,!1)?w.trailingSpace++:w.trailingSpace&&(w.trailingSpaceNewLine=!0)),U(w)}function G(A,w){var ee=A.next();if(ee===">"){w.f=w.inline=X,s.highlightFormatting&&(w.formatting="link");var Ce=U(w);return Ce?Ce+=" ":Ce="",Ce+c.linkInline}return A.match(/^[^>]+/,!0),c.linkInline}function k(A,w){if(A.eatSpace())return null;var ee=A.next();return ee==="("||ee==="["?(w.f=w.inline=q(ee==="("?")":"]"),s.highlightFormatting&&(w.formatting="link-string"),w.linkHref=!0,U(w)):"error"}var H={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function q(A){return function(w,ee){var Ce=w.next();if(Ce===A){ee.f=ee.inline=X,s.highlightFormatting&&(ee.formatting="link-string");var ye=U(ee);return ee.linkHref=!1,ye}return w.match(H[A]),ee.linkHref=!0,U(ee)}}function Q(A,w){return A.match(/^([^\]\\]|\\.)*\]:/,!1)?(w.f=he,A.next(),s.highlightFormatting&&(w.formatting="link"),w.linkText=!0,U(w)):z(A,w,X)}function he(A,w){if(A.match("]:",!0)){w.f=w.inline=be,s.highlightFormatting&&(w.formatting="link");var ee=U(w);return w.linkText=!1,ee}return A.match(/^([^\]\\]|\\.)+/,!0),c.linkText}function be(A,w){return A.eatSpace()?null:(A.match(/^[^\s]+/,!0),A.peek()===void 0?w.linkTitle=!0:A.match(/^(?:\s+(?:"(?:[^"\\]|\\.)+"|'(?:[^'\\]|\\.)+'|\((?:[^)\\]|\\.)+\)))?/,!0),w.f=w.inline=X,c.linkHref+" url")}var Ee={startState:function(){return{f:j,prevLine:{stream:null},thisLine:{stream:null},block:j,htmlState:null,indentation:0,inline:X,text:oe,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(A){return{f:A.f,prevLine:A.prevLine,thisLine:A.thisLine,block:A.block,htmlState:A.htmlState&&o.copyState(a,A.htmlState),indentation:A.indentation,localMode:A.localMode,localState:A.localMode?o.copyState(A.localMode,A.localState):null,inline:A.inline,text:A.text,formatting:!1,linkText:A.linkText,linkTitle:A.linkTitle,linkHref:A.linkHref,code:A.code,em:A.em,strong:A.strong,strikethrough:A.strikethrough,emoji:A.emoji,header:A.header,setext:A.setext,hr:A.hr,taskList:A.taskList,list:A.list,listStack:A.listStack.slice(0),quote:A.quote,indentedCode:A.indentedCode,trailingSpace:A.trailingSpace,trailingSpaceNewLine:A.trailingSpaceNewLine,md_inside:A.md_inside,fencedEndRE:A.fencedEndRE}},token:function(A,w){if(w.formatting=!1,A!=w.thisLine.stream){if(w.header=0,w.hr=!1,A.match(/^\s*$/,!0))return W(w),null;if(w.prevLine=w.thisLine,w.thisLine={stream:A},w.taskList=!1,w.trailingSpace=0,w.trailingSpaceNewLine=!1,!w.localState&&(w.f=w.block,w.f!=K)){var ee=A.match(/^\s*/,!0)[0].replace(/\t/g,N).length;if(w.indentation=ee,w.indentationDiff=null,ee>0)return null}}return w.f(A,w)},innerMode:function(A){return A.block==K?{state:A.htmlState,mode:a}:A.localState?{state:A.localState,mode:A.localMode}:{state:A,mode:Ee}},indent:function(A,w,ee){return A.block==K&&a.indent?a.indent(A.htmlState,w,ee):A.localState&&A.localMode.indent?A.localMode.indent(A.localState,w,ee):o.Pass},blankLine:W,getType:U,blockCommentStart:"",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return Ee},"xml"),o.defineMIME("text/markdown","markdown"),o.defineMIME("text/x-markdown","markdown")})});var sl=at((pf,gf)=>{(function(o){typeof pf=="object"&&typeof gf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.overlayMode=function(l,s,a){return{startState:function(){return{base:o.startState(l),overlay:o.startState(s),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(f){return{base:o.copyState(l,f.base),overlay:o.copyState(s,f.overlay),basePos:f.basePos,baseCur:null,overlayPos:f.overlayPos,overlayCur:null}},token:function(f,h){return(f!=h.streamSeen||Math.min(h.basePos,h.overlayPos){(function(o){typeof mf=="object"&&typeof vf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){o.defineOption("placeholder","",function(d,v,y){var x=y&&y!=o.Init;if(v&&!x)d.on("blur",f),d.on("change",h),d.on("swapDoc",h),o.on(d.getInputField(),"compositionupdate",d.state.placeholderCompose=function(){a(d)}),h(d);else if(!v&&x){d.off("blur",f),d.off("change",h),d.off("swapDoc",h),o.off(d.getInputField(),"compositionupdate",d.state.placeholderCompose),l(d);var D=d.getWrapperElement();D.className=D.className.replace(" CodeMirror-empty","")}v&&!d.hasFocus()&&f(d)});function l(d){d.state.placeholder&&(d.state.placeholder.parentNode.removeChild(d.state.placeholder),d.state.placeholder=null)}function s(d){l(d);var v=d.state.placeholder=document.createElement("pre");v.style.cssText="height: 0; overflow: visible",v.style.direction=d.getOption("direction"),v.className="CodeMirror-placeholder CodeMirror-line-like";var y=d.getOption("placeholder");typeof y=="string"&&(y=document.createTextNode(y)),v.appendChild(y),d.display.lineSpace.insertBefore(v,d.display.lineSpace.firstChild)}function a(d){setTimeout(function(){var v=!1;if(d.lineCount()==1){var y=d.getInputField();v=y.nodeName=="TEXTAREA"?!d.getLine(0).length:!/[^\u200b]/.test(y.querySelector(".CodeMirror-line").textContent)}v?s(d):l(d)},20)}function f(d){c(d)&&s(d)}function h(d){var v=d.getWrapperElement(),y=c(d);v.className=v.className.replace(" CodeMirror-empty","")+(y?" CodeMirror-empty":""),y?s(d):l(d)}function c(d){return d.lineCount()===1&&d.getLine(0)===""}})});var wf=at((yf,xf)=>{(function(o){typeof yf=="object"&&typeof xf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("autoRefresh",!1,function(a,f){a.state.autoRefresh&&(s(a,a.state.autoRefresh),a.state.autoRefresh=null),f&&a.display.wrapper.offsetHeight==0&&l(a,a.state.autoRefresh={delay:f.delay||250})});function l(a,f){function h(){a.display.wrapper.offsetHeight?(s(a,f),a.display.lastWrapHeight!=a.display.wrapper.clientHeight&&a.refresh()):f.timeout=setTimeout(h,f.delay)}f.timeout=setTimeout(h,f.delay),f.hurry=function(){clearTimeout(f.timeout),f.timeout=setTimeout(h,50)},o.on(window,"mouseup",f.hurry),o.on(window,"keyup",f.hurry)}function s(a,f){clearTimeout(f.timeout),o.off(window,"mouseup",f.hurry),o.off(window,"keyup",f.hurry)}})});var kf=at((Cf,Df)=>{(function(o){typeof Cf=="object"&&typeof Df=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("styleSelectedText",!1,function(x,D,S){var F=S&&S!=o.Init;D&&!F?(x.state.markedSelection=[],x.state.markedSelectionStyle=typeof D=="string"?D:"CodeMirror-selectedtext",v(x),x.on("cursorActivity",l),x.on("change",s)):!D&&F&&(x.off("cursorActivity",l),x.off("change",s),d(x),x.state.markedSelection=x.state.markedSelectionStyle=null)});function l(x){x.state.markedSelection&&x.operation(function(){y(x)})}function s(x){x.state.markedSelection&&x.state.markedSelection.length&&x.operation(function(){d(x)})}var a=8,f=o.Pos,h=o.cmpPos;function c(x,D,S,F){if(h(D,S)!=0)for(var B=x.state.markedSelection,L=x.state.markedSelectionStyle,T=D.line;;){var N=T==D.line?D:f(T,0),z=T+a,O=z>=S.line,I=O?S:f(z,0),W=x.markText(N,I,{className:L});if(F==null?B.push(W):B.splice(F++,0,W),O)break;T=z}}function d(x){for(var D=x.state.markedSelection,S=0;S1)return v(x);var D=x.getCursor("start"),S=x.getCursor("end"),F=x.state.markedSelection;if(!F.length)return c(x,D,S);var B=F[0].find(),L=F[F.length-1].find();if(!B||!L||S.line-D.line<=a||h(D,L.to)>=0||h(S,B.from)<=0)return v(x);for(;h(D,B.from)>0;)F.shift().clear(),B=F[0].find();for(h(D,B.from)<0&&(B.to.line-D.line0&&(S.line-L.from.line{(function(o){typeof Sf=="object"&&typeof Ef=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l=o.Pos;function s(T){var N=T.flags;return N??(T.ignoreCase?"i":"")+(T.global?"g":"")+(T.multiline?"m":"")}function a(T,N){for(var z=s(T),O=z,I=0;Ij);K++){var de=T.getLine(W++);O=O==null?de:O+` -`+de}I=I*2,N.lastIndex=z.ch;var U=N.exec(O);if(U){var oe=O.slice(0,U.index).split(` -`),X=U[0].split(` -`),G=z.line+oe.length-1,k=oe[oe.length-1].length;return{from:l(G,k),to:l(G+X.length-1,X.length==1?k+X[0].length:X[X.length-1].length),match:U}}}}function d(T,N,z){for(var O,I=0;I<=T.length;){N.lastIndex=I;var W=N.exec(T);if(!W)break;var j=W.index+W[0].length;if(j>T.length-z)break;(!O||j>O.index+O[0].length)&&(O=W),I=W.index+1}return O}function v(T,N,z){N=a(N,"g");for(var O=z.line,I=z.ch,W=T.firstLine();O>=W;O--,I=-1){var j=T.getLine(O),K=d(j,N,I<0?0:j.length-I);if(K)return{from:l(O,K.index),to:l(O,K.index+K[0].length),match:K}}}function y(T,N,z){if(!f(N))return v(T,N,z);N=a(N,"gm");for(var O,I=1,W=T.getLine(z.line).length-z.ch,j=z.line,K=T.firstLine();j>=K;){for(var de=0;de=K;de++){var U=T.getLine(j--);O=O==null?U:U+` -`+O}I*=2;var oe=d(O,N,W);if(oe){var X=O.slice(0,oe.index).split(` + outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var E;v&&(E=n.ownerDocument.defaultView.scrollY),r.input.focus(),v&&n.ownerDocument.defaultView.scrollTo(null,E),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=M,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function _(){if(n.selectionStart!=null){var R=i.somethingSelected(),Z="\u200B"+(R?n.value:"");n.value="\u21DA",n.value=Z,t.prevInput=R?"":"\u200B",n.selectionStart=1,n.selectionEnd=Z.length,r.selForContextMenu=i.doc.sel}}function M(){if(t.contextMenuPending==M&&(t.contextMenuPending=!1,t.wrapper.style.cssText=b,n.style.cssText=m,c&&d<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=p),n.selectionStart!=null)){(!c||c&&d<9)&&_();var R=0,Z=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?tt(i,gu)(i):R++<10?r.detectingSelectAll=setTimeout(Z,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Z,200)}}if(c&&d>=9&&_(),de){_i(e);var P=function(){Mt(window,"mouseup",P),setTimeout(M,20)};ue(window,"mouseup",P)}else setTimeout(M,50)},We.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},We.prototype.setUneditable=function(){},We.prototype.needsContentAttribute=!1;function Yh(e,t){if(t=t?Lt(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var i=he(Ce(e));t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=g.getValue()}var n;if(e.form&&(ue(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var u=e.form;n=u.submit;try{var p=u.submit=function(){r(),u.submit=n,u.submit(),u.submit=p}}catch{}}t.finishInit=function(m){m.save=r,m.getTextArea=function(){return e},m.toTextArea=function(){m.toTextArea=isNaN,r(),e.parentNode.removeChild(m.getWrapperElement()),e.style.display="",e.form&&(Mt(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var g=Ne(function(m){return e.parentNode.insertBefore(m,e.nextSibling)},t);return g}function Zh(e){e.off=Mt,e.on=ue,e.wheelEventPixels=rh,e.Doc=xt,e.splitLines=ra,e.countColumn=Ye,e.findColumn=Kt,e.isWordChar=Zo,e.Pass=Ze,e.signal=je,e.Line=ei,e.changeEnd=xr,e.scrollbarModel=Gs,e.Pos=Y,e.cmpPos=ve,e.modes=na,e.mimeModes=Vr,e.resolveMode=Sn,e.getMode=oa,e.modeExtensions=$r,e.extendMode=Jc,e.copyState=Lr,e.startState=Jl,e.innerMode=aa,e.commands=nn,e.keyMap=ar,e.keyName=Mu,e.isModifierKey=Tu,e.lookupKey=hi,e.normalizeKeyMap=kh,e.StringStream=Ge,e.SharedTextMarker=en,e.TextMarker=Cr,e.LineWidget=$i,e.e_preventDefault=bt,e.e_stopPropagation=Zl,e.e_stop=_i,e.addClass=pe,e.contains=Q,e.rmClass=oe,e.keyNames=Dr}qh(Ne),jh(Ne);var Qh="iter insert remove copy getEditor constructor".split(" ");for(var io in xt.prototype)xt.prototype.hasOwnProperty(io)&&ze(Qh,io)<0&&(Ne.prototype[io]=function(e){return function(){return e.apply(this.doc,arguments)}}(xt.prototype[io]));return Jr(xt),Ne.inputStyles={textarea:We,contenteditable:Te},Ne.defineMode=function(e){!Ne.defaults.mode&&e!="null"&&(Ne.defaults.mode=e),Zc.apply(this,arguments)},Ne.defineMIME=Qc,Ne.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Ne.defineMIME("text/plain","null"),Ne.defineExtension=function(e,t){Ne.prototype[e]=t},Ne.defineDocExtension=function(e,t){xt.prototype[e]=t},Ne.fromTextArea=Yh,Zh(Ne),Ne.version="5.65.21",Ne})});var ef=at((Vu,$u)=>{(function(o){typeof Vu=="object"&&typeof $u=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,s=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,a=/[*+-]\s/;o.commands.newlineAndIndentContinueMarkdownList=function(h){if(h.getOption("disableInput"))return o.Pass;for(var c=h.listSelections(),d=[],v=0;v\s*$/.test(B),z=!/>\s*$/.test(B);(N||z)&&h.replaceRange("",{line:y.line,ch:0},{line:y.line,ch:y.ch+1}),d[v]=` +`}else{var O=L[1],I=L[5],U=!(a.test(L[2])||L[2].indexOf(">")>=0),j=U?parseInt(L[3],10)+1+L[4]:L[2].replace("x"," ");d[v]=` +`+O+j+I,U&&f(h,y)}}h.replaceSelections(d)};function f(h,c){var d=c.line,v=0,y=0,x=l.exec(h.getLine(d)),D=x[1];do{v+=1;var S=d+v,F=h.getLine(S),B=l.exec(F);if(B){var L=B[1],T=parseInt(x[3],10)+v-y,N=parseInt(B[3],10),z=N;if(D===L&&!isNaN(N))T===N&&(z=N+1),T>N&&(z=T+1),h.replaceRange(F.replace(l,L+z+B[4]+B[5]),{line:S,ch:0},{line:S,ch:F.length});else{if(D.length>L.length||D.length{var tf=At();tf.commands.tabAndIndentMarkdownList=function(o){var l=o.listSelections(),s=l[0].head,a=o.getStateAfter(s.line),f=a.list!==!1;if(f){o.execCommand("indentMore");return}if(o.options.indentWithTabs)o.execCommand("insertTab");else{var h=Array(o.options.tabSize+1).join(" ");o.replaceSelection(h)}};tf.commands.shiftTabAndUnindentMarkdownList=function(o){var l=o.listSelections(),s=l[0].head,a=o.getStateAfter(s.line),f=a.list!==!1;if(f){o.execCommand("indentLess");return}if(o.options.indentWithTabs)o.execCommand("insertTab");else{var h=Array(o.options.tabSize+1).join(" ");o.replaceSelection(h)}}});var af=at((nf,of)=>{(function(o){typeof nf=="object"&&typeof of=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("fullScreen",!1,function(a,f,h){h==o.Init&&(h=!1),!h!=!f&&(f?l(a):s(a))});function l(a){var f=a.getWrapperElement();a.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:f.style.width,height:f.style.height},f.style.width="",f.style.height="auto",f.className+=" CodeMirror-fullscreen",document.documentElement.style.overflow="hidden",a.refresh()}function s(a){var f=a.getWrapperElement();f.className=f.className.replace(/\s*CodeMirror-fullscreen\b/,""),document.documentElement.style.overflow="";var h=a.state.fullScreenRestore;f.style.width=h.width,f.style.height=h.height,window.scrollTo(h.scrollLeft,h.scrollTop),a.refresh()}})});var al=at((lf,sf)=>{(function(o){typeof lf=="object"&&typeof sf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},s={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};o.defineMode("xml",function(a,f){var h=a.indentUnit,c={},d=f.htmlMode?l:s;for(var v in d)c[v]=d[v];for(var v in f)c[v]=f[v];var y,x;function D(k,H){function q(pe){return H.tokenize=pe,pe(k,H)}var Q=k.next();if(Q=="<")return k.eat("!")?k.eat("[")?k.match("CDATA[")?q(B("atom","]]>")):null:k.match("--")?q(B("comment","-->")):k.match("DOCTYPE",!0,!0)?(k.eatWhile(/[\w\._\-]/),q(L(1))):null:k.eat("?")?(k.eatWhile(/[\w\._\-]/),H.tokenize=B("meta","?>"),"meta"):(y=k.eat("/")?"closeTag":"openTag",H.tokenize=S,"tag bracket");if(Q=="&"){var he;return k.eat("#")?k.eat("x")?he=k.eatWhile(/[a-fA-F\d]/)&&k.eat(";"):he=k.eatWhile(/[\d]/)&&k.eat(";"):he=k.eatWhile(/[\w\.\-:]/)&&k.eat(";"),he?"atom":"error"}else return k.eatWhile(/[^&<]/),null}D.isInText=!0;function S(k,H){var q=k.next();if(q==">"||q=="/"&&k.eat(">"))return H.tokenize=D,y=q==">"?"endTag":"selfcloseTag","tag bracket";if(q=="=")return y="equals",null;if(q=="<"){H.tokenize=D,H.state=I,H.tagName=H.tagStart=null;var Q=H.tokenize(k,H);return Q?Q+" tag error":"tag error"}else return/[\'\"]/.test(q)?(H.tokenize=F(q),H.stringStartCol=k.column(),H.tokenize(k,H)):(k.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function F(k){var H=function(q,Q){for(;!q.eol();)if(q.next()==k){Q.tokenize=S;break}return"string"};return H.isInAttribute=!0,H}function B(k,H){return function(q,Q){for(;!q.eol();){if(q.match(H)){Q.tokenize=D;break}q.next()}return k}}function L(k){return function(H,q){for(var Q;(Q=H.next())!=null;){if(Q=="<")return q.tokenize=L(k+1),q.tokenize(H,q);if(Q==">")if(k==1){q.tokenize=D;break}else return q.tokenize=L(k-1),q.tokenize(H,q)}return"meta"}}function T(k){return k&&k.toLowerCase()}function N(k,H,q){this.prev=k.context,this.tagName=H||"",this.indent=k.indented,this.startOfLine=q,(c.doNotIndent.hasOwnProperty(H)||k.context&&k.context.noIndent)&&(this.noIndent=!0)}function z(k){k.context&&(k.context=k.context.prev)}function O(k,H){for(var q;;){if(!k.context||(q=k.context.tagName,!c.contextGrabbers.hasOwnProperty(T(q))||!c.contextGrabbers[T(q)].hasOwnProperty(T(H))))return;z(k)}}function I(k,H,q){return k=="openTag"?(q.tagStart=H.column(),U):k=="closeTag"?j:I}function U(k,H,q){return k=="word"?(q.tagName=H.current(),x="tag",W):c.allowMissingTagName&&k=="endTag"?(x="tag bracket",W(k,H,q)):(x="error",U)}function j(k,H,q){if(k=="word"){var Q=H.current();return q.context&&q.context.tagName!=Q&&c.implicitlyClosed.hasOwnProperty(T(q.context.tagName))&&z(q),q.context&&q.context.tagName==Q||c.matchClosing===!1?(x="tag",K):(x="tag error",de)}else return c.allowMissingTagName&&k=="endTag"?(x="tag bracket",K(k,H,q)):(x="error",de)}function K(k,H,q){return k!="endTag"?(x="error",K):(z(q),I)}function de(k,H,q){return x="error",K(k,H,q)}function W(k,H,q){if(k=="word")return x="attribute",oe;if(k=="endTag"||k=="selfcloseTag"){var Q=q.tagName,he=q.tagStart;return q.tagName=q.tagStart=null,k=="selfcloseTag"||c.autoSelfClosers.hasOwnProperty(T(Q))?O(q,Q):(O(q,Q),q.context=new N(q,Q,he==q.indented)),I}return x="error",W}function oe(k,H,q){return k=="equals"?X:(c.allowMissing||(x="error"),W(k,H,q))}function X(k,H,q){return k=="string"?G:k=="word"&&c.allowUnquoted?(x="string",W):(x="error",W(k,H,q))}function G(k,H,q){return k=="string"?G:W(k,H,q)}return{startState:function(k){var H={tokenize:D,state:I,indented:k||0,tagName:null,tagStart:null,context:null};return k!=null&&(H.baseIndent=k),H},token:function(k,H){if(!H.tagName&&k.sol()&&(H.indented=k.indentation()),k.eatSpace())return null;y=null;var q=H.tokenize(k,H);return(q||y)&&q!="comment"&&(x=null,H.state=H.state(y||q,k,H),x&&(q=x=="error"?q+" error":x)),q},indent:function(k,H,q){var Q=k.context;if(k.tokenize.isInAttribute)return k.tagStart==k.indented?k.stringStartCol+1:k.indented+h;if(Q&&Q.noIndent)return o.Pass;if(k.tokenize!=S&&k.tokenize!=D)return q?q.match(/^(\s*)/)[0].length:0;if(k.tagName)return c.multilineTagIndentPastTag!==!1?k.tagStart+k.tagName.length+2:k.tagStart+h*(c.multilineTagIndentFactor||1);if(c.alignCDATA&&/$/,blockCommentStart:"",configuration:c.htmlMode?"html":"xml",helperType:c.htmlMode?"html":"xml",skipAttribute:function(k){k.state==X&&(k.state=W)},xmlCurrentTag:function(k){return k.tagName?{name:k.tagName,close:k.type=="closeTag"}:null},xmlCurrentContext:function(k){for(var H=[],q=k.context;q;q=q.prev)H.push(q.tagName);return H.reverse()}}}),o.defineMIME("text/xml","xml"),o.defineMIME("application/xml","xml"),o.mimeModes.hasOwnProperty("text/html")||o.defineMIME("text/html",{name:"xml",htmlMode:!0})})});var cf=at((uf,ff)=>{(function(o){typeof uf=="object"&&typeof ff=="object"?o(At()):typeof define=="function"&&define.amd?define(["../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy","cbl"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded JavaScript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"],alias:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var l=0;l-1&&a.substring(c+1,a.length);if(d)return o.findModeByExtension(d)},o.findModeByName=function(a){a=a.toLowerCase();for(var f=0;f{(function(o){typeof df=="object"&&typeof hf=="object"?o(At(),al(),cf()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../xml/xml","../meta"],o):o(CodeMirror)})(function(o){"use strict";o.defineMode("markdown",function(l,s){var a=o.getMode(l,"text/html"),f=a.name=="null";function h(A){if(o.findModeByName){var w=o.findModeByName(A);w&&(A=w.mime||w.mimes[0])}var ee=o.getMode(l,A);return ee.name=="null"?null:ee}s.highlightFormatting===void 0&&(s.highlightFormatting=!1),s.maxBlockquoteDepth===void 0&&(s.maxBlockquoteDepth=0),s.taskLists===void 0&&(s.taskLists=!1),s.strikethrough===void 0&&(s.strikethrough=!1),s.emoji===void 0&&(s.emoji=!1),s.fencedCodeBlockHighlighting===void 0&&(s.fencedCodeBlockHighlighting=!0),s.fencedCodeBlockDefaultMode===void 0&&(s.fencedCodeBlockDefaultMode="text/plain"),s.xml===void 0&&(s.xml=!0),s.tokenTypeOverrides===void 0&&(s.tokenTypeOverrides={});var c={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var d in c)c.hasOwnProperty(d)&&s.tokenTypeOverrides[d]&&(c[d]=s.tokenTypeOverrides[d]);var v=/^([*\-_])(?:\s*\1){2,}\s*$/,y=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,x=/^\[(x| )\](?=\s)/i,D=s.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,S=/^ {0,3}(?:\={1,}|-{2,})\s*$/,F=/^[^#!\[\]*_\\<>` "'(~:]+/,B=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,L=/^\s*\[[^\]]+?\]:.*$/,T=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,N=" ";function z(A,w,ee){return w.f=w.inline=ee,ee(A,w)}function O(A,w,ee){return w.f=w.block=ee,ee(A,w)}function I(A){return!A||!/\S/.test(A.string)}function U(A){if(A.linkTitle=!1,A.linkHref=!1,A.linkText=!1,A.em=!1,A.strong=!1,A.strikethrough=!1,A.quote=0,A.indentedCode=!1,A.f==K){var w=f;if(!w){var ee=o.innerMode(a,A.htmlState);w=ee.mode.name=="xml"&&ee.state.tagStart===null&&!ee.state.context&&ee.state.tokenize.isInText}w&&(A.f=X,A.block=j,A.htmlState=null)}return A.trailingSpace=0,A.trailingSpaceNewLine=!1,A.prevLine=A.thisLine,A.thisLine={stream:null},null}function j(A,w){var ee=A.column()===w.indentation,Ce=I(w.prevLine.stream),ye=w.indentedCode,lt=w.prevLine.hr,Lt=w.list!==!1,Ye=(w.listStack[w.listStack.length-1]||0)+3;w.indentedCode=!1;var dt=w.indentation;if(w.indentationDiff===null&&(w.indentationDiff=w.indentation,Lt)){for(w.list=null;dt=4&&(ye||w.prevLine.fencedCodeEnd||w.prevLine.header||Ce))return A.skipToEnd(),w.indentedCode=!0,c.code;if(A.eatSpace())return null;if(ee&&w.indentation<=Ye&&(Ze=A.match(D))&&Ze[1].length<=6)return w.quote=0,w.header=Ze[1].length,w.thisLine.header=!0,s.highlightFormatting&&(w.formatting="header"),w.f=w.inline,W(w);if(w.indentation<=Ye&&A.eat(">"))return w.quote=ee?1:w.quote+1,s.highlightFormatting&&(w.formatting="quote"),A.eatSpace(),W(w);if(!Pe&&!w.setext&&ee&&w.indentation<=Ye&&(Ze=A.match(y))){var vt=Ze[1]?"ol":"ul";return w.indentation=dt+A.current().length,w.list=!0,w.quote=0,w.listStack.push(w.indentation),w.em=!1,w.strong=!1,w.code=!1,w.strikethrough=!1,s.taskLists&&A.match(x,!1)&&(w.taskList=!0),w.f=w.inline,s.highlightFormatting&&(w.formatting=["list","list-"+vt]),W(w)}else{if(ee&&w.indentation<=Ye&&(Ze=A.match(B,!0)))return w.quote=0,w.fencedEndRE=new RegExp(Ze[1]+"+ *$"),w.localMode=s.fencedCodeBlockHighlighting&&h(Ze[2]||s.fencedCodeBlockDefaultMode),w.localMode&&(w.localState=o.startState(w.localMode)),w.f=w.block=de,s.highlightFormatting&&(w.formatting="code-block"),w.code=-1,W(w);if(w.setext||(!ze||!Lt)&&!w.quote&&w.list===!1&&!w.code&&!Pe&&!L.test(A.string)&&(Ze=A.lookAhead(1))&&(Ze=Ze.match(S)))return w.setext?(w.header=w.setext,w.setext=0,A.skipToEnd(),s.highlightFormatting&&(w.formatting="header")):(w.header=Ze[0].charAt(0)=="="?1:2,w.setext=w.header),w.thisLine.header=!0,w.f=w.inline,W(w);if(Pe)return A.skipToEnd(),w.hr=!0,w.thisLine.hr=!0,c.hr;if(A.peek()==="[")return z(A,w,Q)}return z(A,w,w.inline)}function K(A,w){var ee=a.token(A,w.htmlState);if(!f){var Ce=o.innerMode(a,w.htmlState);(Ce.mode.name=="xml"&&Ce.state.tagStart===null&&!Ce.state.context&&Ce.state.tokenize.isInText||w.md_inside&&A.current().indexOf(">")>-1)&&(w.f=X,w.block=j,w.htmlState=null)}return ee}function de(A,w){var ee=w.listStack[w.listStack.length-1]||0,Ce=w.indentation=A.quote?w.push(c.formatting+"-"+A.formatting[ee]+"-"+A.quote):w.push("error"))}if(A.taskOpen)return w.push("meta"),w.length?w.join(" "):null;if(A.taskClosed)return w.push("property"),w.length?w.join(" "):null;if(A.linkHref?w.push(c.linkHref,"url"):(A.strong&&w.push(c.strong),A.em&&w.push(c.em),A.strikethrough&&w.push(c.strikethrough),A.emoji&&w.push(c.emoji),A.linkText&&w.push(c.linkText),A.code&&w.push(c.code),A.image&&w.push(c.image),A.imageAltText&&w.push(c.imageAltText,"link"),A.imageMarker&&w.push(c.imageMarker)),A.header&&w.push(c.header,c.header+"-"+A.header),A.quote&&(w.push(c.quote),!s.maxBlockquoteDepth||s.maxBlockquoteDepth>=A.quote?w.push(c.quote+"-"+A.quote):w.push(c.quote+"-"+s.maxBlockquoteDepth)),A.list!==!1){var Ce=(A.listStack.length-1)%3;Ce?Ce===1?w.push(c.list2):w.push(c.list3):w.push(c.list1)}return A.trailingSpaceNewLine?w.push("trailing-space-new-line"):A.trailingSpace&&w.push("trailing-space-"+(A.trailingSpace%2?"a":"b")),w.length?w.join(" "):null}function oe(A,w){if(A.match(F,!0))return W(w)}function X(A,w){var ee=w.text(A,w);if(typeof ee<"u")return ee;if(w.list)return w.list=null,W(w);if(w.taskList){var Ce=A.match(x,!0)[1]===" ";return Ce?w.taskOpen=!0:w.taskClosed=!0,s.highlightFormatting&&(w.formatting="task"),w.taskList=!1,W(w)}if(w.taskOpen=!1,w.taskClosed=!1,w.header&&A.match(/^#+$/,!0))return s.highlightFormatting&&(w.formatting="header"),W(w);var ye=A.next();if(w.linkTitle){w.linkTitle=!1;var lt=ye;ye==="("&&(lt=")"),lt=(lt+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Lt="^\\s*(?:[^"+lt+"\\\\]+|\\\\\\\\|\\\\.)"+lt;if(A.match(new RegExp(Lt),!0))return c.linkHref}if(ye==="`"){var Ye=w.formatting;s.highlightFormatting&&(w.formatting="code"),A.eatWhile("`");var dt=A.current().length;if(w.code==0&&(!w.quote||dt==1))return w.code=dt,W(w);if(dt==w.code){var ze=W(w);return w.code=0,ze}else return w.formatting=Ye,W(w)}else if(w.code)return W(w);if(ye==="\\"&&(A.next(),s.highlightFormatting)){var Pe=W(w),Ze=c.formatting+"-escape";return Pe?Pe+" "+Ze:Ze}if(ye==="!"&&A.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return w.imageMarker=!0,w.image=!0,s.highlightFormatting&&(w.formatting="image"),W(w);if(ye==="["&&w.imageMarker&&A.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return w.imageMarker=!1,w.imageAltText=!0,s.highlightFormatting&&(w.formatting="image"),W(w);if(ye==="]"&&w.imageAltText){s.highlightFormatting&&(w.formatting="image");var Pe=W(w);return w.imageAltText=!1,w.image=!1,w.inline=w.f=k,Pe}if(ye==="["&&!w.image)return w.linkText&&A.match(/^.*?\]/)||(w.linkText=!0,s.highlightFormatting&&(w.formatting="link")),W(w);if(ye==="]"&&w.linkText){s.highlightFormatting&&(w.formatting="link");var Pe=W(w);return w.linkText=!1,w.inline=w.f=A.match(/\(.*?\)| ?\[.*?\]/,!1)?k:X,Pe}if(ye==="<"&&A.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){w.f=w.inline=G,s.highlightFormatting&&(w.formatting="link");var Pe=W(w);return Pe?Pe+=" ":Pe="",Pe+c.linkInline}if(ye==="<"&&A.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){w.f=w.inline=G,s.highlightFormatting&&(w.formatting="link");var Pe=W(w);return Pe?Pe+=" ":Pe="",Pe+c.linkEmail}if(s.xml&&ye==="<"&&A.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var vt=A.string.indexOf(">",A.pos);if(vt!=-1){var Ti=A.string.substring(A.start,vt);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Ti)&&(w.md_inside=!0)}return A.backUp(1),w.htmlState=o.startState(a),O(A,w,K)}if(s.xml&&ye==="<"&&A.match(/^\/\w*?>/))return w.md_inside=!1,"tag";if(ye==="*"||ye==="_"){for(var Xt=1,Kt=A.pos==1?" ":A.string.charAt(A.pos-2);Xt<3&&A.eat(ye);)Xt++;var Ht=A.peek()||" ",pr=!/\s/.test(Ht)&&(!T.test(Ht)||/\s/.test(Kt)||T.test(Kt)),De=!/\s/.test(Kt)&&(!T.test(Kt)||/\s/.test(Ht)||T.test(Ht)),Pt=null,gr=null;if(Xt%2&&(!w.em&&pr&&(ye==="*"||!De||T.test(Kt))?Pt=!0:w.em==ye&&De&&(ye==="*"||!pr||T.test(Ht))&&(Pt=!1)),Xt>1&&(!w.strong&&pr&&(ye==="*"||!De||T.test(Kt))?gr=!0:w.strong==ye&&De&&(ye==="*"||!pr||T.test(Ht))&&(gr=!1)),gr!=null||Pt!=null){s.highlightFormatting&&(w.formatting=Pt==null?"strong":gr==null?"em":"strong em"),Pt===!0&&(w.em=ye),gr===!0&&(w.strong=ye);var ze=W(w);return Pt===!1&&(w.em=!1),gr===!1&&(w.strong=!1),ze}}else if(ye===" "&&(A.eat("*")||A.eat("_"))){if(A.peek()===" ")return W(w);A.backUp(1)}if(s.strikethrough){if(ye==="~"&&A.eatWhile(ye)){if(w.strikethrough){s.highlightFormatting&&(w.formatting="strikethrough");var ze=W(w);return w.strikethrough=!1,ze}else if(A.match(/^[^\s]/,!1))return w.strikethrough=!0,s.highlightFormatting&&(w.formatting="strikethrough"),W(w)}else if(ye===" "&&A.match("~~",!0)){if(A.peek()===" ")return W(w);A.backUp(2)}}if(s.emoji&&ye===":"&&A.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){w.emoji=!0,s.highlightFormatting&&(w.formatting="emoji");var Dn=W(w);return w.emoji=!1,Dn}return ye===" "&&(A.match(/^ +$/,!1)?w.trailingSpace++:w.trailingSpace&&(w.trailingSpaceNewLine=!0)),W(w)}function G(A,w){var ee=A.next();if(ee===">"){w.f=w.inline=X,s.highlightFormatting&&(w.formatting="link");var Ce=W(w);return Ce?Ce+=" ":Ce="",Ce+c.linkInline}return A.match(/^[^>]+/,!0),c.linkInline}function k(A,w){if(A.eatSpace())return null;var ee=A.next();return ee==="("||ee==="["?(w.f=w.inline=q(ee==="("?")":"]"),s.highlightFormatting&&(w.formatting="link-string"),w.linkHref=!0,W(w)):"error"}var H={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function q(A){return function(w,ee){var Ce=w.next();if(Ce===A){ee.f=ee.inline=X,s.highlightFormatting&&(ee.formatting="link-string");var ye=W(ee);return ee.linkHref=!1,ye}return w.match(H[A]),ee.linkHref=!0,W(ee)}}function Q(A,w){return A.match(/^([^\]\\]|\\.)*\]:/,!1)?(w.f=he,A.next(),s.highlightFormatting&&(w.formatting="link"),w.linkText=!0,W(w)):z(A,w,X)}function he(A,w){if(A.match("]:",!0)){w.f=w.inline=pe,s.highlightFormatting&&(w.formatting="link");var ee=W(w);return w.linkText=!1,ee}return A.match(/^([^\]\\]|\\.)+/,!0),c.linkText}function pe(A,w){return A.eatSpace()?null:(A.match(/^[^\s]+/,!0),A.peek()===void 0?w.linkTitle=!0:A.match(/^(?:\s+(?:"(?:[^"\\]|\\.)+"|'(?:[^'\\]|\\.)+'|\((?:[^)\\]|\\.)+\)))?/,!0),w.f=w.inline=X,c.linkHref+" url")}var Ee={startState:function(){return{f:j,prevLine:{stream:null},thisLine:{stream:null},block:j,htmlState:null,indentation:0,inline:X,text:oe,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(A){return{f:A.f,prevLine:A.prevLine,thisLine:A.thisLine,block:A.block,htmlState:A.htmlState&&o.copyState(a,A.htmlState),indentation:A.indentation,localMode:A.localMode,localState:A.localMode?o.copyState(A.localMode,A.localState):null,inline:A.inline,text:A.text,formatting:!1,linkText:A.linkText,linkTitle:A.linkTitle,linkHref:A.linkHref,code:A.code,em:A.em,strong:A.strong,strikethrough:A.strikethrough,emoji:A.emoji,header:A.header,setext:A.setext,hr:A.hr,taskList:A.taskList,list:A.list,listStack:A.listStack.slice(0),quote:A.quote,indentedCode:A.indentedCode,trailingSpace:A.trailingSpace,trailingSpaceNewLine:A.trailingSpaceNewLine,md_inside:A.md_inside,fencedEndRE:A.fencedEndRE}},token:function(A,w){if(w.formatting=!1,A!=w.thisLine.stream){if(w.header=0,w.hr=!1,A.match(/^\s*$/,!0))return U(w),null;if(w.prevLine=w.thisLine,w.thisLine={stream:A},w.taskList=!1,w.trailingSpace=0,w.trailingSpaceNewLine=!1,!w.localState&&(w.f=w.block,w.f!=K)){var ee=A.match(/^\s*/,!0)[0].replace(/\t/g,N).length;if(w.indentation=ee,w.indentationDiff=null,ee>0)return null}}return w.f(A,w)},innerMode:function(A){return A.block==K?{state:A.htmlState,mode:a}:A.localState?{state:A.localState,mode:A.localMode}:{state:A,mode:Ee}},indent:function(A,w,ee){return A.block==K&&a.indent?a.indent(A.htmlState,w,ee):A.localState&&A.localMode.indent?A.localMode.indent(A.localState,w,ee):o.Pass},blankLine:U,getType:W,blockCommentStart:"",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return Ee},"xml"),o.defineMIME("text/markdown","markdown"),o.defineMIME("text/x-markdown","markdown")})});var sl=at((pf,gf)=>{(function(o){typeof pf=="object"&&typeof gf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.overlayMode=function(l,s,a){return{startState:function(){return{base:o.startState(l),overlay:o.startState(s),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(f){return{base:o.copyState(l,f.base),overlay:o.copyState(s,f.overlay),basePos:f.basePos,baseCur:null,overlayPos:f.overlayPos,overlayCur:null}},token:function(f,h){return(f!=h.streamSeen||Math.min(h.basePos,h.overlayPos){(function(o){typeof mf=="object"&&typeof vf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){o.defineOption("placeholder","",function(d,v,y){var x=y&&y!=o.Init;if(v&&!x)d.on("blur",f),d.on("change",h),d.on("swapDoc",h),o.on(d.getInputField(),"compositionupdate",d.state.placeholderCompose=function(){a(d)}),h(d);else if(!v&&x){d.off("blur",f),d.off("change",h),d.off("swapDoc",h),o.off(d.getInputField(),"compositionupdate",d.state.placeholderCompose),l(d);var D=d.getWrapperElement();D.className=D.className.replace(" CodeMirror-empty","")}v&&!d.hasFocus()&&f(d)});function l(d){d.state.placeholder&&(d.state.placeholder.parentNode.removeChild(d.state.placeholder),d.state.placeholder=null)}function s(d){l(d);var v=d.state.placeholder=document.createElement("pre");v.style.cssText="height: 0; overflow: visible",v.style.direction=d.getOption("direction"),v.className="CodeMirror-placeholder CodeMirror-line-like";var y=d.getOption("placeholder");typeof y=="string"&&(y=document.createTextNode(y)),v.appendChild(y),d.display.lineSpace.insertBefore(v,d.display.lineSpace.firstChild)}function a(d){setTimeout(function(){var v=!1;if(d.lineCount()==1){var y=d.getInputField();v=y.nodeName=="TEXTAREA"?!d.getLine(0).length:!/[^\u200b]/.test(y.querySelector(".CodeMirror-line").textContent)}v?s(d):l(d)},20)}function f(d){c(d)&&s(d)}function h(d){var v=d.getWrapperElement(),y=c(d);v.className=v.className.replace(" CodeMirror-empty","")+(y?" CodeMirror-empty":""),y?s(d):l(d)}function c(d){return d.lineCount()===1&&d.getLine(0)===""}})});var wf=at((yf,xf)=>{(function(o){typeof yf=="object"&&typeof xf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("autoRefresh",!1,function(a,f){a.state.autoRefresh&&(s(a,a.state.autoRefresh),a.state.autoRefresh=null),f&&a.display.wrapper.offsetHeight==0&&l(a,a.state.autoRefresh={delay:f.delay||250})});function l(a,f){function h(){a.display.wrapper.offsetHeight?(s(a,f),a.display.lastWrapHeight!=a.display.wrapper.clientHeight&&a.refresh()):f.timeout=setTimeout(h,f.delay)}f.timeout=setTimeout(h,f.delay),f.hurry=function(){clearTimeout(f.timeout),f.timeout=setTimeout(h,50)},o.on(window,"mouseup",f.hurry),o.on(window,"keyup",f.hurry)}function s(a,f){clearTimeout(f.timeout),o.off(window,"mouseup",f.hurry),o.off(window,"keyup",f.hurry)}})});var kf=at((Cf,Df)=>{(function(o){typeof Cf=="object"&&typeof Df=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("styleSelectedText",!1,function(x,D,S){var F=S&&S!=o.Init;D&&!F?(x.state.markedSelection=[],x.state.markedSelectionStyle=typeof D=="string"?D:"CodeMirror-selectedtext",v(x),x.on("cursorActivity",l),x.on("change",s)):!D&&F&&(x.off("cursorActivity",l),x.off("change",s),d(x),x.state.markedSelection=x.state.markedSelectionStyle=null)});function l(x){x.state.markedSelection&&x.operation(function(){y(x)})}function s(x){x.state.markedSelection&&x.state.markedSelection.length&&x.operation(function(){d(x)})}var a=8,f=o.Pos,h=o.cmpPos;function c(x,D,S,F){if(h(D,S)!=0)for(var B=x.state.markedSelection,L=x.state.markedSelectionStyle,T=D.line;;){var N=T==D.line?D:f(T,0),z=T+a,O=z>=S.line,I=O?S:f(z,0),U=x.markText(N,I,{className:L});if(F==null?B.push(U):B.splice(F++,0,U),O)break;T=z}}function d(x){for(var D=x.state.markedSelection,S=0;S1)return v(x);var D=x.getCursor("start"),S=x.getCursor("end"),F=x.state.markedSelection;if(!F.length)return c(x,D,S);var B=F[0].find(),L=F[F.length-1].find();if(!B||!L||S.line-D.line<=a||h(D,L.to)>=0||h(S,B.from)<=0)return v(x);for(;h(D,B.from)>0;)F.shift().clear(),B=F[0].find();for(h(D,B.from)<0&&(B.to.line-D.line0&&(S.line-L.from.line{(function(o){typeof Sf=="object"&&typeof Ef=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l=o.Pos;function s(T){var N=T.flags;return N??(T.ignoreCase?"i":"")+(T.global?"g":"")+(T.multiline?"m":"")}function a(T,N){for(var z=s(T),O=z,I=0;Ij);K++){var de=T.getLine(U++);O=O==null?de:O+` +`+de}I=I*2,N.lastIndex=z.ch;var W=N.exec(O);if(W){var oe=O.slice(0,W.index).split(` +`),X=W[0].split(` +`),G=z.line+oe.length-1,k=oe[oe.length-1].length;return{from:l(G,k),to:l(G+X.length-1,X.length==1?k+X[0].length:X[X.length-1].length),match:W}}}}function d(T,N,z){for(var O,I=0;I<=T.length;){N.lastIndex=I;var U=N.exec(T);if(!U)break;var j=U.index+U[0].length;if(j>T.length-z)break;(!O||j>O.index+O[0].length)&&(O=U),I=U.index+1}return O}function v(T,N,z){N=a(N,"g");for(var O=z.line,I=z.ch,U=T.firstLine();O>=U;O--,I=-1){var j=T.getLine(O),K=d(j,N,I<0?0:j.length-I);if(K)return{from:l(O,K.index),to:l(O,K.index+K[0].length),match:K}}}function y(T,N,z){if(!f(N))return v(T,N,z);N=a(N,"gm");for(var O,I=1,U=T.getLine(z.line).length-z.ch,j=z.line,K=T.firstLine();j>=K;){for(var de=0;de=K;de++){var W=T.getLine(j--);O=O==null?W:W+` +`+O}I*=2;var oe=d(O,N,U);if(oe){var X=O.slice(0,oe.index).split(` `),G=oe[0].split(` -`),k=j+X.length,H=X[X.length-1].length;return{from:l(k,H),to:l(k+G.length-1,G.length==1?H+G[0].length:G[G.length-1].length),match:oe}}}}var x,D;String.prototype.normalize?(x=function(T){return T.normalize("NFD").toLowerCase()},D=function(T){return T.normalize("NFD")}):(x=function(T){return T.toLowerCase()},D=function(T){return T});function S(T,N,z,O){if(T.length==N.length)return z;for(var I=0,W=z+Math.max(0,T.length-N.length);;){if(I==W)return I;var j=I+W>>1,K=O(T.slice(0,j)).length;if(K==z)return j;K>z?W=j:I=j+1}}function F(T,N,z,O){if(!N.length)return null;var I=O?x:D,W=I(N).split(/\r|\n\r?/);e:for(var j=z.line,K=z.ch,de=T.lastLine()+1-W.length;j<=de;j++,K=0){var U=T.getLine(j).slice(K),oe=I(U);if(W.length==1){var X=oe.indexOf(W[0]);if(X==-1)continue e;var z=S(U,oe,X,I)+K;return{from:l(j,S(U,oe,X,I)+K),to:l(j,S(U,oe,X+W[0].length,I)+K)}}else{var G=oe.length-W[0].length;if(oe.slice(G)!=W[0])continue e;for(var k=1;k=de;j--,K=-1){var U=T.getLine(j);K>-1&&(U=U.slice(0,K));var oe=I(U);if(W.length==1){var X=oe.lastIndexOf(W[0]);if(X==-1)continue e;return{from:l(j,S(U,oe,X,I)),to:l(j,S(U,oe,X+W[0].length,I))}}else{var G=W[W.length-1];if(oe.slice(0,G.length)!=G)continue e;for(var k=1,z=j-W.length+1;k(this.doc.getLine(N.line)||"").length&&(N.ch=0,N.line++)),o.cmpPos(N,this.doc.clipPos(N))!=0))return this.atOccurrence=!1;var z=this.matches(T,N);if(this.afterEmptyMatch=z&&o.cmpPos(z.from,z.to)==0,z)return this.pos=z,this.atOccurrence=!0,this.pos.match||!0;var O=l(T?this.doc.firstLine():this.doc.lastLine()+1,0);return this.pos={from:O,to:O},this.atOccurrence=!1},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(T,N){if(this.atOccurrence){var z=o.splitLines(T);this.doc.replaceRange(z,this.pos.from,this.pos.to,N),this.pos.to=l(this.pos.from.line+z.length-1,z[z.length-1].length+(z.length==1?this.pos.from.ch:0))}}},o.defineExtension("getSearchCursor",function(T,N,z){return new L(this.doc,T,N,z)}),o.defineDocExtension("getSearchCursor",function(T,N,z){return new L(this,T,N,z)}),o.defineExtension("selectMatches",function(T,N){for(var z=[],O=this.getSearchCursor(T,this.getCursor("from"),N);O.findNext()&&!(o.cmpPos(O.to(),this.getCursor("to"))>0);)z.push({anchor:O.from(),head:O.to()});z.length&&this.setSelections(z,0)})})});var Lf=at((Ff,Tf)=>{(function(o){typeof Ff=="object"&&typeof Tf=="object"?o(At(),ll(),sl()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../markdown/markdown","../../addon/mode/overlay"],o):o(CodeMirror)})(function(o){"use strict";var l=/^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i;o.defineMode("gfm",function(s,a){var f=0;function h(y){return y.code=!1,null}var c={startState:function(){return{code:!1,codeBlock:!1,ateSpace:!1}},copyState:function(y){return{code:y.code,codeBlock:y.codeBlock,ateSpace:y.ateSpace}},token:function(y,x){if(x.combineTokens=null,x.codeBlock)return y.match(/^```+/)?(x.codeBlock=!1,null):(y.skipToEnd(),null);if(y.sol()&&(x.code=!1),y.sol()&&y.match(/^```+/))return y.skipToEnd(),x.codeBlock=!0,null;if(y.peek()==="`"){y.next();var D=y.pos;y.eatWhile("`");var S=1+y.pos-D;return x.code?S===f&&(x.code=!1):(f=S,x.code=!0),null}else if(x.code)return y.next(),null;if(y.eatSpace())return x.ateSpace=!0,null;if((y.sol()||x.ateSpace)&&(x.ateSpace=!1,a.gitHubSpice!==!1)){if(y.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?=.{0,6}\d)(?:[a-f0-9]{7,40}\b)/))return x.combineTokens=!0,"link";if(y.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/))return x.combineTokens=!0,"link"}return y.match(l)&&y.string.slice(y.start-2,y.start)!="]("&&(y.start==0||/\W/.test(y.string.charAt(y.start-1)))?(x.combineTokens=!0,"link"):(y.next(),null)},blankLine:h},d={taskLists:!0,strikethrough:!0,emoji:!0};for(var v in a)d[v]=a[v];return d.name="markdown",o.overlayMode(o.getMode(s,d),c)},"markdown"),o.defineMIME("text/x-gfm","gfm")})});var Mf=at(()=>{});var Bf=at((j0,fl)=>{var ul;(function(){"use strict";ul=function(o,l,s,a){a=a||{},this.dictionary=null,this.rules={},this.dictionaryTable=new Map,this.compoundRules=[],this.compoundRuleCodes={},this.replacementTable=[],this.flags=a.flags||{},this.memoized={},this.loaded=!1;var f=this,h,c,d,v,y;o&&(f.dictionary=o,l&&s?F():(typeof window<"u"?(a.dictionaryPath?h=a.dictionaryPath:h="typo/dictionaries",window.chrome&&window.chrome.runtime&&window.chrome.runtime.getURL?h=window.chrome.runtime.getURL(h):window.browser&&window.browser.runtime&&window.browser.runtime.getURL&&(h=window.browser.runtime.getURL(h))):typeof __dirname<"u"?h=__dirname+"/dictionaries":h="./dictionaries",l||x(h+"/"+o+"/"+o+".aff",D),s||x(h+"/"+o+"/"+o+".dic",S)));function x(B,L){var T=f._readFile(B,null,a?.asyncLoad);a?.asyncLoad?T.then(function(N){L(N)}):L(T)}function D(B){l=B,s&&F()}function S(B){s=B,l&&F()}function F(){for(f.rules=f._parseAFF(l),f.compoundRuleCodes={},c=0,v=f.compoundRules.length;c0&&(W.continuationClasses=O),I!=="."&&(S==="SFX"?W.match=new RegExp(I+"$"):W.match=new RegExp("^"+I)),T!="0"&&(S==="SFX"?W.remove=new RegExp(T+"$"):W.remove=T),L.push(W)}l[F]={type:S,combineable:B==="Y",entries:L},c+=f}else if(S==="COMPOUNDRULE"){for(f=parseInt(D[1],10),d=c+1,y=c+1+f;d0&&(s.get(oe)===null&&s.set(oe,[]),s.get(oe).push(X))}for(var f=1,h=l.length;f1){var x=this.parseRuleCodes(v[1]);(!("NEEDAFFIX"in this.flags)||x.indexOf(this.flags.NEEDAFFIX)===-1)&&a(y,x);for(var D=0,S=x.length;D"u"){if("COMPOUNDMIN"in this.flags&&o.length>=this.flags.COMPOUNDMIN){for(s=0,a=this.compoundRules.length;s"u"&&(s=Array.prototype.concat.apply([],this.dictionaryTable.get(o))),s&&s.indexOf(this.flags[l])!==-1))},alphabet:"",suggest:function(o,l){if(!this.loaded)throw"Dictionary not loaded.";if(l=l||5,this.memoized.hasOwnProperty(o)){var s=this.memoized[o].limit;if(l<=s||this.memoized[o].suggestions.length1&&K[1][1]!==K[1][0]&&(I=K[0]+K[1][1]+K[1][0]+K[1].substring(2),(!F||y.check(I))&&(I in B?B[I]+=1:B[I]=1)),K[1]){var de=K[1].substring(0,1).toUpperCase()===K[1].substring(0,1)?"uppercase":"lowercase";for(T=0;TG?1:oe[0].localeCompare(U[0])}I.sort(W).reverse();var j=[],K="lowercase";S.toUpperCase()===S?K="uppercase":S.substr(0,1).toUpperCase()+S.substr(1).toLowerCase()===S&&(K="capitalized");var de=l;for(z=0;z{"use strict";var _f=Bf();function Oe(o){if(o=o||{},typeof o.codeMirrorInstance!="function"||typeof o.codeMirrorInstance.defineMode!="function"){console.log("CodeMirror Spell Checker: You must provide an instance of CodeMirror via the option `codeMirrorInstance`");return}String.prototype.includes||(String.prototype.includes=function(){"use strict";return String.prototype.indexOf.apply(this,arguments)!==-1}),o.codeMirrorInstance.defineMode("spell-checker",function(l){if(!Oe.aff_loading){Oe.aff_loading=!0;var s=new XMLHttpRequest;s.open("GET","https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.aff",!0),s.onload=function(){s.readyState===4&&s.status===200&&(Oe.aff_data=s.responseText,Oe.num_loaded++,Oe.num_loaded==2&&(Oe.typo=new _f("en_US",Oe.aff_data,Oe.dic_data,{platform:"any"})))},s.send(null)}if(!Oe.dic_loading){Oe.dic_loading=!0;var a=new XMLHttpRequest;a.open("GET","https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.dic",!0),a.onload=function(){a.readyState===4&&a.status===200&&(Oe.dic_data=a.responseText,Oe.num_loaded++,Oe.num_loaded==2&&(Oe.typo=new _f("en_US",Oe.aff_data,Oe.dic_data,{platform:"any"})))},a.send(null)}var f='!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~ ',h={token:function(d){var v=d.peek(),y="";if(f.includes(v))return d.next(),null;for(;(v=d.peek())!=null&&!f.includes(v);)y+=v,d.next();return Oe.typo&&!Oe.typo.check(y)?"spell-error":null}},c=o.codeMirrorInstance.getMode(l,l.backdrop||"text/plain");return o.codeMirrorInstance.overlayMode(c,h,!0)})}Oe.num_loaded=0;Oe.aff_loading=!1;Oe.dic_loading=!1;Oe.aff_data="";Oe.dic_data="";Oe.typo;zf.exports=Oe});var Yf=at(_e=>{"use strict";function Of(o,l){for(var s=0;so.length)&&(l=o.length);for(var s=0,a=new Array(l);s=o.length?{done:!0}:{done:!1,value:o[a++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +`),k=j+X.length,H=X[X.length-1].length;return{from:l(k,H),to:l(k+G.length-1,G.length==1?H+G[0].length:G[G.length-1].length),match:oe}}}}var x,D;String.prototype.normalize?(x=function(T){return T.normalize("NFD").toLowerCase()},D=function(T){return T.normalize("NFD")}):(x=function(T){return T.toLowerCase()},D=function(T){return T});function S(T,N,z,O){if(T.length==N.length)return z;for(var I=0,U=z+Math.max(0,T.length-N.length);;){if(I==U)return I;var j=I+U>>1,K=O(T.slice(0,j)).length;if(K==z)return j;K>z?U=j:I=j+1}}function F(T,N,z,O){if(!N.length)return null;var I=O?x:D,U=I(N).split(/\r|\n\r?/);e:for(var j=z.line,K=z.ch,de=T.lastLine()+1-U.length;j<=de;j++,K=0){var W=T.getLine(j).slice(K),oe=I(W);if(U.length==1){var X=oe.indexOf(U[0]);if(X==-1)continue e;var z=S(W,oe,X,I)+K;return{from:l(j,S(W,oe,X,I)+K),to:l(j,S(W,oe,X+U[0].length,I)+K)}}else{var G=oe.length-U[0].length;if(oe.slice(G)!=U[0])continue e;for(var k=1;k=de;j--,K=-1){var W=T.getLine(j);K>-1&&(W=W.slice(0,K));var oe=I(W);if(U.length==1){var X=oe.lastIndexOf(U[0]);if(X==-1)continue e;return{from:l(j,S(W,oe,X,I)),to:l(j,S(W,oe,X+U[0].length,I))}}else{var G=U[U.length-1];if(oe.slice(0,G.length)!=G)continue e;for(var k=1,z=j-U.length+1;k(this.doc.getLine(N.line)||"").length&&(N.ch=0,N.line++)),o.cmpPos(N,this.doc.clipPos(N))!=0))return this.atOccurrence=!1;var z=this.matches(T,N);if(this.afterEmptyMatch=z&&o.cmpPos(z.from,z.to)==0,z)return this.pos=z,this.atOccurrence=!0,this.pos.match||!0;var O=l(T?this.doc.firstLine():this.doc.lastLine()+1,0);return this.pos={from:O,to:O},this.atOccurrence=!1},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(T,N){if(this.atOccurrence){var z=o.splitLines(T);this.doc.replaceRange(z,this.pos.from,this.pos.to,N),this.pos.to=l(this.pos.from.line+z.length-1,z[z.length-1].length+(z.length==1?this.pos.from.ch:0))}}},o.defineExtension("getSearchCursor",function(T,N,z){return new L(this.doc,T,N,z)}),o.defineDocExtension("getSearchCursor",function(T,N,z){return new L(this,T,N,z)}),o.defineExtension("selectMatches",function(T,N){for(var z=[],O=this.getSearchCursor(T,this.getCursor("from"),N);O.findNext()&&!(o.cmpPos(O.to(),this.getCursor("to"))>0);)z.push({anchor:O.from(),head:O.to()});z.length&&this.setSelections(z,0)})})});var Lf=at((Ff,Tf)=>{(function(o){typeof Ff=="object"&&typeof Tf=="object"?o(At(),ll(),sl()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../markdown/markdown","../../addon/mode/overlay"],o):o(CodeMirror)})(function(o){"use strict";var l=/^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i;o.defineMode("gfm",function(s,a){var f=0;function h(y){return y.code=!1,null}var c={startState:function(){return{code:!1,codeBlock:!1,ateSpace:!1}},copyState:function(y){return{code:y.code,codeBlock:y.codeBlock,ateSpace:y.ateSpace}},token:function(y,x){if(x.combineTokens=null,x.codeBlock)return y.match(/^```+/)?(x.codeBlock=!1,null):(y.skipToEnd(),null);if(y.sol()&&(x.code=!1),y.sol()&&y.match(/^```+/))return y.skipToEnd(),x.codeBlock=!0,null;if(y.peek()==="`"){y.next();var D=y.pos;y.eatWhile("`");var S=1+y.pos-D;return x.code?S===f&&(x.code=!1):(f=S,x.code=!0),null}else if(x.code)return y.next(),null;if(y.eatSpace())return x.ateSpace=!0,null;if((y.sol()||x.ateSpace)&&(x.ateSpace=!1,a.gitHubSpice!==!1)){if(y.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?=.{0,6}\d)(?:[a-f0-9]{7,40}\b)/))return x.combineTokens=!0,"link";if(y.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/))return x.combineTokens=!0,"link"}return y.match(l)&&y.string.slice(y.start-2,y.start)!="]("&&(y.start==0||/\W/.test(y.string.charAt(y.start-1)))?(x.combineTokens=!0,"link"):(y.next(),null)},blankLine:h},d={taskLists:!0,strikethrough:!0,emoji:!0};for(var v in a)d[v]=a[v];return d.name="markdown",o.overlayMode(o.getMode(s,d),c)},"markdown"),o.defineMIME("text/x-gfm","gfm")})});var Mf=at(()=>{});var Bf=at((j0,fl)=>{var ul;(function(){"use strict";ul=function(o,l,s,a){a=a||{},this.dictionary=null,this.rules={},this.dictionaryTable=new Map,this.compoundRules=[],this.compoundRuleCodes={},this.replacementTable=[],this.flags=a.flags||{},this.memoized={},this.loaded=!1;var f=this,h,c,d,v,y;o&&(f.dictionary=o,l&&s?F():(typeof window<"u"?(a.dictionaryPath?h=a.dictionaryPath:h="typo/dictionaries",window.chrome&&window.chrome.runtime&&window.chrome.runtime.getURL?h=window.chrome.runtime.getURL(h):window.browser&&window.browser.runtime&&window.browser.runtime.getURL&&(h=window.browser.runtime.getURL(h))):typeof __dirname<"u"?h=__dirname+"/dictionaries":h="./dictionaries",l||x(h+"/"+o+"/"+o+".aff",D),s||x(h+"/"+o+"/"+o+".dic",S)));function x(B,L){var T=f._readFile(B,null,a?.asyncLoad);a?.asyncLoad?T.then(function(N){L(N)}):L(T)}function D(B){l=B,s&&F()}function S(B){s=B,l&&F()}function F(){for(f.rules=f._parseAFF(l),f.compoundRuleCodes={},c=0,v=f.compoundRules.length;c0&&(U.continuationClasses=O),I!=="."&&(S==="SFX"?U.match=new RegExp(I+"$"):U.match=new RegExp("^"+I)),T!="0"&&(S==="SFX"?U.remove=new RegExp(T+"$"):U.remove=T),L.push(U)}l[F]={type:S,combineable:B==="Y",entries:L},c+=f}else if(S==="COMPOUNDRULE"){for(f=parseInt(D[1],10),d=c+1,y=c+1+f;d0&&(s.get(oe)===null&&s.set(oe,[]),s.get(oe).push(X))}for(var f=1,h=l.length;f1){var x=this.parseRuleCodes(v[1]);(!("NEEDAFFIX"in this.flags)||x.indexOf(this.flags.NEEDAFFIX)===-1)&&a(y,x);for(var D=0,S=x.length;D"u"){if("COMPOUNDMIN"in this.flags&&o.length>=this.flags.COMPOUNDMIN){for(s=0,a=this.compoundRules.length;s"u"&&(s=Array.prototype.concat.apply([],this.dictionaryTable.get(o))),s&&s.indexOf(this.flags[l])!==-1))},alphabet:"",suggest:function(o,l){if(!this.loaded)throw"Dictionary not loaded.";if(l=l||5,this.memoized.hasOwnProperty(o)){var s=this.memoized[o].limit;if(l<=s||this.memoized[o].suggestions.length1&&K[1][1]!==K[1][0]&&(I=K[0]+K[1][1]+K[1][0]+K[1].substring(2),(!F||y.check(I))&&(I in B?B[I]+=1:B[I]=1)),K[1]){var de=K[1].substring(0,1).toUpperCase()===K[1].substring(0,1)?"uppercase":"lowercase";for(T=0;TG?1:oe[0].localeCompare(W[0])}I.sort(U).reverse();var j=[],K="lowercase";S.toUpperCase()===S?K="uppercase":S.substr(0,1).toUpperCase()+S.substr(1).toLowerCase()===S&&(K="capitalized");var de=l;for(z=0;z{"use strict";var _f=Bf();function Oe(o){if(o=o||{},typeof o.codeMirrorInstance!="function"||typeof o.codeMirrorInstance.defineMode!="function"){console.log("CodeMirror Spell Checker: You must provide an instance of CodeMirror via the option `codeMirrorInstance`");return}String.prototype.includes||(String.prototype.includes=function(){"use strict";return String.prototype.indexOf.apply(this,arguments)!==-1}),o.codeMirrorInstance.defineMode("spell-checker",function(l){if(!Oe.aff_loading){Oe.aff_loading=!0;var s=new XMLHttpRequest;s.open("GET","https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.aff",!0),s.onload=function(){s.readyState===4&&s.status===200&&(Oe.aff_data=s.responseText,Oe.num_loaded++,Oe.num_loaded==2&&(Oe.typo=new _f("en_US",Oe.aff_data,Oe.dic_data,{platform:"any"})))},s.send(null)}if(!Oe.dic_loading){Oe.dic_loading=!0;var a=new XMLHttpRequest;a.open("GET","https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.dic",!0),a.onload=function(){a.readyState===4&&a.status===200&&(Oe.dic_data=a.responseText,Oe.num_loaded++,Oe.num_loaded==2&&(Oe.typo=new _f("en_US",Oe.aff_data,Oe.dic_data,{platform:"any"})))},a.send(null)}var f='!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~ ',h={token:function(d){var v=d.peek(),y="";if(f.includes(v))return d.next(),null;for(;(v=d.peek())!=null&&!f.includes(v);)y+=v,d.next();return Oe.typo&&!Oe.typo.check(y)?"spell-error":null}},c=o.codeMirrorInstance.getMode(l,l.backdrop||"text/plain");return o.codeMirrorInstance.overlayMode(c,h,!0)})}Oe.num_loaded=0;Oe.aff_loading=!1;Oe.dic_loading=!1;Oe.aff_data="";Oe.dic_data="";Oe.typo;zf.exports=Oe});var Yf=at(_e=>{"use strict";function Of(o,l){for(var s=0;so.length)&&(l=o.length);for(var s=0,a=new Array(l);s=o.length?{done:!0}:{done:!1,value:o[a++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ep(o,l){if(typeof o!="object"||o===null)return o;var s=o[Symbol.toPrimitive];if(s!==void 0){var a=s.call(o,l||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(o)}function tp(o){var l=ep(o,"string");return typeof l=="symbol"?l:String(l)}function cl(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}_e.defaults=cl();function rp(o){_e.defaults=o}var jf=/[&<>"']/,ip=new RegExp(jf.source,"g"),Gf=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,np=new RegExp(Gf.source,"g"),op={"&":"&","<":"<",">":">",'"':""","'":"'"},Hf=function(l){return op[l]};function gt(o,l){if(l){if(jf.test(o))return o.replace(ip,Hf)}else if(Gf.test(o))return o.replace(np,Hf);return o}var ap=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Xf(o){return o.replace(ap,function(l,s){return s=s.toLowerCase(),s==="colon"?":":s.charAt(0)==="#"?s.charAt(1)==="x"?String.fromCharCode(parseInt(s.substring(2),16)):String.fromCharCode(+s.substring(1)):""})}var lp=/(^|[^\[])\^/g;function Me(o,l){o=typeof o=="string"?o:o.source,l=l||"";var s={replace:function(f,h){return h=h.source||h,h=h.replace(lp,"$1"),o=o.replace(f,h),s},getRegex:function(){return new RegExp(o,l)}};return s}var sp=/[^\w:]/g,up=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function Pf(o,l,s){if(o){var a;try{a=decodeURIComponent(Xf(s)).replace(sp,"").toLowerCase()}catch{return null}if(a.indexOf("javascript:")===0||a.indexOf("vbscript:")===0||a.indexOf("data:")===0)return null}l&&!up.test(s)&&(s=hp(l,s));try{s=encodeURI(s).replace(/%25/g,"%")}catch{return null}return s}var oo={},fp=/^[^:]+:\/*[^/]*$/,cp=/^([^:]+:)[\s\S]*$/,dp=/^([^:]+:\/*[^/]*)[\s\S]*$/;function hp(o,l){oo[" "+o]||(fp.test(o)?oo[" "+o]=o+"/":oo[" "+o]=ao(o,"/",!0)),o=oo[" "+o];var s=o.indexOf(":")===-1;return l.substring(0,2)==="//"?s?l:o.replace(cp,"$1")+l:l.charAt(0)==="/"?s?l:o.replace(dp,"$1")+l:o+l}var lo={exec:function(){}};function qf(o,l){var s=o.replace(/\|/g,function(h,c,d){for(var v=!1,y=c;--y>=0&&d[y]==="\\";)v=!v;return v?"|":" |"}),a=s.split(/ \|/),f=0;if(a[0].trim()||a.shift(),a.length>0&&!a[a.length-1].trim()&&a.pop(),a.length>l)a.splice(l);else for(;a.length1;)l&1&&(s+=o),l>>=1,o+=o;return s+o}function Wf(o,l,s,a){var f=l.href,h=l.title?gt(l.title):null,c=o[1].replace(/\\([\[\]])/g,"$1");if(o[0].charAt(0)!=="!"){a.state.inLink=!0;var d={type:"link",raw:s,href:f,title:h,text:c,tokens:a.inlineTokens(c)};return a.state.inLink=!1,d}return{type:"image",raw:s,href:f,title:h,text:gt(c)}}function mp(o,l){var s=o.match(/^(\s+)(?:```)/);if(s===null)return l;var a=s[1];return l.split(` `).map(function(f){var h=f.match(/^\s+/);if(h===null)return f;var c=h[0];return c.length>=a.length?f.slice(a.length):f}).join(` `)}var so=function(){function o(s){this.options=s||_e.defaults}var l=o.prototype;return l.space=function(a){var f=this.rules.block.newline.exec(a);if(f&&f[0].length>0)return{type:"space",raw:f[0]}},l.code=function(a){var f=this.rules.block.code.exec(a);if(f){var h=f[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:f[0],codeBlockStyle:"indented",text:this.options.pedantic?h:ao(h,` `)}}},l.fences=function(a){var f=this.rules.block.fences.exec(a);if(f){var h=f[0],c=mp(h,f[3]||"");return{type:"code",raw:h,lang:f[2]?f[2].trim().replace(this.rules.inline._escapes,"$1"):f[2],text:c}}},l.heading=function(a){var f=this.rules.block.heading.exec(a);if(f){var h=f[2].trim();if(/#$/.test(h)){var c=ao(h,"#");(this.options.pedantic||!c||/ $/.test(c))&&(h=c.trim())}return{type:"heading",raw:f[0],depth:f[1].length,text:h,tokens:this.lexer.inline(h)}}},l.hr=function(a){var f=this.rules.block.hr.exec(a);if(f)return{type:"hr",raw:f[0]}},l.blockquote=function(a){var f=this.rules.block.blockquote.exec(a);if(f){var h=f[0].replace(/^ *>[ \t]?/gm,""),c=this.lexer.state.top;this.lexer.state.top=!0;var d=this.lexer.blockTokens(h);return this.lexer.state.top=c,{type:"blockquote",raw:f[0],tokens:d,text:h}}},l.list=function(a){var f=this.rules.block.list.exec(a);if(f){var h,c,d,v,y,x,D,S,F,B,L,T,N=f[1].trim(),z=N.length>1,O={type:"list",raw:"",ordered:z,start:z?+N.slice(0,-1):"",loose:!1,items:[]};N=z?"\\d{1,9}\\"+N.slice(-1):"\\"+N,this.options.pedantic&&(N=z?N:"[*+-]");for(var I=new RegExp("^( {0,3}"+N+")((?:[ ][^\\n]*)?(?:\\n|$))");a&&(T=!1,!(!(f=I.exec(a))||this.rules.block.hr.test(a)));){if(h=f[0],a=a.substring(h.length),S=f[2].split(` `,1)[0].replace(/^\t+/,function(G){return" ".repeat(3*G.length)}),F=a.split(` `,1)[0],this.options.pedantic?(v=2,L=S.trimLeft()):(v=f[2].search(/[^ ]/),v=v>4?1:v,L=S.slice(v),v+=f[1].length),x=!1,!S&&/^ *$/.test(F)&&(h+=F+` -`,a=a.substring(F.length+1),T=!0),!T)for(var W=new RegExp("^ {0,"+Math.min(3,v-1)+"}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))"),j=new RegExp("^ {0,"+Math.min(3,v-1)+"}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)"),K=new RegExp("^ {0,"+Math.min(3,v-1)+"}(?:```|~~~)"),de=new RegExp("^ {0,"+Math.min(3,v-1)+"}#");a&&(B=a.split(` -`,1)[0],F=B,this.options.pedantic&&(F=F.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!(K.test(F)||de.test(F)||W.test(F)||j.test(a)));){if(F.search(/[^ ]/)>=v||!F.trim())L+=` +`,a=a.substring(F.length+1),T=!0),!T)for(var U=new RegExp("^ {0,"+Math.min(3,v-1)+"}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))"),j=new RegExp("^ {0,"+Math.min(3,v-1)+"}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)"),K=new RegExp("^ {0,"+Math.min(3,v-1)+"}(?:```|~~~)"),de=new RegExp("^ {0,"+Math.min(3,v-1)+"}#");a&&(B=a.split(` +`,1)[0],F=B,this.options.pedantic&&(F=F.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!(K.test(F)||de.test(F)||U.test(F)||j.test(a)));){if(F.search(/[^ ]/)>=v||!F.trim())L+=` `+F.slice(v);else{if(x||S.search(/[^ ]/)>=4||K.test(S)||de.test(S)||j.test(S))break;L+=` `+F}!x&&!F.trim()&&(x=!0),h+=B+` -`,a=a.substring(B.length+1),S=F.slice(v)}O.loose||(D?O.loose=!0:/\n *\n *$/.test(h)&&(D=!0)),this.options.gfm&&(c=/^\[[ xX]\] /.exec(L),c&&(d=c[0]!=="[ ] ",L=L.replace(/^\[[ xX]\] +/,""))),O.items.push({type:"list_item",raw:h,task:!!c,checked:d,loose:!1,text:L}),O.raw+=h}O.items[O.items.length-1].raw=h.trimRight(),O.items[O.items.length-1].text=L.trimRight(),O.raw=O.raw.trimRight();var U=O.items.length;for(y=0;y0&&oe.some(function(G){return/\n.*\n/.test(G.raw)});O.loose=X}if(O.loose)for(y=0;y$/,"$1").replace(this.rules.inline._escapes,"$1"):"",d=f[3]?f[3].substring(1,f[3].length-1).replace(this.rules.inline._escapes,"$1"):f[3];return{type:"def",tag:h,raw:f[0],href:c,title:d}}},l.table=function(a){var f=this.rules.block.table.exec(a);if(f){var h={type:"table",header:qf(f[1]).map(function(D){return{text:D}}),align:f[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:f[3]&&f[3].trim()?f[3].replace(/\n[ \t]*$/,"").split(` +`,a=a.substring(B.length+1),S=F.slice(v)}O.loose||(D?O.loose=!0:/\n *\n *$/.test(h)&&(D=!0)),this.options.gfm&&(c=/^\[[ xX]\] /.exec(L),c&&(d=c[0]!=="[ ] ",L=L.replace(/^\[[ xX]\] +/,""))),O.items.push({type:"list_item",raw:h,task:!!c,checked:d,loose:!1,text:L}),O.raw+=h}O.items[O.items.length-1].raw=h.trimRight(),O.items[O.items.length-1].text=L.trimRight(),O.raw=O.raw.trimRight();var W=O.items.length;for(y=0;y0&&oe.some(function(G){return/\n.*\n/.test(G.raw)});O.loose=X}if(O.loose)for(y=0;y$/,"$1").replace(this.rules.inline._escapes,"$1"):"",d=f[3]?f[3].substring(1,f[3].length-1).replace(this.rules.inline._escapes,"$1"):f[3];return{type:"def",tag:h,raw:f[0],href:c,title:d}}},l.table=function(a){var f=this.rules.block.table.exec(a);if(f){var h={type:"table",header:qf(f[1]).map(function(D){return{text:D}}),align:f[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:f[3]&&f[3].trim()?f[3].replace(/\n[ \t]*$/,"").split(` `):[]};if(h.header.length===h.align.length){h.raw=f[0];var c=h.align.length,d,v,y,x;for(d=0;d/i.test(f[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(f[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(f[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:f[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(f[0]):gt(f[0]):f[0]}},l.link=function(a){var f=this.rules.inline.link.exec(a);if(f){var h=f[2].trim();if(!this.options.pedantic&&/^$/.test(h))return;var c=ao(h.slice(0,-1),"\\");if((h.length-c.length)%2===0)return}else{var d=pp(f[2],"()");if(d>-1){var v=f[0].indexOf("!")===0?5:4,y=v+f[1].length+d;f[2]=f[2].substring(0,d),f[0]=f[0].substring(0,y).trim(),f[3]=""}}var x=f[2],D="";if(this.options.pedantic){var S=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(x);S&&(x=S[1],D=S[3])}else D=f[3]?f[3].slice(1,-1):"";return x=x.trim(),/^$/.test(h)?x=x.slice(1):x=x.slice(1,-1)),Wf(f,{href:x&&x.replace(this.rules.inline._escapes,"$1"),title:D&&D.replace(this.rules.inline._escapes,"$1")},f[0],this.lexer)}},l.reflink=function(a,f){var h;if((h=this.rules.inline.reflink.exec(a))||(h=this.rules.inline.nolink.exec(a))){var c=(h[2]||h[1]).replace(/\s+/g," ");if(c=f[c.toLowerCase()],!c){var d=h[0].charAt(0);return{type:"text",raw:d,text:d}}return Wf(h,c,h[0],this.lexer)}},l.emStrong=function(a,f,h){h===void 0&&(h="");var c=this.rules.inline.emStrong.lDelim.exec(a);if(c&&!(c[3]&&h.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\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\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\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\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\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-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\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\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDF70-\uDF81\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD837[\uDF00-\uDF1E]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/))){var d=c[1]||c[2]||"";if(!d||d&&(h===""||this.rules.inline.punctuation.exec(h))){var v=c[0].length-1,y,x,D=v,S=0,F=c[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(F.lastIndex=0,f=f.slice(-1*a.length+v);(c=F.exec(f))!=null;)if(y=c[1]||c[2]||c[3]||c[4]||c[5]||c[6],!!y){if(x=y.length,c[3]||c[4]){D+=x;continue}else if((c[5]||c[6])&&v%3&&!((v+x)%3)){S+=x;continue}if(D-=x,!(D>0)){x=Math.min(x,x+D+S);var B=a.slice(0,v+c.index+(c[0].length-y.length)+x);if(Math.min(v,x)%2){var L=B.slice(1,-1);return{type:"em",raw:B,text:L,tokens:this.lexer.inlineTokens(L)}}var T=B.slice(2,-2);return{type:"strong",raw:B,text:T,tokens:this.lexer.inlineTokens(T)}}}}}},l.codespan=function(a){var f=this.rules.inline.code.exec(a);if(f){var h=f[2].replace(/\n/g," "),c=/[^ ]/.test(h),d=/^ /.test(h)&&/ $/.test(h);return c&&d&&(h=h.substring(1,h.length-1)),h=gt(h,!0),{type:"codespan",raw:f[0],text:h}}},l.br=function(a){var f=this.rules.inline.br.exec(a);if(f)return{type:"br",raw:f[0]}},l.del=function(a){var f=this.rules.inline.del.exec(a);if(f)return{type:"del",raw:f[0],text:f[2],tokens:this.lexer.inlineTokens(f[2])}},l.autolink=function(a,f){var h=this.rules.inline.autolink.exec(a);if(h){var c,d;return h[2]==="@"?(c=gt(this.options.mangle?f(h[1]):h[1]),d="mailto:"+c):(c=gt(h[1]),d=c),{type:"link",raw:h[0],text:c,href:d,tokens:[{type:"text",raw:c,text:c}]}}},l.url=function(a,f){var h;if(h=this.rules.inline.url.exec(a)){var c,d;if(h[2]==="@")c=gt(this.options.mangle?f(h[0]):h[0]),d="mailto:"+c;else{var v;do v=h[0],h[0]=this.rules.inline._backpedal.exec(h[0])[0];while(v!==h[0]);c=gt(h[0]),h[1]==="www."?d="http://"+h[0]:d=h[0]}return{type:"link",raw:h[0],text:c,href:d,tokens:[{type:"text",raw:c,text:c}]}}},l.inlineText=function(a,f){var h=this.rules.inline.text.exec(a);if(h){var c;return this.lexer.state.inRawBlock?c=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(h[0]):gt(h[0]):h[0]:c=gt(this.options.smartypants?f(h[0]):h[0]),{type:"text",raw:h[0],text:c}}},o}(),ce={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:lo,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/};ce._label=/(?!\s*\])(?:\\.|[^\[\]\\])+/;ce._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;ce.def=Me(ce.def).replace("label",ce._label).replace("title",ce._title).getRegex();ce.bullet=/(?:[*+-]|\d{1,9}[.)])/;ce.listItemStart=Me(/^( *)(bull) */).replace("bull",ce.bullet).getRegex();ce.list=Me(ce.list).replace(/bull/g,ce.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ce.def.source+")").getRegex();ce._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";ce._comment=/|$)/;ce.html=Me(ce.html,"i").replace("comment",ce._comment).replace("tag",ce._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();ce.paragraph=Me(ce._paragraph).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ce._tag).getRegex();ce.blockquote=Me(ce.blockquote).replace("paragraph",ce.paragraph).getRegex();ce.normal=_t({},ce);ce.gfm=_t({},ce.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"});ce.gfm.table=Me(ce.gfm.table).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ce._tag).getRegex();ce.gfm.paragraph=Me(ce._paragraph).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",ce.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ce._tag).getRegex();ce.pedantic=_t({},ce.normal,{html:Me(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ce._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:lo,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Me(ce.normal._paragraph).replace("hr",ce.hr).replace("heading",` *#{1,6} *[^ ]`).replace("lheading",ce.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var ne={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:lo,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,rDelimUnd:/^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:lo,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~";ne.punctuation=Me(ne.punctuation).replace(/punctuation/g,ne._punctuation).getRegex();ne.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;ne.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g;ne._comment=Me(ce._comment).replace("(?:-->|$)","-->").getRegex();ne.emStrong.lDelim=Me(ne.emStrong.lDelim).replace(/punct/g,ne._punctuation).getRegex();ne.emStrong.rDelimAst=Me(ne.emStrong.rDelimAst,"g").replace(/punct/g,ne._punctuation).getRegex();ne.emStrong.rDelimUnd=Me(ne.emStrong.rDelimUnd,"g").replace(/punct/g,ne._punctuation).getRegex();ne._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;ne._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;ne._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;ne.autolink=Me(ne.autolink).replace("scheme",ne._scheme).replace("email",ne._email).getRegex();ne._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;ne.tag=Me(ne.tag).replace("comment",ne._comment).replace("attribute",ne._attribute).getRegex();ne._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;ne._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;ne._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;ne.link=Me(ne.link).replace("label",ne._label).replace("href",ne._href).replace("title",ne._title).getRegex();ne.reflink=Me(ne.reflink).replace("label",ne._label).replace("ref",ce._label).getRegex();ne.nolink=Me(ne.nolink).replace("ref",ce._label).getRegex();ne.reflinkSearch=Me(ne.reflinkSearch,"g").replace("reflink",ne.reflink).replace("nolink",ne.nolink).getRegex();ne.normal=_t({},ne);ne.pedantic=_t({},ne.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Me(/^!?\[(label)\]\((.*?)\)/).replace("label",ne._label).getRegex(),reflink:Me(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ne._label).getRegex()});ne.gfm=_t({},ne.normal,{escape:Me(ne.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\.5&&(a="x"+a.toString(16)),l+="&#"+a+";";return l}var yi=function(){function o(s){this.tokens=[],this.tokens.links=Object.create(null),this.options=s||_e.defaults,this.options.tokenizer=this.options.tokenizer||new so,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};var a={block:ce.normal,inline:ne.normal};this.options.pedantic?(a.block=ce.pedantic,a.inline=ne.pedantic):this.options.gfm&&(a.block=ce.gfm,this.options.breaks?a.inline=ne.breaks:a.inline=ne.gfm),this.tokenizer.rules=a}o.lex=function(a,f){var h=new o(f);return h.lex(a)},o.lexInline=function(a,f){var h=new o(f);return h.inlineTokens(a)};var l=o.prototype;return l.lex=function(a){a=a.replace(/\r\n|\r/g,` @@ -73,15 +73,15 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `},l.tablerow=function(a){return` `+a+` `},l.tablecell=function(a,f){var h=f.header?"th":"td",c=f.align?"<"+h+' align="'+f.align+'">':"<"+h+">";return c+a+(" -`)},l.strong=function(a){return""+a+""},l.em=function(a){return""+a+""},l.codespan=function(a){return""+a+""},l.br=function(){return this.options.xhtml?"
    ":"
    "},l.del=function(a){return""+a+""},l.link=function(a,f,h){if(a=Pf(this.options.sanitize,this.options.baseUrl,a),a===null)return h;var c='
    ",c},l.image=function(a,f,h){if(a=Pf(this.options.sanitize,this.options.baseUrl,a),a===null)return h;var c=''+h+'":">",c},l.text=function(a){return a},o}(),dl=function(){function o(){}var l=o.prototype;return l.strong=function(a){return a},l.em=function(a){return a},l.codespan=function(a){return a},l.del=function(a){return a},l.html=function(a){return a},l.text=function(a){return a},l.link=function(a,f,h){return""+h},l.image=function(a,f,h){return""+h},l.br=function(){return""},o}(),hl=function(){function o(){this.seen={}}var l=o.prototype;return l.serialize=function(a){return a.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},l.getNextSafeSlug=function(a,f){var h=a,c=0;if(this.seen.hasOwnProperty(h)){c=this.seen[a];do c++,h=a+"-"+c;while(this.seen.hasOwnProperty(h))}return f||(this.seen[a]=c,this.seen[h]=0),h},l.slug=function(a,f){f===void 0&&(f={});var h=this.serialize(a);return this.getNextSafeSlug(h,f.dryrun)},o}(),xi=function(){function o(s){this.options=s||_e.defaults,this.options.renderer=this.options.renderer||new uo,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new dl,this.slugger=new hl}o.parse=function(a,f){var h=new o(f);return h.parse(a)},o.parseInline=function(a,f){var h=new o(f);return h.parseInline(a)};var l=o.prototype;return l.parse=function(a,f){f===void 0&&(f=!0);var h="",c,d,v,y,x,D,S,F,B,L,T,N,z,O,I,W,j,K,de,U=a.length;for(c=0;c0&&I.tokens[0].type==="paragraph"?(I.tokens[0].text=K+" "+I.tokens[0].text,I.tokens[0].tokens&&I.tokens[0].tokens.length>0&&I.tokens[0].tokens[0].type==="text"&&(I.tokens[0].tokens[0].text=K+" "+I.tokens[0].tokens[0].text)):I.tokens.unshift({type:"text",text:K}):O+=K),O+=this.parse(I.tokens,z),B+=this.renderer.listitem(O,j,W);h+=this.renderer.list(B,T,N);continue}case"html":{h+=this.renderer.html(L.text);continue}case"paragraph":{h+=this.renderer.paragraph(this.parseInline(L.tokens));continue}case"text":{for(B=L.tokens?this.parseInline(L.tokens):L.text;c+1"+a+""},l.em=function(a){return""+a+""},l.codespan=function(a){return""+a+""},l.br=function(){return this.options.xhtml?"
    ":"
    "},l.del=function(a){return""+a+""},l.link=function(a,f,h){if(a=Pf(this.options.sanitize,this.options.baseUrl,a),a===null)return h;var c='
    ",c},l.image=function(a,f,h){if(a=Pf(this.options.sanitize,this.options.baseUrl,a),a===null)return h;var c=''+h+'":">",c},l.text=function(a){return a},o}(),dl=function(){function o(){}var l=o.prototype;return l.strong=function(a){return a},l.em=function(a){return a},l.codespan=function(a){return a},l.del=function(a){return a},l.html=function(a){return a},l.text=function(a){return a},l.link=function(a,f,h){return""+h},l.image=function(a,f,h){return""+h},l.br=function(){return""},o}(),hl=function(){function o(){this.seen={}}var l=o.prototype;return l.serialize=function(a){return a.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},l.getNextSafeSlug=function(a,f){var h=a,c=0;if(this.seen.hasOwnProperty(h)){c=this.seen[a];do c++,h=a+"-"+c;while(this.seen.hasOwnProperty(h))}return f||(this.seen[a]=c,this.seen[h]=0),h},l.slug=function(a,f){f===void 0&&(f={});var h=this.serialize(a);return this.getNextSafeSlug(h,f.dryrun)},o}(),xi=function(){function o(s){this.options=s||_e.defaults,this.options.renderer=this.options.renderer||new uo,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new dl,this.slugger=new hl}o.parse=function(a,f){var h=new o(f);return h.parse(a)},o.parseInline=function(a,f){var h=new o(f);return h.parseInline(a)};var l=o.prototype;return l.parse=function(a,f){f===void 0&&(f=!0);var h="",c,d,v,y,x,D,S,F,B,L,T,N,z,O,I,U,j,K,de,W=a.length;for(c=0;c0&&I.tokens[0].type==="paragraph"?(I.tokens[0].text=K+" "+I.tokens[0].text,I.tokens[0].tokens&&I.tokens[0].tokens.length>0&&I.tokens[0].tokens[0].type==="text"&&(I.tokens[0].tokens[0].text=K+" "+I.tokens[0].tokens[0].text)):I.tokens.unshift({type:"text",text:K}):O+=K),O+=this.parse(I.tokens,z),B+=this.renderer.listitem(O,j,U);h+=this.renderer.list(B,T,N);continue}case"html":{h+=this.renderer.html(L.text);continue}case"paragraph":{h+=this.renderer.paragraph(this.parseInline(L.tokens));continue}case"text":{for(B=L.tokens?this.parseInline(L.tokens):L.text;c+1";if(l)return Promise.resolve(f);if(s){s(null,f);return}return f}if(l)return Promise.reject(a);if(s){s(a);return}throw a}}function Kf(o,l){return function(s,a,f){typeof a=="function"&&(f=a,a=null);var h=_t({},a);a=_t({},fe.defaults,h);var c=bp(a.silent,a.async,f);if(typeof s>"u"||s===null)return c(new Error("marked(): input parameter is undefined or null"));if(typeof s!="string")return c(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));if(gp(a),a.hooks&&(a.hooks.options=a),f){var d=a.highlight,v;try{a.hooks&&(s=a.hooks.preprocess(s)),v=o(s,a)}catch(F){return c(F)}var y=function(B){var L;if(!B)try{a.walkTokens&&fe.walkTokens(v,a.walkTokens),L=l(v,a),a.hooks&&(L=a.hooks.postprocess(L))}catch(T){B=T}return a.highlight=d,B?c(B):f(null,L)};if(!d||d.length<3||(delete a.highlight,!v.length))return y();var x=0;fe.walkTokens(v,function(F){F.type==="code"&&(x++,setTimeout(function(){d(F.text,F.lang,function(B,L){if(B)return y(B);L!=null&&L!==F.text&&(F.text=L,F.escaped=!0),x--,x===0&&y()})},0))}),x===0&&y();return}if(a.async)return Promise.resolve(a.hooks?a.hooks.preprocess(s):s).then(function(F){return o(F,a)}).then(function(F){return a.walkTokens?Promise.all(fe.walkTokens(F,a.walkTokens)).then(function(){return F}):F}).then(function(F){return l(F,a)}).then(function(F){return a.hooks?a.hooks.postprocess(F):F}).catch(c);try{a.hooks&&(s=a.hooks.preprocess(s));var D=o(s,a);a.walkTokens&&fe.walkTokens(D,a.walkTokens);var S=l(D,a);return a.hooks&&(S=a.hooks.postprocess(S)),S}catch(F){return c(F)}}}function fe(o,l,s){return Kf(yi.lex,xi.parse)(o,l,s)}fe.options=fe.setOptions=function(o){return fe.defaults=_t({},fe.defaults,o),rp(fe.defaults),fe};fe.getDefaults=cl;fe.defaults=_e.defaults;fe.use=function(){for(var o=fe.defaults.extensions||{renderers:{},childTokens:{}},l=arguments.length,s=new Array(l),a=0;a{"use strict";var wi=At();ef();rf();af();ll();sl();bf();wf();kf();Af();Lf();al();var Ap=Nf(),pl=Yf().marked,Jf=/Mac/.test(navigator.platform),Fp=new RegExp(/()+?/g),fn={toggleBold:ho,toggleItalic:po,drawLink:Eo,toggleHeadingSmaller:cn,toggleHeadingBigger:bo,drawImage:Ao,toggleBlockquote:vo,toggleOrderedList:Do,toggleUnorderedList:Co,toggleCheckList:ko,toggleCodeBlock:mo,togglePreview:Bo,toggleStrikethrough:go,toggleHeading1:yo,toggleHeading2:xo,toggleHeading3:wo,toggleHeading4:ml,toggleHeading5:vl,toggleHeading6:bl,cleanBlock:So,drawTable:Fo,drawHorizontalRule:To,undo:Lo,redo:Mo,toggleSideBySide:Ci,toggleFullScreen:jr},Tp={toggleBold:"Cmd-B",toggleItalic:"Cmd-I",drawLink:"Cmd-K",toggleHeadingSmaller:"Cmd-H",toggleHeadingBigger:"Shift-Cmd-H",toggleHeading1:"Ctrl+Alt+1",toggleHeading2:"Ctrl+Alt+2",toggleHeading3:"Ctrl+Alt+3",toggleHeading4:"Ctrl+Alt+4",toggleHeading5:"Ctrl+Alt+5",toggleHeading6:"Ctrl+Alt+6",cleanBlock:"Cmd-E",drawImage:"Cmd-Alt-I",toggleBlockquote:"Cmd-'",toggleOrderedList:"Cmd-Alt-L",toggleUnorderedList:"Cmd-L",toggleCheckList:"Shift-Cmd-L",toggleCodeBlock:"Cmd-Alt-C",togglePreview:"Cmd-P",toggleSideBySide:"F9",toggleFullScreen:"F11"},Lp=function(o){for(var l in fn)if(fn[l]===o)return l;return null},gl=function(){var o=!1;return function(l){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(l)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(l.substr(0,4)))&&(o=!0)}(navigator.userAgent||navigator.vendor||window.opera),o};function Mp(o){for(var l;(l=Fp.exec(o))!==null;){var s=l[0];if(s.indexOf("target=")===-1){var a=s.replace(/>$/,' target="_blank">');o=o.replace(s,a)}}return o}function Bp(o){for(var l=new DOMParser,s=l.parseFromString(o,"text/html"),a=s.getElementsByTagName("li"),f=0;f0){for(var F=document.createElement("i"),B=0;B";if(l)return Promise.resolve(f);if(s){s(null,f);return}return f}if(l)return Promise.reject(a);if(s){s(a);return}throw a}}function Kf(o,l){return function(s,a,f){typeof a=="function"&&(f=a,a=null);var h=_t({},a);a=_t({},fe.defaults,h);var c=bp(a.silent,a.async,f);if(typeof s>"u"||s===null)return c(new Error("marked(): input parameter is undefined or null"));if(typeof s!="string")return c(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));if(gp(a),a.hooks&&(a.hooks.options=a),f){var d=a.highlight,v;try{a.hooks&&(s=a.hooks.preprocess(s)),v=o(s,a)}catch(F){return c(F)}var y=function(B){var L;if(!B)try{a.walkTokens&&fe.walkTokens(v,a.walkTokens),L=l(v,a),a.hooks&&(L=a.hooks.postprocess(L))}catch(T){B=T}return a.highlight=d,B?c(B):f(null,L)};if(!d||d.length<3||(delete a.highlight,!v.length))return y();var x=0;fe.walkTokens(v,function(F){F.type==="code"&&(x++,setTimeout(function(){d(F.text,F.lang,function(B,L){if(B)return y(B);L!=null&&L!==F.text&&(F.text=L,F.escaped=!0),x--,x===0&&y()})},0))}),x===0&&y();return}if(a.async)return Promise.resolve(a.hooks?a.hooks.preprocess(s):s).then(function(F){return o(F,a)}).then(function(F){return a.walkTokens?Promise.all(fe.walkTokens(F,a.walkTokens)).then(function(){return F}):F}).then(function(F){return l(F,a)}).then(function(F){return a.hooks?a.hooks.postprocess(F):F}).catch(c);try{a.hooks&&(s=a.hooks.preprocess(s));var D=o(s,a);a.walkTokens&&fe.walkTokens(D,a.walkTokens);var S=l(D,a);return a.hooks&&(S=a.hooks.postprocess(S)),S}catch(F){return c(F)}}}function fe(o,l,s){return Kf(yi.lex,xi.parse)(o,l,s)}fe.options=fe.setOptions=function(o){return fe.defaults=_t({},fe.defaults,o),rp(fe.defaults),fe};fe.getDefaults=cl;fe.defaults=_e.defaults;fe.use=function(){for(var o=fe.defaults.extensions||{renderers:{},childTokens:{}},l=arguments.length,s=new Array(l),a=0;a{"use strict";var wi=At();ef();rf();af();ll();sl();bf();wf();kf();Af();Lf();al();var Ap=Nf(),pl=Yf().marked,Jf=/Mac/.test(navigator.platform),Fp=new RegExp(/()+?/g),fn={toggleBold:ho,toggleItalic:po,drawLink:Eo,toggleHeadingSmaller:cn,toggleHeadingBigger:bo,drawImage:Ao,toggleBlockquote:vo,toggleOrderedList:Do,toggleUnorderedList:Co,toggleCheckList:ko,toggleCodeBlock:mo,togglePreview:Bo,toggleStrikethrough:go,toggleHeading1:yo,toggleHeading2:xo,toggleHeading3:wo,toggleHeading4:ml,toggleHeading5:vl,toggleHeading6:bl,cleanBlock:So,drawTable:Fo,drawHorizontalRule:To,undo:Lo,redo:Mo,toggleSideBySide:Ci,toggleFullScreen:jr},Tp={toggleBold:"Cmd-B",toggleItalic:"Cmd-I",drawLink:"Cmd-K",toggleHeadingSmaller:"Cmd-H",toggleHeadingBigger:"Shift-Cmd-H",toggleHeading1:"Ctrl+Alt+1",toggleHeading2:"Ctrl+Alt+2",toggleHeading3:"Ctrl+Alt+3",toggleHeading4:"Ctrl+Alt+4",toggleHeading5:"Ctrl+Alt+5",toggleHeading6:"Ctrl+Alt+6",cleanBlock:"Cmd-E",drawImage:"Cmd-Alt-I",toggleBlockquote:"Cmd-'",toggleOrderedList:"Cmd-Alt-L",toggleUnorderedList:"Cmd-L",toggleCheckList:"Shift-Cmd-L",toggleCodeBlock:"Cmd-Alt-C",togglePreview:"Cmd-P",toggleSideBySide:"F9",toggleFullScreen:"F11"},Lp=function(o){for(var l in fn)if(fn[l]===o)return l;return null},gl=function(){var o=!1;return function(l){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(l)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(l.substr(0,4)))&&(o=!0)}(navigator.userAgent||navigator.vendor||window.opera),o};function Mp(o){for(var l;(l=Fp.exec(o))!==null;){var s=l[0];if(s.indexOf("target=")===-1){var a=s.replace(/>$/,' target="_blank">');o=o.replace(s,a)}}return o}function Bp(o){for(var l=new DOMParser,s=l.parseFromString(o,"text/html"),a=s.getElementsByTagName("li"),f=0;f0){for(var F=document.createElement("i"),B=0;B=0&&(x=c.getLineHandle(S),!s(x));S--);var N=c.getTokenAt({line:S,ch:1}),z=a(N).fencedChars,O,I,W,j;s(c.getLineHandle(d.line))?(O="",I=d.line):s(c.getLineHandle(d.line-1))?(O="",I=d.line-1):(O=z+` -`,I=d.line),s(c.getLineHandle(v.line))?(W="",j=v.line,v.ch===0&&(j+=1)):v.ch!==0&&s(c.getLineHandle(v.line+1))?(W="",j=v.line+1):(W=z+` -`,j=v.line+1),v.ch===0&&(j-=1),c.operation(function(){c.replaceRange(W,{line:j,ch:0},{line:j+(W?0:1),ch:0}),c.replaceRange(O,{line:I,ch:0},{line:I+(O?0:1),ch:0})}),c.setSelection({line:I+(O?1:0),ch:0},{line:j+(O?1:-1),ch:0}),c.focus()}else{var K=d.line;if(s(c.getLineHandle(d.line))&&(f(c,d.line+1)==="fenced"?(S=d.line,K=d.line+1):(F=d.line,K=d.line-1)),S===void 0)for(S=K;S>=0&&(x=c.getLineHandle(S),!s(x));S--);if(F===void 0)for(B=c.lineCount(),F=K;F=0;S--)if(x=c.getLineHandle(S),!x.text.match(/^\s*$/)&&f(c,S,x)!=="indented"){S+=1;break}for(B=c.lineCount(),F=d.line;F\s+/,"unordered-list":a,"ordered-list":a,"check-list":/^(\s*)(- \[[ xX]])(\s+)/},y=function(N,z){var O={quote:">","unordered-list":s,"ordered-list":"%%i.","check-list":"- [ ]"};return O[N].replace("%%i",z)},x=function(N,z){var O={quote:">","unordered-list":"\\"+s,"ordered-list":"\\d+.","check-list":"- \\[[ xX]]"},I=new RegExp(O[N]);return z&&I.test(z)},D=function(N,z,O){var I=a.exec(z),W=y(N,S);return I!==null?(x(N,I[2])&&(W=""),z=I[1]+W+I[3]+z.replace(f,"").replace(v[N],"$1")):O==!1&&(z=W+" "+z),z},S=1,F=["unordered-list","ordered-list","check-list"],B=Object.keys(h)[0];if(!F.includes(B)){var L=o.getLine(c.line);/^\s*- \[[ xX]]\s/.test(L)?B="check-list":/^\s*\d+\.\s/.test(L)?B="ordered-list":/^\s*[*\-+]\s/.test(L)&&(B="unordered-list")}for(var T=c.line;T<=d.line;T++)(function(N){var z=o.getLine(N);h[l]?z=z.replace(v[l],"$1"):F.includes(B)&&F.includes(l)?(z=z.replace(v[B],"$1"),z=D(l,z,!1),S+=1):(z=D(l,z,!1),S+=1),o.replaceRange(z,{line:N,ch:0},{line:N,ch:99999999999999})})(T);o.focus()}}function tc(o,l,s,a){if(!(!o.codemirror||o.isPreviewActive())){var f=o.codemirror,h=Sr(f),c=h[l];if(!c){Gr(f,c,s,a);return}var d=f.getCursor("start"),v=f.getCursor("end"),y=f.getLine(d.line),x=y.slice(0,d.ch),D=y.slice(d.ch);l=="link"?x=x.replace(/(.*)[^!]\[/,"$1"):l=="image"&&(x=x.replace(/(.*)!\[$/,"$1")),D=D.replace(/]\(.*?\)/,""),f.replaceRange(x+D,{line:d.line,ch:0},{line:d.line,ch:99999999999999}),d.ch-=s[0].length,d!==v&&(v.ch-=s[0].length),f.setSelection(d,v),f.focus()}}function xl(o,l,s,a){if(!(!o.codemirror||o.isPreviewActive())){a=typeof a>"u"?s:a;var f=o.codemirror,h=Sr(f),c,d=s,v=a,y=f.getCursor("start"),x=f.getCursor("end");h[l]?(c=f.getLine(y.line),d=c.slice(0,y.ch),v=c.slice(y.ch),l=="bold"?(d=d.replace(/(\*\*|__)(?![\s\S]*(\*\*|__))/,""),v=v.replace(/(\*\*|__)/,"")):l=="italic"?(d=d.replace(/(\*|_)(?![\s\S]*(\*|_))/,""),v=v.replace(/(\*|_)/,"")):l=="strikethrough"&&(d=d.replace(/(\*\*|~~)(?![\s\S]*(\*\*|~~))/,""),v=v.replace(/(\*\*|~~)/,"")),f.replaceRange(d+v,{line:y.line,ch:0},{line:y.line,ch:99999999999999}),l=="bold"||l=="strikethrough"?(y.ch-=2,y!==x&&(x.ch-=2)):l=="italic"&&(y.ch-=1,y!==x&&(x.ch-=1))):(c=f.getSelection(),l=="bold"?(c=c.split("**").join(""),c=c.split("__").join("")):l=="italic"?(c=c.split("*").join(""),c=c.split("_").join("")):l=="strikethrough"&&(c=c.split("~~").join("")),f.replaceSelection(d+c+v),y.ch+=s.length,x.ch=y.ch+c.length),f.setSelection(y,x),f.focus()}}function Op(o){if(!o.getWrapperElement().lastChild.classList.contains("editor-preview-active"))for(var l=o.getCursor("start"),s=o.getCursor("end"),a,f=l.line;f<=s.line;f++)a=o.getLine(f),a=a.replace(/^[ ]*([# ]+|\*|-|[> ]+|[0-9]+(.|\)))[ ]*/,""),o.replaceRange(a,{line:f,ch:0},{line:f,ch:99999999999999})}function co(o,l){if(Math.abs(o)<1024)return""+o+l[0];var s=0;do o/=1024,++s;while(Math.abs(o)>=1024&&s=19968?a+=s[f].length:a+=1;return a}var Be={bold:"fa fa-bold",italic:"fa fa-italic",strikethrough:"fa fa-strikethrough",heading:"fa fa-header fa-heading","heading-smaller":"fa fa-header fa-heading header-smaller","heading-bigger":"fa fa-header fa-heading header-bigger","heading-1":"fa fa-header fa-heading header-1","heading-2":"fa fa-header fa-heading header-2","heading-3":"fa fa-header fa-heading header-3",code:"fa fa-code",quote:"fa fa-quote-left","ordered-list":"fa fa-list-ol","unordered-list":"fa fa-list-ul","check-list":"fa fa-check-square-o","clean-block":"fa fa-eraser",link:"fa fa-link",image:"fa fa-image","upload-image":"fa fa-image",table:"fa fa-table","horizontal-rule":"fa fa-minus",preview:"fa fa-eye","side-by-side":"fa fa-columns",fullscreen:"fa fa-arrows-alt",guide:"fa fa-question-circle",undo:"fa fa-undo",redo:"fa fa-repeat fa-redo"},Ur={bold:{name:"bold",action:ho,className:Be.bold,title:"Bold",default:!0},italic:{name:"italic",action:po,className:Be.italic,title:"Italic",default:!0},strikethrough:{name:"strikethrough",action:go,className:Be.strikethrough,title:"Strikethrough"},heading:{name:"heading",action:cn,className:Be.heading,title:"Heading",default:!0},"heading-smaller":{name:"heading-smaller",action:cn,className:Be["heading-smaller"],title:"Smaller Heading"},"heading-bigger":{name:"heading-bigger",action:bo,className:Be["heading-bigger"],title:"Bigger Heading"},"heading-1":{name:"heading-1",action:yo,className:Be["heading-1"],title:"Big Heading"},"heading-2":{name:"heading-2",action:xo,className:Be["heading-2"],title:"Medium Heading"},"heading-3":{name:"heading-3",action:wo,className:Be["heading-3"],title:"Small Heading"},"separator-1":{name:"separator-1"},code:{name:"code",action:mo,className:Be.code,title:"Code"},quote:{name:"quote",action:vo,className:Be.quote,title:"Quote",default:!0},"unordered-list":{name:"unordered-list",action:Co,className:Be["unordered-list"],title:"Generic List",default:!0},"ordered-list":{name:"ordered-list",action:Do,className:Be["ordered-list"],title:"Numbered List",default:!0},"check-list":{name:"check-list",action:ko,className:Be["check-list"],title:"Check List",default:!0},"clean-block":{name:"clean-block",action:So,className:Be["clean-block"],title:"Clean block"},"separator-2":{name:"separator-2"},link:{name:"link",action:Eo,className:Be.link,title:"Create Link",default:!0},image:{name:"image",action:Ao,className:Be.image,title:"Insert Image",default:!0},"upload-image":{name:"upload-image",action:yl,className:Be["upload-image"],title:"Import an image"},table:{name:"table",action:Fo,className:Be.table,title:"Insert Table"},"horizontal-rule":{name:"horizontal-rule",action:To,className:Be["horizontal-rule"],title:"Insert Horizontal Line"},"separator-3":{name:"separator-3"},preview:{name:"preview",action:Bo,className:Be.preview,noDisable:!0,title:"Toggle Preview",default:!0},"side-by-side":{name:"side-by-side",action:Ci,className:Be["side-by-side"],noDisable:!0,noMobile:!0,title:"Toggle Side by Side",default:!0},fullscreen:{name:"fullscreen",action:jr,className:Be.fullscreen,noDisable:!0,noMobile:!0,title:"Toggle Fullscreen",default:!0},"separator-4":{name:"separator-4"},guide:{name:"guide",action:"https://www.markdownguide.org/basic-syntax/",className:Be.guide,noDisable:!0,title:"Markdown Guide",default:!0},"separator-5":{name:"separator-5"},undo:{name:"undo",action:Lo,className:Be.undo,noDisable:!0,title:"Undo"},redo:{name:"redo",action:Mo,className:Be.redo,noDisable:!0,title:"Redo"}},Ip={link:["[","](#url#)"],image:["![","](#url#)"],uploadedImage:["![](#url#)",""],table:["",` +`,Ee--),Gr(H,!1,[w,ee]),H.setSelection({line:pe,ch:0},{line:Ee,ch:0})}var c=o.codemirror,d=c.getCursor("start"),v=c.getCursor("end"),y=c.getTokenAt({line:d.line,ch:d.ch||1}),x=c.getLineHandle(d.line),D=f(c,d.line,x,y),S,F,B;if(D==="single"){var L=x.text.slice(0,d.ch).replace("`",""),T=x.text.slice(d.ch).replace("`","");c.replaceRange(L+T,{line:d.line,ch:0},{line:d.line,ch:99999999999999}),d.ch--,d!==v&&v.ch--,c.setSelection(d,v),c.focus()}else if(D==="fenced")if(d.line!==v.line||d.ch!==v.ch){for(S=d.line;S>=0&&(x=c.getLineHandle(S),!s(x));S--);var N=c.getTokenAt({line:S,ch:1}),z=a(N).fencedChars,O,I,U,j;s(c.getLineHandle(d.line))?(O="",I=d.line):s(c.getLineHandle(d.line-1))?(O="",I=d.line-1):(O=z+` +`,I=d.line),s(c.getLineHandle(v.line))?(U="",j=v.line,v.ch===0&&(j+=1)):v.ch!==0&&s(c.getLineHandle(v.line+1))?(U="",j=v.line+1):(U=z+` +`,j=v.line+1),v.ch===0&&(j-=1),c.operation(function(){c.replaceRange(U,{line:j,ch:0},{line:j+(U?0:1),ch:0}),c.replaceRange(O,{line:I,ch:0},{line:I+(O?0:1),ch:0})}),c.setSelection({line:I+(O?1:0),ch:0},{line:j+(O?1:-1),ch:0}),c.focus()}else{var K=d.line;if(s(c.getLineHandle(d.line))&&(f(c,d.line+1)==="fenced"?(S=d.line,K=d.line+1):(F=d.line,K=d.line-1)),S===void 0)for(S=K;S>=0&&(x=c.getLineHandle(S),!s(x));S--);if(F===void 0)for(B=c.lineCount(),F=K;F=0;S--)if(x=c.getLineHandle(S),!x.text.match(/^\s*$/)&&f(c,S,x)!=="indented"){S+=1;break}for(B=c.lineCount(),F=d.line;F\s+/,"unordered-list":a,"ordered-list":a,"check-list":/^(\s*)(- \[[ xX]])(\s+)/},y=function(N,z){var O={quote:">","unordered-list":s,"ordered-list":"%%i.","check-list":"- [ ]"};return O[N].replace("%%i",z)},x=function(N,z){var O={quote:">","unordered-list":"\\"+s,"ordered-list":"\\d+.","check-list":"- \\[[ xX]]"},I=new RegExp(O[N]);return z&&I.test(z)},D=function(N,z,O){var I=a.exec(z),U=y(N,S);return I!==null?(x(N,I[2])&&(U=""),z=I[1]+U+I[3]+z.replace(f,"").replace(v[N],"$1")):O==!1&&(z=U+" "+z),z},S=1,F=["unordered-list","ordered-list","check-list"],B=Object.keys(h)[0];if(!F.includes(B)){var L=o.getLine(c.line);/^\s*- \[[ xX]]\s/.test(L)?B="check-list":/^\s*\d+\.\s/.test(L)?B="ordered-list":/^\s*[*\-+]\s/.test(L)&&(B="unordered-list")}for(var T=c.line;T<=d.line;T++)(function(N){var z=o.getLine(N);h[l]?z=z.replace(v[l],"$1"):F.includes(B)&&F.includes(l)?(z=z.replace(v[B],"$1"),z=D(l,z,!1),S+=1):(z=D(l,z,!1),S+=1),o.replaceRange(z,{line:N,ch:0},{line:N,ch:99999999999999})})(T);o.focus()}}function tc(o,l,s,a){if(!(!o.codemirror||o.isPreviewActive())){var f=o.codemirror,h=Sr(f),c=h[l];if(!c){Gr(f,c,s,a);return}var d=f.getCursor("start"),v=f.getCursor("end"),y=f.getLine(d.line),x=y.slice(0,d.ch),D=y.slice(d.ch);l=="link"?x=x.replace(/(.*)[^!]\[/,"$1"):l=="image"&&(x=x.replace(/(.*)!\[$/,"$1")),D=D.replace(/]\(.*?\)/,""),f.replaceRange(x+D,{line:d.line,ch:0},{line:d.line,ch:99999999999999}),d.ch-=s[0].length,d!==v&&(v.ch-=s[0].length),f.setSelection(d,v),f.focus()}}function xl(o,l,s,a){if(!(!o.codemirror||o.isPreviewActive())){a=typeof a>"u"?s:a;var f=o.codemirror,h=Sr(f),c,d=s,v=a,y=f.getCursor("start"),x=f.getCursor("end");h[l]?(c=f.getLine(y.line),d=c.slice(0,y.ch),v=c.slice(y.ch),l=="bold"?(d=d.replace(/(\*\*|__)(?![\s\S]*(\*\*|__))/,""),v=v.replace(/(\*\*|__)/,"")):l=="italic"?(d=d.replace(/(\*|_)(?![\s\S]*(\*|_))/,""),v=v.replace(/(\*|_)/,"")):l=="strikethrough"&&(d=d.replace(/(\*\*|~~)(?![\s\S]*(\*\*|~~))/,""),v=v.replace(/(\*\*|~~)/,"")),f.replaceRange(d+v,{line:y.line,ch:0},{line:y.line,ch:99999999999999}),l=="bold"||l=="strikethrough"?(y.ch-=2,y!==x&&(x.ch-=2)):l=="italic"&&(y.ch-=1,y!==x&&(x.ch-=1))):(c=f.getSelection(),l=="bold"?(c=c.split("**").join(""),c=c.split("__").join("")):l=="italic"?(c=c.split("*").join(""),c=c.split("_").join("")):l=="strikethrough"&&(c=c.split("~~").join("")),f.replaceSelection(d+c+v),y.ch+=s.length,x.ch=y.ch+c.length),f.setSelection(y,x),f.focus()}}function Op(o){if(!o.getWrapperElement().lastChild.classList.contains("editor-preview-active"))for(var l=o.getCursor("start"),s=o.getCursor("end"),a,f=l.line;f<=s.line;f++)a=o.getLine(f),a=a.replace(/^[ ]*([# ]+|\*|-|[> ]+|[0-9]+(.|\)))[ ]*/,""),o.replaceRange(a,{line:f,ch:0},{line:f,ch:99999999999999})}function co(o,l){if(Math.abs(o)<1024)return""+o+l[0];var s=0;do o/=1024,++s;while(Math.abs(o)>=1024&&s=19968?a+=s[f].length:a+=1;return a}var Be={bold:"fa fa-bold",italic:"fa fa-italic",strikethrough:"fa fa-strikethrough",heading:"fa fa-header fa-heading","heading-smaller":"fa fa-header fa-heading header-smaller","heading-bigger":"fa fa-header fa-heading header-bigger","heading-1":"fa fa-header fa-heading header-1","heading-2":"fa fa-header fa-heading header-2","heading-3":"fa fa-header fa-heading header-3",code:"fa fa-code",quote:"fa fa-quote-left","ordered-list":"fa fa-list-ol","unordered-list":"fa fa-list-ul","check-list":"fa fa-check-square-o","clean-block":"fa fa-eraser",link:"fa fa-link",image:"fa fa-image","upload-image":"fa fa-image",table:"fa fa-table","horizontal-rule":"fa fa-minus",preview:"fa fa-eye","side-by-side":"fa fa-columns",fullscreen:"fa fa-arrows-alt",guide:"fa fa-question-circle",undo:"fa fa-undo",redo:"fa fa-repeat fa-redo"},Ur={bold:{name:"bold",action:ho,className:Be.bold,title:"Bold",default:!0},italic:{name:"italic",action:po,className:Be.italic,title:"Italic",default:!0},strikethrough:{name:"strikethrough",action:go,className:Be.strikethrough,title:"Strikethrough"},heading:{name:"heading",action:cn,className:Be.heading,title:"Heading",default:!0},"heading-smaller":{name:"heading-smaller",action:cn,className:Be["heading-smaller"],title:"Smaller Heading"},"heading-bigger":{name:"heading-bigger",action:bo,className:Be["heading-bigger"],title:"Bigger Heading"},"heading-1":{name:"heading-1",action:yo,className:Be["heading-1"],title:"Big Heading"},"heading-2":{name:"heading-2",action:xo,className:Be["heading-2"],title:"Medium Heading"},"heading-3":{name:"heading-3",action:wo,className:Be["heading-3"],title:"Small Heading"},"separator-1":{name:"separator-1"},code:{name:"code",action:mo,className:Be.code,title:"Code"},quote:{name:"quote",action:vo,className:Be.quote,title:"Quote",default:!0},"unordered-list":{name:"unordered-list",action:Co,className:Be["unordered-list"],title:"Generic List",default:!0},"ordered-list":{name:"ordered-list",action:Do,className:Be["ordered-list"],title:"Numbered List",default:!0},"check-list":{name:"check-list",action:ko,className:Be["check-list"],title:"Check List",default:!0},"clean-block":{name:"clean-block",action:So,className:Be["clean-block"],title:"Clean block"},"separator-2":{name:"separator-2"},link:{name:"link",action:Eo,className:Be.link,title:"Create Link",default:!0},image:{name:"image",action:Ao,className:Be.image,title:"Insert Image",default:!0},"upload-image":{name:"upload-image",action:yl,className:Be["upload-image"],title:"Import an image"},table:{name:"table",action:Fo,className:Be.table,title:"Insert Table"},"horizontal-rule":{name:"horizontal-rule",action:To,className:Be["horizontal-rule"],title:"Insert Horizontal Line"},"separator-3":{name:"separator-3"},preview:{name:"preview",action:Bo,className:Be.preview,noDisable:!0,title:"Toggle Preview",default:!0},"side-by-side":{name:"side-by-side",action:Ci,className:Be["side-by-side"],noDisable:!0,noMobile:!0,title:"Toggle Side by Side",default:!0},fullscreen:{name:"fullscreen",action:jr,className:Be.fullscreen,noDisable:!0,noMobile:!0,title:"Toggle Fullscreen",default:!0},"separator-4":{name:"separator-4"},guide:{name:"guide",action:"https://www.markdownguide.org/basic-syntax/",className:Be.guide,noDisable:!0,title:"Markdown Guide",default:!0},"separator-5":{name:"separator-5"},undo:{name:"undo",action:Lo,className:Be.undo,noDisable:!0,title:"Undo"},redo:{name:"redo",action:Mo,className:Be.redo,noDisable:!0,title:"Redo"}},Ip={link:["[","](#url#)"],image:["![","](#url#)"],uploadedImage:["![](#url#)",""],table:["",` | Column 1 | Column 2 | Column 3 | | -------- | -------- | -------- | @@ -92,7 +92,7 @@ Please report this to https://github.com/markedjs/marked.`,o){var f="

    An error ----- `]},Hp={link:"URL for the link:",image:"URL of the image:"},Pp={locale:"en-US",format:{hour:"2-digit",minute:"2-digit"}},qp={bold:"**",code:"```",italic:"*"},Rp={sbInit:"Attach files by drag and dropping or pasting from clipboard.",sbOnDragEnter:"Drop image to upload it.",sbOnDrop:"Uploading image #images_names#...",sbProgress:"Uploading #file_name#: #progress#%",sbOnUploaded:"Uploaded #image_name#",sizeUnits:" B, KB, MB"},Wp={noFileGiven:"You must select a file.",typeNotAllowed:"This image type is not allowed.",fileTooLarge:`Image #image_name# is too big (#image_size#). -Maximum file size is #image_max_size#.`,importError:"Something went wrong when uploading the image #image_name#."};function re(o){o=o||{},o.parent=this;var l=!0;if(o.autoDownloadFontAwesome===!1&&(l=!1),o.autoDownloadFontAwesome!==!0)for(var s=document.styleSheets,a=0;a-1&&(l=!1);if(l){var f=document.createElement("link");f.rel="stylesheet",f.href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css",document.getElementsByTagName("head")[0].appendChild(f)}if(o.element)this.element=o.element;else if(o.element===null){console.log("EasyMDE: Error. No element was found.");return}if(o.toolbar===void 0){o.toolbar=[];for(var h in Ur)Object.prototype.hasOwnProperty.call(Ur,h)&&(h.indexOf("separator-")!=-1&&o.toolbar.push("|"),(Ur[h].default===!0||o.showIcons&&o.showIcons.constructor===Array&&o.showIcons.indexOf(h)!=-1)&&o.toolbar.push(h))}if(Object.prototype.hasOwnProperty.call(o,"previewClass")||(o.previewClass="editor-preview"),Object.prototype.hasOwnProperty.call(o,"status")||(o.status=["autosave","lines","words","cursor"],o.uploadImage&&o.status.unshift("upload-image")),o.previewRender||(o.previewRender=function(d){return this.parent.markdown(d)}),o.parsingConfig=sr({highlightFormatting:!0},o.parsingConfig||{}),o.insertTexts=sr({},Ip,o.insertTexts||{}),o.promptTexts=sr({},Hp,o.promptTexts||{}),o.blockStyles=sr({},qp,o.blockStyles||{}),o.autosave!=null&&(o.autosave.timeFormat=sr({},Pp,o.autosave.timeFormat||{})),o.iconClassMap=sr({},Be,o.iconClassMap||{}),o.shortcuts=sr({},Tp,o.shortcuts||{}),o.maxHeight=o.maxHeight||void 0,o.direction=o.direction||"ltr",typeof o.maxHeight<"u"?o.minHeight=o.maxHeight:o.minHeight=o.minHeight||"300px",o.errorCallback=o.errorCallback||function(d){alert(d)},o.uploadImage=o.uploadImage||!1,o.imageMaxSize=o.imageMaxSize||2097152,o.imageAccept=o.imageAccept||"image/png, image/jpeg, image/gif, image/avif",o.imageTexts=sr({},Rp,o.imageTexts||{}),o.errorMessages=sr({},Wp,o.errorMessages||{}),o.imagePathAbsolute=o.imagePathAbsolute||!1,o.imageCSRFName=o.imageCSRFName||"csrfmiddlewaretoken",o.imageCSRFHeader=o.imageCSRFHeader||!1,o.imageInputName=o.imageInputName||"image",o.autosave!=null&&o.autosave.unique_id!=null&&o.autosave.unique_id!=""&&(o.autosave.uniqueId=o.autosave.unique_id),o.overlayMode&&o.overlayMode.combine===void 0&&(o.overlayMode.combine=!0),this.options=o,this.render(),o.initialValue&&(!this.options.autosave||this.options.autosave.foundSavedValue!==!0)&&this.value(o.initialValue),o.uploadImage){var c=this;this.codemirror.on("dragenter",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbOnDragEnter),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("dragend",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbInit),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("dragleave",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbInit),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("dragover",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbOnDragEnter),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("drop",function(d,v){v.stopPropagation(),v.preventDefault(),o.imageUploadFunction?c.uploadImagesUsingCustomFunction(o.imageUploadFunction,v.dataTransfer.files):c.uploadImages(v.dataTransfer.files)}),this.codemirror.on("paste",function(d,v){o.imageUploadFunction?c.uploadImagesUsingCustomFunction(o.imageUploadFunction,v.clipboardData.files):c.uploadImages(v.clipboardData.files)})}}re.prototype.uploadImages=function(o,l,s){if(o.length!==0){for(var a=[],f=0;f=2){var O=z[1];if(l.imagesPreviewHandler){var I=l.imagesPreviewHandler(z[1]);typeof I=="string"&&(O=I)}if(window.EMDEimagesCache[O])F(N,window.EMDEimagesCache[O]);else{window.EMDEimagesCache[O]={};var W=document.createElement("img");W.onload=function(){window.EMDEimagesCache[O]={naturalWidth:W.naturalWidth,naturalHeight:W.naturalHeight,url:O},F(N,window.EMDEimagesCache[O])},W.src=O}}}})}this.codemirror.on("update",function(){B()}),this.gui.sideBySide=this.createSideBySide(),this._rendered=this.element,(l.autofocus===!0||o.autofocus)&&this.codemirror.focus();var L=this.codemirror;setTimeout(function(){L.refresh()}.bind(L),0)};re.prototype.cleanup=function(){document.removeEventListener("keydown",this.documentOnKeyDown)};function ic(){if(typeof localStorage=="object")try{localStorage.setItem("smde_localStorage",1),localStorage.removeItem("smde_localStorage")}catch{return!1}else return!1;return!0}re.prototype.autosave=function(){if(ic()){var o=this;if(this.options.autosave.uniqueId==null||this.options.autosave.uniqueId==""){console.log("EasyMDE: You must set a uniqueId to use the autosave feature");return}this.options.autosave.binded!==!0&&(o.element.form!=null&&o.element.form!=null&&o.element.form.addEventListener("submit",function(){clearTimeout(o.autosaveTimeoutId),o.autosaveTimeoutId=void 0,localStorage.removeItem("smde_"+o.options.autosave.uniqueId)}),this.options.autosave.binded=!0),this.options.autosave.loaded!==!0&&(typeof localStorage.getItem("smde_"+this.options.autosave.uniqueId)=="string"&&localStorage.getItem("smde_"+this.options.autosave.uniqueId)!=""&&(this.codemirror.setValue(localStorage.getItem("smde_"+this.options.autosave.uniqueId)),this.options.autosave.foundSavedValue=!0),this.options.autosave.loaded=!0);var l=o.value();l!==""?localStorage.setItem("smde_"+this.options.autosave.uniqueId,l):localStorage.removeItem("smde_"+this.options.autosave.uniqueId);var s=document.getElementById("autosaved");if(s!=null&&s!=null&&s!=""){var a=new Date,f=new Intl.DateTimeFormat([this.options.autosave.timeFormat.locale,"en-US"],this.options.autosave.timeFormat.format).format(a),h=this.options.autosave.text==null?"Autosaved: ":this.options.autosave.text;s.innerHTML=h+f}}else console.log("EasyMDE: localStorage not available, cannot autosave")};re.prototype.clearAutosavedValue=function(){if(ic()){if(this.options.autosave==null||this.options.autosave.uniqueId==null||this.options.autosave.uniqueId==""){console.log("EasyMDE: You must set a uniqueId to clear the autosave value");return}localStorage.removeItem("smde_"+this.options.autosave.uniqueId)}else console.log("EasyMDE: localStorage not available, cannot autosave")};re.prototype.openBrowseFileWindow=function(o,l){var s=this,a=this.gui.toolbar.getElementsByClassName("imageInput")[0];a.click();function f(h){s.options.imageUploadFunction?s.uploadImagesUsingCustomFunction(s.options.imageUploadFunction,h.target.files):s.uploadImages(h.target.files,o,l),a.removeEventListener("change",f)}a.addEventListener("change",f)};re.prototype.uploadImage=function(o,l,s){var a=this;l=l||function(y){ec(a,y)};function f(v){a.updateStatusBar("upload-image",v),setTimeout(function(){a.updateStatusBar("upload-image",a.options.imageTexts.sbInit)},1e4),s&&typeof s=="function"&&s(v),a.options.errorCallback(v)}function h(v){var y=a.options.imageTexts.sizeUnits.split(",");return v.replace("#image_name#",o.name).replace("#image_size#",co(o.size,y)).replace("#image_max_size#",co(a.options.imageMaxSize,y))}if(o.size>this.options.imageMaxSize){f(h(this.options.errorMessages.fileTooLarge));return}var c=new FormData;c.append("image",o),a.options.imageCSRFToken&&!a.options.imageCSRFHeader&&c.append(a.options.imageCSRFName,a.options.imageCSRFToken);var d=new XMLHttpRequest;d.upload.onprogress=function(v){if(v.lengthComputable){var y=""+Math.round(v.loaded*100/v.total);a.updateStatusBar("upload-image",a.options.imageTexts.sbProgress.replace("#file_name#",o.name).replace("#progress#",y))}},d.open("POST",this.options.imageUploadEndpoint),a.options.imageCSRFToken&&a.options.imageCSRFHeader&&d.setRequestHeader(a.options.imageCSRFName,a.options.imageCSRFToken),d.onload=function(){try{var v=JSON.parse(this.responseText)}catch{console.error("EasyMDE: The server did not return a valid json."),f(h(a.options.errorMessages.importError));return}this.status===200&&v&&!v.error&&v.data&&v.data.filePath?l((a.options.imagePathAbsolute?"":window.location.origin+"/")+v.data.filePath):v.error&&v.error in a.options.errorMessages?f(h(a.options.errorMessages[v.error])):v.error?f(h(v.error)):(console.error("EasyMDE: Received an unexpected response after uploading the image."+this.status+" ("+this.statusText+")"),f(h(a.options.errorMessages.importError)))},d.onerror=function(v){console.error("EasyMDE: An unexpected error occurred when trying to upload the image."+v.target.status+" ("+v.target.statusText+")"),f(a.options.errorMessages.importError)},d.send(c)};re.prototype.uploadImageUsingCustomFunction=function(o,l){var s=this;function a(c){ec(s,c)}function f(c){var d=h(c);s.updateStatusBar("upload-image",d),setTimeout(function(){s.updateStatusBar("upload-image",s.options.imageTexts.sbInit)},1e4),s.options.errorCallback(d)}function h(c){var d=s.options.imageTexts.sizeUnits.split(",");return c.replace("#image_name#",l.name).replace("#image_size#",co(l.size,d)).replace("#image_max_size#",co(s.options.imageMaxSize,d))}o.apply(this,[l,a,f])};re.prototype.setPreviewMaxHeight=function(){var o=this.codemirror,l=o.getWrapperElement(),s=l.nextSibling,a=parseInt(window.getComputedStyle(l).paddingTop),f=parseInt(window.getComputedStyle(l).borderTopWidth),h=parseInt(this.options.maxHeight),c=h+a*2+f*2,d=c.toString()+"px";s.style.height=d};re.prototype.createSideBySide=function(){var o=this.codemirror,l=o.getWrapperElement(),s=l.nextSibling;if(!s||!s.classList.contains("editor-preview-side")){if(s=document.createElement("div"),s.className="editor-preview-side",this.options.previewClass)if(Array.isArray(this.options.previewClass))for(var a=0;a"&&(l=l.substring(1)),o)try{if(o.matches)return o.matches(l);if(o.msMatchesSelector)return o.msMatchesSelector(l);if(o.webkitMatchesSelector)return o.webkitMatchesSelector(l)}catch{return!1}return!1}}function vc(o){return o.host&&o!==document&&o.host.nodeType&&o.host!==o?o.host:o.parentNode}function Gt(o,l,s,a){if(o){s=s||document;do{if(l!=null&&(l[0]===">"?o.parentNode===s&&Wo(o,l):Wo(o,l))||a&&o===s)return o;if(o===s)break}while(o=vc(o))}return null}var sc=/\s+/g;function zt(o,l,s){if(o&&l)if(o.classList)o.classList[s?"add":"remove"](l);else{var a=(" "+o.className+" ").replace(sc," ").replace(" "+l+" "," ");o.className=(a+(s?" "+l:"")).replace(sc," ")}}function pe(o,l,s){var a=o&&o.style;if(a){if(s===void 0)return document.defaultView&&document.defaultView.getComputedStyle?s=document.defaultView.getComputedStyle(o,""):o.currentStyle&&(s=o.currentStyle),l===void 0?s:s[l];!(l in a)&&l.indexOf("webkit")===-1&&(l="-webkit-"+l),a[l]=s+(typeof s=="string"?"":"px")}}function Ai(o,l){var s="";if(typeof o=="string")s=o;else do{var a=pe(o,"transform");a&&a!=="none"&&(s=a+" "+s)}while(!l&&(o=o.parentNode));var f=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return f&&new f(s)}function bc(o,l,s){if(o){var a=o.getElementsByTagName(l),f=0,h=a.length;if(s)for(;f=h:c=f<=h,!c)return a;if(a===$t())break;a=Tr(a,!1)}return!1}function Fi(o,l,s,a){for(var f=0,h=0,c=o.children;h2&&arguments[2]!==void 0?arguments[2]:{},f=a.evt,h=jp(a,r0);wn.pluginEvent.bind(ge)(l,s,er({dragEl:$,parentEl:Ue,ghostEl:xe,rootEl:He,nextEl:Yr,lastDownEl:Ho,cloneEl:Re,cloneHidden:Fr,dragStarted:dn,putSortable:ft,activeSortable:ge.active,originalEvent:f,oldIndex:Ei,oldDraggableIndex:vn,newIndex:Nt,newDraggableIndex:Ar,hideGhostForTarget:Ec,unhideGhostForTarget:Ac,cloneNowHidden:function(){Fr=!0},cloneNowShown:function(){Fr=!1},dispatchSortableEvent:function(d){kt({sortable:s,name:d,originalEvent:f})}},h))};function kt(o){t0(er({putSortable:ft,cloneEl:Re,targetEl:$,rootEl:He,oldIndex:Ei,oldDraggableIndex:vn,newIndex:Nt,newDraggableIndex:Ar},o))}var $,Ue,xe,He,Yr,Ho,Re,Fr,Ei,Nt,vn,Ar,zo,ft,Si=!1,Uo=!1,jo=[],Xr,jt,Dl,kl,cc,dc,dn,ki,bn,yn=!1,No=!1,Po,mt,Sl=[],Ml=!1,Go=[],Ko=typeof document<"u",Oo=Nl,hc=xn||cr?"cssFloat":"float",i0=Ko&&!gc&&!Nl&&"draggable"in document.createElement("div"),Dc=function(){if(Ko){if(cr)return!1;var o=document.createElement("x");return o.style.cssText="pointer-events:auto",o.style.pointerEvents==="auto"}}(),kc=function(l,s){var a=pe(l),f=parseInt(a.width)-parseInt(a.paddingLeft)-parseInt(a.paddingRight)-parseInt(a.borderLeftWidth)-parseInt(a.borderRightWidth),h=Fi(l,0,s),c=Fi(l,1,s),d=h&&pe(h),v=c&&pe(c),y=d&&parseInt(d.marginLeft)+parseInt(d.marginRight)+Ve(h).width,x=v&&parseInt(v.marginLeft)+parseInt(v.marginRight)+Ve(c).width;if(a.display==="flex")return a.flexDirection==="column"||a.flexDirection==="column-reverse"?"vertical":"horizontal";if(a.display==="grid")return a.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(h&&d.float&&d.float!=="none"){var D=d.float==="left"?"left":"right";return c&&(v.clear==="both"||v.clear===D)?"vertical":"horizontal"}return h&&(d.display==="block"||d.display==="flex"||d.display==="table"||d.display==="grid"||y>=f&&a[hc]==="none"||c&&a[hc]==="none"&&y+x>f)?"vertical":"horizontal"},n0=function(l,s,a){var f=a?l.left:l.top,h=a?l.right:l.bottom,c=a?l.width:l.height,d=a?s.left:s.top,v=a?s.right:s.bottom,y=a?s.width:s.height;return f===d||h===v||f+c/2===d+y/2},o0=function(l,s){var a;return jo.some(function(f){var h=f[Tt].options.emptyInsertThreshold;if(!(!h||Ol(f))){var c=Ve(f),d=l>=c.left-h&&l<=c.right+h,v=s>=c.top-h&&s<=c.bottom+h;if(d&&v)return a=f}}),a},Sc=function(l){function s(h,c){return function(d,v,y,x){var D=d.options.group.name&&v.options.group.name&&d.options.group.name===v.options.group.name;if(h==null&&(c||D))return!0;if(h==null||h===!1)return!1;if(c&&h==="clone")return h;if(typeof h=="function")return s(h(d,v,y,x),c)(d,v,y,x);var S=(c?d:v).options.group.name;return h===!0||typeof h=="string"&&h===S||h.join&&h.indexOf(S)>-1}}var a={},f=l.group;(!f||Ll(f)!="object")&&(f={name:f}),a.name=f.name,a.checkPull=s(f.pull,!0),a.checkPut=s(f.put),a.revertClone=f.revertClone,l.group=a},Ec=function(){!Dc&&xe&&pe(xe,"display","none")},Ac=function(){!Dc&&xe&&pe(xe,"display","")};Ko&&!gc&&document.addEventListener("click",function(o){if(Uo)return o.preventDefault(),o.stopPropagation&&o.stopPropagation(),o.stopImmediatePropagation&&o.stopImmediatePropagation(),Uo=!1,!1},!0);var Kr=function(l){if($){l=l.touches?l.touches[0]:l;var s=o0(l.clientX,l.clientY);if(s){var a={};for(var f in l)l.hasOwnProperty(f)&&(a[f]=l[f]);a.target=a.rootEl=s,a.preventDefault=void 0,a.stopPropagation=void 0,s[Tt]._onDragOver(a)}}},a0=function(l){$&&$.parentNode[Tt]._isOutsideThisEl(l.target)};function ge(o,l){if(!(o&&o.nodeType&&o.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(o));this.el=o,this.options=l=fr({},l),o[Tt]=this;var s={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(o.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return kc(o,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(c,d){c.setData("Text",d.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:ge.supportPointer!==!1&&"PointerEvent"in window&&(!gn||Nl),emptyInsertThreshold:5};wn.initializePlugins(this,o,s);for(var a in s)!(a in l)&&(l[a]=s[a]);Sc(l);for(var f in this)f.charAt(0)==="_"&&typeof this[f]=="function"&&(this[f]=this[f].bind(this));this.nativeDraggable=l.forceFallback?!1:i0,this.nativeDraggable&&(this.options.touchStartThreshold=1),l.supportPointer?Se(o,"pointerdown",this._onTapStart):(Se(o,"mousedown",this._onTapStart),Se(o,"touchstart",this._onTapStart)),this.nativeDraggable&&(Se(o,"dragover",this),Se(o,"dragenter",this)),jo.push(this.el),l.store&&l.store.get&&this.sort(l.store.get(this)||[]),fr(this,Vp())}ge.prototype={constructor:ge,_isOutsideThisEl:function(l){!this.el.contains(l)&&l!==this.el&&(ki=null)},_getDirection:function(l,s){return typeof this.options.direction=="function"?this.options.direction.call(this,l,s,$):this.options.direction},_onTapStart:function(l){if(l.cancelable){var s=this,a=this.el,f=this.options,h=f.preventOnFilter,c=l.type,d=l.touches&&l.touches[0]||l.pointerType&&l.pointerType==="touch"&&l,v=(d||l).target,y=l.target.shadowRoot&&(l.path&&l.path[0]||l.composedPath&&l.composedPath()[0])||v,x=f.filter;if(p0(a),!$&&!(/mousedown|pointerdown/.test(c)&&l.button!==0||f.disabled)&&!y.isContentEditable&&!(!this.nativeDraggable&&gn&&v&&v.tagName.toUpperCase()==="SELECT")&&(v=Gt(v,f.draggable,a,!1),!(v&&v.animated)&&Ho!==v)){if(Ei=It(v),vn=It(v,f.draggable),typeof x=="function"){if(x.call(this,l,v,this)){kt({sortable:s,rootEl:y,name:"filter",targetEl:v,toEl:a,fromEl:a}),Ft("filter",s,{evt:l}),h&&l.preventDefault();return}}else if(x&&(x=x.split(",").some(function(D){if(D=Gt(y,D.trim(),a,!1),D)return kt({sortable:s,rootEl:D,name:"filter",targetEl:v,fromEl:a,toEl:a}),Ft("filter",s,{evt:l}),!0}),x)){h&&l.preventDefault();return}f.handle&&!Gt(y,f.handle,a,!1)||this._prepareDragStart(l,d,v)}}},_prepareDragStart:function(l,s,a){var f=this,h=f.el,c=f.options,d=h.ownerDocument,v;if(a&&!$&&a.parentNode===h){var y=Ve(a);if(He=h,$=a,Ue=$.parentNode,Yr=$.nextSibling,Ho=a,zo=c.group,ge.dragged=$,Xr={target:$,clientX:(s||l).clientX,clientY:(s||l).clientY},cc=Xr.clientX-y.left,dc=Xr.clientY-y.top,this._lastX=(s||l).clientX,this._lastY=(s||l).clientY,$.style["will-change"]="all",v=function(){if(Ft("delayEnded",f,{evt:l}),ge.eventCanceled){f._onDrop();return}f._disableDelayedDragEvents(),!lc&&f.nativeDraggable&&($.draggable=!0),f._triggerDragStart(l,s),kt({sortable:f,name:"choose",originalEvent:l}),zt($,c.chosenClass,!0)},c.ignore.split(",").forEach(function(x){bc($,x.trim(),El)}),Se(d,"dragover",Kr),Se(d,"mousemove",Kr),Se(d,"touchmove",Kr),c.supportPointer?(Se(d,"pointerup",f._onDrop),!this.nativeDraggable&&Se(d,"pointercancel",f._onDrop)):(Se(d,"mouseup",f._onDrop),Se(d,"touchend",f._onDrop),Se(d,"touchcancel",f._onDrop)),lc&&this.nativeDraggable&&(this.options.touchStartThreshold=4,$.draggable=!0),Ft("delayStart",this,{evt:l}),c.delay&&(!c.delayOnTouchOnly||s)&&(!this.nativeDraggable||!(xn||cr))){if(ge.eventCanceled){this._onDrop();return}c.supportPointer?(Se(d,"pointerup",f._disableDelayedDrag),Se(d,"pointercancel",f._disableDelayedDrag)):(Se(d,"mouseup",f._disableDelayedDrag),Se(d,"touchend",f._disableDelayedDrag),Se(d,"touchcancel",f._disableDelayedDrag)),Se(d,"mousemove",f._delayedDragTouchMoveHandler),Se(d,"touchmove",f._delayedDragTouchMoveHandler),c.supportPointer&&Se(d,"pointermove",f._delayedDragTouchMoveHandler),f._dragStartTimer=setTimeout(v,c.delay)}else v()}},_delayedDragTouchMoveHandler:function(l){var s=l.touches?l.touches[0]:l;Math.max(Math.abs(s.clientX-this._lastX),Math.abs(s.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){$&&El($),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var l=this.el.ownerDocument;ke(l,"mouseup",this._disableDelayedDrag),ke(l,"touchend",this._disableDelayedDrag),ke(l,"touchcancel",this._disableDelayedDrag),ke(l,"pointerup",this._disableDelayedDrag),ke(l,"pointercancel",this._disableDelayedDrag),ke(l,"mousemove",this._delayedDragTouchMoveHandler),ke(l,"touchmove",this._delayedDragTouchMoveHandler),ke(l,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(l,s){s=s||l.pointerType=="touch"&&l,!this.nativeDraggable||s?this.options.supportPointer?Se(document,"pointermove",this._onTouchMove):s?Se(document,"touchmove",this._onTouchMove):Se(document,"mousemove",this._onTouchMove):(Se($,"dragend",this),Se(He,"dragstart",this._onDragStart));try{document.selection?qo(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(l,s){if(Si=!1,He&&$){Ft("dragStarted",this,{evt:s}),this.nativeDraggable&&Se(document,"dragover",a0);var a=this.options;!l&&zt($,a.dragClass,!1),zt($,a.ghostClass,!0),ge.active=this,l&&this._appendGhost(),kt({sortable:this,name:"start",originalEvent:s})}else this._nulling()},_emulateDragOver:function(){if(jt){this._lastX=jt.clientX,this._lastY=jt.clientY,Ec();for(var l=document.elementFromPoint(jt.clientX,jt.clientY),s=l;l&&l.shadowRoot&&(l=l.shadowRoot.elementFromPoint(jt.clientX,jt.clientY),l!==s);)s=l;if($.parentNode[Tt]._isOutsideThisEl(l),s)do{if(s[Tt]){var a=void 0;if(a=s[Tt]._onDragOver({clientX:jt.clientX,clientY:jt.clientY,target:l,rootEl:s}),a&&!this.options.dragoverBubble)break}l=s}while(s=vc(s));Ac()}},_onTouchMove:function(l){if(Xr){var s=this.options,a=s.fallbackTolerance,f=s.fallbackOffset,h=l.touches?l.touches[0]:l,c=xe&&Ai(xe,!0),d=xe&&c&&c.a,v=xe&&c&&c.d,y=Oo&&mt&&fc(mt),x=(h.clientX-Xr.clientX+f.x)/(d||1)+(y?y[0]-Sl[0]:0)/(d||1),D=(h.clientY-Xr.clientY+f.y)/(v||1)+(y?y[1]-Sl[1]:0)/(v||1);if(!ge.active&&!Si){if(a&&Math.max(Math.abs(h.clientX-this._lastX),Math.abs(h.clientY-this._lastY))=0&&(kt({rootEl:Ue,name:"add",toEl:Ue,fromEl:He,originalEvent:l}),kt({sortable:this,name:"remove",toEl:Ue,originalEvent:l}),kt({rootEl:Ue,name:"sort",toEl:Ue,fromEl:He,originalEvent:l}),kt({sortable:this,name:"sort",toEl:Ue,originalEvent:l})),ft&&ft.save()):Nt!==Ei&&Nt>=0&&(kt({sortable:this,name:"update",toEl:Ue,originalEvent:l}),kt({sortable:this,name:"sort",toEl:Ue,originalEvent:l})),ge.active&&((Nt==null||Nt===-1)&&(Nt=Ei,Ar=vn),kt({sortable:this,name:"end",toEl:Ue,originalEvent:l}),this.save()))),this._nulling()},_nulling:function(){Ft("nulling",this),He=$=Ue=xe=Yr=Re=Ho=Fr=Xr=jt=dn=Nt=Ar=Ei=vn=ki=bn=ft=zo=ge.dragged=ge.ghost=ge.clone=ge.active=null;var l=this.el;Go.forEach(function(s){l.contains(s)&&(s.checked=!0)}),Go.length=Dl=kl=0},handleEvent:function(l){switch(l.type){case"drop":case"dragend":this._onDrop(l);break;case"dragenter":case"dragover":$&&(this._onDragOver(l),l0(l));break;case"selectstart":l.preventDefault();break}},toArray:function(){for(var l=[],s,a=this.el.children,f=0,h=a.length,c=this.options;ff.right+h||o.clientY>a.bottom&&o.clientX>a.left:o.clientY>f.bottom+h||o.clientX>a.right&&o.clientY>a.top}function c0(o,l,s,a,f,h,c,d){var v=a?o.clientY:o.clientX,y=a?s.height:s.width,x=a?s.top:s.left,D=a?s.bottom:s.right,S=!1;if(!c){if(d&&Pox+y*h/2:vD-Po)return-bn}else if(v>x+y*(1-f)/2&&vD-y*h/2)?v>x+y/2?1:-1:0}function d0(o){return It($)0||D>0&&S0?"Converting "+l+" photo"+(l>1?"s":"")+"\u2026":"Uploading "+D+" photo"+(D>1?"s":"")+"\u2026",s.details.open=!0):D>0?(s.summary.textContent="\u2713 "+D+" photo"+(D>1?"s":"")+" ready \u2014 tap to review",s.details.open=!1):(s.summary.textContent="Photos (1\u20136)",s.details.open=!0)}}function c(){h(),setTimeout(h,150),setTimeout(h,500)}function d(){var x=o.querySelector('button[type="submit"], input[type="submit"]');if(x&&(x.disabled=l>0),l>0)f("Converting "+l+" photo"+(l>1?"s":"")+"\u2026");else{var D=Bc();D&&/Converting/.test(D.textContent)&&f("")}h()}o.addEventListener("submit",function(x){l>0&&(x.preventDefault(),f("Hang on \u2014 a photo is still converting.","err"))},!0);function v(x){return function(D){var S=D&&D.file;return S?Hc(S).then(function(F){return F?(l++,d(),import("./heic-to-CN7JBE7H.js").then(function(B){var L=B.heicTo||B.default&&B.default.heicTo;return L({blob:S,type:"image/jpeg",quality:.85})}).then(function(B){var L=new File([B],y0(S.name),{type:"image/jpeg"});x.addFile(L)}).catch(function(){f("A photo couldn\u2019t be converted and was skipped \u2014 the others are fine.","err")}).then(function(){l--,d()}),!1):!0}):!0}}var y=0;(function x(){var D=window.GravFilePond&&window.GravFilePond.getInstances?window.GravFilePond.getInstances():[];if(!D.length){y++<120&&setTimeout(x,50);return}D.forEach(function(S){S&&!S._heicHooked&&(S._heicHooked=!0,S.setOptions({beforeAddFile:v(S),allowReorder:!0,itemInsertLocation:"after"}),a=S,["addfile","processfile","processfiles","removefile","error"].forEach(function(F){try{S.on(F,c)}catch{}}),h())})})()}function ct(o){return document.querySelector('[name="data['+o+']"]')}function C0(){var o=Array.prototype.slice.call(document.querySelectorAll(".advanced-field"));if(o.length){var l=[];if(o.forEach(function(h){var c=h.closest(".form-field");c&&l.indexOf(c)===-1&&l.push(c)}),!!l.length){var s=document.createElement("details");s.className="more-options";var a=document.createElement("summary");a.className="more-options__summary",a.textContent="More options",s.appendChild(a),l[0].parentNode.insertBefore(s,l[0]),l.forEach(function(h){s.appendChild(h)});var f=l.some(function(h){var c=h.querySelector('input[type="text"]');if(c&&c.value.trim())return!0;var d=h.querySelector('input[type="radio"]:checked');if(!d||!d.value)return!1;var v=h.querySelector('input[type="radio"][checked]');return v?d.value!==v.value:d.value!=="0"});f&&(s.open=!0)}}}var D0={0:"Sunny",1:"Partly cloudy",2:"Partly cloudy",3:"Cloudy",45:"Foggy",48:"Foggy",51:"Drizzle",53:"Drizzle",55:"Drizzle",56:"Drizzle",57:"Drizzle",61:"Rain",63:"Rain",65:"Rain",66:"Rain",67:"Rain",80:"Rain",81:"Rain",82:"Rain",71:"Snow",73:"Snow",75:"Snow",77:"Snow",85:"Snow",86:"Snow",95:"Thunderstorm",96:"Thunderstorm",99:"Thunderstorm"};function dr(o,l,s){o&&(o.className="form-status"+(s?" form-status--"+s:""),o.textContent=l||"")}function k0(){var o=document.getElementById("get-location"),l=document.getElementById("get-weather");if(!o&&!l)return;var s=document.getElementById("location-status"),a=document.getElementById("weather-status");function f(){var d=ct("lat"),v=ct("lng"),y=d?d.value.trim():"",x=v?v.value.trim():"";return y&&x?{lat:y,lng:x}:null}function h(){if(l){var d=!!f();l.disabled=!d,l.title=d?"":"Get location first"}}h();function c(d,v){var y=ct("location_city"),x=ct("location_country");if(!((!y||y.value.trim())&&(!x||x.value.trim()))){var D="https://api.bigdatacloud.net/data/reverse-geocode-client?latitude="+encodeURIComponent(d)+"&longitude="+encodeURIComponent(v)+"&localityLanguage=en";fetch(D).then(function(S){return S.json()}).then(function(S){var F=(S.city||S.locality||"").trim(),B=(S.countryName||"").trim();y&&!y.value.trim()&&F&&(y.value=F),x&&!x.value.trim()&&B&&(x.value=B);var L=[F,B].filter(Boolean).join(", ");L&&dr(s,"\u2713 Location captured \xB7 "+L,"ok")}).catch(function(){})}}o&&o.addEventListener("click",function(){if(!navigator.geolocation){dr(s,"Geolocation is not supported on this device.","err");return}o.classList.add("is-loading"),o.disabled=!0,dr(s,"Getting location\u2026"),navigator.geolocation.getCurrentPosition(function(d){var v=d.coords.latitude.toFixed(6),y=d.coords.longitude.toFixed(6),x=ct("lat"),D=ct("lng");x&&(x.value=v),D&&(D.value=y),o.classList.remove("is-loading"),o.disabled=!1,dr(s,"\u2713 Location captured \xB7 "+v+", "+y,"ok"),h(),c(v,y);var S=document.querySelector(".location-details");S&&S.open&&Ul()},function(d){o.classList.remove("is-loading"),o.disabled=!1,dr(s,"\u2717 "+(d&&d.message?d.message:"Could not get location")+" \u2014 enter coordinates manually if needed.","err")},{enableHighAccuracy:!0,timeout:15e3})}),l&&l.addEventListener("click",function(){var d=f();if(!d){dr(a,"Get location first, then fetch weather.","err");return}l.classList.add("is-loading"),l.disabled=!0,dr(a,"Fetching weather\u2026");var v="https://api.open-meteo.com/v1/forecast?latitude="+d.lat+"&longitude="+d.lng+"¤t=temperature_2m,weather_code&temperature_unit=celsius";fetch(v).then(function(y){return y.json()}).then(function(y){var x=Math.round(y.current.temperature_2m),D=D0[y.current.weather_code]||"Cloudy",S=ct("weather_temp_c"),F=ct("weather_desc");S&&(S.value=x),F&&(F.value=D),l.classList.remove("is-loading"),h(),dr(a,"\u2713 Weather set \xB7 "+D+" \xB7 "+x+"\xB0C (edit above if needed)","ok")}).catch(function(){l.classList.remove("is-loading"),h(),dr(a,"\u2717 Could not fetch weather \u2014 set it manually above.","err")})})}var Ul=function(){};function S0(o,l){var s=null;return function(){var a=arguments;clearTimeout(s),s=setTimeout(function(){o.apply(null,a)},l)}}function E0(o){return[o.name,o.admin1,o.country].filter(Boolean).join(", ")}function A0(){var o=ct("lat"),l=ct("lng");if(!o||!l)return;var s=o.closest(".form-field"),a=l.closest(".form-field");if(!s||!a)return;var f=ct("location_city"),h=ct("location_country"),c=h?h.closest(".form-field"):null,d=c||s,v=document.createElement("details");v.className="location-details";var y=document.createElement("summary");y.className="location-details__summary",y.textContent="More location details",v.appendChild(y);var x=document.createElement("div");x.className="location-details__body";var D=document.createElement("div");D.className="location-search-row";var S=document.createElement("button");S.type="button",S.id="lookup-coords",S.className="btn-action";var F="\u{1F50D} Look up coordinates";S.textContent=F,D.appendChild(S),x.appendChild(D);var B=document.createElement("p");B.id="location-search-hint",B.className="location-search-hint",B.setAttribute("role","status"),x.appendChild(B);var L=document.createElement("ul");L.id="location-search-results",L.className="location-search-results",x.appendChild(L);var T=document.createElement("div");T.id="location-map",T.className="location-map",x.appendChild(T),v.appendChild(x),d.parentNode.insertBefore(v,d.nextSibling),v.appendChild(s),v.appendChild(a);function N(G){return G===o?"location-lat-note":"location-lng-note"}function z(){[o,l].forEach(function(G){G.classList.add("location-field--mismatch"),G.setAttribute("aria-invalid","true");var k=N(G),H=document.getElementById(k);H||(H=document.createElement("span"),H.id=k,H.className="location-field-note",H.setAttribute("role","status"),H.setAttribute("aria-live","polite"),H.textContent="Not reflected on the map yet.",G.parentNode.insertBefore(H,G.nextSibling)),G.setAttribute("aria-describedby",k)})}function O(){[o,l].forEach(function(G){G.classList.remove("location-field--mismatch"),G.removeAttribute("aria-invalid"),G.removeAttribute("aria-describedby");var k=document.getElementById(N(G));k&&k.parentNode&&k.parentNode.removeChild(k)})}var I=null;function W(G){var k=String(G).trim();return!k||!/^[+-]?(\d+(\.\d*)?|\.\d+)$/.test(k)?NaN:Number(k)}function j(){var G=W(o.value),k=W(l.value),H=isFinite(G)&&isFinite(k)&&G>=-90&&G<=90&&k>=-180&&k<=180;H?(o.value=G.toFixed(6),l.value=k.toFixed(6),O(),I&&I.setPin(G,k)):o.value.trim()||l.value.trim()?z():(O(),I&&I.clearPin())}Ul=j;function K(G){o.value=G.lat.toFixed(6),l.value=G.lng.toFixed(6),O()}v.addEventListener("toggle",function(){v.open&&Mc(T,K).then(function(G){I=G,G.resize(),j()}).catch(function(){U("Map preview unavailable \u2014 you can still enter coordinates directly."),j()})}),o.addEventListener("blur",j),l.addEventListener("blur",j);var de=S0(j,400);o.addEventListener("input",de),l.addEventListener("input",de);function U(G){B.textContent=G||""}function oe(){L.innerHTML=""}function X(G){G.forEach(function(k){var H=document.createElement("li"),q=document.createElement("button");q.type="button",q.textContent=E0(k),q.addEventListener("click",function(){o.value=Number(k.latitude).toFixed(6),l.value=Number(k.longitude).toFixed(6),oe(),j()}),H.appendChild(q),L.appendChild(H)})}S.addEventListener("click",function(){oe();var G=f?f.value.trim():"",k=h?h.value.trim():"";if(!G&&!k){U("Enter a city or country first.");return}var H=G||k;U(""),S.disabled=!0,S.textContent="Searching\u2026";var q="https://geocoding-api.open-meteo.com/v1/search?name="+encodeURIComponent(H)+"&count=10&language=en&format=json",Q=new AbortController,he=setTimeout(function(){Q.abort()},1e4);fetch(q,{signal:Q.signal}).then(function(be){return be.json()}).then(function(be){var Ee=be&&be.results||[];if(!Ee.length){U("No matches \u2014 try adding a country, or drag the pin on the map.");return}if(k){var A=k.toLowerCase(),w=function(ee){return(ee.admin1||"").toLowerCase().indexOf(A)!==-1||(ee.country||"").toLowerCase().indexOf(A)!==-1};Ee=Ee.slice().sort(function(ee,Ce){var ye=w(ee),lt=w(Ce);return ye===lt?0:ye?-1:1})}X(Ee)}).catch(function(){}).then(function(){clearTimeout(he),S.disabled=!1,S.textContent=F})}),j()}function F0(){var o=new Date;return o.setSeconds(0,0),o.setMinutes(o.getMinutes()-o.getTimezoneOffset()),o.toISOString().slice(0,16)}function T0(){var o={title:"Title",date:"Date & time",content:"Content"},l=document.querySelector('form[name="new-entry"]');if(!l)return;var s=ct("date");s&&!String(s.value).trim()&&(s.value=F0());function a(){l.querySelectorAll(".field-error").forEach(function(c){c.remove()}),l.querySelectorAll(".field-invalid").forEach(function(c){c.classList.remove("field-invalid")})}function f(c,d){c.classList.add("field-invalid");var v=document.createElement("span");v.className="field-error",v.textContent=d,c.parentNode.insertBefore(v,c.nextSibling)}function h(c){var d=l.querySelector(".photos-collapse"),v,y;if(d?(d.open=!0,y=d.querySelector(".photos-collapse__summary"),v=d):(v=document.querySelector(".filepond-root, .form-input-file"),y=v),!y)return v||null;var x=document.createElement("span");return x.className="field-error",x.textContent=c,y.insertAdjacentElement("afterend",x),v||y}l.addEventListener("submit",function(c){a();var d=null;!Yo&&document.querySelectorAll(".filepond--item").length<1&&(d=h("Add at least one photo.")),Object.keys(o).forEach(function(y){var x=ct(y);x&&!String(x.value).trim()&&(f(x,o[y]+" is required."),d||(d=x))});var v=l.querySelector(".location-field--mismatch");v&&!d&&(d=v),d&&(c.preventDefault(),typeof d.focus=="function"&&d.focus(),d.scrollIntoView({behavior:"smooth",block:"center"}))})}var ql="intotheeast:new-entry-draft";function L0(o){return Array.prototype.slice.call(o.querySelectorAll('[name^="data["]')).filter(function(l){if(l.type==="file")return!1;var s=l.name;return s.indexOf("data[_json")!==0&&s.indexOf("data[photos")!==0})}function M0(){var o=document.querySelector(".filepond-root, .form-input-file");if(!(!o||!o.parentNode)&&!o.parentNode.querySelector(".photo-reauth-hint")){var l=document.createElement("p");l.className="photo-reauth-hint is-shown",l.textContent="Your text was restored \u2014 photos need re-selecting (they can\u2019t be saved in a draft).",o.parentNode.insertBefore(l,o.nextSibling)}}function B0(){var o=document.querySelector('form[name="new-entry"]');if(!o||Yo)return;if(document.querySelector(".notices.success")){try{localStorage.removeItem(ql)}catch{}return}function l(){var h={};L0(o).forEach(function(c){c.type==="radio"?c.checked&&(h[c.name]=c.value):h[c.name]=c.value});try{localStorage.setItem(ql,JSON.stringify(h))}catch{}}var s=null;try{s=localStorage.getItem(ql)}catch{s=null}if(s){var a=null;try{a=JSON.parse(s)}catch{a=null}if(a){var f=!1;Object.keys(a).forEach(function(h){var c=a[h];if(c!=null&&String(c).trim()&&(f=!0),h!=="data[content]"){var d=o.querySelectorAll('input[type="radio"][name="'+h+'"]');if(d.length){d.forEach(function(y){y.checked=y.value===c});return}var v=o.querySelector('[name="'+h+'"]');v&&v.type!=="file"&&(v.value=c)}}),window.postFormEditor&&a["data[content]"]!=null&&window.postFormEditor.value(a["data[content]"]),f&&M0()}}o.addEventListener("input",l),o.addEventListener("change",l),window.postFormEditor&&window.postFormEditor.codemirror.on("change",l)}function _0(){var o=document.querySelector(".post-form-wrap"),l=document.querySelector(".post-form-wrap .notices.success, .post-form-wrap .notices.green");if(!(!o||!l)){var s=document.createElement("div");s.className="post-success";var a=document.createElement("p");a.className="post-success__title",a.textContent="\u2713 Saved to your journal.",s.appendChild(a);var f=document.createElement("div");f.className="post-success__actions";var h=o.getAttribute("data-trip-url");if(h){var c=document.createElement("a");c.className="post-success__view",c.href=h,c.textContent="View your journal \u2192",f.appendChild(c)}var d=document.createElement("a");d.className="post-success__again",d.href=window.location.pathname,d.textContent="Post another",f.appendChild(d),s.appendChild(f),l.parentNode.insertBefore(s,l.nextSibling),["form",".form-action-row","#location-status","#weather-status"].forEach(function(v){var y=o.querySelector(v);y&&(y.style.display="none")}),l.scrollIntoView({behavior:"smooth",block:"start"})}}var Yo=!1;function _c(o){return new URLSearchParams(window.location.search).get(o)}function hr(o,l){var s=ct(o);s&&(s.value=l==null?"":String(l))}function Rl(o,l){var s=l?"1":"0",a=document.querySelectorAll('[name="data['+o+']"]');Array.prototype.forEach.call(a,function(f){f.checked=String(f.value)===s})}function z0(o){var l=o==null?"":String(o);if(window.postFormEditor&&typeof window.postFormEditor.value=="function")window.postFormEditor.value(l);else{var s=ct("content");s&&(s.value=l)}}function zc(o,l){var s=o.querySelectorAll("input, textarea, select, button");Array.prototype.forEach.call(s,function(a){a.type==="file"||a.name&&a.name.indexOf("data[photos")===0||(a.disabled=l)}),window.postFormEditor&&window.postFormEditor.codemirror&&window.postFormEditor.codemirror.setOption("readOnly",l?"nocursor":!1)}function Wl(o,l){o&&(o.tagName==="INPUT"?o.value=l:o.textContent=l)}function N0(o,l){var s=o.querySelector(".post-edit-error");if(s){s.textContent=l;return}var a=document.createElement("div");a.className="post-edit-error",a.setAttribute("role","alert"),a.textContent=l;var f=o.querySelector("h1");f?f.insertAdjacentElement("afterend",a):o.insertBefore(a,o.firstChild)}var O0=/\.(jpe?g|png|webp|heic|heif|gif)$/i;function Nc(o){var l=/(?:^|\/)photo-0*(\d+)\./i.exec(o);return l?parseInt(l[1],10):Number.MAX_SAFE_INTEGER}function I0(o,l){var s=Nc(o),a=Nc(l);return s!==a?s-a:ol?1:0}function Oc(o,l){var s=String(o||"photo"),a=s.lastIndexOf("."),f=(a>0?s.slice(0,a):s).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"photo",h=l?".jpg":a>0?s.slice(a).toLowerCase():".jpg",c=Date.now().toString(36)+Math.random().toString(36).slice(2,6);return f+"-"+c+h}function H0(o){var l=document.querySelector('form[name="new-entry"]');if(!l||!o)return;var s=o.split("/").filter(Boolean).pop();if(!s)return;var a=document.querySelector(".filepond-root, .form-input-file"),f=a?a.closest(".form-field"):null;f&&(f.style.display="none");var h=l.querySelector(".photos-collapse");h&&(h.style.display="none");var c=document.createElement("div");c.className="photo-editor",c.innerHTML='

    Photos

    ',f&&f.parentNode?f.parentNode.insertBefore(c,f):l.insertBefore(c,l.firstElementChild);var d=c.querySelector(".photo-editor__grid"),v=c.querySelector(".photo-editor__status"),y=c.querySelector(".photo-editor__add"),x=c.querySelector(".photo-editor__input"),D=[],S=null,F=!1,B=0;function L(X,G){v.textContent=X||"",v.className="photo-editor__status gpx-status"+(G?" error":"")}function T(X){F=X,y.disabled=X,Array.prototype.forEach.call(d.querySelectorAll(".photo-editor__del, .photo-editor__confirm-yes, .photo-editor__confirm-no"),function(G){G.disabled=X}),S&&S.option("disabled",X)}function N(){return fetch("/api/v1/pages"+o+"/media",{credentials:"include",headers:{Accept:"application/json"}}).then(function(X){if(!X.ok)throw new Error("HTTP "+X.status);return X.json()}).then(function(X){return(X&&X.data||[]).filter(function(G){return G&&typeof G.filename=="string"&&O0.test(G.filename)}).map(function(G){return G.filename}).sort(I0)})}function z(X){return Cn("/api/v1/entry/"+encodeURIComponent(s)+"/photos/order",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({order:X})})}function O(X){if(D=(X||[]).slice(),S&&(S.destroy(),S=null),d.innerHTML="",!D.length){d.innerHTML='

    No photos yet \u2014 add some.

    ';return}var G=++B;D.forEach(function(k){var H=document.createElement("div");H.className="photo-editor__cell",H.setAttribute("data-filename",k);var q=document.createElement("img");q.className="photo-editor__img",q.loading="lazy",q.alt=k,q.src=o+"/"+encodeURIComponent(k)+"?v="+G;var Q=document.createElement("button");Q.type="button",Q.className="photo-editor__del",Q.setAttribute("aria-label","Delete "+k),Q.textContent="\u2715",Q.addEventListener("click",function(){K(H,k)}),H.appendChild(q),H.appendChild(Q),d.appendChild(H)}),D.length>1&&(S=new Tc(d,{animation:150,draggable:".photo-editor__cell",filter:".photo-editor__confirm",onEnd:j}))}function I(){return Array.prototype.map.call(d.querySelectorAll(".photo-editor__cell"),function(X){return X.getAttribute("data-filename")})}function W(X,G){if(X.length!==G.length)return!1;for(var k=0;kDelete?',X.appendChild(k),X.classList.add("is-confirming"),k.querySelector(".photo-editor__confirm-no").addEventListener("click",function(){X.classList.remove("is-confirming"),k.remove()}),k.querySelector(".photo-editor__confirm-yes").addEventListener("click",function(){k.querySelector(".photo-editor__confirm-yes").disabled=!0,k.querySelector(".photo-editor__confirm-no").disabled=!0,de(G)})}}function de(X){var G=D.slice(),k=D.filter(function(H){return H!==X});T(!0),L("Deleting\u2026"),Cn("/api/v1/pages"+o+"/media/"+encodeURIComponent(X),{method:"DELETE"},[204,404]).then(function(){return(k.length?z(k):Promise.resolve()).then(N).then(function(H){L(""),O(H)},function(){L("Photo deleted, but refreshing the list failed \u2014 reload if it looks off.",!0),O(k)})},function(H){L(Pl(H,"Couldn\u2019t delete that photo. Try again."),!0),O(G)}).then(function(){T(!1)})}function U(X){return Hc(X).then(function(G){return G?import("./heic-to-CN7JBE7H.js").then(function(k){var H=k.heicTo||k.default&&k.default.heicTo;return H({blob:X,type:"image/jpeg",quality:.85})}).then(function(k){return{blob:k,name:Oc(X.name,!0)}}):{blob:X,name:Oc(X.name,!1)}})}y.addEventListener("click",function(){F||x.click()}),x.addEventListener("change",function(){var X=Array.prototype.slice.call(x.files||[]);x.value="",X.length&&oe(X)});function oe(X){T(!0);var G=X.length,k=0,H=0,q=!1,Q=D.slice(),he=Promise.resolve();X.forEach(function(be){he=he.then(function(){return k++,L("Uploading "+k+" of "+G+"\u2026"),U(be).then(function(Ee){var A=new FormData;return A.append("file",Ee.blob,Ee.name),Cn("/api/v1/pages"+o+"/media",{method:"POST",body:A})}).then(null,function(Ee){H++,Ee&&(Ee.status===401||Ee.status===403)&&(q=!0)})})}),he.then(function(){return L("Finishing\u2026"),N()}).then(function(be){var Ee=Q.filter(function(ee){return be.indexOf(ee)!==-1}),A=be.filter(function(ee){return Q.indexOf(ee)===-1}),w=Ee.concat(A);return w.length?z(w).catch(function(){return z(w)}).catch(function(){return Promise.all(A.map(function(ee){return Cn("/api/v1/pages"+o+"/media/"+encodeURIComponent(ee),{method:"DELETE"},[204,404]).then(function(){return!0},function(){return!1})})).then(function(ee){var Ce=new Error("reorder failed");throw Ce.rolledBack=!0,Ce.rollbackIncomplete=ee.indexOf(!1)!==-1,Ce})}).then(N):(O([]),null)}).then(function(be){be&&O(be),H?L(q?"Couldn\u2019t add photos \u2014 your login session expired. Sign in again, then retry.":H+" photo"+(H>1?"s":"")+" couldn\u2019t be added.",!0):L("")}).catch(function(be){var Ee;return be&&be.rolledBack?Ee=be.rollbackIncomplete?"Couldn\u2019t finish adding photos and cleanup was incomplete \u2014 reload the page and check your photos.":"Couldn\u2019t finish adding photos \u2014 changes were rolled back. Try again.":Ee="Couldn\u2019t add photos. Please try again.",L(Ee,!0),N().then(O,function(){O(Q)})}).then(function(){T(!1)})}d.innerHTML='

    Loading photos\u2026

    ',N().then(O).catch(function(){L("Couldn\u2019t load photos.",!0),O([])})}function P0(){var o=document.querySelector('form[name="new-entry"]'),l=document.querySelector(".post-form-wrap");if(!(!o||!l)){var s=_c("edit");if(s){Yo=!0;var a=l.querySelector("h1");a&&(a.textContent="Edit entry");var f=o.querySelector('button[type="submit"], input[type="submit"]'),h=f?f.tagName==="INPUT"?f.value:f.textContent:"Save changes";zc(o,!0),Wl(f,"Loading entry\u2026");var c=_c("return")||l.getAttribute("data-trip-url")||"";o.setAttribute("action","/post?edit="+encodeURIComponent(s)+(c?"&return="+encodeURIComponent(c):"")),fetch("/api/v1/pages"+s,{credentials:"include",headers:{Accept:"application/json"}}).then(function(d){if(!d.ok){var v=new Error("HTTP "+d.status);throw v.status=d.status,v}return d.json()}).then(function(d){var v=d&&d.data||{},y=v.header||{};hr("title",y.title!=null?y.title:v.title),hr("date",y.date?String(y.date).replace(" ","T"):""),z0(v.content),hr("lat",y.lat),hr("lng",y.lng),Ul(),hr("location_city",y.location_city),hr("location_country",y.location_country),hr("weather_desc",y.weather_desc),hr("weather_temp_c",y.weather_temp_c),hr("transport_mode",y.transport_mode),Rl("featured",y.featured),Rl("force_connect",y.force_connect),Rl("published",y.published!==void 0?y.published:v.published);var x=ct("edit_path");x&&(x.value=s+"/entry.md"),zc(o,!1),Wl(f,"Save changes");var D=o.querySelector(".more-options");D&&(D.open=!0),H0(s)}).catch(function(d){var v=d&&d.status===404?"This entry no longer exists \u2014 it may have been deleted. Head back to the journal.":"Sorry \u2014 this entry couldn\u2019t be loaded for editing. Check your connection and try again.";N0(l,v),Wl(f,h)})}}}function Ic(){window.postFormEditor=v0(),_0(),P0(),B0(),w0(),C0(),k0(),A0(),T0()}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Ic):Ic(); +Maximum file size is #image_max_size#.`,importError:"Something went wrong when uploading the image #image_name#."};function re(o){o=o||{},o.parent=this;var l=!0;if(o.autoDownloadFontAwesome===!1&&(l=!1),o.autoDownloadFontAwesome!==!0)for(var s=document.styleSheets,a=0;a-1&&(l=!1);if(l){var f=document.createElement("link");f.rel="stylesheet",f.href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css",document.getElementsByTagName("head")[0].appendChild(f)}if(o.element)this.element=o.element;else if(o.element===null){console.log("EasyMDE: Error. No element was found.");return}if(o.toolbar===void 0){o.toolbar=[];for(var h in Ur)Object.prototype.hasOwnProperty.call(Ur,h)&&(h.indexOf("separator-")!=-1&&o.toolbar.push("|"),(Ur[h].default===!0||o.showIcons&&o.showIcons.constructor===Array&&o.showIcons.indexOf(h)!=-1)&&o.toolbar.push(h))}if(Object.prototype.hasOwnProperty.call(o,"previewClass")||(o.previewClass="editor-preview"),Object.prototype.hasOwnProperty.call(o,"status")||(o.status=["autosave","lines","words","cursor"],o.uploadImage&&o.status.unshift("upload-image")),o.previewRender||(o.previewRender=function(d){return this.parent.markdown(d)}),o.parsingConfig=sr({highlightFormatting:!0},o.parsingConfig||{}),o.insertTexts=sr({},Ip,o.insertTexts||{}),o.promptTexts=sr({},Hp,o.promptTexts||{}),o.blockStyles=sr({},qp,o.blockStyles||{}),o.autosave!=null&&(o.autosave.timeFormat=sr({},Pp,o.autosave.timeFormat||{})),o.iconClassMap=sr({},Be,o.iconClassMap||{}),o.shortcuts=sr({},Tp,o.shortcuts||{}),o.maxHeight=o.maxHeight||void 0,o.direction=o.direction||"ltr",typeof o.maxHeight<"u"?o.minHeight=o.maxHeight:o.minHeight=o.minHeight||"300px",o.errorCallback=o.errorCallback||function(d){alert(d)},o.uploadImage=o.uploadImage||!1,o.imageMaxSize=o.imageMaxSize||2097152,o.imageAccept=o.imageAccept||"image/png, image/jpeg, image/gif, image/avif",o.imageTexts=sr({},Rp,o.imageTexts||{}),o.errorMessages=sr({},Wp,o.errorMessages||{}),o.imagePathAbsolute=o.imagePathAbsolute||!1,o.imageCSRFName=o.imageCSRFName||"csrfmiddlewaretoken",o.imageCSRFHeader=o.imageCSRFHeader||!1,o.imageInputName=o.imageInputName||"image",o.autosave!=null&&o.autosave.unique_id!=null&&o.autosave.unique_id!=""&&(o.autosave.uniqueId=o.autosave.unique_id),o.overlayMode&&o.overlayMode.combine===void 0&&(o.overlayMode.combine=!0),this.options=o,this.render(),o.initialValue&&(!this.options.autosave||this.options.autosave.foundSavedValue!==!0)&&this.value(o.initialValue),o.uploadImage){var c=this;this.codemirror.on("dragenter",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbOnDragEnter),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("dragend",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbInit),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("dragleave",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbInit),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("dragover",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbOnDragEnter),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("drop",function(d,v){v.stopPropagation(),v.preventDefault(),o.imageUploadFunction?c.uploadImagesUsingCustomFunction(o.imageUploadFunction,v.dataTransfer.files):c.uploadImages(v.dataTransfer.files)}),this.codemirror.on("paste",function(d,v){o.imageUploadFunction?c.uploadImagesUsingCustomFunction(o.imageUploadFunction,v.clipboardData.files):c.uploadImages(v.clipboardData.files)})}}re.prototype.uploadImages=function(o,l,s){if(o.length!==0){for(var a=[],f=0;f=2){var O=z[1];if(l.imagesPreviewHandler){var I=l.imagesPreviewHandler(z[1]);typeof I=="string"&&(O=I)}if(window.EMDEimagesCache[O])F(N,window.EMDEimagesCache[O]);else{window.EMDEimagesCache[O]={};var U=document.createElement("img");U.onload=function(){window.EMDEimagesCache[O]={naturalWidth:U.naturalWidth,naturalHeight:U.naturalHeight,url:O},F(N,window.EMDEimagesCache[O])},U.src=O}}}})}this.codemirror.on("update",function(){B()}),this.gui.sideBySide=this.createSideBySide(),this._rendered=this.element,(l.autofocus===!0||o.autofocus)&&this.codemirror.focus();var L=this.codemirror;setTimeout(function(){L.refresh()}.bind(L),0)};re.prototype.cleanup=function(){document.removeEventListener("keydown",this.documentOnKeyDown)};function ic(){if(typeof localStorage=="object")try{localStorage.setItem("smde_localStorage",1),localStorage.removeItem("smde_localStorage")}catch{return!1}else return!1;return!0}re.prototype.autosave=function(){if(ic()){var o=this;if(this.options.autosave.uniqueId==null||this.options.autosave.uniqueId==""){console.log("EasyMDE: You must set a uniqueId to use the autosave feature");return}this.options.autosave.binded!==!0&&(o.element.form!=null&&o.element.form!=null&&o.element.form.addEventListener("submit",function(){clearTimeout(o.autosaveTimeoutId),o.autosaveTimeoutId=void 0,localStorage.removeItem("smde_"+o.options.autosave.uniqueId)}),this.options.autosave.binded=!0),this.options.autosave.loaded!==!0&&(typeof localStorage.getItem("smde_"+this.options.autosave.uniqueId)=="string"&&localStorage.getItem("smde_"+this.options.autosave.uniqueId)!=""&&(this.codemirror.setValue(localStorage.getItem("smde_"+this.options.autosave.uniqueId)),this.options.autosave.foundSavedValue=!0),this.options.autosave.loaded=!0);var l=o.value();l!==""?localStorage.setItem("smde_"+this.options.autosave.uniqueId,l):localStorage.removeItem("smde_"+this.options.autosave.uniqueId);var s=document.getElementById("autosaved");if(s!=null&&s!=null&&s!=""){var a=new Date,f=new Intl.DateTimeFormat([this.options.autosave.timeFormat.locale,"en-US"],this.options.autosave.timeFormat.format).format(a),h=this.options.autosave.text==null?"Autosaved: ":this.options.autosave.text;s.innerHTML=h+f}}else console.log("EasyMDE: localStorage not available, cannot autosave")};re.prototype.clearAutosavedValue=function(){if(ic()){if(this.options.autosave==null||this.options.autosave.uniqueId==null||this.options.autosave.uniqueId==""){console.log("EasyMDE: You must set a uniqueId to clear the autosave value");return}localStorage.removeItem("smde_"+this.options.autosave.uniqueId)}else console.log("EasyMDE: localStorage not available, cannot autosave")};re.prototype.openBrowseFileWindow=function(o,l){var s=this,a=this.gui.toolbar.getElementsByClassName("imageInput")[0];a.click();function f(h){s.options.imageUploadFunction?s.uploadImagesUsingCustomFunction(s.options.imageUploadFunction,h.target.files):s.uploadImages(h.target.files,o,l),a.removeEventListener("change",f)}a.addEventListener("change",f)};re.prototype.uploadImage=function(o,l,s){var a=this;l=l||function(y){ec(a,y)};function f(v){a.updateStatusBar("upload-image",v),setTimeout(function(){a.updateStatusBar("upload-image",a.options.imageTexts.sbInit)},1e4),s&&typeof s=="function"&&s(v),a.options.errorCallback(v)}function h(v){var y=a.options.imageTexts.sizeUnits.split(",");return v.replace("#image_name#",o.name).replace("#image_size#",co(o.size,y)).replace("#image_max_size#",co(a.options.imageMaxSize,y))}if(o.size>this.options.imageMaxSize){f(h(this.options.errorMessages.fileTooLarge));return}var c=new FormData;c.append("image",o),a.options.imageCSRFToken&&!a.options.imageCSRFHeader&&c.append(a.options.imageCSRFName,a.options.imageCSRFToken);var d=new XMLHttpRequest;d.upload.onprogress=function(v){if(v.lengthComputable){var y=""+Math.round(v.loaded*100/v.total);a.updateStatusBar("upload-image",a.options.imageTexts.sbProgress.replace("#file_name#",o.name).replace("#progress#",y))}},d.open("POST",this.options.imageUploadEndpoint),a.options.imageCSRFToken&&a.options.imageCSRFHeader&&d.setRequestHeader(a.options.imageCSRFName,a.options.imageCSRFToken),d.onload=function(){try{var v=JSON.parse(this.responseText)}catch{console.error("EasyMDE: The server did not return a valid json."),f(h(a.options.errorMessages.importError));return}this.status===200&&v&&!v.error&&v.data&&v.data.filePath?l((a.options.imagePathAbsolute?"":window.location.origin+"/")+v.data.filePath):v.error&&v.error in a.options.errorMessages?f(h(a.options.errorMessages[v.error])):v.error?f(h(v.error)):(console.error("EasyMDE: Received an unexpected response after uploading the image."+this.status+" ("+this.statusText+")"),f(h(a.options.errorMessages.importError)))},d.onerror=function(v){console.error("EasyMDE: An unexpected error occurred when trying to upload the image."+v.target.status+" ("+v.target.statusText+")"),f(a.options.errorMessages.importError)},d.send(c)};re.prototype.uploadImageUsingCustomFunction=function(o,l){var s=this;function a(c){ec(s,c)}function f(c){var d=h(c);s.updateStatusBar("upload-image",d),setTimeout(function(){s.updateStatusBar("upload-image",s.options.imageTexts.sbInit)},1e4),s.options.errorCallback(d)}function h(c){var d=s.options.imageTexts.sizeUnits.split(",");return c.replace("#image_name#",l.name).replace("#image_size#",co(l.size,d)).replace("#image_max_size#",co(s.options.imageMaxSize,d))}o.apply(this,[l,a,f])};re.prototype.setPreviewMaxHeight=function(){var o=this.codemirror,l=o.getWrapperElement(),s=l.nextSibling,a=parseInt(window.getComputedStyle(l).paddingTop),f=parseInt(window.getComputedStyle(l).borderTopWidth),h=parseInt(this.options.maxHeight),c=h+a*2+f*2,d=c.toString()+"px";s.style.height=d};re.prototype.createSideBySide=function(){var o=this.codemirror,l=o.getWrapperElement(),s=l.nextSibling;if(!s||!s.classList.contains("editor-preview-side")){if(s=document.createElement("div"),s.className="editor-preview-side",this.options.previewClass)if(Array.isArray(this.options.previewClass))for(var a=0;a"&&(l=l.substring(1)),o)try{if(o.matches)return o.matches(l);if(o.msMatchesSelector)return o.msMatchesSelector(l);if(o.webkitMatchesSelector)return o.webkitMatchesSelector(l)}catch{return!1}return!1}}function vc(o){return o.host&&o!==document&&o.host.nodeType&&o.host!==o?o.host:o.parentNode}function Gt(o,l,s,a){if(o){s=s||document;do{if(l!=null&&(l[0]===">"?o.parentNode===s&&Wo(o,l):Wo(o,l))||a&&o===s)return o;if(o===s)break}while(o=vc(o))}return null}var sc=/\s+/g;function zt(o,l,s){if(o&&l)if(o.classList)o.classList[s?"add":"remove"](l);else{var a=(" "+o.className+" ").replace(sc," ").replace(" "+l+" "," ");o.className=(a+(s?" "+l:"")).replace(sc," ")}}function ge(o,l,s){var a=o&&o.style;if(a){if(s===void 0)return document.defaultView&&document.defaultView.getComputedStyle?s=document.defaultView.getComputedStyle(o,""):o.currentStyle&&(s=o.currentStyle),l===void 0?s:s[l];!(l in a)&&l.indexOf("webkit")===-1&&(l="-webkit-"+l),a[l]=s+(typeof s=="string"?"":"px")}}function Ai(o,l){var s="";if(typeof o=="string")s=o;else do{var a=ge(o,"transform");a&&a!=="none"&&(s=a+" "+s)}while(!l&&(o=o.parentNode));var f=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return f&&new f(s)}function bc(o,l,s){if(o){var a=o.getElementsByTagName(l),f=0,h=a.length;if(s)for(;f=h:c=f<=h,!c)return a;if(a===$t())break;a=Tr(a,!1)}return!1}function Fi(o,l,s,a){for(var f=0,h=0,c=o.children;h2&&arguments[2]!==void 0?arguments[2]:{},f=a.evt,h=jp(a,r0);wn.pluginEvent.bind(me)(l,s,er({dragEl:$,parentEl:Ue,ghostEl:xe,rootEl:He,nextEl:Yr,lastDownEl:Ho,cloneEl:Re,cloneHidden:Fr,dragStarted:dn,putSortable:ft,activeSortable:me.active,originalEvent:f,oldIndex:Ei,oldDraggableIndex:vn,newIndex:Nt,newDraggableIndex:Ar,hideGhostForTarget:Ec,unhideGhostForTarget:Ac,cloneNowHidden:function(){Fr=!0},cloneNowShown:function(){Fr=!1},dispatchSortableEvent:function(d){kt({sortable:s,name:d,originalEvent:f})}},h))};function kt(o){t0(er({putSortable:ft,cloneEl:Re,targetEl:$,rootEl:He,oldIndex:Ei,oldDraggableIndex:vn,newIndex:Nt,newDraggableIndex:Ar},o))}var $,Ue,xe,He,Yr,Ho,Re,Fr,Ei,Nt,vn,Ar,zo,ft,Si=!1,Uo=!1,jo=[],Xr,jt,Dl,kl,cc,dc,dn,ki,bn,yn=!1,No=!1,Po,mt,Sl=[],Ml=!1,Go=[],Ko=typeof document<"u",Oo=Nl,hc=xn||cr?"cssFloat":"float",i0=Ko&&!gc&&!Nl&&"draggable"in document.createElement("div"),Dc=function(){if(Ko){if(cr)return!1;var o=document.createElement("x");return o.style.cssText="pointer-events:auto",o.style.pointerEvents==="auto"}}(),kc=function(l,s){var a=ge(l),f=parseInt(a.width)-parseInt(a.paddingLeft)-parseInt(a.paddingRight)-parseInt(a.borderLeftWidth)-parseInt(a.borderRightWidth),h=Fi(l,0,s),c=Fi(l,1,s),d=h&&ge(h),v=c&&ge(c),y=d&&parseInt(d.marginLeft)+parseInt(d.marginRight)+Ve(h).width,x=v&&parseInt(v.marginLeft)+parseInt(v.marginRight)+Ve(c).width;if(a.display==="flex")return a.flexDirection==="column"||a.flexDirection==="column-reverse"?"vertical":"horizontal";if(a.display==="grid")return a.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(h&&d.float&&d.float!=="none"){var D=d.float==="left"?"left":"right";return c&&(v.clear==="both"||v.clear===D)?"vertical":"horizontal"}return h&&(d.display==="block"||d.display==="flex"||d.display==="table"||d.display==="grid"||y>=f&&a[hc]==="none"||c&&a[hc]==="none"&&y+x>f)?"vertical":"horizontal"},n0=function(l,s,a){var f=a?l.left:l.top,h=a?l.right:l.bottom,c=a?l.width:l.height,d=a?s.left:s.top,v=a?s.right:s.bottom,y=a?s.width:s.height;return f===d||h===v||f+c/2===d+y/2},o0=function(l,s){var a;return jo.some(function(f){var h=f[Tt].options.emptyInsertThreshold;if(!(!h||Ol(f))){var c=Ve(f),d=l>=c.left-h&&l<=c.right+h,v=s>=c.top-h&&s<=c.bottom+h;if(d&&v)return a=f}}),a},Sc=function(l){function s(h,c){return function(d,v,y,x){var D=d.options.group.name&&v.options.group.name&&d.options.group.name===v.options.group.name;if(h==null&&(c||D))return!0;if(h==null||h===!1)return!1;if(c&&h==="clone")return h;if(typeof h=="function")return s(h(d,v,y,x),c)(d,v,y,x);var S=(c?d:v).options.group.name;return h===!0||typeof h=="string"&&h===S||h.join&&h.indexOf(S)>-1}}var a={},f=l.group;(!f||Ll(f)!="object")&&(f={name:f}),a.name=f.name,a.checkPull=s(f.pull,!0),a.checkPut=s(f.put),a.revertClone=f.revertClone,l.group=a},Ec=function(){!Dc&&xe&&ge(xe,"display","none")},Ac=function(){!Dc&&xe&&ge(xe,"display","")};Ko&&!gc&&document.addEventListener("click",function(o){if(Uo)return o.preventDefault(),o.stopPropagation&&o.stopPropagation(),o.stopImmediatePropagation&&o.stopImmediatePropagation(),Uo=!1,!1},!0);var Kr=function(l){if($){l=l.touches?l.touches[0]:l;var s=o0(l.clientX,l.clientY);if(s){var a={};for(var f in l)l.hasOwnProperty(f)&&(a[f]=l[f]);a.target=a.rootEl=s,a.preventDefault=void 0,a.stopPropagation=void 0,s[Tt]._onDragOver(a)}}},a0=function(l){$&&$.parentNode[Tt]._isOutsideThisEl(l.target)};function me(o,l){if(!(o&&o.nodeType&&o.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(o));this.el=o,this.options=l=fr({},l),o[Tt]=this;var s={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(o.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return kc(o,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(c,d){c.setData("Text",d.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:me.supportPointer!==!1&&"PointerEvent"in window&&(!gn||Nl),emptyInsertThreshold:5};wn.initializePlugins(this,o,s);for(var a in s)!(a in l)&&(l[a]=s[a]);Sc(l);for(var f in this)f.charAt(0)==="_"&&typeof this[f]=="function"&&(this[f]=this[f].bind(this));this.nativeDraggable=l.forceFallback?!1:i0,this.nativeDraggable&&(this.options.touchStartThreshold=1),l.supportPointer?Se(o,"pointerdown",this._onTapStart):(Se(o,"mousedown",this._onTapStart),Se(o,"touchstart",this._onTapStart)),this.nativeDraggable&&(Se(o,"dragover",this),Se(o,"dragenter",this)),jo.push(this.el),l.store&&l.store.get&&this.sort(l.store.get(this)||[]),fr(this,Vp())}me.prototype={constructor:me,_isOutsideThisEl:function(l){!this.el.contains(l)&&l!==this.el&&(ki=null)},_getDirection:function(l,s){return typeof this.options.direction=="function"?this.options.direction.call(this,l,s,$):this.options.direction},_onTapStart:function(l){if(l.cancelable){var s=this,a=this.el,f=this.options,h=f.preventOnFilter,c=l.type,d=l.touches&&l.touches[0]||l.pointerType&&l.pointerType==="touch"&&l,v=(d||l).target,y=l.target.shadowRoot&&(l.path&&l.path[0]||l.composedPath&&l.composedPath()[0])||v,x=f.filter;if(p0(a),!$&&!(/mousedown|pointerdown/.test(c)&&l.button!==0||f.disabled)&&!y.isContentEditable&&!(!this.nativeDraggable&&gn&&v&&v.tagName.toUpperCase()==="SELECT")&&(v=Gt(v,f.draggable,a,!1),!(v&&v.animated)&&Ho!==v)){if(Ei=It(v),vn=It(v,f.draggable),typeof x=="function"){if(x.call(this,l,v,this)){kt({sortable:s,rootEl:y,name:"filter",targetEl:v,toEl:a,fromEl:a}),Ft("filter",s,{evt:l}),h&&l.preventDefault();return}}else if(x&&(x=x.split(",").some(function(D){if(D=Gt(y,D.trim(),a,!1),D)return kt({sortable:s,rootEl:D,name:"filter",targetEl:v,fromEl:a,toEl:a}),Ft("filter",s,{evt:l}),!0}),x)){h&&l.preventDefault();return}f.handle&&!Gt(y,f.handle,a,!1)||this._prepareDragStart(l,d,v)}}},_prepareDragStart:function(l,s,a){var f=this,h=f.el,c=f.options,d=h.ownerDocument,v;if(a&&!$&&a.parentNode===h){var y=Ve(a);if(He=h,$=a,Ue=$.parentNode,Yr=$.nextSibling,Ho=a,zo=c.group,me.dragged=$,Xr={target:$,clientX:(s||l).clientX,clientY:(s||l).clientY},cc=Xr.clientX-y.left,dc=Xr.clientY-y.top,this._lastX=(s||l).clientX,this._lastY=(s||l).clientY,$.style["will-change"]="all",v=function(){if(Ft("delayEnded",f,{evt:l}),me.eventCanceled){f._onDrop();return}f._disableDelayedDragEvents(),!lc&&f.nativeDraggable&&($.draggable=!0),f._triggerDragStart(l,s),kt({sortable:f,name:"choose",originalEvent:l}),zt($,c.chosenClass,!0)},c.ignore.split(",").forEach(function(x){bc($,x.trim(),El)}),Se(d,"dragover",Kr),Se(d,"mousemove",Kr),Se(d,"touchmove",Kr),c.supportPointer?(Se(d,"pointerup",f._onDrop),!this.nativeDraggable&&Se(d,"pointercancel",f._onDrop)):(Se(d,"mouseup",f._onDrop),Se(d,"touchend",f._onDrop),Se(d,"touchcancel",f._onDrop)),lc&&this.nativeDraggable&&(this.options.touchStartThreshold=4,$.draggable=!0),Ft("delayStart",this,{evt:l}),c.delay&&(!c.delayOnTouchOnly||s)&&(!this.nativeDraggable||!(xn||cr))){if(me.eventCanceled){this._onDrop();return}c.supportPointer?(Se(d,"pointerup",f._disableDelayedDrag),Se(d,"pointercancel",f._disableDelayedDrag)):(Se(d,"mouseup",f._disableDelayedDrag),Se(d,"touchend",f._disableDelayedDrag),Se(d,"touchcancel",f._disableDelayedDrag)),Se(d,"mousemove",f._delayedDragTouchMoveHandler),Se(d,"touchmove",f._delayedDragTouchMoveHandler),c.supportPointer&&Se(d,"pointermove",f._delayedDragTouchMoveHandler),f._dragStartTimer=setTimeout(v,c.delay)}else v()}},_delayedDragTouchMoveHandler:function(l){var s=l.touches?l.touches[0]:l;Math.max(Math.abs(s.clientX-this._lastX),Math.abs(s.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){$&&El($),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var l=this.el.ownerDocument;ke(l,"mouseup",this._disableDelayedDrag),ke(l,"touchend",this._disableDelayedDrag),ke(l,"touchcancel",this._disableDelayedDrag),ke(l,"pointerup",this._disableDelayedDrag),ke(l,"pointercancel",this._disableDelayedDrag),ke(l,"mousemove",this._delayedDragTouchMoveHandler),ke(l,"touchmove",this._delayedDragTouchMoveHandler),ke(l,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(l,s){s=s||l.pointerType=="touch"&&l,!this.nativeDraggable||s?this.options.supportPointer?Se(document,"pointermove",this._onTouchMove):s?Se(document,"touchmove",this._onTouchMove):Se(document,"mousemove",this._onTouchMove):(Se($,"dragend",this),Se(He,"dragstart",this._onDragStart));try{document.selection?qo(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(l,s){if(Si=!1,He&&$){Ft("dragStarted",this,{evt:s}),this.nativeDraggable&&Se(document,"dragover",a0);var a=this.options;!l&&zt($,a.dragClass,!1),zt($,a.ghostClass,!0),me.active=this,l&&this._appendGhost(),kt({sortable:this,name:"start",originalEvent:s})}else this._nulling()},_emulateDragOver:function(){if(jt){this._lastX=jt.clientX,this._lastY=jt.clientY,Ec();for(var l=document.elementFromPoint(jt.clientX,jt.clientY),s=l;l&&l.shadowRoot&&(l=l.shadowRoot.elementFromPoint(jt.clientX,jt.clientY),l!==s);)s=l;if($.parentNode[Tt]._isOutsideThisEl(l),s)do{if(s[Tt]){var a=void 0;if(a=s[Tt]._onDragOver({clientX:jt.clientX,clientY:jt.clientY,target:l,rootEl:s}),a&&!this.options.dragoverBubble)break}l=s}while(s=vc(s));Ac()}},_onTouchMove:function(l){if(Xr){var s=this.options,a=s.fallbackTolerance,f=s.fallbackOffset,h=l.touches?l.touches[0]:l,c=xe&&Ai(xe,!0),d=xe&&c&&c.a,v=xe&&c&&c.d,y=Oo&&mt&&fc(mt),x=(h.clientX-Xr.clientX+f.x)/(d||1)+(y?y[0]-Sl[0]:0)/(d||1),D=(h.clientY-Xr.clientY+f.y)/(v||1)+(y?y[1]-Sl[1]:0)/(v||1);if(!me.active&&!Si){if(a&&Math.max(Math.abs(h.clientX-this._lastX),Math.abs(h.clientY-this._lastY))=0&&(kt({rootEl:Ue,name:"add",toEl:Ue,fromEl:He,originalEvent:l}),kt({sortable:this,name:"remove",toEl:Ue,originalEvent:l}),kt({rootEl:Ue,name:"sort",toEl:Ue,fromEl:He,originalEvent:l}),kt({sortable:this,name:"sort",toEl:Ue,originalEvent:l})),ft&&ft.save()):Nt!==Ei&&Nt>=0&&(kt({sortable:this,name:"update",toEl:Ue,originalEvent:l}),kt({sortable:this,name:"sort",toEl:Ue,originalEvent:l})),me.active&&((Nt==null||Nt===-1)&&(Nt=Ei,Ar=vn),kt({sortable:this,name:"end",toEl:Ue,originalEvent:l}),this.save()))),this._nulling()},_nulling:function(){Ft("nulling",this),He=$=Ue=xe=Yr=Re=Ho=Fr=Xr=jt=dn=Nt=Ar=Ei=vn=ki=bn=ft=zo=me.dragged=me.ghost=me.clone=me.active=null;var l=this.el;Go.forEach(function(s){l.contains(s)&&(s.checked=!0)}),Go.length=Dl=kl=0},handleEvent:function(l){switch(l.type){case"drop":case"dragend":this._onDrop(l);break;case"dragenter":case"dragover":$&&(this._onDragOver(l),l0(l));break;case"selectstart":l.preventDefault();break}},toArray:function(){for(var l=[],s,a=this.el.children,f=0,h=a.length,c=this.options;ff.right+h||o.clientY>a.bottom&&o.clientX>a.left:o.clientY>f.bottom+h||o.clientX>a.right&&o.clientY>a.top}function c0(o,l,s,a,f,h,c,d){var v=a?o.clientY:o.clientX,y=a?s.height:s.width,x=a?s.top:s.left,D=a?s.bottom:s.right,S=!1;if(!c){if(d&&Pox+y*h/2:vD-Po)return-bn}else if(v>x+y*(1-f)/2&&vD-y*h/2)?v>x+y/2?1:-1:0}function d0(o){return It($)0||D>0&&S0?"Converting "+l+" photo"+(l>1?"s":"")+"\u2026":"Uploading "+D+" photo"+(D>1?"s":"")+"\u2026",s.details.open=!0):D>0?(s.summary.textContent="\u2713 "+D+" photo"+(D>1?"s":"")+" ready \u2014 tap to review",s.details.open=!1):(s.summary.textContent="Photos (1\u20136)",s.details.open=!0)}}function c(){h(),setTimeout(h,150),setTimeout(h,500)}function d(){var x=o.querySelector('button[type="submit"], input[type="submit"]');if(x&&(x.disabled=l>0),l>0)f("Converting "+l+" photo"+(l>1?"s":"")+"\u2026");else{var D=Bc();D&&/Converting/.test(D.textContent)&&f("")}h()}o.addEventListener("submit",function(x){l>0&&(x.preventDefault(),f("Hang on \u2014 a photo is still converting.","err"))},!0);function v(x){return function(D){var S=D&&D.file;return S?Hc(S).then(function(F){return F?(l++,d(),import("./heic-to-CN7JBE7H.js").then(function(B){var L=B.heicTo||B.default&&B.default.heicTo;return L({blob:S,type:"image/jpeg",quality:.85})}).then(function(B){var L=new File([B],y0(S.name),{type:"image/jpeg"});x.addFile(L)}).catch(function(){f("A photo couldn\u2019t be converted and was skipped \u2014 the others are fine.","err")}).then(function(){l--,d()}),!1):!0}):!0}}var y=0;(function x(){var D=window.GravFilePond&&window.GravFilePond.getInstances?window.GravFilePond.getInstances():[];if(!D.length){y++<120&&setTimeout(x,50);return}D.forEach(function(S){S&&!S._heicHooked&&(S._heicHooked=!0,S.setOptions({beforeAddFile:v(S),allowReorder:!0,itemInsertLocation:"after"}),a=S,["addfile","processfile","processfiles","removefile","error"].forEach(function(F){try{S.on(F,c)}catch{}}),h())})})()}function ct(o){return document.querySelector('[name="data['+o+']"]')}function C0(){var o=Array.prototype.slice.call(document.querySelectorAll(".advanced-field"));if(o.length){var l=[];if(o.forEach(function(h){var c=h.closest(".form-field");c&&l.indexOf(c)===-1&&l.push(c)}),!!l.length){var s=document.createElement("details");s.className="more-options";var a=document.createElement("summary");a.className="more-options__summary",a.textContent="More options",s.appendChild(a),l[0].parentNode.insertBefore(s,l[0]),l.forEach(function(h){s.appendChild(h)});var f=l.some(function(h){var c=h.querySelector('input[type="text"]');if(c&&c.value.trim())return!0;var d=h.querySelector('input[type="radio"]:checked');if(!d||!d.value)return!1;var v=h.querySelector('input[type="radio"][checked]');return v?d.value!==v.value:d.value!=="0"});f&&(s.open=!0)}}}var D0={0:"Sunny",1:"Partly cloudy",2:"Partly cloudy",3:"Cloudy",45:"Foggy",48:"Foggy",51:"Drizzle",53:"Drizzle",55:"Drizzle",56:"Drizzle",57:"Drizzle",61:"Rain",63:"Rain",65:"Rain",66:"Rain",67:"Rain",80:"Rain",81:"Rain",82:"Rain",71:"Snow",73:"Snow",75:"Snow",77:"Snow",85:"Snow",86:"Snow",95:"Thunderstorm",96:"Thunderstorm",99:"Thunderstorm"};function dr(o,l,s){o&&(o.className="form-status"+(s?" form-status--"+s:""),o.textContent=l||"")}function k0(){var o=document.getElementById("get-location"),l=document.getElementById("get-weather");if(!o&&!l)return;var s=document.getElementById("location-status"),a=document.getElementById("weather-status");function f(){var d=ct("lat"),v=ct("lng"),y=d?d.value.trim():"",x=v?v.value.trim():"";return y&&x?{lat:y,lng:x}:null}function h(){if(l){var d=!!f();l.disabled=!d,l.title=d?"":"Get location first"}}h();function c(d,v){var y=ct("location_city"),x=ct("location_country");if(!((!y||y.value.trim())&&(!x||x.value.trim()))){var D="https://api.bigdatacloud.net/data/reverse-geocode-client?latitude="+encodeURIComponent(d)+"&longitude="+encodeURIComponent(v)+"&localityLanguage=en";fetch(D).then(function(S){return S.json()}).then(function(S){var F=(S.city||S.locality||"").trim(),B=(S.countryName||"").trim();y&&!y.value.trim()&&F&&(y.value=F),x&&!x.value.trim()&&B&&(x.value=B);var L=[F,B].filter(Boolean).join(", ");L&&dr(s,"\u2713 Location captured \xB7 "+L,"ok")}).catch(function(){})}}o&&o.addEventListener("click",function(){if(!navigator.geolocation){dr(s,"Geolocation is not supported on this device.","err");return}o.classList.add("is-loading"),o.disabled=!0,dr(s,"Getting location\u2026"),navigator.geolocation.getCurrentPosition(function(d){var v=d.coords.latitude.toFixed(6),y=d.coords.longitude.toFixed(6),x=ct("lat"),D=ct("lng");x&&(x.value=v),D&&(D.value=y),o.classList.remove("is-loading"),o.disabled=!1,dr(s,"\u2713 Location captured \xB7 "+v+", "+y,"ok"),h(),c(v,y);var S=document.querySelector(".location-details");S&&S.open&&Ul()},function(d){o.classList.remove("is-loading"),o.disabled=!1,dr(s,"\u2717 "+(d&&d.message?d.message:"Could not get location")+" \u2014 enter coordinates manually if needed.","err")},{enableHighAccuracy:!0,timeout:15e3})}),l&&l.addEventListener("click",function(){var d=f();if(!d){dr(a,"Get location first, then fetch weather.","err");return}l.classList.add("is-loading"),l.disabled=!0,dr(a,"Fetching weather\u2026");var v="https://api.open-meteo.com/v1/forecast?latitude="+d.lat+"&longitude="+d.lng+"¤t=temperature_2m,weather_code&temperature_unit=celsius";fetch(v).then(function(y){return y.json()}).then(function(y){var x=Math.round(y.current.temperature_2m),D=D0[y.current.weather_code]||"Cloudy",S=ct("weather_temp_c"),F=ct("weather_desc");S&&(S.value=x),F&&(F.value=D),l.classList.remove("is-loading"),h(),dr(a,"\u2713 Weather set \xB7 "+D+" \xB7 "+x+"\xB0C (edit above if needed)","ok")}).catch(function(){l.classList.remove("is-loading"),h(),dr(a,"\u2717 Could not fetch weather \u2014 set it manually above.","err")})})}var Ul=function(){};function S0(o,l){var s=null;return function(){var a=arguments;clearTimeout(s),s=setTimeout(function(){o.apply(null,a)},l)}}function E0(o){return[o.name,o.admin1,o.country].filter(Boolean).join(", ")}function A0(){var o=ct("lat"),l=ct("lng");if(!o||!l)return;var s=o.closest(".form-field"),a=l.closest(".form-field");if(!s||!a)return;var f=ct("location_city"),h=ct("location_country"),c=h?h.closest(".form-field"):null,d=c||s,v=document.createElement("details");v.className="location-details";var y=document.createElement("summary");y.className="location-details__summary",y.textContent="More location details",v.appendChild(y);var x=document.createElement("div");x.className="location-details__body";var D=document.createElement("div");D.className="location-search-row";var S=document.createElement("button");S.type="button",S.id="lookup-coords",S.className="btn-action";var F="\u{1F50D} Look up coordinates";S.textContent=F,D.appendChild(S),x.appendChild(D);var B=document.createElement("p");B.id="location-search-hint",B.className="location-search-hint",B.setAttribute("role","status"),x.appendChild(B);var L=document.createElement("ul");L.id="location-search-results",L.className="location-search-results",x.appendChild(L);var T=document.createElement("div");T.id="location-map",T.className="location-map",x.appendChild(T),v.appendChild(x),d.parentNode.insertBefore(v,d.nextSibling),v.appendChild(s),v.appendChild(a);function N(G){return G===o?"location-lat-note":"location-lng-note"}function z(){[o,l].forEach(function(G){G.classList.add("location-field--mismatch"),G.setAttribute("aria-invalid","true");var k=N(G),H=document.getElementById(k);H||(H=document.createElement("span"),H.id=k,H.className="location-field-note",H.setAttribute("role","status"),H.setAttribute("aria-live","polite"),H.textContent="Not reflected on the map yet.",G.parentNode.insertBefore(H,G.nextSibling)),G.setAttribute("aria-describedby",k)})}function O(){[o,l].forEach(function(G){G.classList.remove("location-field--mismatch"),G.removeAttribute("aria-invalid"),G.removeAttribute("aria-describedby");var k=document.getElementById(N(G));k&&k.parentNode&&k.parentNode.removeChild(k)})}var I=null;function U(G){var k=String(G).trim();return!k||!/^[+-]?(\d+(\.\d*)?|\.\d+)$/.test(k)?NaN:Number(k)}function j(){var G=U(o.value),k=U(l.value),H=isFinite(G)&&isFinite(k)&&G>=-90&&G<=90&&k>=-180&&k<=180;H?(o.value=G.toFixed(6),l.value=k.toFixed(6),O(),I&&I.setPin(G,k)):o.value.trim()||l.value.trim()?z():(O(),I&&I.clearPin())}Ul=j;function K(G){o.value=G.lat.toFixed(6),l.value=G.lng.toFixed(6),O()}v.addEventListener("toggle",function(){v.open&&Mc(T,K).then(function(G){I=G,G.resize(),j()}).catch(function(){W("Map preview unavailable \u2014 you can still enter coordinates directly."),j()})}),o.addEventListener("blur",j),l.addEventListener("blur",j);var de=S0(j,400);o.addEventListener("input",de),l.addEventListener("input",de);function W(G){B.textContent=G||""}function oe(){L.innerHTML=""}function X(G){G.forEach(function(k){var H=document.createElement("li"),q=document.createElement("button");q.type="button",q.textContent=E0(k),q.addEventListener("click",function(){o.value=Number(k.latitude).toFixed(6),l.value=Number(k.longitude).toFixed(6),oe(),j()}),H.appendChild(q),L.appendChild(H)})}S.addEventListener("click",function(){oe();var G=f?f.value.trim():"",k=h?h.value.trim():"";if(!G&&!k){W("Enter a city or country first.");return}var H=G||k;W(""),S.disabled=!0,S.textContent="Searching\u2026";var q="https://geocoding-api.open-meteo.com/v1/search?name="+encodeURIComponent(H)+"&count=10&language=en&format=json",Q=new AbortController,he=setTimeout(function(){Q.abort()},1e4);fetch(q,{signal:Q.signal}).then(function(pe){if(!pe.ok)throw new Error("geocode http "+pe.status);return pe.json()}).then(function(pe){var Ee=pe&&pe.results||[];if(!Ee.length){W("No matches \u2014 try adding a country, or drag the pin on the map.");return}if(k){var A=k.toLowerCase(),w=function(ee){return(ee.admin1||"").toLowerCase().indexOf(A)!==-1||(ee.country||"").toLowerCase().indexOf(A)!==-1};Ee=Ee.slice().sort(function(ee,Ce){var ye=w(ee),lt=w(Ce);return ye===lt?0:ye?-1:1})}X(Ee)}).catch(function(){W("Couldn\u2019t reach the lookup service \u2014 check your connection and try again, or drag the pin on the map.")}).then(function(){clearTimeout(he),S.disabled=!1,S.textContent=F})}),j()}function F0(){var o=new Date;return o.setSeconds(0,0),o.setMinutes(o.getMinutes()-o.getTimezoneOffset()),o.toISOString().slice(0,16)}function T0(){var o={title:"Title",date:"Date & time",content:"Content"},l=document.querySelector('form[name="new-entry"]');if(!l)return;var s=ct("date");s&&!String(s.value).trim()&&(s.value=F0());function a(){l.querySelectorAll(".field-error").forEach(function(c){c.remove()}),l.querySelectorAll(".field-invalid").forEach(function(c){c.classList.remove("field-invalid")})}function f(c,d){c.classList.add("field-invalid");var v=document.createElement("span");v.className="field-error",v.textContent=d,c.parentNode.insertBefore(v,c.nextSibling)}function h(c){var d=l.querySelector(".photos-collapse"),v,y;if(d?(d.open=!0,y=d.querySelector(".photos-collapse__summary"),v=d):(v=document.querySelector(".filepond-root, .form-input-file"),y=v),!y)return v||null;var x=document.createElement("span");return x.className="field-error",x.textContent=c,y.insertAdjacentElement("afterend",x),v||y}l.addEventListener("submit",function(c){a();var d=null;!Yo&&document.querySelectorAll(".filepond--item").length<1&&(d=h("Add at least one photo.")),Object.keys(o).forEach(function(y){var x=ct(y);x&&!String(x.value).trim()&&(f(x,o[y]+" is required."),d||(d=x))});var v=l.querySelector(".location-field--mismatch");v&&!d&&(d=v),d&&(c.preventDefault(),typeof d.focus=="function"&&d.focus(),d.scrollIntoView({behavior:"smooth",block:"center"}))})}var ql="intotheeast:new-entry-draft";function L0(o){return Array.prototype.slice.call(o.querySelectorAll('[name^="data["]')).filter(function(l){if(l.type==="file")return!1;var s=l.name;return s.indexOf("data[_json")!==0&&s.indexOf("data[photos")!==0})}function M0(){var o=document.querySelector(".filepond-root, .form-input-file");if(!(!o||!o.parentNode)&&!o.parentNode.querySelector(".photo-reauth-hint")){var l=document.createElement("p");l.className="photo-reauth-hint is-shown",l.textContent="Your text was restored \u2014 photos need re-selecting (they can\u2019t be saved in a draft).",o.parentNode.insertBefore(l,o.nextSibling)}}function B0(){var o=document.querySelector('form[name="new-entry"]');if(!o||Yo)return;if(document.querySelector(".notices.success")){try{localStorage.removeItem(ql)}catch{}return}function l(){var h={};L0(o).forEach(function(c){c.type==="radio"?c.checked&&(h[c.name]=c.value):h[c.name]=c.value});try{localStorage.setItem(ql,JSON.stringify(h))}catch{}}var s=null;try{s=localStorage.getItem(ql)}catch{s=null}if(s){var a=null;try{a=JSON.parse(s)}catch{a=null}if(a){var f=!1;Object.keys(a).forEach(function(h){var c=a[h];if(c!=null&&String(c).trim()&&(f=!0),h!=="data[content]"){var d=o.querySelectorAll('input[type="radio"][name="'+h+'"]');if(d.length){d.forEach(function(y){y.checked=y.value===c});return}var v=o.querySelector('[name="'+h+'"]');v&&v.type!=="file"&&(v.value=c)}}),window.postFormEditor&&a["data[content]"]!=null&&window.postFormEditor.value(a["data[content]"]),f&&M0()}}o.addEventListener("input",l),o.addEventListener("change",l),window.postFormEditor&&window.postFormEditor.codemirror.on("change",l)}function _0(){var o=document.querySelector(".post-form-wrap"),l=document.querySelector(".post-form-wrap .notices.success, .post-form-wrap .notices.green");if(!(!o||!l)){var s=document.createElement("div");s.className="post-success";var a=document.createElement("p");a.className="post-success__title",a.textContent="\u2713 Saved to your journal.",s.appendChild(a);var f=document.createElement("div");f.className="post-success__actions";var h=o.getAttribute("data-trip-url");if(h){var c=document.createElement("a");c.className="post-success__view",c.href=h,c.textContent="View your journal \u2192",f.appendChild(c)}var d=document.createElement("a");d.className="post-success__again",d.href=window.location.pathname,d.textContent="Post another",f.appendChild(d),s.appendChild(f),l.parentNode.insertBefore(s,l.nextSibling),["form",".form-action-row","#location-status","#weather-status"].forEach(function(v){var y=o.querySelector(v);y&&(y.style.display="none")}),l.scrollIntoView({behavior:"smooth",block:"start"})}}var Yo=!1;function _c(o){return new URLSearchParams(window.location.search).get(o)}function hr(o,l){var s=ct(o);s&&(s.value=l==null?"":String(l))}function Rl(o,l){var s=l?"1":"0",a=document.querySelectorAll('[name="data['+o+']"]');Array.prototype.forEach.call(a,function(f){f.checked=String(f.value)===s})}function z0(o){var l=o==null?"":String(o);if(window.postFormEditor&&typeof window.postFormEditor.value=="function")window.postFormEditor.value(l);else{var s=ct("content");s&&(s.value=l)}}function zc(o,l){var s=o.querySelectorAll("input, textarea, select, button");Array.prototype.forEach.call(s,function(a){a.type==="file"||a.name&&a.name.indexOf("data[photos")===0||(a.disabled=l)}),window.postFormEditor&&window.postFormEditor.codemirror&&window.postFormEditor.codemirror.setOption("readOnly",l?"nocursor":!1)}function Wl(o,l){o&&(o.tagName==="INPUT"?o.value=l:o.textContent=l)}function N0(o,l){var s=o.querySelector(".post-edit-error");if(s){s.textContent=l;return}var a=document.createElement("div");a.className="post-edit-error",a.setAttribute("role","alert"),a.textContent=l;var f=o.querySelector("h1");f?f.insertAdjacentElement("afterend",a):o.insertBefore(a,o.firstChild)}var O0=/\.(jpe?g|png|webp|heic|heif|gif)$/i;function Nc(o){var l=/(?:^|\/)photo-0*(\d+)\./i.exec(o);return l?parseInt(l[1],10):Number.MAX_SAFE_INTEGER}function I0(o,l){var s=Nc(o),a=Nc(l);return s!==a?s-a:ol?1:0}function Oc(o,l){var s=String(o||"photo"),a=s.lastIndexOf("."),f=(a>0?s.slice(0,a):s).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"photo",h=l?".jpg":a>0?s.slice(a).toLowerCase():".jpg",c=Date.now().toString(36)+Math.random().toString(36).slice(2,6);return f+"-"+c+h}function H0(o){var l=document.querySelector('form[name="new-entry"]');if(!l||!o)return;var s=o.split("/").filter(Boolean).pop();if(!s)return;var a=document.querySelector(".filepond-root, .form-input-file"),f=a?a.closest(".form-field"):null;f&&(f.style.display="none");var h=l.querySelector(".photos-collapse");h&&(h.style.display="none");var c=document.createElement("div");c.className="photo-editor",c.innerHTML='
    Photos

    ',f&&f.parentNode?f.parentNode.insertBefore(c,f):l.insertBefore(c,l.firstElementChild);var d=c.querySelector(".photo-editor__grid"),v=c.querySelector(".photo-editor__status"),y=c.querySelector(".photo-editor__add"),x=c.querySelector(".photo-editor__input"),D=[],S=null,F=!1,B=0;function L(X,G){v.textContent=X||"",v.className="photo-editor__status gpx-status"+(G?" error":"")}function T(X){F=X,y.disabled=X,Array.prototype.forEach.call(d.querySelectorAll(".photo-editor__del, .photo-editor__confirm-yes, .photo-editor__confirm-no"),function(G){G.disabled=X}),S&&S.option("disabled",X)}function N(){return fetch("/api/v1/pages"+o+"/media",{credentials:"include",headers:{Accept:"application/json"}}).then(function(X){if(!X.ok)throw new Error("HTTP "+X.status);return X.json()}).then(function(X){return(X&&X.data||[]).filter(function(G){return G&&typeof G.filename=="string"&&O0.test(G.filename)}).map(function(G){return G.filename}).sort(I0)})}function z(X){return Cn("/api/v1/entry/"+encodeURIComponent(s)+"/photos/order",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({order:X})})}function O(X){if(D=(X||[]).slice(),S&&(S.destroy(),S=null),d.innerHTML="",!D.length){d.innerHTML='

    No photos yet \u2014 add some.

    ';return}var G=++B;D.forEach(function(k){var H=document.createElement("div");H.className="photo-editor__cell",H.setAttribute("data-filename",k);var q=document.createElement("img");q.className="photo-editor__img",q.loading="lazy",q.alt=k,q.src=o+"/"+encodeURIComponent(k)+"?v="+G;var Q=document.createElement("button");Q.type="button",Q.className="photo-editor__del",Q.setAttribute("aria-label","Delete "+k),Q.textContent="\u2715",Q.addEventListener("click",function(){K(H,k)}),H.appendChild(q),H.appendChild(Q),d.appendChild(H)}),D.length>1&&(S=new Tc(d,{animation:150,draggable:".photo-editor__cell",filter:".photo-editor__confirm",onEnd:j}))}function I(){return Array.prototype.map.call(d.querySelectorAll(".photo-editor__cell"),function(X){return X.getAttribute("data-filename")})}function U(X,G){if(X.length!==G.length)return!1;for(var k=0;kDelete?',X.appendChild(k),X.classList.add("is-confirming"),k.querySelector(".photo-editor__confirm-no").addEventListener("click",function(){X.classList.remove("is-confirming"),k.remove()}),k.querySelector(".photo-editor__confirm-yes").addEventListener("click",function(){k.querySelector(".photo-editor__confirm-yes").disabled=!0,k.querySelector(".photo-editor__confirm-no").disabled=!0,de(G)})}}function de(X){var G=D.slice(),k=D.filter(function(H){return H!==X});T(!0),L("Deleting\u2026"),Cn("/api/v1/pages"+o+"/media/"+encodeURIComponent(X),{method:"DELETE"},[204,404]).then(function(){return(k.length?z(k):Promise.resolve()).then(N).then(function(H){L(""),O(H)},function(){L("Photo deleted, but refreshing the list failed \u2014 reload if it looks off.",!0),O(k)})},function(H){L(Pl(H,"Couldn\u2019t delete that photo. Try again."),!0),O(G)}).then(function(){T(!1)})}function W(X){return Hc(X).then(function(G){return G?import("./heic-to-CN7JBE7H.js").then(function(k){var H=k.heicTo||k.default&&k.default.heicTo;return H({blob:X,type:"image/jpeg",quality:.85})}).then(function(k){return{blob:k,name:Oc(X.name,!0)}}):{blob:X,name:Oc(X.name,!1)}})}y.addEventListener("click",function(){F||x.click()}),x.addEventListener("change",function(){var X=Array.prototype.slice.call(x.files||[]);x.value="",X.length&&oe(X)});function oe(X){T(!0);var G=X.length,k=0,H=0,q=!1,Q=D.slice(),he=Promise.resolve();X.forEach(function(pe){he=he.then(function(){return k++,L("Uploading "+k+" of "+G+"\u2026"),W(pe).then(function(Ee){var A=new FormData;return A.append("file",Ee.blob,Ee.name),Cn("/api/v1/pages"+o+"/media",{method:"POST",body:A})}).then(null,function(Ee){H++,Ee&&(Ee.status===401||Ee.status===403)&&(q=!0)})})}),he.then(function(){return L("Finishing\u2026"),N()}).then(function(pe){var Ee=Q.filter(function(ee){return pe.indexOf(ee)!==-1}),A=pe.filter(function(ee){return Q.indexOf(ee)===-1}),w=Ee.concat(A);return w.length?z(w).catch(function(){return z(w)}).catch(function(){return Promise.all(A.map(function(ee){return Cn("/api/v1/pages"+o+"/media/"+encodeURIComponent(ee),{method:"DELETE"},[204,404]).then(function(){return!0},function(){return!1})})).then(function(ee){var Ce=new Error("reorder failed");throw Ce.rolledBack=!0,Ce.rollbackIncomplete=ee.indexOf(!1)!==-1,Ce})}).then(N):(O([]),null)}).then(function(pe){pe&&O(pe),H?L(q?"Couldn\u2019t add photos \u2014 your login session expired. Sign in again, then retry.":H+" photo"+(H>1?"s":"")+" couldn\u2019t be added.",!0):L("")}).catch(function(pe){var Ee;return pe&&pe.rolledBack?Ee=pe.rollbackIncomplete?"Couldn\u2019t finish adding photos and cleanup was incomplete \u2014 reload the page and check your photos.":"Couldn\u2019t finish adding photos \u2014 changes were rolled back. Try again.":Ee="Couldn\u2019t add photos. Please try again.",L(Ee,!0),N().then(O,function(){O(Q)})}).then(function(){T(!1)})}d.innerHTML='

    Loading photos\u2026

    ',N().then(O).catch(function(){L("Couldn\u2019t load photos.",!0),O([])})}function P0(){var o=document.querySelector('form[name="new-entry"]'),l=document.querySelector(".post-form-wrap");if(!(!o||!l)){var s=_c("edit");if(s){Yo=!0;var a=l.querySelector("h1");a&&(a.textContent="Edit entry");var f=o.querySelector('button[type="submit"], input[type="submit"]'),h=f?f.tagName==="INPUT"?f.value:f.textContent:"Save changes";zc(o,!0),Wl(f,"Loading entry\u2026");var c=_c("return")||l.getAttribute("data-trip-url")||"";o.setAttribute("action","/post?edit="+encodeURIComponent(s)+(c?"&return="+encodeURIComponent(c):"")),fetch("/api/v1/pages"+s,{credentials:"include",headers:{Accept:"application/json"}}).then(function(d){if(!d.ok){var v=new Error("HTTP "+d.status);throw v.status=d.status,v}return d.json()}).then(function(d){var v=d&&d.data||{},y=v.header||{};hr("title",y.title!=null?y.title:v.title),hr("date",y.date?String(y.date).replace(" ","T"):""),z0(v.content),hr("lat",y.lat),hr("lng",y.lng),Ul(),hr("location_city",y.location_city),hr("location_country",y.location_country),hr("weather_desc",y.weather_desc),hr("weather_temp_c",y.weather_temp_c),hr("transport_mode",y.transport_mode),Rl("featured",y.featured),Rl("force_connect",y.force_connect),Rl("published",y.published!==void 0?y.published:v.published);var x=ct("edit_path");x&&(x.value=s+"/entry.md"),zc(o,!1),Wl(f,"Save changes");var D=o.querySelector(".more-options");D&&(D.open=!0),H0(s)}).catch(function(d){var v=d&&d.status===404?"This entry no longer exists \u2014 it may have been deleted. Head back to the journal.":"Sorry \u2014 this entry couldn\u2019t be loaded for editing. Check your connection and try again.";N0(l,v),Wl(f,h)})}}}function Ic(){window.postFormEditor=v0(),_0(),P0(),B0(),w0(),C0(),k0(),A0(),T0()}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Ic):Ic(); /*! Bundled license information: sortablejs/modular/sortable.esm.js: diff --git a/themes/intotheeast/js/src/post-form.js b/themes/intotheeast/js/src/post-form.js index 992928f..77999e9 100644 --- a/themes/intotheeast/js/src/post-form.js +++ b/themes/intotheeast/js/src/post-form.js @@ -719,7 +719,14 @@ function initLocationDetails() { // button stuck disabled on "Searching…" forever. var controller = new AbortController(); var timeoutId = setTimeout(function () { controller.abort(); }, 10000); - fetch(url, { signal: controller.signal }).then(function (r) { return r.json(); }).then(function (data) { + fetch(url, { signal: controller.signal }).then(function (r) { + // Without this a 4xx/5xx body (rate limit, upstream error) parses as + // JSON with no `results` key and the traveller is told their city + // does not exist — sending them off to hunt a spelling mistake that + // isn't there. Route real failures to the catch instead. + if (!r.ok) throw new Error('geocode http ' + r.status); + return r.json(); + }).then(function (data) { var list = (data && data.results) || []; if (!list.length) { setHint('No matches — try adding a country, or drag the pin on the map.'); @@ -746,8 +753,13 @@ function initLocationDetails() { } showResults(list); }).catch(function () { - // R8: network failure (including our own timeout abort) degrades - // silently — fields untouched. + // R8 revised: the fields stay untouched on failure (that part of R8 + // is the actual guarantee), but the failure is no longer invisible. + // Silence left the DOM byte-identical to the pre-click state — empty + // hint, enabled button — so a traveller on flaky mobile data could + // not tell "lookup failed" from "the button is broken". Distinct + // from the no-match message above, which means the service answered. + setHint('Couldn’t reach the lookup service — check your connection and try again, or drag the pin on the map.'); }).then(function () { clearTimeout(timeoutId); lookupBtn.disabled = false; From e0e68a9ac3859d779f750587fa54db76607681c0 Mon Sep 17 00:00:00 2001 From: Mischa Date: Fri, 24 Jul 2026 22:33:19 +0200 Subject: [PATCH 7/8] perf(post): lazy-link maplibre's stylesheet instead of bundling it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The engine was already a lazy import(), but its CSS was a static one — the usual workaround for esbuild never emitting a for a code-split chunk's stylesheet (R10). That folded the whole vendor sheet into post-form.css, so every /post load paid for a panel most submits never open, and ~78% of those bytes were rules for controls this map never creates (popups, geolocate, zoom, compass, fullscreen, terrain, scale). Build the vendor sheet as its own css-compiled/maplibre-gl.css and have location-map.js it at panel-open, concurrently with the engine's import(). Keeping the file intact rather than hand-picking the ~16 selectors in use means a maplibre upgrade can't silently un-style the map. post-form.css 92,244 → 26,784 raw (14,528 → 5,631 gzip) The href resolves from import.meta.url, so it is correct under any Grav base path without threading a URL through the template — the panel is built entirely in JS, so there is no element to hang a data-attr on. A failed stylesheet load resolves rather than rejects: the map degrades to unstyled, never to absent. The existing lazy-load guard spec already matched every maplibre-gl URL, so it covers the stylesheet too; its message now says so, and a new test asserts the other half — that opening the panel does link and apply the sheet. --- .../intotheeast/css-compiled/maplibre-gl.css | 1 + themes/intotheeast/css-compiled/post-form.css | 2 +- themes/intotheeast/js/post/post-form.js | 108 +++++++++--------- themes/intotheeast/js/src/location-map.js | 55 ++++++++- themes/intotheeast/js/src/post-form.js | 10 +- themes/intotheeast/package.json | 2 +- 6 files changed, 116 insertions(+), 62 deletions(-) create mode 100644 themes/intotheeast/css-compiled/maplibre-gl.css diff --git a/themes/intotheeast/css-compiled/maplibre-gl.css b/themes/intotheeast/css-compiled/maplibre-gl.css new file mode 100644 index 0000000..51c0b81 --- /dev/null +++ b/themes/intotheeast/css-compiled/maplibre-gl.css @@ -0,0 +1 @@ +.maplibregl-map{font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative;-webkit-tap-highlight-color:rgb(0 0 0/0)}.maplibregl-canvas{left:0;position:absolute;top:0}.maplibregl-map:fullscreen{height:100%;width:100%}.maplibregl-ctrl-group button.maplibregl-ctrl-compass{touch-action:none}.maplibregl-canvas-container.maplibregl-interactive,.maplibregl-ctrl-group button.maplibregl-ctrl-compass{cursor:grab;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:grabbing}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.maplibregl-ctrl-top-left{left:0;top:0}.maplibregl-ctrl-top-right{right:0;top:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{bottom:0;right:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{float:left;margin:10px 0 0 10px}.maplibregl-ctrl-top-right .maplibregl-ctrl{float:right;margin:10px 10px 0 0}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{float:left;margin:0 0 10px 10px}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{float:right;margin:0 10px 10px 0}.maplibregl-ctrl-group{background:#fff;border-radius:4px}.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px #0000001a}@media (forced-colors:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.maplibregl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;padding:0;width:29px}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (forced-colors:active){.maplibregl-ctrl-icon{background-color:transparent}.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl button:disabled{cursor:not-allowed}.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}.maplibregl-ctrl button:not(:disabled):hover{background-color:#0000000d}.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.maplibregl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.maplibregl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.maplibregl-ctrl-group button:focus:only-child{border-radius:inherit}.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%23333' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%2333b5e5' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23aaa' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{animation:maplibregl-spin 2s linear infinite}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23999' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23666' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}}@keyframes maplibregl-spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E");background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (forced-colors:active){a.maplibregl-ctrl-logo{background-color:transparent;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}.maplibregl-ctrl.maplibregl-ctrl-attrib{background-color:#ffffff80;margin:0;padding:0 5px}@media screen{.maplibregl-ctrl-attrib.maplibregl-compact{background-color:#fff;border-radius:12px;box-sizing:content-box;color:#000;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.maplibregl-ctrl-attrib-button{background-color:#ffffff80;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E");border:0;border-radius:12px;box-sizing:border-box;cursor:pointer;display:none;height:24px;outline:none;position:absolute;right:0;top:0;width:24px}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button{-webkit-appearance:none;-moz-appearance:none;appearance:none;list-style:none}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker{display:none}.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button{left:0}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner{display:block}.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button{background-color:#0000000d}.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{right:0;top:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{left:0;top:0}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (forced-colors:active){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%23fff' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}@media screen and (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}.maplibregl-ctrl-attrib a{color:#000000bf;text-decoration:none}.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.maplibregl-attrib-empty{display:none}.maplibregl-ctrl-scale{background-color:#ffffffbf;border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px}.maplibregl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.maplibregl-popup-anchor-top,.maplibregl-popup-anchor-top-left,.maplibregl-popup-anchor-top-right{flex-direction:column}.maplibregl-popup-anchor-bottom,.maplibregl-popup-anchor-bottom-left,.maplibregl-popup-anchor-bottom-right{flex-direction:column-reverse}.maplibregl-popup-anchor-left{flex-direction:row}.maplibregl-popup-anchor-right{flex-direction:row-reverse}.maplibregl-popup-tip{border:10px solid transparent;height:0;width:0;z-index:1}.maplibregl-popup-anchor-top .maplibregl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.maplibregl-popup-anchor-left .maplibregl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.maplibregl-popup-anchor-right .maplibregl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}.maplibregl-popup-close-button{background-color:transparent;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.maplibregl-popup-close-button:hover{background-color:#0000000d}.maplibregl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px #0000001a;padding:15px 10px;pointer-events:auto;position:relative}.maplibregl-popup-anchor-top-left .maplibregl-popup-content{border-top-left-radius:0}.maplibregl-popup-anchor-top-right .maplibregl-popup-content{border-top-right-radius:0}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-content{border-bottom-left-radius:0}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-content{border-bottom-right-radius:0}.maplibregl-popup-track-pointer{display:none}.maplibregl-popup-track-pointer *{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-map:hover .maplibregl-popup-track-pointer{display:flex}.maplibregl-map:active .maplibregl-popup-track-pointer{display:none}.maplibregl-marker{left:0;position:absolute;top:0;transition:opacity .2s;will-change:transform}.maplibregl-user-location-dot,.maplibregl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.maplibregl-user-location-dot:before{animation:maplibregl-user-location-dot-pulse 2s infinite;content:"";position:absolute}.maplibregl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px #00000059;box-sizing:border-box;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px}@keyframes maplibregl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.maplibregl-user-location-dot-stale{background-color:#aaa}.maplibregl-user-location-dot-stale:after{display:none}.maplibregl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.maplibregl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}.maplibregl-cooperative-gesture-screen{align-items:center;background:#0006;color:#fff;display:flex;font-size:1.4em;inset:0;justify-content:center;line-height:1.2;opacity:0;padding:1rem;pointer-events:none;position:absolute;transition:opacity 1s ease 1s;z-index:99999}.maplibregl-cooperative-gesture-screen.maplibregl-show{opacity:1;transition:opacity .05s}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:none}@media (hover:none),(width <= 480px){.maplibregl-cooperative-gesture-screen .maplibregl-desktop-message{display:none}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:block}}.maplibregl-pseudo-fullscreen{height:100%!important;left:0!important;position:fixed!important;top:0!important;width:100%!important;z-index:99999} diff --git a/themes/intotheeast/css-compiled/post-form.css b/themes/intotheeast/css-compiled/post-form.css index ff1d200..b4d3354 100644 --- a/themes/intotheeast/css-compiled/post-form.css +++ b/themes/intotheeast/css-compiled/post-form.css @@ -1,4 +1,4 @@ -.CodeMirror{font-family:monospace;height:300px;color:#000;direction:ltr}.CodeMirror-lines{padding:4px 0}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}.CodeMirror-guttermarker{color:#000}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror-cursor{border-left:1px solid #000;border-right:none;width:0}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.cm-fat-cursor .CodeMirror-cursor{width:auto;border:0!important;background:#7e7}.cm-fat-cursor div.CodeMirror-cursors{z-index:1}.cm-fat-cursor .CodeMirror-line::selection,.cm-fat-cursor .CodeMirror-line>span::selection,.cm-fat-cursor .CodeMirror-line>span>span::selection{background:0 0}.cm-fat-cursor .CodeMirror-line::-moz-selection,.cm-fat-cursor .CodeMirror-line>span::-moz-selection,.cm-fat-cursor .CodeMirror-line>span>span::-moz-selection{background:0 0}.cm-fat-cursor{caret-color:transparent}@-moz-keyframes blink{50%{background-color:transparent}}@-webkit-keyframes blink{50%{background-color:transparent}}@keyframes blink{50%{background-color:transparent}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-rulers{position:absolute;inset:-50px 0 0;overflow:hidden}.CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;position:absolute}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:700}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-strikethrough{text-decoration:line-through}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-type,.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta,.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-s-default .cm-error,.cm-invalidchar{color:red}.CodeMirror-composing{border-bottom:2px solid}div.CodeMirror span.CodeMirror-matchingbracket{color:#0b0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#a22}.CodeMirror-matchingtag{background:#ff96004d}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{position:relative;overflow:hidden;background:#fff}.CodeMirror-scroll{overflow:scroll!important;margin-bottom:-50px;margin-right:-50px;padding-bottom:50px;height:100%;outline:0;position:relative;z-index:0}.CodeMirror-sizer{position:relative;border-right:50px solid transparent}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none;outline:0}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;min-height:100%;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;vertical-align:top;margin-bottom:-50px}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;background:0 0!important;border:none!important}.CodeMirror-gutter-background{position:absolute;top:0;bottom:0;z-index:4}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-gutter-wrapper ::selection{background-color:transparent}.CodeMirror-gutter-wrapper ::-moz-selection{background-color:transparent}.CodeMirror-lines{cursor:text;min-height:1px}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent;-webkit-font-variant-ligatures:contextual;font-variant-ligatures:contextual}.CodeMirror-wrap pre.CodeMirror-line,.CodeMirror-wrap pre.CodeMirror-line-like{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-linebackground{position:absolute;inset:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;padding:.1px}.CodeMirror-code{outline:0}.CodeMirror-gutter,.CodeMirror-gutters,.CodeMirror-linenumber,.CodeMirror-scroll,.CodeMirror-sizer{-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-cursor{position:absolute;pointer-events:none}.CodeMirror-measure pre{position:static}div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}div.CodeMirror-dragcursors,.CodeMirror-focused div.CodeMirror-cursors{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.CodeMirror-line::selection,.CodeMirror-line>span::selection,.CodeMirror-line>span>span::selection{background:#d7d4f0}.CodeMirror-line::-moz-selection,.CodeMirror-line>span::-moz-selection,.CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}.cm-searching{background-color:#ffa;background-color:#ff06}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:""}span.CodeMirror-selectedtext{background:0 0}.EasyMDEContainer{display:block}.CodeMirror-rtl pre{direction:rtl}.EasyMDEContainer.sided--no-fullscreen{display:flex;flex-direction:row;flex-wrap:wrap}.EasyMDEContainer .CodeMirror{box-sizing:border-box;height:auto;border:1px solid #ced4da;border-bottom-left-radius:4px;border-bottom-right-radius:4px;padding:10px;font:inherit;z-index:0;word-wrap:break-word}.EasyMDEContainer .CodeMirror-scroll{cursor:text}.EasyMDEContainer .CodeMirror-fullscreen{background:#fff;position:fixed!important;inset:50px 0 0;height:auto;z-index:8;border-right:none!important;border-bottom-right-radius:0!important}.EasyMDEContainer .CodeMirror-sided{width:50%!important}.EasyMDEContainer.sided--no-fullscreen .CodeMirror-sided{border-right:none!important;border-bottom-right-radius:0;position:relative;flex:1 1 auto}.EasyMDEContainer .CodeMirror-placeholder{opacity:.5}.EasyMDEContainer .CodeMirror-focused .CodeMirror-selected{background:#d9d9d9}.editor-toolbar{position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;padding:9px 10px;border-top:1px solid #ced4da;border-left:1px solid #ced4da;border-right:1px solid #ced4da;border-top-left-radius:4px;border-top-right-radius:4px}.editor-toolbar.fullscreen{width:100%;height:50px;padding-top:10px;padding-bottom:10px;box-sizing:border-box;background:#fff;border:0;position:fixed;top:0;left:0;opacity:1;z-index:9}.editor-toolbar.fullscreen:before{width:20px;height:50px;background:-moz-linear-gradient(left,#fff 0,rgba(255,255,255,0) 100%);background:-webkit-gradient(linear,left top,right top,color-stop(0,#fff),color-stop(100%,rgba(255,255,255,0)));background:-webkit-linear-gradient(left,#fff 0,rgba(255,255,255,0) 100%);background:-o-linear-gradient(left,#fff 0,rgba(255,255,255,0) 100%);background:-ms-linear-gradient(left,#fff 0,rgba(255,255,255,0) 100%);background:linear-gradient(to right,#fff 0,#fff0);position:fixed;top:0;left:0;margin:0;padding:0}.editor-toolbar.fullscreen:after{width:20px;height:50px;background:-moz-linear-gradient(left,rgba(255,255,255,0) 0,#fff 100%);background:-webkit-gradient(linear,left top,right top,color-stop(0,rgba(255,255,255,0)),color-stop(100%,#fff));background:-webkit-linear-gradient(left,rgba(255,255,255,0) 0,#fff 100%);background:-o-linear-gradient(left,rgba(255,255,255,0) 0,#fff 100%);background:-ms-linear-gradient(left,rgba(255,255,255,0) 0,#fff 100%);background:linear-gradient(to right,#fff0 0,#fff);position:fixed;top:0;right:0;margin:0;padding:0}.EasyMDEContainer.sided--no-fullscreen .editor-toolbar{width:100%}.editor-toolbar .easymde-dropdown,.editor-toolbar button{background:0 0;display:inline-block;text-align:center;text-decoration:none!important;height:30px;margin:0;padding:0;border:1px solid transparent;border-radius:3px;cursor:pointer}.editor-toolbar button{font-weight:700;min-width:30px;padding:0 6px;white-space:nowrap}.editor-toolbar button.active,.editor-toolbar button:hover{background:#fcfcfc;border-color:#95a5a6}.editor-toolbar i.separator{display:inline-block;width:0;border-left:1px solid #d9d9d9;border-right:1px solid #fff;color:transparent;text-indent:-10px;margin:0 6px}.editor-toolbar button:after{font-family:Arial,Helvetica Neue,Helvetica,sans-serif;font-size:65%;vertical-align:text-bottom;position:relative;top:2px}.editor-toolbar button.heading-1:after{content:"1"}.editor-toolbar button.heading-2:after{content:"2"}.editor-toolbar button.heading-3:after{content:"3"}.editor-toolbar button.heading-bigger:after{content:"\25b2"}.editor-toolbar button.heading-smaller:after{content:"\25bc"}.editor-toolbar.disabled-for-preview button:not(.no-disable){opacity:.6;pointer-events:none}@media only screen and (max-width:700px){.editor-toolbar i.no-mobile{display:none}}.editor-statusbar{padding:8px 10px;font-size:12px;color:#959694;text-align:right}.EasyMDEContainer.sided--no-fullscreen .editor-statusbar{width:100%}.editor-statusbar span{display:inline-block;min-width:4em;margin-left:1em}.editor-statusbar .lines:before{content:"lines: "}.editor-statusbar .words:before{content:"words: "}.editor-statusbar .characters:before{content:"characters: "}.editor-preview-full{position:absolute;width:100%;height:100%;top:0;left:0;z-index:7;overflow:auto;display:none;box-sizing:border-box}.editor-preview-side{position:fixed;bottom:0;width:50%;top:50px;right:0;z-index:9;overflow:auto;display:none;box-sizing:border-box;border:1px solid #ddd;word-wrap:break-word}.editor-preview-active-side{display:block}.EasyMDEContainer.sided--no-fullscreen .editor-preview-active-side{flex:1 1 auto;height:auto;position:static}.editor-preview-active{display:block}.editor-preview{padding:10px;background:#fafafa}.editor-preview>p{margin-top:0}.editor-preview pre{background:#eee;margin-bottom:10px}.editor-preview table td,.editor-preview table th{border:1px solid #ddd;padding:5px}.cm-s-easymde .cm-tag{color:#63a35c}.cm-s-easymde .cm-attribute{color:#795da3}.cm-s-easymde .cm-string{color:#183691}.cm-s-easymde .cm-header-1{font-size:calc(1.375rem + 1.5vw)}.cm-s-easymde .cm-header-2{font-size:calc(1.325rem + .9vw)}.cm-s-easymde .cm-header-3{font-size:calc(1.3rem + .6vw)}.cm-s-easymde .cm-header-4{font-size:calc(1.275rem + .3vw)}.cm-s-easymde .cm-header-5{font-size:1.25rem}.cm-s-easymde .cm-header-6{font-size:1rem}.cm-s-easymde .cm-header-1,.cm-s-easymde .cm-header-2,.cm-s-easymde .cm-header-3,.cm-s-easymde .cm-header-4,.cm-s-easymde .cm-header-5,.cm-s-easymde .cm-header-6{margin-bottom:.5rem;line-height:1.2}.cm-s-easymde .cm-comment{background:#0000000d;border-radius:2px}.cm-s-easymde .cm-link{color:#7f8c8d}.cm-s-easymde .cm-url{color:#aab2b3}.cm-s-easymde .cm-quote{color:#7f8c8d;font-style:italic}.editor-toolbar .easymde-dropdown{position:relative;background:linear-gradient(to bottom right,#fff 0 84%,#333 50% 100%);border-radius:0;border:1px solid #fff}.editor-toolbar .easymde-dropdown:hover{background:linear-gradient(to bottom right,#fff 0 84%,#333 50% 100%)}.easymde-dropdown-content{display:block;visibility:hidden;position:absolute;background-color:#f9f9f9;box-shadow:0 8px 16px #0003;padding:8px;z-index:2;top:30px}.easymde-dropdown:active .easymde-dropdown-content,.easymde-dropdown:focus .easymde-dropdown-content,.easymde-dropdown:focus-within .easymde-dropdown-content{visibility:visible}.easymde-dropdown-content button{display:block}span[data-img-src]:after{content:"";background-image:var(--bg-image);display:block;max-height:100%;max-width:100%;background-size:contain;height:0;padding-top:var(--height);width:var(--width);background-repeat:no-repeat}.CodeMirror .cm-spell-error:not(.cm-url):not(.cm-comment):not(.cm-tag):not(.cm-word){background:#ff000026}.maplibregl-map{font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative;-webkit-tap-highlight-color:rgb(0 0 0/0)}.maplibregl-canvas{left:0;position:absolute;top:0}.maplibregl-map:fullscreen{height:100%;width:100%}.maplibregl-ctrl-group button.maplibregl-ctrl-compass{touch-action:none}.maplibregl-canvas-container.maplibregl-interactive,.maplibregl-ctrl-group button.maplibregl-ctrl-compass{cursor:grab;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:grabbing}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.maplibregl-ctrl-top-left{left:0;top:0}.maplibregl-ctrl-top-right{right:0;top:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{bottom:0;right:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{float:left;margin:10px 0 0 10px}.maplibregl-ctrl-top-right .maplibregl-ctrl{float:right;margin:10px 10px 0 0}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{float:left;margin:0 0 10px 10px}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{float:right;margin:0 10px 10px 0}.maplibregl-ctrl-group{background:#fff;border-radius:4px}.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px #0000001a}@media (forced-colors:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.maplibregl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;padding:0;width:29px}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (forced-colors:active){.maplibregl-ctrl-icon{background-color:transparent}.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl button:disabled{cursor:not-allowed}.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}.maplibregl-ctrl button:not(:disabled):hover{background-color:#0000000d}.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.maplibregl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.maplibregl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.maplibregl-ctrl-group button:focus:only-child{border-radius:inherit}.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%23333' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%2333b5e5' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23aaa' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{animation:maplibregl-spin 2s linear infinite}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23999' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23666' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}}@keyframes maplibregl-spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E");background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (forced-colors:active){a.maplibregl-ctrl-logo{background-color:transparent;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}.maplibregl-ctrl.maplibregl-ctrl-attrib{background-color:#ffffff80;margin:0;padding:0 5px}@media screen{.maplibregl-ctrl-attrib.maplibregl-compact{background-color:#fff;border-radius:12px;box-sizing:content-box;color:#000;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.maplibregl-ctrl-attrib-button{background-color:#ffffff80;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E");border:0;border-radius:12px;box-sizing:border-box;cursor:pointer;display:none;height:24px;outline:none;position:absolute;right:0;top:0;width:24px}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button{-webkit-appearance:none;-moz-appearance:none;appearance:none;list-style:none}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker{display:none}.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button{left:0}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner{display:block}.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button{background-color:#0000000d}.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{right:0;top:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{left:0;top:0}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (forced-colors:active){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%23fff' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}@media screen and (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}.maplibregl-ctrl-attrib a{color:#000000bf;text-decoration:none}.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.maplibregl-attrib-empty{display:none}.maplibregl-ctrl-scale{background-color:#ffffffbf;border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px}.maplibregl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.maplibregl-popup-anchor-top,.maplibregl-popup-anchor-top-left,.maplibregl-popup-anchor-top-right{flex-direction:column}.maplibregl-popup-anchor-bottom,.maplibregl-popup-anchor-bottom-left,.maplibregl-popup-anchor-bottom-right{flex-direction:column-reverse}.maplibregl-popup-anchor-left{flex-direction:row}.maplibregl-popup-anchor-right{flex-direction:row-reverse}.maplibregl-popup-tip{border:10px solid transparent;height:0;width:0;z-index:1}.maplibregl-popup-anchor-top .maplibregl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.maplibregl-popup-anchor-left .maplibregl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.maplibregl-popup-anchor-right .maplibregl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}.maplibregl-popup-close-button{background-color:transparent;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.maplibregl-popup-close-button:hover{background-color:#0000000d}.maplibregl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px #0000001a;padding:15px 10px;pointer-events:auto;position:relative}.maplibregl-popup-anchor-top-left .maplibregl-popup-content{border-top-left-radius:0}.maplibregl-popup-anchor-top-right .maplibregl-popup-content{border-top-right-radius:0}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-content{border-bottom-left-radius:0}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-content{border-bottom-right-radius:0}.maplibregl-popup-track-pointer{display:none}.maplibregl-popup-track-pointer *{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-map:hover .maplibregl-popup-track-pointer{display:flex}.maplibregl-map:active .maplibregl-popup-track-pointer{display:none}.maplibregl-marker{left:0;position:absolute;top:0;transition:opacity .2s;will-change:transform}.maplibregl-user-location-dot,.maplibregl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.maplibregl-user-location-dot:before{animation:maplibregl-user-location-dot-pulse 2s infinite;content:"";position:absolute}.maplibregl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px #00000059;box-sizing:border-box;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px}@keyframes maplibregl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.maplibregl-user-location-dot-stale{background-color:#aaa}.maplibregl-user-location-dot-stale:after{display:none}.maplibregl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.maplibregl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}.maplibregl-cooperative-gesture-screen{align-items:center;background:#0006;color:#fff;display:flex;font-size:1.4em;inset:0;justify-content:center;line-height:1.2;opacity:0;padding:1rem;pointer-events:none;position:absolute;transition:opacity 1s ease 1s;z-index:99999}.maplibregl-cooperative-gesture-screen.maplibregl-show{opacity:1;transition:opacity .05s}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:none}@media (hover:none),(width <= 480px){.maplibregl-cooperative-gesture-screen .maplibregl-desktop-message{display:none}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:block}}.maplibregl-pseudo-fullscreen{height:100%!important;left:0!important;position:fixed!important;top:0!important;width:100%!important;z-index:99999}.post-edit-error{margin:1rem 0;padding:.75rem 1rem;border:1px solid #E5786A;border-radius:8px;background:#e5786a1f;color:#e5786a;font-size:.9rem;line-height:1.4}.editor-toolbar .mde-btn:before{font-style:normal;font-weight:400;font-family:inherit}.editor-toolbar .mde-bold:before{content:"B";font-weight:700}.editor-toolbar .mde-italic:before{content:"I";font-style:italic}.editor-toolbar .mde-ul:before{content:"\2022\2002\2014"}.editor-toolbar .mde-link:before{content:"\1f517"}.editor-toolbar .mde-preview:before{content:"\1f441"}.EasyMDEContainer .CodeMirror{min-height:180px}.photo-convert-status:empty{display:none}.photo-convert-status{font-size:var(--text-sm);margin-top:var(--space-2)}.photo-reauth-hint{display:none;font-size:var(--text-sm);color:var(--color-ink-muted);margin-top:var(--space-2)}.photo-reauth-hint.is-shown{display:block}.post-form-wrap select{width:100%;font-family:var(--font-ui);font-size:var(--text-base);padding:.875rem 2.5rem .875rem 1rem;min-height:44px;border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-canvas);color:var(--color-ink);-webkit-appearance:none;appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2390887E' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 1rem center}.post-form-wrap select:focus{outline:2px solid var(--color-accent);outline-offset:1px;border-color:var(--color-accent)}.post-form-wrap input[type=number]{width:100%;font-family:var(--font-ui);font-size:var(--text-base);padding:.875rem 1rem;min-height:44px;border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-canvas);color:var(--color-ink);-webkit-appearance:none;appearance:none}.post-form-wrap input[type=number]:focus{outline:2px solid var(--color-accent);outline-offset:1px;border-color:var(--color-accent)}.more-options{margin-bottom:var(--space-5);border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-canvas)}.more-options__summary{cursor:pointer;padding:.875rem 1rem;min-height:44px;display:flex;align-items:center;font-family:var(--font-ui);font-size:var(--text-sm);font-weight:600;color:var(--color-ink);list-style:none;user-select:none}.more-options__summary::-webkit-details-marker{display:none}.more-options__summary:before{content:"\25b8";margin-right:var(--space-2);color:var(--color-ink-muted);transition:transform .15s}.more-options[open] .more-options__summary:before{transform:rotate(90deg)}.more-options[open] .more-options__summary{border-bottom:1px solid var(--color-border)}.more-options>.form-field{padding:0 1rem}.more-options>.form-field:first-of-type{padding-top:var(--space-4)}.more-options>.form-field:last-child{padding-bottom:var(--space-4);margin-bottom:0}.btn-action.is-loading{position:relative;color:transparent;pointer-events:none}.btn-action.is-loading:after{content:"";position:absolute;top:50%;left:50%;width:16px;height:16px;margin:-8px 0 0 -8px;border:2px solid var(--color-ink-muted);border-top-color:var(--color-accent);border-radius:50%;animation:post-spin .7s linear infinite}.btn-action[disabled]{opacity:.5;cursor:not-allowed}@keyframes post-spin{to{transform:rotate(360deg)}}.post-form-wrap .notices{padding:1rem 1.1rem;border-radius:var(--radius-md);font-size:var(--text-base);margin:0 0 var(--space-5);background:var(--color-canvas);color:var(--color-ink);border-left:4px solid var(--color-accent)}.post-form-wrap .notices p{margin:0}.post-form-wrap .notices.error,.post-form-wrap .notices.red{border-left-color:var(--color-error)}.post-form-wrap .notices.success,.post-form-wrap .notices.green{border-left-color:var(--color-accent)}.post-success{margin:0 0 var(--space-5);padding:1.1rem;border-radius:var(--radius-md);background:var(--color-accent-light);border:1px solid var(--color-accent)}.post-success__title{font-family:var(--font-ui);font-size:var(--text-md);font-weight:600;color:var(--color-ink);margin:0 0 var(--space-3)}.post-success__actions{display:flex;flex-wrap:wrap;gap:var(--space-3)}.post-success__view{flex:1;min-width:140px;text-align:center;padding:.8rem 1rem;min-height:44px;border-radius:var(--radius-md);background:var(--color-accent);color:var(--color-accent-on);font-weight:600;text-decoration:none}.post-success__again{flex:1;min-width:140px;text-align:center;padding:.8rem 1rem;min-height:44px;border-radius:var(--radius-md);background:transparent;color:var(--color-ink);border:1px solid var(--color-border);font-weight:600;text-decoration:none}.filepond--credits{display:none!important}.filepond--root{font-family:var(--font-ui);font-size:var(--text-base)}.filepond--panel-root{background-color:var(--color-canvas);border:1px solid var(--color-border);border-radius:var(--radius-md)}.filepond--drop-label,.filepond--drop-label label{color:var(--color-ink-muted)}.filepond--label-action{color:var(--color-accent);text-decoration-color:var(--color-accent)}.filepond--item-panel{background-color:var(--color-surface-raised);border-radius:var(--radius-md)}.filepond--drip-blob{background-color:var(--color-accent)}.filepond--file{color:var(--color-ink)}.filepond--file-action-button{color:var(--color-ink);background-color:#00000073}.filepond--file-action-button:hover{background-color:#000000a6}.filepond--image-preview-overlay{display:none!important}.filepond--item[data-filepond-item-state=processing-complete] .filepond--file-info,.filepond--item[data-filepond-item-state=processing-complete] .filepond--file-status{opacity:0}.filepond--item[data-filepond-item-state=processing-complete]:after{content:"\2713";position:absolute;top:8px;right:8px;z-index:5;width:24px;height:24px;line-height:24px;text-align:center;border-radius:50%;background:var(--color-accent);color:#fff;font-size:15px;font-weight:700;box-shadow:0 1px 3px #00000059;pointer-events:none}.filepond--list.filepond--list{margin:.25rem}.filepond--item{width:calc(33.333% - .5rem)}.filepond--item .filepond--panel-root,.filepond--item .filepond--image-preview-wrapper{border-radius:var(--radius-sm)}.filepond--image-preview,.filepond--image-preview-wrapper,.filepond--image-clip,.filepond--image-preview canvas,.filepond--image-bitmap,.filepond--file img{-webkit-user-drag:none;-khtml-user-drag:none;user-drag:none}.filepond--item[data-filepond-item-state=idle] .filepond--file-info,.filepond--item[data-filepond-item-state=idle] .filepond--file-status{opacity:0}.photos-collapse{margin-bottom:var(--space-5);border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-canvas)}.photos-collapse__summary{cursor:pointer;padding:.875rem 1rem;min-height:44px;display:flex;align-items:center;font-family:var(--font-ui);font-size:var(--text-sm);font-weight:600;color:var(--color-ink);list-style:none;user-select:none}.photos-collapse__summary::-webkit-details-marker{display:none}.photos-collapse__summary:before{content:"\25b8";margin-right:var(--space-2);color:var(--color-ink-muted);transition:transform .15s}.photos-collapse[open] .photos-collapse__summary:before{transform:rotate(90deg)}.photos-collapse[open] .photos-collapse__summary{border-bottom:1px solid var(--color-border)}.photos-collapse>:not(summary){padding-left:1rem;padding-right:1rem}.photos-collapse[open] .filepond--root,.photos-collapse[open] .filepond-root{margin:var(--space-4) 0}.photos-collapse[open]>.photo-convert-status:last-child,.photos-collapse[open]>.photo-reauth-hint:last-child{padding-bottom:var(--space-4)}.EasyMDEContainer .CodeMirror{background:var(--color-canvas);color:var(--color-ink);border:1px solid var(--color-border);border-radius:0 0 var(--radius-md) var(--radius-md);font-family:var(--font-ui);font-size:var(--text-base);line-height:var(--leading-normal);padding:var(--space-1)}.EasyMDEContainer .CodeMirror-cursor{border-color:var(--color-ink)}.EasyMDEContainer .CodeMirror-selected{background:var(--color-accent-light)!important}.EasyMDEContainer .editor-toolbar{background:var(--color-surface-raised);border:1px solid var(--color-border);border-bottom:none;border-radius:var(--radius-md) var(--radius-md) 0 0;opacity:1}.EasyMDEContainer .editor-toolbar button{color:var(--color-ink)!important;min-width:34px;height:34px}.EasyMDEContainer .editor-toolbar button:hover,.EasyMDEContainer .editor-toolbar button.active{background:var(--color-accent-light);border-color:var(--color-border)}.EasyMDEContainer .editor-toolbar i.separator{border-color:var(--color-border)}.EasyMDEContainer .editor-preview,.EasyMDEContainer .editor-preview-side{background:var(--color-canvas);color:var(--color-ink)}.EasyMDEContainer .editor-preview a{color:var(--color-accent)}.photo-editor{margin-bottom:var(--space-5)}.photo-editor__head{display:flex;align-items:center;justify-content:space-between;gap:var(--space-3);margin-bottom:var(--space-2)}.photo-editor__label{font-family:var(--font-ui);font-size:var(--text-base);font-weight:600;color:var(--color-ink)}.photo-editor__add{font-family:var(--font-ui);font-size:var(--text-sm);background:var(--color-accent);color:#fff;border:none;border-radius:var(--radius-sm);padding:var(--space-2) var(--space-4);cursor:pointer}.photo-editor__add:disabled{opacity:.5;cursor:default}.photo-editor__status{font-size:var(--text-sm);color:var(--color-ink-muted);min-height:1.2em;margin:0 0 var(--space-2)}.photo-editor__status.error{color:var(--color-error)}.photo-editor__grid{display:grid;grid-template-columns:repeat(3,1fr);gap:var(--space-2)}@media (min-width: 600px){.photo-editor__grid{grid-template-columns:repeat(4,1fr)}}.photo-editor__loading,.photo-editor__empty{grid-column:1 / -1;color:var(--color-ink-muted);font-size:var(--text-sm);padding:var(--space-4) 0}.photo-editor__cell{position:relative;aspect-ratio:1 / 1;border-radius:var(--radius-sm);overflow:hidden;background:var(--color-surface-raised);cursor:grab;touch-action:none}.photo-editor__cell:active{cursor:grabbing}.photo-editor__img{width:100%;height:100%;object-fit:cover;display:block;-webkit-user-drag:none;user-select:none;pointer-events:none}.photo-editor__cell:first-child:after{content:"Cover";position:absolute;left:var(--space-1);bottom:var(--space-1);font-family:var(--font-ui);font-size:var(--text-xs, .7rem);font-weight:600;color:#fff;background:var(--color-accent);padding:1px 6px;border-radius:var(--radius-sm);pointer-events:none}.photo-editor__del{position:absolute;top:var(--space-1);right:var(--space-1);width:24px;height:24px;line-height:1;display:flex;align-items:center;justify-content:center;border:none;border-radius:50%;background:#0000008c;color:#fff;font-size:.85rem;cursor:pointer}.photo-editor__del:hover{background:#000000bf}.photo-editor__del:disabled{opacity:.4;cursor:default}.photo-editor__confirm{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--space-1);padding:var(--space-2);background:#000000b8;text-align:center}.photo-editor__confirm-q{color:#fff;font-family:var(--font-ui);font-size:var(--text-sm)}.photo-editor__confirm button{font-family:var(--font-ui);font-size:var(--text-xs, .72rem);border:none;border-radius:var(--radius-sm);padding:3px 10px;cursor:pointer}.photo-editor__confirm-yes{background:var(--color-error);color:#fff}.photo-editor__confirm-no{background:#fff;color:var(--color-ink)}.photo-editor__confirm button:disabled{opacity:.5;cursor:default}.photo-editor__cell.sortable-ghost{opacity:.4}.photo-editor__cell.sortable-chosen{outline:2px solid var(--color-accent)}.location-details{margin-bottom:var(--space-5);border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-canvas)}.location-details__summary{cursor:pointer;padding:.875rem 1rem;min-height:44px;display:flex;align-items:center;font-family:var(--font-ui);font-size:var(--text-sm);font-weight:600;color:var(--color-ink);list-style:none;user-select:none}.location-details__summary::-webkit-details-marker{display:none}.location-details__summary:before{content:"\25b8";margin-right:var(--space-2);color:var(--color-ink-muted);transition:transform .15s}.location-details[open] .location-details__summary:before{transform:rotate(90deg)}.location-details[open] .location-details__summary{border-bottom:1px solid var(--color-border)}.location-details>.form-field{padding:0 1rem}.location-details>.form-field:first-of-type{padding-top:var(--space-4)}.location-details>.form-field:last-of-type{padding-bottom:var(--space-2)}.location-details__body{padding:1rem}.location-search-row{display:flex;gap:var(--space-3);align-items:center;flex-wrap:wrap}.location-search-hint{font-size:var(--text-sm);color:var(--color-ink-muted);margin-top:var(--space-2)}.location-search-hint:empty{display:none}.location-search-results{list-style:none;margin:var(--space-3) 0 0;padding:0;border:1px solid var(--color-border);border-radius:var(--radius-md);overflow:hidden}.location-search-results:empty{display:none;margin:0;border:none}.location-search-results li+li{border-top:1px solid var(--color-border)}.location-search-results button{display:block;width:100%;text-align:left;padding:.75rem 1rem;min-height:44px;background:var(--color-canvas);border:none;font-family:var(--font-ui);font-size:var(--text-sm);color:var(--color-ink);cursor:pointer}.location-search-results button:hover,.location-search-results button:focus-visible{background:var(--color-paper)}.location-map{position:relative;width:100%;height:240px;margin-top:var(--space-4);border-radius:var(--radius-md);overflow:hidden;background:var(--color-paper)}.location-map .maplibregl-canvas{border-radius:var(--radius-md)}.location-pin{width:44px;height:44px;border-radius:50%;background:var(--color-accent);border:3px solid #fff;box-shadow:0 1px 6px #00000080;cursor:grab}.location-pin:active{cursor:grabbing}.location-field--mismatch{border-color:var(--color-error)!important;outline-color:var(--color-error)!important}.location-field-note{display:block;font-size:var(--text-sm);color:var(--color-error);margin-top:var(--space-1)} +.CodeMirror{font-family:monospace;height:300px;color:#000;direction:ltr}.CodeMirror-lines{padding:4px 0}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}.CodeMirror-guttermarker{color:#000}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror-cursor{border-left:1px solid #000;border-right:none;width:0}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.cm-fat-cursor .CodeMirror-cursor{width:auto;border:0!important;background:#7e7}.cm-fat-cursor div.CodeMirror-cursors{z-index:1}.cm-fat-cursor .CodeMirror-line::selection,.cm-fat-cursor .CodeMirror-line>span::selection,.cm-fat-cursor .CodeMirror-line>span>span::selection{background:0 0}.cm-fat-cursor .CodeMirror-line::-moz-selection,.cm-fat-cursor .CodeMirror-line>span::-moz-selection,.cm-fat-cursor .CodeMirror-line>span>span::-moz-selection{background:0 0}.cm-fat-cursor{caret-color:transparent}@-moz-keyframes blink{50%{background-color:transparent}}@-webkit-keyframes blink{50%{background-color:transparent}}@keyframes blink{50%{background-color:transparent}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-rulers{position:absolute;inset:-50px 0 0;overflow:hidden}.CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;position:absolute}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:700}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-strikethrough{text-decoration:line-through}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-type,.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta,.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-s-default .cm-error,.cm-invalidchar{color:red}.CodeMirror-composing{border-bottom:2px solid}div.CodeMirror span.CodeMirror-matchingbracket{color:#0b0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#a22}.CodeMirror-matchingtag{background:#ff96004d}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{position:relative;overflow:hidden;background:#fff}.CodeMirror-scroll{overflow:scroll!important;margin-bottom:-50px;margin-right:-50px;padding-bottom:50px;height:100%;outline:0;position:relative;z-index:0}.CodeMirror-sizer{position:relative;border-right:50px solid transparent}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none;outline:0}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;min-height:100%;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;vertical-align:top;margin-bottom:-50px}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;background:0 0!important;border:none!important}.CodeMirror-gutter-background{position:absolute;top:0;bottom:0;z-index:4}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-gutter-wrapper ::selection{background-color:transparent}.CodeMirror-gutter-wrapper ::-moz-selection{background-color:transparent}.CodeMirror-lines{cursor:text;min-height:1px}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent;-webkit-font-variant-ligatures:contextual;font-variant-ligatures:contextual}.CodeMirror-wrap pre.CodeMirror-line,.CodeMirror-wrap pre.CodeMirror-line-like{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-linebackground{position:absolute;inset:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;padding:.1px}.CodeMirror-code{outline:0}.CodeMirror-gutter,.CodeMirror-gutters,.CodeMirror-linenumber,.CodeMirror-scroll,.CodeMirror-sizer{-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-cursor{position:absolute;pointer-events:none}.CodeMirror-measure pre{position:static}div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}div.CodeMirror-dragcursors,.CodeMirror-focused div.CodeMirror-cursors{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.CodeMirror-line::selection,.CodeMirror-line>span::selection,.CodeMirror-line>span>span::selection{background:#d7d4f0}.CodeMirror-line::-moz-selection,.CodeMirror-line>span::-moz-selection,.CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}.cm-searching{background-color:#ffa;background-color:#ff06}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:""}span.CodeMirror-selectedtext{background:0 0}.EasyMDEContainer{display:block}.CodeMirror-rtl pre{direction:rtl}.EasyMDEContainer.sided--no-fullscreen{display:flex;flex-direction:row;flex-wrap:wrap}.EasyMDEContainer .CodeMirror{box-sizing:border-box;height:auto;border:1px solid #ced4da;border-bottom-left-radius:4px;border-bottom-right-radius:4px;padding:10px;font:inherit;z-index:0;word-wrap:break-word}.EasyMDEContainer .CodeMirror-scroll{cursor:text}.EasyMDEContainer .CodeMirror-fullscreen{background:#fff;position:fixed!important;inset:50px 0 0;height:auto;z-index:8;border-right:none!important;border-bottom-right-radius:0!important}.EasyMDEContainer .CodeMirror-sided{width:50%!important}.EasyMDEContainer.sided--no-fullscreen .CodeMirror-sided{border-right:none!important;border-bottom-right-radius:0;position:relative;flex:1 1 auto}.EasyMDEContainer .CodeMirror-placeholder{opacity:.5}.EasyMDEContainer .CodeMirror-focused .CodeMirror-selected{background:#d9d9d9}.editor-toolbar{position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;padding:9px 10px;border-top:1px solid #ced4da;border-left:1px solid #ced4da;border-right:1px solid #ced4da;border-top-left-radius:4px;border-top-right-radius:4px}.editor-toolbar.fullscreen{width:100%;height:50px;padding-top:10px;padding-bottom:10px;box-sizing:border-box;background:#fff;border:0;position:fixed;top:0;left:0;opacity:1;z-index:9}.editor-toolbar.fullscreen:before{width:20px;height:50px;background:-moz-linear-gradient(left,#fff 0,rgba(255,255,255,0) 100%);background:-webkit-gradient(linear,left top,right top,color-stop(0,#fff),color-stop(100%,rgba(255,255,255,0)));background:-webkit-linear-gradient(left,#fff 0,rgba(255,255,255,0) 100%);background:-o-linear-gradient(left,#fff 0,rgba(255,255,255,0) 100%);background:-ms-linear-gradient(left,#fff 0,rgba(255,255,255,0) 100%);background:linear-gradient(to right,#fff 0,#fff0);position:fixed;top:0;left:0;margin:0;padding:0}.editor-toolbar.fullscreen:after{width:20px;height:50px;background:-moz-linear-gradient(left,rgba(255,255,255,0) 0,#fff 100%);background:-webkit-gradient(linear,left top,right top,color-stop(0,rgba(255,255,255,0)),color-stop(100%,#fff));background:-webkit-linear-gradient(left,rgba(255,255,255,0) 0,#fff 100%);background:-o-linear-gradient(left,rgba(255,255,255,0) 0,#fff 100%);background:-ms-linear-gradient(left,rgba(255,255,255,0) 0,#fff 100%);background:linear-gradient(to right,#fff0 0,#fff);position:fixed;top:0;right:0;margin:0;padding:0}.EasyMDEContainer.sided--no-fullscreen .editor-toolbar{width:100%}.editor-toolbar .easymde-dropdown,.editor-toolbar button{background:0 0;display:inline-block;text-align:center;text-decoration:none!important;height:30px;margin:0;padding:0;border:1px solid transparent;border-radius:3px;cursor:pointer}.editor-toolbar button{font-weight:700;min-width:30px;padding:0 6px;white-space:nowrap}.editor-toolbar button.active,.editor-toolbar button:hover{background:#fcfcfc;border-color:#95a5a6}.editor-toolbar i.separator{display:inline-block;width:0;border-left:1px solid #d9d9d9;border-right:1px solid #fff;color:transparent;text-indent:-10px;margin:0 6px}.editor-toolbar button:after{font-family:Arial,Helvetica Neue,Helvetica,sans-serif;font-size:65%;vertical-align:text-bottom;position:relative;top:2px}.editor-toolbar button.heading-1:after{content:"1"}.editor-toolbar button.heading-2:after{content:"2"}.editor-toolbar button.heading-3:after{content:"3"}.editor-toolbar button.heading-bigger:after{content:"\25b2"}.editor-toolbar button.heading-smaller:after{content:"\25bc"}.editor-toolbar.disabled-for-preview button:not(.no-disable){opacity:.6;pointer-events:none}@media only screen and (max-width:700px){.editor-toolbar i.no-mobile{display:none}}.editor-statusbar{padding:8px 10px;font-size:12px;color:#959694;text-align:right}.EasyMDEContainer.sided--no-fullscreen .editor-statusbar{width:100%}.editor-statusbar span{display:inline-block;min-width:4em;margin-left:1em}.editor-statusbar .lines:before{content:"lines: "}.editor-statusbar .words:before{content:"words: "}.editor-statusbar .characters:before{content:"characters: "}.editor-preview-full{position:absolute;width:100%;height:100%;top:0;left:0;z-index:7;overflow:auto;display:none;box-sizing:border-box}.editor-preview-side{position:fixed;bottom:0;width:50%;top:50px;right:0;z-index:9;overflow:auto;display:none;box-sizing:border-box;border:1px solid #ddd;word-wrap:break-word}.editor-preview-active-side{display:block}.EasyMDEContainer.sided--no-fullscreen .editor-preview-active-side{flex:1 1 auto;height:auto;position:static}.editor-preview-active{display:block}.editor-preview{padding:10px;background:#fafafa}.editor-preview>p{margin-top:0}.editor-preview pre{background:#eee;margin-bottom:10px}.editor-preview table td,.editor-preview table th{border:1px solid #ddd;padding:5px}.cm-s-easymde .cm-tag{color:#63a35c}.cm-s-easymde .cm-attribute{color:#795da3}.cm-s-easymde .cm-string{color:#183691}.cm-s-easymde .cm-header-1{font-size:calc(1.375rem + 1.5vw)}.cm-s-easymde .cm-header-2{font-size:calc(1.325rem + .9vw)}.cm-s-easymde .cm-header-3{font-size:calc(1.3rem + .6vw)}.cm-s-easymde .cm-header-4{font-size:calc(1.275rem + .3vw)}.cm-s-easymde .cm-header-5{font-size:1.25rem}.cm-s-easymde .cm-header-6{font-size:1rem}.cm-s-easymde .cm-header-1,.cm-s-easymde .cm-header-2,.cm-s-easymde .cm-header-3,.cm-s-easymde .cm-header-4,.cm-s-easymde .cm-header-5,.cm-s-easymde .cm-header-6{margin-bottom:.5rem;line-height:1.2}.cm-s-easymde .cm-comment{background:#0000000d;border-radius:2px}.cm-s-easymde .cm-link{color:#7f8c8d}.cm-s-easymde .cm-url{color:#aab2b3}.cm-s-easymde .cm-quote{color:#7f8c8d;font-style:italic}.editor-toolbar .easymde-dropdown{position:relative;background:linear-gradient(to bottom right,#fff 0 84%,#333 50% 100%);border-radius:0;border:1px solid #fff}.editor-toolbar .easymde-dropdown:hover{background:linear-gradient(to bottom right,#fff 0 84%,#333 50% 100%)}.easymde-dropdown-content{display:block;visibility:hidden;position:absolute;background-color:#f9f9f9;box-shadow:0 8px 16px #0003;padding:8px;z-index:2;top:30px}.easymde-dropdown:active .easymde-dropdown-content,.easymde-dropdown:focus .easymde-dropdown-content,.easymde-dropdown:focus-within .easymde-dropdown-content{visibility:visible}.easymde-dropdown-content button{display:block}span[data-img-src]:after{content:"";background-image:var(--bg-image);display:block;max-height:100%;max-width:100%;background-size:contain;height:0;padding-top:var(--height);width:var(--width);background-repeat:no-repeat}.CodeMirror .cm-spell-error:not(.cm-url):not(.cm-comment):not(.cm-tag):not(.cm-word){background:#ff000026}.post-edit-error{margin:1rem 0;padding:.75rem 1rem;border:1px solid #E5786A;border-radius:8px;background:#e5786a1f;color:#e5786a;font-size:.9rem;line-height:1.4}.editor-toolbar .mde-btn:before{font-style:normal;font-weight:400;font-family:inherit}.editor-toolbar .mde-bold:before{content:"B";font-weight:700}.editor-toolbar .mde-italic:before{content:"I";font-style:italic}.editor-toolbar .mde-ul:before{content:"\2022\2002\2014"}.editor-toolbar .mde-link:before{content:"\1f517"}.editor-toolbar .mde-preview:before{content:"\1f441"}.EasyMDEContainer .CodeMirror{min-height:180px}.photo-convert-status:empty{display:none}.photo-convert-status{font-size:var(--text-sm);margin-top:var(--space-2)}.photo-reauth-hint{display:none;font-size:var(--text-sm);color:var(--color-ink-muted);margin-top:var(--space-2)}.photo-reauth-hint.is-shown{display:block}.post-form-wrap select{width:100%;font-family:var(--font-ui);font-size:var(--text-base);padding:.875rem 2.5rem .875rem 1rem;min-height:44px;border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-canvas);color:var(--color-ink);-webkit-appearance:none;appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2390887E' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 1rem center}.post-form-wrap select:focus{outline:2px solid var(--color-accent);outline-offset:1px;border-color:var(--color-accent)}.post-form-wrap input[type=number]{width:100%;font-family:var(--font-ui);font-size:var(--text-base);padding:.875rem 1rem;min-height:44px;border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-canvas);color:var(--color-ink);-webkit-appearance:none;appearance:none}.post-form-wrap input[type=number]:focus{outline:2px solid var(--color-accent);outline-offset:1px;border-color:var(--color-accent)}.more-options{margin-bottom:var(--space-5);border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-canvas)}.more-options__summary{cursor:pointer;padding:.875rem 1rem;min-height:44px;display:flex;align-items:center;font-family:var(--font-ui);font-size:var(--text-sm);font-weight:600;color:var(--color-ink);list-style:none;user-select:none}.more-options__summary::-webkit-details-marker{display:none}.more-options__summary:before{content:"\25b8";margin-right:var(--space-2);color:var(--color-ink-muted);transition:transform .15s}.more-options[open] .more-options__summary:before{transform:rotate(90deg)}.more-options[open] .more-options__summary{border-bottom:1px solid var(--color-border)}.more-options>.form-field{padding:0 1rem}.more-options>.form-field:first-of-type{padding-top:var(--space-4)}.more-options>.form-field:last-child{padding-bottom:var(--space-4);margin-bottom:0}.btn-action.is-loading{position:relative;color:transparent;pointer-events:none}.btn-action.is-loading:after{content:"";position:absolute;top:50%;left:50%;width:16px;height:16px;margin:-8px 0 0 -8px;border:2px solid var(--color-ink-muted);border-top-color:var(--color-accent);border-radius:50%;animation:post-spin .7s linear infinite}.btn-action[disabled]{opacity:.5;cursor:not-allowed}@keyframes post-spin{to{transform:rotate(360deg)}}.post-form-wrap .notices{padding:1rem 1.1rem;border-radius:var(--radius-md);font-size:var(--text-base);margin:0 0 var(--space-5);background:var(--color-canvas);color:var(--color-ink);border-left:4px solid var(--color-accent)}.post-form-wrap .notices p{margin:0}.post-form-wrap .notices.error,.post-form-wrap .notices.red{border-left-color:var(--color-error)}.post-form-wrap .notices.success,.post-form-wrap .notices.green{border-left-color:var(--color-accent)}.post-success{margin:0 0 var(--space-5);padding:1.1rem;border-radius:var(--radius-md);background:var(--color-accent-light);border:1px solid var(--color-accent)}.post-success__title{font-family:var(--font-ui);font-size:var(--text-md);font-weight:600;color:var(--color-ink);margin:0 0 var(--space-3)}.post-success__actions{display:flex;flex-wrap:wrap;gap:var(--space-3)}.post-success__view{flex:1;min-width:140px;text-align:center;padding:.8rem 1rem;min-height:44px;border-radius:var(--radius-md);background:var(--color-accent);color:var(--color-accent-on);font-weight:600;text-decoration:none}.post-success__again{flex:1;min-width:140px;text-align:center;padding:.8rem 1rem;min-height:44px;border-radius:var(--radius-md);background:transparent;color:var(--color-ink);border:1px solid var(--color-border);font-weight:600;text-decoration:none}.filepond--credits{display:none!important}.filepond--root{font-family:var(--font-ui);font-size:var(--text-base)}.filepond--panel-root{background-color:var(--color-canvas);border:1px solid var(--color-border);border-radius:var(--radius-md)}.filepond--drop-label,.filepond--drop-label label{color:var(--color-ink-muted)}.filepond--label-action{color:var(--color-accent);text-decoration-color:var(--color-accent)}.filepond--item-panel{background-color:var(--color-surface-raised);border-radius:var(--radius-md)}.filepond--drip-blob{background-color:var(--color-accent)}.filepond--file{color:var(--color-ink)}.filepond--file-action-button{color:var(--color-ink);background-color:#00000073}.filepond--file-action-button:hover{background-color:#000000a6}.filepond--image-preview-overlay{display:none!important}.filepond--item[data-filepond-item-state=processing-complete] .filepond--file-info,.filepond--item[data-filepond-item-state=processing-complete] .filepond--file-status{opacity:0}.filepond--item[data-filepond-item-state=processing-complete]:after{content:"\2713";position:absolute;top:8px;right:8px;z-index:5;width:24px;height:24px;line-height:24px;text-align:center;border-radius:50%;background:var(--color-accent);color:#fff;font-size:15px;font-weight:700;box-shadow:0 1px 3px #00000059;pointer-events:none}.filepond--list.filepond--list{margin:.25rem}.filepond--item{width:calc(33.333% - .5rem)}.filepond--item .filepond--panel-root,.filepond--item .filepond--image-preview-wrapper{border-radius:var(--radius-sm)}.filepond--image-preview,.filepond--image-preview-wrapper,.filepond--image-clip,.filepond--image-preview canvas,.filepond--image-bitmap,.filepond--file img{-webkit-user-drag:none;-khtml-user-drag:none;user-drag:none}.filepond--item[data-filepond-item-state=idle] .filepond--file-info,.filepond--item[data-filepond-item-state=idle] .filepond--file-status{opacity:0}.photos-collapse{margin-bottom:var(--space-5);border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-canvas)}.photos-collapse__summary{cursor:pointer;padding:.875rem 1rem;min-height:44px;display:flex;align-items:center;font-family:var(--font-ui);font-size:var(--text-sm);font-weight:600;color:var(--color-ink);list-style:none;user-select:none}.photos-collapse__summary::-webkit-details-marker{display:none}.photos-collapse__summary:before{content:"\25b8";margin-right:var(--space-2);color:var(--color-ink-muted);transition:transform .15s}.photos-collapse[open] .photos-collapse__summary:before{transform:rotate(90deg)}.photos-collapse[open] .photos-collapse__summary{border-bottom:1px solid var(--color-border)}.photos-collapse>:not(summary){padding-left:1rem;padding-right:1rem}.photos-collapse[open] .filepond--root,.photos-collapse[open] .filepond-root{margin:var(--space-4) 0}.photos-collapse[open]>.photo-convert-status:last-child,.photos-collapse[open]>.photo-reauth-hint:last-child{padding-bottom:var(--space-4)}.EasyMDEContainer .CodeMirror{background:var(--color-canvas);color:var(--color-ink);border:1px solid var(--color-border);border-radius:0 0 var(--radius-md) var(--radius-md);font-family:var(--font-ui);font-size:var(--text-base);line-height:var(--leading-normal);padding:var(--space-1)}.EasyMDEContainer .CodeMirror-cursor{border-color:var(--color-ink)}.EasyMDEContainer .CodeMirror-selected{background:var(--color-accent-light)!important}.EasyMDEContainer .editor-toolbar{background:var(--color-surface-raised);border:1px solid var(--color-border);border-bottom:none;border-radius:var(--radius-md) var(--radius-md) 0 0;opacity:1}.EasyMDEContainer .editor-toolbar button{color:var(--color-ink)!important;min-width:34px;height:34px}.EasyMDEContainer .editor-toolbar button:hover,.EasyMDEContainer .editor-toolbar button.active{background:var(--color-accent-light);border-color:var(--color-border)}.EasyMDEContainer .editor-toolbar i.separator{border-color:var(--color-border)}.EasyMDEContainer .editor-preview,.EasyMDEContainer .editor-preview-side{background:var(--color-canvas);color:var(--color-ink)}.EasyMDEContainer .editor-preview a{color:var(--color-accent)}.photo-editor{margin-bottom:var(--space-5)}.photo-editor__head{display:flex;align-items:center;justify-content:space-between;gap:var(--space-3);margin-bottom:var(--space-2)}.photo-editor__label{font-family:var(--font-ui);font-size:var(--text-base);font-weight:600;color:var(--color-ink)}.photo-editor__add{font-family:var(--font-ui);font-size:var(--text-sm);background:var(--color-accent);color:#fff;border:none;border-radius:var(--radius-sm);padding:var(--space-2) var(--space-4);cursor:pointer}.photo-editor__add:disabled{opacity:.5;cursor:default}.photo-editor__status{font-size:var(--text-sm);color:var(--color-ink-muted);min-height:1.2em;margin:0 0 var(--space-2)}.photo-editor__status.error{color:var(--color-error)}.photo-editor__grid{display:grid;grid-template-columns:repeat(3,1fr);gap:var(--space-2)}@media (min-width: 600px){.photo-editor__grid{grid-template-columns:repeat(4,1fr)}}.photo-editor__loading,.photo-editor__empty{grid-column:1 / -1;color:var(--color-ink-muted);font-size:var(--text-sm);padding:var(--space-4) 0}.photo-editor__cell{position:relative;aspect-ratio:1 / 1;border-radius:var(--radius-sm);overflow:hidden;background:var(--color-surface-raised);cursor:grab;touch-action:none}.photo-editor__cell:active{cursor:grabbing}.photo-editor__img{width:100%;height:100%;object-fit:cover;display:block;-webkit-user-drag:none;user-select:none;pointer-events:none}.photo-editor__cell:first-child:after{content:"Cover";position:absolute;left:var(--space-1);bottom:var(--space-1);font-family:var(--font-ui);font-size:var(--text-xs, .7rem);font-weight:600;color:#fff;background:var(--color-accent);padding:1px 6px;border-radius:var(--radius-sm);pointer-events:none}.photo-editor__del{position:absolute;top:var(--space-1);right:var(--space-1);width:24px;height:24px;line-height:1;display:flex;align-items:center;justify-content:center;border:none;border-radius:50%;background:#0000008c;color:#fff;font-size:.85rem;cursor:pointer}.photo-editor__del:hover{background:#000000bf}.photo-editor__del:disabled{opacity:.4;cursor:default}.photo-editor__confirm{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--space-1);padding:var(--space-2);background:#000000b8;text-align:center}.photo-editor__confirm-q{color:#fff;font-family:var(--font-ui);font-size:var(--text-sm)}.photo-editor__confirm button{font-family:var(--font-ui);font-size:var(--text-xs, .72rem);border:none;border-radius:var(--radius-sm);padding:3px 10px;cursor:pointer}.photo-editor__confirm-yes{background:var(--color-error);color:#fff}.photo-editor__confirm-no{background:#fff;color:var(--color-ink)}.photo-editor__confirm button:disabled{opacity:.5;cursor:default}.photo-editor__cell.sortable-ghost{opacity:.4}.photo-editor__cell.sortable-chosen{outline:2px solid var(--color-accent)}.location-details{margin-bottom:var(--space-5);border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-canvas)}.location-details__summary{cursor:pointer;padding:.875rem 1rem;min-height:44px;display:flex;align-items:center;font-family:var(--font-ui);font-size:var(--text-sm);font-weight:600;color:var(--color-ink);list-style:none;user-select:none}.location-details__summary::-webkit-details-marker{display:none}.location-details__summary:before{content:"\25b8";margin-right:var(--space-2);color:var(--color-ink-muted);transition:transform .15s}.location-details[open] .location-details__summary:before{transform:rotate(90deg)}.location-details[open] .location-details__summary{border-bottom:1px solid var(--color-border)}.location-details>.form-field{padding:0 1rem}.location-details>.form-field:first-of-type{padding-top:var(--space-4)}.location-details>.form-field:last-of-type{padding-bottom:var(--space-2)}.location-details__body{padding:1rem}.location-search-row{display:flex;gap:var(--space-3);align-items:center;flex-wrap:wrap}.location-search-hint{font-size:var(--text-sm);color:var(--color-ink-muted);margin-top:var(--space-2)}.location-search-hint:empty{display:none}.location-search-results{list-style:none;margin:var(--space-3) 0 0;padding:0;border:1px solid var(--color-border);border-radius:var(--radius-md);overflow:hidden}.location-search-results:empty{display:none;margin:0;border:none}.location-search-results li+li{border-top:1px solid var(--color-border)}.location-search-results button{display:block;width:100%;text-align:left;padding:.75rem 1rem;min-height:44px;background:var(--color-canvas);border:none;font-family:var(--font-ui);font-size:var(--text-sm);color:var(--color-ink);cursor:pointer}.location-search-results button:hover,.location-search-results button:focus-visible{background:var(--color-paper)}.location-map{position:relative;width:100%;height:240px;margin-top:var(--space-4);border-radius:var(--radius-md);overflow:hidden;background:var(--color-paper)}.location-map .maplibregl-canvas{border-radius:var(--radius-md)}.location-pin{width:44px;height:44px;border-radius:50%;background:var(--color-accent);border:3px solid #fff;box-shadow:0 1px 6px #00000080;cursor:grab}.location-pin:active{cursor:grabbing}.location-field--mismatch{border-color:var(--color-error)!important;outline-color:var(--color-error)!important}.location-field-note{display:block;font-size:var(--text-sm);color:var(--color-error);margin-top:var(--space-1)} /*! Bundled license information: easymde/dist/easymde.min.css: diff --git a/themes/intotheeast/js/post/post-form.js b/themes/intotheeast/js/post/post-form.js index 53af4f3..fb8fc52 100644 --- a/themes/intotheeast/js/post/post-form.js +++ b/themes/intotheeast/js/post/post-form.js @@ -1,59 +1,59 @@ -import{a as Ju,b as at,c as Jh}from"./chunk-ZWRDP37E.js";var At=at((nl,ol)=>{(function(o,l){typeof nl=="object"&&typeof ol<"u"?ol.exports=l():typeof define=="function"&&define.amd?define(l):(o=o||self,o.CodeMirror=l())})(nl,function(){"use strict";var o=navigator.userAgent,l=navigator.platform,s=/gecko\/\d/i.test(o),a=/MSIE \d/.test(o),f=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(o),h=/Edge\/(\d+)/.exec(o),c=a||f||h,d=c&&(a?document.documentMode||6:+(h||f)[1]),v=!h&&/WebKit\//.test(o),y=v&&/Qt\/\d+\.\d+/.test(o),x=!h&&/Chrome\/(\d+)/.exec(o),D=x&&+x[1],S=/Opera\//.test(o),F=/Apple Computer/.test(navigator.vendor),B=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(o),L=/PhantomJS/.test(o),T=F&&(/Mobile\/\w+/.test(o)||navigator.maxTouchPoints>2),N=/Android/.test(o),z=T||N||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(o),O=T||/Mac/.test(l),I=/\bCrOS\b/.test(o),U=/win/i.test(l),j=S&&o.match(/Version\/(\d*\.\d*)/);j&&(j=Number(j[1])),j&&j>=15&&(S=!1,v=!0);var K=O&&(y||S&&(j==null||j<12.11)),de=s||c&&d>=9;function W(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var oe=function(e,t){var i=e.className,r=W(t).exec(i);if(r){var n=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(n?r[1]+n:"")}};function X(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function G(e,t){return X(e).appendChild(t)}function k(e,t,i,r){var n=document.createElement(e);if(i&&(n.className=i),r&&(n.style.cssText=r),typeof t=="string")n.appendChild(document.createTextNode(t));else if(t)for(var u=0;u=t)return p+(t-u);p+=g-u,p+=i-p%i,u=g+1}}var dt=function(){this.id=null,this.f=null,this.time=0,this.handler=lt(this.onTimeout,this)};dt.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},dt.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i=t)return r+Math.min(p,t-n);if(n+=u-r,n+=i-n%i,r=u+1,n>=t)return r}}var Ht=[""];function pr(e){for(;Ht.length<=e;)Ht.push(De(Ht)+" ");return Ht[e]}function De(e){return e[e.length-1]}function Pt(e,t){for(var i=[],r=0;r"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Pc.test(e))}function kn(e,t){return t?t.source.indexOf("\\w")>-1&&Zo(e)?!0:t.test(e):Zo(e)}function Gl(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var qc=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Qo(e){return e.charCodeAt(0)>=768&&qc.test(e)}function Xl(e,t,i){for(;(i<0?t>0:ti?-1:1;;){if(t==i)return t;var n=(t+i)/2,u=r<0?Math.ceil(n):Math.floor(n);if(u==t)return e(u)?t:i;e(u)?i=u:t=u+r}}function Rc(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,u=0;ut||t==i&&p.to==t)&&(r(Math.max(p.from,t),Math.min(p.to,i),p.level==1?"rtl":"ltr",u),n=!0)}n||r(t,i,"ltr")}var Mi=null;function Bi(e,t,i){var r;Mi=null;for(var n=0;nt)return n;u.to==t&&(u.from!=u.to&&i=="before"?r=n:Mi=n),u.from==t&&(u.from!=u.to&&i!="before"?r=n:Mi=n)}return r??Mi}var Wc=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(b){return b<=247?e.charAt(b):1424<=b&&b<=1524?"R":1536<=b&&b<=1785?t.charAt(b-1536):1774<=b&&b<=2220?"r":8192<=b&&b<=8203?"w":b==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,u=/[LRr]/,p=/[Lb1n]/,g=/[1n]/;function m(b,C,E){this.level=b,this.from=C,this.to=E}return function(b,C){var E=C=="ltr"?"L":"R";if(b.length==0||C=="ltr"&&!r.test(b))return!1;for(var _=b.length,M=[],P=0;P<_;++P)M.push(i(b.charCodeAt(P)));for(var R=0,Z=E;R<_;++R){var J=M[R];J=="m"?M[R]=Z:Z=J}for(var te=0,V=E;te<_;++te){var ie=M[te];ie=="1"&&V=="r"?M[te]="n":u.test(ie)&&(V=ie,ie=="r"&&(M[te]="R"))}for(var se=1,le=M[0];se<_-1;++se){var we=M[se];we=="+"&&le=="1"&&M[se+1]=="1"?M[se]="1":we==","&&le==M[se+1]&&(le=="1"||le=="n")&&(M[se]=le),le=we}for(var Le=0;Le<_;++Le){var it=M[Le];if(it==",")M[Le]="N";else if(it=="%"){var Ie=void 0;for(Ie=Le+1;Ie<_&&M[Ie]=="%";++Ie);for(var Et=Le&&M[Le-1]=="!"||Ie<_&&M[Ie]=="1"?"1":"N",wt=Le;wt-1&&(r[t]=n.slice(0,u).concat(n.slice(u+1)))}}}function je(e,t){var i=Jo(e,t);if(i.length)for(var r=Array.prototype.slice.call(arguments,2),n=0;n0}function Jr(e){e.prototype.on=function(t,i){ue(this,t,i)},e.prototype.off=function(t,i){Mt(this,t,i)}}function bt(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Zl(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Vo(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function _i(e){bt(e),Zl(e)}function $o(e){return e.target||e.srcElement}function Ql(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),O&&e.ctrlKey&&t==1&&(t=3),t}var Uc=function(){if(c&&d<9)return!1;var e=k("div");return"draggable"in e||"dragDrop"in e}(),ea;function jc(e){if(ea==null){var t=k("span","\u200B");G(e,k("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(ea=t.offsetWidth<=1&&t.offsetHeight>2&&!(c&&d<8))}var i=ea?k("span","\u200B"):k("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var ta;function Gc(e){if(ta!=null)return ta;var t=G(e,document.createTextNode("A\u062EA")),i=q(t,0,1).getBoundingClientRect(),r=q(t,1,2).getBoundingClientRect();return X(e),!i||i.left==i.right?!1:ta=r.right-i.right<3}var ra=` +import{a as $u,b as at,c as $h}from"./chunk-ZWRDP37E.js";var At=at((ol,al)=>{(function(o,l){typeof ol=="object"&&typeof al<"u"?al.exports=l():typeof define=="function"&&define.amd?define(l):(o=o||self,o.CodeMirror=l())})(ol,function(){"use strict";var o=navigator.userAgent,l=navigator.platform,s=/gecko\/\d/i.test(o),a=/MSIE \d/.test(o),f=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(o),h=/Edge\/(\d+)/.exec(o),c=a||f||h,d=c&&(a?document.documentMode||6:+(h||f)[1]),m=!h&&/WebKit\//.test(o),y=m&&/Qt\/\d+\.\d+/.test(o),x=!h&&/Chrome\/(\d+)/.exec(o),C=x&&+x[1],S=/Opera\//.test(o),F=/Apple Computer/.test(navigator.vendor),_=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(o),L=/PhantomJS/.test(o),T=F&&(/Mobile\/\w+/.test(o)||navigator.maxTouchPoints>2),O=/Android/.test(o),N=T||O||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(o),I=T||/Mac/.test(l),P=/\bCrOS\b/.test(o),U=/win/i.test(l),j=S&&o.match(/Version\/(\d*\.\d*)/);j&&(j=Number(j[1])),j&&j>=15&&(S=!1,m=!0);var K=I&&(y||S&&(j==null||j<12.11)),de=s||c&&d>=9;function q(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var oe=function(e,t){var n=e.className,r=q(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function X(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function G(e,t){return X(e).appendChild(t)}function k(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var u=0;u=t)return p+(t-u);p+=g-u,p+=n-p%n,u=g+1}}var dt=function(){this.id=null,this.f=null,this.time=0,this.handler=lt(this.onTimeout,this)};dt.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},dt.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n=t)return r+Math.min(p,t-i);if(i+=u-r,i+=n-i%n,r=u+1,i>=t)return r}}var zt=[""];function pr(e){for(;zt.length<=e;)zt.push(Ce(zt)+" ");return zt[e]}function Ce(e){return e[e.length-1]}function Ht(e,t){for(var n=[],r=0;r"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Rc.test(e))}function Si(e,t){return t?t.source.indexOf("\\w")>-1&&Qo(e)?!0:t.test(e):Qo(e)}function Xl(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Wc=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Jo(e){return e.charCodeAt(0)>=768&&Wc.test(e)}function Kl(e,t,n){for(;(n<0?t>0:tn?-1:1;;){if(t==n)return t;var i=(t+n)/2,u=r<0?Math.ceil(i):Math.floor(i);if(u==t)return e(u)?t:n;e(u)?n=u:t=u+r}}function qc(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,u=0;ut||t==n&&p.to==t)&&(r(Math.max(p.from,t),Math.min(p.to,n),p.level==1?"rtl":"ltr",u),i=!0)}i||r(t,n,"ltr")}var _n=null;function Bn(e,t,n){var r;_n=null;for(var i=0;it)return i;u.to==t&&(u.from!=u.to&&n=="before"?r=i:_n=i),u.from==t&&(u.from!=u.to&&n!="before"?r=i:_n=i)}return r??_n}var Uc=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(b){return b<=247?e.charAt(b):1424<=b&&b<=1524?"R":1536<=b&&b<=1785?t.charAt(b-1536):1774<=b&&b<=2220?"r":8192<=b&&b<=8203?"w":b==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,u=/[LRr]/,p=/[Lb1n]/,g=/[1n]/;function v(b,D,E){this.level=b,this.from=D,this.to=E}return function(b,D){var E=D=="ltr"?"L":"R";if(b.length==0||D=="ltr"&&!r.test(b))return!1;for(var B=b.length,M=[],H=0;H-1&&(r[t]=i.slice(0,u).concat(i.slice(u+1)))}}}function je(e,t){var n=$o(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i0}function Jr(e){e.prototype.on=function(t,n){ue(this,t,n)},e.prototype.off=function(t,n){Mt(this,t,n)}}function bt(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Ql(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Vo(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function Nn(e){bt(e),Ql(e)}function ea(e){return e.target||e.srcElement}function Jl(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),I&&e.ctrlKey&&t==1&&(t=3),t}var jc=function(){if(c&&d<9)return!1;var e=k("div");return"draggable"in e||"dragDrop"in e}(),ta;function Gc(e){if(ta==null){var t=k("span","\u200B");G(e,k("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(ta=t.offsetWidth<=1&&t.offsetHeight>2&&!(c&&d<8))}var n=ta?k("span","\u200B"):k("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var ra;function Xc(e){if(ra!=null)return ra;var t=G(e,document.createTextNode("A\u062EA")),n=R(t,0,1).getBoundingClientRect(),r=R(t,1,2).getBoundingClientRect();return X(e),!n||n.left==n.right?!1:ra=r.right-n.right<3}var na=` -b`.split(/\n/).length!=3?function(e){for(var t=0,i=[],r=e.length;t<=r;){var n=e.indexOf(` -`,t);n==-1&&(n=e.length);var u=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),p=u.indexOf("\r");p!=-1?(i.push(u.slice(0,p)),t+=p+1):(i.push(u),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},Xc=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch{return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch{}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Kc=function(){var e=k("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),ia=null;function Yc(e){if(ia!=null)return ia;var t=G(e,k("span","x")),i=t.getBoundingClientRect(),r=q(t,0,1).getBoundingClientRect();return ia=Math.abs(i.left-r.left)>1}var na={},Vr={};function Zc(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),na[e]=t}function Qc(e,t){Vr[e]=t}function Sn(e){if(typeof e=="string"&&Vr.hasOwnProperty(e))e=Vr[e];else if(e&&typeof e.name=="string"&&Vr.hasOwnProperty(e.name)){var t=Vr[e.name];typeof t=="string"&&(t={name:t}),e=jl(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Sn("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Sn("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function oa(e,t){t=Sn(t);var i=na[t.name];if(!i)return oa(e,"text/plain");var r=i(e,t);if($r.hasOwnProperty(t.name)){var n=$r[t.name];for(var u in n)n.hasOwnProperty(u)&&(r.hasOwnProperty(u)&&(r["_"+u]=r[u]),r[u]=n[u])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var p in t.modeProps)r[p]=t.modeProps[p];return r}var $r={};function Jc(e,t){var i=$r.hasOwnProperty(e)?$r[e]:$r[e]={};Lt(t,i)}function Lr(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var r in t){var n=t[r];n instanceof Array&&(n=n.concat([])),i[r]=n}return i}function aa(e,t){for(var i;e.innerMode&&(i=e.innerMode(t),!(!i||i.mode==e));)t=i.state,e=i.mode;return i||{mode:e,state:t}}function Jl(e,t,i){return e.startState?e.startState(t,i):!0}var Ge=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};Ge.prototype.eol=function(){return this.pos>=this.string.length},Ge.prototype.sol=function(){return this.pos==this.lineStart},Ge.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ge.prototype.next=function(){if(this.post},Ge.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ge.prototype.skipToEnd=function(){this.pos=this.string.length},Ge.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ge.prototype.backUp=function(e){this.pos-=e},Ge.prototype.column=function(){return this.lastColumnPos0?null:(u&&t!==!1&&(this.pos+=u[0].length),u)}},Ge.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ge.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ge.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ge.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ae(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var i=e;!i.lines;)for(var r=0;;++r){var n=i.children[r],u=n.chunkSize();if(t=e.first&&ti?Y(i,ae(e,i).text.length):Vc(t,ae(e,t.line).text.length)}function Vc(e,t){var i=e.ch;return i==null||i>t?Y(e.line,t):i<0?Y(e.line,0):e}function $l(e,t){for(var i=[],r=0;rthis.maxLookAhead&&(this.maxLookAhead=e),t},Zt.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},Zt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Zt.fromSaved=function(e,t,i){return t instanceof Fn?new Zt(e,Lr(e.mode,t.state),i,t.lookAhead):new Zt(e,Lr(e.mode,t),i)},Zt.prototype.save=function(e){var t=e!==!1?Lr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Fn(t,this.maxLookAhead):t};function es(e,t,i,r){var n=[e.state.modeGen],u={};as(e,t.text,e.doc.mode,i,function(b,C){return n.push(b,C)},u,r);for(var p=i.state,g=function(b){i.baseTokens=n;var C=e.state.overlays[b],E=1,_=0;i.state=!0,as(e,t.text,C.mode,i,function(M,P){for(var R=E;_M&&n.splice(E,1,M,n[E+1],Z),E+=2,_=Math.min(M,Z)}if(P)if(C.opaque)n.splice(R,E-R,M,"overlay "+P),E=R+2;else for(;Re.options.maxHighlightLength&&Lr(e.doc.mode,r.state),u=es(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=u.styles,u.classes?t.styleClasses=u.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Ni(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new Zt(r,!0,t);var u=$c(e,t,i),p=u>r.first&&ae(r,u-1).stateAfter,g=p?Zt.fromSaved(r,p,u):new Zt(r,Jl(r.mode),u);return r.iter(u,t,function(m){ca(e,m.text,g);var b=g.line;m.stateAfter=b==t-1||b%5==0||b>=n.viewFrom&&bt.start)return u}throw new Error("Mode "+e.name+" failed to advance stream.")}var is=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function ns(e,t,i,r){var n=e.doc,u=n.mode,p;t=be(n,t);var g=ae(n,t.line),m=Ni(e,t.line,i),b=new Ge(g.text,e.options.tabSize,m),C;for(r&&(C=[]);(r||b.pose.options.maxHighlightLength?(g=!1,p&&ca(e,t,r,C.pos),C.pos=t.length,E=null):E=os(da(i,C,r.state,_),u),_){var M=_[0].name;M&&(E="m-"+(E?M+" "+E:M))}if(!g||b!=E){for(;mp;--g){if(g<=u.first)return u.first;var m=ae(u,g-1),b=m.stateAfter;if(b&&(!i||g+(b instanceof Fn?b.lookAhead:0)<=u.modeFrontier))return g;var C=Ye(m.text,null,e.options.tabSize);(n==null||r>C)&&(n=g-1,r=C)}return n}function ed(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontieri;r--){var n=ae(e,r).stateAfter;if(n&&(!(n instanceof Fn)||r+n.lookAhead=t:u.to>t);(r||(r=[])).push(new Tn(p,u.from,m?null:u.to))}}return r}function ad(e,t,i){var r;if(e)for(var n=0;n=t:u.to>t);if(g||u.from==t&&p.type=="bookmark"&&(!i||u.marker.insertLeft)){var m=u.from==null||(p.inclusiveLeft?u.from<=t:u.from0&&g)for(var ie=0;ie0)){var C=[m,1],E=ve(b.from,g.from),_=ve(b.to,g.to);(E<0||!p.inclusiveLeft&&!E)&&C.push({from:b.from,to:g.from}),(_>0||!p.inclusiveRight&&!_)&&C.push({from:g.to,to:b.to}),n.splice.apply(n,C),m+=C.length-3}}return n}function us(e){var t=e.markedSpans;if(t){for(var i=0;it)&&(!r||pa(r,u.marker)<0)&&(r=u.marker)}return r}function hs(e,t,i,r,n){var u=ae(e,t),p=rr&&u.markedSpans;if(p)for(var g=0;g=0&&E<=0||C<=0&&E>=0)&&(C<=0&&(m.marker.inclusiveRight&&n.inclusiveLeft?ve(b.to,i)>=0:ve(b.to,i)>0)||C>=0&&(m.marker.inclusiveRight&&n.inclusiveLeft?ve(b.from,r)<=0:ve(b.from,r)<0)))return!0}}}function qt(e){for(var t;t=ds(e);)e=t.find(-1,!0).line;return e}function ud(e){for(var t;t=Bn(e);)e=t.find(1,!0).line;return e}function fd(e){for(var t,i;t=Bn(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function ga(e,t){var i=ae(e,t),r=qt(i);return i==r?t:Fe(r)}function ps(e,t){if(t>e.lastLine())return t;var i=ae(e,t),r;if(!mr(e,i))return t;for(;r=Bn(i);)i=r.find(1,!0).line;return Fe(i)+1}function mr(e,t){var i=rr&&t.markedSpans;if(i){for(var r=void 0,n=0;nt.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var ei=function(e,t,i){this.text=e,fs(this,t),this.height=i?i(this):1};ei.prototype.lineNo=function(){return Fe(this)},Jr(ei);function cd(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),us(e),fs(e,i);var n=r?r(e):1;n!=e.height&&Yt(e,n)}function dd(e){e.parent=null,us(e)}var hd={},pd={};function gs(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?pd:hd;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function ms(e,t){var i=H("span",null,null,v?"padding-right: .1px":null),r={pre:H("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var u=n?t.rest[n-1]:t.line,p=void 0;r.pos=0,r.addToken=md,Gc(e.display.measure)&&(p=tr(u,e.doc.direction))&&(r.addToken=bd(r.addToken,p)),r.map=[];var g=t!=e.display.externalMeasured&&Fe(u);yd(u,r,ts(e,u,g)),u.styleClasses&&(u.styleClasses.bgClass&&(r.bgClass=Ee(u.styleClasses.bgClass,r.bgClass||"")),u.styleClasses.textClass&&(r.textClass=Ee(u.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(jc(e.display.measure))),n==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(v){var m=r.content.lastChild;(/\bcm-tab\b/.test(m.className)||m.querySelector&&m.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return je(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=Ee(r.pre.className,r.textClass||"")),r}function gd(e){var t=k("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function md(e,t,i,r,n,u,p){if(t){var g=e.splitSpaces?vd(t,e.trailingSpace):t,m=e.cm.state.specialChars,b=!1,C;if(!m.test(t))e.col+=t.length,C=document.createTextNode(g),e.map.push(e.pos,e.pos+t.length,C),c&&d<9&&(b=!0),e.pos+=t.length;else{C=document.createDocumentFragment();for(var E=0;;){m.lastIndex=E;var _=m.exec(t),M=_?_.index-E:t.length-E;if(M){var P=document.createTextNode(g.slice(E,E+M));c&&d<9?C.appendChild(k("span",[P])):C.appendChild(P),e.map.push(e.pos,e.pos+M,P),e.col+=M,e.pos+=M}if(!_)break;E+=M+1;var R=void 0;if(_[0]==" "){var Z=e.cm.options.tabSize,J=Z-e.col%Z;R=C.appendChild(k("span",pr(J),"cm-tab")),R.setAttribute("role","presentation"),R.setAttribute("cm-text"," "),e.col+=J}else _[0]=="\r"||_[0]==` -`?(R=C.appendChild(k("span",_[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),R.setAttribute("cm-text",_[0]),e.col+=1):(R=e.cm.options.specialCharPlaceholder(_[0]),R.setAttribute("cm-text",_[0]),c&&d<9?C.appendChild(k("span",[R])):C.appendChild(R),e.col+=1);e.map.push(e.pos,e.pos+1,R),e.pos++}}if(e.trailingSpace=g.charCodeAt(t.length-1)==32,i||r||n||b||u||p){var te=i||"";r&&(te+=r),n&&(te+=n);var V=k("span",[C],te,u);if(p)for(var ie in p)p.hasOwnProperty(ie)&&ie!="style"&&ie!="class"&&V.setAttribute(ie,p[ie]);return e.content.appendChild(V)}e.content.appendChild(C)}}function vd(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;nb&&E.from<=b));_++);if(E.to>=C)return e(i,r,n,u,p,g,m);e(i,r.slice(0,E.to-b),n,u,null,g,m),u=null,r=r.slice(E.to-b),b=E.to}}}function vs(e,t,i,r){var n=!r&&i.widgetNode;n&&e.map.push(e.pos,e.pos+t,n),!r&&e.cm.display.input.needsContentAttribute&&(n||(n=e.content.appendChild(document.createElement("span"))),n.setAttribute("cm-marker",i.id)),n&&(e.cm.display.input.setUneditable(n),e.content.appendChild(n)),e.pos+=t,e.trailingSpace=!1}function yd(e,t,i){var r=e.markedSpans,n=e.text,u=0;if(!r){for(var p=1;pm||we.collapsed&&le.to==m&&le.from==m)){if(le.to!=null&&le.to!=m&&M>le.to&&(M=le.to,R=""),we.className&&(P+=" "+we.className),we.css&&(_=(_?_+";":"")+we.css),we.startStyle&&le.from==m&&(Z+=" "+we.startStyle),we.endStyle&&le.to==M&&(ie||(ie=[])).push(we.endStyle,le.to),we.title&&((te||(te={})).title=we.title),we.attributes)for(var Le in we.attributes)(te||(te={}))[Le]=we.attributes[Le];we.collapsed&&(!J||pa(J.marker,we)<0)&&(J=le)}else le.from>m&&M>le.from&&(M=le.from)}if(ie)for(var it=0;it=g)break;for(var Et=Math.min(g,M);;){if(C){var wt=m+C.length;if(!J){var Xe=wt>Et?C.slice(0,Et-m):C;t.addToken(t,Xe,E?E+P:P,Z,m+Xe.length==M?R:"",_,te)}if(wt>=Et){C=C.slice(Et-m),m=Et;break}m=wt,Z=""}C=n.slice(u,u=i[b++]),E=gs(i[b++],t.cm.options)}}}function bs(e,t,i){this.line=t,this.rest=fd(t),this.size=this.rest?Fe(De(this.rest))-i+1:1,this.node=this.text=null,this.hidden=mr(e,t)}function zn(e,t,i){for(var r=[],n,u=t;u2&&u.push((m.bottom+b.top)/2-i.top)}}u.push(i.bottom-i.top)}}function Ss(e,t,i){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var r=0;ri)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}}function Ld(e,t){t=qt(t);var i=Fe(t),r=e.display.externalMeasured=new bs(e.doc,t,i);r.lineN=i;var n=r.built=ms(e,r);return r.text=n.pre,G(e.display.lineMeasure,n.pre),r}function Es(e,t,i,r){return Jt(e,ri(e,t),i,r)}function wa(e,t){if(t>=e.display.viewFrom&&t=i.lineN&&tt)&&(u=m-g,n=u-1,t>=m&&(p="right")),n!=null){if(r=e[b+2],g==m&&i==(r.insertLeft?"left":"right")&&(p=i),i=="left"&&n==0)for(;b&&e[b-2]==e[b-3]&&e[b-1].insertLeft;)r=e[(b-=3)+2],p="left";if(i=="right"&&n==m-g)for(;b=0&&(i=e[n]).left==i.right;n--);return i}function Bd(e,t,i,r){var n=Fs(t.map,i,r),u=n.node,p=n.start,g=n.end,m=n.collapse,b;if(u.nodeType==3){for(var C=0;C<4;C++){for(;p&&Qo(t.line.text.charAt(n.coverStart+p));)--p;for(;n.coverStart+g0&&(m=r="right");var E;e.options.lineWrapping&&(E=u.getClientRects()).length>1?b=E[r=="right"?E.length-1:0]:b=u.getBoundingClientRect()}if(c&&d<9&&!p&&(!b||!b.left&&!b.right)){var _=u.parentNode.getClientRects()[0];_?b={left:_.left,right:_.left+ni(e.display),top:_.top,bottom:_.bottom}:b=As}for(var M=b.top-t.rect.top,P=b.bottom-t.rect.top,R=(M+P)/2,Z=t.view.measure.heights,J=0;J=r.text.length?(m=r.text.length,b="before"):m<=0&&(m=0,b="after"),!g)return p(b=="before"?m-1:m,b=="before");function C(P,R,Z){var J=g[R],te=J.level==1;return p(Z?P-1:P,te!=Z)}var E=Bi(g,m,b),_=Mi,M=C(m,E,b=="before");return _!=null&&(M.other=C(m,_,b!="before")),M}function zs(e,t){var i=0;t=be(e.doc,t),e.options.lineWrapping||(i=ni(e.display)*t.ch);var r=ae(e.doc,t.line),n=ir(r)+Nn(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function Da(e,t,i,r,n){var u=Y(e,t,i);return u.xRel=n,r&&(u.outside=r),u}function ka(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return Da(r.first,0,null,-1,-1);var n=Br(r,i),u=r.first+r.size-1;if(n>u)return Da(r.first+r.size-1,ae(r,u).text.length,null,1,1);t<0&&(t=0);for(var p=ae(r,n);;){var g=zd(e,p,n,t,i),m=sd(p,g.ch+(g.xRel>0||g.outside>0?1:0));if(!m)return g;var b=m.find(1);if(b.line==n)return b;p=ae(r,n=b.line)}}function Ns(e,t,i,r){r-=Ca(t);var n=t.text.length,u=Li(function(p){return Jt(e,i,p-1).bottom<=r},n,0);return n=Li(function(p){return Jt(e,i,p).top>r},u,n),{begin:u,end:n}}function Os(e,t,i,r){i||(i=ri(e,t));var n=On(e,t,Jt(e,i,r),"line").top;return Ns(e,t,i,n)}function Sa(e,t,i,r){return e.bottom<=i?!1:e.top>i?!0:(r?e.left:e.right)>t}function zd(e,t,i,r,n){n-=ir(t);var u=ri(e,t),p=Ca(t),g=0,m=t.text.length,b=!0,C=tr(t,e.doc.direction);if(C){var E=(e.options.lineWrapping?Od:Nd)(e,t,i,u,C,r,n);b=E.level!=1,g=b?E.from:E.to-1,m=b?E.to:E.from-1}var _=null,M=null,P=Li(function(se){var le=Jt(e,u,se);return le.top+=p,le.bottom+=p,Sa(le,r,n,!1)?(le.top<=n&&le.left<=r&&(_=se,M=le),!0):!1},g,m),R,Z,J=!1;if(M){var te=r-M.left=ie.bottom?1:0}return P=Xl(t.text,P,1),Da(i,P,Z,J,r-R)}function Nd(e,t,i,r,n,u,p){var g=Li(function(E){var _=n[E],M=_.level!=1;return Sa(Rt(e,Y(i,M?_.to:_.from,M?"before":"after"),"line",t,r),u,p,!0)},0,n.length-1),m=n[g];if(g>0){var b=m.level!=1,C=Rt(e,Y(i,b?m.from:m.to,b?"after":"before"),"line",t,r);Sa(C,u,p,!0)&&C.top>p&&(m=n[g-1])}return m}function Od(e,t,i,r,n,u,p){var g=Ns(e,t,r,p),m=g.begin,b=g.end;/\s/.test(t.text.charAt(b-1))&&b--;for(var C=null,E=null,_=0;_=b||M.to<=m)){var P=M.level!=1,R=Jt(e,r,P?Math.min(b,M.to)-1:Math.max(m,M.from)).right,Z=RZ)&&(C=M,E=Z)}}return C||(C=n[n.length-1]),C.fromb&&(C={from:C.from,to:b,level:C.level}),C}var zr;function ii(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(zr==null){zr=k("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)zr.appendChild(document.createTextNode("x")),zr.appendChild(k("br"));zr.appendChild(document.createTextNode("x"))}G(e.measure,zr);var i=zr.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),X(e.measure),i||1}function ni(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=k("span","xxxxxxxxxx"),i=k("pre",[t],"CodeMirror-line-like");G(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function Ea(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,u=t.gutters.firstChild,p=0;u;u=u.nextSibling,++p){var g=e.display.gutterSpecs[p].className;i[g]=u.offsetLeft+u.clientLeft+n,r[g]=u.clientWidth}return{fixedPos:Aa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Aa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Is(e){var t=ii(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/ni(e.display)-3);return function(n){if(mr(e.doc,n))return 0;var u=0;if(n.widgets)for(var p=0;p0&&(b=ae(e.doc,m.line).text).length==m.ch){var C=Ye(b,b.length,e.options.tabSize)-b.length;m=Y(m.line,Math.max(0,Math.round((u-ks(e.display).left)/ni(e.display))-C))}return m}function Or(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var i=e.display.view,r=0;rt)&&(n.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=n.viewTo)rr&&ga(e.doc,t)n.viewFrom?br(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)br(e);else if(t<=n.viewFrom){var u=Hn(e,i,i+r,1);u?(n.view=n.view.slice(u.index),n.viewFrom=u.lineN,n.viewTo+=r):br(e)}else if(i>=n.viewTo){var p=Hn(e,t,t,-1);p?(n.view=n.view.slice(0,p.index),n.viewTo=p.lineN):br(e)}else{var g=Hn(e,t,t,-1),m=Hn(e,i,i+r,1);g&&m?(n.view=n.view.slice(0,g.index).concat(zn(e,g.lineN,m.lineN)).concat(n.view.slice(m.index)),n.viewTo+=r):br(e)}var b=n.externalMeasured;b&&(i=n.lineN&&t=r.viewTo)){var u=r.view[Or(e,t)];if(u.node!=null){var p=u.changes||(u.changes=[]);ze(p,i)==-1&&p.push(i)}}}function br(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Hn(e,t,i,r){var n=Or(e,t),u,p=e.display.view;if(!rr||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var g=e.display.viewFrom,m=0;m0){if(n==p.length-1)return null;u=g+p[n].size-t,n++}else u=g-t;t+=u,i+=u}for(;ga(e.doc,i)!=i;){if(n==(r<0?0:p.length-1))return null;i+=r*p[n-(r<0?1:0)].size,n+=r}return{index:n,lineN:i}}function Id(e,t,i){var r=e.display,n=r.view;n.length==0||t>=r.viewTo||i<=r.viewFrom?(r.view=zn(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=zn(e,t,r.viewFrom).concat(r.view):r.viewFromi&&(r.view=r.view.slice(0,Or(e,i)))),r.viewTo=i}function Hs(e){for(var t=e.display.view,i=0,r=0;r=e.display.viewTo||m.to().line0?p:e.defaultCharWidth())+"px"}if(r.other){var g=i.appendChild(k("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));g.style.display="",g.style.left=r.other.left+"px",g.style.top=r.other.top+"px",g.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Pn(e,t){return e.top-t.top||e.left-t.left}function Hd(e,t,i){var r=e.display,n=e.doc,u=document.createDocumentFragment(),p=ks(e.display),g=p.left,m=Math.max(r.sizerWidth,_r(e)-r.sizer.offsetLeft)-p.right,b=n.direction=="ltr";function C(V,ie,se,le){ie<0&&(ie=0),ie=Math.round(ie),le=Math.round(le),u.appendChild(k("div",null,"CodeMirror-selected","position: absolute; left: "+V+`px; - top: `+ie+"px; width: "+(se??m-V)+`px; - height: `+(le-ie)+"px"))}function E(V,ie,se){var le=ae(n,V),we=le.text.length,Le,it;function Ie(Xe,Ct){return In(e,Y(V,Xe),"div",le,Ct)}function Et(Xe,Ct,ot){var Qe=Os(e,le,null,Xe),Ke=Ct=="ltr"==(ot=="after")?"left":"right",qe=ot=="after"?Qe.begin:Qe.end-(/\s/.test(le.text.charAt(Qe.end-1))?2:1);return Ie(qe,Ke)[Ke]}var wt=tr(le,n.direction);return Rc(wt,ie||0,se??we,function(Xe,Ct,ot,Qe){var Ke=ot=="ltr",qe=Ie(Xe,Ke?"left":"right"),Dt=Ie(Ct-1,Ke?"right":"left"),vi=ie==null&&Xe==0,kr=se==null&&Ct==we,ut=Qe==0,Vt=!wt||Qe==wt.length-1;if(Dt.top-qe.top<=3){var nt=(b?vi:kr)&&ut,rl=(b?kr:vi)&&Vt,lr=nt?g:(Ke?qe:Dt).left,Rr=rl?m:(Ke?Dt:qe).right;C(lr,qe.top,Rr-lr,qe.bottom)}else{var Wr,pt,bi,il;Ke?(Wr=b&&vi&&ut?g:qe.left,pt=b?m:Et(Xe,ot,"before"),bi=b?g:Et(Ct,ot,"after"),il=b&&kr&&Vt?m:Dt.right):(Wr=b?Et(Xe,ot,"before"):g,pt=!b&&vi&&ut?m:qe.right,bi=!b&&kr&&Vt?g:Dt.left,il=b?Et(Ct,ot,"after"):m),C(Wr,qe.top,pt-Wr,qe.bottom),qe.bottom0?t.blinker=setInterval(function(){e.hasFocus()||oi(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function qs(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Ba(e))}function Ma(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&oi(e))},100)}function Ba(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(je(e,"focus",e,t),e.state.focused=!0,pe(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),v&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),La(e))}function oi(e,t){e.state.delayingBlurEvent||(e.state.focused&&(je(e,"blur",e,t),e.state.focused=!1,oe(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function qn(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),n=t.lineDiv.getBoundingClientRect().top,u=0,p=0;p.005||M<-.005)&&(ne.display.sizerWidth){var R=Math.ceil(C/ni(e.display));R>e.display.maxLineLength&&(e.display.maxLineLength=R,e.display.maxLine=g.line,e.display.maxLineChanged=!0)}}}Math.abs(u)>2&&(t.scroller.scrollTop+=u)}function Rs(e){if(e.widgets)for(var t=0;t=p&&(u=Br(t,ir(ae(t,m))-e.wrapper.clientHeight),p=m)}return{from:u,to:Math.max(p,u+1)}}function Pd(e,t){if(!$e(e,"scrollCursorIntoView")){var i=e.display,r=i.sizer.getBoundingClientRect(),n=null,u=i.wrapper.ownerDocument;if(t.top+r.top<0?n=!0:t.bottom+r.top>(u.defaultView.innerHeight||u.documentElement.clientHeight)&&(n=!1),n!=null&&!L){var p=k("div","\u200B",null,`position: absolute; - top: `+(t.top-i.viewOffset-Nn(e.display))+`px; - height: `+(t.bottom-t.top+Qt(e)+i.barHeight)+`px; - left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(p),p.scrollIntoView(n),e.display.lineSpace.removeChild(p)}}}function qd(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(i=t.sticky=="before"?Y(t.line,t.ch+1,"before"):t,t=t.ch?Y(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var u=0;u<5;u++){var p=!1,g=Rt(e,t),m=!i||i==t?g:Rt(e,i);n={left:Math.min(g.left,m.left),top:Math.min(g.top,m.top)-r,right:Math.max(g.left,m.left),bottom:Math.max(g.bottom,m.bottom)+r};var b=_a(e,n),C=e.doc.scrollTop,E=e.doc.scrollLeft;if(b.scrollTop!=null&&(Ui(e,b.scrollTop),Math.abs(e.doc.scrollTop-C)>1&&(p=!0)),b.scrollLeft!=null&&(Ir(e,b.scrollLeft),Math.abs(e.doc.scrollLeft-E)>1&&(p=!0)),!p)break}return n}function Rd(e,t){var i=_a(e,t);i.scrollTop!=null&&Ui(e,i.scrollTop),i.scrollLeft!=null&&Ir(e,i.scrollLeft)}function _a(e,t){var i=e.display,r=ii(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,u=xa(e),p={};t.bottom-t.top>u&&(t.bottom=t.top+u);var g=e.doc.height+ya(i),m=t.topg-r;if(t.topn+u){var C=Math.min(t.top,(b?g:t.bottom)-u);C!=n&&(p.scrollTop=C)}var E=e.options.fixedGutter?0:i.gutters.offsetWidth,_=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-E,M=_r(e)-i.gutters.offsetWidth,P=t.right-t.left>M;return P&&(t.right=t.left+M),t.left<10?p.scrollLeft=0:t.left<_?p.scrollLeft=Math.max(0,t.left+E-(P?0:10)):t.right>M+_-3&&(p.scrollLeft=t.right+(P?0:10)-M),p}function za(e,t){t!=null&&(Wn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function ai(e){Wn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Wi(e,t,i){(t!=null||i!=null)&&Wn(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Wd(e,t){Wn(e),e.curOp.scrollToPos=t}function Wn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=zs(e,t.from),r=zs(e,t.to);Ws(e,i,r,t.margin)}}function Ws(e,t,i,r){var n=_a(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-r,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+r});Wi(e,n.scrollLeft,n.scrollTop)}function Ui(e,t){Math.abs(e.doc.scrollTop-t)<2||(s||Oa(e,{top:t}),Us(e,t,!0),s&&Oa(e),Xi(e,100))}function Us(e,t,i){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),!(e.display.scroller.scrollTop==t&&!i)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Ir(e,t,i,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),!((i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)&&(e.doc.scrollLeft=t,Ys(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function ji(e){var t=e.display,i=t.gutters.offsetWidth,r=Math.round(e.doc.height+ya(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?i:0,docHeight:r,scrollHeight:r+Qt(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var Hr=function(e,t,i){this.cm=i;var r=this.vert=k("div",[k("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=k("div",[k("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=n.tabIndex=-1,e(r),e(n),ue(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),ue(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,c&&d<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Hr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var n=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+n)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=i?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var u=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+u)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?r:0,bottom:t?r:0}},Hr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Hr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Hr.prototype.zeroWidthHack=function(){var e=O&&!B?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new dt,this.disableVert=new dt},Hr.prototype.enableZeroWidthBar=function(e,t,i){e.style.visibility="";function r(){var n=e.getBoundingClientRect(),u=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);u!=e?e.style.visibility="hidden":t.set(1e3,r)}t.set(1e3,r)},Hr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Gi=function(){};Gi.prototype.update=function(){return{bottom:0,right:0}},Gi.prototype.setScrollLeft=function(){},Gi.prototype.setScrollTop=function(){},Gi.prototype.clear=function(){};function li(e,t){t||(t=ji(e));var i=e.display.barWidth,r=e.display.barHeight;js(e,t);for(var n=0;n<4&&i!=e.display.barWidth||r!=e.display.barHeight;n++)i!=e.display.barWidth&&e.options.lineWrapping&&qn(e),js(e,ji(e)),i=e.display.barWidth,r=e.display.barHeight}function js(e,t){var i=e.display,r=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=r.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=r.bottom)+"px",i.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=r.bottom+"px",i.scrollbarFiller.style.width=r.right+"px"):i.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=r.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}var Gs={native:Hr,null:Gi};function Xs(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&oe(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Gs[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ue(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?Ir(e,t):Ui(e,t)},e),e.display.scrollbars.addClass&&pe(e.display.wrapper,e.display.scrollbars.addClass)}var Ud=0;function Pr(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Ud,markArrays:null},xd(e.curOp)}function qr(e){var t=e.curOp;t&&Cd(t,function(i){for(var r=0;r=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Un(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Xd(e){e.updatedDisplay=e.mustUpdate&&Na(e.cm,e.update)}function Kd(e){var t=e.cm,i=t.display;e.updatedDisplay&&qn(t),e.barMeasure=ji(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Es(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+Qt(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-_r(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function Yd(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)){var i=+new Date+e.options.workTime,r=Ni(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(u){if(r.line>=e.display.viewFrom){var p=u.styles,g=u.text.length>e.options.maxHighlightLength?Lr(t.mode,r.state):null,m=es(e,u,r,!0);g&&(r.state=g),u.styles=m.styles;var b=u.styleClasses,C=m.classes;C?u.styleClasses=C:b&&(u.styleClasses=null);for(var E=!p||p.length!=u.styles.length||b!=C&&(!b||!C||b.bgClass!=C.bgClass||b.textClass!=C.textClass),_=0;!E&&_i)return Xi(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&St(e,function(){for(var u=0;u=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&Hs(e)==0)return!1;Zs(e)&&(br(e),t.dims=Ea(e));var n=r.first+r.size,u=Math.max(t.visible.from-e.options.viewportMargin,r.first),p=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFromp&&i.viewTo-p<20&&(p=Math.min(n,i.viewTo)),rr&&(u=ga(e.doc,u),p=ps(e.doc,p));var g=u!=i.viewFrom||p!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Id(e,u,p),i.viewOffset=ir(ae(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var m=Hs(e);if(!g&&m==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var b=Vd(e);return m>4&&(i.lineDiv.style.display="none"),eh(e,i.updateLineNumbers,t.dims),m>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,$d(b),X(i.cursorDiv),X(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,g&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,Xi(e,400)),i.updateLineNumbers=null,!0}function Ks(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==_r(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+ya(e.display)-xa(e),i.top)}),t.visible=Rn(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Rn(e.display,e.doc,i));if(!Na(e,t))break;qn(e);var n=ji(e);Ri(e),li(e,n),Ha(e,n),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Oa(e,t){var i=new Un(e,t);if(Na(e,i)){qn(e),Ks(e,i);var r=ji(e);Ri(e),li(e,r),Ha(e,r),i.finish()}}function eh(e,t,i){var r=e.display,n=e.options.lineNumbers,u=r.lineDiv,p=u.firstChild;function g(P){var R=P.nextSibling;return v&&O&&e.display.currentWheelTarget==P?P.style.display="none":P.parentNode.removeChild(P),R}for(var m=r.view,b=r.viewFrom,C=0;C-1&&(M=!1),ys(e,E,b,i)),M&&(X(E.lineNumber),E.lineNumber.appendChild(document.createTextNode(sa(e.options,b)))),p=E.node.nextSibling}b+=E.size}for(;p;)p=g(p)}function Ia(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",et(e,"gutterChanged",e)}function Ha(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Qt(e)+"px"}function Ys(e){var t=e.display,i=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var r=Aa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,u=r+"px",p=0;pg.clientWidth,b=g.scrollHeight>g.clientHeight;if(r&&m||n&&b){if(n&&O&&v){e:for(var C=t.target,E=p.view;C!=g;C=C.parentNode)for(var _=0;_=0&&ve(e,r.to())<=0)return i}return-1};var Ae=function(e,t){this.anchor=e,this.head=t};Ae.prototype.from=function(){return An(this.anchor,this.head)},Ae.prototype.to=function(){return En(this.anchor,this.head)},Ae.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Wt(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(_,M){return ve(_.from(),M.from())}),i=ze(t,n);for(var u=1;u0:m>=0){var b=An(g.from(),p.from()),C=En(g.to(),p.to()),E=g.empty()?p.from()==p.head:g.from()==g.head;u<=i&&--i,t.splice(--u,2,new Ae(E?C:b,E?b:C))}}return new Bt(t,i)}function yr(e,t){return new Bt([new Ae(e,t||e)],0)}function xr(e){return e.text?Y(e.from.line+e.text.length-1,De(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function $s(e,t){if(ve(e,t.from)<0)return e;if(ve(e,t.to)<=0)return xr(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=xr(t).ch-t.to.ch),Y(i,r)}function qa(e,t){for(var i=[],r=0;r1&&e.remove(g.line+1,P-1),e.insert(g.line+1,J)}et(e,"change",e,t)}function wr(e,t,i){function r(n,u,p){if(n.linked)for(var g=0;g1&&!e.done[e.done.length-2].ranges)return e.done.pop(),De(e.done)}function ou(e,t,i,r){var n=e.history;n.undone.length=0;var u=+new Date,p,g;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>u-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(p=oh(n,n.lastOp==r)))g=De(p.changes),ve(t.from,t.to)==0&&ve(t.from,g.to)==0?g.to=xr(t):p.changes.push(Ua(e,t));else{var m=De(n.done);for((!m||!m.ranges)&&Xn(e.sel,n.done),p={changes:[Ua(e,t)],generation:n.generation},n.done.push(p);n.done.length>n.undoDepth;)n.done.shift(),n.done[0].ranges||n.done.shift()}n.done.push(i),n.generation=++n.maxGeneration,n.lastModTime=n.lastSelTime=u,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,g||je(e,"historyAdded")}function ah(e,t,i,r){var n=t.charAt(0);return n=="*"||n=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function lh(e,t,i,r){var n=e.history,u=r&&r.origin;i==n.lastSelOp||u&&n.lastSelOrigin==u&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==u||ah(e,u,De(n.done),t))?n.done[n.done.length-1]=t:Xn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=u,n.lastSelOp=i,r&&r.clearRedo!==!1&&nu(n.undone)}function Xn(e,t){var i=De(t);i&&i.ranges&&i.equals(e)||t.push(e)}function au(e,t,i,r){var n=t["spans_"+e.id],u=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(p){p.markedSpans&&((n||(n=t["spans_"+e.id]={}))[u]=p.markedSpans),++u})}function sh(e){if(!e)return null;for(var t,i=0;i-1&&(De(g)[E]=b[E],delete b[E])}}return r}function ja(e,t,i,r){if(r){var n=e.anchor;if(i){var u=ve(t,n)<0;u!=ve(i,n)<0?(n=t,t=i):u!=ve(t,i)<0&&(t=i)}return new Ae(n,t)}else return new Ae(i||t,t)}function Kn(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),st(e,new Bt([ja(e.sel.primary(),t,i,n)],0),r)}function su(e,t,i){for(var r=[],n=e.cm&&(e.cm.display.shift||e.extend),u=0;u=t.ch:g.to>t.ch))){if(n&&(je(m,"beforeCursorEnter"),m.explicitlyCleared))if(u.markedSpans){--p;continue}else break;if(!m.atomic)continue;if(i){var E=m.find(r<0?1:-1),_=void 0;if((r<0?C:b)&&(E=pu(e,E,-r,E&&E.line==t.line?u:null)),E&&E.line==t.line&&(_=ve(E,i))&&(r<0?_<0:_>0))return ui(e,E,t,r,n)}var M=m.find(r<0?-1:1);return(r<0?b:C)&&(M=pu(e,M,r,M.line==t.line?u:null)),M?ui(e,M,t,r,n):null}}return t}function Zn(e,t,i,r,n){var u=r||1,p=ui(e,t,i,u,n)||!n&&ui(e,t,i,u,!0)||ui(e,t,i,-u,n)||!n&&ui(e,t,i,-u,!0);return p||(e.cantEdit=!0,Y(e.first,0))}function pu(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?be(e,Y(t.line-1)):null:i>0&&t.ch==(r||ae(e,t.line)).text.length?t.line=0;--n)vu(e,{from:r[n].from,to:r[n].to,text:n?[""]:t.text,origin:t.origin});else vu(e,t)}}function vu(e,t){if(!(t.text.length==1&&t.text[0]==""&&ve(t.from,t.to)==0)){var i=qa(e,t);ou(e,t,i,e.cm?e.cm.curOp.id:NaN),Zi(e,t,i,ha(e,t));var r=[];wr(e,function(n,u){!u&&ze(r,n.history)==-1&&(wu(n.history,t),r.push(n.history)),Zi(n,t,null,ha(n,t))})}}function Qn(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(!(r&&!i)){for(var n=e.history,u,p=e.sel,g=t=="undo"?n.done:n.undone,m=t=="undo"?n.undone:n.done,b=0;b=0;--M){var P=_(M);if(P)return P.v}}}}function bu(e,t){if(t!=0&&(e.first+=t,e.sel=new Bt(Pt(e.sel.ranges,function(n){return new Ae(Y(n.anchor.line+t,n.anchor.ch),Y(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm)){yt(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;re.lastLine())){if(t.from.lineu&&(t={from:t.from,to:Y(u,ae(e,u).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Mr(e,t.from,t.to),i||(i=qa(e,t)),e.cm?ch(e.cm,t,r):Wa(e,t,r),Yn(e,i,vt),e.cantEdit&&Zn(e,Y(e.firstLine(),0))&&(e.cantEdit=!1)}}function ch(e,t,i){var r=e.doc,n=e.display,u=t.from,p=t.to,g=!1,m=u.line;e.options.lineWrapping||(m=Fe(qt(ae(r,u.line))),r.iter(m,p.line+1,function(M){if(M==n.maxLine)return g=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Yl(e),Wa(r,t,i,Is(e)),e.options.lineWrapping||(r.iter(m,u.line+t.text.length,function(M){var P=_n(M);P>n.maxLineLength&&(n.maxLine=M,n.maxLineLength=P,n.maxLineChanged=!0,g=!1)}),g&&(e.curOp.updateMaxLine=!0)),ed(r,u.line),Xi(e,400);var b=t.text.length-(p.line-u.line)-1;t.full?yt(e):u.line==p.line&&t.text.length==1&&!tu(e.doc,t)?vr(e,u.line,"text"):yt(e,u.line,p.line+1,b);var C=Ot(e,"changes"),E=Ot(e,"change");if(E||C){var _={from:u,to:p,text:t.text,removed:t.removed,origin:t.origin};E&&et(e,"change",e,_),C&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(_)}e.display.selForContextMenu=null}function ci(e,t,i,r,n){var u;r||(r=i),ve(r,i)<0&&(u=[r,i],i=u[0],r=u[1]),typeof t=="string"&&(t=e.splitLines(t)),fi(e,{from:i,to:r,text:t,origin:n})}function yu(e,t,i,r){i1||!(this.children[0]instanceof Ji))){var g=[];this.collapse(g),this.children=[new Ji(g)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var p=n.lines.length%25+25,g=p;g10);e.parent.maybeSpill()}},iterN:function(e,t,i){for(var r=0;re.display.maxLineLength&&(e.display.maxLine=b,e.display.maxLineLength=C,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&yt(e,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&du(e.doc)),e&&et(e,"markerCleared",e,this,r,n),t&&qr(e),this.parent&&this.parent.clear()}},Cr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n0||p==0&&u.clearWhenEmpty!==!1)return u;if(u.replacedWith&&(u.collapsed=!0,u.widgetNode=H("span",[u.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||u.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(u.widgetNode.insertLeft=!0)),u.collapsed){if(hs(e,t.line,t,i,u)||t.line!=i.line&&hs(e,i.line,t,i,u))throw new Error("Inserting collapsed marker partially overlapping an existing one");rd()}u.addToHistory&&ou(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var g=t.line,m=e.cm,b;if(e.iter(g,i.line+1,function(E){m&&u.collapsed&&!m.options.lineWrapping&&qt(E)==m.display.maxLine&&(b=!0),u.collapsed&&g!=t.line&&Yt(E,0),nd(E,new Tn(u,g==t.line?t.ch:null,g==i.line?i.ch:null),e.cm&&e.cm.curOp),++g}),u.collapsed&&e.iter(t.line,i.line+1,function(E){mr(e,E)&&Yt(E,0)}),u.clearOnEnter&&ue(u,"beforeCursorEnter",function(){return u.clear()}),u.readOnly&&(td(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),u.collapsed&&(u.id=++Du,u.atomic=!0),m){if(b&&(m.curOp.updateMaxLine=!0),u.collapsed)yt(m,t.line,i.line+1);else if(u.className||u.startStyle||u.endStyle||u.css||u.attributes||u.title)for(var C=t.line;C<=i.line;C++)vr(m,C,"text");u.atomic&&du(m.doc),et(m,"markerAdded",m,u)}return u}var en=function(e,t){this.markers=e,this.primary=t;for(var i=0;i=0;m--)fi(this,r[m]);g?fu(this,g):this.cm&&ai(this.cm)}),undo:rt(function(){Qn(this,"undo")}),redo:rt(function(){Qn(this,"redo")}),undoSelection:rt(function(){Qn(this,"undo",!0)}),redoSelection:rt(function(){Qn(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,r=0;r=e.ch)&&t.push(n.marker.parent||n.marker)}return t},findMarks:function(e,t,i){e=be(this,e),t=be(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(u){var p=u.markedSpans;if(p)for(var g=0;g=m.to||m.from==null&&n!=e.line||m.from!=null&&n==t.line&&m.from>=t.ch)&&(!i||i(m.marker))&&r.push(m.marker.parent||m.marker)}++n}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var r=0;re)return t=e,!0;e-=u,++i}),be(this,Y(i,t))},indexFromPos:function(e){e=be(this,e);var t=e.ch;if(e.linet&&(t=e.from),e.to!=null&&e.to-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var C=e.dataTransfer.getData("Text");if(C){var E;if(t.state.draggingText&&!t.state.draggingText.copy&&(E=t.listSelections()),Yn(t.doc,yr(i,i)),E)for(var _=0;_=0;g--)ci(e.doc,"",r[g].from,r[g].to,"+delete");ai(e)})}function Xa(e,t,i){var r=Xl(e.text,t+i,i);return r<0||r>e.text.length?null:r}function Ka(e,t,i){var r=Xa(e,t.ch,i);return r==null?null:new Y(t.line,r,i<0?"after":"before")}function Ya(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var u=tr(i,t.doc.direction);if(u){var p=n<0?De(u):u[0],g=n<0==(p.level==1),m=g?"after":"before",b;if(p.level>0||t.doc.direction=="rtl"){var C=ri(t,i);b=n<0?i.text.length-1:0;var E=Jt(t,C,b).top;b=Li(function(_){return Jt(t,C,_).top==E},n<0==(p.level==1)?p.from:p.to-1,b),m=="before"&&(b=Xa(i,b,1))}else b=n<0?p.to:p.from;return new Y(r,b,m)}}return new Y(r,n<0?i.text.length:0,n<0?"before":"after")}function Sh(e,t,i,r){var n=tr(t,e.doc.direction);if(!n)return Ka(t,i,r);i.ch>=t.text.length?(i.ch=t.text.length,i.sticky="before"):i.ch<=0&&(i.ch=0,i.sticky="after");var u=Bi(n,i.ch,i.sticky),p=n[u];if(e.doc.direction=="ltr"&&p.level%2==0&&(r>0?p.to>i.ch:p.from=p.from&&_>=C.begin)){var M=E?"before":"after";return new Y(i.line,_,M)}}var P=function(J,te,V){for(var ie=function(Le,it){return it?new Y(i.line,g(Le,1),"before"):new Y(i.line,Le,"after")};J>=0&&J0==(se.level!=1),we=le?V.begin:g(V.end,-1);if(se.from<=we&&we0?C.end:g(C.begin,-1);return Z!=null&&!(r>0&&Z==t.text.length)&&(R=P(r>0?0:n.length-1,r,b(Z)),R)?R:null}var nn={selectAll:gu,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),vt)},killLine:function(e){return pi(e,function(t){if(t.empty()){var i=ae(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line0)n=new Y(n.line,n.ch+1),e.replaceRange(u.charAt(n.ch-1)+u.charAt(n.ch-2),Y(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var p=ae(e.doc,n.line-1).text;p&&(n=new Y(n.line,1),e.replaceRange(u.charAt(0)+e.doc.lineSeparator()+p.charAt(p.length-1),Y(n.line-1,p.length-1),n,"+transpose"))}}i.push(new Ae(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){return St(e,function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");t=e.listSelections();for(var r=0;re&&ve(t,this.pos)==0&&i==this.button};var an,ln;function Bh(e,t){var i=+new Date;return ln&&ln.compare(i,e,t)?(an=ln=null,"triple"):an&&an.compare(i,e,t)?(ln=new Qa(i,e,t),an=null,"double"):(an=new Qa(i,e,t),ln=null,"single")}function Pu(e){var t=this,i=t.display;if(!($e(t,e)||i.activeTouch&&i.input.supportsTouch())){if(i.input.ensurePolled(),i.shift=e.shiftKey,nr(i,e)){v||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(!Ja(t,e)){var r=Nr(t,e),n=Ql(e),u=r?Bh(r,n):"single";ye(t).focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&_h(t,n,r,u,e))&&(n==1?r?Nh(t,r,u,e):$o(e)==i.scroller&&bt(e):n==2?(r&&Kn(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(de?t.display.input.onContextMenu(e):Ma(t)))}}}function _h(e,t,i,r,n){var u="Click";return r=="double"?u="Double"+u:r=="triple"&&(u="Triple"+u),u=(t==1?"Left":t==2?"Middle":"Right")+u,on(e,Lu(u,n),n,function(p){if(typeof p=="string"&&(p=nn[p]),!p)return!1;var g=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),g=p(e,i)!=Ze}finally{e.state.suppressEdits=!1}return g})}function zh(e,t,i){var r=e.getOption("configureMouse"),n=r?r(e,t,i):{};if(n.unit==null){var u=I?i.shiftKey&&i.metaKey:i.altKey;n.unit=u?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(n.extend==null||e.doc.extend)&&(n.extend=e.doc.extend||i.shiftKey),n.addNew==null&&(n.addNew=O?i.metaKey:i.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(O?i.altKey:i.ctrlKey)),n}function Nh(e,t,i,r){c?setTimeout(lt(qs,e),0):e.curOp.focus=he(ee(e));var n=zh(e,i,r),u=e.doc.sel,p;e.options.dragDrop&&Uc&&!e.isReadOnly()&&i=="single"&&(p=u.contains(t))>-1&&(ve((p=u.ranges[p]).from(),t)<0||t.xRel>0)&&(ve(p.to(),t)>0||t.xRel<0)?Oh(e,r,t,n):Ih(e,r,t,n)}function Oh(e,t,i,r){var n=e.display,u=!1,p=tt(e,function(b){v&&(n.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:Ma(e)),Mt(n.wrapper.ownerDocument,"mouseup",p),Mt(n.wrapper.ownerDocument,"mousemove",g),Mt(n.scroller,"dragstart",m),Mt(n.scroller,"drop",p),u||(bt(b),r.addNew||Kn(e.doc,i,null,null,r.extend),v&&!F||c&&d==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),g=function(b){u=u||Math.abs(t.clientX-b.clientX)+Math.abs(t.clientY-b.clientY)>=10},m=function(){return u=!0};v&&(n.scroller.draggable=!0),e.state.draggingText=p,p.copy=!r.moveOnDrag,ue(n.wrapper.ownerDocument,"mouseup",p),ue(n.wrapper.ownerDocument,"mousemove",g),ue(n.scroller,"dragstart",m),ue(n.scroller,"drop",p),e.state.delayingBlurEvent=!0,setTimeout(function(){return n.input.focus()},20),n.scroller.dragDrop&&n.scroller.dragDrop()}function qu(e,t,i){if(i=="char")return new Ae(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new Ae(Y(t.line,0),be(e.doc,Y(t.line+1,0)));var r=i(e,t);return new Ae(r.from,r.to)}function Ih(e,t,i,r){c&&Ma(e);var n=e.display,u=e.doc;bt(t);var p,g,m=u.sel,b=m.ranges;if(r.addNew&&!r.extend?(g=u.sel.contains(i),g>-1?p=b[g]:p=new Ae(i,i)):(p=u.sel.primary(),g=u.sel.primIndex),r.unit=="rectangle")r.addNew||(p=new Ae(i,i)),i=Nr(e,t,!0,!0),g=-1;else{var C=qu(e,i,r.unit);r.extend?p=ja(p,C.anchor,C.head,r.extend):p=C}r.addNew?g==-1?(g=b.length,st(u,Wt(e,b.concat([p]),g),{scroll:!1,origin:"*mouse"})):b.length>1&&b[g].empty()&&r.unit=="char"&&!r.extend?(st(u,Wt(e,b.slice(0,g).concat(b.slice(g+1)),0),{scroll:!1,origin:"*mouse"}),m=u.sel):Ga(u,g,p,Ti):(g=0,st(u,new Bt([p],0),Ti),m=u.sel);var E=i;function _(V){if(ve(E,V)!=0)if(E=V,r.unit=="rectangle"){for(var ie=[],se=e.options.tabSize,le=Ye(ae(u,i.line).text,i.ch,se),we=Ye(ae(u,V.line).text,V.ch,se),Le=Math.min(le,we),it=Math.max(le,we),Ie=Math.min(i.line,V.line),Et=Math.min(e.lastLine(),Math.max(i.line,V.line));Ie<=Et;Ie++){var wt=ae(u,Ie).text,Xe=Kt(wt,Le,se);Le==it?ie.push(new Ae(Y(Ie,Xe),Y(Ie,Xe))):wt.length>Xe&&ie.push(new Ae(Y(Ie,Xe),Y(Ie,Kt(wt,it,se))))}ie.length||ie.push(new Ae(i,i)),st(u,Wt(e,m.ranges.slice(0,g).concat(ie),g),{origin:"*mouse",scroll:!1}),e.scrollIntoView(V)}else{var Ct=p,ot=qu(e,V,r.unit),Qe=Ct.anchor,Ke;ve(ot.anchor,Qe)>0?(Ke=ot.head,Qe=An(Ct.from(),ot.anchor)):(Ke=ot.anchor,Qe=En(Ct.to(),ot.head));var qe=m.ranges.slice(0);qe[g]=Hh(e,new Ae(be(u,Qe),Ke)),st(u,Wt(e,qe,g),Ti)}}var M=n.wrapper.getBoundingClientRect(),P=0;function R(V){var ie=++P,se=Nr(e,V,!0,r.unit=="rectangle");if(se)if(ve(se,E)!=0){e.curOp.focus=he(ee(e)),_(se);var le=Rn(n,u);(se.line>=le.to||se.lineM.bottom?20:0;we&&setTimeout(tt(e,function(){P==ie&&(n.scroller.scrollTop+=we,R(V))}),50)}}function Z(V){e.state.selectingText=!1,P=1/0,V&&(bt(V),n.input.focus()),Mt(n.wrapper.ownerDocument,"mousemove",J),Mt(n.wrapper.ownerDocument,"mouseup",te),u.history.lastSelOrigin=null}var J=tt(e,function(V){V.buttons===0||!Ql(V)?Z(V):R(V)}),te=tt(e,Z);e.state.selectingText=te,ue(n.wrapper.ownerDocument,"mousemove",J),ue(n.wrapper.ownerDocument,"mouseup",te)}function Hh(e,t){var i=t.anchor,r=t.head,n=ae(e.doc,i.line);if(ve(i,r)==0&&i.sticky==r.sticky)return t;var u=tr(n);if(!u)return t;var p=Bi(u,i.ch,i.sticky),g=u[p];if(g.from!=i.ch&&g.to!=i.ch)return t;var m=p+(g.from==i.ch==(g.level!=1)?0:1);if(m==0||m==u.length)return t;var b;if(r.line!=i.line)b=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var C=Bi(u,r.ch,r.sticky),E=C-p||(r.ch-i.ch)*(g.level==1?-1:1);C==m-1||C==m?b=E<0:b=E>0}var _=u[m+(b?-1:0)],M=b==(_.level==1),P=M?_.from:_.to,R=M?"after":"before";return i.ch==P&&i.sticky==R?t:new Ae(new Y(i.line,P,R),r)}function Ru(e,t,i,r){var n,u;if(t.touches)n=t.touches[0].clientX,u=t.touches[0].clientY;else try{n=t.clientX,u=t.clientY}catch{return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&bt(t);var p=e.display,g=p.lineDiv.getBoundingClientRect();if(u>g.bottom||!Ot(e,i))return Vo(t);u-=g.top-p.viewOffset;for(var m=0;m=n){var C=Br(e.doc,u),E=e.display.gutterSpecs[m];return je(e,i,e,C,E.className,t),Vo(t)}}}function Ja(e,t){return Ru(e,t,"gutterClick",!0)}function Wu(e,t){nr(e.display,t)||Ph(e,t)||$e(e,t,"contextmenu")||de||e.display.input.onContextMenu(t)}function Ph(e,t){return Ot(e,"gutterContextMenu")?Ru(e,t,"gutterContextMenu",!1):!1}function Uu(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),qi(e)}var gi={toString:function(){return"CodeMirror.Init"}},ju={},eo={};function qh(e){var t=e.optionHandlers;function i(r,n,u,p){e.defaults[r]=n,u&&(t[r]=p?function(g,m,b){b!=gi&&u(g,m,b)}:u)}e.defineOption=i,e.Init=gi,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,Ra(r)},!0),i("indentUnit",2,Ra,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){Yi(r),qi(r),yt(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!!n){var u=[],p=r.doc.first;r.doc.iter(function(m){for(var b=0;;){var C=m.text.indexOf(n,b);if(C==-1)break;b=C+n.length,u.push(Y(p,C))}p++});for(var g=u.length-1;g>=0;g--)ci(r.doc,n,u[g],Y(u[g].line,u[g].ch+n.length))}}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(r,n,u){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),u!=gi&&r.refresh()}),i("specialCharPlaceholder",gd,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",z?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(r,n){return r.getInputField().spellcheck=n},!0),i("autocorrect",!1,function(r,n){return r.getInputField().autocorrect=n},!0),i("autocapitalize",!1,function(r,n){return r.getInputField().autocapitalize=n},!0),i("rtlMoveVisually",!U),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Uu(r),Ki(r)},!0),i("keyMap","default",function(r,n,u){var p=Vn(n),g=u!=gi&&Vn(u);g&&g.detach&&g.detach(r,p),p.attach&&p.attach(r,g||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Wh,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=Pa(n,r.options.lineNumbers),Ki(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?Aa(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return li(r)},!0),i("scrollbarStyle","native",function(r){Xs(r),li(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),i("lineNumbers",!1,function(r,n){r.display.gutterSpecs=Pa(r.options.gutters,n),Ki(r)},!0),i("firstLineNumber",1,Ki,!0),i("lineNumberFormatter",function(r){return r},Ki,!0),i("showCursorWhenSelecting",!1,Ri,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,n){n=="nocursor"&&(oi(r),r.display.input.blur()),r.display.input.readOnlyChanged(n)}),i("screenReaderLabel",null,function(r,n){n=n===""?null:n,r.display.input.screenReaderLabelChanged(n)}),i("disableInput",!1,function(r,n){n||r.display.input.reset()},!0),i("dragDrop",!0,Rh),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,Ri,!0),i("singleCursorHeightPerLine",!0,Ri,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,Yi,!0),i("addModeClass",!1,Yi,!0),i("pollInterval",100),i("undoDepth",200,function(r,n){return r.doc.history.undoDepth=n}),i("historyEventDelay",1250),i("viewportMargin",10,function(r){return r.refresh()},!0),i("maxHighlightLength",1e4,Yi,!0),i("moveInputWithCursor",!0,function(r,n){n||r.display.input.resetPosition()}),i("tabindex",null,function(r,n){return r.display.input.getField().tabIndex=n||""}),i("autofocus",null),i("direction","ltr",function(r,n){return r.doc.setDirection(n)},!0),i("phrases",null)}function Rh(e,t,i){var r=i&&i!=gi;if(!t!=!r){var n=e.display.dragFunctions,u=t?ue:Mt;u(e.display.scroller,"dragstart",n.start),u(e.display.scroller,"dragenter",n.enter),u(e.display.scroller,"dragover",n.over),u(e.display.scroller,"dragleave",n.leave),u(e.display.scroller,"drop",n.drop)}}function Wh(e){e.options.lineWrapping?(pe(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(oe(e.display.wrapper,"CodeMirror-wrap"),va(e)),Fa(e),yt(e),qi(e),setTimeout(function(){return li(e)},100)}function Ne(e,t){var i=this;if(!(this instanceof Ne))return new Ne(e,t);this.options=t=t?Lt(t):{},Lt(ju,t,!1);var r=t.value;typeof r=="string"?r=new xt(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new Ne.inputStyles[t.inputStyle](this),u=this.display=new th(e,r,n,t);u.wrapper.CodeMirror=this,Uu(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Xs(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new dt,keySeq:null,specialChars:null},t.autofocus&&!z&&u.input.focus(),c&&d<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Uh(this),xh(),Pr(this),this.curOp.forceUpdate=!0,ru(this,r),t.autofocus&&!z||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&Ba(i)},20):oi(this);for(var p in eo)eo.hasOwnProperty(p)&&eo[p](this,t[p],gi);Zs(this),t.finishInit&&t.finishInit(this);for(var g=0;g20*20}ue(t.scroller,"touchstart",function(m){if(!$e(e,m)&&!u(m)&&!Ja(e,m)){t.input.ensurePolled(),clearTimeout(i);var b=+new Date;t.activeTouch={start:b,moved:!1,prev:b-r.end<=300?r:null},m.touches.length==1&&(t.activeTouch.left=m.touches[0].pageX,t.activeTouch.top=m.touches[0].pageY)}}),ue(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),ue(t.scroller,"touchend",function(m){var b=t.activeTouch;if(b&&!nr(t,m)&&b.left!=null&&!b.moved&&new Date-b.start<300){var C=e.coordsChar(t.activeTouch,"page"),E;!b.prev||p(b,b.prev)?E=new Ae(C,C):!b.prev.prev||p(b,b.prev.prev)?E=e.findWordAt(C):E=new Ae(Y(C.line,0),be(e.doc,Y(C.line+1,0))),e.setSelection(E.anchor,E.head),e.focus(),bt(m)}n()}),ue(t.scroller,"touchcancel",n),ue(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Ui(e,t.scroller.scrollTop),Ir(e,t.scroller.scrollLeft,!0),je(e,"scroll",e))}),ue(t.scroller,"mousewheel",function(m){return Vs(e,m)}),ue(t.scroller,"DOMMouseScroll",function(m){return Vs(e,m)}),ue(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(m){$e(e,m)||_i(m)},over:function(m){$e(e,m)||(yh(e,m),_i(m))},start:function(m){return bh(e,m)},drop:tt(e,vh),leave:function(m){$e(e,m)||Eu(e)}};var g=t.input.getField();ue(g,"keyup",function(m){return Iu.call(e,m)}),ue(g,"keydown",tt(e,Ou)),ue(g,"keypress",tt(e,Hu)),ue(g,"focus",function(m){return Ba(e,m)}),ue(g,"blur",function(m){return oi(e,m)})}var Va=[];Ne.defineInitHook=function(e){return Va.push(e)};function sn(e,t,i,r){var n=e.doc,u;i==null&&(i="add"),i=="smart"&&(n.mode.indent?u=Ni(e,t).state:i="prev");var p=e.options.tabSize,g=ae(n,t),m=Ye(g.text,null,p);g.stateAfter&&(g.stateAfter=null);var b=g.text.match(/^\s*/)[0],C;if(!r&&!/\S/.test(g.text))C=0,i="not";else if(i=="smart"&&(C=n.mode.indent(u,g.text.slice(b.length),g.text),C==Ze||C>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?C=Ye(ae(n,t-1).text,null,p):C=0:i=="add"?C=m+e.options.indentUnit:i=="subtract"?C=m-e.options.indentUnit:typeof i=="number"&&(C=m+i),C=Math.max(0,C);var E="",_=0;if(e.options.indentWithTabs)for(var M=Math.floor(C/p);M;--M)_+=p,E+=" ";if(_p,m=ra(t),b=null;if(g&&r.ranges.length>1)if(Ut&&Ut.text.join(` -`)==t){if(r.ranges.length%Ut.text.length==0){b=[];for(var C=0;C=0;_--){var M=r.ranges[_],P=M.from(),R=M.to();M.empty()&&(i&&i>0?P=Y(P.line,P.ch-i):e.state.overwrite&&!g?R=Y(R.line,Math.min(ae(u,R.line).text.length,R.ch+De(m).length)):g&&Ut&&Ut.lineWise&&Ut.text.join(` -`)==m.join(` -`)&&(P=R=Y(P.line,0)));var Z={from:P,to:R,text:b?b[_%b.length]:m,origin:n||(g?"paste":e.state.cutIncoming>p?"cut":"+input")};fi(e.doc,Z),et(e,"inputRead",e,Z)}t&&!g&&Xu(e,t),ai(e),e.curOp.updateInput<2&&(e.curOp.updateInput=E),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Gu(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&St(t,function(){return $a(t,i,0,null,"paste")}),!0}function Xu(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var i=e.doc.sel,r=i.ranges.length-1;r>=0;r--){var n=i.ranges[r];if(!(n.head.ch>100||r&&i.ranges[r-1].head.line==n.head.line)){var u=e.getModeAt(n.head),p=!1;if(u.electricChars){for(var g=0;g-1){p=sn(e,n.head.line,"smart");break}}else u.electricInput&&u.electricInput.test(ae(e.doc,n.head.line).text.slice(0,n.head.ch))&&(p=sn(e,n.head.line,"smart"));p&&et(e,"electricInput",e,n.head.line)}}}function Ku(e){for(var t=[],i=[],r=0;ru&&(sn(this,g.head.line,r,!0),u=g.head.line,p==this.doc.sel.primIndex&&ai(this));else{var m=g.from(),b=g.to(),C=Math.max(u,m.line);u=Math.min(this.lastLine(),b.line-(b.ch?0:1))+1;for(var E=C;E0&&Ga(this.doc,p,new Ae(m,_[p].to()),vt)}}}),getTokenAt:function(r,n){return ns(this,r,n)},getLineTokens:function(r,n){return ns(this,Y(r),n,!0)},getTokenTypeAt:function(r){r=be(this.doc,r);var n=ts(this,ae(this.doc,r.line)),u=0,p=(n.length-1)/2,g=r.ch,m;if(g==0)m=n[2];else for(;;){var b=u+p>>1;if((b?n[b*2-1]:0)>=g)p=b;else if(n[b*2+1]m&&(r=m,p=!0),g=ae(this.doc,r)}else g=r;return On(this,g,{top:0,left:0},n||"page",u||p).top+(p?this.doc.height-ir(g):0)},defaultTextHeight:function(){return ii(this.display)},defaultCharWidth:function(){return ni(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,u,p,g){var m=this.display;r=Rt(this,be(this.doc,r));var b=r.bottom,C=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),m.sizer.appendChild(n),p=="over")b=r.top;else if(p=="above"||p=="near"){var E=Math.max(m.wrapper.clientHeight,this.doc.height),_=Math.max(m.sizer.clientWidth,m.lineSpace.clientWidth);(p=="above"||r.bottom+n.offsetHeight>E)&&r.top>n.offsetHeight?b=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=E&&(b=r.bottom),C+n.offsetWidth>_&&(C=_-n.offsetWidth)}n.style.top=b+"px",n.style.left=n.style.right="",g=="right"?(C=m.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(g=="left"?C=0:g=="middle"&&(C=(m.sizer.clientWidth-n.offsetWidth)/2),n.style.left=C+"px"),u&&Rd(this,{left:C,top:b,right:C+n.offsetWidth,bottom:b+n.offsetHeight})},triggerOnKeyDown:ht(Ou),triggerOnKeyPress:ht(Hu),triggerOnKeyUp:Iu,triggerOnMouseDown:ht(Pu),execCommand:function(r){if(nn.hasOwnProperty(r))return nn[r].call(null,this)},triggerElectric:ht(function(r){Xu(this,r)}),findPosH:function(r,n,u,p){var g=1;n<0&&(g=-1,n=-n);for(var m=be(this.doc,r),b=0;b0&&C(u.charAt(p-1));)--p;for(;g.5||this.options.lineWrapping)&&Fa(this),je(this,"refresh",this)}),swapDoc:ht(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),ru(this,r),qi(this),this.display.input.reset(),Wi(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,et(this,"swapDoc",this,n),n}),phrase:function(r){var n=this.options.phrases;return n&&Object.prototype.hasOwnProperty.call(n,r)?n[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Jr(e),e.registerHelper=function(r,n,u){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=u},e.registerGlobalHelper=function(r,n,u,p){e.registerHelper(r,n,p),i[r]._global.push({pred:u,val:p})}}function tl(e,t,i,r,n){var u=t,p=i,g=ae(e,t.line),m=n&&e.direction=="rtl"?-i:i;function b(){var te=t.line+m;return te=e.first+e.size?!1:(t=new Y(te,t.ch,t.sticky),g=ae(e,te))}function C(te){var V;if(r=="codepoint"){var ie=g.text.charCodeAt(t.ch+(i>0?0:-1));if(isNaN(ie))V=null;else{var se=i>0?ie>=55296&&ie<56320:ie>=56320&&ie<57343;V=new Y(t.line,Math.max(0,Math.min(g.text.length,t.ch+i*(se?2:1))),-i)}}else n?V=Sh(e.cm,g,t,i):V=Ka(g,t,i);if(V==null)if(!te&&b())t=Ya(n,e.cm,g,t.line,m);else return!1;else t=V;return!0}if(r=="char"||r=="codepoint")C();else if(r=="column")C(!0);else if(r=="word"||r=="group")for(var E=null,_=r=="group",M=e.cm&&e.cm.getHelper(t,"wordChars"),P=!0;!(i<0&&!C(!P));P=!1){var R=g.text.charAt(t.ch)||` -`,Z=kn(R,M)?"w":_&&R==` -`?"n":!_||/\s/.test(R)?null:"p";if(_&&!P&&!Z&&(Z="s"),E&&E!=Z){i<0&&(i=1,C(),t.sticky="after");break}if(Z&&(E=Z),i>0&&!C(!P))break}var J=Zn(e,t,u,p,!0);return ua(u,J)&&(J.hitSide=!0),J}function Zu(e,t,i,r){var n=e.doc,u=t.left,p;if(r=="page"){var g=Math.min(e.display.wrapper.clientHeight,ye(e).innerHeight||n(e).documentElement.clientHeight),m=Math.max(g-.5*ii(e.display),3);p=(i>0?t.bottom:t.top)+i*m}else r=="line"&&(p=i>0?t.bottom+3:t.top-3);for(var b;b=ka(e,u,p),!!b.outside;){if(i<0?p<=0:p>=n.height){b.hitSide=!0;break}p+=i*5}return b}var Te=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new dt,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Te.prototype.init=function(e){var t=this,i=this,r=i.cm,n=i.div=e.lineDiv;n.contentEditable=!0,el(n,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function u(g){for(var m=g.target;m;m=m.parentNode){if(m==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(m.className))break}return!1}ue(n,"paste",function(g){!u(g)||$e(r,g)||Gu(g,r)||d<=11&&setTimeout(tt(r,function(){return t.updateFromDOM()}),20)}),ue(n,"compositionstart",function(g){t.composing={data:g.data,done:!1}}),ue(n,"compositionupdate",function(g){t.composing||(t.composing={data:g.data,done:!1})}),ue(n,"compositionend",function(g){t.composing&&(g.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ue(n,"touchstart",function(){return i.forceCompositionEnd()}),ue(n,"input",function(){t.composing||t.readFromDOMSoon()});function p(g){if(!(!u(g)||$e(r,g))){if(r.somethingSelected())to({lineWise:!1,text:r.getSelections()}),g.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var m=Ku(r);to({lineWise:!0,text:m.text}),g.type=="cut"&&r.operation(function(){r.setSelections(m.ranges,0,vt),r.replaceSelection("",null,"cut")})}else return;if(g.clipboardData){g.clipboardData.clearData();var b=Ut.text.join(` -`);if(g.clipboardData.setData("Text",b),g.clipboardData.getData("Text")==b){g.preventDefault();return}}var C=Yu(),E=C.firstChild;el(E),r.display.lineSpace.insertBefore(C,r.display.lineSpace.firstChild),E.value=Ut.text.join(` -`);var _=he(Ce(n));A(E),setTimeout(function(){r.display.lineSpace.removeChild(C),_.focus(),_==n&&i.showPrimarySelection()},50)}}ue(n,"copy",p),ue(n,"cut",p)},Te.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Te.prototype.prepareSelection=function(){var e=Ps(this.cm,!1);return e.focus=he(Ce(this.div))==this.div,e},Te.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Te.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Te.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),r=i.from(),n=i.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||n.line=t.display.viewFrom&&Qu(t,r)||{node:g[0].measure.map[2],offset:0},b=n.linee.firstLine()&&(r=Y(r.line-1,ae(e.doc,r.line-1).length)),n.ch==ae(e.doc,n.line).text.length&&n.linet.viewTo-1)return!1;var u,p,g;r.line==t.viewFrom||(u=Or(e,r.line))==0?(p=Fe(t.view[0].line),g=t.view[0].node):(p=Fe(t.view[u].line),g=t.view[u-1].node.nextSibling);var m=Or(e,n.line),b,C;if(m==t.view.length-1?(b=t.viewTo-1,C=t.lineDiv.lastChild):(b=Fe(t.view[m+1].line)-1,C=t.view[m+1].node.previousSibling),!g)return!1;for(var E=e.doc.splitLines(Xh(e,g,C,p,b)),_=Mr(e.doc,Y(p,0),Y(b,ae(e.doc,b).text.length));E.length>1&&_.length>1;)if(De(E)==De(_))E.pop(),_.pop(),b--;else if(E[0]==_[0])E.shift(),_.shift(),p++;else break;for(var M=0,P=0,R=E[0],Z=_[0],J=Math.min(R.length,Z.length);Mr.ch&&te.charCodeAt(te.length-P-1)==V.charCodeAt(V.length-P-1);)M--,P++;E[E.length-1]=te.slice(0,te.length-P).replace(/^\u200b+/,""),E[0]=E[0].slice(M).replace(/\u200b+$/,"");var se=Y(p,M),le=Y(b,_.length?De(_).length-P:0);if(E.length>1||E[0]||ve(se,le))return ci(e.doc,E,se,le,"+input"),!0},Te.prototype.ensurePolled=function(){this.forceCompositionEnd()},Te.prototype.reset=function(){this.forceCompositionEnd()},Te.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Te.prototype.readFromDOMSoon=function(){var e=this;this.readDOMTimeout==null&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80))},Te.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&St(this.cm,function(){return yt(e.cm)})},Te.prototype.setUneditable=function(e){e.contentEditable="false"},Te.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||tt(this.cm,$a)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},Te.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Te.prototype.onContextMenu=function(){},Te.prototype.resetPosition=function(){},Te.prototype.needsContentAttribute=!0;function Qu(e,t){var i=wa(e,t.line);if(!i||i.hidden)return null;var r=ae(e.doc,t.line),n=Ss(i,r,t.line),u=tr(r,e.doc.direction),p="left";if(u){var g=Bi(u,t.ch);p=g%2?"right":"left"}var m=Fs(n.map,t.ch,p);return m.offset=m.collapse=="right"?m.end:m.start,m}function Gh(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function mi(e,t){return t&&(e.bad=!0),e}function Xh(e,t,i,r,n){var u="",p=!1,g=e.doc.lineSeparator(),m=!1;function b(M){return function(P){return P.id==M}}function C(){p&&(u+=g,m&&(u+=g),p=m=!1)}function E(M){M&&(C(),u+=M)}function _(M){if(M.nodeType==1){var P=M.getAttribute("cm-text");if(P){E(P);return}var R=M.getAttribute("cm-marker"),Z;if(R){var J=e.findMarks(Y(r,0),Y(n+1,0),b(+R));J.length&&(Z=J[0].find(0))&&E(Mr(e.doc,Z.from,Z.to).join(g));return}if(M.getAttribute("contenteditable")=="false")return;var te=/^(pre|div|p|li|table|br)$/i.test(M.nodeName);if(!/^br$/i.test(M.nodeName)&&M.textContent.length==0)return;te&&C();for(var V=0;V=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),ue(n,"paste",function(p){$e(r,p)||Gu(p,r)||(r.state.pasteIncoming=+new Date,i.fastPoll())});function u(p){if(!$e(r,p)){if(r.somethingSelected())to({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var g=Ku(r);to({lineWise:!0,text:g.text}),p.type=="cut"?r.setSelections(g.ranges,null,vt):(i.prevInput="",n.value=g.text.join(` -`),A(n))}else return;p.type=="cut"&&(r.state.cutIncoming=+new Date)}}ue(n,"cut",u),ue(n,"copy",u),ue(e.scroller,"paste",function(p){if(!(nr(e,p)||$e(r,p))){if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var g=new Event("paste");g.clipboardData=p.clipboardData,n.dispatchEvent(g)}}),ue(e.lineSpace,"selectstart",function(p){nr(e,p)||bt(p)}),ue(n,"compositionstart",function(){var p=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:p,range:r.markText(p,r.getCursor("to"),{className:"CodeMirror-composing"})}}),ue(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},We.prototype.createField=function(e){this.wrapper=Yu(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;el(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},We.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},We.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=Ps(e);if(e.options.moveInputWithCursor){var n=Rt(e,i.sel.primary().head,"div"),u=t.wrapper.getBoundingClientRect(),p=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+p.top-u.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+p.left-u.left))}return r},We.prototype.showSelection=function(e){var t=this.cm,i=t.display;G(i.cursorDiv,e.cursors),G(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},We.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i,t.state.focused&&A(this.textarea),c&&d>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",c&&d>=9&&(this.hasSelection=null));this.resetting=!1}},We.prototype.getField=function(){return this.textarea},We.prototype.supportsTouch=function(){return!1},We.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!z||he(Ce(this.textarea))!=this.textarea))try{this.textarea.focus()}catch{}},We.prototype.blur=function(){this.textarea.blur()},We.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},We.prototype.receivedFocus=function(){this.slowPoll()},We.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},We.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function i(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,i)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,i)},We.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||Xc(i)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var n=i.value;if(n==r&&!t.somethingSelected())return!1;if(c&&d>=9&&this.hasSelection===n||O&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var u=n.charCodeAt(0);if(u==8203&&!r&&(r="\u200B"),u==8666)return this.reset(),this.cm.execCommand("undo")}for(var p=0,g=Math.min(r.length,n.length);p1e3||n.indexOf(` -`)>-1?i.value=e.prevInput="":e.prevInput=n,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},We.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},We.prototype.onKeyPress=function(){c&&d>=9&&(this.hasSelection=null),this.fastPoll()},We.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var u=Nr(i,e),p=r.scroller.scrollTop;if(!u||S)return;var g=i.options.resetSelectionOnContextMenu;g&&i.doc.sel.contains(u)==-1&&tt(i,st)(i.doc,yr(u),vt);var m=n.style.cssText,b=t.wrapper.style.cssText,C=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",n.style.cssText=`position: absolute; width: 30px; height: 30px; - top: `+(e.clientY-C.top-5)+"px; left: "+(e.clientX-C.left-5)+`px; +b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(` +`,t);i==-1&&(i=e.length);var u=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),p=u.indexOf("\r");p!=-1?(n.push(u.slice(0,p)),t+=p+1):(n.push(u),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Kc=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch{return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch{}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Yc=function(){var e=k("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),ia=null;function Zc(e){if(ia!=null)return ia;var t=G(e,k("span","x")),n=t.getBoundingClientRect(),r=R(t,0,1).getBoundingClientRect();return ia=Math.abs(n.left-r.left)>1}var oa={},$r={};function Qc(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),oa[e]=t}function Jc(e,t){$r[e]=t}function Ei(e){if(typeof e=="string"&&$r.hasOwnProperty(e))e=$r[e];else if(e&&typeof e.name=="string"&&$r.hasOwnProperty(e.name)){var t=$r[e.name];typeof t=="string"&&(t={name:t}),e=Gl(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ei("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ei("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function aa(e,t){t=Ei(t);var n=oa[t.name];if(!n)return aa(e,"text/plain");var r=n(e,t);if(Vr.hasOwnProperty(t.name)){var i=Vr[t.name];for(var u in i)i.hasOwnProperty(u)&&(r.hasOwnProperty(u)&&(r["_"+u]=r[u]),r[u]=i[u])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var p in t.modeProps)r[p]=t.modeProps[p];return r}var Vr={};function $c(e,t){var n=Vr.hasOwnProperty(e)?Vr[e]:Vr[e]={};Lt(t,n)}function Lr(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function la(e,t){for(var n;e.innerMode&&(n=e.innerMode(t),!(!n||n.mode==e));)t=n.state,e=n.mode;return n||{mode:e,state:t}}function $l(e,t,n){return e.startState?e.startState(t,n):!0}var Ge=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};Ge.prototype.eol=function(){return this.pos>=this.string.length},Ge.prototype.sol=function(){return this.pos==this.lineStart},Ge.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ge.prototype.next=function(){if(this.post},Ge.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ge.prototype.skipToEnd=function(){this.pos=this.string.length},Ge.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ge.prototype.backUp=function(e){this.pos-=e},Ge.prototype.column=function(){return this.lastColumnPos0?null:(u&&t!==!1&&(this.pos+=u[0].length),u)}},Ge.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ge.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ge.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ge.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ae(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],u=i.chunkSize();if(t=e.first&&tn?Y(n,ae(e,n).text.length):Vc(t,ae(e,t.line).text.length)}function Vc(e,t){var n=e.ch;return n==null||n>t?Y(e.line,t):n<0?Y(e.line,0):e}function es(e,t){for(var n=[],r=0;rthis.maxLookAhead&&(this.maxLookAhead=e),t},Zt.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},Zt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Zt.fromSaved=function(e,t,n){return t instanceof Ti?new Zt(e,Lr(e.mode,t.state),n,t.lookAhead):new Zt(e,Lr(e.mode,t),n)},Zt.prototype.save=function(e){var t=e!==!1?Lr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Ti(t,this.maxLookAhead):t};function ts(e,t,n,r){var i=[e.state.modeGen],u={};ls(e,t.text,e.doc.mode,n,function(b,D){return i.push(b,D)},u,r);for(var p=n.state,g=function(b){n.baseTokens=i;var D=e.state.overlays[b],E=1,B=0;n.state=!0,ls(e,t.text,D.mode,n,function(M,H){for(var W=E;BM&&i.splice(E,1,M,i[E+1],Z),E+=2,B=Math.min(M,Z)}if(H)if(D.opaque)i.splice(W,E-W,M,"overlay "+H),E=W+2;else for(;We.options.maxHighlightLength&&Lr(e.doc.mode,r.state),u=ts(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=u.styles,u.classes?t.styleClasses=u.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function In(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new Zt(r,!0,t);var u=ed(e,t,n),p=u>r.first&&ae(r,u-1).stateAfter,g=p?Zt.fromSaved(r,p,u):new Zt(r,$l(r.mode),u);return r.iter(u,t,function(v){da(e,v.text,g);var b=g.line;v.stateAfter=b==t-1||b%5==0||b>=i.viewFrom&&bt.start)return u}throw new Error("Mode "+e.name+" failed to advance stream.")}var is=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function os(e,t,n,r){var i=e.doc,u=i.mode,p;t=be(i,t);var g=ae(i,t.line),v=In(e,t.line,n),b=new Ge(g.text,e.options.tabSize,v),D;for(r&&(D=[]);(r||b.pose.options.maxHighlightLength?(g=!1,p&&da(e,t,r,D.pos),D.pos=t.length,E=null):E=as(ha(n,D,r.state,B),u),B){var M=B[0].name;M&&(E="m-"+(E?M+" "+E:M))}if(!g||b!=E){for(;vp;--g){if(g<=u.first)return u.first;var v=ae(u,g-1),b=v.stateAfter;if(b&&(!n||g+(b instanceof Ti?b.lookAhead:0)<=u.modeFrontier))return g;var D=Ye(v.text,null,e.options.tabSize);(i==null||r>D)&&(i=g-1,r=D)}return i}function td(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontiern;r--){var i=ae(e,r).stateAfter;if(i&&(!(i instanceof Ti)||r+i.lookAhead=t:u.to>t);(r||(r=[])).push(new Li(p,u.from,v?null:u.to))}}return r}function ld(e,t,n){var r;if(e)for(var i=0;i=t:u.to>t);if(g||u.from==t&&p.type=="bookmark"&&(!n||u.marker.insertLeft)){var v=u.from==null||(p.inclusiveLeft?u.from<=t:u.from0&&g)for(var ne=0;ne0)){var D=[v,1],E=me(b.from,g.from),B=me(b.to,g.to);(E<0||!p.inclusiveLeft&&!E)&&D.push({from:b.from,to:g.from}),(B>0||!p.inclusiveRight&&!B)&&D.push({from:g.to,to:b.to}),i.splice.apply(i,D),v+=D.length-3}}return i}function fs(e){var t=e.markedSpans;if(t){for(var n=0;nt)&&(!r||ga(r,u.marker)<0)&&(r=u.marker)}return r}function ps(e,t,n,r,i){var u=ae(e,t),p=rr&&u.markedSpans;if(p)for(var g=0;g=0&&E<=0||D<=0&&E>=0)&&(D<=0&&(v.marker.inclusiveRight&&i.inclusiveLeft?me(b.to,n)>=0:me(b.to,n)>0)||D>=0&&(v.marker.inclusiveRight&&i.inclusiveLeft?me(b.from,r)<=0:me(b.from,r)<0)))return!0}}}function Rt(e){for(var t;t=hs(e);)e=t.find(-1,!0).line;return e}function fd(e){for(var t;t=Bi(e);)e=t.find(1,!0).line;return e}function cd(e){for(var t,n;t=Bi(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function va(e,t){var n=ae(e,t),r=Rt(n);return n==r?t:Fe(r)}function gs(e,t){if(t>e.lastLine())return t;var n=ae(e,t),r;if(!vr(e,n))return t;for(;r=Bi(n);)n=r.find(1,!0).line;return Fe(n)+1}function vr(e,t){var n=rr&&t.markedSpans;if(n){for(var r=void 0,i=0;it.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var en=function(e,t,n){this.text=e,cs(this,t),this.height=n?n(this):1};en.prototype.lineNo=function(){return Fe(this)},Jr(en);function dd(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),fs(e),cs(e,n);var i=r?r(e):1;i!=e.height&&Yt(e,i)}function hd(e){e.parent=null,fs(e)}var pd={},gd={};function vs(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?gd:pd;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function ms(e,t){var n=z("span",null,null,m?"padding-right: .1px":null),r={pre:z("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var u=i?t.rest[i-1]:t.line,p=void 0;r.pos=0,r.addToken=md,Xc(e.display.measure)&&(p=tr(u,e.doc.direction))&&(r.addToken=yd(r.addToken,p)),r.map=[];var g=t!=e.display.externalMeasured&&Fe(u);xd(u,r,rs(e,u,g)),u.styleClasses&&(u.styleClasses.bgClass&&(r.bgClass=Ee(u.styleClasses.bgClass,r.bgClass||"")),u.styleClasses.textClass&&(r.textClass=Ee(u.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(Gc(e.display.measure))),i==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(m){var v=r.content.lastChild;(/\bcm-tab\b/.test(v.className)||v.querySelector&&v.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return je(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=Ee(r.pre.className,r.textClass||"")),r}function vd(e){var t=k("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function md(e,t,n,r,i,u,p){if(t){var g=e.splitSpaces?bd(t,e.trailingSpace):t,v=e.cm.state.specialChars,b=!1,D;if(!v.test(t))e.col+=t.length,D=document.createTextNode(g),e.map.push(e.pos,e.pos+t.length,D),c&&d<9&&(b=!0),e.pos+=t.length;else{D=document.createDocumentFragment();for(var E=0;;){v.lastIndex=E;var B=v.exec(t),M=B?B.index-E:t.length-E;if(M){var H=document.createTextNode(g.slice(E,E+M));c&&d<9?D.appendChild(k("span",[H])):D.appendChild(H),e.map.push(e.pos,e.pos+M,H),e.col+=M,e.pos+=M}if(!B)break;E+=M+1;var W=void 0;if(B[0]==" "){var Z=e.cm.options.tabSize,J=Z-e.col%Z;W=D.appendChild(k("span",pr(J),"cm-tab")),W.setAttribute("role","presentation"),W.setAttribute("cm-text"," "),e.col+=J}else B[0]=="\r"||B[0]==` +`?(W=D.appendChild(k("span",B[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),W.setAttribute("cm-text",B[0]),e.col+=1):(W=e.cm.options.specialCharPlaceholder(B[0]),W.setAttribute("cm-text",B[0]),c&&d<9?D.appendChild(k("span",[W])):D.appendChild(W),e.col+=1);e.map.push(e.pos,e.pos+1,W),e.pos++}}if(e.trailingSpace=g.charCodeAt(t.length-1)==32,n||r||i||b||u||p){var te=n||"";r&&(te+=r),i&&(te+=i);var $=k("span",[D],te,u);if(p)for(var ne in p)p.hasOwnProperty(ne)&&ne!="style"&&ne!="class"&&$.setAttribute(ne,p[ne]);return e.content.appendChild($)}e.content.appendChild(D)}}function bd(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;ib&&E.from<=b));B++);if(E.to>=D)return e(n,r,i,u,p,g,v);e(n,r.slice(0,E.to-b),i,u,null,g,v),u=null,r=r.slice(E.to-b),b=E.to}}}function bs(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function xd(e,t,n){var r=e.markedSpans,i=e.text,u=0;if(!r){for(var p=1;pv||we.collapsed&&le.to==v&&le.from==v)){if(le.to!=null&&le.to!=v&&M>le.to&&(M=le.to,W=""),we.className&&(H+=" "+we.className),we.css&&(B=(B?B+";":"")+we.css),we.startStyle&&le.from==v&&(Z+=" "+we.startStyle),we.endStyle&&le.to==M&&(ne||(ne=[])).push(we.endStyle,le.to),we.title&&((te||(te={})).title=we.title),we.attributes)for(var Le in we.attributes)(te||(te={}))[Le]=we.attributes[Le];we.collapsed&&(!J||ga(J.marker,we)<0)&&(J=le)}else le.from>v&&M>le.from&&(M=le.from)}if(ne)for(var nt=0;nt=g)break;for(var Et=Math.min(g,M);;){if(D){var wt=v+D.length;if(!J){var Xe=wt>Et?D.slice(0,Et-v):D;t.addToken(t,Xe,E?E+H:H,Z,v+Xe.length==M?W:"",B,te)}if(wt>=Et){D=D.slice(Et-v),v=Et;break}v=wt,Z=""}D=i.slice(u,u=n[b++]),E=vs(n[b++],t.cm.options)}}}function ys(e,t,n){this.line=t,this.rest=cd(t),this.size=this.rest?Fe(Ce(this.rest))-n+1:1,this.node=this.text=null,this.hidden=vr(e,t)}function Oi(e,t,n){for(var r=[],i,u=t;u2&&u.push((v.bottom+b.top)/2-n.top)}}u.push(n.bottom-n.top)}}function Es(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var r=0;rn)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}}function Md(e,t){t=Rt(t);var n=Fe(t),r=e.display.externalMeasured=new ys(e.doc,t,n);r.lineN=n;var i=r.built=ms(e,r);return r.text=i.pre,G(e.display.lineMeasure,i.pre),r}function As(e,t,n,r){return Jt(e,rn(e,t),n,r)}function Da(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&tt)&&(u=v-g,i=u-1,t>=v&&(p="right")),i!=null){if(r=e[b+2],g==v&&n==(r.insertLeft?"left":"right")&&(p=n),n=="left"&&i==0)for(;b&&e[b-2]==e[b-3]&&e[b-1].insertLeft;)r=e[(b-=3)+2],p="left";if(n=="right"&&i==v-g)for(;b=0&&(n=e[i]).left==n.right;i--);return n}function Bd(e,t,n,r){var i=Ts(t.map,n,r),u=i.node,p=i.start,g=i.end,v=i.collapse,b;if(u.nodeType==3){for(var D=0;D<4;D++){for(;p&&Jo(t.line.text.charAt(i.coverStart+p));)--p;for(;i.coverStart+g0&&(v=r="right");var E;e.options.lineWrapping&&(E=u.getClientRects()).length>1?b=E[r=="right"?E.length-1:0]:b=u.getBoundingClientRect()}if(c&&d<9&&!p&&(!b||!b.left&&!b.right)){var B=u.parentNode.getClientRects()[0];B?b={left:B.left,right:B.left+on(e.display),top:B.top,bottom:B.bottom}:b=Fs}for(var M=b.top-t.rect.top,H=b.bottom-t.rect.top,W=(M+H)/2,Z=t.view.measure.heights,J=0;J=r.text.length?(v=r.text.length,b="before"):v<=0&&(v=0,b="after"),!g)return p(b=="before"?v-1:v,b=="before");function D(H,W,Z){var J=g[W],te=J.level==1;return p(Z?H-1:H,te!=Z)}var E=Bn(g,v,b),B=_n,M=D(v,E,b=="before");return B!=null&&(M.other=D(v,B,b!="before")),M}function Os(e,t){var n=0;t=be(e.doc,t),e.options.lineWrapping||(n=on(e.display)*t.ch);var r=ae(e.doc,t.line),i=nr(r)+Ii(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function ka(e,t,n,r,i){var u=Y(e,t,n);return u.xRel=i,r&&(u.outside=r),u}function Sa(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return ka(r.first,0,null,-1,-1);var i=_r(r,n),u=r.first+r.size-1;if(i>u)return ka(r.first+r.size-1,ae(r,u).text.length,null,1,1);t<0&&(t=0);for(var p=ae(r,i);;){var g=Od(e,p,i,t,n),v=ud(p,g.ch+(g.xRel>0||g.outside>0?1:0));if(!v)return g;var b=v.find(1);if(b.line==i)return b;p=ae(r,i=b.line)}}function Is(e,t,n,r){r-=Ca(t);var i=t.text.length,u=Mn(function(p){return Jt(e,n,p-1).bottom<=r},i,0);return i=Mn(function(p){return Jt(e,n,p).top>r},u,i),{begin:u,end:i}}function Ps(e,t,n,r){n||(n=rn(e,t));var i=Pi(e,t,Jt(e,n,r),"line").top;return Is(e,t,n,i)}function Ea(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Od(e,t,n,r,i){i-=nr(t);var u=rn(e,t),p=Ca(t),g=0,v=t.text.length,b=!0,D=tr(t,e.doc.direction);if(D){var E=(e.options.lineWrapping?Pd:Id)(e,t,n,u,D,r,i);b=E.level!=1,g=b?E.from:E.to-1,v=b?E.to:E.from-1}var B=null,M=null,H=Mn(function(se){var le=Jt(e,u,se);return le.top+=p,le.bottom+=p,Ea(le,r,i,!1)?(le.top<=i&&le.left<=r&&(B=se,M=le),!0):!1},g,v),W,Z,J=!1;if(M){var te=r-M.left=ne.bottom?1:0}return H=Kl(t.text,H,1),ka(n,H,Z,J,r-W)}function Id(e,t,n,r,i,u,p){var g=Mn(function(E){var B=i[E],M=B.level!=1;return Ea(Wt(e,Y(n,M?B.to:B.from,M?"before":"after"),"line",t,r),u,p,!0)},0,i.length-1),v=i[g];if(g>0){var b=v.level!=1,D=Wt(e,Y(n,b?v.from:v.to,b?"after":"before"),"line",t,r);Ea(D,u,p,!0)&&D.top>p&&(v=i[g-1])}return v}function Pd(e,t,n,r,i,u,p){var g=Is(e,t,r,p),v=g.begin,b=g.end;/\s/.test(t.text.charAt(b-1))&&b--;for(var D=null,E=null,B=0;B=b||M.to<=v)){var H=M.level!=1,W=Jt(e,r,H?Math.min(b,M.to)-1:Math.max(v,M.from)).right,Z=WZ)&&(D=M,E=Z)}}return D||(D=i[i.length-1]),D.fromb&&(D={from:D.from,to:b,level:D.level}),D}var Nr;function nn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Nr==null){Nr=k("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Nr.appendChild(document.createTextNode("x")),Nr.appendChild(k("br"));Nr.appendChild(document.createTextNode("x"))}G(e.measure,Nr);var n=Nr.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),X(e.measure),n||1}function on(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=k("span","xxxxxxxxxx"),n=k("pre",[t],"CodeMirror-line-like");G(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Aa(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,u=t.gutters.firstChild,p=0;u;u=u.nextSibling,++p){var g=e.display.gutterSpecs[p].className;n[g]=u.offsetLeft+u.clientLeft+i,r[g]=u.clientWidth}return{fixedPos:Fa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Fa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function zs(e){var t=nn(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/on(e.display)-3);return function(i){if(vr(e.doc,i))return 0;var u=0;if(i.widgets)for(var p=0;p0&&(b=ae(e.doc,v.line).text).length==v.ch){var D=Ye(b,b.length,e.options.tabSize)-b.length;v=Y(v.line,Math.max(0,Math.round((u-Ss(e.display).left)/on(e.display))-D))}return v}function Ir(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var n=e.display.view,r=0;rt)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)rr&&va(e.doc,t)i.viewFrom?br(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)br(e);else if(t<=i.viewFrom){var u=Hi(e,n,n+r,1);u?(i.view=i.view.slice(u.index),i.viewFrom=u.lineN,i.viewTo+=r):br(e)}else if(n>=i.viewTo){var p=Hi(e,t,t,-1);p?(i.view=i.view.slice(0,p.index),i.viewTo=p.lineN):br(e)}else{var g=Hi(e,t,t,-1),v=Hi(e,n,n+r,1);g&&v?(i.view=i.view.slice(0,g.index).concat(Oi(e,g.lineN,v.lineN)).concat(i.view.slice(v.index)),i.viewTo+=r):br(e)}var b=i.externalMeasured;b&&(n=i.lineN&&t=r.viewTo)){var u=r.view[Ir(e,t)];if(u.node!=null){var p=u.changes||(u.changes=[]);Ne(p,n)==-1&&p.push(n)}}}function br(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Hi(e,t,n,r){var i=Ir(e,t),u,p=e.display.view;if(!rr||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var g=e.display.viewFrom,v=0;v0){if(i==p.length-1)return null;u=g+p[i].size-t,i++}else u=g-t;t+=u,n+=u}for(;va(e.doc,n)!=n;){if(i==(r<0?0:p.length-1))return null;n+=r*p[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function zd(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=Oi(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Oi(e,t,r.viewFrom).concat(r.view):r.viewFromn&&(r.view=r.view.slice(0,Ir(e,n)))),r.viewTo=n}function Hs(e){for(var t=e.display.view,n=0,r=0;r=e.display.viewTo||v.to().line0?p:e.defaultCharWidth())+"px"}if(r.other){var g=n.appendChild(k("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));g.style.display="",g.style.left=r.other.left+"px",g.style.top=r.other.top+"px",g.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Ri(e,t){return e.top-t.top||e.left-t.left}function Hd(e,t,n){var r=e.display,i=e.doc,u=document.createDocumentFragment(),p=Ss(e.display),g=p.left,v=Math.max(r.sizerWidth,Br(e)-r.sizer.offsetLeft)-p.right,b=i.direction=="ltr";function D($,ne,se,le){ne<0&&(ne=0),ne=Math.round(ne),le=Math.round(le),u.appendChild(k("div",null,"CodeMirror-selected","position: absolute; left: "+$+`px; + top: `+ne+"px; width: "+(se??v-$)+`px; + height: `+(le-ne)+"px"))}function E($,ne,se){var le=ae(i,$),we=le.text.length,Le,nt;function Pe(Xe,Dt){return zi(e,Y($,Xe),"div",le,Dt)}function Et(Xe,Dt,ot){var Qe=Ps(e,le,null,Xe),Ke=Dt=="ltr"==(ot=="after")?"left":"right",Re=ot=="after"?Qe.begin:Qe.end-(/\s/.test(le.text.charAt(Qe.end-1))?2:1);return Pe(Re,Ke)[Ke]}var wt=tr(le,i.direction);return qc(wt,ne||0,se??we,function(Xe,Dt,ot,Qe){var Ke=ot=="ltr",Re=Pe(Xe,Ke?"left":"right"),Ct=Pe(Dt-1,Ke?"right":"left"),bn=ne==null&&Xe==0,kr=se==null&&Dt==we,ut=Qe==0,$t=!wt||Qe==wt.length-1;if(Ct.top-Re.top<=3){var it=(b?bn:kr)&&ut,nl=(b?kr:bn)&&$t,lr=it?g:(Ke?Re:Ct).left,Wr=nl?v:(Ke?Ct:Re).right;D(lr,Re.top,Wr-lr,Re.bottom)}else{var qr,pt,yn,il;Ke?(qr=b&&bn&&ut?g:Re.left,pt=b?v:Et(Xe,ot,"before"),yn=b?g:Et(Dt,ot,"after"),il=b&&kr&&$t?v:Ct.right):(qr=b?Et(Xe,ot,"before"):g,pt=!b&&bn&&ut?v:Re.right,yn=!b&&kr&&$t?g:Ct.left,il=b?Et(Dt,ot,"after"):v),D(qr,Re.top,pt-qr,Re.bottom),Re.bottom0?t.blinker=setInterval(function(){e.hasFocus()||an(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Ws(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Ba(e))}function _a(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&an(e))},100)}function Ba(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(je(e,"focus",e,t),e.state.focused=!0,pe(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),m&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ma(e))}function an(e,t){e.state.delayingBlurEvent||(e.state.focused&&(je(e,"blur",e,t),e.state.focused=!1,oe(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function Wi(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),i=t.lineDiv.getBoundingClientRect().top,u=0,p=0;p.005||M<-.005)&&(ie.display.sizerWidth){var W=Math.ceil(D/on(e.display));W>e.display.maxLineLength&&(e.display.maxLineLength=W,e.display.maxLine=g.line,e.display.maxLineChanged=!0)}}}Math.abs(u)>2&&(t.scroller.scrollTop+=u)}function qs(e){if(e.widgets)for(var t=0;t=p&&(u=_r(t,nr(ae(t,v))-e.wrapper.clientHeight),p=v)}return{from:u,to:Math.max(p,u+1)}}function Rd(e,t){if(!Ve(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),i=null,u=n.wrapper.ownerDocument;if(t.top+r.top<0?i=!0:t.bottom+r.top>(u.defaultView.innerHeight||u.documentElement.clientHeight)&&(i=!1),i!=null&&!L){var p=k("div","\u200B",null,`position: absolute; + top: `+(t.top-n.viewOffset-Ii(e.display))+`px; + height: `+(t.bottom-t.top+Qt(e)+n.barHeight)+`px; + left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(p),p.scrollIntoView(i),e.display.lineSpace.removeChild(p)}}}function Wd(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(n=t.sticky=="before"?Y(t.line,t.ch+1,"before"):t,t=t.ch?Y(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var u=0;u<5;u++){var p=!1,g=Wt(e,t),v=!n||n==t?g:Wt(e,n);i={left:Math.min(g.left,v.left),top:Math.min(g.top,v.top)-r,right:Math.max(g.left,v.left),bottom:Math.max(g.bottom,v.bottom)+r};var b=Na(e,i),D=e.doc.scrollTop,E=e.doc.scrollLeft;if(b.scrollTop!=null&&(jn(e,b.scrollTop),Math.abs(e.doc.scrollTop-D)>1&&(p=!0)),b.scrollLeft!=null&&(Pr(e,b.scrollLeft),Math.abs(e.doc.scrollLeft-E)>1&&(p=!0)),!p)break}return i}function qd(e,t){var n=Na(e,t);n.scrollTop!=null&&jn(e,n.scrollTop),n.scrollLeft!=null&&Pr(e,n.scrollLeft)}function Na(e,t){var n=e.display,r=nn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,u=wa(e),p={};t.bottom-t.top>u&&(t.bottom=t.top+u);var g=e.doc.height+xa(n),v=t.topg-r;if(t.topi+u){var D=Math.min(t.top,(b?g:t.bottom)-u);D!=i&&(p.scrollTop=D)}var E=e.options.fixedGutter?0:n.gutters.offsetWidth,B=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-E,M=Br(e)-n.gutters.offsetWidth,H=t.right-t.left>M;return H&&(t.right=t.left+M),t.left<10?p.scrollLeft=0:t.leftM+B-3&&(p.scrollLeft=t.right+(H?0:10)-M),p}function Oa(e,t){t!=null&&(Ui(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function ln(e){Ui(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Un(e,t,n){(t!=null||n!=null)&&Ui(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Ud(e,t){Ui(e),e.curOp.scrollToPos=t}function Ui(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=Os(e,t.from),r=Os(e,t.to);Us(e,n,r,t.margin)}}function Us(e,t,n,r){var i=Na(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});Un(e,i.scrollLeft,i.scrollTop)}function jn(e,t){Math.abs(e.doc.scrollTop-t)<2||(s||Pa(e,{top:t}),js(e,t,!0),s&&Pa(e),Kn(e,100))}function js(e,t,n){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),!(e.display.scroller.scrollTop==t&&!n)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Pr(e,t,n,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),!((n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)&&(e.doc.scrollLeft=t,Zs(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Gn(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+xa(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Qt(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var zr=function(e,t,n){this.cm=n;var r=this.vert=k("div",[k("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=k("div",[k("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),ue(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),ue(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,c&&d<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};zr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var u=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+u)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},zr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},zr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},zr.prototype.zeroWidthHack=function(){var e=I&&!_?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new dt,this.disableVert=new dt},zr.prototype.enableZeroWidthBar=function(e,t,n){e.style.visibility="";function r(){var i=e.getBoundingClientRect(),u=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);u!=e?e.style.visibility="hidden":t.set(1e3,r)}t.set(1e3,r)},zr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Xn=function(){};Xn.prototype.update=function(){return{bottom:0,right:0}},Xn.prototype.setScrollLeft=function(){},Xn.prototype.setScrollTop=function(){},Xn.prototype.clear=function(){};function sn(e,t){t||(t=Gn(e));var n=e.display.barWidth,r=e.display.barHeight;Gs(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Wi(e),Gs(e,Gn(e)),n=e.display.barWidth,r=e.display.barHeight}function Gs(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var Xs={native:zr,null:Xn};function Ks(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&oe(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Xs[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ue(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?Pr(e,t):jn(e,t)},e),e.display.scrollbars.addClass&&pe(e.display.wrapper,e.display.scrollbars.addClass)}var jd=0;function Hr(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++jd,markArrays:null},wd(e.curOp)}function Rr(e){var t=e.curOp;t&&Cd(t,function(n){for(var r=0;r=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new ji(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Kd(e){e.updatedDisplay=e.mustUpdate&&Ia(e.cm,e.update)}function Yd(e){var t=e.cm,n=t.display;e.updatedDisplay&&Wi(t),e.barMeasure=Gn(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=As(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Qt(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Br(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Zd(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)){var n=+new Date+e.options.workTime,r=In(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(u){if(r.line>=e.display.viewFrom){var p=u.styles,g=u.text.length>e.options.maxHighlightLength?Lr(t.mode,r.state):null,v=ts(e,u,r,!0);g&&(r.state=g),u.styles=v.styles;var b=u.styleClasses,D=v.classes;D?u.styleClasses=D:b&&(u.styleClasses=null);for(var E=!p||p.length!=u.styles.length||b!=D&&(!b||!D||b.bgClass!=D.bgClass||b.textClass!=D.textClass),B=0;!E&&Bn)return Kn(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&St(e,function(){for(var u=0;u=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&Hs(e)==0)return!1;Qs(e)&&(br(e),t.dims=Aa(e));var i=r.first+r.size,u=Math.max(t.visible.from-e.options.viewportMargin,r.first),p=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFromp&&n.viewTo-p<20&&(p=Math.min(i,n.viewTo)),rr&&(u=va(e.doc,u),p=gs(e.doc,p));var g=u!=n.viewFrom||p!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;zd(e,u,p),n.viewOffset=nr(ae(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var v=Hs(e);if(!g&&v==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var b=Vd(e);return v>4&&(n.lineDiv.style.display="none"),th(e,n.updateLineNumbers,t.dims),v>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,eh(b),X(n.cursorDiv),X(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,g&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,Kn(e,400)),n.updateLineNumbers=null,!0}function Ys(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==Br(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+xa(e.display)-wa(e),n.top)}),t.visible=qi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=qi(e.display,e.doc,n));if(!Ia(e,t))break;Wi(e);var i=Gn(e);qn(e),sn(e,i),Ha(e,i),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Pa(e,t){var n=new ji(e,t);if(Ia(e,n)){Wi(e),Ys(e,n);var r=Gn(e);qn(e),sn(e,r),Ha(e,r),n.finish()}}function th(e,t,n){var r=e.display,i=e.options.lineNumbers,u=r.lineDiv,p=u.firstChild;function g(H){var W=H.nextSibling;return m&&I&&e.display.currentWheelTarget==H?H.style.display="none":H.parentNode.removeChild(H),W}for(var v=r.view,b=r.viewFrom,D=0;D-1&&(M=!1),xs(e,E,b,n)),M&&(X(E.lineNumber),E.lineNumber.appendChild(document.createTextNode(ua(e.options,b)))),p=E.node.nextSibling}b+=E.size}for(;p;)p=g(p)}function za(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",et(e,"gutterChanged",e)}function Ha(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Qt(e)+"px"}function Zs(e){var t=e.display,n=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var r=Fa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,u=r+"px",p=0;pg.clientWidth,b=g.scrollHeight>g.clientHeight;if(r&&v||i&&b){if(i&&I&&m){e:for(var D=t.target,E=p.view;D!=g;D=D.parentNode)for(var B=0;B=0&&me(e,r.to())<=0)return n}return-1};var Ae=function(e,t){this.anchor=e,this.head=t};Ae.prototype.from=function(){return Fi(this.anchor,this.head)},Ae.prototype.to=function(){return Ai(this.anchor,this.head)},Ae.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function qt(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(B,M){return me(B.from(),M.from())}),n=Ne(t,i);for(var u=1;u0:v>=0){var b=Fi(g.from(),p.from()),D=Ai(g.to(),p.to()),E=g.empty()?p.from()==p.head:g.from()==g.head;u<=n&&--n,t.splice(--u,2,new Ae(E?D:b,E?b:D))}}return new _t(t,n)}function yr(e,t){return new _t([new Ae(e,t||e)],0)}function xr(e){return e.text?Y(e.from.line+e.text.length-1,Ce(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function eu(e,t){if(me(e,t.from)<0)return e;if(me(e,t.to)<=0)return xr(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=xr(t).ch-t.to.ch),Y(n,r)}function Wa(e,t){for(var n=[],r=0;r1&&e.remove(g.line+1,H-1),e.insert(g.line+1,J)}et(e,"change",e,t)}function wr(e,t,n){function r(i,u,p){if(i.linked)for(var g=0;g1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Ce(e.done)}function au(e,t,n,r){var i=e.history;i.undone.length=0;var u=+new Date,p,g;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>u-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(p=ah(i,i.lastOp==r)))g=Ce(p.changes),me(t.from,t.to)==0&&me(t.from,g.to)==0?g.to=xr(t):p.changes.push(ja(e,t));else{var v=Ce(i.done);for((!v||!v.ranges)&&Ki(e.sel,i.done),p={changes:[ja(e,t)],generation:i.generation},i.done.push(p);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=u,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,g||je(e,"historyAdded")}function lh(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function sh(e,t,n,r){var i=e.history,u=r&&r.origin;n==i.lastSelOp||u&&i.lastSelOrigin==u&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==u||lh(e,u,Ce(i.done),t))?i.done[i.done.length-1]=t:Ki(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=u,i.lastSelOp=n,r&&r.clearRedo!==!1&&ou(i.undone)}function Ki(e,t){var n=Ce(t);n&&n.ranges&&n.equals(e)||t.push(e)}function lu(e,t,n,r){var i=t["spans_"+e.id],u=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(p){p.markedSpans&&((i||(i=t["spans_"+e.id]={}))[u]=p.markedSpans),++u})}function uh(e){if(!e)return null;for(var t,n=0;n-1&&(Ce(g)[E]=b[E],delete b[E])}}return r}function Ga(e,t,n,r){if(r){var i=e.anchor;if(n){var u=me(t,i)<0;u!=me(n,i)<0?(i=t,t=n):u!=me(t,n)<0&&(t=n)}return new Ae(i,t)}else return new Ae(n||t,t)}function Yi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),st(e,new _t([Ga(e.sel.primary(),t,n,i)],0),r)}function uu(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),u=0;u=t.ch:g.to>t.ch))){if(i&&(je(v,"beforeCursorEnter"),v.explicitlyCleared))if(u.markedSpans){--p;continue}else break;if(!v.atomic)continue;if(n){var E=v.find(r<0?1:-1),B=void 0;if((r<0?D:b)&&(E=gu(e,E,-r,E&&E.line==t.line?u:null)),E&&E.line==t.line&&(B=me(E,n))&&(r<0?B<0:B>0))return fn(e,E,t,r,i)}var M=v.find(r<0?-1:1);return(r<0?b:D)&&(M=gu(e,M,r,M.line==t.line?u:null)),M?fn(e,M,t,r,i):null}}return t}function Qi(e,t,n,r,i){var u=r||1,p=fn(e,t,n,u,i)||!i&&fn(e,t,n,u,!0)||fn(e,t,n,-u,i)||!i&&fn(e,t,n,-u,!0);return p||(e.cantEdit=!0,Y(e.first,0))}function gu(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?be(e,Y(t.line-1)):null:n>0&&t.ch==(r||ae(e,t.line)).text.length?t.line=0;--i)bu(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else bu(e,t)}}function bu(e,t){if(!(t.text.length==1&&t.text[0]==""&&me(t.from,t.to)==0)){var n=Wa(e,t);au(e,t,n,e.cm?e.cm.curOp.id:NaN),Qn(e,t,n,pa(e,t));var r=[];wr(e,function(i,u){!u&&Ne(r,i.history)==-1&&(Du(i.history,t),r.push(i.history)),Qn(i,t,null,pa(i,t))})}}function Ji(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(!(r&&!n)){for(var i=e.history,u,p=e.sel,g=t=="undo"?i.done:i.undone,v=t=="undo"?i.undone:i.done,b=0;b=0;--M){var H=B(M);if(H)return H.v}}}}function yu(e,t){if(t!=0&&(e.first+=t,e.sel=new _t(Ht(e.sel.ranges,function(i){return new Ae(Y(i.anchor.line+t,i.anchor.ch),Y(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm)){yt(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;re.lastLine())){if(t.from.lineu&&(t={from:t.from,to:Y(u,ae(e,u).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Mr(e,t.from,t.to),n||(n=Wa(e,t)),e.cm?dh(e.cm,t,r):Ua(e,t,r),Zi(e,n,mt),e.cantEdit&&Qi(e,Y(e.firstLine(),0))&&(e.cantEdit=!1)}}function dh(e,t,n){var r=e.doc,i=e.display,u=t.from,p=t.to,g=!1,v=u.line;e.options.lineWrapping||(v=Fe(Rt(ae(r,u.line))),r.iter(v,p.line+1,function(M){if(M==i.maxLine)return g=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Zl(e),Ua(r,t,n,zs(e)),e.options.lineWrapping||(r.iter(v,u.line+t.text.length,function(M){var H=Ni(M);H>i.maxLineLength&&(i.maxLine=M,i.maxLineLength=H,i.maxLineChanged=!0,g=!1)}),g&&(e.curOp.updateMaxLine=!0)),td(r,u.line),Kn(e,400);var b=t.text.length-(p.line-u.line)-1;t.full?yt(e):u.line==p.line&&t.text.length==1&&!ru(e.doc,t)?mr(e,u.line,"text"):yt(e,u.line,p.line+1,b);var D=It(e,"changes"),E=It(e,"change");if(E||D){var B={from:u,to:p,text:t.text,removed:t.removed,origin:t.origin};E&&et(e,"change",e,B),D&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(B)}e.display.selForContextMenu=null}function dn(e,t,n,r,i){var u;r||(r=n),me(r,n)<0&&(u=[r,n],n=u[0],r=u[1]),typeof t=="string"&&(t=e.splitLines(t)),cn(e,{from:n,to:r,text:t,origin:i})}function xu(e,t,n,r){n1||!(this.children[0]instanceof $n))){var g=[];this.collapse(g),this.children=[new $n(g)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var p=i.lines.length%25+25,g=p;g10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;re.display.maxLineLength&&(e.display.maxLine=b,e.display.maxLineLength=D,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&yt(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&hu(e.doc)),e&&et(e,"markerCleared",e,this,r,i),t&&Rr(e),this.parent&&this.parent.clear()}},Dr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i0||p==0&&u.clearWhenEmpty!==!1)return u;if(u.replacedWith&&(u.collapsed=!0,u.widgetNode=z("span",[u.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||u.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(u.widgetNode.insertLeft=!0)),u.collapsed){if(ps(e,t.line,t,n,u)||t.line!=n.line&&ps(e,n.line,t,n,u))throw new Error("Inserting collapsed marker partially overlapping an existing one");nd()}u.addToHistory&&au(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var g=t.line,v=e.cm,b;if(e.iter(g,n.line+1,function(E){v&&u.collapsed&&!v.options.lineWrapping&&Rt(E)==v.display.maxLine&&(b=!0),u.collapsed&&g!=t.line&&Yt(E,0),od(E,new Li(u,g==t.line?t.ch:null,g==n.line?n.ch:null),e.cm&&e.cm.curOp),++g}),u.collapsed&&e.iter(t.line,n.line+1,function(E){vr(e,E)&&Yt(E,0)}),u.clearOnEnter&&ue(u,"beforeCursorEnter",function(){return u.clear()}),u.readOnly&&(rd(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),u.collapsed&&(u.id=++ku,u.atomic=!0),v){if(b&&(v.curOp.updateMaxLine=!0),u.collapsed)yt(v,t.line,n.line+1);else if(u.className||u.startStyle||u.endStyle||u.css||u.attributes||u.title)for(var D=t.line;D<=n.line;D++)mr(v,D,"text");u.atomic&&hu(v.doc),et(v,"markerAdded",v,u)}return u}var ti=function(e,t){this.markers=e,this.primary=t;for(var n=0;n=0;v--)cn(this,r[v]);g?cu(this,g):this.cm&&ln(this.cm)}),undo:rt(function(){Ji(this,"undo")}),redo:rt(function(){Ji(this,"redo")}),undoSelection:rt(function(){Ji(this,"undo",!0)}),redoSelection:rt(function(){Ji(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=be(this,e),t=be(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(u){var p=u.markedSpans;if(p)for(var g=0;g=v.to||v.from==null&&i!=e.line||v.from!=null&&i==t.line&&v.from>=t.ch)&&(!n||n(v.marker))&&r.push(v.marker.parent||v.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;re)return t=e,!0;e-=u,++n}),be(this,Y(n,t))},indexFromPos:function(e){e=be(this,e);var t=e.ch;if(e.linet&&(t=e.from),e.to!=null&&e.to-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var D=e.dataTransfer.getData("Text");if(D){var E;if(t.state.draggingText&&!t.state.draggingText.copy&&(E=t.listSelections()),Zi(t.doc,yr(n,n)),E)for(var B=0;B=0;g--)dn(e.doc,"",r[g].from,r[g].to,"+delete");ln(e)})}function Ka(e,t,n){var r=Kl(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Ya(e,t,n){var r=Ka(e,t.ch,n);return r==null?null:new Y(t.line,r,n<0?"after":"before")}function Za(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var u=tr(n,t.doc.direction);if(u){var p=i<0?Ce(u):u[0],g=i<0==(p.level==1),v=g?"after":"before",b;if(p.level>0||t.doc.direction=="rtl"){var D=rn(t,n);b=i<0?n.text.length-1:0;var E=Jt(t,D,b).top;b=Mn(function(B){return Jt(t,D,B).top==E},i<0==(p.level==1)?p.from:p.to-1,b),v=="before"&&(b=Ka(n,b,1))}else b=i<0?p.to:p.from;return new Y(r,b,v)}}return new Y(r,i<0?n.text.length:0,i<0?"before":"after")}function Eh(e,t,n,r){var i=tr(t,e.doc.direction);if(!i)return Ya(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var u=Bn(i,n.ch,n.sticky),p=i[u];if(e.doc.direction=="ltr"&&p.level%2==0&&(r>0?p.to>n.ch:p.from=p.from&&B>=D.begin)){var M=E?"before":"after";return new Y(n.line,B,M)}}var H=function(J,te,$){for(var ne=function(Le,nt){return nt?new Y(n.line,g(Le,1),"before"):new Y(n.line,Le,"after")};J>=0&&J0==(se.level!=1),we=le?$.begin:g($.end,-1);if(se.from<=we&&we0?D.end:g(D.begin,-1);return Z!=null&&!(r>0&&Z==t.text.length)&&(W=H(r>0?0:i.length-1,r,b(Z)),W)?W:null}var ii={selectAll:vu,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),mt)},killLine:function(e){return gn(e,function(t){if(t.empty()){var n=ae(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line0)i=new Y(i.line,i.ch+1),e.replaceRange(u.charAt(i.ch-1)+u.charAt(i.ch-2),Y(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var p=ae(e.doc,i.line-1).text;p&&(i=new Y(i.line,1),e.replaceRange(u.charAt(0)+e.doc.lineSeparator()+p.charAt(p.length-1),Y(i.line-1,p.length-1),i,"+transpose"))}}n.push(new Ae(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return St(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;re&&me(t,this.pos)==0&&n==this.button};var ai,li;function Bh(e,t){var n=+new Date;return li&&li.compare(n,e,t)?(ai=li=null,"triple"):ai&&ai.compare(n,e,t)?(li=new Ja(n,e,t),ai=null,"double"):(ai=new Ja(n,e,t),li=null,"single")}function Ru(e){var t=this,n=t.display;if(!(Ve(t,e)||n.activeTouch&&n.input.supportsTouch())){if(n.input.ensurePolled(),n.shift=e.shiftKey,ir(n,e)){m||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(!$a(t,e)){var r=Or(t,e),i=Jl(e),u=r?Bh(r,i):"single";ye(t).focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&Nh(t,i,r,u,e))&&(i==1?r?Ih(t,r,u,e):ea(e)==n.scroller&&bt(e):i==2?(r&&Yi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(de?t.display.input.onContextMenu(e):_a(t)))}}}function Nh(e,t,n,r,i){var u="Click";return r=="double"?u="Double"+u:r=="triple"&&(u="Triple"+u),u=(t==1?"Left":t==2?"Middle":"Right")+u,oi(e,Mu(u,i),i,function(p){if(typeof p=="string"&&(p=ii[p]),!p)return!1;var g=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),g=p(e,n)!=Ze}finally{e.state.suppressEdits=!1}return g})}function Oh(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var u=P?n.shiftKey&&n.metaKey:n.altKey;i.unit=u?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=I?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(I?n.altKey:n.ctrlKey)),i}function Ih(e,t,n,r){c?setTimeout(lt(Ws,e),0):e.curOp.focus=he(ee(e));var i=Oh(e,n,r),u=e.doc.sel,p;e.options.dragDrop&&jc&&!e.isReadOnly()&&n=="single"&&(p=u.contains(t))>-1&&(me((p=u.ranges[p]).from(),t)<0||t.xRel>0)&&(me(p.to(),t)>0||t.xRel<0)?Ph(e,r,t,i):zh(e,r,t,i)}function Ph(e,t,n,r){var i=e.display,u=!1,p=tt(e,function(b){m&&(i.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:_a(e)),Mt(i.wrapper.ownerDocument,"mouseup",p),Mt(i.wrapper.ownerDocument,"mousemove",g),Mt(i.scroller,"dragstart",v),Mt(i.scroller,"drop",p),u||(bt(b),r.addNew||Yi(e.doc,n,null,null,r.extend),m&&!F||c&&d==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),g=function(b){u=u||Math.abs(t.clientX-b.clientX)+Math.abs(t.clientY-b.clientY)>=10},v=function(){return u=!0};m&&(i.scroller.draggable=!0),e.state.draggingText=p,p.copy=!r.moveOnDrag,ue(i.wrapper.ownerDocument,"mouseup",p),ue(i.wrapper.ownerDocument,"mousemove",g),ue(i.scroller,"dragstart",v),ue(i.scroller,"drop",p),e.state.delayingBlurEvent=!0,setTimeout(function(){return i.input.focus()},20),i.scroller.dragDrop&&i.scroller.dragDrop()}function Wu(e,t,n){if(n=="char")return new Ae(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new Ae(Y(t.line,0),be(e.doc,Y(t.line+1,0)));var r=n(e,t);return new Ae(r.from,r.to)}function zh(e,t,n,r){c&&_a(e);var i=e.display,u=e.doc;bt(t);var p,g,v=u.sel,b=v.ranges;if(r.addNew&&!r.extend?(g=u.sel.contains(n),g>-1?p=b[g]:p=new Ae(n,n)):(p=u.sel.primary(),g=u.sel.primIndex),r.unit=="rectangle")r.addNew||(p=new Ae(n,n)),n=Or(e,t,!0,!0),g=-1;else{var D=Wu(e,n,r.unit);r.extend?p=Ga(p,D.anchor,D.head,r.extend):p=D}r.addNew?g==-1?(g=b.length,st(u,qt(e,b.concat([p]),g),{scroll:!1,origin:"*mouse"})):b.length>1&&b[g].empty()&&r.unit=="char"&&!r.extend?(st(u,qt(e,b.slice(0,g).concat(b.slice(g+1)),0),{scroll:!1,origin:"*mouse"}),v=u.sel):Xa(u,g,p,Ln):(g=0,st(u,new _t([p],0),Ln),v=u.sel);var E=n;function B($){if(me(E,$)!=0)if(E=$,r.unit=="rectangle"){for(var ne=[],se=e.options.tabSize,le=Ye(ae(u,n.line).text,n.ch,se),we=Ye(ae(u,$.line).text,$.ch,se),Le=Math.min(le,we),nt=Math.max(le,we),Pe=Math.min(n.line,$.line),Et=Math.min(e.lastLine(),Math.max(n.line,$.line));Pe<=Et;Pe++){var wt=ae(u,Pe).text,Xe=Kt(wt,Le,se);Le==nt?ne.push(new Ae(Y(Pe,Xe),Y(Pe,Xe))):wt.length>Xe&&ne.push(new Ae(Y(Pe,Xe),Y(Pe,Kt(wt,nt,se))))}ne.length||ne.push(new Ae(n,n)),st(u,qt(e,v.ranges.slice(0,g).concat(ne),g),{origin:"*mouse",scroll:!1}),e.scrollIntoView($)}else{var Dt=p,ot=Wu(e,$,r.unit),Qe=Dt.anchor,Ke;me(ot.anchor,Qe)>0?(Ke=ot.head,Qe=Fi(Dt.from(),ot.anchor)):(Ke=ot.anchor,Qe=Ai(Dt.to(),ot.head));var Re=v.ranges.slice(0);Re[g]=Hh(e,new Ae(be(u,Qe),Ke)),st(u,qt(e,Re,g),Ln)}}var M=i.wrapper.getBoundingClientRect(),H=0;function W($){var ne=++H,se=Or(e,$,!0,r.unit=="rectangle");if(se)if(me(se,E)!=0){e.curOp.focus=he(ee(e)),B(se);var le=qi(i,u);(se.line>=le.to||se.lineM.bottom?20:0;we&&setTimeout(tt(e,function(){H==ne&&(i.scroller.scrollTop+=we,W($))}),50)}}function Z($){e.state.selectingText=!1,H=1/0,$&&(bt($),i.input.focus()),Mt(i.wrapper.ownerDocument,"mousemove",J),Mt(i.wrapper.ownerDocument,"mouseup",te),u.history.lastSelOrigin=null}var J=tt(e,function($){$.buttons===0||!Jl($)?Z($):W($)}),te=tt(e,Z);e.state.selectingText=te,ue(i.wrapper.ownerDocument,"mousemove",J),ue(i.wrapper.ownerDocument,"mouseup",te)}function Hh(e,t){var n=t.anchor,r=t.head,i=ae(e.doc,n.line);if(me(n,r)==0&&n.sticky==r.sticky)return t;var u=tr(i);if(!u)return t;var p=Bn(u,n.ch,n.sticky),g=u[p];if(g.from!=n.ch&&g.to!=n.ch)return t;var v=p+(g.from==n.ch==(g.level!=1)?0:1);if(v==0||v==u.length)return t;var b;if(r.line!=n.line)b=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var D=Bn(u,r.ch,r.sticky),E=D-p||(r.ch-n.ch)*(g.level==1?-1:1);D==v-1||D==v?b=E<0:b=E>0}var B=u[v+(b?-1:0)],M=b==(B.level==1),H=M?B.from:B.to,W=M?"after":"before";return n.ch==H&&n.sticky==W?t:new Ae(new Y(n.line,H,W),r)}function qu(e,t,n,r){var i,u;if(t.touches)i=t.touches[0].clientX,u=t.touches[0].clientY;else try{i=t.clientX,u=t.clientY}catch{return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&bt(t);var p=e.display,g=p.lineDiv.getBoundingClientRect();if(u>g.bottom||!It(e,n))return Vo(t);u-=g.top-p.viewOffset;for(var v=0;v=i){var D=_r(e.doc,u),E=e.display.gutterSpecs[v];return je(e,n,e,D,E.className,t),Vo(t)}}}function $a(e,t){return qu(e,t,"gutterClick",!0)}function Uu(e,t){ir(e.display,t)||Rh(e,t)||Ve(e,t,"contextmenu")||de||e.display.input.onContextMenu(t)}function Rh(e,t){return It(e,"gutterContextMenu")?qu(e,t,"gutterContextMenu",!1):!1}function ju(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Wn(e)}var vn={toString:function(){return"CodeMirror.Init"}},Gu={},to={};function Wh(e){var t=e.optionHandlers;function n(r,i,u,p){e.defaults[r]=i,u&&(t[r]=p?function(g,v,b){b!=vn&&u(g,v,b)}:u)}e.defineOption=n,e.Init=vn,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,qa(r)},!0),n("indentUnit",2,qa,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){Zn(r),Wn(r),yt(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!!i){var u=[],p=r.doc.first;r.doc.iter(function(v){for(var b=0;;){var D=v.text.indexOf(i,b);if(D==-1)break;b=D+i.length,u.push(Y(p,D))}p++});for(var g=u.length-1;g>=0;g--)dn(r.doc,i,u[g],Y(u[g].line,u[g].ch+i.length))}}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(r,i,u){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),u!=vn&&r.refresh()}),n("specialCharPlaceholder",vd,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",N?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!U),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){ju(r),Yn(r)},!0),n("keyMap","default",function(r,i,u){var p=Vi(i),g=u!=vn&&Vi(u);g&&g.detach&&g.detach(r,p),p.attach&&p.attach(r,g||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Uh,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=Ra(i,r.options.lineNumbers),Yn(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?Fa(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return sn(r)},!0),n("scrollbarStyle","native",function(r){Ks(r),sn(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=Ra(r.options.gutters,i),Yn(r)},!0),n("firstLineNumber",1,Yn,!0),n("lineNumberFormatter",function(r){return r},Yn,!0),n("showCursorWhenSelecting",!1,qn,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(an(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,qh),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,qn,!0),n("singleCursorHeightPerLine",!0,qn,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Zn,!0),n("addModeClass",!1,Zn,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,Zn,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function qh(e,t,n){var r=n&&n!=vn;if(!t!=!r){var i=e.display.dragFunctions,u=t?ue:Mt;u(e.display.scroller,"dragstart",i.start),u(e.display.scroller,"dragenter",i.enter),u(e.display.scroller,"dragover",i.over),u(e.display.scroller,"dragleave",i.leave),u(e.display.scroller,"drop",i.drop)}}function Uh(e){e.options.lineWrapping?(pe(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(oe(e.display.wrapper,"CodeMirror-wrap"),ba(e)),Ta(e),yt(e),Wn(e),setTimeout(function(){return sn(e)},100)}function Oe(e,t){var n=this;if(!(this instanceof Oe))return new Oe(e,t);this.options=t=t?Lt(t):{},Lt(Gu,t,!1);var r=t.value;typeof r=="string"?r=new xt(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Oe.inputStyles[t.inputStyle](this),u=this.display=new rh(e,r,i,t);u.wrapper.CodeMirror=this,ju(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Ks(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new dt,keySeq:null,specialChars:null},t.autofocus&&!N&&u.input.focus(),c&&d<11&&setTimeout(function(){return n.display.input.reset(!0)},20),jh(this),wh(),Hr(this),this.curOp.forceUpdate=!0,nu(this,r),t.autofocus&&!N||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Ba(n)},20):an(this);for(var p in to)to.hasOwnProperty(p)&&to[p](this,t[p],vn);Qs(this),t.finishInit&&t.finishInit(this);for(var g=0;g20*20}ue(t.scroller,"touchstart",function(v){if(!Ve(e,v)&&!u(v)&&!$a(e,v)){t.input.ensurePolled(),clearTimeout(n);var b=+new Date;t.activeTouch={start:b,moved:!1,prev:b-r.end<=300?r:null},v.touches.length==1&&(t.activeTouch.left=v.touches[0].pageX,t.activeTouch.top=v.touches[0].pageY)}}),ue(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),ue(t.scroller,"touchend",function(v){var b=t.activeTouch;if(b&&!ir(t,v)&&b.left!=null&&!b.moved&&new Date-b.start<300){var D=e.coordsChar(t.activeTouch,"page"),E;!b.prev||p(b,b.prev)?E=new Ae(D,D):!b.prev.prev||p(b,b.prev.prev)?E=e.findWordAt(D):E=new Ae(Y(D.line,0),be(e.doc,Y(D.line+1,0))),e.setSelection(E.anchor,E.head),e.focus(),bt(v)}i()}),ue(t.scroller,"touchcancel",i),ue(t.scroller,"scroll",function(){t.scroller.clientHeight&&(jn(e,t.scroller.scrollTop),Pr(e,t.scroller.scrollLeft,!0),je(e,"scroll",e))}),ue(t.scroller,"mousewheel",function(v){return Vs(e,v)}),ue(t.scroller,"DOMMouseScroll",function(v){return Vs(e,v)}),ue(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(v){Ve(e,v)||Nn(v)},over:function(v){Ve(e,v)||(xh(e,v),Nn(v))},start:function(v){return yh(e,v)},drop:tt(e,bh),leave:function(v){Ve(e,v)||Au(e)}};var g=t.input.getField();ue(g,"keyup",function(v){return zu.call(e,v)}),ue(g,"keydown",tt(e,Pu)),ue(g,"keypress",tt(e,Hu)),ue(g,"focus",function(v){return Ba(e,v)}),ue(g,"blur",function(v){return an(e,v)})}var Va=[];Oe.defineInitHook=function(e){return Va.push(e)};function si(e,t,n,r){var i=e.doc,u;n==null&&(n="add"),n=="smart"&&(i.mode.indent?u=In(e,t).state:n="prev");var p=e.options.tabSize,g=ae(i,t),v=Ye(g.text,null,p);g.stateAfter&&(g.stateAfter=null);var b=g.text.match(/^\s*/)[0],D;if(!r&&!/\S/.test(g.text))D=0,n="not";else if(n=="smart"&&(D=i.mode.indent(u,g.text.slice(b.length),g.text),D==Ze||D>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?D=Ye(ae(i,t-1).text,null,p):D=0:n=="add"?D=v+e.options.indentUnit:n=="subtract"?D=v-e.options.indentUnit:typeof n=="number"&&(D=v+n),D=Math.max(0,D);var E="",B=0;if(e.options.indentWithTabs)for(var M=Math.floor(D/p);M;--M)B+=p,E+=" ";if(Bp,v=na(t),b=null;if(g&&r.ranges.length>1)if(Ut&&Ut.text.join(` +`)==t){if(r.ranges.length%Ut.text.length==0){b=[];for(var D=0;D=0;B--){var M=r.ranges[B],H=M.from(),W=M.to();M.empty()&&(n&&n>0?H=Y(H.line,H.ch-n):e.state.overwrite&&!g?W=Y(W.line,Math.min(ae(u,W.line).text.length,W.ch+Ce(v).length)):g&&Ut&&Ut.lineWise&&Ut.text.join(` +`)==v.join(` +`)&&(H=W=Y(H.line,0)));var Z={from:H,to:W,text:b?b[B%b.length]:v,origin:i||(g?"paste":e.state.cutIncoming>p?"cut":"+input")};cn(e.doc,Z),et(e,"inputRead",e,Z)}t&&!g&&Ku(e,t),ln(e),e.curOp.updateInput<2&&(e.curOp.updateInput=E),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Xu(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&St(t,function(){return el(t,n,0,null,"paste")}),!0}function Ku(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var u=e.getModeAt(i.head),p=!1;if(u.electricChars){for(var g=0;g-1){p=si(e,i.head.line,"smart");break}}else u.electricInput&&u.electricInput.test(ae(e.doc,i.head.line).text.slice(0,i.head.ch))&&(p=si(e,i.head.line,"smart"));p&&et(e,"electricInput",e,i.head.line)}}}function Yu(e){for(var t=[],n=[],r=0;ru&&(si(this,g.head.line,r,!0),u=g.head.line,p==this.doc.sel.primIndex&&ln(this));else{var v=g.from(),b=g.to(),D=Math.max(u,v.line);u=Math.min(this.lastLine(),b.line-(b.ch?0:1))+1;for(var E=D;E0&&Xa(this.doc,p,new Ae(v,B[p].to()),mt)}}}),getTokenAt:function(r,i){return os(this,r,i)},getLineTokens:function(r,i){return os(this,Y(r),i,!0)},getTokenTypeAt:function(r){r=be(this.doc,r);var i=rs(this,ae(this.doc,r.line)),u=0,p=(i.length-1)/2,g=r.ch,v;if(g==0)v=i[2];else for(;;){var b=u+p>>1;if((b?i[b*2-1]:0)>=g)p=b;else if(i[b*2+1]v&&(r=v,p=!0),g=ae(this.doc,r)}else g=r;return Pi(this,g,{top:0,left:0},i||"page",u||p).top+(p?this.doc.height-nr(g):0)},defaultTextHeight:function(){return nn(this.display)},defaultCharWidth:function(){return on(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,u,p,g){var v=this.display;r=Wt(this,be(this.doc,r));var b=r.bottom,D=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),v.sizer.appendChild(i),p=="over")b=r.top;else if(p=="above"||p=="near"){var E=Math.max(v.wrapper.clientHeight,this.doc.height),B=Math.max(v.sizer.clientWidth,v.lineSpace.clientWidth);(p=="above"||r.bottom+i.offsetHeight>E)&&r.top>i.offsetHeight?b=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=E&&(b=r.bottom),D+i.offsetWidth>B&&(D=B-i.offsetWidth)}i.style.top=b+"px",i.style.left=i.style.right="",g=="right"?(D=v.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(g=="left"?D=0:g=="middle"&&(D=(v.sizer.clientWidth-i.offsetWidth)/2),i.style.left=D+"px"),u&&qd(this,{left:D,top:b,right:D+i.offsetWidth,bottom:b+i.offsetHeight})},triggerOnKeyDown:ht(Pu),triggerOnKeyPress:ht(Hu),triggerOnKeyUp:zu,triggerOnMouseDown:ht(Ru),execCommand:function(r){if(ii.hasOwnProperty(r))return ii[r].call(null,this)},triggerElectric:ht(function(r){Ku(this,r)}),findPosH:function(r,i,u,p){var g=1;i<0&&(g=-1,i=-i);for(var v=be(this.doc,r),b=0;b0&&D(u.charAt(p-1));)--p;for(;g.5||this.options.lineWrapping)&&Ta(this),je(this,"refresh",this)}),swapDoc:ht(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),nu(this,r),Wn(this),this.display.input.reset(),Un(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,et(this,"swapDoc",this,i),i}),phrase:function(r){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,r)?i[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Jr(e),e.registerHelper=function(r,i,u){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=u},e.registerGlobalHelper=function(r,i,u,p){e.registerHelper(r,i,p),n[r]._global.push({pred:u,val:p})}}function rl(e,t,n,r,i){var u=t,p=n,g=ae(e,t.line),v=i&&e.direction=="rtl"?-n:n;function b(){var te=t.line+v;return te=e.first+e.size?!1:(t=new Y(te,t.ch,t.sticky),g=ae(e,te))}function D(te){var $;if(r=="codepoint"){var ne=g.text.charCodeAt(t.ch+(n>0?0:-1));if(isNaN(ne))$=null;else{var se=n>0?ne>=55296&&ne<56320:ne>=56320&&ne<57343;$=new Y(t.line,Math.max(0,Math.min(g.text.length,t.ch+n*(se?2:1))),-n)}}else i?$=Eh(e.cm,g,t,n):$=Ya(g,t,n);if($==null)if(!te&&b())t=Za(i,e.cm,g,t.line,v);else return!1;else t=$;return!0}if(r=="char"||r=="codepoint")D();else if(r=="column")D(!0);else if(r=="word"||r=="group")for(var E=null,B=r=="group",M=e.cm&&e.cm.getHelper(t,"wordChars"),H=!0;!(n<0&&!D(!H));H=!1){var W=g.text.charAt(t.ch)||` +`,Z=Si(W,M)?"w":B&&W==` +`?"n":!B||/\s/.test(W)?null:"p";if(B&&!H&&!Z&&(Z="s"),E&&E!=Z){n<0&&(n=1,D(),t.sticky="after");break}if(Z&&(E=Z),n>0&&!D(!H))break}var J=Qi(e,t,u,p,!0);return fa(u,J)&&(J.hitSide=!0),J}function Qu(e,t,n,r){var i=e.doc,u=t.left,p;if(r=="page"){var g=Math.min(e.display.wrapper.clientHeight,ye(e).innerHeight||i(e).documentElement.clientHeight),v=Math.max(g-.5*nn(e.display),3);p=(n>0?t.bottom:t.top)+n*v}else r=="line"&&(p=n>0?t.bottom+3:t.top-3);for(var b;b=Sa(e,u,p),!!b.outside;){if(n<0?p<=0:p>=i.height){b.hitSide=!0;break}p+=n*5}return b}var Te=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new dt,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Te.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;i.contentEditable=!0,tl(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function u(g){for(var v=g.target;v;v=v.parentNode){if(v==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(v.className))break}return!1}ue(i,"paste",function(g){!u(g)||Ve(r,g)||Xu(g,r)||d<=11&&setTimeout(tt(r,function(){return t.updateFromDOM()}),20)}),ue(i,"compositionstart",function(g){t.composing={data:g.data,done:!1}}),ue(i,"compositionupdate",function(g){t.composing||(t.composing={data:g.data,done:!1})}),ue(i,"compositionend",function(g){t.composing&&(g.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ue(i,"touchstart",function(){return n.forceCompositionEnd()}),ue(i,"input",function(){t.composing||t.readFromDOMSoon()});function p(g){if(!(!u(g)||Ve(r,g))){if(r.somethingSelected())ro({lineWise:!1,text:r.getSelections()}),g.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var v=Yu(r);ro({lineWise:!0,text:v.text}),g.type=="cut"&&r.operation(function(){r.setSelections(v.ranges,0,mt),r.replaceSelection("",null,"cut")})}else return;if(g.clipboardData){g.clipboardData.clearData();var b=Ut.text.join(` +`);if(g.clipboardData.setData("Text",b),g.clipboardData.getData("Text")==b){g.preventDefault();return}}var D=Zu(),E=D.firstChild;tl(E),r.display.lineSpace.insertBefore(D,r.display.lineSpace.firstChild),E.value=Ut.text.join(` +`);var B=he(De(i));A(E),setTimeout(function(){r.display.lineSpace.removeChild(D),B.focus(),B==i&&n.showPrimarySelection()},50)}}ue(i,"copy",p),ue(i,"cut",p)},Te.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Te.prototype.prepareSelection=function(){var e=Rs(this.cm,!1);return e.focus=he(De(this.div))==this.div,e},Te.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Te.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Te.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line=t.display.viewFrom&&Ju(t,r)||{node:g[0].measure.map[2],offset:0},b=i.linee.firstLine()&&(r=Y(r.line-1,ae(e.doc,r.line-1).length)),i.ch==ae(e.doc,i.line).text.length&&i.linet.viewTo-1)return!1;var u,p,g;r.line==t.viewFrom||(u=Ir(e,r.line))==0?(p=Fe(t.view[0].line),g=t.view[0].node):(p=Fe(t.view[u].line),g=t.view[u-1].node.nextSibling);var v=Ir(e,i.line),b,D;if(v==t.view.length-1?(b=t.viewTo-1,D=t.lineDiv.lastChild):(b=Fe(t.view[v+1].line)-1,D=t.view[v+1].node.previousSibling),!g)return!1;for(var E=e.doc.splitLines(Kh(e,g,D,p,b)),B=Mr(e.doc,Y(p,0),Y(b,ae(e.doc,b).text.length));E.length>1&&B.length>1;)if(Ce(E)==Ce(B))E.pop(),B.pop(),b--;else if(E[0]==B[0])E.shift(),B.shift(),p++;else break;for(var M=0,H=0,W=E[0],Z=B[0],J=Math.min(W.length,Z.length);Mr.ch&&te.charCodeAt(te.length-H-1)==$.charCodeAt($.length-H-1);)M--,H++;E[E.length-1]=te.slice(0,te.length-H).replace(/^\u200b+/,""),E[0]=E[0].slice(M).replace(/\u200b+$/,"");var se=Y(p,M),le=Y(b,B.length?Ce(B).length-H:0);if(E.length>1||E[0]||me(se,le))return dn(e.doc,E,se,le,"+input"),!0},Te.prototype.ensurePolled=function(){this.forceCompositionEnd()},Te.prototype.reset=function(){this.forceCompositionEnd()},Te.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Te.prototype.readFromDOMSoon=function(){var e=this;this.readDOMTimeout==null&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80))},Te.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&St(this.cm,function(){return yt(e.cm)})},Te.prototype.setUneditable=function(e){e.contentEditable="false"},Te.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||tt(this.cm,el)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},Te.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Te.prototype.onContextMenu=function(){},Te.prototype.resetPosition=function(){},Te.prototype.needsContentAttribute=!0;function Ju(e,t){var n=Da(e,t.line);if(!n||n.hidden)return null;var r=ae(e.doc,t.line),i=Es(n,r,t.line),u=tr(r,e.doc.direction),p="left";if(u){var g=Bn(u,t.ch);p=g%2?"right":"left"}var v=Ts(i.map,t.ch,p);return v.offset=v.collapse=="right"?v.end:v.start,v}function Xh(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function mn(e,t){return t&&(e.bad=!0),e}function Kh(e,t,n,r,i){var u="",p=!1,g=e.doc.lineSeparator(),v=!1;function b(M){return function(H){return H.id==M}}function D(){p&&(u+=g,v&&(u+=g),p=v=!1)}function E(M){M&&(D(),u+=M)}function B(M){if(M.nodeType==1){var H=M.getAttribute("cm-text");if(H){E(H);return}var W=M.getAttribute("cm-marker"),Z;if(W){var J=e.findMarks(Y(r,0),Y(i+1,0),b(+W));J.length&&(Z=J[0].find(0))&&E(Mr(e.doc,Z.from,Z.to).join(g));return}if(M.getAttribute("contenteditable")=="false")return;var te=/^(pre|div|p|li|table|br)$/i.test(M.nodeName);if(!/^br$/i.test(M.nodeName)&&M.textContent.length==0)return;te&&D();for(var $=0;$=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),ue(i,"paste",function(p){Ve(r,p)||Xu(p,r)||(r.state.pasteIncoming=+new Date,n.fastPoll())});function u(p){if(!Ve(r,p)){if(r.somethingSelected())ro({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var g=Yu(r);ro({lineWise:!0,text:g.text}),p.type=="cut"?r.setSelections(g.ranges,null,mt):(n.prevInput="",i.value=g.text.join(` +`),A(i))}else return;p.type=="cut"&&(r.state.cutIncoming=+new Date)}}ue(i,"cut",u),ue(i,"copy",u),ue(e.scroller,"paste",function(p){if(!(ir(e,p)||Ve(r,p))){if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var g=new Event("paste");g.clipboardData=p.clipboardData,i.dispatchEvent(g)}}),ue(e.lineSpace,"selectstart",function(p){ir(e,p)||bt(p)}),ue(i,"compositionstart",function(){var p=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:p,range:r.markText(p,r.getCursor("to"),{className:"CodeMirror-composing"})}}),ue(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},qe.prototype.createField=function(e){this.wrapper=Zu(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;tl(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},qe.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},qe.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=Rs(e);if(e.options.moveInputWithCursor){var i=Wt(e,n.sel.primary().head,"div"),u=t.wrapper.getBoundingClientRect(),p=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+p.top-u.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+p.left-u.left))}return r},qe.prototype.showSelection=function(e){var t=this.cm,n=t.display;G(n.cursorDiv,e.cursors),G(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},qe.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&A(this.textarea),c&&d>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",c&&d>=9&&(this.hasSelection=null));this.resetting=!1}},qe.prototype.getField=function(){return this.textarea},qe.prototype.supportsTouch=function(){return!1},qe.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!N||he(De(this.textarea))!=this.textarea))try{this.textarea.focus()}catch{}},qe.prototype.blur=function(){this.textarea.blur()},qe.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},qe.prototype.receivedFocus=function(){this.slowPoll()},qe.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},qe.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},qe.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||Kc(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(c&&d>=9&&this.hasSelection===i||I&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var u=i.charCodeAt(0);if(u==8203&&!r&&(r="\u200B"),u==8666)return this.reset(),this.cm.execCommand("undo")}for(var p=0,g=Math.min(r.length,i.length);p1e3||i.indexOf(` +`)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},qe.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},qe.prototype.onKeyPress=function(){c&&d>=9&&(this.hasSelection=null),this.fastPoll()},qe.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var u=Or(n,e),p=r.scroller.scrollTop;if(!u||S)return;var g=n.options.resetSelectionOnContextMenu;g&&n.doc.sel.contains(u)==-1&&tt(n,st)(n.doc,yr(u),mt);var v=i.style.cssText,b=t.wrapper.style.cssText,D=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px; + top: `+(e.clientY-D.top-5)+"px; left: "+(e.clientX-D.left-5)+`px; z-index: 1000; background: `+(c?"rgba(255, 255, 255, .05)":"transparent")+`; - outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var E;v&&(E=n.ownerDocument.defaultView.scrollY),r.input.focus(),v&&n.ownerDocument.defaultView.scrollTo(null,E),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=M,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function _(){if(n.selectionStart!=null){var R=i.somethingSelected(),Z="\u200B"+(R?n.value:"");n.value="\u21DA",n.value=Z,t.prevInput=R?"":"\u200B",n.selectionStart=1,n.selectionEnd=Z.length,r.selForContextMenu=i.doc.sel}}function M(){if(t.contextMenuPending==M&&(t.contextMenuPending=!1,t.wrapper.style.cssText=b,n.style.cssText=m,c&&d<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=p),n.selectionStart!=null)){(!c||c&&d<9)&&_();var R=0,Z=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?tt(i,gu)(i):R++<10?r.detectingSelectAll=setTimeout(Z,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Z,200)}}if(c&&d>=9&&_(),de){_i(e);var P=function(){Mt(window,"mouseup",P),setTimeout(M,20)};ue(window,"mouseup",P)}else setTimeout(M,50)},We.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},We.prototype.setUneditable=function(){},We.prototype.needsContentAttribute=!1;function Yh(e,t){if(t=t?Lt(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var i=he(Ce(e));t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=g.getValue()}var n;if(e.form&&(ue(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var u=e.form;n=u.submit;try{var p=u.submit=function(){r(),u.submit=n,u.submit(),u.submit=p}}catch{}}t.finishInit=function(m){m.save=r,m.getTextArea=function(){return e},m.toTextArea=function(){m.toTextArea=isNaN,r(),e.parentNode.removeChild(m.getWrapperElement()),e.style.display="",e.form&&(Mt(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var g=Ne(function(m){return e.parentNode.insertBefore(m,e.nextSibling)},t);return g}function Zh(e){e.off=Mt,e.on=ue,e.wheelEventPixels=rh,e.Doc=xt,e.splitLines=ra,e.countColumn=Ye,e.findColumn=Kt,e.isWordChar=Zo,e.Pass=Ze,e.signal=je,e.Line=ei,e.changeEnd=xr,e.scrollbarModel=Gs,e.Pos=Y,e.cmpPos=ve,e.modes=na,e.mimeModes=Vr,e.resolveMode=Sn,e.getMode=oa,e.modeExtensions=$r,e.extendMode=Jc,e.copyState=Lr,e.startState=Jl,e.innerMode=aa,e.commands=nn,e.keyMap=ar,e.keyName=Mu,e.isModifierKey=Tu,e.lookupKey=hi,e.normalizeKeyMap=kh,e.StringStream=Ge,e.SharedTextMarker=en,e.TextMarker=Cr,e.LineWidget=$i,e.e_preventDefault=bt,e.e_stopPropagation=Zl,e.e_stop=_i,e.addClass=pe,e.contains=Q,e.rmClass=oe,e.keyNames=Dr}qh(Ne),jh(Ne);var Qh="iter insert remove copy getEditor constructor".split(" ");for(var io in xt.prototype)xt.prototype.hasOwnProperty(io)&&ze(Qh,io)<0&&(Ne.prototype[io]=function(e){return function(){return e.apply(this.doc,arguments)}}(xt.prototype[io]));return Jr(xt),Ne.inputStyles={textarea:We,contenteditable:Te},Ne.defineMode=function(e){!Ne.defaults.mode&&e!="null"&&(Ne.defaults.mode=e),Zc.apply(this,arguments)},Ne.defineMIME=Qc,Ne.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Ne.defineMIME("text/plain","null"),Ne.defineExtension=function(e,t){Ne.prototype[e]=t},Ne.defineDocExtension=function(e,t){xt.prototype[e]=t},Ne.fromTextArea=Yh,Zh(Ne),Ne.version="5.65.21",Ne})});var ef=at((Vu,$u)=>{(function(o){typeof Vu=="object"&&typeof $u=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,s=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,a=/[*+-]\s/;o.commands.newlineAndIndentContinueMarkdownList=function(h){if(h.getOption("disableInput"))return o.Pass;for(var c=h.listSelections(),d=[],v=0;v\s*$/.test(B),z=!/>\s*$/.test(B);(N||z)&&h.replaceRange("",{line:y.line,ch:0},{line:y.line,ch:y.ch+1}),d[v]=` -`}else{var O=L[1],I=L[5],U=!(a.test(L[2])||L[2].indexOf(">")>=0),j=U?parseInt(L[3],10)+1+L[4]:L[2].replace("x"," ");d[v]=` -`+O+j+I,U&&f(h,y)}}h.replaceSelections(d)};function f(h,c){var d=c.line,v=0,y=0,x=l.exec(h.getLine(d)),D=x[1];do{v+=1;var S=d+v,F=h.getLine(S),B=l.exec(F);if(B){var L=B[1],T=parseInt(x[3],10)+v-y,N=parseInt(B[3],10),z=N;if(D===L&&!isNaN(N))T===N&&(z=N+1),T>N&&(z=T+1),h.replaceRange(F.replace(l,L+z+B[4]+B[5]),{line:S,ch:0},{line:S,ch:F.length});else{if(D.length>L.length||D.length{var tf=At();tf.commands.tabAndIndentMarkdownList=function(o){var l=o.listSelections(),s=l[0].head,a=o.getStateAfter(s.line),f=a.list!==!1;if(f){o.execCommand("indentMore");return}if(o.options.indentWithTabs)o.execCommand("insertTab");else{var h=Array(o.options.tabSize+1).join(" ");o.replaceSelection(h)}};tf.commands.shiftTabAndUnindentMarkdownList=function(o){var l=o.listSelections(),s=l[0].head,a=o.getStateAfter(s.line),f=a.list!==!1;if(f){o.execCommand("indentLess");return}if(o.options.indentWithTabs)o.execCommand("insertTab");else{var h=Array(o.options.tabSize+1).join(" ");o.replaceSelection(h)}}});var af=at((nf,of)=>{(function(o){typeof nf=="object"&&typeof of=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("fullScreen",!1,function(a,f,h){h==o.Init&&(h=!1),!h!=!f&&(f?l(a):s(a))});function l(a){var f=a.getWrapperElement();a.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:f.style.width,height:f.style.height},f.style.width="",f.style.height="auto",f.className+=" CodeMirror-fullscreen",document.documentElement.style.overflow="hidden",a.refresh()}function s(a){var f=a.getWrapperElement();f.className=f.className.replace(/\s*CodeMirror-fullscreen\b/,""),document.documentElement.style.overflow="";var h=a.state.fullScreenRestore;f.style.width=h.width,f.style.height=h.height,window.scrollTo(h.scrollLeft,h.scrollTop),a.refresh()}})});var al=at((lf,sf)=>{(function(o){typeof lf=="object"&&typeof sf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},s={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};o.defineMode("xml",function(a,f){var h=a.indentUnit,c={},d=f.htmlMode?l:s;for(var v in d)c[v]=d[v];for(var v in f)c[v]=f[v];var y,x;function D(k,H){function q(pe){return H.tokenize=pe,pe(k,H)}var Q=k.next();if(Q=="<")return k.eat("!")?k.eat("[")?k.match("CDATA[")?q(B("atom","]]>")):null:k.match("--")?q(B("comment","-->")):k.match("DOCTYPE",!0,!0)?(k.eatWhile(/[\w\._\-]/),q(L(1))):null:k.eat("?")?(k.eatWhile(/[\w\._\-]/),H.tokenize=B("meta","?>"),"meta"):(y=k.eat("/")?"closeTag":"openTag",H.tokenize=S,"tag bracket");if(Q=="&"){var he;return k.eat("#")?k.eat("x")?he=k.eatWhile(/[a-fA-F\d]/)&&k.eat(";"):he=k.eatWhile(/[\d]/)&&k.eat(";"):he=k.eatWhile(/[\w\.\-:]/)&&k.eat(";"),he?"atom":"error"}else return k.eatWhile(/[^&<]/),null}D.isInText=!0;function S(k,H){var q=k.next();if(q==">"||q=="/"&&k.eat(">"))return H.tokenize=D,y=q==">"?"endTag":"selfcloseTag","tag bracket";if(q=="=")return y="equals",null;if(q=="<"){H.tokenize=D,H.state=I,H.tagName=H.tagStart=null;var Q=H.tokenize(k,H);return Q?Q+" tag error":"tag error"}else return/[\'\"]/.test(q)?(H.tokenize=F(q),H.stringStartCol=k.column(),H.tokenize(k,H)):(k.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function F(k){var H=function(q,Q){for(;!q.eol();)if(q.next()==k){Q.tokenize=S;break}return"string"};return H.isInAttribute=!0,H}function B(k,H){return function(q,Q){for(;!q.eol();){if(q.match(H)){Q.tokenize=D;break}q.next()}return k}}function L(k){return function(H,q){for(var Q;(Q=H.next())!=null;){if(Q=="<")return q.tokenize=L(k+1),q.tokenize(H,q);if(Q==">")if(k==1){q.tokenize=D;break}else return q.tokenize=L(k-1),q.tokenize(H,q)}return"meta"}}function T(k){return k&&k.toLowerCase()}function N(k,H,q){this.prev=k.context,this.tagName=H||"",this.indent=k.indented,this.startOfLine=q,(c.doNotIndent.hasOwnProperty(H)||k.context&&k.context.noIndent)&&(this.noIndent=!0)}function z(k){k.context&&(k.context=k.context.prev)}function O(k,H){for(var q;;){if(!k.context||(q=k.context.tagName,!c.contextGrabbers.hasOwnProperty(T(q))||!c.contextGrabbers[T(q)].hasOwnProperty(T(H))))return;z(k)}}function I(k,H,q){return k=="openTag"?(q.tagStart=H.column(),U):k=="closeTag"?j:I}function U(k,H,q){return k=="word"?(q.tagName=H.current(),x="tag",W):c.allowMissingTagName&&k=="endTag"?(x="tag bracket",W(k,H,q)):(x="error",U)}function j(k,H,q){if(k=="word"){var Q=H.current();return q.context&&q.context.tagName!=Q&&c.implicitlyClosed.hasOwnProperty(T(q.context.tagName))&&z(q),q.context&&q.context.tagName==Q||c.matchClosing===!1?(x="tag",K):(x="tag error",de)}else return c.allowMissingTagName&&k=="endTag"?(x="tag bracket",K(k,H,q)):(x="error",de)}function K(k,H,q){return k!="endTag"?(x="error",K):(z(q),I)}function de(k,H,q){return x="error",K(k,H,q)}function W(k,H,q){if(k=="word")return x="attribute",oe;if(k=="endTag"||k=="selfcloseTag"){var Q=q.tagName,he=q.tagStart;return q.tagName=q.tagStart=null,k=="selfcloseTag"||c.autoSelfClosers.hasOwnProperty(T(Q))?O(q,Q):(O(q,Q),q.context=new N(q,Q,he==q.indented)),I}return x="error",W}function oe(k,H,q){return k=="equals"?X:(c.allowMissing||(x="error"),W(k,H,q))}function X(k,H,q){return k=="string"?G:k=="word"&&c.allowUnquoted?(x="string",W):(x="error",W(k,H,q))}function G(k,H,q){return k=="string"?G:W(k,H,q)}return{startState:function(k){var H={tokenize:D,state:I,indented:k||0,tagName:null,tagStart:null,context:null};return k!=null&&(H.baseIndent=k),H},token:function(k,H){if(!H.tagName&&k.sol()&&(H.indented=k.indentation()),k.eatSpace())return null;y=null;var q=H.tokenize(k,H);return(q||y)&&q!="comment"&&(x=null,H.state=H.state(y||q,k,H),x&&(q=x=="error"?q+" error":x)),q},indent:function(k,H,q){var Q=k.context;if(k.tokenize.isInAttribute)return k.tagStart==k.indented?k.stringStartCol+1:k.indented+h;if(Q&&Q.noIndent)return o.Pass;if(k.tokenize!=S&&k.tokenize!=D)return q?q.match(/^(\s*)/)[0].length:0;if(k.tagName)return c.multilineTagIndentPastTag!==!1?k.tagStart+k.tagName.length+2:k.tagStart+h*(c.multilineTagIndentFactor||1);if(c.alignCDATA&&/$/,blockCommentStart:"",configuration:c.htmlMode?"html":"xml",helperType:c.htmlMode?"html":"xml",skipAttribute:function(k){k.state==X&&(k.state=W)},xmlCurrentTag:function(k){return k.tagName?{name:k.tagName,close:k.type=="closeTag"}:null},xmlCurrentContext:function(k){for(var H=[],q=k.context;q;q=q.prev)H.push(q.tagName);return H.reverse()}}}),o.defineMIME("text/xml","xml"),o.defineMIME("application/xml","xml"),o.mimeModes.hasOwnProperty("text/html")||o.defineMIME("text/html",{name:"xml",htmlMode:!0})})});var cf=at((uf,ff)=>{(function(o){typeof uf=="object"&&typeof ff=="object"?o(At()):typeof define=="function"&&define.amd?define(["../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy","cbl"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded JavaScript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"],alias:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var l=0;l-1&&a.substring(c+1,a.length);if(d)return o.findModeByExtension(d)},o.findModeByName=function(a){a=a.toLowerCase();for(var f=0;f{(function(o){typeof df=="object"&&typeof hf=="object"?o(At(),al(),cf()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../xml/xml","../meta"],o):o(CodeMirror)})(function(o){"use strict";o.defineMode("markdown",function(l,s){var a=o.getMode(l,"text/html"),f=a.name=="null";function h(A){if(o.findModeByName){var w=o.findModeByName(A);w&&(A=w.mime||w.mimes[0])}var ee=o.getMode(l,A);return ee.name=="null"?null:ee}s.highlightFormatting===void 0&&(s.highlightFormatting=!1),s.maxBlockquoteDepth===void 0&&(s.maxBlockquoteDepth=0),s.taskLists===void 0&&(s.taskLists=!1),s.strikethrough===void 0&&(s.strikethrough=!1),s.emoji===void 0&&(s.emoji=!1),s.fencedCodeBlockHighlighting===void 0&&(s.fencedCodeBlockHighlighting=!0),s.fencedCodeBlockDefaultMode===void 0&&(s.fencedCodeBlockDefaultMode="text/plain"),s.xml===void 0&&(s.xml=!0),s.tokenTypeOverrides===void 0&&(s.tokenTypeOverrides={});var c={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var d in c)c.hasOwnProperty(d)&&s.tokenTypeOverrides[d]&&(c[d]=s.tokenTypeOverrides[d]);var v=/^([*\-_])(?:\s*\1){2,}\s*$/,y=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,x=/^\[(x| )\](?=\s)/i,D=s.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,S=/^ {0,3}(?:\={1,}|-{2,})\s*$/,F=/^[^#!\[\]*_\\<>` "'(~:]+/,B=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,L=/^\s*\[[^\]]+?\]:.*$/,T=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,N=" ";function z(A,w,ee){return w.f=w.inline=ee,ee(A,w)}function O(A,w,ee){return w.f=w.block=ee,ee(A,w)}function I(A){return!A||!/\S/.test(A.string)}function U(A){if(A.linkTitle=!1,A.linkHref=!1,A.linkText=!1,A.em=!1,A.strong=!1,A.strikethrough=!1,A.quote=0,A.indentedCode=!1,A.f==K){var w=f;if(!w){var ee=o.innerMode(a,A.htmlState);w=ee.mode.name=="xml"&&ee.state.tagStart===null&&!ee.state.context&&ee.state.tokenize.isInText}w&&(A.f=X,A.block=j,A.htmlState=null)}return A.trailingSpace=0,A.trailingSpaceNewLine=!1,A.prevLine=A.thisLine,A.thisLine={stream:null},null}function j(A,w){var ee=A.column()===w.indentation,Ce=I(w.prevLine.stream),ye=w.indentedCode,lt=w.prevLine.hr,Lt=w.list!==!1,Ye=(w.listStack[w.listStack.length-1]||0)+3;w.indentedCode=!1;var dt=w.indentation;if(w.indentationDiff===null&&(w.indentationDiff=w.indentation,Lt)){for(w.list=null;dt=4&&(ye||w.prevLine.fencedCodeEnd||w.prevLine.header||Ce))return A.skipToEnd(),w.indentedCode=!0,c.code;if(A.eatSpace())return null;if(ee&&w.indentation<=Ye&&(Ze=A.match(D))&&Ze[1].length<=6)return w.quote=0,w.header=Ze[1].length,w.thisLine.header=!0,s.highlightFormatting&&(w.formatting="header"),w.f=w.inline,W(w);if(w.indentation<=Ye&&A.eat(">"))return w.quote=ee?1:w.quote+1,s.highlightFormatting&&(w.formatting="quote"),A.eatSpace(),W(w);if(!Pe&&!w.setext&&ee&&w.indentation<=Ye&&(Ze=A.match(y))){var vt=Ze[1]?"ol":"ul";return w.indentation=dt+A.current().length,w.list=!0,w.quote=0,w.listStack.push(w.indentation),w.em=!1,w.strong=!1,w.code=!1,w.strikethrough=!1,s.taskLists&&A.match(x,!1)&&(w.taskList=!0),w.f=w.inline,s.highlightFormatting&&(w.formatting=["list","list-"+vt]),W(w)}else{if(ee&&w.indentation<=Ye&&(Ze=A.match(B,!0)))return w.quote=0,w.fencedEndRE=new RegExp(Ze[1]+"+ *$"),w.localMode=s.fencedCodeBlockHighlighting&&h(Ze[2]||s.fencedCodeBlockDefaultMode),w.localMode&&(w.localState=o.startState(w.localMode)),w.f=w.block=de,s.highlightFormatting&&(w.formatting="code-block"),w.code=-1,W(w);if(w.setext||(!ze||!Lt)&&!w.quote&&w.list===!1&&!w.code&&!Pe&&!L.test(A.string)&&(Ze=A.lookAhead(1))&&(Ze=Ze.match(S)))return w.setext?(w.header=w.setext,w.setext=0,A.skipToEnd(),s.highlightFormatting&&(w.formatting="header")):(w.header=Ze[0].charAt(0)=="="?1:2,w.setext=w.header),w.thisLine.header=!0,w.f=w.inline,W(w);if(Pe)return A.skipToEnd(),w.hr=!0,w.thisLine.hr=!0,c.hr;if(A.peek()==="[")return z(A,w,Q)}return z(A,w,w.inline)}function K(A,w){var ee=a.token(A,w.htmlState);if(!f){var Ce=o.innerMode(a,w.htmlState);(Ce.mode.name=="xml"&&Ce.state.tagStart===null&&!Ce.state.context&&Ce.state.tokenize.isInText||w.md_inside&&A.current().indexOf(">")>-1)&&(w.f=X,w.block=j,w.htmlState=null)}return ee}function de(A,w){var ee=w.listStack[w.listStack.length-1]||0,Ce=w.indentation=A.quote?w.push(c.formatting+"-"+A.formatting[ee]+"-"+A.quote):w.push("error"))}if(A.taskOpen)return w.push("meta"),w.length?w.join(" "):null;if(A.taskClosed)return w.push("property"),w.length?w.join(" "):null;if(A.linkHref?w.push(c.linkHref,"url"):(A.strong&&w.push(c.strong),A.em&&w.push(c.em),A.strikethrough&&w.push(c.strikethrough),A.emoji&&w.push(c.emoji),A.linkText&&w.push(c.linkText),A.code&&w.push(c.code),A.image&&w.push(c.image),A.imageAltText&&w.push(c.imageAltText,"link"),A.imageMarker&&w.push(c.imageMarker)),A.header&&w.push(c.header,c.header+"-"+A.header),A.quote&&(w.push(c.quote),!s.maxBlockquoteDepth||s.maxBlockquoteDepth>=A.quote?w.push(c.quote+"-"+A.quote):w.push(c.quote+"-"+s.maxBlockquoteDepth)),A.list!==!1){var Ce=(A.listStack.length-1)%3;Ce?Ce===1?w.push(c.list2):w.push(c.list3):w.push(c.list1)}return A.trailingSpaceNewLine?w.push("trailing-space-new-line"):A.trailingSpace&&w.push("trailing-space-"+(A.trailingSpace%2?"a":"b")),w.length?w.join(" "):null}function oe(A,w){if(A.match(F,!0))return W(w)}function X(A,w){var ee=w.text(A,w);if(typeof ee<"u")return ee;if(w.list)return w.list=null,W(w);if(w.taskList){var Ce=A.match(x,!0)[1]===" ";return Ce?w.taskOpen=!0:w.taskClosed=!0,s.highlightFormatting&&(w.formatting="task"),w.taskList=!1,W(w)}if(w.taskOpen=!1,w.taskClosed=!1,w.header&&A.match(/^#+$/,!0))return s.highlightFormatting&&(w.formatting="header"),W(w);var ye=A.next();if(w.linkTitle){w.linkTitle=!1;var lt=ye;ye==="("&&(lt=")"),lt=(lt+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Lt="^\\s*(?:[^"+lt+"\\\\]+|\\\\\\\\|\\\\.)"+lt;if(A.match(new RegExp(Lt),!0))return c.linkHref}if(ye==="`"){var Ye=w.formatting;s.highlightFormatting&&(w.formatting="code"),A.eatWhile("`");var dt=A.current().length;if(w.code==0&&(!w.quote||dt==1))return w.code=dt,W(w);if(dt==w.code){var ze=W(w);return w.code=0,ze}else return w.formatting=Ye,W(w)}else if(w.code)return W(w);if(ye==="\\"&&(A.next(),s.highlightFormatting)){var Pe=W(w),Ze=c.formatting+"-escape";return Pe?Pe+" "+Ze:Ze}if(ye==="!"&&A.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return w.imageMarker=!0,w.image=!0,s.highlightFormatting&&(w.formatting="image"),W(w);if(ye==="["&&w.imageMarker&&A.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return w.imageMarker=!1,w.imageAltText=!0,s.highlightFormatting&&(w.formatting="image"),W(w);if(ye==="]"&&w.imageAltText){s.highlightFormatting&&(w.formatting="image");var Pe=W(w);return w.imageAltText=!1,w.image=!1,w.inline=w.f=k,Pe}if(ye==="["&&!w.image)return w.linkText&&A.match(/^.*?\]/)||(w.linkText=!0,s.highlightFormatting&&(w.formatting="link")),W(w);if(ye==="]"&&w.linkText){s.highlightFormatting&&(w.formatting="link");var Pe=W(w);return w.linkText=!1,w.inline=w.f=A.match(/\(.*?\)| ?\[.*?\]/,!1)?k:X,Pe}if(ye==="<"&&A.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){w.f=w.inline=G,s.highlightFormatting&&(w.formatting="link");var Pe=W(w);return Pe?Pe+=" ":Pe="",Pe+c.linkInline}if(ye==="<"&&A.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){w.f=w.inline=G,s.highlightFormatting&&(w.formatting="link");var Pe=W(w);return Pe?Pe+=" ":Pe="",Pe+c.linkEmail}if(s.xml&&ye==="<"&&A.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var vt=A.string.indexOf(">",A.pos);if(vt!=-1){var Ti=A.string.substring(A.start,vt);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Ti)&&(w.md_inside=!0)}return A.backUp(1),w.htmlState=o.startState(a),O(A,w,K)}if(s.xml&&ye==="<"&&A.match(/^\/\w*?>/))return w.md_inside=!1,"tag";if(ye==="*"||ye==="_"){for(var Xt=1,Kt=A.pos==1?" ":A.string.charAt(A.pos-2);Xt<3&&A.eat(ye);)Xt++;var Ht=A.peek()||" ",pr=!/\s/.test(Ht)&&(!T.test(Ht)||/\s/.test(Kt)||T.test(Kt)),De=!/\s/.test(Kt)&&(!T.test(Kt)||/\s/.test(Ht)||T.test(Ht)),Pt=null,gr=null;if(Xt%2&&(!w.em&&pr&&(ye==="*"||!De||T.test(Kt))?Pt=!0:w.em==ye&&De&&(ye==="*"||!pr||T.test(Ht))&&(Pt=!1)),Xt>1&&(!w.strong&&pr&&(ye==="*"||!De||T.test(Kt))?gr=!0:w.strong==ye&&De&&(ye==="*"||!pr||T.test(Ht))&&(gr=!1)),gr!=null||Pt!=null){s.highlightFormatting&&(w.formatting=Pt==null?"strong":gr==null?"em":"strong em"),Pt===!0&&(w.em=ye),gr===!0&&(w.strong=ye);var ze=W(w);return Pt===!1&&(w.em=!1),gr===!1&&(w.strong=!1),ze}}else if(ye===" "&&(A.eat("*")||A.eat("_"))){if(A.peek()===" ")return W(w);A.backUp(1)}if(s.strikethrough){if(ye==="~"&&A.eatWhile(ye)){if(w.strikethrough){s.highlightFormatting&&(w.formatting="strikethrough");var ze=W(w);return w.strikethrough=!1,ze}else if(A.match(/^[^\s]/,!1))return w.strikethrough=!0,s.highlightFormatting&&(w.formatting="strikethrough"),W(w)}else if(ye===" "&&A.match("~~",!0)){if(A.peek()===" ")return W(w);A.backUp(2)}}if(s.emoji&&ye===":"&&A.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){w.emoji=!0,s.highlightFormatting&&(w.formatting="emoji");var Dn=W(w);return w.emoji=!1,Dn}return ye===" "&&(A.match(/^ +$/,!1)?w.trailingSpace++:w.trailingSpace&&(w.trailingSpaceNewLine=!0)),W(w)}function G(A,w){var ee=A.next();if(ee===">"){w.f=w.inline=X,s.highlightFormatting&&(w.formatting="link");var Ce=W(w);return Ce?Ce+=" ":Ce="",Ce+c.linkInline}return A.match(/^[^>]+/,!0),c.linkInline}function k(A,w){if(A.eatSpace())return null;var ee=A.next();return ee==="("||ee==="["?(w.f=w.inline=q(ee==="("?")":"]"),s.highlightFormatting&&(w.formatting="link-string"),w.linkHref=!0,W(w)):"error"}var H={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function q(A){return function(w,ee){var Ce=w.next();if(Ce===A){ee.f=ee.inline=X,s.highlightFormatting&&(ee.formatting="link-string");var ye=W(ee);return ee.linkHref=!1,ye}return w.match(H[A]),ee.linkHref=!0,W(ee)}}function Q(A,w){return A.match(/^([^\]\\]|\\.)*\]:/,!1)?(w.f=he,A.next(),s.highlightFormatting&&(w.formatting="link"),w.linkText=!0,W(w)):z(A,w,X)}function he(A,w){if(A.match("]:",!0)){w.f=w.inline=pe,s.highlightFormatting&&(w.formatting="link");var ee=W(w);return w.linkText=!1,ee}return A.match(/^([^\]\\]|\\.)+/,!0),c.linkText}function pe(A,w){return A.eatSpace()?null:(A.match(/^[^\s]+/,!0),A.peek()===void 0?w.linkTitle=!0:A.match(/^(?:\s+(?:"(?:[^"\\]|\\.)+"|'(?:[^'\\]|\\.)+'|\((?:[^)\\]|\\.)+\)))?/,!0),w.f=w.inline=X,c.linkHref+" url")}var Ee={startState:function(){return{f:j,prevLine:{stream:null},thisLine:{stream:null},block:j,htmlState:null,indentation:0,inline:X,text:oe,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(A){return{f:A.f,prevLine:A.prevLine,thisLine:A.thisLine,block:A.block,htmlState:A.htmlState&&o.copyState(a,A.htmlState),indentation:A.indentation,localMode:A.localMode,localState:A.localMode?o.copyState(A.localMode,A.localState):null,inline:A.inline,text:A.text,formatting:!1,linkText:A.linkText,linkTitle:A.linkTitle,linkHref:A.linkHref,code:A.code,em:A.em,strong:A.strong,strikethrough:A.strikethrough,emoji:A.emoji,header:A.header,setext:A.setext,hr:A.hr,taskList:A.taskList,list:A.list,listStack:A.listStack.slice(0),quote:A.quote,indentedCode:A.indentedCode,trailingSpace:A.trailingSpace,trailingSpaceNewLine:A.trailingSpaceNewLine,md_inside:A.md_inside,fencedEndRE:A.fencedEndRE}},token:function(A,w){if(w.formatting=!1,A!=w.thisLine.stream){if(w.header=0,w.hr=!1,A.match(/^\s*$/,!0))return U(w),null;if(w.prevLine=w.thisLine,w.thisLine={stream:A},w.taskList=!1,w.trailingSpace=0,w.trailingSpaceNewLine=!1,!w.localState&&(w.f=w.block,w.f!=K)){var ee=A.match(/^\s*/,!0)[0].replace(/\t/g,N).length;if(w.indentation=ee,w.indentationDiff=null,ee>0)return null}}return w.f(A,w)},innerMode:function(A){return A.block==K?{state:A.htmlState,mode:a}:A.localState?{state:A.localState,mode:A.localMode}:{state:A,mode:Ee}},indent:function(A,w,ee){return A.block==K&&a.indent?a.indent(A.htmlState,w,ee):A.localState&&A.localMode.indent?A.localMode.indent(A.localState,w,ee):o.Pass},blankLine:U,getType:W,blockCommentStart:"",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return Ee},"xml"),o.defineMIME("text/markdown","markdown"),o.defineMIME("text/x-markdown","markdown")})});var sl=at((pf,gf)=>{(function(o){typeof pf=="object"&&typeof gf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.overlayMode=function(l,s,a){return{startState:function(){return{base:o.startState(l),overlay:o.startState(s),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(f){return{base:o.copyState(l,f.base),overlay:o.copyState(s,f.overlay),basePos:f.basePos,baseCur:null,overlayPos:f.overlayPos,overlayCur:null}},token:function(f,h){return(f!=h.streamSeen||Math.min(h.basePos,h.overlayPos){(function(o){typeof mf=="object"&&typeof vf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){o.defineOption("placeholder","",function(d,v,y){var x=y&&y!=o.Init;if(v&&!x)d.on("blur",f),d.on("change",h),d.on("swapDoc",h),o.on(d.getInputField(),"compositionupdate",d.state.placeholderCompose=function(){a(d)}),h(d);else if(!v&&x){d.off("blur",f),d.off("change",h),d.off("swapDoc",h),o.off(d.getInputField(),"compositionupdate",d.state.placeholderCompose),l(d);var D=d.getWrapperElement();D.className=D.className.replace(" CodeMirror-empty","")}v&&!d.hasFocus()&&f(d)});function l(d){d.state.placeholder&&(d.state.placeholder.parentNode.removeChild(d.state.placeholder),d.state.placeholder=null)}function s(d){l(d);var v=d.state.placeholder=document.createElement("pre");v.style.cssText="height: 0; overflow: visible",v.style.direction=d.getOption("direction"),v.className="CodeMirror-placeholder CodeMirror-line-like";var y=d.getOption("placeholder");typeof y=="string"&&(y=document.createTextNode(y)),v.appendChild(y),d.display.lineSpace.insertBefore(v,d.display.lineSpace.firstChild)}function a(d){setTimeout(function(){var v=!1;if(d.lineCount()==1){var y=d.getInputField();v=y.nodeName=="TEXTAREA"?!d.getLine(0).length:!/[^\u200b]/.test(y.querySelector(".CodeMirror-line").textContent)}v?s(d):l(d)},20)}function f(d){c(d)&&s(d)}function h(d){var v=d.getWrapperElement(),y=c(d);v.className=v.className.replace(" CodeMirror-empty","")+(y?" CodeMirror-empty":""),y?s(d):l(d)}function c(d){return d.lineCount()===1&&d.getLine(0)===""}})});var wf=at((yf,xf)=>{(function(o){typeof yf=="object"&&typeof xf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("autoRefresh",!1,function(a,f){a.state.autoRefresh&&(s(a,a.state.autoRefresh),a.state.autoRefresh=null),f&&a.display.wrapper.offsetHeight==0&&l(a,a.state.autoRefresh={delay:f.delay||250})});function l(a,f){function h(){a.display.wrapper.offsetHeight?(s(a,f),a.display.lastWrapHeight!=a.display.wrapper.clientHeight&&a.refresh()):f.timeout=setTimeout(h,f.delay)}f.timeout=setTimeout(h,f.delay),f.hurry=function(){clearTimeout(f.timeout),f.timeout=setTimeout(h,50)},o.on(window,"mouseup",f.hurry),o.on(window,"keyup",f.hurry)}function s(a,f){clearTimeout(f.timeout),o.off(window,"mouseup",f.hurry),o.off(window,"keyup",f.hurry)}})});var kf=at((Cf,Df)=>{(function(o){typeof Cf=="object"&&typeof Df=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("styleSelectedText",!1,function(x,D,S){var F=S&&S!=o.Init;D&&!F?(x.state.markedSelection=[],x.state.markedSelectionStyle=typeof D=="string"?D:"CodeMirror-selectedtext",v(x),x.on("cursorActivity",l),x.on("change",s)):!D&&F&&(x.off("cursorActivity",l),x.off("change",s),d(x),x.state.markedSelection=x.state.markedSelectionStyle=null)});function l(x){x.state.markedSelection&&x.operation(function(){y(x)})}function s(x){x.state.markedSelection&&x.state.markedSelection.length&&x.operation(function(){d(x)})}var a=8,f=o.Pos,h=o.cmpPos;function c(x,D,S,F){if(h(D,S)!=0)for(var B=x.state.markedSelection,L=x.state.markedSelectionStyle,T=D.line;;){var N=T==D.line?D:f(T,0),z=T+a,O=z>=S.line,I=O?S:f(z,0),U=x.markText(N,I,{className:L});if(F==null?B.push(U):B.splice(F++,0,U),O)break;T=z}}function d(x){for(var D=x.state.markedSelection,S=0;S1)return v(x);var D=x.getCursor("start"),S=x.getCursor("end"),F=x.state.markedSelection;if(!F.length)return c(x,D,S);var B=F[0].find(),L=F[F.length-1].find();if(!B||!L||S.line-D.line<=a||h(D,L.to)>=0||h(S,B.from)<=0)return v(x);for(;h(D,B.from)>0;)F.shift().clear(),B=F[0].find();for(h(D,B.from)<0&&(B.to.line-D.line0&&(S.line-L.from.line{(function(o){typeof Sf=="object"&&typeof Ef=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l=o.Pos;function s(T){var N=T.flags;return N??(T.ignoreCase?"i":"")+(T.global?"g":"")+(T.multiline?"m":"")}function a(T,N){for(var z=s(T),O=z,I=0;Ij);K++){var de=T.getLine(U++);O=O==null?de:O+` -`+de}I=I*2,N.lastIndex=z.ch;var W=N.exec(O);if(W){var oe=O.slice(0,W.index).split(` -`),X=W[0].split(` -`),G=z.line+oe.length-1,k=oe[oe.length-1].length;return{from:l(G,k),to:l(G+X.length-1,X.length==1?k+X[0].length:X[X.length-1].length),match:W}}}}function d(T,N,z){for(var O,I=0;I<=T.length;){N.lastIndex=I;var U=N.exec(T);if(!U)break;var j=U.index+U[0].length;if(j>T.length-z)break;(!O||j>O.index+O[0].length)&&(O=U),I=U.index+1}return O}function v(T,N,z){N=a(N,"g");for(var O=z.line,I=z.ch,U=T.firstLine();O>=U;O--,I=-1){var j=T.getLine(O),K=d(j,N,I<0?0:j.length-I);if(K)return{from:l(O,K.index),to:l(O,K.index+K[0].length),match:K}}}function y(T,N,z){if(!f(N))return v(T,N,z);N=a(N,"gm");for(var O,I=1,U=T.getLine(z.line).length-z.ch,j=z.line,K=T.firstLine();j>=K;){for(var de=0;de=K;de++){var W=T.getLine(j--);O=O==null?W:W+` -`+O}I*=2;var oe=d(O,N,U);if(oe){var X=O.slice(0,oe.index).split(` + outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var E;m&&(E=i.ownerDocument.defaultView.scrollY),r.input.focus(),m&&i.ownerDocument.defaultView.scrollTo(null,E),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=M,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function B(){if(i.selectionStart!=null){var W=n.somethingSelected(),Z="\u200B"+(W?i.value:"");i.value="\u21DA",i.value=Z,t.prevInput=W?"":"\u200B",i.selectionStart=1,i.selectionEnd=Z.length,r.selForContextMenu=n.doc.sel}}function M(){if(t.contextMenuPending==M&&(t.contextMenuPending=!1,t.wrapper.style.cssText=b,i.style.cssText=v,c&&d<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=p),i.selectionStart!=null)){(!c||c&&d<9)&&B();var W=0,Z=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?tt(n,vu)(n):W++<10?r.detectingSelectAll=setTimeout(Z,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Z,200)}}if(c&&d>=9&&B(),de){Nn(e);var H=function(){Mt(window,"mouseup",H),setTimeout(M,20)};ue(window,"mouseup",H)}else setTimeout(M,50)},qe.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},qe.prototype.setUneditable=function(){},qe.prototype.needsContentAttribute=!1;function Zh(e,t){if(t=t?Lt(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=he(De(e));t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=g.getValue()}var i;if(e.form&&(ue(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var u=e.form;i=u.submit;try{var p=u.submit=function(){r(),u.submit=i,u.submit(),u.submit=p}}catch{}}t.finishInit=function(v){v.save=r,v.getTextArea=function(){return e},v.toTextArea=function(){v.toTextArea=isNaN,r(),e.parentNode.removeChild(v.getWrapperElement()),e.style.display="",e.form&&(Mt(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var g=Oe(function(v){return e.parentNode.insertBefore(v,e.nextSibling)},t);return g}function Qh(e){e.off=Mt,e.on=ue,e.wheelEventPixels=nh,e.Doc=xt,e.splitLines=na,e.countColumn=Ye,e.findColumn=Kt,e.isWordChar=Qo,e.Pass=Ze,e.signal=je,e.Line=en,e.changeEnd=xr,e.scrollbarModel=Xs,e.Pos=Y,e.cmpPos=me,e.modes=oa,e.mimeModes=$r,e.resolveMode=Ei,e.getMode=aa,e.modeExtensions=Vr,e.extendMode=$c,e.copyState=Lr,e.startState=$l,e.innerMode=la,e.commands=ii,e.keyMap=ar,e.keyName=_u,e.isModifierKey=Lu,e.lookupKey=pn,e.normalizeKeyMap=Sh,e.StringStream=Ge,e.SharedTextMarker=ti,e.TextMarker=Dr,e.LineWidget=ei,e.e_preventDefault=bt,e.e_stopPropagation=Ql,e.e_stop=Nn,e.addClass=pe,e.contains=Q,e.rmClass=oe,e.keyNames=Cr}Wh(Oe),Gh(Oe);var Jh="iter insert remove copy getEditor constructor".split(" ");for(var io in xt.prototype)xt.prototype.hasOwnProperty(io)&&Ne(Jh,io)<0&&(Oe.prototype[io]=function(e){return function(){return e.apply(this.doc,arguments)}}(xt.prototype[io]));return Jr(xt),Oe.inputStyles={textarea:qe,contenteditable:Te},Oe.defineMode=function(e){!Oe.defaults.mode&&e!="null"&&(Oe.defaults.mode=e),Qc.apply(this,arguments)},Oe.defineMIME=Jc,Oe.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Oe.defineMIME("text/plain","null"),Oe.defineExtension=function(e,t){Oe.prototype[e]=t},Oe.defineDocExtension=function(e,t){xt.prototype[e]=t},Oe.fromTextArea=Zh,Qh(Oe),Oe.version="5.65.21",Oe})});var tf=at((Vu,ef)=>{(function(o){typeof Vu=="object"&&typeof ef=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,s=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,a=/[*+-]\s/;o.commands.newlineAndIndentContinueMarkdownList=function(h){if(h.getOption("disableInput"))return o.Pass;for(var c=h.listSelections(),d=[],m=0;m\s*$/.test(_),N=!/>\s*$/.test(_);(O||N)&&h.replaceRange("",{line:y.line,ch:0},{line:y.line,ch:y.ch+1}),d[m]=` +`}else{var I=L[1],P=L[5],U=!(a.test(L[2])||L[2].indexOf(">")>=0),j=U?parseInt(L[3],10)+1+L[4]:L[2].replace("x"," ");d[m]=` +`+I+j+P,U&&f(h,y)}}h.replaceSelections(d)};function f(h,c){var d=c.line,m=0,y=0,x=l.exec(h.getLine(d)),C=x[1];do{m+=1;var S=d+m,F=h.getLine(S),_=l.exec(F);if(_){var L=_[1],T=parseInt(x[3],10)+m-y,O=parseInt(_[3],10),N=O;if(C===L&&!isNaN(O))T===O&&(N=O+1),T>O&&(N=T+1),h.replaceRange(F.replace(l,L+N+_[4]+_[5]),{line:S,ch:0},{line:S,ch:F.length});else{if(C.length>L.length||C.length{var rf=At();rf.commands.tabAndIndentMarkdownList=function(o){var l=o.listSelections(),s=l[0].head,a=o.getStateAfter(s.line),f=a.list!==!1;if(f){o.execCommand("indentMore");return}if(o.options.indentWithTabs)o.execCommand("insertTab");else{var h=Array(o.options.tabSize+1).join(" ");o.replaceSelection(h)}};rf.commands.shiftTabAndUnindentMarkdownList=function(o){var l=o.listSelections(),s=l[0].head,a=o.getStateAfter(s.line),f=a.list!==!1;if(f){o.execCommand("indentLess");return}if(o.options.indentWithTabs)o.execCommand("insertTab");else{var h=Array(o.options.tabSize+1).join(" ");o.replaceSelection(h)}}});var lf=at((of,af)=>{(function(o){typeof of=="object"&&typeof af=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("fullScreen",!1,function(a,f,h){h==o.Init&&(h=!1),!h!=!f&&(f?l(a):s(a))});function l(a){var f=a.getWrapperElement();a.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:f.style.width,height:f.style.height},f.style.width="",f.style.height="auto",f.className+=" CodeMirror-fullscreen",document.documentElement.style.overflow="hidden",a.refresh()}function s(a){var f=a.getWrapperElement();f.className=f.className.replace(/\s*CodeMirror-fullscreen\b/,""),document.documentElement.style.overflow="";var h=a.state.fullScreenRestore;f.style.width=h.width,f.style.height=h.height,window.scrollTo(h.scrollLeft,h.scrollTop),a.refresh()}})});var ll=at((sf,uf)=>{(function(o){typeof sf=="object"&&typeof uf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},s={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};o.defineMode("xml",function(a,f){var h=a.indentUnit,c={},d=f.htmlMode?l:s;for(var m in d)c[m]=d[m];for(var m in f)c[m]=f[m];var y,x;function C(k,z){function R(pe){return z.tokenize=pe,pe(k,z)}var Q=k.next();if(Q=="<")return k.eat("!")?k.eat("[")?k.match("CDATA[")?R(_("atom","]]>")):null:k.match("--")?R(_("comment","-->")):k.match("DOCTYPE",!0,!0)?(k.eatWhile(/[\w\._\-]/),R(L(1))):null:k.eat("?")?(k.eatWhile(/[\w\._\-]/),z.tokenize=_("meta","?>"),"meta"):(y=k.eat("/")?"closeTag":"openTag",z.tokenize=S,"tag bracket");if(Q=="&"){var he;return k.eat("#")?k.eat("x")?he=k.eatWhile(/[a-fA-F\d]/)&&k.eat(";"):he=k.eatWhile(/[\d]/)&&k.eat(";"):he=k.eatWhile(/[\w\.\-:]/)&&k.eat(";"),he?"atom":"error"}else return k.eatWhile(/[^&<]/),null}C.isInText=!0;function S(k,z){var R=k.next();if(R==">"||R=="/"&&k.eat(">"))return z.tokenize=C,y=R==">"?"endTag":"selfcloseTag","tag bracket";if(R=="=")return y="equals",null;if(R=="<"){z.tokenize=C,z.state=P,z.tagName=z.tagStart=null;var Q=z.tokenize(k,z);return Q?Q+" tag error":"tag error"}else return/[\'\"]/.test(R)?(z.tokenize=F(R),z.stringStartCol=k.column(),z.tokenize(k,z)):(k.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function F(k){var z=function(R,Q){for(;!R.eol();)if(R.next()==k){Q.tokenize=S;break}return"string"};return z.isInAttribute=!0,z}function _(k,z){return function(R,Q){for(;!R.eol();){if(R.match(z)){Q.tokenize=C;break}R.next()}return k}}function L(k){return function(z,R){for(var Q;(Q=z.next())!=null;){if(Q=="<")return R.tokenize=L(k+1),R.tokenize(z,R);if(Q==">")if(k==1){R.tokenize=C;break}else return R.tokenize=L(k-1),R.tokenize(z,R)}return"meta"}}function T(k){return k&&k.toLowerCase()}function O(k,z,R){this.prev=k.context,this.tagName=z||"",this.indent=k.indented,this.startOfLine=R,(c.doNotIndent.hasOwnProperty(z)||k.context&&k.context.noIndent)&&(this.noIndent=!0)}function N(k){k.context&&(k.context=k.context.prev)}function I(k,z){for(var R;;){if(!k.context||(R=k.context.tagName,!c.contextGrabbers.hasOwnProperty(T(R))||!c.contextGrabbers[T(R)].hasOwnProperty(T(z))))return;N(k)}}function P(k,z,R){return k=="openTag"?(R.tagStart=z.column(),U):k=="closeTag"?j:P}function U(k,z,R){return k=="word"?(R.tagName=z.current(),x="tag",q):c.allowMissingTagName&&k=="endTag"?(x="tag bracket",q(k,z,R)):(x="error",U)}function j(k,z,R){if(k=="word"){var Q=z.current();return R.context&&R.context.tagName!=Q&&c.implicitlyClosed.hasOwnProperty(T(R.context.tagName))&&N(R),R.context&&R.context.tagName==Q||c.matchClosing===!1?(x="tag",K):(x="tag error",de)}else return c.allowMissingTagName&&k=="endTag"?(x="tag bracket",K(k,z,R)):(x="error",de)}function K(k,z,R){return k!="endTag"?(x="error",K):(N(R),P)}function de(k,z,R){return x="error",K(k,z,R)}function q(k,z,R){if(k=="word")return x="attribute",oe;if(k=="endTag"||k=="selfcloseTag"){var Q=R.tagName,he=R.tagStart;return R.tagName=R.tagStart=null,k=="selfcloseTag"||c.autoSelfClosers.hasOwnProperty(T(Q))?I(R,Q):(I(R,Q),R.context=new O(R,Q,he==R.indented)),P}return x="error",q}function oe(k,z,R){return k=="equals"?X:(c.allowMissing||(x="error"),q(k,z,R))}function X(k,z,R){return k=="string"?G:k=="word"&&c.allowUnquoted?(x="string",q):(x="error",q(k,z,R))}function G(k,z,R){return k=="string"?G:q(k,z,R)}return{startState:function(k){var z={tokenize:C,state:P,indented:k||0,tagName:null,tagStart:null,context:null};return k!=null&&(z.baseIndent=k),z},token:function(k,z){if(!z.tagName&&k.sol()&&(z.indented=k.indentation()),k.eatSpace())return null;y=null;var R=z.tokenize(k,z);return(R||y)&&R!="comment"&&(x=null,z.state=z.state(y||R,k,z),x&&(R=x=="error"?R+" error":x)),R},indent:function(k,z,R){var Q=k.context;if(k.tokenize.isInAttribute)return k.tagStart==k.indented?k.stringStartCol+1:k.indented+h;if(Q&&Q.noIndent)return o.Pass;if(k.tokenize!=S&&k.tokenize!=C)return R?R.match(/^(\s*)/)[0].length:0;if(k.tagName)return c.multilineTagIndentPastTag!==!1?k.tagStart+k.tagName.length+2:k.tagStart+h*(c.multilineTagIndentFactor||1);if(c.alignCDATA&&/$/,blockCommentStart:"",configuration:c.htmlMode?"html":"xml",helperType:c.htmlMode?"html":"xml",skipAttribute:function(k){k.state==X&&(k.state=q)},xmlCurrentTag:function(k){return k.tagName?{name:k.tagName,close:k.type=="closeTag"}:null},xmlCurrentContext:function(k){for(var z=[],R=k.context;R;R=R.prev)z.push(R.tagName);return z.reverse()}}}),o.defineMIME("text/xml","xml"),o.defineMIME("application/xml","xml"),o.mimeModes.hasOwnProperty("text/html")||o.defineMIME("text/html",{name:"xml",htmlMode:!0})})});var df=at((ff,cf)=>{(function(o){typeof ff=="object"&&typeof cf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy","cbl"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded JavaScript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"],alias:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var l=0;l-1&&a.substring(c+1,a.length);if(d)return o.findModeByExtension(d)},o.findModeByName=function(a){a=a.toLowerCase();for(var f=0;f{(function(o){typeof hf=="object"&&typeof pf=="object"?o(At(),ll(),df()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../xml/xml","../meta"],o):o(CodeMirror)})(function(o){"use strict";o.defineMode("markdown",function(l,s){var a=o.getMode(l,"text/html"),f=a.name=="null";function h(A){if(o.findModeByName){var w=o.findModeByName(A);w&&(A=w.mime||w.mimes[0])}var ee=o.getMode(l,A);return ee.name=="null"?null:ee}s.highlightFormatting===void 0&&(s.highlightFormatting=!1),s.maxBlockquoteDepth===void 0&&(s.maxBlockquoteDepth=0),s.taskLists===void 0&&(s.taskLists=!1),s.strikethrough===void 0&&(s.strikethrough=!1),s.emoji===void 0&&(s.emoji=!1),s.fencedCodeBlockHighlighting===void 0&&(s.fencedCodeBlockHighlighting=!0),s.fencedCodeBlockDefaultMode===void 0&&(s.fencedCodeBlockDefaultMode="text/plain"),s.xml===void 0&&(s.xml=!0),s.tokenTypeOverrides===void 0&&(s.tokenTypeOverrides={});var c={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var d in c)c.hasOwnProperty(d)&&s.tokenTypeOverrides[d]&&(c[d]=s.tokenTypeOverrides[d]);var m=/^([*\-_])(?:\s*\1){2,}\s*$/,y=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,x=/^\[(x| )\](?=\s)/i,C=s.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,S=/^ {0,3}(?:\={1,}|-{2,})\s*$/,F=/^[^#!\[\]*_\\<>` "'(~:]+/,_=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,L=/^\s*\[[^\]]+?\]:.*$/,T=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,O=" ";function N(A,w,ee){return w.f=w.inline=ee,ee(A,w)}function I(A,w,ee){return w.f=w.block=ee,ee(A,w)}function P(A){return!A||!/\S/.test(A.string)}function U(A){if(A.linkTitle=!1,A.linkHref=!1,A.linkText=!1,A.em=!1,A.strong=!1,A.strikethrough=!1,A.quote=0,A.indentedCode=!1,A.f==K){var w=f;if(!w){var ee=o.innerMode(a,A.htmlState);w=ee.mode.name=="xml"&&ee.state.tagStart===null&&!ee.state.context&&ee.state.tokenize.isInText}w&&(A.f=X,A.block=j,A.htmlState=null)}return A.trailingSpace=0,A.trailingSpaceNewLine=!1,A.prevLine=A.thisLine,A.thisLine={stream:null},null}function j(A,w){var ee=A.column()===w.indentation,De=P(w.prevLine.stream),ye=w.indentedCode,lt=w.prevLine.hr,Lt=w.list!==!1,Ye=(w.listStack[w.listStack.length-1]||0)+3;w.indentedCode=!1;var dt=w.indentation;if(w.indentationDiff===null&&(w.indentationDiff=w.indentation,Lt)){for(w.list=null;dt=4&&(ye||w.prevLine.fencedCodeEnd||w.prevLine.header||De))return A.skipToEnd(),w.indentedCode=!0,c.code;if(A.eatSpace())return null;if(ee&&w.indentation<=Ye&&(Ze=A.match(C))&&Ze[1].length<=6)return w.quote=0,w.header=Ze[1].length,w.thisLine.header=!0,s.highlightFormatting&&(w.formatting="header"),w.f=w.inline,q(w);if(w.indentation<=Ye&&A.eat(">"))return w.quote=ee?1:w.quote+1,s.highlightFormatting&&(w.formatting="quote"),A.eatSpace(),q(w);if(!He&&!w.setext&&ee&&w.indentation<=Ye&&(Ze=A.match(y))){var mt=Ze[1]?"ol":"ul";return w.indentation=dt+A.current().length,w.list=!0,w.quote=0,w.listStack.push(w.indentation),w.em=!1,w.strong=!1,w.code=!1,w.strikethrough=!1,s.taskLists&&A.match(x,!1)&&(w.taskList=!0),w.f=w.inline,s.highlightFormatting&&(w.formatting=["list","list-"+mt]),q(w)}else{if(ee&&w.indentation<=Ye&&(Ze=A.match(_,!0)))return w.quote=0,w.fencedEndRE=new RegExp(Ze[1]+"+ *$"),w.localMode=s.fencedCodeBlockHighlighting&&h(Ze[2]||s.fencedCodeBlockDefaultMode),w.localMode&&(w.localState=o.startState(w.localMode)),w.f=w.block=de,s.highlightFormatting&&(w.formatting="code-block"),w.code=-1,q(w);if(w.setext||(!Ne||!Lt)&&!w.quote&&w.list===!1&&!w.code&&!He&&!L.test(A.string)&&(Ze=A.lookAhead(1))&&(Ze=Ze.match(S)))return w.setext?(w.header=w.setext,w.setext=0,A.skipToEnd(),s.highlightFormatting&&(w.formatting="header")):(w.header=Ze[0].charAt(0)=="="?1:2,w.setext=w.header),w.thisLine.header=!0,w.f=w.inline,q(w);if(He)return A.skipToEnd(),w.hr=!0,w.thisLine.hr=!0,c.hr;if(A.peek()==="[")return N(A,w,Q)}return N(A,w,w.inline)}function K(A,w){var ee=a.token(A,w.htmlState);if(!f){var De=o.innerMode(a,w.htmlState);(De.mode.name=="xml"&&De.state.tagStart===null&&!De.state.context&&De.state.tokenize.isInText||w.md_inside&&A.current().indexOf(">")>-1)&&(w.f=X,w.block=j,w.htmlState=null)}return ee}function de(A,w){var ee=w.listStack[w.listStack.length-1]||0,De=w.indentation=A.quote?w.push(c.formatting+"-"+A.formatting[ee]+"-"+A.quote):w.push("error"))}if(A.taskOpen)return w.push("meta"),w.length?w.join(" "):null;if(A.taskClosed)return w.push("property"),w.length?w.join(" "):null;if(A.linkHref?w.push(c.linkHref,"url"):(A.strong&&w.push(c.strong),A.em&&w.push(c.em),A.strikethrough&&w.push(c.strikethrough),A.emoji&&w.push(c.emoji),A.linkText&&w.push(c.linkText),A.code&&w.push(c.code),A.image&&w.push(c.image),A.imageAltText&&w.push(c.imageAltText,"link"),A.imageMarker&&w.push(c.imageMarker)),A.header&&w.push(c.header,c.header+"-"+A.header),A.quote&&(w.push(c.quote),!s.maxBlockquoteDepth||s.maxBlockquoteDepth>=A.quote?w.push(c.quote+"-"+A.quote):w.push(c.quote+"-"+s.maxBlockquoteDepth)),A.list!==!1){var De=(A.listStack.length-1)%3;De?De===1?w.push(c.list2):w.push(c.list3):w.push(c.list1)}return A.trailingSpaceNewLine?w.push("trailing-space-new-line"):A.trailingSpace&&w.push("trailing-space-"+(A.trailingSpace%2?"a":"b")),w.length?w.join(" "):null}function oe(A,w){if(A.match(F,!0))return q(w)}function X(A,w){var ee=w.text(A,w);if(typeof ee<"u")return ee;if(w.list)return w.list=null,q(w);if(w.taskList){var De=A.match(x,!0)[1]===" ";return De?w.taskOpen=!0:w.taskClosed=!0,s.highlightFormatting&&(w.formatting="task"),w.taskList=!1,q(w)}if(w.taskOpen=!1,w.taskClosed=!1,w.header&&A.match(/^#+$/,!0))return s.highlightFormatting&&(w.formatting="header"),q(w);var ye=A.next();if(w.linkTitle){w.linkTitle=!1;var lt=ye;ye==="("&&(lt=")"),lt=(lt+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Lt="^\\s*(?:[^"+lt+"\\\\]+|\\\\\\\\|\\\\.)"+lt;if(A.match(new RegExp(Lt),!0))return c.linkHref}if(ye==="`"){var Ye=w.formatting;s.highlightFormatting&&(w.formatting="code"),A.eatWhile("`");var dt=A.current().length;if(w.code==0&&(!w.quote||dt==1))return w.code=dt,q(w);if(dt==w.code){var Ne=q(w);return w.code=0,Ne}else return w.formatting=Ye,q(w)}else if(w.code)return q(w);if(ye==="\\"&&(A.next(),s.highlightFormatting)){var He=q(w),Ze=c.formatting+"-escape";return He?He+" "+Ze:Ze}if(ye==="!"&&A.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return w.imageMarker=!0,w.image=!0,s.highlightFormatting&&(w.formatting="image"),q(w);if(ye==="["&&w.imageMarker&&A.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return w.imageMarker=!1,w.imageAltText=!0,s.highlightFormatting&&(w.formatting="image"),q(w);if(ye==="]"&&w.imageAltText){s.highlightFormatting&&(w.formatting="image");var He=q(w);return w.imageAltText=!1,w.image=!1,w.inline=w.f=k,He}if(ye==="["&&!w.image)return w.linkText&&A.match(/^.*?\]/)||(w.linkText=!0,s.highlightFormatting&&(w.formatting="link")),q(w);if(ye==="]"&&w.linkText){s.highlightFormatting&&(w.formatting="link");var He=q(w);return w.linkText=!1,w.inline=w.f=A.match(/\(.*?\)| ?\[.*?\]/,!1)?k:X,He}if(ye==="<"&&A.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){w.f=w.inline=G,s.highlightFormatting&&(w.formatting="link");var He=q(w);return He?He+=" ":He="",He+c.linkInline}if(ye==="<"&&A.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){w.f=w.inline=G,s.highlightFormatting&&(w.formatting="link");var He=q(w);return He?He+=" ":He="",He+c.linkEmail}if(s.xml&&ye==="<"&&A.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var mt=A.string.indexOf(">",A.pos);if(mt!=-1){var Ln=A.string.substring(A.start,mt);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Ln)&&(w.md_inside=!0)}return A.backUp(1),w.htmlState=o.startState(a),I(A,w,K)}if(s.xml&&ye==="<"&&A.match(/^\/\w*?>/))return w.md_inside=!1,"tag";if(ye==="*"||ye==="_"){for(var Xt=1,Kt=A.pos==1?" ":A.string.charAt(A.pos-2);Xt<3&&A.eat(ye);)Xt++;var zt=A.peek()||" ",pr=!/\s/.test(zt)&&(!T.test(zt)||/\s/.test(Kt)||T.test(Kt)),Ce=!/\s/.test(Kt)&&(!T.test(Kt)||/\s/.test(zt)||T.test(zt)),Ht=null,gr=null;if(Xt%2&&(!w.em&&pr&&(ye==="*"||!Ce||T.test(Kt))?Ht=!0:w.em==ye&&Ce&&(ye==="*"||!pr||T.test(zt))&&(Ht=!1)),Xt>1&&(!w.strong&&pr&&(ye==="*"||!Ce||T.test(Kt))?gr=!0:w.strong==ye&&Ce&&(ye==="*"||!pr||T.test(zt))&&(gr=!1)),gr!=null||Ht!=null){s.highlightFormatting&&(w.formatting=Ht==null?"strong":gr==null?"em":"strong em"),Ht===!0&&(w.em=ye),gr===!0&&(w.strong=ye);var Ne=q(w);return Ht===!1&&(w.em=!1),gr===!1&&(w.strong=!1),Ne}}else if(ye===" "&&(A.eat("*")||A.eat("_"))){if(A.peek()===" ")return q(w);A.backUp(1)}if(s.strikethrough){if(ye==="~"&&A.eatWhile(ye)){if(w.strikethrough){s.highlightFormatting&&(w.formatting="strikethrough");var Ne=q(w);return w.strikethrough=!1,Ne}else if(A.match(/^[^\s]/,!1))return w.strikethrough=!0,s.highlightFormatting&&(w.formatting="strikethrough"),q(w)}else if(ye===" "&&A.match("~~",!0)){if(A.peek()===" ")return q(w);A.backUp(2)}}if(s.emoji&&ye===":"&&A.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){w.emoji=!0,s.highlightFormatting&&(w.formatting="emoji");var ki=q(w);return w.emoji=!1,ki}return ye===" "&&(A.match(/^ +$/,!1)?w.trailingSpace++:w.trailingSpace&&(w.trailingSpaceNewLine=!0)),q(w)}function G(A,w){var ee=A.next();if(ee===">"){w.f=w.inline=X,s.highlightFormatting&&(w.formatting="link");var De=q(w);return De?De+=" ":De="",De+c.linkInline}return A.match(/^[^>]+/,!0),c.linkInline}function k(A,w){if(A.eatSpace())return null;var ee=A.next();return ee==="("||ee==="["?(w.f=w.inline=R(ee==="("?")":"]"),s.highlightFormatting&&(w.formatting="link-string"),w.linkHref=!0,q(w)):"error"}var z={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function R(A){return function(w,ee){var De=w.next();if(De===A){ee.f=ee.inline=X,s.highlightFormatting&&(ee.formatting="link-string");var ye=q(ee);return ee.linkHref=!1,ye}return w.match(z[A]),ee.linkHref=!0,q(ee)}}function Q(A,w){return A.match(/^([^\]\\]|\\.)*\]:/,!1)?(w.f=he,A.next(),s.highlightFormatting&&(w.formatting="link"),w.linkText=!0,q(w)):N(A,w,X)}function he(A,w){if(A.match("]:",!0)){w.f=w.inline=pe,s.highlightFormatting&&(w.formatting="link");var ee=q(w);return w.linkText=!1,ee}return A.match(/^([^\]\\]|\\.)+/,!0),c.linkText}function pe(A,w){return A.eatSpace()?null:(A.match(/^[^\s]+/,!0),A.peek()===void 0?w.linkTitle=!0:A.match(/^(?:\s+(?:"(?:[^"\\]|\\.)+"|'(?:[^'\\]|\\.)+'|\((?:[^)\\]|\\.)+\)))?/,!0),w.f=w.inline=X,c.linkHref+" url")}var Ee={startState:function(){return{f:j,prevLine:{stream:null},thisLine:{stream:null},block:j,htmlState:null,indentation:0,inline:X,text:oe,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(A){return{f:A.f,prevLine:A.prevLine,thisLine:A.thisLine,block:A.block,htmlState:A.htmlState&&o.copyState(a,A.htmlState),indentation:A.indentation,localMode:A.localMode,localState:A.localMode?o.copyState(A.localMode,A.localState):null,inline:A.inline,text:A.text,formatting:!1,linkText:A.linkText,linkTitle:A.linkTitle,linkHref:A.linkHref,code:A.code,em:A.em,strong:A.strong,strikethrough:A.strikethrough,emoji:A.emoji,header:A.header,setext:A.setext,hr:A.hr,taskList:A.taskList,list:A.list,listStack:A.listStack.slice(0),quote:A.quote,indentedCode:A.indentedCode,trailingSpace:A.trailingSpace,trailingSpaceNewLine:A.trailingSpaceNewLine,md_inside:A.md_inside,fencedEndRE:A.fencedEndRE}},token:function(A,w){if(w.formatting=!1,A!=w.thisLine.stream){if(w.header=0,w.hr=!1,A.match(/^\s*$/,!0))return U(w),null;if(w.prevLine=w.thisLine,w.thisLine={stream:A},w.taskList=!1,w.trailingSpace=0,w.trailingSpaceNewLine=!1,!w.localState&&(w.f=w.block,w.f!=K)){var ee=A.match(/^\s*/,!0)[0].replace(/\t/g,O).length;if(w.indentation=ee,w.indentationDiff=null,ee>0)return null}}return w.f(A,w)},innerMode:function(A){return A.block==K?{state:A.htmlState,mode:a}:A.localState?{state:A.localState,mode:A.localMode}:{state:A,mode:Ee}},indent:function(A,w,ee){return A.block==K&&a.indent?a.indent(A.htmlState,w,ee):A.localState&&A.localMode.indent?A.localMode.indent(A.localState,w,ee):o.Pass},blankLine:U,getType:q,blockCommentStart:"",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return Ee},"xml"),o.defineMIME("text/markdown","markdown"),o.defineMIME("text/x-markdown","markdown")})});var ul=at((gf,vf)=>{(function(o){typeof gf=="object"&&typeof vf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.overlayMode=function(l,s,a){return{startState:function(){return{base:o.startState(l),overlay:o.startState(s),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(f){return{base:o.copyState(l,f.base),overlay:o.copyState(s,f.overlay),basePos:f.basePos,baseCur:null,overlayPos:f.overlayPos,overlayCur:null}},token:function(f,h){return(f!=h.streamSeen||Math.min(h.basePos,h.overlayPos){(function(o){typeof mf=="object"&&typeof bf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){o.defineOption("placeholder","",function(d,m,y){var x=y&&y!=o.Init;if(m&&!x)d.on("blur",f),d.on("change",h),d.on("swapDoc",h),o.on(d.getInputField(),"compositionupdate",d.state.placeholderCompose=function(){a(d)}),h(d);else if(!m&&x){d.off("blur",f),d.off("change",h),d.off("swapDoc",h),o.off(d.getInputField(),"compositionupdate",d.state.placeholderCompose),l(d);var C=d.getWrapperElement();C.className=C.className.replace(" CodeMirror-empty","")}m&&!d.hasFocus()&&f(d)});function l(d){d.state.placeholder&&(d.state.placeholder.parentNode.removeChild(d.state.placeholder),d.state.placeholder=null)}function s(d){l(d);var m=d.state.placeholder=document.createElement("pre");m.style.cssText="height: 0; overflow: visible",m.style.direction=d.getOption("direction"),m.className="CodeMirror-placeholder CodeMirror-line-like";var y=d.getOption("placeholder");typeof y=="string"&&(y=document.createTextNode(y)),m.appendChild(y),d.display.lineSpace.insertBefore(m,d.display.lineSpace.firstChild)}function a(d){setTimeout(function(){var m=!1;if(d.lineCount()==1){var y=d.getInputField();m=y.nodeName=="TEXTAREA"?!d.getLine(0).length:!/[^\u200b]/.test(y.querySelector(".CodeMirror-line").textContent)}m?s(d):l(d)},20)}function f(d){c(d)&&s(d)}function h(d){var m=d.getWrapperElement(),y=c(d);m.className=m.className.replace(" CodeMirror-empty","")+(y?" CodeMirror-empty":""),y?s(d):l(d)}function c(d){return d.lineCount()===1&&d.getLine(0)===""}})});var Df=at((xf,wf)=>{(function(o){typeof xf=="object"&&typeof wf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("autoRefresh",!1,function(a,f){a.state.autoRefresh&&(s(a,a.state.autoRefresh),a.state.autoRefresh=null),f&&a.display.wrapper.offsetHeight==0&&l(a,a.state.autoRefresh={delay:f.delay||250})});function l(a,f){function h(){a.display.wrapper.offsetHeight?(s(a,f),a.display.lastWrapHeight!=a.display.wrapper.clientHeight&&a.refresh()):f.timeout=setTimeout(h,f.delay)}f.timeout=setTimeout(h,f.delay),f.hurry=function(){clearTimeout(f.timeout),f.timeout=setTimeout(h,50)},o.on(window,"mouseup",f.hurry),o.on(window,"keyup",f.hurry)}function s(a,f){clearTimeout(f.timeout),o.off(window,"mouseup",f.hurry),o.off(window,"keyup",f.hurry)}})});var Sf=at((Cf,kf)=>{(function(o){typeof Cf=="object"&&typeof kf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("styleSelectedText",!1,function(x,C,S){var F=S&&S!=o.Init;C&&!F?(x.state.markedSelection=[],x.state.markedSelectionStyle=typeof C=="string"?C:"CodeMirror-selectedtext",m(x),x.on("cursorActivity",l),x.on("change",s)):!C&&F&&(x.off("cursorActivity",l),x.off("change",s),d(x),x.state.markedSelection=x.state.markedSelectionStyle=null)});function l(x){x.state.markedSelection&&x.operation(function(){y(x)})}function s(x){x.state.markedSelection&&x.state.markedSelection.length&&x.operation(function(){d(x)})}var a=8,f=o.Pos,h=o.cmpPos;function c(x,C,S,F){if(h(C,S)!=0)for(var _=x.state.markedSelection,L=x.state.markedSelectionStyle,T=C.line;;){var O=T==C.line?C:f(T,0),N=T+a,I=N>=S.line,P=I?S:f(N,0),U=x.markText(O,P,{className:L});if(F==null?_.push(U):_.splice(F++,0,U),I)break;T=N}}function d(x){for(var C=x.state.markedSelection,S=0;S1)return m(x);var C=x.getCursor("start"),S=x.getCursor("end"),F=x.state.markedSelection;if(!F.length)return c(x,C,S);var _=F[0].find(),L=F[F.length-1].find();if(!_||!L||S.line-C.line<=a||h(C,L.to)>=0||h(S,_.from)<=0)return m(x);for(;h(C,_.from)>0;)F.shift().clear(),_=F[0].find();for(h(C,_.from)<0&&(_.to.line-C.line0&&(S.line-L.from.line{(function(o){typeof Ef=="object"&&typeof Af=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l=o.Pos;function s(T){var O=T.flags;return O??(T.ignoreCase?"i":"")+(T.global?"g":"")+(T.multiline?"m":"")}function a(T,O){for(var N=s(T),I=N,P=0;Pj);K++){var de=T.getLine(U++);I=I==null?de:I+` +`+de}P=P*2,O.lastIndex=N.ch;var q=O.exec(I);if(q){var oe=I.slice(0,q.index).split(` +`),X=q[0].split(` +`),G=N.line+oe.length-1,k=oe[oe.length-1].length;return{from:l(G,k),to:l(G+X.length-1,X.length==1?k+X[0].length:X[X.length-1].length),match:q}}}}function d(T,O,N){for(var I,P=0;P<=T.length;){O.lastIndex=P;var U=O.exec(T);if(!U)break;var j=U.index+U[0].length;if(j>T.length-N)break;(!I||j>I.index+I[0].length)&&(I=U),P=U.index+1}return I}function m(T,O,N){O=a(O,"g");for(var I=N.line,P=N.ch,U=T.firstLine();I>=U;I--,P=-1){var j=T.getLine(I),K=d(j,O,P<0?0:j.length-P);if(K)return{from:l(I,K.index),to:l(I,K.index+K[0].length),match:K}}}function y(T,O,N){if(!f(O))return m(T,O,N);O=a(O,"gm");for(var I,P=1,U=T.getLine(N.line).length-N.ch,j=N.line,K=T.firstLine();j>=K;){for(var de=0;de=K;de++){var q=T.getLine(j--);I=I==null?q:q+` +`+I}P*=2;var oe=d(I,O,U);if(oe){var X=I.slice(0,oe.index).split(` `),G=oe[0].split(` -`),k=j+X.length,H=X[X.length-1].length;return{from:l(k,H),to:l(k+G.length-1,G.length==1?H+G[0].length:G[G.length-1].length),match:oe}}}}var x,D;String.prototype.normalize?(x=function(T){return T.normalize("NFD").toLowerCase()},D=function(T){return T.normalize("NFD")}):(x=function(T){return T.toLowerCase()},D=function(T){return T});function S(T,N,z,O){if(T.length==N.length)return z;for(var I=0,U=z+Math.max(0,T.length-N.length);;){if(I==U)return I;var j=I+U>>1,K=O(T.slice(0,j)).length;if(K==z)return j;K>z?U=j:I=j+1}}function F(T,N,z,O){if(!N.length)return null;var I=O?x:D,U=I(N).split(/\r|\n\r?/);e:for(var j=z.line,K=z.ch,de=T.lastLine()+1-U.length;j<=de;j++,K=0){var W=T.getLine(j).slice(K),oe=I(W);if(U.length==1){var X=oe.indexOf(U[0]);if(X==-1)continue e;var z=S(W,oe,X,I)+K;return{from:l(j,S(W,oe,X,I)+K),to:l(j,S(W,oe,X+U[0].length,I)+K)}}else{var G=oe.length-U[0].length;if(oe.slice(G)!=U[0])continue e;for(var k=1;k=de;j--,K=-1){var W=T.getLine(j);K>-1&&(W=W.slice(0,K));var oe=I(W);if(U.length==1){var X=oe.lastIndexOf(U[0]);if(X==-1)continue e;return{from:l(j,S(W,oe,X,I)),to:l(j,S(W,oe,X+U[0].length,I))}}else{var G=U[U.length-1];if(oe.slice(0,G.length)!=G)continue e;for(var k=1,z=j-U.length+1;k(this.doc.getLine(N.line)||"").length&&(N.ch=0,N.line++)),o.cmpPos(N,this.doc.clipPos(N))!=0))return this.atOccurrence=!1;var z=this.matches(T,N);if(this.afterEmptyMatch=z&&o.cmpPos(z.from,z.to)==0,z)return this.pos=z,this.atOccurrence=!0,this.pos.match||!0;var O=l(T?this.doc.firstLine():this.doc.lastLine()+1,0);return this.pos={from:O,to:O},this.atOccurrence=!1},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(T,N){if(this.atOccurrence){var z=o.splitLines(T);this.doc.replaceRange(z,this.pos.from,this.pos.to,N),this.pos.to=l(this.pos.from.line+z.length-1,z[z.length-1].length+(z.length==1?this.pos.from.ch:0))}}},o.defineExtension("getSearchCursor",function(T,N,z){return new L(this.doc,T,N,z)}),o.defineDocExtension("getSearchCursor",function(T,N,z){return new L(this,T,N,z)}),o.defineExtension("selectMatches",function(T,N){for(var z=[],O=this.getSearchCursor(T,this.getCursor("from"),N);O.findNext()&&!(o.cmpPos(O.to(),this.getCursor("to"))>0);)z.push({anchor:O.from(),head:O.to()});z.length&&this.setSelections(z,0)})})});var Lf=at((Ff,Tf)=>{(function(o){typeof Ff=="object"&&typeof Tf=="object"?o(At(),ll(),sl()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../markdown/markdown","../../addon/mode/overlay"],o):o(CodeMirror)})(function(o){"use strict";var l=/^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i;o.defineMode("gfm",function(s,a){var f=0;function h(y){return y.code=!1,null}var c={startState:function(){return{code:!1,codeBlock:!1,ateSpace:!1}},copyState:function(y){return{code:y.code,codeBlock:y.codeBlock,ateSpace:y.ateSpace}},token:function(y,x){if(x.combineTokens=null,x.codeBlock)return y.match(/^```+/)?(x.codeBlock=!1,null):(y.skipToEnd(),null);if(y.sol()&&(x.code=!1),y.sol()&&y.match(/^```+/))return y.skipToEnd(),x.codeBlock=!0,null;if(y.peek()==="`"){y.next();var D=y.pos;y.eatWhile("`");var S=1+y.pos-D;return x.code?S===f&&(x.code=!1):(f=S,x.code=!0),null}else if(x.code)return y.next(),null;if(y.eatSpace())return x.ateSpace=!0,null;if((y.sol()||x.ateSpace)&&(x.ateSpace=!1,a.gitHubSpice!==!1)){if(y.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?=.{0,6}\d)(?:[a-f0-9]{7,40}\b)/))return x.combineTokens=!0,"link";if(y.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/))return x.combineTokens=!0,"link"}return y.match(l)&&y.string.slice(y.start-2,y.start)!="]("&&(y.start==0||/\W/.test(y.string.charAt(y.start-1)))?(x.combineTokens=!0,"link"):(y.next(),null)},blankLine:h},d={taskLists:!0,strikethrough:!0,emoji:!0};for(var v in a)d[v]=a[v];return d.name="markdown",o.overlayMode(o.getMode(s,d),c)},"markdown"),o.defineMIME("text/x-gfm","gfm")})});var Mf=at(()=>{});var Bf=at((j0,fl)=>{var ul;(function(){"use strict";ul=function(o,l,s,a){a=a||{},this.dictionary=null,this.rules={},this.dictionaryTable=new Map,this.compoundRules=[],this.compoundRuleCodes={},this.replacementTable=[],this.flags=a.flags||{},this.memoized={},this.loaded=!1;var f=this,h,c,d,v,y;o&&(f.dictionary=o,l&&s?F():(typeof window<"u"?(a.dictionaryPath?h=a.dictionaryPath:h="typo/dictionaries",window.chrome&&window.chrome.runtime&&window.chrome.runtime.getURL?h=window.chrome.runtime.getURL(h):window.browser&&window.browser.runtime&&window.browser.runtime.getURL&&(h=window.browser.runtime.getURL(h))):typeof __dirname<"u"?h=__dirname+"/dictionaries":h="./dictionaries",l||x(h+"/"+o+"/"+o+".aff",D),s||x(h+"/"+o+"/"+o+".dic",S)));function x(B,L){var T=f._readFile(B,null,a?.asyncLoad);a?.asyncLoad?T.then(function(N){L(N)}):L(T)}function D(B){l=B,s&&F()}function S(B){s=B,l&&F()}function F(){for(f.rules=f._parseAFF(l),f.compoundRuleCodes={},c=0,v=f.compoundRules.length;c0&&(U.continuationClasses=O),I!=="."&&(S==="SFX"?U.match=new RegExp(I+"$"):U.match=new RegExp("^"+I)),T!="0"&&(S==="SFX"?U.remove=new RegExp(T+"$"):U.remove=T),L.push(U)}l[F]={type:S,combineable:B==="Y",entries:L},c+=f}else if(S==="COMPOUNDRULE"){for(f=parseInt(D[1],10),d=c+1,y=c+1+f;d0&&(s.get(oe)===null&&s.set(oe,[]),s.get(oe).push(X))}for(var f=1,h=l.length;f1){var x=this.parseRuleCodes(v[1]);(!("NEEDAFFIX"in this.flags)||x.indexOf(this.flags.NEEDAFFIX)===-1)&&a(y,x);for(var D=0,S=x.length;D"u"){if("COMPOUNDMIN"in this.flags&&o.length>=this.flags.COMPOUNDMIN){for(s=0,a=this.compoundRules.length;s"u"&&(s=Array.prototype.concat.apply([],this.dictionaryTable.get(o))),s&&s.indexOf(this.flags[l])!==-1))},alphabet:"",suggest:function(o,l){if(!this.loaded)throw"Dictionary not loaded.";if(l=l||5,this.memoized.hasOwnProperty(o)){var s=this.memoized[o].limit;if(l<=s||this.memoized[o].suggestions.length1&&K[1][1]!==K[1][0]&&(I=K[0]+K[1][1]+K[1][0]+K[1].substring(2),(!F||y.check(I))&&(I in B?B[I]+=1:B[I]=1)),K[1]){var de=K[1].substring(0,1).toUpperCase()===K[1].substring(0,1)?"uppercase":"lowercase";for(T=0;TG?1:oe[0].localeCompare(W[0])}I.sort(U).reverse();var j=[],K="lowercase";S.toUpperCase()===S?K="uppercase":S.substr(0,1).toUpperCase()+S.substr(1).toLowerCase()===S&&(K="capitalized");var de=l;for(z=0;z{"use strict";var _f=Bf();function Oe(o){if(o=o||{},typeof o.codeMirrorInstance!="function"||typeof o.codeMirrorInstance.defineMode!="function"){console.log("CodeMirror Spell Checker: You must provide an instance of CodeMirror via the option `codeMirrorInstance`");return}String.prototype.includes||(String.prototype.includes=function(){"use strict";return String.prototype.indexOf.apply(this,arguments)!==-1}),o.codeMirrorInstance.defineMode("spell-checker",function(l){if(!Oe.aff_loading){Oe.aff_loading=!0;var s=new XMLHttpRequest;s.open("GET","https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.aff",!0),s.onload=function(){s.readyState===4&&s.status===200&&(Oe.aff_data=s.responseText,Oe.num_loaded++,Oe.num_loaded==2&&(Oe.typo=new _f("en_US",Oe.aff_data,Oe.dic_data,{platform:"any"})))},s.send(null)}if(!Oe.dic_loading){Oe.dic_loading=!0;var a=new XMLHttpRequest;a.open("GET","https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.dic",!0),a.onload=function(){a.readyState===4&&a.status===200&&(Oe.dic_data=a.responseText,Oe.num_loaded++,Oe.num_loaded==2&&(Oe.typo=new _f("en_US",Oe.aff_data,Oe.dic_data,{platform:"any"})))},a.send(null)}var f='!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~ ',h={token:function(d){var v=d.peek(),y="";if(f.includes(v))return d.next(),null;for(;(v=d.peek())!=null&&!f.includes(v);)y+=v,d.next();return Oe.typo&&!Oe.typo.check(y)?"spell-error":null}},c=o.codeMirrorInstance.getMode(l,l.backdrop||"text/plain");return o.codeMirrorInstance.overlayMode(c,h,!0)})}Oe.num_loaded=0;Oe.aff_loading=!1;Oe.dic_loading=!1;Oe.aff_data="";Oe.dic_data="";Oe.typo;zf.exports=Oe});var Yf=at(_e=>{"use strict";function Of(o,l){for(var s=0;so.length)&&(l=o.length);for(var s=0,a=new Array(l);s=o.length?{done:!0}:{done:!1,value:o[a++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ep(o,l){if(typeof o!="object"||o===null)return o;var s=o[Symbol.toPrimitive];if(s!==void 0){var a=s.call(o,l||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(o)}function tp(o){var l=ep(o,"string");return typeof l=="symbol"?l:String(l)}function cl(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}_e.defaults=cl();function rp(o){_e.defaults=o}var jf=/[&<>"']/,ip=new RegExp(jf.source,"g"),Gf=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,np=new RegExp(Gf.source,"g"),op={"&":"&","<":"<",">":">",'"':""","'":"'"},Hf=function(l){return op[l]};function gt(o,l){if(l){if(jf.test(o))return o.replace(ip,Hf)}else if(Gf.test(o))return o.replace(np,Hf);return o}var ap=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Xf(o){return o.replace(ap,function(l,s){return s=s.toLowerCase(),s==="colon"?":":s.charAt(0)==="#"?s.charAt(1)==="x"?String.fromCharCode(parseInt(s.substring(2),16)):String.fromCharCode(+s.substring(1)):""})}var lp=/(^|[^\[])\^/g;function Me(o,l){o=typeof o=="string"?o:o.source,l=l||"";var s={replace:function(f,h){return h=h.source||h,h=h.replace(lp,"$1"),o=o.replace(f,h),s},getRegex:function(){return new RegExp(o,l)}};return s}var sp=/[^\w:]/g,up=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function Pf(o,l,s){if(o){var a;try{a=decodeURIComponent(Xf(s)).replace(sp,"").toLowerCase()}catch{return null}if(a.indexOf("javascript:")===0||a.indexOf("vbscript:")===0||a.indexOf("data:")===0)return null}l&&!up.test(s)&&(s=hp(l,s));try{s=encodeURI(s).replace(/%25/g,"%")}catch{return null}return s}var oo={},fp=/^[^:]+:\/*[^/]*$/,cp=/^([^:]+:)[\s\S]*$/,dp=/^([^:]+:\/*[^/]*)[\s\S]*$/;function hp(o,l){oo[" "+o]||(fp.test(o)?oo[" "+o]=o+"/":oo[" "+o]=ao(o,"/",!0)),o=oo[" "+o];var s=o.indexOf(":")===-1;return l.substring(0,2)==="//"?s?l:o.replace(cp,"$1")+l:l.charAt(0)==="/"?s?l:o.replace(dp,"$1")+l:o+l}var lo={exec:function(){}};function qf(o,l){var s=o.replace(/\|/g,function(h,c,d){for(var v=!1,y=c;--y>=0&&d[y]==="\\";)v=!v;return v?"|":" |"}),a=s.split(/ \|/),f=0;if(a[0].trim()||a.shift(),a.length>0&&!a[a.length-1].trim()&&a.pop(),a.length>l)a.splice(l);else for(;a.length1;)l&1&&(s+=o),l>>=1,o+=o;return s+o}function Wf(o,l,s,a){var f=l.href,h=l.title?gt(l.title):null,c=o[1].replace(/\\([\[\]])/g,"$1");if(o[0].charAt(0)!=="!"){a.state.inLink=!0;var d={type:"link",raw:s,href:f,title:h,text:c,tokens:a.inlineTokens(c)};return a.state.inLink=!1,d}return{type:"image",raw:s,href:f,title:h,text:gt(c)}}function mp(o,l){var s=o.match(/^(\s+)(?:```)/);if(s===null)return l;var a=s[1];return l.split(` +`),k=j+X.length,z=X[X.length-1].length;return{from:l(k,z),to:l(k+G.length-1,G.length==1?z+G[0].length:G[G.length-1].length),match:oe}}}}var x,C;String.prototype.normalize?(x=function(T){return T.normalize("NFD").toLowerCase()},C=function(T){return T.normalize("NFD")}):(x=function(T){return T.toLowerCase()},C=function(T){return T});function S(T,O,N,I){if(T.length==O.length)return N;for(var P=0,U=N+Math.max(0,T.length-O.length);;){if(P==U)return P;var j=P+U>>1,K=I(T.slice(0,j)).length;if(K==N)return j;K>N?U=j:P=j+1}}function F(T,O,N,I){if(!O.length)return null;var P=I?x:C,U=P(O).split(/\r|\n\r?/);e:for(var j=N.line,K=N.ch,de=T.lastLine()+1-U.length;j<=de;j++,K=0){var q=T.getLine(j).slice(K),oe=P(q);if(U.length==1){var X=oe.indexOf(U[0]);if(X==-1)continue e;var N=S(q,oe,X,P)+K;return{from:l(j,S(q,oe,X,P)+K),to:l(j,S(q,oe,X+U[0].length,P)+K)}}else{var G=oe.length-U[0].length;if(oe.slice(G)!=U[0])continue e;for(var k=1;k=de;j--,K=-1){var q=T.getLine(j);K>-1&&(q=q.slice(0,K));var oe=P(q);if(U.length==1){var X=oe.lastIndexOf(U[0]);if(X==-1)continue e;return{from:l(j,S(q,oe,X,P)),to:l(j,S(q,oe,X+U[0].length,P))}}else{var G=U[U.length-1];if(oe.slice(0,G.length)!=G)continue e;for(var k=1,N=j-U.length+1;k(this.doc.getLine(O.line)||"").length&&(O.ch=0,O.line++)),o.cmpPos(O,this.doc.clipPos(O))!=0))return this.atOccurrence=!1;var N=this.matches(T,O);if(this.afterEmptyMatch=N&&o.cmpPos(N.from,N.to)==0,N)return this.pos=N,this.atOccurrence=!0,this.pos.match||!0;var I=l(T?this.doc.firstLine():this.doc.lastLine()+1,0);return this.pos={from:I,to:I},this.atOccurrence=!1},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(T,O){if(this.atOccurrence){var N=o.splitLines(T);this.doc.replaceRange(N,this.pos.from,this.pos.to,O),this.pos.to=l(this.pos.from.line+N.length-1,N[N.length-1].length+(N.length==1?this.pos.from.ch:0))}}},o.defineExtension("getSearchCursor",function(T,O,N){return new L(this.doc,T,O,N)}),o.defineDocExtension("getSearchCursor",function(T,O,N){return new L(this,T,O,N)}),o.defineExtension("selectMatches",function(T,O){for(var N=[],I=this.getSearchCursor(T,this.getCursor("from"),O);I.findNext()&&!(o.cmpPos(I.to(),this.getCursor("to"))>0);)N.push({anchor:I.from(),head:I.to()});N.length&&this.setSelections(N,0)})})});var Mf=at((Tf,Lf)=>{(function(o){typeof Tf=="object"&&typeof Lf=="object"?o(At(),sl(),ul()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../markdown/markdown","../../addon/mode/overlay"],o):o(CodeMirror)})(function(o){"use strict";var l=/^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i;o.defineMode("gfm",function(s,a){var f=0;function h(y){return y.code=!1,null}var c={startState:function(){return{code:!1,codeBlock:!1,ateSpace:!1}},copyState:function(y){return{code:y.code,codeBlock:y.codeBlock,ateSpace:y.ateSpace}},token:function(y,x){if(x.combineTokens=null,x.codeBlock)return y.match(/^```+/)?(x.codeBlock=!1,null):(y.skipToEnd(),null);if(y.sol()&&(x.code=!1),y.sol()&&y.match(/^```+/))return y.skipToEnd(),x.codeBlock=!0,null;if(y.peek()==="`"){y.next();var C=y.pos;y.eatWhile("`");var S=1+y.pos-C;return x.code?S===f&&(x.code=!1):(f=S,x.code=!0),null}else if(x.code)return y.next(),null;if(y.eatSpace())return x.ateSpace=!0,null;if((y.sol()||x.ateSpace)&&(x.ateSpace=!1,a.gitHubSpice!==!1)){if(y.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?=.{0,6}\d)(?:[a-f0-9]{7,40}\b)/))return x.combineTokens=!0,"link";if(y.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/))return x.combineTokens=!0,"link"}return y.match(l)&&y.string.slice(y.start-2,y.start)!="]("&&(y.start==0||/\W/.test(y.string.charAt(y.start-1)))?(x.combineTokens=!0,"link"):(y.next(),null)},blankLine:h},d={taskLists:!0,strikethrough:!0,emoji:!0};for(var m in a)d[m]=a[m];return d.name="markdown",o.overlayMode(o.getMode(s,d),c)},"markdown"),o.defineMIME("text/x-gfm","gfm")})});var _f=at(()=>{});var Bf=at((Xg,cl)=>{var fl;(function(){"use strict";fl=function(o,l,s,a){a=a||{},this.dictionary=null,this.rules={},this.dictionaryTable=new Map,this.compoundRules=[],this.compoundRuleCodes={},this.replacementTable=[],this.flags=a.flags||{},this.memoized={},this.loaded=!1;var f=this,h,c,d,m,y;o&&(f.dictionary=o,l&&s?F():(typeof window<"u"?(a.dictionaryPath?h=a.dictionaryPath:h="typo/dictionaries",window.chrome&&window.chrome.runtime&&window.chrome.runtime.getURL?h=window.chrome.runtime.getURL(h):window.browser&&window.browser.runtime&&window.browser.runtime.getURL&&(h=window.browser.runtime.getURL(h))):typeof __dirname<"u"?h=__dirname+"/dictionaries":h="./dictionaries",l||x(h+"/"+o+"/"+o+".aff",C),s||x(h+"/"+o+"/"+o+".dic",S)));function x(_,L){var T=f._readFile(_,null,a?.asyncLoad);a?.asyncLoad?T.then(function(O){L(O)}):L(T)}function C(_){l=_,s&&F()}function S(_){s=_,l&&F()}function F(){for(f.rules=f._parseAFF(l),f.compoundRuleCodes={},c=0,m=f.compoundRules.length;c0&&(U.continuationClasses=I),P!=="."&&(S==="SFX"?U.match=new RegExp(P+"$"):U.match=new RegExp("^"+P)),T!="0"&&(S==="SFX"?U.remove=new RegExp(T+"$"):U.remove=T),L.push(U)}l[F]={type:S,combineable:_==="Y",entries:L},c+=f}else if(S==="COMPOUNDRULE"){for(f=parseInt(C[1],10),d=c+1,y=c+1+f;d0&&(s.get(oe)===null&&s.set(oe,[]),s.get(oe).push(X))}for(var f=1,h=l.length;f1){var x=this.parseRuleCodes(m[1]);(!("NEEDAFFIX"in this.flags)||x.indexOf(this.flags.NEEDAFFIX)===-1)&&a(y,x);for(var C=0,S=x.length;C"u"){if("COMPOUNDMIN"in this.flags&&o.length>=this.flags.COMPOUNDMIN){for(s=0,a=this.compoundRules.length;s"u"&&(s=Array.prototype.concat.apply([],this.dictionaryTable.get(o))),s&&s.indexOf(this.flags[l])!==-1))},alphabet:"",suggest:function(o,l){if(!this.loaded)throw"Dictionary not loaded.";if(l=l||5,this.memoized.hasOwnProperty(o)){var s=this.memoized[o].limit;if(l<=s||this.memoized[o].suggestions.length1&&K[1][1]!==K[1][0]&&(P=K[0]+K[1][1]+K[1][0]+K[1].substring(2),(!F||y.check(P))&&(P in _?_[P]+=1:_[P]=1)),K[1]){var de=K[1].substring(0,1).toUpperCase()===K[1].substring(0,1)?"uppercase":"lowercase";for(T=0;TG?1:oe[0].localeCompare(q[0])}P.sort(U).reverse();var j=[],K="lowercase";S.toUpperCase()===S?K="uppercase":S.substr(0,1).toUpperCase()+S.substr(1).toLowerCase()===S&&(K="capitalized");var de=l;for(N=0;N{"use strict";var Nf=Bf();function Ie(o){if(o=o||{},typeof o.codeMirrorInstance!="function"||typeof o.codeMirrorInstance.defineMode!="function"){console.log("CodeMirror Spell Checker: You must provide an instance of CodeMirror via the option `codeMirrorInstance`");return}String.prototype.includes||(String.prototype.includes=function(){"use strict";return String.prototype.indexOf.apply(this,arguments)!==-1}),o.codeMirrorInstance.defineMode("spell-checker",function(l){if(!Ie.aff_loading){Ie.aff_loading=!0;var s=new XMLHttpRequest;s.open("GET","https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.aff",!0),s.onload=function(){s.readyState===4&&s.status===200&&(Ie.aff_data=s.responseText,Ie.num_loaded++,Ie.num_loaded==2&&(Ie.typo=new Nf("en_US",Ie.aff_data,Ie.dic_data,{platform:"any"})))},s.send(null)}if(!Ie.dic_loading){Ie.dic_loading=!0;var a=new XMLHttpRequest;a.open("GET","https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.dic",!0),a.onload=function(){a.readyState===4&&a.status===200&&(Ie.dic_data=a.responseText,Ie.num_loaded++,Ie.num_loaded==2&&(Ie.typo=new Nf("en_US",Ie.aff_data,Ie.dic_data,{platform:"any"})))},a.send(null)}var f='!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~ ',h={token:function(d){var m=d.peek(),y="";if(f.includes(m))return d.next(),null;for(;(m=d.peek())!=null&&!f.includes(m);)y+=m,d.next();return Ie.typo&&!Ie.typo.check(y)?"spell-error":null}},c=o.codeMirrorInstance.getMode(l,l.backdrop||"text/plain");return o.codeMirrorInstance.overlayMode(c,h,!0)})}Ie.num_loaded=0;Ie.aff_loading=!1;Ie.dic_loading=!1;Ie.aff_data="";Ie.dic_data="";Ie.typo;Of.exports=Ie});var Zf=at(Be=>{"use strict";function Pf(o,l){for(var s=0;so.length)&&(l=o.length);for(var s=0,a=new Array(l);s=o.length?{done:!0}:{done:!1,value:o[a++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tp(o,l){if(typeof o!="object"||o===null)return o;var s=o[Symbol.toPrimitive];if(s!==void 0){var a=s.call(o,l||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(o)}function rp(o){var l=tp(o,"string");return typeof l=="symbol"?l:String(l)}function dl(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}Be.defaults=dl();function np(o){Be.defaults=o}var Gf=/[&<>"']/,ip=new RegExp(Gf.source,"g"),Xf=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,op=new RegExp(Xf.source,"g"),ap={"&":"&","<":"<",">":">",'"':""","'":"'"},Hf=function(l){return ap[l]};function gt(o,l){if(l){if(Gf.test(o))return o.replace(ip,Hf)}else if(Xf.test(o))return o.replace(op,Hf);return o}var lp=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Kf(o){return o.replace(lp,function(l,s){return s=s.toLowerCase(),s==="colon"?":":s.charAt(0)==="#"?s.charAt(1)==="x"?String.fromCharCode(parseInt(s.substring(2),16)):String.fromCharCode(+s.substring(1)):""})}var sp=/(^|[^\[])\^/g;function Me(o,l){o=typeof o=="string"?o:o.source,l=l||"";var s={replace:function(f,h){return h=h.source||h,h=h.replace(sp,"$1"),o=o.replace(f,h),s},getRegex:function(){return new RegExp(o,l)}};return s}var up=/[^\w:]/g,fp=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function Rf(o,l,s){if(o){var a;try{a=decodeURIComponent(Kf(s)).replace(up,"").toLowerCase()}catch{return null}if(a.indexOf("javascript:")===0||a.indexOf("vbscript:")===0||a.indexOf("data:")===0)return null}l&&!fp.test(s)&&(s=pp(l,s));try{s=encodeURI(s).replace(/%25/g,"%")}catch{return null}return s}var ao={},cp=/^[^:]+:\/*[^/]*$/,dp=/^([^:]+:)[\s\S]*$/,hp=/^([^:]+:\/*[^/]*)[\s\S]*$/;function pp(o,l){ao[" "+o]||(cp.test(o)?ao[" "+o]=o+"/":ao[" "+o]=lo(o,"/",!0)),o=ao[" "+o];var s=o.indexOf(":")===-1;return l.substring(0,2)==="//"?s?l:o.replace(dp,"$1")+l:l.charAt(0)==="/"?s?l:o.replace(hp,"$1")+l:o+l}var so={exec:function(){}};function Wf(o,l){var s=o.replace(/\|/g,function(h,c,d){for(var m=!1,y=c;--y>=0&&d[y]==="\\";)m=!m;return m?"|":" |"}),a=s.split(/ \|/),f=0;if(a[0].trim()||a.shift(),a.length>0&&!a[a.length-1].trim()&&a.pop(),a.length>l)a.splice(l);else for(;a.length1;)l&1&&(s+=o),l>>=1,o+=o;return s+o}function Uf(o,l,s,a){var f=l.href,h=l.title?gt(l.title):null,c=o[1].replace(/\\([\[\]])/g,"$1");if(o[0].charAt(0)!=="!"){a.state.inLink=!0;var d={type:"link",raw:s,href:f,title:h,text:c,tokens:a.inlineTokens(c)};return a.state.inLink=!1,d}return{type:"image",raw:s,href:f,title:h,text:gt(c)}}function mp(o,l){var s=o.match(/^(\s+)(?:```)/);if(s===null)return l;var a=s[1];return l.split(` `).map(function(f){var h=f.match(/^\s+/);if(h===null)return f;var c=h[0];return c.length>=a.length?f.slice(a.length):f}).join(` -`)}var so=function(){function o(s){this.options=s||_e.defaults}var l=o.prototype;return l.space=function(a){var f=this.rules.block.newline.exec(a);if(f&&f[0].length>0)return{type:"space",raw:f[0]}},l.code=function(a){var f=this.rules.block.code.exec(a);if(f){var h=f[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:f[0],codeBlockStyle:"indented",text:this.options.pedantic?h:ao(h,` -`)}}},l.fences=function(a){var f=this.rules.block.fences.exec(a);if(f){var h=f[0],c=mp(h,f[3]||"");return{type:"code",raw:h,lang:f[2]?f[2].trim().replace(this.rules.inline._escapes,"$1"):f[2],text:c}}},l.heading=function(a){var f=this.rules.block.heading.exec(a);if(f){var h=f[2].trim();if(/#$/.test(h)){var c=ao(h,"#");(this.options.pedantic||!c||/ $/.test(c))&&(h=c.trim())}return{type:"heading",raw:f[0],depth:f[1].length,text:h,tokens:this.lexer.inline(h)}}},l.hr=function(a){var f=this.rules.block.hr.exec(a);if(f)return{type:"hr",raw:f[0]}},l.blockquote=function(a){var f=this.rules.block.blockquote.exec(a);if(f){var h=f[0].replace(/^ *>[ \t]?/gm,""),c=this.lexer.state.top;this.lexer.state.top=!0;var d=this.lexer.blockTokens(h);return this.lexer.state.top=c,{type:"blockquote",raw:f[0],tokens:d,text:h}}},l.list=function(a){var f=this.rules.block.list.exec(a);if(f){var h,c,d,v,y,x,D,S,F,B,L,T,N=f[1].trim(),z=N.length>1,O={type:"list",raw:"",ordered:z,start:z?+N.slice(0,-1):"",loose:!1,items:[]};N=z?"\\d{1,9}\\"+N.slice(-1):"\\"+N,this.options.pedantic&&(N=z?N:"[*+-]");for(var I=new RegExp("^( {0,3}"+N+")((?:[ ][^\\n]*)?(?:\\n|$))");a&&(T=!1,!(!(f=I.exec(a))||this.rules.block.hr.test(a)));){if(h=f[0],a=a.substring(h.length),S=f[2].split(` +`)}var uo=function(){function o(s){this.options=s||Be.defaults}var l=o.prototype;return l.space=function(a){var f=this.rules.block.newline.exec(a);if(f&&f[0].length>0)return{type:"space",raw:f[0]}},l.code=function(a){var f=this.rules.block.code.exec(a);if(f){var h=f[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:f[0],codeBlockStyle:"indented",text:this.options.pedantic?h:lo(h,` +`)}}},l.fences=function(a){var f=this.rules.block.fences.exec(a);if(f){var h=f[0],c=mp(h,f[3]||"");return{type:"code",raw:h,lang:f[2]?f[2].trim().replace(this.rules.inline._escapes,"$1"):f[2],text:c}}},l.heading=function(a){var f=this.rules.block.heading.exec(a);if(f){var h=f[2].trim();if(/#$/.test(h)){var c=lo(h,"#");(this.options.pedantic||!c||/ $/.test(c))&&(h=c.trim())}return{type:"heading",raw:f[0],depth:f[1].length,text:h,tokens:this.lexer.inline(h)}}},l.hr=function(a){var f=this.rules.block.hr.exec(a);if(f)return{type:"hr",raw:f[0]}},l.blockquote=function(a){var f=this.rules.block.blockquote.exec(a);if(f){var h=f[0].replace(/^ *>[ \t]?/gm,""),c=this.lexer.state.top;this.lexer.state.top=!0;var d=this.lexer.blockTokens(h);return this.lexer.state.top=c,{type:"blockquote",raw:f[0],tokens:d,text:h}}},l.list=function(a){var f=this.rules.block.list.exec(a);if(f){var h,c,d,m,y,x,C,S,F,_,L,T,O=f[1].trim(),N=O.length>1,I={type:"list",raw:"",ordered:N,start:N?+O.slice(0,-1):"",loose:!1,items:[]};O=N?"\\d{1,9}\\"+O.slice(-1):"\\"+O,this.options.pedantic&&(O=N?O:"[*+-]");for(var P=new RegExp("^( {0,3}"+O+")((?:[ ][^\\n]*)?(?:\\n|$))");a&&(T=!1,!(!(f=P.exec(a))||this.rules.block.hr.test(a)));){if(h=f[0],a=a.substring(h.length),S=f[2].split(` `,1)[0].replace(/^\t+/,function(G){return" ".repeat(3*G.length)}),F=a.split(` -`,1)[0],this.options.pedantic?(v=2,L=S.trimLeft()):(v=f[2].search(/[^ ]/),v=v>4?1:v,L=S.slice(v),v+=f[1].length),x=!1,!S&&/^ *$/.test(F)&&(h+=F+` -`,a=a.substring(F.length+1),T=!0),!T)for(var U=new RegExp("^ {0,"+Math.min(3,v-1)+"}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))"),j=new RegExp("^ {0,"+Math.min(3,v-1)+"}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)"),K=new RegExp("^ {0,"+Math.min(3,v-1)+"}(?:```|~~~)"),de=new RegExp("^ {0,"+Math.min(3,v-1)+"}#");a&&(B=a.split(` -`,1)[0],F=B,this.options.pedantic&&(F=F.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!(K.test(F)||de.test(F)||U.test(F)||j.test(a)));){if(F.search(/[^ ]/)>=v||!F.trim())L+=` -`+F.slice(v);else{if(x||S.search(/[^ ]/)>=4||K.test(S)||de.test(S)||j.test(S))break;L+=` -`+F}!x&&!F.trim()&&(x=!0),h+=B+` -`,a=a.substring(B.length+1),S=F.slice(v)}O.loose||(D?O.loose=!0:/\n *\n *$/.test(h)&&(D=!0)),this.options.gfm&&(c=/^\[[ xX]\] /.exec(L),c&&(d=c[0]!=="[ ] ",L=L.replace(/^\[[ xX]\] +/,""))),O.items.push({type:"list_item",raw:h,task:!!c,checked:d,loose:!1,text:L}),O.raw+=h}O.items[O.items.length-1].raw=h.trimRight(),O.items[O.items.length-1].text=L.trimRight(),O.raw=O.raw.trimRight();var W=O.items.length;for(y=0;y0&&oe.some(function(G){return/\n.*\n/.test(G.raw)});O.loose=X}if(O.loose)for(y=0;y$/,"$1").replace(this.rules.inline._escapes,"$1"):"",d=f[3]?f[3].substring(1,f[3].length-1).replace(this.rules.inline._escapes,"$1"):f[3];return{type:"def",tag:h,raw:f[0],href:c,title:d}}},l.table=function(a){var f=this.rules.block.table.exec(a);if(f){var h={type:"table",header:qf(f[1]).map(function(D){return{text:D}}),align:f[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:f[3]&&f[3].trim()?f[3].replace(/\n[ \t]*$/,"").split(` -`):[]};if(h.header.length===h.align.length){h.raw=f[0];var c=h.align.length,d,v,y,x;for(d=0;d/i.test(f[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(f[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(f[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:f[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(f[0]):gt(f[0]):f[0]}},l.link=function(a){var f=this.rules.inline.link.exec(a);if(f){var h=f[2].trim();if(!this.options.pedantic&&/^$/.test(h))return;var c=ao(h.slice(0,-1),"\\");if((h.length-c.length)%2===0)return}else{var d=pp(f[2],"()");if(d>-1){var v=f[0].indexOf("!")===0?5:4,y=v+f[1].length+d;f[2]=f[2].substring(0,d),f[0]=f[0].substring(0,y).trim(),f[3]=""}}var x=f[2],D="";if(this.options.pedantic){var S=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(x);S&&(x=S[1],D=S[3])}else D=f[3]?f[3].slice(1,-1):"";return x=x.trim(),/^$/.test(h)?x=x.slice(1):x=x.slice(1,-1)),Wf(f,{href:x&&x.replace(this.rules.inline._escapes,"$1"),title:D&&D.replace(this.rules.inline._escapes,"$1")},f[0],this.lexer)}},l.reflink=function(a,f){var h;if((h=this.rules.inline.reflink.exec(a))||(h=this.rules.inline.nolink.exec(a))){var c=(h[2]||h[1]).replace(/\s+/g," ");if(c=f[c.toLowerCase()],!c){var d=h[0].charAt(0);return{type:"text",raw:d,text:d}}return Wf(h,c,h[0],this.lexer)}},l.emStrong=function(a,f,h){h===void 0&&(h="");var c=this.rules.inline.emStrong.lDelim.exec(a);if(c&&!(c[3]&&h.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\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\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\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\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\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-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\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\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDF70-\uDF81\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD837[\uDF00-\uDF1E]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/))){var d=c[1]||c[2]||"";if(!d||d&&(h===""||this.rules.inline.punctuation.exec(h))){var v=c[0].length-1,y,x,D=v,S=0,F=c[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(F.lastIndex=0,f=f.slice(-1*a.length+v);(c=F.exec(f))!=null;)if(y=c[1]||c[2]||c[3]||c[4]||c[5]||c[6],!!y){if(x=y.length,c[3]||c[4]){D+=x;continue}else if((c[5]||c[6])&&v%3&&!((v+x)%3)){S+=x;continue}if(D-=x,!(D>0)){x=Math.min(x,x+D+S);var B=a.slice(0,v+c.index+(c[0].length-y.length)+x);if(Math.min(v,x)%2){var L=B.slice(1,-1);return{type:"em",raw:B,text:L,tokens:this.lexer.inlineTokens(L)}}var T=B.slice(2,-2);return{type:"strong",raw:B,text:T,tokens:this.lexer.inlineTokens(T)}}}}}},l.codespan=function(a){var f=this.rules.inline.code.exec(a);if(f){var h=f[2].replace(/\n/g," "),c=/[^ ]/.test(h),d=/^ /.test(h)&&/ $/.test(h);return c&&d&&(h=h.substring(1,h.length-1)),h=gt(h,!0),{type:"codespan",raw:f[0],text:h}}},l.br=function(a){var f=this.rules.inline.br.exec(a);if(f)return{type:"br",raw:f[0]}},l.del=function(a){var f=this.rules.inline.del.exec(a);if(f)return{type:"del",raw:f[0],text:f[2],tokens:this.lexer.inlineTokens(f[2])}},l.autolink=function(a,f){var h=this.rules.inline.autolink.exec(a);if(h){var c,d;return h[2]==="@"?(c=gt(this.options.mangle?f(h[1]):h[1]),d="mailto:"+c):(c=gt(h[1]),d=c),{type:"link",raw:h[0],text:c,href:d,tokens:[{type:"text",raw:c,text:c}]}}},l.url=function(a,f){var h;if(h=this.rules.inline.url.exec(a)){var c,d;if(h[2]==="@")c=gt(this.options.mangle?f(h[0]):h[0]),d="mailto:"+c;else{var v;do v=h[0],h[0]=this.rules.inline._backpedal.exec(h[0])[0];while(v!==h[0]);c=gt(h[0]),h[1]==="www."?d="http://"+h[0]:d=h[0]}return{type:"link",raw:h[0],text:c,href:d,tokens:[{type:"text",raw:c,text:c}]}}},l.inlineText=function(a,f){var h=this.rules.inline.text.exec(a);if(h){var c;return this.lexer.state.inRawBlock?c=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(h[0]):gt(h[0]):h[0]:c=gt(this.options.smartypants?f(h[0]):h[0]),{type:"text",raw:h[0],text:c}}},o}(),ce={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:lo,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/};ce._label=/(?!\s*\])(?:\\.|[^\[\]\\])+/;ce._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;ce.def=Me(ce.def).replace("label",ce._label).replace("title",ce._title).getRegex();ce.bullet=/(?:[*+-]|\d{1,9}[.)])/;ce.listItemStart=Me(/^( *)(bull) */).replace("bull",ce.bullet).getRegex();ce.list=Me(ce.list).replace(/bull/g,ce.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ce.def.source+")").getRegex();ce._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";ce._comment=/|$)/;ce.html=Me(ce.html,"i").replace("comment",ce._comment).replace("tag",ce._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();ce.paragraph=Me(ce._paragraph).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ce._tag).getRegex();ce.blockquote=Me(ce.blockquote).replace("paragraph",ce.paragraph).getRegex();ce.normal=_t({},ce);ce.gfm=_t({},ce.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"});ce.gfm.table=Me(ce.gfm.table).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ce._tag).getRegex();ce.gfm.paragraph=Me(ce._paragraph).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",ce.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ce._tag).getRegex();ce.pedantic=_t({},ce.normal,{html:Me(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ce._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:lo,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Me(ce.normal._paragraph).replace("hr",ce.hr).replace("heading",` *#{1,6} *[^ -]`).replace("lheading",ce.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var ne={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:lo,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,rDelimUnd:/^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:lo,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~";ne.punctuation=Me(ne.punctuation).replace(/punctuation/g,ne._punctuation).getRegex();ne.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;ne.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g;ne._comment=Me(ce._comment).replace("(?:-->|$)","-->").getRegex();ne.emStrong.lDelim=Me(ne.emStrong.lDelim).replace(/punct/g,ne._punctuation).getRegex();ne.emStrong.rDelimAst=Me(ne.emStrong.rDelimAst,"g").replace(/punct/g,ne._punctuation).getRegex();ne.emStrong.rDelimUnd=Me(ne.emStrong.rDelimUnd,"g").replace(/punct/g,ne._punctuation).getRegex();ne._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;ne._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;ne._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;ne.autolink=Me(ne.autolink).replace("scheme",ne._scheme).replace("email",ne._email).getRegex();ne._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;ne.tag=Me(ne.tag).replace("comment",ne._comment).replace("attribute",ne._attribute).getRegex();ne._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;ne._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;ne._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;ne.link=Me(ne.link).replace("label",ne._label).replace("href",ne._href).replace("title",ne._title).getRegex();ne.reflink=Me(ne.reflink).replace("label",ne._label).replace("ref",ce._label).getRegex();ne.nolink=Me(ne.nolink).replace("ref",ce._label).getRegex();ne.reflinkSearch=Me(ne.reflinkSearch,"g").replace("reflink",ne.reflink).replace("nolink",ne.nolink).getRegex();ne.normal=_t({},ne);ne.pedantic=_t({},ne.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Me(/^!?\[(label)\]\((.*?)\)/).replace("label",ne._label).getRegex(),reflink:Me(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ne._label).getRegex()});ne.gfm=_t({},ne.normal,{escape:Me(ne.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\.5&&(a="x"+a.toString(16)),l+="&#"+a+";";return l}var yi=function(){function o(s){this.tokens=[],this.tokens.links=Object.create(null),this.options=s||_e.defaults,this.options.tokenizer=this.options.tokenizer||new so,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};var a={block:ce.normal,inline:ne.normal};this.options.pedantic?(a.block=ce.pedantic,a.inline=ne.pedantic):this.options.gfm&&(a.block=ce.gfm,this.options.breaks?a.inline=ne.breaks:a.inline=ne.gfm),this.tokenizer.rules=a}o.lex=function(a,f){var h=new o(f);return h.lex(a)},o.lexInline=function(a,f){var h=new o(f);return h.inlineTokens(a)};var l=o.prototype;return l.lex=function(a){a=a.replace(/\r\n|\r/g,` -`),this.blockTokens(a,this.tokens);for(var f;f=this.inlineQueue.shift();)this.inlineTokens(f.src,f.tokens);return this.tokens},l.blockTokens=function(a,f){var h=this;f===void 0&&(f=[]),this.options.pedantic?a=a.replace(/\t/g," ").replace(/^ +$/gm,""):a=a.replace(/^( *)(\t+)/gm,function(D,S,F){return S+" ".repeat(F.length)});for(var c,d,v,y;a;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(function(D){return(c=D.call({lexer:h},a,f))?(a=a.substring(c.raw.length),f.push(c),!0):!1}))){if(c=this.tokenizer.space(a)){a=a.substring(c.raw.length),c.raw.length===1&&f.length>0?f[f.length-1].raw+=` +`,1)[0],this.options.pedantic?(m=2,L=S.trimLeft()):(m=f[2].search(/[^ ]/),m=m>4?1:m,L=S.slice(m),m+=f[1].length),x=!1,!S&&/^ *$/.test(F)&&(h+=F+` +`,a=a.substring(F.length+1),T=!0),!T)for(var U=new RegExp("^ {0,"+Math.min(3,m-1)+"}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))"),j=new RegExp("^ {0,"+Math.min(3,m-1)+"}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)"),K=new RegExp("^ {0,"+Math.min(3,m-1)+"}(?:```|~~~)"),de=new RegExp("^ {0,"+Math.min(3,m-1)+"}#");a&&(_=a.split(` +`,1)[0],F=_,this.options.pedantic&&(F=F.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!(K.test(F)||de.test(F)||U.test(F)||j.test(a)));){if(F.search(/[^ ]/)>=m||!F.trim())L+=` +`+F.slice(m);else{if(x||S.search(/[^ ]/)>=4||K.test(S)||de.test(S)||j.test(S))break;L+=` +`+F}!x&&!F.trim()&&(x=!0),h+=_+` +`,a=a.substring(_.length+1),S=F.slice(m)}I.loose||(C?I.loose=!0:/\n *\n *$/.test(h)&&(C=!0)),this.options.gfm&&(c=/^\[[ xX]\] /.exec(L),c&&(d=c[0]!=="[ ] ",L=L.replace(/^\[[ xX]\] +/,""))),I.items.push({type:"list_item",raw:h,task:!!c,checked:d,loose:!1,text:L}),I.raw+=h}I.items[I.items.length-1].raw=h.trimRight(),I.items[I.items.length-1].text=L.trimRight(),I.raw=I.raw.trimRight();var q=I.items.length;for(y=0;y0&&oe.some(function(G){return/\n.*\n/.test(G.raw)});I.loose=X}if(I.loose)for(y=0;y$/,"$1").replace(this.rules.inline._escapes,"$1"):"",d=f[3]?f[3].substring(1,f[3].length-1).replace(this.rules.inline._escapes,"$1"):f[3];return{type:"def",tag:h,raw:f[0],href:c,title:d}}},l.table=function(a){var f=this.rules.block.table.exec(a);if(f){var h={type:"table",header:Wf(f[1]).map(function(C){return{text:C}}),align:f[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:f[3]&&f[3].trim()?f[3].replace(/\n[ \t]*$/,"").split(` +`):[]};if(h.header.length===h.align.length){h.raw=f[0];var c=h.align.length,d,m,y,x;for(d=0;d/i.test(f[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(f[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(f[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:f[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(f[0]):gt(f[0]):f[0]}},l.link=function(a){var f=this.rules.inline.link.exec(a);if(f){var h=f[2].trim();if(!this.options.pedantic&&/^$/.test(h))return;var c=lo(h.slice(0,-1),"\\");if((h.length-c.length)%2===0)return}else{var d=gp(f[2],"()");if(d>-1){var m=f[0].indexOf("!")===0?5:4,y=m+f[1].length+d;f[2]=f[2].substring(0,d),f[0]=f[0].substring(0,y).trim(),f[3]=""}}var x=f[2],C="";if(this.options.pedantic){var S=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(x);S&&(x=S[1],C=S[3])}else C=f[3]?f[3].slice(1,-1):"";return x=x.trim(),/^$/.test(h)?x=x.slice(1):x=x.slice(1,-1)),Uf(f,{href:x&&x.replace(this.rules.inline._escapes,"$1"),title:C&&C.replace(this.rules.inline._escapes,"$1")},f[0],this.lexer)}},l.reflink=function(a,f){var h;if((h=this.rules.inline.reflink.exec(a))||(h=this.rules.inline.nolink.exec(a))){var c=(h[2]||h[1]).replace(/\s+/g," ");if(c=f[c.toLowerCase()],!c){var d=h[0].charAt(0);return{type:"text",raw:d,text:d}}return Uf(h,c,h[0],this.lexer)}},l.emStrong=function(a,f,h){h===void 0&&(h="");var c=this.rules.inline.emStrong.lDelim.exec(a);if(c&&!(c[3]&&h.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\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\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\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\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\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-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\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\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDF70-\uDF81\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD837[\uDF00-\uDF1E]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/))){var d=c[1]||c[2]||"";if(!d||d&&(h===""||this.rules.inline.punctuation.exec(h))){var m=c[0].length-1,y,x,C=m,S=0,F=c[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(F.lastIndex=0,f=f.slice(-1*a.length+m);(c=F.exec(f))!=null;)if(y=c[1]||c[2]||c[3]||c[4]||c[5]||c[6],!!y){if(x=y.length,c[3]||c[4]){C+=x;continue}else if((c[5]||c[6])&&m%3&&!((m+x)%3)){S+=x;continue}if(C-=x,!(C>0)){x=Math.min(x,x+C+S);var _=a.slice(0,m+c.index+(c[0].length-y.length)+x);if(Math.min(m,x)%2){var L=_.slice(1,-1);return{type:"em",raw:_,text:L,tokens:this.lexer.inlineTokens(L)}}var T=_.slice(2,-2);return{type:"strong",raw:_,text:T,tokens:this.lexer.inlineTokens(T)}}}}}},l.codespan=function(a){var f=this.rules.inline.code.exec(a);if(f){var h=f[2].replace(/\n/g," "),c=/[^ ]/.test(h),d=/^ /.test(h)&&/ $/.test(h);return c&&d&&(h=h.substring(1,h.length-1)),h=gt(h,!0),{type:"codespan",raw:f[0],text:h}}},l.br=function(a){var f=this.rules.inline.br.exec(a);if(f)return{type:"br",raw:f[0]}},l.del=function(a){var f=this.rules.inline.del.exec(a);if(f)return{type:"del",raw:f[0],text:f[2],tokens:this.lexer.inlineTokens(f[2])}},l.autolink=function(a,f){var h=this.rules.inline.autolink.exec(a);if(h){var c,d;return h[2]==="@"?(c=gt(this.options.mangle?f(h[1]):h[1]),d="mailto:"+c):(c=gt(h[1]),d=c),{type:"link",raw:h[0],text:c,href:d,tokens:[{type:"text",raw:c,text:c}]}}},l.url=function(a,f){var h;if(h=this.rules.inline.url.exec(a)){var c,d;if(h[2]==="@")c=gt(this.options.mangle?f(h[0]):h[0]),d="mailto:"+c;else{var m;do m=h[0],h[0]=this.rules.inline._backpedal.exec(h[0])[0];while(m!==h[0]);c=gt(h[0]),h[1]==="www."?d="http://"+h[0]:d=h[0]}return{type:"link",raw:h[0],text:c,href:d,tokens:[{type:"text",raw:c,text:c}]}}},l.inlineText=function(a,f){var h=this.rules.inline.text.exec(a);if(h){var c;return this.lexer.state.inRawBlock?c=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(h[0]):gt(h[0]):h[0]:c=gt(this.options.smartypants?f(h[0]):h[0]),{type:"text",raw:h[0],text:c}}},o}(),ce={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:so,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/};ce._label=/(?!\s*\])(?:\\.|[^\[\]\\])+/;ce._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;ce.def=Me(ce.def).replace("label",ce._label).replace("title",ce._title).getRegex();ce.bullet=/(?:[*+-]|\d{1,9}[.)])/;ce.listItemStart=Me(/^( *)(bull) */).replace("bull",ce.bullet).getRegex();ce.list=Me(ce.list).replace(/bull/g,ce.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ce.def.source+")").getRegex();ce._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";ce._comment=/|$)/;ce.html=Me(ce.html,"i").replace("comment",ce._comment).replace("tag",ce._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();ce.paragraph=Me(ce._paragraph).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ce._tag).getRegex();ce.blockquote=Me(ce.blockquote).replace("paragraph",ce.paragraph).getRegex();ce.normal=Bt({},ce);ce.gfm=Bt({},ce.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"});ce.gfm.table=Me(ce.gfm.table).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ce._tag).getRegex();ce.gfm.paragraph=Me(ce._paragraph).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",ce.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ce._tag).getRegex();ce.pedantic=Bt({},ce.normal,{html:Me(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ce._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:so,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Me(ce.normal._paragraph).replace("hr",ce.hr).replace("heading",` *#{1,6} *[^ +]`).replace("lheading",ce.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var ie={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:so,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,rDelimUnd:/^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:so,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~";ie.punctuation=Me(ie.punctuation).replace(/punctuation/g,ie._punctuation).getRegex();ie.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;ie.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g;ie._comment=Me(ce._comment).replace("(?:-->|$)","-->").getRegex();ie.emStrong.lDelim=Me(ie.emStrong.lDelim).replace(/punct/g,ie._punctuation).getRegex();ie.emStrong.rDelimAst=Me(ie.emStrong.rDelimAst,"g").replace(/punct/g,ie._punctuation).getRegex();ie.emStrong.rDelimUnd=Me(ie.emStrong.rDelimUnd,"g").replace(/punct/g,ie._punctuation).getRegex();ie._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;ie._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;ie._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;ie.autolink=Me(ie.autolink).replace("scheme",ie._scheme).replace("email",ie._email).getRegex();ie._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;ie.tag=Me(ie.tag).replace("comment",ie._comment).replace("attribute",ie._attribute).getRegex();ie._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;ie._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;ie._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;ie.link=Me(ie.link).replace("label",ie._label).replace("href",ie._href).replace("title",ie._title).getRegex();ie.reflink=Me(ie.reflink).replace("label",ie._label).replace("ref",ce._label).getRegex();ie.nolink=Me(ie.nolink).replace("ref",ce._label).getRegex();ie.reflinkSearch=Me(ie.reflinkSearch,"g").replace("reflink",ie.reflink).replace("nolink",ie.nolink).getRegex();ie.normal=Bt({},ie);ie.pedantic=Bt({},ie.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Me(/^!?\[(label)\]\((.*?)\)/).replace("label",ie._label).getRegex(),reflink:Me(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ie._label).getRegex()});ie.gfm=Bt({},ie.normal,{escape:Me(ie.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\.5&&(a="x"+a.toString(16)),l+="&#"+a+";";return l}var xn=function(){function o(s){this.tokens=[],this.tokens.links=Object.create(null),this.options=s||Be.defaults,this.options.tokenizer=this.options.tokenizer||new uo,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};var a={block:ce.normal,inline:ie.normal};this.options.pedantic?(a.block=ce.pedantic,a.inline=ie.pedantic):this.options.gfm&&(a.block=ce.gfm,this.options.breaks?a.inline=ie.breaks:a.inline=ie.gfm),this.tokenizer.rules=a}o.lex=function(a,f){var h=new o(f);return h.lex(a)},o.lexInline=function(a,f){var h=new o(f);return h.inlineTokens(a)};var l=o.prototype;return l.lex=function(a){a=a.replace(/\r\n|\r/g,` +`),this.blockTokens(a,this.tokens);for(var f;f=this.inlineQueue.shift();)this.inlineTokens(f.src,f.tokens);return this.tokens},l.blockTokens=function(a,f){var h=this;f===void 0&&(f=[]),this.options.pedantic?a=a.replace(/\t/g," ").replace(/^ +$/gm,""):a=a.replace(/^( *)(\t+)/gm,function(C,S,F){return S+" ".repeat(F.length)});for(var c,d,m,y;a;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(function(C){return(c=C.call({lexer:h},a,f))?(a=a.substring(c.raw.length),f.push(c),!0):!1}))){if(c=this.tokenizer.space(a)){a=a.substring(c.raw.length),c.raw.length===1&&f.length>0?f[f.length-1].raw+=` `:f.push(c);continue}if(c=this.tokenizer.code(a)){a=a.substring(c.raw.length),d=f[f.length-1],d&&(d.type==="paragraph"||d.type==="text")?(d.raw+=` `+c.raw,d.text+=` `+c.text,this.inlineQueue[this.inlineQueue.length-1].src=d.text):f.push(c);continue}if(c=this.tokenizer.fences(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.heading(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.hr(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.blockquote(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.list(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.html(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.def(a)){a=a.substring(c.raw.length),d=f[f.length-1],d&&(d.type==="paragraph"||d.type==="text")?(d.raw+=` `+c.raw,d.text+=` -`+c.raw,this.inlineQueue[this.inlineQueue.length-1].src=d.text):this.tokens.links[c.tag]||(this.tokens.links[c.tag]={href:c.href,title:c.title});continue}if(c=this.tokenizer.table(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.lheading(a)){a=a.substring(c.raw.length),f.push(c);continue}if(v=a,this.options.extensions&&this.options.extensions.startBlock&&function(){var D=1/0,S=a.slice(1),F=void 0;h.options.extensions.startBlock.forEach(function(B){F=B.call({lexer:this},S),typeof F=="number"&&F>=0&&(D=Math.min(D,F))}),D<1/0&&D>=0&&(v=a.substring(0,D+1))}(),this.state.top&&(c=this.tokenizer.paragraph(v))){d=f[f.length-1],y&&d.type==="paragraph"?(d.raw+=` +`+c.raw,this.inlineQueue[this.inlineQueue.length-1].src=d.text):this.tokens.links[c.tag]||(this.tokens.links[c.tag]={href:c.href,title:c.title});continue}if(c=this.tokenizer.table(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.lheading(a)){a=a.substring(c.raw.length),f.push(c);continue}if(m=a,this.options.extensions&&this.options.extensions.startBlock&&function(){var C=1/0,S=a.slice(1),F=void 0;h.options.extensions.startBlock.forEach(function(_){F=_.call({lexer:this},S),typeof F=="number"&&F>=0&&(C=Math.min(C,F))}),C<1/0&&C>=0&&(m=a.substring(0,C+1))}(),this.state.top&&(c=this.tokenizer.paragraph(m))){d=f[f.length-1],y&&d.type==="paragraph"?(d.raw+=` `+c.raw,d.text+=` -`+c.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=d.text):f.push(c),y=v.length!==a.length,a=a.substring(c.raw.length);continue}if(c=this.tokenizer.text(a)){a=a.substring(c.raw.length),d=f[f.length-1],d&&d.type==="text"?(d.raw+=` +`+c.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=d.text):f.push(c),y=m.length!==a.length,a=a.substring(c.raw.length);continue}if(c=this.tokenizer.text(a)){a=a.substring(c.raw.length),d=f[f.length-1],d&&d.type==="text"?(d.raw+=` `+c.raw,d.text+=` -`+c.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=d.text):f.push(c);continue}if(a){var x="Infinite loop on byte: "+a.charCodeAt(0);if(this.options.silent){console.error(x);break}else throw new Error(x)}}return this.state.top=!0,f},l.inline=function(a,f){return f===void 0&&(f=[]),this.inlineQueue.push({src:a,tokens:f}),f},l.inlineTokens=function(a,f){var h=this;f===void 0&&(f=[]);var c,d,v,y=a,x,D,S;if(this.tokens.links){var F=Object.keys(this.tokens.links);if(F.length>0)for(;(x=this.tokenizer.rules.inline.reflinkSearch.exec(y))!=null;)F.includes(x[0].slice(x[0].lastIndexOf("[")+1,-1))&&(y=y.slice(0,x.index)+"["+Rf("a",x[0].length-2)+"]"+y.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(x=this.tokenizer.rules.inline.blockSkip.exec(y))!=null;)y=y.slice(0,x.index)+"["+Rf("a",x[0].length-2)+"]"+y.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(x=this.tokenizer.rules.inline.escapedEmSt.exec(y))!=null;)y=y.slice(0,x.index+x[0].length-2)+"++"+y.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex),this.tokenizer.rules.inline.escapedEmSt.lastIndex--;for(;a;)if(D||(S=""),D=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(function(L){return(c=L.call({lexer:h},a,f))?(a=a.substring(c.raw.length),f.push(c),!0):!1}))){if(c=this.tokenizer.escape(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.tag(a)){a=a.substring(c.raw.length),d=f[f.length-1],d&&c.type==="text"&&d.type==="text"?(d.raw+=c.raw,d.text+=c.text):f.push(c);continue}if(c=this.tokenizer.link(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.reflink(a,this.tokens.links)){a=a.substring(c.raw.length),d=f[f.length-1],d&&c.type==="text"&&d.type==="text"?(d.raw+=c.raw,d.text+=c.text):f.push(c);continue}if(c=this.tokenizer.emStrong(a,y,S)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.codespan(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.br(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.del(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.autolink(a,Uf)){a=a.substring(c.raw.length),f.push(c);continue}if(!this.state.inLink&&(c=this.tokenizer.url(a,Uf))){a=a.substring(c.raw.length),f.push(c);continue}if(v=a,this.options.extensions&&this.options.extensions.startInline&&function(){var L=1/0,T=a.slice(1),N=void 0;h.options.extensions.startInline.forEach(function(z){N=z.call({lexer:this},T),typeof N=="number"&&N>=0&&(L=Math.min(L,N))}),L<1/0&&L>=0&&(v=a.substring(0,L+1))}(),c=this.tokenizer.inlineText(v,vp)){a=a.substring(c.raw.length),c.raw.slice(-1)!=="_"&&(S=c.raw.slice(-1)),D=!0,d=f[f.length-1],d&&d.type==="text"?(d.raw+=c.raw,d.text+=c.text):f.push(c);continue}if(a){var B="Infinite loop on byte: "+a.charCodeAt(0);if(this.options.silent){console.error(B);break}else throw new Error(B)}}return f},Vh(o,null,[{key:"rules",get:function(){return{block:ce,inline:ne}}}]),o}(),uo=function(){function o(s){this.options=s||_e.defaults}var l=o.prototype;return l.code=function(a,f,h){var c=(f||"").match(/\S*/)[0];if(this.options.highlight){var d=this.options.highlight(a,c);d!=null&&d!==a&&(h=!0,a=d)}return a=a.replace(/\n$/,"")+` +`+c.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=d.text):f.push(c);continue}if(a){var x="Infinite loop on byte: "+a.charCodeAt(0);if(this.options.silent){console.error(x);break}else throw new Error(x)}}return this.state.top=!0,f},l.inline=function(a,f){return f===void 0&&(f=[]),this.inlineQueue.push({src:a,tokens:f}),f},l.inlineTokens=function(a,f){var h=this;f===void 0&&(f=[]);var c,d,m,y=a,x,C,S;if(this.tokens.links){var F=Object.keys(this.tokens.links);if(F.length>0)for(;(x=this.tokenizer.rules.inline.reflinkSearch.exec(y))!=null;)F.includes(x[0].slice(x[0].lastIndexOf("[")+1,-1))&&(y=y.slice(0,x.index)+"["+qf("a",x[0].length-2)+"]"+y.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(x=this.tokenizer.rules.inline.blockSkip.exec(y))!=null;)y=y.slice(0,x.index)+"["+qf("a",x[0].length-2)+"]"+y.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(x=this.tokenizer.rules.inline.escapedEmSt.exec(y))!=null;)y=y.slice(0,x.index+x[0].length-2)+"++"+y.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex),this.tokenizer.rules.inline.escapedEmSt.lastIndex--;for(;a;)if(C||(S=""),C=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(function(L){return(c=L.call({lexer:h},a,f))?(a=a.substring(c.raw.length),f.push(c),!0):!1}))){if(c=this.tokenizer.escape(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.tag(a)){a=a.substring(c.raw.length),d=f[f.length-1],d&&c.type==="text"&&d.type==="text"?(d.raw+=c.raw,d.text+=c.text):f.push(c);continue}if(c=this.tokenizer.link(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.reflink(a,this.tokens.links)){a=a.substring(c.raw.length),d=f[f.length-1],d&&c.type==="text"&&d.type==="text"?(d.raw+=c.raw,d.text+=c.text):f.push(c);continue}if(c=this.tokenizer.emStrong(a,y,S)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.codespan(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.br(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.del(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.autolink(a,jf)){a=a.substring(c.raw.length),f.push(c);continue}if(!this.state.inLink&&(c=this.tokenizer.url(a,jf))){a=a.substring(c.raw.length),f.push(c);continue}if(m=a,this.options.extensions&&this.options.extensions.startInline&&function(){var L=1/0,T=a.slice(1),O=void 0;h.options.extensions.startInline.forEach(function(N){O=N.call({lexer:this},T),typeof O=="number"&&O>=0&&(L=Math.min(L,O))}),L<1/0&&L>=0&&(m=a.substring(0,L+1))}(),c=this.tokenizer.inlineText(m,bp)){a=a.substring(c.raw.length),c.raw.slice(-1)!=="_"&&(S=c.raw.slice(-1)),C=!0,d=f[f.length-1],d&&d.type==="text"?(d.raw+=c.raw,d.text+=c.text):f.push(c);continue}if(a){var _="Infinite loop on byte: "+a.charCodeAt(0);if(this.options.silent){console.error(_);break}else throw new Error(_)}}return f},Vh(o,null,[{key:"rules",get:function(){return{block:ce,inline:ie}}}]),o}(),fo=function(){function o(s){this.options=s||Be.defaults}var l=o.prototype;return l.code=function(a,f,h){var c=(f||"").match(/\S*/)[0];if(this.options.highlight){var d=this.options.highlight(a,c);d!=null&&d!==a&&(h=!0,a=d)}return a=a.replace(/\n$/,"")+` `,c?'
    '+(h?a:gt(a,!0))+`
    `:"
    "+(h?a:gt(a,!0))+`
    `},l.blockquote=function(a){return`
    @@ -73,15 +73,15 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `},l.tablerow=function(a){return` `+a+` `},l.tablecell=function(a,f){var h=f.header?"th":"td",c=f.align?"<"+h+' align="'+f.align+'">':"<"+h+">";return c+a+(" -`)},l.strong=function(a){return""+a+""},l.em=function(a){return""+a+""},l.codespan=function(a){return""+a+""},l.br=function(){return this.options.xhtml?"
    ":"
    "},l.del=function(a){return""+a+""},l.link=function(a,f,h){if(a=Pf(this.options.sanitize,this.options.baseUrl,a),a===null)return h;var c='
    ",c},l.image=function(a,f,h){if(a=Pf(this.options.sanitize,this.options.baseUrl,a),a===null)return h;var c=''+h+'":">",c},l.text=function(a){return a},o}(),dl=function(){function o(){}var l=o.prototype;return l.strong=function(a){return a},l.em=function(a){return a},l.codespan=function(a){return a},l.del=function(a){return a},l.html=function(a){return a},l.text=function(a){return a},l.link=function(a,f,h){return""+h},l.image=function(a,f,h){return""+h},l.br=function(){return""},o}(),hl=function(){function o(){this.seen={}}var l=o.prototype;return l.serialize=function(a){return a.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},l.getNextSafeSlug=function(a,f){var h=a,c=0;if(this.seen.hasOwnProperty(h)){c=this.seen[a];do c++,h=a+"-"+c;while(this.seen.hasOwnProperty(h))}return f||(this.seen[a]=c,this.seen[h]=0),h},l.slug=function(a,f){f===void 0&&(f={});var h=this.serialize(a);return this.getNextSafeSlug(h,f.dryrun)},o}(),xi=function(){function o(s){this.options=s||_e.defaults,this.options.renderer=this.options.renderer||new uo,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new dl,this.slugger=new hl}o.parse=function(a,f){var h=new o(f);return h.parse(a)},o.parseInline=function(a,f){var h=new o(f);return h.parseInline(a)};var l=o.prototype;return l.parse=function(a,f){f===void 0&&(f=!0);var h="",c,d,v,y,x,D,S,F,B,L,T,N,z,O,I,U,j,K,de,W=a.length;for(c=0;c0&&I.tokens[0].type==="paragraph"?(I.tokens[0].text=K+" "+I.tokens[0].text,I.tokens[0].tokens&&I.tokens[0].tokens.length>0&&I.tokens[0].tokens[0].type==="text"&&(I.tokens[0].tokens[0].text=K+" "+I.tokens[0].tokens[0].text)):I.tokens.unshift({type:"text",text:K}):O+=K),O+=this.parse(I.tokens,z),B+=this.renderer.listitem(O,j,U);h+=this.renderer.list(B,T,N);continue}case"html":{h+=this.renderer.html(L.text);continue}case"paragraph":{h+=this.renderer.paragraph(this.parseInline(L.tokens));continue}case"text":{for(B=L.tokens?this.parseInline(L.tokens):L.text;c+1";if(l)return Promise.resolve(f);if(s){s(null,f);return}return f}if(l)return Promise.reject(a);if(s){s(a);return}throw a}}function Kf(o,l){return function(s,a,f){typeof a=="function"&&(f=a,a=null);var h=_t({},a);a=_t({},fe.defaults,h);var c=bp(a.silent,a.async,f);if(typeof s>"u"||s===null)return c(new Error("marked(): input parameter is undefined or null"));if(typeof s!="string")return c(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));if(gp(a),a.hooks&&(a.hooks.options=a),f){var d=a.highlight,v;try{a.hooks&&(s=a.hooks.preprocess(s)),v=o(s,a)}catch(F){return c(F)}var y=function(B){var L;if(!B)try{a.walkTokens&&fe.walkTokens(v,a.walkTokens),L=l(v,a),a.hooks&&(L=a.hooks.postprocess(L))}catch(T){B=T}return a.highlight=d,B?c(B):f(null,L)};if(!d||d.length<3||(delete a.highlight,!v.length))return y();var x=0;fe.walkTokens(v,function(F){F.type==="code"&&(x++,setTimeout(function(){d(F.text,F.lang,function(B,L){if(B)return y(B);L!=null&&L!==F.text&&(F.text=L,F.escaped=!0),x--,x===0&&y()})},0))}),x===0&&y();return}if(a.async)return Promise.resolve(a.hooks?a.hooks.preprocess(s):s).then(function(F){return o(F,a)}).then(function(F){return a.walkTokens?Promise.all(fe.walkTokens(F,a.walkTokens)).then(function(){return F}):F}).then(function(F){return l(F,a)}).then(function(F){return a.hooks?a.hooks.postprocess(F):F}).catch(c);try{a.hooks&&(s=a.hooks.preprocess(s));var D=o(s,a);a.walkTokens&&fe.walkTokens(D,a.walkTokens);var S=l(D,a);return a.hooks&&(S=a.hooks.postprocess(S)),S}catch(F){return c(F)}}}function fe(o,l,s){return Kf(yi.lex,xi.parse)(o,l,s)}fe.options=fe.setOptions=function(o){return fe.defaults=_t({},fe.defaults,o),rp(fe.defaults),fe};fe.getDefaults=cl;fe.defaults=_e.defaults;fe.use=function(){for(var o=fe.defaults.extensions||{renderers:{},childTokens:{}},l=arguments.length,s=new Array(l),a=0;a{"use strict";var wi=At();ef();rf();af();ll();sl();bf();wf();kf();Af();Lf();al();var Ap=Nf(),pl=Yf().marked,Jf=/Mac/.test(navigator.platform),Fp=new RegExp(/()+?/g),fn={toggleBold:ho,toggleItalic:po,drawLink:Eo,toggleHeadingSmaller:cn,toggleHeadingBigger:bo,drawImage:Ao,toggleBlockquote:vo,toggleOrderedList:Do,toggleUnorderedList:Co,toggleCheckList:ko,toggleCodeBlock:mo,togglePreview:Bo,toggleStrikethrough:go,toggleHeading1:yo,toggleHeading2:xo,toggleHeading3:wo,toggleHeading4:ml,toggleHeading5:vl,toggleHeading6:bl,cleanBlock:So,drawTable:Fo,drawHorizontalRule:To,undo:Lo,redo:Mo,toggleSideBySide:Ci,toggleFullScreen:jr},Tp={toggleBold:"Cmd-B",toggleItalic:"Cmd-I",drawLink:"Cmd-K",toggleHeadingSmaller:"Cmd-H",toggleHeadingBigger:"Shift-Cmd-H",toggleHeading1:"Ctrl+Alt+1",toggleHeading2:"Ctrl+Alt+2",toggleHeading3:"Ctrl+Alt+3",toggleHeading4:"Ctrl+Alt+4",toggleHeading5:"Ctrl+Alt+5",toggleHeading6:"Ctrl+Alt+6",cleanBlock:"Cmd-E",drawImage:"Cmd-Alt-I",toggleBlockquote:"Cmd-'",toggleOrderedList:"Cmd-Alt-L",toggleUnorderedList:"Cmd-L",toggleCheckList:"Shift-Cmd-L",toggleCodeBlock:"Cmd-Alt-C",togglePreview:"Cmd-P",toggleSideBySide:"F9",toggleFullScreen:"F11"},Lp=function(o){for(var l in fn)if(fn[l]===o)return l;return null},gl=function(){var o=!1;return function(l){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(l)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(l.substr(0,4)))&&(o=!0)}(navigator.userAgent||navigator.vendor||window.opera),o};function Mp(o){for(var l;(l=Fp.exec(o))!==null;){var s=l[0];if(s.indexOf("target=")===-1){var a=s.replace(/>$/,' target="_blank">');o=o.replace(s,a)}}return o}function Bp(o){for(var l=new DOMParser,s=l.parseFromString(o,"text/html"),a=s.getElementsByTagName("li"),f=0;f0){for(var F=document.createElement("i"),B=0;B"+a+""},l.em=function(a){return""+a+""},l.codespan=function(a){return""+a+""},l.br=function(){return this.options.xhtml?"
    ":"
    "},l.del=function(a){return""+a+""},l.link=function(a,f,h){if(a=Rf(this.options.sanitize,this.options.baseUrl,a),a===null)return h;var c='
    ",c},l.image=function(a,f,h){if(a=Rf(this.options.sanitize,this.options.baseUrl,a),a===null)return h;var c=''+h+'":">",c},l.text=function(a){return a},o}(),hl=function(){function o(){}var l=o.prototype;return l.strong=function(a){return a},l.em=function(a){return a},l.codespan=function(a){return a},l.del=function(a){return a},l.html=function(a){return a},l.text=function(a){return a},l.link=function(a,f,h){return""+h},l.image=function(a,f,h){return""+h},l.br=function(){return""},o}(),pl=function(){function o(){this.seen={}}var l=o.prototype;return l.serialize=function(a){return a.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},l.getNextSafeSlug=function(a,f){var h=a,c=0;if(this.seen.hasOwnProperty(h)){c=this.seen[a];do c++,h=a+"-"+c;while(this.seen.hasOwnProperty(h))}return f||(this.seen[a]=c,this.seen[h]=0),h},l.slug=function(a,f){f===void 0&&(f={});var h=this.serialize(a);return this.getNextSafeSlug(h,f.dryrun)},o}(),wn=function(){function o(s){this.options=s||Be.defaults,this.options.renderer=this.options.renderer||new fo,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new hl,this.slugger=new pl}o.parse=function(a,f){var h=new o(f);return h.parse(a)},o.parseInline=function(a,f){var h=new o(f);return h.parseInline(a)};var l=o.prototype;return l.parse=function(a,f){f===void 0&&(f=!0);var h="",c,d,m,y,x,C,S,F,_,L,T,O,N,I,P,U,j,K,de,q=a.length;for(c=0;c0&&P.tokens[0].type==="paragraph"?(P.tokens[0].text=K+" "+P.tokens[0].text,P.tokens[0].tokens&&P.tokens[0].tokens.length>0&&P.tokens[0].tokens[0].type==="text"&&(P.tokens[0].tokens[0].text=K+" "+P.tokens[0].tokens[0].text)):P.tokens.unshift({type:"text",text:K}):I+=K),I+=this.parse(P.tokens,N),_+=this.renderer.listitem(I,j,U);h+=this.renderer.list(_,T,O);continue}case"html":{h+=this.renderer.html(L.text);continue}case"paragraph":{h+=this.renderer.paragraph(this.parseInline(L.tokens));continue}case"text":{for(_=L.tokens?this.parseInline(L.tokens):L.text;c+1";if(l)return Promise.resolve(f);if(s){s(null,f);return}return f}if(l)return Promise.reject(a);if(s){s(a);return}throw a}}function Yf(o,l){return function(s,a,f){typeof a=="function"&&(f=a,a=null);var h=Bt({},a);a=Bt({},fe.defaults,h);var c=yp(a.silent,a.async,f);if(typeof s>"u"||s===null)return c(new Error("marked(): input parameter is undefined or null"));if(typeof s!="string")return c(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));if(vp(a),a.hooks&&(a.hooks.options=a),f){var d=a.highlight,m;try{a.hooks&&(s=a.hooks.preprocess(s)),m=o(s,a)}catch(F){return c(F)}var y=function(_){var L;if(!_)try{a.walkTokens&&fe.walkTokens(m,a.walkTokens),L=l(m,a),a.hooks&&(L=a.hooks.postprocess(L))}catch(T){_=T}return a.highlight=d,_?c(_):f(null,L)};if(!d||d.length<3||(delete a.highlight,!m.length))return y();var x=0;fe.walkTokens(m,function(F){F.type==="code"&&(x++,setTimeout(function(){d(F.text,F.lang,function(_,L){if(_)return y(_);L!=null&&L!==F.text&&(F.text=L,F.escaped=!0),x--,x===0&&y()})},0))}),x===0&&y();return}if(a.async)return Promise.resolve(a.hooks?a.hooks.preprocess(s):s).then(function(F){return o(F,a)}).then(function(F){return a.walkTokens?Promise.all(fe.walkTokens(F,a.walkTokens)).then(function(){return F}):F}).then(function(F){return l(F,a)}).then(function(F){return a.hooks?a.hooks.postprocess(F):F}).catch(c);try{a.hooks&&(s=a.hooks.preprocess(s));var C=o(s,a);a.walkTokens&&fe.walkTokens(C,a.walkTokens);var S=l(C,a);return a.hooks&&(S=a.hooks.postprocess(S)),S}catch(F){return c(F)}}}function fe(o,l,s){return Yf(xn.lex,wn.parse)(o,l,s)}fe.options=fe.setOptions=function(o){return fe.defaults=Bt({},fe.defaults,o),np(fe.defaults),fe};fe.getDefaults=dl;fe.defaults=Be.defaults;fe.use=function(){for(var o=fe.defaults.extensions||{renderers:{},childTokens:{}},l=arguments.length,s=new Array(l),a=0;a{"use strict";var Dn=At();tf();nf();lf();sl();ul();yf();Df();Sf();Ff();Mf();ll();var Fp=If(),gl=Zf().marked,$f=/Mac/.test(navigator.platform),Tp=new RegExp(/()+?/g),fi={toggleBold:po,toggleItalic:go,drawLink:Ao,toggleHeadingSmaller:ci,toggleHeadingBigger:yo,drawImage:Fo,toggleBlockquote:bo,toggleOrderedList:ko,toggleUnorderedList:Co,toggleCheckList:So,toggleCodeBlock:mo,togglePreview:Bo,toggleStrikethrough:vo,toggleHeading1:xo,toggleHeading2:wo,toggleHeading3:Do,toggleHeading4:ml,toggleHeading5:bl,toggleHeading6:yl,cleanBlock:Eo,drawTable:To,drawHorizontalRule:Lo,undo:Mo,redo:_o,toggleSideBySide:Cn,toggleFullScreen:jr},Lp={toggleBold:"Cmd-B",toggleItalic:"Cmd-I",drawLink:"Cmd-K",toggleHeadingSmaller:"Cmd-H",toggleHeadingBigger:"Shift-Cmd-H",toggleHeading1:"Ctrl+Alt+1",toggleHeading2:"Ctrl+Alt+2",toggleHeading3:"Ctrl+Alt+3",toggleHeading4:"Ctrl+Alt+4",toggleHeading5:"Ctrl+Alt+5",toggleHeading6:"Ctrl+Alt+6",cleanBlock:"Cmd-E",drawImage:"Cmd-Alt-I",toggleBlockquote:"Cmd-'",toggleOrderedList:"Cmd-Alt-L",toggleUnorderedList:"Cmd-L",toggleCheckList:"Shift-Cmd-L",toggleCodeBlock:"Cmd-Alt-C",togglePreview:"Cmd-P",toggleSideBySide:"F9",toggleFullScreen:"F11"},Mp=function(o){for(var l in fi)if(fi[l]===o)return l;return null},vl=function(){var o=!1;return function(l){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(l)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(l.substr(0,4)))&&(o=!0)}(navigator.userAgent||navigator.vendor||window.opera),o};function _p(o){for(var l;(l=Tp.exec(o))!==null;){var s=l[0];if(s.indexOf("target=")===-1){var a=s.replace(/>$/,' target="_blank">');o=o.replace(s,a)}}return o}function Bp(o){for(var l=new DOMParser,s=l.parseFromString(o,"text/html"),a=s.getElementsByTagName("li"),f=0;f0){for(var F=document.createElement("i"),_=0;_=0&&(x=c.getLineHandle(S),!s(x));S--);var N=c.getTokenAt({line:S,ch:1}),z=a(N).fencedChars,O,I,U,j;s(c.getLineHandle(d.line))?(O="",I=d.line):s(c.getLineHandle(d.line-1))?(O="",I=d.line-1):(O=z+` -`,I=d.line),s(c.getLineHandle(v.line))?(U="",j=v.line,v.ch===0&&(j+=1)):v.ch!==0&&s(c.getLineHandle(v.line+1))?(U="",j=v.line+1):(U=z+` -`,j=v.line+1),v.ch===0&&(j-=1),c.operation(function(){c.replaceRange(U,{line:j,ch:0},{line:j+(U?0:1),ch:0}),c.replaceRange(O,{line:I,ch:0},{line:I+(O?0:1),ch:0})}),c.setSelection({line:I+(O?1:0),ch:0},{line:j+(O?1:-1),ch:0}),c.focus()}else{var K=d.line;if(s(c.getLineHandle(d.line))&&(f(c,d.line+1)==="fenced"?(S=d.line,K=d.line+1):(F=d.line,K=d.line-1)),S===void 0)for(S=K;S>=0&&(x=c.getLineHandle(S),!s(x));S--);if(F===void 0)for(B=c.lineCount(),F=K;F=0;S--)if(x=c.getLineHandle(S),!x.text.match(/^\s*$/)&&f(c,S,x)!=="indented"){S+=1;break}for(B=c.lineCount(),F=d.line;F\s+/,"unordered-list":a,"ordered-list":a,"check-list":/^(\s*)(- \[[ xX]])(\s+)/},y=function(N,z){var O={quote:">","unordered-list":s,"ordered-list":"%%i.","check-list":"- [ ]"};return O[N].replace("%%i",z)},x=function(N,z){var O={quote:">","unordered-list":"\\"+s,"ordered-list":"\\d+.","check-list":"- \\[[ xX]]"},I=new RegExp(O[N]);return z&&I.test(z)},D=function(N,z,O){var I=a.exec(z),U=y(N,S);return I!==null?(x(N,I[2])&&(U=""),z=I[1]+U+I[3]+z.replace(f,"").replace(v[N],"$1")):O==!1&&(z=U+" "+z),z},S=1,F=["unordered-list","ordered-list","check-list"],B=Object.keys(h)[0];if(!F.includes(B)){var L=o.getLine(c.line);/^\s*- \[[ xX]]\s/.test(L)?B="check-list":/^\s*\d+\.\s/.test(L)?B="ordered-list":/^\s*[*\-+]\s/.test(L)&&(B="unordered-list")}for(var T=c.line;T<=d.line;T++)(function(N){var z=o.getLine(N);h[l]?z=z.replace(v[l],"$1"):F.includes(B)&&F.includes(l)?(z=z.replace(v[B],"$1"),z=D(l,z,!1),S+=1):(z=D(l,z,!1),S+=1),o.replaceRange(z,{line:N,ch:0},{line:N,ch:99999999999999})})(T);o.focus()}}function tc(o,l,s,a){if(!(!o.codemirror||o.isPreviewActive())){var f=o.codemirror,h=Sr(f),c=h[l];if(!c){Gr(f,c,s,a);return}var d=f.getCursor("start"),v=f.getCursor("end"),y=f.getLine(d.line),x=y.slice(0,d.ch),D=y.slice(d.ch);l=="link"?x=x.replace(/(.*)[^!]\[/,"$1"):l=="image"&&(x=x.replace(/(.*)!\[$/,"$1")),D=D.replace(/]\(.*?\)/,""),f.replaceRange(x+D,{line:d.line,ch:0},{line:d.line,ch:99999999999999}),d.ch-=s[0].length,d!==v&&(v.ch-=s[0].length),f.setSelection(d,v),f.focus()}}function xl(o,l,s,a){if(!(!o.codemirror||o.isPreviewActive())){a=typeof a>"u"?s:a;var f=o.codemirror,h=Sr(f),c,d=s,v=a,y=f.getCursor("start"),x=f.getCursor("end");h[l]?(c=f.getLine(y.line),d=c.slice(0,y.ch),v=c.slice(y.ch),l=="bold"?(d=d.replace(/(\*\*|__)(?![\s\S]*(\*\*|__))/,""),v=v.replace(/(\*\*|__)/,"")):l=="italic"?(d=d.replace(/(\*|_)(?![\s\S]*(\*|_))/,""),v=v.replace(/(\*|_)/,"")):l=="strikethrough"&&(d=d.replace(/(\*\*|~~)(?![\s\S]*(\*\*|~~))/,""),v=v.replace(/(\*\*|~~)/,"")),f.replaceRange(d+v,{line:y.line,ch:0},{line:y.line,ch:99999999999999}),l=="bold"||l=="strikethrough"?(y.ch-=2,y!==x&&(x.ch-=2)):l=="italic"&&(y.ch-=1,y!==x&&(x.ch-=1))):(c=f.getSelection(),l=="bold"?(c=c.split("**").join(""),c=c.split("__").join("")):l=="italic"?(c=c.split("*").join(""),c=c.split("_").join("")):l=="strikethrough"&&(c=c.split("~~").join("")),f.replaceSelection(d+c+v),y.ch+=s.length,x.ch=y.ch+c.length),f.setSelection(y,x),f.focus()}}function Op(o){if(!o.getWrapperElement().lastChild.classList.contains("editor-preview-active"))for(var l=o.getCursor("start"),s=o.getCursor("end"),a,f=l.line;f<=s.line;f++)a=o.getLine(f),a=a.replace(/^[ ]*([# ]+|\*|-|[> ]+|[0-9]+(.|\)))[ ]*/,""),o.replaceRange(a,{line:f,ch:0},{line:f,ch:99999999999999})}function co(o,l){if(Math.abs(o)<1024)return""+o+l[0];var s=0;do o/=1024,++s;while(Math.abs(o)>=1024&&s=19968?a+=s[f].length:a+=1;return a}var Be={bold:"fa fa-bold",italic:"fa fa-italic",strikethrough:"fa fa-strikethrough",heading:"fa fa-header fa-heading","heading-smaller":"fa fa-header fa-heading header-smaller","heading-bigger":"fa fa-header fa-heading header-bigger","heading-1":"fa fa-header fa-heading header-1","heading-2":"fa fa-header fa-heading header-2","heading-3":"fa fa-header fa-heading header-3",code:"fa fa-code",quote:"fa fa-quote-left","ordered-list":"fa fa-list-ol","unordered-list":"fa fa-list-ul","check-list":"fa fa-check-square-o","clean-block":"fa fa-eraser",link:"fa fa-link",image:"fa fa-image","upload-image":"fa fa-image",table:"fa fa-table","horizontal-rule":"fa fa-minus",preview:"fa fa-eye","side-by-side":"fa fa-columns",fullscreen:"fa fa-arrows-alt",guide:"fa fa-question-circle",undo:"fa fa-undo",redo:"fa fa-repeat fa-redo"},Ur={bold:{name:"bold",action:ho,className:Be.bold,title:"Bold",default:!0},italic:{name:"italic",action:po,className:Be.italic,title:"Italic",default:!0},strikethrough:{name:"strikethrough",action:go,className:Be.strikethrough,title:"Strikethrough"},heading:{name:"heading",action:cn,className:Be.heading,title:"Heading",default:!0},"heading-smaller":{name:"heading-smaller",action:cn,className:Be["heading-smaller"],title:"Smaller Heading"},"heading-bigger":{name:"heading-bigger",action:bo,className:Be["heading-bigger"],title:"Bigger Heading"},"heading-1":{name:"heading-1",action:yo,className:Be["heading-1"],title:"Big Heading"},"heading-2":{name:"heading-2",action:xo,className:Be["heading-2"],title:"Medium Heading"},"heading-3":{name:"heading-3",action:wo,className:Be["heading-3"],title:"Small Heading"},"separator-1":{name:"separator-1"},code:{name:"code",action:mo,className:Be.code,title:"Code"},quote:{name:"quote",action:vo,className:Be.quote,title:"Quote",default:!0},"unordered-list":{name:"unordered-list",action:Co,className:Be["unordered-list"],title:"Generic List",default:!0},"ordered-list":{name:"ordered-list",action:Do,className:Be["ordered-list"],title:"Numbered List",default:!0},"check-list":{name:"check-list",action:ko,className:Be["check-list"],title:"Check List",default:!0},"clean-block":{name:"clean-block",action:So,className:Be["clean-block"],title:"Clean block"},"separator-2":{name:"separator-2"},link:{name:"link",action:Eo,className:Be.link,title:"Create Link",default:!0},image:{name:"image",action:Ao,className:Be.image,title:"Insert Image",default:!0},"upload-image":{name:"upload-image",action:yl,className:Be["upload-image"],title:"Import an image"},table:{name:"table",action:Fo,className:Be.table,title:"Insert Table"},"horizontal-rule":{name:"horizontal-rule",action:To,className:Be["horizontal-rule"],title:"Insert Horizontal Line"},"separator-3":{name:"separator-3"},preview:{name:"preview",action:Bo,className:Be.preview,noDisable:!0,title:"Toggle Preview",default:!0},"side-by-side":{name:"side-by-side",action:Ci,className:Be["side-by-side"],noDisable:!0,noMobile:!0,title:"Toggle Side by Side",default:!0},fullscreen:{name:"fullscreen",action:jr,className:Be.fullscreen,noDisable:!0,noMobile:!0,title:"Toggle Fullscreen",default:!0},"separator-4":{name:"separator-4"},guide:{name:"guide",action:"https://www.markdownguide.org/basic-syntax/",className:Be.guide,noDisable:!0,title:"Markdown Guide",default:!0},"separator-5":{name:"separator-5"},undo:{name:"undo",action:Lo,className:Be.undo,noDisable:!0,title:"Undo"},redo:{name:"redo",action:Mo,className:Be.redo,noDisable:!0,title:"Redo"}},Ip={link:["[","](#url#)"],image:["![","](#url#)"],uploadedImage:["![](#url#)",""],table:["",` +`,Ee--),Gr(z,!1,[w,ee]),z.setSelection({line:pe,ch:0},{line:Ee,ch:0})}var c=o.codemirror,d=c.getCursor("start"),m=c.getCursor("end"),y=c.getTokenAt({line:d.line,ch:d.ch||1}),x=c.getLineHandle(d.line),C=f(c,d.line,x,y),S,F,_;if(C==="single"){var L=x.text.slice(0,d.ch).replace("`",""),T=x.text.slice(d.ch).replace("`","");c.replaceRange(L+T,{line:d.line,ch:0},{line:d.line,ch:99999999999999}),d.ch--,d!==m&&m.ch--,c.setSelection(d,m),c.focus()}else if(C==="fenced")if(d.line!==m.line||d.ch!==m.ch){for(S=d.line;S>=0&&(x=c.getLineHandle(S),!s(x));S--);var O=c.getTokenAt({line:S,ch:1}),N=a(O).fencedChars,I,P,U,j;s(c.getLineHandle(d.line))?(I="",P=d.line):s(c.getLineHandle(d.line-1))?(I="",P=d.line-1):(I=N+` +`,P=d.line),s(c.getLineHandle(m.line))?(U="",j=m.line,m.ch===0&&(j+=1)):m.ch!==0&&s(c.getLineHandle(m.line+1))?(U="",j=m.line+1):(U=N+` +`,j=m.line+1),m.ch===0&&(j-=1),c.operation(function(){c.replaceRange(U,{line:j,ch:0},{line:j+(U?0:1),ch:0}),c.replaceRange(I,{line:P,ch:0},{line:P+(I?0:1),ch:0})}),c.setSelection({line:P+(I?1:0),ch:0},{line:j+(I?1:-1),ch:0}),c.focus()}else{var K=d.line;if(s(c.getLineHandle(d.line))&&(f(c,d.line+1)==="fenced"?(S=d.line,K=d.line+1):(F=d.line,K=d.line-1)),S===void 0)for(S=K;S>=0&&(x=c.getLineHandle(S),!s(x));S--);if(F===void 0)for(_=c.lineCount(),F=K;F<_&&(x=c.getLineHandle(F),!s(x));F++);c.operation(function(){c.replaceRange("",{line:S,ch:0},{line:S+1,ch:0}),c.replaceRange("",{line:F-1,ch:0},{line:F,ch:0})}),c.focus()}else if(C==="indented"){if(d.line!==m.line||d.ch!==m.ch)S=d.line,F=m.line,m.ch===0&&F--;else{for(S=d.line;S>=0;S--)if(x=c.getLineHandle(S),!x.text.match(/^\s*$/)&&f(c,S,x)!=="indented"){S+=1;break}for(_=c.lineCount(),F=d.line;F<_;F++)if(x=c.getLineHandle(F),!x.text.match(/^\s*$/)&&f(c,F,x)!=="indented"){F-=1;break}}var de=c.getLineHandle(F+1),q=de&&c.getTokenAt({line:F+1,ch:de.text.length-1}),oe=q&&a(q).indentedCode;oe&&c.replaceRange(` +`,{line:F+1,ch:0});for(var X=S;X<=F;X++)c.indentLine(X,"subtract");c.focus()}else{var G=d.line===m.line&&d.ch===m.ch&&d.ch===0,k=d.line!==m.line;G||k?h(c,d,m,l):Gr(c,!1,["`","`"])}}function bo(o){No(o.codemirror,"quote")}function ci(o){Er(o.codemirror,"smaller")}function yo(o){Er(o.codemirror,"bigger")}function xo(o){Er(o.codemirror,void 0,1)}function wo(o){Er(o.codemirror,void 0,2)}function Do(o){Er(o.codemirror,void 0,3)}function ml(o){Er(o.codemirror,void 0,4)}function bl(o){Er(o.codemirror,void 0,5)}function yl(o){Er(o.codemirror,void 0,6)}function Co(o){var l=o.codemirror,s="*";["-","+","*"].includes(o.options.unorderedListStyle)&&(s=o.options.unorderedListStyle),No(l,"unordered-list",s)}function ko(o){No(o.codemirror,"ordered-list")}function So(o){No(o.codemirror,"check-list")}function Eo(o){Pp(o.codemirror)}function Ao(o){var l=o.options,s="https://";if(l.promptURLs){var a=prompt(l.promptTexts.link,s);if(!a)return!1;s=ec(a)}rc(o,"link",l.insertTexts.link,s)}function Fo(o){var l=o.options,s="https://";if(l.promptURLs){var a=prompt(l.promptTexts.image,s);if(!a)return!1;s=ec(a)}rc(o,"image",l.insertTexts.image,s)}function ec(o){return encodeURI(o).replace(/([\\()])/g,"\\$1")}function xl(o){o.openBrowseFileWindow()}function tc(o,l){var s=o.codemirror,a=Sr(s),f=o.options,h=l.substr(l.lastIndexOf("/")+1),c=h.substring(h.lastIndexOf(".")+1).replace(/\?.*$/,"").toLowerCase();if(["png","jpg","jpeg","gif","svg","apng","avif","webp"].includes(c))Gr(s,a.image,f.insertTexts.uploadedImage,l);else{var d=f.insertTexts.link;d[0]="["+h,Gr(s,a.link,d,l)}o.updateStatusBar("upload-image",o.options.imageTexts.sbOnUploaded.replace("#image_name#",h)),setTimeout(function(){o.updateStatusBar("upload-image",o.options.imageTexts.sbInit)},1e3)}function To(o){var l=o.codemirror,s=Sr(l),a=o.options;Gr(l,s.table,a.insertTexts.table)}function Lo(o){var l=o.codemirror,s=Sr(l),a=o.options;Gr(l,s.image,a.insertTexts.horizontalRule)}function Mo(o){var l=o.codemirror;l.undo(),l.focus()}function _o(o){var l=o.codemirror;l.redo(),l.focus()}function Cn(o){var l=o.codemirror,s=l.getWrapperElement(),a=s.nextSibling,f=o.toolbarElements&&o.toolbarElements["side-by-side"],h=!1,c=s.parentNode;a.classList.contains("editor-preview-active-side")?(o.options.sideBySideFullscreen===!1&&c.classList.remove("sided--no-fullscreen"),a.classList.remove("editor-preview-active-side"),f&&f.classList.remove("active"),s.classList.remove("CodeMirror-sided")):(setTimeout(function(){l.getOption("fullScreen")||(o.options.sideBySideFullscreen===!1?c.classList.add("sided--no-fullscreen"):jr(o)),a.classList.add("editor-preview-active-side")},1),f&&f.classList.add("active"),s.classList.add("CodeMirror-sided"),h=!0);var d=s.lastChild;if(d.classList.contains("editor-preview-active")){d.classList.remove("editor-preview-active");var m=o.toolbarElements.preview,y=o.toolbar_div;m.classList.remove("active"),y.classList.remove("disabled-for-preview")}var x=function(){var S=o.options.previewRender(o.value(),a);S!=null&&(a.innerHTML=S)};if(l.sideBySideRenderingFunction||(l.sideBySideRenderingFunction=x),h){var C=o.options.previewRender(o.value(),a);C!=null&&(a.innerHTML=C),l.on("update",l.sideBySideRenderingFunction)}else l.off("update",l.sideBySideRenderingFunction);l.refresh()}function Bo(o){var l=o.codemirror,s=l.getWrapperElement(),a=o.toolbar_div,f=o.options.toolbar?o.toolbarElements.preview:!1,h=s.lastChild,c=l.getWrapperElement().nextSibling;if(c.classList.contains("editor-preview-active-side")&&Cn(o),!h||!h.classList.contains("editor-preview-full")){if(h=document.createElement("div"),h.className="editor-preview-full",o.options.previewClass)if(Array.isArray(o.options.previewClass))for(var d=0;d\s+/,"unordered-list":a,"ordered-list":a,"check-list":/^(\s*)(- \[[ xX]])(\s+)/},y=function(O,N){var I={quote:">","unordered-list":s,"ordered-list":"%%i.","check-list":"- [ ]"};return I[O].replace("%%i",N)},x=function(O,N){var I={quote:">","unordered-list":"\\"+s,"ordered-list":"\\d+.","check-list":"- \\[[ xX]]"},P=new RegExp(I[O]);return N&&P.test(N)},C=function(O,N,I){var P=a.exec(N),U=y(O,S);return P!==null?(x(O,P[2])&&(U=""),N=P[1]+U+P[3]+N.replace(f,"").replace(m[O],"$1")):I==!1&&(N=U+" "+N),N},S=1,F=["unordered-list","ordered-list","check-list"],_=Object.keys(h)[0];if(!F.includes(_)){var L=o.getLine(c.line);/^\s*- \[[ xX]]\s/.test(L)?_="check-list":/^\s*\d+\.\s/.test(L)?_="ordered-list":/^\s*[*\-+]\s/.test(L)&&(_="unordered-list")}for(var T=c.line;T<=d.line;T++)(function(O){var N=o.getLine(O);h[l]?N=N.replace(m[l],"$1"):F.includes(_)&&F.includes(l)?(N=N.replace(m[_],"$1"),N=C(l,N,!1),S+=1):(N=C(l,N,!1),S+=1),o.replaceRange(N,{line:O,ch:0},{line:O,ch:99999999999999})})(T);o.focus()}}function rc(o,l,s,a){if(!(!o.codemirror||o.isPreviewActive())){var f=o.codemirror,h=Sr(f),c=h[l];if(!c){Gr(f,c,s,a);return}var d=f.getCursor("start"),m=f.getCursor("end"),y=f.getLine(d.line),x=y.slice(0,d.ch),C=y.slice(d.ch);l=="link"?x=x.replace(/(.*)[^!]\[/,"$1"):l=="image"&&(x=x.replace(/(.*)!\[$/,"$1")),C=C.replace(/]\(.*?\)/,""),f.replaceRange(x+C,{line:d.line,ch:0},{line:d.line,ch:99999999999999}),d.ch-=s[0].length,d!==m&&(m.ch-=s[0].length),f.setSelection(d,m),f.focus()}}function wl(o,l,s,a){if(!(!o.codemirror||o.isPreviewActive())){a=typeof a>"u"?s:a;var f=o.codemirror,h=Sr(f),c,d=s,m=a,y=f.getCursor("start"),x=f.getCursor("end");h[l]?(c=f.getLine(y.line),d=c.slice(0,y.ch),m=c.slice(y.ch),l=="bold"?(d=d.replace(/(\*\*|__)(?![\s\S]*(\*\*|__))/,""),m=m.replace(/(\*\*|__)/,"")):l=="italic"?(d=d.replace(/(\*|_)(?![\s\S]*(\*|_))/,""),m=m.replace(/(\*|_)/,"")):l=="strikethrough"&&(d=d.replace(/(\*\*|~~)(?![\s\S]*(\*\*|~~))/,""),m=m.replace(/(\*\*|~~)/,"")),f.replaceRange(d+m,{line:y.line,ch:0},{line:y.line,ch:99999999999999}),l=="bold"||l=="strikethrough"?(y.ch-=2,y!==x&&(x.ch-=2)):l=="italic"&&(y.ch-=1,y!==x&&(x.ch-=1))):(c=f.getSelection(),l=="bold"?(c=c.split("**").join(""),c=c.split("__").join("")):l=="italic"?(c=c.split("*").join(""),c=c.split("_").join("")):l=="strikethrough"&&(c=c.split("~~").join("")),f.replaceSelection(d+c+m),y.ch+=s.length,x.ch=y.ch+c.length),f.setSelection(y,x),f.focus()}}function Pp(o){if(!o.getWrapperElement().lastChild.classList.contains("editor-preview-active"))for(var l=o.getCursor("start"),s=o.getCursor("end"),a,f=l.line;f<=s.line;f++)a=o.getLine(f),a=a.replace(/^[ ]*([# ]+|\*|-|[> ]+|[0-9]+(.|\)))[ ]*/,""),o.replaceRange(a,{line:f,ch:0},{line:f,ch:99999999999999})}function ho(o,l){if(Math.abs(o)<1024)return""+o+l[0];var s=0;do o/=1024,++s;while(Math.abs(o)>=1024&&s=19968?a+=s[f].length:a+=1;return a}var _e={bold:"fa fa-bold",italic:"fa fa-italic",strikethrough:"fa fa-strikethrough",heading:"fa fa-header fa-heading","heading-smaller":"fa fa-header fa-heading header-smaller","heading-bigger":"fa fa-header fa-heading header-bigger","heading-1":"fa fa-header fa-heading header-1","heading-2":"fa fa-header fa-heading header-2","heading-3":"fa fa-header fa-heading header-3",code:"fa fa-code",quote:"fa fa-quote-left","ordered-list":"fa fa-list-ol","unordered-list":"fa fa-list-ul","check-list":"fa fa-check-square-o","clean-block":"fa fa-eraser",link:"fa fa-link",image:"fa fa-image","upload-image":"fa fa-image",table:"fa fa-table","horizontal-rule":"fa fa-minus",preview:"fa fa-eye","side-by-side":"fa fa-columns",fullscreen:"fa fa-arrows-alt",guide:"fa fa-question-circle",undo:"fa fa-undo",redo:"fa fa-repeat fa-redo"},Ur={bold:{name:"bold",action:po,className:_e.bold,title:"Bold",default:!0},italic:{name:"italic",action:go,className:_e.italic,title:"Italic",default:!0},strikethrough:{name:"strikethrough",action:vo,className:_e.strikethrough,title:"Strikethrough"},heading:{name:"heading",action:ci,className:_e.heading,title:"Heading",default:!0},"heading-smaller":{name:"heading-smaller",action:ci,className:_e["heading-smaller"],title:"Smaller Heading"},"heading-bigger":{name:"heading-bigger",action:yo,className:_e["heading-bigger"],title:"Bigger Heading"},"heading-1":{name:"heading-1",action:xo,className:_e["heading-1"],title:"Big Heading"},"heading-2":{name:"heading-2",action:wo,className:_e["heading-2"],title:"Medium Heading"},"heading-3":{name:"heading-3",action:Do,className:_e["heading-3"],title:"Small Heading"},"separator-1":{name:"separator-1"},code:{name:"code",action:mo,className:_e.code,title:"Code"},quote:{name:"quote",action:bo,className:_e.quote,title:"Quote",default:!0},"unordered-list":{name:"unordered-list",action:Co,className:_e["unordered-list"],title:"Generic List",default:!0},"ordered-list":{name:"ordered-list",action:ko,className:_e["ordered-list"],title:"Numbered List",default:!0},"check-list":{name:"check-list",action:So,className:_e["check-list"],title:"Check List",default:!0},"clean-block":{name:"clean-block",action:Eo,className:_e["clean-block"],title:"Clean block"},"separator-2":{name:"separator-2"},link:{name:"link",action:Ao,className:_e.link,title:"Create Link",default:!0},image:{name:"image",action:Fo,className:_e.image,title:"Insert Image",default:!0},"upload-image":{name:"upload-image",action:xl,className:_e["upload-image"],title:"Import an image"},table:{name:"table",action:To,className:_e.table,title:"Insert Table"},"horizontal-rule":{name:"horizontal-rule",action:Lo,className:_e["horizontal-rule"],title:"Insert Horizontal Line"},"separator-3":{name:"separator-3"},preview:{name:"preview",action:Bo,className:_e.preview,noDisable:!0,title:"Toggle Preview",default:!0},"side-by-side":{name:"side-by-side",action:Cn,className:_e["side-by-side"],noDisable:!0,noMobile:!0,title:"Toggle Side by Side",default:!0},fullscreen:{name:"fullscreen",action:jr,className:_e.fullscreen,noDisable:!0,noMobile:!0,title:"Toggle Fullscreen",default:!0},"separator-4":{name:"separator-4"},guide:{name:"guide",action:"https://www.markdownguide.org/basic-syntax/",className:_e.guide,noDisable:!0,title:"Markdown Guide",default:!0},"separator-5":{name:"separator-5"},undo:{name:"undo",action:Mo,className:_e.undo,noDisable:!0,title:"Undo"},redo:{name:"redo",action:_o,className:_e.redo,noDisable:!0,title:"Redo"}},zp={link:["[","](#url#)"],image:["![","](#url#)"],uploadedImage:["![](#url#)",""],table:["",` | Column 1 | Column 2 | Column 3 | | -------- | -------- | -------- | @@ -91,8 +91,8 @@ Please report this to https://github.com/markedjs/marked.`,o){var f="

    An error ----- -`]},Hp={link:"URL for the link:",image:"URL of the image:"},Pp={locale:"en-US",format:{hour:"2-digit",minute:"2-digit"}},qp={bold:"**",code:"```",italic:"*"},Rp={sbInit:"Attach files by drag and dropping or pasting from clipboard.",sbOnDragEnter:"Drop image to upload it.",sbOnDrop:"Uploading image #images_names#...",sbProgress:"Uploading #file_name#: #progress#%",sbOnUploaded:"Uploaded #image_name#",sizeUnits:" B, KB, MB"},Wp={noFileGiven:"You must select a file.",typeNotAllowed:"This image type is not allowed.",fileTooLarge:`Image #image_name# is too big (#image_size#). -Maximum file size is #image_max_size#.`,importError:"Something went wrong when uploading the image #image_name#."};function re(o){o=o||{},o.parent=this;var l=!0;if(o.autoDownloadFontAwesome===!1&&(l=!1),o.autoDownloadFontAwesome!==!0)for(var s=document.styleSheets,a=0;a-1&&(l=!1);if(l){var f=document.createElement("link");f.rel="stylesheet",f.href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css",document.getElementsByTagName("head")[0].appendChild(f)}if(o.element)this.element=o.element;else if(o.element===null){console.log("EasyMDE: Error. No element was found.");return}if(o.toolbar===void 0){o.toolbar=[];for(var h in Ur)Object.prototype.hasOwnProperty.call(Ur,h)&&(h.indexOf("separator-")!=-1&&o.toolbar.push("|"),(Ur[h].default===!0||o.showIcons&&o.showIcons.constructor===Array&&o.showIcons.indexOf(h)!=-1)&&o.toolbar.push(h))}if(Object.prototype.hasOwnProperty.call(o,"previewClass")||(o.previewClass="editor-preview"),Object.prototype.hasOwnProperty.call(o,"status")||(o.status=["autosave","lines","words","cursor"],o.uploadImage&&o.status.unshift("upload-image")),o.previewRender||(o.previewRender=function(d){return this.parent.markdown(d)}),o.parsingConfig=sr({highlightFormatting:!0},o.parsingConfig||{}),o.insertTexts=sr({},Ip,o.insertTexts||{}),o.promptTexts=sr({},Hp,o.promptTexts||{}),o.blockStyles=sr({},qp,o.blockStyles||{}),o.autosave!=null&&(o.autosave.timeFormat=sr({},Pp,o.autosave.timeFormat||{})),o.iconClassMap=sr({},Be,o.iconClassMap||{}),o.shortcuts=sr({},Tp,o.shortcuts||{}),o.maxHeight=o.maxHeight||void 0,o.direction=o.direction||"ltr",typeof o.maxHeight<"u"?o.minHeight=o.maxHeight:o.minHeight=o.minHeight||"300px",o.errorCallback=o.errorCallback||function(d){alert(d)},o.uploadImage=o.uploadImage||!1,o.imageMaxSize=o.imageMaxSize||2097152,o.imageAccept=o.imageAccept||"image/png, image/jpeg, image/gif, image/avif",o.imageTexts=sr({},Rp,o.imageTexts||{}),o.errorMessages=sr({},Wp,o.errorMessages||{}),o.imagePathAbsolute=o.imagePathAbsolute||!1,o.imageCSRFName=o.imageCSRFName||"csrfmiddlewaretoken",o.imageCSRFHeader=o.imageCSRFHeader||!1,o.imageInputName=o.imageInputName||"image",o.autosave!=null&&o.autosave.unique_id!=null&&o.autosave.unique_id!=""&&(o.autosave.uniqueId=o.autosave.unique_id),o.overlayMode&&o.overlayMode.combine===void 0&&(o.overlayMode.combine=!0),this.options=o,this.render(),o.initialValue&&(!this.options.autosave||this.options.autosave.foundSavedValue!==!0)&&this.value(o.initialValue),o.uploadImage){var c=this;this.codemirror.on("dragenter",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbOnDragEnter),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("dragend",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbInit),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("dragleave",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbInit),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("dragover",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbOnDragEnter),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("drop",function(d,v){v.stopPropagation(),v.preventDefault(),o.imageUploadFunction?c.uploadImagesUsingCustomFunction(o.imageUploadFunction,v.dataTransfer.files):c.uploadImages(v.dataTransfer.files)}),this.codemirror.on("paste",function(d,v){o.imageUploadFunction?c.uploadImagesUsingCustomFunction(o.imageUploadFunction,v.clipboardData.files):c.uploadImages(v.clipboardData.files)})}}re.prototype.uploadImages=function(o,l,s){if(o.length!==0){for(var a=[],f=0;f=2){var O=z[1];if(l.imagesPreviewHandler){var I=l.imagesPreviewHandler(z[1]);typeof I=="string"&&(O=I)}if(window.EMDEimagesCache[O])F(N,window.EMDEimagesCache[O]);else{window.EMDEimagesCache[O]={};var U=document.createElement("img");U.onload=function(){window.EMDEimagesCache[O]={naturalWidth:U.naturalWidth,naturalHeight:U.naturalHeight,url:O},F(N,window.EMDEimagesCache[O])},U.src=O}}}})}this.codemirror.on("update",function(){B()}),this.gui.sideBySide=this.createSideBySide(),this._rendered=this.element,(l.autofocus===!0||o.autofocus)&&this.codemirror.focus();var L=this.codemirror;setTimeout(function(){L.refresh()}.bind(L),0)};re.prototype.cleanup=function(){document.removeEventListener("keydown",this.documentOnKeyDown)};function ic(){if(typeof localStorage=="object")try{localStorage.setItem("smde_localStorage",1),localStorage.removeItem("smde_localStorage")}catch{return!1}else return!1;return!0}re.prototype.autosave=function(){if(ic()){var o=this;if(this.options.autosave.uniqueId==null||this.options.autosave.uniqueId==""){console.log("EasyMDE: You must set a uniqueId to use the autosave feature");return}this.options.autosave.binded!==!0&&(o.element.form!=null&&o.element.form!=null&&o.element.form.addEventListener("submit",function(){clearTimeout(o.autosaveTimeoutId),o.autosaveTimeoutId=void 0,localStorage.removeItem("smde_"+o.options.autosave.uniqueId)}),this.options.autosave.binded=!0),this.options.autosave.loaded!==!0&&(typeof localStorage.getItem("smde_"+this.options.autosave.uniqueId)=="string"&&localStorage.getItem("smde_"+this.options.autosave.uniqueId)!=""&&(this.codemirror.setValue(localStorage.getItem("smde_"+this.options.autosave.uniqueId)),this.options.autosave.foundSavedValue=!0),this.options.autosave.loaded=!0);var l=o.value();l!==""?localStorage.setItem("smde_"+this.options.autosave.uniqueId,l):localStorage.removeItem("smde_"+this.options.autosave.uniqueId);var s=document.getElementById("autosaved");if(s!=null&&s!=null&&s!=""){var a=new Date,f=new Intl.DateTimeFormat([this.options.autosave.timeFormat.locale,"en-US"],this.options.autosave.timeFormat.format).format(a),h=this.options.autosave.text==null?"Autosaved: ":this.options.autosave.text;s.innerHTML=h+f}}else console.log("EasyMDE: localStorage not available, cannot autosave")};re.prototype.clearAutosavedValue=function(){if(ic()){if(this.options.autosave==null||this.options.autosave.uniqueId==null||this.options.autosave.uniqueId==""){console.log("EasyMDE: You must set a uniqueId to clear the autosave value");return}localStorage.removeItem("smde_"+this.options.autosave.uniqueId)}else console.log("EasyMDE: localStorage not available, cannot autosave")};re.prototype.openBrowseFileWindow=function(o,l){var s=this,a=this.gui.toolbar.getElementsByClassName("imageInput")[0];a.click();function f(h){s.options.imageUploadFunction?s.uploadImagesUsingCustomFunction(s.options.imageUploadFunction,h.target.files):s.uploadImages(h.target.files,o,l),a.removeEventListener("change",f)}a.addEventListener("change",f)};re.prototype.uploadImage=function(o,l,s){var a=this;l=l||function(y){ec(a,y)};function f(v){a.updateStatusBar("upload-image",v),setTimeout(function(){a.updateStatusBar("upload-image",a.options.imageTexts.sbInit)},1e4),s&&typeof s=="function"&&s(v),a.options.errorCallback(v)}function h(v){var y=a.options.imageTexts.sizeUnits.split(",");return v.replace("#image_name#",o.name).replace("#image_size#",co(o.size,y)).replace("#image_max_size#",co(a.options.imageMaxSize,y))}if(o.size>this.options.imageMaxSize){f(h(this.options.errorMessages.fileTooLarge));return}var c=new FormData;c.append("image",o),a.options.imageCSRFToken&&!a.options.imageCSRFHeader&&c.append(a.options.imageCSRFName,a.options.imageCSRFToken);var d=new XMLHttpRequest;d.upload.onprogress=function(v){if(v.lengthComputable){var y=""+Math.round(v.loaded*100/v.total);a.updateStatusBar("upload-image",a.options.imageTexts.sbProgress.replace("#file_name#",o.name).replace("#progress#",y))}},d.open("POST",this.options.imageUploadEndpoint),a.options.imageCSRFToken&&a.options.imageCSRFHeader&&d.setRequestHeader(a.options.imageCSRFName,a.options.imageCSRFToken),d.onload=function(){try{var v=JSON.parse(this.responseText)}catch{console.error("EasyMDE: The server did not return a valid json."),f(h(a.options.errorMessages.importError));return}this.status===200&&v&&!v.error&&v.data&&v.data.filePath?l((a.options.imagePathAbsolute?"":window.location.origin+"/")+v.data.filePath):v.error&&v.error in a.options.errorMessages?f(h(a.options.errorMessages[v.error])):v.error?f(h(v.error)):(console.error("EasyMDE: Received an unexpected response after uploading the image."+this.status+" ("+this.statusText+")"),f(h(a.options.errorMessages.importError)))},d.onerror=function(v){console.error("EasyMDE: An unexpected error occurred when trying to upload the image."+v.target.status+" ("+v.target.statusText+")"),f(a.options.errorMessages.importError)},d.send(c)};re.prototype.uploadImageUsingCustomFunction=function(o,l){var s=this;function a(c){ec(s,c)}function f(c){var d=h(c);s.updateStatusBar("upload-image",d),setTimeout(function(){s.updateStatusBar("upload-image",s.options.imageTexts.sbInit)},1e4),s.options.errorCallback(d)}function h(c){var d=s.options.imageTexts.sizeUnits.split(",");return c.replace("#image_name#",l.name).replace("#image_size#",co(l.size,d)).replace("#image_max_size#",co(s.options.imageMaxSize,d))}o.apply(this,[l,a,f])};re.prototype.setPreviewMaxHeight=function(){var o=this.codemirror,l=o.getWrapperElement(),s=l.nextSibling,a=parseInt(window.getComputedStyle(l).paddingTop),f=parseInt(window.getComputedStyle(l).borderTopWidth),h=parseInt(this.options.maxHeight),c=h+a*2+f*2,d=c.toString()+"px";s.style.height=d};re.prototype.createSideBySide=function(){var o=this.codemirror,l=o.getWrapperElement(),s=l.nextSibling;if(!s||!s.classList.contains("editor-preview-side")){if(s=document.createElement("div"),s.className="editor-preview-side",this.options.previewClass)if(Array.isArray(this.options.previewClass))for(var a=0;a"&&(l=l.substring(1)),o)try{if(o.matches)return o.matches(l);if(o.msMatchesSelector)return o.msMatchesSelector(l);if(o.webkitMatchesSelector)return o.webkitMatchesSelector(l)}catch{return!1}return!1}}function vc(o){return o.host&&o!==document&&o.host.nodeType&&o.host!==o?o.host:o.parentNode}function Gt(o,l,s,a){if(o){s=s||document;do{if(l!=null&&(l[0]===">"?o.parentNode===s&&Wo(o,l):Wo(o,l))||a&&o===s)return o;if(o===s)break}while(o=vc(o))}return null}var sc=/\s+/g;function zt(o,l,s){if(o&&l)if(o.classList)o.classList[s?"add":"remove"](l);else{var a=(" "+o.className+" ").replace(sc," ").replace(" "+l+" "," ");o.className=(a+(s?" "+l:"")).replace(sc," ")}}function ge(o,l,s){var a=o&&o.style;if(a){if(s===void 0)return document.defaultView&&document.defaultView.getComputedStyle?s=document.defaultView.getComputedStyle(o,""):o.currentStyle&&(s=o.currentStyle),l===void 0?s:s[l];!(l in a)&&l.indexOf("webkit")===-1&&(l="-webkit-"+l),a[l]=s+(typeof s=="string"?"":"px")}}function Ai(o,l){var s="";if(typeof o=="string")s=o;else do{var a=ge(o,"transform");a&&a!=="none"&&(s=a+" "+s)}while(!l&&(o=o.parentNode));var f=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return f&&new f(s)}function bc(o,l,s){if(o){var a=o.getElementsByTagName(l),f=0,h=a.length;if(s)for(;f=h:c=f<=h,!c)return a;if(a===$t())break;a=Tr(a,!1)}return!1}function Fi(o,l,s,a){for(var f=0,h=0,c=o.children;h2&&arguments[2]!==void 0?arguments[2]:{},f=a.evt,h=jp(a,r0);wn.pluginEvent.bind(me)(l,s,er({dragEl:$,parentEl:Ue,ghostEl:xe,rootEl:He,nextEl:Yr,lastDownEl:Ho,cloneEl:Re,cloneHidden:Fr,dragStarted:dn,putSortable:ft,activeSortable:me.active,originalEvent:f,oldIndex:Ei,oldDraggableIndex:vn,newIndex:Nt,newDraggableIndex:Ar,hideGhostForTarget:Ec,unhideGhostForTarget:Ac,cloneNowHidden:function(){Fr=!0},cloneNowShown:function(){Fr=!1},dispatchSortableEvent:function(d){kt({sortable:s,name:d,originalEvent:f})}},h))};function kt(o){t0(er({putSortable:ft,cloneEl:Re,targetEl:$,rootEl:He,oldIndex:Ei,oldDraggableIndex:vn,newIndex:Nt,newDraggableIndex:Ar},o))}var $,Ue,xe,He,Yr,Ho,Re,Fr,Ei,Nt,vn,Ar,zo,ft,Si=!1,Uo=!1,jo=[],Xr,jt,Dl,kl,cc,dc,dn,ki,bn,yn=!1,No=!1,Po,mt,Sl=[],Ml=!1,Go=[],Ko=typeof document<"u",Oo=Nl,hc=xn||cr?"cssFloat":"float",i0=Ko&&!gc&&!Nl&&"draggable"in document.createElement("div"),Dc=function(){if(Ko){if(cr)return!1;var o=document.createElement("x");return o.style.cssText="pointer-events:auto",o.style.pointerEvents==="auto"}}(),kc=function(l,s){var a=ge(l),f=parseInt(a.width)-parseInt(a.paddingLeft)-parseInt(a.paddingRight)-parseInt(a.borderLeftWidth)-parseInt(a.borderRightWidth),h=Fi(l,0,s),c=Fi(l,1,s),d=h&&ge(h),v=c&&ge(c),y=d&&parseInt(d.marginLeft)+parseInt(d.marginRight)+Ve(h).width,x=v&&parseInt(v.marginLeft)+parseInt(v.marginRight)+Ve(c).width;if(a.display==="flex")return a.flexDirection==="column"||a.flexDirection==="column-reverse"?"vertical":"horizontal";if(a.display==="grid")return a.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(h&&d.float&&d.float!=="none"){var D=d.float==="left"?"left":"right";return c&&(v.clear==="both"||v.clear===D)?"vertical":"horizontal"}return h&&(d.display==="block"||d.display==="flex"||d.display==="table"||d.display==="grid"||y>=f&&a[hc]==="none"||c&&a[hc]==="none"&&y+x>f)?"vertical":"horizontal"},n0=function(l,s,a){var f=a?l.left:l.top,h=a?l.right:l.bottom,c=a?l.width:l.height,d=a?s.left:s.top,v=a?s.right:s.bottom,y=a?s.width:s.height;return f===d||h===v||f+c/2===d+y/2},o0=function(l,s){var a;return jo.some(function(f){var h=f[Tt].options.emptyInsertThreshold;if(!(!h||Ol(f))){var c=Ve(f),d=l>=c.left-h&&l<=c.right+h,v=s>=c.top-h&&s<=c.bottom+h;if(d&&v)return a=f}}),a},Sc=function(l){function s(h,c){return function(d,v,y,x){var D=d.options.group.name&&v.options.group.name&&d.options.group.name===v.options.group.name;if(h==null&&(c||D))return!0;if(h==null||h===!1)return!1;if(c&&h==="clone")return h;if(typeof h=="function")return s(h(d,v,y,x),c)(d,v,y,x);var S=(c?d:v).options.group.name;return h===!0||typeof h=="string"&&h===S||h.join&&h.indexOf(S)>-1}}var a={},f=l.group;(!f||Ll(f)!="object")&&(f={name:f}),a.name=f.name,a.checkPull=s(f.pull,!0),a.checkPut=s(f.put),a.revertClone=f.revertClone,l.group=a},Ec=function(){!Dc&&xe&&ge(xe,"display","none")},Ac=function(){!Dc&&xe&&ge(xe,"display","")};Ko&&!gc&&document.addEventListener("click",function(o){if(Uo)return o.preventDefault(),o.stopPropagation&&o.stopPropagation(),o.stopImmediatePropagation&&o.stopImmediatePropagation(),Uo=!1,!1},!0);var Kr=function(l){if($){l=l.touches?l.touches[0]:l;var s=o0(l.clientX,l.clientY);if(s){var a={};for(var f in l)l.hasOwnProperty(f)&&(a[f]=l[f]);a.target=a.rootEl=s,a.preventDefault=void 0,a.stopPropagation=void 0,s[Tt]._onDragOver(a)}}},a0=function(l){$&&$.parentNode[Tt]._isOutsideThisEl(l.target)};function me(o,l){if(!(o&&o.nodeType&&o.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(o));this.el=o,this.options=l=fr({},l),o[Tt]=this;var s={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(o.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return kc(o,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(c,d){c.setData("Text",d.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:me.supportPointer!==!1&&"PointerEvent"in window&&(!gn||Nl),emptyInsertThreshold:5};wn.initializePlugins(this,o,s);for(var a in s)!(a in l)&&(l[a]=s[a]);Sc(l);for(var f in this)f.charAt(0)==="_"&&typeof this[f]=="function"&&(this[f]=this[f].bind(this));this.nativeDraggable=l.forceFallback?!1:i0,this.nativeDraggable&&(this.options.touchStartThreshold=1),l.supportPointer?Se(o,"pointerdown",this._onTapStart):(Se(o,"mousedown",this._onTapStart),Se(o,"touchstart",this._onTapStart)),this.nativeDraggable&&(Se(o,"dragover",this),Se(o,"dragenter",this)),jo.push(this.el),l.store&&l.store.get&&this.sort(l.store.get(this)||[]),fr(this,Vp())}me.prototype={constructor:me,_isOutsideThisEl:function(l){!this.el.contains(l)&&l!==this.el&&(ki=null)},_getDirection:function(l,s){return typeof this.options.direction=="function"?this.options.direction.call(this,l,s,$):this.options.direction},_onTapStart:function(l){if(l.cancelable){var s=this,a=this.el,f=this.options,h=f.preventOnFilter,c=l.type,d=l.touches&&l.touches[0]||l.pointerType&&l.pointerType==="touch"&&l,v=(d||l).target,y=l.target.shadowRoot&&(l.path&&l.path[0]||l.composedPath&&l.composedPath()[0])||v,x=f.filter;if(p0(a),!$&&!(/mousedown|pointerdown/.test(c)&&l.button!==0||f.disabled)&&!y.isContentEditable&&!(!this.nativeDraggable&&gn&&v&&v.tagName.toUpperCase()==="SELECT")&&(v=Gt(v,f.draggable,a,!1),!(v&&v.animated)&&Ho!==v)){if(Ei=It(v),vn=It(v,f.draggable),typeof x=="function"){if(x.call(this,l,v,this)){kt({sortable:s,rootEl:y,name:"filter",targetEl:v,toEl:a,fromEl:a}),Ft("filter",s,{evt:l}),h&&l.preventDefault();return}}else if(x&&(x=x.split(",").some(function(D){if(D=Gt(y,D.trim(),a,!1),D)return kt({sortable:s,rootEl:D,name:"filter",targetEl:v,fromEl:a,toEl:a}),Ft("filter",s,{evt:l}),!0}),x)){h&&l.preventDefault();return}f.handle&&!Gt(y,f.handle,a,!1)||this._prepareDragStart(l,d,v)}}},_prepareDragStart:function(l,s,a){var f=this,h=f.el,c=f.options,d=h.ownerDocument,v;if(a&&!$&&a.parentNode===h){var y=Ve(a);if(He=h,$=a,Ue=$.parentNode,Yr=$.nextSibling,Ho=a,zo=c.group,me.dragged=$,Xr={target:$,clientX:(s||l).clientX,clientY:(s||l).clientY},cc=Xr.clientX-y.left,dc=Xr.clientY-y.top,this._lastX=(s||l).clientX,this._lastY=(s||l).clientY,$.style["will-change"]="all",v=function(){if(Ft("delayEnded",f,{evt:l}),me.eventCanceled){f._onDrop();return}f._disableDelayedDragEvents(),!lc&&f.nativeDraggable&&($.draggable=!0),f._triggerDragStart(l,s),kt({sortable:f,name:"choose",originalEvent:l}),zt($,c.chosenClass,!0)},c.ignore.split(",").forEach(function(x){bc($,x.trim(),El)}),Se(d,"dragover",Kr),Se(d,"mousemove",Kr),Se(d,"touchmove",Kr),c.supportPointer?(Se(d,"pointerup",f._onDrop),!this.nativeDraggable&&Se(d,"pointercancel",f._onDrop)):(Se(d,"mouseup",f._onDrop),Se(d,"touchend",f._onDrop),Se(d,"touchcancel",f._onDrop)),lc&&this.nativeDraggable&&(this.options.touchStartThreshold=4,$.draggable=!0),Ft("delayStart",this,{evt:l}),c.delay&&(!c.delayOnTouchOnly||s)&&(!this.nativeDraggable||!(xn||cr))){if(me.eventCanceled){this._onDrop();return}c.supportPointer?(Se(d,"pointerup",f._disableDelayedDrag),Se(d,"pointercancel",f._disableDelayedDrag)):(Se(d,"mouseup",f._disableDelayedDrag),Se(d,"touchend",f._disableDelayedDrag),Se(d,"touchcancel",f._disableDelayedDrag)),Se(d,"mousemove",f._delayedDragTouchMoveHandler),Se(d,"touchmove",f._delayedDragTouchMoveHandler),c.supportPointer&&Se(d,"pointermove",f._delayedDragTouchMoveHandler),f._dragStartTimer=setTimeout(v,c.delay)}else v()}},_delayedDragTouchMoveHandler:function(l){var s=l.touches?l.touches[0]:l;Math.max(Math.abs(s.clientX-this._lastX),Math.abs(s.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){$&&El($),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var l=this.el.ownerDocument;ke(l,"mouseup",this._disableDelayedDrag),ke(l,"touchend",this._disableDelayedDrag),ke(l,"touchcancel",this._disableDelayedDrag),ke(l,"pointerup",this._disableDelayedDrag),ke(l,"pointercancel",this._disableDelayedDrag),ke(l,"mousemove",this._delayedDragTouchMoveHandler),ke(l,"touchmove",this._delayedDragTouchMoveHandler),ke(l,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(l,s){s=s||l.pointerType=="touch"&&l,!this.nativeDraggable||s?this.options.supportPointer?Se(document,"pointermove",this._onTouchMove):s?Se(document,"touchmove",this._onTouchMove):Se(document,"mousemove",this._onTouchMove):(Se($,"dragend",this),Se(He,"dragstart",this._onDragStart));try{document.selection?qo(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(l,s){if(Si=!1,He&&$){Ft("dragStarted",this,{evt:s}),this.nativeDraggable&&Se(document,"dragover",a0);var a=this.options;!l&&zt($,a.dragClass,!1),zt($,a.ghostClass,!0),me.active=this,l&&this._appendGhost(),kt({sortable:this,name:"start",originalEvent:s})}else this._nulling()},_emulateDragOver:function(){if(jt){this._lastX=jt.clientX,this._lastY=jt.clientY,Ec();for(var l=document.elementFromPoint(jt.clientX,jt.clientY),s=l;l&&l.shadowRoot&&(l=l.shadowRoot.elementFromPoint(jt.clientX,jt.clientY),l!==s);)s=l;if($.parentNode[Tt]._isOutsideThisEl(l),s)do{if(s[Tt]){var a=void 0;if(a=s[Tt]._onDragOver({clientX:jt.clientX,clientY:jt.clientY,target:l,rootEl:s}),a&&!this.options.dragoverBubble)break}l=s}while(s=vc(s));Ac()}},_onTouchMove:function(l){if(Xr){var s=this.options,a=s.fallbackTolerance,f=s.fallbackOffset,h=l.touches?l.touches[0]:l,c=xe&&Ai(xe,!0),d=xe&&c&&c.a,v=xe&&c&&c.d,y=Oo&&mt&&fc(mt),x=(h.clientX-Xr.clientX+f.x)/(d||1)+(y?y[0]-Sl[0]:0)/(d||1),D=(h.clientY-Xr.clientY+f.y)/(v||1)+(y?y[1]-Sl[1]:0)/(v||1);if(!me.active&&!Si){if(a&&Math.max(Math.abs(h.clientX-this._lastX),Math.abs(h.clientY-this._lastY))=0&&(kt({rootEl:Ue,name:"add",toEl:Ue,fromEl:He,originalEvent:l}),kt({sortable:this,name:"remove",toEl:Ue,originalEvent:l}),kt({rootEl:Ue,name:"sort",toEl:Ue,fromEl:He,originalEvent:l}),kt({sortable:this,name:"sort",toEl:Ue,originalEvent:l})),ft&&ft.save()):Nt!==Ei&&Nt>=0&&(kt({sortable:this,name:"update",toEl:Ue,originalEvent:l}),kt({sortable:this,name:"sort",toEl:Ue,originalEvent:l})),me.active&&((Nt==null||Nt===-1)&&(Nt=Ei,Ar=vn),kt({sortable:this,name:"end",toEl:Ue,originalEvent:l}),this.save()))),this._nulling()},_nulling:function(){Ft("nulling",this),He=$=Ue=xe=Yr=Re=Ho=Fr=Xr=jt=dn=Nt=Ar=Ei=vn=ki=bn=ft=zo=me.dragged=me.ghost=me.clone=me.active=null;var l=this.el;Go.forEach(function(s){l.contains(s)&&(s.checked=!0)}),Go.length=Dl=kl=0},handleEvent:function(l){switch(l.type){case"drop":case"dragend":this._onDrop(l);break;case"dragenter":case"dragover":$&&(this._onDragOver(l),l0(l));break;case"selectstart":l.preventDefault();break}},toArray:function(){for(var l=[],s,a=this.el.children,f=0,h=a.length,c=this.options;ff.right+h||o.clientY>a.bottom&&o.clientX>a.left:o.clientY>f.bottom+h||o.clientX>a.right&&o.clientY>a.top}function c0(o,l,s,a,f,h,c,d){var v=a?o.clientY:o.clientX,y=a?s.height:s.width,x=a?s.top:s.left,D=a?s.bottom:s.right,S=!1;if(!c){if(d&&Pox+y*h/2:vD-Po)return-bn}else if(v>x+y*(1-f)/2&&vD-y*h/2)?v>x+y/2?1:-1:0}function d0(o){return It($)0||D>0&&S0?"Converting "+l+" photo"+(l>1?"s":"")+"\u2026":"Uploading "+D+" photo"+(D>1?"s":"")+"\u2026",s.details.open=!0):D>0?(s.summary.textContent="\u2713 "+D+" photo"+(D>1?"s":"")+" ready \u2014 tap to review",s.details.open=!1):(s.summary.textContent="Photos (1\u20136)",s.details.open=!0)}}function c(){h(),setTimeout(h,150),setTimeout(h,500)}function d(){var x=o.querySelector('button[type="submit"], input[type="submit"]');if(x&&(x.disabled=l>0),l>0)f("Converting "+l+" photo"+(l>1?"s":"")+"\u2026");else{var D=Bc();D&&/Converting/.test(D.textContent)&&f("")}h()}o.addEventListener("submit",function(x){l>0&&(x.preventDefault(),f("Hang on \u2014 a photo is still converting.","err"))},!0);function v(x){return function(D){var S=D&&D.file;return S?Hc(S).then(function(F){return F?(l++,d(),import("./heic-to-CN7JBE7H.js").then(function(B){var L=B.heicTo||B.default&&B.default.heicTo;return L({blob:S,type:"image/jpeg",quality:.85})}).then(function(B){var L=new File([B],y0(S.name),{type:"image/jpeg"});x.addFile(L)}).catch(function(){f("A photo couldn\u2019t be converted and was skipped \u2014 the others are fine.","err")}).then(function(){l--,d()}),!1):!0}):!0}}var y=0;(function x(){var D=window.GravFilePond&&window.GravFilePond.getInstances?window.GravFilePond.getInstances():[];if(!D.length){y++<120&&setTimeout(x,50);return}D.forEach(function(S){S&&!S._heicHooked&&(S._heicHooked=!0,S.setOptions({beforeAddFile:v(S),allowReorder:!0,itemInsertLocation:"after"}),a=S,["addfile","processfile","processfiles","removefile","error"].forEach(function(F){try{S.on(F,c)}catch{}}),h())})})()}function ct(o){return document.querySelector('[name="data['+o+']"]')}function C0(){var o=Array.prototype.slice.call(document.querySelectorAll(".advanced-field"));if(o.length){var l=[];if(o.forEach(function(h){var c=h.closest(".form-field");c&&l.indexOf(c)===-1&&l.push(c)}),!!l.length){var s=document.createElement("details");s.className="more-options";var a=document.createElement("summary");a.className="more-options__summary",a.textContent="More options",s.appendChild(a),l[0].parentNode.insertBefore(s,l[0]),l.forEach(function(h){s.appendChild(h)});var f=l.some(function(h){var c=h.querySelector('input[type="text"]');if(c&&c.value.trim())return!0;var d=h.querySelector('input[type="radio"]:checked');if(!d||!d.value)return!1;var v=h.querySelector('input[type="radio"][checked]');return v?d.value!==v.value:d.value!=="0"});f&&(s.open=!0)}}}var D0={0:"Sunny",1:"Partly cloudy",2:"Partly cloudy",3:"Cloudy",45:"Foggy",48:"Foggy",51:"Drizzle",53:"Drizzle",55:"Drizzle",56:"Drizzle",57:"Drizzle",61:"Rain",63:"Rain",65:"Rain",66:"Rain",67:"Rain",80:"Rain",81:"Rain",82:"Rain",71:"Snow",73:"Snow",75:"Snow",77:"Snow",85:"Snow",86:"Snow",95:"Thunderstorm",96:"Thunderstorm",99:"Thunderstorm"};function dr(o,l,s){o&&(o.className="form-status"+(s?" form-status--"+s:""),o.textContent=l||"")}function k0(){var o=document.getElementById("get-location"),l=document.getElementById("get-weather");if(!o&&!l)return;var s=document.getElementById("location-status"),a=document.getElementById("weather-status");function f(){var d=ct("lat"),v=ct("lng"),y=d?d.value.trim():"",x=v?v.value.trim():"";return y&&x?{lat:y,lng:x}:null}function h(){if(l){var d=!!f();l.disabled=!d,l.title=d?"":"Get location first"}}h();function c(d,v){var y=ct("location_city"),x=ct("location_country");if(!((!y||y.value.trim())&&(!x||x.value.trim()))){var D="https://api.bigdatacloud.net/data/reverse-geocode-client?latitude="+encodeURIComponent(d)+"&longitude="+encodeURIComponent(v)+"&localityLanguage=en";fetch(D).then(function(S){return S.json()}).then(function(S){var F=(S.city||S.locality||"").trim(),B=(S.countryName||"").trim();y&&!y.value.trim()&&F&&(y.value=F),x&&!x.value.trim()&&B&&(x.value=B);var L=[F,B].filter(Boolean).join(", ");L&&dr(s,"\u2713 Location captured \xB7 "+L,"ok")}).catch(function(){})}}o&&o.addEventListener("click",function(){if(!navigator.geolocation){dr(s,"Geolocation is not supported on this device.","err");return}o.classList.add("is-loading"),o.disabled=!0,dr(s,"Getting location\u2026"),navigator.geolocation.getCurrentPosition(function(d){var v=d.coords.latitude.toFixed(6),y=d.coords.longitude.toFixed(6),x=ct("lat"),D=ct("lng");x&&(x.value=v),D&&(D.value=y),o.classList.remove("is-loading"),o.disabled=!1,dr(s,"\u2713 Location captured \xB7 "+v+", "+y,"ok"),h(),c(v,y);var S=document.querySelector(".location-details");S&&S.open&&Ul()},function(d){o.classList.remove("is-loading"),o.disabled=!1,dr(s,"\u2717 "+(d&&d.message?d.message:"Could not get location")+" \u2014 enter coordinates manually if needed.","err")},{enableHighAccuracy:!0,timeout:15e3})}),l&&l.addEventListener("click",function(){var d=f();if(!d){dr(a,"Get location first, then fetch weather.","err");return}l.classList.add("is-loading"),l.disabled=!0,dr(a,"Fetching weather\u2026");var v="https://api.open-meteo.com/v1/forecast?latitude="+d.lat+"&longitude="+d.lng+"¤t=temperature_2m,weather_code&temperature_unit=celsius";fetch(v).then(function(y){return y.json()}).then(function(y){var x=Math.round(y.current.temperature_2m),D=D0[y.current.weather_code]||"Cloudy",S=ct("weather_temp_c"),F=ct("weather_desc");S&&(S.value=x),F&&(F.value=D),l.classList.remove("is-loading"),h(),dr(a,"\u2713 Weather set \xB7 "+D+" \xB7 "+x+"\xB0C (edit above if needed)","ok")}).catch(function(){l.classList.remove("is-loading"),h(),dr(a,"\u2717 Could not fetch weather \u2014 set it manually above.","err")})})}var Ul=function(){};function S0(o,l){var s=null;return function(){var a=arguments;clearTimeout(s),s=setTimeout(function(){o.apply(null,a)},l)}}function E0(o){return[o.name,o.admin1,o.country].filter(Boolean).join(", ")}function A0(){var o=ct("lat"),l=ct("lng");if(!o||!l)return;var s=o.closest(".form-field"),a=l.closest(".form-field");if(!s||!a)return;var f=ct("location_city"),h=ct("location_country"),c=h?h.closest(".form-field"):null,d=c||s,v=document.createElement("details");v.className="location-details";var y=document.createElement("summary");y.className="location-details__summary",y.textContent="More location details",v.appendChild(y);var x=document.createElement("div");x.className="location-details__body";var D=document.createElement("div");D.className="location-search-row";var S=document.createElement("button");S.type="button",S.id="lookup-coords",S.className="btn-action";var F="\u{1F50D} Look up coordinates";S.textContent=F,D.appendChild(S),x.appendChild(D);var B=document.createElement("p");B.id="location-search-hint",B.className="location-search-hint",B.setAttribute("role","status"),x.appendChild(B);var L=document.createElement("ul");L.id="location-search-results",L.className="location-search-results",x.appendChild(L);var T=document.createElement("div");T.id="location-map",T.className="location-map",x.appendChild(T),v.appendChild(x),d.parentNode.insertBefore(v,d.nextSibling),v.appendChild(s),v.appendChild(a);function N(G){return G===o?"location-lat-note":"location-lng-note"}function z(){[o,l].forEach(function(G){G.classList.add("location-field--mismatch"),G.setAttribute("aria-invalid","true");var k=N(G),H=document.getElementById(k);H||(H=document.createElement("span"),H.id=k,H.className="location-field-note",H.setAttribute("role","status"),H.setAttribute("aria-live","polite"),H.textContent="Not reflected on the map yet.",G.parentNode.insertBefore(H,G.nextSibling)),G.setAttribute("aria-describedby",k)})}function O(){[o,l].forEach(function(G){G.classList.remove("location-field--mismatch"),G.removeAttribute("aria-invalid"),G.removeAttribute("aria-describedby");var k=document.getElementById(N(G));k&&k.parentNode&&k.parentNode.removeChild(k)})}var I=null;function U(G){var k=String(G).trim();return!k||!/^[+-]?(\d+(\.\d*)?|\.\d+)$/.test(k)?NaN:Number(k)}function j(){var G=U(o.value),k=U(l.value),H=isFinite(G)&&isFinite(k)&&G>=-90&&G<=90&&k>=-180&&k<=180;H?(o.value=G.toFixed(6),l.value=k.toFixed(6),O(),I&&I.setPin(G,k)):o.value.trim()||l.value.trim()?z():(O(),I&&I.clearPin())}Ul=j;function K(G){o.value=G.lat.toFixed(6),l.value=G.lng.toFixed(6),O()}v.addEventListener("toggle",function(){v.open&&Mc(T,K).then(function(G){I=G,G.resize(),j()}).catch(function(){W("Map preview unavailable \u2014 you can still enter coordinates directly."),j()})}),o.addEventListener("blur",j),l.addEventListener("blur",j);var de=S0(j,400);o.addEventListener("input",de),l.addEventListener("input",de);function W(G){B.textContent=G||""}function oe(){L.innerHTML=""}function X(G){G.forEach(function(k){var H=document.createElement("li"),q=document.createElement("button");q.type="button",q.textContent=E0(k),q.addEventListener("click",function(){o.value=Number(k.latitude).toFixed(6),l.value=Number(k.longitude).toFixed(6),oe(),j()}),H.appendChild(q),L.appendChild(H)})}S.addEventListener("click",function(){oe();var G=f?f.value.trim():"",k=h?h.value.trim():"";if(!G&&!k){W("Enter a city or country first.");return}var H=G||k;W(""),S.disabled=!0,S.textContent="Searching\u2026";var q="https://geocoding-api.open-meteo.com/v1/search?name="+encodeURIComponent(H)+"&count=10&language=en&format=json",Q=new AbortController,he=setTimeout(function(){Q.abort()},1e4);fetch(q,{signal:Q.signal}).then(function(pe){if(!pe.ok)throw new Error("geocode http "+pe.status);return pe.json()}).then(function(pe){var Ee=pe&&pe.results||[];if(!Ee.length){W("No matches \u2014 try adding a country, or drag the pin on the map.");return}if(k){var A=k.toLowerCase(),w=function(ee){return(ee.admin1||"").toLowerCase().indexOf(A)!==-1||(ee.country||"").toLowerCase().indexOf(A)!==-1};Ee=Ee.slice().sort(function(ee,Ce){var ye=w(ee),lt=w(Ce);return ye===lt?0:ye?-1:1})}X(Ee)}).catch(function(){W("Couldn\u2019t reach the lookup service \u2014 check your connection and try again, or drag the pin on the map.")}).then(function(){clearTimeout(he),S.disabled=!1,S.textContent=F})}),j()}function F0(){var o=new Date;return o.setSeconds(0,0),o.setMinutes(o.getMinutes()-o.getTimezoneOffset()),o.toISOString().slice(0,16)}function T0(){var o={title:"Title",date:"Date & time",content:"Content"},l=document.querySelector('form[name="new-entry"]');if(!l)return;var s=ct("date");s&&!String(s.value).trim()&&(s.value=F0());function a(){l.querySelectorAll(".field-error").forEach(function(c){c.remove()}),l.querySelectorAll(".field-invalid").forEach(function(c){c.classList.remove("field-invalid")})}function f(c,d){c.classList.add("field-invalid");var v=document.createElement("span");v.className="field-error",v.textContent=d,c.parentNode.insertBefore(v,c.nextSibling)}function h(c){var d=l.querySelector(".photos-collapse"),v,y;if(d?(d.open=!0,y=d.querySelector(".photos-collapse__summary"),v=d):(v=document.querySelector(".filepond-root, .form-input-file"),y=v),!y)return v||null;var x=document.createElement("span");return x.className="field-error",x.textContent=c,y.insertAdjacentElement("afterend",x),v||y}l.addEventListener("submit",function(c){a();var d=null;!Yo&&document.querySelectorAll(".filepond--item").length<1&&(d=h("Add at least one photo.")),Object.keys(o).forEach(function(y){var x=ct(y);x&&!String(x.value).trim()&&(f(x,o[y]+" is required."),d||(d=x))});var v=l.querySelector(".location-field--mismatch");v&&!d&&(d=v),d&&(c.preventDefault(),typeof d.focus=="function"&&d.focus(),d.scrollIntoView({behavior:"smooth",block:"center"}))})}var ql="intotheeast:new-entry-draft";function L0(o){return Array.prototype.slice.call(o.querySelectorAll('[name^="data["]')).filter(function(l){if(l.type==="file")return!1;var s=l.name;return s.indexOf("data[_json")!==0&&s.indexOf("data[photos")!==0})}function M0(){var o=document.querySelector(".filepond-root, .form-input-file");if(!(!o||!o.parentNode)&&!o.parentNode.querySelector(".photo-reauth-hint")){var l=document.createElement("p");l.className="photo-reauth-hint is-shown",l.textContent="Your text was restored \u2014 photos need re-selecting (they can\u2019t be saved in a draft).",o.parentNode.insertBefore(l,o.nextSibling)}}function B0(){var o=document.querySelector('form[name="new-entry"]');if(!o||Yo)return;if(document.querySelector(".notices.success")){try{localStorage.removeItem(ql)}catch{}return}function l(){var h={};L0(o).forEach(function(c){c.type==="radio"?c.checked&&(h[c.name]=c.value):h[c.name]=c.value});try{localStorage.setItem(ql,JSON.stringify(h))}catch{}}var s=null;try{s=localStorage.getItem(ql)}catch{s=null}if(s){var a=null;try{a=JSON.parse(s)}catch{a=null}if(a){var f=!1;Object.keys(a).forEach(function(h){var c=a[h];if(c!=null&&String(c).trim()&&(f=!0),h!=="data[content]"){var d=o.querySelectorAll('input[type="radio"][name="'+h+'"]');if(d.length){d.forEach(function(y){y.checked=y.value===c});return}var v=o.querySelector('[name="'+h+'"]');v&&v.type!=="file"&&(v.value=c)}}),window.postFormEditor&&a["data[content]"]!=null&&window.postFormEditor.value(a["data[content]"]),f&&M0()}}o.addEventListener("input",l),o.addEventListener("change",l),window.postFormEditor&&window.postFormEditor.codemirror.on("change",l)}function _0(){var o=document.querySelector(".post-form-wrap"),l=document.querySelector(".post-form-wrap .notices.success, .post-form-wrap .notices.green");if(!(!o||!l)){var s=document.createElement("div");s.className="post-success";var a=document.createElement("p");a.className="post-success__title",a.textContent="\u2713 Saved to your journal.",s.appendChild(a);var f=document.createElement("div");f.className="post-success__actions";var h=o.getAttribute("data-trip-url");if(h){var c=document.createElement("a");c.className="post-success__view",c.href=h,c.textContent="View your journal \u2192",f.appendChild(c)}var d=document.createElement("a");d.className="post-success__again",d.href=window.location.pathname,d.textContent="Post another",f.appendChild(d),s.appendChild(f),l.parentNode.insertBefore(s,l.nextSibling),["form",".form-action-row","#location-status","#weather-status"].forEach(function(v){var y=o.querySelector(v);y&&(y.style.display="none")}),l.scrollIntoView({behavior:"smooth",block:"start"})}}var Yo=!1;function _c(o){return new URLSearchParams(window.location.search).get(o)}function hr(o,l){var s=ct(o);s&&(s.value=l==null?"":String(l))}function Rl(o,l){var s=l?"1":"0",a=document.querySelectorAll('[name="data['+o+']"]');Array.prototype.forEach.call(a,function(f){f.checked=String(f.value)===s})}function z0(o){var l=o==null?"":String(o);if(window.postFormEditor&&typeof window.postFormEditor.value=="function")window.postFormEditor.value(l);else{var s=ct("content");s&&(s.value=l)}}function zc(o,l){var s=o.querySelectorAll("input, textarea, select, button");Array.prototype.forEach.call(s,function(a){a.type==="file"||a.name&&a.name.indexOf("data[photos")===0||(a.disabled=l)}),window.postFormEditor&&window.postFormEditor.codemirror&&window.postFormEditor.codemirror.setOption("readOnly",l?"nocursor":!1)}function Wl(o,l){o&&(o.tagName==="INPUT"?o.value=l:o.textContent=l)}function N0(o,l){var s=o.querySelector(".post-edit-error");if(s){s.textContent=l;return}var a=document.createElement("div");a.className="post-edit-error",a.setAttribute("role","alert"),a.textContent=l;var f=o.querySelector("h1");f?f.insertAdjacentElement("afterend",a):o.insertBefore(a,o.firstChild)}var O0=/\.(jpe?g|png|webp|heic|heif|gif)$/i;function Nc(o){var l=/(?:^|\/)photo-0*(\d+)\./i.exec(o);return l?parseInt(l[1],10):Number.MAX_SAFE_INTEGER}function I0(o,l){var s=Nc(o),a=Nc(l);return s!==a?s-a:ol?1:0}function Oc(o,l){var s=String(o||"photo"),a=s.lastIndexOf("."),f=(a>0?s.slice(0,a):s).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"photo",h=l?".jpg":a>0?s.slice(a).toLowerCase():".jpg",c=Date.now().toString(36)+Math.random().toString(36).slice(2,6);return f+"-"+c+h}function H0(o){var l=document.querySelector('form[name="new-entry"]');if(!l||!o)return;var s=o.split("/").filter(Boolean).pop();if(!s)return;var a=document.querySelector(".filepond-root, .form-input-file"),f=a?a.closest(".form-field"):null;f&&(f.style.display="none");var h=l.querySelector(".photos-collapse");h&&(h.style.display="none");var c=document.createElement("div");c.className="photo-editor",c.innerHTML='

    Photos

    ',f&&f.parentNode?f.parentNode.insertBefore(c,f):l.insertBefore(c,l.firstElementChild);var d=c.querySelector(".photo-editor__grid"),v=c.querySelector(".photo-editor__status"),y=c.querySelector(".photo-editor__add"),x=c.querySelector(".photo-editor__input"),D=[],S=null,F=!1,B=0;function L(X,G){v.textContent=X||"",v.className="photo-editor__status gpx-status"+(G?" error":"")}function T(X){F=X,y.disabled=X,Array.prototype.forEach.call(d.querySelectorAll(".photo-editor__del, .photo-editor__confirm-yes, .photo-editor__confirm-no"),function(G){G.disabled=X}),S&&S.option("disabled",X)}function N(){return fetch("/api/v1/pages"+o+"/media",{credentials:"include",headers:{Accept:"application/json"}}).then(function(X){if(!X.ok)throw new Error("HTTP "+X.status);return X.json()}).then(function(X){return(X&&X.data||[]).filter(function(G){return G&&typeof G.filename=="string"&&O0.test(G.filename)}).map(function(G){return G.filename}).sort(I0)})}function z(X){return Cn("/api/v1/entry/"+encodeURIComponent(s)+"/photos/order",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({order:X})})}function O(X){if(D=(X||[]).slice(),S&&(S.destroy(),S=null),d.innerHTML="",!D.length){d.innerHTML='

    No photos yet \u2014 add some.

    ';return}var G=++B;D.forEach(function(k){var H=document.createElement("div");H.className="photo-editor__cell",H.setAttribute("data-filename",k);var q=document.createElement("img");q.className="photo-editor__img",q.loading="lazy",q.alt=k,q.src=o+"/"+encodeURIComponent(k)+"?v="+G;var Q=document.createElement("button");Q.type="button",Q.className="photo-editor__del",Q.setAttribute("aria-label","Delete "+k),Q.textContent="\u2715",Q.addEventListener("click",function(){K(H,k)}),H.appendChild(q),H.appendChild(Q),d.appendChild(H)}),D.length>1&&(S=new Tc(d,{animation:150,draggable:".photo-editor__cell",filter:".photo-editor__confirm",onEnd:j}))}function I(){return Array.prototype.map.call(d.querySelectorAll(".photo-editor__cell"),function(X){return X.getAttribute("data-filename")})}function U(X,G){if(X.length!==G.length)return!1;for(var k=0;kDelete?',X.appendChild(k),X.classList.add("is-confirming"),k.querySelector(".photo-editor__confirm-no").addEventListener("click",function(){X.classList.remove("is-confirming"),k.remove()}),k.querySelector(".photo-editor__confirm-yes").addEventListener("click",function(){k.querySelector(".photo-editor__confirm-yes").disabled=!0,k.querySelector(".photo-editor__confirm-no").disabled=!0,de(G)})}}function de(X){var G=D.slice(),k=D.filter(function(H){return H!==X});T(!0),L("Deleting\u2026"),Cn("/api/v1/pages"+o+"/media/"+encodeURIComponent(X),{method:"DELETE"},[204,404]).then(function(){return(k.length?z(k):Promise.resolve()).then(N).then(function(H){L(""),O(H)},function(){L("Photo deleted, but refreshing the list failed \u2014 reload if it looks off.",!0),O(k)})},function(H){L(Pl(H,"Couldn\u2019t delete that photo. Try again."),!0),O(G)}).then(function(){T(!1)})}function W(X){return Hc(X).then(function(G){return G?import("./heic-to-CN7JBE7H.js").then(function(k){var H=k.heicTo||k.default&&k.default.heicTo;return H({blob:X,type:"image/jpeg",quality:.85})}).then(function(k){return{blob:k,name:Oc(X.name,!0)}}):{blob:X,name:Oc(X.name,!1)}})}y.addEventListener("click",function(){F||x.click()}),x.addEventListener("change",function(){var X=Array.prototype.slice.call(x.files||[]);x.value="",X.length&&oe(X)});function oe(X){T(!0);var G=X.length,k=0,H=0,q=!1,Q=D.slice(),he=Promise.resolve();X.forEach(function(pe){he=he.then(function(){return k++,L("Uploading "+k+" of "+G+"\u2026"),W(pe).then(function(Ee){var A=new FormData;return A.append("file",Ee.blob,Ee.name),Cn("/api/v1/pages"+o+"/media",{method:"POST",body:A})}).then(null,function(Ee){H++,Ee&&(Ee.status===401||Ee.status===403)&&(q=!0)})})}),he.then(function(){return L("Finishing\u2026"),N()}).then(function(pe){var Ee=Q.filter(function(ee){return pe.indexOf(ee)!==-1}),A=pe.filter(function(ee){return Q.indexOf(ee)===-1}),w=Ee.concat(A);return w.length?z(w).catch(function(){return z(w)}).catch(function(){return Promise.all(A.map(function(ee){return Cn("/api/v1/pages"+o+"/media/"+encodeURIComponent(ee),{method:"DELETE"},[204,404]).then(function(){return!0},function(){return!1})})).then(function(ee){var Ce=new Error("reorder failed");throw Ce.rolledBack=!0,Ce.rollbackIncomplete=ee.indexOf(!1)!==-1,Ce})}).then(N):(O([]),null)}).then(function(pe){pe&&O(pe),H?L(q?"Couldn\u2019t add photos \u2014 your login session expired. Sign in again, then retry.":H+" photo"+(H>1?"s":"")+" couldn\u2019t be added.",!0):L("")}).catch(function(pe){var Ee;return pe&&pe.rolledBack?Ee=pe.rollbackIncomplete?"Couldn\u2019t finish adding photos and cleanup was incomplete \u2014 reload the page and check your photos.":"Couldn\u2019t finish adding photos \u2014 changes were rolled back. Try again.":Ee="Couldn\u2019t add photos. Please try again.",L(Ee,!0),N().then(O,function(){O(Q)})}).then(function(){T(!1)})}d.innerHTML='

    Loading photos\u2026

    ',N().then(O).catch(function(){L("Couldn\u2019t load photos.",!0),O([])})}function P0(){var o=document.querySelector('form[name="new-entry"]'),l=document.querySelector(".post-form-wrap");if(!(!o||!l)){var s=_c("edit");if(s){Yo=!0;var a=l.querySelector("h1");a&&(a.textContent="Edit entry");var f=o.querySelector('button[type="submit"], input[type="submit"]'),h=f?f.tagName==="INPUT"?f.value:f.textContent:"Save changes";zc(o,!0),Wl(f,"Loading entry\u2026");var c=_c("return")||l.getAttribute("data-trip-url")||"";o.setAttribute("action","/post?edit="+encodeURIComponent(s)+(c?"&return="+encodeURIComponent(c):"")),fetch("/api/v1/pages"+s,{credentials:"include",headers:{Accept:"application/json"}}).then(function(d){if(!d.ok){var v=new Error("HTTP "+d.status);throw v.status=d.status,v}return d.json()}).then(function(d){var v=d&&d.data||{},y=v.header||{};hr("title",y.title!=null?y.title:v.title),hr("date",y.date?String(y.date).replace(" ","T"):""),z0(v.content),hr("lat",y.lat),hr("lng",y.lng),Ul(),hr("location_city",y.location_city),hr("location_country",y.location_country),hr("weather_desc",y.weather_desc),hr("weather_temp_c",y.weather_temp_c),hr("transport_mode",y.transport_mode),Rl("featured",y.featured),Rl("force_connect",y.force_connect),Rl("published",y.published!==void 0?y.published:v.published);var x=ct("edit_path");x&&(x.value=s+"/entry.md"),zc(o,!1),Wl(f,"Save changes");var D=o.querySelector(".more-options");D&&(D.open=!0),H0(s)}).catch(function(d){var v=d&&d.status===404?"This entry no longer exists \u2014 it may have been deleted. Head back to the journal.":"Sorry \u2014 this entry couldn\u2019t be loaded for editing. Check your connection and try again.";N0(l,v),Wl(f,h)})}}}function Ic(){window.postFormEditor=v0(),_0(),P0(),B0(),w0(),C0(),k0(),A0(),T0()}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Ic):Ic(); +`]},Hp={link:"URL for the link:",image:"URL of the image:"},Rp={locale:"en-US",format:{hour:"2-digit",minute:"2-digit"}},Wp={bold:"**",code:"```",italic:"*"},qp={sbInit:"Attach files by drag and dropping or pasting from clipboard.",sbOnDragEnter:"Drop image to upload it.",sbOnDrop:"Uploading image #images_names#...",sbProgress:"Uploading #file_name#: #progress#%",sbOnUploaded:"Uploaded #image_name#",sizeUnits:" B, KB, MB"},Up={noFileGiven:"You must select a file.",typeNotAllowed:"This image type is not allowed.",fileTooLarge:`Image #image_name# is too big (#image_size#). +Maximum file size is #image_max_size#.`,importError:"Something went wrong when uploading the image #image_name#."};function re(o){o=o||{},o.parent=this;var l=!0;if(o.autoDownloadFontAwesome===!1&&(l=!1),o.autoDownloadFontAwesome!==!0)for(var s=document.styleSheets,a=0;a-1&&(l=!1);if(l){var f=document.createElement("link");f.rel="stylesheet",f.href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css",document.getElementsByTagName("head")[0].appendChild(f)}if(o.element)this.element=o.element;else if(o.element===null){console.log("EasyMDE: Error. No element was found.");return}if(o.toolbar===void 0){o.toolbar=[];for(var h in Ur)Object.prototype.hasOwnProperty.call(Ur,h)&&(h.indexOf("separator-")!=-1&&o.toolbar.push("|"),(Ur[h].default===!0||o.showIcons&&o.showIcons.constructor===Array&&o.showIcons.indexOf(h)!=-1)&&o.toolbar.push(h))}if(Object.prototype.hasOwnProperty.call(o,"previewClass")||(o.previewClass="editor-preview"),Object.prototype.hasOwnProperty.call(o,"status")||(o.status=["autosave","lines","words","cursor"],o.uploadImage&&o.status.unshift("upload-image")),o.previewRender||(o.previewRender=function(d){return this.parent.markdown(d)}),o.parsingConfig=sr({highlightFormatting:!0},o.parsingConfig||{}),o.insertTexts=sr({},zp,o.insertTexts||{}),o.promptTexts=sr({},Hp,o.promptTexts||{}),o.blockStyles=sr({},Wp,o.blockStyles||{}),o.autosave!=null&&(o.autosave.timeFormat=sr({},Rp,o.autosave.timeFormat||{})),o.iconClassMap=sr({},_e,o.iconClassMap||{}),o.shortcuts=sr({},Lp,o.shortcuts||{}),o.maxHeight=o.maxHeight||void 0,o.direction=o.direction||"ltr",typeof o.maxHeight<"u"?o.minHeight=o.maxHeight:o.minHeight=o.minHeight||"300px",o.errorCallback=o.errorCallback||function(d){alert(d)},o.uploadImage=o.uploadImage||!1,o.imageMaxSize=o.imageMaxSize||2097152,o.imageAccept=o.imageAccept||"image/png, image/jpeg, image/gif, image/avif",o.imageTexts=sr({},qp,o.imageTexts||{}),o.errorMessages=sr({},Up,o.errorMessages||{}),o.imagePathAbsolute=o.imagePathAbsolute||!1,o.imageCSRFName=o.imageCSRFName||"csrfmiddlewaretoken",o.imageCSRFHeader=o.imageCSRFHeader||!1,o.imageInputName=o.imageInputName||"image",o.autosave!=null&&o.autosave.unique_id!=null&&o.autosave.unique_id!=""&&(o.autosave.uniqueId=o.autosave.unique_id),o.overlayMode&&o.overlayMode.combine===void 0&&(o.overlayMode.combine=!0),this.options=o,this.render(),o.initialValue&&(!this.options.autosave||this.options.autosave.foundSavedValue!==!0)&&this.value(o.initialValue),o.uploadImage){var c=this;this.codemirror.on("dragenter",function(d,m){c.updateStatusBar("upload-image",c.options.imageTexts.sbOnDragEnter),m.stopPropagation(),m.preventDefault()}),this.codemirror.on("dragend",function(d,m){c.updateStatusBar("upload-image",c.options.imageTexts.sbInit),m.stopPropagation(),m.preventDefault()}),this.codemirror.on("dragleave",function(d,m){c.updateStatusBar("upload-image",c.options.imageTexts.sbInit),m.stopPropagation(),m.preventDefault()}),this.codemirror.on("dragover",function(d,m){c.updateStatusBar("upload-image",c.options.imageTexts.sbOnDragEnter),m.stopPropagation(),m.preventDefault()}),this.codemirror.on("drop",function(d,m){m.stopPropagation(),m.preventDefault(),o.imageUploadFunction?c.uploadImagesUsingCustomFunction(o.imageUploadFunction,m.dataTransfer.files):c.uploadImages(m.dataTransfer.files)}),this.codemirror.on("paste",function(d,m){o.imageUploadFunction?c.uploadImagesUsingCustomFunction(o.imageUploadFunction,m.clipboardData.files):c.uploadImages(m.clipboardData.files)})}}re.prototype.uploadImages=function(o,l,s){if(o.length!==0){for(var a=[],f=0;f=2){var I=N[1];if(l.imagesPreviewHandler){var P=l.imagesPreviewHandler(N[1]);typeof P=="string"&&(I=P)}if(window.EMDEimagesCache[I])F(O,window.EMDEimagesCache[I]);else{window.EMDEimagesCache[I]={};var U=document.createElement("img");U.onload=function(){window.EMDEimagesCache[I]={naturalWidth:U.naturalWidth,naturalHeight:U.naturalHeight,url:I},F(O,window.EMDEimagesCache[I])},U.src=I}}}})}this.codemirror.on("update",function(){_()}),this.gui.sideBySide=this.createSideBySide(),this._rendered=this.element,(l.autofocus===!0||o.autofocus)&&this.codemirror.focus();var L=this.codemirror;setTimeout(function(){L.refresh()}.bind(L),0)};re.prototype.cleanup=function(){document.removeEventListener("keydown",this.documentOnKeyDown)};function ic(){if(typeof localStorage=="object")try{localStorage.setItem("smde_localStorage",1),localStorage.removeItem("smde_localStorage")}catch{return!1}else return!1;return!0}re.prototype.autosave=function(){if(ic()){var o=this;if(this.options.autosave.uniqueId==null||this.options.autosave.uniqueId==""){console.log("EasyMDE: You must set a uniqueId to use the autosave feature");return}this.options.autosave.binded!==!0&&(o.element.form!=null&&o.element.form!=null&&o.element.form.addEventListener("submit",function(){clearTimeout(o.autosaveTimeoutId),o.autosaveTimeoutId=void 0,localStorage.removeItem("smde_"+o.options.autosave.uniqueId)}),this.options.autosave.binded=!0),this.options.autosave.loaded!==!0&&(typeof localStorage.getItem("smde_"+this.options.autosave.uniqueId)=="string"&&localStorage.getItem("smde_"+this.options.autosave.uniqueId)!=""&&(this.codemirror.setValue(localStorage.getItem("smde_"+this.options.autosave.uniqueId)),this.options.autosave.foundSavedValue=!0),this.options.autosave.loaded=!0);var l=o.value();l!==""?localStorage.setItem("smde_"+this.options.autosave.uniqueId,l):localStorage.removeItem("smde_"+this.options.autosave.uniqueId);var s=document.getElementById("autosaved");if(s!=null&&s!=null&&s!=""){var a=new Date,f=new Intl.DateTimeFormat([this.options.autosave.timeFormat.locale,"en-US"],this.options.autosave.timeFormat.format).format(a),h=this.options.autosave.text==null?"Autosaved: ":this.options.autosave.text;s.innerHTML=h+f}}else console.log("EasyMDE: localStorage not available, cannot autosave")};re.prototype.clearAutosavedValue=function(){if(ic()){if(this.options.autosave==null||this.options.autosave.uniqueId==null||this.options.autosave.uniqueId==""){console.log("EasyMDE: You must set a uniqueId to clear the autosave value");return}localStorage.removeItem("smde_"+this.options.autosave.uniqueId)}else console.log("EasyMDE: localStorage not available, cannot autosave")};re.prototype.openBrowseFileWindow=function(o,l){var s=this,a=this.gui.toolbar.getElementsByClassName("imageInput")[0];a.click();function f(h){s.options.imageUploadFunction?s.uploadImagesUsingCustomFunction(s.options.imageUploadFunction,h.target.files):s.uploadImages(h.target.files,o,l),a.removeEventListener("change",f)}a.addEventListener("change",f)};re.prototype.uploadImage=function(o,l,s){var a=this;l=l||function(y){tc(a,y)};function f(m){a.updateStatusBar("upload-image",m),setTimeout(function(){a.updateStatusBar("upload-image",a.options.imageTexts.sbInit)},1e4),s&&typeof s=="function"&&s(m),a.options.errorCallback(m)}function h(m){var y=a.options.imageTexts.sizeUnits.split(",");return m.replace("#image_name#",o.name).replace("#image_size#",ho(o.size,y)).replace("#image_max_size#",ho(a.options.imageMaxSize,y))}if(o.size>this.options.imageMaxSize){f(h(this.options.errorMessages.fileTooLarge));return}var c=new FormData;c.append("image",o),a.options.imageCSRFToken&&!a.options.imageCSRFHeader&&c.append(a.options.imageCSRFName,a.options.imageCSRFToken);var d=new XMLHttpRequest;d.upload.onprogress=function(m){if(m.lengthComputable){var y=""+Math.round(m.loaded*100/m.total);a.updateStatusBar("upload-image",a.options.imageTexts.sbProgress.replace("#file_name#",o.name).replace("#progress#",y))}},d.open("POST",this.options.imageUploadEndpoint),a.options.imageCSRFToken&&a.options.imageCSRFHeader&&d.setRequestHeader(a.options.imageCSRFName,a.options.imageCSRFToken),d.onload=function(){try{var m=JSON.parse(this.responseText)}catch{console.error("EasyMDE: The server did not return a valid json."),f(h(a.options.errorMessages.importError));return}this.status===200&&m&&!m.error&&m.data&&m.data.filePath?l((a.options.imagePathAbsolute?"":window.location.origin+"/")+m.data.filePath):m.error&&m.error in a.options.errorMessages?f(h(a.options.errorMessages[m.error])):m.error?f(h(m.error)):(console.error("EasyMDE: Received an unexpected response after uploading the image."+this.status+" ("+this.statusText+")"),f(h(a.options.errorMessages.importError)))},d.onerror=function(m){console.error("EasyMDE: An unexpected error occurred when trying to upload the image."+m.target.status+" ("+m.target.statusText+")"),f(a.options.errorMessages.importError)},d.send(c)};re.prototype.uploadImageUsingCustomFunction=function(o,l){var s=this;function a(c){tc(s,c)}function f(c){var d=h(c);s.updateStatusBar("upload-image",d),setTimeout(function(){s.updateStatusBar("upload-image",s.options.imageTexts.sbInit)},1e4),s.options.errorCallback(d)}function h(c){var d=s.options.imageTexts.sizeUnits.split(",");return c.replace("#image_name#",l.name).replace("#image_size#",ho(l.size,d)).replace("#image_max_size#",ho(s.options.imageMaxSize,d))}o.apply(this,[l,a,f])};re.prototype.setPreviewMaxHeight=function(){var o=this.codemirror,l=o.getWrapperElement(),s=l.nextSibling,a=parseInt(window.getComputedStyle(l).paddingTop),f=parseInt(window.getComputedStyle(l).borderTopWidth),h=parseInt(this.options.maxHeight),c=h+a*2+f*2,d=c.toString()+"px";s.style.height=d};re.prototype.createSideBySide=function(){var o=this.codemirror,l=o.getWrapperElement(),s=l.nextSibling;if(!s||!s.classList.contains("editor-preview-side")){if(s=document.createElement("div"),s.className="editor-preview-side",this.options.previewClass)if(Array.isArray(this.options.previewClass))for(var a=0;a"&&(l=l.substring(1)),o)try{if(o.matches)return o.matches(l);if(o.msMatchesSelector)return o.msMatchesSelector(l);if(o.webkitMatchesSelector)return o.webkitMatchesSelector(l)}catch{return!1}return!1}}function bc(o){return o.host&&o!==document&&o.host.nodeType&&o.host!==o?o.host:o.parentNode}function Gt(o,l,s,a){if(o){s=s||document;do{if(l!=null&&(l[0]===">"?o.parentNode===s&&Uo(o,l):Uo(o,l))||a&&o===s)return o;if(o===s)break}while(o=bc(o))}return null}var uc=/\s+/g;function Nt(o,l,s){if(o&&l)if(o.classList)o.classList[s?"add":"remove"](l);else{var a=(" "+o.className+" ").replace(uc," ").replace(" "+l+" "," ");o.className=(a+(s?" "+l:"")).replace(uc," ")}}function ge(o,l,s){var a=o&&o.style;if(a){if(s===void 0)return document.defaultView&&document.defaultView.getComputedStyle?s=document.defaultView.getComputedStyle(o,""):o.currentStyle&&(s=o.currentStyle),l===void 0?s:s[l];!(l in a)&&l.indexOf("webkit")===-1&&(l="-webkit-"+l),a[l]=s+(typeof s=="string"?"":"px")}}function Fn(o,l){var s="";if(typeof o=="string")s=o;else do{var a=ge(o,"transform");a&&a!=="none"&&(s=a+" "+s)}while(!l&&(o=o.parentNode));var f=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return f&&new f(s)}function yc(o,l,s){if(o){var a=o.getElementsByTagName(l),f=0,h=a.length;if(s)for(;f=h:c=f<=h,!c)return a;if(a===Vt())break;a=Tr(a,!1)}return!1}function Tn(o,l,s,a){for(var f=0,h=0,c=o.children;h2&&arguments[2]!==void 0?arguments[2]:{},f=a.evt,h=Gp(a,ng);wi.pluginEvent.bind(ve)(l,s,er({dragEl:V,parentEl:Ue,ghostEl:xe,rootEl:ze,nextEl:Yr,lastDownEl:Ho,cloneEl:We,cloneHidden:Fr,dragStarted:di,putSortable:ft,activeSortable:ve.active,originalEvent:f,oldIndex:An,oldDraggableIndex:mi,newIndex:Ot,newDraggableIndex:Ar,hideGhostForTarget:Ac,unhideGhostForTarget:Fc,cloneNowHidden:function(){Fr=!0},cloneNowShown:function(){Fr=!1},dispatchSortableEvent:function(d){kt({sortable:s,name:d,originalEvent:f})}},h))};function kt(o){rg(er({putSortable:ft,cloneEl:We,targetEl:V,rootEl:ze,oldIndex:An,oldDraggableIndex:mi,newIndex:Ot,newDraggableIndex:Ar},o))}var V,Ue,xe,ze,Yr,Ho,We,Fr,An,Ot,mi,Ar,Oo,ft,En=!1,jo=!1,Go=[],Xr,jt,kl,Sl,dc,hc,di,Sn,bi,yi=!1,Io=!1,Ro,vt,El=[],_l=!1,Xo=[],Yo=typeof document<"u",Po=Il,pc=xi||cr?"cssFloat":"float",ig=Yo&&!vc&&!Il&&"draggable"in document.createElement("div"),kc=function(){if(Yo){if(cr)return!1;var o=document.createElement("x");return o.style.cssText="pointer-events:auto",o.style.pointerEvents==="auto"}}(),Sc=function(l,s){var a=ge(l),f=parseInt(a.width)-parseInt(a.paddingLeft)-parseInt(a.paddingRight)-parseInt(a.borderLeftWidth)-parseInt(a.borderRightWidth),h=Tn(l,0,s),c=Tn(l,1,s),d=h&&ge(h),m=c&&ge(c),y=d&&parseInt(d.marginLeft)+parseInt(d.marginRight)+$e(h).width,x=m&&parseInt(m.marginLeft)+parseInt(m.marginRight)+$e(c).width;if(a.display==="flex")return a.flexDirection==="column"||a.flexDirection==="column-reverse"?"vertical":"horizontal";if(a.display==="grid")return a.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(h&&d.float&&d.float!=="none"){var C=d.float==="left"?"left":"right";return c&&(m.clear==="both"||m.clear===C)?"vertical":"horizontal"}return h&&(d.display==="block"||d.display==="flex"||d.display==="table"||d.display==="grid"||y>=f&&a[pc]==="none"||c&&a[pc]==="none"&&y+x>f)?"vertical":"horizontal"},og=function(l,s,a){var f=a?l.left:l.top,h=a?l.right:l.bottom,c=a?l.width:l.height,d=a?s.left:s.top,m=a?s.right:s.bottom,y=a?s.width:s.height;return f===d||h===m||f+c/2===d+y/2},ag=function(l,s){var a;return Go.some(function(f){var h=f[Tt].options.emptyInsertThreshold;if(!(!h||Pl(f))){var c=$e(f),d=l>=c.left-h&&l<=c.right+h,m=s>=c.top-h&&s<=c.bottom+h;if(d&&m)return a=f}}),a},Ec=function(l){function s(h,c){return function(d,m,y,x){var C=d.options.group.name&&m.options.group.name&&d.options.group.name===m.options.group.name;if(h==null&&(c||C))return!0;if(h==null||h===!1)return!1;if(c&&h==="clone")return h;if(typeof h=="function")return s(h(d,m,y,x),c)(d,m,y,x);var S=(c?d:m).options.group.name;return h===!0||typeof h=="string"&&h===S||h.join&&h.indexOf(S)>-1}}var a={},f=l.group;(!f||Ml(f)!="object")&&(f={name:f}),a.name=f.name,a.checkPull=s(f.pull,!0),a.checkPut=s(f.put),a.revertClone=f.revertClone,l.group=a},Ac=function(){!kc&&xe&&ge(xe,"display","none")},Fc=function(){!kc&&xe&&ge(xe,"display","")};Yo&&!vc&&document.addEventListener("click",function(o){if(jo)return o.preventDefault(),o.stopPropagation&&o.stopPropagation(),o.stopImmediatePropagation&&o.stopImmediatePropagation(),jo=!1,!1},!0);var Kr=function(l){if(V){l=l.touches?l.touches[0]:l;var s=ag(l.clientX,l.clientY);if(s){var a={};for(var f in l)l.hasOwnProperty(f)&&(a[f]=l[f]);a.target=a.rootEl=s,a.preventDefault=void 0,a.stopPropagation=void 0,s[Tt]._onDragOver(a)}}},lg=function(l){V&&V.parentNode[Tt]._isOutsideThisEl(l.target)};function ve(o,l){if(!(o&&o.nodeType&&o.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(o));this.el=o,this.options=l=fr({},l),o[Tt]=this;var s={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(o.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Sc(o,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(c,d){c.setData("Text",d.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:ve.supportPointer!==!1&&"PointerEvent"in window&&(!gi||Il),emptyInsertThreshold:5};wi.initializePlugins(this,o,s);for(var a in s)!(a in l)&&(l[a]=s[a]);Ec(l);for(var f in this)f.charAt(0)==="_"&&typeof this[f]=="function"&&(this[f]=this[f].bind(this));this.nativeDraggable=l.forceFallback?!1:ig,this.nativeDraggable&&(this.options.touchStartThreshold=1),l.supportPointer?Se(o,"pointerdown",this._onTapStart):(Se(o,"mousedown",this._onTapStart),Se(o,"touchstart",this._onTapStart)),this.nativeDraggable&&(Se(o,"dragover",this),Se(o,"dragenter",this)),Go.push(this.el),l.store&&l.store.get&&this.sort(l.store.get(this)||[]),fr(this,Vp())}ve.prototype={constructor:ve,_isOutsideThisEl:function(l){!this.el.contains(l)&&l!==this.el&&(Sn=null)},_getDirection:function(l,s){return typeof this.options.direction=="function"?this.options.direction.call(this,l,s,V):this.options.direction},_onTapStart:function(l){if(l.cancelable){var s=this,a=this.el,f=this.options,h=f.preventOnFilter,c=l.type,d=l.touches&&l.touches[0]||l.pointerType&&l.pointerType==="touch"&&l,m=(d||l).target,y=l.target.shadowRoot&&(l.path&&l.path[0]||l.composedPath&&l.composedPath()[0])||m,x=f.filter;if(gg(a),!V&&!(/mousedown|pointerdown/.test(c)&&l.button!==0||f.disabled)&&!y.isContentEditable&&!(!this.nativeDraggable&&gi&&m&&m.tagName.toUpperCase()==="SELECT")&&(m=Gt(m,f.draggable,a,!1),!(m&&m.animated)&&Ho!==m)){if(An=Pt(m),mi=Pt(m,f.draggable),typeof x=="function"){if(x.call(this,l,m,this)){kt({sortable:s,rootEl:y,name:"filter",targetEl:m,toEl:a,fromEl:a}),Ft("filter",s,{evt:l}),h&&l.preventDefault();return}}else if(x&&(x=x.split(",").some(function(C){if(C=Gt(y,C.trim(),a,!1),C)return kt({sortable:s,rootEl:C,name:"filter",targetEl:m,fromEl:a,toEl:a}),Ft("filter",s,{evt:l}),!0}),x)){h&&l.preventDefault();return}f.handle&&!Gt(y,f.handle,a,!1)||this._prepareDragStart(l,d,m)}}},_prepareDragStart:function(l,s,a){var f=this,h=f.el,c=f.options,d=h.ownerDocument,m;if(a&&!V&&a.parentNode===h){var y=$e(a);if(ze=h,V=a,Ue=V.parentNode,Yr=V.nextSibling,Ho=a,Oo=c.group,ve.dragged=V,Xr={target:V,clientX:(s||l).clientX,clientY:(s||l).clientY},dc=Xr.clientX-y.left,hc=Xr.clientY-y.top,this._lastX=(s||l).clientX,this._lastY=(s||l).clientY,V.style["will-change"]="all",m=function(){if(Ft("delayEnded",f,{evt:l}),ve.eventCanceled){f._onDrop();return}f._disableDelayedDragEvents(),!sc&&f.nativeDraggable&&(V.draggable=!0),f._triggerDragStart(l,s),kt({sortable:f,name:"choose",originalEvent:l}),Nt(V,c.chosenClass,!0)},c.ignore.split(",").forEach(function(x){yc(V,x.trim(),Al)}),Se(d,"dragover",Kr),Se(d,"mousemove",Kr),Se(d,"touchmove",Kr),c.supportPointer?(Se(d,"pointerup",f._onDrop),!this.nativeDraggable&&Se(d,"pointercancel",f._onDrop)):(Se(d,"mouseup",f._onDrop),Se(d,"touchend",f._onDrop),Se(d,"touchcancel",f._onDrop)),sc&&this.nativeDraggable&&(this.options.touchStartThreshold=4,V.draggable=!0),Ft("delayStart",this,{evt:l}),c.delay&&(!c.delayOnTouchOnly||s)&&(!this.nativeDraggable||!(xi||cr))){if(ve.eventCanceled){this._onDrop();return}c.supportPointer?(Se(d,"pointerup",f._disableDelayedDrag),Se(d,"pointercancel",f._disableDelayedDrag)):(Se(d,"mouseup",f._disableDelayedDrag),Se(d,"touchend",f._disableDelayedDrag),Se(d,"touchcancel",f._disableDelayedDrag)),Se(d,"mousemove",f._delayedDragTouchMoveHandler),Se(d,"touchmove",f._delayedDragTouchMoveHandler),c.supportPointer&&Se(d,"pointermove",f._delayedDragTouchMoveHandler),f._dragStartTimer=setTimeout(m,c.delay)}else m()}},_delayedDragTouchMoveHandler:function(l){var s=l.touches?l.touches[0]:l;Math.max(Math.abs(s.clientX-this._lastX),Math.abs(s.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){V&&Al(V),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var l=this.el.ownerDocument;ke(l,"mouseup",this._disableDelayedDrag),ke(l,"touchend",this._disableDelayedDrag),ke(l,"touchcancel",this._disableDelayedDrag),ke(l,"pointerup",this._disableDelayedDrag),ke(l,"pointercancel",this._disableDelayedDrag),ke(l,"mousemove",this._delayedDragTouchMoveHandler),ke(l,"touchmove",this._delayedDragTouchMoveHandler),ke(l,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(l,s){s=s||l.pointerType=="touch"&&l,!this.nativeDraggable||s?this.options.supportPointer?Se(document,"pointermove",this._onTouchMove):s?Se(document,"touchmove",this._onTouchMove):Se(document,"mousemove",this._onTouchMove):(Se(V,"dragend",this),Se(ze,"dragstart",this._onDragStart));try{document.selection?Wo(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(l,s){if(En=!1,ze&&V){Ft("dragStarted",this,{evt:s}),this.nativeDraggable&&Se(document,"dragover",lg);var a=this.options;!l&&Nt(V,a.dragClass,!1),Nt(V,a.ghostClass,!0),ve.active=this,l&&this._appendGhost(),kt({sortable:this,name:"start",originalEvent:s})}else this._nulling()},_emulateDragOver:function(){if(jt){this._lastX=jt.clientX,this._lastY=jt.clientY,Ac();for(var l=document.elementFromPoint(jt.clientX,jt.clientY),s=l;l&&l.shadowRoot&&(l=l.shadowRoot.elementFromPoint(jt.clientX,jt.clientY),l!==s);)s=l;if(V.parentNode[Tt]._isOutsideThisEl(l),s)do{if(s[Tt]){var a=void 0;if(a=s[Tt]._onDragOver({clientX:jt.clientX,clientY:jt.clientY,target:l,rootEl:s}),a&&!this.options.dragoverBubble)break}l=s}while(s=bc(s));Fc()}},_onTouchMove:function(l){if(Xr){var s=this.options,a=s.fallbackTolerance,f=s.fallbackOffset,h=l.touches?l.touches[0]:l,c=xe&&Fn(xe,!0),d=xe&&c&&c.a,m=xe&&c&&c.d,y=Po&&vt&&cc(vt),x=(h.clientX-Xr.clientX+f.x)/(d||1)+(y?y[0]-El[0]:0)/(d||1),C=(h.clientY-Xr.clientY+f.y)/(m||1)+(y?y[1]-El[1]:0)/(m||1);if(!ve.active&&!En){if(a&&Math.max(Math.abs(h.clientX-this._lastX),Math.abs(h.clientY-this._lastY))=0&&(kt({rootEl:Ue,name:"add",toEl:Ue,fromEl:ze,originalEvent:l}),kt({sortable:this,name:"remove",toEl:Ue,originalEvent:l}),kt({rootEl:Ue,name:"sort",toEl:Ue,fromEl:ze,originalEvent:l}),kt({sortable:this,name:"sort",toEl:Ue,originalEvent:l})),ft&&ft.save()):Ot!==An&&Ot>=0&&(kt({sortable:this,name:"update",toEl:Ue,originalEvent:l}),kt({sortable:this,name:"sort",toEl:Ue,originalEvent:l})),ve.active&&((Ot==null||Ot===-1)&&(Ot=An,Ar=mi),kt({sortable:this,name:"end",toEl:Ue,originalEvent:l}),this.save()))),this._nulling()},_nulling:function(){Ft("nulling",this),ze=V=Ue=xe=Yr=We=Ho=Fr=Xr=jt=di=Ot=Ar=An=mi=Sn=bi=ft=Oo=ve.dragged=ve.ghost=ve.clone=ve.active=null;var l=this.el;Xo.forEach(function(s){l.contains(s)&&(s.checked=!0)}),Xo.length=kl=Sl=0},handleEvent:function(l){switch(l.type){case"drop":case"dragend":this._onDrop(l);break;case"dragenter":case"dragover":V&&(this._onDragOver(l),sg(l));break;case"selectstart":l.preventDefault();break}},toArray:function(){for(var l=[],s,a=this.el.children,f=0,h=a.length,c=this.options;ff.right+h||o.clientY>a.bottom&&o.clientX>a.left:o.clientY>f.bottom+h||o.clientX>a.right&&o.clientY>a.top}function dg(o,l,s,a,f,h,c,d){var m=a?o.clientY:o.clientX,y=a?s.height:s.width,x=a?s.top:s.left,C=a?s.bottom:s.right,S=!1;if(!c){if(d&&Rox+y*h/2:mC-Ro)return-bi}else if(m>x+y*(1-f)/2&&mC-y*h/2)?m>x+y/2?1:-1:0}function hg(o){return Pt(V)0||C>0&&S0?"Converting "+l+" photo"+(l>1?"s":"")+"\u2026":"Uploading "+C+" photo"+(C>1?"s":"")+"\u2026",s.details.open=!0):C>0?(s.summary.textContent="\u2713 "+C+" photo"+(C>1?"s":"")+" ready \u2014 tap to review",s.details.open=!1):(s.summary.textContent="Photos (1\u20136)",s.details.open=!0)}}function c(){h(),setTimeout(h,150),setTimeout(h,500)}function d(){var x=o.querySelector('button[type="submit"], input[type="submit"]');if(x&&(x.disabled=l>0),l>0)f("Converting "+l+" photo"+(l>1?"s":"")+"\u2026");else{var C=Bc();C&&/Converting/.test(C.textContent)&&f("")}h()}o.addEventListener("submit",function(x){l>0&&(x.preventDefault(),f("Hang on \u2014 a photo is still converting.","err"))},!0);function m(x){return function(C){var S=C&&C.file;return S?Hc(S).then(function(F){return F?(l++,d(),import("./heic-to-CN7JBE7H.js").then(function(_){var L=_.heicTo||_.default&&_.default.heicTo;return L({blob:S,type:"image/jpeg",quality:.85})}).then(function(_){var L=new File([_],wg(S.name),{type:"image/jpeg"});x.addFile(L)}).catch(function(){f("A photo couldn\u2019t be converted and was skipped \u2014 the others are fine.","err")}).then(function(){l--,d()}),!1):!0}):!0}}var y=0;(function x(){var C=window.GravFilePond&&window.GravFilePond.getInstances?window.GravFilePond.getInstances():[];if(!C.length){y++<120&&setTimeout(x,50);return}C.forEach(function(S){S&&!S._heicHooked&&(S._heicHooked=!0,S.setOptions({beforeAddFile:m(S),allowReorder:!0,itemInsertLocation:"after"}),a=S,["addfile","processfile","processfiles","removefile","error"].forEach(function(F){try{S.on(F,c)}catch{}}),h())})})()}function ct(o){return document.querySelector('[name="data['+o+']"]')}function kg(){var o=Array.prototype.slice.call(document.querySelectorAll(".advanced-field"));if(o.length){var l=[];if(o.forEach(function(h){var c=h.closest(".form-field");c&&l.indexOf(c)===-1&&l.push(c)}),!!l.length){var s=document.createElement("details");s.className="more-options";var a=document.createElement("summary");a.className="more-options__summary",a.textContent="More options",s.appendChild(a),l[0].parentNode.insertBefore(s,l[0]),l.forEach(function(h){s.appendChild(h)});var f=l.some(function(h){var c=h.querySelector('input[type="text"]');if(c&&c.value.trim())return!0;var d=h.querySelector('input[type="radio"]:checked');if(!d||!d.value)return!1;var m=h.querySelector('input[type="radio"][checked]');return m?d.value!==m.value:d.value!=="0"});f&&(s.open=!0)}}}var Sg={0:"Sunny",1:"Partly cloudy",2:"Partly cloudy",3:"Cloudy",45:"Foggy",48:"Foggy",51:"Drizzle",53:"Drizzle",55:"Drizzle",56:"Drizzle",57:"Drizzle",61:"Rain",63:"Rain",65:"Rain",66:"Rain",67:"Rain",80:"Rain",81:"Rain",82:"Rain",71:"Snow",73:"Snow",75:"Snow",77:"Snow",85:"Snow",86:"Snow",95:"Thunderstorm",96:"Thunderstorm",99:"Thunderstorm"};function dr(o,l,s){o&&(o.className="form-status"+(s?" form-status--"+s:""),o.textContent=l||"")}function Eg(){var o=document.getElementById("get-location"),l=document.getElementById("get-weather");if(!o&&!l)return;var s=document.getElementById("location-status"),a=document.getElementById("weather-status");function f(){var d=ct("lat"),m=ct("lng"),y=d?d.value.trim():"",x=m?m.value.trim():"";return y&&x?{lat:y,lng:x}:null}function h(){if(l){var d=!!f();l.disabled=!d,l.title=d?"":"Get location first"}}h();function c(d,m){var y=ct("location_city"),x=ct("location_country");if(!((!y||y.value.trim())&&(!x||x.value.trim()))){var C="https://api.bigdatacloud.net/data/reverse-geocode-client?latitude="+encodeURIComponent(d)+"&longitude="+encodeURIComponent(m)+"&localityLanguage=en";fetch(C).then(function(S){return S.json()}).then(function(S){var F=(S.city||S.locality||"").trim(),_=(S.countryName||"").trim();y&&!y.value.trim()&&F&&(y.value=F),x&&!x.value.trim()&&_&&(x.value=_);var L=[F,_].filter(Boolean).join(", ");L&&dr(s,"\u2713 Location captured \xB7 "+L,"ok")}).catch(function(){})}}o&&o.addEventListener("click",function(){if(!navigator.geolocation){dr(s,"Geolocation is not supported on this device.","err");return}o.classList.add("is-loading"),o.disabled=!0,dr(s,"Getting location\u2026"),navigator.geolocation.getCurrentPosition(function(d){var m=d.coords.latitude.toFixed(6),y=d.coords.longitude.toFixed(6),x=ct("lat"),C=ct("lng");x&&(x.value=m),C&&(C.value=y),o.classList.remove("is-loading"),o.disabled=!1,dr(s,"\u2713 Location captured \xB7 "+m+", "+y,"ok"),h(),c(m,y);var S=document.querySelector(".location-details");S&&S.open&&jl()},function(d){o.classList.remove("is-loading"),o.disabled=!1,dr(s,"\u2717 "+(d&&d.message?d.message:"Could not get location")+" \u2014 enter coordinates manually if needed.","err")},{enableHighAccuracy:!0,timeout:15e3})}),l&&l.addEventListener("click",function(){var d=f();if(!d){dr(a,"Get location first, then fetch weather.","err");return}l.classList.add("is-loading"),l.disabled=!0,dr(a,"Fetching weather\u2026");var m="https://api.open-meteo.com/v1/forecast?latitude="+d.lat+"&longitude="+d.lng+"¤t=temperature_2m,weather_code&temperature_unit=celsius";fetch(m).then(function(y){return y.json()}).then(function(y){var x=Math.round(y.current.temperature_2m),C=Sg[y.current.weather_code]||"Cloudy",S=ct("weather_temp_c"),F=ct("weather_desc");S&&(S.value=x),F&&(F.value=C),l.classList.remove("is-loading"),h(),dr(a,"\u2713 Weather set \xB7 "+C+" \xB7 "+x+"\xB0C (edit above if needed)","ok")}).catch(function(){l.classList.remove("is-loading"),h(),dr(a,"\u2717 Could not fetch weather \u2014 set it manually above.","err")})})}var jl=function(){};function Ag(o,l){var s=null;return function(){var a=arguments;clearTimeout(s),s=setTimeout(function(){o.apply(null,a)},l)}}function Fg(o){return[o.name,o.admin1,o.country].filter(Boolean).join(", ")}function Tg(){var o=ct("lat"),l=ct("lng");if(!o||!l)return;var s=o.closest(".form-field"),a=l.closest(".form-field");if(!s||!a)return;var f=ct("location_city"),h=ct("location_country"),c=h?h.closest(".form-field"):null,d=c||s,m=document.createElement("details");m.className="location-details";var y=document.createElement("summary");y.className="location-details__summary",y.textContent="More location details",m.appendChild(y);var x=document.createElement("div");x.className="location-details__body";var C=document.createElement("div");C.className="location-search-row";var S=document.createElement("button");S.type="button",S.id="lookup-coords",S.className="btn-action";var F="\u{1F50D} Look up coordinates";S.textContent=F,C.appendChild(S),x.appendChild(C);var _=document.createElement("p");_.id="location-search-hint",_.className="location-search-hint",_.setAttribute("role","status"),x.appendChild(_);var L=document.createElement("ul");L.id="location-search-results",L.className="location-search-results",x.appendChild(L);var T=document.createElement("div");T.id="location-map",T.className="location-map",x.appendChild(T),m.appendChild(x),d.parentNode.insertBefore(m,d.nextSibling),m.appendChild(s),m.appendChild(a);function O(G){return G===o?"location-lat-note":"location-lng-note"}function N(){[o,l].forEach(function(G){G.classList.add("location-field--mismatch"),G.setAttribute("aria-invalid","true");var k=O(G),z=document.getElementById(k);z||(z=document.createElement("span"),z.id=k,z.className="location-field-note",z.setAttribute("role","status"),z.setAttribute("aria-live","polite"),z.textContent="Not reflected on the map yet.",G.parentNode.insertBefore(z,G.nextSibling)),G.setAttribute("aria-describedby",k)})}function I(){[o,l].forEach(function(G){G.classList.remove("location-field--mismatch"),G.removeAttribute("aria-invalid"),G.removeAttribute("aria-describedby");var k=document.getElementById(O(G));k&&k.parentNode&&k.parentNode.removeChild(k)})}var P=null;function U(G){var k=String(G).trim();return!k||!/^[+-]?(\d+(\.\d*)?|\.\d+)$/.test(k)?NaN:Number(k)}function j(){var G=U(o.value),k=U(l.value),z=isFinite(G)&&isFinite(k)&&G>=-90&&G<=90&&k>=-180&&k<=180;z?(o.value=G.toFixed(6),l.value=k.toFixed(6),I(),P&&P.setPin(G,k)):o.value.trim()||l.value.trim()?N():(I(),P&&P.clearPin())}jl=j;function K(G){o.value=G.lat.toFixed(6),l.value=G.lng.toFixed(6),I()}m.addEventListener("toggle",function(){m.open&&_c(T,K).then(function(G){P=G,G.resize(),j()}).catch(function(){q("Map preview unavailable \u2014 you can still enter coordinates directly."),j()})}),o.addEventListener("blur",j),l.addEventListener("blur",j);var de=Ag(j,400);o.addEventListener("input",de),l.addEventListener("input",de);function q(G){_.textContent=G||""}function oe(){L.innerHTML=""}function X(G){G.forEach(function(k){var z=document.createElement("li"),R=document.createElement("button");R.type="button",R.textContent=Fg(k),R.addEventListener("click",function(){o.value=Number(k.latitude).toFixed(6),l.value=Number(k.longitude).toFixed(6),oe(),j()}),z.appendChild(R),L.appendChild(z)})}S.addEventListener("click",function(){oe();var G=f?f.value.trim():"",k=h?h.value.trim():"";if(!G&&!k){q("Enter a city or country first.");return}var z=G||k;q(""),S.disabled=!0,S.textContent="Searching\u2026";var R="https://geocoding-api.open-meteo.com/v1/search?name="+encodeURIComponent(z)+"&count=10&language=en&format=json",Q=new AbortController,he=setTimeout(function(){Q.abort()},1e4);fetch(R,{signal:Q.signal}).then(function(pe){if(!pe.ok)throw new Error("geocode http "+pe.status);return pe.json()}).then(function(pe){var Ee=pe&&pe.results||[];if(!Ee.length){q("No matches \u2014 try adding a country, or drag the pin on the map.");return}if(k){var A=k.toLowerCase(),w=function(ee){return(ee.admin1||"").toLowerCase().indexOf(A)!==-1||(ee.country||"").toLowerCase().indexOf(A)!==-1};Ee=Ee.slice().sort(function(ee,De){var ye=w(ee),lt=w(De);return ye===lt?0:ye?-1:1})}X(Ee)}).catch(function(){q("Couldn\u2019t reach the lookup service \u2014 check your connection and try again, or drag the pin on the map.")}).then(function(){clearTimeout(he),S.disabled=!1,S.textContent=F})}),j()}function Lg(){var o=new Date;return o.setSeconds(0,0),o.setMinutes(o.getMinutes()-o.getTimezoneOffset()),o.toISOString().slice(0,16)}function Mg(){var o={title:"Title",date:"Date & time",content:"Content"},l=document.querySelector('form[name="new-entry"]');if(!l)return;var s=ct("date");s&&!String(s.value).trim()&&(s.value=Lg());function a(){l.querySelectorAll(".field-error").forEach(function(c){c.remove()}),l.querySelectorAll(".field-invalid").forEach(function(c){c.classList.remove("field-invalid")})}function f(c,d){c.classList.add("field-invalid");var m=document.createElement("span");m.className="field-error",m.textContent=d,c.parentNode.insertBefore(m,c.nextSibling)}function h(c){var d=l.querySelector(".photos-collapse"),m,y;if(d?(d.open=!0,y=d.querySelector(".photos-collapse__summary"),m=d):(m=document.querySelector(".filepond-root, .form-input-file"),y=m),!y)return m||null;var x=document.createElement("span");return x.className="field-error",x.textContent=c,y.insertAdjacentElement("afterend",x),m||y}l.addEventListener("submit",function(c){a();var d=null;!Zo&&document.querySelectorAll(".filepond--item").length<1&&(d=h("Add at least one photo.")),Object.keys(o).forEach(function(y){var x=ct(y);x&&!String(x.value).trim()&&(f(x,o[y]+" is required."),d||(d=x))});var m=l.querySelector(".location-field--mismatch");m&&!d&&(d=m),d&&(c.preventDefault(),typeof d.focus=="function"&&d.focus(),d.scrollIntoView({behavior:"smooth",block:"center"}))})}var Wl="intotheeast:new-entry-draft";function _g(o){return Array.prototype.slice.call(o.querySelectorAll('[name^="data["]')).filter(function(l){if(l.type==="file")return!1;var s=l.name;return s.indexOf("data[_json")!==0&&s.indexOf("data[photos")!==0})}function Bg(){var o=document.querySelector(".filepond-root, .form-input-file");if(!(!o||!o.parentNode)&&!o.parentNode.querySelector(".photo-reauth-hint")){var l=document.createElement("p");l.className="photo-reauth-hint is-shown",l.textContent="Your text was restored \u2014 photos need re-selecting (they can\u2019t be saved in a draft).",o.parentNode.insertBefore(l,o.nextSibling)}}function Ng(){var o=document.querySelector('form[name="new-entry"]');if(!o||Zo)return;if(document.querySelector(".notices.success")){try{localStorage.removeItem(Wl)}catch{}return}function l(){var h={};_g(o).forEach(function(c){c.type==="radio"?c.checked&&(h[c.name]=c.value):h[c.name]=c.value});try{localStorage.setItem(Wl,JSON.stringify(h))}catch{}}var s=null;try{s=localStorage.getItem(Wl)}catch{s=null}if(s){var a=null;try{a=JSON.parse(s)}catch{a=null}if(a){var f=!1;Object.keys(a).forEach(function(h){var c=a[h];if(c!=null&&String(c).trim()&&(f=!0),h!=="data[content]"){var d=o.querySelectorAll('input[type="radio"][name="'+h+'"]');if(d.length){d.forEach(function(y){y.checked=y.value===c});return}var m=o.querySelector('[name="'+h+'"]');m&&m.type!=="file"&&(m.value=c)}}),window.postFormEditor&&a["data[content]"]!=null&&window.postFormEditor.value(a["data[content]"]),f&&Bg()}}o.addEventListener("input",l),o.addEventListener("change",l),window.postFormEditor&&window.postFormEditor.codemirror.on("change",l)}function Og(){var o=document.querySelector(".post-form-wrap"),l=document.querySelector(".post-form-wrap .notices.success, .post-form-wrap .notices.green");if(!(!o||!l)){var s=document.createElement("div");s.className="post-success";var a=document.createElement("p");a.className="post-success__title",a.textContent="\u2713 Saved to your journal.",s.appendChild(a);var f=document.createElement("div");f.className="post-success__actions";var h=o.getAttribute("data-trip-url");if(h){var c=document.createElement("a");c.className="post-success__view",c.href=h,c.textContent="View your journal \u2192",f.appendChild(c)}var d=document.createElement("a");d.className="post-success__again",d.href=window.location.pathname,d.textContent="Post another",f.appendChild(d),s.appendChild(f),l.parentNode.insertBefore(s,l.nextSibling),["form",".form-action-row","#location-status","#weather-status"].forEach(function(m){var y=o.querySelector(m);y&&(y.style.display="none")}),l.scrollIntoView({behavior:"smooth",block:"start"})}}var Zo=!1;function Nc(o){return new URLSearchParams(window.location.search).get(o)}function hr(o,l){var s=ct(o);s&&(s.value=l==null?"":String(l))}function ql(o,l){var s=l?"1":"0",a=document.querySelectorAll('[name="data['+o+']"]');Array.prototype.forEach.call(a,function(f){f.checked=String(f.value)===s})}function Ig(o){var l=o==null?"":String(o);if(window.postFormEditor&&typeof window.postFormEditor.value=="function")window.postFormEditor.value(l);else{var s=ct("content");s&&(s.value=l)}}function Oc(o,l){var s=o.querySelectorAll("input, textarea, select, button");Array.prototype.forEach.call(s,function(a){a.type==="file"||a.name&&a.name.indexOf("data[photos")===0||(a.disabled=l)}),window.postFormEditor&&window.postFormEditor.codemirror&&window.postFormEditor.codemirror.setOption("readOnly",l?"nocursor":!1)}function Ul(o,l){o&&(o.tagName==="INPUT"?o.value=l:o.textContent=l)}function Pg(o,l){var s=o.querySelector(".post-edit-error");if(s){s.textContent=l;return}var a=document.createElement("div");a.className="post-edit-error",a.setAttribute("role","alert"),a.textContent=l;var f=o.querySelector("h1");f?f.insertAdjacentElement("afterend",a):o.insertBefore(a,o.firstChild)}var zg=/\.(jpe?g|png|webp|heic|heif|gif)$/i;function Ic(o){var l=/(?:^|\/)photo-0*(\d+)\./i.exec(o);return l?parseInt(l[1],10):Number.MAX_SAFE_INTEGER}function Hg(o,l){var s=Ic(o),a=Ic(l);return s!==a?s-a:ol?1:0}function Pc(o,l){var s=String(o||"photo"),a=s.lastIndexOf("."),f=(a>0?s.slice(0,a):s).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"photo",h=l?".jpg":a>0?s.slice(a).toLowerCase():".jpg",c=Date.now().toString(36)+Math.random().toString(36).slice(2,6);return f+"-"+c+h}function Rg(o){var l=document.querySelector('form[name="new-entry"]');if(!l||!o)return;var s=o.split("/").filter(Boolean).pop();if(!s)return;var a=document.querySelector(".filepond-root, .form-input-file"),f=a?a.closest(".form-field"):null;f&&(f.style.display="none");var h=l.querySelector(".photos-collapse");h&&(h.style.display="none");var c=document.createElement("div");c.className="photo-editor",c.innerHTML='
    Photos

    ',f&&f.parentNode?f.parentNode.insertBefore(c,f):l.insertBefore(c,l.firstElementChild);var d=c.querySelector(".photo-editor__grid"),m=c.querySelector(".photo-editor__status"),y=c.querySelector(".photo-editor__add"),x=c.querySelector(".photo-editor__input"),C=[],S=null,F=!1,_=0;function L(X,G){m.textContent=X||"",m.className="photo-editor__status gpx-status"+(G?" error":"")}function T(X){F=X,y.disabled=X,Array.prototype.forEach.call(d.querySelectorAll(".photo-editor__del, .photo-editor__confirm-yes, .photo-editor__confirm-no"),function(G){G.disabled=X}),S&&S.option("disabled",X)}function O(){return fetch("/api/v1/pages"+o+"/media",{credentials:"include",headers:{Accept:"application/json"}}).then(function(X){if(!X.ok)throw new Error("HTTP "+X.status);return X.json()}).then(function(X){return(X&&X.data||[]).filter(function(G){return G&&typeof G.filename=="string"&&zg.test(G.filename)}).map(function(G){return G.filename}).sort(Hg)})}function N(X){return Di("/api/v1/entry/"+encodeURIComponent(s)+"/photos/order",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({order:X})})}function I(X){if(C=(X||[]).slice(),S&&(S.destroy(),S=null),d.innerHTML="",!C.length){d.innerHTML='

    No photos yet \u2014 add some.

    ';return}var G=++_;C.forEach(function(k){var z=document.createElement("div");z.className="photo-editor__cell",z.setAttribute("data-filename",k);var R=document.createElement("img");R.className="photo-editor__img",R.loading="lazy",R.alt=k,R.src=o+"/"+encodeURIComponent(k)+"?v="+G;var Q=document.createElement("button");Q.type="button",Q.className="photo-editor__del",Q.setAttribute("aria-label","Delete "+k),Q.textContent="\u2715",Q.addEventListener("click",function(){K(z,k)}),z.appendChild(R),z.appendChild(Q),d.appendChild(z)}),C.length>1&&(S=new Lc(d,{animation:150,draggable:".photo-editor__cell",filter:".photo-editor__confirm",onEnd:j}))}function P(){return Array.prototype.map.call(d.querySelectorAll(".photo-editor__cell"),function(X){return X.getAttribute("data-filename")})}function U(X,G){if(X.length!==G.length)return!1;for(var k=0;kDelete?',X.appendChild(k),X.classList.add("is-confirming"),k.querySelector(".photo-editor__confirm-no").addEventListener("click",function(){X.classList.remove("is-confirming"),k.remove()}),k.querySelector(".photo-editor__confirm-yes").addEventListener("click",function(){k.querySelector(".photo-editor__confirm-yes").disabled=!0,k.querySelector(".photo-editor__confirm-no").disabled=!0,de(G)})}}function de(X){var G=C.slice(),k=C.filter(function(z){return z!==X});T(!0),L("Deleting\u2026"),Di("/api/v1/pages"+o+"/media/"+encodeURIComponent(X),{method:"DELETE"},[204,404]).then(function(){return(k.length?N(k):Promise.resolve()).then(O).then(function(z){L(""),I(z)},function(){L("Photo deleted, but refreshing the list failed \u2014 reload if it looks off.",!0),I(k)})},function(z){L(Rl(z,"Couldn\u2019t delete that photo. Try again."),!0),I(G)}).then(function(){T(!1)})}function q(X){return Hc(X).then(function(G){return G?import("./heic-to-CN7JBE7H.js").then(function(k){var z=k.heicTo||k.default&&k.default.heicTo;return z({blob:X,type:"image/jpeg",quality:.85})}).then(function(k){return{blob:k,name:Pc(X.name,!0)}}):{blob:X,name:Pc(X.name,!1)}})}y.addEventListener("click",function(){F||x.click()}),x.addEventListener("change",function(){var X=Array.prototype.slice.call(x.files||[]);x.value="",X.length&&oe(X)});function oe(X){T(!0);var G=X.length,k=0,z=0,R=!1,Q=C.slice(),he=Promise.resolve();X.forEach(function(pe){he=he.then(function(){return k++,L("Uploading "+k+" of "+G+"\u2026"),q(pe).then(function(Ee){var A=new FormData;return A.append("file",Ee.blob,Ee.name),Di("/api/v1/pages"+o+"/media",{method:"POST",body:A})}).then(null,function(Ee){z++,Ee&&(Ee.status===401||Ee.status===403)&&(R=!0)})})}),he.then(function(){return L("Finishing\u2026"),O()}).then(function(pe){var Ee=Q.filter(function(ee){return pe.indexOf(ee)!==-1}),A=pe.filter(function(ee){return Q.indexOf(ee)===-1}),w=Ee.concat(A);return w.length?N(w).catch(function(){return N(w)}).catch(function(){return Promise.all(A.map(function(ee){return Di("/api/v1/pages"+o+"/media/"+encodeURIComponent(ee),{method:"DELETE"},[204,404]).then(function(){return!0},function(){return!1})})).then(function(ee){var De=new Error("reorder failed");throw De.rolledBack=!0,De.rollbackIncomplete=ee.indexOf(!1)!==-1,De})}).then(O):(I([]),null)}).then(function(pe){pe&&I(pe),z?L(R?"Couldn\u2019t add photos \u2014 your login session expired. Sign in again, then retry.":z+" photo"+(z>1?"s":"")+" couldn\u2019t be added.",!0):L("")}).catch(function(pe){var Ee;return pe&&pe.rolledBack?Ee=pe.rollbackIncomplete?"Couldn\u2019t finish adding photos and cleanup was incomplete \u2014 reload the page and check your photos.":"Couldn\u2019t finish adding photos \u2014 changes were rolled back. Try again.":Ee="Couldn\u2019t add photos. Please try again.",L(Ee,!0),O().then(I,function(){I(Q)})}).then(function(){T(!1)})}d.innerHTML='

    Loading photos\u2026

    ',O().then(I).catch(function(){L("Couldn\u2019t load photos.",!0),I([])})}function Wg(){var o=document.querySelector('form[name="new-entry"]'),l=document.querySelector(".post-form-wrap");if(!(!o||!l)){var s=Nc("edit");if(s){Zo=!0;var a=l.querySelector("h1");a&&(a.textContent="Edit entry");var f=o.querySelector('button[type="submit"], input[type="submit"]'),h=f?f.tagName==="INPUT"?f.value:f.textContent:"Save changes";Oc(o,!0),Ul(f,"Loading entry\u2026");var c=Nc("return")||l.getAttribute("data-trip-url")||"";o.setAttribute("action","/post?edit="+encodeURIComponent(s)+(c?"&return="+encodeURIComponent(c):"")),fetch("/api/v1/pages"+s,{credentials:"include",headers:{Accept:"application/json"}}).then(function(d){if(!d.ok){var m=new Error("HTTP "+d.status);throw m.status=d.status,m}return d.json()}).then(function(d){var m=d&&d.data||{},y=m.header||{};hr("title",y.title!=null?y.title:m.title),hr("date",y.date?String(y.date).replace(" ","T"):""),Ig(m.content),hr("lat",y.lat),hr("lng",y.lng),jl(),hr("location_city",y.location_city),hr("location_country",y.location_country),hr("weather_desc",y.weather_desc),hr("weather_temp_c",y.weather_temp_c),hr("transport_mode",y.transport_mode),ql("featured",y.featured),ql("force_connect",y.force_connect),ql("published",y.published!==void 0?y.published:m.published);var x=ct("edit_path");x&&(x.value=s+"/entry.md"),Oc(o,!1),Ul(f,"Save changes");var C=o.querySelector(".more-options");C&&(C.open=!0),Rg(s)}).catch(function(d){var m=d&&d.status===404?"This entry no longer exists \u2014 it may have been deleted. Head back to the journal.":"Sorry \u2014 this entry couldn\u2019t be loaded for editing. Check your connection and try again.";Pg(l,m),Ul(f,h)})}}}function zc(){window.postFormEditor=yg(),Og(),Wg(),Ng(),Cg(),kg(),Eg(),Tg(),Mg()}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",zc):zc(); /*! Bundled license information: sortablejs/modular/sortable.esm.js: diff --git a/themes/intotheeast/js/src/location-map.js b/themes/intotheeast/js/src/location-map.js index 96986a9..9c80cca 100644 --- a/themes/intotheeast/js/src/location-map.js +++ b/themes/intotheeast/js/src/location-map.js @@ -6,7 +6,8 @@ * needs (KTD1). * * maplibre-gl itself is lazy-imported on first call (KTD3) so an ordinary - * GPS-only submit, where the panel is never opened, never fetches it. The + * GPS-only submit, where the panel is never opened, never fetches it. Its + * STYLESHEET is lazy too — see ensureMaplibreCss below. The * created map/marker are cached in module scope and reused on every * subsequent call — see the panel's toggle-open handler in post-form.js, * which calls this on every open and then always calls the returned @@ -22,7 +23,48 @@ */ import { MAP_STYLE } from './map-style.js'; -var cached = null; // { container, promise } +var cached = null; // { container, promise } +var cssPromise = null; // in-flight/settled load for maplibre's stylesheet + +/** + * Inject maplibre-gl's stylesheet on demand, once. + * + * esbuild will not emit a for a code-split chunk's CSS (R10), so the + * usual fix is a static `import 'maplibre-gl/dist/maplibre-gl.css'` up in + * post-form.js — but that defeats the lazy import it accompanies: every /post + * load would then pay ~9 KB gzip of vendor CSS for a panel most submits never + * open. So package.json builds the vendor stylesheet as its own + * css-compiled/maplibre-gl.css and we it here instead, in parallel with + * the engine's import(). Keeping the vendor file intact (rather than + * hand-picking the ~16 selectors this panel actually uses) means a maplibre + * upgrade can't silently un-style the map. + * + * The href is resolved from import.meta.url — the bundle is ESM, so this is the + * URL of this chunk under `js/post/`, which makes the link correct under any + * Grav base path without threading a URL through the template. (The panel is + * built entirely in JS, so there is no Twig element to hang a data-attr on.) + * + * Resolves on error as well as load: a missing stylesheet must degrade to an + * unstyled-but-functional map, never block it. On error the dead and the + * memo are dropped so a later retry re-attempts it, mirroring the map cache's + * clear-on-failure below. + */ +function ensureMaplibreCss() { + if (cssPromise) return cssPromise; + cssPromise = new Promise(function (resolve) { + var link = document.createElement('link'); + link.rel = 'stylesheet'; + link.href = new URL('../../css-compiled/maplibre-gl.css', import.meta.url).href; + link.onload = function () { resolve(); }; + link.onerror = function () { + link.remove(); + cssPromise = null; + resolve(); + }; + document.head.appendChild(link); + }); + return cssPromise; +} function buildPinElement() { var el = document.createElement('div'); @@ -35,7 +77,14 @@ export function getOrCreateLocationMap(container, onDragEnd) { return cached.promise; } - var promise = import('maplibre-gl').then(function (mod) { + // Stylesheet and engine fetch concurrently; awaiting the CSS before + // constructing the Map means maplibre never measures the container against + // half-applied styles. + var promise = Promise.all([ + import('maplibre-gl'), + ensureMaplibreCss() + ]).then(function (loaded) { + var mod = loaded[0]; var maplibregl = mod.default || mod; var map = new maplibregl.Map({ container: container, diff --git a/themes/intotheeast/js/src/post-form.js b/themes/intotheeast/js/src/post-form.js index 77999e9..7f5b398 100644 --- a/themes/intotheeast/js/src/post-form.js +++ b/themes/intotheeast/js/src/post-form.js @@ -10,9 +10,13 @@ import EasyMDE from 'easymde'; import Sortable from 'sortablejs'; import 'easymde/dist/easymde.min.css'; -// maplibre-gl's CSS is a static import — a dynamically-imported chunk's CSS is -// never auto-linked (R10). The JS itself stays a lazy import (see location-map.js). -import 'maplibre-gl/dist/maplibre-gl.css'; +// NOTE: maplibre-gl's CSS is deliberately NOT imported here. esbuild never emits +// a for a dynamically-imported chunk's CSS (R10), and a static import +// would have folded 68 KB / ~9 KB gzip of vendor stylesheet — ~78% of it rules +// for controls this panel never creates — into post-form.css on every /post +// load. location-map.js instead injects a to the separately-built +// css-compiled/maplibre-gl.css at the moment it lazy-imports the engine, so an +// ordinary GPS-only submit pays nothing for either half. import './post-form.css'; import { apiSend, apiErrorMsg } from './api-utils.js'; import { getOrCreateLocationMap } from './location-map.js'; diff --git a/themes/intotheeast/package.json b/themes/intotheeast/package.json index a755877..37df99c 100644 --- a/themes/intotheeast/package.json +++ b/themes/intotheeast/package.json @@ -1,7 +1,7 @@ { "private": true, "scripts": { - "build": "node scripts/gen-weather-icons.js && esbuild js/src/main.js --bundle --minify --format=iife --outfile=js/main.js --loader:.woff2=file --loader:.woff=file --asset-names=../fonts/[name] && esbuild js/src/map.js --bundle --minify --format=iife --outfile=js/map.js && esbuild js/src/feed-actions.js --bundle --minify --format=iife --outfile=js/feed-actions.js && esbuild js/src/trip-publish.js --bundle --minify --format=iife --outfile=js/trip-publish.js && rm -rf js/post && esbuild js/src/post-form.js --bundle --minify --format=esm --splitting --outdir=js/post && mkdir -p css-compiled fonts && { mv js/main.css css-compiled/main.css 2>/dev/null || true; } && { mv js/map.css css-compiled/map.css 2>/dev/null || true; } && { mv js/post/post-form.css css-compiled/post-form.css 2>/dev/null || true; }" + "build": "node scripts/gen-weather-icons.js && esbuild js/src/main.js --bundle --minify --format=iife --outfile=js/main.js --loader:.woff2=file --loader:.woff=file --asset-names=../fonts/[name] && esbuild js/src/map.js --bundle --minify --format=iife --outfile=js/map.js && esbuild js/src/feed-actions.js --bundle --minify --format=iife --outfile=js/feed-actions.js && esbuild js/src/trip-publish.js --bundle --minify --format=iife --outfile=js/trip-publish.js && rm -rf js/post && esbuild js/src/post-form.js --bundle --minify --format=esm --splitting --outdir=js/post && mkdir -p css-compiled fonts && esbuild node_modules/maplibre-gl/dist/maplibre-gl.css --bundle --minify --outfile=css-compiled/maplibre-gl.css && { mv js/main.css css-compiled/main.css 2>/dev/null || true; } && { mv js/map.css css-compiled/map.css 2>/dev/null || true; } && { mv js/post/post-form.css css-compiled/post-form.css 2>/dev/null || true; }" }, "dependencies": { "@fontsource-variable/dm-sans": "latest", From 2b91aa30c33a183e1ef24987feb045045616fd3c Mon Sep 17 00:00:00 2001 From: Mischa Date: Fri, 24 Jul 2026 22:33:27 +0200 Subject: [PATCH 8/8] fix(demo): stop demo-load reverting the real italy-2025 trip MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit docs/demo/trips/italy-2025/ shares its slug with a real trip (deliberately — the fixture supplies that trip's GPX and dailies), so demo-load copies this trip.md straight over the live page. The fixture was a snapshot from before the trip gained a tagline, so every `make test` silently deleted that tagline from real content, showing up as an unexplained dirty submodule afterwards. Re-sync it byte-identically to the live page. The note about keeping colliding fixtures in sync goes in the Makefile recipe, not here — anything added to this file lands in real content on the next demo-load. --- docs/demo/trips/italy-2025/trip.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/demo/trips/italy-2025/trip.md b/docs/demo/trips/italy-2025/trip.md index a51f618..4882a59 100644 --- a/docs/demo/trips/italy-2025/trip.md +++ b/docs/demo/trips/italy-2025/trip.md @@ -5,4 +5,5 @@ date: '2025-09-01' date_start: '2025-09-01' date_end: '2025-09-08' cover_image: '' +tagline: '600 km of Tuscan gravel — hill towns, aperitivi, and relentless climbing' ---