@dartcom/ui-kit 3.8.1 → 3.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/form/form.stories.d.ts.map +1 -1
- package/dist/components/input/input.d.ts.map +1 -1
- package/dist/index.cjs +4 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/pages/auth/auth.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -145,5 +145,5 @@ function zn(e,t){const n=on(e,t);return"production"!==process.env.NODE_ENV?(...t
|
|
|
145
145
|
*
|
|
146
146
|
* This source code is licensed under the MIT license found in the
|
|
147
147
|
* LICENSE file in the root directory of this source tree.
|
|
148
|
-
*/var Vb,Ub,Wb=($b||($b=1,"production"===process.env.NODE_ENV?Fb.exports=function(){if(Db)return Lb;Db=1;var e=r,t="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=e.useState,i=e.useEffect,o=e.useLayoutEffect,s=e.useDebugValue;function a(e){var n=e.getSnapshot;e=e.value;try{var r=n();return!t(e,r)}catch(e){return!0}}var l="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var r=t(),l=n({inst:{value:r,getSnapshot:t}}),u=l[0].inst,c=l[1];return o(function(){u.value=r,u.getSnapshot=t,a(u)&&c({inst:u})},[e,r,t]),i(function(){return a(u)&&c({inst:u}),e(function(){a(u)&&c({inst:u})})},[e]),s(r),r};return Lb.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:l,Lb}():Fb.exports=(jb||(jb=1,"production"!==process.env.NODE_ENV&&function(){function e(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!n(e,r)}catch(e){return!0}}"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=r,n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=t.useState,o=t.useEffect,s=t.useLayoutEffect,a=t.useDebugValue,l=!1,u=!1,c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(r,c){l||void 0===t.startTransition||(l=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var d=c();if(!u){var h=c();n(d,h)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),u=!0)}var p=(h=i({inst:{value:d,getSnapshot:c}}))[0].inst,f=h[1];return s(function(){p.value=d,p.getSnapshot=c,e(p)&&f({inst:p})},[r,d,c]),o(function(){return e(p)&&f({inst:p}),r(function(){e(p)&&f({inst:p})})},[r]),a(d),d};Bb.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:c,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Bb)),Fb.exports);function qb(e){e.reaction=new zg("observer".concat(e.name),function(){var t;e.stateVersion=Symbol(),null===(t=e.onStoreChange)||void 0===t||t.call(e)})}var Gb=!0,Hb="function"==typeof Symbol&&Symbol.for,Yb=null!==(Ub=null===(Vb=Object.getOwnPropertyDescriptor(function(){},"name"))||void 0===Vb?void 0:Vb.configurable)&&void 0!==Ub&&Ub,Kb=Hb?Symbol.for("react.forward_ref"):"function"==typeof i&&i(function(e){return null}).$$typeof,Xb=Hb?Symbol.for("react.memo"):"function"==typeof c&&c(function(e){return null}).$$typeof;function Zb(e,t){if(process.env.NODE_ENV,Xb&&e.$$typeof===Xb)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");var n=!1,o=e,s=e.displayName||e.name;if(Kb&&e.$$typeof===Kb&&(n=!0,"function"!=typeof(o=e.render)))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var a,l,u=function(e,t){return function(e,t){void 0===t&&(t="observed");var n=r.useRef(null);if(!n.current){var i={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(e){return zb.unregister(i),i.onStoreChange=e,i.reaction||(qb(i),i.stateVersion=Symbol()),function(){var e;i.onStoreChange=null,null===(e=i.reaction)||void 0===e||e.dispose(),i.reaction=null}},getSnapshot:function(){return i.stateVersion}};n.current=i}var o,s,a=n.current;if(a.reaction||(qb(a),zb.register(n,a,a)),r.useDebugValue(a.reaction,Mb),Wb.useSyncExternalStore(a.subscribe,a.getSnapshot,a.getSnapshot),a.reaction.track(function(){try{o=e()}catch(e){s=e}}),s)throw s;return o}(function(){return o(e,t)},s)};return u.displayName=e.displayName,Yb&&Object.defineProperty(u,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(u.contextTypes=e.contextTypes,"production"!==process.env.NODE_ENV&&Gb&&(Gb=!1,console.warn("[mobx-react-lite] Support for Legacy Context in function components will be removed in the next major release."))),n&&(u=i(u)),u=c(u),a=e,l=u,Object.keys(a).forEach(function(e){Jb[e]||Object.defineProperty(l,e,Object.getOwnPropertyDescriptor(a,e))}),"production"!==process.env.NODE_ENV&&Object.defineProperty(u,"contextTypes",{set:function(){var e,t;throw new Error("[mobx-react-lite] `".concat(this.displayName||(null===(e=this.type)||void 0===e?void 0:e.displayName)||(null===(t=this.type)||void 0===t?void 0:t.name)||"Component",".contextTypes` must be set before applying `observer`."))}}),u}var Jb={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};process.env.NODE_ENV,function(e){e||(e=Pb,"production"!==process.env.NODE_ENV&&console.warn("[MobX] Failed to get unstable_batched updates from react-dom / react-native")),uy({reactionScheduler:e})}(E),zb.finalizeAllImmediately;var Qb=Zb(t=>{const{children:n,variant:r="contained",textVariant:i="body2",loading:o,icon:s,sx:a,...l}=t;return o&&!s?e(uf,{sx:{whiteSpace:"nowrap",padding:"5px 15px",height:"23px"},loadingIndicator:e(dl,{variant:i,children:"Loading..."}),variant:r,loading:!0,...l,children:n}):s?e(il,{...l,children:s}):e(ud,{sx:{whiteSpace:"nowrap",padding:"5px 15px",textTransform:"none",...a},variant:r,...l,children:e(dl,{variant:i,children:n})})}),ev=e=>"checkbox"===e.type,tv=e=>e instanceof Date,nv=e=>null==e;const rv=e=>"object"==typeof e;var iv=e=>!nv(e)&&!Array.isArray(e)&&rv(e)&&!tv(e),ov=e=>iv(e)&&e.target?ev(e.target)?e.target.checked:e.target.value:e,sv=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),av="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function lv(e){let t;const n=Array.isArray(e),r="undefined"!=typeof FileList&&e instanceof FileList;if(e instanceof Date)t=new Date(e);else{if(av&&(e instanceof Blob||r)||!n&&!iv(e))return e;if(t=n?[]:Object.create(Object.getPrototypeOf(e)),n||(e=>{const t=e.constructor&&e.constructor.prototype;return iv(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const n in e)e.hasOwnProperty(n)&&(t[n]=lv(e[n]));else t=e}return t}var uv=e=>/^\w*$/.test(e),cv=e=>void 0===e,dv=e=>Array.isArray(e)?e.filter(Boolean):[],hv=e=>dv(e.replace(/["|']|\]/g,"").split(/\.|\[/)),pv=(e,t,n)=>{if(!t||!iv(e))return n;const r=(uv(t)?[t]:hv(t)).reduce((e,t)=>nv(e)?e:e[t],e);return cv(r)||r===e?cv(e[t])?n:e[t]:r},fv=e=>"boolean"==typeof e,mv=(e,t,n)=>{let r=-1;const i=uv(t)?[t]:hv(t),o=i.length,s=o-1;for(;++r<o;){const t=i[r];let o=n;if(r!==s){const n=e[t];o=iv(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=o,e=e[t]}};const gv="blur",yv="focusout",bv="change",vv="onBlur",_v="onChange",xv="onSubmit",wv="onTouched",Ev="all",Sv="max",Tv="min",kv="maxLength",Ov="minLength",Av="pattern",Cv="required",Rv="validate",Nv=r.createContext(null);Nv.displayName="HookFormContext";const Pv=()=>r.useContext(Nv),Mv=e=>{const{children:t,...n}=e;return r.createElement(Nv.Provider,{value:n},t)};var Dv=(e,t,n,r=!0)=>{const i={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(i,o,{get:()=>{const i=o;return t._proxyFormState[i]!==Ev&&(t._proxyFormState[i]=!r||Ev),n&&(n[i]=!0),e[i]}});return i};const Iv="undefined"!=typeof window?r.useLayoutEffect:r.useEffect;var zv=e=>"string"==typeof e,Fv=(e,t,n,r,i)=>zv(e)?(r&&t.watch.add(e),pv(n,e,i)):Array.isArray(e)?e.map(e=>(r&&t.watch.add(e),pv(n,e))):(r&&(t.watchAll=!0),n),Lv=e=>nv(e)||!rv(e);function jv(e,t,n=new WeakSet){if(Lv(e)||Lv(t))return e===t;if(tv(e)&&tv(t))return e.getTime()===t.getTime();const r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);for(const o of r){const r=e[o];if(!i.includes(o))return!1;if("ref"!==o){const e=t[o];if(tv(r)&&tv(e)||iv(r)&&iv(e)||Array.isArray(r)&&Array.isArray(e)?!jv(r,e,n):r!==e)return!1}}return!0}function $v(e){const t=Pv(),{name:n,disabled:i,control:o=t.control,shouldUnregister:s,defaultValue:a}=e,l=sv(o._names.array,n),u=r.useMemo(()=>pv(o._formValues,n,pv(o._defaultValues,n,a)),[o,n,a]),c=function(e){const t=Pv(),{control:n=t.control,name:i,defaultValue:o,disabled:s,exact:a,compute:l}=e||{},u=r.useRef(o),c=r.useRef(l),d=r.useRef(void 0),h=r.useRef(n),p=r.useRef(i);c.current=l;const[f,m]=r.useState(()=>{const e=n._getWatch(i,u.current);return c.current?c.current(e):e}),g=r.useCallback(e=>{const t=Fv(i,n._names,e||n._formValues,!1,u.current);return c.current?c.current(t):t},[n._formValues,n._names,i]),y=r.useCallback(e=>{if(!s){const t=Fv(i,n._names,e||n._formValues,!1,u.current);if(c.current){const e=c.current(t);jv(e,d.current)||(m(e),d.current=e)}else m(t)}},[n._formValues,n._names,s,i]);Iv(()=>(h.current===n&&jv(p.current,i)||(h.current=n,p.current=i,y()),n._subscribe({name:i,formState:{values:!0},exact:a,callback:e=>{y(e.values)}})),[n,a,i,y]),r.useEffect(()=>n._removeUnmounted());const b=h.current!==n,v=p.current,_=r.useMemo(()=>{if(s)return null;const e=!b&&!jv(v,i);return b||e?g():null},[s,b,i,v,g]);return null!==_?_:f}({control:o,name:n,defaultValue:u,exact:!0}),d=function(e){const t=Pv(),{control:n=t.control,disabled:i,name:o,exact:s}=e||{},[a,l]=r.useState(n._formState),u=r.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Iv(()=>n._subscribe({name:o,formState:u.current,exact:s,callback:e=>{!i&&l({...n._formState,...e})}}),[o,i,s]),r.useEffect(()=>{u.current.isValid&&n._setValid(!0)},[n]),r.useMemo(()=>Dv(a,n,u.current,!1),[a,n])}({control:o,name:n,exact:!0}),h=r.useRef(e),p=r.useRef(void 0),f=r.useRef(o.register(n,{...e.rules,value:c,...fv(e.disabled)?{disabled:e.disabled}:{}}));h.current=e;const m=r.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!pv(d.errors,n)},isDirty:{enumerable:!0,get:()=>!!pv(d.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!pv(d.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!pv(d.validatingFields,n)},error:{enumerable:!0,get:()=>pv(d.errors,n)}}),[d,n]),g=r.useCallback(e=>f.current.onChange({target:{value:ov(e),name:n},type:bv}),[n]),y=r.useCallback(()=>f.current.onBlur({target:{value:pv(o._formValues,n),name:n},type:gv}),[n,o._formValues]),b=r.useCallback(e=>{const t=pv(o._fields,n);t&&e&&(t._f.ref={focus:()=>e.focus&&e.focus(),select:()=>e.select&&e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})},[o._fields,n]),v=r.useMemo(()=>({name:n,value:c,...fv(i)||d.disabled?{disabled:d.disabled||i}:{},onChange:g,onBlur:y,ref:b}),[n,i,d.disabled,g,y,b,c]);return r.useEffect(()=>{const e=o._options.shouldUnregister||s,t=p.current;t&&t!==n&&!l&&o.unregister(t),o.register(n,{...h.current.rules,...fv(h.current.disabled)?{disabled:h.current.disabled}:{}});const r=(e,t)=>{const n=pv(o._fields,e);n&&n._f&&(n._f.mount=t)};if(r(n,!0),e){const e=lv(pv(o._options.defaultValues,n,h.current.defaultValue));mv(o._defaultValues,n,e),cv(pv(o._formValues,n))&&mv(o._formValues,n,e)}return!l&&o.register(n),p.current=n,()=>{(l?e&&!o._state.action:e)?o.unregister(n):r(n,!1)}},[n,o,l,s]),r.useEffect(()=>{o._setDisabledField({disabled:i,name:n})},[i,n,o]),r.useMemo(()=>({field:v,formState:d,fieldState:m}),[v,d,m])}const Bv=e=>e.render($v(e));var Vv=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},Uv=e=>Array.isArray(e)?e:[e],Wv=()=>{let e=[];return{get observers(){return e},next:t=>{for(const n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}};function qv(e,t){const n={};for(const r in e)if(e.hasOwnProperty(r)){const i=e[r],o=t[r];if(i&&iv(i)&&o){const e=qv(i,o);iv(e)&&(n[r]=e)}else e[r]&&(n[r]=o)}return n}var Gv=e=>iv(e)&&!Object.keys(e).length,Hv=e=>"file"===e.type,Yv=e=>"function"==typeof e,Kv=e=>{if(!av)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Xv=e=>"select-multiple"===e.type,Zv=e=>"radio"===e.type,Jv=e=>Kv(e)&&e.isConnected;function Qv(e,t){const n=Array.isArray(t)?t:uv(t)?[t]:hv(t),r=1===n.length?e:function(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=cv(e)?r++:e[t[r++]];return e}(e,n),i=n.length-1,o=n[i];return r&&delete r[o],0!==i&&(iv(r)&&Gv(r)||Array.isArray(r)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!cv(e[t]))return!1;return!0}(r))&&Qv(e,n.slice(0,-1)),e}function e_(e){return Array.isArray(e)||iv(e)&&!(e=>{for(const t in e)if(Yv(e[t]))return!0;return!1})(e)}function t_(e,t={}){for(const n in e)e_(e[n])?(t[n]=Array.isArray(e[n])?[]:{},t_(e[n],t[n])):cv(e[n])||(t[n]=!0);return t}function n_(e,t,n){n||(n=t_(t));for(const r in e)e_(e[r])?cv(t)||Lv(n[r])?n[r]=t_(e[r],Array.isArray(e[r])?[]:{}):n_(e[r],nv(t)?{}:t[r],n[r]):n[r]=!jv(e[r],t[r]);return n}const r_={value:!1,isValid:!1},i_={value:!0,isValid:!0};var o_=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!cv(e[0].attributes.value)?cv(e[0].value)||""===e[0].value?i_:{value:e[0].value,isValid:!0}:i_:r_}return r_},s_=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>cv(e)?e:t?""===e?NaN:e?+e:e:n&&zv(e)?new Date(e):r?r(e):e;const a_={isValid:!1,value:null};var l_=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,a_):a_;function u_(e){const t=e.ref;return Hv(t)?t.files:Zv(t)?l_(e.refs).value:Xv(t)?[...t.selectedOptions].map(({value:e})=>e):ev(t)?o_(e.refs).value:s_(cv(t.value)?e.ref.value:t.value,e)}var c_=e=>e instanceof RegExp,d_=e=>cv(e)?e:c_(e)?e.source:iv(e)?c_(e.value)?e.value.source:e.value:e,h_=e=>({isOnSubmit:!e||e===xv,isOnBlur:e===vv,isOnChange:e===_v,isOnAll:e===Ev,isOnTouch:e===wv});const p_="AsyncFunction";var f_=e=>!!e&&!!e.validate&&!!(Yv(e.validate)&&e.validate.constructor.name===p_||iv(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===p_)),m_=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));const g_=(e,t,n,r)=>{for(const i of n||Object.keys(e)){const n=pv(e,i);if(n){const{_f:e,...o}=n;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],i)&&!r)return!0;if(e.ref&&t(e.ref,e.name)&&!r)return!0;if(g_(o,t))break}else if(iv(o)&&g_(o,t))break}}};function y_(e,t,n){const r=pv(e,n);if(r||uv(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const r=i.join("."),o=pv(t,r),s=pv(e,r);if(o&&!Array.isArray(o)&&n!==r)return{name:n};if(s&&s.type)return{name:r,error:s};if(s&&s.root&&s.root.type)return{name:`${r}.root`,error:s.root};i.pop()}return{name:n}}var b_=(e,t,n)=>{const r=Uv(pv(e,n));return mv(r,"root",t[n]),mv(e,n,r),e};function v_(e,t,n="validate"){if(zv(e)||Array.isArray(e)&&e.every(zv)||fv(e)&&!e)return{type:n,message:zv(e)?e:"",ref:t}}var __=e=>iv(e)&&!c_(e)?e:{value:e,message:""},x_=async(e,t,n,r,i,o)=>{const{ref:s,refs:a,required:l,maxLength:u,minLength:c,min:d,max:h,pattern:p,validate:f,name:m,valueAsNumber:g,mount:y}=e._f,b=pv(n,m);if(!y||t.has(m))return{};const v=a?a[0]:s,_=e=>{i&&v.reportValidity&&(v.setCustomValidity(fv(e)?"":e||""),v.reportValidity())},x={},w=Zv(s),E=ev(s),S=w||E,T=(g||Hv(s))&&cv(s.value)&&cv(b)||Kv(s)&&""===s.value||""===b||Array.isArray(b)&&!b.length,k=Vv.bind(null,m,r,x),O=(e,t,n,r=kv,i=Ov)=>{const o=e?t:n;x[m]={type:e?r:i,message:o,ref:s,...k(e?r:i,o)}};if(o?!Array.isArray(b)||!b.length:l&&(!S&&(T||nv(b))||fv(b)&&!b||E&&!o_(a).isValid||w&&!l_(a).isValid)){const{value:e,message:t}=zv(l)?{value:!!l,message:l}:__(l);if(e&&(x[m]={type:Cv,message:t,ref:v,...k(Cv,t)},!r))return _(t),x}if(!(T||nv(d)&&nv(h))){let e,t;const n=__(h),i=__(d);if(nv(b)||isNaN(b)){const r=s.valueAsDate||new Date(b),o=e=>new Date((new Date).toDateString()+" "+e),a="time"==s.type,l="week"==s.type;zv(n.value)&&b&&(e=a?o(b)>o(n.value):l?b>n.value:r>new Date(n.value)),zv(i.value)&&b&&(t=a?o(b)<o(i.value):l?b<i.value:r<new Date(i.value))}else{const r=s.valueAsNumber||(b?+b:b);nv(n.value)||(e=r>n.value),nv(i.value)||(t=r<i.value)}if((e||t)&&(O(!!e,n.message,i.message,Sv,Tv),!r))return _(x[m].message),x}if((u||c)&&!T&&(zv(b)||o&&Array.isArray(b))){const e=__(u),t=__(c),n=!nv(e.value)&&b.length>+e.value,i=!nv(t.value)&&b.length<+t.value;if((n||i)&&(O(n,e.message,t.message),!r))return _(x[m].message),x}if(p&&!T&&zv(b)){const{value:e,message:t}=__(p);if(c_(e)&&!b.match(e)&&(x[m]={type:Av,message:t,ref:s,...k(Av,t)},!r))return _(t),x}if(f)if(Yv(f)){const e=v_(await f(b,n),v);if(e&&(x[m]={...e,...k(Rv,e.message)},!r))return _(e.message),x}else if(iv(f)){let e={};for(const t in f){if(!Gv(e)&&!r)break;const i=v_(await f[t](b,n),v,t);i&&(e={...i,...k(t,i.message)},_(i.message),r&&(x[m]=e))}if(!Gv(e)&&(x[m]={ref:v,...e},!r))return x}return _(!0),x};const w_={mode:xv,reValidateMode:_v,shouldFocusError:!0};function E_(e={}){let t,n={...w_,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:Yv(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:n.errors||{},disabled:n.disabled||!1},i={},o=(iv(n.defaultValues)||iv(n.values))&&lv(n.defaultValues||n.values)||{},s=n.shouldUnregister?{}:lv(o),a={action:!1,mount:!1,watch:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},u=0;const c={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let d={...c};const h={array:Wv(),state:Wv()},p=n.criteriaMode===Ev,f=async e=>{if(!n.disabled&&(c.isValid||d.isValid||e)){const e=n.resolver?Gv((await v()).errors):await _(i,!0);e!==r.isValid&&h.state.next({isValid:e})}},m=(e,t)=>{!n.disabled&&(c.isValidating||c.validatingFields||d.isValidating||d.validatingFields)&&((e||Array.from(l.mount)).forEach(e=>{e&&(t?mv(r.validatingFields,e,t):Qv(r.validatingFields,e))}),h.state.next({validatingFields:r.validatingFields,isValidating:!Gv(r.validatingFields)}))},g=(e,t,n,r)=>{const l=pv(i,e);if(l){const i=pv(s,e,cv(n)?pv(o,e):n);cv(i)||r&&r.defaultChecked||t?mv(s,e,t?i:u_(l._f)):E(e,i),a.mount&&f()}},y=(e,t,i,s,a)=>{let l=!1,u=!1;const p={name:e};if(!n.disabled){if(!i||s){(c.isDirty||d.isDirty)&&(u=r.isDirty,r.isDirty=p.isDirty=x(),l=u!==p.isDirty);const n=jv(pv(o,e),t);u=!!pv(r.dirtyFields,e),n?Qv(r.dirtyFields,e):mv(r.dirtyFields,e,!0),p.dirtyFields=r.dirtyFields,l=l||(c.dirtyFields||d.dirtyFields)&&u!==!n}if(i){const t=pv(r.touchedFields,e);t||(mv(r.touchedFields,e,i),p.touchedFields=r.touchedFields,l=l||(c.touchedFields||d.touchedFields)&&t!==i)}l&&a&&h.state.next(p)}return l?p:{}},b=(e,i,o,s)=>{const a=pv(r.errors,e),l=(c.isValid||d.isValid)&&fv(i)&&r.isValid!==i;var p;if(n.delayError&&o?(p=()=>((e,t)=>{mv(r.errors,e,t),h.state.next({errors:r.errors})})(e,o),t=e=>{clearTimeout(u),u=setTimeout(p,e)},t(n.delayError)):(clearTimeout(u),t=null,o?mv(r.errors,e,o):Qv(r.errors,e)),(o?!jv(a,o):a)||!Gv(s)||l){const t={...s,...l&&fv(i)?{isValid:i}:{},errors:r.errors,name:e};r={...r,...t},h.state.next(t)}},v=async e=>{m(e,!0);const t=await n.resolver(s,n.context,((e,t,n,r)=>{const i={};for(const n of e){const e=pv(t,n);e&&mv(i,n,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}})(e||l.mount,i,n.criteriaMode,n.shouldUseNativeValidation));return m(e),t},_=async(e,t,i={valid:!0})=>{for(const o in e){const a=e[o];if(a){const{_f:e,...o}=a;if(e){const o=l.array.has(e.name),u=a._f&&f_(a._f);u&&c.validatingFields&&m([e.name],!0);const d=await x_(a,l.disabled,s,p,n.shouldUseNativeValidation&&!t,o);if(u&&c.validatingFields&&m([e.name]),d[e.name]&&(i.valid=!1,t))break;!t&&(pv(d,e.name)?o?b_(r.errors,d,e.name):mv(r.errors,e.name,d[e.name]):Qv(r.errors,e.name))}!Gv(o)&&await _(o,t,i)}}return i.valid},x=(e,t)=>!n.disabled&&(e&&t&&mv(s,e,t),!jv(C(),o)),w=(e,t,n)=>Fv(e,l,{...a.mount?s:cv(t)?o:zv(e)?{[e]:t}:t},n,t),E=(e,t,n={})=>{const r=pv(i,e);let o=t;if(r){const n=r._f;n&&(!n.disabled&&mv(s,e,s_(t,n)),o=Kv(n.ref)&&nv(t)?"":t,Xv(n.ref)?[...n.ref.options].forEach(e=>e.selected=o.includes(e.value)):n.refs?ev(n.ref)?n.refs.forEach(e=>{e.defaultChecked&&e.disabled||(Array.isArray(o)?e.checked=!!o.find(t=>t===e.value):e.checked=o===e.value||!!o)}):n.refs.forEach(e=>e.checked=e.value===o):Hv(n.ref)?n.ref.value="":(n.ref.value=o,n.ref.type||h.state.next({name:e,values:lv(s)})))}(n.shouldDirty||n.shouldTouch)&&y(e,o,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&A(e)},S=(e,t,n)=>{for(const r in t){if(!t.hasOwnProperty(r))return;const o=t[r],s=e+"."+r,a=pv(i,s);(l.array.has(e)||iv(o)||a&&!a._f)&&!tv(o)?S(s,o,n):E(s,o,n)}},T=(e,t,n={})=>{const u=pv(i,e),p=l.array.has(e),f=lv(t);mv(s,e,f),p?(h.array.next({name:e,values:lv(s)}),(c.isDirty||c.dirtyFields||d.isDirty||d.dirtyFields)&&n.shouldDirty&&h.state.next({name:e,dirtyFields:n_(o,s),isDirty:x(e,f)})):!u||u._f||nv(f)?E(e,f,n):S(e,f,n),m_(e,l)&&h.state.next({...r,name:e}),h.state.next({name:a.mount?e:void 0,values:lv(s)})},k=async e=>{a.mount=!0;const o=e.target;let u=o.name,g=!0;const x=pv(i,u),w=e=>{g=Number.isNaN(e)||tv(e)&&isNaN(e.getTime())||jv(e,pv(s,u,e))},E=h_(n.mode),S=h_(n.reValidateMode);if(x){let a,k;const O=o.type?u_(x._f):ov(e),C=e.type===gv||e.type===yv,R=!((T=x._f).mount&&(T.required||T.min||T.max||T.maxLength||T.minLength||T.pattern||T.validate)||n.resolver||pv(r.errors,u)||x._f.deps)||((e,t,n,r,i)=>!i.isOnAll&&(!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:!(n?r.isOnChange:i.isOnChange)||e))(C,pv(r.touchedFields,u),r.isSubmitted,S,E),N=m_(u,l,C);mv(s,u,O),C?o&&o.readOnly||(x._f.onBlur&&x._f.onBlur(e),t&&t(0)):x._f.onChange&&x._f.onChange(e);const P=y(u,O,C),M=!Gv(P)||N;if(!C&&h.state.next({name:u,type:e.type,values:lv(s)}),R)return(c.isValid||d.isValid)&&("onBlur"===n.mode?C&&f():C||f()),M&&h.state.next({name:u,...N?{}:P});if(!C&&N&&h.state.next({...r}),n.resolver){const{errors:e}=await v([u]);if(w(O),g){const t=y_(r.errors,i,u),n=y_(e,i,t.name||u);a=n.error,u=n.name,k=Gv(e)}}else m([u],!0),a=(await x_(x,l.disabled,s,p,n.shouldUseNativeValidation))[u],m([u]),w(O),g&&(a?k=!1:(c.isValid||d.isValid)&&(k=await _(i,!0)));g&&(x._f.deps&&(!Array.isArray(x._f.deps)||x._f.deps.length>0)&&A(x._f.deps),b(u,k,a,P))}var T},O=(e,t)=>{if(pv(r.errors,t)&&e.focus)return e.focus(),1},A=async(e,t={})=>{let o,s;const a=Uv(e);if(n.resolver){const t=await(async e=>{const{errors:t}=await v(e);if(e)for(const n of e){const e=pv(t,n);e?mv(r.errors,n,e):Qv(r.errors,n)}else r.errors=t;return t})(cv(e)?e:a);o=Gv(t),s=e?!a.some(e=>pv(t,e)):o}else e?(s=(await Promise.all(a.map(async e=>{const t=pv(i,e);return await _(t&&t._f?{[e]:t}:t)}))).every(Boolean),(s||r.isValid)&&f()):s=o=await _(i);return h.state.next({...!zv(e)||(c.isValid||d.isValid)&&o!==r.isValid?{}:{name:e},...n.resolver||!e?{isValid:o}:{},errors:r.errors}),t.shouldFocus&&!s&&g_(i,O,e?a:l.mount),s},C=(e,t)=>{let n={...a.mount?s:o};return t&&(n=qv(t.dirtyFields?r.dirtyFields:r.touchedFields,n)),cv(e)?n:zv(e)?pv(n,e):e.map(e=>pv(n,e))},R=(e,t)=>({invalid:!!pv((t||r).errors,e),isDirty:!!pv((t||r).dirtyFields,e),error:pv((t||r).errors,e),isValidating:!!pv(r.validatingFields,e),isTouched:!!pv((t||r).touchedFields,e)}),N=(e,t,n)=>{const o=(pv(i,e,{_f:{}})._f||{}).ref,s=pv(r.errors,e)||{},{ref:a,message:l,type:u,...c}=s;mv(r.errors,e,{...c,...t,ref:o}),h.state.next({name:e,errors:r.errors,isValid:!1}),n&&n.shouldFocus&&o&&o.focus&&o.focus()},P=e=>h.state.subscribe({next:t=>{var n,i,a;n=e.name,i=t.name,a=e.exact,n&&i&&n!==i&&!Uv(n).some(e=>e&&(a?e===i:e.startsWith(i)||i.startsWith(e)))||!((e,t,n,r)=>{n(e);const{name:i,...o}=e;return Gv(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(e=>t[e]===(!r||Ev))})(t,e.formState||c,$,e.reRenderRoot)||e.callback({values:{...s},...r,...t,defaultValues:o})}}).unsubscribe,M=(e,t={})=>{for(const a of e?Uv(e):l.mount)l.mount.delete(a),l.array.delete(a),t.keepValue||(Qv(i,a),Qv(s,a)),!t.keepError&&Qv(r.errors,a),!t.keepDirty&&Qv(r.dirtyFields,a),!t.keepTouched&&Qv(r.touchedFields,a),!t.keepIsValidating&&Qv(r.validatingFields,a),!n.shouldUnregister&&!t.keepDefaultValue&&Qv(o,a);h.state.next({values:lv(s)}),h.state.next({...r,...t.keepDirty?{isDirty:x()}:{}}),!t.keepIsValid&&f()},D=({disabled:e,name:t})=>{(fv(e)&&a.mount||e||l.disabled.has(t))&&(e?l.disabled.add(t):l.disabled.delete(t))},I=(e,t={})=>{let r=pv(i,e);const s=fv(t.disabled)||fv(n.disabled);return mv(i,e,{...r||{},_f:{...r&&r._f?r._f:{ref:{name:e}},name:e,mount:!0,...t}}),l.mount.add(e),r?D({disabled:fv(t.disabled)?t.disabled:n.disabled,name:e}):g(e,!0,t.value),{...s?{disabled:t.disabled||n.disabled}:{},...n.progressive?{required:!!t.required,min:d_(t.min),max:d_(t.max),minLength:d_(t.minLength),maxLength:d_(t.maxLength),pattern:d_(t.pattern)}:{},name:e,onChange:k,onBlur:k,ref:s=>{if(s){I(e,t),r=pv(i,e);const n=cv(s.value)&&s.querySelectorAll&&s.querySelectorAll("input,select,textarea")[0]||s,a=(e=>Zv(e)||ev(e))(n),l=r._f.refs||[];if(a?l.find(e=>e===n):n===r._f.ref)return;mv(i,e,{_f:{...r._f,...a?{refs:[...l.filter(Jv),n,...Array.isArray(pv(o,e))?[{}]:[]],ref:{type:n.type,name:e}}:{ref:n}}}),g(e,!1,void 0,n)}else r=pv(i,e,{}),r._f&&(r._f.mount=!1),(n.shouldUnregister||t.shouldUnregister)&&(!sv(l.array,e)||!a.action)&&l.unMount.add(e)}}},z=()=>n.shouldFocusError&&g_(i,O,l.mount),F=(e,t)=>async o=>{let a;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let u=lv(s);if(h.state.next({isSubmitting:!0}),n.resolver){const{errors:e,values:t}=await v();r.errors=e,u=lv(t)}else await _(i);if(l.disabled.size)for(const e of l.disabled)Qv(u,e);if(Qv(r.errors,"root"),Gv(r.errors)){h.state.next({errors:{}});try{await e(u,o)}catch(e){a=e}}else t&&await t({...r.errors},o),z(),setTimeout(z);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Gv(r.errors)&&!a,submitCount:r.submitCount+1,errors:r.errors}),a)throw a},L=(e,t={})=>{const u=e?lv(e):o,d=lv(u),p=Gv(e),f=p?o:d;if(t.keepDefaultValues||(o=u),!t.keepValues){if(t.keepDirtyValues){const e=new Set([...l.mount,...Object.keys(n_(o,s))]);for(const t of Array.from(e))pv(r.dirtyFields,t)?mv(f,t,pv(s,t)):T(t,pv(f,t))}else{if(av&&cv(e))for(const e of l.mount){const t=pv(i,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(Kv(e)){const t=e.closest("form");if(t){t.reset();break}}}}if(t.keepFieldsRef)for(const e of l.mount)T(e,pv(f,e));else i={}}s=n.shouldUnregister?t.keepDefaultValues?lv(o):{}:lv(f),h.array.next({values:{...f}}),h.state.next({values:{...f}})}l={mount:t.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},a.mount=!c.isValid||!!t.keepIsValid||!!t.keepDirtyValues||!n.shouldUnregister&&!Gv(f),a.watch=!!n.shouldUnregister,h.state.next({submitCount:t.keepSubmitCount?r.submitCount:0,isDirty:!p&&(t.keepDirty?r.isDirty:!(!t.keepDefaultValues||jv(e,o))),isSubmitted:!!t.keepIsSubmitted&&r.isSubmitted,dirtyFields:p?{}:t.keepDirtyValues?t.keepDefaultValues&&s?n_(o,s):r.dirtyFields:t.keepDefaultValues&&e?n_(o,e):t.keepDirty?r.dirtyFields:{},touchedFields:t.keepTouched?r.touchedFields:{},errors:t.keepErrors?r.errors:{},isSubmitSuccessful:!!t.keepIsSubmitSuccessful&&r.isSubmitSuccessful,isSubmitting:!1,defaultValues:o})},j=(e,t)=>L(Yv(e)?e(s):e,t),$=e=>{r={...r,...e}},B={control:{register:I,unregister:M,getFieldState:R,handleSubmit:F,setError:N,_subscribe:P,_runSchema:v,_focusError:z,_getWatch:w,_getDirty:x,_setValid:f,_setFieldArray:(e,t=[],l,u,p=!0,f=!0)=>{if(u&&l&&!n.disabled){if(a.action=!0,f&&Array.isArray(pv(i,e))){const t=l(pv(i,e),u.argA,u.argB);p&&mv(i,e,t)}if(f&&Array.isArray(pv(r.errors,e))){const t=l(pv(r.errors,e),u.argA,u.argB);p&&mv(r.errors,e,t),((e,t)=>{!dv(pv(e,t)).length&&Qv(e,t)})(r.errors,e)}if((c.touchedFields||d.touchedFields)&&f&&Array.isArray(pv(r.touchedFields,e))){const t=l(pv(r.touchedFields,e),u.argA,u.argB);p&&mv(r.touchedFields,e,t)}(c.dirtyFields||d.dirtyFields)&&(r.dirtyFields=n_(o,s)),h.state.next({name:e,isDirty:x(e,t),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else mv(s,e,t)},_setDisabledField:D,_setErrors:e=>{r.errors=e,h.state.next({errors:r.errors,isValid:!1})},_getFieldArray:e=>dv(pv(a.mount?s:o,e,n.shouldUnregister?pv(o,e,[]):[])),_reset:L,_resetDefaultValues:()=>Yv(n.defaultValues)&&n.defaultValues().then(e=>{j(e,n.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:()=>{for(const e of l.unMount){const t=pv(i,e);t&&(t._f.refs?t._f.refs.every(e=>!Jv(e)):!Jv(t._f.ref))&&M(e)}l.unMount=new Set},_disableForm:e=>{fv(e)&&(h.state.next({disabled:e}),g_(i,(t,n)=>{const r=pv(i,n);r&&(t.disabled=r._f.disabled||e,Array.isArray(r._f.refs)&&r._f.refs.forEach(t=>{t.disabled=r._f.disabled||e}))},0,!1))},_subjects:h,_proxyFormState:c,get _fields(){return i},get _formValues(){return s},get _state(){return a},set _state(e){a=e},get _defaultValues(){return o},get _names(){return l},set _names(e){l=e},get _formState(){return r},get _options(){return n},set _options(e){n={...n,...e}}},subscribe:e=>(a.mount=!0,d={...d,...e.formState},P({...e,formState:d})),trigger:A,register:I,handleSubmit:F,watch:(e,t)=>Yv(e)?h.state.subscribe({next:n=>"values"in n&&e(w(void 0,t),n)}):w(e,t,!0),setValue:T,getValues:C,reset:j,resetField:(e,t={})=>{pv(i,e)&&(cv(t.defaultValue)?T(e,lv(pv(o,e))):(T(e,t.defaultValue),mv(o,e,lv(t.defaultValue))),t.keepTouched||Qv(r.touchedFields,e),t.keepDirty||(Qv(r.dirtyFields,e),r.isDirty=t.defaultValue?x(e,lv(pv(o,e))):x()),t.keepError||(Qv(r.errors,e),c.isValid&&f()),h.state.next({...r}))},clearErrors:e=>{e&&Uv(e).forEach(e=>Qv(r.errors,e)),h.state.next({errors:e?r.errors:{}})},unregister:M,setError:N,setFocus:(e,t={})=>{const n=pv(i,e),r=n&&n._f;if(r){const e=r.refs?r.refs[0]:r.ref;e.focus&&(e.focus(),t.shouldSelect&&Yv(e.select)&&e.select())}},getFieldState:R};return{...B,formControl:B}}const S_=({sx:t,...n})=>e(dl,{variant:"body1",sx:{color:"var(--color-white)",cursor:"default",...t},...n}),T_=fs(Ed)({padding:0,marginRight:"5px",marginLeft:"10px","& .MuiSvgIcon-root":{color:"var(--color-orange-medium)"}});function k_({label:t,name:r,...i}){const o=n.useId(),{control:s,setValue:a,watch:l}=Pv(),u=l(r),c=`${o}-${r}-${String(u)}`;return e(Bv,{control:s,name:r,render:({field:n})=>{const{value:r,name:o}=n;return t?e(wh,{color:"white",control:e(T_,{...i,checked:r,onChange:(e,t)=>{a(o,t,{shouldValidate:!0})}}),label:e(S_,{children:t})}):e(T_,{...i,checked:r,onChange:(e,t)=>{a(o,t,{shouldValidate:!0})}})}},c)}function O_({form:t,sx:n={},onSubmit:r,children:i}){const{handleSubmit:o}=t;return e(Mv,{...t,children:e(Jc,{component:"form",sx:{display:"grid",gap:"15px",...n},onSubmit:o(r),children:i})})}const A_=()=>Pv(),C_=t=>e(Qp,{size:"small",...t});function R_({name:t,items:r,label:i,sx:o,getLabel:s,getValue:a,getKey:l}){const{watch:u,resetField:c,setValue:d}=Pv(),h=u(t),p=n.useId(),f=r.find(e=>a(e)===h);return e(Vc,{value:f,options:r,id:p,getOptionLabel:e=>s(e),getOptionKey:e=>l(e),sx:{minWidth:150,...o},size:"small",onChange:(e,n)=>{n?d(t,a(n)):c(t)},renderInput:t=>e(C_,{...t,label:i})})}function N_(t){const{name:r,type:i}=t,o=n.useId(),{control:s}=Pv();return e(Bv,{name:r,control:s,render:({field:n})=>e(C_,{id:o,...t,...n,onChange:e=>{const{target:t}=e,{value:r}=t;if("number"===i)""===r?n.onChange():n.onChange(Number(r));else n.onChange(e)}})})}const P_="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function M_(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function D_(e){return"nodeType"in e}function I_(e){var t,n;return e?M_(e)?e:D_(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function z_(e){const{Document:t}=I_(e);return e instanceof t}function F_(e){return!M_(e)&&e instanceof I_(e).HTMLElement}function L_(e){return e instanceof I_(e).SVGElement}function j_(e){return e?M_(e)?e.document:D_(e)?z_(e)?e:F_(e)||L_(e)?e.ownerDocument:document:document:document}const $_=P_?d:h;function B_(e){const t=p(e);return $_(()=>{t.current=e}),m(function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)},[])}function V_(e,t){void 0===t&&(t=[e]);const n=p(e);return $_(()=>{n.current!==e&&(n.current=e)},t),n}function U_(e,t){const n=p();return f(()=>{const t=e(n.current);return n.current=t,t},[...t])}function W_(e){const t=B_(e),n=p(null),r=m(e=>{e!==n.current&&(null==t||t(e,n.current)),n.current=e},[]);return[n,r]}function q_(e){const t=p();return h(()=>{t.current=e},[e]),t.current}let G_={};function H_(e,t){return f(()=>{if(t)return t;const n=null==G_[e]?0:G_[e]+1;return G_[e]=n,e+"-"+n},[e,t])}function Y_(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((t,n)=>{const r=Object.entries(n);for(const[n,i]of r){const r=t[n];null!=r&&(t[n]=r+e*i)}return t},{...t})}}const K_=Y_(1),X_=Y_(-1);function Z_(e){if(!e)return!1;const{KeyboardEvent:t}=I_(e.target);return t&&e instanceof t}function J_(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=I_(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return function(e){return"clientX"in e&&"clientY"in e}(e)?{x:e.clientX,y:e.clientY}:null}const Q_=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Q_.Translate.toString(e),Q_.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),ex="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function tx(e){return e.matches(ex)?e:e.querySelector(ex)}const nx={display:"none"};function rx(e){let{id:t,value:n}=e;return r.createElement("div",{id:t,style:nx},n)}function ix(e){let{id:t,announcement:n,ariaLiveType:i="assertive"}=e;return r.createElement("div",{id:t,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":i,"aria-atomic":!0},n)}const ox=g(null);const sx={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},ax={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function lx(e){let{announcements:t=ax,container:n,hiddenTextDescribedById:i,screenReaderInstructions:s=sx}=e;const{announce:a,announcement:l}=function(){const[e,t]=u("");return{announce:m(e=>{null!=e&&t(e)},[]),announcement:e}}(),c=H_("DndLiveRegion"),[d,p]=u(!1);if(h(()=>{p(!0)},[]),function(e){const t=o(ox);h(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}(f(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!d)return null;const g=r.createElement(r.Fragment,null,r.createElement(rx,{id:i,value:s.draggable}),r.createElement(ix,{id:c,announcement:l}));return n?S(g,n):g}var ux;function cx(){}!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(ux||(ux={}));const dx=Object.freeze({x:0,y:0});function hx(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function px(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function fx(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function mx(e,t,n){return void 0===t&&(t=e.left),void 0===n&&(n=e.top),{x:t+.5*e.width,y:n+.5*e.height}}const gx=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=mx(t,t.left,t.top),o=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=hx(mx(r),i);o.push({id:t,data:{droppableContainer:e,value:n}})}}return o.sort(px)};function yx(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),s=i-r,a=o-n;if(r<i&&n<o){const n=t.width*t.height,r=e.width*e.height,i=s*a;return Number((i/(n+r-i)).toFixed(4))}return 0}const bx=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const e of r){const{id:r}=e,o=n.get(r);if(o){const n=yx(o,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(fx)};function vx(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:dx}function _x(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}const xx=_x(1);const wx={ignoreTransform:!1};function Ex(e,t){void 0===t&&(t=wx);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:r}=I_(e).getComputedStyle(e);t&&(n=function(e,t,n){const r=function(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}(t);if(!r)return e;const{scaleX:i,scaleY:o,x:s,y:a}=r,l=e.left-s-(1-i)*parseFloat(n),u=e.top-a-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),c=i?e.width/i:e.width,d=o?e.height/o:e.height;return{width:c,height:d,top:u,right:l+c,bottom:u+d,left:l}}(n,t,r))}const{top:r,left:i,width:o,height:s,bottom:a,right:l}=n;return{top:r,left:i,width:o,height:s,bottom:a,right:l}}function Sx(e){return Ex(e,{ignoreTransform:!0})}function Tx(e,t){const n=[];return e?function r(i){if(null!=t&&n.length>=t)return n;if(!i)return n;if(z_(i)&&null!=i.scrollingElement&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!F_(i)||L_(i))return n;if(n.includes(i))return n;const o=I_(e).getComputedStyle(i);return i!==e&&function(e,t){void 0===t&&(t=I_(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(e=>{const r=t[e];return"string"==typeof r&&n.test(r)})}(i,o)&&n.push(i),function(e,t){return void 0===t&&(t=I_(e).getComputedStyle(e)),"fixed"===t.position}(i,o)?n:r(i.parentNode)}(e):n}function kx(e){const[t]=Tx(e,1);return null!=t?t:null}function Ox(e){return P_&&e?M_(e)?e:D_(e)?z_(e)||e===j_(e).scrollingElement?window:F_(e)?e:null:null:null}function Ax(e){return M_(e)?e.scrollX:e.scrollLeft}function Cx(e){return M_(e)?e.scrollY:e.scrollTop}function Rx(e){return{x:Ax(e),y:Cx(e)}}var Nx;function Px(e){return!(!P_||!e)&&e===document.scrollingElement}function Mx(e){const t={x:0,y:0},n=Px(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(Nx||(Nx={}));const Dx={x:.2,y:.2};function Ix(e,t,n,r,i){let{top:o,left:s,right:a,bottom:l}=n;void 0===r&&(r=10),void 0===i&&(i=Dx);const{isTop:u,isBottom:c,isLeft:d,isRight:h}=Mx(e),p={x:0,y:0},f={x:0,y:0},m=t.height*i.y,g=t.width*i.x;return!u&&o<=t.top+m?(p.y=Nx.Backward,f.y=r*Math.abs((t.top+m-o)/m)):!c&&l>=t.bottom-m&&(p.y=Nx.Forward,f.y=r*Math.abs((t.bottom-m-l)/m)),!h&&a>=t.right-g?(p.x=Nx.Forward,f.x=r*Math.abs((t.right-g-a)/g)):!d&&s<=t.left+g&&(p.x=Nx.Backward,f.x=r*Math.abs((t.left+g-s)/g)),{direction:p,speed:f}}function zx(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Fx(e){return e.reduce((e,t)=>K_(e,Rx(t)),dx)}const Lx=[["x",["left","right"],function(e){return e.reduce((e,t)=>e+Ax(t),0)}],["y",["top","bottom"],function(e){return e.reduce((e,t)=>e+Cx(t),0)}]];class jx{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=Tx(t),r=Fx(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,i]of Lx)for(const o of t)Object.defineProperty(this,o,{get:()=>{const t=i(n),s=r[e]-t;return this.rect[o]+s},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class $x{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)})},this.target=e}add(e,t,n){var r;null==(r=this.target)||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function Bx(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y}var Vx,Ux;function Wx(e){e.preventDefault()}function qx(e){e.stopPropagation()}!function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"}(Vx||(Vx={})),function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"}(Ux||(Ux={}));const Gx={start:[Ux.Space,Ux.Enter],cancel:[Ux.Esc],end:[Ux.Space,Ux.Enter,Ux.Tab]},Hx=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Ux.Right:return{...n,x:n.x+25};case Ux.Left:return{...n,x:n.x-25};case Ux.Down:return{...n,y:n.y+25};case Ux.Up:return{...n,y:n.y-25}}};class Yx{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new $x(j_(t)),this.windowListeners=new $x(I_(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Vx.Resize,this.handleCancel),this.windowListeners.add(Vx.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Vx.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&function(e,t){if(void 0===t&&(t=Ex),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);kx(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(n),t(dx)}handleKeyDown(e){if(Z_(e)){const{active:t,context:n,options:r}=this.props,{keyboardCodes:i=Gx,coordinateGetter:o=Hx,scrollBehavior:s="smooth"}=r,{code:a}=e;if(i.end.includes(a))return void this.handleEnd(e);if(i.cancel.includes(a))return void this.handleCancel(e);const{collisionRect:l}=n.current,u=l?{x:l.left,y:l.top}:dx;this.referenceCoordinates||(this.referenceCoordinates=u);const c=o(e,{active:t,context:n.current,currentCoordinates:u});if(c){const t=X_(c,u),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(const n of i){const i=e.code,{isTop:o,isRight:a,isLeft:l,isBottom:u,maxScroll:d,minScroll:h}=Mx(n),p=zx(n),f={x:Math.min(i===Ux.Right?p.right-p.width/2:p.right,Math.max(i===Ux.Right?p.left:p.left+p.width/2,c.x)),y:Math.min(i===Ux.Down?p.bottom-p.height/2:p.bottom,Math.max(i===Ux.Down?p.top:p.top+p.height/2,c.y))},m=i===Ux.Right&&!a||i===Ux.Left&&!l,g=i===Ux.Down&&!u||i===Ux.Up&&!o;if(m&&f.x!==c.x){const e=n.scrollLeft+t.x,o=i===Ux.Right&&e<=d.x||i===Ux.Left&&e>=h.x;if(o&&!t.y)return void n.scrollTo({left:e,behavior:s});r.x=o?n.scrollLeft-e:i===Ux.Right?n.scrollLeft-d.x:n.scrollLeft-h.x,r.x&&n.scrollBy({left:-r.x,behavior:s});break}if(g&&f.y!==c.y){const e=n.scrollTop+t.y,o=i===Ux.Down&&e<=d.y||i===Ux.Up&&e>=h.y;if(o&&!t.x)return void n.scrollTo({top:e,behavior:s});r.y=o?n.scrollTop-e:i===Ux.Down?n.scrollTop-d.y:n.scrollTop-h.y,r.y&&n.scrollBy({top:-r.y,behavior:s});break}}this.handleMove(e,K_(X_(c,this.referenceCoordinates),r))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function Kx(e){return Boolean(e&&"distance"in e)}function Xx(e){return Boolean(e&&"delay"in e)}Yx.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Gx,onActivation:i}=t,{active:o}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const t=o.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==i||i({event:e.nativeEvent}),!0)}return!1}}];class Zx{constructor(e,t,n){var r;void 0===n&&(n=function(e){const{EventTarget:t}=I_(e);return e instanceof t?e:j_(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:i}=e,{target:o}=i;this.props=e,this.events=t,this.document=j_(o),this.documentListeners=new $x(this.document),this.listeners=new $x(n),this.windowListeners=new $x(I_(o)),this.initialCoordinates=null!=(r=J_(i))?r:dx,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Vx.Resize,this.handleCancel),this.windowListeners.add(Vx.DragStart,Wx),this.windowListeners.add(Vx.VisibilityChange,this.handleCancel),this.windowListeners.add(Vx.ContextMenu,Wx),this.documentListeners.add(Vx.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Xx(t))return this.timeoutId=setTimeout(this.handleStart,t.delay),void this.handlePending(t);if(Kx(t))return void this.handlePending(t)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){const{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Vx.Click,qx,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Vx.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:r,props:i}=this,{onMove:o,options:{activationConstraint:s}}=i;if(!r)return;const a=null!=(t=J_(e))?t:dx,l=X_(r,a);if(!n&&s){if(Kx(s)){if(null!=s.tolerance&&Bx(l,s.tolerance))return this.handleCancel();if(Bx(l,s.distance))return this.handleStart()}return Xx(s)&&Bx(l,s.tolerance)?this.handleCancel():void this.handlePending(s,l)}e.cancelable&&e.preventDefault(),o(a)}handleEnd(){const{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){const{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===Ux.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const Jx={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Qx extends Zx{constructor(e){const{event:t}=e,n=j_(t.target);super(e,Jx,n)}}Qx.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!(!n.isPrimary||0!==n.button)&&(null==r||r({event:n}),!0)}}];const ew={move:{name:"mousemove"},end:{name:"mouseup"}};var tw;!function(e){e[e.RightClick=2]="RightClick"}(tw||(tw={}));(class extends Zx{constructor(e){super(e,ew,j_(e.event.target))}}).activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==tw.RightClick&&(null==r||r({event:n}),!0)}}];const nw={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};var rw,iw;function ow(e){let{acceleration:t,activator:n=rw.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:s=5,order:a=iw.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:c,delta:d,threshold:g}=e;const y=function(e){let{delta:t,disabled:n}=e;const r=q_(t);return U_(e=>{if(n||!r||!e)return sw;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Nx.Backward]:e.x[Nx.Backward]||-1===i.x,[Nx.Forward]:e.x[Nx.Forward]||1===i.x},y:{[Nx.Backward]:e.y[Nx.Backward]||-1===i.y,[Nx.Forward]:e.y[Nx.Forward]||1===i.y}}},[n,t,r])}({delta:d,disabled:!o}),[b,v]=function(){const e=p(null),t=m((t,n)=>{e.current=setInterval(t,n)},[]);return[t,m(()=>{null!==e.current&&(clearInterval(e.current),e.current=null)},[])]}(),_=p({x:0,y:0}),x=p({x:0,y:0}),w=f(()=>{switch(n){case rw.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case rw.DraggableRect:return i}},[n,i,l]),E=p(null),S=m(()=>{const e=E.current;if(!e)return;const t=_.current.x*x.current.x,n=_.current.y*x.current.y;e.scrollBy(t,n)},[]),T=f(()=>a===iw.TreeOrder?[...u].reverse():u,[a,u]);h(()=>{if(o&&u.length&&w){for(const e of T){if(!1===(null==r?void 0:r(e)))continue;const n=u.indexOf(e),i=c[n];if(!i)continue;const{direction:o,speed:a}=Ix(e,i,w,t,g);for(const e of["x","y"])y[e][o[e]]||(a[e]=0,o[e]=0);if(a.x>0||a.y>0)return v(),E.current=e,b(S,s),_.current=a,void(x.current=o)}_.current={x:0,y:0},x.current={x:0,y:0},v()}else v()},[t,S,r,v,o,s,JSON.stringify(w),JSON.stringify(y),b,u,T,c,JSON.stringify(g)])}(class extends Zx{constructor(e){super(e,nw)}static setup(){return window.addEventListener(nw.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(nw.move.name,e)};function e(){}}}).activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return!(i.length>1)&&(null==r||r({event:n}),!0)}}],function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"}(rw||(rw={})),function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"}(iw||(iw={}));const sw={x:{[Nx.Backward]:!1,[Nx.Forward]:!1},y:{[Nx.Backward]:!1,[Nx.Forward]:!1}};var aw,lw;!function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"}(aw||(aw={})),function(e){e.Optimized="optimized"}(lw||(lw={}));const uw=new Map;function cw(e,t){return U_(n=>e?n||("function"==typeof t?t(e):e):null,[t,e])}function dw(e){let{callback:t,disabled:n}=e;const r=B_(t),i=f(()=>{if(n||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(r)},[n]);return h(()=>()=>null==i?void 0:i.disconnect(),[i]),i}function hw(e){return new jx(Ex(e),e)}function pw(e,t,n){void 0===t&&(t=hw);const[r,i]=u(null);function o(){i(r=>{if(!e)return null;var i;if(!1===e.isConnected)return null!=(i=null!=r?r:n)?i:null;const o=t(e);return JSON.stringify(r)===JSON.stringify(o)?r:o})}const s=function(e){let{callback:t,disabled:n}=e;const r=B_(t),i=f(()=>{if(n||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(r)},[r,n]);return h(()=>()=>null==i?void 0:i.disconnect(),[i]),i}({callback(t){if(e)for(const n of t){const{type:t,target:r}=n;if("childList"===t&&r instanceof HTMLElement&&r.contains(e)){o();break}}}}),a=dw({callback:o});return $_(()=>{o(),e?(null==a||a.observe(e),null==s||s.observe(document.body,{childList:!0,subtree:!0})):(null==a||a.disconnect(),null==s||s.disconnect())},[e]),r}const fw=[];function mw(e,t){void 0===t&&(t=[]);const n=p(null);return h(()=>{n.current=null},t),h(()=>{const t=e!==dx;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?X_(e,n.current):dx}function gw(e){return f(()=>e?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(e):null,[e])}const yw=[];function bw(e){let{measure:t}=e;const[n,r]=u(null),i=m(e=>{for(const{target:n}of e)if(F_(n)){r(e=>{const r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t]),o=dw({callback:i}),s=m(e=>{const n=function(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return F_(t)?t:e}(e);null==o||o.disconnect(),n&&(null==o||o.observe(n)),r(n?t(n):null)},[t,o]),[a,l]=W_(s);return f(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const vw=[{sensor:Qx,options:{}},{sensor:Yx,options:{}}],_w={current:{}},xw={draggable:{measure:Sx},droppable:{measure:Sx,strategy:aw.WhileDragging,frequency:lw.Optimized},dragOverlay:{measure:Ex}};class ww extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}const Ew={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ww,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:cx},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:xw,measureDroppableContainers:cx,windowRect:null,measuringScheduled:!1},Sw=g({activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:cx,draggableNodes:new Map,over:null,measureDroppableContainers:cx}),Tw=g(Ew);function kw(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ww}}}function Ow(e,t){switch(t.type){case ux.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case ux.DragMove:return null==e.draggable.active?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case ux.DragEnd:case ux.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ux.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new ww(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case ux.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new ww(e.droppable.containers);return s.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:s}}}case ux.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new ww(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function Aw(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=o(Sw),s=q_(r),a=q_(null==n?void 0:n.id);return h(()=>{if(!t&&!r&&s&&null!=a){if(!Z_(s))return;if(document.activeElement===s.target)return;const e=i.get(a);if(!e)return;const{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(const e of[t.current,n.current]){if(!e)continue;const t=tx(e);if(t){t.focus();break}}})}},[r,t,i,a,s]),null}const Cw=g({...dx,scaleX:1,scaleY:1});var Rw;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(Rw||(Rw={}));const Nw=c(function(e){var t,n,i,o;let{id:s,accessibility:a,autoScroll:l=!0,children:c,sensors:d=vw,collisionDetection:g=bx,measuring:b,modifiers:v,..._}=e;const x=y(Ow,void 0,kw),[w,S]=x,[T,k]=function(){const[e]=u(()=>new Set),t=m(t=>(e.add(t),()=>e.delete(t)),[e]);return[m(t=>{let{type:n,event:r}=t;e.forEach(e=>{var t;return null==(t=e[n])?void 0:t.call(e,r)})},[e]),t]}(),[O,A]=u(Rw.Uninitialized),C=O===Rw.Initialized,{draggable:{active:R,nodes:N,translate:P},droppable:{containers:M}}=w,D=null!=R?N.get(R):null,I=p({initial:null,translated:null}),z=f(()=>{var e;return null!=R?{id:R,data:null!=(e=null==D?void 0:D.data)?e:_w,rect:I}:null},[R,D]),F=p(null),[L,j]=u(null),[$,B]=u(null),V=V_(_,Object.values(_)),U=H_("DndDescribedBy",s),W=f(()=>M.getEnabled(),[M]),q=function(e){return f(()=>({draggable:{...xw.draggable,...null==e?void 0:e.draggable},droppable:{...xw.droppable,...null==e?void 0:e.droppable},dragOverlay:{...xw.dragOverlay,...null==e?void 0:e.dragOverlay}}),[null==e?void 0:e.draggable,null==e?void 0:e.droppable,null==e?void 0:e.dragOverlay])}(b),{droppableRects:G,measureDroppableContainers:H,measuringScheduled:Y}=function(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,s]=u(null),{frequency:a,measure:l,strategy:c}=i,d=p(e),f=function(){switch(c){case aw.Always:return!1;case aw.BeforeDragging:return n;default:return!n}}(),g=V_(f),y=m(function(e){void 0===e&&(e=[]),g.current||s(t=>null===t?e:t.concat(e.filter(e=>!t.includes(e))))},[g]),b=p(null),v=U_(t=>{if(f&&!n)return uw;if(!t||t===uw||d.current!==e||null!=o){const t=new Map;for(let n of e){if(!n)continue;if(o&&o.length>0&&!o.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}const e=n.node.current,r=e?new jx(l(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,o,n,f,l]);return h(()=>{d.current=e},[e]),h(()=>{f||y()},[n,f]),h(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),h(()=>{f||"number"!=typeof a||null!==b.current||(b.current=setTimeout(()=>{y(),b.current=null},a))},[a,f,y,...r]),{droppableRects:v,measureDroppableContainers:y,measuringScheduled:null!=o}}(W,{dragging:C,dependencies:[P.x,P.y],config:q.droppable}),K=function(e,t){const n=null!=t?e.get(t):void 0,r=n?n.node.current:null;return U_(e=>{var n;return null==t?null:null!=(n=null!=r?r:e)?n:null},[r,t])}(N,R),X=f(()=>$?J_($):null,[$]),Z=function(){const e=!1===(null==L?void 0:L.autoScrollEnabled),t="object"==typeof l?!1===l.enabled:!1===l,n=C&&!e&&!t;if("object"==typeof l)return{...l,enabled:n};return{enabled:n}}(),J=function(e,t){return cw(e,t)}(K,q.draggable.measure);!function(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=p(!1),{x:s,y:a}="boolean"==typeof i?{x:i,y:i}:i;$_(()=>{if(!s&&!a||!t)return void(o.current=!1);if(o.current||!r)return;const e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;const i=vx(n(e),r);if(s||(i.x=0),a||(i.y=0),o.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){const t=kx(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,s,a,r,n])}({activeNode:null!=R?N.get(R):null,config:Z.layoutShiftCompensation,initialRect:J,measure:q.draggable.measure});const Q=pw(K,q.draggable.measure,J),ee=pw(K?K.parentElement:null),te=p({activatorEvent:null,active:null,activeNode:K,collisionRect:null,collisions:null,droppableRects:G,draggableNodes:N,draggingNode:null,draggingNodeRect:null,droppableContainers:M,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ne=M.getNodeFor(null==(t=te.current.over)?void 0:t.id),re=bw({measure:q.dragOverlay.measure}),ie=null!=(n=re.nodeRef.current)?n:K,oe=C?null!=(i=re.rect)?i:Q:null,se=Boolean(re.nodeRef.current&&re.rect),ae=vx(le=se?null:Q,cw(le));var le;const ue=gw(ie?I_(ie):null),ce=function(e){const t=p(e),n=U_(n=>e?n&&n!==fw&&e&&t.current&&e.parentNode===t.current.parentNode?n:Tx(e):fw,[e]);return h(()=>{t.current=e},[e]),n}(C?null!=ne?ne:K:null),de=function(e,t){void 0===t&&(t=Ex);const[n]=e,r=gw(n?I_(n):null),[i,o]=u(yw);function s(){o(()=>e.length?e.map(e=>Px(e)?r:new jx(t(e),e)):yw)}const a=dw({callback:s});return $_(()=>{null==a||a.disconnect(),s(),e.forEach(e=>null==a?void 0:a.observe(e))},[e]),i}(ce),he=function(e,t){let{transform:n,...r}=t;return null!=e&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}(v,{transform:{x:P.x-ae.x,y:P.y-ae.y,scaleX:1,scaleY:1},activatorEvent:$,active:z,activeNodeRect:Q,containerNodeRect:ee,draggingNodeRect:oe,over:te.current.over,overlayNodeRect:re.rect,scrollableAncestors:ce,scrollableAncestorRects:de,windowRect:ue}),pe=X?K_(X,P):null,fe=function(e){const[t,n]=u(null),r=p(e),i=m(e=>{const t=Ox(e.target);t&&n(e=>e?(e.set(t,Rx(t)),new Map(e)):null)},[]);return h(()=>{const t=r.current;if(e!==t){o(t);const s=e.map(e=>{const t=Ox(e);return t?(t.addEventListener("scroll",i,{passive:!0}),[t,Rx(t)]):null}).filter(e=>null!=e);n(s.length?new Map(s):null),r.current=e}return()=>{o(e),o(t)};function o(e){e.forEach(e=>{const t=Ox(e);null==t||t.removeEventListener("scroll",i)})}},[i,e]),f(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>K_(e,t),dx):Fx(e):dx,[e,t])}(ce),me=mw(fe),ge=mw(fe,[Q]),ye=K_(he,me),be=oe?xx(oe,he):null,ve=z&&be?g({active:z,collisionRect:be,droppableRects:G,droppableContainers:W,pointerCoordinates:pe}):null,_e=function(e,t){if(!e||0===e.length)return null;const[n]=e;return n[t]}(ve,"id"),[xe,we]=u(null),Ee=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(se?he:K_(he,ge),null!=(o=null==xe?void 0:xe.rect)?o:null,Q),Se=p(null),Te=m((e,t)=>{let{sensor:n,options:r}=t;if(null==F.current)return;const i=N.get(F.current);if(!i)return;const o=e.nativeEvent,s=new n({active:F.current,activeNode:i,event:o,options:r,context:te,onAbort(e){if(!N.get(e))return;const{onDragAbort:t}=V.current,n={id:e};null==t||t(n),T({type:"onDragAbort",event:n})},onPending(e,t,n,r){if(!N.get(e))return;const{onDragPending:i}=V.current,o={id:e,constraint:t,initialCoordinates:n,offset:r};null==i||i(o),T({type:"onDragPending",event:o})},onStart(e){const t=F.current;if(null==t)return;const n=N.get(t);if(!n)return;const{onDragStart:r}=V.current,i={activatorEvent:o,active:{id:t,data:n.data,rect:I}};E(()=>{null==r||r(i),A(Rw.Initializing),S({type:ux.DragStart,initialCoordinates:e,active:t}),T({type:"onDragStart",event:i}),j(Se.current),B(o)})},onMove(e){S({type:ux.DragMove,coordinates:e})},onEnd:a(ux.DragEnd),onCancel:a(ux.DragCancel)});function a(e){return async function(){const{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=te.current;let s=null;if(t&&i){const{cancelDrop:a}=V.current;if(s={activatorEvent:o,active:t,collisions:n,delta:i,over:r},e===ux.DragEnd&&"function"==typeof a){await Promise.resolve(a(s))&&(e=ux.DragCancel)}}F.current=null,E(()=>{S({type:e}),A(Rw.Uninitialized),we(null),j(null),B(null),Se.current=null;const t=e===ux.DragEnd?"onDragEnd":"onDragCancel";if(s){const e=V.current[t];null==e||e(s),T({type:t,event:s})}})}}Se.current=s},[N]),ke=m((e,t)=>(n,r)=>{const i=n.nativeEvent,o=N.get(r);if(null!==F.current||!o||i.dndKit||i.defaultPrevented)return;const s={active:o};!0===e(n,t.options,s)&&(i.dndKit={capturedBy:t.sensor},F.current=r,Te(n,t))},[N,Te]),Oe=function(e,t){return f(()=>e.reduce((e,n)=>{const{sensor:r}=n;return[...e,...r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}))]},[]),[e,t])}(d,ke);!function(e){h(()=>{if(!P_)return;const t=e.map(e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()});return()=>{for(const e of t)null==e||e()}},e.map(e=>{let{sensor:t}=e;return t}))}(d),$_(()=>{Q&&O===Rw.Initializing&&A(Rw.Initialized)},[Q,O]),h(()=>{const{onDragMove:e}=V.current,{active:t,activatorEvent:n,collisions:r,over:i}=te.current;if(!t||!n)return;const o={active:t,activatorEvent:n,collisions:r,delta:{x:ye.x,y:ye.y},over:i};E(()=>{null==e||e(o),T({type:"onDragMove",event:o})})},[ye.x,ye.y]),h(()=>{const{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=te.current;if(!e||null==F.current||!t||!i)return;const{onDragOver:o}=V.current,s=r.get(_e),a=s&&s.rect.current?{id:s.id,rect:s.rect.current,data:s.data,disabled:s.disabled}:null,l={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:a};E(()=>{we(a),null==o||o(l),T({type:"onDragOver",event:l})})},[_e]),$_(()=>{te.current={activatorEvent:$,active:z,activeNode:K,collisionRect:be,collisions:ve,droppableRects:G,draggableNodes:N,draggingNode:ie,draggingNodeRect:oe,droppableContainers:M,over:xe,scrollableAncestors:ce,scrollAdjustedTranslate:ye},I.current={initial:oe,translated:be}},[z,K,ve,be,N,ie,oe,G,M,xe,ce,ye]),ow({...Z,delta:P,draggingRect:be,pointerCoordinates:pe,scrollableAncestors:ce,scrollableAncestorRects:de});const Ae=f(()=>({active:z,activeNode:K,activeNodeRect:Q,activatorEvent:$,collisions:ve,containerNodeRect:ee,dragOverlay:re,draggableNodes:N,droppableContainers:M,droppableRects:G,over:xe,measureDroppableContainers:H,scrollableAncestors:ce,scrollableAncestorRects:de,measuringConfiguration:q,measuringScheduled:Y,windowRect:ue}),[z,K,Q,$,ve,ee,re,N,M,G,xe,H,ce,de,q,Y,ue]),Ce=f(()=>({activatorEvent:$,activators:Oe,active:z,activeNodeRect:Q,ariaDescribedById:{draggable:U},dispatch:S,draggableNodes:N,over:xe,measureDroppableContainers:H}),[$,Oe,z,Q,S,U,N,xe,H]);return r.createElement(ox.Provider,{value:k},r.createElement(Sw.Provider,{value:Ce},r.createElement(Tw.Provider,{value:Ae},r.createElement(Cw.Provider,{value:Ee},c)),r.createElement(Aw,{disabled:!1===(null==a?void 0:a.restoreFocus)})),r.createElement(lx,{...a,hiddenTextDescribedById:U}))}),Pw=g(null),Mw="button";function Dw(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const s=H_("Draggable"),{activators:a,activatorEvent:l,active:u,activeNodeRect:c,ariaDescribedById:d,draggableNodes:h,over:p}=o(Sw),{role:m=Mw,roleDescription:g="draggable",tabIndex:y=0}=null!=i?i:{},b=(null==u?void 0:u.id)===t,v=o(b?Cw:Pw),[_,x]=W_(),[w,E]=W_(),S=function(e,t){return f(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}(a,t),T=V_(n);$_(()=>(h.set(t,{id:t,key:s,node:_,activatorNode:w,data:T}),()=>{const e=h.get(t);e&&e.key===s&&h.delete(t)}),[h,t]);return{active:u,activatorEvent:l,activeNodeRect:c,attributes:f(()=>({role:m,tabIndex:y,"aria-disabled":r,"aria-pressed":!(!b||m!==Mw)||void 0,"aria-roledescription":g,"aria-describedby":d.draggable}),[r,m,y,b,g,d.draggable]),isDragging:b,listeners:r?void 0:S,node:_,over:p,setNodeRef:x,setActivatorNodeRef:E,transform:v}}const Iw={timeout:25};function zw(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Fw(e,t){return e.reduce((e,n,r)=>{const i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function Lw(e){return null!==e&&e>=0}const jw=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e;const o=zw(t,r,n),s=t[i],a=o[i];return a&&s?{x:a.left-s.left,y:a.top-s.top,scaleX:a.width/s.width,scaleY:a.height/s.height}:null},$w={scaleX:1,scaleY:1},Bw=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:i,rects:o,overIndex:s}=e;const a=null!=(t=o[n])?t:r;if(!a)return null;if(i===n){const e=o[s];return e?{x:0,y:n<s?e.top+e.height-(a.top+a.height):e.top-a.top,...$w}:null}const l=function(e,t,n){const r=e[t],i=e[t-1],o=e[t+1];if(!r)return 0;if(n<t)return i?r.top-(i.top+i.height):o?o.top-(r.top+r.height):0;return o?o.top-(r.top+r.height):i?r.top-(i.top+i.height):0}(o,i,n);return i>n&&i<=s?{x:0,y:-a.height-l,...$w}:i<n&&i>=s?{x:0,y:a.height+l,...$w}:{x:0,y:0,...$w}};const Vw="Sortable",Uw=r.createContext({activeIndex:-1,containerId:Vw,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:jw,disabled:{draggable:!1,droppable:!1}});function Ww(e){let{children:t,id:n,items:i,strategy:s=jw,disabled:a=!1}=e;const{active:l,dragOverlay:u,droppableRects:c,over:d,measureDroppableContainers:m}=o(Tw),g=H_(Vw,n),y=Boolean(null!==u.rect),b=f(()=>i.map(e=>"object"==typeof e&&"id"in e?e.id:e),[i]),v=null!=l,_=l?b.indexOf(l.id):-1,x=d?b.indexOf(d.id):-1,w=p(b),E=!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(b,w.current),S=-1!==x&&-1===_||E,T=function(e){return"boolean"==typeof e?{draggable:e,droppable:e}:e}(a);$_(()=>{E&&v&&m(b)},[E,b,v,m]),h(()=>{w.current=b},[b]);const k=f(()=>({activeIndex:_,containerId:g,disabled:T,disableTransforms:S,items:b,overIndex:x,useDragOverlay:y,sortedRects:Fw(b,c),strategy:s}),[_,g,T.draggable,T.droppable,S,b,x,c,y,s]);return r.createElement(Uw.Provider,{value:k},t)}const qw=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return zw(n,r,i).indexOf(t)},Gw=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:o,newIndex:s,previousItems:a,previousContainerId:l,transition:u}=e;return!(!u||!r)&&((a===o||i!==s)&&(!!n||s!==i&&t===l))},Hw={duration:200,easing:"ease"},Yw="transform",Kw=Q_.Transition.toString({property:Yw,duration:0,easing:"linear"}),Xw={roleDescription:"sortable"};function Zw(e){let{animateLayoutChanges:t=Gw,attributes:n,disabled:r,data:i,getNewIndex:s=qw,id:a,strategy:l,resizeObserverConfig:c,transition:d=Hw}=e;const{items:g,containerId:y,activeIndex:b,disabled:v,disableTransforms:_,sortedRects:x,overIndex:w,useDragOverlay:E,strategy:S}=o(Uw),T=function(e,t){var n,r;if("boolean"==typeof e)return{draggable:e,droppable:!1};return{draggable:null!=(n=null==e?void 0:e.draggable)?n:t.draggable,droppable:null!=(r=null==e?void 0:e.droppable)?r:t.droppable}}(r,v),k=g.indexOf(a),O=f(()=>({sortable:{containerId:y,index:k,items:g},...i}),[y,i,k,g]),A=f(()=>g.slice(g.indexOf(a)),[g,a]),{rect:C,node:R,isOver:N,setNodeRef:P}=function(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const s=H_("Droppable"),{active:a,dispatch:l,over:u,measureDroppableContainers:c}=o(Sw),d=p({disabled:n}),f=p(!1),g=p(null),y=p(null),{disabled:b,updateMeasurementsFor:v,timeout:_}={...Iw,...i},x=V_(null!=v?v:r),w=dw({callback:m(()=>{f.current?(null!=y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{c(Array.isArray(x.current)?x.current:[x.current]),y.current=null},_)):f.current=!0},[_]),disabled:b||!a}),E=m((e,t)=>{w&&(t&&(w.unobserve(t),f.current=!1),e&&w.observe(e))},[w]),[S,T]=W_(E),k=V_(t);return h(()=>{w&&S.current&&(w.disconnect(),f.current=!1,w.observe(S.current))},[S,w]),h(()=>(l({type:ux.RegisterDroppable,element:{id:r,key:s,disabled:n,node:S,rect:g,data:k}}),()=>l({type:ux.UnregisterDroppable,key:s,id:r})),[r]),h(()=>{n!==d.current.disabled&&(l({type:ux.SetDroppableDisabled,id:r,key:s,disabled:n}),d.current.disabled=n)},[r,s,n,l]),{active:a,rect:g,isOver:(null==u?void 0:u.id)===r,node:S,over:u,setNodeRef:T}}({id:a,data:O,disabled:T.droppable,resizeObserverConfig:{updateMeasurementsFor:A,...c}}),{active:M,activatorEvent:D,activeNodeRect:I,attributes:z,setNodeRef:F,listeners:L,isDragging:j,over:$,setActivatorNodeRef:B,transform:V}=Dw({id:a,data:O,attributes:{...Xw,...n},disabled:T.draggable}),U=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return f(()=>e=>{t.forEach(t=>t(e))},t)}(P,F),W=Boolean(M),q=W&&!_&&Lw(b)&&Lw(w),G=!E&&j,H=G&&q?V:null,Y=q?null!=H?H:(null!=l?l:S)({rects:x,activeNodeRect:I,activeIndex:b,overIndex:w,index:k}):null,K=Lw(b)&&Lw(w)?s({id:a,items:g,activeIndex:b,overIndex:w}):k,X=null==M?void 0:M.id,Z=p({activeId:X,items:g,newIndex:K,containerId:y}),J=g!==Z.current.items,Q=t({active:M,containerId:y,isDragging:j,isSorting:W,id:a,index:k,items:g,newIndex:Z.current.newIndex,previousItems:Z.current.items,previousContainerId:Z.current.containerId,transition:d,wasDragging:null!=Z.current.activeId}),ee=function(e){let{disabled:t,index:n,node:r,rect:i}=e;const[o,s]=u(null),a=p(n);return $_(()=>{if(!t&&n!==a.current&&r.current){const e=i.current;if(e){const t=Ex(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&s(n)}}n!==a.current&&(a.current=n)},[t,n,r,i]),h(()=>{o&&s(null)},[o]),o}({disabled:!Q,index:k,node:R,rect:C});return h(()=>{W&&Z.current.newIndex!==K&&(Z.current.newIndex=K),y!==Z.current.containerId&&(Z.current.containerId=y),g!==Z.current.items&&(Z.current.items=g)},[W,K,y,g]),h(()=>{if(X===Z.current.activeId)return;if(null!=X&&null==Z.current.activeId)return void(Z.current.activeId=X);const e=setTimeout(()=>{Z.current.activeId=X},50);return()=>clearTimeout(e)},[X]),{active:M,activeIndex:b,attributes:z,data:O,rect:C,index:k,newIndex:K,items:g,isOver:N,isSorting:W,isDragging:j,listeners:L,node:R,overIndex:w,over:$,setNodeRef:U,setActivatorNodeRef:B,setDroppableNodeRef:P,setDraggableNodeRef:F,transform:null!=ee?ee:Y,transition:function(){if(ee||J&&Z.current.newIndex===k)return Kw;if(G&&!Z_(D)||!d)return;if(W||Q)return Q_.Transition.toString({...d,property:Yw});return}()}}Ux.Down,Ux.Right,Ux.Up,Ux.Left;const Jw=({id:t,sx:n,children:r})=>{const{isDragging:i}=Dw({id:t}),{attributes:o,listeners:s,setNodeRef:a,transform:l,transition:u}=Zw({id:t,strategy:Bw,transition:{duration:300,easing:"cubic-bezier(0.25, 1, 0.5, 1)"}}),c={...n?.default,...i?n?.dragging:{},transform:Q_.Translate.toString(l),transition:u,cursor:"pointer"};return e(Jc,{ref:a,style:c,...s,...o,children:r})};function Qw({items:t,getItem:n,getId:r,onDragEnd:i,sx:o,title:s,draggableSx:a}){const l=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return f(()=>[...t].filter(e=>null!=e),[...t])}(f(()=>({sensor:u,options:null!=c?c:{}}),[u=Qx,c={activationConstraint:{distance:8}}]));var u,c;return e(Nw,{sensors:l,collisionDetection:gx,onDragEnd:e=>{const{active:n,over:o}=e,s=t.findIndex(e=>r(e)===n.id),a=t.findIndex(e=>r(e)===o?.id),l=zw(t,s,a);i(l)},children:e(Ww,{items:t.map(r),strategy:Bw,children:e(tf,{items:t,sx:o,title:s,getKey:r,getContent:(t,i)=>{const o=r(t);return e(Jw,{id:o,sx:a,children:n(t,i)},o)}})})})}const eE=g(null);function tE(){return function(){const e=b(eE);if(null==e)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of <MapContainer>");return e}().map}var nE={global:{links:{getIsConstruction:"function (feature) {\n const { construction } = feature;\n\n return construction;\n}\n",getIsFunctionalClass:"function (feature) {\n const { functional_class, access_id } = feature;\n\n return functional_class === 5 && access_id === 32;\n}\n",getIsLowMobility:"function (feature) {\n const { functional_class, low_mobility } = feature;\n\n return functional_class === 5 && low_mobility === 1;\n}\n"}},cameras:{camera1:{type:"perspective",vanishing_point:[0,-500]}},textures:{arrow:{url:"https://dalganmap.ru/api-image/images/arrow-20.png",sprites:{base:[0,0,20,20]}},"traffic-signal":{url:"https://dalganmap.ru/api-image/images/conditions/traffic-signal.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},pedestrian_crossing:{url:"https://dalganmap.ru/api-image/images/conditions/pedestrian_crossing.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},physical:{url:"https://dalganmap.ru/api-image/images/conditions/physical.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},gate:{url:"https://dalganmap.ru/api-image/images/conditions/gate.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_3578:{url:"https://dalganmap.ru/api-image/images/POI/3578.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5813:{url:"https://dalganmap.ru/api-image/images/POI/5813.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5541:{url:"https://dalganmap.ru/api-image/images/POI/5541.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5540:{url:"https://dalganmap.ru/api-image/images/POI/5540.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9530(Mail)":{url:"https://dalganmap.ru/api-image/images/POI/mail.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9530(Delivery)":{url:"https://dalganmap.ru/api-image/images/POI/delivery.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5400:{url:"https://dalganmap.ru/api-image/images/POI/5400.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_6000:{url:"https://dalganmap.ru/api-image/images/POI/6000.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_9565:{url:"https://dalganmap.ru/api-image/images/POI/9565.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_9583:{url:"https://dalganmap.ru/api-image/images/POI/9583.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_8060:{url:"https://dalganmap.ru/api-image/images/POI/8060.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5511:{url:"https://dalganmap.ru/api-image/images/POI/5511.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5512:{url:"https://dalganmap.ru/api-image/images/POI/5512.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5800:{url:"https://dalganmap.ru/api-image/images/POI/5800.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5999:{url:"https://dalganmap.ru/api-image/images/POI/5999.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_7011:{url:"https://dalganmap.ru/api-image/images/POI/7011.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_7389:{url:"https://dalganmap.ru/api-image/images/POI/7389.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_7832:{url:"https://dalganmap.ru/api-image/images/POI/7832.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_7929:{url:"https://dalganmap.ru/api-image/images/POI/7929.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_7990:{url:"https://dalganmap.ru/api-image/images/POI/7990.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_7999:{url:"https://dalganmap.ru/api-image/images/POI/7999.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_8410:{url:"https://dalganmap.ru/api-image/images/POI/8410.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_9517:{url:"https://dalganmap.ru/api-image/images/POI/9517.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_9718:{url:"https://dalganmap.ru/api-image/images/POI/9718.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9992(mosque)":{url:"https://dalganmap.ru/api-image/images/POI/9992_mosque.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9992(church)":{url:"https://dalganmap.ru/api-image/images/POI/9992_church.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9992(temple)":{url:"https://dalganmap.ru/api-image/images/POI/9992_temple.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9992(davidStar)":{url:"https://dalganmap.ru/api-image/images/POI/9992_davidStar.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9992(mortar)":{url:"https://dalganmap.ru/api-image/images/POI/9992_mortar.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_4100(metro)":{url:"https://dalganmap.ru/api-image/images/POI/4100_metro.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_4100(diameter)":{url:"https://dalganmap.ru/api-image/images/POI/4100_diameter.png",filtering:"mipmap",sprites:{base:[0,0,41,15]}},POI_4013:{url:"https://dalganmap.ru/api-image/images/POI/4013.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"lane-marking":{url:"https://dalganmap.ru/api-image/images/msk/lane-marking.svg",filtering:"mipmap",sprites:{base:[0,0,11,35]}}},layers:null,styles:{buildings:{base:"polygons",shaders:{blocks:{color:"color.rgb;\n"}}}},lights:{light1:{type:"directional",direction:[.1,.5,-1],diffuse:.7,ambient:.5}},sources:null};function rE(e,t){return function(){return e.apply(t,arguments)}}const{toString:iE}=Object.prototype,{getPrototypeOf:oE}=Object,{iterator:sE,toStringTag:aE}=Symbol,lE=(uE=Object.create(null),e=>{const t=iE.call(e);return uE[t]||(uE[t]=t.slice(8,-1).toLowerCase())});var uE;const cE=e=>(e=e.toLowerCase(),t=>lE(t)===e),dE=e=>t=>typeof t===e,{isArray:hE}=Array,pE=dE("undefined");function fE(e){return null!==e&&!pE(e)&&null!==e.constructor&&!pE(e.constructor)&&yE(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const mE=cE("ArrayBuffer");const gE=dE("string"),yE=dE("function"),bE=dE("number"),vE=e=>null!==e&&"object"==typeof e,_E=e=>{if("object"!==lE(e))return!1;const t=oE(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||aE in e||sE in e)},xE=cE("Date"),wE=cE("File"),EE=cE("Blob"),SE=cE("FileList"),TE=cE("URLSearchParams"),[kE,OE,AE,CE]=["ReadableStream","Request","Response","Headers"].map(cE);function RE(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,i;if("object"!=typeof e&&(e=[e]),hE(e))for(r=0,i=e.length;r<i;r++)t.call(null,e[r],r,e);else{if(fE(e))return;const i=n?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let s;for(r=0;r<o;r++)s=i[r],t.call(null,e[s],s,e)}}function NE(e,t){if(fE(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,i=n.length;for(;i-- >0;)if(r=n[i],t===r.toLowerCase())return r;return null}const PE="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,ME=e=>!pE(e)&&e!==PE;const DE=(IE="undefined"!=typeof Uint8Array&&oE(Uint8Array),e=>IE&&e instanceof IE);var IE;const zE=cE("HTMLFormElement"),FE=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),LE=cE("RegExp"),jE=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};RE(n,(n,i)=>{let o;!1!==(o=t(n,i,e))&&(r[i]=o||n)}),Object.defineProperties(e,r)};const $E=cE("AsyncFunction"),BE=(VE="function"==typeof setImmediate,UE=yE(PE.postMessage),VE?setImmediate:UE?((e,t)=>(PE.addEventListener("message",({source:n,data:r})=>{n===PE&&r===e&&t.length&&t.shift()()},!1),n=>{t.push(n),PE.postMessage(e,"*")}))(`axios@${Math.random()}`,[]):e=>setTimeout(e));var VE,UE;const WE="undefined"!=typeof queueMicrotask?queueMicrotask.bind(PE):"undefined"!=typeof process&&process.nextTick||BE;var qE={isArray:hE,isArrayBuffer:mE,isBuffer:fE,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||yE(e.append)&&("formdata"===(t=lE(e))||"object"===t&&yE(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&mE(e.buffer),t},isString:gE,isNumber:bE,isBoolean:e=>!0===e||!1===e,isObject:vE,isPlainObject:_E,isEmptyObject:e=>{if(!vE(e)||fE(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:kE,isRequest:OE,isResponse:AE,isHeaders:CE,isUndefined:pE,isDate:xE,isFile:wE,isBlob:EE,isRegExp:LE,isFunction:yE,isStream:e=>vE(e)&&yE(e.pipe),isURLSearchParams:TE,isTypedArray:DE,isFileList:SE,forEach:RE,merge:function e(){const{caseless:t,skipUndefined:n}=ME(this)&&this||{},r={},i=(i,o)=>{const s=t&&NE(r,o)||o;_E(r[s])&&_E(i)?r[s]=e(r[s],i):_E(i)?r[s]=e({},i):hE(i)?r[s]=i.slice():n&&pE(i)||(r[s]=i)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&RE(arguments[e],i);return r},extend:(e,t,n,{allOwnKeys:r}={})=>(RE(t,(t,r)=>{n&&yE(t)?e[r]=rE(t,n):e[r]=t},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let i,o,s;const a={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)s=i[o],r&&!r(s,e,t)||a[s]||(t[s]=e[s],a[s]=!0);e=!1!==n&&oE(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:lE,kindOfTest:cE,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(hE(e))return e;let t=e.length;if(!bE(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[sE]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:zE,hasOwnProperty:FE,hasOwnProp:FE,reduceDescriptors:jE,freezeMethods:e=>{jE(e,(t,n)=>{if(yE(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];yE(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return hE(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:NE,global:PE,isContextDefined:ME,isSpecCompliantForm:function(e){return!!(e&&yE(e.append)&&"FormData"===e[aE]&&e[sE])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(vE(e)){if(t.indexOf(e)>=0)return;if(fE(e))return e;if(!("toJSON"in e)){t[r]=e;const i=hE(e)?[]:{};return RE(e,(e,t)=>{const o=n(e,r+1);!pE(o)&&(i[t]=o)}),t[r]=void 0,i}}return e};return n(e,0)},isAsyncFn:$E,isThenable:e=>e&&(vE(e)||yE(e))&&yE(e.then)&&yE(e.catch),setImmediate:BE,asap:WE,isIterable:e=>null!=e&&yE(e[sE])};function GE(e,t,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}qE.inherits(GE,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:qE.toJSONObject(this.config),code:this.code,status:this.status}}});const HE=GE.prototype,YE={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{YE[e]={value:e}}),Object.defineProperties(GE,YE),Object.defineProperty(HE,"isAxiosError",{value:!0}),GE.from=(e,t,n,r,i,o)=>{const s=Object.create(HE);qE.toFlatObject(e,s,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e);const a=e&&e.message?e.message:"Error",l=null==t&&e?e.code:t;return GE.call(s,a,l,n,r,i),e&&null==s.cause&&Object.defineProperty(s,"cause",{value:e,configurable:!0}),s.name=e&&e.name||"Error",o&&Object.assign(s,o),s};function KE(e){return qE.isPlainObject(e)||qE.isArray(e)}function XE(e){return qE.endsWith(e,"[]")?e.slice(0,-2):e}function ZE(e,t,n){return e?e.concat(t).map(function(e,t){return e=XE(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const JE=qE.toFlatObject(qE,{},null,function(e){return/^is[A-Z]/.test(e)});function QE(e,t,n){if(!qE.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=qE.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!qE.isUndefined(t[e])})).metaTokens,i=n.visitor||u,o=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&qE.isSpecCompliantForm(t);if(!qE.isFunction(i))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(qE.isDate(e))return e.toISOString();if(qE.isBoolean(e))return e.toString();if(!a&&qE.isBlob(e))throw new GE("Blob is not supported. Use a Buffer instead.");return qE.isArrayBuffer(e)||qE.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,n,i){let a=e;if(e&&!i&&"object"==typeof e)if(qE.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(qE.isArray(e)&&function(e){return qE.isArray(e)&&!e.some(KE)}(e)||(qE.isFileList(e)||qE.endsWith(n,"[]"))&&(a=qE.toArray(e)))return n=XE(n),a.forEach(function(e,r){!qE.isUndefined(e)&&null!==e&&t.append(!0===s?ZE([n],r,o):null===s?n:n+"[]",l(e))}),!1;return!!KE(e)||(t.append(ZE(i,n,o),l(e)),!1)}const c=[],d=Object.assign(JE,{defaultVisitor:u,convertValue:l,isVisitable:KE});if(!qE.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!qE.isUndefined(n)){if(-1!==c.indexOf(n))throw Error("Circular reference detected in "+r.join("."));c.push(n),qE.forEach(n,function(n,o){!0===(!(qE.isUndefined(n)||null===n)&&i.call(t,n,qE.isString(o)?o.trim():o,r,d))&&e(n,r?r.concat(o):[o])}),c.pop()}}(e),t}function eS(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function tS(e,t){this._pairs=[],e&&QE(e,this,t)}const nS=tS.prototype;function rS(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function iS(e,t,n){if(!t)return e;const r=n&&n.encode||rS;qE.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let o;if(o=i?i(t,n):qE.isURLSearchParams(t)?t.toString():new tS(t,n).toString(r),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}nS.append=function(e,t){this._pairs.push([e,t])},nS.toString=function(e){const t=e?function(t){return e.call(this,t,eS)}:eS;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class oS{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){qE.forEach(this.handlers,function(t){null!==t&&e(t)})}}var sS={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},aS={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:tS,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const lS="undefined"!=typeof window&&"undefined"!=typeof document,uS="object"==typeof navigator&&navigator||void 0,cS=lS&&(!uS||["ReactNative","NativeScript","NS"].indexOf(uS.product)<0),dS="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,hS=lS&&window.location.href||"http://localhost";var pS={...Object.freeze({__proto__:null,hasBrowserEnv:lS,hasStandardBrowserEnv:cS,hasStandardBrowserWebWorkerEnv:dS,navigator:uS,origin:hS}),...aS};function fS(e){function t(e,n,r,i){let o=e[i++];if("__proto__"===o)return!0;const s=Number.isFinite(+o),a=i>=e.length;if(o=!o&&qE.isArray(r)?r.length:o,a)return qE.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!s;r[o]&&qE.isObject(r[o])||(r[o]=[]);return t(e,n,r[o],i)&&qE.isArray(r[o])&&(r[o]=function(e){const t={},n=Object.keys(e);let r;const i=n.length;let o;for(r=0;r<i;r++)o=n[r],t[o]=e[o];return t}(r[o])),!s}if(qE.isFormData(e)&&qE.isFunction(e.entries)){const n={};return qE.forEachEntry(e,(e,r)=>{t(function(e){return qE.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const mS={transitional:sS,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,i=qE.isObject(e);i&&qE.isHTMLForm(e)&&(e=new FormData(e));if(qE.isFormData(e))return r?JSON.stringify(fS(e)):e;if(qE.isArrayBuffer(e)||qE.isBuffer(e)||qE.isStream(e)||qE.isFile(e)||qE.isBlob(e)||qE.isReadableStream(e))return e;if(qE.isArrayBufferView(e))return e.buffer;if(qE.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return QE(e,new pS.classes.URLSearchParams,{visitor:function(e,t,n,r){return pS.isNode&&qE.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=qE.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return QE(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||r?(t.setContentType("application/json",!1),function(e,t,n){if(qE.isString(e))try{return(t||JSON.parse)(e),qE.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||mS.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(qE.isResponse(e)||qE.isReadableStream(e))return e;if(e&&qE.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(e){if(n){if("SyntaxError"===e.name)throw GE.from(e,GE.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:pS.classes.FormData,Blob:pS.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};qE.forEach(["delete","get","head","post","put","patch"],e=>{mS.headers[e]={}});const gS=qE.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const yS=Symbol("internals");function bS(e){return e&&String(e).trim().toLowerCase()}function vS(e){return!1===e||null==e?e:qE.isArray(e)?e.map(vS):String(e)}function _S(e,t,n,r,i){return qE.isFunction(r)?r.call(this,t,n):(i&&(t=n),qE.isString(t)?qE.isString(r)?-1!==t.indexOf(r):qE.isRegExp(r)?r.test(t):void 0:void 0)}let xS=class{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function i(e,t,n){const i=bS(t);if(!i)throw new Error("header name must be a non-empty string");const o=qE.findKey(r,i);(!o||void 0===r[o]||!0===n||void 0===n&&!1!==r[o])&&(r[o||t]=vS(e))}const o=(e,t)=>qE.forEach(e,(e,n)=>i(e,n,t));if(qE.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(qE.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let n,r,i;return e&&e.split("\n").forEach(function(e){i=e.indexOf(":"),n=e.substring(0,i).trim().toLowerCase(),r=e.substring(i+1).trim(),!n||t[n]&&gS[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(qE.isObject(e)&&qE.isIterable(e)){let n,r,i={};for(const t of e){if(!qE.isArray(t))throw TypeError("Object iterator must return a key-value pair");i[r=t[0]]=(n=i[r])?qE.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}o(i,t)}else null!=e&&i(t,e,n);return this}get(e,t){if(e=bS(e)){const n=qE.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(qE.isFunction(t))return t.call(this,e,n);if(qE.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=bS(e)){const n=qE.findKey(this,e);return!(!n||void 0===this[n]||t&&!_S(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function i(e){if(e=bS(e)){const i=qE.findKey(n,e);!i||t&&!_S(0,n[i],i,t)||(delete n[i],r=!0)}}return qE.isArray(e)?e.forEach(i):i(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const i=t[n];e&&!_S(0,this[i],i,e,!0)||(delete this[i],r=!0)}return r}normalize(e){const t=this,n={};return qE.forEach(this,(r,i)=>{const o=qE.findKey(n,i);if(o)return t[o]=vS(r),void delete t[i];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(i):String(i).trim();s!==i&&delete t[i],t[s]=vS(r),n[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return qE.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&qE.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[yS]=this[yS]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=bS(e);t[r]||(!function(e,t){const n=qE.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,i){return this[r].call(this,t,e,n,i)},configurable:!0})})}(n,e),t[r]=!0)}return qE.isArray(e)?e.forEach(r):r(e),this}};function wS(e,t){const n=this||mS,r=t||n,i=xS.from(r.headers);let o=r.data;return qE.forEach(e,function(e){o=e.call(n,o,i.normalize(),t?t.status:void 0)}),i.normalize(),o}function ES(e){return!(!e||!e.__CANCEL__)}function SS(e,t,n){GE.call(this,null==e?"canceled":e,GE.ERR_CANCELED,t,n),this.name="CanceledError"}function TS(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new GE("Request failed with status code "+n.status,[GE.ERR_BAD_REQUEST,GE.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}xS.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),qE.reduceDescriptors(xS.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),qE.freezeMethods(xS),qE.inherits(SS,GE,{__CANCEL__:!0});const kS=(e,t,n=3)=>{let r=0;const i=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let i,o=0,s=0;return t=void 0!==t?t:1e3,function(a){const l=Date.now(),u=r[s];i||(i=l),n[o]=a,r[o]=l;let c=s,d=0;for(;c!==o;)d+=n[c++],c%=e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),l-i<t)return;const h=u&&l-u;return h?Math.round(1e3*d/h):void 0}}(50,250);return function(e,t){let n,r,i=0,o=1e3/t;const s=(t,o=Date.now())=>{i=o,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-i;a>=o?s(e,t):(n=e,r||(r=setTimeout(()=>{r=null,s(n)},o-a)))},()=>n&&s(n)]}(n=>{const o=n.loaded,s=n.lengthComputable?n.total:void 0,a=o-r,l=i(a);r=o;e({loaded:o,total:s,progress:s?o/s:void 0,bytes:a,rate:l||void 0,estimated:l&&s&&o<=s?(s-o)/l:void 0,event:n,lengthComputable:null!=s,[t?"download":"upload"]:!0})},n)},OS=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},AS=e=>(...t)=>qE.asap(()=>e(...t));var CS=pS.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,pS.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(pS.origin),pS.navigator&&/(msie|trident)/i.test(pS.navigator.userAgent)):()=>!0,RS=pS.hasStandardBrowserEnv?{write(e,t,n,r,i,o,s){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];qE.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),qE.isString(r)&&a.push(`path=${r}`),qE.isString(i)&&a.push(`domain=${i}`),!0===o&&a.push("secure"),qE.isString(s)&&a.push(`SameSite=${s}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function NS(e,t,n){let r=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const PS=e=>e instanceof xS?{...e}:e;function MS(e,t){t=t||{};const n={};function r(e,t,n,r){return qE.isPlainObject(e)&&qE.isPlainObject(t)?qE.merge.call({caseless:r},e,t):qE.isPlainObject(t)?qE.merge({},t):qE.isArray(t)?t.slice():t}function i(e,t,n,i){return qE.isUndefined(t)?qE.isUndefined(e)?void 0:r(void 0,e,0,i):r(e,t,0,i)}function o(e,t){if(!qE.isUndefined(t))return r(void 0,t)}function s(e,t){return qE.isUndefined(t)?qE.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,i,o){return o in t?r(n,i):o in e?r(void 0,n):void 0}const l={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(e,t,n)=>i(PS(e),PS(t),0,!0)};return qE.forEach(Object.keys({...e,...t}),function(r){const o=l[r]||i,s=o(e[r],t[r],r);qE.isUndefined(s)&&o!==a||(n[r]=s)}),n}var DS=e=>{const t=MS({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:o,headers:s,auth:a}=t;if(t.headers=s=xS.from(s),t.url=iS(NS(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),qE.isFormData(n))if(pS.hasStandardBrowserEnv||pS.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(qE.isFunction(n.getHeaders)){const e=n.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&s.set(e,n)})}if(pS.hasStandardBrowserEnv&&(r&&qE.isFunction(r)&&(r=r(t)),r||!1!==r&&CS(t.url))){const e=i&&o&&RS.read(o);e&&s.set(i,e)}return t};var IS="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=DS(e);let i=r.data;const o=xS.from(r.headers).normalize();let s,a,l,u,c,{responseType:d,onUploadProgress:h,onDownloadProgress:p}=r;function f(){u&&u(),c&&c(),r.cancelToken&&r.cancelToken.unsubscribe(s),r.signal&&r.signal.removeEventListener("abort",s)}let m=new XMLHttpRequest;function g(){if(!m)return;const r=xS.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());TS(function(e){t(e),f()},function(e){n(e),f()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(g)},m.onabort=function(){m&&(n(new GE("Request aborted",GE.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const r=new GE(t&&t.message?t.message:"Network Error",GE.ERR_NETWORK,e,m);r.event=t||null,n(r),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const i=r.transitional||sS;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new GE(t,i.clarifyTimeoutError?GE.ETIMEDOUT:GE.ECONNABORTED,e,m)),m=null},void 0===i&&o.setContentType(null),"setRequestHeader"in m&&qE.forEach(o.toJSON(),function(e,t){m.setRequestHeader(t,e)}),qE.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),p&&([l,c]=kS(p,!0),m.addEventListener("progress",l)),h&&m.upload&&([a,u]=kS(h),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(s=t=>{m&&(n(!t||t.type?new SS(null,e,m):t),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(s),r.signal&&(r.signal.aborted?s():r.signal.addEventListener("abort",s)));const y=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);y&&-1===pS.protocols.indexOf(y)?n(new GE("Unsupported protocol "+y+":",GE.ERR_BAD_REQUEST,e)):m.send(i||null)})};const zS=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const i=function(e){if(!n){n=!0,s();const t=e instanceof Error?e:this.reason;r.abort(t instanceof GE?t:new SS(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,i(new GE(`timeout ${t} of ms exceeded`,GE.ETIMEDOUT))},t);const s=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(i):e.removeEventListener("abort",i)}),e=null)};e.forEach(e=>e.addEventListener("abort",i));const{signal:a}=r;return a.unsubscribe=()=>qE.asap(s),a}},FS=function*(e,t){let n=e.byteLength;if(n<t)return void(yield e);let r,i=0;for(;i<n;)r=i+t,yield e.slice(i,r),i=r},LS=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},jS=(e,t,n,r)=>{const i=async function*(e,t){for await(const n of LS(e))yield*FS(n,t)}(e,t);let o,s=0,a=e=>{o||(o=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await i.next();if(t)return a(),void e.close();let o=r.byteLength;if(n){let e=s+=o;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),i.return())},{highWaterMark:2})},{isFunction:$S}=qE,BS=(({Request:e,Response:t})=>({Request:e,Response:t}))(qE.global),{ReadableStream:VS,TextEncoder:US}=qE.global,WS=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},qS=e=>{e=qE.merge.call({skipUndefined:!0},BS,e);const{fetch:t,Request:n,Response:r}=e,i=t?$S(t):"function"==typeof fetch,o=$S(n),s=$S(r);if(!i)return!1;const a=i&&$S(VS),l=i&&("function"==typeof US?(u=new US,e=>u.encode(e)):async e=>new Uint8Array(await new n(e).arrayBuffer()));var u;const c=o&&a&&WS(()=>{let e=!1;const t=new n(pS.origin,{body:new VS,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),d=s&&a&&WS(()=>qE.isReadableStream(new r("").body)),h={stream:d&&(e=>e.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!h[e]&&(h[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new GE(`Response type '${e}' is not supported`,GE.ERR_NOT_SUPPORT,n)})});const p=async(e,t)=>{const r=qE.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(qE.isBlob(e))return e.size;if(qE.isSpecCompliantForm(e)){const t=new n(pS.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return qE.isArrayBufferView(e)||qE.isArrayBuffer(e)?e.byteLength:(qE.isURLSearchParams(e)&&(e+=""),qE.isString(e)?(await l(e)).byteLength:void 0)})(t):r};return async e=>{let{url:i,method:s,data:a,signal:l,cancelToken:u,timeout:f,onDownloadProgress:m,onUploadProgress:g,responseType:y,headers:b,withCredentials:v="same-origin",fetchOptions:_}=DS(e),x=t||fetch;y=y?(y+"").toLowerCase():"text";let w=zS([l,u&&u.toAbortSignal()],f),E=null;const S=w&&w.unsubscribe&&(()=>{w.unsubscribe()});let T;try{if(g&&c&&"get"!==s&&"head"!==s&&0!==(T=await p(b,a))){let e,t=new n(i,{method:"POST",body:a,duplex:"half"});if(qE.isFormData(a)&&(e=t.headers.get("content-type"))&&b.setContentType(e),t.body){const[e,n]=OS(T,kS(AS(g)));a=jS(t.body,65536,e,n)}}qE.isString(v)||(v=v?"include":"omit");const t=o&&"credentials"in n.prototype,l={..._,signal:w,method:s.toUpperCase(),headers:b.normalize().toJSON(),body:a,duplex:"half",credentials:t?v:void 0};E=o&&new n(i,l);let u=await(o?x(E,_):x(i,l));const f=d&&("stream"===y||"response"===y);if(d&&(m||f&&S)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=u[t]});const t=qE.toFiniteNumber(u.headers.get("content-length")),[n,i]=m&&OS(t,kS(AS(m),!0))||[];u=new r(jS(u.body,65536,n,()=>{i&&i(),S&&S()}),e)}y=y||"text";let k=await h[qE.findKey(h,y)||"text"](u,e);return!f&&S&&S(),await new Promise((t,n)=>{TS(t,n,{data:k,headers:xS.from(u.headers),status:u.status,statusText:u.statusText,config:e,request:E})})}catch(t){if(S&&S(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new GE("Network Error",GE.ERR_NETWORK,e,E),{cause:t.cause||t});throw GE.from(t,t&&t.code,e,E)}}},GS=new Map,HS=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:i}=t,o=[r,i,n];let s,a,l=o.length,u=GS;for(;l--;)s=o[l],a=u.get(s),void 0===a&&u.set(s,a=l?new Map:qS(t)),u=a;return a};HS();const YS={http:null,xhr:IS,fetch:{get:HS}};qE.forEach(YS,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const KS=e=>`- ${e}`,XS=e=>qE.isFunction(e)||null===e||!1===e;var ZS={getAdapter:function(e,t){e=qE.isArray(e)?e:[e];const{length:n}=e;let r,i;const o={};for(let s=0;s<n;s++){let n;if(r=e[s],i=r,!XS(r)&&(i=YS[(n=String(r)).toLowerCase()],void 0===i))throw new GE(`Unknown adapter '${n}'`);if(i&&(qE.isFunction(i)||(i=i.get(t))))break;o[n||"#"+s]=i}if(!i){const e=Object.entries(o).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new GE("There is no suitable adapter to dispatch the request "+(n?e.length>1?"since :\n"+e.map(KS).join("\n"):" "+KS(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return i},adapters:YS};function JS(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new SS(null,e)}function QS(e){JS(e),e.headers=xS.from(e.headers),e.data=wS.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return ZS.getAdapter(e.adapter||mS.adapter,e)(e).then(function(t){return JS(e),t.data=wS.call(e,e.transformResponse,t),t.headers=xS.from(t.headers),t},function(t){return ES(t)||(JS(e),t&&t.response&&(t.response.data=wS.call(e,e.transformResponse,t.response),t.response.headers=xS.from(t.response.headers))),Promise.reject(t)})}const eT="1.13.2",tT={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{tT[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const nT={};tT.transitional=function(e,t,n){function r(e,t){return"[Axios v"+eT+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,i,o)=>{if(!1===e)throw new GE(r(i," has been removed"+(t?" in "+t:"")),GE.ERR_DEPRECATED);return t&&!nT[i]&&(nT[i]=!0,console.warn(r(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,i,o)}},tT.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};var rT={assertOptions:function(e,t,n){if("object"!=typeof e)throw new GE("options must be an object",GE.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let i=r.length;for(;i-- >0;){const o=r[i],s=t[o];if(s){const t=e[o],n=void 0===t||s(t,o,e);if(!0!==n)throw new GE("option "+o+" must be "+n,GE.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new GE("Unknown option "+o,GE.ERR_BAD_OPTION)}},validators:tT};const iT=rT.validators;let oT=class{constructor(e){this.defaults=e||{},this.interceptors={request:new oS,response:new oS}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=MS(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:i}=t;void 0!==n&&rT.assertOptions(n,{silentJSONParsing:iT.transitional(iT.boolean),forcedJSONParsing:iT.transitional(iT.boolean),clarifyTimeoutError:iT.transitional(iT.boolean)},!1),null!=r&&(qE.isFunction(r)?t.paramsSerializer={serialize:r}:rT.assertOptions(r,{encode:iT.function,serialize:iT.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),rT.assertOptions(t,{baseUrl:iT.spelling("baseURL"),withXsrfToken:iT.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=i&&qE.merge(i.common,i[t.method]);i&&qE.forEach(["delete","get","head","post","put","patch","common"],e=>{delete i[e]}),t.headers=xS.concat(o,i);const s=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,s.unshift(e.fulfilled,e.rejected))});const l=[];let u;this.interceptors.response.forEach(function(e){l.push(e.fulfilled,e.rejected)});let c,d=0;if(!a){const e=[QS.bind(this),void 0];for(e.unshift(...s),e.push(...l),c=e.length,u=Promise.resolve(t);d<c;)u=u.then(e[d++],e[d++]);return u}c=s.length;let h=t;for(;d<c;){const e=s[d++],t=s[d++];try{h=e(h)}catch(e){t.call(this,e);break}}try{u=QS.call(this,h)}catch(e){return Promise.reject(e)}for(d=0,c=l.length;d<c;)u=u.then(l[d++],l[d++]);return u}getUri(e){return iS(NS((e=MS(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};qE.forEach(["delete","get","head","options"],function(e){oT.prototype[e]=function(t,n){return this.request(MS(n||{},{method:e,url:t,data:(n||{}).data}))}}),qE.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,i){return this.request(MS(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}oT.prototype[e]=t(),oT.prototype[e+"Form"]=t(!0)});const sT={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(sT).forEach(([e,t])=>{sT[t]=e});const aT=function e(t){const n=new oT(t),r=rE(oT.prototype.request,n);return qE.extend(r,oT.prototype,n,{allOwnKeys:!0}),qE.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(MS(t,n))},r}(mS);aT.Axios=oT,aT.CanceledError=SS,aT.CancelToken=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,i){n.reason||(n.reason=new SS(e,r,i),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;const n=new e(function(e){t=e});return{token:n,cancel:t}}},aT.isCancel=ES,aT.VERSION=eT,aT.toFormData=QE,aT.AxiosError=GE,aT.Cancel=aT.CanceledError,aT.all=function(e){return Promise.all(e)},aT.spread=function(e){return function(t){return e.apply(null,t)}},aT.isAxiosError=function(e){return qE.isObject(e)&&!0===e.isAxiosError},aT.mergeConfig=MS,aT.AxiosHeaders=xS,aT.formToJSON=e=>fS(qE.isHTMLForm(e)?new FormData(e):e),aT.getAdapter=ZS.getAdapter,aT.HttpStatusCode=sT,aT.default=aT;const{Axios:lT,AxiosError:uT,CanceledError:cT,isCancel:dT,CancelToken:hT,VERSION:pT,all:fT,Cancel:mT,isAxiosError:gT,spread:yT,toFormData:bT,AxiosHeaders:vT,HttpStatusCode:_T,formToJSON:xT,getAdapter:wT,mergeConfig:ET}=aT;class ST{constructor(){var e,t,n;e=this,"production"!==process.env.NODE_ENV&&(Rf(e)||Rf(Object.getPrototypeOf(e))||df("'makeAutoObservable' can only be used for classes that don't have a superclass"),ob(e)&&df("makeAutoObservable can only be used on objects not already made observable")),Rf(e)?cy(e,e,t,n):wb(function(){var r=nb(e,n)[rm];if(!e[Ry]){var i=Object.getPrototypeOf(e),o=new Set([].concat(Lf(e),Lf(i)));o.delete("constructor"),o.delete(rm),Pf(i,Ry,o)}e[Ry].forEach(function(e){return r.make_(e,!t||!(e in t)||t[e])})})}_isUnauthorized=!1;get isUnauthorized(){return this._isUnauthorized}set isUnauthorized(e){this._isUnauthorized=e}}var TT=Zb(({onUnauthorized:t,children:r})=>{const{authStore:i}=CT();return n.useEffect(()=>{i.isUnauthorized&&t()},[i.isUnauthorized]),e(n.Fragment,{children:r})});const kT=new class{authStore=new ST},OT=n.createContext(kT),AT=({children:t})=>e(OT.Provider,{value:kT,children:t}),CT=()=>{const e=n.useContext(OT);if(null===e)throw new Error("You have forgotten to wrap your root component with RootStoreProvider");return e};class RT{client;constructor(e){this.client=aT.create({baseURL:e,timeout:1e4,headers:{"Content-Type":"application/json"}}),this.setupInterceptors()}setupInterceptors(){this.client.interceptors.request.use(e=>(kT.authStore.isUnauthorized=!1,e),e=>Promise.reject(e)),this.client.interceptors.response.use(e=>e,e=>(401===e.status&&(kT.authStore.isUnauthorized=!0),Promise.reject(e)))}async get({url:e,config:t}){return(await this.client.get(e,t)).data}async post({url:e,body:t,config:n}){return(await this.client.post(e,t,n)).data}async put({url:e,body:t,config:n}){return(await this.client.put(e,t,n)).data}async delete({url:e,config:t}){return(await this.client.delete(e,t)).data}}const NT=e=>new RT(e);class PT{_apiService;get apiService(){return this._apiService}static _instance=null;static get instance(){if(!PT._instance)throw new Error("Dartcom Config не инициализирован с приватным ключом. Вызовите Config.initialize(...) первым, чтобы иметь возможность пользоваться компонентами нашей библиотеки");return PT._instance}static initialize(e){PT._instance||(PT._instance=new PT(e))}static deactivate(){this._instance=null}constructor({apiKey:e,backendUrl:t,onCheck:n}){this._apiKey=e,this._apiService=NT(t),this._getCheckKeyData().then(e=>{if(e){const{valid:t}=e;n?.(e),this.isValidApiKey=t}})}_apiKey="";_isValidApiKey=!1;get isValidApiKey(){return this._isValidApiKey}set isValidApiKey(e){this._isValidApiKey=e}async _getCheckKeyData(){const e=await this._apiService.get({url:"check_tile_token",config:{params:{tile_token:this._apiKey}}}).then(e=>e).catch(({response:e})=>{if(e){const{data:{detail:t}}=e;return t}});return e}}const MT={valid:"18c38ab326d12f428e90be50a5141fc8949de497df7f7e0c1796d58e99d006f3",dateExpired:"8cbc5e15e61e649daf57c3a08422ae372c101afb4759036a3864a9fa588ef717",off:"b1520018920b33a4c1f8100c4f3bb3eb93661db829faa99c9cd75537f6300ba9",invalid:"abcdefghijklmnopqrstuvwxyz0123456789"};var DT,IT;var zT,FT,LT=(IT||(IT=1,DT=function(){const e=["a","b","c","d","e","f","0","1","2","3","4","5","6","7","8","9"];let t=[];for(let n=0;n<36;n++)t[n]=8===n||13===n||18===n||23===n?"-":e[Math.ceil(Math.random()*e.length-1)];return t.join("")}),DT),jT=dt(LT);!function(e){e.GET="GET",e.DELETE="DELETE",e.PUT="PUT",e.POST="POST"}(zT||(zT={})),function(e){e.TOP_RIGHT="top-right",e.BOTTOM_RIGHT="bottom-right",e.BOTTOM_LEFT="bottom-left",e.TOP_LEFT="top-left"}(FT||(FT={}));const $T="https://dalganmap.ru/api";var BT;!function(e){e.TILE="tile",e.NATURE_TILE="nature_tile",e.MSK="msk"}(BT||(BT={}));const VT=256,UT={[BT.TILE]:`${$T}/tiles/get_tile/{z}/{x}/{y}.mvt`,[BT.NATURE_TILE]:`${$T}/tiles/get_nature_tile/{z}/{x}/{y}.mvt`,[BT.MSK]:"http://89.108.118.23:3070/tiles/get_tile/{z}/{x}/{y}.mvt"},WT=e=>{const t=[],n={source:e,layer:'"RoadPoly"'},r={id:jT(),data:n,filter:"function() {\n const { type } = feature;\n\n const isFilter = type === 'Road';\n\n return isFilter;\n }",draw:{polygons:{color:"#BABCC2"}}},i={id:jT(),data:n,filter:"function() {\n const { type } = feature;\n\n const isFilter = type === 'Tram';\n\n return isFilter;\n }",draw:{polygons:{color:"#ADA8A8"}}},o={id:jT(),data:n,filter:"function() {\n const { type } = feature;\n\n const isFilter = type === 'Curb';\n\n return isFilter;\n }",draw:{polygons:{color:"#D2D9E6"}}},s={id:jT(),data:n,filter:"function() {\n const { type } = feature;\n\n const isFilter = type === 'Bridge';\n\n return isFilter;\n }",draw:{polygons:{color:"#E1DFDD"}}};return t.push(r,i,o,s),t},qT=e=>{const t=[],n={source:e,layer:'"LaneMarkingPoly"'},r={id:jT(),data:n,filter:"function() {\n const { poly_number } = feature;\n\n const isFilter = poly_number === '1.14.1';\n\n return isFilter;\n }",draw:{styles:{zebra_crossing:{attributes:{a_angle:"function() {\n return feature.angle;\n }"}}}}},i={id:jT(),data:n,filter:"function() {\n const { poly_number } = feature;\n\n const isFilter = poly_number === '1.18';\n\n return isFilter;\n }",draw:{polygons:{color:"white"}}};return t.push(i,r),t},GT=e=>{const t=[],n={source:e,layer:'"LaneMarkingLine"'},r="white",i=.5,o={id:jT(),data:n,sublayers:{1.1:{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.1';\n\n return isFilter;\n }",draw:{lines:{color:r,width:i}}},1.5:{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.5';\n\n return isFilter;\n }",draw:{lines:{color:r,width:i,dash:[4,10]}}},1.6:{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.6';\n\n return isFilter;\n }",draw:{lines:{color:r,width:i,dash:[5,5]}}},"1.16.1":{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.16.1';\n\n return isFilter;\n }",draw:{lines:{color:r,width:i}}},1.7:{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.7';\n\n return isFilter;\n }",draw:{lines:{color:r,width:i,dash:[4,10]}}},"1.7-blue":{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.7blue';\n\n return isFilter;\n }",draw:{lines:{color:"blue",width:i,dash:[4,10]}}},"1.14.3":{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.14.3';\n\n return isFilter;\n }",draw:{lines:{color:r,width:i,dash:[3,8]}}},1.12:{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.12';\n\n return isFilter;\n }",draw:{lines:{color:r,width:1.5}}},"1.17.1":{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.17.1';\n\n return isFilter;\n }",draw:{lines:{color:"yellow",width:i}}},1.26:{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.26';\n\n return isFilter;\n }",draw:{lines:{color:"yellow",width:i}}}}},s={"1.3-left":{id:jT(),data:n,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.3';\n\n return isFilter;\n }",draw:{lines:{color:r,width:i,offset:-.5}}},"1.3-right":{id:jT(),data:n,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.3';\n\n return isFilter;\n }",draw:{lines:{color:r,width:i,offset:i}}},"1.11r-left":{id:jT(),data:n,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.11r';\n\n return isFilter;\n }",draw:{lines:{color:r,width:i,offset:-.5}}},"1.11r-right":{id:jT(),data:n,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.11r';\n\n return isFilter;\n }",draw:{lines:{color:r,width:i,offset:i,dash:[5,5]}}},"1.11l-left":{id:jT(),data:n,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.11l';\n\n return isFilter;\n }",draw:{lines:{color:r,width:i,offset:-.5,dash:[5,5]}}},"1.11l-right":{id:jT(),data:n,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.11l';\n\n return isFilter;\n }",draw:{lines:{color:r,width:i,offset:i}}},"1.25-left":{id:jT(),data:n,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.25';\n\n return isFilter;\n }",draw:{lines:{color:r,width:1,offset:-.5,dash:[1,1],dash_background_color:[0,0,0,0]}}},"1.25-right":{id:jT(),data:n,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.25';\n\n return isFilter;\n }",draw:{lines:{color:"rgba(0,0,0,0)",width:1,offset:.5,dash:[1,1],dash_background_color:[1,1,1]}}}};return t.push(o,...Object.values(s)),t},HT=e=>{const t=[],n={source:e,layer:'"ParkingLine"'},r={id:jT(),data:n,draw:{lines:{color:"white",width:1}}};return t.push(r),t},YT=e=>{const t=[],n={source:e,layer:'"MapAdminBuiltupArea"'},r={id:jT(),data:n,draw:{polygons:{color:"#CFC8C8"}}};return t.push(r),t},KT=e=>[{id:jT(),data:{source:e,layer:'"PointAddress"',minzoom:15},draw:{text:{interactive:!0,text_source:"address",font:{fill:"black",size:"12px"}}}}],XT='function() {\n const { poi_name, cat_id } = feature;\n\n switch (+cat_id) {\n case 4100: {\n const text = poi_name.replaceAll(/(Метро-|Станция-|МЦД-)/g, "");\n\n return text;\n }\n\n default: {\n return poi_name;\n }\n }\n}',ZT=[3578,4013,4100,5400,5511,5512,5540,5541,5800,5813,5999,6e3,7011,7389,7832,7929,7990,8060,8410,9517,9530,9565,9583,9718,9992],JT=e=>{const t={};switch(e){case 4100:t[`_${e}-metro`]={filter:`function() {\n const { poi_name, cat_id } = feature;\n\n const isMetro = poi_name.startsWith('Метро-');\n const isStation = poi_name.startsWith('Станция-');\n\n const isCatId = +cat_id === ${e};\n\n const isFilter = isCatId && (isMetro || isStation);\n\n return isFilter;\n }`,draw:{points:QT({texture:`POI_${e}(metro)`})}},t[`_${e}-diameter`]={filter:`function() {\n const { cat_id, poi_name } = feature;\n\n const isDiameter = poi_name.startsWith('МЦД-');\n\n const isCatId = +cat_id === ${e};\n\n const isFilter = isCatId && isDiameter;\n\n return isFilter;\n }`,draw:{points:QT({texture:`POI_${e}(diameter)`,size:[41,15]})}};break;case 9530:t[`_${e}-mail`]={filter:`function() {\n const { cat_id, poi_name = '' } = feature;\n\n const isCatId = +cat_id === ${e};\n\n const isMail = poi_name.startsWith('Почта');\n\n const isFilter = isCatId && isMail;\n\n return isFilter;\n }`,draw:{points:QT({texture:`POI_${e}(Mail)`})}},t[`_${e}-delivery`]={filter:`function() {\n const { cat_id, poi_name = '' } = feature;\n\n const isCatId = +cat_id === ${e};\n \n const isMail = poi_name.startsWith('Почта');\n\n const isFilter = isCatId && !isMail;\n\n return isFilter;\n }`,draw:{points:QT({texture:`POI_${e}(Delivery)`})}};break;case 9992:{const n={mosque:1,church:2,temple:3,davidStar:4,mortar:6};Object.entries(n).forEach(([n,r])=>{t[`_${e}-${n}`]={filter:`function() {\n const { cat_id, subcat_id } = feature;\n\n const isCatId = +cat_id === ${e};\n const isSubcatId = +subcat_id === ${r};\n\n const isFilter = isCatId && isSubcatId;\n\n return isFilter;\n }`,draw:{points:QT({texture:`POI_${e}(${n})`})}}});break}default:t[`_${e}`]={filter:`function {\n const { cat_id } = feature;\n\n const isFilter = +cat_id === ${e};\n\n return isFilter;\n }`,draw:{points:QT({texture:`POI_${e}`})}}}return t},QT=({texture:e,size:t="20px"})=>({texture:e,size:t,sprite:"base",placement:"midpoint"}),ek=ZT.reduce((e,t)=>({...e,...JT(t)}),{}),tk=e=>{const t=[],n={id:jT(),data:{source:e,layer:'"POI"'},draw:{points:{text:{text_source:XT,font:{fill:"#464544",size:"12px"}}}},sublayers:ek};return t.push(n),t},nk=e=>[{id:jT(),data:{source:e,layer:'"CityPOI"'},filter:"function () {\n const { capital_order8, capital_order2, capital_order1, poi_name, priority } = feature;\n\n if ($zoom >= 9 && $zoom < 13) {\n return priority < 8;\n }\n\n if ($zoom <= 11) {\n return capital_order8 === 'Y';\n }\n\n if ($zoom >= 15) {\n return capital_order2 !== 'Y';\n }\n\n return true;\n }\n ",draw:{text:{text_source:"poi_name",priority:"function () {\n const { priority } = feature;\n\n if ($zoom <= 15) {\n return priority;\n }\n\n return 1;\n }\n ",font:{fill:"black",size:"function() {\n const { capital_order8 } = feature;\n\n if (capital_order8 === 'Y') {\n return '16px';\n }\n\n return '12px';\n }",weight:"function() {\n const { capital_order2 } = feature;\n\n if (capital_order2 === 'Y') {\n return 'bold';\n }\n\n return 'normal';\n }",stroke:{color:"white",width:"2px"}}}}}],rk=e=>[{id:jT(),data:{source:e,layer:'"OneWay"'},draw:{points:{texture:"arrow",sprite:"base",angle:"function() {\n const { bearing } = feature;\n \n return bearing;\n }\n "}}}];var ik;!function(e){e.traffic_signal="traffic_signal",e.pedestrian_crossing="pedestrian_crossing",e.physical="physical",e.gate="gate"}(ik||(ik={}));const ok=e=>{const t={},n={id:jT(),data:{source:e,layer:'"Conditions"'}};return Object.values(ik).forEach(e=>{t[`_${e}`]={filter:`function() {\n const { type } = feature;\n\n const isShow = type === '${e}';\n\n return isShow;\n }`,draw:{points:{texture:e,sprite:"base",placement:"midpoint"}}}}),n.sublayers=t,[n]},sk=e=>{const t=[],n={source:e,layer:'"MapRailroadLink"'},r={id:jT(),data:n,draw:{lines:{color:"#A3A8A",width:5,dash:[1,2],dash_background_color:[0,0,0],join:"round"}}};return t.push(r),t},ak=e=>{const t=[],n={id:jT(),data:{source:e,layer:'"MapWaterArea"'},draw:{polygons:{color:"#7DBEE4"},lines:{color:"#7DBEE4",width:20,cap:"round",join:"round"}}},r={id:jT(),data:{source:e,layer:'"MapWaterAreaLabel"'},filter:"function() {\n const { display_class } = feature;\n\n if ($zoom >= 14) {\n return true;\n } else {\n return display_class <= 4;\n }\n }",draw:{text:{text_source:"name",font:{fill:"#0A80C4",size:"14px",stroke:{color:"white",width:"3px"}}}}},i={id:jT(),data:{source:e,layer:'"MapWaterLakeLabel"'},filter:"function() {\n const { display_class } = feature;\n\n if ($zoom >= 14) {\n return true;\n } else {\n return display_class <= 4;\n }\n }",draw:{text:{text_source:"name",font:{fill:"#0A80C4",size:"14px",stroke:{color:"white",width:"3px"}}}}};return t.push(n,r,i),t},lk=e=>{const t=[],n={},r={source:e,layer:'"MapWaterLink"'},i={id:jT(),data:r};return n.geometry={draw:{lines:{color:"#7DBEE4",width:5,cap:"round",join:"round"}}},n.text={filter:"function() {\n return $zoom >= 10;\n }",draw:{text:{text_source:"name",font:{fill:"#0A80C4",size:"14px",stroke:{color:"white",width:"3px"}}}}},i.sublayers=n,t.push(i),t},uk=e=>{const t=[],n={id:jT(),data:{source:e,layer:'"MapOceanArea"'},draw:{polygons:{color:"#7DBEE4"}}},r={id:jT(),data:{source:e,layer:'"MapOceanAreaLabel"'},draw:{text:{text_source:"name",font:{fill:"#0A80C4",size:"18px",stroke:{color:"white",width:"3px"}}}}};return t.push(n,r),t},ck=e=>{const t=[],n={id:jT(),data:{source:e,layer:'"MapLanduseArea"'},draw:{polygons:{interactive:!0,color:"function() {\n const { feature_type } = feature;\n\n switch (feature_type) {\n case '509998': {\n return '#ECD175';\n }\n\n case '600102':\n case '900140': {\n return '#3E9A8C';\n }\n\n case '900202':\n case '900130':\n case '900150':\n case '900103': {\n return '#96BE7D';\n }\n\n case '9997010': {\n return null;\n }\n }\n }",order:"function() {\n const { feature_type } = feature;\n\n switch(feature_type) {\n case '900150':\n case '900130':\n case '509998': {\n return 300;\n }\n\n default: {\n return 299;\n }\n }\n }"}}},r={id:jT(),data:{source:e,layer:'"MapLanduseAreaLabel"'},filter:"function() {\n return $zoom >= 15;\n }",draw:{text:{text_source:"name",font:{size:"13px",fill:"function() {\n const { feature_type } = feature;\n\n switch(feature_type) {\n case '509998': {\n return '#CD7F32';\n }\n\n default: {\n return '#00541F';\n }\n }\n }",stroke:{color:"white",width:"3px"}}}}};return t.push(n,r),t},dk=e=>{const t=[],n={source:e,layer:'"MapBuildingECArea"',minzoom:15},r={id:jT(),data:n,extruded:{draw:{polygons:{interactive:!0,style:"buildings",extrude:"function() {\n return $zoom >= 17;\n }"}}},draw:{polygons:{color:"#DDB07B",height:{property:"height"}},lines:{color:"#DB933F",width:"2px",cap:"round",join:"round"}}};return t.push(r),t},hk=e=>{const t=[],n={id:jT(),data:{source:e,layer:'"MapFacilityArea"'},draw:{polygons:{color:"function() {\n const { feature_type } = feature;\n\n switch (feature_type) {\n case '2000408': {\n return '#DBBAC4';\n }\n\n case '1900403': {\n return '#B6C3C7';\n }\n\n case '1907403': {\n return '#A3B9C0';\n }\n\n case '2000123': {\n return '#E4BA7D';\n }\n\n case '2000124': {\n return '#BFE6E3';\n }\n\n case '2000200': {\n return '#A0A9A8';\n }\n\n case '2000403': {\n return '#AF7136';\n }\n\n case '2000420': {\n return '#89AC76';\n }\n\n case '2000457': {\n return '#9494C0';\n }\n\n default: {\n return '#E1D4D4';\n }\n }\n }",order:"function() {\n const { feature_type } = feature;\n\n switch (feature_type) {\n case '1907403': {\n return 301;\n }\n\n default: {\n return 300;\n }\n }\n }"},lines:{color:"#857F7F",width:"2px",cap:"round",join:"round"}}},r={id:jT(),data:{source:e,layer:'"MapFacilityAreaLabel"'},draw:{text:{text_source:"name",font:{fill:"function() {\n const { feature_type } = feature;\n\n switch(feature_type) {\n case '1900403':\n case '1907403': {\n return '#256D7B';\n }\n\n case '2000420':\n case '2000460':\n case '2000123': {\n return '#00541F';\n }\n\n case '2000408': {\n return '#5E2129';\n }\n\n case '2000124': {\n return '#3E5F8A';\n }\n\n case '2000200': {\n return '#464451';\n }\n\n case '2000403': {\n return '#B03F35';\n }\n\n case '2000457': {\n return '#6A5ACD';\n }\n\n case '1700215':\n case '900159':\n case '900158': {\n return '#474A51';\n }\n\n default: {\n return black;\n }\n }\n }",size:"12px",stroke:{color:"white",width:"3px"}}}}};return t.push(n,r),t},pk=e=>{const t=[],n={source:e,layer:'"MapAdminArea"'},r={id:jT(),data:n,draw:{polygons:{color:"#D3D2CF"}}},i={id:jT(),data:n,filter:"function() {\n const { type } = feature;\n\n const isFilter = type === 'R';\n\n return isFilter;\n }",draw:{lines:{color:"#696969",width:"1px",cap:"round",join:"round"}}},o={id:jT(),data:n,filter:"function() {\n const { type } = feature;\n\n const isFilter = type === 'D' && $zoom >= 12;\n\n return isFilter;\n }",draw:{lines:{color:"#696969",dash:[4,7],width:"1px",cap:"round",join:"round"}}};return t.push(r,i,o),t},fk=()=>{const e=[],t={source:BT.NATURE_TILE,layer:'"MapNatureField"'},n={id:jT(),data:t,draw:{polygons:{interactive:!0,color:"#EBEEC7"}}};return e.push(n),e},mk=["-1.0","-0.5","-0.3","0.0","0.3","0.5","0.7","1.0","1.5","2.0"],gk=[[1,2],[3,4],[5]],yk="function() {\n const { functional_class, tunnel, tollway } = feature;\n\n const alpha = tunnel ? 0.89 : 1;\n\n const getRGB = (hex, alpha) => {\n const r = +(parseInt(hex.slice(1, 3), 16) / 255).toFixed(2);\n const g = +(parseInt(hex.slice(3, 5), 16) / 255).toFixed(2);\n const b = +(parseInt(hex.slice(5, 7), 16) / 255).toFixed(2);\n\n return [r, g, b, alpha];\n }\n\n if (tollway) {\n return '#D72740';\n }\n\n switch (functional_class) {\n case 1:\n case 2: {\n const color = getRGB('#D1747F', alpha);\n\n return color;\n }\n\n case 3:\n case 4: {\n const color = getRGB('#B1A7AA', alpha);\n\n return color;\n }\n\n case 5: {\n const color = getRGB('#D5CEC3', alpha);\n\n return color;\n }\n }\n}",bk="function() {\n const { functional_class, road_number } = feature;\n\n const getScale = () => {\n if ($zoom <= 15 && $zoom >= 14) { return 7; }\n\n if ($zoom <= 13 && $zoom >= 12) { return 9; }\n\n if ($zoom <= 5) { return 400; }\n\n if ($zoom <= 7) { return 200; }\n\n if ($zoom < 12) { return 50; }\n\n return 1;\n }\n\n const scale = getScale();\n\n switch(functional_class) {\n case 1:\n case 2: {\n return 8 * scale;\n }\n\n case 3:\n case 4: {\n return 7 * scale;\n }\n\n case 5: {\n if (Boolean(road_number)) {\n return 7 * scale;\n }\n\n return 6;\n }\n }\n}",vk=e=>{const t=[],n={source:e,layer:'"Link"'},r={id:jT(),data:n,draw:{text:{text_source:"road_number",font:{fill:"#181bff",size:"16px",weight:"bold",underline:!0,background:{color:"black"}}}}};t.push(r);const i={text_source:"street_name",font:{fill:"black",size:"14px",stroke:{color:"white",width:"3px"}}};return mk.forEach(e=>{const r=`function() {\n const { z_lvl } = feature;\n\n const isFilter = z_lvl === '${e}';\n\n return isFilter;\n }`,o=()=>({text:i,lines:{color:yk,width:bk,cap:"round",join:"round"}}),s=()=>({lines:{color:yk,width:bk,cap:"round",join:"round",outline:{color:"function() {\n const { functional_class, access_id, tollway } = feature;\n\n if (tollway) {\n return '#B9263B';\n }\n\n switch(functional_class) {\n case 5: {\n return '#989898';\n }\n\n case 3:\n case 4: {\n return '#8F6E78';\n }\n\n case 1:\n case 2: {\n return '#9A414B';\n }\n }\n}",width:"function() {\n const { functional_class, access_id } = feature;\n\n switch(functional_class) {\n case 5: {\n switch (access_id) {\n case 32: {\n return 0;\n }\n\n default: {\n return 1;\n }\n }\n }\n\n default: {\n return 1;\n }\n }\n}"}}});if("0.0"===e)gk.forEach(r=>{r.forEach(r=>{const i={id:jT(),data:n,filter:`function() {\n const { functional_class, z_lvl } = feature;\n\n const isFilter = z_lvl === '${e}' && functional_class === ${r};\n\n return isFilter;\n }`,draw:o(),sublayers:{construction:{filter:"function() {\n return global.links.getIsConstruction(feature);\n }",draw:{lines:{width:3,color:"#9AA096",dash:[2,1]}}},functionalClassAccessId32:{filter:"function() {\n return global.links.getIsFunctionalClass(feature);\n }",draw:{lines:{width:2,color:"#9AA096",dash:[2,1]}}},lowMobility:{filter:"function() {\n return global.links.getIsLowMobility(feature);\n }",draw:{lines:{width:4}}}}},a={id:jT(),data:n,filter:`function() {\n const { functional_class, z_lvl } = feature;\n\n const isFilter = z_lvl === '${e}' && functional_class === ${r} && !global.links.getIsConstruction(feature) && !global.links.getIsFunctionalClass(feature);\n\n return isFilter;\n }`,draw:s(),sublayers:{lowMobility:{filter:"function() {\n return global.links.getIsLowMobility(feature);\n }",draw:{lines:{width:4}}}}};t.push(a,i)})});else{const e={id:jT(),data:n,filter:r,draw:o()},i={id:jT(),data:n,filter:r,draw:s()};t.push(i,e)}}),t},_k=()=>{const e=[],t={source:BT.NATURE_TILE,layer:'"MapNatureForest"'},n={id:jT(),data:t,draw:{polygons:{interactive:!0,color:"function() {\n const { feature_type } = feature;\n\n switch (feature_type) {\n case '900202': {\n return '#96BE7D';\n }\n\n default : {\n return null;\n }\n }\n }"}}};return e.push(n),e},xk=({id:e,data:{source:t,layer:n}})=>`${e}-${t}-${n}`,wk=({layer:e,order:t})=>{const n=structuredClone(e),{draw:r,sublayers:i}=n;if(r){const{points:e,lines:i,polygons:o,text:s,styles:a}=r;e&&(r.points={...structuredClone(e),order:t}),i&&(r.lines={...structuredClone(i),order:t}),o&&(r.polygons={...structuredClone(o),order:t}),s&&(r.text={...structuredClone(s),order:t}),a&&(r.styles=Object.entries(a).reduce((e,[n,r])=>({...e,[n]:{...structuredClone(r),order:t}}),{})),n.draw=structuredClone(r)}return i&&(Object.entries(i).forEach(([e,n])=>{if(n){const{draw:r}=n;if(r){const{points:e,lines:i,polygons:o}=r;e&&(r.points={...structuredClone(e),order:t}),i&&(r.lines={...structuredClone(i),order:t}),o&&(r.polygons={...structuredClone(o),order:t}),n.draw=structuredClone(r)}i[e]=structuredClone(n)}}),n.sublayers=structuredClone(i)),n},Ek=e=>{const t=pk(e),n=fk(),r=_k(),i=YT(e),o=hk(e),s=ck(e),a=ak(e),l=uk(e),u=[];if(e===BT.MSK)u.push(...t,...i,...o,...s,...a,...l);else u.push(...t,...i,...o,...n,...r,...s,...a,...l);return u},Sk=e=>{const t=vk(e),n=sk(e),r=lk(e),i=rk(e),o=ok(e),s=[...r,...n,...t];if(e===BT.MSK)s.push(...r,...n,...t);else s.push(...r,...n,...t,...i,...o);return s},Tk=e=>{const t=tk(e),n=nk(e);return[...t,...KT(e),...n]},kk=e=>{const t=[],n=dk(e),r=Ek(e),i=Sk(e),o=Tk(e),s=WT(e),a=qT(e),l=GT(e),u=HT(e);if(e===BT.MSK)t.push(...r,...i,...s,...a,...l,...u,...n,...o);else t.push(...r,...i,...n,...o);return t},Ok=()=>{const{instance:{isValidApiKey:e}}=PT,[t,r]=n.useState(null),[i,o]=n.useState(null),[s,a]=n.useState(null),l=n.useCallback(e=>{if(!i)return void console.warn("Scene не инициализирована");if(!s)return void console.warn("Config не инициализирована");const{name:t}=e;return s.sources[t]=structuredClone(e),i.updateConfig({rebuild:!0}),b()},[i,s]),u=n.useCallback(e=>{if(s)return structuredClone(s.sources[e]);console.warn("Config не инициализирована")},[s]),c=n.useCallback((e,t)=>{if(i){if(s)return s.sources[e].url=t,i.updateConfig({rebuild:!0}),b();console.warn("Config не инициализирована")}else console.warn("Scene не инициализирована")},[s,i]),d=n.useCallback(e=>{if(!i)return void console.warn("Scene не инициализирован");if(!s)return void console.warn("Config не инициализирован");const t=g().length+1,n=wk({layer:e,order:t}),r=xk(n),{sublayers:o,draw:a}=n;if(a){const{styles:e={}}=a;e&&(n.draw={...structuredClone(n.draw),...structuredClone(e)})}return s.layers[r]={...structuredClone(n),...structuredClone(o)},i.updateConfig({rebuild:!0}),g()},[s,i]),h=n.useCallback(e=>{if(!i)return void console.warn("Scene не инициализирован");if(!s)return void console.warn("Config не инициализирован");const t=xk(e);return s.layers[t]&&delete s.layers[t],i.updateConfig({rebuild:!0}),g()},[s,i]),p=n.useCallback(({name:e,style:t})=>{i?s?(s.styles[e]=structuredClone(t),i.updateConfig({rebuild:!0})):console.warn("Config не инициализирована"):console.warn("Scene не инициализирована")},[s,i]),f=n.useCallback(e=>{if(!s)return void console.warn("Config не инициализирована");const t=xk(e),{visible:n}=s.layers[t];return n},[s]),m=n.useCallback(({layer:e,visible:t})=>{if(!i)return void console.warn("Scene не инициализирована");if(!s)return void console.warn("Config не инициализирована");const n=xk(e);return s.layers[n].visible=t,i.updateConfig(),f(e)},[s,i]),g=n.useCallback(()=>{if(!s)return[];const{layers:e}=s;return Object.keys(e)},[s]),y=n.useCallback(()=>{if(!s)return[];const{layers:e}=s;Object.values(e).forEach(h)},[s]),b=n.useCallback(()=>{if(!s)return[];const{sources:e}=s;return Object.keys(e)},[s]);return n.useEffect(()=>(e&&Promise.resolve().then(function(){return lM}).then(()=>{if(window.Tangram){const e=window.Tangram.leafletLayer({scene:nE}),{scene:t}=e;r(e),o(t)}}),()=>{r(null),o(null),a(null)}),[e]),n.useEffect(()=>{i&&i.subscribe({load:({config:e})=>{a(e)}})},[i]),n.useEffect(()=>{p({name:"space-tile",style:{shaders:{defines:{TILE_SCALE:2445e-7,"NORMALIZED_SHORT(x)":"(x * 32767.)"},blocks:{global:"\n varying vec3 v_pos;\n vec2 getTileCoords() {\n return fract(v_pos.xy);\n }\n ",position:"\n v_pos = modelPosition().xyz;\n "}}}}),p({name:"tools-aastep",style:{shaders:{extensions:"OES_standard_derivatives",blocks:{global:"\n float aastep(float threshold, float value) {\n #ifdef TANGRAM_FRAGMENT_SHADER\n #ifdef TANGRAM_EXTENSION_OES_standard_derivatives\n float afwidth = length(vec2(dFdx(value), dFdy(value))) * 0.70710678118654757;\n return smoothstep(threshold-afwidth, threshold+afwidth, value);\n #else\n return step(threshold, value);\n #endif\n #else\n return step(threshold, value);\n #endif\n }\n "}}}}),p({name:"pattern-diagonal-grid",style:{mix:["space-tile","tools-aastep"],shaders:{blocks:{global:"\n float DiagonalGrid(float scale, float lineWidth) {\n vec2 st = getTileCoords() * scale;\n\n float d1 = mod(st.x + st.y, 1.0);\n float line1 = aastep(lineWidth, d1) * aastep(1.0 - lineWidth, d1);\n\n float d2 = mod(st.x - st.y, 1.0);\n float line2 = aastep(lineWidth, d2) * aastep(1.0 - lineWidth, d2);\n\n return max(line1, line2);\n } \n "}}}}),p({name:"diagonal-grid",style:{mix:"pattern-diagonal-grid",blend:"overlay",base:"polygons",shaders:{blocks:{color:"\n float grid = DiagonalGrid(12.0, 0.08);\n\n color.a = grid;\n "}}}}),p({name:"zebra_crossing",style:{base:"polygons",lighting:!1,shaders:{attributes:{a_angle:{type:"float",default:0}},uniforms:{u_stripe_width:1},blocks:{filter:"\n vec3 pos = worldPosition().xyz;\n\n float ang = radians(a_angle);\n\n vec2 dir = vec2(sin(ang), cos(ang));\n\n float positionAlongLine = dot(pos.xy, dir);\n\n float stripe = step(1.0, mod(positionAlongLine / u_stripe_width, 2.0));\n\n color.rgb = mix(vec3(1.0, 1.0, 1.0), vec3(1.0, 0.8, 0.0), stripe);\n \n color.a = 1.0;\n "}}}})},[p]),n.useEffect(()=>{Object.values(BT).forEach(e=>{l({tile_size:256,name:e,url:UT[e],type:"MVT"})})},[l]),{layer:t,scene:i,config:s,addSource:l,getSource:u,updateSource:c,addLayer:d,removeLayer:h,addStyle:p,getLayerVisibility:f,toggleLayerVisibility:m,getSources:b,getLayers:g,removeLayers:y}},Ak=()=>{const{layer:e,addLayer:t}=Ok(),r=tE();return n.useEffect(()=>{e&&r.addLayer(e)},[e]),n.useEffect(()=>{kk(BT.MSK).map(t)},[t]),null},Ck=({children:t,sx:n={},...r})=>e(Jc,{...r,sx:{padding:"20px 15px",borderRadius:"10px",boxShadow:"0px 8px 24px 0px rgba(0,0,0,0.3)",maxHeight:"80vh",maxWidth:"90vw",overflowX:"auto",...n},children:t}),Rk=({color:t="inherit"})=>e(Qa,{color:t});var Nk=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Pk={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Mk=new class{#e=Pk;#t=!1;setTimeoutProvider(e){"production"!==process.env.NODE_ENV&&this.#t&&e!==this.#e&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:this.#e,provider:e}),this.#e=e,"production"!==process.env.NODE_ENV&&(this.#t=!1)}setTimeout(e,t){return"production"!==process.env.NODE_ENV&&(this.#t=!0),this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return"production"!==process.env.NODE_ENV&&(this.#t=!0),this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};var Dk="undefined"==typeof window||"Deno"in globalThis;function Ik(){}function zk(e,t){return"function"==typeof e?e(t):e}function Fk(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:o,queryKey:s,stale:a}=e;if(s)if(r){if(t.queryHash!==jk(s,t.options))return!1}else if(!Bk(t.queryKey,s))return!1;if("all"!==n){const e=t.isActive();if("active"===n&&!e)return!1;if("inactive"===n&&e)return!1}return("boolean"!=typeof a||t.isStale()===a)&&((!i||i===t.state.fetchStatus)&&!(o&&!o(t)))}function Lk(e,t){const{exact:n,status:r,predicate:i,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if($k(t.options.mutationKey)!==$k(o))return!1}else if(!Bk(t.options.mutationKey,o))return!1}return(!r||t.state.status===r)&&!(i&&!i(t))}function jk(e,t){return(t?.queryKeyHashFn||$k)(e)}function $k(e){return JSON.stringify(e,(e,t)=>qk(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Bk(e,t){return e===t||typeof e==typeof t&&(!(!e||!t||"object"!=typeof e||"object"!=typeof t)&&Object.keys(t).every(n=>Bk(e[n],t[n])))}var Vk=Object.prototype.hasOwnProperty;function Uk(e,t){if(e===t)return e;const n=Wk(e)&&Wk(t);if(!(n||qk(e)&&qk(t)))return t;const r=(n?e:Object.keys(e)).length,i=n?t:Object.keys(t),o=i.length,s=n?new Array(o):{};let a=0;for(let l=0;l<o;l++){const o=n?l:i[l],u=e[o],c=t[o];if(u===c){s[o]=u,(n?l<r:Vk.call(e,o))&&a++;continue}if(null===u||null===c||"object"!=typeof u||"object"!=typeof c){s[o]=c;continue}const d=Uk(u,c);s[o]=d,d===u&&a++}return r===o&&a===r?e:s}function Wk(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function qk(e){if(!Gk(e))return!1;const t=e.constructor;if(void 0===t)return!0;const n=t.prototype;return!!Gk(n)&&(!!n.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype)}function Gk(e){return"[object Object]"===Object.prototype.toString.call(e)}function Hk(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Yk(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Kk=Symbol();function Xk(e,t){return"production"!==process.env.NODE_ENV&&e.queryFn===Kk&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==Kk?e.queryFn:()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`))}var Zk=new class extends Nk{#n;#r;#i;constructor(){super(),this.#i=e=>{if(!Dk&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#r||this.setEventListener(this.#i)}onUnsubscribe(){this.hasListeners()||(this.#r?.(),this.#r=void 0)}setEventListener(e){this.#i=e,this.#r?.(),this.#r=e(e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()})}setFocused(e){this.#n!==e&&(this.#n=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return"boolean"==typeof this.#n?this.#n:"hidden"!==globalThis.document?.visibilityState}};var Jk=function(e){setTimeout(e,0)};var Qk=function(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Jk;const o=r=>{t?e.push(r):i(()=>{n(r)})};return{batch:o=>{let s;t++;try{s=o()}finally{t--,t||(()=>{const t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})})()}return s},batchCalls:e=>(...t)=>{o(()=>{e(...t)})},schedule:o,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}(),eO=new class extends Nk{#o=!0;#r;#i;constructor(){super(),this.#i=e=>{if(!Dk&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#r||this.setEventListener(this.#i)}onUnsubscribe(){this.hasListeners()||(this.#r?.(),this.#r=void 0)}setEventListener(e){this.#i=e,this.#r?.(),this.#r=e(this.setOnline.bind(this))}setOnline(e){this.#o!==e&&(this.#o=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#o}};function tO(e){return Math.min(1e3*2**e,3e4)}function nO(e){return"online"!==(e??"online")||eO.isOnline()}var rO=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function iO(e){let t,n=!1,r=0;const i=function(){let e,t;const n=new Promise((n,r)=>{e=n,t=r});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.status="pending",n.catch(()=>{}),n.resolve=t=>{r({status:"fulfilled",value:t}),e(t)},n.reject=e=>{r({status:"rejected",reason:e}),t(e)},n}(),o=()=>"pending"!==i.status,s=()=>Zk.isFocused()&&("always"===e.networkMode||eO.isOnline())&&e.canRun(),a=()=>nO(e.networkMode)&&e.canRun(),l=e=>{o()||(t?.(),i.resolve(e))},u=e=>{o()||(t?.(),i.reject(e))},c=()=>new Promise(n=>{t=e=>{(o()||s())&&n(e)},e.onPause?.()}).then(()=>{t=void 0,o()||e.onContinue?.()}),d=()=>{if(o())return;let t;const i=0===r?e.initialPromise:void 0;try{t=i??e.fn()}catch(e){t=Promise.reject(e)}Promise.resolve(t).then(l).catch(t=>{if(o())return;const i=e.retry??(Dk?0:3),a=e.retryDelay??tO,l="function"==typeof a?a(r,t):a,h=!0===i||"number"==typeof i&&r<i||"function"==typeof i&&i(r,t);!n&&h?(r++,e.onFail?.(r,t),function(e){return new Promise(t=>{Mk.setTimeout(t,e)})}(l).then(()=>s()?void 0:c()).then(()=>{n?u(t):d()})):u(t)})};return{promise:i,status:()=>i.status,cancel:t=>{if(!o()){const n=new rO(t);u(n),e.onCancel?.(n)}},continue:()=>(t?.(),i),cancelRetry:()=>{n=!0},continueRetry:()=>{n=!1},canStart:a,start:()=>(a()?d():c().then(d),i)}}var oO=class{#s;destroy(){this.clearGcTimeout()}scheduleGc(){var e;this.clearGcTimeout(),"number"==typeof(e=this.gcTime)&&e>=0&&e!==1/0&&(this.#s=Mk.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Dk?1/0:3e5))}clearGcTimeout(){this.#s&&(Mk.clearTimeout(this.#s),this.#s=void 0)}},sO=class extends oO{#a;#l;#u;#c;#d;#h;#p;constructor(e){super(),this.#p=!1,this.#h=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#c=e.client,this.#u=this.#c.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#a=uO(this.options),this.state=e.state??this.#a,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#d?.promise}setOptions(e){if(this.options={...this.#h,...e},this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){const e=uO(this.options);void 0!==e.data&&(this.setState(lO(e.data,e.dataUpdatedAt)),this.#a=e)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#u.remove(this)}setData(e,t){const n=function(e,t,n){if("function"==typeof n.structuralSharing)return n.structuralSharing(e,t);if(!1!==n.structuralSharing){if("production"!==process.env.NODE_ENV)try{return Uk(e,t)}catch(e){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${e}`),e}return Uk(e,t)}return t}(this.state.data,e,this.options);return this.#f({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#f({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#d?.promise;return this.#d?.cancel(e),t?t.then(Ik).catch(Ik):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#a)}isActive(){return this.observers.some(e=>{return!1!==(t=e.options.enabled,n=this,"function"==typeof t?t(n):t);var t,n})}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Kk||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>"static"===zk(e.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(e=0){return void 0===this.state.data||"static"!==e&&(!!this.state.isInvalidated||!function(e,t){return Math.max(e+(t||0)-Date.now(),0)}(this.state.dataUpdatedAt,e))}onFocus(){const e=this.observers.find(e=>e.shouldFetchOnWindowFocus());e?.refetch({cancelRefetch:!1}),this.#d?.continue()}onOnline(){const e=this.observers.find(e=>e.shouldFetchOnReconnect());e?.refetch({cancelRefetch:!1}),this.#d?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#u.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#d&&(this.#p?this.#d.cancel({revert:!0}):this.#d.cancelRetry()),this.scheduleGc()),this.#u.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#f({type:"invalidate"})}async fetch(e,t){if("idle"!==this.state.fetchStatus&&"rejected"!==this.#d?.status())if(void 0!==this.state.data&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#d)return this.#d.continueRetry(),this.#d.promise;if(e&&this.setOptions(e),!this.options.queryFn){const e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}"production"!==process.env.NODE_ENV&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#p=!0,n.signal)})},i=()=>{const e=Xk(this.options,t),n=(()=>{const e={client:this.#c,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#p=!1,this.options.persister?this.options.persister(e,n,this):e(n)},o=(()=>{const e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#c,state:this.state,fetchFn:i};return r(e),e})();this.options.behavior?.onFetch(o,this),this.#l=this.state,"idle"!==this.state.fetchStatus&&this.state.fetchMeta===o.fetchOptions?.meta||this.#f({type:"fetch",meta:o.fetchOptions?.meta}),this.#d=iO({initialPromise:t?.initialPromise,fn:o.fetchFn,onCancel:e=>{e instanceof rO&&e.revert&&this.setState({...this.#l,fetchStatus:"idle"}),n.abort()},onFail:(e,t)=>{this.#f({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#f({type:"pause"})},onContinue:()=>{this.#f({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0});try{const e=await this.#d.start();if(void 0===e)throw"production"!==process.env.NODE_ENV&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#u.config.onSuccess?.(e,this),this.#u.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof rO){if(e.silent)return this.#d.promise;if(e.revert){if(void 0===this.state.data)throw e;return this.state.data}}throw this.#f({type:"error",error:e}),this.#u.config.onError?.(e,this),this.#u.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#f(e){this.state=(t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":return{...t,...aO(t.data,this.options),fetchMeta:e.meta??null};case"success":const n={...t,...lO(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#l=e.manual?n:void 0,n;case"error":const r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error"};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}})(this.state),Qk.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#u.notify({query:this,type:"updated",action:e})})}};function aO(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:nO(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}function lO(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function uO(e){const t="function"==typeof e.initialData?e.initialData():e.initialData,n=void 0!==t,r=n?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}function cO(e){return{onFetch:(t,n)=>{const r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],s=t.state.data?.pageParams||[];let a={pages:[],pageParams:[]},l=0;const u=async()=>{let n=!1;const u=Xk(t.options,t.fetchOptions),c=async(e,r,i)=>{if(n)return Promise.reject();if(null==r&&e.pages.length)return Promise.resolve(e);const o=(()=>{const e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?"backward":"forward",meta:t.options.meta};return(e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(t.signal.aborted?n=!0:t.signal.addEventListener("abort",()=>{n=!0}),t.signal)})})(e),e})(),s=await u(o),{maxPages:a}=t.options,l=i?Yk:Hk;return{pages:l(e.pages,s,a),pageParams:l(e.pageParams,r,a)}};if(i&&o.length){const e="backward"===i,t={pages:o,pageParams:s},n=(e?hO:dO)(r,t);a=await c(t,n,e)}else{const t=e??o.length;do{const e=0===l?s[0]??r.initialPageParam:dO(r,a);if(l>0&&null==e)break;a=await c(a,e),l++}while(l<t)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=u}}}function dO(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function hO(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var pO=class extends oO{#c;#m;#g;#d;constructor(e){super(),this.#c=e.client,this.mutationId=e.mutationId,this.#g=e.mutationCache,this.#m=[],this.state=e.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#m.includes(e)||(this.#m.push(e),this.clearGcTimeout(),this.#g.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#m=this.#m.filter(t=>t!==e),this.scheduleGc(),this.#g.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#m.length||("pending"===this.state.status?this.scheduleGc():this.#g.remove(this))}continue(){return this.#d?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#f({type:"continue"})},n={client:this.#c,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#d=iO({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(e,t)=>{this.#f({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#f({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#g.canRun(this)});const r="pending"===this.state.status,i=!this.#d.canStart();try{if(r)t();else{this.#f({type:"pending",variables:e,isPaused:i}),await(this.#g.config.onMutate?.(e,this,n));const t=await(this.options.onMutate?.(e,n));t!==this.state.context&&this.#f({type:"pending",context:t,variables:e,isPaused:i})}const o=await this.#d.start();return await(this.#g.config.onSuccess?.(o,e,this.state.context,this,n)),await(this.options.onSuccess?.(o,e,this.state.context,n)),await(this.#g.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n)),await(this.options.onSettled?.(o,null,e,this.state.context,n)),this.#f({type:"success",data:o}),o}catch(t){try{throw await(this.#g.config.onError?.(t,e,this.state.context,this,n)),await(this.options.onError?.(t,e,this.state.context,n)),await(this.#g.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)),await(this.options.onSettled?.(void 0,t,e,this.state.context,n)),t}finally{this.#f({type:"error",error:t})}}finally{this.#g.runNext(this)}}#f(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),Qk.batch(()=>{this.#m.forEach(t=>{t.onMutationUpdate(e)}),this.#g.notify({mutation:this,type:"updated",action:e})})}};var fO=class extends Nk{constructor(e={}){super(),this.config=e,this.#y=new Set,this.#b=new Map,this.#v=0}#y;#b;#v;build(e,t,n){const r=new pO({client:e,mutationCache:this,mutationId:++this.#v,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#y.add(e);const t=mO(e);if("string"==typeof t){const n=this.#b.get(t);n?n.push(e):this.#b.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#y.delete(e)){const t=mO(e);if("string"==typeof t){const n=this.#b.get(t);if(n)if(n.length>1){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}else n[0]===e&&this.#b.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=mO(e);if("string"==typeof t){const n=this.#b.get(t),r=n?.find(e=>"pending"===e.state.status);return!r||r===e}return!0}runNext(e){const t=mO(e);if("string"==typeof t){const n=this.#b.get(t)?.find(t=>t!==e&&t.state.isPaused);return n?.continue()??Promise.resolve()}return Promise.resolve()}clear(){Qk.batch(()=>{this.#y.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#y.clear(),this.#b.clear()})}getAll(){return Array.from(this.#y)}find(e){const t={exact:!0,...e};return this.getAll().find(e=>Lk(t,e))}findAll(e={}){return this.getAll().filter(t=>Lk(e,t))}notify(e){Qk.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(e=>e.state.isPaused);return Qk.batch(()=>Promise.all(e.map(e=>e.continue().catch(Ik))))}};function mO(e){return e.options.scope?.id}var gO=class extends Nk{#c;#_=void 0;#x;#w;constructor(e,t){super(),this.#c=e,this.setOptions(t),this.bindMethods(),this.#E()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){const t=this.options;this.options=this.#c.defaultMutationOptions(e),function(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}(this.options,t)||this.#c.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#x,observer:this}),t?.mutationKey&&this.options.mutationKey&&$k(t.mutationKey)!==$k(this.options.mutationKey)?this.reset():"pending"===this.#x?.state.status&&this.#x.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#x?.removeObserver(this)}onMutationUpdate(e){this.#E(),this.#S(e)}getCurrentResult(){return this.#_}reset(){this.#x?.removeObserver(this),this.#x=void 0,this.#E(),this.#S()}mutate(e,t){return this.#w=t,this.#x?.removeObserver(this),this.#x=this.#c.getMutationCache().build(this.#c,this.options),this.#x.addObserver(this),this.#x.execute(e)}#E(){const e=this.#x?.state??{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0};this.#_={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#S(e){Qk.batch(()=>{if(this.#w&&this.hasListeners()){const t=this.#_.variables,n=this.#_.context,r={client:this.#c,meta:this.options.meta,mutationKey:this.options.mutationKey};"success"===e?.type?(this.#w.onSuccess?.(e.data,t,n,r),this.#w.onSettled?.(e.data,null,t,n,r)):"error"===e?.type&&(this.#w.onError?.(e.error,t,n,r),this.#w.onSettled?.(void 0,e.error,t,n,r))}this.listeners.forEach(e=>{e(this.#_)})})}},yO=class extends Nk{constructor(e={}){super(),this.config=e,this.#T=new Map}#T;build(e,t,n){const r=t.queryKey,i=t.queryHash??jk(r,t);let o=this.get(i);return o||(o=new sO({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(o)),o}add(e){this.#T.has(e.queryHash)||(this.#T.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#T.get(e.queryHash);t&&(e.destroy(),t===e&&this.#T.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Qk.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#T.get(e)}getAll(){return[...this.#T.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(e=>Fk(t,e))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Fk(e,t)):t}notify(e){Qk.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Qk.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Qk.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},bO=n.createContext(void 0),vO=({client:t,children:r})=>(n.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),e(bO.Provider,{value:t,children:r}));function _O(e,t){const r=(()=>{const e=n.useContext(bO);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e})(),[i]=n.useState(()=>new gO(r,e));n.useEffect(()=>{i.setOptions(e)},[i,e]);const o=n.useSyncExternalStore(n.useCallback(e=>i.subscribe(Qk.batchCalls(e)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),s=n.useCallback((e,t)=>{i.mutate(e,t).catch(Ik)},[i]);if(o.error&&(a=i.options.throwOnError,l=[o.error],"function"==typeof a?a(...l):a))throw o.error;var a,l;return{...o,mutate:s,mutateAsync:o.mutate}}const xO=new class{#k;#g;#h;#O;#A;#C;#R;#N;constructor(e={}){this.#k=e.queryCache||new yO,this.#g=e.mutationCache||new fO,this.#h=e.defaultOptions||{},this.#O=new Map,this.#A=new Map,this.#C=0}mount(){this.#C++,1===this.#C&&(this.#R=Zk.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#k.onFocus())}),this.#N=eO.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#k.onOnline())}))}unmount(){this.#C--,0===this.#C&&(this.#R?.(),this.#R=void 0,this.#N?.(),this.#N=void 0)}isFetching(e){return this.#k.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#g.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#k.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#k.build(this,t),r=n.state.data;return void 0===r?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(zk(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#k.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=this.#k.get(r.queryHash),o=i?.state.data,s=function(e,t){return"function"==typeof e?e(t):e}(t,o);if(void 0!==s)return this.#k.build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return Qk.batch(()=>this.#k.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#k.get(t.queryHash)?.state}removeQueries(e){const t=this.#k;Qk.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){const n=this.#k;return Qk.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Qk.batch(()=>this.#k.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Ik).catch(Ik)}invalidateQueries(e,t={}){return Qk.batch(()=>(this.#k.findAll(e).forEach(e=>{e.invalidate()}),"none"===e?.refetchType?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Qk.batch(()=>this.#k.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(Ik)),"paused"===e.state.fetchStatus?Promise.resolve():t}));return Promise.all(r).then(Ik)}fetchQuery(e){const t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);const n=this.#k.build(this,t);return n.isStaleByTime(zk(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ik).catch(Ik)}fetchInfiniteQuery(e){return e.behavior=cO(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ik).catch(Ik)}ensureInfiniteQueryData(e){return e.behavior=cO(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return eO.isOnline()?this.#g.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#k}getMutationCache(){return this.#g}getDefaultOptions(){return this.#h}setDefaultOptions(e){this.#h=e}setQueryDefaults(e,t){this.#O.set($k(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#O.values()],n={};return t.forEach(t=>{Bk(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#A.set($k(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#A.values()],n={};return t.forEach(t=>{Bk(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#h.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=jk(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Kk&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#h.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#k.clear(),this.#g.clear()}},wO=t=>e(vO,{...t,client:xO}),EO=["localeText"],SO=n.createContext(null);"production"!==process.env.NODE_ENV&&(SO.displayName="PickerAdapterContext");const TO=function(t){const{localeText:r}=t,i=$s(t,EO),{adapter:o,localeText:s}=n.useContext(SO)??{adapter:void 0,localeText:void 0},a=function({props:e,name:t}){return Ci({props:e,name:t,defaultTheme:cs,themeId:se})}({props:i,name:"MuiLocalizationProvider"}),{children:l,dateAdapter:u,dateFormats:c,dateLibInstance:d,adapterLocale:h,localeText:p}=a,f=n.useMemo(()=>ae({},p,s,r),[p,s,r]),m=n.useMemo(()=>{if(!u)return o||null;const e=new u({locale:h,formats:c,instance:d});if(!e.isMUIAdapter)throw new Error(["MUI X: The date adapter should be imported from `@mui/x-date-pickers` or `@mui/x-date-pickers-pro`, not from `@date-io`","For example, `import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'` instead of `import AdapterDayjs from '@date-io/dayjs'`","More information on the installation documentation: https://mui.com/x/react-date-pickers/quickstart/#installation"].join("\n"));return e},[u,h,c,d,o]),g=n.useMemo(()=>m?{minDate:m.date("1900-01-01T00:00:00.000"),maxDate:m.date("2099-12-31T00:00:00.000")}:null,[m]),y=n.useMemo(()=>({utils:m,adapter:m,defaultDates:g,localeText:f}),[g,m,f]);return e(SO.Provider,{value:y,children:l})};"production"!==process.env.NODE_ENV&&(TO.displayName="LocalizationProvider"),"production"!==process.env.NODE_ENV&&(TO.propTypes={adapterLocale:Dn.any,children:Dn.node,dateAdapter:Dn.func,dateFormats:Dn.shape({dayOfMonth:Dn.string,dayOfMonthFull:Dn.string,fullDate:Dn.string,fullTime12h:Dn.string,fullTime24h:Dn.string,hours12h:Dn.string,hours24h:Dn.string,keyboardDate:Dn.string,keyboardDateTime12h:Dn.string,keyboardDateTime24h:Dn.string,meridiem:Dn.string,minutes:Dn.string,month:Dn.string,monthShort:Dn.string,normalDate:Dn.string,normalDateWithWeekday:Dn.string,seconds:Dn.string,shortDate:Dn.string,weekday:Dn.string,weekdayShort:Dn.string,year:Dn.string}),dateLibInstance:Dn.any,localeText:Dn.object});const kO=6048e5,OO=36e5,AO=Symbol.for("constructDateFrom");function CO(e,t){return"function"==typeof e?e(t):e&&"object"==typeof e&&AO in e?e[AO](t):e instanceof Date?new e.constructor(t):new Date(t)}function RO(e,t){return CO(t||e,e)}function NO(e,t,n){const r=RO(e,n?.in);return isNaN(t)?CO(n?.in||e,NaN):t?(r.setDate(r.getDate()+t),r):r}function PO(e,t,n){return CO(e,+RO(e)+t)}function MO(e,t,n){const r=RO(e,n?.in);if(isNaN(t))return CO(e,NaN);if(!t)return r;const i=r.getDate(),o=CO(e,r.getTime());o.setMonth(r.getMonth()+t+1,0);return i>=o.getDate()?o:(r.setFullYear(o.getFullYear(),o.getMonth(),i),r)}function DO(e,t){const n=RO(e,t?.in);return n.setHours(23,59,59,999),n}let IO={};function zO(){return IO}function FO(e,t){const n=RO(e,t?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}const LO={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function jO(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const $O={date:jO({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:jO({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:jO({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},BO={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function VO(e){return(t,n)=>{let r;if("formatting"===(n?.context?String(n.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,i=n?.width?String(n.width):t;r=e.formattingValues[i]||e.formattingValues[t]}else{const t=e.defaultWidth,i=n?.width?String(n.width):e.defaultWidth;r=e.values[i]||e.values[t]}return r[e.argumentCallback?e.argumentCallback(t):t]}}const UO={ordinalNumber:(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:VO({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:VO({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:VO({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:VO({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:VO({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})};function WO(e){return(t,n={})=>{const r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],o=t.match(i);if(!o)return null;const s=o[0],a=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(a)?function(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n;return}(a,e=>e.test(s)):function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n;return}(a,e=>e.test(s));let u;u=e.valueCallback?e.valueCallback(l):l,u=n.valueCallback?n.valueCallback(u):u;return{value:u,rest:t.slice(s.length)}}}function qO(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const i=r[0],o=t.match(e.parsePattern);if(!o)return null;let s=e.valueCallback?e.valueCallback(o[0]):o[0];s=n.valueCallback?n.valueCallback(s):s;return{value:s,rest:t.slice(i.length)}}}const GO={code:"en-US",formatDistance:(e,t,n)=>{let r;const i=LO[e];return r="string"==typeof i?i:1===t?i.one:i.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r},formatLong:$O,formatRelative:(e,t,n,r)=>BO[e],localize:UO,match:{ordinalNumber:qO({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:WO({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:WO({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:WO({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:WO({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:WO({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function HO(e){const t=RO(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function YO(e,...t){const n=CO.bind(null,e||t.find(e=>"object"==typeof e));return t.map(n)}function KO(e,t){const n=RO(e,t?.in);return n.setHours(0,0,0,0),n}function XO(e,t){const n=RO(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function ZO(e,t){const n=RO(e,t?.in),r=function(e,t,n){const[r,i]=YO(n?.in,e,t),o=KO(r),s=KO(i),a=+o-HO(o),l=+s-HO(s);return Math.round((a-l)/864e5)}(n,XO(n));return r+1}function JO(e,t){const n=zO(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=RO(e,t?.in),o=i.getDay(),s=(o<r?7:0)+o-r;return i.setDate(i.getDate()-s),i.setHours(0,0,0,0),i}function QO(e,t){return JO(e,{...t,weekStartsOn:1})}function eA(e,t){const n=RO(e,t?.in),r=n.getFullYear(),i=CO(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);const o=QO(i),s=CO(n,0);s.setFullYear(r,0,4),s.setHours(0,0,0,0);const a=QO(s);return n.getTime()>=o.getTime()?r+1:n.getTime()>=a.getTime()?r:r-1}function tA(e,t){const n=RO(e,t?.in),r=+QO(n)-+function(e,t){const n=eA(e,t),r=CO(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),QO(r)}(n);return Math.round(r/kO)+1}function nA(e,t){const n=RO(e,t?.in),r=n.getFullYear(),i=zO(),o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,s=CO(t?.in||e,0);s.setFullYear(r+1,0,o),s.setHours(0,0,0,0);const a=JO(s,t),l=CO(t?.in||e,0);l.setFullYear(r,0,o),l.setHours(0,0,0,0);const u=JO(l,t);return+n>=+a?r+1:+n>=+u?r:r-1}function rA(e,t){const n=RO(e,t?.in),r=+JO(n,t)-+function(e,t){const n=zO(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=nA(e,t),o=CO(t?.in||e,0);return o.setFullYear(i,0,r),o.setHours(0,0,0,0),JO(o,t)}(n,t);return Math.round(r/kO)+1}function iA(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const oA={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return iA("yy"===t?r%100:r,t.length)},M(e,t){const n=e.getMonth();return"M"===t?String(n+1):iA(n+1,2)},d:(e,t)=>iA(e.getDate(),t.length),a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,t)=>iA(e.getHours()%12||12,t.length),H:(e,t)=>iA(e.getHours(),t.length),m:(e,t)=>iA(e.getMinutes(),t.length),s:(e,t)=>iA(e.getSeconds(),t.length),S(e,t){const n=t.length,r=e.getMilliseconds();return iA(Math.trunc(r*Math.pow(10,n-3)),t.length)}},sA="midnight",aA="noon",lA="morning",uA="afternoon",cA="evening",dA="night",hA={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if("yo"===t){const t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:"year"})}return oA.y(e,t)},Y:function(e,t,n,r){const i=nA(e,r),o=i>0?i:1-i;if("YY"===t){return iA(o%100,2)}return"Yo"===t?n.ordinalNumber(o,{unit:"year"}):iA(o,t.length)},R:function(e,t){return iA(eA(e),t.length)},u:function(e,t){return iA(e.getFullYear(),t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return iA(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return iA(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return oA.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return iA(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const i=rA(e,r);return"wo"===t?n.ordinalNumber(i,{unit:"week"}):iA(i,t.length)},I:function(e,t,n){const r=tA(e);return"Io"===t?n.ordinalNumber(r,{unit:"week"}):iA(r,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getDate(),{unit:"date"}):oA.d(e,t)},D:function(e,t,n){const r=ZO(e);return"Do"===t?n.ordinalNumber(r,{unit:"dayOfYear"}):iA(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const i=e.getDay(),o=(i-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return iA(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const i=e.getDay(),o=(i-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return iA(o,t.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),i=0===r?7:r;switch(t){case"i":return String(i);case"ii":return iA(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let i;switch(i=12===r?aA:0===r?sA:r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let i;switch(i=r>=17?cA:r>=12?uA:r>=4?lA:dA,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),n.ordinalNumber(t,{unit:"hour"})}return oA.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getHours(),{unit:"hour"}):oA.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return"Ko"===t?n.ordinalNumber(r,{unit:"hour"}):iA(r,t.length)},k:function(e,t,n){let r=e.getHours();return 0===r&&(r=24),"ko"===t?n.ordinalNumber(r,{unit:"hour"}):iA(r,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):oA.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getSeconds(),{unit:"second"}):oA.s(e,t)},S:function(e,t){return oA.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(0===r)return"Z";switch(t){case"X":return fA(r);case"XXXX":case"XX":return mA(r);default:return mA(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return fA(r);case"xxxx":case"xx":return mA(r);default:return mA(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+pA(r,":");default:return"GMT"+mA(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+pA(r,":");default:return"GMT"+mA(r,":")}},t:function(e,t,n){return iA(Math.trunc(+e/1e3),t.length)},T:function(e,t,n){return iA(+e,t.length)}};function pA(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),i=Math.trunc(r/60),o=r%60;return 0===o?n+String(i):n+String(i)+t+iA(o,2)}function fA(e,t){if(e%60==0){return(e>0?"-":"+")+iA(Math.abs(e)/60,2)}return mA(e,t)}function mA(e,t=""){const n=e>0?"-":"+",r=Math.abs(e);return n+iA(Math.trunc(r/60),2)+t+iA(r%60,2)}const gA=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},yA=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},bA={p:yA,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return gA(e,t);let o;switch(r){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;default:o=t.dateTime({width:"full"})}return o.replace("{{date}}",gA(r,t)).replace("{{time}}",yA(i,t))}},vA=/^D+$/,_A=/^Y+$/,xA=["D","DD","YY","YYYY"];function wA(e){return vA.test(e)}function EA(e){return _A.test(e)}function SA(e,t,n){const r=function(e,t,n){const r="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,n);if(console.warn(r),xA.includes(e))throw new RangeError(r)}function TA(e){return!(!((t=e)instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t))&&"number"!=typeof e||isNaN(+RO(e)));var t}const kA=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,OA=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,AA=/^'([^]*?)'?$/,CA=/''/g,RA=/[a-zA-Z]/;function NA(e){const t=e.match(AA);return t?t[1].replace(CA,"'"):e}function PA(e,t){const n=RO(e,t?.in),r=n.getFullYear(),i=n.getMonth(),o=CO(n,0);return o.setFullYear(r,i+1,0),o.setHours(0,0,0,0),o.getDate()}function MA(e,t){return+RO(e)>+RO(t)}function DA(e,t){return+RO(e)<+RO(t)}function IA(e,t){const n=RO(e,t?.in);return n.setMinutes(0,0,0),n}class zA{subPriority=0;validate(e,t){return!0}}class FA extends zA{constructor(e,t,n,r,i){super(),this.value=e,this.validateValue=t,this.setValue=n,this.priority=r,i&&(this.subPriority=i)}validate(e,t){return this.validateValue(e,this.value,t)}set(e,t,n){return this.setValue(e,t,this.value,n)}}class LA extends zA{priority=10;subPriority=-1;constructor(e,t){super(),this.context=e||(e=>CO(t,e))}set(e,t){return t.timestampIsSet?e:CO(e,function(e,t){const n=function(e){return"function"==typeof e&&e.prototype?.constructor===e}(t)?new t(0):CO(t,0);return n.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),n.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n}(e,this.context))}}class jA{run(e,t,n,r){const i=this.parse(e,t,n,r);return i?{setter:new FA(i.value,this.validate,this.set,this.priority,this.subPriority),rest:i.rest}:null}validate(e,t,n){return!0}}const $A=/^(1[0-2]|0?\d)/,BA=/^(3[0-1]|[0-2]?\d)/,VA=/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,UA=/^(5[0-3]|[0-4]?\d)/,WA=/^(2[0-3]|[0-1]?\d)/,qA=/^(2[0-4]|[0-1]?\d)/,GA=/^(1[0-1]|0?\d)/,HA=/^(1[0-2]|0?\d)/,YA=/^[0-5]?\d/,KA=/^[0-5]?\d/,XA=/^\d/,ZA=/^\d{1,2}/,JA=/^\d{1,3}/,QA=/^\d{1,4}/,eC=/^-?\d+/,tC=/^-?\d/,nC=/^-?\d{1,2}/,rC=/^-?\d{1,3}/,iC=/^-?\d{1,4}/,oC=/^([+-])(\d{2})(\d{2})?|Z/,sC=/^([+-])(\d{2})(\d{2})|Z/,aC=/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,lC=/^([+-])(\d{2}):(\d{2})|Z/,uC=/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/;function cC(e,t){return e?{value:t(e.value),rest:e.rest}:e}function dC(e,t){const n=t.match(e);return n?{value:parseInt(n[0],10),rest:t.slice(n[0].length)}:null}function hC(e,t){const n=t.match(e);if(!n)return null;if("Z"===n[0])return{value:0,rest:t.slice(1)};const r="+"===n[1]?1:-1,i=n[2]?parseInt(n[2],10):0,o=n[3]?parseInt(n[3],10):0,s=n[5]?parseInt(n[5],10):0;return{value:r*(i*OO+6e4*o+1e3*s),rest:t.slice(n[0].length)}}function pC(e){return dC(eC,e)}function fC(e,t){switch(e){case 1:return dC(XA,t);case 2:return dC(ZA,t);case 3:return dC(JA,t);case 4:return dC(QA,t);default:return dC(new RegExp("^\\d{1,"+e+"}"),t)}}function mC(e,t){switch(e){case 1:return dC(tC,t);case 2:return dC(nC,t);case 3:return dC(rC,t);case 4:return dC(iC,t);default:return dC(new RegExp("^-?\\d{1,"+e+"}"),t)}}function gC(e){switch(e){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;default:return 0}}function yC(e,t){const n=t>0,r=n?t:1-t;let i;if(r<=50)i=e||100;else{const t=r+50;i=e+100*Math.trunc(t/100)-(e>=t%100?100:0)}return n?i:1-i}function bC(e){return e%400==0||e%4==0&&e%100!=0}const vC=[31,28,31,30,31,30,31,31,30,31,30,31],_C=[31,29,31,30,31,30,31,31,30,31,30,31];function xC(e,t,n){const r=zO(),i=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,o=RO(e,n?.in),s=o.getDay(),a=7-i;return NO(o,t<0||t>6?t-(s+a)%7:((t%7+7)%7+a)%7-(s+a)%7,n)}function wC(e,t,n){const r=RO(e,n?.in),i=function(e,t){const n=RO(e,t?.in).getDay();return 0===n?7:n}(r,n);return NO(r,t-i,n)}const EC={G:new class extends jA{priority=140;parse(e,t,n){switch(t){case"G":case"GG":case"GGG":return n.era(e,{width:"abbreviated"})||n.era(e,{width:"narrow"});case"GGGGG":return n.era(e,{width:"narrow"});default:return n.era(e,{width:"wide"})||n.era(e,{width:"abbreviated"})||n.era(e,{width:"narrow"})}}set(e,t,n){return t.era=n,e.setFullYear(n,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=["R","u","t","T"]},y:new class extends jA{priority=130;incompatibleTokens=["Y","R","u","w","I","i","e","c","t","T"];parse(e,t,n){const r=e=>({year:e,isTwoDigitYear:"yy"===t});switch(t){case"y":return cC(fC(4,e),r);case"yo":return cC(n.ordinalNumber(e,{unit:"year"}),r);default:return cC(fC(t.length,e),r)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,n){const r=e.getFullYear();if(n.isTwoDigitYear){const t=yC(n.year,r);return e.setFullYear(t,0,1),e.setHours(0,0,0,0),e}const i="era"in t&&1!==t.era?1-n.year:n.year;return e.setFullYear(i,0,1),e.setHours(0,0,0,0),e}},Y:new class extends jA{priority=130;parse(e,t,n){const r=e=>({year:e,isTwoDigitYear:"YY"===t});switch(t){case"Y":return cC(fC(4,e),r);case"Yo":return cC(n.ordinalNumber(e,{unit:"year"}),r);default:return cC(fC(t.length,e),r)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,n,r){const i=nA(e,r);if(n.isTwoDigitYear){const t=yC(n.year,i);return e.setFullYear(t,0,r.firstWeekContainsDate),e.setHours(0,0,0,0),JO(e,r)}const o="era"in t&&1!==t.era?1-n.year:n.year;return e.setFullYear(o,0,r.firstWeekContainsDate),e.setHours(0,0,0,0),JO(e,r)}incompatibleTokens=["y","R","u","Q","q","M","L","I","d","D","i","t","T"]},R:new class extends jA{priority=130;parse(e,t){return mC("R"===t?4:t.length,e)}set(e,t,n){const r=CO(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),QO(r)}incompatibleTokens=["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]},u:new class extends jA{priority=130;parse(e,t){return mC("u"===t?4:t.length,e)}set(e,t,n){return e.setFullYear(n,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=["G","y","Y","R","w","I","i","e","c","t","T"]},Q:new class extends jA{priority=120;parse(e,t,n){switch(t){case"Q":case"QQ":return fC(t.length,e);case"Qo":return n.ordinalNumber(e,{unit:"quarter"});case"QQQ":return n.quarter(e,{width:"abbreviated",context:"formatting"})||n.quarter(e,{width:"narrow",context:"formatting"});case"QQQQQ":return n.quarter(e,{width:"narrow",context:"formatting"});default:return n.quarter(e,{width:"wide",context:"formatting"})||n.quarter(e,{width:"abbreviated",context:"formatting"})||n.quarter(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=1&&t<=4}set(e,t,n){return e.setMonth(3*(n-1),1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"]},q:new class extends jA{priority=120;parse(e,t,n){switch(t){case"q":case"qq":return fC(t.length,e);case"qo":return n.ordinalNumber(e,{unit:"quarter"});case"qqq":return n.quarter(e,{width:"abbreviated",context:"standalone"})||n.quarter(e,{width:"narrow",context:"standalone"});case"qqqqq":return n.quarter(e,{width:"narrow",context:"standalone"});default:return n.quarter(e,{width:"wide",context:"standalone"})||n.quarter(e,{width:"abbreviated",context:"standalone"})||n.quarter(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=1&&t<=4}set(e,t,n){return e.setMonth(3*(n-1),1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"]},M:new class extends jA{incompatibleTokens=["Y","R","q","Q","L","w","I","D","i","e","c","t","T"];priority=110;parse(e,t,n){const r=e=>e-1;switch(t){case"M":return cC(dC($A,e),r);case"MM":return cC(fC(2,e),r);case"Mo":return cC(n.ordinalNumber(e,{unit:"month"}),r);case"MMM":return n.month(e,{width:"abbreviated",context:"formatting"})||n.month(e,{width:"narrow",context:"formatting"});case"MMMMM":return n.month(e,{width:"narrow",context:"formatting"});default:return n.month(e,{width:"wide",context:"formatting"})||n.month(e,{width:"abbreviated",context:"formatting"})||n.month(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.setMonth(n,1),e.setHours(0,0,0,0),e}},L:new class extends jA{priority=110;parse(e,t,n){const r=e=>e-1;switch(t){case"L":return cC(dC($A,e),r);case"LL":return cC(fC(2,e),r);case"Lo":return cC(n.ordinalNumber(e,{unit:"month"}),r);case"LLL":return n.month(e,{width:"abbreviated",context:"standalone"})||n.month(e,{width:"narrow",context:"standalone"});case"LLLLL":return n.month(e,{width:"narrow",context:"standalone"});default:return n.month(e,{width:"wide",context:"standalone"})||n.month(e,{width:"abbreviated",context:"standalone"})||n.month(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.setMonth(n,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","M","w","I","D","i","e","c","t","T"]},w:new class extends jA{priority=100;parse(e,t,n){switch(t){case"w":return dC(UA,e);case"wo":return n.ordinalNumber(e,{unit:"week"});default:return fC(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,n,r){return JO(function(e,t,n){const r=RO(e,n?.in),i=rA(r,n)-t;return r.setDate(r.getDate()-7*i),RO(r,n?.in)}(e,n,r),r)}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","i","t","T"]},I:new class extends jA{priority=100;parse(e,t,n){switch(t){case"I":return dC(UA,e);case"Io":return n.ordinalNumber(e,{unit:"week"});default:return fC(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,n){return QO(function(e,t,n){const r=RO(e,n?.in),i=tA(r,n)-t;return r.setDate(r.getDate()-7*i),r}(e,n))}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"]},d:new class extends jA{priority=90;subPriority=1;parse(e,t,n){switch(t){case"d":return dC(BA,e);case"do":return n.ordinalNumber(e,{unit:"date"});default:return fC(t.length,e)}}validate(e,t){const n=bC(e.getFullYear()),r=e.getMonth();return n?t>=1&&t<=_C[r]:t>=1&&t<=vC[r]}set(e,t,n){return e.setDate(n),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","w","I","D","i","e","c","t","T"]},D:new class extends jA{priority=90;subpriority=1;parse(e,t,n){switch(t){case"D":case"DD":return dC(VA,e);case"Do":return n.ordinalNumber(e,{unit:"date"});default:return fC(t.length,e)}}validate(e,t){return bC(e.getFullYear())?t>=1&&t<=366:t>=1&&t<=365}set(e,t,n){return e.setMonth(0,n),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"]},E:new class extends jA{priority=90;parse(e,t,n){switch(t){case"E":case"EE":case"EEE":return n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"EEEEE":return n.day(e,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});default:return n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,r){return(e=xC(e,n,r)).setHours(0,0,0,0),e}incompatibleTokens=["D","i","e","c","t","T"]},e:new class extends jA{priority=90;parse(e,t,n,r){const i=e=>{const t=7*Math.floor((e-1)/7);return(e+r.weekStartsOn+6)%7+t};switch(t){case"e":case"ee":return cC(fC(t.length,e),i);case"eo":return cC(n.ordinalNumber(e,{unit:"day"}),i);case"eee":return n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"eeeee":return n.day(e,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});default:return n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,r){return(e=xC(e,n,r)).setHours(0,0,0,0),e}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"]},c:new class extends jA{priority=90;parse(e,t,n,r){const i=e=>{const t=7*Math.floor((e-1)/7);return(e+r.weekStartsOn+6)%7+t};switch(t){case"c":case"cc":return cC(fC(t.length,e),i);case"co":return cC(n.ordinalNumber(e,{unit:"day"}),i);case"ccc":return n.day(e,{width:"abbreviated",context:"standalone"})||n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"});case"ccccc":return n.day(e,{width:"narrow",context:"standalone"});case"cccccc":return n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"});default:return n.day(e,{width:"wide",context:"standalone"})||n.day(e,{width:"abbreviated",context:"standalone"})||n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,r){return(e=xC(e,n,r)).setHours(0,0,0,0),e}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"]},i:new class extends jA{priority=90;parse(e,t,n){const r=e=>0===e?7:e;switch(t){case"i":case"ii":return fC(t.length,e);case"io":return n.ordinalNumber(e,{unit:"day"});case"iii":return cC(n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"}),r);case"iiiii":return cC(n.day(e,{width:"narrow",context:"formatting"}),r);case"iiiiii":return cC(n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"}),r);default:return cC(n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"}),r)}}validate(e,t){return t>=1&&t<=7}set(e,t,n){return(e=wC(e,n)).setHours(0,0,0,0),e}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"]},a:new class extends jA{priority=80;parse(e,t,n){switch(t){case"a":case"aa":case"aaa":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaaa":return n.dayPeriod(e,{width:"narrow",context:"formatting"});default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,n){return e.setHours(gC(n),0,0,0),e}incompatibleTokens=["b","B","H","k","t","T"]},b:new class extends jA{priority=80;parse(e,t,n){switch(t){case"b":case"bb":case"bbb":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbbb":return n.dayPeriod(e,{width:"narrow",context:"formatting"});default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,n){return e.setHours(gC(n),0,0,0),e}incompatibleTokens=["a","B","H","k","t","T"]},B:new class extends jA{priority=80;parse(e,t,n){switch(t){case"B":case"BB":case"BBB":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBBB":return n.dayPeriod(e,{width:"narrow",context:"formatting"});default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,n){return e.setHours(gC(n),0,0,0),e}incompatibleTokens=["a","b","t","T"]},h:new class extends jA{priority=70;parse(e,t,n){switch(t){case"h":return dC(HA,e);case"ho":return n.ordinalNumber(e,{unit:"hour"});default:return fC(t.length,e)}}validate(e,t){return t>=1&&t<=12}set(e,t,n){const r=e.getHours()>=12;return r&&n<12?e.setHours(n+12,0,0,0):r||12!==n?e.setHours(n,0,0,0):e.setHours(0,0,0,0),e}incompatibleTokens=["H","K","k","t","T"]},H:new class extends jA{priority=70;parse(e,t,n){switch(t){case"H":return dC(WA,e);case"Ho":return n.ordinalNumber(e,{unit:"hour"});default:return fC(t.length,e)}}validate(e,t){return t>=0&&t<=23}set(e,t,n){return e.setHours(n,0,0,0),e}incompatibleTokens=["a","b","h","K","k","t","T"]},K:new class extends jA{priority=70;parse(e,t,n){switch(t){case"K":return dC(GA,e);case"Ko":return n.ordinalNumber(e,{unit:"hour"});default:return fC(t.length,e)}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.getHours()>=12&&n<12?e.setHours(n+12,0,0,0):e.setHours(n,0,0,0),e}incompatibleTokens=["h","H","k","t","T"]},k:new class extends jA{priority=70;parse(e,t,n){switch(t){case"k":return dC(qA,e);case"ko":return n.ordinalNumber(e,{unit:"hour"});default:return fC(t.length,e)}}validate(e,t){return t>=1&&t<=24}set(e,t,n){const r=n<=24?n%24:n;return e.setHours(r,0,0,0),e}incompatibleTokens=["a","b","h","H","K","t","T"]},m:new class extends jA{priority=60;parse(e,t,n){switch(t){case"m":return dC(YA,e);case"mo":return n.ordinalNumber(e,{unit:"minute"});default:return fC(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,n){return e.setMinutes(n,0,0),e}incompatibleTokens=["t","T"]},s:new class extends jA{priority=50;parse(e,t,n){switch(t){case"s":return dC(KA,e);case"so":return n.ordinalNumber(e,{unit:"second"});default:return fC(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,n){return e.setSeconds(n,0),e}incompatibleTokens=["t","T"]},S:new class extends jA{priority=30;parse(e,t){return cC(fC(t.length,e),e=>Math.trunc(e*Math.pow(10,3-t.length)))}set(e,t,n){return e.setMilliseconds(n),e}incompatibleTokens=["t","T"]},X:new class extends jA{priority=10;parse(e,t){switch(t){case"X":return hC(oC,e);case"XX":return hC(sC,e);case"XXXX":return hC(aC,e);case"XXXXX":return hC(uC,e);default:return hC(lC,e)}}set(e,t,n){return t.timestampIsSet?e:CO(e,e.getTime()-HO(e)-n)}incompatibleTokens=["t","T","x"]},x:new class extends jA{priority=10;parse(e,t){switch(t){case"x":return hC(oC,e);case"xx":return hC(sC,e);case"xxxx":return hC(aC,e);case"xxxxx":return hC(uC,e);default:return hC(lC,e)}}set(e,t,n){return t.timestampIsSet?e:CO(e,e.getTime()-HO(e)-n)}incompatibleTokens=["t","T","X"]},t:new class extends jA{priority=40;parse(e){return pC(e)}set(e,t,n){return[CO(e,1e3*n),{timestampIsSet:!0}]}incompatibleTokens="*"},T:new class extends jA{priority=20;parse(e){return pC(e)}set(e,t,n){return[CO(e,n),{timestampIsSet:!0}]}incompatibleTokens="*"}},SC=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,TC=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,kC=/^'([^]*?)'?$/,OC=/''/g,AC=/\S/,CC=/[a-zA-Z]/;function RC(e,t,n,r){const i=()=>CO(r?.in||n,NaN),o=Object.assign({},zO()),s=r?.locale??o.locale??GO,a=r?.firstWeekContainsDate??r?.locale?.options?.firstWeekContainsDate??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,l=r?.weekStartsOn??r?.locale?.options?.weekStartsOn??o.weekStartsOn??o.locale?.options?.weekStartsOn??0;if(!t)return e?i():RO(n,r?.in);const u={firstWeekContainsDate:a,weekStartsOn:l,locale:s},c=[new LA(r?.in,n)],d=t.match(TC).map(e=>{const t=e[0];if(t in bA){return(0,bA[t])(e,s.formatLong)}return e}).join("").match(SC),h=[];for(let n of d){!r?.useAdditionalWeekYearTokens&&EA(n)&&SA(n,t,e),!r?.useAdditionalDayOfYearTokens&&wA(n)&&SA(n,t,e);const o=n[0],a=EC[o];if(a){const{incompatibleTokens:t}=a;if(Array.isArray(t)){const e=h.find(e=>t.includes(e.token)||e.token===o);if(e)throw new RangeError(`The format string mustn't contain \`${e.fullToken}\` and \`${n}\` at the same time`)}else if("*"===a.incompatibleTokens&&h.length>0)throw new RangeError(`The format string mustn't contain \`${n}\` and any other token at the same time`);h.push({token:o,fullToken:n});const r=a.run(e,n,s.match,u);if(!r)return i();c.push(r.setter),e=r.rest}else{if(o.match(CC))throw new RangeError("Format string contains an unescaped latin alphabet character `"+o+"`");if("''"===n?n="'":"'"===o&&(n=NC(n)),0!==e.indexOf(n))return i();e=e.slice(n.length)}}if(e.length>0&&AC.test(e))return i();const p=c.map(e=>e.priority).sort((e,t)=>t-e).filter((e,t,n)=>n.indexOf(e)===t).map(e=>c.filter(t=>t.priority===e).sort((e,t)=>t.subPriority-e.subPriority)).map(e=>e[0]);let f=RO(n,r?.in);if(isNaN(+f))return i();const m={};for(const e of p){if(!e.validate(f,u))return i();const t=e.set(f,m,u);Array.isArray(t)?(f=t[0],Object.assign(m,t[1])):f=t}return f}function NC(e){return e.match(kC)[1].replace(OC,"'")}const PC={y:{sectionType:"year",contentType:"digit",maxLength:4},yy:"year",yyy:{sectionType:"year",contentType:"digit",maxLength:4},yyyy:"year",M:{sectionType:"month",contentType:"digit",maxLength:2},MM:"month",MMMM:{sectionType:"month",contentType:"letter"},MMM:{sectionType:"month",contentType:"letter"},L:{sectionType:"month",contentType:"digit",maxLength:2},LL:"month",LLL:{sectionType:"month",contentType:"letter"},LLLL:{sectionType:"month",contentType:"letter"},d:{sectionType:"day",contentType:"digit",maxLength:2},dd:"day",do:{sectionType:"day",contentType:"digit-with-letter"},E:{sectionType:"weekDay",contentType:"letter"},EE:{sectionType:"weekDay",contentType:"letter"},EEE:{sectionType:"weekDay",contentType:"letter"},EEEE:{sectionType:"weekDay",contentType:"letter"},EEEEE:{sectionType:"weekDay",contentType:"letter"},i:{sectionType:"weekDay",contentType:"digit",maxLength:1},ii:"weekDay",iii:{sectionType:"weekDay",contentType:"letter"},iiii:{sectionType:"weekDay",contentType:"letter"},e:{sectionType:"weekDay",contentType:"digit",maxLength:1},ee:"weekDay",eee:{sectionType:"weekDay",contentType:"letter"},eeee:{sectionType:"weekDay",contentType:"letter"},eeeee:{sectionType:"weekDay",contentType:"letter"},eeeeee:{sectionType:"weekDay",contentType:"letter"},c:{sectionType:"weekDay",contentType:"digit",maxLength:1},cc:"weekDay",ccc:{sectionType:"weekDay",contentType:"letter"},cccc:{sectionType:"weekDay",contentType:"letter"},ccccc:{sectionType:"weekDay",contentType:"letter"},cccccc:{sectionType:"weekDay",contentType:"letter"},a:"meridiem",aa:"meridiem",aaa:"meridiem",H:{sectionType:"hours",contentType:"digit",maxLength:2},HH:"hours",h:{sectionType:"hours",contentType:"digit",maxLength:2},hh:"hours",m:{sectionType:"minutes",contentType:"digit",maxLength:2},mm:"minutes",s:{sectionType:"seconds",contentType:"digit",maxLength:2},ss:"seconds"},MC={year:"yyyy",month:"LLLL",monthShort:"MMM",dayOfMonth:"d",dayOfMonthFull:"do",weekday:"EEEE",weekdayShort:"EEEEEE",hours24h:"HH",hours12h:"hh",meridiem:"aa",minutes:"mm",seconds:"ss",fullDate:"PP",keyboardDate:"P",shortDate:"MMM d",normalDate:"d MMMM",normalDateWithWeekday:"EEE, MMM d",fullTime12h:"hh:mm aa",fullTime24h:"HH:mm",keyboardDateTime12h:"P hh:mm aa",keyboardDateTime24h:"P HH:mm"};class DC{isMUIAdapter=!0;isTimezoneCompatible=!1;formatTokenMap=(()=>PC)();escapedCharacters={start:"'",end:"'"};constructor(e){const{locale:t,formats:n,longFormatters:r,lib:i}=e;this.locale=t,this.formats=ae({},MC,n),this.longFormatters=r,this.lib=i||"date-fns"}date=e=>void 0===e?new Date:null===e?null:new Date(e);getInvalidDate=()=>new Date("Invalid Date");getTimezone=()=>"default";setTimezone=e=>e;toJsDate=e=>e;getCurrentLocaleCode=()=>this.locale.code;is12HourCycleInCurrentLocale=()=>/a/.test(this.locale.formatLong.time({width:"short"}));expandFormat=e=>e.match(/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g).map(e=>{const t=e[0];if("p"===t||"P"===t){return(0,this.longFormatters[t])(e,this.locale.formatLong)}return e}).join("");formatNumber=e=>e;getDayOfWeek=e=>e.getDay()+1}class IC extends DC{constructor({locale:e,formats:t}={}){if("production"!==process.env.NODE_ENV&&!bA)throw new Error("MUI: The minimum supported `date-fns` package version compatible with this adapter is `3.2.x`.");super({locale:e??GO,formats:t,longFormatters:bA})}parse=(e,t)=>""===e?null:RC(e,t,new Date,{locale:this.locale});isValid=e=>null!=e&&TA(e);format=(e,t)=>this.formatByString(e,this.formats[t]);formatByString=(e,t)=>function(e,t,n){const r=zO(),i=n?.locale??r.locale??GO,o=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,s=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,a=RO(e,n?.in);if(!TA(a))throw new RangeError("Invalid time value");let l=t.match(OA).map(e=>{const t=e[0];return"p"===t||"P"===t?(0,bA[t])(e,i.formatLong):e}).join("").match(kA).map(e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:NA(e)};if(hA[t])return{isToken:!0,value:e};if(t.match(RA))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(l=i.localize.preprocessor(a,l));const u={firstWeekContainsDate:o,weekStartsOn:s,locale:i};return l.map(r=>{if(!r.isToken)return r.value;const o=r.value;return(!n?.useAdditionalWeekYearTokens&&EA(o)||!n?.useAdditionalDayOfYearTokens&&wA(o))&&SA(o,t,String(e)),(0,hA[o[0]])(a,o,i.localize,u)}).join("")}(e,t,{locale:this.locale});isEqual=(e,t)=>{return null===e&&null===t||null!==e&&null!==t&&(n=t,+RO(e)===+RO(n));var n};isSameYear=(e,t)=>function(e,t,n){const[r,i]=YO(n?.in,e,t);return r.getFullYear()===i.getFullYear()}(e,t);isSameMonth=(e,t)=>function(e,t,n){const[r,i]=YO(n?.in,e,t);return r.getFullYear()===i.getFullYear()&&r.getMonth()===i.getMonth()}(e,t);isSameDay=(e,t)=>function(e,t,n){const[r,i]=YO(n?.in,e,t);return+KO(r)===+KO(i)}(e,t);isSameHour=(e,t)=>function(e,t,n){const[r,i]=YO(n?.in,e,t);return+IA(r)===+IA(i)}(e,t);isAfter=(e,t)=>MA(e,t);isAfterYear=(e,t)=>MA(e,FO(t));isAfterDay=(e,t)=>MA(e,DO(t));isBefore=(e,t)=>DA(e,t);isBeforeYear=(e,t)=>DA(e,this.startOfYear(t));isBeforeDay=(e,t)=>DA(e,this.startOfDay(t));isWithinRange=(e,[t,n])=>function(e,t,n){const r=+RO(e,n?.in),[i,o]=[+RO(t.start,n?.in),+RO(t.end,n?.in)].sort((e,t)=>e-t);return r>=i&&r<=o}(e,{start:t,end:n});startOfYear=e=>XO(e);startOfMonth=e=>function(e,t){const n=RO(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}(e);startOfWeek=e=>JO(e,{locale:this.locale});startOfDay=e=>KO(e);endOfYear=e=>FO(e);endOfMonth=e=>function(e,t){const n=RO(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}(e);endOfWeek=e=>function(e,t){const n=zO(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=RO(e,t?.in),o=i.getDay(),s=6+(o<r?-7:0)-(o-r);return i.setDate(i.getDate()+s),i.setHours(23,59,59,999),i}(e,{locale:this.locale});endOfDay=e=>DO(e);addYears=(e,t)=>function(e,t,n){return MO(e,12*t,n)}(e,t);addMonths=(e,t)=>MO(e,t);addWeeks=(e,t)=>function(e,t,n){return NO(e,7*t,n)}(e,t);addDays=(e,t)=>NO(e,t);addHours=(e,t)=>function(e,t){return PO(e,t*OO)}(e,t);addMinutes=(e,t)=>function(e,t,n){const r=RO(e,n?.in);return r.setTime(r.getTime()+6e4*t),r}(e,t);addSeconds=(e,t)=>function(e,t){return PO(e,1e3*t)}(e,t);getYear=e=>function(e,t){return RO(e,t?.in).getFullYear()}(e);getMonth=e=>function(e,t){return RO(e,t?.in).getMonth()}(e);getDate=e=>function(e,t){return RO(e,t?.in).getDate()}(e);getHours=e=>function(e,t){return RO(e,t?.in).getHours()}(e);getMinutes=e=>function(e,t){return RO(e,t?.in).getMinutes()}(e);getSeconds=e=>function(e){return RO(e).getSeconds()}(e);getMilliseconds=e=>function(e){return RO(e).getMilliseconds()}(e);setYear=(e,t)=>function(e,t,n){const r=RO(e,n?.in);return isNaN(+r)?CO(e,NaN):(r.setFullYear(t),r)}(e,t);setMonth=(e,t)=>function(e,t,n){const r=RO(e,n?.in),i=r.getFullYear(),o=r.getDate(),s=CO(e,0);s.setFullYear(i,t,15),s.setHours(0,0,0,0);const a=PA(s);return r.setMonth(t,Math.min(o,a)),r}(e,t);setDate=(e,t)=>function(e,t,n){const r=RO(e,n?.in);return r.setDate(t),r}(e,t);setHours=(e,t)=>function(e,t,n){const r=RO(e,n?.in);return r.setHours(t),r}(e,t);setMinutes=(e,t)=>function(e,t,n){const r=RO(e,n?.in);return r.setMinutes(t),r}(e,t);setSeconds=(e,t)=>function(e,t,n){const r=RO(e,n?.in);return r.setSeconds(t),r}(e,t);setMilliseconds=(e,t)=>function(e,t,n){const r=RO(e,n?.in);return r.setMilliseconds(t),r}(e,t);getDaysInMonth=e=>PA(e);getWeekArray=e=>{const t=this.startOfWeek(this.startOfMonth(e)),n=this.endOfWeek(this.endOfMonth(e));let r=0,i=t;const o=[];for(;this.isBefore(i,n);){const e=Math.floor(r/7);o[e]=o[e]||[],o[e].push(i),i=this.addDays(i,1),r+=1}return o};getWeekNumber=e=>rA(e,{locale:this.locale});getYearRange=([e,t])=>{const n=this.startOfYear(e),r=this.endOfYear(t),i=[];let o=n;for(;this.isBefore(o,r);)i.push(o),o=this.addYears(o,1);return i}}function zC(e,t){if(void 0!==e.one&&1===t)return e.one;const n=t%10,r=t%100;return 1===n&&11!==r?e.singularNominative.replace("{{count}}",String(t)):n>=2&&n<=4&&(r<10||r>20)?e.singularGenitive.replace("{{count}}",String(t)):e.pluralGenitive.replace("{{count}}",String(t))}function FC(e){return(t,n)=>n?.addSuffix?n.comparison&&n.comparison>0?e.future?zC(e.future,t):"через "+zC(e.regular,t):e.past?zC(e.past,t):zC(e.regular,t)+" назад":zC(e.regular,t)}const LC={lessThanXSeconds:FC({regular:{one:"меньше секунды",singularNominative:"меньше {{count}} секунды",singularGenitive:"меньше {{count}} секунд",pluralGenitive:"меньше {{count}} секунд"},future:{one:"меньше, чем через секунду",singularNominative:"меньше, чем через {{count}} секунду",singularGenitive:"меньше, чем через {{count}} секунды",pluralGenitive:"меньше, чем через {{count}} секунд"}}),xSeconds:FC({regular:{singularNominative:"{{count}} секунда",singularGenitive:"{{count}} секунды",pluralGenitive:"{{count}} секунд"},past:{singularNominative:"{{count}} секунду назад",singularGenitive:"{{count}} секунды назад",pluralGenitive:"{{count}} секунд назад"},future:{singularNominative:"через {{count}} секунду",singularGenitive:"через {{count}} секунды",pluralGenitive:"через {{count}} секунд"}}),halfAMinute:(e,t)=>t?.addSuffix?t.comparison&&t.comparison>0?"через полминуты":"полминуты назад":"полминуты",lessThanXMinutes:FC({regular:{one:"меньше минуты",singularNominative:"меньше {{count}} минуты",singularGenitive:"меньше {{count}} минут",pluralGenitive:"меньше {{count}} минут"},future:{one:"меньше, чем через минуту",singularNominative:"меньше, чем через {{count}} минуту",singularGenitive:"меньше, чем через {{count}} минуты",pluralGenitive:"меньше, чем через {{count}} минут"}}),xMinutes:FC({regular:{singularNominative:"{{count}} минута",singularGenitive:"{{count}} минуты",pluralGenitive:"{{count}} минут"},past:{singularNominative:"{{count}} минуту назад",singularGenitive:"{{count}} минуты назад",pluralGenitive:"{{count}} минут назад"},future:{singularNominative:"через {{count}} минуту",singularGenitive:"через {{count}} минуты",pluralGenitive:"через {{count}} минут"}}),aboutXHours:FC({regular:{singularNominative:"около {{count}} часа",singularGenitive:"около {{count}} часов",pluralGenitive:"около {{count}} часов"},future:{singularNominative:"приблизительно через {{count}} час",singularGenitive:"приблизительно через {{count}} часа",pluralGenitive:"приблизительно через {{count}} часов"}}),xHours:FC({regular:{singularNominative:"{{count}} час",singularGenitive:"{{count}} часа",pluralGenitive:"{{count}} часов"}}),xDays:FC({regular:{singularNominative:"{{count}} день",singularGenitive:"{{count}} дня",pluralGenitive:"{{count}} дней"}}),aboutXWeeks:FC({regular:{singularNominative:"около {{count}} недели",singularGenitive:"около {{count}} недель",pluralGenitive:"около {{count}} недель"},future:{singularNominative:"приблизительно через {{count}} неделю",singularGenitive:"приблизительно через {{count}} недели",pluralGenitive:"приблизительно через {{count}} недель"}}),xWeeks:FC({regular:{singularNominative:"{{count}} неделя",singularGenitive:"{{count}} недели",pluralGenitive:"{{count}} недель"}}),aboutXMonths:FC({regular:{singularNominative:"около {{count}} месяца",singularGenitive:"около {{count}} месяцев",pluralGenitive:"около {{count}} месяцев"},future:{singularNominative:"приблизительно через {{count}} месяц",singularGenitive:"приблизительно через {{count}} месяца",pluralGenitive:"приблизительно через {{count}} месяцев"}}),xMonths:FC({regular:{singularNominative:"{{count}} месяц",singularGenitive:"{{count}} месяца",pluralGenitive:"{{count}} месяцев"}}),aboutXYears:FC({regular:{singularNominative:"около {{count}} года",singularGenitive:"около {{count}} лет",pluralGenitive:"около {{count}} лет"},future:{singularNominative:"приблизительно через {{count}} год",singularGenitive:"приблизительно через {{count}} года",pluralGenitive:"приблизительно через {{count}} лет"}}),xYears:FC({regular:{singularNominative:"{{count}} год",singularGenitive:"{{count}} года",pluralGenitive:"{{count}} лет"}}),overXYears:FC({regular:{singularNominative:"больше {{count}} года",singularGenitive:"больше {{count}} лет",pluralGenitive:"больше {{count}} лет"},future:{singularNominative:"больше, чем через {{count}} год",singularGenitive:"больше, чем через {{count}} года",pluralGenitive:"больше, чем через {{count}} лет"}}),almostXYears:FC({regular:{singularNominative:"почти {{count}} год",singularGenitive:"почти {{count}} года",pluralGenitive:"почти {{count}} лет"},future:{singularNominative:"почти через {{count}} год",singularGenitive:"почти через {{count}} года",pluralGenitive:"почти через {{count}} лет"}})},jC={date:jO({formats:{full:"EEEE, d MMMM y 'г.'",long:"d MMMM y 'г.'",medium:"d MMM y 'г.'",short:"dd.MM.y"},defaultWidth:"full"}),time:jO({formats:{full:"H:mm:ss zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},defaultWidth:"full"}),dateTime:jO({formats:{any:"{{date}}, {{time}}"},defaultWidth:"any"})};function $C(e,t,n){const[r,i]=YO(n?.in,e,t);return+JO(r,n)===+JO(i,n)}const BC=["воскресенье","понедельник","вторник","среду","четверг","пятницу","субботу"];function VC(e){const t=BC[e];return 2===e?"'во "+t+" в' p":"'в "+t+" в' p"}const UC={lastWeek:(e,t,n)=>{const r=e.getDay();return $C(e,t,n)?VC(r):function(e){const t=BC[e];switch(e){case 0:return"'в прошлое "+t+" в' p";case 1:case 2:case 4:return"'в прошлый "+t+" в' p";case 3:case 5:case 6:return"'в прошлую "+t+" в' p"}}(r)},yesterday:"'вчера в' p",today:"'сегодня в' p",tomorrow:"'завтра в' p",nextWeek:(e,t,n)=>{const r=e.getDay();return $C(e,t,n)?VC(r):function(e){const t=BC[e];switch(e){case 0:return"'в следующее "+t+" в' p";case 1:case 2:case 4:return"'в следующий "+t+" в' p";case 3:case 5:case 6:return"'в следующую "+t+" в' p"}}(r)},other:"P"},WC={ordinalNumber:(e,t)=>{const n=Number(e),r=t?.unit;let i;return i="date"===r?"-е":"week"===r||"minute"===r||"second"===r?"-я":"-й",n+i},era:VO({values:{narrow:["до н.э.","н.э."],abbreviated:["до н. э.","н. э."],wide:["до нашей эры","нашей эры"]},defaultWidth:"wide"}),quarter:VO({values:{narrow:["1","2","3","4"],abbreviated:["1-й кв.","2-й кв.","3-й кв.","4-й кв."],wide:["1-й квартал","2-й квартал","3-й квартал","4-й квартал"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:VO({values:{narrow:["Я","Ф","М","А","М","И","И","А","С","О","Н","Д"],abbreviated:["янв.","фев.","март","апр.","май","июнь","июль","авг.","сент.","окт.","нояб.","дек."],wide:["январь","февраль","март","апрель","май","июнь","июль","август","сентябрь","октябрь","ноябрь","декабрь"]},defaultWidth:"wide",formattingValues:{narrow:["Я","Ф","М","А","М","И","И","А","С","О","Н","Д"],abbreviated:["янв.","фев.","мар.","апр.","мая","июн.","июл.","авг.","сент.","окт.","нояб.","дек."],wide:["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"]},defaultFormattingWidth:"wide"}),day:VO({values:{narrow:["В","П","В","С","Ч","П","С"],short:["вс","пн","вт","ср","чт","пт","сб"],abbreviated:["вск","пнд","втр","срд","чтв","птн","суб"],wide:["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"]},defaultWidth:"wide"}),dayPeriod:VO({values:{narrow:{am:"ДП",pm:"ПП",midnight:"полн.",noon:"полд.",morning:"утро",afternoon:"день",evening:"веч.",night:"ночь"},abbreviated:{am:"ДП",pm:"ПП",midnight:"полн.",noon:"полд.",morning:"утро",afternoon:"день",evening:"веч.",night:"ночь"},wide:{am:"ДП",pm:"ПП",midnight:"полночь",noon:"полдень",morning:"утро",afternoon:"день",evening:"вечер",night:"ночь"}},defaultWidth:"any",formattingValues:{narrow:{am:"ДП",pm:"ПП",midnight:"полн.",noon:"полд.",morning:"утра",afternoon:"дня",evening:"веч.",night:"ночи"},abbreviated:{am:"ДП",pm:"ПП",midnight:"полн.",noon:"полд.",morning:"утра",afternoon:"дня",evening:"веч.",night:"ночи"},wide:{am:"ДП",pm:"ПП",midnight:"полночь",noon:"полдень",morning:"утра",afternoon:"дня",evening:"вечера",night:"ночи"}},defaultFormattingWidth:"wide"})},qC={code:"ru",formatDistance:(e,t,n)=>LC[e](t,n),formatLong:jC,formatRelative:(e,t,n,r)=>{const i=UC[e];return"function"==typeof i?i(t,n,r):i},localize:WC,match:{ordinalNumber:qO({matchPattern:/^(\d+)(-?(е|я|й|ое|ье|ая|ья|ый|ой|ий|ый))?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:WO({matchPatterns:{narrow:/^((до )?н\.?\s?э\.?)/i,abbreviated:/^((до )?н\.?\s?э\.?)/i,wide:/^(до нашей эры|нашей эры|наша эра)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^д/i,/^н/i]},defaultParseWidth:"any"}),quarter:WO({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^[1234](-?[ыои]?й?)? кв.?/i,wide:/^[1234](-?[ыои]?й?)? квартал/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:WO({matchPatterns:{narrow:/^[яфмаисонд]/i,abbreviated:/^(янв|фев|март?|апр|ма[йя]|июн[ья]?|июл[ья]?|авг|сент?|окт|нояб?|дек)\.?/i,wide:/^(январ[ья]|феврал[ья]|марта?|апрел[ья]|ма[йя]|июн[ья]|июл[ья]|августа?|сентябр[ья]|октябр[ья]|октябр[ья]|ноябр[ья]|декабр[ья])/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^я/i,/^ф/i,/^м/i,/^а/i,/^м/i,/^и/i,/^и/i,/^а/i,/^с/i,/^о/i,/^н/i,/^я/i],any:[/^я/i,/^ф/i,/^мар/i,/^ап/i,/^ма[йя]/i,/^июн/i,/^июл/i,/^ав/i,/^с/i,/^о/i,/^н/i,/^д/i]},defaultParseWidth:"any"}),day:WO({matchPatterns:{narrow:/^[впсч]/i,short:/^(вс|во|пн|по|вт|ср|чт|че|пт|пя|сб|су)\.?/i,abbreviated:/^(вск|вос|пнд|пон|втр|вто|срд|сре|чтв|чет|птн|пят|суб).?/i,wide:/^(воскресень[ея]|понедельника?|вторника?|сред[аы]|четверга?|пятниц[аы]|суббот[аы])/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^в/i,/^п/i,/^в/i,/^с/i,/^ч/i,/^п/i,/^с/i],any:[/^в[ос]/i,/^п[он]/i,/^в/i,/^ср/i,/^ч/i,/^п[ят]/i,/^с[уб]/i]},defaultParseWidth:"any"}),dayPeriod:WO({matchPatterns:{narrow:/^([дп]п|полн\.?|полд\.?|утр[оа]|день|дня|веч\.?|ноч[ьи])/i,abbreviated:/^([дп]п|полн\.?|полд\.?|утр[оа]|день|дня|веч\.?|ноч[ьи])/i,wide:/^([дп]п|полночь|полдень|утр[оа]|день|дня|вечера?|ноч[ьи])/i},defaultMatchWidth:"wide",parsePatterns:{any:{am:/^дп/i,pm:/^пп/i,midnight:/^полн/i,noon:/^полд/i,morning:/^у/i,afternoon:/^д[ен]/i,evening:/^в/i,night:/^н/i}},defaultParseWidth:"any"})},options:{weekStartsOn:1,firstWeekContainsDate:1}},GC=t=>e(TO,{...t,dateAdapter:IC,adapterLocale:qC});function HC(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=HC(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function YC(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=HC(e))&&(r&&(r+=" "),r+=t);return r}let KC={data:""},XC=e=>{if("object"==typeof window){let t=(e?e.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return t.nonce=window.__nonce__,t.parentNode||(e||document.head).appendChild(t),t.firstChild}return e||KC},ZC=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,JC=/\/\*[^]*?\*\/| +/g,QC=/\n+/g,eR=(e,t)=>{let n="",r="",i="";for(let o in e){let s=e[o];"@"==o[0]?"i"==o[1]?n=o+" "+s+";":r+="f"==o[1]?eR(s,o):o+"{"+eR(s,"k"==o[1]?"":t)+"}":"object"==typeof s?r+=eR(s,t?t.replace(/([^,])+/g,e=>o.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,t=>/&/.test(t)?t.replace(/&/g,e):e?e+" "+t:t)):o):null!=s&&(o=/^--/.test(o)?o:o.replace(/[A-Z]/g,"-$&").toLowerCase(),i+=eR.p?eR.p(o,s):o+":"+s+";")}return n+(t&&i?t+"{"+i+"}":i)+r},tR={},nR=e=>{if("object"==typeof e){let t="";for(let n in e)t+=n+nR(e[n]);return t}return e},rR=(e,t,n,r,i)=>{let o=nR(e),s=tR[o]||(tR[o]=(e=>{let t=0,n=11;for(;t<e.length;)n=101*n+e.charCodeAt(t++)>>>0;return"go"+n})(o));if(!tR[s]){let t=o!==e?e:(e=>{let t,n,r=[{}];for(;t=ZC.exec(e.replace(JC,""));)t[4]?r.shift():t[3]?(n=t[3].replace(QC," ").trim(),r.unshift(r[0][n]=r[0][n]||{})):r[0][t[1]]=t[2].replace(QC," ").trim();return r[0]})(e);tR[s]=eR(i?{["@keyframes "+s]:t}:t,n?"":"."+s)}let a=n&&tR.g?tR.g:null;return n&&(tR.g=tR[s]),((e,t,n,r)=>{r?t.data=t.data.replace(r,e):-1===t.data.indexOf(e)&&(t.data=n?e+t.data:t.data+e)})(tR[s],t,r,a),s};function iR(e){let t=this||{},n=e.call?e(t.p):e;return rR(n.unshift?n.raw?((e,t,n)=>e.reduce((e,r,i)=>{let o=t[i];if(o&&o.call){let e=o(n),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;o=t?"."+t:e&&"object"==typeof e?e.props?"":eR(e,""):!1===e?"":e}return e+r+(null==o?"":o)},""))(n,[].slice.call(arguments,1),t.p):n.reduce((e,n)=>Object.assign(e,n&&n.call?n(t.p):n),{}):n,XC(t.target),t.g,t.o,t.k)}function oR(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function sR(){return sR=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},sR.apply(this,arguments)}function aR(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function lR(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}function uR(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}iR.bind({g:1}),iR.bind({k:1});var cR=function(){return""},dR=r.createContext({enqueueSnackbar:cR,closeSnackbar:cR}),hR="@media (max-width:599.95px)",pR="@media (min-width:600px)",fR=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},mR=function(e){return""+fR(e.vertical)+fR(e.horizontal)},gR=function(e){return!!e||0===e},yR="unmounted",bR="exited",vR="entering",_R="entered",xR="exiting",wR=function(e){function t(t){var n;n=e.call(this,t)||this;var r,i=t.appear;return n.appearStatus=null,t.in?i?(r=bR,n.appearStatus=vR):r=_R:r=t.unmountOnExit||t.mountOnEnter?yR:bR,n.state={status:r},n.nextCallback=null,n}aR(t,e),t.getDerivedStateFromProps=function(e,t){return e.in&&t.status===yR?{status:bR}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(e){var t=null;if(e!==this.props){var n=this.state.status;this.props.in?n!==vR&&n!==_R&&(t=vR):n!==vR&&n!==_R||(t=xR)}this.updateStatus(!1,t)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var e=this.props.timeout,t=e,n=e;return null!=e&&"number"!=typeof e&&"string"!=typeof e&&(n=e.exit,t=e.enter),{exit:n,enter:t}},n.updateStatus=function(e,t){void 0===e&&(e=!1),null!==t?(this.cancelNextCallback(),t===vR?this.performEnter(e):this.performExit()):this.props.unmountOnExit&&this.state.status===bR&&this.setState({status:yR})},n.performEnter=function(e){var t=this,n=this.props.enter,r=e,i=this.getTimeouts();e||n?(this.props.onEnter&&this.props.onEnter(this.node,r),this.safeSetState({status:vR},function(){t.props.onEntering&&t.props.onEntering(t.node,r),t.onTransitionEnd(i.enter,function(){t.safeSetState({status:_R},function(){t.props.onEntered&&t.props.onEntered(t.node,r)})})})):this.safeSetState({status:_R},function(){t.props.onEntered&&t.props.onEntered(t.node,r)})},n.performExit=function(){var e=this,t=this.props.exit,n=this.getTimeouts();t?(this.props.onExit&&this.props.onExit(this.node),this.safeSetState({status:xR},function(){e.props.onExiting&&e.props.onExiting(e.node),e.onTransitionEnd(n.exit,function(){e.safeSetState({status:bR},function(){e.props.onExited&&e.props.onExited(e.node)})})})):this.safeSetState({status:bR},function(){e.props.onExited&&e.props.onExited(e.node)})},n.cancelNextCallback=function(){null!==this.nextCallback&&this.nextCallback.cancel&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},n.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(){n&&(n=!1,t.nextCallback=null,e())},this.nextCallback.cancel=function(){n=!1},this.nextCallback},n.onTransitionEnd=function(e,t){this.setNextCallback(t);var n=null==e&&!this.props.addEndListener;this.node&&!n?(this.props.addEndListener&&this.props.addEndListener(this.node,this.nextCallback),null!=e&&setTimeout(this.nextCallback,e)):setTimeout(this.nextCallback,0)},n.render=function(){var e=this.state.status;if(e===yR)return null;var t=this.props;return(0,t.children)(e,lR(t,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]))},oR(t,[{key:"node",get:function(){var e,t=null===(e=this.props.nodeRef)||void 0===e?void 0:e.current;if(!t)throw new Error("notistack - Custom snackbar is not refForwarding");return t}}]),t}(r.Component);function ER(){}function SR(e,t){"function"==typeof e?e(t):e&&(e.current=t)}function TR(e,t){return f(function(){return null==e&&null==t?null:function(n){SR(e,n),SR(t,n)}},[e,t])}function kR(e){var t=e.timeout,n=e.style,r=void 0===n?{}:n,i=e.mode;return{duration:"object"==typeof t?t[i]||0:t,easing:r.transitionTimingFunction,delay:r.transitionDelay}}wR.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:ER,onEntering:ER,onEntered:ER,onExit:ER,onExiting:ER,onExited:ER};var OR="cubic-bezier(0.4, 0, 0.2, 1)",AR="cubic-bezier(0.0, 0, 0.2, 1)",CR="cubic-bezier(0.4, 0, 0.6, 1)",RR=function(e){e.scrollTop=e.scrollTop},NR=function(e){return Math.round(e)+"ms"};function PR(e,t){void 0===e&&(e=["all"]);var n=t||{},r=n.duration,i=void 0===r?300:r,o=n.easing,s=void 0===o?OR:o,a=n.delay,l=void 0===a?0:a;return(Array.isArray(e)?e:[e]).map(function(e){var t="string"==typeof i?i:NR(i),n="string"==typeof l?l:NR(l);return e+" "+t+" "+s+" "+n}).join(",")}function MR(e){var t=function(e){return e&&e.ownerDocument||document}(e);return t.defaultView||window}function DR(e,t){if(t){var n=function(e,t){var n,r=t.getBoundingClientRect(),i=MR(t);if(t.fakeTransform)n=t.fakeTransform;else{var o=i.getComputedStyle(t);n=o.getPropertyValue("-webkit-transform")||o.getPropertyValue("transform")}var s=0,a=0;if(n&&"none"!==n&&"string"==typeof n){var l=n.split("(")[1].split(")")[0].split(",");s=parseInt(l[4],10),a=parseInt(l[5],10)}switch(e){case"left":return"translateX("+(i.innerWidth+s-r.left)+"px)";case"right":return"translateX(-"+(r.left+r.width-s)+"px)";case"up":return"translateY("+(i.innerHeight+a-r.top)+"px)";default:return"translateY(-"+(r.top+r.height-a)+"px)"}}(e,t);n&&(t.style.webkitTransform=n,t.style.transform=n)}}var IR=i(function(e,t){var n=e.children,r=e.direction,i=void 0===r?"down":r,o=e.in,s=e.style,l=e.timeout,u=void 0===l?0:l,c=e.onEnter,d=e.onEntered,f=e.onExit,g=e.onExited,y=lR(e,["children","direction","in","style","timeout","onEnter","onEntered","onExit","onExited"]),b=p(null),_=TR(n.ref,b),x=TR(_,t),w=m(function(){b.current&&DR(i,b.current)},[i]);return h(function(){if(!o&&"down"!==i&&"right"!==i){var e=function(e,t){var n;function r(){for(var r=this,i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];clearTimeout(n),n=setTimeout(function(){e.apply(r,o)},t)}return void 0===t&&(t=166),r.clear=function(){clearTimeout(n)},r}(function(){b.current&&DR(i,b.current)}),t=MR(b.current);return t.addEventListener("resize",e),function(){e.clear(),t.removeEventListener("resize",e)}}},[i,o]),h(function(){o||w()},[o,w]),v(wR,Object.assign({appear:!0,nodeRef:b,onEnter:function(e,t){DR(i,e),RR(e),c&&c(e,t)},onEntered:d,onEntering:function(e){var t=(null==s?void 0:s.transitionTimingFunction)||AR,n=kR({timeout:u,mode:"enter",style:sR({},s,{transitionTimingFunction:t})});e.style.webkitTransition=PR("-webkit-transform",n),e.style.transition=PR("transform",n),e.style.webkitTransform="none",e.style.transform="none"},onExit:function(e){var t=(null==s?void 0:s.transitionTimingFunction)||CR,n=kR({timeout:u,mode:"exit",style:sR({},s,{transitionTimingFunction:t})});e.style.webkitTransition=PR("-webkit-transform",n),e.style.transition=PR("transform",n),DR(i,e),f&&f(e)},onExited:function(e){e.style.webkitTransition="",e.style.transition="",g&&g(e)},in:o,timeout:u},y),function(e,t){return a(n,sR({ref:x,style:sR({visibility:"exited"!==e||o?void 0:"hidden"},s,{},n.props.style)},t))})});IR.displayName="Slide";var zR=function(e){return r.createElement("svg",Object.assign({viewBox:"0 0 24 24",focusable:"false",style:{fontSize:20,marginInlineEnd:8,userSelect:"none",width:"1em",height:"1em",display:"inline-block",fill:"currentColor",flexShrink:0}},e))},FR=function(){return r.createElement(zR,null,r.createElement("path",{d:"M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M10 17L5 12L6.41\n 10.59L10 14.17L17.59 6.58L19 8L10 17Z"}))},LR=function(){return r.createElement(zR,null,r.createElement("path",{d:"M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z"}))},jR=function(){return r.createElement(zR,null,r.createElement("path",{d:"M12,2C17.53,2 22,6.47 22,12C22,17.53 17.53,22 12,22C6.47,22 2,17.53 2,12C2,\n 6.47 6.47,2 12,2M15.59,7L12,10.59L8.41,7L7,8.41L10.59,12L7,15.59L8.41,17L12,\n 13.41L15.59,17L17,15.59L13.41,12L17,8.41L15.59,7Z"}))},$R=function(){return r.createElement(zR,null,r.createElement("path",{d:"M13,9H11V7H13M13,17H11V11H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,\n 0 22,12A10,10 0 0,0 12,2Z"}))},BR={maxSnack:3,persist:!1,hideIconVariant:!1,disableWindowBlurListener:!1,variant:"default",autoHideDuration:5e3,iconVariant:{default:void 0,success:r.createElement(FR,null),warning:r.createElement(LR,null),error:r.createElement(jR,null),info:r.createElement($R,null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},TransitionComponent:IR,transitionDuration:{enter:225,exit:195}},VR=function(e,t){return function(n,r){return void 0===r&&(r=!1),r?sR({},BR[n],{},t[n],{},e[n]):"autoHideDuration"===n?(i=e.autoHideDuration,o=t.autoHideDuration,(s=function(e){return"number"==typeof e||null===e})(i)?i:s(o)?o:BR.autoHideDuration):"transitionDuration"===n?function(e,t){var n=function(e,t){return t.some(function(t){return typeof e===t})};return n(e,["string","number"])?e:n(e,["object"])?sR({},BR.transitionDuration,{},n(t,["object"])&&t,{},e):n(t,["string","number"])?t:n(t,["object"])?sR({},BR.transitionDuration,{},t):BR.transitionDuration}(e.transitionDuration,t.transitionDuration):e[n]||t[n]||BR[n];var i,o,s}};function UR(e){return Object.entries(e).reduce(function(e,t){var n,r=t[0],i=t[1];return sR({},e,((n={})[r]=iR(i),n))},{})}var WR="notistack-SnackbarContainer",qR="notistack-Snackbar",GR="notistack-CollapseWrapper",HR="notistack-MuiContent",YR=function(e){return"notistack-MuiContent-"+e},KR=UR({root:{height:0},entered:{height:"auto"}}),XR="0px",ZR=i(function(e,t){var n=e.children,r=e.in,i=e.onExited,o=p(null),s=p(null),a=TR(t,s),l=function(){return o.current?o.current.clientHeight:0};return v(wR,{in:r,unmountOnExit:!0,onEnter:function(e){e.style.height=XR},onEntered:function(e){e.style.height="auto"},onEntering:function(e){var t=l(),n=kR({timeout:175,mode:"enter"}),r=n.duration,i=n.easing;e.style.transitionDuration="string"==typeof r?r:r+"ms",e.style.height=t+"px",e.style.transitionTimingFunction=i||""},onExit:function(e){e.style.height=l()+"px"},onExited:i,onExiting:function(e){RR(e);var t=kR({timeout:175,mode:"exit"}),n=t.duration,r=t.easing;e.style.transitionDuration="string"==typeof n?n:n+"ms",e.style.height=XR,e.style.transitionTimingFunction=r||""},nodeRef:s,timeout:175},function(e,t){return v("div",Object.assign({ref:a,className:YC(KR.root,"entered"===e&&KR.entered),style:sR({pointerEvents:"all",overflow:"hidden",minHeight:XR,transition:PR("height")},"entered"===e&&{overflow:"visible"},{},"exited"===e&&!r&&{visibility:"hidden"})},t),v("div",{ref:o,className:GR,style:{display:"flex",width:"100%"}},n))})});ZR.displayName="Collapse";var JR={right:"left",left:"right",bottom:"up",top:"down"},QR=function(e){return"anchorOrigin"+mR(e)},eN=function(){};function tN(e,t){return e.reduce(function(e,n){return null==n?e:function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];var s=[].concat(i);t&&-1===s.indexOf(t)&&s.push(t),e.apply(this,s),n.apply(this,s)}},eN)}var nN="undefined"!=typeof window?d:h;function rN(e){var t=p(e);return nN(function(){t.current=e}),m(function(){return t.current.apply(void 0,arguments)},[])}var iN,oN=i(function(e,t){var n=e.children,r=e.className,i=e.autoHideDuration,o=e.disableWindowBlurListener,s=void 0!==o&&o,a=e.onClose,l=e.id,u=e.open,c=e.SnackbarProps,d=void 0===c?{}:c,f=p(),g=rN(function(){a&&a.apply(void 0,arguments)}),y=rN(function(e){a&&null!=e&&(f.current&&clearTimeout(f.current),f.current=setTimeout(function(){g(null,"timeout",l)},e))});h(function(){return u&&y(i),function(){f.current&&clearTimeout(f.current)}},[u,i,y]);var b=function(){f.current&&clearTimeout(f.current)},_=m(function(){null!=i&&y(.5*i)},[i,y]);return h(function(){if(!s&&u)return window.addEventListener("focus",_),window.addEventListener("blur",b),function(){window.removeEventListener("focus",_),window.removeEventListener("blur",b)}},[s,_,u]),v("div",Object.assign({ref:t},d,{className:YC(qR,r),onMouseEnter:function(e){d.onMouseEnter&&d.onMouseEnter(e),b()},onMouseLeave:function(e){d.onMouseLeave&&d.onMouseLeave(e),_()}}),n)});oN.displayName="Snackbar";var sN=UR({root:(iN={display:"flex",flexWrap:"wrap",flexGrow:1},iN[pR]={flexGrow:"initial",minWidth:"288px"},iN)}),aN=i(function(e,t){var n=e.className,i=lR(e,["className"]);return r.createElement("div",Object.assign({ref:t,className:YC(sN.root,n)},i))});aN.displayName="SnackbarContent";var lN=UR({root:{backgroundColor:"#313131",fontSize:"0.875rem",lineHeight:1.43,letterSpacing:"0.01071em",color:"#fff",alignItems:"center",padding:"6px 16px",borderRadius:"4px",boxShadow:"0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)"},lessPadding:{paddingLeft:"20px"},default:{backgroundColor:"#313131"},success:{backgroundColor:"#43a047"},error:{backgroundColor:"#d32f2f"},warning:{backgroundColor:"#ff9800"},info:{backgroundColor:"#2196f3"},message:{display:"flex",alignItems:"center",padding:"8px 0"},action:{display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:"16px",marginRight:"-8px"}}),uN="notistack-snackbar",cN=i(function(e,t){var n=e.id,i=e.message,o=e.action,s=e.iconVariant,a=e.variant,l=e.hideIconVariant,u=e.style,c=e.className,d=s[a],h=o;return"function"==typeof h&&(h=h(n)),r.createElement(aN,{ref:t,role:"alert","aria-describedby":uN,style:u,className:YC(HR,YR(a),lN.root,lN[a],c,!l&&d&&lN.lessPadding)},r.createElement("div",{id:uN,className:lN.message},l?null:d,i),h&&r.createElement("div",{className:lN.action},h))});cN.displayName="MaterialDesignContent";var dN,hN,pN,fN,mN,gN=c(cN),yN=UR({wrappedRoot:{width:"100%",position:"relative",transform:"translateX(0)",top:0,right:0,bottom:0,left:0,minWidth:"288px"}}),bN=function(e){var t=p(),n=u(!0),i=n[0],o=n[1],s=tN([e.snack.onClose,e.onClose]),a=m(function(){t.current=setTimeout(function(){o(function(e){return!e})},125)},[]);h(function(){return function(){t.current&&clearTimeout(t.current)}},[]);var l,c=e.snack,d=e.classes,g=e.Component,y=void 0===g?gN:g,b=f(function(){return function(e){void 0===e&&(e={});var t={containerRoot:!0,containerAnchorOriginTopCenter:!0,containerAnchorOriginBottomCenter:!0,containerAnchorOriginTopRight:!0,containerAnchorOriginBottomRight:!0,containerAnchorOriginTopLeft:!0,containerAnchorOriginBottomLeft:!0};return Object.keys(e).filter(function(e){return!t[e]}).reduce(function(t,n){var r;return sR({},t,((r={})[n]=e[n],r))},{})}(d)},[d]),v=c.open,_=c.SnackbarProps,x=c.TransitionComponent,w=c.TransitionProps,E=c.transitionDuration,S=c.disableWindowBlurListener,T=c.content,k=lR(c,["open","SnackbarProps","TransitionComponent","TransitionProps","transitionDuration","disableWindowBlurListener","content","entered","requestClose","onEnter","onEntered","onExit","onExited"]),O=sR({direction:(l=k.anchorOrigin,"center"!==l.horizontal?JR[l.horizontal]:JR[l.vertical]),timeout:E},w),A=T;"function"==typeof A&&(A=A(k.id,k.message));var C=["onEnter","onEntered","onExit","onExited"].reduce(function(t,n){var r;return sR({},t,((r={})[n]=tN([e.snack[n],e[n]],k.id),r))},{});return r.createElement(ZR,{in:i,onExited:C.onExited},r.createElement(oN,{open:v,id:k.id,disableWindowBlurListener:S,autoHideDuration:k.autoHideDuration,className:YC(yN.wrappedRoot,b.root,b[QR(k.anchorOrigin)]),SnackbarProps:_,onClose:s},r.createElement(x,Object.assign({},O,{appear:!0,in:v,onExit:C.onExit,onExited:a,onEnter:C.onEnter,onEntered:tN([C.onEntered,function(){e.snack.requestClose&&s(null,"instructed",e.snack.id)}],k.id)}),A||r.createElement(y,Object.assign({},k)))))},vN={default:20},_N={default:6,dense:2},xN="."+GR,wN=UR({root:(dN={boxSizing:"border-box",display:"flex",maxHeight:"100%",position:"fixed",zIndex:1400,height:"auto",width:"auto",transition:PR(["top","right","bottom","left","max-width"],{duration:300,easing:"ease"}),pointerEvents:"none"},dN[xN]={padding:_N.default+"px 0px",transition:"padding 300ms ease 0ms"},dN.maxWidth="calc(100% - "+2*vN.default+"px)",dN[hR]={width:"100%",maxWidth:"calc(100% - 32px)"},dN),rootDense:(hN={},hN[xN]={padding:_N.dense+"px 0px"},hN),top:{top:vN.default-_N.default+"px",flexDirection:"column"},bottom:{bottom:vN.default-_N.default+"px",flexDirection:"column-reverse"},left:(pN={left:vN.default+"px"},pN[pR]={alignItems:"flex-start"},pN[hR]={left:"16px"},pN),right:(fN={right:vN.default+"px"},fN[pR]={alignItems:"flex-end"},fN[hR]={right:"16px"},fN),center:(mN={left:"50%",transform:"translateX(-50%)"},mN[pR]={alignItems:"center"},mN)}),EN=function(e){var t=e.classes,n=void 0===t?{}:t,i=e.anchorOrigin,o=e.dense,s=e.children,a=YC(WR,wN[i.vertical],wN[i.horizontal],wN.root,n.containerRoot,n["containerAnchorOrigin"+mR(i)],o&&wN.rootDense);return r.createElement("div",{className:a},s)},SN=c(EN),TN="production"!==process.env.NODE_ENV,kN={NO_PERSIST_ALL:"Reached maxSnack while all enqueued snackbars have 'persist' flag. Notistack will dismiss the oldest snackbar anyway to allow other ones in the queue to be presented."},ON=function(e){return!("string"==typeof e||s(e))},AN=function(e){function t(t){var n;return(n=e.call(this,t)||this).enqueueSnackbar=function(e,t){if(void 0===t&&(t={}),null==e)throw new Error("enqueueSnackbar called with invalid argument");var r=ON(e)?e:t,i=ON(e)?e.message:e,o=r.key,s=r.preventDuplicate,a=lR(r,["key","preventDuplicate"]),l=gR(o),u=l?o:(new Date).getTime()+Math.random(),c=VR(a,n.props),d=sR({id:u},a,{message:i,open:!0,entered:!1,requestClose:!1,persist:c("persist"),action:c("action"),content:c("content"),variant:c("variant"),anchorOrigin:c("anchorOrigin"),disableWindowBlurListener:c("disableWindowBlurListener"),autoHideDuration:c("autoHideDuration"),hideIconVariant:c("hideIconVariant"),TransitionComponent:c("TransitionComponent"),transitionDuration:c("transitionDuration"),TransitionProps:c("TransitionProps",!0),iconVariant:c("iconVariant",!0),style:c("style",!0),SnackbarProps:c("SnackbarProps",!0),className:YC(n.props.className,a.className)});return d.persist&&(d.autoHideDuration=void 0),n.setState(function(e){if(void 0===s&&n.props.preventDuplicate||s){var t=function(e){return l?e.id===u:e.message===i},r=e.queue.findIndex(t)>-1,o=e.snacks.findIndex(t)>-1;if(r||o)return e}return n.handleDisplaySnack(sR({},e,{queue:[].concat(e.queue,[d])}))}),u},n.handleDisplaySnack=function(e){return e.snacks.length>=n.maxSnack?n.handleDismissOldest(e):n.processQueue(e)},n.processQueue=function(e){var t=e.queue,n=e.snacks;return t.length>0?sR({},e,{snacks:[].concat(n,[t[0]]),queue:t.slice(1,t.length)}):e},n.handleDismissOldest=function(e){if(e.snacks.some(function(e){return!e.open||e.requestClose}))return e;var t=!1,r=!1;e.snacks.reduce(function(e,t){return e+(t.open&&t.persist?1:0)},0)===n.maxSnack&&("production"!==process.env.NODE_ENV&&function(e){if(TN){var t=kN[e];"undefined"!=typeof console&&console.error("WARNING - notistack: "+t);try{throw new Error(t)}catch(e){}}}("NO_PERSIST_ALL"),r=!0);var i=e.snacks.map(function(e){return t||e.persist&&!r?sR({},e):(t=!0,e.entered?(e.onClose&&e.onClose(null,"maxsnack",e.id),n.props.onClose&&n.props.onClose(null,"maxsnack",e.id),sR({},e,{open:!1})):sR({},e,{requestClose:!0}))});return sR({},e,{snacks:i})},n.handleEnteredSnack=function(e,t,r){if(!gR(r))throw new Error("handleEnteredSnack Cannot be called with undefined key");n.setState(function(e){return{snacks:e.snacks.map(function(e){return e.id===r?sR({},e,{entered:!0}):sR({},e)})}})},n.handleCloseSnack=function(e,t,r){n.props.onClose&&n.props.onClose(e,t,r);var i=void 0===r;n.setState(function(e){var t=e.snacks,n=e.queue;return{snacks:t.map(function(e){return i||e.id===r?e.entered?sR({},e,{open:!1}):sR({},e,{requestClose:!0}):sR({},e)}),queue:n.filter(function(e){return e.id!==r})}})},n.closeSnackbar=function(e){var t=n.state.snacks.find(function(t){return t.id===e});gR(e)&&t&&t.onClose&&t.onClose(null,"instructed",e),n.handleCloseSnack(null,"instructed",e)},n.handleExitedSnack=function(e,t){if(!gR(t))throw new Error("handleExitedSnack Cannot be called with undefined key");n.setState(function(e){var r=n.processQueue(sR({},e,{snacks:e.snacks.filter(function(e){return e.id!==t})}));return 0===r.queue.length?r:n.handleDismissOldest(r)})},n.enqueueSnackbar,n.closeSnackbar,n.state={snacks:[],queue:[],contextValue:{enqueueSnackbar:n.enqueueSnackbar.bind(uR(n)),closeSnackbar:n.closeSnackbar.bind(uR(n))}},n}return aR(t,e),t.prototype.render=function(){var e=this,t=this.state.contextValue,n=this.props,i=n.domRoot,o=n.children,s=n.dense,a=void 0!==s&&s,l=n.Components,u=void 0===l?{}:l,c=n.classes,d=this.state.snacks.reduce(function(e,t){var n,r=mR(t.anchorOrigin),i=e[r]||[];return sR({},e,((n={})[r]=[].concat(i,[t]),n))},{}),h=Object.keys(d).map(function(t){var n=d[t],i=n[0];return r.createElement(SN,{key:t,dense:a,anchorOrigin:i.anchorOrigin,classes:c},n.map(function(t){return r.createElement(bN,{key:t.id,snack:t,classes:c,Component:u[t.variant],onClose:e.handleCloseSnack,onEnter:e.props.onEnter,onExit:e.props.onExit,onExited:tN([e.handleExitedSnack,e.props.onExited],t.id),onEntered:tN([e.handleEnteredSnack,e.props.onEntered],t.id)})}))});return r.createElement(dR.Provider,{value:t},o,i?S(h,i):h)},oR(t,[{key:"maxSnack",get:function(){return this.props.maxSnack||BR.maxSnack}}]),t}(_);const CN=({children:t,configOptions:r})=>{const[i,o]=n.useState(null),[s,a]=n.useState("");return n.useEffect(()=>(PT.initialize({...r,onCheck:e=>{const{valid:t,reason:n}=e;a(n),o(t),r.onCheck?.(e)}}),()=>{PT.deactivate()}),[r]),null===i?e(Rk,{color:"primary"}):i?e(n.Fragment,{children:t}):e(dl,{color:"error",children:s})},RN=({children:t,themeOptions:n})=>{const r=us(n);return e(ws,{theme:r,children:t})},NN=({children:t,configOptions:n,themeOptions:r})=>e(AN,{children:e(wO,{children:e(AT,{children:e(RN,{themeOptions:r,children:e(GC,{children:e(CN,{configOptions:n,children:t})})})})})}),PN=()=>{const{enqueueSnackbar:e}=o(dR);return({variant:t,message:n})=>{e({variant:t,message:n,anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:3e3,hideIconVariant:!0})}},MN=()=>{const e=PN();return t=>{const{response:n}=t;if(n){const{data:t}=n;if(t){const{detail:n}=t;n&&n.forEach(t=>{e({variant:"error",message:t})})}}}},DN=e=>{const t=(new Date).getUTCHours();return encodeURIComponent([...e].reduce((n,r,i)=>{const o=(e.charCodeAt(i)-32+t)%95+32;return n+String.fromCharCode(o)},""))},IN=()=>_O({mutationKey:["sign-in"],mutationFn:({body:{username:e,password:t}})=>{const n={username:e,password:DN(t)},r=Object.keys(n).reduce((e,t,r)=>`${e}${0===r?"":"&"}${t}=${n[t]}`,"");return PT.instance.apiService.post({url:"token",body:r,config:{headers:{"Content-Type":"application/x-www-form-urlencoded"}}})}}),zN=()=>_O({mutationFn:async e=>await PT.instance.apiService.post({url:"logout"}),onError:MN(),onSuccess:()=>{xO.invalidateQueries({queryKey:["user"]})}}),FN=(e,t,n)=>{if(e&&"reportValidity"in e){const r=pv(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},LN=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?FN(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>FN(t,n,e))}},jN=(e,t)=>{t.shouldUseNativeValidation&&LN(e,t);const n={};for(const r in e){const i=pv(t.fields,r),o=Object.assign(e[r]||{},{ref:i&&i.ref});if($N(t.names||Object.keys(e),r)){const e=Object.assign({},pv(n,r));mv(e,"root",o),mv(n,r,e)}else mv(n,r,o)}return n},$N=(e,t)=>{const n=BN(t);return e.some(e=>BN(e).match(`^${n}\\.\\d+`))};function BN(e){return e.replace(/\]|\[/g,"")}function VN(e,t,n){return void 0===n&&(n={}),function(r,i,o){try{return Promise.resolve(function(s,a){try{var l=(null!=t&&t.context&&"development"===process.env.NODE_ENV&&console.warn("You should not used the yup options context. Please, use the 'useForm' context object instead"),Promise.resolve(e["sync"===n.mode?"validateSync":"validate"](r,Object.assign({abortEarly:!1},t,{context:i}))).then(function(e){return o.shouldUseNativeValidation&&LN({},o),{values:n.raw?Object.assign({},r):e,errors:{}}}))}catch(e){return a(e)}return l&&l.then?l.then(void 0,a):l}(0,function(e){if(!e.inner)throw e;return{values:{},errors:jN((t=e,n=!o.shouldUseNativeValidation&&"all"===o.criteriaMode,(t.inner||[]).reduce(function(e,t){if(e[t.path]||(e[t.path]={message:t.message,type:t.type}),n){var r=e[t.path].types,i=r&&r[t.type];e[t.path]=Vv(t.path,n,e,t.type,i?[].concat(i,t.message):t.message)}return e},{})),o)};var t,n}))}catch(e){return Promise.reject(e)}}}var UN,WN,qN=Zb(({children:t})=>e(Jc,{sx:{display:"flex",alignItems:"center",height:"100vh",width:"100vw",overflow:"hidden"},children:e(Jc,{sx:{margin:"auto",maxWidth:"400px",width:"100%"},children:e(Ck,{children:t})})}));var GN,HN,YN=function(){if(WN)return UN;function e(e){this._maxSize=e,this.clear()}WN=1,e.prototype.clear=function(){this._size=0,this._values=Object.create(null)},e.prototype.get=function(e){return this._values[e]},e.prototype.set=function(e,t){return this._size>=this._maxSize&&this.clear(),e in this._values||this._size++,this._values[e]=t};var t=/[^.^\]^[]+|(?=\[\]|\.\.)/g,n=/^\d+$/,r=/^\d/,i=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,o=/^\s*(['"]?)(.*?)(\1)\s*$/,s=new e(512),a=new e(512),l=new e(512);function u(e){return s.get(e)||s.set(e,c(e).map(function(e){return e.replace(o,"$2")}))}function c(e){return e.match(t)||[""]}function d(e){return"string"==typeof e&&e&&-1!==["'",'"'].indexOf(e.charAt(0))}function h(e){return!d(e)&&(function(e){return e.match(r)&&!e.match(n)}(e)||function(e){return i.test(e)}(e))}return UN={Cache:e,split:c,normalizePath:u,setter:function(e){var t=u(e);return a.get(e)||a.set(e,function(e,n){for(var r=0,i=t.length,o=e;r<i-1;){var s=t[r];if("__proto__"===s||"constructor"===s||"prototype"===s)return e;o=o[t[r++]]}o[t[r]]=n})},getter:function(e,t){var n=u(e);return l.get(e)||l.set(e,function(e){for(var r=0,i=n.length;r<i;){if(null==e&&t)return;e=e[n[r++]]}return e})},join:function(e){return e.reduce(function(e,t){return e+(d(t)||n.test(t)?"["+t+"]":(e?".":"")+t)},"")},forEach:function(e,t,n){!function(e,t,n){var r,i,o,s,a=e.length;for(i=0;i<a;i++)(r=e[i])&&(h(r)&&(r='"'+r+'"'),o=!(s=d(r))&&/^\d+$/.test(r),t.call(n,r,s,o,i,e))}(Array.isArray(e)?e:c(e),t,n)}},UN}();var KN,XN=function(){if(HN)return GN;HN=1;const e=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,t=t=>t.match(e)||[],n=e=>e[0].toUpperCase()+e.slice(1),r=(e,n)=>t(e).join(n).toLowerCase(),i=e=>t(e).reduce((e,t)=>`${e}${e?t[0].toUpperCase()+t.slice(1).toLowerCase():t.toLowerCase()}`,"");return GN={words:t,upperFirst:n,camelCase:i,pascalCase:e=>n(i(e)),snakeCase:e=>r(e,"_"),kebabCase:e=>r(e,"-"),sentenceCase:e=>n(r(e," ")),titleCase:e=>t(e).map(n).join(" ")}}(),ZN={exports:{}};var JN=function(){if(KN)return ZN.exports;function e(e,t){var n=e.length,r=new Array(n),i={},o=n,s=function(e){for(var t=new Map,n=0,r=e.length;n<r;n++){var i=e[n];t.has(i[0])||t.set(i[0],new Set),t.has(i[1])||t.set(i[1],new Set),t.get(i[0]).add(i[1])}return t}(t),a=function(e){for(var t=new Map,n=0,r=e.length;n<r;n++)t.set(e[n],n);return t}(e);for(t.forEach(function(e){if(!a.has(e[0])||!a.has(e[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});o--;)i[o]||l(e[o],o,new Set);return r;function l(e,t,o){if(o.has(e)){var u;try{u=", node was:"+JSON.stringify(e)}catch(e){u=""}throw new Error("Cyclic dependency"+u)}if(!a.has(e))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(e));if(!i[t]){i[t]=!0;var c=s.get(e)||new Set;if(t=(c=Array.from(c)).length){o.add(e);do{var d=c[--t];l(d,a.get(d),o)}while(t);o.delete(e)}r[--n]=e}}}return KN=1,ZN.exports=function(t){return e(function(e){for(var t=new Set,n=0,r=e.length;n<r;n++){var i=e[n];t.add(i[0]),t.add(i[1])}return Array.from(t)}(t),t)},ZN.exports.array=e,ZN.exports}(),QN=dt(JN);const eP=Object.prototype.toString,tP=Error.prototype.toString,nP=RegExp.prototype.toString,rP="undefined"!=typeof Symbol?Symbol.prototype.toString:()=>"",iP=/^Symbol\((.*)\)(.*)$/;function oP(e,t=!1){if(null==e||!0===e||!1===e)return""+e;const n=typeof e;if("number"===n)return function(e){return e!=+e?"NaN":0===e&&1/e<0?"-0":""+e}(e);if("string"===n)return t?`"${e}"`:e;if("function"===n)return"[Function "+(e.name||"anonymous")+"]";if("symbol"===n)return rP.call(e).replace(iP,"Symbol($1)");const r=eP.call(e).slice(8,-1);return"Date"===r?isNaN(e.getTime())?""+e:e.toISOString(e):"Error"===r||e instanceof Error?"["+tP.call(e)+"]":"RegExp"===r?nP.call(e):null}function sP(e,t){let n=oP(e,t);return null!==n?n:JSON.stringify(e,function(e,n){let r=oP(this[e],t);return null!==r?r:n},2)}function aP(e){return null==e?[]:[].concat(e)}let lP,uP,cP,dP=/\$\{\s*(\w+)\s*\}/g;lP=Symbol.toStringTag;class hP{constructor(e,t,n,r){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[lP]="Error",this.name="ValidationError",this.value=t,this.path=n,this.type=r,this.errors=[],this.inner=[],aP(e).forEach(e=>{if(pP.isError(e)){this.errors.push(...e.errors);const t=e.inner.length?e.inner:[e];this.inner.push(...t)}else this.errors.push(e)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}uP=Symbol.hasInstance,cP=Symbol.toStringTag;class pP extends Error{static formatError(e,t){const n=t.label||t.path||"this";return t=Object.assign({},t,{path:n,originalPath:t.path}),"string"==typeof e?e.replace(dP,(e,n)=>sP(t[n])):"function"==typeof e?e(t):e}static isError(e){return e&&"ValidationError"===e.name}constructor(e,t,n,r,i){const o=new hP(e,t,n,r);if(i)return o;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[cP]="Error",this.name=o.name,this.message=o.message,this.type=o.type,this.value=o.value,this.path=o.path,this.errors=o.errors,this.inner=o.inner,Error.captureStackTrace&&Error.captureStackTrace(this,pP)}static[uP](e){return hP[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let fP={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:e,type:t,value:n,originalValue:r})=>{const i=null!=r&&r!==n?` (cast from the value \`${sP(r,!0)}\`).`:".";return"mixed"!==t?`${e} must be a \`${t}\` type, but the final value was: \`${sP(n,!0)}\``+i:`${e} must match the configured type. The validated value was: \`${sP(n,!0)}\``+i}},mP={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},gP={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},yP={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},bP={notType:e=>{const{path:t,value:n,spec:r}=e,i=r.types.length;if(Array.isArray(n)){if(n.length<i)return`${t} tuple value has too few items, expected a length of ${i} but got ${n.length} for value: \`${sP(n,!0)}\``;if(n.length>i)return`${t} tuple value has too many items, expected a length of ${i} but got ${n.length} for value: \`${sP(n,!0)}\``}return pP.formatError(fP.notType,e)}};Object.assign(Object.create(null),{mixed:fP,string:mP,number:{min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},date:gP,object:yP,array:{min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},boolean:{isValue:"${path} field must be ${value}"},tuple:bP});const vP=e=>e&&e.__isYupSchema__;class _P{static fromOptions(e,t){if(!t.then&&!t.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:n,then:r,otherwise:i}=t,o="function"==typeof n?n:(...e)=>e.every(e=>e===n);return new _P(e,(e,t)=>{var n;let s=o(...e)?r:i;return null!=(n=null==s?void 0:s(t))?n:t})}constructor(e,t){this.fn=void 0,this.refs=e,this.refs=e,this.fn=t}resolve(e,t){let n=this.refs.map(e=>e.getValue(null==t?void 0:t.value,null==t?void 0:t.parent,null==t?void 0:t.context)),r=this.fn(n,e,t);if(void 0===r||r===e)return e;if(!vP(r))throw new TypeError("conditions must return a schema object");return r.resolve(t)}}const xP="$",wP=".";class EP{constructor(e,t={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,"string"!=typeof e)throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),""===e)throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===xP,this.isValue=this.key[0]===wP,this.isSibling=!this.isContext&&!this.isValue;let n=this.isContext?xP:this.isValue?wP:"";this.path=this.key.slice(n.length),this.getter=this.path&&YN.getter(this.path,!0),this.map=t.map}getValue(e,t,n){let r=this.isContext?n:this.isValue?e:t;return this.getter&&(r=this.getter(r||{})),this.map&&(r=this.map(r)),r}cast(e,t){return this.getValue(e,null==t?void 0:t.parent,null==t?void 0:t.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}EP.prototype.__isYupRef=!0;const SP=e=>null==e;function TP(e){function t({value:t,path:n="",options:r,originalValue:i,schema:o},s,a){const{name:l,test:u,params:c,message:d,skipAbsent:h}=e;let{parent:p,context:f,abortEarly:m=o.spec.abortEarly,disableStackTrace:g=o.spec.disableStackTrace}=r;const y={value:t,parent:p,context:f};function b(e={}){const r=kP(Object.assign({value:t,originalValue:i,label:o.spec.label,path:e.path||n,spec:o.spec,disableStackTrace:e.disableStackTrace||g},c,e.params),y),s=new pP(pP.formatError(e.message||d,r),t,r.path,e.type||l,r.disableStackTrace);return s.params=r,s}const v=m?s:a;let _={path:n,parent:p,type:l,from:r.from,createError:b,resolve:e=>OP(e,y),options:r,originalValue:i,schema:o};const x=e=>{pP.isError(e)?v(e):e?a(null):v(b())},w=e=>{pP.isError(e)?v(e):s(e)};if(h&&SP(t))return x(!0);let E;try{var S;if(E=u.call(_,t,_),"function"==typeof(null==(S=E)?void 0:S.then)){if(r.sync)throw new Error(`Validation test of type: "${_.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(E).then(x,w)}}catch(e){return void w(e)}x(E)}return t.OPTIONS=e,t}function kP(e,t){if(!e)return e;for(const n of Object.keys(e))e[n]=OP(e[n],t);return e}function OP(e,t){return EP.isRef(e)?e.getValue(t.value,t.parent,t.context):e}function AP(e,t,n,r=n){let i,o,s;return t?(YN.forEach(t,(a,l,u)=>{let c=l?a.slice(1,a.length-1):a,d="tuple"===(e=e.resolve({context:r,parent:i,value:n})).type,h=u?parseInt(c,10):0;if(e.innerType||d){if(d&&!u)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${s}" must contain an index to the tuple element, e.g. "${s}[0]"`);if(n&&h>=n.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${a}, in the path: ${t}. because there is no value at that index. `);i=n,n=n&&n[h],e=d?e.spec.types[h]:e.innerType}if(!u){if(!e.fields||!e.fields[c])throw new Error(`The schema does not contain the path: ${t}. (failed at: ${s} which is a type: "${e.type}")`);i=n,n=n&&n[c],e=e.fields[c]}o=c,s=l?"["+a+"]":"."+a}),{schema:e,parent:i,parentPath:o}):{parent:i,parentPath:t,schema:e}}class CP extends Set{describe(){const e=[];for(const t of this.values())e.push(EP.isRef(t)?t.describe():t);return e}resolveAll(e){let t=[];for(const n of this.values())t.push(e(n));return t}clone(){return new CP(this.values())}merge(e,t){const n=this.clone();return e.forEach(e=>n.add(e)),t.forEach(e=>n.delete(e)),n}}function RP(e,t=new Map){if(vP(e)||!e||"object"!=typeof e)return e;if(t.has(e))return t.get(e);let n;if(e instanceof Date)n=new Date(e.getTime()),t.set(e,n);else if(e instanceof RegExp)n=new RegExp(e),t.set(e,n);else if(Array.isArray(e)){n=new Array(e.length),t.set(e,n);for(let r=0;r<e.length;r++)n[r]=RP(e[r],t)}else if(e instanceof Map){n=new Map,t.set(e,n);for(const[r,i]of e.entries())n.set(r,RP(i,t))}else if(e instanceof Set){n=new Set,t.set(e,n);for(const r of e)n.add(RP(r,t))}else{if(!(e instanceof Object))throw Error(`Unable to clone ${e}`);n={},t.set(e,n);for(const[r,i]of Object.entries(e))n[r]=RP(i,t)}return n}function NP(e){if(null==e||!e.length)return;const t=[];let n="",r=!1,i=!1;for(let o=0;o<e.length;o++){const s=e[o];"["!==s||i?"]"!==s||i?'"'!==s?"."!==s||r||i?n+=s:n&&(t.push(n),n=""):i=!i:(n&&(/^\d+$/.test(n)?t.push(n):t.push(n.replace(/^"|"$/g,"")),n=""),r=!1):(n&&(t.push(...n.split(".").filter(Boolean)),n=""),r=!0)}return n&&t.push(...n.split(".").filter(Boolean)),t}function PP(e,t){var n;if((null==(n=e.inner)||!n.length)&&e.errors.length)return function(e,t){const n=t?`${t}.${e.path}`:e.path;return e.errors.map(e=>({message:e,path:NP(n)}))}(e,t);const r=t?`${t}.${e.path}`:e.path;return e.inner.flatMap(e=>PP(e,r))}class MP{constructor(e){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new CP,this._blacklist=new CP,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(fP.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},null==e?void 0:e.spec),this.withMutation(e=>{e.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const t=Object.create(Object.getPrototypeOf(this));return t.type=this.type,t._typeCheck=this._typeCheck,t._whitelist=this._whitelist.clone(),t._blacklist=this._blacklist.clone(),t.internalTests=Object.assign({},this.internalTests),t.exclusiveTests=Object.assign({},this.exclusiveTests),t.deps=[...this.deps],t.conditions=[...this.conditions],t.tests=[...this.tests],t.transforms=[...this.transforms],t.spec=RP(Object.assign({},this.spec,e)),t}label(e){let t=this.clone();return t.spec.label=e,t}meta(...e){if(0===e.length)return this.spec.meta;let t=this.clone();return t.spec.meta=Object.assign(t.spec.meta||{},e[0]),t}withMutation(e){let t=this._mutate;this._mutate=!0;let n=e(this);return this._mutate=t,n}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&"mixed"!==this.type)throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let t=this,n=e.clone();const r=Object.assign({},t.spec,n.spec);return n.spec=r,n.internalTests=Object.assign({},t.internalTests,n.internalTests),n._whitelist=t._whitelist.merge(e._whitelist,e._blacklist),n._blacklist=t._blacklist.merge(e._blacklist,e._whitelist),n.tests=t.tests,n.exclusiveTests=t.exclusiveTests,n.withMutation(t=>{e.tests.forEach(e=>{t.test(e.OPTIONS)})}),n.transforms=[...t.transforms,...n.transforms],n}isType(e){return null==e?!(!this.spec.nullable||null!==e)||!(!this.spec.optional||void 0!==e):this._typeCheck(e)}resolve(e){let t=this;if(t.conditions.length){let n=t.conditions;t=t.clone(),t.conditions=[],t=n.reduce((t,n)=>n.resolve(t,e),t),t=t.resolve(e)}return t}resolveOptions(e){var t,n,r,i;return Object.assign({},e,{from:e.from||[],strict:null!=(t=e.strict)?t:this.spec.strict,abortEarly:null!=(n=e.abortEarly)?n:this.spec.abortEarly,recursive:null!=(r=e.recursive)?r:this.spec.recursive,disableStackTrace:null!=(i=e.disableStackTrace)?i:this.spec.disableStackTrace})}cast(e,t={}){let n=this.resolve(Object.assign({},t,{value:e})),r="ignore-optionality"===t.assert,i=n._cast(e,t);if(!1!==t.assert&&!n.isType(i)){if(r&&SP(i))return i;let o=sP(e),s=sP(i);throw new TypeError(`The value of ${t.path||"field"} could not be cast to a value that satisfies the schema type: "${n.type}". \n\nattempted value: ${o} \n`+(s!==o?`result of cast: ${s}`:""))}return i}_cast(e,t){let n=void 0===e?e:this.transforms.reduce((n,r)=>r.call(this,n,e,this,t),e);return void 0===n&&(n=this.getDefault(t)),n}_validate(e,t={},n,r){let{path:i,originalValue:o=e,strict:s=this.spec.strict}=t,a=e;s||(a=this._cast(a,Object.assign({assert:!1},t)));let l=[];for(let e of Object.values(this.internalTests))e&&l.push(e);this.runTests({path:i,value:a,originalValue:o,options:t,tests:l},n,e=>{if(e.length)return r(e,a);this.runTests({path:i,value:a,originalValue:o,options:t,tests:this.tests},n,r)})}runTests(e,t,n){let r=!1,{tests:i,value:o,originalValue:s,path:a,options:l}=e,u=e=>{r||(r=!0,t(e,o))},c=e=>{r||(r=!0,n(e,o))},d=i.length,h=[];if(!d)return c([]);let p={value:o,originalValue:s,path:a,options:l,schema:this};for(let e=0;e<i.length;e++){(0,i[e])(p,u,function(e){e&&(Array.isArray(e)?h.push(...e):h.push(e)),--d<=0&&c(h)})}}asNestedTest({key:e,index:t,parent:n,parentPath:r,originalParent:i,options:o}){const s=null!=e?e:t;if(null==s)throw TypeError("Must include `key` or `index` for nested validations");const a="number"==typeof s;let l=n[s];const u=Object.assign({},o,{strict:!0,parent:n,value:l,originalValue:i[s],key:void 0,[a?"index":"key"]:s,path:a||s.includes(".")?`${r||""}[${a?s:`"${s}"`}]`:(r?`${r}.`:"")+e});return(e,t,n)=>this.resolve(u)._validate(l,u,t,n)}validate(e,t){var n;let r=this.resolve(Object.assign({},t,{value:e})),i=null!=(n=null==t?void 0:t.disableStackTrace)?n:r.spec.disableStackTrace;return new Promise((n,o)=>r._validate(e,t,(e,t)=>{pP.isError(e)&&(e.value=t),o(e)},(e,t)=>{e.length?o(new pP(e,t,void 0,void 0,i)):n(t)}))}validateSync(e,t){var n;let r,i=this.resolve(Object.assign({},t,{value:e})),o=null!=(n=null==t?void 0:t.disableStackTrace)?n:i.spec.disableStackTrace;return i._validate(e,Object.assign({},t,{sync:!0}),(e,t)=>{throw pP.isError(e)&&(e.value=t),e},(t,n)=>{if(t.length)throw new pP(t,e,void 0,void 0,o);r=n}),r}isValid(e,t){return this.validate(e,t).then(()=>!0,e=>{if(pP.isError(e))return!1;throw e})}isValidSync(e,t){try{return this.validateSync(e,t),!0}catch(e){if(pP.isError(e))return!1;throw e}}_getDefault(e){let t=this.spec.default;return null==t?t:"function"==typeof t?t.call(this,e):RP(t)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){if(0===arguments.length)return this._getDefault();return this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,t){const n=this.clone({nullable:e});return n.internalTests.nullable=TP({message:t,name:"nullable",test(e){return null!==e||this.schema.spec.nullable}}),n}optionality(e,t){const n=this.clone({optional:e});return n.internalTests.optionality=TP({message:t,name:"optionality",test(e){return void 0!==e||this.schema.spec.optional}}),n}optional(){return this.optionality(!0)}defined(e=fP.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=fP.notNull){return this.nullability(!1,e)}required(e=fP.required){return this.clone().withMutation(t=>t.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let t=this.clone();return t.transforms.push(e),t}test(...e){let t;if(t=1===e.length?"function"==typeof e[0]?{test:e[0]}:e[0]:2===e.length?{name:e[0],test:e[1]}:{name:e[0],message:e[1],test:e[2]},void 0===t.message&&(t.message=fP.default),"function"!=typeof t.test)throw new TypeError("`test` is a required parameters");let n=this.clone(),r=TP(t),i=t.exclusive||t.name&&!0===n.exclusiveTests[t.name];if(t.exclusive&&!t.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return t.name&&(n.exclusiveTests[t.name]=!!t.exclusive),n.tests=n.tests.filter(e=>{if(e.OPTIONS.name===t.name){if(i)return!1;if(e.OPTIONS.test===r.OPTIONS.test)return!1}return!0}),n.tests.push(r),n}when(e,t){Array.isArray(e)||"string"==typeof e||(t=e,e=".");let n=this.clone(),r=aP(e).map(e=>new EP(e));return r.forEach(e=>{e.isSibling&&n.deps.push(e.key)}),n.conditions.push("function"==typeof t?new _P(r,t):_P.fromOptions(r,t)),n}typeError(e){let t=this.clone();return t.internalTests.typeError=TP({message:e,name:"typeError",skipAbsent:!0,test(e){return!!this.schema._typeCheck(e)||this.createError({params:{type:this.schema.type}})}}),t}oneOf(e,t=fP.oneOf){let n=this.clone();return e.forEach(e=>{n._whitelist.add(e),n._blacklist.delete(e)}),n.internalTests.whiteList=TP({message:t,name:"oneOf",skipAbsent:!0,test(e){let t=this.schema._whitelist,n=t.resolveAll(this.resolve);return!!n.includes(e)||this.createError({params:{values:Array.from(t).join(", "),resolved:n}})}}),n}notOneOf(e,t=fP.notOneOf){let n=this.clone();return e.forEach(e=>{n._blacklist.add(e),n._whitelist.delete(e)}),n.internalTests.blacklist=TP({message:t,name:"notOneOf",test(e){let t=this.schema._blacklist,n=t.resolveAll(this.resolve);return!n.includes(e)||this.createError({params:{values:Array.from(t).join(", "),resolved:n}})}}),n}strip(e=!0){let t=this.clone();return t.spec.strip=e,t}describe(e){const t=(e?this.resolve(e):this).clone(),{label:n,meta:r,optional:i,nullable:o}=t.spec,s={meta:r,label:n,optional:i,nullable:o,default:t.getDefault(e),type:t.type,oneOf:t._whitelist.describe(),notOneOf:t._blacklist.describe(),tests:t.tests.filter((e,t,n)=>n.findIndex(t=>t.OPTIONS.name===e.OPTIONS.name)===t).map(t=>{const n=t.OPTIONS.params&&e?kP(Object.assign({},t.OPTIONS.params),e):t.OPTIONS.params;return{name:t.OPTIONS.name,params:n}})};return s}get"~standard"(){const e=this;return{version:1,vendor:"yup",async validate(t){try{return{value:await e.validate(t,{abortEarly:!1})}}catch(e){if(e instanceof pP)return{issues:PP(e)};throw e}}}}}MP.prototype.__isYupSchema__=!0;for(const e of["validate","validateSync"])MP.prototype[`${e}At`]=function(t,n,r={}){const{parent:i,parentPath:o,schema:s}=AP(this,t,n,r.context);return s[e](i&&i[o],Object.assign({},r,{parent:i,path:t}))};for(const e of["equals","is"])MP.prototype[e]=MP.prototype.oneOf;for(const e of["not","nope"])MP.prototype[e]=MP.prototype.notOneOf;const DP=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function IP(e){var t,n;const r=DP.exec(e);return r?{year:zP(r[1]),month:zP(r[2],1)-1,day:zP(r[3],1),hour:zP(r[4]),minute:zP(r[5]),second:zP(r[6]),millisecond:r[7]?zP(r[7].substring(0,3)):0,precision:null!=(t=null==(n=r[7])?void 0:n.length)?t:void 0,z:r[8]||void 0,plusMinus:r[9]||void 0,hourOffset:zP(r[10]),minuteOffset:zP(r[11])}:null}function zP(e,t=0){return Number(e)||t}let FP=/^[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])?)*$/,LP=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,jP=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,$P=new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"),BP=e=>SP(e)||e===e.trim(),VP={}.toString();function UP(){return new WP}class WP extends MP{constructor(){super({type:"string",check:e=>(e instanceof String&&(e=e.valueOf()),"string"==typeof e)}),this.withMutation(()=>{this.transform((e,t)=>{if(!this.spec.coerce||this.isType(e))return e;if(Array.isArray(e))return e;const n=null!=e&&e.toString?e.toString():e;return n===VP?e:n})})}required(e){return super.required(e).withMutation(t=>t.test({message:e||fP.required,name:"required",skipAbsent:!0,test:e=>!!e.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(e=>"required"!==e.OPTIONS.name),e))}length(e,t=mP.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(t){return t.length===this.resolve(e)}})}min(e,t=mP.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(t){return t.length>=this.resolve(e)}})}max(e,t=mP.max){return this.test({name:"max",exclusive:!0,message:t,params:{max:e},skipAbsent:!0,test(t){return t.length<=this.resolve(e)}})}matches(e,t){let n,r,i=!1;return t&&("object"==typeof t?({excludeEmptyString:i=!1,message:n,name:r}=t):n=t),this.test({name:r||"matches",message:n||mP.matches,params:{regex:e},skipAbsent:!0,test:t=>""===t&&i||-1!==t.search(e)})}email(e=mP.email){return this.matches(FP,{name:"email",message:e,excludeEmptyString:!0})}url(e=mP.url){return this.matches(LP,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=mP.uuid){return this.matches(jP,{name:"uuid",message:e,excludeEmptyString:!1})}datetime(e){let t,n,r="";return e&&("object"==typeof e?({message:r="",allowOffset:t=!1,precision:n}=e):r=e),this.matches($P,{name:"datetime",message:r||mP.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:r||mP.datetime_offset,params:{allowOffset:t},skipAbsent:!0,test:e=>{if(!e||t)return!0;const n=IP(e);return!!n&&!!n.z}}).test({name:"datetime_precision",message:r||mP.datetime_precision,params:{precision:n},skipAbsent:!0,test:e=>{if(!e||null==n)return!0;const t=IP(e);return!!t&&t.precision===n}})}ensure(){return this.default("").transform(e=>null===e?"":e)}trim(e=mP.trim){return this.transform(e=>null!=e?e.trim():e).test({message:e,name:"trim",test:BP})}lowercase(e=mP.lowercase){return this.transform(e=>SP(e)?e:e.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:e=>SP(e)||e===e.toLowerCase()})}uppercase(e=mP.uppercase){return this.transform(e=>SP(e)?e:e.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:e=>SP(e)||e===e.toUpperCase()})}}UP.prototype=WP.prototype;let qP=new Date("");class GP extends MP{constructor(){super({type:"date",check(e){return t=e,"[object Date]"===Object.prototype.toString.call(t)&&!isNaN(e.getTime());var t}}),this.withMutation(()=>{this.transform((e,t)=>!this.spec.coerce||this.isType(e)||null===e?e:(e=function(e){const t=IP(e);if(!t)return Date.parse?Date.parse(e):Number.NaN;if(void 0===t.z&&void 0===t.plusMinus)return new Date(t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond).valueOf();let n=0;return"Z"!==t.z&&void 0!==t.plusMinus&&(n=60*t.hourOffset+t.minuteOffset,"+"===t.plusMinus&&(n=0-n)),Date.UTC(t.year,t.month,t.day,t.hour,t.minute+n,t.second,t.millisecond)}(e),isNaN(e)?GP.INVALID_DATE:new Date(e)))})}prepareParam(e,t){let n;if(EP.isRef(e))n=e;else{let r=this.cast(e);if(!this._typeCheck(r))throw new TypeError(`\`${t}\` must be a Date or a value that can be \`cast()\` to a Date`);n=r}return n}min(e,t=gP.min){let n=this.prepareParam(e,"min");return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(e){return e>=this.resolve(n)}})}max(e,t=gP.max){let n=this.prepareParam(e,"max");return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(e){return e<=this.resolve(n)}})}}function HP(e,t){let n=1/0;return e.some((e,r)=>{var i;if(null!=(i=t.path)&&i.includes(e))return n=r,!0}),n}function YP(e){return(t,n)=>HP(e,t)-HP(e,n)}GP.INVALID_DATE=qP;const KP=(e,t,n)=>{if("string"!=typeof e)return e;let r=e;try{r=JSON.parse(e)}catch(e){}return n.isType(r)?r:e};function XP(e){if("fields"in e){const t={};for(const[n,r]of Object.entries(e.fields))t[n]=XP(r);return e.setFields(t)}if("array"===e.type){const t=e.optional();return t.innerType&&(t.innerType=XP(t.innerType)),t}return"tuple"===e.type?e.optional().clone({types:e.spec.types.map(XP)}):"optional"in e?e.optional():e}let ZP=e=>"[object Object]"===Object.prototype.toString.call(e);function JP(e,t){let n=Object.keys(e.fields);return Object.keys(t).filter(e=>-1===n.indexOf(e))}const QP=YP([]);function eM(e){return new tM(e)}class tM extends MP{constructor(e){super({type:"object",check:e=>ZP(e)||"function"==typeof e}),this.fields=Object.create(null),this._sortErrors=QP,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{e&&this.shape(e)})}_cast(e,t={}){var n;let r=super._cast(e,t);if(void 0===r)return this.getDefault(t);if(!this._typeCheck(r))return r;let i=this.fields,o=null!=(n=t.stripUnknown)?n:this.spec.noUnknown,s=[].concat(this._nodes,Object.keys(r).filter(e=>!this._nodes.includes(e))),a={},l=Object.assign({},t,{parent:a,__validating:t.__validating||!1}),u=!1;for(const e of s){let n=i[e],s=e in r,c=r[e];if(n){let i;l.path=(t.path?`${t.path}.`:"")+e,n=n.resolve({value:c,context:t.context,parent:a});let o=n instanceof MP?n.spec:void 0,s=null==o?void 0:o.strict;if(null!=o&&o.strip){u=u||e in r;continue}i=t.__validating&&s?c:n.cast(c,l),void 0!==i&&(a[e]=i)}else s&&!o&&(a[e]=c);s===e in a&&a[e]===c||(u=!0)}return u?a:r}_validate(e,t={},n,r){let{from:i=[],originalValue:o=e,recursive:s=this.spec.recursive}=t;t.from=[{schema:this,value:o},...i],t.__validating=!0,t.originalValue=o,super._validate(e,t,n,(e,i)=>{if(!s||!ZP(i))return void r(e,i);o=o||i;let a=[];for(let e of this._nodes){let n=this.fields[e];n&&!EP.isRef(n)&&a.push(n.asNestedTest({options:t,key:e,parent:i,parentPath:t.path,originalParent:o}))}this.runTests({tests:a,value:i,originalValue:o,options:t},n,t=>{r(t.sort(this._sortErrors).concat(e),i)})})}clone(e){const t=super.clone(e);return t.fields=Object.assign({},this.fields),t._nodes=this._nodes,t._excludedEdges=this._excludedEdges,t._sortErrors=this._sortErrors,t}concat(e){let t=super.concat(e),n=t.fields;for(let[e,t]of Object.entries(this.fields)){const r=n[e];n[e]=void 0===r?t:r}return t.withMutation(t=>t.setFields(n,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let t={};return this._nodes.forEach(n=>{var r;const i=this.fields[n];let o=e;null!=(r=o)&&r.value&&(o=Object.assign({},o,{parent:o.value,value:o.value[n]})),t[n]=i&&"getDefault"in i?i.getDefault(o):void 0}),t}setFields(e,t){let n=this.clone();return n.fields=e,n._nodes=function(e,t=[]){let n=[],r=new Set,i=new Set(t.map(([e,t])=>`${e}-${t}`));function o(e,t){let o=YN.split(e)[0];r.add(o),i.has(`${t}-${o}`)||n.push([t,o])}for(const t of Object.keys(e)){let n=e[t];r.add(t),EP.isRef(n)&&n.isSibling?o(n.path,t):vP(n)&&"deps"in n&&n.deps.forEach(e=>o(e,t))}return QN.array(Array.from(r),n).reverse()}(e,t),n._sortErrors=YP(Object.keys(e)),t&&(n._excludedEdges=t),n}shape(e,t=[]){return this.clone().withMutation(n=>{let r=n._excludedEdges;return t.length&&(Array.isArray(t[0])||(t=[t]),r=[...n._excludedEdges,...t]),n.setFields(Object.assign(n.fields,e),r)})}partial(){const e={};for(const[t,n]of Object.entries(this.fields))e[t]="optional"in n&&n.optional instanceof Function?n.optional():n;return this.setFields(e)}deepPartial(){return XP(this)}pick(e){const t={};for(const n of e)this.fields[n]&&(t[n]=this.fields[n]);return this.setFields(t,this._excludedEdges.filter(([t,n])=>e.includes(t)&&e.includes(n)))}omit(e){const t=[];for(const n of Object.keys(this.fields))e.includes(n)||t.push(n);return this.pick(t)}from(e,t,n){let r=YN.getter(e,!0);return this.transform(i=>{if(!i)return i;let o=i;return((e,t)=>{const n=[...YN.normalizePath(t)];if(1===n.length)return n[0]in e;let r=n.pop(),i=YN.getter(YN.join(n),!0)(e);return!(!i||!(r in i))})(i,e)&&(o=Object.assign({},i),n||delete o[e],o[t]=r(i)),o})}json(){return this.transform(KP)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||yP.exact,test(e){if(null==e)return!0;const t=JP(this.schema,e);return 0===t.length||this.createError({params:{properties:t.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,t=yP.noUnknown){"boolean"!=typeof e&&(t=e,e=!0);let n=this.test({name:"noUnknown",exclusive:!0,message:t,test(t){if(null==t)return!0;const n=JP(this.schema,t);return!e||0===n.length||this.createError({params:{unknown:n.join(", ")}})}});return n.spec.noUnknown=e,n}unknown(e=!0,t=yP.noUnknown){return this.noUnknown(!e,t)}transformKeys(e){return this.transform(t=>{if(!t)return t;const n={};for(const r of Object.keys(t))n[e(r)]=t[r];return n})}camelCase(){return this.transformKeys(XN.camelCase)}snakeCase(){return this.transformKeys(XN.snakeCase)}constantCase(){return this.transformKeys(e=>XN.snakeCase(e).toUpperCase())}describe(e){const t=(e?this.resolve(e):this).clone(),n=super.describe(e);n.fields={};for(const[i,o]of Object.entries(t.fields)){var r;let t=e;null!=(r=t)&&r.value&&(t=Object.assign({},t,{parent:t.value,value:t.value[i]})),n.fields[i]=o.describe(t)}return n}}eM.prototype=tM.prototype;const nM=eM().shape({username:UP().required(),password:UP().required()});var rM,iM,oM=Zb(({onSuccessSignIn:i})=>{const o=zN(),s=IN(),a=PN(),l=function(e={}){const t=r.useRef(void 0),n=r.useRef(void 0),[i,o]=r.useState({isDirty:!1,isValidating:!1,isLoading:Yv(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Yv(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:i},e.defaultValues&&!Yv(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:n,...r}=E_(e);t.current={...r,formState:i}}const s=t.current.control;return s._options=e,Iv(()=>{const e=s._subscribe({formState:s._proxyFormState,callback:()=>o({...s._formState}),reRenderRoot:!0});return o(e=>({...e,isReady:!0})),s._formState.isReady=!0,e},[s]),r.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),r.useEffect(()=>{e.mode&&(s._options.mode=e.mode),e.reValidateMode&&(s._options.reValidateMode=e.reValidateMode)},[s,e.mode,e.reValidateMode]),r.useEffect(()=>{e.errors&&(s._setErrors(e.errors),s._focusError())},[s,e.errors]),r.useEffect(()=>{e.shouldUnregister&&s._subjects.state.next({values:s._getWatch()})},[s,e.shouldUnregister]),r.useEffect(()=>{if(s._proxyFormState.isDirty){const e=s._getDirty();e!==i.isDirty&&s._subjects.state.next({isDirty:e})}},[s,i.isDirty]),r.useEffect(()=>{e.values&&!jv(e.values,n.current)?(s._reset(e.values,{keepFieldsRef:!0,...s._options.resetOptions}),n.current=e.values,o(e=>({...e}))):s._resetDefaultValues()},[s,e.values]),r.useEffect(()=>{s._state.mount||(s._setValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),t.current.formState=Dv(i,s),t.current}({defaultValues:{username:"",password:""},resolver:VN(nM)}),{control:u,handleSubmit:c,formState:{isValid:d}}=l;return n.useEffect(()=>{o.mutate()},[]),n.useEffect(()=>{if(s.error){const{response:e}=s.error;if(e){const{data:{detail:t}}=e;a({message:t,variant:"error"})}}},[s.error]),n.useEffect(()=>{s.data&&i(s.data)},[s.data]),e(qN,{children:t(Jc,{sx:{display:"grid",justifyContent:"center",justifyItems:"center",alignContent:"center",alignItems:"center",gap:"20px"},children:[e(dl,{variant:"h4",sx:{margin:"0 auto"},children:"Authorization"}),t(Jc,{component:"form",sx:{display:"grid",gap:"15px"},onSubmit:c(e=>{s.mutate({body:e})}),children:[e(Bv,{name:"username",control:u,render:({field:t})=>e(Qp,{label:"Login",size:"small",...t})}),e(Bv,{name:"password",control:u,render:({field:t})=>e(Qp,{label:"Password",type:"password",size:"small",...t})}),e(Qb,{type:"submit",variant:"contained",disabled:!d,children:"Sign in"})]})]})})}),sM={};function aM(e,t){if(rM)if(iM){var n="var shared_chunk = {}; ("+rM+")(shared_chunk); ("+iM+")(shared_chunk);",r={};rM(r),(sM=t(r)).workerURL=window.URL.createObjectURL(new Blob([n],{type:"text/javascript"}))}else iM=t;else rM=t}aM(0,function(e){const t={};try{window instanceof Window&&window.document instanceof HTMLDocument&&(t.is_worker=!1,t.is_main=!0)}catch(e){t.is_worker=!0,t.is_main=!1,self.window={document:{}},self.document=self.window.document}function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function r(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=n(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==n(t)?t:t+""}function i(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var o,s="v0.22.0",a=o={},l=0,u={};function c(e){var t=[];"string"==typeof e&&(t=e.split("."),e=t.pop());var n=o.targets;for(let e=0;e<t.length;e++){if(!n[t[e]])return[];n=n[t[e]]}return[e,n]}function d(e,t=null,n=null,r=[]){if(!e)return r;if(Array.isArray(e))e.forEach((t,n)=>d(t,e,n,r));else if("object"==typeof e)if(e instanceof ArrayBuffer)r.push({object:e,parent:t,property:n});else if(e.buffer instanceof ArrayBuffer)r.push({object:e.buffer,parent:t,property:n});else for(let t in e)d(e[t],e,t,r);return r}function h(e){Array.isArray(e)&&e.filter(e=>e.parent&&e.property).forEach(e=>delete e.parent[e.property])}o.targets={},o.addTarget=function(e,t){o.targets[e]=t},o.removeTarget=function(e){e&&delete o.targets[e]},o.withTransferables=function(...e){if(!(this instanceof o.withTransferables))return new o.withTransferables(...e);this.value=e,this.transferables=d(this.value)},t.is_main&&(o.postMessage=function(e,t,...n){if(Array.isArray(e))return Promise.all(e.map(e=>o.postMessage(e,t,...n)));let r={};"object"==typeof t&&(r=t,t=t.method);var i=new Promise((e,r)=>{u[l]={method:t,message:n,resolve:e,reject:r}});let s,a=[];return n&&1===n.length&&n[0]instanceof o.withTransferables&&(a=n[0].transferables,n=n[0].value),s={type:"main_send",message_id:l,method:t,message:n},r.stringify&&(s=JSON.stringify(s)),e.postMessage(s,a.map(e=>e.object)),h(a),a.length>0&&g("trace",`'${t}' transferred ${a.length} objects to worker thread`),l++,i},o.addWorker=function(e){if(!(e instanceof Worker))throw Error("Worker broker could not add non-Worker object",e);e.addEventListener("message",function(t){let n="string"==typeof t.data?JSON.parse(t.data):t.data,r=n.message_id;if("worker_reply"===n.type)u[r]&&(n.error?u[r].reject(n.error):u[r].resolve(n.message),delete u[r]);else if("worker_send"===n.type&&null!=r){let t,i,s,a,l;try{if([a,s]=c(n.method),!s)throw Error(`Worker broker could not dispatch message type ${n.method} on target ${n.target} because no object with that name is registered on main thread`);if(l="function"==typeof s[a]&&s[a],!l)throw Error(`Worker broker could not dispatch message type ${n.method} on target ${n.target} because object has no method with that name`);t=l.apply(s,n.message)}catch(e){i=e}let u,d=[];t instanceof Promise?t.then(t=>{t instanceof o.withTransferables&&(d=t.transferables,t=t.value[0]),u={type:"main_reply",message_id:r,message:t},e.postMessage(u,d.map(e=>e.object)),h(d),d.length>0&&g("trace",`'${a}' transferred ${d.length} objects to worker thread`)},t=>{e.postMessage({type:"main_reply",message_id:r,error:t instanceof Error?`${t.message}: ${t.stack}`:t})}):(t instanceof o.withTransferables&&(d=t.transferables,t=t.value[0]),u={type:"main_reply",message_id:r,message:t,error:i instanceof Error?`${i.message}: ${i.stack}`:i},e.postMessage(u,d.map(e=>e.object)),h(d),d.length>0&&g("trace",`'${a}' transferred ${d.length} objects to worker thread`))}})},o.getMessages=function(){return u},o.getMessageId=function(){return l}),t.is_worker&&(o.postMessage=function(e,...t){let n={};"object"==typeof e&&(n=e,e=e.method);var r=new Promise((n,r)=>{u[l]={method:e,message:t,resolve:n,reject:r}});let i,s=[];return t&&1===t.length&&t[0]instanceof o.withTransferables&&(s=t[0].transferables,t=t[0].value),i={type:"worker_send",message_id:l,method:e,message:t},n.stringify&&(i=JSON.stringify(i)),self.postMessage(i,s.map(e=>e.object)),h(s),s.length>0&&g("trace",`'${e}' transferred ${s.length} objects to main thread`),l++,r},self.addEventListener("message",function(e){let t="string"==typeof e.data?JSON.parse(e.data):e.data,n=t.message_id;if("main_reply"===t.type)u[n]&&(t.error?u[n].reject(t.error):u[n].resolve(t.message),delete u[n]);else if("main_send"===t.type&&null!=n){let r,i,s,a,l;try{if([a,s]=c(t.method),!s)throw Error(`Worker broker could not dispatch message type ${t.method} on target ${t.target} because no object with that name is registered on main thread`);if(l="function"==typeof s[a]&&s[a],!l)throw Error(`Worker broker could not dispatch message type ${t.method} because worker has no method with that name`);r=l.apply(s,t.message)}catch(e){i=e}let u,d=[];r instanceof Promise?r.then(e=>{e instanceof o.withTransferables&&(d=e.transferables,e=e.value[0]),u={type:"worker_reply",message_id:n,message:e},self.postMessage(u,d.map(e=>e.object)),h(d),d.length>0&&g("trace",`'${a}' transferred ${d.length} objects to main thread`)},e=>{self.postMessage({type:"worker_reply",message_id:n,error:e instanceof Error?`${e.message}: ${e.stack}`:e})}):(r instanceof o.withTransferables&&(d=r.transferables,r=r.value[0]),u={type:"worker_reply",message_id:n,message:r,error:i instanceof Error?`${i.message}: ${i.stack}`:i},self.postMessage(u,d.map(e=>e.object)),h(d),d.length>0&&g("trace",`'${a}' transferred ${d.length} objects to main thread`))}}));const p={silent:-1,error:0,warn:1,info:2,debug:3,trace:4},f={};let m={};function g(e,...n){let r="object"==typeof e?e.level:e;if(p[r]<=p[g.level]){if(t.is_worker)return a.postMessage({method:"_logProxy",stringify:!0},e,...n);{if("object"==typeof e&&!0===e.once){if(m[JSON.stringify(n)])return Promise.resolve(!1);m[JSON.stringify(n)]=!0}let i=function(e){if(t.is_main)return f[e]=f[e]||(console[e]?console[e]:console.log).bind(console),f[e]}(r);n.length>1?i(`Tangram ${s} [${r}]: ${n[0]}`,...n.slice(1)):i(`Tangram ${s} [${r}]: ${n[0]}`)}return Promise.resolve(!0)}return Promise.resolve(!1)}g.level="info",g.workers=null,g.setLevel=function(e){g.level=e,t.is_main&&Array.isArray(g.workers)&&a.postMessage(g.workers,"_logSetLevelProxy",e)},t.is_main&&(g.setWorkers=function(e){g.workers=e},g.reset=function(){m={}}),a.addTarget("_logProxy",g),a.addTarget("_logSetLevelProxy",g.setLevel);const y={};let b;a.addTarget("Utils",y),y.isSafari=function(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)},y.isMicrosoft=function(){return/(Trident\/7.0|Edge[ /](\d+[.\d]+))/i.test(navigator.userAgent)},y._requests={},y._proxy_requests={},y.io=function(e,n=6e4,r="text",i="GET",o={},s=null,l=!1){if(t.is_worker&&y.isMicrosoft())return g("debug","Proxying request for URL to worker",e),s&&(y._proxy_requests[s]=!0),a.postMessage("Utils.io",e,n,r,i,o,s,!0);var u=new XMLHttpRequest,c=new Promise((t,s)=>{if(u.open(i,e,!0),u.timeout=n,u.responseType=r,o&&"object"==typeof o)for(let e in o)u.setRequestHeader(e,o[e]);u.onload=()=>{200===u.status?["text","json"].indexOf(u.responseType)>-1?t({body:u.responseText,status:u.status}):t({body:u.response,status:u.status}):204===u.status?t({body:null,status:u.status}):s(Error("Request error with a status of "+u.statusText))},u.onerror=e=>{s(Error("There was a network error"+e.toString()))},u.ontimeout=e=>{s(Error("timeout "+e.toString()))},u.send()});return c=c.then(e=>(s&&delete y._requests[s],l?a.withTransferables(e):e)),s&&(y._requests[s]=u),c},y.cancelRequest=function(e){if(t.is_worker&&y._proxy_requests[e])return a.postMessage("Utils.cancelRequest",e);y._requests[e]?(g("trace",`Cancelling network request key '${e}'`),y._requests[e].abort(),delete y._requests[e]):g("trace",`Could not find network request key '${e}'`)},y.serializeWithFunctions=function(e){return"function"==typeof e?e.toString():JSON.stringify(e,function(e,t){return"function"==typeof t?t.toString():t})},y.use_high_density_display=!0,y.updateDevicePixelRatio=function(){let e=y.device_pixel_ratio;return y.device_pixel_ratio=y.use_high_density_display&&window.devicePixelRatio||1,y.device_pixel_ratio!==e},t.is_main&&y.updateDevicePixelRatio(),y.isPowerOf2=function(e){return!(e&e-1)},y.interpolate=function(e,t,n){if(!Array.isArray(t)||!Array.isArray(t[0]))return t;if(t.length<1)return t;var r,i,o,s,a;if(e<=t[0][0])s=t[0][1],"function"==typeof n&&(s=n(s));else if(e>=t[t.length-1][0])s=t[t.length-1][1],"function"==typeof n&&(s=n(s));else for(var l=0;l<t.length-1;l++)if(e>=t[l][0]&&e<t[l+1][0]){if(r=t[l][0],i=t[l+1][0],Array.isArray(t[l][1])){s=[];for(var u=0;u<t[l][1].length;u++)"function"==typeof n?(a=n(t[l][1][u]),o=n(t[l+1][1][u])-a,s[u]=o*(e-r)/(i-r)+a):(o=t[l+1][1][u]-t[l][1][u],s[u]=o*(e-r)/(i-r)+t[l][1][u])}else"function"==typeof n?(a=n(t[l][1]),s=(o=n(t[l+1][1])-a)*(e-r)/(i-r)+a):s=(o=t[l+1][1]-t[l][1])*(e-r)/(i-r)+t[l][1];break}return s},y.toCSSColor=function(e){if(null!=e)return 1===e[3]?`rgb(${e.slice(0,3).map(e=>Math.round(255*e)).join(", ")})`:`rgba(${e.map((e,t)=>t<3&&Math.round(255*e)||e).join(", ")})`};var v=b={draw_label_collision_boxes:!1,draw_label_texture_boxes:!1,suppress_label_fade_in:!1,suppress_label_snap_animation:!1,show_hidden_labels:!1,layer_stats:!1,wireframe:!1};function _(e){if("string"==typeof e&&-1===e.search(/^(data|blob):/)){let t=e.indexOf("?");t>-1&&(e=e.substr(0,t));let n=e.indexOf("#");return n>-1&&(e=e.substr(0,n)),e.substr(0,e.lastIndexOf("/")+1)||""}return""}function x(e){if("string"==typeof e)return!(e.search(/^(http|https|data|blob):/)>-1||"//"===e.substr(0,2))}let w;function E(e,t){e=e.replace(/[[]/,"\\[").replace(/[\]]/,"\\]");var n=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(t);return null===n?"":decodeURIComponent(n[1].replace(/\+/g," "))}const S={id:0,queue:[],max_time:20,start_time:null,state:{},add(e){e.id=S.id++,e.max_time=e.max_time||S.max_time,e.pause_factor=e.pause_factor||1;let t=new Promise((t,n)=>{e.resolve=t,e.reject=n});return e.promise=t,e.elapsed=0,e.total_elapsed=0,e.stats={calls:0},this.queue.push(e),this.start_time=this.start_time||performance.now(),this.elapsed=performance.now()-this.start_time,(this.elapsed<S.max_time||e.immediate)&&this.process(e),e.promise},remove(e){let t=this.queue.indexOf(e);t>-1&&this.queue.splice(t,1)},process(e){if(!this.state.user_moving_view||!1!==e.user_moving_view)return e.pause?(e.pause--,!0):(e.stats.calls++,e.start_time=performance.now(),e.run(e))},processAll(){this.start_time=this.start_time||performance.now();for(let e=0;e<this.queue.length;e++){let t=this.queue[e];if(!0!==this.process(t)&&(t.pause||(t.pause=t.elapsed>t.max_time?t.pause_factor:0),t.total_elapsed+=t.elapsed),this.elapsed=performance.now()-this.start_time,this.elapsed>=S.max_time){this.start_time=null;break}}},finish(e,t){return e.elapsed=performance.now()-e.start_time,e.total_elapsed+=e.elapsed,this.remove(e),e.resolve(t),e.promise},cancel(e){let t;e.cancel instanceof Function&&(t=e.cancel(e)),e.resolve(t)},shouldContinue(e){return e.elapsed=performance.now()-e.start_time,this.elapsed=performance.now()-this.start_time,e.elapsed<e.max_time&&this.elapsed<S.max_time},removeForTile(e){for(let t=this.queue.length-1;t>=0;t--)this.queue[t].tile_id===e&&(this.cancel(this.queue[t]),this.queue.splice(t,1))},setState(e){this.state=e}};function T(e){let t=[];return Object.assign(e,{subscribe(e){-1===t.indexOf(e)&&t.push(e)},unsubscribe(e){let n=t.indexOf(e);n>-1&&t.splice(n,1)},unsubscribeAll(){t=[]},trigger(e,...n){t.forEach(t=>{if("function"==typeof t[e])try{t[e](...n)}catch(t){g("warn",`Caught exception in listener for event '${e}':`,t)}})},hasSubscribersFor(e){let n=!1;return t.forEach(t=>{"function"==typeof t[e]&&(n=!0)}),n}})}function k(e,t){let n={};return t.forEach(t=>n[t]=e[t]),n}class O{constructor(e,t,n={}){n=O.sliceOptions(n),this.gl=e,this.texture=e.createTexture(),this.texture&&(this.valid=!0),this.bind(),this.name=t,this.retain_count=0,this.config_type=null,this.loading=null,this.loaded=!1,this.filtering=n.filtering,this.density=n.density||1,this.sprites=n.sprites,this.texcoords={},this.sizes={},this.css_sizes={},this.aspects={},this.setData(1,1,new Uint8Array([0,0,0,0]),{filtering:"nearest"}),this.loaded=!1,O.textures[this.name]&&(this.retain_count=O.textures[this.name].retain_count,O.textures[this.name].retain_count=0,O.textures[this.name].destroy()),O.textures[this.name]=this,O.texture_configs[this.name]=JSON.stringify(Object.assign({name:t},n)),this.load(n),g("trace",`creating Texture ${this.name}`)}destroy({force:e}={}){this.retain_count>0&&!e?g("error",`Texture '${this.name}': destroying texture with retain count of '${this.retain_count}'`):this.valid&&(this.gl.deleteTexture(this.texture),this.texture=null,O.textures[this.name]===this&&(delete O.textures[this.name],delete O.texture_configs[this.name]),this.valid=!1,g("trace",`destroying Texture ${this.name}`))}retain(){this.retain_count++}release(){this.retain_count<=0&&g("error",`Texture '${this.name}': releasing texture with retain count of '${this.retain_count}'`),this.retain_count--,this.retain_count<=0&&this.destroy()}bind(e=0){this.valid&&(O.activeUnit!==e&&(this.gl.activeTexture(this.gl.TEXTURE0+e),O.activeUnit=e,O.boundTexture=null),O.boundTexture!==this.texture&&(this.gl.bindTexture(this.gl.TEXTURE_2D,this.texture),O.boundTexture=this.texture))}load(e){return e?(this.loading=null,"string"==typeof e.url?(this.config_type="url",this.setUrl(e.url,e)):e.element?(this.config_type="element",this.setElement(e.element,e)):e.data&&e.width&&e.height&&(this.config_type="data",this.setData(e.width,e.height,e.data,e)),this.loading=this.loading&&this.loading.then(()=>(this.calculateSprites(),this))||Promise.resolve(this),this.loading):this.loading||Promise.resolve(this)}setUrl(e,t={}){if(this.valid)return this.url=e,this.loading=new Promise(e=>{let n=new Image;n.onload=()=>{try{if("data:"===this.url.slice(0,5)){const e=document.createElement("canvas"),r=e.getContext("2d");e.width=n.width,e.height=n.height,r.drawImage(n,0,0),this.setElement(e,t)}else this.setElement(n,t)}catch(e){this.loaded=!1,g("warn",`Texture '${this.name}': failed to load url: '${this.url}'`,e,t),O.trigger("warning",{message:`Failed to load texture from ${this.url}`,error:e,texture:t})}this.loaded=!0,e(this)},n.onerror=n=>{this.loaded=!1,g("warn",`Texture '${this.name}': failed to load url: '${this.url}'`,n,t),O.trigger("warning",{message:`Failed to load texture from ${this.url}`,error:n,texture:t}),e(this)},y.isSafari()&&"data:"===this.url.slice(0,5)||(n.crossOrigin="anonymous"),n.src=this.url}),this.loading}setData(e,t,n,r={}){return this.width=e,this.height=t,Array.isArray(n)&&(n=new Uint8Array(n)),this.update(n,r),this.setFiltering(r),this.loaded=!0,this.loading=Promise.resolve(this),this.loading}setElement(e,t){let n=e;if("string"==typeof e&&(e=document.querySelector(e)),e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof HTMLVideoElement)this.update(e,t),this.setFiltering(t);else{this.loaded=!1;let e=`the 'element' parameter (\`element: ${JSON.stringify(n)}\`) must be a CSS `;e+="selector string, or a <canvas>, <image> or <video> object",g("warn",`Texture '${this.name}': ${e}`,t),O.trigger("warning",{message:`Failed to load texture because ${e}`,texture:t})}return this.loaded=!0,this.loading=Promise.resolve(this),this.loading}update(e,t={}){this.valid&&(this.bind(),e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLImageElement&&e.complete?(this.width=e.width,this.height=e.height,this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1!==t.UNPACK_FLIP_Y_WEBGL),this.gl.pixelStorei(this.gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.UNPACK_PREMULTIPLY_ALPHA_WEBGL||!1),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e)):(this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,null),this.gl.pixelStorei(this.gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,null),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.width,this.height,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e)),O.trigger("update",this))}setFiltering(e={}){if(this.valid){e.filtering=e.filtering||"linear";var t=this.gl;this.bind(),y.isPowerOf2(this.width)&&y.isPowerOf2(this.height)?(this.power_of_2=!0,t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,e.TEXTURE_WRAP_S||e.repeat&&t.REPEAT||t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,e.TEXTURE_WRAP_T||e.repeat&&t.REPEAT||t.CLAMP_TO_EDGE),"mipmap"===e.filtering?(this.filtering="mipmap",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.generateMipmap(t.TEXTURE_2D)):"linear"===e.filtering?(this.filtering="linear",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR)):"nearest"===e.filtering&&(this.filtering="nearest",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST))):(this.power_of_2=!1,t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),"nearest"===e.filtering?(this.filtering="nearest",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST)):(this.filtering="linear",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR))),O.trigger("update",this)}}calculateSprites(){if(this.sprites)for(let e in this.sprites){let t=this.sprites[e];this.texcoords[e]=O.getTexcoordsForSprite([t[0],t[1]],[t[2],t[3]],[this.width,this.height]),this.sizes[e]=[t[2],t[3]],this.css_sizes[e]=[t[2]/this.density,t[3]/this.density],this.aspects[e]=t[2]/t[3]}}byteSize(){return Math.round(this.width*this.height*4*("mipmap"==this.filtering?1.33:1))}}O.create=function(e,t,n){return new O(e,t,n)},O.retain=function(e){O.textures[e]&&O.textures[e].retain()},O.release=function(e){O.textures[e]&&O.textures[e].release()},O.destroy=function(e){Object.keys(O.textures).forEach(t=>{var n=O.textures[t];n.gl===e&&n.destroy({force:!0})})},O.getSpriteInfo=function(e,t){let n=O.textures[e];return n&&{size:n.sizes[t],css_size:n.css_sizes[t],aspect:n.aspects[t],texcoords:n.texcoords[t]}},O.getTexcoordsForSprite=function(e,t,n){var r=n[1]-e[1]-t[1];return[e[0]/n[0],r/n[1],(t[0]+e[0])/n[0],(t[1]+r)/n[1]]},O.createFromObject=function(e,t){let n=[];if(t)for(let r in t){let i=t[r];if(i.skip_create)continue;if(!O.changed(r,i))continue;let o=O.create(e,r,i);n.push(o.loading)}return Promise.all(n)},O.default="__default",O.createDefault=function(e){return O.create(e,O.default)},O.sliceOptions=function(e){return{filtering:e.filtering,sprites:e.sprites,url:e.url,element:e.element,data:e.data,width:e.width,height:e.height,density:e.density,repeat:e.repeat,TEXTURE_WRAP_S:e.TEXTURE_WRAP_S,TEXTURE_WRAP_T:e.TEXTURE_WRAP_T,UNPACK_FLIP_Y_WEBGL:e.UNPACK_FLIP_Y_WEBGL,UNPACK_PREMULTIPLY_ALPHA_WEBGL:e.UNPACK_PREMULTIPLY_ALPHA_WEBGL}},O.changed=function(e,t){let n=O.textures[e];if(n){if("element"===n.config_type||null!=t.element)return!0;if(t=O.sliceOptions(t),O.texture_configs[e]===JSON.stringify(Object.assign({name:e},t)))return!1}return!0},O.getInfo=function(e){if(e||(e=Object.keys(O.textures)),Array.isArray(e))return Promise.all(e.map(e=>O.getInfo(e)));var t=O.textures[e];return t?(t.loading||Promise.resolve(t)).then(()=>({name:t.name,width:t.width,height:t.height,density:t.density,css_size:[t.width/t.density,t.height/t.density],aspect:t.width/t.height,sprites:t.sprites,texcoords:t.texcoords,sizes:t.sizes,css_sizes:t.css_sizes,aspects:t.aspects,filtering:t.filtering,power_of_2:t.power_of_2,valid:t.valid})):Promise.resolve(null)},O.syncTexturesToWorker=function(e){return a.postMessage("Texture.getInfo",e).then(e=>(e&&e.filter(e=>e).forEach(e=>O.textures[e.name]=e),O.textures))},O.getMaxTextureSize=function(e){return e.getParameter(e.MAX_TEXTURE_SIZE)},O.textures={},O.texture_configs={},O.boundTexture=null,O.activeUnit=null,a.addTarget("Texture",O),T(O);var A={parseUniforms:function(e={}){var t=[];for(const[n,r]of Object.entries(e))if("number"==typeof r)t.push({type:"float",method:"1f",name:n,value:r,path:[n]});else if(Array.isArray(r)){if("number"==typeof r[0])r.length>=2&&r.length<=4?t.push({type:"vec"+r.length,method:r.length+"fv",name:n,value:r,path:[n]}):r.length>4&&t.push({type:"float[]",method:"1fv",name:n+"[0]",value:r,path:[n]});else if("string"==typeof r[0])for(let e=0;e<r.length;e++)t.push({type:"sampler2D",method:"1i",name:n+"["+e+"]",value:r[e],path:[n,e]});else if(Array.isArray(r[0])&&"number"==typeof r[0][0]&&r[0].length>=2&&r[0].length<=4)for(let e=0;e<r.length;e++)t.push({type:"vec"+r[0].length,method:r[0].length+"fv",name:n+"["+e+"]",value:r[e],path:[n,e]})}else"boolean"==typeof r?t.push({type:"bool",method:"1i",name:n,value:r,path:[n]}):"string"==typeof r&&t.push({type:"sampler2D",method:"1i",name:n,value:r,path:[n]});return t},defineVariable:function(e,t){var n,r;if("number"==typeof t)n="float";else if(Array.isArray(t))"number"==typeof t[0]?t.length>=2&&t.length<=4?n="vec"+t.length:(n="float",r=t.length):"string"==typeof t[0]?(n="sampler2D",r=t.length):Array.isArray(t[0])&&"number"==typeof t[0][0]&&t[0].length>=2&&t[0].length<=4&&(n="vec"+t[0].length,r=t.length);else if("boolean"==typeof t)n="bool";else{if("string"!=typeof t)return;n="sampler2D"}var i="";return i+=`${n} ${e}`,r&&(i+=`[${r}]`),i+";\n"},defineUniform:function(e,t){var n=A.defineVariable(e,t);if(n)return"uniform "+n},expandVec3:function(e,t=1){let n;if(Array.isArray(e)){if(2!==e.length)return e;n=[...e,t].map(parseFloat)}else n=[e,e,e].map(parseFloat);if(n&&n.every(e=>"number"==typeof e&&!isNaN(e)))return n},expandVec4:function(e,t=1){let n;if(Array.isArray(e)){if(3!==e.length)return e;n=[...e,t].map(parseFloat)}else n=[e,e,e,t].map(parseFloat);if(n&&n.every(e=>"number"==typeof e&&!isNaN(e)))return n}};let C=[];function R(e,t){let n=C.filter(t=>t[0]===e)[0];return n=n&&n[1],n||(C.push([e,{}]),n=C[C.length-1][1]),n[t]||(n[t]=e.getExtension(t)),n[t]}function N(e){var t,n,r=0;if(0===e.length)return r;for(t=0,n=e.length;t<n;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return r}function P(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var M,D,I=(D||(D=1,M=function(e){e=String(e);for(var t,n=[];t=e.match(/ERROR\:([^\n]+)/);){e=e.slice(t.index+1);var r=(s=t[1].trim()).split(":"),i=r.slice(2).join(":").trim(),o=parseInt(r[0],10),s=parseInt(r[1],10);n.push({message:i,file:o,line:s})}return n}),M),z=P(I);const F=/^\s*#pragma.*$/gm,L=/\\\s*\n/gm;class j{constructor(e,t,n,r){r=r||{},this.gl=e,this.program=null,this.compiled=!1,this.compiling=!1,this.error=null,this.defines=Object.assign({},r.defines||{}),this.blocks=Object.assign({},r.blocks||{}),this.block_scopes=Object.assign({},r.block_scopes||{}),this.extensions=r.extensions||[],this.dependent_uniforms=r.uniforms,this.uniforms={},this.attribs={},this.vertex_source=t,this.fragment_source=n,this.id=j.id++,this.name=r.name}destroy(){this.gl.useProgram(null),this.gl.deleteProgram(this.program),this.program=null,this.uniforms={},this.attribs={},this.compiled=!1}use(){this.compiled&&(j.current!==this&&this.gl.useProgram(this.program),j.current=this)}compile(){if(this.compiling)throw new Error(`ShaderProgram.compile(): skipping for ${this.id} (${this.name}) because already compiling`);this.compiling=!0,this.compiled=!1,this.error=null,this.computed_vertex_source=this.vertex_source,this.computed_fragment_source=this.fragment_source;let e=this.checkExtensions();var t,n=this.buildDefineList(),r=this.buildShaderBlockList();for(var i in r){var o=r[i];if(o&&(!Array.isArray(o)||0!==o.length)){t=new RegExp("^\\s*#pragma\\s+tangram:\\s+"+i+"\\s*$","m");var s=this.computed_vertex_source.match(t),a=this.computed_fragment_source.match(t);if(null!=s||null!=a){var l="";o.forEach(e=>{let t=`${e.scope}, ${e.key}, ${e.num}`;l+=`\n// tangram-block-start: ${t}\n`,l+=e.source,l+=`\n// tangram-block-end: ${t}\n`}),null!=s&&(this.computed_vertex_source=this.computed_vertex_source.replace(t,l)),null!=a&&(this.computed_fragment_source=this.computed_fragment_source.replace(t,l)),n["TANGRAM_BLOCK_"+i.replace(/[\s-]+/g,"_").toUpperCase()]=!0}}}this.computed_vertex_source=this.computed_vertex_source.replace(F,""),this.computed_fragment_source=this.computed_fragment_source.replace(F,""),this.ensureUniforms(this.dependent_uniforms);let u="",c=this.gl.getShaderPrecisionFormat(this.gl.FRAGMENT_SHADER,this.gl.HIGH_FLOAT);u=c&&c.precision>0?"precision highp float;\n":"precision mediump float;\n",n.TANGRAM_VERTEX_SHADER=!0,n.TANGRAM_FRAGMENT_SHADER=!1,this.computed_vertex_source=u+j.buildDefineString(n)+this.computed_vertex_source,n.TANGRAM_VERTEX_SHADER=!1,n.TANGRAM_FRAGMENT_SHADER=!0,this.computed_fragment_source=j.buildExtensionString(e)+u+j.buildDefineString(n)+this.computed_fragment_source,this.computed_vertex_source=this.computed_vertex_source.replace(L,""),this.computed_fragment_source=this.computed_fragment_source.replace(L,"");try{this.program=j.updateProgram(this.gl,this.program,this.computed_vertex_source,this.computed_fragment_source),this.compiled=!0,this.compiling=!1}catch(e){throw this.program=null,this.compiled=!1,this.compiling=!1,this.error=e,this.error.vertex_shader_source=this.computed_vertex_source,this.error.fragment_shader_source=this.computed_fragment_source,"vertex"!==e.type&&"fragment"!==e.type||(this.shader_errors=e.errors,this.shader_errors.forEach(t=>{t.type=e.type,t.block=this.block(e.type,t.line),t.line=this.block(e.type,t.line)}),this.error.shader_errors=this.shader_errors),e}this.computed_vertex_source=null,this.computed_fragment_source=null,this.use(),this.refreshUniforms(),this.refreshAttributes()}buildDefineList(){var e,t={};for(e in j.defines)t[e]=j.defines[e];for(e in this.defines)t[e]=this.defines[e];return t}buildShaderBlockList(){let e,t={};for(e in j.blocks)t[e]=[],Array.isArray(j.blocks[e])?t[e].push(...j.blocks[e].map((t,n)=>({key:e,source:t,num:n,scope:"ShaderProgram"}))):t[e]=[{key:e,source:j.blocks[e],num:0,scope:"ShaderProgram"}];for(e in this.blocks)if(t[e]=t[e]||[],Array.isArray(this.blocks[e])){let n=this.block_scopes&&this.block_scopes[e]||[],r=null,i=0;for(let o=0;o<this.blocks[e].length;o++)n[o]!==r&&(r=n[o],i=0),t[e].push({key:e,source:this.blocks[e][o],num:i,scope:r||this.name}),i++}else t[e].push({key:e,source:this.blocks[e],num:0,scope:this.name});return t}ensureUniforms(e){if(!e)return;const t=Object.entries(e).map(([e,t])=>A.defineUniform(e,t)).filter(e=>e);this.computed_vertex_source=t.join("\n")+this.computed_vertex_source,this.computed_fragment_source=t.join("\n")+this.computed_fragment_source}setUniforms(e,t=!0){this.compiled&&(t&&(this.texture_unit=0),A.parseUniforms(e).forEach(({name:e,type:t,value:n,method:r})=>{"sampler2D"===t?this.setTextureUniform(e,n):this.uniform(r,e,n)}))}saveUniforms(e){let t=e||this.uniforms;for(let e in t){let t=this.uniforms[e];t&&(t.saved_value=t.value)}this.saved_texture_unit=this.texture_unit||0}restoreUniforms(e){let t=e||this.uniforms;for(let e in t){let t=this.uniforms[e];t&&t.saved_value&&(t.value=t.saved_value,this.updateUniform(t))}this.texture_unit=this.saved_texture_unit||0}setTextureUniform(e,t){var n=O.textures[t];null!=n?(n.bind(this.texture_unit),this.uniform("1i",e,this.texture_unit),this.texture_unit++):g("warn",`Cannot find texture '${t}'`)}uniform(e,t,n){if(!this.compiled)return;this.uniforms[t]=this.uniforms[t]||{};let r=this.uniforms[t];r.name=t,void 0===r.location&&(r.location=this.gl.getUniformLocation(this.program,t)),r.method=e,r.value=n,this.updateUniform(r)}updateUniform(e){this.compiled&&e&&null!=e.location&&(this.use(),this.commitUniform(e))}commitUniform(e){let t=e.location,n=e.value;switch(e.method){case"1i":this.gl.uniform1i(t,n);break;case"1f":this.gl.uniform1f(t,n);break;case"2f":this.gl.uniform2f(t,n[0],n[1]);break;case"3f":this.gl.uniform3f(t,n[0],n[1],n[2]);break;case"4f":this.gl.uniform4f(t,n[0],n[1],n[2],n[3]);break;case"1iv":this.gl.uniform1iv(t,n);break;case"3iv":this.gl.uniform3iv(t,n);break;case"1fv":this.gl.uniform1fv(t,n);break;case"2fv":this.gl.uniform2fv(t,n);break;case"3fv":this.gl.uniform3fv(t,n);break;case"4fv":this.gl.uniform4fv(t,n);break;case"Matrix3fv":this.gl.uniformMatrix3fv(t,!1,n);break;case"Matrix4fv":this.gl.uniformMatrix4fv(t,!1,n)}}refreshUniforms(){if(this.compiled)for(var e in this.uniforms){let t=this.uniforms[e];t.location=this.gl.getUniformLocation(this.program,e),this.updateUniform(t)}}refreshAttributes(){this.attribs={}}attribute(e){if(this.compiled){var t=this.attribs[e]=this.attribs[e]||{};return null!=t.location||(t.name=e,t.location=this.gl.getAttribLocation(this.program,e)),t}}source(e){return"vertex"===e?this.computed_vertex_source:"fragment"===e?this.computed_fragment_source:void 0}lines(e){let t=this.source(e);return t?t.split("\n"):[]}line(e,t){let n=this.lines(e);if(n)return n[t]}block(e,t){let n,r=this.lines(e);for(let e=0;e<t&&e<r.length;e++){let t=r[e],i=t.match(/\/\/ tangram-block-start: ([A-Za-z0-9_-]+), ([A-Za-z0-9_-]+), (\d+)/);i&&i.length>1?n={scope:i[1],name:i[2],num:i[3]}:(i=t.match(/\/\/ tangram-block-end: ([A-Za-z0-9_-]+), ([A-Za-z0-9_-]+), (\d+)/),i&&i.length>1&&(n=null)),n&&(n.line=null==n.line?-1:n.line+1,n.source=t)}return n}checkExtensions(){let e=[];return this.extensions.forEach(t=>{let n=R(this.gl,t),r=`TANGRAM_EXTENSION_${t}`;this.defines[r]=null!=n,n?e.push(t):g("debug",`Could not enable extension '${t}'`)}),e}}j.id=0,j.current=null,j.defines={},j.blocks={},j.reset=function(){j.programs_by_source={},j.shaders_by_source={}},j.reset(),j.buildDefineString=function(e){var t="";for(var n in e)null!=e[n]&&!1!==e[n]&&("boolean"==typeof e[n]&&!0===e[n]?t+="#define "+n+"\n":"number"==typeof e[n]&&Math.floor(e[n])===e[n]?t+="#define "+n+" "+e[n].toFixed(1)+"\n":t+="#define "+n+" "+e[n]+"\n");return t},j.buildExtensionString=function(e){let t="";return(e=e||[]).forEach(e=>{t+=`#ifdef GL_${e}\n#extension GL_${e} : enable\n#endif\n`}),t},j.addBlock=function(e,...t){j.blocks[e]=j.blocks[e]||[],j.blocks[e].push(...t)},j.removeBlock=function(e){j.blocks[e]=[]},j.replaceBlock=function(e,...t){j.removeBlock(e),j.addBlock(e,...t)},j.updateProgram=function(e,t,n,r){let i=N(e._tangram_id+"::"+n+"::"+r);if(j.programs_by_source[i])return g("trace","Reusing identical source GL program object"),j.programs_by_source[i];var o=j.createShader(e,n,e.VERTEX_SHADER),s=j.createShader(e,r,e.FRAGMENT_SHADER);if(e.useProgram(null),null!=t)for(var a=e.getAttachedShaders(t),l=0;l<a.length;l++)e.detachShader(t,a[l]);else t=e.createProgram();if(null==o||null==s)return t;if(e.attachShader(t,o),e.attachShader(t,s),e.bindAttribLocation(t,0,"a_position"),e.linkProgram(t),!e.getProgramParameter(t,e.LINK_STATUS)){let i=new Error(`WebGL program error:\n VALIDATE_STATUS: ${e.getProgramParameter(t,e.VALIDATE_STATUS)}\n ERROR: ${e.getError()}\n --- Vertex Shader ---\n ${n}\n --- Fragment Shader ---\n ${r}`);throw Object.assign(new Error(i),{type:"program"})}return j.programs_by_source[i]=t,t},j.createShader=function(e,t,n){let r=N(e._tangram_id+"::"+t);if(j.shaders_by_source[r])return g("trace","Reusing identical source GL shader object"),j.shaders_by_source[r];let i=e.createShader(n);if(e.shaderSource(i,t),e.compileShader(i),!e.getShaderParameter(i,e.COMPILE_STATUS)){let t=n===e.VERTEX_SHADER?"vertex":"fragment",r=e.getShaderInfoLog(i),o=z(r);throw Object.assign(new Error(r),{type:t,errors:o})}return j.shaders_by_source[r]=i,i};var $,B={disabled:!1,bound_vao:[],init(e){let t;!0!==this.disabled&&(t=R(e,"OES_vertex_array_object")),null!=t?g("info","Vertex Array Object extension available"):!0!==this.disabled?g("warn","Vertex Array Object extension NOT available"):g("warn","Vertex Array Object extension force disabled")},getExtension(e,t){if(!0!==this.disabled)return R(e,t)},create(e,t,n){let r={};r.setup=t,r.teardown=n;let i=this.getExtension(e,"OES_vertex_array_object");return null!=i&&(r._vao=i.createVertexArrayOES(),i.bindVertexArrayOES(r._vao)),r.setup(),r},getCurrentBinding(e){let t=this.bound_vao.filter(t=>t[0]===e)[0];return t&&t[1]},setCurrentBinding(e,t){let n=this.bound_vao,r=n.filter(t=>t[0]===e)[0];null==r?n.push([e,t]):r[1]=t},bind(e,t){let n=this.getExtension(e,"OES_vertex_array_object");if(null!=t)null!=n&&null!=t._vao?(n.bindVertexArrayOES(t._vao),this.setCurrentBinding(e,t)):t.setup();else{let t=this.getCurrentBinding(e);null!=n?n.bindVertexArrayOES(null):null!=t&&"function"==typeof t.teardown&&t.teardown(),this.setCurrentBinding(e,null)}},destroy(e,t){let n=this.getExtension(e,"OES_vertex_array_object");null!=n&&null!=t&&null!=t._vao&&(n.deleteVertexArrayOES(t._vao),t._vao=null)}};function V(e,...t){for(let n=0;n<t.length;n++){let r=t[n];if(r)for(let t in r){let n=r[t];null===n||"object"!=typeof n||Array.isArray(n)?void 0!==n&&(e[t]=n):null===e[t]||"object"!=typeof e[t]||Array.isArray(e[t])?e[t]=V({},n):e[t]=V(e[t],n)}}return e}var U=$={};$.default_source_max_zoom=18,$.default_view_max_zoom=20,$.max_style_zoom=25,$.tile_size=256,$.half_circumference_meters=20037508.342789244,$.circumference_meters=2*$.half_circumference_meters,$.min_zoom_meters_per_pixel=$.circumference_meters/$.tile_size;let W=[];$.metersPerPixel=function(e){return W[e]=W[e]||$.min_zoom_meters_per_pixel/Math.pow(2,e),W[e]};let q=[];$.metersPerTile=function(e){return q[e]=q[e]||$.circumference_meters/Math.pow(2,e),q[e]},$.tile_scale=4096,$.units_per_pixel=$.tile_scale/$.tile_size,$.height_scale=16;let G=[];$.unitsPerMeter=function(e){return G[e]=G[e]||$.tile_scale/($.tile_size*$.metersPerPixel(e)),G[e]},$.metersForTile=function(e){return{x:e.x*$.circumference_meters/Math.pow(2,e.z)-$.half_circumference_meters,y:-(e.y*$.circumference_meters/Math.pow(2,e.z)-$.half_circumference_meters)}},$.tileForMeters=function([e,t],n){return{x:Math.floor((e+$.half_circumference_meters)/($.circumference_meters/Math.pow(2,n))),y:Math.floor((-t+$.half_circumference_meters)/($.circumference_meters/Math.pow(2,n))),z:n}},$.wrapTile=function({x:e,y:t,z:n},r={x:!0,y:!1}){var i=(1<<n)-1;return r.x&&(e&=i),r.y&&(t&=i),{x:e,y:t,z:n}},$.metersToLatLng=function(e){return e[0]/=$.half_circumference_meters,e[1]/=$.half_circumference_meters,e[1]=(2*Math.atan(Math.exp(e[1]*Math.PI))-Math.PI/2)/Math.PI,e[0]*=180,e[1]*=180,e},$.latLngToMeters=function(e){return e[1]=Math.log(Math.tan(e[1]*Math.PI/360+Math.PI/4))/Math.PI,e[1]*=$.half_circumference_meters,e[0]*=$.half_circumference_meters/180,e},$.tileSpaceToLatlng=function(e,t,n){const r=$.unitsPerMeter(t);return $.transformGeometry(e,e=>{e[0]=e[0]/r+n.x,e[1]=e[1]/r+n.y,$.metersToLatLng(e)}),e},$.copyGeometry=function(e){if(null==e)return;let t={type:e.type};return"Point"===e.type?t.coordinates=[e.coordinates[0],e.coordinates[1]]:"LineString"===e.type||"MultiPoint"===e.type?t.coordinates=e.coordinates.map(e=>[e[0],e[1]]):"Polygon"===e.type||"MultiLineString"===e.type?t.coordinates=e.coordinates.map(e=>e.map(e=>[e[0],e[1]])):"MultiPolygon"===e.type&&(t.coordinates=e.coordinates.map(e=>e.map(e=>e.map(e=>[e[0],e[1]])))),t},$.transformGeometry=function(e,t){null!=e&&("Point"===e.type?t(e.coordinates):"LineString"===e.type||"MultiPoint"===e.type?e.coordinates.forEach(t):"Polygon"===e.type||"MultiLineString"===e.type?e.coordinates.forEach(e=>e.forEach(t)):"MultiPolygon"===e.type&&e.coordinates.forEach(e=>{e.forEach(e=>e.forEach(t))}))},$.boxIntersect=function(e,t){return!(t.sw.x>e.ne.x||t.ne.x<e.sw.x||t.sw.y>e.ne.y||t.ne.y<e.sw.y)},$.findBoundingBox=function(e){for(var t=1/0,n=-1/0,r=1/0,i=-1/0,o=e[0].length,s=0;s<o;s++){var a=e[0][s];a[0]<t&&(t=a[0]),a[1]<r&&(r=a[1]),a[0]>n&&(n=a[0]),a[1]>i&&(i=a[1])}return[t,r,n,i]},$.geometryType=function(e){return"Polygon"===e||"MultiPolygon"===e?"polygon":"LineString"===e||"MultiLineString"===e?"line":"Point"===e||"MultiPoint"===e?"point":void 0},$.centroid=function(e,t=!0){if(!e||0===e.length)return;let n,r=0,i=0,o=0,s=e[0],a=s.length;t&&(n=s[0],s=s.map(e=>[e[0]-n[0],e[1]-n[1]]));for(let e=0,t=a-1;e<a;t=e,e++){let n=s[e],a=s[t],l=n[1]*a[0]-a[1]*n[0];r+=(n[0]+a[0])*l,i+=(n[1]+a[1])*l,o+=3*l}if(!o)return;let l=[r/o,i/o];return t&&(l[0]+=n[0],l[1]+=n[1]),l},$.multiCentroid=function(e){let t=0,n=null;for(let r=0;r<e.length;r++){let i=$.centroid(e[r]);i&&(n=n||[0,0],n[0]+=i[0],n[1]+=i[1],t++)}return t>0&&(n[0]/=t,n[1]/=t),n},$.signedPolygonRingAreaSum=function(e){let t=0,n=e.length;for(let r=0;r<n-1;r++){let n=e[r],i=e[r+1];t+=n[0]*i[1]-i[0]*n[1]}return t+=e[n-1][0]*e[0][1]-e[0][0]*e[n-1][1],t},$.polygonRingArea=function(e){return Math.abs($.signedPolygonRingAreaSum(e))/2},$.polygonArea=function(e){if(e)return $.polygonRingArea(e[0])},$.multiPolygonArea=function(e){let t=0;for(let n=0;n<e.length;n++)t+=$.polygonArea(e[n]);return t},$.ringWinding=function(e){let t=$.signedPolygonRingAreaSum(e);return t>0?"CW":t<0?"CCW":void 0};const H={functions:{},num_functions:0,num_cached:0};function Y(e,t){if("string"==typeof e)e=K(e,t);else if(null!=e&&"object"==typeof e)for(let n in e)e[n]=Y(e[n],t);return e}function K(e,t){let n="string"==typeof e&&e.match(/^\s*function[^(]*\(([^)]*)\)\s*?\{([\s\S]*)\}$/m);if(n&&n.length>2)try{const e=n[2],r="function"==typeof t?t(e):e,i=N(r);if(void 0===H.functions[i]){let t=n[1].length>0&&n[1].split(",").map(e=>e.trim()).filter(e=>e);t=t.length>0?t:["context"],H.functions[i]=new Function(t.toString(),r),H.functions[i].source=e,H.num_functions++}else H.num_cached++;return H.functions[i]}catch(t){return e}return e}var X,Z={},J=P(function(){if(X)return Z;X=1;var e={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function t(e){return(e=Math.round(e))<0?0:e>255?255:e}function n(e){return e<0?0:e>1?1:e}function r(e){return"%"===e[e.length-1]?t(parseFloat(e)/100*255):t(parseInt(e))}function i(e){return"%"===e[e.length-1]?n(parseFloat(e)/100):n(parseFloat(e))}function o(e,t,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?e+(t-e)*n*6:2*n<1?t:3*n<2?e+(t-e)*(2/3-n)*6:e}try{Z.parseCSSColor=function(n){var s,a=n.replace(/ /g,"").toLowerCase();if(a in e)return e[a].slice();if("#"===a[0])return 4===a.length?(s=parseInt(a.substr(1),16))>=0&&s<=4095?[(3840&s)>>4|(3840&s)>>8,240&s|(240&s)>>4,15&s|(15&s)<<4,1]:null:7===a.length&&(s=parseInt(a.substr(1),16))>=0&&s<=16777215?[(16711680&s)>>16,(65280&s)>>8,255&s,1]:null;var l=a.indexOf("("),u=a.indexOf(")");if(-1!==l&&u+1===a.length){var c=a.substr(0,l),d=a.substr(l+1,u-(l+1)).split(","),h=1;switch(c){case"rgba":if(4!==d.length)return null;h=i(d.pop());case"rgb":return 3!==d.length?null:[r(d[0]),r(d[1]),r(d[2]),h];case"hsla":if(4!==d.length)return null;h=i(d.pop());case"hsl":if(3!==d.length)return null;var p=(parseFloat(d[0])%360+360)%360/360,f=i(d[1]),m=i(d[2]),g=m<=.5?m*(f+1):m+f-m*f,y=2*m-g;return[t(255*o(y,g,p+1/3)),t(255*o(y,g,p)),t(255*o(y,g,p-1/3)),h];default:return null}}return null}}catch(e){}return Z}());const Q={},ee=e=>Math.max(e,0),te=e=>isNaN(e)?0:e,ne=e=>Array.isArray(e)?e.map(parseFloat).map(te):te(parseFloat(e)),re=e=>Array.isArray(e)?e.map(ne).map(ee):ee(ne(e));Object.assign(Q,{clampPositive:ee,noNaN:te,parseNumber:ne,parsePositiveNumber:re}),Q.wrapFunction=function(e){return`\n var feature = context.feature.properties;\n var global = context.global;\n var $zoom = context.zoom;\n var $layer = context.layer;\n var $source = context.source;\n var $geometry = context.geometry;\n var $meters_per_pixel = context.meters_per_pixel;\n var $id = context.id;\n\n var val = (function(){ ${e} }());\n\n if (typeof val === 'number' && isNaN(val)) {\n val = null; // convert NaNs to nulls\n }\n\n return val;\n `},Q.zeroPair=Object.freeze([0,0]),Q.defaults={color:[1,1,1,1],width:1,size:1,extrude:!1,height:20,min_height:0,order:0,z:0,outline:{color:[0,0,0,0],width:0},material:{ambient:1,diffuse:1}},Q.macros={"Style.color.pseudoRandomColor":function(){return[parseInt(feature.id,16)/100%1*.7,parseInt(feature.id,16)/1e4%1*.7,parseInt(feature.id,16)/1e6%1*.7,1]},"Style.color.randomColor":function(){return[.7*Math.random(),.7*Math.random(),.7*Math.random(),1]}},Q.getFeatureParseContext=function(e,t,n){return{feature:e,id:e.id,tile:t,global:n,zoom:t.style_z,geometry:U.geometryType(e.geometry.type),meters_per_pixel:t.meters_per_pixel,meters_per_pixel_sq:t.meters_per_pixel_sq,units_per_meter_overzoom:t.units_per_meter_overzoom}};const ie={STATIC:0,DYNAMIC:1,ZOOM:2};Q.CACHE_TYPE=ie,Q.createPropertyCache=function(e,t=null,n=null){if(null==e)return;if(e.value)return{value:e.value,zoom:e.zoom?{}:null,type:e.type};let r={value:e,type:ie.STATIC};return Array.isArray(r.value)&&Array.isArray(r.value[0])?(r.zoom={},r.type=ie.ZOOM):"function"==typeof r.value&&(r.type=ie.DYNAMIC,r.dynamic_transform="function"==typeof n?n:null),"function"==typeof t&&(r.zoom?r.value=r.value.map((e,n)=>[e[0],t(e[1],n)]):"function"!=typeof r.value&&(r.value=t(r.value,0))),r},Q.createColorPropertyCache=function(e){return Q.createPropertyCache(e,e=>"Style.color.pseudoRandomColor"===e?K(Q.wrapFunction(Q.macros["Style.color.pseudoRandomColor"])):"Style.color.randomColor"===e?Q.macros["Style.color.randomColor"]:e)};const oe=e=>"string"==typeof e&&"%"===e[e.length-1],se=e=>"auto"===e,ae=e=>oe(e)||se(e),le="'size' can specify either width or height as derived from aspect ratio, but not both";function ue(e,t){return Q.createPropertyCache(e.value,(n,r)=>(Array.isArray(n)?(n=n.map((t,n)=>e.has_ratio[r][n]?t:re(t)).map((n,i)=>e.has_pct[r][i]?t.css_size[i]*n/100:n),e.has_ratio[r][0]?n[0]=n[1]*t.aspect:e.has_ratio[r][1]&&(n[1]=n[0]/t.aspect)):(n=re(n),n=e.has_pct[r]?t.css_size.map(e=>e*n/100):[n,n]),n))}function ce(e,t){try{return e(t)}catch(n){g("warn",`Property function in layer '${t.layers[t.layers.length-1]}' failed with\n`,`error ${n.stack}\n`,`function '${e.source}'\n`,t.feature,t)}}Q.createPointSizePropertyCache=function(e,t){let n=null,r=null;if(oe(e))n=[!0];else if(Array.isArray(e)){if(Array.isArray(e[0])){if(e.some(e=>Array.isArray(e[1])?e[1].some(e=>ae(e)):oe(e[1]))&&(n=e.map(e=>Array.isArray(e[1])?e[1].map(e=>oe(e)):oe(e[1])),r=e.map(e=>Array.isArray(e[1])&&e[1].map(e=>se(e))),r.some(e=>Array.isArray(e)&&e.every(e=>e))))throw le}else if(e.some(ae)&&(n=[e.map(oe)],r=[e.map(se)],r[0].every(e=>e)))throw le}else if(se(e))throw"this value only allowed as half of an array, eg [16px, auto]:";if(n||r){if(!t)throw"% or 'auto' keywords can only be used to specify point size when a texture is defined";(e={value:e}).has_pct=n,e.has_ratio=r,e.sprites={}}else e=Q.createPropertyCache(e,re);return e},Q.evalCachedPointSizeProperty=function(e,t,n,r){if(null!=e)return e.has_pct||e.has_ratio?t?(e.sprites[t.sprite]||(e.sprites[t.sprite]=ue(e,t)),Q.evalCachedProperty(e.sprites[t.sprite],r)):(e.texture=e.texture||ue(e,n),Q.evalCachedProperty(e.texture,r)):Q.evalCachedProperty(e,r)},Q.evalCachedProperty=function(e,t){return null==e?void 0:e.dynamic?ce(e.dynamic,t):e.static?e.static:e.zoom&&e.zoom[t.zoom]?e.zoom[t.zoom]:"function"==typeof e.value?(e.dynamic_transform?e.dynamic=function(t){return e.dynamic_transform(e.value(t))}:e.dynamic=e.value,ce(e.dynamic,t)):Array.isArray(e.value)&&Array.isArray(e.value[0])?(e.zoom=e.zoom||{},e.zoom[t.zoom]=y.interpolate(t.zoom,e.value),e.zoom[t.zoom]):(e.static=e.value,e.static)},Q.convertUnits=function(e,t){if(null!=e.value)return"px"===e.units?e.value*U.metersPerPixel(t.zoom):e.value;if("string"==typeof e)"px"===e.trim().slice(-2)?(e=ne(e),e*=U.metersPerPixel(t.zoom)):e=ne(e);else if(Array.isArray(e))return Array.isArray(e[0])?e.map(e=>[e[0],Q.convertUnits(e[1],t)]):e.map(e=>Q.convertUnits(e,t));return e},Q.parseUnits=function(e){var t={value:ne(e)};return 0!==t.value&&"string"==typeof e&&"px"===e.trim().slice(-2)&&(t.units="px"),t},Q.evalCachedDistanceProperty=function(e,t){return null==e?void 0:e.dynamic?ce(e.dynamic,t):e.zoom&&e.zoom[t.zoom]?e.zoom[t.zoom]:"function"==typeof e.value?(e.dynamic=e.value,ce(e.dynamic,t)):e.zoom?(e.zoom[t.zoom]=y.interpolate(t.zoom,e.value,e=>Q.convertUnits(e,t)),e.zoom[t.zoom]):Q.convertUnits(e.value,t)},Q.string_colors={},Q.colorForString=function(e){if(Q.string_colors[e])return Q.string_colors[e];let t=J.parseCSSColor(e);return t&&4===t.length?(t[0]/=255,t[1]/=255,t[2]/=255):t=Q.defaults.color,Q.string_colors[e]=t,t},Q.evalCachedColorProperty=function(e,t={}){if(null!=e){if(e.dynamic){let n=ce(e.dynamic,t);return"string"==typeof n&&(n=Q.colorForString(n)),n&&null==n[3]&&(n[3]=1),n}if(e.static)return e.static;if(e.zoom&&e.zoom[t.zoom])return e.zoom[t.zoom];if("function"==typeof e.value){e.dynamic=e.value;let n=ce(e.dynamic,t);return"string"==typeof n&&(n=Q.colorForString(n)),n&&null==n[3]&&(n[3]=1),n}if("string"==typeof e.value)return e.static=Q.colorForString(e.value),e.static;if(e.zoom){if(!e.zoom_preprocessed){for(let t=0;t<e.value.length;t++){let n=e.value[t];n&&"string"==typeof n[1]&&(n[1]=Q.colorForString(n[1]))}e.zoom_preprocessed=!0}return e.zoom[t.zoom]=y.interpolate(t.zoom,e.value),e.zoom[t.zoom][3]=e.zoom[t.zoom][3]||1,e.zoom[t.zoom]}return e.static=e.value.map(e=>e),e.static&&null==e.static[3]&&(e.static[3]=1),e.static}},Q.evalCachedColorPropertyWithAlpha=function(e,t,n){const r=Q.evalCachedColorProperty(e,n);if(null!=r&&null!=t){const e=Q.evalCachedProperty(t,n);if(null!=e)return[r[0],r[1],r[2],e]}return r},Q.parseColor=function(e,t={}){if("function"==typeof e&&(e=ce(e,t)),"string"==typeof e)e=Q.colorForString(e);else if(Array.isArray(e)&&Array.isArray(e[0])){for(let t=0;t<e.length;t++){let n=e[t];"string"==typeof n[1]&&(n[1]=Q.colorForString(n[1]))}t.zoom&&(e=y.interpolate(t.zoom,e))}return Array.isArray(e)?null==(e=e.map(e=>e))[3]&&(e[3]=1):e=[0,0,0,1],e},Q.calculateOrder=function(e,t){return"function"==typeof e?e=ce(e,t):"string"==typeof e&&(e=t.feature.properties[e]?t.feature.properties[e]:re(e)),e},Q.evalProperty=function(e,t){return"function"==typeof e?ce(e,t):e};class de{constructor(e,t,n){this.gl=e,this.workers=t,this._lock_fn="function"==typeof n&&n,this.init()}init(){this.requests={},this.feature=null,this.read_delay=0,this.read_delay_timer=null,this.pixels=null,this.fbo=this.gl.createFramebuffer(),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.fbo),this.fbo_size={width:256,height:256};var e=O.create(this.gl,"__selection_fbo",{filtering:"nearest"});e.setData(this.fbo_size.width,this.fbo_size.height,null,{filtering:"nearest"}),this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,this.gl.TEXTURE_2D,e.texture,0);var t=this.gl.createRenderbuffer();this.gl.bindRenderbuffer(this.gl.RENDERBUFFER,t),this.gl.renderbufferStorage(this.gl.RENDERBUFFER,this.gl.DEPTH_COMPONENT16,this.fbo_size.width,this.fbo_size.height),this.gl.framebufferRenderbuffer(this.gl.FRAMEBUFFER,this.gl.DEPTH_ATTACHMENT,this.gl.RENDERBUFFER,t),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null)}destroy(){this.gl&&this.fbo&&(this.gl.deleteFramebuffer(this.fbo),this.fbo=null,this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null))}get locked(){return this._lock_fn&&this._lock_fn()||!1}bind(){this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.fbo),this.gl.viewport(0,0,this.fbo_size.width,this.fbo_size.height),this.gl.clearColor(...de.defaultColor)}getFeatureAt(e,{radius:t}){return!e||e.x<0||e.y<0||e.x>1||e.y>1?Promise.resolve({feature:null,changed:!1}):new Promise((n,r)=>{this.selection_request_id=this.selection_request_id+1||0,this.requests[this.selection_request_id]={id:this.selection_request_id,point:e,radius:t,resolve:n,reject:r}})}pendingRequests(){return Object.keys(this.requests).length?this.requests:null}hasPendingRequests(){return null!=this.pendingRequests()}clearPendingRequests(){for(var e in this.requests){var t=this.requests[e];t.sent||(t.reject({request:t}),delete this.requests[e])}}read(){null!=this.read_delay_timer&&clearTimeout(this.read_delay_timer),this.read_delay_timer=setTimeout(()=>{if(!this.locked){var e=this.gl;for(var t in e.bindFramebuffer(e.FRAMEBUFFER,this.fbo),this.requests){var n=this.requests[t];if(n.sent)continue;let r,i,o=255,{point:s,radius:l}=n;if(l){let e=Math.min(this.fbo_size.width,this.fbo_size.height);i={x:Math.min(Math.ceil(2*l.x*this.fbo_size.width),e),y:Math.min(Math.ceil(2*l.y*this.fbo_size.height),e)}}else l={x:0,y:0},i={x:1,y:1};if((null==this.pixels||this.pixels.byteLength<i.x*i.y*4)&&(this.pixels=new Uint8Array(i.x*i.y*4)),this.pixels.fill instanceof Function)this.pixels.fill(0);else for(let e=0;e<this.pixels.length;e++)this.pixels[e]=0;e.readPixels(Math.round((s.x-l.x)*this.fbo_size.width),Math.round((1-s.y-l.y)*this.fbo_size.height),i.x,i.y,e.RGBA,e.UNSIGNED_BYTE,this.pixels);let u=4*(Math.round(i.y/2)*i.x+Math.round(i.x/2)),c=this.pixels[u]+(this.pixels[u+1]<<8)+(this.pixels[u+2]<<16);if(c>0)r=c+(this.pixels[u+3]<<24)>>>0,o=this.pixels[u+3];else{let e=-1>>>0;u=0;for(let t=0;t<i.y;t++)for(let n=0;n<i.x;n++,u+=4)if(c=this.pixels[u]+(this.pixels[u+1]<<8)+(this.pixels[u+2]<<16),c>0){let s=(n-i.x/2)*(n-i.x/2)+(t-i.y/2)*(t-i.y/2);s<=e&&(r=c+(this.pixels[u+3]<<24)>>>0,o=this.pixels[u+3],e=s)}}255!==o?null!=this.workers[o]&&a.postMessage(this.workers[o],"self.getFeatureSelection",{id:n.id,key:r}).then(e=>{this.finishRead(e)}):this.finishRead({id:n.id}),n.sent=!0}e.bindFramebuffer(e.FRAMEBUFFER,null)}},this.read_delay)}finishRead(e){var t=this.requests[e.id];if(t){var n=e.feature,r=!1;(null!=n&&null==this.feature||null==n&&null!=this.feature||null!=n&&null!=this.feature&&JSON.stringify(n)!==JSON.stringify(this.feature))&&(r=!0),this.feature=n,t.resolve({feature:n,changed:r,request:t}),delete this.requests[e.id]}else g("error","FeatureSelection.finishRead(): could not find message",e)}static makeEntry(e){this.map_entry++;var t=255&this.map_entry,n=this.map_entry>>8&255,r=this.map_entry>>16&255,i=this.map_prefix,o=t/255,s=n/255,a=r/255,l=i/255,u=t+(n<<8)+(r<<16)+(i<<24)>>>0;return this.map[u]={color:[o,s,a,l]},this.map_size++,this.tiles[e.key]||(this.tiles[e.key]={entries:[],tile:{key:e.key,coords:e.coords,style_z:e.style_z,source:e.source,generation:e.generation}}),this.tiles[e.key].entries.push(u),this.map[u]}static makeColor(e,t,n){var r=this.makeEntry(t);return r.feature={id:e.id,properties:e.properties,source_name:n.source,source_layer:n.layer,layers:n.layers,tile:this.tiles[t.key].tile},r.color}static reset(e){Array.isArray(e)?e.forEach(e=>this.clearSource(e)):(this.tiles={},this.map={},this.map_size=0,this.map_entry=0)}static clearSource(e){for(let t in this.tiles)this.tiles[t].tile.source===e&&this.clearTile(t)}static clearTile(e){this.tiles[e]&&(this.tiles[e].entries.forEach(e=>delete this.map[e]),this.map_size-=this.tiles[e].entries.length,delete this.tiles[e])}static getMapSize(){return this.map_size}static setPrefix(e){this.map_prefix=e}}var he;de.map={},de.tiles={},de.map_size=0,de.map_entry=0,de.map_prefix=0,de.defaultColor=[0,0,0,1];var pe=he={};he.BYTE=5120,he.UNSIGNED_BYTE=5121,he.SHORT=5122,he.UNSIGNED_SHORT=5123,he.INT=5124,he.UNSIGNED_INT=5125,he.FLOAT=5126;class fe{constructor(e,t,n,r,i){i=i||{},this.gl=e,this.vertex_data=t,this.element_data=n,this.vertex_layout=r,this.vertex_buffer=this.gl.createBuffer(),this.buffer_size=this.vertex_data.byteLength,this.draw_mode=i.draw_mode||this.gl.TRIANGLES,this.data_usage=i.data_usage||this.gl.STATIC_DRAW,this.vertices_per_geometry=3,this.uniforms=i.uniforms,this.textures=i.textures,this.retain=i.retain||!1,this.created_at=+new Date,this.fade_in_time=i.fade_in_time||0,this.vertex_count=this.vertex_data.byteLength/this.vertex_layout.stride,this.element_count=0,this.vaos={},this.toggle_element_array=!1,this.element_data?(this.toggle_element_array=!0,this.element_count=this.element_data.length,this.geometry_count=this.element_count/this.vertices_per_geometry,this.element_type=this.element_data.constructor===Uint16Array?this.gl.UNSIGNED_SHORT:this.gl.UNSIGNED_INT,this.element_buffer=this.gl.createBuffer(),this.buffer_size+=this.element_data.byteLength,this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.element_buffer),this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER,this.element_data,this.data_usage)):this.geometry_count=this.vertex_count/this.vertices_per_geometry,this.upload(),this.retain||(delete this.vertex_data,delete this.element_data),this.valid=!0}render(e={}){if(!this.valid)return!1;var t=e.program||j.current;t.use(),this.uniforms&&(t.saveUniforms(this.uniforms),t.setUniforms(this.uniforms,!1));let n=(+new Date-this.created_at)/1e3;return t.uniform("1f","u_visible_time",n),this.bind(t),this.toggle_element_array?this.gl.drawElements(this.draw_mode,this.element_count,this.element_type,0):this.gl.drawArrays(this.draw_mode,0,this.vertex_count),B.bind(this.gl,null),this.uniforms&&t.restoreUniforms(this.uniforms),n<this.fade_in_time}bind(e){let t=this.vaos[e.id];t?B.bind(this.gl,t):this.vaos[e.id]=B.create(this.gl,()=>{this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertex_buffer),this.toggle_element_array&&this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.element_buffer),this.vertex_layout.enableDynamicAttributes(this.gl,e)}),this.vertex_layout.enableStaticAttributes(this.gl,e)}upload(){this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertex_buffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.vertex_data,this.data_usage)}destroy(){if(!this.valid)return!1;this.valid=!1;for(let e in this.vaos)B.destroy(this.gl,this.vaos[e]);return this.gl.deleteBuffer(this.vertex_buffer),this.vertex_buffer=null,this.element_buffer&&(this.gl.deleteBuffer(this.element_buffer),this.element_buffer=null),delete this.vertex_data,delete this.element_data,this.textures&&this.textures.forEach(e=>O.release(e)),!0}}const me=["emission","ambient","diffuse","specular"];class ge{constructor(e){e=e||{},me.forEach(t=>{const n=e[t];null!=n&&(n.texture?this[t]={texture:n.texture,mapping:n.mapping||"spheremap",scale:A.expandVec3(null!=n.scale?n.scale:1),amount:A.expandVec4(null!=n.amount?n.amount:1)}:"number"==typeof n||Array.isArray(n)?this[t]={amount:A.expandVec4(n)}:this[t]="string"==typeof n?{amount:Q.parseColor(n)}:n)}),this.specular&&(this.specular.shininess=e.shininess?parseFloat(e.shininess):.2),null!=e.normal&&(this.normal={texture:e.normal.texture,mapping:e.normal.mapping||"triplanar",scale:A.expandVec3(null!=e.normal.scale?e.normal.scale:1),amount:null!=e.normal.amount?e.normal.amount:1})}static isValid(e){return null!=e&&(null!=e.emission||null!=e.ambient||null!=e.diffuse||null!=e.specular)}inject(e){me.forEach(t=>{let n=`TANGRAM_MATERIAL_${t.toUpperCase()}`,r=n+"_TEXTURE";e.defines[n]=null!=this[t],this[t]&&this[t].texture&&(e.defines[r]=!0,e.defines[r+"_"+this[t].mapping.toUpperCase()]=!0,e.defines[`TANGRAM_MATERIAL_TEXTURE_${this[t].mapping.toUpperCase()}`]=!0,e.texcoords=e.texcoords||"uv"===this[t].mapping)}),this.normal&&this.normal.texture&&(e.defines.TANGRAM_MATERIAL_NORMAL_TEXTURE=!0,e.defines["TANGRAM_MATERIAL_NORMAL_TEXTURE_"+this.normal.mapping.toUpperCase()]=!0,e.defines[`TANGRAM_MATERIAL_TEXTURE_${this.normal.mapping.toUpperCase()}`]=!0,e.texcoords=e.texcoords||"uv"===this.normal.mapping),e.replaceShaderBlock(ge.block,"/*\n\nDefines globals:\nmaterial\nlight_accumulator_*\n\n*/\n\n\n// MATERIALS\n//\nstruct Material {\n #ifdef TANGRAM_MATERIAL_EMISSION\n vec4 emission;\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE\n vec3 emissionScale;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT\n vec4 ambient;\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE\n vec3 ambientScale;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n vec4 diffuse;\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE\n vec3 diffuseScale;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n vec4 specular;\n float shininess;\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE\n vec3 specularScale;\n #endif\n #endif\n\n\n #ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE\n vec3 normalScale;\n float normalAmount;\n #endif\n};\n\n// Note: uniform is copied to a global instance to allow modification\nuniform Material u_material;\nMaterial material;\n\n#ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE\nuniform sampler2D u_material_emission_texture;\n#endif\n\n#ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE\nuniform sampler2D u_material_ambient_texture;\n#endif\n\n#ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE\nuniform sampler2D u_material_diffuse_texture;\n#endif\n\n#ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE\nuniform sampler2D u_material_specular_texture;\n#endif\n\n#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE\nuniform sampler2D u_material_normal_texture;\n#endif\n\n// Global light accumulators for each property\nvec4 light_accumulator_ambient = vec4(vec3(0.0), 1.);\nvec4 light_accumulator_diffuse = vec4(vec3(0.0), 1.);\n#ifdef TANGRAM_MATERIAL_SPECULAR\n vec4 light_accumulator_specular = vec4(vec3(0.0), 1.);\n#endif\n\n\n#ifdef TANGRAM_MATERIAL_TEXTURE_SPHEREMAP\nvec4 getSphereMap (in sampler2D _tex, in vec3 _eyeToPoint, in vec3 _normal, in vec2 _skew) {\n // Normalized vector from camera to surface\n vec3 eye = normalize(_eyeToPoint);\n\n // Adjust for camera skew\n eye.xy -= _skew;\n eye = normalize(eye);\n\n // Reflection of eye off of surface normal\n vec3 r = reflect(eye, _normal);\n\n // Map reflected vector onto the surface of a sphere\n r.z += 1.0;\n float m = 2. * length(r);\n\n // Adjust xy to account for spherical shape, and center in middle of texture\n vec2 uv = r.xy / m + .5;\n\n // Sample the environment map\n return texture2D(_tex, uv);\n}\n#endif\n\n\n#ifdef TANGRAM_MATERIAL_TEXTURE_TRIPLANAR\nvec3 getTriPlanarBlend (in vec3 _normal) {\n vec3 blending = abs(_normal);\n blending = normalize(max(blending, 0.00001));\n float b = (blending.x + blending.y + blending.z);\n return blending / b;\n}\n\nvec4 getTriPlanar (in sampler2D _tex, in vec3 _pos, in vec3 _normal, in vec3 _scale) {\n vec3 blending = getTriPlanarBlend(_normal);\n vec4 xaxis = texture2D(_tex, fract(_pos.yz * _scale.x));\n vec4 yaxis = texture2D(_tex, fract(_pos.xz * _scale.y));\n vec4 zaxis = texture2D(_tex, fract(_pos.xy * _scale.z));\n return xaxis * blending.x + yaxis * blending.y + zaxis * blending.z;\n}\n#endif\n\n\n#ifdef TANGRAM_MATERIAL_TEXTURE_PLANAR\nvec4 getPlanar (in sampler2D _tex, in vec3 _pos, in vec2 _scale) {\n return texture2D( _tex, fract(_pos.xy * _scale.x) );\n}\n#endif\n\n\n#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE\nvoid calculateNormal (inout vec3 _normal) {\n // Get NORMALMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_UV\n _normal += texture2D(u_material_normal_texture, fract(v_texcoord*material.normalScale.xy)).rgb*2.0-1.0;\n #endif\n\n #ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_PLANAR\n vec3 normalTex = getPlanar(u_material_normal_texture, v_world_position.xyz, material.normalScale.xy).rgb*2.0-1.0;\n _normal += normalTex;\n #endif\n\n #ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_TRIPLANAR\n vec3 normalTex = getTriPlanar(u_material_normal_texture, v_world_position.xyz, _normal, material.normalScale).rgb*2.0-1.0;\n _normal += normalTex;\n #endif\n\n _normal = normalize(_normal);\n}\n#endif\n\nvoid calculateMaterial (in vec3 _eyeToPoint, inout vec3 _normal) {\n // get EMISSION TEXTUREMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_UV\n material.emission *= texture2D(u_material_emission_texture,v_texcoord);\n #endif\n\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_PLANAR\n material.emission *= getPlanar(u_material_emission_texture, v_world_position.xyz, material.emissionScale.xy);\n #endif\n\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_TRIPLANAR\n material.emission *= getTriPlanar(u_material_emission_texture, v_world_position.xyz, _normal, material.emissionScale);\n #endif\n\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_SPHEREMAP\n material.emission *= getSphereMap(u_material_emission_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n\n // get AMBIENT TEXTUREMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_UV\n material.ambient *= texture2D(u_material_ambient_texture,v_texcoord);\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_PLANAR\n material.ambient *= getPlanar(u_material_ambient_texture, v_world_position.xyz, material.ambientScale.xy);\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_TRIPLANAR\n material.ambient *= getTriPlanar(u_material_ambient_texture, v_world_position.xyz, _normal, material.ambientScale);\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_SPHEREMAP\n material.ambient *= getSphereMap(u_material_ambient_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n\n // get DIFFUSE TEXTUREMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_UV\n material.diffuse *= texture2D(u_material_diffuse_texture,v_texcoord);\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_PLANAR\n material.diffuse *= getPlanar(u_material_diffuse_texture, v_world_position.xyz, material.diffuseScale.xy);\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_TRIPLANAR\n material.diffuse *= getTriPlanar(u_material_diffuse_texture, v_world_position.xyz, _normal, material.diffuseScale);\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_SPHEREMAP\n material.diffuse *= getSphereMap(u_material_diffuse_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n\n // get SPECULAR TEXTUREMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_UV\n material.specular *= texture2D(u_material_specular_texture,v_texcoord);\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_PLANAR\n material.specular *= getPlanar(u_material_specular_texture, v_world_position.xyz, material.specularScale.xy);\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_TRIPLANAR\n material.specular *= getTriPlanar(u_material_specular_texture, v_world_position.xyz, _normal, material.specularScale);\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_SPHEREMAP\n material.specular *= getSphereMap(u_material_specular_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n}\n","Material"),e.addShaderBlock("setup","\nmaterial = u_material;\n","Material")}setupProgram(e){me.forEach(t=>{this[t]&&(this[t].texture?(e.setTextureUniform(`u_material_${t}_texture`,this[t].texture),e.uniform("3fv",`u_material.${t}Scale`,this[t].scale),e.uniform("4fv",`u_material.${t}`,this[t].amount)):this[t].amount&&e.uniform("4fv",`u_material.${t}`,this[t].amount))}),this.specular&&e.uniform("1f","u_material.shininess",this.specular.shininess),this.normal&&this.normal.texture&&(e.setTextureUniform("u_material_normal_texture",this.normal.texture),e.uniform("3fv","u_material.normalScale",this.normal.scale),e.uniform("1f","u_material.normalAmount",this.normal.amount))}}var ye;ge.block="material";var be=ye={};ye.copy=function(e){for(var t=[],n=e.length,r=0;r<n;r++)t[r]=e[r];return t},ye.neg=function(e){for(var t=[],n=e.length,r=0;r<n;r++)t[r]=-e[r];return t},ye.add=function(e,t){for(var n=[],r=Math.min(e.length,t.length),i=0;i<r;i++)n[i]=e[i]+t[i];return n},ye.sub=function(e,t){for(var n=[],r=Math.min(e.length,t.length),i=0;i<r;i++)n[i]=e[i]-t[i];return n},ye.signed_area=function(e,t,n){return(t[0]-e[0])*(n[1]-e[1])-(n[0]-e[0])*(t[1]-e[1])},ye.mult=function(e,t){var n,r=[],i=e.length;if("number"==typeof t)for(n=0;n<i;n++)r[n]=e[n]*t;else for(i=Math.min(e.length,t.length),n=0;n<i;n++)r[n]=e[n]*t[n];return r},ye.div=function(e,t){var n,r=[];if("number"==typeof t)for(n=0;n<e.length;n++)r[n]=e[n]/t;else{var i=Math.min(e.length,t.length);for(n=0;n<i;n++)r[n]=e[n]/t[n]}return r},ye.perp=function(e,t){return[t[1]-e[1],e[0]-t[0]]},ye.rot=function(e,t){var n=Math.cos(t),r=Math.sin(t);return[e[0]*n-e[1]*r,e[0]*r+e[1]*n]},ye.angle=function([e,t]){return Math.atan2(t,e)},ye.angleBetween=function(e,t){var n=ye.dot(ye.normalize(ye.copy(e)),ye.normalize(ye.copy(t)));return n>1&&(n=1),Math.acos(n)},ye.isEqual=function(e,t){for(var n=e.length,r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0},ye.lengthSq=function(e){return 2===e.length?e[0]*e[0]+e[1]*e[1]:e.length>=3?e[0]*e[0]+e[1]*e[1]+e[2]*e[2]:0},ye.length=function(e){return Math.sqrt(ye.lengthSq(e))},ye.normalize=function(e){var t;if(2===e.length){if(1===(t=e[0]*e[0]+e[1]*e[1]))return e;0!==(t=Math.sqrt(t))?(e[0]/=t,e[1]/=t):(e[0]=0,e[1]=0)}else if(e.length>=3){if(1===(t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2]))return e;0!==(t=Math.sqrt(t))?(e[0]/=t,e[1]/=t,e[2]/=t):(e[0]=0,e[1]=0,e[2]=0)}return e},ye.cross=function(e,t){return 2===e.length?e[0]*t[1]-e[1]*t[0]:3===e.length?[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]:void 0},ye.dot=function(e,t){for(var n=0,r=Math.min(e.length,t.length),i=0;i<r;i++)n+=e[i]*t[i];return n};class ve{constructor(e,t){this.name=t.name,this.view=e,null==t.ambient||"number"==typeof t.ambient?this.ambient=A.expandVec3(t.ambient||0):this.ambient=Q.parseColor(t.ambient).slice(0,3),null==t.diffuse||"number"==typeof t.diffuse?this.diffuse=A.expandVec3(null!=t.diffuse?t.diffuse:1):this.diffuse=Q.parseColor(t.diffuse).slice(0,3),null==t.specular||"number"==typeof t.specular?this.specular=A.expandVec3(t.specular||0):this.specular=Q.parseColor(t.specular).slice(0,3)}static create(e,t){if(ve.types[t.type])return new ve.types[t.type](e,t)}static setMode(e,t){!0===e&&(e="fragment"),e=ve.enabled&&(null!=e?e:"fragment"),t.defines.TANGRAM_LIGHTING_FRAGMENT="fragment"===e,t.defines.TANGRAM_LIGHTING_VERTEX="vertex"===e}static inject(e){if(j.removeBlock(ve.block),!ve.enabled)return;let t="";if(e&&Object.keys(e).length>0){let n={};for(let t in e)n[e[t].type]=!0;for(let e in n)ve.types[e].inject();for(let n in e)e[n].inject(),t+=`calculateLight(${n}, _eyeToPoint, _normal);\n`}let n=`\n vec4 calculateLighting(in vec3 _eyeToPoint, in vec3 _normal, in vec4 _color) {\n\n // Do initial material calculations over normal, emission, ambient, diffuse and specular values\n calculateMaterial(_eyeToPoint,_normal);\n\n // Un roll the loop of individual ligths to calculate\n ${t}\n\n // Final light intensity calculation\n vec4 color = vec4(vec3(0.), _color.a); // start with vertex color alpha\n\n #ifdef TANGRAM_MATERIAL_EMISSION\n color.rgb = material.emission.rgb;\n color.a *= material.emission.a;\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT\n color.rgb += light_accumulator_ambient.rgb * _color.rgb * material.ambient.rgb;\n color.a *= material.ambient.a;\n #else\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n color.rgb += light_accumulator_ambient.rgb * _color.rgb * material.diffuse.rgb;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n color.rgb += light_accumulator_diffuse.rgb * _color.rgb * material.diffuse.rgb;\n color.a *= material.diffuse.a;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n color.rgb += light_accumulator_specular.rgb * material.specular.rgb;\n color.a *= material.specular.a;\n #endif\n\n // Clamp final color\n color = clamp(color, 0.0, 1.0);\n\n return color;\n }`;j.addBlock(ve.block,n)}inject(){let e=`\n uniform ${this.struct_name} u_${this.name};\n ${this.struct_name} ${this.name};\n `,t=`\n ${this.name} = u_${this.name};\n\n `;j.addBlock(ve.block,e),j.addBlock("setup",t)}update(){}setupProgram(e){e.uniform("3fv",`u_${this.name}.ambient`,this.ambient),e.uniform("3fv",`u_${this.name}.diffuse`,this.diffuse),e.uniform("3fv",`u_${this.name}.specular`,this.specular)}}ve.types={},ve.block="lighting",ve.enabled=!0,ve.types.ambient=class extends ve{constructor(e,t){super(e,t),this.type="ambient",this.struct_name="AmbientLight"}static inject(){j.addBlock(ve.block,"/*\n\nExpected globals:\nlight_accumulator_*\n\n*/\n\nstruct AmbientLight {\n vec3 ambient;\n};\n\nvoid calculateLight(in AmbientLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n light_accumulator_ambient.rgb += _light.ambient;\n}\n")}setupProgram(e){e.uniform("3fv",`u_${this.name}.ambient`,this.ambient)}},ve.types.directional=class extends ve{constructor(e,t){if(super(e,t),this.type="directional",this.struct_name="DirectionalLight",t.direction)this._direction=t.direction;else{let e=135,n=Math.sin(60*Math.PI/180);this._direction=[Math.cos(Math.PI*e/180)*n,Math.sin(Math.PI*e/180)*n,-.5],null==t.ambient&&(this.ambient=A.expandVec3(.5))}this.direction=this._direction.map(parseFloat)}get direction(){return this._direction}set direction(e){this._direction=be.normalize(be.copy(e))}static inject(){j.addBlock(ve.block,"/*\n\nExpected globals:\nmaterial\nlight_accumulator_*\n\n*/\n\nstruct DirectionalLight {\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n vec3 direction;\n};\n\nvoid calculateLight(in DirectionalLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n\n light_accumulator_ambient.rgb += _light.ambient;\n\n float nDotVP = clamp(dot(_normal, -_light.direction), 0.0, 1.0);\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n light_accumulator_diffuse.rgb += _light.diffuse * nDotVP;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n float pf = 0.0;\n if (nDotVP > 0.0) {\n vec3 reflectVector = reflect(_light.direction, _normal);\n float eyeDotR = max(dot(normalize(_eyeToPoint), reflectVector), 0.0);\n pf = pow(eyeDotR, material.shininess);\n }\n light_accumulator_specular.rgb += _light.specular * pf;\n #endif\n}\n")}setupProgram(e){super.setupProgram(e),e.uniform("3fv",`u_${this.name}.direction`,this.direction)}};class _e extends ve{constructor(e,t){super(e,t),this.type="point",this.struct_name="PointLight",this.position=t.position||[0,0,"100px"],this.position_eye=[],this.origin=t.origin||"ground",this.attenuation=isNaN(parseFloat(t.attenuation))?0:parseFloat(t.attenuation),t.radius?Array.isArray(t.radius)&&2===t.radius.length?this.radius=t.radius:this.radius=[null,t.radius]:this.radius=null}static inject(){j.addBlock(ve.block,"/*\n\nExpected globals:\nmaterial\nlight_accumulator_*\n\n*/\n\nstruct PointLight {\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n vec4 position;\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float attenuationExponent;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n float innerRadius;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float outerRadius;\n#endif\n};\n\nvoid calculateLight(in PointLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n\n float dist = length(_light.position.xyz - _eyeToPoint);\n\n // Compute vector from surface to light position\n vec3 VP = (_light.position.xyz - _eyeToPoint) / dist;\n\n // Normalize the vector from surface to light position\n float nDotVP = clamp(dot(VP, _normal), 0.0, 1.0);\n\n // Attenuation defaults\n float attenuation = 1.0;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float Rin = 1.0;\n float e = _light.attenuationExponent;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #endif\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-(pow(d,e));\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/(pow(d,e)), 0.0, 1.0);\n #endif\n #else\n float Rin = 0.0;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/d, 0.0, 1.0);\n #endif\n #else\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float d = clamp(dist/_light.outerRadius, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n attenuation = 1.0;\n #endif\n #endif\n #endif\n\n // Computer accumulators\n light_accumulator_ambient.rgb += _light.ambient * attenuation;\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n light_accumulator_diffuse.rgb += _light.diffuse * nDotVP * attenuation;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n float pf = 0.0; // power factor for shiny speculars\n if (nDotVP > 0.0) {\n vec3 reflectVector = reflect(-VP, _normal);\n float eyeDotR = max(0.0, dot(-normalize(_eyeToPoint), reflectVector));\n pf = pow(eyeDotR, material.shininess);\n }\n\n light_accumulator_specular.rgb += _light.specular * pf * attenuation;\n #endif\n}\n")}inject(){super.inject(),j.defines.TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT=0!==this.attenuation,j.defines.TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS=null!=this.radius&&null!=this.radius[0],j.defines.TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS=null!=this.radius}update(){this.updateEyePosition()}updateEyePosition(){if("world"===this.origin){const e=U.latLngToMeters([...this.position]);this.position_eye[0]=e[0]-this.view.camera.position_meters[0],this.position_eye[1]=e[1]-this.view.camera.position_meters[1],this.position_eye[2]=Q.convertUnits(this.position[2],{zoom:this.view.zoom,meters_per_pixel:U.metersPerPixel(this.view.zoom)}),this.position_eye[2]=this.position_eye[2]-this.view.camera.position_meters[2]}else"ground"!==this.origin&&"camera"!==this.origin||(this.position_eye=Q.convertUnits(this.position,{zoom:this.view.zoom,meters_per_pixel:U.metersPerPixel(this.view.zoom)}),"ground"===this.origin&&(this.position_eye[2]=this.position_eye[2]-this.view.camera.position_meters[2]));this.position_eye[3]=1}setupProgram(e){super.setupProgram(e),e.uniform("4fv",`u_${this.name}.position`,this.position_eye),j.defines.TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT&&e.uniform("1f",`u_${this.name}.attenuationExponent`,this.attenuation),j.defines.TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS&&e.uniform("1f",`u_${this.name}.innerRadius`,Q.convertUnits(this.radius[0],{zoom:this.view.zoom,meters_per_pixel:U.metersPerPixel(this.view.zoom)})),j.defines.TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS&&e.uniform("1f",`u_${this.name}.outerRadius`,Q.convertUnits(this.radius[1],{zoom:this.view.zoom,meters_per_pixel:U.metersPerPixel(this.view.zoom)}))}}ve.types.point=_e,ve.types.spotlight=class extends _e{constructor(e,t){super(e,t),this.type="spotlight",this.struct_name="SpotLight",this.direction=this._direction=(t.direction||[0,0,-1]).map(parseFloat),this.exponent=t.exponent?parseFloat(t.exponent):.2,this.angle=t.angle?parseFloat(t.angle):20}get direction(){return this._direction}set direction(e){this._direction=be.normalize(be.copy(e))}static inject(){j.addBlock(ve.block,"/*\n\nExpected globals:\nmaterial\nlight_accumulator_*\n\n*/\n\nstruct SpotLight {\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n vec4 position;\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float attenuationExponent;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n float innerRadius;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float outerRadius;\n#endif\n\n vec3 direction;\n float spotCosCutoff;\n float spotExponent;\n};\n\nvoid calculateLight(in SpotLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n\n float dist = length(_light.position.xyz - _eyeToPoint);\n\n // Compute vector from surface to light position\n vec3 VP = (_light.position.xyz - _eyeToPoint) / dist;\n\n // normal . light direction\n float nDotVP = clamp(dot(_normal, VP), 0.0, 1.0);\n\n // Attenuation defaults\n float attenuation = 1.0;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float Rin = 1.0;\n float e = _light.attenuationExponent;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #endif\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-(pow(d,e));\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/(pow(d,e)), 0.0, 1.0);\n #endif\n #else\n float Rin = 0.0;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/d, 0.0, 1.0);\n #endif\n #else\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float d = clamp(dist/_light.outerRadius, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n attenuation = 1.0;\n #endif\n #endif\n #endif\n\n // spotlight attenuation factor\n float spotAttenuation = 0.0;\n\n // See if point on surface is inside cone of illumination\n float spotDot = clamp(dot(-VP, _light.direction), 0.0, 1.0);\n\n if (spotDot >= _light.spotCosCutoff) {\n spotAttenuation = pow(spotDot, _light.spotExponent);\n }\n\n light_accumulator_ambient.rgb += _light.ambient * attenuation * spotAttenuation;\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n light_accumulator_diffuse.rgb += _light.diffuse * nDotVP * attenuation * spotAttenuation;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n // Power factor for shiny speculars\n float pf = 0.0;\n if (nDotVP > 0.0) {\n vec3 reflectVector = reflect(-VP, _normal);\n float eyeDotR = max(dot(-normalize(_eyeToPoint), reflectVector), 0.0);\n pf = pow(eyeDotR, material.shininess);\n }\n light_accumulator_specular.rgb += _light.specular * pf * attenuation * spotAttenuation;\n #endif\n}\n")}setupProgram(e){super.setupProgram(e),e.uniform("3fv",`u_${this.name}.direction`,this.direction),e.uniform("1f",`u_${this.name}.spotCosCutoff`,Math.cos(3.14159*this.angle/180)),e.uniform("1f",`u_${this.name}.spotExponent`,this.exponent)}};class xe extends Error{constructor(e){super(),this.name="MethodNotImplemented",this.message="Method "+e+" must be implemented in subclass"}}class we{constructor(e,t){this.validate(e),this.config=e,this.sources=t,this.id=e.id,this.name=e.name,this.pad_scale=e.pad_scale||1e-5,this.default_winding=null,this.rasters=[],Array.isArray(e.rasters)&&e.rasters.forEach(e=>{-1===this.rasters.indexOf(e)&&this.rasters.push(e)}),this.preprocess=e.preprocess,"function"==typeof this.preprocess&&this.preprocess.bind(this),this.transform=e.transform,"function"==typeof this.transform&&this.transform.bind(this),this.extra_data=e.extra_data,this.scripts=e.scripts,this.setZooms(e),this.zoom_offset=null!=e.zoom_offset?e.zoom_offset:0,this.zoom_offset<0&&(g({level:"warn",once:!0},`Data source '${this.name}' zoom_offset must not be negative – setting to 0.`),this.zoom_offset=0),this.setTileSize(e.tile_size),this.min_display_zoom=Math.max(e.min_display_zoom||0,this.zooms[0]),this.max_display_zoom=null!=e.max_display_zoom?e.max_display_zoom:null}static register(e,t){e&&t&&(we.types[e]=t)}static create(e,t){if("function"==typeof we.types[e.type]){const n=we.types[e.type](e);if(n)return new n(e,t)}}static tileLayoutChanged(e,t){if(!e||!t)return!0;const n=["max_zoom","zooms","min_display_zoom","max_display_zoom","bounds","tile_size","zoom_offset"],r=k(e.config,n),i=k(t.config,n);return JSON.stringify(r)!==JSON.stringify(i)}static projectData(e){var t=+new Date;for(var n in e.layers)for(var r=e.layers[n].features.length,i=0;i<r;i++){var o=e.layers[n].features[i];U.transformGeometry(o.geometry,this.projectCoord)}void 0!==e.debug&&(e.debug.projection=+new Date-t)}static projectCoord(e){U.latLngToMeters(e)}static scaleData(e,{coords:{z:t},min:n}){let r=U.unitsPerMeter(t);for(var i in e.layers)for(var o=e.layers[i].features.length,s=0;s<o;s++){var a=e.layers[i].features[s];U.transformGeometry(a.geometry,e=>{e[0]=(e[0]-n.x)*r,e[1]=(e[1]-n.y)*r*-1})}}load(e){return e.source_data={},e.source_data.layers={},e.pad_scale=this.pad_scale,e.rasters=[...this.rasters],this._load(e).then(e=>{for(let t in e.source_data.layers){let n=e.source_data.layers[t];n&&n.features&&n.features.forEach(e=>{U.transformGeometry(e.geometry,e=>{e[1]=-e[1],this.pad_scale&&(e[0]=Math.round(e[0]*(1+this.pad_scale)-U.tile_scale*this.pad_scale/2),e[1]=Math.round(e[1]*(1+this.pad_scale)-U.tile_scale*this.pad_scale/2))}),this.updateDefaultWinding(e.geometry)})}return e.default_winding=this.default_winding||"CCW",e})}_load(){throw new xe("_load")}copyTileData(e,t){return g("trace",`Copy tile data from ${e.key} to ${t.key}`),t.source_data={layers:e.source_data.layers},t.rasters=[...e.rasters],t.pad_scale=e.pad_scale,t.default_winding=e.default_winding,t}setZooms({max_zoom:e,zooms:t}){if(this.max_zoom=null!=e?e:U.default_source_max_zoom,Array.isArray(t))this.zooms=t,this.max_zoom=this.zooms[this.zooms.length-1];else{this.zooms=[];for(let e=0;e<=this.max_zoom;e++)this.zooms[e]=e}}setTileSize(e){this.tile_size=e||256,("number"!=typeof this.tile_size||this.tile_size<256||!y.isPowerOf2(this.tile_size))&&(g({level:"warn",once:!0},`Data source '${this.name}': 'tile_size' parameter must be a number that is a power of 2 greater than or equal to 256, but was '${e}'`),this.tile_size=256),this.zoom_bias=Math.log2(this.tile_size)-8+this.zoom_offset}updateDefaultWinding(e){return null==this.default_winding&&("Polygon"===e.type?this.default_winding=U.ringWinding(e.coordinates[0]):"MultiPolygon"===e.type&&(this.default_winding=U.ringWinding(e.coordinates[0][0]))),this.default_winding}includesTile(e,t){if(e.z<this.min_display_zoom||null!=this.max_display_zoom&&t>this.max_display_zoom)return!1;for(let t=0;t<this.rasters.length;t++){const n=this.rasters[t];if(this.sources[n]&&this.sources[n]!==this&&!this.sources[n].includesTile(e,e.z))return!1}return!0}validate(){}}we.types={};let Ee=0;class Se extends we{constructor(e,t){super(e,t),this.response_type="";let[n,r]=function(e,t){if(!t||0===Object.keys(t).length)return[e,[]];var n=e.indexOf("?"),r=e.indexOf("#"),i="";r>-1&&(i=e.slice(r),e=e.slice(0,r)),-1===n&&(n=e.length,e+="?"),n++;var o="",s=[];for(var a in t)""===E(a,e)?o+=`${a}=${t[a]}&`:s.push([a,t[a]]);return[e=e.slice(0,n)+o+e.slice(n)+i,s]}(e.url,e.url_params);this.url=n,r.forEach(([t,n])=>{g({level:"warn",once:!0},`Data source '${this.name}': parameter '${t}' already present in URL '${e.url}', skipping value '${t}=${n}' specified in 'url_params'`)}),e.request_headers&&"object"==typeof e.request_headers&&(this.request_headers=e.request_headers)}_load(e){let t=this.formatURL(this.url,e),n=e.source_data;return n.url=t,e.debug=e.debug||{},e.debug.network=+new Date,new Promise(r=>{let i=Ee+++"-"+t,o=y.io(t,6e4,this.response_type,"GET",this.request_headers,i);n.request_id=i,n.error=null,o.then(({body:t})=>{e.debug.response_size=t&&(t.length||t.byteLength),e.debug.network=+new Date-e.debug.network,e.debug.parsing=+new Date,null!=t&&"function"==typeof this.preprocess&&(t=this.preprocess(t)),(t=t instanceof Promise?t:Promise.resolve(t)).then(t=>{null!=t?this.parseSourceData(e,n,t):n.layers={},e.debug.parsing=+new Date-e.debug.parsing,r(e)})}).catch(t=>{n.error=t.stack,r(e)})})}validate(e){if("string"!=typeof e.url)throw Error("Network data source must provide a string `url` property")}formatURL(){throw new xe("formatURL")}parseSourceData(){throw new xe("parseSourceData")}}class Te extends Se{constructor(e,t){super(e,t),this.tiled=!0,this.bounds=this.parseBounds(e),this.builds_geometry_tiles=!1,this.tms=!0===e.tms,this.url&&this.url.search("{s}")>-1&&(Array.isArray(e.url_subdomains)&&e.url_subdomains.length>0?(this.url_subdomains=e.url_subdomains,this.next_url_subdomain=0):g({level:"warn",once:!0},`Data source '${this.name}': source URL includes '{s}' subdomain marker ('${this.url}'), but no subdomains were specified in 'url_subdomains' parameter`)),this.url&&this.url.search("{r}")>-1&&(Array.isArray(e.url_density_scales)&&e.url_density_scales.length>0?this.url_density_scales=e.url_density_scales:this.url_density_scales=[1,2])}parseBounds(e){if(Array.isArray(e.bounds)&&4===e.bounds.length){const[t,n,r,i]=e.bounds;return{latlng:[...e.bounds],meters:{min:U.latLngToMeters([t,i]),max:U.latLngToMeters([r,n])},tiles:{min:{},max:{}}}}}checkBounds(e,t){if(t){e=U.wrapTile(e);let n=t.tiles.min[e.z];n||(n=t.tiles.min[e.z]=U.tileForMeters(t.meters.min,e.z));let r=t.tiles.max[e.z];if(r||(r=t.tiles.max[e.z]=U.tileForMeters(t.meters.max,e.z)),e.y<n.y||e.y>r.y)return!1;if(n.x<=r.x){if(e.x<n.x||e.x>r.x)return!1}else if(e.x>r.x&&e.x<n.x)return!1}return!0}includesTile(e,t){return!!super.includesTile(e,t)&&!!this.checkBounds(e,this.bounds)}formatURL(e,t){let n=U.wrapTile(t.coords,{x:!0});this.tms&&(n.y=Math.pow(2,n.z)-1-n.y);let r=e.replace("{x}",n.x).replace("{y}",n.y).replace("{z}",n.z).replace("{r}",this.getDensityModifier()).replace("{q}",this.toQuadKey(n));return null!=this.url_subdomains&&(r=r.replace("{s}",this.url_subdomains[this.next_url_subdomain]),this.next_url_subdomain=(this.next_url_subdomain+1)%this.url_subdomains.length),r}getDensityModifier(){if(this.url_density_scales){const e=y.device_pixel_ratio;let t=this.url_density_scales.filter(t=>e>=t).reverse()[0];if(t=null!=t?t:this.url_density_scales[0],t>1)return`@${t}x`}return""}toQuadKey({x:e,y:t,z:n}){let r="";for(let i=n;i>0;i--){let n=0,o=1<<i-1;e&o&&n++,t&o&&(n+=2),r+=n.toString()}return r}static urlHasTilePattern(e){return e&&(e.search("{x}")>-1&&e.search("{y}")>-1&&e.search("{z}")>-1||e.search("{q}")>-1)}}const ke={coord(e){return{x:e.x,y:e.y,z:e.z,key:this.coordKey(e)}},coordKey:({x:e,y:t,z:n})=>e+"/"+t+"/"+n,key(e,t,n){if(!(e.y<0||e.y>=1<<e.z||e.z<0))return[t.name,e.x,e.y,e.z,n].join("/")},normalizedKey(e,t,n){return this.key(this.normalizedCoord(e,t),t,n)},normalizedCoord(e,t){return t.zoom_bias&&(e=this.coordAtZoom(e,Math.max(e.z-t.zoom_bias,t.zooms[0]))),this.coordForTileZooms(e,t.zooms)},coordAtZoom({x:e,y:t,z:n},r){if(n!==(r=Math.max(0,r))){let i=Math.pow(2,n-r);e=Math.floor(e/i),t=Math.floor(t/i),n=r}return this.coord({x:e,y:t,z:n})},coordForTileZooms({x:e,y:t,z:n},r){const i=this.findZoomInRange(n,r);return i!==n?this.coordAtZoom({x:e,y:t,z:n},i):this.coord({x:e,y:t,z:n})},findZoomInRange:(e,t)=>t.filter(t=>e>=t).reverse()[0]||t[0],isDescendant(e,t){if(t.z>e.z){let{x:n,y:r}=this.coordAtZoom(t,e.z);return e.x===n&&e.y===r}return!1},parent({coords:e,source:t,style_z:n}){if(n>0){n--;const r=Math.max(n-t.zoom_bias,t.zooms[0]),i=this.coordForTileZooms(this.coordAtZoom(e,r),t.zooms);return i.z>n?null:{key:this.key(i,t,n),coords:i,style_z:n,source:t}}},children({coords:e,source:t,style_z:n},r={}){n++;const i=this.coordForTileZooms(this.coordAtZoom(e,n-t.zoom_bias),t.zooms);if(i.z===e.z)return[{key:this.key(i,t,n),coords:i,style_z:n,source:t}];{const o=this.key(i,t,n);if(r[t.id]=r[t.id]||{},null==r[t.id][o]){const s=Math.pow(2,i.z-e.z),a=e.x*s,l=e.y*s;let u=[];for(let e=a;e<a+s;e++)for(let r=l;r<l+s;r++){let o=this.coord({x:e,y:r,z:i.z});u.push({key:this.key(o,t,n),coords:o,style_z:n,source:t})}r[t.id][o]=u}return r[t.id][o]}}};class Oe extends Te{constructor(e,t){super(e,t),-1===this.rasters.indexOf(this.name)&&this.rasters.unshift(this.name),this.filtering=e.filtering,this.textures={}}async load(e){e.source_data={},e.source_data.layers={},e.pad_scale=this.pad_scale,e.rasters=[...this.rasters];let t=U.tile_scale;return e.source_data.layers={_default:{type:"FeatureCollection",features:[{geometry:{type:"Polygon",coordinates:[[[0,0],[t,0],[t,-t],[0,-t],[0,0]]]},properties:{}}]}},e.default_winding="CW",e}async tileTexture(e){let t=this.adjustRasterTileZoom(e),n=t.key;if(!this.textures[n]){let e=this.formatURL(this.url,{coords:t});this.textures[n]={name:e,url:e,filtering:this.filtering,coords:t}}return this.textures[n]}adjustRasterTileZoom(e){let t=e.coords;const n=this.sources[e.source];if(n!==this){let r=this.zoom_bias-n.zoom_bias;r>0?t=ke.normalizedCoord(e.coords,{zoom_bias:r,zooms:this.zooms}):(r<0&&g({level:"warn",once:!0},`Raster source '${this.name}' supports higher zoom detail than source '${n.name}' it's attached to. Downsampling this source ${-r} extra zoom levels to match.`),t=ke.coordForTileZooms(t,this.zooms))}return t}}class Ae extends Oe{constructor(e,t){super(e,t),this.load_image={},this.alpha=null!=e.alpha?Math.max(Math.min(e.alpha,1),0):null,this.mask_alpha=!0,this.preserve_tiles_within_zoom=0,this.max_display_density=e.max_display_density,Array.isArray(e.composite)?this.images=e.composite.map(e=>({url:e.url,bounds:this.parseBounds(e),alpha:null!=e.alpha?Math.max(Math.min(e.alpha,1),0):null})):this.images=[{url:this.url,bounds:this.bounds,alpha:this.alpha}]}async tileTexture(e,{blend:t,generation:n}){let r=this.adjustRasterTileZoom(e);const i="opaque"!==t,o=`raster-${this.name}-${r.key}-${i?"alpha":"opaque"}-${n}`;if(O.textures[o])return{name:o,coords:r,skip_create:!0};let s=y.device_pixel_ratio;this.max_display_density&&(s=Math.min(s,this.max_display_density)),s*=2;const a=document.createElement("canvas"),l=a.getContext("2d");a.width=this.tile_size*s,a.height=this.tile_size*s,l.imageSmoothingEnabled="nearest"!==this.filtering;const u=this.images.filter(t=>this.checkBounds(e.coords,t.bounds));return await Promise.all(u.map(t=>{const n=i?null!=t.alpha?t.alpha:this.alpha:1;return this.drawImage(t.url,t.bounds,n,e,s,l)})),{name:o,element:a,filtering:this.filtering,coords:r}}async drawImage(e,t,n,r,i,o){const s=N(e);this.load_image[s]=this.load_image[s]||this.loadImage(e);const a=await this.load_image[s],l=U.metersPerPixel(r.coords.z)/i/(this.tile_size/U.tile_size),u=(t.meters.min[0]-r.min.x)/l,c=-(t.meters.min[1]-r.min.y)/l,d=(t.meters.max[0]-t.meters.min[0])/l,h=-(t.meters.max[1]-t.meters.min[1])/l;o.globalAlpha=null!=n?n:1,o.drawImage(a,u,c,d,h)}loadImage(e){return new Promise(t=>{let n=new Image;n.onload=()=>t(n),n.onerror=n=>{g("warn",`Raster source '${this.name}': failed to load url: '${e}'`,n),t(null)},y.isSafari()&&"data:"===e.slice(0,5)||(n.crossOrigin="anonymous"),n.src=e})}includesTile(e,t){return!!we.prototype.includesTile.call(this,e,t)&&this.images.some(t=>this.checkBounds(e,t.bounds))}validate(e){let t="Raster data source must provide a string `url` parameter, or an array of `composite` raster ";t+="image objects that each have a `url` parameter";let n="Raster data source must provide a `bounds` parameter, or an array of `composite` raster ";if(n+="image objects that each have a `bounds` parameter",Array.isArray(e.composite)){if(e.composite.some(e=>"string"!=typeof e.url))throw Error(t);if(e.composite.some(e=>!(Array.isArray(e.bounds)&&4===e.bounds.length)))throw Error(n);if(null!=e.url||null!=e.bounds)throw Error("Raster data source must have *either* a single image specified as `url` and `bounds `parameters, or an array of `composite` raster image objects, each with `url` and `bounds`.")}else{if("string"!=typeof e.url)throw Error(t);if(!Array.isArray(e.bounds)||4!==e.bounds.length)throw Error(n)}}}function Ce(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Re(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ce(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ce(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}we.register("Raster",e=>Oe.urlHasTilePattern(e.url)?Oe:Ae);var Ne={init({generation:e,styles:t,sources:n={},introspection:r}={}){this.setGeneration(e),this.styles=t,this.sources=n,this.defines=Object.prototype.hasOwnProperty.call(this,"defines")&&this.defines||{},this.shaders=Object.prototype.hasOwnProperty.call(this,"shaders")&&this.shaders||{},this.introspection=r||!1,this.selection=this.selection||this.introspection||!1,this.compile_setup=!1,this.program=null,this.selection_program=null,this.feature_style={},this.vertex_template=[],this.tile_data={},this.stencil_proxy_tiles=!0,this.variants={},this.vertex_layouts={},this.defines.TANGRAM_WORLD_POSITION_WRAP=1e5,this.blend=this.blend||"opaque","opaque"!==this.blend?null==this.blend_order&&(this.blend_order=this.default_blend_orders[this.blend]):this.blend_order=this.default_blend_orders[this.blend],this.defines[`TANGRAM_BLEND_${this.blend.toUpperCase()}`]=!0,this.removeShaderBlock("setup"),this.material instanceof ge||(ge.isValid(this.material)||(this.material=Q.defaults.material),this.material=new ge(this.material)),this.material.inject(this),ve.setMode(this.lighting,this),this.setupRasters(),this.setupCustomAttributes(),this.initialized=!0},destroy(){this.program&&(this.program.destroy(),this.program=null),this.selection_program&&(this.selection_program.destroy(),this.selection_program=null),a.removeTarget(this.main_thread_target),this.gl=null,this.initialized=!1},reset(){},baseStyle(){return this.base||this.name},setGeneration(e){this.generation=e,this.main_thread_target=["Style",this.name,this.generation].join("_"),t.is_main&&a.addTarget(this.main_thread_target,this)},startData(e){this.tile_data[e.id]=this.tile_data[e.id]||{meshes:{},uniforms:{},textures:[]}},async endData(e){var t=this.tile_data[e.id];if(this.tile_data[e.id]=null,t&&Object.keys(t.meshes).length>0){for(let e in t.meshes){let n=t.meshes[e];0!==n.vertex_data.vertex_count?(n.vertex_data.end(),n.vertex_elements=n.vertex_data.element_buffer,n.vertex_data=n.vertex_data.vertex_buffer):delete t.meshes[e]}return this.buildRasterTextures(e,t)}return null},hasDataForTile(e){return null!=this.tile_data[e.id]},getTileMesh(e,t){const n=this.tile_data[e.id].meshes;if(null==n[t.key]){const e=this.vertexLayoutForMeshVariant(t);n[t.key]={variant:t,vertex_data:e.createVertexData()}}return n[t.key]},vertexLayoutForMeshVariant(){},meshVariantTypeForDraw(){},addFeature(e,t,n){let r=n.tile;if(r.generation!==this.generation)return;this.tile_data[r.id]||this.startData(r);let i=this.parseFeature(e,t,n);i&&this.buildGeometry(e.geometry,i,n)>0&&(e.generation=this.generation)},buildGeometry(e,t,n){let r;if("Polygon"===e.type?r=this.buildPolygons([e.coordinates],t,n):"MultiPolygon"===e.type?r=this.buildPolygons(e.coordinates,t,n):"LineString"===e.type?r=this.buildLines([e.coordinates],t,n):"MultiLineString"===e.type?r=this.buildLines(e.coordinates,t,n):"Point"===e.type?r=this.buildPoints([e.coordinates],t,n):"MultiPoint"===e.type&&(r=this.buildPoints(e.coordinates,t,n)),r>0&&v.layer_stats){let e=n.tile;e.debug.layers=e.debug.layers||{list:{},tree:{}};let t=e.debug.layers.list,i=e.debug.layers.tree,o={};n.layers.forEach(e=>{Pe(t,e,1,r,{[this.name]:r},{[this.baseStyle()]:r});let n=i,s=o,a=e.split(":");for(let e=0;e<a.length;e++){let t=a[e];n[t]=n[t]||{features:0,geoms:0,styles:{},base:{}},null==s[t]&&(s[t]={},Pe(n,t,1,r,{[this.name]:r},{[this.baseStyle()]:r})),e<a.length-1&&(n[t].layers=n[t].layers||{}),n=n[t].layers,s=s[t]}})}return r},parseFeature(e,t,n){try{var r=this.feature_style;if(r.order=this.parseOrder(t.order,n),null==r.order&&"overlay"!==this.blend){let e=`Layer '${t.layers.join(", ")}', draw group '${t.group}': `;return e+="'order' parameter is required unless blend mode is 'overlay'",null!=t.order&&(e+="; 'order' was set to a dynamic value (e.g. string tied to feature property, ",e+="or JS function), but evaluated to null for one or more features"),void g({level:"warn",once:!0},e)}if(!(r=this._parseFeature(e,t,n)))return;if(this.shaders.attributes){r.attributes=r.attributes||{};for(const e in this.shaders.attributes)r.attributes[e]=Q.evalCachedProperty(t.attributes&&t.attributes[e],n),"number"!=typeof r.attributes[e]&&(r.attributes[e]=0)}return this.selection?r.interactive=Q.evalProperty(t.interactive,n):r.interactive=!1,!0===r.interactive?r.selection_color=de.makeColor(e,n.tile,n):r.selection_color=de.defaultColor,r}catch(t){g("error","Style.parseFeature: style parsing error",e,r,t.stack)}},_parseFeature(){return this.feature_style},preprocess(e){if(!e.preprocessed){if(this.draw)for(let t in this.draw){let n=this.draw[t];"object"!=typeof n||Array.isArray(n)?null==e[t]&&(e[t]=n):e[t]=V({},n,e[t])}if(this.selection?this.introspection&&(e.interactive=!0):e.interactive=!1,!(e=this._preprocess(e)))return;if(this.shaders.attributes){e.attributes=e.attributes||{};for(const t in this.shaders.attributes)e.attributes[t]=Q.createPropertyCache(null!=e.attributes[t]?e.attributes[t]:0)}e.preprocessed=!0}return e},_preprocess:e=>e,parseOrder:(e,t)=>"number"!=typeof e?Q.calculateOrder(e,t):e,scaleOrder:e=>2*e,parseColor(e,t){return e?Q.evalCachedColorProperty(e,t):this.shaders.blocks.color||this.shaders.blocks.filter?Q.defaults.color:void 0},buildPolygons:()=>0,buildLines:()=>0,buildPoints:()=>0,setGL(e){this.gl=e,this.max_texture_size=O.getMaxTextureSize(this.gl)},makeMesh(e,t,n={}){let r=this.vertexLayoutForMeshVariant(n.variant);return v.wireframe?(t=function(e){const t=new Uint16Array(2*e.length);for(let n=0;n<e.length;n+=3)t.set([e[n],e[n+1],e[n+1],e[n+2],e[n+2],e[n]],2*n);return t}(t),new fe(this.gl,e,t,r,Re(Re({},n),{},{draw_mode:this.gl.LINES}))):new fe(this.gl,e,t,r,n)},render:e=>e.render(),getProgram(e="program"){this.compileSetup();const t=this[e];if(t&&!t.error){if(!t.compiled){g("debug",`Compiling style '${this.name}', program key '${e}'`);try{t.compile()}catch(t){throw g("error",`Style: error compiling program for style '${this.name}' (program key '${e}')`,this,t.stack,t.type,t.shader_errors),t}}return t}},compileSetup(){if(!this.compile_setup){if(!this.gl)throw new Error(`style.compile(): skipping for ${this.name} because no GL context`);var e=this.buildDefineList();if(this.selection){var t=Object.assign({},e);t.TANGRAM_FEATURE_SELECTION=!0}var n=this.shaders&&this.shaders.blocks,r=this.shaders&&this.shaders.block_scopes,i=Object.assign({},this.shaders&&this.shaders.uniforms);for(let e in i)null==i[e]&&g({level:"warn",once:!0},`Style '${this.name}' has invalid uniform '${e}': uniform values must be non-null`);var o=this.shaders&&this.shaders.extensions;"string"==typeof o&&(o=[o]),this.program=new j(this.gl,this.vertex_shader_src,this.fragment_shader_src,{name:this.name,defines:e,uniforms:i,blocks:n,block_scopes:r,extensions:o}),this.selection?this.selection_program=new j(this.gl,this.vertex_shader_src,"// Fragment shader for feature selection passes\n// Renders in silhouette according to selection (picking) color, or black if none defined\n\n#ifdef TANGRAM_FEATURE_SELECTION\n varying vec4 v_selection_color;\n#endif\n\nvoid main (void) {\n #ifdef TANGRAM_FEATURE_SELECTION\n gl_FragColor = v_selection_color;\n #else\n gl_FragColor = vec4(0., 0., 0., 1.);\n #endif\n}\n",{name:this.name+" (selection)",defines:t,uniforms:i,blocks:n,block_scopes:r,extensions:o}):this.selection_program=null,this.compile_setup=!0}},addShaderBlock(e,t,n=null){this.shaders.blocks=this.shaders.blocks||{},this.shaders.blocks[e]=this.shaders.blocks[e]||[],this.shaders.blocks[e].push(t),this.shaders.block_scopes=this.shaders.block_scopes||{},this.shaders.block_scopes[e]=this.shaders.block_scopes[e]||[],this.shaders.block_scopes[e].push(n)},removeShaderBlock(e){this.shaders.blocks&&(this.shaders.blocks[e]=null),this.shaders.block_scopes&&(this.shaders.block_scopes[e]=null)},replaceShaderBlock(e,t,n=null){this.removeShaderBlock(e),this.addShaderBlock(e,t,n)},buildDefineList(){var e={};if(null!=this.defines)for(var t in this.defines)e[t]=this.defines[t];if(null!=this.shaders&&null!=this.shaders.defines)for(t in this.shaders.defines)e[t]=this.shaders.defines[t];return e},hasRasters(){return["color","normal","custom"].indexOf(this.raster)>-1},setupRasters(){if(!this.hasRasters())return;"color"===this.raster?this.defines.TANGRAM_RASTER_TEXTURE_COLOR=!0:"normal"===this.raster&&(this.defines.TANGRAM_RASTER_TEXTURE_NORMAL=!0);let e=Object.keys(this.sources).filter(e=>this.sources[e]instanceof Oe).length;if(this.defines.TANGRAM_NUM_RASTER_SOURCES=`${e}`,e>0){const t=Object.keys(this.sources).filter(e=>this.sources[e].mask_alpha).length;this.defines.TANGRAM_HAS_MASKED_RASTERS=t>0,this.defines.TANGRAM_ALL_MASKED_RASTERS=t===e,this.defines.TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING=!0,this.replaceShaderBlock("raster","// Uniforms defining raster textures and macros for accessing them\n\n#ifdef TANGRAM_FRAGMENT_SHADER\nuniform sampler2D u_rasters[TANGRAM_NUM_RASTER_SOURCES]; // raster tile texture samplers\nuniform vec2 u_raster_sizes[TANGRAM_NUM_RASTER_SOURCES]; // raster tile texture sizes (width/height in pixels)\nuniform vec3 u_raster_offsets[TANGRAM_NUM_RASTER_SOURCES]; // raster tile texture UV starting offset for tile\n\n// Raster sources can optionally mask by the alpha channel (render with only full or no alpha, based on a threshold),\n// which is used for handling transparency outside the raster image when rendering with opaque blending\n#if defined(TANGRAM_HAS_MASKED_RASTERS) && !defined(TANGRAM_ALL_MASKED_RASTERS) // only add uniform if we need it\nuniform bool u_raster_mask_alpha;\n#endif\n\n// Note: the raster accessors below are #defines rather than functions to\n// avoid issues with constant integer expressions for array indices\n\n// Adjusts UVs in model space to account for raster tile texture overzooming\n// (applies scale and offset adjustments)\n#define adjustRasterUV(raster_index, uv) \\\n ((uv) * u_raster_offsets[raster_index].z + u_raster_offsets[raster_index].xy)\n\n// Returns the UVs of the current model position for a raster sampler\n#define currentRasterUV(raster_index) \\\n (adjustRasterUV(raster_index, v_modelpos_base_zoom.xy))\n\n// Returns pixel location in raster tile texture at current model position\n#define currentRasterPixel(raster_index) \\\n (currentRasterUV(raster_index) * rasterPixelSize(raster_index))\n\n// Samples a raster tile texture for the current model position\n#define sampleRaster(raster_index) \\\n (texture2D(u_rasters[raster_index], currentRasterUV(raster_index)))\n\n// Samples a raster tile texture for a given pixel\n#define sampleRasterAtPixel(raster_index, pixel) \\\n (texture2D(u_rasters[raster_index], (pixel) / rasterPixelSize(raster_index)))\n\n// Returns size of raster sampler in pixels\n#define rasterPixelSize(raster_index) \\\n (u_raster_sizes[raster_index])\n\n#endif\n","Raster")}},async buildRasterTextures(e,t){if(!this.hasRasters())return t;if(0===e.rasters.length)return t;let n;try{n=await a.postMessage(`${this.main_thread_target}.loadTextures`,{coords:e.coords,source:e.source,rasters:e.rasters,min:e.min,max:e.max})}catch(e){return t}if(!n||n.length<1)return t;if(n.some(e=>!e.loaded))return null;t.uniforms.u_raster_mask_alpha=!0===this.sources[e.rasters[0]].mask_alpha;const r=t.uniforms.u_rasters=[],i=t.uniforms.u_raster_sizes=[],o=t.uniforms.u_raster_offsets=[];return n.forEach(n=>{const s=n.index;if(r[s]=n.name,t.textures.push(n.name),i[s]=[n.width,n.height],e.coords.z>n.coords.z){let t=e.coords.z-n.coords.z,r=Math.pow(2,t);o[s]=[(e.coords.x%r+r)%r/r,(r-1-e.coords.y%r)/r,1/r]}else o[s]=[0,0,1]}),t},async loadTextures(e){let t={},n={},r=[];e.rasters.map(e=>this.sources[e]).filter(e=>e).forEach((i,o)=>{i instanceof Oe&&r.push(i.tileTexture(e,this).then(e=>{t[e.name]=e,n[e.name]=o}))}),await Promise.all(r),await O.createFromObject(this.gl,t);let i=await Promise.all(Object.keys(t).map(e=>O.textures[e]&&O.textures[e].load()).filter(e=>e));return i.forEach(e=>e.retain()),i.map(e=>({name:e.name,width:e.width,height:e.height,loaded:e.loaded,index:n[e.name],coords:t[e.name].coords}))},setupCustomAttributes(){if(this.shaders.attributes)for(const[e,t]of Object.entries(this.shaders.attributes))"float"===t.type&&(!1!==t.varying?(this.addShaderBlock("attributes",`\n #ifdef TANGRAM_VERTEX_SHADER\n attribute float a_${e};\n varying float v_${e};\n #define ${e} a_${e}\n #else\n varying float v_${e};\n #define ${e} v_${e}\n #endif\n `),this.addShaderBlock("setup",`#ifdef TANGRAM_VERTEX_SHADER\nv_${e} = a_${e};\n#endif`)):this.addShaderBlock("attributes",`\n #ifdef TANGRAM_VERTEX_SHADER\n attribute float a_${e};\n #define ${e} a_${e}\n #endif\n `))},addCustomAttributesToAttributeList(e){if(this.shaders.attributes)for(const[t,n]of Object.entries(this.shaders.attributes))"float"===n.type&&e.push({name:`a_${t}`,size:1,type:pe.FLOAT,normalized:!1});return e},addCustomAttributesToVertexTemplate(e,t){if(this.shaders.attributes)for(let n in this.shaders.attributes)this.vertex_template[t++]=null!=e.attributes[n]?e.attributes[n]:0},setup(){this.setUniforms(),this.material.setupProgram(j.current)},setUniforms(){var e,t=j.current;t&&t.setUniforms(null===(e=this.shaders)||void 0===e?void 0:e.uniforms,!0)},render_states:{opaque:{depth_test:!0,depth_write:!0},translucent:{depth_test:!0,depth_write:!0},add:{depth_test:!0,depth_write:!1},multiply:{depth_test:!0,depth_write:!1},inlay:{depth_test:!0,depth_write:!1},overlay:{depth_test:!1,depth_write:!1}},default_blend_orders:{opaque:Number.MIN_SAFE_INTEGER,add:1,multiply:2,inlay:3,translucent:4,overlay:5},getBlendOrderForDraw(e){return"opaque"!==this.blend&&null!=e.blend_order?e.blend_order:this.blend_order}};function Pe(e,t,n,r,i,o){e[t]=e[t]||{features:0,geoms:0,styles:{},base:{}},e[t].features+=n,e[t].geoms+=r;for(let n in i)e[t].styles[n]=e[t].styles[n]||0,e[t].styles[n]+=i[n];for(let n in o)e[t].base[n]=e[t].base[n]||0,e[t].base[n]+=o[n]}let Me=Math.pow(2,16)-1,De=!1;class Ie{constructor(){this.array=[],this.has_overflown=!1}push(e){this.has_overflown&&!De||e>Me&&(this.has_overflown=!0,!De)||this.array.push(e)}end(){if(this.array.length){let t=(e=this.array,new(this.has_overflown&&De?Uint32Array:Uint16Array)(e));return this.array=[],this.has_overflown=!1,t}return!1;var e}}Ie.setElementIndexUint=function(e){De=e};let ze={[pe.FLOAT]:Float32Array,[pe.BYTE]:Int8Array,[pe.UNSIGNED_BYTE]:Uint8Array,[pe.INT]:Int32Array,[pe.UNSIGNED_INT]:Uint32Array,[pe.SHORT]:Int16Array,[pe.UNSIGNED_SHORT]:Uint16Array};class Fe{constructor(e,{prealloc:t=500}={}){this.vertex_layout=e,this.vertex_elements=new Ie,this.stride=this.vertex_layout.stride,Fe.array_pool.length>0?(this.vertex_buffer=Fe.array_pool.pop(),this.byte_length=this.vertex_buffer.byteLength,this.size=Math.floor(this.byte_length/this.stride),g("trace",`VertexData: reused buffer of bytes ${this.byte_length}, ${this.size} vertices`)):(this.size=t,this.byte_length=this.stride*this.size,this.vertex_buffer=new Uint8Array(this.byte_length)),this.offset=0,this.vertex_count=0,this.realloc_count=0,this.setBufferViews(),this.setAddVertexFunction()}setBufferViews(){this.views={},this.views[pe.UNSIGNED_BYTE]=this.vertex_buffer,this.vertex_layout.dynamic_attribs.forEach(e=>{if(null==this.views[e.type]){var t=ze[e.type];this.views[e.type]=new t(this.vertex_buffer.buffer)}})}checkBufferSize(){if(this.offset+this.stride>this.byte_length){this.size=Math.floor(1.5*this.size),this.size-=this.size%4,this.byte_length=this.stride*this.size;var e=new Uint8Array(this.byte_length);e.set(this.vertex_buffer),Fe.array_pool.push(this.vertex_buffer),this.vertex_buffer=e,this.setBufferViews(),this.realloc_count++}}setAddVertexFunction(){this.vertexLayoutAddVertex=this.vertex_layout.getAddVertexFunction()}addVertex(e){this.checkBufferSize(),this.vertexLayoutAddVertex(e,this.views,this.offset),this.offset+=this.stride,this.vertex_count++}end(){return this.vertex_buffer=this.vertex_buffer.subarray(0,this.offset),this.element_buffer=this.vertex_elements.end(),g("trace",`VertexData: ${this.size} vertices total, realloc count ${this.realloc_count}`),this}}Fe.array_pool=[];class Le{constructor(e){this.attribs=e,this.dynamic_attribs=this.attribs.filter(e=>null==e.static),this.static_attribs=this.attribs.filter(e=>null!=e.static),this.components=[],this.index={},this.offset={},this.stride=0;let t=0,n=0;for(let e=0;e<this.attribs.length;e++){let r=this.attribs[e];if(null==r.static){r.offset=this.stride,r.byte_size=r.size;let e=0;switch(r.type){case pe.FLOAT:case pe.INT:case pe.UNSIGNED_INT:r.byte_size*=4,e=2;break;case pe.SHORT:case pe.UNSIGNED_SHORT:r.byte_size*=2,e=1}3&r.byte_size&&(r.byte_size+=4-(3&r.byte_size)),this.stride+=r.byte_size;let i=r.offset>>e;for(let t=0;t<r.size;t++)this.components.push({type:r.type,shift:e,offset:i++,index:n++});this.index[r.name]=t,t+=r.size,this.offset[r.name]=r.offset}else r.static=Array.isArray(r.static)?r.static:[r.static],r.method=`vertexAttrib${r.static.length}fv`}}enableDynamicAttributes(e,t){for(const t in Le.enabled_attribs)e.disableVertexAttribArray(t);Le.enabled_attribs={},this.dynamic_attribs.forEach(n=>{const r=t.attribute(n.name).location;-1!==r&&(e.enableVertexAttribArray(r),e.vertexAttribPointer(r,n.size,n.type,n.normalized,this.stride,n.offset),Le.enabled_attribs[r]=t)})}enableStaticAttributes(e,t){this.static_attribs.forEach(n=>{const r=t.attribute(n.name).location;-1!==r&&e[n.method]instanceof Function&&(e.enableVertexAttribArray(r),e[n.method](r,n.static),e.disableVertexAttribArray(r))})}createVertexData(){return new Fe(this)}getAddVertexFunction(){return null==this.addVertex&&this.createAddVertexFunction(),this.addVertex}createAddVertexFunction(){let e=N(JSON.stringify(this.attribs));if(null==Le.add_vertex_funcs[e]){let t,n=["var t, o;"],r=[...this.components];r.sort((e,t)=>e.type!==t.type?e.type-t.type:e.index-t.index);for(let e=0;e<r.length;e++){let i=r[e];t!==i.type&&(n.push(`t = vs[${i.type}];`),n.push(`o = off${i.shift?" >> "+i.shift:""};`),t=i.type),n.push(`t[o + ${i.offset}] = v[${i.index}];`)}n=n.join("\n");let i=new Function("v","vs","off",n);Le.add_vertex_funcs[e]=i}this.addVertex=Le.add_vertex_funcs[e]}}Le.enabled_attribs={},Le.add_vertex_funcs={};const je=[{x:0,y:0},{x:U.tile_scale,y:-U.tile_scale}],$e=[0,0,1,1];function Be(e,t,n){let r=je[0],i=je[1];return e[0]<=r.x+n&&t[0]<=r.x+n||e[0]>=i.x-n&&t[0]>=i.x-n||e[1]>=r.y-n&&t[1]>=r.y-n||e[1]<=i.y+n&&t[1]<=i.y+n}function Ve(e,t){t=t||0;let n=je[0],r=je[1];return e[0]<=n.x+t||e[0]>=r.x-t||e[1]>=n.y-t||e[1]<=r.y+t}var Ue,We={exports:{}},qe=function(){if(Ue)return We.exports;function e(e,i,o){o=o||2;var s,a,c,d,p,f,m,g=i&&i.length,y=g?i[0]*o:e.length,b=t(e,0,y,o,!0),v=[];if(!b||b.next===b.prev)return v;if(g&&(b=function(e,r,i,o){var s,a,c,d=[];for(s=0,a=r.length;s<a;s++)(c=t(e,r[s]*o,s<a-1?r[s+1]*o:e.length,o,!1))===c.next&&(c.steiner=!0),d.push(h(c));for(d.sort(l),s=0;s<d.length;s++)u(d[s],i),i=n(i,i.next);return i}(e,i,b,o)),e.length>80*o){s=c=e[0],a=d=e[1];for(var _=o;_<y;_+=o)(p=e[_])<s&&(s=p),(f=e[_+1])<a&&(a=f),p>c&&(c=p),f>d&&(d=f);m=0!==(m=Math.max(c-s,d-a))?1/m:0}return r(b,v,o,s,a,m),v}function t(e,t,n,r,i){var o,s;if(i===T(e,t,n,r)>0)for(o=t;o<n;o+=r)s=w(o,e[o],e[o+1],s);else for(o=n-r;o>=t;o-=r)s=w(o,e[o],e[o+1],s);return s&&g(s,s.next)&&(E(s),s=s.next),s}function n(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!g(r,r.next)&&0!==m(r.prev,r,r.next))r=r.next;else{if(E(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function r(e,t,l,u,c,h,p){if(e){!p&&h&&function(e,t,n,r){var i=e;do{null===i.z&&(i.z=d(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){var t,n,r,i,o,s,a,l,u=1;do{for(n=e,e=null,o=null,s=0;n;){for(s++,r=n,a=0,t=0;t<u&&(a++,r=r.nextZ);t++);for(l=u;a>0||l>0&&r;)0!==a&&(0===l||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,l--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;n=r}o.nextZ=null,u*=2}while(s>1)}(i)}(e,u,c,h);for(var f,m,g=e;e.prev!==e.next;)if(f=e.prev,m=e.next,h?o(e,u,c,h):i(e))t.push(f.i/l),t.push(e.i/l),t.push(m.i/l),E(e),e=m.next,g=m.next;else if((e=m)===g){p?1===p?r(e=s(n(e),t,l),t,l,u,c,h,2):2===p&&a(e,t,l,u,c,h):r(n(e),t,l,u,c,h,1);break}}}function i(e){var t=e.prev,n=e,r=e.next;if(m(t,n,r)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(p(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&m(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function o(e,t,n,r){var i=e.prev,o=e,s=e.next;if(m(i,o,s)>=0)return!1;for(var a=i.x<o.x?i.x<s.x?i.x:s.x:o.x<s.x?o.x:s.x,l=i.y<o.y?i.y<s.y?i.y:s.y:o.y<s.y?o.y:s.y,u=i.x>o.x?i.x>s.x?i.x:s.x:o.x>s.x?o.x:s.x,c=i.y>o.y?i.y>s.y?i.y:s.y:o.y>s.y?o.y:s.y,h=d(a,l,t,n,r),f=d(u,c,t,n,r),g=e.prevZ,y=e.nextZ;g&&g.z>=h&&y&&y.z<=f;){if(g!==e.prev&&g!==e.next&&p(i.x,i.y,o.x,o.y,s.x,s.y,g.x,g.y)&&m(g.prev,g,g.next)>=0)return!1;if(g=g.prevZ,y!==e.prev&&y!==e.next&&p(i.x,i.y,o.x,o.y,s.x,s.y,y.x,y.y)&&m(y.prev,y,y.next)>=0)return!1;y=y.nextZ}for(;g&&g.z>=h;){if(g!==e.prev&&g!==e.next&&p(i.x,i.y,o.x,o.y,s.x,s.y,g.x,g.y)&&m(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;y&&y.z<=f;){if(y!==e.prev&&y!==e.next&&p(i.x,i.y,o.x,o.y,s.x,s.y,y.x,y.y)&&m(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function s(e,t,r){var i=e;do{var o=i.prev,s=i.next.next;!g(o,s)&&y(o,i,i.next,s)&&_(o,s)&&_(s,o)&&(t.push(o.i/r),t.push(i.i/r),t.push(s.i/r),E(i),E(i.next),i=e=s),i=i.next}while(i!==e);return n(i)}function a(e,t,i,o,s,a){var l=e;do{for(var u=l.next.next;u!==l.prev;){if(l.i!==u.i&&f(l,u)){var c=x(l,u);return l=n(l,l.next),c=n(c,c.next),r(l,t,i,o,s,a),void r(c,t,i,o,s,a)}u=u.next}l=l.next}while(l!==e)}function l(e,t){return e.x-t.x}function u(e,t){if(t=function(e,t){var n,r=t,i=e.x,o=e.y,s=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var a=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=i&&a>s){if(s=a,a===i){if(o===r.y)return r;if(o===r.next.y)return r.next}n=r.x<r.next.x?r:r.next}}r=r.next}while(r!==t);if(!n)return null;if(i===s)return n;var l,u=n,d=n.x,h=n.y,f=1/0;r=n;do{i>=r.x&&r.x>=d&&i!==r.x&&p(o<h?i:s,o,d,h,o<h?s:i,o,r.x,r.y)&&(l=Math.abs(o-r.y)/(i-r.x),_(r,e)&&(l<f||l===f&&(r.x>n.x||r.x===n.x&&c(n,r)))&&(n=r,f=l)),r=r.next}while(r!==u);return n}(e,t),t){var r=x(t,e);n(t,t.next),n(r,r.next)}}function c(e,t){return m(e.prev,e,t.prev)<0&&m(t.next,e,e.next)<0}function d(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function h(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function p(e,t,n,r,i,o,s,a){return(i-s)*(t-a)-(e-s)*(o-a)>=0&&(e-s)*(r-a)-(n-s)*(t-a)>=0&&(n-s)*(o-a)-(i-s)*(r-a)>=0}function f(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&y(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(_(e,t)&&_(t,e)&&function(e,t){var n=e,r=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)&&(m(e.prev,e,t.prev)||m(e,t.prev,t))||g(e,t)&&m(e.prev,e,e.next)>0&&m(t.prev,t,t.next)>0)}function m(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function g(e,t){return e.x===t.x&&e.y===t.y}function y(e,t,n,r){var i=v(m(e,t,n)),o=v(m(e,t,r)),s=v(m(n,r,e)),a=v(m(n,r,t));return i!==o&&s!==a||!(0!==i||!b(e,n,t))||!(0!==o||!b(e,r,t))||!(0!==s||!b(n,e,r))||!(0!==a||!b(n,t,r))}function b(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function v(e){return e>0?1:e<0?-1:0}function _(e,t){return m(e.prev,e,e.next)<0?m(e,t,e.next)>=0&&m(e,e.prev,t)>=0:m(e,t,e.prev)<0||m(e,e.next,t)<0}function x(e,t){var n=new S(e.i,e.x,e.y),r=new S(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function w(e,t,n,r){var i=new S(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function E(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function S(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function T(e,t,n,r){for(var i=0,o=t,s=n-r;o<n;o+=r)i+=(e[s]-e[o])*(e[o+1]+e[s+1]),s=o;return i}return Ue=1,We.exports=e,We.exports.default=e,e.deviation=function(e,t,n,r){var i=t&&t.length,o=i?t[0]*n:e.length,s=Math.abs(T(e,0,o,n));if(i)for(var a=0,l=t.length;a<l;a++){var u=t[a]*n,c=a<l-1?t[a+1]*n:e.length;s-=Math.abs(T(e,u,c,n))}var d=0;for(a=0;a<r.length;a+=3){var h=r[a]*n,p=r[a+1]*n,f=r[a+2]*n;d+=Math.abs((e[h]-e[f])*(e[p+1]-e[h+1])-(e[h]-e[p])*(e[f+1]-e[h+1]))}return 0===s&&0===d?0:Math.abs((d-s)/s)},e.flatten=function(e){for(var t=e[0][0].length,n={vertices:[],holes:[],dimensions:t},r=0,i=0;i<e.length;i++){for(var o=0;o<e[i].length;o++)for(var s=0;s<t;s++)n.vertices.push(e[i][o][s]);i>0&&(r+=e[i-1].length,n.holes.push(r))}return n},We.exports}(),Ge=P(qe);function He(e,t,n=0,r=e.length-1,i=Ke){for(;r>n;){if(r-n>600){const o=r-n+1,s=t-n+1,a=Math.log(o),l=.5*Math.exp(2*a/3),u=.5*Math.sqrt(a*l*(o-l)/o)*(s-o/2<0?-1:1);He(e,t,Math.max(n,Math.floor(t-s*l/o+u)),Math.min(r,Math.floor(t+(o-s)*l/o+u)),i)}const o=e[t];let s=n,a=r;for(Ye(e,n,t),i(e[r],o)>0&&Ye(e,n,r);s<a;){for(Ye(e,s,a),s++,a--;i(e[s],o)<0;)s++;for(;i(e[a],o)>0;)a--}0===i(e[n],o)?Ye(e,n,a):(a++,Ye(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}}function Ye(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Ke(e,t){return e<t?-1:e>t?1:0}const Xe=[0,0,1];function Ze(e,t,n,{texcoord_index:r,texcoord_scale:i,texcoord_normalize:o}){let s,a,l,u,c,d,h,p,f,m,g,y,b=t.vertex_elements,v=e.length,_=0;r&&(o=o||1,[s,a,l,u]=i||$e);for(let i=0;i<v;i++){const v=500;let w=e[i];w.length>v&&(w=[...w],He(w,v,1,w.length-1,(e,t)=>t.area-e.area),w=w.slice(0,v));const E=(x=Ge.flatten(w),Ge(x.vertices,x.holes,x.dimensions)),S=E.length,T=t.vertex_count;if(S){r&&([c,d,h,p]=U.findBoundingBox(w),f=h-c,m=p-d,g=(l-s)/f,y=(u-a)/m);for(let e=0;e<w.length;e++){let i=w[e];for(let e=0;e<i.length;e++){let l=i[e];n[0]=l[0],n[1]=l[1],r&&(n[r+0]=((l[0]-c)*g+s)*o,n[r+1]=((l[1]-d)*y+a)*o),t.addVertex(n)}}for(let e=0;e<S;e++)b.push(T+E[e]);_+=S/3}}var x;return _}var Je='uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_tile_proxy_order_offset;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\n\nuniform mat4 u_model;\nuniform mat4 u_modelView;\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nattribute vec4 a_position;\nattribute vec4 a_color;\n\n// Optional normal attribute, otherwise default to up\n#ifdef TANGRAM_NORMAL_ATTRIBUTE\n attribute vec3 a_normal;\n #define TANGRAM_NORMAL a_normal\n#else\n #define TANGRAM_NORMAL vec3(0., 0., 1.)\n#endif\n\n// Optional dynamic line extrusion\n#ifdef TANGRAM_EXTRUDE_LINES\n attribute vec2 a_extrude; // extrusion direction in xy plane\n attribute vec2 a_offset; // offset direction in xy plane\n\n // Polygon and line styles have slightly different VBO layouts, saving memory by optimizing vertex packing.\n // All lines have a width scaling factor, but only some have a height (position.z) or offset.\n // The vertex height is stored in different attributes to account for this.\n attribute vec2 a_z_and_offset_scale; // stores vertex height in x, and offset scaling factor in y\n #define TANGRAM_POSITION_Z a_z_and_offset_scale.x // vertex height is stored in separate line-specific attrib\n #define TANGRAM_OFFSET_SCALING a_z_and_offset_scale.y // zoom scaling factor for line offset\n #define TANGRAM_WIDTH_SCALING a_position.z // zoom scaling factor for line width (stored in position attrib)\n\n uniform float u_v_scale_adjust; // scales texture UVs for line dash patterns w/fractional pixel width\n#else\n #define TANGRAM_POSITION_Z a_position.z // vertex height\n#endif\n\nvarying vec4 v_position;\nvarying vec3 v_normal;\nvarying vec4 v_color;\nvarying vec4 v_world_position;\n\n// Optional texture UVs\n#if defined(TANGRAM_TEXTURE_COORDS) || defined(TANGRAM_EXTRUDE_LINES)\n attribute vec2 a_texcoord;\n varying vec2 v_texcoord;\n#endif\n\n// Optional model position varying for tile coordinate zoom\n#ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\n varying vec4 v_modelpos_base_zoom;\n#endif\n\n#if defined(TANGRAM_LIGHTING_VERTEX)\n varying vec4 v_lighting;\n#endif\n\n#define TANGRAM_UNPACK_SCALING(x) (x / 1024.)\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\nvoid main() {\n // Initialize globals\n #pragma tangram: setup\n\n // Texture UVs\n #ifdef TANGRAM_TEXTURE_COORDS\n v_texcoord = a_texcoord;\n #ifdef TANGRAM_EXTRUDE_LINES\n v_texcoord.y *= u_v_scale_adjust;\n #endif\n #endif\n\n // Pass model position to fragment shader\n #ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\n v_modelpos_base_zoom = modelPositionBaseZoom();\n #endif\n\n // Position\n vec4 position = vec4(a_position.xy, TANGRAM_POSITION_Z / TANGRAM_HEIGHT_SCALE, 1.); // convert height back to meters\n\n #ifdef TANGRAM_EXTRUDE_LINES\n vec2 _extrude = a_extrude.xy;\n vec2 _offset = a_offset.xy;\n\n // Adjust line width based on zoom level, to prevent proxied lines\n // from being either too small or too big.\n // "Flattens" the zoom between 1-2 to peg it to 1 (keeps lines from\n // prematurely shrinking), then interpolate and clamp to 4 (keeps lines\n // from becoming too small when far away).\n float _dz = clamp(u_map_position.z - u_tile_origin.z, 0., 4.);\n _dz += step(1., _dz) * (1. - _dz) + mix(0., 2., clamp((_dz - 2.) / 2., 0., 1.));\n\n // Interpolate line width between zooms\n float _mdz = (_dz - 0.5) * 2.; // zoom from mid-point\n _extrude -= _extrude * TANGRAM_UNPACK_SCALING(TANGRAM_WIDTH_SCALING) * _mdz;\n\n // Interpolate line offset between zooms\n // Scales from the larger value to the smaller one\n float _dwdz = TANGRAM_UNPACK_SCALING(TANGRAM_OFFSET_SCALING);\n float _sdwdz = sign(step(0., _dwdz) - 0.5); // sign indicates "direction" of scaling\n _offset -= _offset * abs(_dwdz) * ((1.-step(0., _sdwdz)) - (_dz * -_sdwdz)); // scale "up" or "down"\n\n // Scale line width and offset to be consistent in screen space\n float _ssz = exp2(-_dz - (u_tile_origin.z - u_tile_origin.w));\n _extrude *= _ssz;\n _offset *= _ssz;\n\n // Modify line width before extrusion\n #ifdef TANGRAM_BLOCK_WIDTH\n float width = 1.;\n #pragma tangram: width\n _extrude *= width;\n #endif\n\n position.xy += _extrude + _offset;\n #endif\n\n // World coordinates for 3d procedural textures\n v_world_position = wrapWorldPosition(u_model * position);\n\n // Adjust for tile and view position\n position = u_modelView * position;\n\n // Modify position before camera projection\n #pragma tangram: position\n\n // Setup varyings\n v_position = position;\n v_normal = normalize(u_normalMatrix * TANGRAM_NORMAL);\n v_color = a_color;\n\n #if defined(TANGRAM_LIGHTING_VERTEX)\n // Vertex lighting\n vec3 normal = v_normal;\n\n // Modify normal before lighting\n #pragma tangram: normal\n\n // Pass lighting intensity to fragment shader\n v_lighting = calculateLighting(position.xyz - u_eye, normal, vec4(1.));\n #endif\n\n // Camera\n cameraProjection(position);\n\n // +1 is to keep all layers including proxies > 0\n applyLayerOrder(a_position.w + u_tile_proxy_order_offset + 1., position);\n\n gl_Position = position;\n}\n',Qe="uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\n\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nvarying vec4 v_position;\nvarying vec3 v_normal;\nvarying vec4 v_color;\nvarying vec4 v_world_position;\n\n#ifdef TANGRAM_EXTRUDE_LINES\n uniform bool u_has_line_texture;\n uniform sampler2D u_texture;\n uniform float u_texture_ratio;\n uniform vec4 u_dash_background_color;\n uniform float u_has_dash;\n#endif\n\n#define TANGRAM_NORMAL v_normal\n\n#if defined(TANGRAM_TEXTURE_COORDS) || defined(TANGRAM_EXTRUDE_LINES)\n varying vec2 v_texcoord;\n#endif\n\n#ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\n varying vec4 v_modelpos_base_zoom;\n#endif\n\n#if defined(TANGRAM_LIGHTING_VERTEX)\n varying vec4 v_lighting;\n#endif\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\nvoid main (void) {\n // Initialize globals\n #pragma tangram: setup\n\n vec4 color = v_color;\n vec3 normal = TANGRAM_NORMAL;\n\n // Apply raster to vertex color\n #ifdef TANGRAM_RASTER_TEXTURE_COLOR\n vec4 _raster_color = sampleRaster(0);\n\n #if defined(TANGRAM_BLEND_OPAQUE) || defined(TANGRAM_BLEND_TRANSLUCENT) || defined(TANGRAM_BLEND_MULTIPLY)\n // Raster sources can optionally mask by the alpha channel, which will render with only full or no alpha.\n // This is used for handling transparency outside the raster image in some blend modes,\n // which either don't support alpha, or would cause transparent pixels to write to the depth buffer,\n // obscuring geometry underneath.\n #ifdef TANGRAM_HAS_MASKED_RASTERS // skip masking logic if no masked raster sources\n #ifndef TANGRAM_ALL_MASKED_RASTERS // skip source check for masking if *all* raster sources are masked\n if (u_raster_mask_alpha) {\n #else\n {\n #endif\n #if defined(TANGRAM_BLEND_TRANSLUCENT) || defined(TANGRAM_BLEND_MULTIPLY)\n if (_raster_color.a < TANGRAM_EPSILON) {\n discard;\n }\n #else // TANGRAM_BLEND_OPAQUE\n if (_raster_color.a < 1. - TANGRAM_EPSILON) {\n discard;\n }\n // only allow full alpha in opaque blend mode (avoids artifacts blending w/canvas tile background)\n _raster_color.a = 1.;\n #endif\n }\n #endif\n #endif\n\n color *= _raster_color; // multiplied to tint texture color\n #endif\n\n // Apply line texture\n #ifdef TANGRAM_EXTRUDE_LINES\n { // enclose in scope to avoid leakage of internal variables\n if (u_has_line_texture) {\n vec2 _line_st = vec2(v_texcoord.x, fract(v_texcoord.y / u_texture_ratio));\n vec4 _line_color = texture2D(u_texture, _line_st);\n\n // If the line has a dash pattern, the line texture indicates if the current fragment should be\n // the dash foreground or background color. If the line doesn't have a dash pattern,\n // the line texture color is used directly (but also tinted by the vertex color).\n color = mix(\n color * _line_color, // no dash: tint the line texture with the vertex color\n mix(u_dash_background_color, color, _line_color.a), // choose dash foreground or background color\n u_has_dash // 0 if no dash, 1 if has dash\n );\n\n // Use alpha discard test as a lower-quality substitute for blending\n #if defined(TANGRAM_BLEND_OPAQUE)\n if (color.a < TANGRAM_ALPHA_TEST) {\n discard;\n }\n #endif\n }\n }\n #endif\n\n // First, get normal from raster tile (if applicable)\n #ifdef TANGRAM_RASTER_TEXTURE_NORMAL\n normal = normalize(sampleRaster(0).rgb * 2. - 1.);\n #endif\n\n // Second, alter normal with normal map texture (if applicable)\n #if defined(TANGRAM_LIGHTING_FRAGMENT) && defined(TANGRAM_MATERIAL_NORMAL_TEXTURE)\n calculateNormal(normal);\n #endif\n\n // Normal modification applied here for fragment lighting or no lighting,\n // and in vertex shader for vertex lighting\n #if !defined(TANGRAM_LIGHTING_VERTEX)\n #pragma tangram: normal\n #endif\n\n // Color modification before lighting is applied\n #pragma tangram: color\n\n #if defined(TANGRAM_LIGHTING_FRAGMENT)\n // Calculate per-fragment lighting\n color = calculateLighting(v_position.xyz - u_eye, normal, color);\n #elif defined(TANGRAM_LIGHTING_VERTEX)\n // Apply lighting intensity interpolated from vertex shader\n color *= v_lighting;\n #endif\n\n // Post-processing effects (modify color after lighting)\n #pragma tangram: filter\n\n gl_FragColor = color;\n}\n";const et=Object.create(Ne);Object.assign(et,{name:"polygons",built_in:!0,vertex_shader_src:Je,fragment_shader_src:Qe,selection:!0,init(){Ne.init.apply(this,arguments),this.defines.TANGRAM_NORMAL_ATTRIBUTE=!0,this.defines.TANGRAM_TEXTURE_COORDS=this.texcoords},_parseFeature(e,t,n){var r=this.feature_style;return r.color=this.parseColor(t.color,n),r.color?(r.alpha=Q.evalCachedProperty(t.alpha,n),r.variant=t.variant,r.z=Q.evalCachedDistanceProperty(t.z,n)||Q.defaults.z,r.z*=U.height_scale,r.extrude=Q.evalProperty(t.extrude,n),r.extrude&&(!0===r.extrude?(r.height=e.properties.height||Q.defaults.height,r.min_height=e.properties.min_height||Q.defaults.min_height):"number"==typeof r.extrude?(r.height=r.extrude,r.min_height=0):Array.isArray(r.extrude)&&(r.min_height=r.extrude[0],r.height=r.extrude[1]),r.height*=U.height_scale,r.min_height*=U.height_scale),r.tile_edges=t.tile_edges,r):null},_preprocess(e){return e.color=Q.createColorPropertyCache(e.color),e.alpha=Q.createPropertyCache(e.alpha),e.z=Q.createPropertyCache(e.z,Q.parseUnits),this.computeVariant(e),e},computeVariant(e){const t=e.interactive?1:0,n=null!=e.extrude?1:0,r=this.texcoords?1:0,i=this.getBlendOrderForDraw(e),o=[t,n,r,i].join("/");e.variant=o,null==this.variants[o]&&(this.variants[o]={key:o,blend_order:i,mesh_order:0,selection:t,normal:n,texcoords:r})},vertexLayoutForMeshVariant(e){if(null==this.vertex_layouts[e.key]){const t=[{name:"a_position",size:4,type:pe.SHORT,normalized:!1},{name:"a_normal",size:3,type:pe.BYTE,normalized:!0,static:e.normal?null:[0,0,1]},{name:"a_color",size:4,type:pe.UNSIGNED_BYTE,normalized:!0},{name:"a_selection_color",size:4,type:pe.UNSIGNED_BYTE,normalized:!0,static:e.selection?null:[0,0,0,0]},{name:"a_texcoord",size:2,type:pe.UNSIGNED_SHORT,normalized:!0,static:e.texcoords?null:[0,0]}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.key]=new Le(t)}return this.vertex_layouts[e.key]},meshVariantTypeForDraw(e){return this.variants[e.variant]},makeVertexTemplate(e,t){let n=0;return this.vertex_template[n++]=0,this.vertex_template[n++]=0,this.vertex_template[n++]=e.z||0,this.vertex_template[n++]=this.scaleOrder(e.order),t.variant.normal&&(this.vertex_template[n++]=0,this.vertex_template[n++]=0,this.vertex_template[n++]=127),this.vertex_template[n++]=255*e.color[0],this.vertex_template[n++]=255*e.color[1],this.vertex_template[n++]=255*e.color[2],this.vertex_template[n++]=255*(null!=e.alpha?e.alpha:e.color[3]),t.variant.selection&&(this.vertex_template[n++]=255*e.selection_color[0],this.vertex_template[n++]=255*e.selection_color[1],this.vertex_template[n++]=255*e.selection_color[2],this.vertex_template[n++]=255*e.selection_color[3]),t.variant.texcoords&&(this.vertex_template[n++]=0,this.vertex_template[n++]=0),this.addCustomAttributesToVertexTemplate(e,n),this.vertex_template},buildPolygons(e,t,n){let r=this.getTileMesh(n.tile,this.meshVariantTypeForDraw(t)),i=r.vertex_data,o=i.vertex_layout,s=this.makeVertexTemplate(t,r),a={texcoord_index:o.index.a_texcoord,texcoord_normalize:65535,remove_tile_edges:!t.tile_edges,tile_edge_tolerance:U.tile_scale*n.tile.pad_scale*4,winding:n.winding};return t.extrude&&t.height?function(e,t,n,r,i,o,s,a,{remove_tile_edges:l,tile_edge_tolerance:u,texcoord_index:c,texcoord_scale:d,texcoord_normalize:h,winding:p}){var f=t+(r||0),m=t+n;o[2]=m;var g=Ze(e,i,o,{texcoord_index:c,texcoord_scale:d,texcoord_normalize:h}),y=i.vertex_elements,b=i.vertex_count;if(c){h=h||1;var[v,_,x,w]=d||$e,E=[[v,w],[v,_],[x,_],[x,w]]}for(var S=e.length,T=0;T<S;T++)for(var k=e[T],O=0;O<k.length;O++)for(var A=k[O],C=0;C<A.length-1;C++){if(l&&Be(A[C],A[C+1],u))continue;let e,t;"CCW"===p?(e=C,t=C+1):(e=C+1,t=C);var R=[[A[t][0],A[t][1],m],[A[t][0],A[t][1],f],[A[e][0],A[e][1],f],[A[e][0],A[e][1],m]];let n=be.normalize([A[t][0]-A[e][0],A[t][1]-A[e][1],0]),r=be.cross(Xe,n);o[s+0]=r[0]*a,o[s+1]=r[1]*a,o[s+2]=r[2]*a;for(var N=0;N<R.length;N++)o[0]=R[N][0],o[1]=R[N][1],o[2]=R[N][2],c&&(o[c+0]=E[N][0]*h,o[c+1]=E[N][1]*h),i.addVertex(o);y.push(b+0),y.push(b+1),y.push(b+2),y.push(b+2),y.push(b+3),y.push(b+0),b+=4,g+=2}return g}(e,t.z,t.height,t.min_height,i,s,o.index.a_normal,127,a):Ze(e,i,s,a)}});const tt=[0,0],nt={butt:0,square:1,round:2},rt={miter:0,bevel:1,round:2},it=U.tile_scale,ot=[0,0],st=[1,0],at=[.5,0];function lt(e,t){if(!(e.length<2)){var n,r,i,o,{join_type:s,cap_type:a,closed_polygon:l,remove_tile_edges:u,tile_edge_tolerance:c,v_scale:d,miter_len_sq:h}=t,p=null!=t.texcoord_index,f=0;if(l&&s===rt.miter){var m=function(e){if(Ve(e[0]))return 0;for(var t=0;t<e.length;t++)if(Ve(e[e.length-1-t]))return e.length-1-t;return 0}(e);if(0!==m){var g=function(e,t){var n=[];for(let i=0;i<e.length;i++){var r=(i+t)%e.length;0!==r&&n.push(e[r])}return n.push(n[0]),n}(e,m);return t.extra_lines=t.extra_lines||[],void t.extra_lines.push(g)}}var y=0,b=e.length-1,v=0;for(n=e[y],r=e[y+1];be.isEqual(n,r);)if(n=r,r=e[1+ ++y],v++,y===e.length-1)return;for(;be.isEqual(e[b],e[b-1]);)if(v++,0===--b)return;if(!(e.length<2+v))if(o=be.normalize(be.perp(n,r)),u&&Be(n,r,c)){var _=ut(e,y,c);_&&(t.extra_lines=t.extra_lines||[],t.extra_lines.push(_))}else{l?function(e,t,n,r,i){if(void 0===r||Ve(e))ft(e,n,n,1,0,i,1),ft(e,n,n,0,0,i,-1);else{r===rt.miter?dt(0,e,t,n,i.miter_len_sq,!0,i):ht(r,0,e,t,n,!0,i)}}(n,i=be.normalize(be.perp(e[b-1],n)),o,s,t):(Ve(n)||(yt(n,f,o,a,!0,t),p&&a!==nt.butt&&(f+=.5*d*t.texcoord_width)),ft(n,o,o,1,f,t,1),ft(n,o,o,0,f,t,-1)),p&&(f+=d*be.length(be.sub(r,n)));for(var x=y+1;x<b;x++){var w=x,E=x+1;if(n=e[w],r=e[E],!be.isEqual(n,r)){if(u&&Be(n,r,c)){ft(n,o,o,1,f,t,1),ft(n,o,o,0,f,t,-1),pt(1,t);var S=ut(e,w+1,c);return void(S&&(t.extra_lines=t.extra_lines||[],t.extra_lines.push(S)))}i=o,o=be.normalize(be.perp(n,r)),s===rt.miter?dt(f,n,i,o,h,!1,t):ht(s,f,n,i,o,!1,t),p&&(f+=d*be.length(be.sub(r,n)))}}n=r,i=o,l?function(e,t,n,r,i,o){if(Ve(e))ft(e,t,t,1,i,o,1),ft(e,t,t,0,i,o,-1),pt(1,o);else{var s=ct(t,n);r===rt.miter&&be.lengthSq(s)>o.miter_len_sq&&(r=rt.bevel),r===rt.miter?(ft(e,s,t,1,i,o,1),ft(e,s,t,0,i,o,-1),pt(1,o)):(ft(e,t,t,1,i,o,1),ft(e,t,t,0,i,o,-1),pt(1,o))}}(n,i,o=be.normalize(be.perp(n,e[1])),s,f,t):(ft(n,i,o,1,f,t,1),ft(n,i,o,0,f,t,-1),pt(1,t),Ve(n)||yt(n,f,i,a,!1,t))}}}function ut(e,t,n){for(var r=t;e[r+1]&&Be(e[r],e[r+1],n);)r++;return e.length-r>=2&&e.slice(r)}function ct(e,t){var n=be.normalize(be.add(e,t)),r=2/(1+Math.abs(be.dot(e,n)));return be.mult(n,r*r)}function dt(e,t,n,r,i,o,s){var a=ct(n,r);be.lengthSq(a)>i?ht(rt.bevel,e,t,n,r,o,s):(ft(t,a,a,1,e,s,1),ft(t,a,a,0,e,s,-1),o||pt(1,s))}function ht(e,t,n,r,i,o,s){var a=ct(r,i),l=i[0]*r[1]-i[1]*r[0]>0;null!=s.texcoord_index&&(ot[1]=t,st[1]=t),l?(ft(n,a,a,1,t,s,1),ft(n,r,a,0,t,s,-1),o||pt(1,s),gt(n,be.neg(r),a,be.neg(i),a,ot,st,ot,!1,e===rt.bevel,s),ft(n,a,a,1,t,s,1),ft(n,i,a,0,t,s,-1)):(ft(n,r,a,1,t,s,1),ft(n,a,a,0,t,s,-1),o||pt(1,s),gt(n,r,be.neg(a),i,a,st,ot,st,!1,e===rt.bevel,s),ft(n,i,a,1,t,s,1),ft(n,a,a,0,t,s,-1))}function pt(e,t){for(var n=t.vertex_data.vertex_elements,r=t.vertex_data.vertex_count-2*e-2,i=0;i<e;i++)n.push(r+2*i+2),n.push(r+2*i+1),n.push(r+2*i+0),n.push(r+2*i+2),n.push(r+2*i+3),n.push(r+2*i+1),t.geom_count+=2}function ft(e,t,n,r,i,o,s){var a=o.vertex_template,l=o.vertex_data;a[0]=e[0],a[1]=e[1];let u=o.half_width*s;a[o.extrude_index+0]=t[0]*u,a[o.extrude_index+1]=t[1]*u,o.offset&&(a[o.offset_index+0]=n[0]*o.offset,a[o.offset_index+1]=n[1]*o.offset),null!=o.texcoord_index&&(a[o.texcoord_index+0]=65535*r,a[o.texcoord_index+1]=65535*i),l.addVertex(a)}var mt=[0,0];function gt(e,t,n,r,i,o,s,a,l,u,c){for(var d=t[0]*r[1]-t[1]*r[0],h=be.dot(t,r),p=Math.atan2(d,h);p>=Math.PI;)p-=2*Math.PI;if(u)f=1;else{var f=function(e,t){e<0&&(e=-e);var n=t>10?Math.log2(t/5):1;return Math.ceil(e/Math.PI*n)}(p,c.half_width);if(f<1)return}var m=c.vertex_data.vertex_count,g=c.vertex_data.vertex_elements;ft(e,n,i,s[0],s[1],c,1),ft(e,t,i,o[0],o[1],c,1);var y=t,b=null!=c.texcoord_index;if(b)if(l)var v=be.sub(o,s);else{mt=be.copy(o);var _=be.div(be.sub(a,o),f)}var x=p/f;let w,E,S=p<0?-1:1;d>0?(w=2,E=1):(w=1,E=2);for(var T=0;T<f;T++)0===T&&p<0&&(y=be.neg(y)),y=be.rot(y,x),b&&(l?(v=be.rot(v,x),mt[0]=v[0]+s[0],mt[1]=v[1]*c.texcoord_width*c.v_scale+s[1]):mt=be.add(mt,_)),ft(e,y,i,mt[0],mt[1],c,S),g.push(m+T+w),g.push(m),g.push(m+T+E)}function yt(e,t,n,r,i,o){var s=be.neg(n),a=null!=o.texcoord_index;switch(r){case nt.square:var l;i?(l=[n[1],-n[0]],ft(e,be.add(n,l),n,1,t,o,1),ft(e,be.add(s,l),n,0,t,o,1),a&&(t+=.5*o.texcoord_width*o.v_scale),ft(e,n,n,1,t,o,1),ft(e,s,n,0,t,o,1)):(l=[-n[1],n[0]],ft(e,n,n,1,t,o,1),ft(e,s,n,0,t,o,1),a&&(t+=.5*o.texcoord_width*o.v_scale),ft(e,be.add(n,l),n,1,t,o,1),ft(e,be.add(s,l),n,0,t,o,1)),pt(1,o);break;case nt.round:var u,c,d=ot,h=st,p=at;i?(u=n,c=s,a&&(t+=.5*o.texcoord_width*o.v_scale,d=st,h=ot,p=at)):(u=s,c=n),a&&(ot[1]=t,st[1]=t,at[1]=t),gt(e,u,tt,c,n,d,p,h,!0,!1,o);break;case nt.butt:return}}const bt=[255,255,255,255],vt=[0,0,0,0],_t=Object.create(Ne);Object.assign(_t,{name:"lines",built_in:!0,vertex_shader_src:Je,fragment_shader_src:Qe,selection:!0,init(){Ne.init.apply(this,arguments),this.defines.TANGRAM_EXTRUDE_LINES=!0,this.defines.TANGRAM_TEXTURE_COORDS=!0,this.outline_feature_style={},this.inline_feature_style=this.feature_style,this.dash_textures={}},calcDistance:(e,t)=>Q.evalCachedDistanceProperty(e,t)||0,calcDistanceNextZoom(e,t){t.zoom++;let n=this.calcDistance(e,t);return t.zoom--,n},calcWidth(e,t,n){let r,i=this.calcDistance(e.width,n);if(!(i<0)){if(r=e.next_width?this.calcDistanceNextZoom(e.next_width,n):i/2,0===i&&0===r||r<0)return!1;if(t.width_unscaled=i,t.next_width_unscaled=r,e.next_width){r*=2;let e=.5*(i+r);t.width=e*n.units_per_meter_overzoom,t.width_scale=1-r/e}else t.width=i*n.units_per_meter_overzoom,t.width_scale=0;return e.texcoords&&(e.inline_texcoord_width?t.texcoord_width=e.inline_texcoord_width:t.texcoord_width=(t.width_unscaled||t.next_width_unscaled)*n.units_per_meter_overzoom/n.tile.overzoom2),!0}},calcOffset(e,t,n){if(e.offset_precalc)t.offset=e.offset_precalc,t.offset_scale=e.offset_scale_precalc;else if(e.offset){let r=this.calcDistance(e.offset,n);if(e.next_offset){let i=2*this.calcDistanceNextZoom(e.next_offset,n);Math.abs(r)>=Math.abs(i)?(t.offset=r*n.units_per_meter_overzoom,t.offset_scale=0!==r?1-i/r:0):(t.offset=i*n.units_per_meter_overzoom,t.offset_scale=0!==i?-1*(1-r/i):0)}else t.offset=r*n.units_per_meter_overzoom,t.offset_scale=0}else t.offset=0,t.offset_scale=0},_parseFeature(e,t,n){var r=this.feature_style;if(!1!==this.calcWidth(t,r,n)&&(this.calcOffset(t,r,n),r.color=this.parseColor(t.color,n),r.color)){if(r.alpha=Q.evalCachedProperty(t.alpha,n),r.variant=t.variant,r.z=Q.evalCachedDistanceProperty(t.z,n)||Q.defaults.z,r.height=e.properties.height||Q.defaults.height,r.extrude=Q.evalProperty(t.extrude,n),r.extrude&&("number"==typeof r.extrude?r.height=r.extrude:Array.isArray(r.extrude)&&(r.height=r.extrude[1])),r.extrude&&r.height&&(r.z+=r.height),r.z*=U.height_scale,r.cap=t.cap,r.join=t.join,r.miter_limit=t.miter_limit,r.tile_edges=t.tile_edges,r.outline=r.outline||{width:{},next_width:{},preprocessed:!0},t.outline&&!1!==t.outline.visible&&t.outline.color&&t.outline.width){let e=2*this.calcDistance(t.outline.width,n),i=2*this.calcDistanceNextZoom(t.outline.next_width,n);0===e&&0===i||e<0||i<0?(r.outline.width.value=null,r.outline.next_width.value=null,r.outline.color=null,r.outline.inline_texcoord_width=null,r.outline.texcoords=!1):(r.outline.width.value=e+r.width_unscaled,r.outline.next_width.value=i+r.next_width_unscaled,r.outline.inline_texcoord_width=r.texcoord_width,r.outline.offset_precalc=r.offset,r.outline.offset_scale_precalc=r.offset_scale,r.outline.color=t.outline.color,r.outline.alpha=t.outline.alpha,r.outline.interactive=t.outline.interactive,r.outline.cap=t.outline.cap,r.outline.join=t.outline.join,r.outline.miter_limit=t.outline.miter_limit,r.outline.texcoords=t.outline.texcoords,r.outline.extrude=t.outline.extrude,r.outline.z=t.outline.z,r.outline.style=t.outline.style,r.outline.variant=t.outline.variant,t.outline.order?r.outline.order=this.parseOrder(t.outline.order,n):r.outline.order=r.order,r.outline.order>r.order&&(r.outline.order=r.order),r.outline.order-=.5)}else r.outline.width.value=null,r.outline.next_width.value=null,r.outline.color=null,r.outline.inline_texcoord_width=null;return r}},_preprocess(e){if(e.color=Q.createColorPropertyCache(e.color),e.alpha=Q.createPropertyCache(e.alpha),e.width=Q.createPropertyCache(e.width,Q.parseUnits),e.width&&e.width.type!==Q.CACHE_TYPE.STATIC&&(e.next_width=Q.createPropertyCache(e.width,Q.parseUnits)),e.offset=e.offset&&Q.createPropertyCache(e.offset,Q.parseUnits),e.offset&&e.offset.type!==Q.CACHE_TYPE.STATIC&&(e.next_offset=Q.createPropertyCache(e.offset,Q.parseUnits)),e.z=Q.createPropertyCache(e.z,Q.parseUnits),e.dash=void 0!==e.dash?e.dash:this.dash,e.dash_key=e.dash&&this.dashTextureKey(e.dash),e.dash_background_color=void 0!==e.dash_background_color?e.dash_background_color:this.dash_background_color,e.dash_background_color=e.dash_background_color&&Q.parseColor(e.dash_background_color),e.texture_merged=e.dash_key||(void 0!==e.texture?e.texture:this.texture),e.texcoords=this.texcoords||e.texture_merged?1:0,this.computeVariant(e),e.outline){e.outline.is_outline=!0,e.outline.style=e.outline.style||this.name,e.outline.color=Q.createColorPropertyCache(e.outline.color),e.outline.alpha=Q.createPropertyCache(e.outline.alpha),e.outline.width=Q.createPropertyCache(e.outline.width,Q.parseUnits),e.outline.next_width=Q.createPropertyCache(e.outline.width,Q.parseUnits),e.outline.interactive=null!=e.outline.interactive?e.outline.interactive:e.interactive,e.outline.cap=e.outline.cap||e.cap,e.outline.join=e.outline.join||e.join,e.outline.miter_limit=null!=e.outline.miter_limit?e.outline.miter_limit:e.miter_limit,e.outline.offset=e.offset,e.outline.extrude=e.extrude,e.outline.z=e.z;let t=this.styles[e.outline.style];t?(e.outline.dash=void 0!==e.outline.dash?e.outline.dash:t.dash,e.outline.texture=void 0!==e.outline.texture?e.outline.texture:t.texture,null!=e.outline.dash?(e.outline.dash_key=e.outline.dash&&this.dashTextureKey(e.outline.dash),e.outline.texture_merged=e.outline.dash_key):null===e.outline.dash||null!=e.outline.texture?(e.outline.dash_key=null,e.outline.texture_merged=e.outline.texture):(e.outline.dash=e.dash,e.outline.dash_key=e.outline.dash&&this.dashTextureKey(e.outline.dash),e.outline.texture_merged=e.outline.dash_key),e.outline.dash_background_color=void 0!==e.outline.dash_background_color?e.outline.dash_background_color:t.dash_background_color,e.outline.dash_background_color=void 0!==e.outline.dash_background_color?e.outline.dash_background_color:e.dash_background_color,e.outline.dash_background_color=e.outline.dash_background_color&&Q.parseColor(e.outline.dash_background_color),e.outline.texcoords=t.texcoords||e.outline.texture_merged?1:0,void 0===e.outline.blend_order&&null!=e.blend_order&&(e.outline.blend_order=e.blend_order),t.computeVariant(e.outline)):(g({level:"warn",once:!0},`Layer group '${e.layers.join(", ")}': line 'outline' specifies non-existent draw style '${e.outline.style}' (or maybe the style is defined but is missing a 'base' or has another error), skipping outlines for features matching this layer group`),e.outline=null)}return e},dashTextureKey:e=>"__dash_"+JSON.stringify(e),getDashTexture(e){let t=this.dashTextureKey(e);if(null==this.dash_textures[t]){this.dash_textures[t]=!0;const n=function(e,t={}){const n=t.dash_color||bt,r=t.background_color||vt,i=e,o=t.scale||1;i.length%2==1&&Array.prototype.push.apply(i,i);let s=!0,a=[];for(let e=0;e<i.length;e++){let t=Math.floor(i[e]*o);for(let e=0;e<t;e++)Array.prototype.push.apply(a,s?n:r);s=!s}return a.reverse(),a=new Uint8Array(a),{pixels:a,length:a.length/4}}(e,{scale:20});O.create(this.gl,t,{data:n.pixels,height:n.length,width:1,filtering:"nearest"})}},async endData(e){const t=await Ne.endData.call(this,e);if(t){t.uniforms.u_has_line_texture=!1,t.uniforms.u_texture=O.default,t.uniforms.u_v_scale_adjust=U.tile_scale;let n=[];for(let r in t.meshes){let i=t.meshes[r].variant;if(i.texture){let o=t.meshes[r].uniforms=t.meshes[r].uniforms||{};if(o.u_has_line_texture=!0,o.u_texture=i.texture,o.u_texture_ratio=1,i.dash&&(o.u_v_scale_adjust=20*U.tile_scale,o.u_has_dash=null!=i.dash_background_color?1:0,o.u_dash_background_color=i.dash_background_color||[0,0,0,0]),i.dash_key&&null==this.dash_textures[i.dash_key]){this.dash_textures[i.dash_key]=!0;try{await a.postMessage(this.main_thread_target+".getDashTexture",i.dash)}catch(e){g("trace",`${this.name}: line dash texture create failed because style no longer on main thread`)}}if(null==O.textures[i.texture])n.push(O.syncTexturesToWorker([i.texture]).then(e=>{let t=e[i.texture];t&&(o.u_texture_ratio=t.height/t.width)}));else{let e=O.textures[i.texture];o.u_texture_ratio=e.height/e.width}}}await Promise.all(n)}return t},computeVariant(e){let t=e.offset?1:0;t+="/"+e.texcoords,t+="/"+(e.interactive?1:0),t+="/"+(e.extrude||e.z?1:0),t+="/"+e.is_outline,e.dash_key&&(t+=e.dash_key,e.dash_background_color&&(t+=e.dash_background_color)),e.texture_merged&&(t+=e.texture_merged);const n=this.getBlendOrderForDraw(e);t+="/"+n,t=N(t),e.variant=t,null==this.variants[t]&&(this.variants[t]={key:t,blend_order:n,mesh_order:e.is_outline?0:1,selection:e.interactive?1:0,offset:e.offset?1:0,z_or_offset:e.offset||e.extrude||e.z?1:0,texcoords:e.texcoords,texture:e.texture_merged,dash:e.dash,dash_key:e.dash_key,dash_background_color:e.dash_background_color})},vertexLayoutForMeshVariant(e){if(null==this.vertex_layouts[e.key]){const t=[{name:"a_position",size:4,type:pe.SHORT,normalized:!1},{name:"a_extrude",size:2,type:pe.SHORT,normalized:!1},{name:"a_offset",size:2,type:pe.SHORT,normalized:!1,static:e.offset?null:[0,0]},{name:"a_z_and_offset_scale",size:2,type:pe.SHORT,normalized:!1,static:e.z_or_offset?null:[0,0]},{name:"a_texcoord",size:2,type:pe.UNSIGNED_SHORT,normalized:!0,static:e.texcoords?null:[0,0]},{name:"a_color",size:4,type:pe.UNSIGNED_BYTE,normalized:!0},{name:"a_selection_color",size:4,type:pe.UNSIGNED_BYTE,normalized:!0,static:e.selection?null:[0,0,0,0]}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.key]=new Le(t)}return this.vertex_layouts[e.key]},meshVariantTypeForDraw(e){return this.variants[e.variant]},makeVertexTemplate(e,t){let n=0;return this.vertex_template[n++]=0,this.vertex_template[n++]=0,this.vertex_template[n++]=1024*e.width_scale,this.vertex_template[n++]=this.scaleOrder(e.order),this.vertex_template[n++]=0,this.vertex_template[n++]=0,t.variant.offset&&(this.vertex_template[n++]=0,this.vertex_template[n++]=0),t.variant.z_or_offset&&(this.vertex_template[n++]=e.z||0,this.vertex_template[n++]=1024*e.offset_scale),t.variant.texcoords&&(this.vertex_template[n++]=0,this.vertex_template[n++]=0),this.vertex_template[n++]=255*e.color[0],this.vertex_template[n++]=255*e.color[1],this.vertex_template[n++]=255*e.color[2],this.vertex_template[n++]=255*(null!=e.alpha?e.alpha:e.color[3]),t.variant.selection&&(this.vertex_template[n++]=255*e.selection_color[0],this.vertex_template[n++]=255*e.selection_color[1],this.vertex_template[n++]=255*e.selection_color[2],this.vertex_template[n++]=255*e.selection_color[3]),this.addCustomAttributesToVertexTemplate(e,n),this.vertex_template},buildLines(e,t,n,r){if(this.feature_style=this.outline_feature_style,t.outline&&null!=t.outline.color&&null!=t.outline.width.value){var i=this.styles[t.outline.style];i&&i.addFeature(n.feature,t.outline,n)}this.feature_style=this.inline_feature_style;let o=this.getTileMesh(n.tile,this.meshVariantTypeForDraw(t)),s=o.vertex_data,a=s.vertex_layout;return function(e,t,n,r,i,o,s,a){var l,u=t.cap?nt[t.cap]:nt.butt,c=t.join?rt[t.join]:rt.miter;if(c===rt.miter){const e=t.miter_limit||3;var d=e*e}i.a_texcoord&&(l=1/(t.texcoord_width*it));var h={closed_polygon:o,remove_tile_edges:s,tile_edge_tolerance:a,miter_len_sq:d,join_type:c,cap_type:u,vertex_data:n,vertex_template:r,half_width:t.width/2,extrude_index:i.a_extrude,offset_index:i.a_offset,v_scale:l,texcoord_index:i.a_texcoord,texcoord_width:t.texcoord_width,offset:t.offset,geom_count:0};for(let t=0;t<e.length;t++)lt(e[t],h);if(h.extra_lines)for(let e=0;e<h.extra_lines.length;e++)lt(h.extra_lines[e],h);return h.geom_count}(e,t,s,this.makeVertexTemplate(t,o),a.index,r&&r.closed_polygon,!t.tile_edges&&r&&r.remove_tile_edges,U.tile_scale*n.tile.pad_scale*2)},buildPolygons(e,t,n){let r=0;for(let i=0;i<e.length;i++)r+=this.buildLines(e[i],t,n,{closed_polygon:!0,remove_tile_edges:!0});return r}});const xt=128/Math.PI,wt=16384/Math.PI,Et=[0,2,2,0],St=[1,1,3,3],Tt=new Array(4),kt=["left","top-left","bottom-left"],Ot=["right","top-right","bottom-right"],At=["top","top-left","top-right"],Ct=["bottom","bottom-left","bottom-right"],Rt={computeOffset(e,t,n,r=null){if(!n||"center"===n)return e;let i=[e[0],e[1]];return r=r||this.default_buffer,this.isLeftAnchor(n)?(i[0]-=t[0]/2,"left"===n&&(i[0]-=r[0])):this.isRightAnchor(n)&&(i[0]+=t[0]/2,"right"===n&&(i[0]+=r[1])),this.isTopAnchor(n)?(i[1]-=t[1]/2,"top"===n&&(i[1]-=r[2])):this.isBottomAnchor(n)&&(i[1]+=t[1]/2,"bottom"===n&&(i[1]+=r[3])),i},alignForAnchor(e){if(e&&"center"!==e){if(this.isLeftAnchor(e))return"right";if(this.isRightAnchor(e))return"left"}return"center"},isLeftAnchor:e=>kt.indexOf(e)>-1,isRightAnchor:e=>Ot.indexOf(e)>-1,isTopAnchor:e=>At.indexOf(e)>-1,isBottomAnchor:e=>Ct.indexOf(e)>-1,default_buffer:[2.5,2.5,1.5,.75],zero_buffer:[0,0,0,0]};function Nt(e,t){return!(e[2]<t[0]||e[0]>t[2]||e[3]<t[1]||e[1]>t[3])}const Pt=[[1,0],[0,1]],Mt=[],Dt=[];let It,zt,Ft,Lt;class jt{constructor(e,t,n,r,i){this.dimension=[r/2,i/2],this.angle=n,this.centroid=[e,t],this.quad=null,this.axis_0=null,this.axis_1=null,this.update()}toJSON(){return{x:this.centroid[0],y:this.centroid[1],a:this.angle,w:this.dimension[0],h:this.dimension[1]}}getExtent(){return 0===this.angle?[this.quad[0],this.quad[1],this.quad[4],this.quad[5]]:[Math.min(this.quad[0],this.quad[2],this.quad[4],this.quad[6]),Math.min(this.quad[1],this.quad[3],this.quad[5],this.quad[7]),Math.max(this.quad[0],this.quad[2],this.quad[4],this.quad[6]),Math.max(this.quad[1],this.quad[3],this.quad[5],this.quad[7])]}updateAxes(){this.axis_0=be.normalize([this.quad[4]-this.quad[6],this.quad[5]-this.quad[7]]),this.axis_1=be.normalize([this.quad[4]-this.quad[2],this.quad[5]-this.quad[3]])}update(){const e=this.centroid,t=this.dimension[0],n=this.dimension[1];if(0===this.angle)this.quad=[e[0]-t,e[1]-n,e[0]+t,e[1]-n,e[0]+t,e[1]+n,e[0]-t,e[1]+n],this.axis_0=Pt[0],this.axis_1=Pt[1];else{let r=Math.cos(this.angle)*t,i=Math.sin(this.angle)*t,o=-Math.sin(this.angle)*n,s=Math.cos(this.angle)*n;this.quad=[e[0]-r-o,e[1]-i-s,e[0]+r-o,e[1]+i-s,e[0]+r+o,e[1]+i+s,e[0]-r+o,e[1]-i+s],this.updateAxes()}}static projectToAxis(e,t,n){let r=e.quad;return It=r[0]*t[0]+r[1]*t[1],zt=r[2]*t[0]+r[3]*t[1],Ft=r[4]*t[0]+r[5]*t[1],Lt=r[6]*t[0]+r[7]*t[1],n[0]=Math.min(It,zt,Ft,Lt),n[1]=Math.max(It,zt,Ft,Lt),n}static axisCollide(e,t,n,r){return jt.projectToAxis(e,n,Mt),jt.projectToAxis(t,n,Dt),!(Dt[0]>Mt[1]||Dt[1]<Mt[0]||(jt.projectToAxis(e,r,Mt),jt.projectToAxis(t,r,Dt),Dt[0]>Mt[1]||Dt[1]<Mt[0]))}static intersect(e,t){return jt.axisCollide(e,t,e.axis_0,e.axis_1)&&jt.axisCollide(e,t,t.axis_0,t.axis_1)}}class $t{constructor(e,t={}){this.id=$t.nextLabelId(),this.type="",this.size=e,this.layout=t,this.position=null,this.angle=0,this.anchor=Array.isArray(this.layout.anchor)?this.layout.anchor[0]:this.layout.anchor,this.placed=null,this.offset=t.offset,this.unit_scale=this.layout.units_per_pixel,this.aabb=null,this.obb=null,this.align="center",this.throw_away=!1}toJSON(){return{id:this.id,type:this.type,obb:this.obb.toJSON(),position:this.position,angle:this.angle,size:this.size,offset:this.offset,breach:this.breach,may_repeat_across_tiles:this.may_repeat_across_tiles,layout:Bt(this.layout)}}update(){this.align=this.layout.align||Rt.alignForAnchor(this.anchor)}occluded(e,t=null){let n=!1,r=e.aabb,i=e.obb;return r.length>0&&function(e,t,n){for(let r=0;r<t.length&&(!Nt(e,t[r])||null==n(r));r++);}(this.aabb,r,e=>{if(!t||r[e]!==t.aabb)return 0===this.obb.angle&&0===i[e].angle||jt.intersect(this.obb,i[e])?(n=!0,!0):void 0}),n}inTileBounds(){return this.aabb[0]>=0&&this.aabb[1]>-U.tile_scale&&this.aabb[0]<U.tile_scale&&this.aabb[1]<=0||this.aabb[2]>=0&&this.aabb[3]>-U.tile_scale&&this.aabb[2]<U.tile_scale&&this.aabb[3]<=0}mayRepeatAcrossTiles(){if(this.layout.collide)return!0;const e=this.layout.repeat_distance;return 0!==e&&(Math.abs(this.position[0])<e||Math.abs(this.position[0]-U.tile_scale)<e||Math.abs(this.position[1])<e||Math.abs(-(this.position[1]-U.tile_scale))<e)}discard(e,t=null){return!!this.throw_away||this.occluded(e,t)}}function Bt(e){return{priority:e.priority,collide:e.collide,repeat_distance:e.repeat_distance,repeat_group:e.repeat_group,buffer:e.buffer,italic:e.italic}}$t.add=function(e,t){if(e.placed=!0,e.aabb&&(t.aabb.push(e.aabb),t.obb.push(e.obb)),e.aabbs)for(let n=0;n<e.aabbs.length;n++)t.aabb.push(e.aabbs[n]),t.obb.push(e.obbs[n])},$t.id=0,$t.id_prefix=0,$t.id_multiplier=0,$t.nextLabelId=function(){return $t.id_prefix+$t.id++*$t.id_multiplier},$t.epsilon=.9999;class Vt{constructor(e,t){this.key=e,this.repeat_dist=t,this.repeat_dist_sq=this.repeat_dist*this.repeat_dist,this.positions=[]}check(e){let t=e.position;for(let e=0;e<this.positions.length;e++){let n=this.positions[e],r=t[0]-n[0],i=t[1]-n[1];if(r*r+i*i<this.repeat_dist_sq)return!0}}add(e){e&&e.position&&this.positions.push(e.position)}static clear(e){this.groups[e]={}}static check(e,t,n){if(t.repeat_distance&&t.repeat_group&&this.groups[n][t.repeat_group])return this.groups[n][t.repeat_group].check(e)}static add(e,t,n){t.repeat_distance&&t.repeat_group&&(null==this.groups[n][t.repeat_group]&&(this.groups[n][t.repeat_group]=new Vt(t.repeat_group,t.repeat_distance*t.repeat_scale)),this.groups[n][t.repeat_group].add(e))}}Vt.groups={};class Ut{constructor(e,t){this.anchor=e,this.span=t,this.cells={}}addLabel(e){e.aabb&&this.addLabelBboxes(e,e.aabb),e.aabbs&&e.aabbs.forEach(t=>this.addLabelBboxes(e,t))}addLabelBboxes(e,t){const n=[Math.max(Math.floor((t[0]-this.anchor.x)/this.span),0),Math.max(Math.floor(-(t[1]-this.anchor.y)/this.span),0),Math.max(Math.floor((t[2]-this.anchor.x)/this.span),0),Math.max(Math.floor(-(t[3]-this.anchor.y)/this.span),0)];e.cells=[];for(let t=n[1];t<=n[3];t++){this.cells[t]=this.cells[t]||{};for(let r=n[0];r<=n[2];r++)this.cells[t][r]=this.cells[t][r]||{aabb:[],obb:[]},e.cells.push(this.cells[t][r])}}}const Wt={tiles:{},grid:null,initGrid(e){this.grid=null==e?null:new Ut(e.anchor,e.span)},startTile(e,{apply_repeat_groups:t=!0,return_hidden:n=!1}={}){let r=this.tiles[e]={bboxes:{aabb:[],obb:[]},objects:{},labels:{},styles:{},repeat:t,return_hidden:n};null==r.complete&&(r.complete=new Promise((e,t)=>{r.resolve=e,r.reject=t}))},resetTile(e){delete this.tiles[e]},abortTile(e){this.tiles[e]&&this.tiles[e].resolve&&this.tiles[e].resolve([]),this.resetTile(e)},addStyle(e,t){this.tiles[t].styles[e]=!0},collide(e,t,n){let r=this.tiles[n];if(!r)return g("trace","Collision.collide() called with null tile",n,this.tiles,t,e),Promise.resolve([]);let i=r.objects;for(let n=0;n<e.length;n++){let r=e[n],o=r.label.layout.priority;i[o]=i[o]||{},i[o][t]=i[o][t]||[],i[o][t].push(r)}return delete r.styles[t],0===Object.keys(r.styles).length&&this.endTile(n),r.complete.then(()=>(r.resolve=null,r.labels[t]||[]))},endTile(e){let t=this.tiles[e],n=t.labels;this.grid&&this.addLabelsToGrid(e),t.repeat&&Vt.clear(e);let r=Object.keys(t.objects).sort((e,t)=>e-t);for(let i=0;i<r.length;i++){let o=t.objects[r[i]];if(o)for(let r in o){let i=o[r];n[r]=n[r]||[];for(let o=0;o<i.length;o++){let s=i[o];this.canBePlaced(s,e,s.linked,t)?s.linked?this.canBePlaced(s.linked,e,s,t)?(s.show=!0,(s.label.breach||s.linked.label.breach)&&(s.label.breach=!0,s.linked.label.breach=!0),(s.label.may_repeat_across_tiles||s.linked.label.may_repeat_across_tiles)&&(s.label.may_repeat_across_tiles=!0,s.linked.label.may_repeat_across_tiles=!0),n[r].push(s),this.place(s,e,t),this.place(s.linked,e,t)):t.return_hidden&&(s.show=!1,n[r].push(s)):(s.show=!0,n[r].push(s),this.place(s,e,t)):t.return_hidden&&(s.show=!1,n[r].push(s))}}}delete this.tiles[e],t.resolve()},addLabelsToGrid(e){const t=this.tiles[e];for(const e in t.objects){const n=t.objects[e];if(n)for(const e in n)n[e].forEach(e=>this.grid.addLabel(e.label))}},canBePlaced(e,t,n=null,{repeat:r=!0}={}){let i=e.label,o=e.label.layout;if(null!=i.placed)return i.placed;let s=!o.collide;if(s||(s=this.grid&&i.cells?i.cells.reduce((e,t)=>(e&&i.discard(t,n&&n.label)&&(e=!1),e),!0):!i.discard(this.tiles[t].bboxes,n&&n.label)),s){if(!r||!Vt.check(i,o,t))return!0;i.placed=!1}else o.collide&&(i.placed=!1);return i.placed},place({label:e},t,{repeat:n=!0}){null==e.placed&&(n&&Vt.add(e,e.layout,t),this.grid&&e.cells?e.cells.forEach(t=>$t.add(e,t)):$t.add(e,this.tiles[t].bboxes))}};class qt extends $t{constructor(e,t,n,r=0){super(t,n),this.type="point",this.position=[e[0],e[1]],this.angle=r,this.parent=this.layout.parent,this.update(),this.start_anchor_index=1,this.degenerate=!(this.size[0]||this.size[1]||this.layout.buffer[0]||this.layout.buffer[1]),this.throw_away=!1}update(){super.update(),this.computeOffset(),this.updateBBoxes()}computeOffset(){if(this.offset=[this.layout.offset[0],this.layout.offset[1]],this.parent){let e=this.parent;this.offset=Rt.computeOffset(this.offset,e.size,e.anchor,Rt.zero_buffer),this.offset=Rt.computeOffset(this.offset,e.size,this.anchor,Rt.zero_buffer),e.offset!==Q.zeroPair&&(this.offset===Q.zeroPair?this.offset=e.offset:(this.offset[0]+=e.offset[0],this.offset[1]+=e.offset[1]))}this.offset=Rt.computeOffset(this.offset,this.size,this.anchor)}updateBBoxes(){let e=(this.size[0]+2*this.layout.buffer[0])*this.unit_scale*$t.epsilon,t=(this.size[1]+2*this.layout.buffer[1])*this.unit_scale*$t.epsilon;this.layout.italic&&(e+=5*this.unit_scale),this.obb=new jt(this.position[0]+this.offset[0]*this.unit_scale,this.position[1]-this.offset[1]*this.unit_scale,-this.angle,e,t),this.aabb=this.obb.getExtent(),this.inTileBounds&&(this.breach=!this.inTileBounds()),this.mayRepeatAcrossTiles&&(this.may_repeat_across_tiles=this.mayRepeatAcrossTiles())}discard(e,t=null){if(this.degenerate)return!1;if(super.discard(e,t)){if(Array.isArray(this.layout.anchor))for(let n=this.start_anchor_index;n<this.layout.anchor.length;n++)if(this.anchor=this.layout.anchor[n],this.update(),!super.discard(e,t))return!1;return!0}return!1}}qt.PLACEMENT={VERTEX:0,MIDPOINT:1,SPACED:2,CENTROID:3};const Gt=qt.PLACEMENT;function Ht(e,t,n){const r=[],i=n.placement,o=Math.max(t[0],t[1])*n.placement_min_length_ratio*n.units_per_pixel;if(i===Gt.SPACED){let i=function(e,t,n){let r=n.units_per_pixel,i=(n.placement_spacing||80)*r,o=function(e){let t=0;for(let n=0;n<e.length-1;n++)t+=Kt(e[n],e[n+1]);return t}(e);if(o<=t)return!1;let s=Math.max(Math.floor(o/i),1),a=[],l=[],u=.5*(o-(s-1)*i);for(let r=0;r<s;r++){let{position:r,angle:o}=Xt(e,u,t,n);null!=r&&null!=o&&(a.push(r),l.push(o)),u+=i}return{positions:a,angles:l}}(e,o,n);if(!i)return[];let s=i.positions,a=i.angles;for(let e=0;e<s.length;e++){let i=s[e],o=a[e];!0!==n.tile_edges&&Ve(i)||r.push(new qt(i,t,n,o))}}else if(i===Gt.VERTEX){let i,o;for(let s=0;s<e.length-1;s++)if(i=e[s],o=e[s+1],!0===n.tile_edges||!Ve(i)){const e=Yt(i,o,n.angle);r.push(new qt(i,t,n,e))}const s=Yt(i,o,n.angle);r.push(new qt(o,t,n,s))}else if(i===Gt.MIDPOINT)for(let i=0;i<e.length-1;i++){let s=e[i],a=e[i+1],l=[.5*(s[0]+a[0]),.5*(s[1]+a[1])];if((!0===n.tile_edges||!Ve(l))&&(!o||Kt(s,a)>o)){const e=Yt(s,a,n.angle);r.push(new qt(l,t,n,e))}}return r}function Yt(e,t,n=0){return"auto"===n?Math.atan2(t[0]-e[0],t[1]-e[1]):n}function Kt(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2))}function Xt(e,t,n,r){let i,o,s=0;for(let a=0;a<e.length-1;a++){let l=e[a],u=e[a+1];const c=Kt(l,u);if(!(c<=n)&&(s+=c,s>t)){i=Zt(l,u,s-t),o=Yt(l,u,r.angle);break}}return{position:i,angle:o}}function Zt(e,t,n){let r=n/Kt(e,t);return[r*e[0]+(1-r)*t[0],r*e[1]+(1-r)*t[1]]}const Jt={key:e=>[e.style,e.weight,e.family,e.px_size,e.fill,e.stroke,e.stroke_width,e.underline_width,e.background_color,e.background_width,e.background_stroke_color,e.background_stroke_width,e.transform,e.text_wrap,e.max_lines,e.supersample,y.device_pixel_ratio].join("/"),defaults:{style:"normal",weight:"normal",size:"12px",px_size:12,family:"Helvetica",fill:[1,1,1,1],text_wrap:15,max_lines:5,align:"center"},compute(e,t){const n={};e.font=e.font||this.defaults,n.supersample=e.supersample_text?1.5:1,n.can_articulate=e.can_articulate,n.fill=Q.evalCachedColorPropertyWithAlpha(e.font.fill,e.font.alpha,t),n.fill=y.toCSSColor(n.fill),e.font.stroke&&e.font.stroke.color&&(n.stroke=Q.evalCachedColorPropertyWithAlpha(e.font.stroke.color,e.font.stroke.alpha,t),n.stroke=y.toCSSColor(n.stroke),n.stroke_width=Q.evalCachedProperty(e.font.stroke.width,t)),!0!==e.font.underline||n.can_articulate||(n.underline_width=1.5*n.supersample),e.font.background&&!n.can_articulate&&(n.background_color=Q.evalCachedColorPropertyWithAlpha(e.font.background.color,e.font.background.alpha,t),n.background_color=y.toCSSColor(n.background_color),n.background_color&&(n.background_width=Q.evalCachedProperty(e.font.background.width,t)),n.background_stroke_color=e.font.background.stroke&&e.font.background.stroke.color&&Q.evalCachedColorPropertyWithAlpha(e.font.background.stroke.color,e.font.background.stroke.alpha,t),n.background_stroke_color&&(n.background_stroke_color=y.toCSSColor(n.background_stroke_color),n.background_stroke_width=null!=e.font.background.stroke.width?Q.evalCachedProperty(e.font.background.stroke.width,t):1)),n.weight=Q.evalCachedProperty(e.font.weight,t)||this.defaults.weight,"number"==typeof n.weight&&(n.weight=Math.min(Math.max(n.weight,1),1e3)),e.font.family?(n.family=e.font.family,n.family!==this.defaults.family&&(n.family+=", "+this.defaults.family)):n.family=this.defaults.family,n.style=e.font.style||this.defaults.style,n.transform=e.font.transform,n.px_size=Q.evalCachedProperty(e.font.px_size,t)*n.supersample,n.font_css=this.fontCSS(n);let r=e.text_wrap;return null!=r||n.can_articulate||(r=!0),!0===r&&(r=this.defaults.text_wrap),n.text_wrap=r,n.max_lines=e.max_lines||this.defaults.max_lines,n},fontCSS:({style:e,weight:t,px_size:n,family:r})=>[e,t,n+"px",r].filter(e=>e).join(" ")};var Qt,en,tn={exports:{}},nn=P((Qt||(Qt=1,en=tn,function(){function e(e,t){document.addEventListener?e.addEventListener("scroll",t,!1):e.attachEvent("scroll",t)}function t(e){this.a=document.createElement("div"),this.a.setAttribute("aria-hidden","true"),this.a.appendChild(document.createTextNode(e)),this.b=document.createElement("span"),this.c=document.createElement("span"),this.h=document.createElement("span"),this.f=document.createElement("span"),this.g=-1,this.b.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.c.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.f.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.h.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;",this.b.appendChild(this.h),this.c.appendChild(this.f),this.a.appendChild(this.b),this.a.appendChild(this.c)}function n(e,t){e.a.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;left:-999px;white-space:nowrap;font:"+t+";"}function r(e){var t=e.a.offsetWidth,n=t+100;return e.f.style.width=n+"px",e.c.scrollLeft=n,e.b.scrollLeft=e.b.scrollWidth+100,e.g!==t&&(e.g=t,!0)}function i(t,n){function i(){var e=o;r(e)&&e.a.parentNode&&n(e.g)}var o=t;e(t.b,i),e(t.c,i),r(t)}function o(e,t){var n=t||{};this.family=e,this.style=n.style||"normal",this.weight=n.weight||"normal",this.stretch=n.stretch||"normal"}var s=null,a=null,l=null,u=null;function c(){if(null===l){var e=document.createElement("div");try{e.style.font="condensed 100px sans-serif"}catch(e){}l=""!==e.style.font}return l}function d(e,t){return[e.style,e.weight,c()?e.stretch:"","100px",t].join(" ")}o.prototype.load=function(e,r){var o=this,l=e||"BESbswy",c=0,h=r||3e3,p=(new Date).getTime();return new Promise(function(e,r){var f;if(null===u&&(u=!!document.fonts),(f=u)&&(null===a&&(a=/OS X.*Version\/10\..*Safari/.test(navigator.userAgent)&&/Apple/.test(navigator.vendor)),f=!a),f){f=new Promise(function(e,t){!function n(){(new Date).getTime()-p>=h?t():document.fonts.load(d(o,'"'+o.family+'"'),l).then(function(t){1<=t.length?e():setTimeout(n,25)},function(){t()})}()});var m=new Promise(function(e,t){c=setTimeout(t,h)});Promise.race([m,f]).then(function(){clearTimeout(c),e(o)},function(){r(o)})}else!function(e){document.body?e():document.addEventListener?document.addEventListener("DOMContentLoaded",function t(){document.removeEventListener("DOMContentLoaded",t),e()}):document.attachEvent("onreadystatechange",function t(){"interactive"!=document.readyState&&"complete"!=document.readyState||(document.detachEvent("onreadystatechange",t),e())})}(function(){function a(){var t;(t=-1!=g&&-1!=y||-1!=g&&-1!=b||-1!=y&&-1!=b)&&((t=g!=y&&g!=b&&y!=b)||(null===s&&(t=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),s=!!t&&(536>parseInt(t[1],10)||536===parseInt(t[1],10)&&11>=parseInt(t[2],10))),t=s&&(g==v&&y==v&&b==v||g==_&&y==_&&b==_||g==x&&y==x&&b==x)),t=!t),t&&(w.parentNode&&w.parentNode.removeChild(w),clearTimeout(c),e(o))}var u=new t(l),f=new t(l),m=new t(l),g=-1,y=-1,b=-1,v=-1,_=-1,x=-1,w=document.createElement("div");w.dir="ltr",n(u,d(o,"sans-serif")),n(f,d(o,"serif")),n(m,d(o,"monospace")),w.appendChild(u.a),w.appendChild(f.a),w.appendChild(m.a),document.body.appendChild(w),v=u.a.offsetWidth,_=f.a.offsetWidth,x=m.a.offsetWidth,function e(){if((new Date).getTime()-p>=h)w.parentNode&&w.parentNode.removeChild(w),r(o);else{var t=document.hidden;!0!==t&&void 0!==t||(g=u.a.offsetWidth,y=f.a.offsetWidth,b=m.a.offsetWidth,a()),c=setTimeout(e,50)}}(),i(u,function(e){g=e,a()}),n(u,d(o,'"'+o.family+'",sans-serif')),i(f,function(e){y=e,a()}),n(f,d(o,'"'+o.family+'",serif')),i(m,function(e){b=e,a()}),n(m,d(o,'"'+o.family+'",monospace'))})})},en.exports=o}()),tn.exports));const rn={fonts_loaded:Promise.resolve(),last_loaded:null,loadFonts(e){const t=JSON.stringify(e)===this.last_loaded;if(e&&!t){const t=[];for(const n in e)Array.isArray(e[n])?e[n].forEach(e=>t.push(this.loadFontFace(n,e))):t.push(this.loadFontFace(n,e[n]));this.last_loaded=JSON.stringify(e),this.fonts_loaded=Promise.all(t.filter(e=>e))}return this.fonts_loaded},async loadFontFace(e,t){if(null==t||"object"!=typeof t&&"external"!==t)return;const n={family:e};"object"==typeof t&&(Object.assign(n,t),"string"==typeof t.url&&await this.injectFontFace(n));try{n.weight="string"==typeof n.weight?n.weight.split(" ")[0]:n.weight;const t=new nn(e,n);await t.load(),g("debug",`Font face '${e}' is available`,n)}catch(t){g("warn",`Font face '${e}' is NOT available`,n,t)}},async injectFontFace({family:e,url:t,weight:n,style:r}){void 0===this.supports_native_font_loading&&(this.supports_native_font_loading=void 0!==window.FontFace);let i=t;if("blob:"===t.slice(0,5)){i=(await y.io(t,6e4,"arraybuffer")).body;let e=new Uint8Array(i);if(this.supports_native_font_loading)i=e;else{let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);i="data:font/opentype;base64,"+btoa(t)}}if(this.supports_native_font_loading){let t;"string"==typeof i?t=new FontFace(e,`url(${encodeURI(i)})`,{weight:n,style:r}):i instanceof Uint8Array&&(t=new FontFace(e,i,{weight:n,style:r})),document.fonts.add(t),g("trace","Adding FontFace to document.fonts:",t)}else{let t=`\n @font-face {\n font-family: '${e}';\n font-weight: ${n||"normal"};\n font-style: ${r||"normal"};\n src: url(${encodeURI(i)});\n }`,o=document.createElement("style");o.appendChild(document.createTextNode("")),document.head.appendChild(o),o.sheet.insertRule(t,0),g("trace","Injecting CSS font face:",t)}}},on=new RegExp("[֑-߿יִ-﷽ﹰ-ﻼ]");function sn(e){return on.test(e)}const an="\0-/:-@[-`{-¿×÷ʹ-˿ -⯿‐-\u2029 -⯿",ln=new RegExp("["+an+"]+");function un(e){return ln.test(e)}const cn=new RegExp("^["+an+"-ۿ]+"),dn=new RegExp("["+an+"آ-إاد-زوٱ-ٷڈ-ڙۄ-ۋۏےۓۮۯ]"),hn=new RegExp("^[ؐ-ًؚ-ٰٟۖ-ۜ۟-۪ۤۧۨ-ۭ]+"),pn="[̀-֑ͯ-ׇֽֿׁׂׅׄަ-ްऀ-ःऺ-ौॎॏ॑-ॗॢॣঁ-ঃ়া-ৌৗৢৣਁ-ਃ਼-ੌੑઁ-ઃ઼ા-ૌૢૣଁ-ଃ଼ା-ୌୖୗୢୣஂா-்ௗఀ-ఃా-ౌౕౖౢౣಁ-ಃ಼ಾ-ೌೕೖೢೣഁ-ഃാ-ൌൎൗൢൣංඃ්-ෟෲෳัิ-ฺ็-๎ັິ-ຼ່-ໍ༹༘༙༵༷༾༿ཱ-ྃ྆྇ྍ-ྼ࿆ါ-း်-ှၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏႚ-ႝ឴-៑៓ᩕ-ᩞᩡ-᩼᷀-᷿⃐-]",fn=new RegExp(`^.(?:${pn}+)?([्্੍્୍్್്྄္្᩠᩿]\\W(?:${pn}+)?)*`),mn={Mongolian:"᠀-"},gn=Object.keys(mn).map(e=>mn[e]).join(""),yn=new RegExp("["+gn+"]");function bn(e,t,n){const r=t?1:2;if(e.length<r)return[e];let i=e;if(n.segment[i])return n.stats.segment_hits++,n.segment[i];let o=[];if(cn.exec(e)){o=e.split(dn);let t=-1;for(var s=0;s<o.length-1;s++){if(s>0){let e=hn.exec(o[s]);e&&(o[s]=o[s].substring(e[0].length),o[s-1]+=e[0],t+=e[0].length)}t+=1+o[s].length,o[s]+=e.slice(t,t+1)}e=""}for(;e.length;){let t="",n=e,i=0;for(;i<r&&n.length;i++){let e=(fn.exec(n)||n)[0];t+=e,n=n.substring(e.length)}o.push(t),e=e.substring(t.length)}return t&&o.reverse(),n.stats.segment_misses++,n.segment[i]=o,o}class vn{constructor(e,t=1/0,n=1/0){this.width=0,this.height=0,this.lines=[],this.max_lines=t,this.text_wrap=n,this.context=e}createLine(e){return this.lines.length<this.max_lines&&new _n(e,this.text_wrap)}push(e){if(this.lines.length<this.max_lines){let t=this.context.measureText(e.text).width;return e.width=t,t>this.width&&(this.width=Math.ceil(t)),this.lines.push(e),this.height+=e.height,!0}return this.addEllipsis(),!1}advance(e,t){return!!this.push(e)&&this.createLine(t)}addEllipsis(){let e=this.lines[this.lines.length-1],t=Math.ceil(this.context.measureText(vn.ellipsis).width);e.append(vn.ellipsis),e.width+=t,e.width>this.width&&(this.width=e.width)}finish(e){e?this.push(e):this.addEllipsis()}static parse(e,t,n,r,i){let o;o="number"==typeof t?e.split(" "):[e];let s=new vn(i,n,t),a=s.createLine(r);for(let e=0;e<o.length;e++){let n=o[e].split("\n"),i=0===e;for(let o=0;o<n.length&&a;o++){let l=n[o];sn(l)&&un(l[l.length-1])&&(l+="");let u=i?l:" "+l;if(t&&e>0&&a.exceedsTextwrap(u)){if(a=s.advance(a,r),!a)break;a.append(l),i=!0}else a.append(u);o<n.length-1&&(a=s.advance(a,r),i=!0)}e===o.length-1&&s.finish(a)}return s}}vn.ellipsis="...";class _n{constructor(e=0,t=0){this.chars=0,this.text="",this.height=Math.ceil(e),this.text_wrap=t}append(e){this.chars+=e.length,this.text+=e}exceedsTextwrap(e){return e.length+this.chars>this.text_wrap}}function xn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function wn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?xn(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}class En{constructor(){this.createCanvas(),this.vertical_text_buffer=8,this.horizontal_text_buffer=4,this.background_size=4}createCanvas(){this.canvas=document.createElement("canvas"),this.canvas.style.backgroundColor="transparent",this.context=this.canvas.getContext("2d")}resize(e,t){this.canvas.width=e,this.canvas.height=t,this.context.clearRect(0,0,e,t)}setFont({font_css:e,fill:t,stroke:n,stroke_width:r,px_size:i,supersample:o}){this.px_size=i;let s=this.context,a=y.device_pixel_ratio*o;n&&r>0&&(s.strokeStyle=n,s.lineWidth=r*a),s.fillStyle=t,s.font=e,s.miterLimit=2}async textSizes(e,t){return await rn.loadFonts(),S.add({type:"textSizes",run:this.processTextSizesTask.bind(this),texts:t,tile_id:e,cursor:{styles:Object.keys(t),texts:null,style_idx:null,text_idx:null}})}processTextSizesTask(e){let{cursor:t,texts:n}=e;for(t.style_idx=t.style_idx||0;t.style_idx<t.styles.length;){let i=t.styles[t.style_idx];null==t.text_idx&&(t.text_idx=0,t.texts=Object.keys(n[i]));let o=n[i],s=!0;for(;t.text_idx<t.texts.length;){let n=t.texts[t.text_idx],a=o[n],l=a.text_settings;if(s&&(this.setFont(l),s=!1),a.size=this.textSize(i,n,l).size,l.can_articulate){let e=!1,t=!1;if(sn(n)&&(un(n)?e=!0:t=!0),a.isRTL=e,a.no_curving=t||(r=n,yn.test(r)),a.vertical_buffer=this.vertical_text_buffer,a.segment_sizes=[],!a.no_curving){let t=bn(n,e,En.cache);a.segments=t;for(let e=0;e<t.length;e++)a.segment_sizes.push(this.textSize(i,t[e],l).size)}}if(t.text_idx++,!S.shouldContinue(e))return!1}t.text_idx=null,t.style_idx++}var r;return S.finish(e,n),!0}textSize(e,t,{transform:n,text_wrap:r,max_lines:i,stroke_width:o=0,background_color:s,background_stroke_width:a=0,background_width:l,underline_width:u=0,supersample:c}){if(En.cache.text[e]=En.cache.text[e]||{},En.cache.text[e][t])return En.cache.stats.text_hits++,En.cache.text[e][t];En.cache.stats.text_misses++,En.cache.text_count++;const d=y.device_pixel_ratio*c,h=this.applyTextTransform(t,n),p=this.context,f=this.vertical_text_buffer*d,m=(o+this.horizontal_text_buffer)*d;l=null!=l?l:this.background_size;const g=s||a?(l+a)*d:0,b=(2+u+(u?o+1:0))*d,v=this.px_size+b;let{width:_,height:x,lines:w}=vn.parse(h,r,i,v,p);_+=2*g,x+=2*g;let E=[_/d,x/d],S=[_+2*m,x+2*f],T=[S[0]/d,S[1]/d];return En.cache.text[e][t]={lines:w,size:{collision_size:E,texture_size:S,logical_size:T,horizontal_buffer:m,vertical_buffer:f,dpr:d,line_height:v,background_size:g}},En.cache.text[e][t]}drawTextMultiLine(e,[t,n],r,i,o){const{dpr:s,collision_size:a,texture_size:l,line_height:u,horizontal_buffer:c,vertical_buffer:d}=r;if(i.background_color||i.background_stroke_color){const e=i.background_stroke_color,r=(i.background_stroke_width||0)*s;this.context.save(),i.background_color&&(this.context.fillStyle=i.background_color,this.context.fillRect(t+c+("curved"===o?l[0]:0)+r,n+d+r,s*a[0]-2*r,s*a[1]-2*r)),e&&r&&(this.context.strokeStyle=e,this.context.lineWidth=r,this.context.strokeRect(t+c+("curved"===o?l[0]:0)+.5*r,n+d+.5*r,s*a[0]-r,s*a[1]-r)),this.context.restore()}const h=i.underline_width||0,p=i.stroke_width||0;let f=n-(h?.5*(h+p+1)*s:0);for(let n=0;n<e.length;n++){let s=e[n];this.drawTextLine(s,[t,f],r,i,o),f+=u}this.drawTextDebug([t,n],r,o)}drawTextLine(e,[t,n],r,i,o){const{stroke:s,stroke_width:a,transform:l,align:u="center"}=i,{horizontal_buffer:c,vertical_buffer:d,texture_size:h,background_size:p,line_height:f,dpr:m}=r,g=(i.underline_width||0)*m,y=this.applyTextTransform(e.text,l);let b;"left"===u?b=t+c+p:"center"===u?b=t+h[0]/2-e.width/2:"right"===u&&(b=t+h[0]-e.width-c-p);const v=n+.75*d+f+p-.5*g,_=s&&a>0&&"curved"===o?h[0]:0;if(g){this.context.save(),this.context.strokeStyle=this.context.fillStyle,this.context.lineWidth=g;const t=v+(.5*a+2)*m+.5*this.context.lineWidth;this.context.beginPath(),this.context.moveTo(b+_,t),this.context.lineTo(b+_+e.width,t),this.context.stroke(),this.context.restore()}s&&a>0&&this.context.strokeText(y,b+_,v),this.context.fillText(y,b,v)}drawTextDebug([e,t],n,r){const{dpr:i,horizontal_buffer:o,vertical_buffer:s,texture_size:a,collision_size:l}=n;v.draw_label_collision_boxes&&(this.context.save(),this.context.strokeStyle="blue",this.context.lineWidth=2,this.context.strokeRect(e+o,t+s,i*l[0],i*l[1]),"curved"===r&&this.context.strokeRect(e+a[0]+o,t+s,i*l[0],i*l[1]),this.context.restore()),v.draw_label_texture_boxes&&(this.context.save(),this.context.strokeStyle="green",this.context.lineWidth=2,this.context.strokeRect(e+2,t+2,a[0]-4,a[1]-4),"curved"===r&&this.context.strokeRect(e+2+a[0],t+2,a[0]-4,a[1]-4),this.context.restore())}rasterize(e,t,n,r,i){return S.add({type:"rasterizeLabels",run:this.processRasterizeTask.bind(this),cancel:this.cancelRasterizeTask.bind(this),pause_factor:2,user_moving_view:!1,texts:e,textures:t,texture_prefix:r,gl:i,tile_id:n,cursor:{styles:Object.keys(e),texts:null,style_idx:0,text_idx:null,texture_idx:0,texture_resize:!0,texture_names:[]}})}processRasterizeTask(e){let t,{cursor:n,texts:r,textures:i}=e;for(;n.texture_idx<e.textures.length;){for(t=i[n.texture_idx],n.texture_resize&&(n.texture_resize=!1,this.resize(...t.texture_size));n.style_idx<n.styles.length;){let i=n.styles[n.style_idx];null==n.text_idx&&(n.text_idx=0,n.texts=Object.keys(r[i]));let o=r[i],s=!0;for(;n.text_idx<n.texts.length;){let r=n.texts[n.text_idx],a=o[r],l=a.text_settings;if(s&&(this.setFont(l),s=!1),l.can_articulate){a.texcoords=a.texcoords||{};for(let e=0;e<a.type.length;e++){let o=a.type[e];if("straight"===o){if(a.textures[e]!==n.texture_idx)continue;let s,u=a.isRTL?r.split().reverse().join():r,c=t.texcoord_cache[i][u];if(c.texcoord)s=c.texcoord;else{let e=c.texture_position,{size:n,lines:r}=this.textSize(i,u,l);this.drawTextMultiLine(r,e,n,l,o),s=O.getTexcoordsForSprite(e,n.texture_size,t.texture_size),c.texcoord=s}a.texcoords[o]={texcoord:s,texture_id:c.texture_id}}else if("curved"===o){let r=a.segments;a.texcoords.curved=a.texcoords.curved||[],a.texcoords_stroke=a.texcoords_stroke||[];for(let s=0;s<r.length;s++){if(a.textures[e][s]!==n.texture_idx)continue;let u,c,d=r[s],h=t.texcoord_cache[i][d];if(h.texcoord)u=h.texcoord,c=h.texcoord_stroke,a.texcoords_stroke.push(c);else{let e=h.texture_position,{size:n,lines:r}=this.textSize(i,d,l);this.drawTextMultiLine(r,e,n,l,o),u=O.getTexcoordsForSprite(e,n.texture_size,t.texture_size);let s=[e[0]+n.texture_size[0],e[1]];c=O.getTexcoordsForSprite(s,n.texture_size,t.texture_size),h.texcoord=u,h.texcoord_stroke=c,a.texcoords_stroke.push(c)}a.texcoords.curved.push({texcoord:u,texture_id:h.texture_id})}}}}else{let e=this.textSize(i,r,l).lines;const o=wn({},l);for(let r in a.align)a.align[r].texture_id===n.texture_idx&&(o.align=r,this.drawTextMultiLine(e,a.align[r].texture_position,a.size,o),a.align[r].texcoords=O.getTexcoordsForSprite(a.align[r].texture_position,a.size.texture_size,t.texture_size))}if(n.text_idx++,!S.shouldContinue(e))return!1}n.text_idx=null,n.style_idx++}let o=e.texture_prefix+n.texture_idx;O.create(e.gl,o,{element:this.canvas,filtering:"linear",UNPACK_PREMULTIPLY_ALPHA_WEBGL:!0}),O.retain(o),n.texture_names.push(o),n.texture_idx++,n.texture_resize=!0,n.style_idx=0}return S.finish(e,n.texture_names),!0}cancelRasterizeTask(e){g("trace",`RasterizeTask: release textures [${e.cursor.texture_names.join(", ")}]`),e.cursor.texture_names.forEach(e=>O.release(e))}setTextureTextPositions(e,t){let n={cx:0,cy:0,width:0,height:0,column_width:0,texture_id:0,texcoord_cache:{}},r=[];for(let i in e){let o=e[i];for(let e in o){let s,a=o[e];if(a.text_settings.can_articulate){a.textures=[],n.texcoord_cache[i]=n.texcoord_cache[i]||{};for(let o=0;o<a.type.length;o++){let l=a.type[o];if("straight"===l){let l=a.isRTL?e.split().reverse().join():e;if(!n.texcoord_cache[i][l]){let e=a.size.texture_size;s=this.placeText(e[0],e[1],i,n,r,t),n.texcoord_cache[i][l]={texture_id:n.texture_id,texture_position:s}}a.textures[o]=n.texture_id}else if("curved"===l){a.textures[o]=[];for(let e=0;e<a.segment_sizes.length;e++){let l=a.segments[e];if(!n.texcoord_cache[i][l]){let o=a.segment_sizes[e].texture_size,u=2*o[0];s=this.placeText(u,o[1],i,n,r,t),n.texcoord_cache[i][l]={texture_id:n.texture_id,texture_position:s}}a.textures[o].push(n.texture_id)}}}}else{let e=a.size.texture_size;for(let o in a.align)s=this.placeText(e[0],e[1],i,n,r,t),a.align[o].texture_id=n.texture_id,a.align[o].texture_position=s}}}return n.column_width>0&&n.height>0&&(r[n.texture_id]={texture_size:[n.width,n.height],texcoord_cache:n.texcoord_cache}),r}placeText(e,t,n,r,i,o){let s;return r.cy+t>o?(r.cx+=r.column_width,r.cy=0,r.column_width=e):r.column_width=Math.max(r.column_width,e),r.cx+r.column_width<=o?(s=[r.cx,r.cy],r.cy+=t,r.height=Math.max(r.height,r.cy),r.width=Math.max(r.width,r.cx+r.column_width)):(i[r.texture_id]={texture_size:[r.width,r.height],texcoord_cache:r.texcoord_cache},r.texcoord_cache={},r.texcoord_cache[n]={},r.texture_id++,r.cx=0,r.cy=t,r.column_width=e,r.width=e,r.height=t,s=[0,0]),s}applyTextTransform(e,t){return"capitalize"===t?e.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1)}):"uppercase"===t?e.toUpperCase():"lowercase"===t?e.toLowerCase():e}static fontPixelSize(e){if(null==e)return;e="string"==typeof e?e:String(e);let[,t,n]=e.match(En.font_size_re)||[];return n=n||"px","em"===n?t*=16:"pt"===n?t/=.75:"%"===n&&(t/=6.25),t=Q.parsePositiveNumber(t),t*=y.device_pixel_ratio,t}static pruneTextCache(){En.cache.text_count>En.cache.text_count_max&&(En.cache.text={},En.cache.text_count=0,g("debug","TextCanvas: pruning text cache")),Object.keys(En.cache.segment).length>En.cache.segment_count_max&&(En.cache.segment={},g("debug","TextCanvas: pruning segment cache"))}}function Sn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}En.font_size_re=/((?:[0-9]*\.)?[0-9]+)\s*(px|pt|em|%)?/,En.cache={text:{},text_count:0,text_count_max:2e3,segment:{},segment_count_max:2e3,stats:{text_hits:0,text_misses:0,segment_hits:0,segment_misses:0}};let Tn=0;const kn={resetText(){t.is_main?this.canvas=new En:t.is_worker&&(this.texts={})},freeText(e){delete this.texts[e.id]},parseTextFeature(e,t,n,r){let i=this.parseTextSource(e,t,n);if(null==i||""===i)return;let o=Jt.compute(t,n),s=Jt.key(o);this.texts[r.id]=this.texts[r.id]||{};let a=this.texts[r.id][s]=this.texts[r.id][s]||{};if(i instanceof Object){let l=[],u=i.left+"-"+i.right;for(let c in i){let d=i[c];if(!d)continue;let h=this.computeTextLayout({},e,t,n,r,d,o,u,c);a[d]||(a[d]={text_settings:o,ref:0}),l.push({draw:t,text:d,text_settings_key:s,layout:h})}return l.length>0&&l}{let l=this.computeTextLayout({},e,t,n,r,i,o);return a[i]||(a[i]={text_settings:o,ref:0}),{draw:t,text:i,text_settings_key:s,layout:l}}},parseTextSource(e,t,n){let r,i=t.text_source||"name";if(null==i||Array.isArray(i)||"object"!=typeof i)r=this.parseTextSourceValue(i,e,n);else{r={};for(let t in i)r[t]=this.parseTextSourceValue(i[t],e,n)}return r},parseTextSourceValue(e,t,n){let r;if(Array.isArray(e)){for(let i=0;i<e.length;i++)if("string"==typeof e[i]?r=t.properties[e[i]]:"function"==typeof e[i]&&(r=e[i](n)),r)return r}else"string"==typeof e?r=t.properties[e]:e instanceof Function&&(r=e(n));return r},async prepareTextLabels(e,t){if(0===Object.keys(this.texts[e.id]||{}).length)return[];try{const n=await a.postMessage(this.main_thread_target+".calcTextSizes",e.id,this.texts[e.id]);return e.canceled?(g("trace",`Style ${this.name}: stop tile build because tile was canceled: ${e.key}, post-calcTextSizes()`),[]):(this.texts[e.id]=n||[],n?this.buildTextLabels(e,t):(Wt.abortTile(e.id),[]))}catch(t){return Wt.abortTile(e.id),[]}},async collideAndRenderTextLabels(e,t,n){let r=await this.prepareTextLabels(e,n);if(0===r.length)return Wt.collide([],t,e.id),{};if(r=await Wt.collide(r,t,e.id),e.canceled)return g("trace",`stop tile build because tile was canceled: ${e.key}, post-collide()`),{};let o=this.texts[e.id];if(null==o||0===r.length)return{};this.cullTextStyles(o,r),r.forEach(e=>{let t=e.text_settings_key,n=o[t]&&o[t][e.text];n.text_settings.can_articulate?(n.type||(n.type=[]),-1===n.type.indexOf(e.label.type)&&n.type.push(e.label.type)):(n.align=n.align||{},n.align[e.label.align]={})});try{const t=await a.postMessage(this.main_thread_target+".rasterizeTexts",e.id,e.key,o);return e.canceled?(g("trace",`stop tile build because tile was canceled: ${e.key}, post-rasterizeTexts()`),{}):function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Sn(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Sn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({labels:r},t)}catch(e){return{}}},cullTextStyles(e,t){for(let n=0;n<t.length;n++){let r=t[n];e[r.text_settings_key][r.text].ref++}for(let t in e)for(let n in e[t])e[t][n].ref<1&&delete e[t][n];for(let t in e)0===Object.keys(e[t]).length&&delete e[t]},calcTextSizes(e,t){return this.canvas.textSizes(e,t)},async rasterizeTexts(e,t,n){let r=new En,i=Math.min(this.max_texture_size,2048),o=r.setTextureTextPositions(n,i),s=["labels",this.name,t,e,Tn,""].join("-");return Tn++,o=await r.rasterize(n,o,e,s,this.gl),o?{texts:n,textures:o}:{}},preprocessText(e){if(e&&e.font&&"object"==typeof e.font)return e.font.weight=Q.createPropertyCache(e.font.weight),e.font.fill=Q.createPropertyCache(e.font.fill||Jt.defaults.fill),e.font.alpha=Q.createPropertyCache(e.font.alpha),e.font.stroke&&(e.font.stroke.color=Q.createPropertyCache(e.font.stroke.color),e.font.stroke.alpha=Q.createPropertyCache(e.font.stroke.alpha)),e.font.background&&(e.font.background.color=Q.createPropertyCache(e.font.background.color),e.font.background.alpha=Q.createPropertyCache(e.font.background.alpha),e.font.background.width=Q.createPropertyCache(e.font.background.width,Q.parsePositiveNumber),e.font.background.stroke&&(e.font.background.stroke.color=Q.createPropertyCache(e.font.background.stroke.color),e.font.background.stroke.alpha=Q.createPropertyCache(e.font.background.stroke.alpha))),e.font.px_size=Q.createPropertyCache(e.font.size||Jt.defaults.size,En.fontPixelSize,En.fontPixelSize),e.font.stroke&&null!=e.font.stroke.width&&(e.font.stroke.width=Q.createPropertyCache(e.font.stroke.width,Q.parsePositiveNumber)),e.font.background&&e.font.background.stroke&&null!=e.font.background.stroke.width&&(e.font.background.stroke.width=Q.createPropertyCache(e.font.background.stroke.width,Q.parsePositiveNumber)),e.offset=Q.createPropertyCache(e.offset,e=>Array.isArray(e)&&e.map(Q.parseNumber)),e.buffer=Q.createPropertyCache(e.buffer,e=>(Array.isArray(e)?e:[e,e]).map(Q.parsePositiveNumber)),e.repeat_distance=Q.createPropertyCache(e.repeat_distance,Q.parsePositiveNumber),e},computeTextLayout(e,t,n,r,i,o,s,a,l){let u=e||{};return u=this.computeLayout(u,t,n,r,i),null==n.repeat_distance&&(u.repeat_distance="point"===r.geometry?0:U.tile_size,u.repeat_distance&&(u.repeat_distance*=u.units_per_pixel,u.repeat_scale=1,"function"==typeof n.repeat_group?u.repeat_group=n.repeat_group(r):u.repeat_group=n.repeat_group)),u.repeat_distance&&(a&&(u.repeat_group+="/"+a),u.repeat_group+="/"+o),u.subdiv=i.overzoom2,u.align=n.align,u.italic="normal"!==s.style,"right"===l?u.orientation=1:"left"===l&&(u.orientation=-1),u}};var On,An,Cn,Rn,Nn,Pn,Mn,Dn,In,zn,Fn,Ln,jn,$n,Bn,Vn,Un=P(An?On:(An=1,On=function(e,t){var n=t[0],r=t[1],i=t[2],o=t[3],s=t[4],a=t[5],l=t[6],u=t[7],c=t[8],d=t[9],h=t[10],p=t[11],f=t[12],m=t[13],g=t[14],y=t[15],b=n*a-r*s,v=n*l-i*s,_=n*u-o*s,x=r*l-i*a,w=r*u-o*a,E=i*u-o*l,S=c*m-d*f,T=c*g-h*f,k=c*y-p*f,O=d*g-h*m,A=d*y-p*m,C=h*y-p*g,R=b*C-v*A+_*O+x*k-w*T+E*S;return R?(R=1/R,e[0]=(a*C-l*A+u*O)*R,e[1]=(l*k-s*C-u*T)*R,e[2]=(s*A-a*k+u*S)*R,e[3]=(i*A-r*C-o*O)*R,e[4]=(n*C-i*k+o*T)*R,e[5]=(r*k-n*A-o*S)*R,e[6]=(m*E-g*w+y*x)*R,e[7]=(g*_-f*E-y*v)*R,e[8]=(f*w-m*_+y*b)*R,e):null})),Wn=P(Rn?Cn:(Rn=1,Cn=function(e,t){var n=t[0],r=t[1],i=t[2],o=t[3],s=t[4],a=t[5],l=t[6],u=t[7],c=t[8],d=c*s-a*u,h=-c*o+a*l,p=u*o-s*l,f=n*d+r*h+i*p;return f?(f=1/f,e[0]=d*f,e[1]=(-c*r+i*u)*f,e[2]=(a*r-i*s)*f,e[3]=h*f,e[4]=(c*n-i*l)*f,e[5]=(-a*n+i*o)*f,e[6]=p*f,e[7]=(-u*n+r*l)*f,e[8]=(s*n-r*o)*f,e):null})),qn=P(Pn?Nn:(Pn=1,Nn=function(e,t,n){var r=t[0],i=t[1],o=t[2],s=t[3],a=t[4],l=t[5],u=t[6],c=t[7],d=t[8],h=t[9],p=t[10],f=t[11],m=t[12],g=t[13],y=t[14],b=t[15],v=n[0],_=n[1],x=n[2],w=n[3];return e[0]=v*r+_*a+x*d+w*m,e[1]=v*i+_*l+x*h+w*g,e[2]=v*o+_*u+x*p+w*y,e[3]=v*s+_*c+x*f+w*b,v=n[4],_=n[5],x=n[6],w=n[7],e[4]=v*r+_*a+x*d+w*m,e[5]=v*i+_*l+x*h+w*g,e[6]=v*o+_*u+x*p+w*y,e[7]=v*s+_*c+x*f+w*b,v=n[8],_=n[9],x=n[10],w=n[11],e[8]=v*r+_*a+x*d+w*m,e[9]=v*i+_*l+x*h+w*g,e[10]=v*o+_*u+x*p+w*y,e[11]=v*s+_*c+x*f+w*b,v=n[12],_=n[13],x=n[14],w=n[15],e[12]=v*r+_*a+x*d+w*m,e[13]=v*i+_*l+x*h+w*g,e[14]=v*o+_*u+x*p+w*y,e[15]=v*s+_*c+x*f+w*b,e})),Gn=P(Dn?Mn:(Dn=1,Mn=function(e,t,n){var r,i,o,s,a,l,u,c,d,h,p,f,m=n[0],g=n[1],y=n[2];return t===e?(e[12]=t[0]*m+t[4]*g+t[8]*y+t[12],e[13]=t[1]*m+t[5]*g+t[9]*y+t[13],e[14]=t[2]*m+t[6]*g+t[10]*y+t[14],e[15]=t[3]*m+t[7]*g+t[11]*y+t[15]):(r=t[0],i=t[1],o=t[2],s=t[3],a=t[4],l=t[5],u=t[6],c=t[7],d=t[8],h=t[9],p=t[10],f=t[11],e[0]=r,e[1]=i,e[2]=o,e[3]=s,e[4]=a,e[5]=l,e[6]=u,e[7]=c,e[8]=d,e[9]=h,e[10]=p,e[11]=f,e[12]=r*m+a*g+d*y+t[12],e[13]=i*m+l*g+h*y+t[13],e[14]=o*m+u*g+p*y+t[14],e[15]=s*m+c*g+f*y+t[15]),e})),Hn=P(zn?In:(zn=1,In=function(e,t,n){var r=n[0],i=n[1],o=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e})),Yn=P(Ln?Fn:(Ln=1,Fn=function(e,t,n,r,i){var o=1/Math.tan(t/2),s=1/(r-i);return e[0]=o/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=(i+r)*s,e[11]=-1,e[12]=0,e[13]=0,e[14]=2*i*r*s,e[15]=0,e}));function Kn(){return $n?jn:($n=1,jn=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e})}var Xn,Zn,Jn=function(){if(Vn)return Bn;Vn=1;var e=Kn();return Bn=function(t,n,r,i){var o,s,a,l,u,c,d,h,p,f,m=n[0],g=n[1],y=n[2],b=i[0],v=i[1],_=i[2],x=r[0],w=r[1],E=r[2];return Math.abs(m-x)<1e-6&&Math.abs(g-w)<1e-6&&Math.abs(y-E)<1e-6?e(t):(d=m-x,h=g-w,p=y-E,o=v*(p*=f=1/Math.sqrt(d*d+h*h+p*p))-_*(h*=f),s=_*(d*=f)-b*p,a=b*h-v*d,(f=Math.sqrt(o*o+s*s+a*a))?(o*=f=1/f,s*=f,a*=f):(o=0,s=0,a=0),l=h*a-p*s,u=p*o-d*a,c=d*s-h*o,(f=Math.sqrt(l*l+u*u+c*c))?(l*=f=1/f,u*=f,c*=f):(l=0,u=0,c=0),t[0]=o,t[1]=l,t[2]=d,t[3]=0,t[4]=s,t[5]=u,t[6]=h,t[7]=0,t[8]=a,t[9]=c,t[10]=p,t[11]=0,t[12]=-(o*m+s*g+a*y),t[13]=-(l*m+u*g+c*y),t[14]=-(d*m+h*g+p*y),t[15]=1,t)}}(),Qn=P(Jn),er=P(Kn()),tr=P(Zn?Xn:(Zn=1,Xn=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}));const nr={fromValues(e,t,n){var r=new Float64Array(3);return r[0]=e,r[1]=t,r[2]=n,r}},rr={normalFromMat4:Un,invert:Wn},ir={multiply:qn,translate:Gn,scale:Hn,perspective:Yn,lookAt:Qn,identity:er,copy:tr};class or{constructor(e,t,n={}){this.view=t,this.position=n.position,this.zoom=n.zoom}static create(e,t,n){switch(n.type){case"isometric":return new ar(e,t,n);case"flat":return new lr(e,t,n);default:return new sr(e,t,n)}}update(){}setupProgram(){}updateView(){if(this.position||this.zoom){var e={};this.position&&(e={lng:this.position[0],lat:this.position[1],zoom:this.position[2]}),this.zoom&&(e.zoom=this.zoom),this.view.setView(e)}}setupMatrices(e,t){ir.multiply(e.model_view32,this.view_matrix,e.model),t.uniform("Matrix4fv","u_modelView",e.model_view32),rr.normalFromMat4(e.normal32,e.model_view32),rr.invert(e.inverse_normal32,e.normal32),t.uniform("Matrix3fv","u_normalMatrix",e.normal32),t.uniform("Matrix3fv","u_inverseNormalMatrix",e.inverse_normal32)}}class sr extends or{constructor(e,t,n={}){super(e,t,n),this.type="perspective",this.focal_length=n.focal_length,this.fov=n.fov,this.focal_length||this.fov||(this.focal_length=[[16,2],[17,2.5],[18,3],[19,4],[20,6]]),this.vanishing_point=n.vanishing_point||[0,0],this.vanishing_point=this.vanishing_point.map(parseFloat),this.vanishing_point_skew=[],this.position_meters=null,this.view_matrix=new Float64Array(16),this.projection_matrix=new Float32Array(16),j.replaceBlock("camera","\n uniform mat4 u_projection;\n uniform vec3 u_eye;\n uniform vec2 u_vanishing_point;\n\n void cameraProjection (inout vec4 position) {\n position = u_projection * position;\n }")}constrainCamera({view_height:e,height:t,focal_length:n,fov:r}){return t?(n=2*t/e,r=2*Math.atan(1/n)):(n?r=2*Math.atan(1/n):r&&(r=r*Math.PI/180,n=1/Math.tan(r/2)),t=e/2*n),{view_height:e,height:t,focal_length:n,fov:r}}updateMatrices(){var e=this.view.size.css.height*this.view.meters_per_pixel,{height:t,fov:n}=this.constrainCamera({view_height:e,focal_length:y.interpolate(this.view.zoom,this.focal_length),fov:y.interpolate(this.view.zoom,this.fov)}),r=[this.view.center.meters.x,this.view.center.meters.y,t];this.position_meters=r,ir.lookAt(this.view_matrix,nr.fromValues(r[0],r[1],0),nr.fromValues(r[0],r[1],-1),nr.fromValues(0,1,0)),ir.perspective(this.projection_matrix,n,this.view.aspect,1,2*t),this.vanishing_point_skew[0]=this.vanishing_point[0]/this.view.size.css.width,this.vanishing_point_skew[1]=this.vanishing_point[1]/this.view.size.css.height,this.projection_matrix[8]=2*-this.vanishing_point_skew[0],this.projection_matrix[9]=2*-this.vanishing_point_skew[1],ir.translate(this.projection_matrix,this.projection_matrix,nr.fromValues(e/2*this.view.aspect*(2*-this.vanishing_point_skew[0]),e/2*(2*-this.vanishing_point_skew[1]),0)),ir.translate(this.projection_matrix,this.projection_matrix,nr.fromValues(0,0,-t))}update(){super.update(),this.updateMatrices()}setupProgram(e){e.uniform("Matrix4fv","u_projection",this.projection_matrix),e.uniform("3f","u_eye",[0,0,this.position_meters[2]]),e.uniform("2fv","u_vanishing_point",this.vanishing_point_skew)}}class ar extends or{constructor(e,t,n={}){super(e,t,n),this.type="isometric",this.axis=n.axis||{x:0,y:1},2===this.axis.length&&(this.axis={x:this.axis[0],y:this.axis[1]}),this.position_meters=null,this.viewport_height=null,this.view_matrix=new Float64Array(16),this.projection_matrix=new Float32Array(16),j.replaceBlock("camera","\n uniform mat4 u_projection;\n uniform vec3 u_eye;\n uniform vec2 u_vanishing_point;\n\n void cameraProjection (inout vec4 position) {\n position = u_projection * position;\n // position.xy += position.z * u_isometric_axis;\n\n // Reverse z for depth buffer so up is negative,\n // and scale down values so objects higher than one screen height will not get clipped\n // pull forward slightly to avoid going past far clipping plane\n position.z = -position.z / 100. + 1. - 0.001;\n }")}update(){super.update(),this.viewport_height=this.view.size.css.height*this.view.meters_per_pixel;var e=[this.view.center.meters.x,this.view.center.meters.y,this.viewport_height];this.position_meters=e,ir.identity(this.view_matrix),ir.translate(this.view_matrix,this.view_matrix,nr.fromValues(-e[0],-e[1],0)),ir.identity(this.projection_matrix),this.projection_matrix[8]=this.axis.x/this.view.aspect,this.projection_matrix[9]=this.axis.y,ir.scale(this.projection_matrix,this.projection_matrix,nr.fromValues(2/this.view.size.meters.x,2/this.view.size.meters.y,2/this.view.size.meters.y))}setupProgram(e){e.uniform("Matrix4fv","u_projection",this.projection_matrix),e.uniform("3fv","u_eye",[0,0,this.viewport_height]),e.uniform("2fv","u_vanishing_point",[0,0])}}class lr extends ar{constructor(e,t,n={}){super(e,t,n),this.type="flat"}update(){this.axis.x=0,this.axis.y=0,super.update()}}const ur=qt.PLACEMENT,cr=Object.create(Ne),dr="__shader_point";Object.assign(cr,kn),Object.assign(cr,{name:"points",built_in:!0,vertex_shader_src:"uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_tile_proxy_order_offset;\nuniform bool u_tile_fade_in;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\nuniform float u_visible_time;\nuniform bool u_view_panning;\nuniform float u_view_pan_snap_timer;\n\nuniform mat4 u_model;\nuniform mat4 u_modelView;\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nattribute vec4 a_position;\nattribute vec4 a_shape;\nattribute vec4 a_color;\nattribute vec2 a_texcoord;\nattribute vec2 a_offset;\n\nuniform float u_point_type;\n\n#ifdef TANGRAM_CURVED_LABEL\n attribute vec4 a_offsets;\n attribute vec4 a_pre_angles;\n attribute vec4 a_angles;\n#endif\n\nvarying vec4 v_color;\nvarying vec2 v_texcoord;\nvarying vec4 v_world_position;\nvarying float v_alpha_factor;\n\n#ifdef TANGRAM_HAS_SHADER_POINTS\n attribute float a_outline_edge;\n attribute vec4 a_outline_color;\n\n varying float v_outline_edge;\n varying vec4 v_outline_color;\n varying float v_aa_offset;\n#endif\n\n#ifdef TANGRAM_SHOW_HIDDEN_LABELS\n varying float v_label_hidden;\n#endif\n\n#define TANGRAM_PI 3.14159265359\n#define TANGRAM_NORMAL vec3(0., 0., 1.)\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\nvec2 rotate2D(vec2 _st, float _angle) {\n return mat2(cos(_angle),-sin(_angle),\n sin(_angle),cos(_angle)) * _st;\n}\n\n#ifdef TANGRAM_CURVED_LABEL\n // Assumes stops are [0, 0.33, 0.66, 0.99];\n float mix4linear(vec4 v, float x) {\n x = clamp(x, 0., 1.);\n return mix(mix(v[0], v[1], 3. * x),\n mix(v[1],\n mix(v[2], v[3], 3. * (max(x, .66) - .66)),\n 3. * (clamp(x, .33, .66) - .33)),\n step(0.33, x)\n );\n }\n#endif\n\nvoid main() {\n // Initialize globals\n #pragma tangram: setup\n\n // discard hidden labels by collapsing into degenerate triangle\n #ifndef TANGRAM_SHOW_HIDDEN_LABELS\n if (a_shape.w == 0.) {\n gl_Position = vec4(0., 0., 0., 1.);\n return;\n }\n #else\n // highlight hidden label in fragment shader for debugging\n if (a_shape.w == 0.) {\n v_label_hidden = 1.; // label debug testing\n }\n else {\n v_label_hidden = 0.;\n }\n #endif\n\n v_alpha_factor = 1.0;\n v_color = a_color;\n v_texcoord = a_texcoord; // UV from vertex attribute\n\n #ifdef TANGRAM_HAS_SHADER_POINTS\n v_outline_color = a_outline_color;\n v_outline_edge = a_outline_edge;\n\n if (u_point_type == TANGRAM_POINT_TYPE_SHADER) { // shader point\n // use point dimensions for UVs instead (ignore attribute), add antialiasing info for fragment shader\n float _size = abs(a_shape.x / 128.); // radius in pixels\n v_texcoord = sign(a_shape.xy) * (_size + 1.) / _size;\n _size += 2.;\n v_aa_offset = 2. / _size;\n }\n #endif\n\n // Position\n vec4 position = u_modelView * vec4(a_position.xyz, 1.);\n\n // Apply positioning and scaling in screen space\n vec2 _shape = a_shape.xy / 256.; // values have an 8-bit fraction\n vec2 _offset = vec2(a_offset.x, -a_offset.y); // flip y to make it point down\n float _theta = a_shape.z / 4096.;\n\n #ifdef TANGRAM_CURVED_LABEL\n //TODO: potential bug? null is passed in for non-curved labels, otherwise the first offset will be 0\n if (a_offsets[0] != 0.){\n vec4 _angles_scaled = (TANGRAM_PI / 16384.) * a_angles;\n vec4 _pre_angles_scaled = (TANGRAM_PI / 128.) * a_pre_angles;\n vec4 _offsets_scaled = (1. / 64.) * a_offsets;\n\n float _zoom = clamp(u_map_position.z - u_tile_origin.z, 0., 1.); //fract(u_map_position.z);\n float _pre_angle = mix4linear(_pre_angles_scaled, _zoom);\n float _angle = mix4linear(_angles_scaled, _zoom);\n float _offset_curve = mix4linear(_offsets_scaled, _zoom);\n\n _shape = rotate2D(_shape, _pre_angle); // rotate in place\n _shape.x += _offset_curve; // offset for curved label segment\n _shape = rotate2D(_shape, _angle); // rotate relative to curved label anchor\n _shape += rotate2D(_offset, _theta); // offset if specified in the scene file\n }\n else {\n _shape = rotate2D(_shape + _offset, _theta);\n }\n #else\n _shape = rotate2D(_shape + _offset, _theta);\n #endif\n\n // Fade in (if requested) based on time mesh has been visible.\n // Value passed to fragment shader in the v_alpha_factor varying\n #ifdef TANGRAM_FADE_IN_RATE\n if (u_tile_fade_in) {\n v_alpha_factor *= clamp(u_visible_time * TANGRAM_FADE_IN_RATE, 0., 1.);\n }\n #endif\n\n // World coordinates for 3d procedural textures\n v_world_position = u_model * position;\n v_world_position.xy += _shape * u_meters_per_pixel;\n v_world_position = wrapWorldPosition(v_world_position);\n\n // Modify position before camera projection\n #pragma tangram: position\n\n cameraProjection(position);\n\n #ifdef TANGRAM_LAYER_ORDER\n // +1 is to keep all layers including proxies > 0\n applyLayerOrder(a_position.w + u_tile_proxy_order_offset + 1., position);\n #endif\n\n // Apply pixel offset in screen-space\n // Multiply by 2 is because screen is 2 units wide Normalized Device Coords (and u_resolution device pixels wide)\n // Device pixel ratio adjustment is because shape is in logical pixels\n position.xy += _shape * position.w * 2. * u_device_pixel_ratio / u_resolution;\n #ifdef TANGRAM_HAS_SHADER_POINTS\n if (u_point_type == TANGRAM_POINT_TYPE_SHADER) { // shader point\n // enlarge by 1px to catch missed MSAA fragments\n position.xy += sign(_shape) * position.w * u_device_pixel_ratio / u_resolution;\n }\n #endif\n\n // Snap to pixel grid\n // Only applied to fully upright sprites/labels (not shader-drawn points), while panning is not active\n #ifdef TANGRAM_HAS_SHADER_POINTS\n if (!u_view_panning && (abs(_theta) < TANGRAM_EPSILON) && u_point_type != TANGRAM_POINT_TYPE_SHADER) {\n #else\n if (!u_view_panning && (abs(_theta) < TANGRAM_EPSILON)) {\n #endif\n vec2 _position_fract = fract((((position.xy / position.w) + 1.) * .5) * u_resolution);\n vec2 _position_snap = position.xy + ((step(0.5, _position_fract) - _position_fract) * position.w * 2. / u_resolution);\n\n // Animate the snapping to smooth the transition and make it less noticeable\n #ifdef TANGRAM_VIEW_PAN_SNAP_RATE\n position.xy = mix(position.xy, _position_snap, clamp(u_view_pan_snap_timer * TANGRAM_VIEW_PAN_SNAP_RATE, 0., 1.));\n #else\n position.xy = _position_snap;\n #endif\n }\n\n gl_Position = position;\n}\n",fragment_shader_src:"uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\nuniform float u_visible_time;\n\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nuniform sampler2D u_texture;\nuniform float u_point_type;\nuniform bool u_apply_color_blocks;\n\nvarying vec4 v_color;\nvarying vec2 v_texcoord;\nvarying vec4 v_world_position;\nvarying float v_alpha_factor;\n\n#ifdef TANGRAM_HAS_SHADER_POINTS\n varying vec4 v_outline_color;\n varying float v_outline_edge;\n varying float v_aa_offset;\n#endif\n\n#ifdef TANGRAM_SHOW_HIDDEN_LABELS\n varying float v_label_hidden;\n#endif\n\n#define TANGRAM_NORMAL vec3(0., 0., 1.)\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\n#ifdef TANGRAM_HAS_SHADER_POINTS\n //l is the distance from the center to the fragment, R is the radius of the drawn point\n float _tangram_antialias(float l, float R){\n float low = R - v_aa_offset;\n float high = R + v_aa_offset;\n return 1. - smoothstep(low, high, l);\n }\n#endif\n\nvoid main (void) {\n // Initialize globals\n #pragma tangram: setup\n\n vec4 color = v_color;\n\n #ifdef TANGRAM_HAS_SHADER_POINTS\n // Only apply shader blocks to point, not to attached text (N.B.: for compatibility with ES)\n if (u_point_type == TANGRAM_POINT_TYPE_TEXTURE) { // sprite texture\n color *= texture2D(u_texture, v_texcoord);\n }\n else if (u_point_type == TANGRAM_POINT_TYPE_LABEL) { // label texture\n color = texture2D(u_texture, v_texcoord);\n color.rgb /= max(color.a, 0.001); // un-multiply canvas texture\n }\n else if (u_point_type == TANGRAM_POINT_TYPE_SHADER) { // shader point\n // Mask of outermost circle, either outline or point boundary\n float _d = length(v_texcoord); // distance to this fragment from the point center\n float _outer_alpha = _tangram_antialias(_d, 1.);\n float _fill_alpha = _tangram_antialias(_d, 1. - (v_outline_edge * 0.5)) * color.a;\n float _stroke_alpha = (_outer_alpha - _tangram_antialias(_d, 1. - v_outline_edge)) * v_outline_color.a;\n\n // Apply alpha compositing with stroke 'over' fill.\n #ifdef TANGRAM_BLEND_ADD\n color.a = _stroke_alpha + _fill_alpha;\n color.rgb = color.rgb * _fill_alpha + v_outline_color.rgb * _stroke_alpha;\n #else // TANGRAM_BLEND_OVERLAY (and fallback for not implemented blending modes)\n color.a = _stroke_alpha + _fill_alpha * (1. - _stroke_alpha);\n color.rgb = mix(color.rgb * _fill_alpha, v_outline_color.rgb, _stroke_alpha) / max(color.a, 0.001); // avoid divide by zero\n #endif\n }\n #else\n // If shader points not supported, assume label texture\n color = texture2D(u_texture, v_texcoord);\n color.rgb /= max(color.a, 0.001); // un-multiply canvas texture\n #endif\n\n // Shader blocks for color/filter are only applied for sprites, shader points, and standalone text,\n // NOT for text attached to a point (N.B.: for compatibility with ES)\n if (u_apply_color_blocks) {\n #pragma tangram: color\n #pragma tangram: filter\n }\n\n color.a *= v_alpha_factor;\n\n // highlight hidden label in fragment shader for debugging\n #ifdef TANGRAM_SHOW_HIDDEN_LABELS\n if (v_label_hidden > 0.) {\n color.a *= 0.5;\n color.rgb = vec3(1., 0., 0.);\n }\n #endif\n\n // Use alpha test as a lower-quality substitute\n // For opaque and translucent: avoid transparent pixels writing to depth buffer, obscuring geometry underneath\n // For multiply: avoid transparent pixels multiplying geometry underneath to zero/full black\n #if defined(TANGRAM_BLEND_OPAQUE) || defined(TANGRAM_BLEND_TRANSLUCENT) || defined(TANGRAM_BLEND_MULTIPLY)\n if (color.a < TANGRAM_ALPHA_TEST) {\n discard;\n }\n #endif\n\n // Make points more visible in wireframe debug mode\n #ifdef TANGRAM_WIREFRAME\n color = vec4(vec3(0.5), 1.); // use gray outline for textured points\n #ifdef TANGRAM_HAS_SHADER_POINTS\n if (u_point_type == TANGRAM_POINT_TYPE_SHADER) {\n color = vec4(v_color.rgb, 1.); // use original vertex color outline for shader points\n }\n #endif\n #endif\n\n gl_FragColor = color;\n}\n",selection:!0,collision:!0,blend:"overlay",init(e={}){Ne.init.call(this,e),this.setupDefines(),this.defines.TANGRAM_HAS_SHADER_POINTS=!0,this.defines.TANGRAM_POINT_TYPE_TEXTURE=1,this.defines.TANGRAM_POINT_TYPE_LABEL=2,this.defines.TANGRAM_POINT_TYPE_SHADER=3,this.collision_group_points=this.name+"-points",this.collision_group_text=this.name+"-text",this.stencil_proxy_tiles=!1,this.reset()},setupDefines(){"overlay"!==this.blend&&(this.defines.TANGRAM_LAYER_ORDER=!0),!0===v.suppress_label_fade_in?(this.fade_in_time=0,this.defines.TANGRAM_FADE_IN_RATE=null):(this.fade_in_time=.15,this.defines.TANGRAM_FADE_IN_RATE=1/this.fade_in_time),!0!==v.suppress_label_snap_animation&&(this.defines.TANGRAM_VIEW_PAN_SNAP_RATE=2),!0===v.show_hidden_labels&&(this.defines.TANGRAM_SHOW_HIDDEN_LABELS=!0),!0===v.wireframe&&(this.defines.TANGRAM_WIREFRAME=!0)},reset(){this.queues={},this.resetText(),this.texture_missing_sprites={}},addFeature(e,t,n){let r=n.tile;if(r.generation!==this.generation)return;let i,o={};if(o.color=this.parseColor(t.color,n),o.texture=t.texture,o.label_texture=null,o.blend_order=t.blend_order,!o.color&&!o.texture)return;if(o.alpha=Q.evalCachedProperty(t.alpha,n),this.hasSprites(o)){if(i=this.parseSprite(o,t,n),!i)return void g({level:"debug",once:!0},`Layer group '${t.layers.join(", ")}' uses a texture '${o.texture}', but doesn't specify which sprite to draw. Features that match this layer group won't be drawn without specifying the sprite with the 'sprite' or 'sprite_default' properties. The merged draw parameters for this layer group are:`,t).then(n=>{n&&g("debug",`Example feature for layer group '${t.layers.join(", ")}'`,e)});o.texcoords=i.texcoords}else if(t.sprite)return void g({level:"warn",once:!0},`Layer group '${t.layers.join(", ")}' specifies sprite '${t.sprite}', but the texture '${t.texture}' doesn't define any sprites. Features that match this layer group won't be drawn. The merged draw parameters for this layer group are:`,t);if(this.calcSize(t,o,i,n),t.outline&&(o.outline_width=Q.evalCachedProperty(t.outline.width,n)||Q.defaults.outline.width,o.outline_color=this.parseColor(t.outline.color,n)),o.outline_edge_pct=0,o.outline_width&&o.outline_color){let e=o.outline_width;o.size[0]+=e,o.size[1]+=e,o.outline_edge_pct=e/Math.min(o.size[0],o.size[1])*2,o.outline_alpha=Q.evalCachedProperty(t.outline.alpha,n)}o.size[0]=Math.min(o.size[0],256),o.size[1]=Math.min(o.size[1],256),o.placement=t.placement,o.placement_min_length_ratio=Q.evalCachedProperty(t.placement_min_length_ratio,n),o.placement===ur.SPACED&&t.placement_spacing&&(o.placement_spacing=Q.evalCachedProperty(t.placement_spacing,n)),o.angle=Q.evalProperty(t.angle,n)||0,o.z=Q.evalCachedDistanceProperty(t.z,n)||Q.defaults.z,o.tile_edges=t.tile_edges,this.computeLayout(o,e,t,n,r);let s=t.text&&!1!==t.text.visible&&this.parseTextFeature(e,t.text,n,r);Array.isArray(s)&&(s=null,g({level:"warn",once:!0},`Layer group '${t.layers.join(", ")}': cannot use boundary labels (e.g. 'text_source: { left: ..., right: ... }') for 'text' labels attached to 'points'; provided 'text_source' value was ${JSON.stringify(t.text.text_source)}`)),s&&(s.layout.parent=o,s.layout.priority=t.text.priority?Math.max(s.layout.priority,o.priority+.5):o.priority+.5,Wt.addStyle(this.collision_group_text,r.id)),this.queueFeature({feature:e,draw:t,context:n,style:o,text_feature:s},r),Wt.addStyle(this.collision_group_points,r.id)},calcSize(e,t,n,r){if(t.size=e.size,t.size){if(t.size=Q.evalCachedPointSizeProperty(e.size,n,O.textures[t.texture],r),null==t.size)return void g({level:"warn",once:!0},`Layer group '${e.layers.join(", ")}': 'size' (${JSON.stringify(e.size.value)}) couldn't be interpreted, features that match this layer group won't be drawn`);"number"==typeof t.size&&(t.size=[t.size,t.size])}else t.size=n&&n.css_size||[16,16]},hasSprites:e=>e.texture&&O.textures[e.texture]&&O.textures[e.texture].sprites,getSpriteInfo(e,t){let n=O.textures[e.texture].sprites[t]&&O.getSpriteInfo(e.texture,t);return t&&!n?(this.texture_missing_sprites[e.texture]=this.texture_missing_sprites[e.texture]||{},this.texture_missing_sprites[e.texture][t]||(g("debug",`Style: in style '${this.name}', could not find sprite '${t}' for texture '${e.texture}'`),this.texture_missing_sprites[e.texture][t]=!0)):n&&(n.sprite=t),n},parseSprite(e,t,n){let r=Q.evalProperty(t.sprite,n);return this.getSpriteInfo(e,r)||this.getSpriteInfo(e,t.sprite_default)},queueFeature(e,t){this.tile_data[t.id]&&this.queues[t.id]||this.startData(t),this.queues[t.id]=this.queues[t.id]||[],this.queues[t.id].push(e)},async endData(e){if(e.canceled)return g("trace",`Style ${this.name}: stop tile build because tile was canceled: ${e.key}`),null;let t=this.queues[e.id];delete this.queues[e.id];let n=[],r=[];t.forEach(e=>{let t=e.style,i=e.feature,o=i.geometry,s=this.buildLabels(t.size,o,t);for(let o=0;o<s.length;o++){let a=s[o],l={feature:i,draw:e.draw,context:e.context,style:t,label:a};if(r.push(l),e.text_feature){let t={feature:i,draw:e.text_feature.draw,context:e.context,text:e.text_feature.text,text_settings_key:e.text_feature.text_settings_key,layout:e.text_feature.layout,point_label:a,linked:l};n.push(t),e.draw.text.optional||(l.linked=t)}}});const[,{labels:i,texts:o,textures:s}]=await Promise.all([Wt.collide(r,this.collision_group_points,e.id).then(e=>{e.forEach(e=>{this.feature_style=e.style,this.feature_style.label=e.label,this.feature_style.linked=e.linked,Ne.addFeature.call(this,e.feature,e.draw,e.context)})}),this.collideAndRenderTextLabels(e,this.collision_group_text,n)]);i&&o&&i.forEach(e=>{let t=e.text_settings_key,n=o[t]&&o[t][e.text],r=this.feature_style;r.label=e.label,r.linked=e.linked,r.size=n.size.logical_size,r.texcoords=n.align[e.label.align].texcoords,r.label_texture=s[n.align[e.label.align].texture_id],r.blend_order=e.draw.blend_order,Ne.addFeature.call(this,e.feature,e.draw,e.context)}),this.freeText(e);const a=await Ne.endData.call(this,e);return a&&s&&s.length&&(a.textures=a.textures||[],a.textures.push(...s)),a},_preprocess(e){e.color=Q.createColorPropertyCache(e.color),e.alpha=Q.createPropertyCache(e.alpha),e.texture=void 0!==e.texture?e.texture:this.texture,e.blend_order=this.getBlendOrderForDraw(e),e.outline&&(e.outline.color=Q.createColorPropertyCache(e.outline.color),e.outline.alpha=Q.createPropertyCache(e.outline.alpha),e.outline.width=Q.createPropertyCache(e.outline.width,Q.parsePositiveNumber)),e.z=Q.createPropertyCache(e.z,Q.parseUnits);try{e.size=Q.createPointSizePropertyCache(e.size,e.texture)}catch(t){return g({level:"warn",once:!0},`Layer group '${e.layers.join(", ")}': ${t} (${JSON.stringify(e.size)}), features that match this layer group won't be drawn.`),null}if(e.offset=Q.createPropertyCache(e.offset,e=>Array.isArray(e)&&e.map(Q.parseNumber)),e.buffer=Q.createPropertyCache(e.buffer,e=>(Array.isArray(e)?e:[e,e]).map(Q.parsePositiveNumber)),e.repeat_distance=Q.createPropertyCache(e.repeat_distance,Q.parseNumber),e.placement=ur[e.placement&&e.placement.toUpperCase()],null==e.placement&&(e.placement=ur.VERTEX),e.placement_spacing=null!=e.placement_spacing?e.placement_spacing:80,e.placement_spacing=Q.createPropertyCache(e.placement_spacing,Q.parsePositiveNumber),e.placement_min_length_ratio=null!=e.placement_min_length_ratio?e.placement_min_length_ratio:1,e.placement_min_length_ratio=Q.createPropertyCache(e.placement_min_length_ratio,Q.parsePositiveNumber),"number"==typeof e.angle)e.angle=e.angle*Math.PI/180;else if("function"==typeof e.angle){const t=e.angle;e.angle=e=>t(e)*Math.PI/180}else e.angle=e.angle||0;return e.text=this.preprocessText(e.text),e.text&&(e.text.key=e.key,e.text.group=e.group,e.text.layers=e.layers,e.text.order=e.order,e.text.blend_order=e.blend_order,e.text.repeat_group=null!=e.text.repeat_group?e.text.repeat_group:e.repeat_group,e.text.anchor=e.text.anchor||this.default_anchor,e.text.optional="boolean"==typeof e.text.optional&&e.text.optional,e.text.interactive=e.text.interactive||e.interactive),e},default_anchor:["bottom","top","right","left"],computeLayout(e,t,n,r,i){let o=e||{};o.id=t,o.units_per_pixel=i.units_per_pixel||1,o.collide=!1!==n.collide,o.anchor=n.anchor,o.offset=Q.evalCachedProperty(n.offset,r)||Q.zeroPair,o.buffer=Q.evalCachedProperty(n.buffer,r)||Q.zeroPair,o.repeat_distance=Q.evalCachedProperty(n.repeat_distance,r),o.repeat_distance&&(o.repeat_distance*=o.units_per_pixel,o.repeat_scale=1,"function"==typeof n.repeat_group?o.repeat_group=n.repeat_group(r):o.repeat_group=n.repeat_group||r.layer);let s=n.priority;return null!=s?"function"==typeof s&&(s=s(r)):s=-1>>>0,o.priority=s,o},buildTextLabels(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],o=this.texts[e.id][i.text_settings_key][i.text].size.collision_size;i.label=new qt(i.point_label.position,o,i.layout),n.push(i)}return n},buildLabels(e,t,n){let r=[];if("Point"===t.type)r.push(new qt(t.coordinates,e,n,n.angle));else if("MultiPoint"===t.type){let i=t.coordinates;for(let t=0;t<i.length;++t){let o=i[t];r.push(new qt(o,e,n,n.angle))}}else if("LineString"===t.type){let i=Ht(t.coordinates,e,n);for(let e=0;e<i.length;++e)r.push(i[e])}else if("MultiLineString"===t.type){let i=t.coordinates;for(let t=0;t<i.length;t++){let o=Ht(i[t],e,n);for(let e=0;e<o.length;++e)r.push(o[e])}}else if("Polygon"===t.type)if(n.placement===ur.CENTROID){let i=U.centroid(t.coordinates);i&&r.push(new qt(i,e,n,n.angle))}else{let i=t.coordinates;for(let t=0;t<i.length;t++){let o=Ht(i[t],e,n);for(let e=0;e<o.length;++e)r.push(o[e])}}else if("MultiPolygon"===t.type)if(n.placement===ur.CENTROID){let i=U.multiCentroid(t.coordinates);i&&r.push(new qt(i,e,n,n.angle))}else{let i=t.coordinates;for(let t=0;t<i.length;t++){let o=i[t];for(let t=0;t<o.length;t++){let i=Ht(o[t],e,n);for(let e=0;e<i.length;++e)r.push(i[e])}}}return r},makeVertexTemplate(e,t,n=!0){let r=0;this.vertex_template[r++]=0,this.vertex_template[r++]=0,this.vertex_template[r++]=e.z||0,this.vertex_template[r++]=this.scaleOrder(e.order),this.vertex_template[r++]=0,this.vertex_template[r++]=0,this.vertex_template[r++]=0,this.vertex_template[r++]=e.label.layout.collide?0:1,t.variant.shader_point||(this.vertex_template[r++]=0,this.vertex_template[r++]=0),this.vertex_template[r++]=0,this.vertex_template[r++]=0;const i=e.color||Q.defaults.color;if(this.vertex_template[r++]=255*i[0],this.vertex_template[r++]=255*i[1],this.vertex_template[r++]=255*i[2],this.vertex_template[r++]=255*(null!=e.alpha?e.alpha:i[3]),t.variant.selection&&(this.vertex_template[r++]=255*e.selection_color[0],this.vertex_template[r++]=255*e.selection_color[1],this.vertex_template[r++]=255*e.selection_color[2],this.vertex_template[r++]=255*e.selection_color[3]),t.variant.shader_point){const t=e.outline_color||Q.defaults.outline.color;this.vertex_template[r++]=255*t[0],this.vertex_template[r++]=255*t[1],this.vertex_template[r++]=255*t[2],this.vertex_template[r++]=255*(null!=e.outline_alpha?e.outline_alpha:t[3]),this.vertex_template[r++]=e.outline_edge_pct||Q.defaults.outline.width}return n&&this.addCustomAttributesToVertexTemplate(e,r),this.vertex_template},buildQuad:(e,t,n,r,i,o,s,a,l,u,c)=>t[0]<=0||t[1]<=0?0:function(e,t,n,r,i,o,s,a,l,u,c,d){const h=128*i[0],p=128*i[1];Tt[0]=-h,Tt[1]=-p,Tt[2]=h,Tt[3]=p;const f=c||$e,m=t.vertex_elements;let g=t.vertex_count;for(let i=0;i<4;i++)n[r.a_position+0]=e[0],n[r.a_position+1]=e[1],n[r.a_shape+0]=Tt[Et[i]],n[r.a_shape+1]=Tt[St[i]],n[r.a_shape+2]=l,n[r.a_offset+0]=o[0],n[r.a_offset+1]=o[1],r.a_texcoord&&(n[r.a_texcoord+0]=65535*f[Et[i]],n[r.a_texcoord+1]=65535*f[St[i]]),d&&(n[r.a_pre_angles+0]=xt*a[0],n[r.a_pre_angles+1]=xt*a[1],n[r.a_pre_angles+2]=xt*a[2],n[r.a_pre_angles+3]=xt*a[3],n[r.a_angles+0]=wt*u[0],n[r.a_angles+1]=wt*u[1],n[r.a_angles+2]=wt*u[2],n[r.a_angles+3]=wt*u[3],n[r.a_offsets+0]=64*s[0],n[r.a_offsets+1]=64*s[1],n[r.a_offsets+2]=64*s[2],n[r.a_offsets+3]=64*s[3]),t.addVertex(n);return m.push(g+0),m.push(g+1),m.push(g+2),m.push(g+2),m.push(g+3),m.push(g+0),2}(e,u,c,u.vertex_layout.index,t,o,s,i,4096*n,r,a,l),build(e,t){let n=e.label;return"curved"===n.type?this.buildCurvedLabel(n,e,t):this.buildStraightLabel(n,e,t)},buildStraightLabel(e,t,n){let r,i,o=this.getTileMesh(n.tile,this.meshVariantTypeForDraw(t)),s=this.makeVertexTemplate(t,o);"point"!==e.type?(r=t.size[e.type],i=t.texcoords[e.type].texcoord):(r=t.size,i=t.texcoords),o.uniforms=o.uniforms||{},t.label_texture?(o.uniforms.u_texture=t.label_texture,o.uniforms.u_point_type=2,o.uniforms.u_apply_color_blocks=!1):t.texture?(o.uniforms.u_texture=t.texture,o.uniforms.u_point_type=1,o.uniforms.u_apply_color_blocks=!0):(o.uniforms.u_texture=O.default,o.uniforms.u_point_type=3,o.uniforms.u_apply_color_blocks=!0);let a=e.offset,l=this.buildQuad(e.position,r,e.angle,null,null,a,null,i,!1,o.vertex_data,s);const u=t.linked&&t.linked.label.id;return this.trackLabel(e,u,o,l,n),l},buildCurvedLabel(e,t,n){let r,i,o=0;for(let s=0;s<e.num_segments;s++){let a=t.size[e.type][s],l=t.texcoords_stroke[s];t.label_texture=t.label_textures[s],r=this.getTileMesh(n.tile,this.meshVariantTypeForDraw(t)),i=this.makeVertexTemplate(t,r),r.uniforms=r.uniforms||{},r.uniforms.u_texture=t.label_texture,r.uniforms.u_point_type=2,r.uniforms.u_apply_color_blocks=!1;let u=e.offset||[0,0],c=e.position,d=e.angles[s],h=e.offsets[s],p=e.pre_angles[s],f=this.buildQuad(c,a,e.angle,d,p,u,h,l,!0,r.vertex_data,i);o+=f;const m=t.linked&&t.linked.label.id;this.trackLabel(e,m,r,f,n)}for(let s=0;s<e.num_segments;s++){let a=t.size[e.type][s],l=t.texcoords[e.type][s].texcoord;t.label_texture=t.label_textures[s],r=this.getTileMesh(n.tile,this.meshVariantTypeForDraw(t)),i=this.makeVertexTemplate(t,r),r.uniforms=r.uniforms||{},r.uniforms.u_texture=t.label_texture,r.uniforms.u_point_type=2,r.uniforms.u_apply_color_blocks=!1;let u=e.offset||[0,0],c=e.position,d=e.angles[s],h=e.offsets[s],p=e.pre_angles[s],f=this.buildQuad(c,a,e.angle,d,p,u,h,l,!0,r.vertex_data,i);o+=f;const m=t.linked&&t.linked.label.id;this.trackLabel(e,m,r,f,n)}return o},trackLabel(e,t,n,r){if(e.layout.collide||e.may_repeat_across_tiles){n.labels=n.labels||{},n.labels[e.id]=n.labels[e.id]||{container:{label:e.toJSON(),linked:t},ranges:[]};const i=2*r,o=n.vertex_data.offset-n.vertex_data.stride*i;n.labels[e.id].ranges.push([o,i])}},buildLines(e,t,n){return this.build(t,n)},buildPoints(e,t,n){return this.build(t,n)},buildPolygons(e,t,n){return this.build(t,n)},vertexLayoutForMeshVariant(e){if(null==this.vertex_layouts[e.shader_point]){const t=[{name:"a_position",size:4,type:pe.SHORT,normalized:!1},{name:"a_shape",size:4,type:pe.SHORT,normalized:!1},{name:"a_texcoord",size:2,type:pe.UNSIGNED_SHORT,normalized:!0,static:e.shader_point?[0,0]:null},{name:"a_offset",size:2,type:pe.SHORT,normalized:!1},{name:"a_color",size:4,type:pe.UNSIGNED_BYTE,normalized:!0},{name:"a_selection_color",size:4,type:pe.UNSIGNED_BYTE,normalized:!0,static:e.selection?null:[0,0,0,0]},{name:"a_outline_color",size:4,type:pe.UNSIGNED_BYTE,normalized:!0,static:e.shader_point?null:[0,0,0,0]},{name:"a_outline_edge",size:1,type:pe.FLOAT,normalized:!1,static:e.shader_point?null:0}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.shader_point]=new Le(t)}return this.vertex_layouts[e.shader_point]},meshVariantTypeForDraw(e){const t=e.label_texture||e.texture||dr,n=t+"/"+e.blend_order;return null==this.variants[n]&&(this.variants[n]={key:n,selection:1,shader_point:t===dr,blend_order:e.blend_order,mesh_order:e.label_texture?1:0}),this.variants[n]},makeMesh(e,t,n={}){return n=Object.assign({},n,{fade_in_time:this.fade_in_time}),Ne.makeMesh.call(this,e,t,n)}});const hr=[0,.33,.66,.99];let pr=function(e,t,n,r){const i=[{type:"straight",tolerance:r.no_curving?1.8:1.5},{type:"curved"},{type:"straight",tolerance:2.3}];for(let o=0;o<i.length;o++){let s,a=i[o];if("straight"===a.type?s=new mr(t,n,r,a.tolerance):"curved"===a.type&&!r.no_curving&&n.length>2&&(s=new gr(e,n,r)),s&&!s.throw_away)return s}return!1};class fr{constructor(e){this.id=$t.nextLabelId(),this.layout=e,this.position=[],this.angle=0,this.offset=e.offset.slice(),this.unit_scale=this.layout.units_per_pixel,this.obbs=[],this.aabbs=[],this.type="",this.throw_away=!1}toJSON(){return{id:this.id,type:this.type,position:this.position,size:this.size,offset:this.offset,angle:this.angle,breach:this.breach,may_repeat_across_tiles:this.may_repeat_across_tiles,layout:Bt(this.layout)}}static splitLineByOrientation(e){let t=[e[0]],n=0,r=0,i=0,o=t,s=!1;for(let a=1;a<e.length;a++){let l=e[a],u=e[a-1],c=be.length(be.sub(l,u));l[0]>u[0]?1===i?(t.push(l),n+=c,n>r&&(o=t,r=n,s=!1)):(t=[u,l],n=c,n>r&&(o=t,r=n,s=!1),i=1):l[0]<u[0]?-1===i?(t.unshift(l),n+=c,n>r&&(o=t,r=n,s=!0)):(t=[l,u],n=c,n>r&&(o=t,r=n,s=!0),i=-1):(-1===i?t.unshift(l):(t.push(l),i=1),n+=c,n>r&&(o=t,r=n,s=-1===i))}return[o,s]}discard(e,t=null){if(this.throw_away)return!0;for(let n=0;n<this.obbs.length;n++){let r={aabb:this.aabbs[n],obb:this.obbs[n]};if($t.prototype.occluded.call(r,e,t))return!0}return!1}inTileBounds(){for(let e=0;e<this.aabbs.length;e++){let t={aabb:this.aabbs[e]};if(!$t.prototype.inTileBounds.call(t))return!1}return!0}static createOBB(e,t,n,r,i,o,s){let a=e[0],l=e[1];return!o||0===o[0]&&0===o[1]||(a+=(o=be.rot(o,i))[0]*s,l-=o[1]*s),new jt(a,l,-r,t,n)}}class mr extends fr{constructor(e,t,n,r){super(n),this.type="straight",this.size=e,this.throw_away=!this.fit(e,t,n,r)}fit(e,t,n,r){let i,o=this.unit_scale;[t,i]=fr.splitLineByOrientation(t),"number"==typeof n.orientation&&(this.offset[1]+=1.2*(e[1]-n.vertical_buffer),i&&(this.offset[1]*=-1),-1===n.orientation&&(this.offset[1]*=-1));let s=vr(t),a=e[0]*o;for(let i=0;i<t.length-1;i++){let o,l=t[i],u=0,c=0,d=i+1;for(;d<t.length;){let h=t[d-1],p=t[d],f=br(h,p);if(d!==i+1&&(u+=_r(f,o)),Math.abs(u)>.1)break;if(c+=s[d-1],yr(c,a)<r){let t=be.mult(be.add(l,p),.5);return this.angle=-f,Math.abs(this.angle-Math.PI/2)<.01&&(this.angle=-Math.PI/2,"number"==typeof n.orientation&&(this.offset[1]*=-1)),this.position=t,this.updateBBoxes(this.position,e,this.angle,this.angle,this.offset),!0}o=f,d++}}return!1}updateBBoxes(e,t,n,r,i){let o=this.unit_scale;this.obbs=[],this.aabbs=[];let s=(t[0]+2*this.layout.buffer[0])*o*$t.epsilon,a=(t[1]+2*this.layout.buffer[1])*o*$t.epsilon,l=fr.createOBB(e,s,a,n,r,i,o),u=l.getExtent();this.obbs.push(l),this.aabbs.push(u),this.inTileBounds&&(this.breach=!this.inTileBounds()),this.mayRepeatAcrossTiles&&(this.may_repeat_across_tiles=this.mayRepeatAcrossTiles())}}class gr extends fr{constructor(e,t,n){super(n),this.type="curved",this.angles=[],this.pre_angles=[],this.offsets=[],this.num_segments=e.length,this.sizes=e,this.throw_away=!this.fit(this.sizes,t,n)}toJSON(){return{id:this.id,type:this.type,obbs:this.obbs.map(e=>e.toJSON()),position:this.position,breach:this.breach,may_repeat_across_tiles:this.may_repeat_across_tiles,layout:Bt(this.layout)}}fit(e,t,n){let r,i=this.unit_scale,o=Math.max(...e.map(e=>e[1])),s=o*i;[t,r]=fr.splitLineByOrientation(t),"number"==typeof n.orientation&&(this.offset[1]+=1.2*(o-n.vertical_buffer),r&&(this.offset[1]*=-1),-1===n.orientation&&(this.offset[1]*=-1));let a=vr(t),l=e.map(e=>e[0]*i),u=a.reduce((e,t)=>e+t,0),c=l.reduce((e,t)=>e+t,0);if(c>u)return!1;let d=t.length-1;if(d-0<2)return!1;let h=gr.curvaturePlacement(t,u,a,c,0,d),p=t[h];if(-1===h||d-h<2)return!1;this.position=p;for(var f=0;f<l.length;f++){this.offsets[f]=[],this.angles[f]=[],this.pre_angles[f]=[];for(var m=0;m<hr.length;m++){let e=hr[m],[n,r]=gr.scaleLine(e,t);p=n[h];let{positions:o,offsets:a,angles:u,pre_angles:c}=gr.placeAtIndex(h,n,r,l),d=a.map(e=>Math.sqrt(e[0]*e[0]+e[1]*e[1])/i);if(0===e){this.angle=1/u.length*u.reduce((e,t)=>e+t);for(let e=0;e<o.length;e++){let t=o[e],n=c[e],r=l[e],a=n+u[e],d=this.angle,h=fr.createOBB(t,r,s,a,d,this.offset,i),p=h.getExtent();this.obbs.push(h),this.aabbs.push(p)}}this.offsets[f].push(d[f]),this.angles[f].push(u[f]),this.pre_angles[f].push(c[f])}}return!0}static curvaturePlacement(e,t,n,r,i,o){i=i||0,o=o||e.length-1;var s=[];for(let t=i+1;t<o;t++){var a=e[t-1],l=e[t],u=e[t+1],c=be.perp(l,a),d=be.perp(u,l),h=be.angleBetween(c,d);h>1&&(h=1/0),s.push(h)}s.push(1/0);var p=[],f=[],m=i,g=0;for(let e=0;e<i;e++)g+=n[e];for(;g+r<t;){for(var y=g+r,b=g,v=m,_=0;v<o&&b+n[v]<y&&(_+=s[v])!==1/0;)b+=n[v],v++;if(0===_)return m;var x=_/(v-m);p.push(_),f.push(x),g+=n[m],m++}if(0===p.length)return-1;var w=Math.min.apply(null,p),E=f[p.indexOf(w)];return w<1.3&&E<.4?p.indexOf(w):-1}static scaleLine(e,t){var n=[t[0]],r=[];return t.forEach((i,o)=>{if(o!==t.length-1){var s=be.sub(t[o+1],t[o]),a=be.mult(s,1+e);n.push(be.add(n[o],a)),r.push(be.length(a))}}),[n,r]}static placeAtIndex(e,t,n,r){let i=t[e],[o,s]=gr.getIndicesAndOffsets(e,n,r),a=gr.getPositionsFromIndicesAndOffsets(t,o,s),[l,u,c]=gr.getAnglesFromIndicesAndOffsets(i,o,t,a);return{positions:a,offsets:l,angles:u,pre_angles:c}}static getIndicesAndOffsets(e,t,n){let r=n.length,i=[],o=[],s=0,a=0,l=0;for(;s<r;){let u=n[s];for(;s<r&&a+.5*u<=l+t[e];){let t=a-l+.5*u;o.push(t),i.push(e),a+=u,s++,u=n[s]}l+=t[e],e++}return[i,o]}static getPositionsFromIndicesAndOffsets(e,t,n){let r=[];for(let i=0;i<t.length;i++){let o=t[i],s=n[i],a=br(e[o],e[o+1]),l=be.rot([s,0],a),u=be.add(e[o],l);r.push(u)}return r}static getAnglesFromIndicesAndOffsets(e,t,n,r){let i=[],o=[],s=[];for(let a=0;a<r.length;a++){let l=r[a],u=t[a],c=be.sub(l,e),d=-be.angle(c),h=-br(n[u],n[u+1])-d;if(a>0){let e=i[a-1],t=o[a-1];Math.abs(d-e)>Math.PI&&(d+=d>e?-2*Math.PI:2*Math.PI),Math.abs(t-h)>Math.PI&&(h+=h>t?-2*Math.PI:2*Math.PI)}i.push(d),o.push(h),s.push(c)}return[s,i,o]}}function yr(e,t){return t/e}function br(e,t){let n=be.sub(t,e);return be.angle(n)}function vr(e){let t=[];for(let n=0;n<e.length-1;n++){let r=e[n],i=e[n+1],o=Math.hypot(r[0]-i[0],r[1]-i[1]);t.push(o)}return t}function _r(e,t){let n,r;for(e>t?(n=t,r=e):(n=e,r=t);r-n>Math.PI;)n+=2*Math.PI;return Math.abs(r-n)}let xr=Object.create(cr);Object.assign(xr,{name:"text",super:cr,built_in:!0,init(e={}){Ne.init.call(this,e),this.setupDefines(),this.defines.TANGRAM_HAS_SHADER_POINTS=!1,this.defines.TANGRAM_CURVED_LABEL=!0,this.reset()},makeVertexTemplate(e,t){this.super.makeVertexTemplate.call(this,e,t,!1);let n=t.vertex_data.vertex_layout.index.a_pre_angles;for(let e=0;e<12;e++)this.vertex_template[n++]=0;return this.addCustomAttributesToVertexTemplate(e,n),this.vertex_template},reset(){this.queues={},this.resetText()},addFeature(e,t,n){let r=n.tile;if(r.generation!==this.generation)return;let i=e.geometry.type;t.can_articulate="LineString"===i||"MultiLineString"===i,t.supersample_text="LineString"===i||"MultiLineString"===i;let o=this.parseTextFeature(e,t,n,r);o&&(o instanceof Array?o.forEach(t=>{t.feature=e,t.context=n,t.layout.vertex=!1,this.queueFeature(t,r)}):(o.feature=e,o.context=n,o.layout.vertex=!1,this.queueFeature(o,r)),Wt.addStyle(this.name,r.id))},async endData(e){let t=this.queues[e.id];delete this.queues[e.id];const{labels:n,texts:r,textures:i}=await this.collideAndRenderTextLabels(e,this.name,t);n&&r&&(this.texts[e.id]=r,n.forEach(t=>{let n=t.text_settings_key,r=this.texts[e.id][n]&&this.texts[e.id][n][t.text],o=this.feature_style;o.label=t.label,r.text_settings.can_articulate?(o.size={},o.texcoords={},"straight"===t.label.type?(o.size.straight=r.size.logical_size,o.texcoords.straight=r.texcoords.straight,o.label_texture=i[r.texcoords.straight.texture_id]):(o.size.curved=r.segment_sizes.map(function(e){return e.logical_size}),o.texcoords_stroke=r.texcoords_stroke,o.texcoords.curved=r.texcoords.curved,o.label_textures=r.texcoords.curved.map(e=>i[e.texture_id]))):(o.size=r.size.logical_size,o.texcoords=r.align[t.label.align].texcoords,o.label_texture=i[r.align[t.label.align].texture_id]),o.blend_order=t.draw.blend_order,Ne.addFeature.call(this,t.feature,t.draw,t.context)})),this.freeText(e);const o=await Ne.endData.call(this,e);if(o){i&&i.length&&o.textures.push(...i);for(let e in o.meshes)o.meshes[e].uniforms.u_apply_color_blocks=!0}return o},_preprocess(e){return e.blend_order=this.getBlendOrderForDraw(e),this.preprocessText(e)},buildTextLabels(e,t){let n=[];for(let i=0;i<t.length;i++){let o,s=t[i],a=this.texts[e.id][s.text_settings_key][s.text];if(s.layout.vertical_buffer=a.vertical_buffer,a.text_settings.can_articulate){var r=a.segment_sizes.map(e=>e.collision_size);s.layout.no_curving=a.no_curving,o=this.buildLabels(r,s.feature.geometry,s.layout,a.size.collision_size)}else o=this.buildLabels(a.size.collision_size,s.feature.geometry,s.layout);for(let e=0;e<o.length;e++){let t=Object.create(s);t.label=o[e],n.push(t)}}return n},buildLabels(e,t,n,r){let i=[];if("LineString"===t.type)Array.prototype.push.apply(i,this.buildLineLabels(t.coordinates,e,n,r));else if("MultiLineString"===t.type){let o=t.coordinates;for(let t=0;t<o.length;++t)Array.prototype.push.apply(i,this.buildLineLabels(o[t],e,n,r))}else if("Point"===t.type)i.push(new qt(t.coordinates,e,n));else if("MultiPoint"===t.type){let r=t.coordinates;for(let t=0;t<r.length;++t)i.push(new qt(r[t],e,n))}else if("Polygon"===t.type){let r=U.centroid(t.coordinates);r&&i.push(new qt(r,e,n))}else if("MultiPolygon"===t.type){let r=U.multiCentroid(t.coordinates);r&&i.push(new qt(r,e,n))}return i},buildLineLabels(e,t,n,r){let i=[],o=Math.min(n.subdiv,e.length-1);if(o>1){let s=(e.length-1)/o;for(let a=0;a<o;a++){let o=Math.floor(a*s),l=Math.floor((a+1)*s)+1,u=e.slice(o,l),c=pr(t,r,u,n);c&&i.push(c)}}if(i.length<o){let o=pr(t,r,e,n);o&&i.push(o)}return i},vertexLayoutForMeshVariant(e){if(null==this.vertex_layouts[e.shader_point]){const t=[{name:"a_position",size:4,type:pe.SHORT,normalized:!1},{name:"a_shape",size:4,type:pe.SHORT,normalized:!1},{name:"a_texcoord",size:2,type:pe.UNSIGNED_SHORT,normalized:!0},{name:"a_offset",size:2,type:pe.SHORT,normalized:!1},{name:"a_color",size:4,type:pe.UNSIGNED_BYTE,normalized:!0},{name:"a_selection_color",size:4,type:pe.UNSIGNED_BYTE,normalized:!0,static:e.selection?null:[0,0,0,0]},{name:"a_pre_angles",size:4,type:pe.BYTE,normalized:!1},{name:"a_angles",size:4,type:pe.SHORT,normalized:!1},{name:"a_offsets",size:4,type:pe.UNSIGNED_SHORT,normalized:!1}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.shader_point]=new Le(t)}return this.vertex_layouts[e.shader_point]}}),xr.texture_id=0;let wr=Object.create(et);function Er(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Sr(e){return null!=e}function Tr(e){return"("+e+")"}function kr(e){return"string"==typeof e?'"'+e+'"':e}function Or(e){return"$"===e[0]?"context['"+e.substring(1)+"']":e.indexOf(".")>-1?-1===e.indexOf("\\.")?`context.feature.properties${e.split(".").map(e=>"['"+e+"']").join("")}`:`context.feature.properties${e.replace(/\\\./g,"__TANGRAM_DELIMITER__").split(".").map(e=>e.replace(/__TANGRAM_DELIMITER__/g,".")).map(e=>"['"+e+"']").join("")}`:"context.feature.properties['"+e+"']"}function Ar(e,t){return Tr(kr(t)+" === "+Or(e))}function Cr(e,t){return Tr(`${"["+t.map(kr).join(",")+"]"}.indexOf(${Or(e)}) > -1`)}function Rr(e,t){return Tr(e.filter(Sr).map(function(e){return Tr(e.join(" && "))}).join(" "+t+" "))}function Nr(e,t,n){return t&&t.length>0?Rr(t.map(function(e){return Lr(e,n)}),"||"):"true"}function Pr(e,t,n){return t&&t.length>0?Rr(t.map(function(e){return Lr(e,n)}),"&&"):"true"}function Mr(e,t,n){return"!"+Tr(Lr(t,n).join(" && "))}function Dr(e,t,n){return"!"+Tr(Nr(0,t,n))}function Ir(e,t){return Tr(Or(e)+(t?" != ":" == ")+"null")}function zr(e,t,n){var r=[],i=n&&"function"==typeof n.rangeTransform&&n.rangeTransform;if(t.max){var o=i?i(t.max):t.max;r.push(Or(e)+" < "+o)}if(t.min){var s=i?s=i(t.min):t.min;r.push(Or(e)+" >= "+s)}return Tr(r.join(" && "))}function Fr(e,t){let n=[];if(t.includes_any){const r="["+(Array.isArray(t.includes_any)?t.includes_any:[t.includes_any]).map(kr).join(",")+"]";n.push(`${Or(e)} != null && ${r}.some(function(v) { return ${Or(e)}.indexOf(v) > -1 })`)}if(t.includes_all){const r="["+(Array.isArray(t.includes_all)?t.includes_all:[t.includes_all]).map(kr).join(",")+"]";n.push(`${Or(e)} != null && ${r}.every(function(v) { return ${Or(e)}.indexOf(v) > -1 })`)}return Tr(n.join(" && "))}function Lr(e,t){var n=[];if("function"==typeof e)return[Tr(e.toString()+"(context)")];if(Array.isArray(e))return[Nr(0,e,t)];if(null==e)return["true"];for(var r=Object.keys(e),i=0;i<r.length;i++){var o=r[i],s=e[o],a=typeof s;if("string"===a||"number"===a)n.push(Ar(o,s));else if("boolean"===a)n.push(Ir(o,s));else if("not"===o)n.push(Mr(0,s,t));else if("any"===o)n.push(Nr(0,s,t));else if("all"===o)n.push(Pr(0,s,t));else if("none"===o)n.push(Dr(0,s,t));else if(Array.isArray(s))n.push(Cr(o,s));else if("object"===a&&null!=s)s.max||s.min?n.push(zr(o,s,t)):(s.includes_any||s.includes_all)&&n.push(Fr(o,s));else{if(null!=s)throw new Error("Unknown Query syntax: "+s);n.push(" true ")}}return 0===r.length?["true"]:n}function jr(e,t){return null==e?function(){return!0}:new Function("context","return "+Tr(Lr(e,t).join(" && "))+";")}Object.assign(wr,{name:"raster",super:et,built_in:!0,init(){this.raster=this.raster||"color",this.super.init.apply(this,arguments),this.selection=!1},_preprocess(e){return e.color=e.color||Q.defaults.color,this.super._preprocess.apply(this,arguments)}});const $r=["filter","draw","visible","enabled","data","exclusive","priority"];let Br={};function Vr(e,t){let n,r=0;for(let t=0;t<e.length;t++)e[t].length>r&&(r=e[t].length);if(0===r)return null;let i={visible:!0};for(let o=0;o<r;o++)n=[],e.forEach(e=>{e[o]&&e[o][t]&&-1===n.indexOf(e[o][t])&&n.push(e[o][t])}),0!==n.length&&V(i,...n);return!1===i.visible?null:i}const Ur=["any","all","not","none"];class Wr{constructor({layer:e,name:t,parent:n,draw:r,visible:i,enabled:o,filter:s,exclusive:a,priority:l,styles:u}){if(this.id=Wr.id++,this.config_data=e.data,this.parent=n,this.name=t,this.full_name=this.parent?this.parent.full_name+":"+this.name:this.name,this.draw=r,this.filter=s,this.exclusive=!0===a,this.priority=null!=l?l:Number.MAX_SAFE_INTEGER,this.styles=u,this.is_built=!1,o=void 0===o?i:o,this.enabled=!1!==o,this.draw)for(let e in this.draw)if(this.draw[e]=null==this.draw[e]?{}:this.draw[e],"object"!=typeof this.draw[e]){let t=`Draw group '${e}' for layer ${this.full_name} is invalid, must be an object, `;t+=`but was set to \`${e}: ${this.draw[e]}\` instead`,g("warn",t),delete this.draw[e]}}build(){g("trace",`Building layer '${this.full_name}'`),this.buildFilter(),this.buildDraw(),this.is_built=!0}buildDraw(){this.draw=Y(this.draw,Q.wrapFunction),this.calculatedDraw=function(e){let t=[];if(e.parent){let n=e.parent.calculatedDraw||[];t.push(...n)}return t.push(e.draw),t}(this)}buildFilter(){this.filter_original=this.filter,this.filter=Y(this.filter,Q.wrapFunction);let e=typeof this.filter;if(null!=this.filter&&"object"!==e&&"function"!==e){let e=`Filter for layer ${this.full_name} is invalid, filter value must be an object or function, `;return e+=`but was set to \`filter: ${this.filter}\` instead`,void g("warn",e)}try{this.buildZooms(),this.buildPropMatches(),null!=this.filter&&("function"==typeof this.filter||Object.keys(this.filter).length>0)?this.filter=jr(this.filter,Hr):this.filter=null}catch(e){let t=`Filter for layer ${this.full_name} is invalid, \`filter: ${JSON.stringify(this.filter)}\` `;t+=`failed with error '${e.message}', stack trace: ${e.stack}`,g("warn",t)}}buildZooms(){let e=this.filter&&this.filter.$zoom,t=typeof e;if(null!=e){if(this.zooms={},"number"===t)this.zooms[e]=!0;else if(Array.isArray(e))for(let t=0;t<e.length;t++)this.zooms[e[t]]=!0;else if("object"===t&&(null!=e.min||null!=e.max)){let t=e.min||0,n=e.max||U.max_style_zoom;for(let e=t;e<n;e++)this.zooms[e]=!0}delete this.filter.$zoom}}buildPropMatches(){this.filter&&!Array.isArray(this.filter)&&"function"!=typeof this.filter&&Object.keys(this.filter).forEach(e=>{if(-1===Ur.indexOf(e)){let t=this.filter[e],n=typeof t,r=Array.isArray(t);if(!r&&"string"!==n&&"number"!==n)return;"$"===e[0]?(this.context_prop_matches=this.context_prop_matches||[],this.context_prop_matches.push([e.substring(1),r?t:[t]]),delete this.filter[e]):-1===e.indexOf(".")&&(this.feature_prop_matches=this.feature_prop_matches||[],this.feature_prop_matches.push([e,r?t:[t]]),delete this.filter[e])}})}doPropMatches(e){if(this.feature_prop_matches)for(let t=0;t<this.feature_prop_matches.length;t++){let n=this.feature_prop_matches[t],r=e.feature.properties[n[0]];if(null==r||-1===n[1].indexOf(r))return!1}if(this.context_prop_matches)for(let t=0;t<this.context_prop_matches.length;t++){let n=this.context_prop_matches[t],r=e[n[0]];if(null==r||-1===n[1].indexOf(r))return!1}return!0}doesMatch(e){if(!this.enabled)return!1;if(this.is_built||this.build(),null!=this.zooms&&!this.zooms[e.zoom])return!1;if(!this.doPropMatches(e))return!1;let t;if(this.filter instanceof Function)try{t=this.filter(e)}catch(t){let n=`Filter for this ${this.full_name}: \`filter: ${this.filter_original}\` `;n+=`failed with error '${t.message}', stack trace: ${t.stack}`,g("error",n,e.feature)}else t=null==this.filter;return!!t&&(this.children_to_parse&&(function(e,t,n){for(let r in t){let i=t[r];if("object"!=typeof i||Array.isArray(i)){let t=`Layer value must be an object: cannot create layer '${r}: ${JSON.stringify(i)}'`;t+=`, under parent layer '${e.full_name}'.`,n[e.name]&&(t+=` The parent name '${e.name}' is also the name of a style, did you mean to create a 'draw' group`,e.parent&&(t+=` under '${e.parent.name}'`),t+=" instead?"),g("warn",t)}else Kr(r,i,e,n)}e.layers.sort((e,t)=>{if(e.exclusive<t.exclusive)return 1;if(e.exclusive>t.exclusive)return-1;const n=e.exclusive?1:-1;return e.priority>t.priority?n:e.priority<t.priority?-n:e.full_name<t.full_name?n:e.full_name>t.full_name?-n:void 0})}(this,this.children_to_parse,this.styles),delete this.children_to_parse),!0)}}Wr.id=0;class qr extends Wr{constructor(e){super(e),this.is_leaf=!0}}class Gr extends Wr{constructor(e){super(e),this.is_tree=!0,this.layers=e.layers||[]}addLayer(e){this.layers.push(e)}buildDrawGroups(e){let t=[],n=[];if(Xr(e,[this],t,n),t.length>0){let e=function(e){if(e.length>1){for(var t=e[0],n=1;n<e.length;n++)t+="/"+e[n];return t}return e[0]}(n);if(void 0===Br[e]){let n=t.map(e=>e&&!1!==e.visible&&e.calculatedDraw),r={};for(let e=0;e<n.length;e++){let t=n[e];if(t)for(let e=0;e<t.length;e++){let n=t[e];for(let e in n)r[e]=!0}}for(let i in r)Br[e]=Br[e]||{},Br[e][i]=Vr(n,i),Br[e][i]?(Br[e][i].key=e+"/"+i,Br[e][i].layers=t.map(e=>e&&e.full_name),Br[e][i].group=i):delete Br[e][i];Br[e]&&0===Object.keys(Br[e]).length&&(Br[e]=null)}return Br[e]}}}const Hr={rangeTransform:e=>"string"==typeof e&&"px2"===e.trim().slice(-3)?`${parseFloat(e)} * context.meters_per_pixel_sq`:e};function Yr(e){return $r.indexOf(e)>-1}function Kr(e,t,n,r){let i={name:e,layer:t=null==t?{}:t,parent:n,styles:r},[o,s]=function(e){let t={},n={};for(let r in e)Yr(r)?t[r]=e[r]:n[r]=e[r];return[t,n]}(t),a=(l=s,0===Object.keys(l).length);var l;let u;u=a&&null!=n?qr:Gr;let c=new u(Object.assign(i,o));return c.enabled&&(n&&n.addLayer(c),c.children_to_parse=a?null:s),c}function Xr(e,t,n,r){let i=!1,o=!1;if(0!==t.length){for(let s=0;s<t.length;s++){let a=t[s];if(a.is_leaf){if(a.doesMatch(e)&&(i=!0,n.push(a),r.push(a.id),a.exclusive))break}else if(a.is_tree&&a.doesMatch(e)&&(i=!0,o=Xr(e,a.layers,n,r),o||(n.push(a),r.push(a.id)),a.exclusive))break}return i}}function Zr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Jr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Zr(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}let Qr=0,ei=0;class ti{constructor({coords:e,style_z:t,source:n,workers:r,view:i}){this.id=Qr++,this.view=i,this.source=n,this.generation=null,this.valid=!0,this.visible=!1,this.proxy_for=null,this.proxied_as=null,this.proxy_level=0,this.proxy_order_offset=0,this.fade_in=!0,this.loading=!1,this.loaded=!1,this.built=!1,this.labeled=!1,this.error=null,this.debug={},this.style_z=t,this.coords=ke.normalizedCoord(e,this.source),this.key=ke.key(this.coords,this.source,this.style_z),this.overzoom=Math.max(this.style_z-this.coords.z,0),this.overzoom2=Math.pow(2,this.overzoom),this.min=U.metersForTile(this.coords),this.max=U.metersForTile({x:this.coords.x+1,y:this.coords.y+1,z:this.coords.z}),this.span={x:this.max.x-this.min.x,y:-(this.max.y-this.min.y)},this.bounds={sw:{x:this.min.x,y:this.max.y},ne:{x:this.max.x,y:this.min.y}},this.meters_per_pixel=U.metersPerPixel(this.style_z),this.meters_per_pixel_sq=this.meters_per_pixel*this.meters_per_pixel,this.units_per_pixel=U.units_per_pixel/this.overzoom2,this.units_per_meter_overzoom=U.unitsPerMeter(this.coords.z)*this.overzoom2,this.preserve_tiles_within_zoom=this.source.preserve_tiles_within_zoom,this.meshes={},this.new_mesh_styles=[],this.pending_label_meshes=null,this.setWorker(r)}freeResources(){for(let e in this.meshes)this.meshes[e].forEach(e=>e.destroy());if(this.meshes={},this.pending_label_meshes)for(let e in this.pending_label_meshes)this.pending_label_meshes[e].forEach(e=>e.destroy());this.pending_label_meshes=null}destroy(){S.removeForTile(this.id),this.workerMessage("self.removeTile",this.key),this.freeResources(),this.worker=null,this.valid=!1}buildAsMessage(){return{id:this.id,key:this.key,source:this.source.name,coords:this.coords,min:this.min,max:this.max,units_per_pixel:this.units_per_pixel,meters_per_pixel:this.meters_per_pixel,meters_per_pixel_sq:this.meters_per_pixel_sq,units_per_meter_overzoom:this.units_per_meter_overzoom,style_z:this.style_z,overzoom:this.overzoom,overzoom2:this.overzoom2,generation:this.generation,debug:this.debug}}setWorker(e){this.source.tiled?this.worker_id=Math.abs(this.coords.x+this.coords.y+this.coords.z)%e.length:this.worker_id=this.source.id%e.length,this.worker=e[this.worker_id]}workerMessage(...e){return a.postMessage(this.worker,...e)}build(e,{fade_in:t=!0}={}){return this.generation=e,this.fade_in=t,this.loaded||(this.loading=!0,this.built=!1,this.labeled=!1),this.workerMessage("self.buildTile",{tile:this.buildAsMessage()}).catch(e=>{throw e})}static cancel(e){e&&(e.canceled=!0,e.source_data&&e.source_data.request_id&&(y.cancelRequest(e.source_data.request_id),e.source_data.request_id=null),ti.abortBuild(e))}static buildGeometry(e,{scene_id:t,layers:n,styles:r,global:i}){let o=e.source_data;e.debug.building=+new Date,e.debug.feature_count=0,e.debug.layers=null,Wt.startTile(e.id,{apply_repeat_groups:!0});for(let t in n){let s=n[t];if(!s||!s.config_data){g("warn",`Layer ${t} was defined without a geometry data source and will not be rendered.`);continue}if(s.config_data.source!==e.source)continue;let a=ti.getDataForSource(o,s.config_data,t);for(let n=0;n<a.length;n++){let o=a[n],l=o.geom;if(l)for(let n=0;n<l.features.length;n++){let a=l.features[n];if(null==a.geometry)continue;let u=Q.getFeatureParseContext(a,e,i);u.winding=e.default_winding,u.source=e.source,u.layer=o.layer;let c=s.buildDrawGroups(u,!0);if(c){for(let e in c){let n=c[e],i=n.style||e,o=r[i];o?(n=o.preprocess(n),null!=n&&!1!==n.visible&&(u.layers=n.layers,o.addFeature(a,n,u))):g("warn",`Style '${i}' not found, skipping layer '${t}':`,n,a)}e.debug.feature_count++}}}}e.debug.building=+new Date-e.debug.building;let s=this.stylesForTile(e,r).map(e=>r[e]);ti.buildStyleGroups(e,s,t,e=>e.collision?"collision":"non-collision")}static stylesForTile(e,t){let n=[];for(let r in t)t[r].hasDataForTile(e)&&n.push(r);return n}static buildStyleGroups(e,t,n,r){const i=t.reduce((e,t)=>{const n=r(t);return e[n]=e[n]||[],e[n].push(t),e},{});if(0===Object.keys(i).length)return a.postMessage(`TileManager_${n}.buildTileStylesCompleted`,a.withTransferables({tile:ti.slice(e),progress:{start:!0,done:!0}})),void Wt.resetTile(e.id);const o={};for(const t in i)ti.buildStyleGroup({group_name:t,groups:i,tile:e,progress:o,scene_id:n})}static async buildStyleGroup({group_name:e,groups:t,tile:n,progress:r,scene_id:i}){const o=t[e],s={};try{await Promise.all(o.map(async function(e){const t=await e.endData(n);t&&(s[e.name]=t)})),g("trace",`Finished style group '${e}' for tile ${n.key}`),t[e]=null,Object.keys(t).every(e=>null==t[e])&&(r.done=!0),a.postMessage(`TileManager_${i}.buildTileStylesCompleted`,a.withTransferables({tile:Jr(Jr({},ti.slice(n)),{},{mesh_data:s}),progress:r})),r.done&&Wt.resetTile(n.id)}catch(t){g("error",`Error for style group '${e}' for tile ${n.key}`,t&&t.stack||t)}}static getDataForSource(e,t,n){var r=[];if(null!=t&&null!=e&&null!=e.layers)if(!0===t.all_layers){null!=t.layer&&g({level:"warn",once:!0},`Layer ${n} includes both 'all_layers: true' and an explicit 'layer' keyword in its 'data' block. 'all_layers: true' takes precedence, 'layer' will be ignored.`);for(const t in e.layers)r.push({layer:t,geom:e.layers[t]})}else!t.layer&&e.layers._default?r.push({geom:e.layers._default}):!t.layer&&n?r.push({layer:n,geom:e.layers[n]}):"string"==typeof t.layer?r.push({layer:t.layer,geom:e.layers[t.layer]}):Array.isArray(t.layer)&&t.layer.forEach(t=>{r.push({layer:t,geom:e.layers[t]})});return r}buildMeshes(e,t){if(this.error)return;this.build_id=ei++,t.start&&(this.debug.geometry_count=0,this.debug.buffer_size=0);let n={},r=this.mesh_data;if(r)for(let t in r){for(let i in r[t].meshes){let o=r[t].meshes[i];if(o.vertex_data){if(!e[t]){g("warn",`Could not create mesh because style '${t}' not found, for tile ${this.key}, aborting tile`);break}let i=Object.assign({},r[t]);i.uniforms=Object.assign({},i.uniforms,o.uniforms),i.variant=o.variant,o.labels&&(i.retain=!0);let s=e[t].makeMesh(o.vertex_data,o.vertex_elements,i);s.variant=i.variant,s.labels=o.labels,n[t]=n[t]||[],n[t].push(s),null==s.variant.mesh_order&&(s.variant.mesh_order=n[t].length-1),this.debug.buffer_size+=s.buffer_size,this.debug.geometry_count+=s.geometry_count}}n[t]&&n[t].sort((e,t)=>{let n=e.variant.mesh_order,r=t.variant.mesh_order;return null==n?1:null==r||n<r?-1:1})}delete this.mesh_data;for(let t in n)e[t].collision?(this.pending_label_meshes=this.pending_label_meshes||{},this.pending_label_meshes[t]=n[t]):(this.meshes[t]&&this.meshes[t].forEach(e=>e.destroy()),this.meshes[t]=n[t],this.new_mesh_styles.push(t));if(t.done){for(let e in this.meshes)-1!==this.new_mesh_styles.indexOf(e)||this.pending_label_meshes&&null!=this.pending_label_meshes[e]||(this.meshes[e].forEach(e=>e.destroy()),delete this.meshes[e]);this.new_mesh_styles=[],this.debug.geometry_ratio=(this.debug.geometry_count/this.debug.feature_count).toFixed(1)}this.printDebug(t)}pendingLabelStyleCount(){return this.pending_label_meshes?Object.keys(this.pending_label_meshes).length:0}swapPendingLabels(){if(this.labeled=!0,this.pending_label_meshes){for(let e in this.pending_label_meshes)this.meshes[e]&&this.meshes[e].forEach(e=>e.destroy()),this.meshes[e]=this.pending_label_meshes[e];this.pending_label_meshes=null}}static abortBuild(e){if(S.removeForTile(e.id),Wt.abortTile(e.id),e.mesh_data)for(let t in e.mesh_data){let n=e.mesh_data[t].textures;n&&n.forEach(t=>{let n=O.textures[t];n&&(g("trace",`releasing texture ${t} for tile ${e.key}`),n.release())})}}setProxyFor(e){e?(this.visible=!0,this.proxy_for=this.proxy_for||[],this.proxy_for.push(e),this.proxy_order_offset=1,e.proxied_as=e.style_z>this.style_z?"child":"parent",this.proxy_level=Math.abs(e.style_z-this.style_z)):(this.proxy_for=null,this.proxy_order_offset=0,this.proxy_level=0)}isProxy(){return null!=this.proxy_for}shouldProxyForStyle(e){return!this.proxy_for||this.proxy_for.some(t=>null==t.meshes[e])}setupProgram({model:e,model32:t},n){n.uniform("4fv","u_tile_origin",[this.min.x,this.min.y,this.style_z,this.coords.z]),n.uniform("1f","u_tile_proxy_order_offset",this.proxy_order_offset),ir.identity(e),ir.translate(e,e,nr.fromValues(this.min.x,this.min.y,0)),ir.scale(e,e,nr.fromValues(this.span.x/U.tile_scale,this.span.y/U.tile_scale,1)),ir.copy(t,e),n.uniform("Matrix4fv","u_model",t),n.uniform("1i","u_tile_fade_in",this.fade_in&&"child"!==this.proxied_as)}static slice(e,t){let n=["id","key","loading","loaded","generation","error","debug"];Array.isArray(t)&&n.push(...t);var r={};for(let t=0;t<n.length;t++){const i=n[t];r[i]=e[i]}return r}merge(e){return this.loading=e.loading,this.loaded=e.loaded,this.generation=e.generation,this.error=e.error,this.mesh_data=e.mesh_data,this.debug=V(this.debug,e.debug),this}printDebug(e){const t=["layers"];let n={};for(let e in this.debug)-1===t.indexOf(e)&&(n[e]=this.debug[e]);g("debug",`Tile ${e.done?"(done)":""}: debug for ${this.key}: [ ${JSON.stringify(n)} ]`)}}function ni(e,t){for(let n in e){let r=e[n];Pe(t,n,r.features,r.geoms,r.styles,r.base),r.layers&&(t[n].layers=t[n].layers||{},ni(r.layers,t[n].layers))}}ti.coord_children={};var ri,ii,oi,si={};var ai,li,ui,ci,di,hi,pi,fi,mi,gi=function(){if(oi)return ii;oi=1,ii=t;var e=(ri||(ri=1,si.read=function(e,t,n,r,i){var o,s,a=8*i-r-1,l=(1<<a)-1,u=l>>1,c=-7,d=n?i-1:0,h=n?-1:1,p=e[t+d];for(d+=h,o=p&(1<<-c)-1,p>>=-c,c+=a;c>0;o=256*o+e[t+d],d+=h,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=r;c>0;s=256*s+e[t+d],d+=h,c-=8);if(0===o)o=1-u;else{if(o===l)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=u}return(p?-1:1)*s*Math.pow(2,o-r)},si.write=function(e,t,n,r,i,o){var s,a,l,u=8*o-i-1,c=(1<<u)-1,d=c>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,f=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+d>=1?h/l:h*Math.pow(2,1-d))*l>=2&&(s++,l/=2),s+d>=c?(a=0,s=c):s+d>=1?(a=(t*l-1)*Math.pow(2,i),s+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,i),s=0));i>=8;e[n+p]=255&a,p+=f,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;e[n+p]=255&s,p+=f,s/=256,u-=8);e[n+p-f]|=128*m}),si);function t(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}t.Varint=0,t.Fixed64=1,t.Bytes=2,t.Fixed32=5;var n=4294967296,r=1/n;function i(e){return e.type===t.Bytes?e.readVarint()+e.pos:e.pos+1}function o(e,t,n){return n?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function s(e,t,n){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.ceil(Math.log(t)/(7*Math.LN2));n.realloc(r);for(var i=n.pos-1;i>=e;i--)n.buf[i+r]=n.buf[i]}function a(e,t){for(var n=0;n<e.length;n++)t.writeVarint(e[n])}function l(e,t){for(var n=0;n<e.length;n++)t.writeSVarint(e[n])}function u(e,t){for(var n=0;n<e.length;n++)t.writeFloat(e[n])}function c(e,t){for(var n=0;n<e.length;n++)t.writeDouble(e[n])}function d(e,t){for(var n=0;n<e.length;n++)t.writeBoolean(e[n])}function h(e,t){for(var n=0;n<e.length;n++)t.writeFixed32(e[n])}function p(e,t){for(var n=0;n<e.length;n++)t.writeSFixed32(e[n])}function f(e,t){for(var n=0;n<e.length;n++)t.writeFixed64(e[n])}function m(e,t){for(var n=0;n<e.length;n++)t.writeSFixed64(e[n])}function g(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+16777216*e[t+3]}function y(e,t,n){e[n]=t,e[n+1]=t>>>8,e[n+2]=t>>>16,e[n+3]=t>>>24}function b(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}return t.prototype={destroy:function(){this.buf=null},readFields:function(e,t,n){for(n=n||this.length;this.pos<n;){var r=this.readVarint(),i=r>>3,o=this.pos;this.type=7&r,e(i,t,this),this.pos===o&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=g(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=b(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=g(this.buf,this.pos)+g(this.buf,this.pos+4)*n;return this.pos+=8,e},readSFixed64:function(){var e=g(this.buf,this.pos)+b(this.buf,this.pos+4)*n;return this.pos+=8,e},readFloat:function(){var t=e.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=e.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(e){var t,n,r=this.buf;return t=127&(n=r[this.pos++]),n<128?t:(t|=(127&(n=r[this.pos++]))<<7,n<128?t:(t|=(127&(n=r[this.pos++]))<<14,n<128?t:(t|=(127&(n=r[this.pos++]))<<21,n<128?t:function(e,t,n){var r,i,s=n.buf;if(r=(112&(i=s[n.pos++]))>>4,i<128)return o(e,r,t);if(r|=(127&(i=s[n.pos++]))<<3,i<128)return o(e,r,t);if(r|=(127&(i=s[n.pos++]))<<10,i<128)return o(e,r,t);if(r|=(127&(i=s[n.pos++]))<<17,i<128)return o(e,r,t);if(r|=(127&(i=s[n.pos++]))<<24,i<128)return o(e,r,t);if(r|=(1&(i=s[n.pos++]))<<31,i<128)return o(e,r,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(n=r[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=function(e,t,n){for(var r="",i=t;i<n;){var o,s,a,l=e[i],u=null,c=l>239?4:l>223?3:l>191?2:1;if(i+c>n)break;1===c?l<128&&(u=l):2===c?128==(192&(o=e[i+1]))&&(u=(31&l)<<6|63&o)<=127&&(u=null):3===c?(o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&((u=(15&l)<<12|(63&o)<<6|63&s)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&((u=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,r+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),r+=String.fromCharCode(u),i+=c}return r}(this.buf,this.pos,e);return this.pos=e,t},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){var n=i(this);for(e=e||[];this.pos<n;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){var t=i(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){var t=i(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){var t=i(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){var t=i(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){var t=i(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){var t=i(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){var t=i(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){var t=i(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var n=7&e;if(n===t.Varint)for(;this.buf[this.pos++]>127;);else if(n===t.Bytes)this.pos=this.readVarint()+this.pos;else if(n===t.Fixed32)this.pos+=4;else{if(n!==t.Fixed64)throw new Error("Unimplemented type: "+n);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var n=new Uint8Array(t);n.set(this.buf),this.buf=n,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),y(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),y(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),y(this.buf,-1&e,this.pos),y(this.buf,Math.floor(e*r),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),y(this.buf,-1&e,this.pos),y(this.buf,Math.floor(e*r),this.pos+4),this.pos+=8},writeVarint:function(e){(e=+e||0)>268435455||e<0?function(e,t){var n,r;if(e>=0?(n=e%4294967296|0,r=e/4294967296|0):(r=~(-e/4294967296),4294967295^(n=~(-e%4294967296))?n=n+1|0:(n=0,r=r+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,n){n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos]=127&e}(n,0,t),function(e,t){var n=(7&e)<<4;t.buf[t.pos++]|=n|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(r,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,n){for(var r,i,o=0;o<t.length;o++){if((r=t.charCodeAt(o))>55295&&r<57344){if(!i){r>56319||o+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):i=r;continue}if(r<56320){e[n++]=239,e[n++]=191,e[n++]=189,i=r;continue}r=i-55296<<10|r-56320|65536,i=null}else i&&(e[n++]=239,e[n++]=191,e[n++]=189,i=null);r<128?e[n++]=r:(r<2048?e[n++]=r>>6|192:(r<65536?e[n++]=r>>12|224:(e[n++]=r>>18|240,e[n++]=r>>12&63|128),e[n++]=r>>6&63|128),e[n++]=63&r|128)}return n}(this.buf,e,this.pos);var n=this.pos-t;n>=128&&s(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n},writeFloat:function(t){this.realloc(4),e.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),e.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var n=0;n<t;n++)this.buf[this.pos++]=e[n]},writeRawMessage:function(e,t){this.pos++;var n=this.pos;e(t,this);var r=this.pos-n;r>=128&&s(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,n,r){this.writeTag(e,t.Bytes),this.writeRawMessage(n,r)},writePackedVarint:function(e,t){this.writeMessage(e,a,t)},writePackedSVarint:function(e,t){this.writeMessage(e,l,t)},writePackedBoolean:function(e,t){this.writeMessage(e,d,t)},writePackedFloat:function(e,t){this.writeMessage(e,u,t)},writePackedDouble:function(e,t){this.writeMessage(e,c,t)},writePackedFixed32:function(e,t){this.writeMessage(e,h,t)},writePackedSFixed32:function(e,t){this.writeMessage(e,p,t)},writePackedFixed64:function(e,t){this.writeMessage(e,f,t)},writePackedSFixed64:function(e,t){this.writeMessage(e,m,t)},writeBytesField:function(e,n){this.writeTag(e,t.Bytes),this.writeBytes(n)},writeFixed32Field:function(e,n){this.writeTag(e,t.Fixed32),this.writeFixed32(n)},writeSFixed32Field:function(e,n){this.writeTag(e,t.Fixed32),this.writeSFixed32(n)},writeFixed64Field:function(e,n){this.writeTag(e,t.Fixed64),this.writeFixed64(n)},writeSFixed64Field:function(e,n){this.writeTag(e,t.Fixed64),this.writeSFixed64(n)},writeVarintField:function(e,n){this.writeTag(e,t.Varint),this.writeVarint(n)},writeSVarintField:function(e,n){this.writeTag(e,t.Varint),this.writeSVarint(n)},writeStringField:function(e,n){this.writeTag(e,t.Bytes),this.writeString(n)},writeFloatField:function(e,n){this.writeTag(e,t.Fixed32),this.writeFloat(n)},writeDoubleField:function(e,n){this.writeTag(e,t.Fixed64),this.writeDouble(n)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}},ii}(),yi=P(gi),bi={};function vi(){if(ci)return ui;ci=1;var e=function(){if(li)return ai;function e(e,t){this.x=e,this.y=t}return li=1,ai=e,e.prototype={clone:function(){return new e(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},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(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,n=e.y-this.y;return t*t+n*n},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[0]*this.x+e[1]*this.y,n=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=n,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),n=Math.sin(e),r=t*this.x-n*this.y,i=n*this.x+t*this.y;return this.x=r,this.y=i,this},_rotateAround:function(e,t){var n=Math.cos(e),r=Math.sin(e),i=t.x+n*(this.x-t.x)-r*(this.y-t.y),o=t.y+r*(this.x-t.x)+n*(this.y-t.y);return this.x=i,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},e.convert=function(t){return t instanceof e?t:Array.isArray(t)?new e(t[0],t[1]):t},ai}();function t(e,t,r,i,o){this.properties={},this.extent=r,this.type=0,this._pbf=e,this._geometry=-1,this._keys=i,this._values=o,e.readFields(n,this,t)}function n(e,t,n){1==e?t.id=n.readVarint():2==e?function(e,t){for(var n=e.readVarint()+e.pos;e.pos<n;){var r=t._keys[e.readVarint()],i=t._values[e.readVarint()];t.properties[r]=i}}(n,t):3==e?t.type=n.readVarint():4==e&&(t._geometry=n.pos)}function r(e){for(var t,n,r=0,i=0,o=e.length,s=o-1;i<o;s=i++)t=e[i],r+=((n=e[s]).x-t.x)*(t.y+n.y);return r}return ui=t,t.types=["Unknown","Point","LineString","Polygon"],t.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var n,r=t.readVarint()+t.pos,i=1,o=0,s=0,a=0,l=[];t.pos<r;){if(!o){var u=t.readVarint();i=7&u,o=u>>3}if(o--,1===i||2===i)s+=t.readSVarint(),a+=t.readSVarint(),1===i&&(n&&l.push(n),n=[]),n.push(new e(s,a));else{if(7!==i)throw new Error("unknown command "+i);n&&n.push(n[0].clone())}}return n&&l.push(n),l},t.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,n=1,r=0,i=0,o=0,s=1/0,a=-1/0,l=1/0,u=-1/0;e.pos<t;){if(!r){var c=e.readVarint();n=7&c,r=c>>3}if(r--,1===n||2===n)(i+=e.readSVarint())<s&&(s=i),i>a&&(a=i),(o+=e.readSVarint())<l&&(l=o),o>u&&(u=o);else if(7!==n)throw new Error("unknown command "+n)}return[s,l,a,u]},t.prototype.toGeoJSON=function(e,n,i){var o,s,a=this.extent*Math.pow(2,i),l=this.extent*e,u=this.extent*n,c=this.loadGeometry(),d=t.types[this.type];function h(e){for(var t=0;t<e.length;t++){var n=e[t],r=180-360*(n.y+u)/a;e[t]=[360*(n.x+l)/a-180,360/Math.PI*Math.atan(Math.exp(r*Math.PI/180))-90]}}switch(this.type){case 1:var p=[];for(o=0;o<c.length;o++)p[o]=c[o][0];h(c=p);break;case 2:for(o=0;o<c.length;o++)h(c[o]);break;case 3:for(c=function(e){var t=e.length;if(t<=1)return[e];for(var n,i,o=[],s=0;s<t;s++){var a=r(e[s]);0!==a&&(void 0===i&&(i=a<0),i===a<0?(n&&o.push(n),n=[e[s]]):n.push(e[s]))}return n&&o.push(n),o}(c),o=0;o<c.length;o++)for(s=0;s<c[o].length;s++)h(c[o][s])}1===c.length?c=c[0]:d="Multi"+d;var f={type:"Feature",geometry:{type:d,coordinates:c},properties:this.properties};return"id"in this&&(f.id=this.id),f},ui}function _i(){if(hi)return di;hi=1;var e=vi();function t(e,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(n,this,t),this.length=this._features.length}function n(e,t,n){15===e?t.version=n.readVarint():1===e?t.name=n.readString():5===e?t.extent=n.readVarint():2===e?t._features.push(n.pos):3===e?t._keys.push(n.readString()):4===e&&t._values.push(function(e){for(var t=null,n=e.readVarint()+e.pos;e.pos<n;){var r=e.readVarint()>>3;t=1===r?e.readString():2===r?e.readFloat():3===r?e.readDouble():4===r?e.readVarint64():5===r?e.readVarint():6===r?e.readSVarint():7===r?e.readBoolean():null}return t}(n))}return di=t,t.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var n=this._pbf.readVarint()+this._pbf.pos;return new e(this._pbf,n,this.extent,this._keys,this._values)},di}var xi=(mi||(mi=1,bi.VectorTile=function(){if(fi)return pi;fi=1;var e=_i();function t(t,n,r){if(3===t){var i=new e(r,r.readVarint()+r.pos);i.length&&(n[i.name]=i)}}return pi=function(e,n){this.layers=e.readFields(t,{},n)},pi}(),bi.VectorTileFeature=vi(),bi.VectorTileLayer=_i()),bi);const wi=["{","["];class Ei extends Te{constructor(e,t){super(e,t),this.response_type="arraybuffer",!0===e.parse_json?this.parse_json_type=1:Array.isArray(e.parse_json)?(this.parse_json_type=2,this.parse_json_prop_list=e.parse_json):(null!=e.parse_json&&g({level:"warn",once:!0},`Data source '${this.name}': 'parse_json' parameter should be 'true', or an array of property names (was '${JSON.stringify(e.parse_json)}')`),this.parse_json_type=0)}parseSourceData(e,t,n){var r=new Uint8Array(n),i=new yi(r);if(t.data=new xi.VectorTile(i),t.layers=this.toGeoJSON(t.data),"function"==typeof this.transform){const n={min:Object.assign({},e.min),max:Object.assign({},e.max),coords:Object.assign({},e.coords)};t.layers=this.transform(t.layers,this.extra_data,n)}delete t.data}toGeoJSON(e){var t={};for(var n in e.layers){for(var r=e.layers[n],i=U.tile_scale/r.extent,o={type:"FeatureCollection",features:[]},s=0;s<r.length;s++){var a=r.feature(s),l={type:"Feature",geometry:{},id:a.id,properties:a.properties};this.parseJSONProperties(l);for(var u=l.geometry,c=a.loadGeometry(),d=0;d<c.length;d++)for(var h=c[d],p=0;p<h.length;p++)h[p]=[h[p].x*i,h[p].y*i];u.coordinates=c,"Point"===xi.VectorTileFeature.types[a.type]?1===c.length?(u.type="Point",u.coordinates=u.coordinates[0][0]):(u.type="MultiPoint",u.coordinates=u.coordinates[0]):"LineString"===xi.VectorTileFeature.types[a.type]?1===c.length?(u.type="LineString",u.coordinates=u.coordinates[0]):u.type="MultiLineString":"Polygon"===xi.VectorTileFeature.types[a.type]&&(u=Si(u)),o.features.push(l)}t[n]=o}return t}parseJSONProperties(e){if(0!==this.parse_json_type){const t=e.properties;if(2===this.parse_json_type)this.parse_json_prop_list.forEach(e=>{try{t[e]=JSON.parse(t[e])}catch(e){}});else for(const n in t)if(wi.indexOf(t[n][0])>-1)try{t[n]=JSON.parse(t[n])}catch(e){}}}}function Si(e){let t,n=[],r=[];for(let i=0;i<e.coordinates.length;i++){let o=e.coordinates[i],s=U.ringWinding(o);null!=s&&(t=t||s,s===t&&r.length>0&&(n.push(r),r=[]),r.push(o))}return r.length>0&&n.push(r),1===n.length?(e.type="Polygon",e.coordinates=n[0]):n.length>1?(e.type="MultiPolygon",e.coordinates=n):e=null,e}function Ti(e,t,n,r){for(var i,o=r,s=n-t>>1,a=n-t,l=e[t],u=e[t+1],c=e[n],d=e[n+1],h=t+3;h<n;h+=3){var p=ki(e[h],e[h+1],l,u,c,d);if(p>o)i=h,o=p;else if(p===o){var f=Math.abs(h-s);f<a&&(i=h,a=f)}}o>r&&(i-t>3&&Ti(e,t,i,r),e[i+2]=o,n-i>3&&Ti(e,i,n,r))}function ki(e,t,n,r,i,o){var s=i-n,a=o-r;if(0!==s||0!==a){var l=((e-n)*s+(t-r)*a)/(s*s+a*a);l>1?(n=i,r=o):l>0&&(n+=s*l,r+=a*l)}return(s=e-n)*s+(a=t-r)*a}function Oi(e,t,n,r){var i={id:void 0===e?null:e,type:t,geometry:n,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(e){var t=e.geometry,n=e.type;if("Point"===n||"MultiPoint"===n||"LineString"===n)Ai(e,t);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r<t.length;r++)Ai(e,t[r]);else if("MultiPolygon"===n)for(r=0;r<t.length;r++)for(var i=0;i<t[r].length;i++)Ai(e,t[r][i])}(i),i}function Ai(e,t){for(var n=0;n<t.length;n+=3)e.minX=Math.min(e.minX,t[n]),e.minY=Math.min(e.minY,t[n+1]),e.maxX=Math.max(e.maxX,t[n]),e.maxY=Math.max(e.maxY,t[n+1])}function Ci(e,t,n,r){if(t.geometry){var i=t.geometry.coordinates,o=t.geometry.type,s=Math.pow(n.tolerance/((1<<n.maxZoom)*n.extent),2),a=[],l=t.id;if(n.promoteId?l=t.properties[n.promoteId]:n.generateId&&(l=r||0),"Point"===o)Ri(i,a);else if("MultiPoint"===o)for(var u=0;u<i.length;u++)Ri(i[u],a);else if("LineString"===o)Ni(i,a,s,!1);else if("MultiLineString"===o){if(n.lineMetrics){for(u=0;u<i.length;u++)a=[],Ni(i[u],a,s,!1),e.push(Oi(l,"LineString",a,t.properties));return}Pi(i,a,s,!1)}else if("Polygon"===o)Pi(i,a,s,!0);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(u=0;u<t.geometry.geometries.length;u++)Ci(e,{id:l,geometry:t.geometry.geometries[u],properties:t.properties},n,r);return}throw new Error("Input data is not a valid GeoJSON object.")}for(u=0;u<i.length;u++){var c=[];Pi(i[u],c,s,!0),a.push(c)}}e.push(Oi(l,o,a,t.properties))}}function Ri(e,t){t.push(Mi(e[0])),t.push(Di(e[1])),t.push(0)}function Ni(e,t,n,r){for(var i,o,s=0,a=0;a<e.length;a++){var l=Mi(e[a][0]),u=Di(e[a][1]);t.push(l),t.push(u),t.push(0),a>0&&(s+=r?(i*u-l*o)/2:Math.sqrt(Math.pow(l-i,2)+Math.pow(u-o,2))),i=l,o=u}var c=t.length-3;t[2]=1,Ti(t,0,c,n),t[c+2]=1,t.size=Math.abs(s),t.start=0,t.end=t.size}function Pi(e,t,n,r){for(var i=0;i<e.length;i++){var o=[];Ni(e[i],o,n,r),t.push(o)}}function Mi(e){return e/360+.5}function Di(e){var t=Math.sin(e*Math.PI/180),n=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return n<0?0:n>1?1:n}function Ii(e,t,n,r,i,o,s,a){if(r/=t,o>=(n/=t)&&s<r)return e;if(s<n||o>=r)return null;for(var l=[],u=0;u<e.length;u++){var c=e[u],d=c.geometry,h=c.type,p=0===i?c.minX:c.minY,f=0===i?c.maxX:c.maxY;if(p>=n&&f<r)l.push(c);else if(!(f<n||p>=r)){var m=[];if("Point"===h||"MultiPoint"===h)zi(d,m,n,r,i);else if("LineString"===h)Fi(d,m,n,r,i,!1,a.lineMetrics);else if("MultiLineString"===h)ji(d,m,n,r,i,!1);else if("Polygon"===h)ji(d,m,n,r,i,!0);else if("MultiPolygon"===h)for(var g=0;g<d.length;g++){var y=[];ji(d[g],y,n,r,i,!0),y.length&&m.push(y)}if(m.length){if(a.lineMetrics&&"LineString"===h){for(g=0;g<m.length;g++)l.push(Oi(c.id,h,m[g],c.tags));continue}"LineString"!==h&&"MultiLineString"!==h||(1===m.length?(h="LineString",m=m[0]):h="MultiLineString"),"Point"!==h&&"MultiPoint"!==h||(h=3===m.length?"Point":"MultiPoint"),l.push(Oi(c.id,h,m,c.tags))}}}return l.length?l:null}function zi(e,t,n,r,i){for(var o=0;o<e.length;o+=3){var s=e[o+i];s>=n&&s<=r&&(t.push(e[o]),t.push(e[o+1]),t.push(e[o+2]))}}function Fi(e,t,n,r,i,o,s){for(var a,l,u=Li(e),c=0===i?Bi:Vi,d=e.start,h=0;h<e.length-3;h+=3){var p=e[h],f=e[h+1],m=e[h+2],g=e[h+3],y=e[h+4],b=0===i?p:f,v=0===i?g:y,_=!1;s&&(a=Math.sqrt(Math.pow(p-g,2)+Math.pow(f-y,2))),b<n?v>n&&(l=c(u,p,f,g,y,n),s&&(u.start=d+a*l)):b>r?v<r&&(l=c(u,p,f,g,y,r),s&&(u.start=d+a*l)):$i(u,p,f,m),v<n&&b>=n&&(l=c(u,p,f,g,y,n),_=!0),v>r&&b<=r&&(l=c(u,p,f,g,y,r),_=!0),!o&&_&&(s&&(u.end=d+a*l),t.push(u),u=Li(e)),s&&(d+=a)}var x=e.length-3;p=e[x],f=e[x+1],m=e[x+2],(b=0===i?p:f)>=n&&b<=r&&$i(u,p,f,m),x=u.length-3,o&&x>=3&&(u[x]!==u[0]||u[x+1]!==u[1])&&$i(u,u[0],u[1],u[2]),u.length&&t.push(u)}function Li(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function ji(e,t,n,r,i,o){for(var s=0;s<e.length;s++)Fi(e[s],t,n,r,i,o,!1)}function $i(e,t,n,r){e.push(t),e.push(n),e.push(r)}function Bi(e,t,n,r,i,o){var s=(o-t)/(r-t);return e.push(o),e.push(n+(i-n)*s),e.push(1),s}function Vi(e,t,n,r,i,o){var s=(o-n)/(i-n);return e.push(t+(r-t)*s),e.push(o),e.push(1),s}function Ui(e,t){for(var n=[],r=0;r<e.length;r++){var i,o=e[r],s=o.type;if("Point"===s||"MultiPoint"===s||"LineString"===s)i=Wi(o.geometry,t);else if("MultiLineString"===s||"Polygon"===s){i=[];for(var a=0;a<o.geometry.length;a++)i.push(Wi(o.geometry[a],t))}else if("MultiPolygon"===s)for(i=[],a=0;a<o.geometry.length;a++){for(var l=[],u=0;u<o.geometry[a].length;u++)l.push(Wi(o.geometry[a][u],t));i.push(l)}n.push(Oi(o.id,s,i,o.tags))}return n}function Wi(e,t){var n=[];n.size=e.size,void 0!==e.start&&(n.start=e.start,n.end=e.end);for(var r=0;r<e.length;r+=3)n.push(e[r]+t,e[r+1],e[r+2]);return n}function qi(e,t){if(e.transformed)return e;var n,r,i,o=1<<e.z,s=e.x,a=e.y;for(n=0;n<e.features.length;n++){var l=e.features[n],u=l.geometry,c=l.type;if(l.geometry=[],1===c)for(r=0;r<u.length;r+=2)l.geometry.push(Gi(u[r],u[r+1],t,o,s,a));else for(r=0;r<u.length;r++){var d=[];for(i=0;i<u[r].length;i+=2)d.push(Gi(u[r][i],u[r][i+1],t,o,s,a));l.geometry.push(d)}}return e.transformed=!0,e}function Gi(e,t,n,r,i,o){return[Math.round(n*(e*r-i)),Math.round(n*(t*r-o))]}function Hi(e,t,n,r,i){for(var o=t===i.maxZoom?0:i.tolerance/((1<<t)*i.extent),s={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:n,y:r,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},a=0;a<e.length;a++){s.numFeatures++,Yi(s,e[a],o,i);var l=e[a].minX,u=e[a].minY,c=e[a].maxX,d=e[a].maxY;l<s.minX&&(s.minX=l),u<s.minY&&(s.minY=u),c>s.maxX&&(s.maxX=c),d>s.maxY&&(s.maxY=d)}return s}function Yi(e,t,n,r){var i=t.geometry,o=t.type,s=[];if("Point"===o||"MultiPoint"===o)for(var a=0;a<i.length;a+=3)s.push(i[a]),s.push(i[a+1]),e.numPoints++,e.numSimplified++;else if("LineString"===o)Ki(s,i,e,n,!1,!1);else if("MultiLineString"===o||"Polygon"===o)for(a=0;a<i.length;a++)Ki(s,i[a],e,n,"Polygon"===o,0===a);else if("MultiPolygon"===o)for(var l=0;l<i.length;l++){var u=i[l];for(a=0;a<u.length;a++)Ki(s,u[a],e,n,!0,0===a)}if(s.length){var c=t.tags||null;if("LineString"===o&&r.lineMetrics){for(var d in c={},t.tags)c[d]=t.tags[d];c.mapbox_clip_start=i.start/i.size,c.mapbox_clip_end=i.end/i.size}var h={geometry:s,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:c};null!==t.id&&(h.id=t.id),e.features.push(h)}}function Ki(e,t,n,r,i,o){var s=r*r;if(r>0&&t.size<(i?s:r))n.numPoints+=t.length/3;else{for(var a=[],l=0;l<t.length;l+=3)(0===r||t[l+2]>s)&&(n.numSimplified++,a.push(t[l]),a.push(t[l+1])),n.numPoints++;i&&function(e,t){for(var n=0,r=0,i=e.length,o=i-2;r<i;o=r,r+=2)n+=(e[r]-e[o])*(e[r+1]+e[o+1]);if(n>0===t)for(r=0,i=e.length;r<i/2;r+=2){var s=e[r],a=e[r+1];e[r]=e[i-2-r],e[r+1]=e[i-1-r],e[i-2-r]=s,e[i-1-r]=a}}(a,o),e.push(a)}}function Xi(e,t){return new Zi(e,t)}function Zi(e,t){var n=(t=this.options=function(e,t){for(var n in t)e[n]=t[n];return e}(Object.create(this.options),t)).debug;if(n&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");var r=function(e,t){var n=[];if("FeatureCollection"===e.type)for(var r=0;r<e.features.length;r++)Ci(n,e.features[r],t,r);else"Feature"===e.type?Ci(n,e,t):Ci(n,{geometry:e},t);return n}(e,t);this.tiles={},this.tileCoords=[],n&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),r=function(e,t){var n=t.buffer/t.extent,r=e,i=Ii(e,1,-1-n,n,0,-1,2,t),o=Ii(e,1,1-n,2+n,0,-1,2,t);return(i||o)&&(r=Ii(e,1,-n,1+n,0,-1,2,t)||[],i&&(r=Ui(i,1).concat(r)),o&&(r=r.concat(Ui(o,-1)))),r}(r,t),r.length&&this.splitTile(r,0,0,0),n&&(r.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function Ji(e,t,n){return 32*((1<<e)*n+t)+e}we.register("MVT",()=>Ei),Zi.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},Zi.prototype.splitTile=function(e,t,n,r,i,o,s){for(var a=[e,t,n,r],l=this.options,u=l.debug;a.length;){r=a.pop(),n=a.pop(),t=a.pop(),e=a.pop();var c=1<<t,d=Ji(t,n,r),h=this.tiles[d];if(!h&&(u>1&&console.time("creation"),h=this.tiles[d]=Hi(e,t,n,r,l),this.tileCoords.push({z:t,x:n,y:r}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,n,r,h.numFeatures,h.numPoints,h.numSimplified),console.timeEnd("creation"));var p="z"+t;this.stats[p]=(this.stats[p]||0)+1,this.total++}if(h.source=e,i){if(t===l.maxZoom||t===i)continue;var f=1<<i-t;if(n!==Math.floor(o/f)||r!==Math.floor(s/f))continue}else if(t===l.indexMaxZoom||h.numPoints<=l.indexMaxPoints)continue;if(h.source=null,0!==e.length){u>1&&console.time("clipping");var m,g,y,b,v,_,x=.5*l.buffer/l.extent,w=.5-x,E=.5+x,S=1+x;m=g=y=b=null,v=Ii(e,c,n-x,n+E,0,h.minX,h.maxX,l),_=Ii(e,c,n+w,n+S,0,h.minX,h.maxX,l),e=null,v&&(m=Ii(v,c,r-x,r+E,1,h.minY,h.maxY,l),g=Ii(v,c,r+w,r+S,1,h.minY,h.maxY,l),v=null),_&&(y=Ii(_,c,r-x,r+E,1,h.minY,h.maxY,l),b=Ii(_,c,r+w,r+S,1,h.minY,h.maxY,l),_=null),u>1&&console.timeEnd("clipping"),a.push(m||[],t+1,2*n,2*r),a.push(g||[],t+1,2*n,2*r+1),a.push(y||[],t+1,2*n+1,2*r),a.push(b||[],t+1,2*n+1,2*r+1)}}},Zi.prototype.getTile=function(e,t,n){var r=this.options,i=r.extent,o=r.debug;if(e<0||e>24)return null;var s=1<<e,a=Ji(e,t=(t%s+s)%s,n);if(this.tiles[a])return qi(this.tiles[a],i);o>1&&console.log("drilling down to z%d-%d-%d",e,t,n);for(var l,u=e,c=t,d=n;!l&&u>0;)u--,c=Math.floor(c/2),d=Math.floor(d/2),l=this.tiles[Ji(u,c,d)];return l&&l.source?(o>1&&console.log("found parent tile z%d-%d-%d",u,c,d),o>1&&console.time("drilling down"),this.splitTile(l.source,u,c,d,e,t,n),o>1&&console.timeEnd("drilling down"),this.tiles[a]?qi(this.tiles[a],i):null):null};class Qi extends Se{constructor(e,t){super(e,t),this.load_data=null,this.tile_indexes={},this.setTileSize(512),this.pad_scale=0}_load(e){return this.load_data||(this.load_data=super._load({source_data:{layers:{}}}).then(e=>{e.source_data.error&&g("warn",`data source load error(s) for source '${this.name}', URL '${this.url}': ${e.source_data.error}`);let t=e.source_data.layers;for(let e in t)this.tile_indexes[e]=Xi(t[e],{maxZoom:this.max_zoom,tolerance:1.5,extent:U.tile_scale,buffer:1e-4});return this.loaded=!0,e})),this.load_data.then(()=>{for(let t in this.tile_indexes)e.source_data.layers[t]=this.getTileFeatures(e,t);return e})}getTileFeatures(e,t){let n,r=U.wrapTile(e.coords,{x:!0}),i=this.tile_indexes[t].getTile(r.z,r.x,r.y);if(i&&i.features){n={type:"FeatureCollection",features:[]};for(let e=0;e<i.features.length;e++){const t=i.features[e];let r={type:"Feature",geometry:{},id:t.id,properties:t.tags};if(1===t.type)r.geometry.coordinates=t.geometry.map(e=>[e[0],e[1]]),r.geometry.type="MultiPoint";else{if(2!==t.type&&3!==t.type)continue;if(r.geometry.coordinates=t.geometry.map(e=>e.map(e=>[e[0],e[1]])),2===t.type)r.geometry.type="MultiLineString";else if(r.geometry=Si(r.geometry),null==r.geometry)continue}n.features.push(r)}}return n}formatURL(){return this.url}parseSourceData(e,t,n){let r="string"==typeof n?JSON.parse(n):n,i=this.getLayers(r);t.layers=this.preprocessLayers(i,e)}preprocessLayers(e,t){for(let t in e){let n=e[t];n.features=this.preprocessFeatures(n.features)}if("function"==typeof this.transform){const n={min:Object.assign({},t.min),max:Object.assign({},t.max),coords:Object.assign({},t.coords)};1===Object.keys(e).length&&e._default?e._default=this.transform(e._default,this.extra_data,n):e=this.transform(e,this.extra_data,n)}return e}preprocessFeatures(e){if(e=e.filter(e=>null!=e.geometry),this.config.generate_label_centroids){let t=[],n={label_placement:!0};e.forEach(e=>{let r,i;if("Polygon"===e.geometry.type)r=e.geometry.coordinates,i=to(r,e.id,e.properties,n),t.push(i);else if("MultiPolygon"===e.geometry.type){r=e.geometry.coordinates;let o=-1/0,s=0;for(let e=0;e<r.length;e++){let t=U.polygonArea(r[e]);t>o&&(o=t,s=e)}i=to(r[s],e.id,e.properties,n),t.push(i)}}),t=t.filter(e=>e),Array.prototype.push.apply(e,t)}return e}getLayers(e){return"Feature"===e.type?{_default:{type:"FeatureCollection",features:[e]}}:"FeatureCollection"===e.type?{_default:e}:e}}class eo extends Te{constructor(e,t){super(e,t)}parseSourceData(e,t,n){let r="string"==typeof n?JSON.parse(n):n;this.prepareGeoJSON(r,e,t)}prepareGeoJSON(e,t,n){if("function"==typeof this.transform){const n={min:Object.assign({},t.min),max:Object.assign({},t.max),coords:Object.assign({},t.coords)};e=this.transform(e,this.extra_data,n)}n.layers=Qi.prototype.getLayers(e);let r={coords:t.coords,min:U.metersForTile(U.wrapTile(t.coords,{x:!0}))};we.projectData(n),we.scaleData(n,r)}}function to(e,t,n,r){let i=U.centroid(e);if(!i)return;let o={};return Object.assign(o,n,r),{type:"Feature",id:t,properties:o,geometry:{type:"Point",coordinates:i}}}function no(e){return e}function ro(e,t){var n=t.id,r=t.bbox,i=null==t.properties?{}:t.properties,o=function(e,t){var n=function(e){if(null==(t=e.transform))return no;var t,n,r,i=t.scale[0],o=t.scale[1],s=t.translate[0],a=t.translate[1];return function(e,t){return t||(n=r=0),e[0]=(n+=e[0])*i+s,e[1]=(r+=e[1])*o+a,e}}(e),r=e.arcs;function i(e,t){t.length&&t.pop();for(var i=r[e<0?~e:e],o=0,s=i.length;o<s;++o)t.push(n(i[o].slice(),o));e<0&&function(e,t){for(var n,r=e.length,i=r-t;i<--r;)n=e[i],e[i++]=e[r],e[r]=n}(t,s)}function o(e){return n(e.slice())}function s(e){for(var t=[],n=0,r=e.length;n<r;++n)i(e[n],t);return t.length<2&&t.push(t[0].slice()),t}function a(e){for(var t=s(e);t.length<4;)t.push(t[0].slice());return t}function l(e){return e.map(a)}return function e(t){var n,r=t.type;switch(r){case"GeometryCollection":return{type:r,geometries:t.geometries.map(e)};case"Point":n=o(t.coordinates);break;case"MultiPoint":n=t.coordinates.map(o);break;case"LineString":n=s(t.arcs);break;case"MultiLineString":n=t.arcs.map(s);break;case"Polygon":n=l(t.arcs);break;case"MultiPolygon":n=t.arcs.map(l);break;default:return null}return{type:r,coordinates:n}}(t)}(e,t);return null==n&&null==r?{type:"Feature",properties:i,geometry:o}:null==r?{type:"Feature",id:n,properties:i,geometry:o}:{type:"Feature",id:n,bbox:r,properties:i,geometry:o}}we.register("GeoJSON",e=>eo.urlHasTilePattern(e.url)?eo:Qi);class io extends Qi{parseSourceData(e,t,n){let r="string"==typeof n?JSON.parse(n):n;r=this.toGeoJSON(r);let i=this.getLayers(r);super.preprocessLayers(i,e),t.layers=i}toGeoJSON(e){if(e.objects&&1===Object.keys(e.objects).length){let t=Object.keys(e.objects)[0];e=oo(e,e.objects[t])}else{let t={};for(let n in e.objects)t[n]=oo(e,e.objects[n]);e=t}return e}}function oo(e,t){let n=function(e,t){return"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map(function(t){return ro(e,t)})}:ro(e,t)}(e,t);return"Feature"===n.type&&(n={type:"FeatureCollection",features:[n]}),n}class so extends eo{constructor(e,t){super(e,t)}parseSourceData(e,t,n){let r="string"==typeof n?JSON.parse(n):n;r=io.prototype.toGeoJSON(r),this.prepareGeoJSON(r,e,t)}}we.register("TopoJSON",e=>so.urlHasTilePattern(e.url)?so:io),e.Collision=Wt,e.DataSource=we,e.FeatureSelection=de,e.FilterOptions=Hr,e.FontManager=rn,e.GLSL=A,e.Geo=U,e.Label=$t,e.LabelLineStraight=mr,e.LabelPoint=qt,e.Light=ve,e.Material=ge,e.OBB=jt,e.ShaderProgram=j,e.Style=Ne,e.StyleManager=class{constructor(){this.styles={},this.base_styles={},this.active_styles=[],this.active_blend_orders=[],this.register(Object.create(et)),this.register(Object.create(_t)),this.register(Object.create(cr)),this.register(Object.create(xr)),this.register(Object.create(wr))}init(){j.removeBlock("global"),j.removeBlock("setup"),j.addBlock("global","#ifdef TANGRAM_VERTEX_SHADER\n\n// Apply layer ordering to avoid z-fighting\nvoid applyLayerOrder (float layer, inout vec4 position) {\n position.z -= layer * TANGRAM_LAYER_DELTA * position.w;\n}\n\n// Vertex position in model space: [0, 1] range over the local tile\n// Note positions can be outside that range due to unclipped geometry, geometry higher than a unit cube, etc.\nvec4 modelPosition() {\n return\n vec4(\n a_position.xyz / TANGRAM_TILE_SCALE // scale coords to ~0-1 range\n * exp2(u_tile_origin.z - u_tile_origin.w), // adjust for tile overzooming\n 1.)\n + vec4(0., 1., 0., 0.);\n // NB: additional offset to account for unusual Tangram JS y coords,\n // should be refactored to remove\n}\n\n// Position in model space as above, but according to tile coordinate (as opposed to style) zoom\n// e.g. unadjusted for tile overzooming\nvec4 modelPositionBaseZoom() {\n return\n vec4(\n a_position.xyz / TANGRAM_TILE_SCALE, // scale coords to ~0-1 range\n 1.)\n + vec4(0., 1., 0., 0.); // see note on offset above\n}\n\n#endif\n\n// Vertex position in world coordinates, useful for 3d procedural textures, etc.\nvec4 worldPosition() {\n return v_world_position;\n}\n\n// Optionally wrap world coordinates (allows more precision at higher zooms)\n// e.g. at wrap 1000, the world space will wrap every 1000 meters\n#ifdef TANGRAM_VERTEX_SHADER\n\nvec4 wrapWorldPosition(vec4 world_position) {\n #if defined(TANGRAM_WORLD_POSITION_WRAP)\n vec2 anchor = u_tile_origin.xy - mod(u_tile_origin.xy, TANGRAM_WORLD_POSITION_WRAP);\n world_position.xy -= anchor;\n #endif\n return world_position;\n}\n\n#endif\n\n// Normal in world space\n#if defined(TANGRAM_VERTEX_SHADER)\n\nvec3 worldNormal() {\n return TANGRAM_NORMAL;\n}\n\n#elif defined(TANGRAM_FRAGMENT_SHADER)\n\nvec3 worldNormal() {\n return u_inverseNormalMatrix * TANGRAM_NORMAL;\n}\n\n#endif\n"),j.addBlock("global","// Vertex attribute + varying for feature selection\n#if defined(TANGRAM_FEATURE_SELECTION) && defined(TANGRAM_VERTEX_SHADER)\n attribute vec4 a_selection_color;\n varying vec4 v_selection_color;\n#endif\n"),j.replaceBlock("setup","// Selection pass-specific rendering\n#if defined(TANGRAM_FEATURE_SELECTION) && defined(TANGRAM_VERTEX_SHADER)\n if (a_selection_color.rgb == vec3(0.)) {\n // Discard by forcing invalid triangle if we're in the feature\n // selection pass but have no selection info\n // TODO: in some cases we may actually want non-selectable features to occlude selectable ones?\n gl_Position = vec4(0., 0., 0., 1.);\n return;\n }\n v_selection_color = a_selection_color;\n#endif\n"),j.defines.TANGRAM_EPSILON=1e-5,j.defines.TANGRAM_LAYER_DELTA=1/16384,j.defines.TANGRAM_TILE_SCALE=`vec3(${U.tile_scale}., ${U.tile_scale}., u_meters_per_pixel * ${U.tile_size}.)`,j.defines.TANGRAM_HEIGHT_SCALE=U.height_scale,j.defines.TANGRAM_ALPHA_TEST=.5}destroy(e){Object.keys(this.styles).forEach(t=>{let n=this.styles[t];n.gl===e&&(g("trace",`StyleManager.destroy: destroying render style ${n.name}`),n.base&&this.remove(n.name),n.destroy())})}register(e){this.styles[e.name]=e,this.base_styles[e.name]=e}remove(e){delete this.styles[e]}getActiveStyles(){return this.active_styles}updateActiveStyles(e){return this.active_styles=Object.keys(e.reduce((e,t)=>(Object.keys(t.meshes).forEach(t=>e[t]=!0),e),{})),this.active_styles}getActiveBlendOrders(){return this.active_blend_orders}updateActiveBlendOrders(e){const t=[];e.forEach(e=>{Object.entries(e.meshes).forEach(([e,n])=>{n.forEach(n=>{const r=n.variant.blend_order;let i=t.findIndex(e=>e.blend_order===r);i=i>-1?i:t.push({blend_order:r,styles:[]})-1,-1===t[i].styles.indexOf(e)&&t[i].styles.push(e)})})}),this.active_blend_orders=t.sort((e,t)=>e.blend_order-t.blend_order)}mix(e,t){if(e.mixed)return e;e.mixed={};let n=[];e.mix&&(Array.isArray(e.mix)?n.push(...e.mix):n.push(e.mix),n=n.map(e=>t[e]).filter(t=>t&&t!==e),n.forEach(t=>e.mixed[t.name]=!0)),n.push(e),e.animated=n.some(e=>e&&e.animated),e.texcoords=n.some(e=>e&&e.texcoords),e.base=n.map(e=>e.base).filter(e=>e).pop(),e.lighting=n.map(e=>e.lighting).filter(e=>null!=e).pop(),e.texture=n.map(e=>e.texture).filter(e=>e).pop(),e.raster=n.map(e=>e.raster).filter(e=>null!=e).pop(),e.dash=n.map(e=>e.dash).filter(e=>null!=e).pop(),e.dash_background_color=n.map(e=>e.dash_background_color).filter(e=>null!=e).pop(),n.some(e=>Object.prototype.hasOwnProperty.call(e,"blend")&&e.blend)&&(e.blend=n.map(e=>Object.prototype.hasOwnProperty.call(e,"blend")&&e.blend).filter(e=>e).pop()),e.blend_order=n.map(e=>e.blend_order).filter(e=>null!=e).pop(),e.defines=Object.assign({},...n.map(e=>e.defines).filter(e=>e)),e.material=Object.assign({},...n.map(e=>e.material).filter(e=>e));let r=n.map(e=>e.draw).filter(e=>e);return r.length>0&&(e.draw=V({},...r)),this.mixShaders(e,t,n),e}mixShaders(e,t,n){let r={},i=n.map(e=>e.shaders).filter(e=>e);if(r.defines=Object.assign({},...i.map(e=>e.defines).filter(e=>e)),r.attributes=Object.assign({},...i.map(e=>e.attributes).filter(e=>e)),r.uniforms={},r._uniforms=e.shaders&&e.shaders.uniforms||{},r._uniform_scopes={},n.filter(e=>e.shaders&&e.shaders.uniforms).forEach(e=>{for(let n in e.shaders.uniforms)r._uniform_scopes[n]=e.name,Object.defineProperty(r.uniforms,n,{enumerable:!0,configurable:!0,get:function(){return void 0!==r._uniforms[n]?r._uniforms[n]:t[r._uniform_scopes[n]].shaders.uniforms!==r.uniforms?t[r._uniform_scopes[n]].shaders.uniforms[n]:void 0},set:function(e){r._uniforms[n]=e}})}),r.extensions=Object.keys(i.map(e=>e.extensions).filter(e=>e).reduce((e,t)=>("string"==typeof t?e[t]=!0:t.forEach(t=>e[t]=!0),e),{})||{}),e.shaders&&e.shaders.blocks){e.shaders.block_scopes=e.shaders.block_scopes||{};for(let t in e.shaders.blocks){let n=e.shaders.blocks[t];e.shaders.block_scopes[t]=e.shaders.block_scopes[t]||[],Array.isArray(n)?e.shaders.block_scopes[t].push(...n.map(()=>e.name)):e.shaders.block_scopes[t].push(e.name)}}let o={};return i.forEach(e=>{if(!e.blocks)return;r.blocks=r.blocks||{},r.block_scopes=r.block_scopes||{};let t={};for(let n in e.blocks){let i=e.blocks[n],s=e.block_scopes[n];r.blocks[n]=r.blocks[n]||[],r.block_scopes[n]=r.block_scopes[n]||[],i=Array.isArray(i)?i:[i],s=Array.isArray(s)?s:[s];for(let e=0;e<i.length;e++)o[s[e]]||(t[s[e]]=!0,r.blocks[n].push(i[e]),r.block_scopes[n].push(s[e]))}Object.assign(o,t)}),Object.assign(e.mixed,o),e.shaders=r,e}create(e,t,n={}){let r=V({},t);return r.name=e,r=this.mix(r,n),r.base&&this.base_styles[r.base]?this.styles[e]=r=Object.assign(Object.create(this.base_styles[r.base]),r):r.base=null,r}build(e){const t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Er(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Er(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},e);this.styles&&Object.values(this.styles).forEach(e=>a.removeTarget(e.main_thread_target));const n=["opaque","add","multiply","overlay","inlay","translucent"],r=["polygons","lines","points","text","raster"];for(const e of n)for(const n of r){const r=e+"_"+n;null==t[r]&&(t[r]={base:n,blend:e})}let o=Object.keys(t).sort((e,n)=>this.inheritanceDepth(e,t)-this.inheritanceDepth(n,t));for(let e in this.styles)this.base_styles[e]?this.styles[e].reset():delete this.styles[e];let s={};return o.forEach(e=>{s[e]=this.create(e,t[e],s)}),this.styles}initStyles(e={}){for(let t in this.styles)this.styles[t].init(e)}inheritanceDepth(e,t){let n=0;for(;;){let r=t[e];if(!r)break;if(!r.mix)break;if(n++,Array.isArray(r.mix)){n+=Math.max(...r.mix.map(n=>{if(e!==n)return this.inheritanceDepth(n,t)}));break}if(e===r.mix)break;e=r.mix}return n}},e.StyleParser=Q,e.Task=S,e.TextCanvas=En,e.Texture=O,e.Thread=t,e.Tile=ti,e.TileID=ke,e.Utils=y,e.Vector=be,e.VertexArrayObject=B,e.VertexData=Fe,e.VertexElements=Ie,e.View=class{constructor(e,t){T(this),this.scene=e,this.createMatrices(),this.zoom=null,this.center=null,this.bounds=null,this.meters_per_pixel=null,this.panning=!1,this.panning_stop_at=0,this.pan_snap_timer=0,this.zoom_direction=0,this.user_input_at=0,this.user_input_timeout=50,this.user_input_active=!1,this.size={css:{},device:{},meters:{}},this.aspect=null,this.buffer=0,this.continuous_zoom="boolean"!=typeof t.continuousZoom||t.continuousZoom,this.wrap=!1!==t.wrapView,this.preserve_tiles_within_zoom=1,this.reset()}reset(){this.createCamera()}createCamera(){let e=this.getActiveCamera();e&&(this.camera=or.create(e,this,this.scene.config.cameras[e]),this.camera.updateView())}getActiveCamera(){if(this.scene.config&&this.scene.config.cameras){for(let e in this.scene.config.cameras)if(this.scene.config.cameras[e].active)return e;let e=Object.keys(this.scene.config.cameras);return e.length&&e[0]}}setActiveCamera(e){let t=this.getActiveCamera();return t===e?e:(this.scene.config.cameras[e]&&(this.scene.config.cameras[e].active=!0,t&&this.scene.config.cameras[t]&&delete this.scene.config.cameras[t].active),this.scene.updateConfig({rebuild:!1,normalize:!1}),this.getActiveCamera())}update(){null!=this.camera&&this.ready()&&this.camera.update(),this.pan_snap_timer=(+new Date-this.panning_stop_at)/1e3,this.user_input_active=+new Date-this.user_input_at<this.user_input_timeout}setViewportSize(e,t){this.size.css={width:e,height:t},this.size.device={width:Math.round(this.size.css.width*y.device_pixel_ratio),height:Math.round(this.size.css.height*y.device_pixel_ratio)},this.aspect=this.size.css.width/this.size.css.height,this.updateBounds()}setView({lng:e,lat:t,zoom:n}={}){var r=!1;return"number"==typeof e&&"number"==typeof t&&(this.center&&e===this.center.lng&&t===this.center.lat||(r=!0,this.center={lng:e,lat:t})),"number"==typeof n&&n!==this.zoom&&(r=!0,this.setZoom(n)),r&&this.updateBounds(),r}setZoom(e){let t=this.tile_zoom,n=this.baseZoom(e);this.continuous_zoom||(e=n),n!==t&&(this.zoom_direction=n>t?1:-1),this.zoom=e,this.tile_zoom=n,this.updateBounds(),this.scene.requestRedraw()}baseZoom(e){return Math.floor(e)}setPanning(e){this.panning=e,this.panning||(this.panning_stop_at=+new Date)}markUserInput(){this.user_input_at=+new Date}ready(){return"number"==typeof this.size.css.width&&"number"==typeof this.size.css.height&&null!=this.center&&"number"==typeof this.zoom}updateBounds(){if(!this.ready())return;this.meters_per_pixel=U.metersPerPixel(this.zoom),this.size.meters={x:this.size.css.width*this.meters_per_pixel,y:this.size.css.height*this.meters_per_pixel};const e=U.latLngToMeters([this.center.lng,this.center.lat]);this.center.meters={x:e[0],y:e[1]},this.center.tile=U.tileForMeters([this.center.meters.x,this.center.meters.y],this.tile_zoom),this.bounds={sw:{x:this.center.meters.x-this.size.meters.x/2,y:this.center.meters.y-this.size.meters.y/2},ne:{x:this.center.meters.x+this.size.meters.x/2,y:this.center.meters.y+this.size.meters.y/2}},this.scene.tile_manager.updateTilesForView(),this.trigger("move"),this.scene.requestRedraw()}findVisibleTileCoordinates(){if(!this.bounds)return[];let e=this.tile_zoom,t=U.tileForMeters([this.bounds.sw.x,this.bounds.sw.y],e),n=U.tileForMeters([this.bounds.ne.x,this.bounds.ne.y],e),r=[t.x-this.buffer,n.x+this.buffer,n.y-this.buffer,t.y+this.buffer];if(!1===this.wrap){let t=(1<<e)-1;r=r.map(e=>Math.min(Math.max(0,e),t))}let i=[];for(let t=r[0];t<=r[1];t++)for(let n=r[2];n<=r[3];n++)i.push(ke.coord({x:t,y:n,z:e}));return i}pruneTilesForView(){this.ready()&&this.scene.tile_manager.removeTiles(e=>{if(e.visible||e.isProxy())return!1;if(e.loading&&e.style_z!==this.tile_zoom)return!0;if(Math.abs(e.style_z-this.tile_zoom)>(null!=e.preserve_tiles_within_zoom?e.preserve_tiles_within_zoom:this.preserve_tiles_within_zoom))return!0;const t=this.meters_per_pixel*U.tile_size,n=ke.coordAtZoom(U.tileForMeters([this.center.meters.x-this.size.meters.x/2-t,this.center.meters.y+this.size.meters.y/2+t],this.tile_zoom),e.coords.z),r=ke.coordAtZoom(U.tileForMeters([this.center.meters.x+this.size.meters.x/2+t,this.center.meters.y-this.size.meters.y/2-t],this.tile_zoom),e.coords.z);return(e.coords.x<n.x||e.coords.x>r.x||e.coords.y<n.y||e.coords.y>r.y)&&(g("trace",`View: remove tile ${e.key} (as ${e.coords.key}) for being too far out of visible area (${n.key}, ${r.key})`),!0)})}createMatrices(){this.matrices={},this.matrices.model=new Float64Array(16),this.matrices.model32=new Float32Array(16),this.matrices.model_view=new Float64Array(16),this.matrices.model_view32=new Float32Array(16),this.matrices.normal=new Float64Array(9),this.matrices.normal32=new Float32Array(9),this.matrices.inverse_normal32=new Float32Array(9)}setupTile(e,t){e.setupProgram(this.matrices,t),this.camera.setupMatrices(this.matrices,t)}setupProgram(e){e.uniform("2fv","u_resolution",[this.size.device.width,this.size.device.height]),e.uniform("3fv","u_map_position",[this.center.meters.x,this.center.meters.y,this.zoom]),e.uniform("1f","u_meters_per_pixel",this.meters_per_pixel),e.uniform("1f","u_device_pixel_ratio",y.device_pixel_ratio),e.uniform("1f","u_view_pan_snap_timer",this.pan_snap_timer),e.uniform("1i","u_view_panning",this.panning),this.camera.setupProgram(e)}isAnimating(){return this.pan_snap_timer<=.5}},e.WorkerBroker=a,e._defineProperty=i,e.addBaseURL=function(e,t){if(!e||!x(e))return e;var n,r="/"!==e[0];if(t?(n=document.createElement("a")).href=t:n=window.location,r)e=_(n.href)+e;else{let t=n.origin;t||(t=n.protocol+"//"+n.host),e=t+e}return e},e.buildFilter=jr,e.cache=H,e.clearFunctionStringCache=function(){H.functions={},H.num_functions=0,H.num_cached=0},e.compileFunctionStrings=Y,e.createObjectURL=function(e){return void 0===w&&(w=window.URL&&window.URL.createObjectURL||window.webkitURL&&window.webkitURL.createObjectURL,"function"!=typeof w&&(w=null,g("warn","window.URL.createObjectURL (or vendor prefix) not found, unable to create local blob URLs"))),w?w(e):e},e.debugSettings=v,e.debugSumLayerStats=function(e){let t={},n={};return e.filter(e=>e.debug.layers).forEach(e=>{Object.keys(e.debug.layers.list).forEach(n=>{let r=e.debug.layers.list[n];Pe(t,n,r.features,r.geoms,r.styles,r.base)}),ni(e.debug.layers.tree,n)}),{list:t,tree:n}},e.extensionForURL=function(e){let t=(e=e.split("/").pop()).lastIndexOf(".");if(t>-1)return e.substring(t+1)},e.flattenRelativeURL=function(e){let t=(e||"").split("/");for(let e=1;e<t.length;e++)"."===t[e]?(t.splice(e,1),e--):".."===t[e]&&(e+=0,t.splice(e-1,2),e--);return t.join("/")},e.getAugmentedNamespace=function(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n},e.getDefaultExportFromCjs=P,e.isLocalURL=function(e){if("string"==typeof e)return e.search(/^(data|blob):/)>-1},e.isRelativeURL=x,e.isReserved=Yr,e.layerCache=function(){return Br},e.log=g,e.mergeDebugSettings=function(e){Object.assign(b,e)},e.mergeObjects=V,e.parseLayers=function(e,t){Br={};let n={};for(let r in e){let i=e[r];i&&(n[r]=Kr(r,i,null,t))}return n},e.pathForURL=_,e.sliceObject=k,e.subscribeMixin=T,e.version=s}),aM(0,function(e){const t=Object.assign(self,{FeatureSelection:e.FeatureSelection,sources:{},styles:{},layers:{},tiles:{},init(t,n,r,i,o,s,a){return this.scene_id=t,this._worker_id=n,this.num_workers=r,e.log.setLevel(i),e.Utils.device_pixel_ratio=o,e.VertexElements.setElementIndexUint(s),e.FeatureSelection.setPrefix(this._worker_id),this.style_manager=new e.StyleManager,this.importExternalScripts(a),e.Label.id_prefix=n,e.Label.id_multiplier=r,n},importExternalScripts(t){if(0===t.length)return;e.log("debug","loading custom data source scripts in worker:",t);let n=Object.getOwnPropertyNames(window);importScripts(...t),Object.getOwnPropertyNames(window).forEach(e=>{-1===n.indexOf(e)&&(this[e]=window[e])})},updateConfig({config:t,generation:n,introspection:r},i){return t=JSON.parse(t),e.mergeDebugSettings(i),this.generation=n,this.introspection=r,this.global=e.compileFunctionStrings(t.global),this.createDataSources(t),t.styles=e.compileFunctionStrings(t.styles,e.StyleParser.wrapFunction),this.styles=this.style_manager.build(t.styles),this.style_manager.initStyles({generation:this.generation,styles:this.styles,sources:this.sources,introspection:this.introspection}),this.layers=e.parseLayers(t.layers,this.style_manager.styles),this.syncing_textures=this.syncTextures(t.textures),this.configuring=this.syncing_textures.then(()=>{e.log("debug","updated config")}),this.configuring},createDataSources(t){this.last_config_sources=this.config_sources||{},this.config_sources=e.mergeObjects({},t.sources);let n=this.sources,r=[];this.sources={};for(let i in t.sources){if(JSON.stringify(this.last_config_sources[i])===JSON.stringify(t.sources[i])){this.sources[i]=n[i];continue}let o;t.sources[i]=e.compileFunctionStrings(t.sources[i]);try{o=e.DataSource.create(Object.assign({},t.sources[i],{name:i}),this.sources)}catch(e){continue}o&&(this.sources[i]=o,r.push(i))}r.forEach(e=>{for(let t in this.tiles)this.tiles[t].source===e&&delete this.tiles[t]})},awaitConfiguration(){return this.configuring},buildTile({tile:t}){if(null==this.getTile(t.key)||!0!==this.getTile(t.key).loading)return t=this.tiles[t.key]=Object.assign(this.getTile(t.key)||{},t),this.awaitConfiguration().then(()=>{if(!0!==t.loaded)t.loading=!0,t.loaded=!1,t.error=null,this.loadTileSourceData(t).then(()=>{this.getTile(t.key)?(t.source_data.error&&e.log("warn",`tile load error(s) for ${t.key}: ${t.source_data.error}`),t.loading=!1,t.loaded=!0,e.Tile.buildGeometry(t,this)):e.log("trace",`stop tile build after data source load because tile was removed: ${t.key}`)}).catch(n=>{t.loading=!1,t.loaded=!1,t.error=n.stack,e.log("error",`tile load error for ${t.key}: ${t.error}`),e.WorkerBroker.postMessage(`TileManager_${this.scene_id}.buildTileError`,e.Tile.slice(t))});else{e.log("trace",`used worker cache for tile ${t.key}`);try{e.Tile.buildGeometry(t,this)}catch(n){t.error=n.toString(),e.WorkerBroker.postMessage(`TileManager_${this.scene_id}.buildTileError`,e.Tile.slice(t))}}})},loadTileSourceData(e){const t=this.sources[e.source];if(t){for(const n in this.tiles){const r=this.tiles[n];if(r.source===e.source&&r.coords.key===e.coords.key&&r.loaded)return Promise.resolve(t.copyTileData(r,e))}return t.load(e)}return e.source_data={},Promise.resolve(e)},getTile(e){return this.tiles[e]},removeTile(t){var n=this.tiles[t];null!=n&&(!0===n.loading&&(e.log("trace",`cancel tile load for ${t}`),n.loading=!1,e.Tile.cancel(n)),e.FeatureSelection.clearTile(t),delete this.tiles[t],e.log("trace",`remove tile from cache for ${t}`))},queryFeatures({filter:t,visible:n,geometry:r,tile_keys:i}){let o=[],s=i.map(e=>this.tiles[e]).filter(e=>e&&e.loaded);return null!=t&&(t=["{","["].indexOf(t[0])>-1?JSON.parse(t):t,t=e.compileFunctionStrings(t,e.StyleParser.wrapFunction)),t=e.buildFilter(t,e.FilterOptions),s.forEach(i=>{for(let s in i.source_data.layers){let a=i.source_data.layers[s];if(null==a)return;a.features.forEach(a=>{const l=a.generation===this.generation;if(!0===n&&!l||!1===n&&l)return;let u=e.StyleParser.getFeatureParseContext(a,i,this.global);if(u.source=i.source,u.layer=s,u.id=a.id,!t(u))return;let c={type:a.type,id:a.id,properties:Object.assign({},a.properties,{$source:u.source,$layer:u.layer,$geometry:u.geometry,$visible:l})};!0===r&&(c.geometry=e.Geo.copyGeometry(a.geometry),e.Geo.tileSpaceToLatlng(c.geometry,i.coords.z,i.min)),o.push(c)})}}),o},getFeatureSelection({id:t,key:n}={}){var r=e.FeatureSelection.map[n];return{id:t,feature:r&&r.feature}},resetFeatureSelection(t=null){e.FeatureSelection.reset(t)},getFeatureSelectionMapSize:()=>e.FeatureSelection.getMapSize(),syncTextures(t){let n=[];return t&&n.push(...Object.keys(t)),e.log("trace","sync textures to worker:",n),n.length>0?e.Texture.syncTexturesToWorker(n):Promise.resolve()},updateDevicePixelRatio(t){e.Utils.device_pixel_ratio=t},clearFunctionStringCache(){e.clearFunctionStringCache()},profile(e){console.profile(`worker ${this._worker_id}: ${e}`)},profileEnd(e){console.profileEnd(`worker ${this._worker_id}: ${e}`)},debug:{debugSettings:e.debugSettings,layerCache:e.layerCache,functionStringCache:e.cache}});e.WorkerBroker.addTarget("self",t)}),aM(0,function(e){var t,n=t={};let r=0;function i(e,t){var n;const r=t[t.length-1];return null===(n=s(e,t))||void 0===n?void 0:n[r]}function o(e,t,n){const r=t[t.length-1],i=s(e,t);i&&(i[r]=n)}function s(e,t){if(0===t.length)return;let n=e;for(let e=0;e<t.length-1;e++)if(n=n[t[e]],null==n)return;return n}t.getContext=function(e,n){var i=!1;null==e&&((e=document.createElement("canvas")).style.position="absolute",e.style.top=0,e.style.left=0,e.style.zIndex=-1,document.body.appendChild(e),i=!0),e.addEventListener("webglcontextlost",()=>{}),e.addEventListener("webglcontextrestored",()=>{});var o=e.getContext("webgl",n)||e.getContext("experimental-webgl",n);if(!o)throw new Error("Couldn't create WebGL context.");return o._tangram_id=r++,i?(t.resize(o,window.innerWidth,window.innerHeight,n.device_pixel_ratio),window.addEventListener("resize",function(){t.resize(o,window.innerWidth,window.innerHeight,n.device_pixel_ratio)})):t.resize(o,parseFloat(e.style.width),parseFloat(e.style.height),n.device_pixel_ratio),o},t.resize=function(e,t,n,r){r=r||window.devicePixelRatio||1,e.canvas.style.width=t+"px",e.canvas.style.height=n+"px",e.canvas.width=Math.round(t*r),e.canvas.height=Math.round(n*r),e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,e.canvas.width,e.canvas.height)};const a="global.",l="__global_prop";function u(e){return(null==e?void 0:e.slice(0,7))===a}function c(e,t){var n;const r=Array.isArray(t)?t:[t],i=s(e,r),o=r[r.length-1];return void 0!==(null==i||null===(n=i[l])||void 0===n?void 0:n[o])}function d(e,t=null,n={}){t=t?t+".":a;for(const r in e){const i=t+r,o=e[r];n[i]=o,"object"!=typeof o||Array.isArray(o)||d(o,i,n)}return n}function h(t,n,r,i){var o;let s;if(null!=r&&null!==(o=r[l])&&void 0!==o&&o[i]?s=r[l][i]:"string"==typeof n&&n.slice(0,7)===a&&(s=n),s){null==r[l]&&Object.defineProperty(r,l,{value:{}}),r[l][i]=s;let n,o=t[s];for(;"string"==typeof o&&o.slice(0,7)===a;){if(n=n||[s],n.indexOf(o)>-1){e.log({level:"warn",once:!0},"Global properties: cyclical reference detected",n),o=null;break}n.push(o),o=t[o]}Object.defineProperty(r,i,{enumerable:!0,get:function(){return o},set:function(e){delete r[l][i],delete r[i],r[i]=e}})}else if(Array.isArray(n))for(let e=0;e<n.length;e++)h(t,n[e],n,e);else if("object"==typeof n)for(const e in n)h(t,n[e],n,e);return n}var p="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},f=[],m=[],g="undefined"!=typeof Uint8Array?Uint8Array:Array,y=!1;function b(){y=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)f[t]=e[t],m[e.charCodeAt(t)]=t;m["-".charCodeAt(0)]=62,m["_".charCodeAt(0)]=63}function v(e,t,n){for(var r,i,o=[],s=t;s<n;s+=3)r=(e[s]<<16)+(e[s+1]<<8)+e[s+2],o.push(f[(i=r)>>18&63]+f[i>>12&63]+f[i>>6&63]+f[63&i]);return o.join("")}function _(e){var t;y||b();for(var n=e.length,r=n%3,i="",o=[],s=16383,a=0,l=n-r;a<l;a+=s)o.push(v(e,a,a+s>l?l:a+s));return 1===r?(t=e[n-1],i+=f[t>>2],i+=f[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=f[t>>10],i+=f[t>>4&63],i+=f[t<<2&63],i+="="),o.push(i),o.join("")}function x(e,t,n,r,i){var o,s,a=8*i-r-1,l=(1<<a)-1,u=l>>1,c=-7,d=n?i-1:0,h=n?-1:1,p=e[t+d];for(d+=h,o=p&(1<<-c)-1,p>>=-c,c+=a;c>0;o=256*o+e[t+d],d+=h,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=r;c>0;s=256*s+e[t+d],d+=h,c-=8);if(0===o)o=1-u;else{if(o===l)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=u}return(p?-1:1)*s*Math.pow(2,o-r)}function w(e,t,n,r,i,o){var s,a,l,u=8*o-i-1,c=(1<<u)-1,d=c>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,f=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+d>=1?h/l:h*Math.pow(2,1-d))*l>=2&&(s++,l/=2),s+d>=c?(a=0,s=c):s+d>=1?(a=(t*l-1)*Math.pow(2,i),s+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,i),s=0));i>=8;e[n+p]=255&a,p+=f,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;e[n+p]=255&s,p+=f,s/=256,u-=8);e[n+p-f]|=128*m}var E={}.toString,S=Array.isArray||function(e){return"[object Array]"==E.call(e)};A.TYPED_ARRAY_SUPPORT=void 0===p.TYPED_ARRAY_SUPPORT||p.TYPED_ARRAY_SUPPORT;var T=k();function k(){return A.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function O(e,t){if(k()<t)throw new RangeError("Invalid typed array length");return A.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=A.prototype:(null===e&&(e=new A(t)),e.length=t),e}function A(e,t,n){if(!(A.TYPED_ARRAY_SUPPORT||this instanceof A))return new A(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return N(this,e)}return C(this,e,t,n)}function C(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");return t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r),A.TYPED_ARRAY_SUPPORT?(e=t).__proto__=A.prototype:e=P(e,t),e}(e,t,n,r):"string"==typeof t?function(e,t,n){if("string"==typeof n&&""!==n||(n="utf8"),!A.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|I(t,n),i=(e=O(e,r)).write(t,n);return i!==r&&(e=e.slice(0,i)),e}(e,t,n):function(e,t){if(D(t)){var n=0|M(t.length);return 0===(e=O(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?O(e,0):P(e,t);if("Buffer"===t.type&&S(t.data))return P(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function R(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function N(e,t){if(R(t),e=O(e,t<0?0:0|M(t)),!A.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function P(e,t){var n=t.length<0?0:0|M(t.length);e=O(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function M(e){if(e>=k())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+k().toString(16)+" bytes");return 0|e}function D(e){return!(null==e||!e._isBuffer)}function I(e,t){if(D(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return le(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return ue(e).length;default:if(r)return le(e).length;t=(""+t).toLowerCase(),r=!0}}function z(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return Z(this,t,n);case"utf8":case"utf-8":return H(this,t,n);case"ascii":return K(this,t,n);case"latin1":case"binary":return X(this,t,n);case"base64":return G(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return J(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function F(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function L(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=A.from(t,r)),D(t))return 0===t.length?-1:j(e,t,n,r,i);if("number"==typeof t)return t&=255,A.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):j(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function j(e,t,n,r,i){var o,s=1,a=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,l/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var c=-1;for(o=n;o<a;o++)if(u(e,o)===u(t,-1===c?0:o-c)){if(-1===c&&(c=o),o-c+1===l)return c*s}else-1!==c&&(o-=o-c),c=-1}else for(n+l>a&&(n=a-l),o=n;o>=0;o--){for(var d=!0,h=0;h<l;h++)if(u(e,o+h)!==u(t,h)){d=!1;break}if(d)return o}return-1}function $(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[n+s]=a}return s}function B(e,t,n,r){return ce(le(t,e.length-n),e,n,r)}function V(e,t,n,r){return ce(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function U(e,t,n,r){return V(e,t,n,r)}function W(e,t,n,r){return ce(ue(t),e,n,r)}function q(e,t,n,r){return ce(function(e,t){for(var n,r,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)r=(n=e.charCodeAt(s))>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function G(e,t,n){return 0===t&&n===e.length?_(e):_(e.slice(t,n))}function H(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var o,s,a,l,u=e[i],c=null,d=u>239?4:u>223?3:u>191?2:1;if(i+d<=n)switch(d){case 1:u<128&&(c=u);break;case 2:128==(192&(o=e[i+1]))&&(l=(31&u)<<6|63&o)>127&&(c=l);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(l=(15&u)<<12|(63&o)<<6|63&s)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(l=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&l<1114112&&(c=l)}null===c?(c=65533,d=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=d}return function(e){var t=e.length;if(t<=Y)return String.fromCharCode.apply(String,e);for(var n="",r=0;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=Y));return n}(r)}A.poolSize=8192,A._augment=function(e){return e.__proto__=A.prototype,e},A.from=function(e,t,n){return C(null,e,t,n)},A.TYPED_ARRAY_SUPPORT&&(A.prototype.__proto__=Uint8Array.prototype,A.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&A[Symbol.species]),A.alloc=function(e,t,n){return function(e,t,n,r){return R(t),t<=0?O(e,t):void 0!==n?"string"==typeof r?O(e,t).fill(n,r):O(e,t).fill(n):O(e,t)}(null,e,t,n)},A.allocUnsafe=function(e){return N(null,e)},A.allocUnsafeSlow=function(e){return N(null,e)},A.isBuffer=de,A.compare=function(e,t){if(!D(e)||!D(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},A.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},A.concat=function(e,t){if(!S(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return A.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=A.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var o=e[n];if(!D(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},A.byteLength=I,A.prototype._isBuffer=!0,A.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)F(this,t,t+1);return this},A.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)F(this,t,t+3),F(this,t+1,t+2);return this},A.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)F(this,t,t+7),F(this,t+1,t+6),F(this,t+2,t+5),F(this,t+3,t+4);return this},A.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?H(this,0,e):z.apply(this,arguments)},A.prototype.equals=function(e){if(!D(e))throw new TypeError("Argument must be a Buffer");return this===e||0===A.compare(this,e)},A.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},A.prototype.compare=function(e,t,n,r,i){if(!D(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(r,i),u=e.slice(t,n),c=0;c<a;++c)if(l[c]!==u[c]){o=l[c],s=u[c];break}return o<s?-1:s<o?1:0},A.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},A.prototype.indexOf=function(e,t,n){return L(this,e,t,n,!0)},A.prototype.lastIndexOf=function(e,t,n){return L(this,e,t,n,!1)},A.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return $(this,e,t,n);case"utf8":case"utf-8":return B(this,e,t,n);case"ascii":return V(this,e,t,n);case"latin1":case"binary":return U(this,e,t,n);case"base64":return W(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return q(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},A.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Y=4096;function K(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function X(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function Z(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=t;o<n;++o)i+=ae(e[o]);return i}function J(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function Q(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function ee(e,t,n,r,i,o){if(!D(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function te(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i<o;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function ne(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i<o;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function re(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function ie(e,t,n,r,i){return i||re(e,0,n,4),w(e,t,n,r,23,4),n+4}function oe(e,t,n,r,i){return i||re(e,0,n,8),w(e,t,n,r,52,8),n+8}A.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),A.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=A.prototype;else{var i=t-e;n=new A(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+e]}return n},A.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||Q(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},A.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||Q(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},A.prototype.readUInt8=function(e,t){return t||Q(e,1,this.length),this[e]},A.prototype.readUInt16LE=function(e,t){return t||Q(e,2,this.length),this[e]|this[e+1]<<8},A.prototype.readUInt16BE=function(e,t){return t||Q(e,2,this.length),this[e]<<8|this[e+1]},A.prototype.readUInt32LE=function(e,t){return t||Q(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},A.prototype.readUInt32BE=function(e,t){return t||Q(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},A.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||Q(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},A.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||Q(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},A.prototype.readInt8=function(e,t){return t||Q(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},A.prototype.readInt16LE=function(e,t){t||Q(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},A.prototype.readInt16BE=function(e,t){t||Q(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},A.prototype.readInt32LE=function(e,t){return t||Q(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},A.prototype.readInt32BE=function(e,t){return t||Q(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},A.prototype.readFloatLE=function(e,t){return t||Q(e,4,this.length),x(this,e,!0,23,4)},A.prototype.readFloatBE=function(e,t){return t||Q(e,4,this.length),x(this,e,!1,23,4)},A.prototype.readDoubleLE=function(e,t){return t||Q(e,8,this.length),x(this,e,!0,52,8)},A.prototype.readDoubleBE=function(e,t){return t||Q(e,8,this.length),x(this,e,!1,52,8)},A.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||ee(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},A.prototype.writeUIntBE=function(e,t,n,r){e=+e,t|=0,n|=0,r||ee(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},A.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||ee(this,e,t,1,255,0),A.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},A.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||ee(this,e,t,2,65535,0),A.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):te(this,e,t,!0),t+2},A.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||ee(this,e,t,2,65535,0),A.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):te(this,e,t,!1),t+2},A.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||ee(this,e,t,4,4294967295,0),A.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):ne(this,e,t,!0),t+4},A.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||ee(this,e,t,4,4294967295,0),A.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):ne(this,e,t,!1),t+4},A.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);ee(this,e,t,n,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<n&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s|0)-a&255;return t+n},A.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);ee(this,e,t,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s|0)-a&255;return t+n},A.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||ee(this,e,t,1,127,-128),A.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},A.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||ee(this,e,t,2,32767,-32768),A.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):te(this,e,t,!0),t+2},A.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||ee(this,e,t,2,32767,-32768),A.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):te(this,e,t,!1),t+2},A.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||ee(this,e,t,4,2147483647,-2147483648),A.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):ne(this,e,t,!0),t+4},A.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||ee(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),A.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):ne(this,e,t,!1),t+4},A.prototype.writeFloatLE=function(e,t,n){return ie(this,e,t,!0,n)},A.prototype.writeFloatBE=function(e,t,n){return ie(this,e,t,!1,n)},A.prototype.writeDoubleLE=function(e,t,n){return oe(this,e,t,!0,n)},A.prototype.writeDoubleBE=function(e,t,n){return oe(this,e,t,!1,n)},A.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,o=r-n;if(this===e&&n<t&&t<r)for(i=o-1;i>=0;--i)e[i+t]=this[i+n];else if(o<1e3||!A.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},A.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!A.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var s=D(e)?e:le(new A(e,r).toString()),a=s.length;for(o=0;o<n-t;++o)this[o+t]=s[o%a]}return this};var se=/[^+\/0-9A-Za-z-_]/g;function ae(e){return e<16?"0"+e.toString(16):e.toString(16)}function le(e,t){var n;t=t||1/0;for(var r=e.length,i=null,o=[],s=0;s<r;++s){if((n=e.charCodeAt(s))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function ue(e){return function(e){var t,n,r,i,o,s;y||b();var a=e.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[a-2]?2:"="===e[a-1]?1:0,s=new g(3*a/4-o),r=o>0?a-4:a;var l=0;for(t=0,n=0;t<r;t+=4,n+=3)i=m[e.charCodeAt(t)]<<18|m[e.charCodeAt(t+1)]<<12|m[e.charCodeAt(t+2)]<<6|m[e.charCodeAt(t+3)],s[l++]=i>>16&255,s[l++]=i>>8&255,s[l++]=255&i;return 2===o?(i=m[e.charCodeAt(t)]<<2|m[e.charCodeAt(t+1)]>>4,s[l++]=255&i):1===o&&(i=m[e.charCodeAt(t)]<<10|m[e.charCodeAt(t+1)]<<4|m[e.charCodeAt(t+2)]>>2,s[l++]=i>>8&255,s[l++]=255&i),s}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(se,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function ce(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function de(e){return null!=e&&(!!e._isBuffer||he(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&he(e.slice(0,0))}(e))}function he(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var pe=Object.freeze({__proto__:null,Buffer:A,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),A.alloc(+e)},isBuffer:de,kMaxLength:T});function fe(){throw new Error("setTimeout has not been defined")}function me(){throw new Error("clearTimeout has not been defined")}var ge=fe,ye=me;function be(e){if(ge===setTimeout)return setTimeout(e,0);if((ge===fe||!ge)&&setTimeout)return ge=setTimeout,setTimeout(e,0);try{return ge(e,0)}catch(t){try{return ge.call(null,e,0)}catch(t){return ge.call(this,e,0)}}}"function"==typeof p.setTimeout&&(ge=setTimeout),"function"==typeof p.clearTimeout&&(ye=clearTimeout);var ve,_e=[],xe=!1,we=-1;function Ee(){xe&&ve&&(xe=!1,ve.length?_e=ve.concat(_e):we=-1,_e.length&&Se())}function Se(){if(!xe){var e=be(Ee);xe=!0;for(var t=_e.length;t;){for(ve=_e,_e=[];++we<t;)ve&&ve[we].run();we=-1,t=_e.length}ve=null,xe=!1,function(e){if(ye===clearTimeout)return clearTimeout(e);if((ye===me||!ye)&&clearTimeout)return ye=clearTimeout,clearTimeout(e);try{return ye(e)}catch(t){try{return ye.call(null,e)}catch(t){return ye.call(this,e)}}}(e)}}function Te(e,t){this.fun=e,this.array=t}Te.prototype.run=function(){this.fun.apply(null,this.array)};var ke=p.performance||{};function Oe(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}ke.now||ke.mozNow||ke.msNow||ke.oNow||ke.webkitNow;var Ae,Ce,Re,Ne,Pe,Me,De,Ie,ze,Fe,Le,je,$e,Be,Ve,Ue,We,qe,Ge,He,Ye,Ke,Xe,Ze,Je,Qe,et,tt,nt,rt,it,ot,st,at,lt={exports:{}},ut=(Ae||(Ae=1,lt.exports=function e(t,n,r){function i(s,a){if(!n[s]){if(!t[s]){if(!a&&Oe)return Oe(s);if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var u=n[s]={exports:{}};t[s][0].call(u.exports,function(e){return i(t[s][1][e]||e)},u,u.exports,e,t,n,r)}return n[s].exports}for(var o=Oe,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(e,t,n){var r=e("./utils"),i=e("./support"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";n.encode=function(e){for(var t,n,i,s,a,l,u,c=[],d=0,h=e.length,p=h,f="string"!==r.getTypeOf(e);d<e.length;)p=h-d,i=f?(t=e[d++],n=d<h?e[d++]:0,d<h?e[d++]:0):(t=e.charCodeAt(d++),n=d<h?e.charCodeAt(d++):0,d<h?e.charCodeAt(d++):0),s=t>>2,a=(3&t)<<4|n>>4,l=1<p?(15&n)<<2|i>>6:64,u=2<p?63&i:64,c.push(o.charAt(s)+o.charAt(a)+o.charAt(l)+o.charAt(u));return c.join("")},n.decode=function(e){var t,n,r,s,a,l,u=0,c=0,d="data:";if(e.substr(0,5)===d)throw new Error("Invalid base64 input, it looks like a data url.");var h,p=3*(e=e.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(e.charAt(e.length-1)===o.charAt(64)&&p--,e.charAt(e.length-2)===o.charAt(64)&&p--,p%1!=0)throw new Error("Invalid base64 input, bad content length.");for(h=i.uint8array?new Uint8Array(0|p):new Array(0|p);u<e.length;)t=o.indexOf(e.charAt(u++))<<2|(s=o.indexOf(e.charAt(u++)))>>4,n=(15&s)<<4|(a=o.indexOf(e.charAt(u++)))>>2,r=(3&a)<<6|(l=o.indexOf(e.charAt(u++))),h[c++]=t,64!==a&&(h[c++]=n),64!==l&&(h[c++]=r);return h}},{"./support":30,"./utils":32}],2:[function(e,t,n){var r=e("./external"),i=e("./stream/DataWorker"),o=e("./stream/Crc32Probe"),s=e("./stream/DataLengthProbe");function a(e,t,n,r,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=n,this.compression=r,this.compressedContent=i}a.prototype={getContentWorker:function(){var e=new i(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new s("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new i(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(e,t,n){return e.pipe(new o).pipe(new s("uncompressedSize")).pipe(t.compressWorker(n)).pipe(new s("compressedSize")).withStreamInfo("compression",t)},t.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,n){var r=e("./stream/GenericWorker");n.STORE={magic:"\0\0",compressWorker:function(){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},n.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,n){var r=e("./utils"),i=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==r.getTypeOf(e)?function(e,t,n){var r=i,o=0+n;e^=-1;for(var s=0;s<o;s++)e=e>>>8^r[255&(e^t[s])];return~e}(0|t,e,e.length):function(e,t,n){var r=i,o=0+n;e^=-1;for(var s=0;s<o;s++)e=e>>>8^r[255&(e^t.charCodeAt(s))];return~e}(0|t,e,e.length):0}},{"./utils":32}],5:[function(e,t,n){n.base64=!1,n.binary=!1,n.dir=!1,n.createFolders=!0,n.date=null,n.compression=null,n.compressionOptions=null,n.comment=null,n.unixPermissions=null,n.dosPermissions=null},{}],6:[function(e,t,n){var r;r="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:r}},{lie:37}],7:[function(e,t,n){var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,i=e("pako"),o=e("./utils"),s=e("./stream/GenericWorker"),a=r?"uint8array":"array";function l(e,t){s.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}n.magic="\b\0",o.inherits(l,s),l.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(o.transformTo(a,e.data),!1)},l.prototype.flush=function(){s.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},l.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this._pako=null},l.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},n.compressWorker=function(e){return new l("Deflate",e)},n.uncompressWorker=function(){return new l("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,n){function r(e,t){var n,r="";for(n=0;n<t;n++)r+=String.fromCharCode(255&e),e>>>=8;return r}function i(e,t,n,i,s,c){var d,h,p=e.file,f=e.compression,m=c!==a.utf8encode,g=o.transformTo("string",c(p.name)),y=o.transformTo("string",a.utf8encode(p.name)),b=p.comment,v=o.transformTo("string",c(b)),_=o.transformTo("string",a.utf8encode(b)),x=y.length!==p.name.length,w=_.length!==b.length,E="",S="",T="",k=p.dir,O=p.date,A={crc32:0,compressedSize:0,uncompressedSize:0};t&&!n||(A.crc32=e.crc32,A.compressedSize=e.compressedSize,A.uncompressedSize=e.uncompressedSize);var C=0;t&&(C|=8),m||!x&&!w||(C|=2048);var R=0,N=0;k&&(R|=16),"UNIX"===s?(N=798,R|=function(e,t){var n=e;return e||(n=t?16893:33204),(65535&n)<<16}(p.unixPermissions,k)):(N=20,R|=function(e){return 63&(e||0)}(p.dosPermissions)),d=O.getUTCHours(),d<<=6,d|=O.getUTCMinutes(),d<<=5,d|=O.getUTCSeconds()/2,h=O.getUTCFullYear()-1980,h<<=4,h|=O.getUTCMonth()+1,h<<=5,h|=O.getUTCDate(),x&&(S=r(1,1)+r(l(g),4)+y,E+="up"+r(S.length,2)+S),w&&(T=r(1,1)+r(l(v),4)+_,E+="uc"+r(T.length,2)+T);var P="";return P+="\n\0",P+=r(C,2),P+=f.magic,P+=r(d,2),P+=r(h,2),P+=r(A.crc32,4),P+=r(A.compressedSize,4),P+=r(A.uncompressedSize,4),P+=r(g.length,2),P+=r(E.length,2),{fileRecord:u.LOCAL_FILE_HEADER+P+g+E,dirRecord:u.CENTRAL_FILE_HEADER+r(N,2)+P+r(v.length,2)+"\0\0\0\0"+r(R,4)+r(i,4)+g+E+v}}var o=e("../utils"),s=e("../stream/GenericWorker"),a=e("../utf8"),l=e("../crc32"),u=e("../signature");function c(e,t,n,r){s.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=n,this.encodeFileName=r,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(c,s),c.prototype.push=function(e){var t=e.meta.percent||0,n=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,s.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:n?(t+100*(n-r-1))/n:100}}))},c.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var n=i(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},c.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,n=i(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),t)this.push({data:function(e){return u.DATA_DESCRIPTOR+r(e.crc32,4)+r(e.compressedSize,4)+r(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},c.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var n=this.bytesWritten-e,i=function(e,t,n,i,s){var a=o.transformTo("string",s(i));return u.CENTRAL_DIRECTORY_END+"\0\0\0\0"+r(e,2)+r(e,2)+r(t,4)+r(n,4)+r(a.length,2)+a}(this.dirRecords.length,n,e,this.zipComment,this.encodeFileName);this.push({data:i,meta:{percent:100}})},c.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},c.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()}),e.on("error",function(e){t.error(e)}),this},c.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},c.prototype.error=function(e){var t=this._sources;if(!s.prototype.error.call(this,e))return!1;for(var n=0;n<t.length;n++)try{t[n].error(e)}catch(e){}return!0},c.prototype.lock=function(){s.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()},t.exports=c},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,n){var r=e("../compressions"),i=e("./ZipFileWorker");n.generateWorker=function(e,t,n){var o=new i(t.streamFiles,n,t.platform,t.encodeFileName),s=0;try{e.forEach(function(e,n){s++;var i=function(e,t){var n=e||t,i=r[n];if(!i)throw new Error(n+" is not a valid compression method !");return i}(n.options.compression,t.compression),a=n.options.compressionOptions||t.compressionOptions||{},l=n.dir,u=n.date;n._compressWorker(i,a).withStreamInfo("file",{name:e,dir:l,date:u,comment:n.comment||"",unixPermissions:n.unixPermissions,dosPermissions:n.dosPermissions}).pipe(o)}),o.entriesCount=s}catch(e){o.error(e)}return o}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,n){function r(){if(!(this instanceof r))return new r;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e=new r;for(var t in this)"function"!=typeof this[t]&&(e[t]=this[t]);return e}}(r.prototype=e("./object")).loadAsync=e("./load"),r.support=e("./support"),r.defaults=e("./defaults"),r.version="3.10.1",r.loadAsync=function(e,t){return(new r).loadAsync(e,t)},r.external=e("./external"),t.exports=r},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,n){var r=e("./utils"),i=e("./external"),o=e("./utf8"),s=e("./zipEntries"),a=e("./stream/Crc32Probe"),l=e("./nodejsUtils");function u(e){return new i.Promise(function(t,n){var r=e.decompressed.getContentWorker().pipe(new a);r.on("error",function(e){n(e)}).on("end",function(){r.streamInfo.crc32!==e.decompressed.crc32?n(new Error("Corrupted zip : CRC32 mismatch")):t()}).resume()})}t.exports=function(e,t){var n=this;return t=r.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),l.isNode&&l.isStream(e)?i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):r.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then(function(e){var n=new s(t);return n.load(e),n}).then(function(e){var n=[i.Promise.resolve(e)],r=e.files;if(t.checkCRC32)for(var o=0;o<r.length;o++)n.push(u(r[o]));return i.Promise.all(n)}).then(function(e){for(var i=e.shift(),o=i.files,s=0;s<o.length;s++){var a=o[s],l=a.fileNameStr,u=r.resolve(a.fileNameStr);n.file(u,a.decompressed,{binary:!0,optimizedBinaryString:!0,date:a.date,dir:a.dir,comment:a.fileCommentStr.length?a.fileCommentStr:null,unixPermissions:a.unixPermissions,dosPermissions:a.dosPermissions,createFolders:t.createFolders}),a.dir||(n.file(u).unsafeOriginalName=l)}return i.zipComment.length&&(n.comment=i.zipComment),n})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,n){var r=e("../utils"),i=e("../stream/GenericWorker");function o(e,t){i.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}r.inherits(o,i),o.prototype._bindStream=function(e){var t=this;(this._stream=e).pause(),e.on("data",function(e){t.push({data:e,meta:{percent:0}})}).on("error",function(e){t.isPaused?this.generatedError=e:t.error(e)}).on("end",function(){t.isPaused?t._upstreamEnded=!0:t.end()})},o.prototype.pause=function(){return!!i.prototype.pause.call(this)&&(this._stream.pause(),!0)},o.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=o},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,n){var r=e("readable-stream").Readable;function i(e,t,n){r.call(this,t),this._helper=e;var i=this;e.on("data",function(e,t){i.push(e)||i._helper.pause(),n&&n(t)}).on("error",function(e){i.emit("error",e)}).on("end",function(){i.push(null)})}e("../utils").inherits(i,r),i.prototype._read=function(){this._helper.resume()},t.exports=i},{"../utils":32,"readable-stream":16}],14:[function(e,t,n){t.exports={isNode:void 0!==A,newBufferFrom:function(e,t){if(A.from&&A.from!==Uint8Array.from)return A.from(e,t);if("number"==typeof e)throw new Error('The "data" argument must not be a number');return new A(e,t)},allocBuffer:function(e){if(A.alloc)return A.alloc(e);var t=new A(e);return t.fill(0),t},isBuffer:function(e){return de(e)},isStream:function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume}}},{}],15:[function(e,t,n){function r(e,t,n){var r,i=o.getTypeOf(t),a=o.extend(n||{},l);a.date=a.date||new Date,null!==a.compression&&(a.compression=a.compression.toUpperCase()),"string"==typeof a.unixPermissions&&(a.unixPermissions=parseInt(a.unixPermissions,8)),a.unixPermissions&&16384&a.unixPermissions&&(a.dir=!0),a.dosPermissions&&16&a.dosPermissions&&(a.dir=!0),a.dir&&(e=m(e)),a.createFolders&&(r=f(e))&&g.call(this,r,!0);var d="string"===i&&!1===a.binary&&!1===a.base64;n&&void 0!==n.binary||(a.binary=!d),(t instanceof u&&0===t.uncompressedSize||a.dir||!t||0===t.length)&&(a.base64=!1,a.binary=!0,t="",a.compression="STORE",i="string");var y;y=t instanceof u||t instanceof s?t:h.isNode&&h.isStream(t)?new p(e,t):o.prepareContent(e,t,a.binary,a.optimizedBinaryString,a.base64);var b=new c(e,y,a);this.files[e]=b}var i=e("./utf8"),o=e("./utils"),s=e("./stream/GenericWorker"),a=e("./stream/StreamHelper"),l=e("./defaults"),u=e("./compressedObject"),c=e("./zipObject"),d=e("./generate"),h=e("./nodejsUtils"),p=e("./nodejs/NodejsStreamInputAdapter"),f=function(e){"/"===e.slice(-1)&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return 0<t?e.substring(0,t):""},m=function(e){return"/"!==e.slice(-1)&&(e+="/"),e},g=function(e,t){return t=void 0!==t?t:l.createFolders,e=m(e),this.files[e]||r.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function y(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var b={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,n,r;for(t in this.files)r=this.files[t],(n=t.slice(this.root.length,t.length))&&t.slice(0,this.root.length)===this.root&&e(n,r)},filter:function(e){var t=[];return this.forEach(function(n,r){e(n,r)&&t.push(r)}),t},file:function(e,t,n){if(1!==arguments.length)return e=this.root+e,r.call(this,e,t,n),this;if(y(e)){var i=e;return this.filter(function(e,t){return!t.dir&&i.test(e)})}var o=this.files[this.root+e];return o&&!o.dir?o:null},folder:function(e){if(!e)return this;if(y(e))return this.filter(function(t,n){return n.dir&&e.test(t)});var t=this.root+e,n=g.call(this,t),r=this.clone();return r.root=n.name,r},remove:function(e){e=this.root+e;var t=this.files[e];if(t||("/"!==e.slice(-1)&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var n=this.filter(function(t,n){return n.name.slice(0,e.length)===e}),r=0;r<n.length;r++)delete this.files[n[r].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,n={};try{if((n=o.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:i.utf8encode})).type=n.type.toLowerCase(),n.compression=n.compression.toUpperCase(),"binarystring"===n.type&&(n.type="string"),!n.type)throw new Error("No output type specified.");o.checkSupport(n.type),"darwin"!==n.platform&&"freebsd"!==n.platform&&"linux"!==n.platform&&"sunos"!==n.platform||(n.platform="UNIX"),"win32"===n.platform&&(n.platform="DOS");var r=n.comment||this.comment||"";t=d.generateWorker(this,n,r)}catch(e){(t=new s("error")).error(e)}return new a(t,n.type||"string",n.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return(e=e||{}).type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}};t.exports=b},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,t,n){t.exports=e("stream")},{stream:void 0}],17:[function(e,t,n){var r=e("./DataReader");function i(e){r.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=255&e[t]}e("../utils").inherits(i,r),i.prototype.byteAt=function(e){return this.data[this.zero+e]},i.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),n=e.charCodeAt(1),r=e.charCodeAt(2),i=e.charCodeAt(3),o=this.length-4;0<=o;--o)if(this.data[o]===t&&this.data[o+1]===n&&this.data[o+2]===r&&this.data[o+3]===i)return o-this.zero;return-1},i.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),n=e.charCodeAt(1),r=e.charCodeAt(2),i=e.charCodeAt(3),o=this.readData(4);return t===o[0]&&n===o[1]&&r===o[2]&&i===o[3]},i.prototype.readData=function(e){if(this.checkOffset(e),0===e)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],18:[function(e,t,n){var r=e("../utils");function i(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}i.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t,n=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)n=(n<<8)+this.byteAt(t);return this.index+=e,n},readString:function(e){return r.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=i},{"../utils":32}],19:[function(e,t,n){var r=e("./Uint8ArrayReader");function i(e){r.call(this,e)}e("../utils").inherits(i,r),i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,n){var r=e("./DataReader");function i(e){r.call(this,e)}e("../utils").inherits(i,r),i.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},i.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},i.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(e,t,n){var r=e("./ArrayReader");function i(e){r.call(this,e)}e("../utils").inherits(i,r),i.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,n){var r=e("../utils"),i=e("../support"),o=e("./ArrayReader"),s=e("./StringReader"),a=e("./NodeBufferReader"),l=e("./Uint8ArrayReader");t.exports=function(e){var t=r.getTypeOf(e);return r.checkSupport(t),"string"!==t||i.uint8array?"nodebuffer"===t?new a(e):i.uint8array?new l(r.transformTo("uint8array",e)):new o(r.transformTo("array",e)):new s(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,n){n.LOCAL_FILE_HEADER="PK",n.CENTRAL_FILE_HEADER="PK",n.CENTRAL_DIRECTORY_END="PK",n.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",n.ZIP64_CENTRAL_DIRECTORY_END="PK",n.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,n){var r=e("./GenericWorker"),i=e("../utils");function o(e){r.call(this,"ConvertWorker to "+e),this.destType=e}i.inherits(o,r),o.prototype.processChunk=function(e){this.push({data:i.transformTo(this.destType,e.data),meta:e.meta})},t.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,n){var r=e("./GenericWorker"),i=e("../crc32");function o(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(o,r),o.prototype.processChunk=function(e){this.streamInfo.crc32=i(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,n){var r=e("../utils"),i=e("./GenericWorker");function o(e){i.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}r.inherits(o,i),o.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}i.prototype.processChunk.call(this,e)},t.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,n){var r=e("../utils"),i=e("./GenericWorker");function o(e){i.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=r.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}r.inherits(o,i),o.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,n){function r(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var n=0;n<this._listeners[e].length;n++)this._listeners[e][n].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.end()}),e.on("error",function(e){t.error(e)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var e=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}},t.exports=r},{}],29:[function(e,t,n){var r=e("../utils"),i=e("./ConvertWorker"),o=e("./GenericWorker"),s=e("../base64"),a=e("../support"),l=e("../external"),u=null;if(a.nodestream)try{u=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function c(e,t,n){var s=t;switch(t){case"blob":case"arraybuffer":s="uint8array";break;case"base64":s="string"}try{this._internalType=s,this._outputType=t,this._mimeType=n,r.checkSupport(s),this._worker=e.pipe(new i(s)),e.lock()}catch(e){this._worker=new o("error"),this._worker.error(e)}}c.prototype={accumulate:function(e){return function(e,t){return new l.Promise(function(n,i){var o=[],a=e._internalType,l=e._outputType,u=e._mimeType;e.on("data",function(e,n){o.push(e),t&&t(n)}).on("error",function(e){o=[],i(e)}).on("end",function(){try{var e=function(e,t,n){switch(e){case"blob":return r.newBlob(r.transformTo("arraybuffer",t),n);case"base64":return s.encode(t);default:return r.transformTo(e,t)}}(l,function(e,t){var n,r=0,i=null,o=0;for(n=0;n<t.length;n++)o+=t[n].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(i=new Uint8Array(o),n=0;n<t.length;n++)i.set(t[n],r),r+=t[n].length;return i;case"nodebuffer":return A.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}(a,o),u);n(e)}catch(e){i(e)}o=[]}).resume()})}(this,e)},on:function(e,t){var n=this;return"data"===e?this._worker.on(e,function(e){t.call(n,e.data,e.meta)}):this._worker.on(e,function(){r.delay(t,arguments,n)}),this},resume:function(){return r.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(r.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new u(this,{objectMode:"nodebuffer"!==this._outputType},e)}},t.exports=c},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,t,n){if(n.base64=!0,n.array=!0,n.string=!0,n.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,n.nodebuffer=void 0!==A,n.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)n.blob=!1;else{var r=new ArrayBuffer(0);try{n.blob=0===new Blob([r],{type:"application/zip"}).size}catch(e){try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(r),n.blob=0===i.getBlob("application/zip").size}catch(e){n.blob=!1}}}try{n.nodestream=!!e("readable-stream").Readable}catch(e){n.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,n){for(var r=e("./utils"),i=e("./support"),o=e("./nodejsUtils"),s=e("./stream/GenericWorker"),a=new Array(256),l=0;l<256;l++)a[l]=252<=l?6:248<=l?5:240<=l?4:224<=l?3:192<=l?2:1;function u(){s.call(this,"utf-8 decode"),this.leftOver=null}function c(){s.call(this,"utf-8 encode")}a[254]=a[254]=1,n.utf8encode=function(e){return i.nodebuffer?o.newBufferFrom(e,"utf-8"):function(e){var t,n,r,o,s,a=e.length,l=0;for(o=0;o<a;o++)55296==(64512&(n=e.charCodeAt(o)))&&o+1<a&&56320==(64512&(r=e.charCodeAt(o+1)))&&(n=65536+(n-55296<<10)+(r-56320),o++),l+=n<128?1:n<2048?2:n<65536?3:4;for(t=i.uint8array?new Uint8Array(l):new Array(l),o=s=0;s<l;o++)55296==(64512&(n=e.charCodeAt(o)))&&o+1<a&&56320==(64512&(r=e.charCodeAt(o+1)))&&(n=65536+(n-55296<<10)+(r-56320),o++),n<128?t[s++]=n:(n<2048?t[s++]=192|n>>>6:(n<65536?t[s++]=224|n>>>12:(t[s++]=240|n>>>18,t[s++]=128|n>>>12&63),t[s++]=128|n>>>6&63),t[s++]=128|63&n);return t}(e)},n.utf8decode=function(e){return i.nodebuffer?r.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,n,i,o,s=e.length,l=new Array(2*s);for(t=n=0;t<s;)if((i=e[t++])<128)l[n++]=i;else if(4<(o=a[i]))l[n++]=65533,t+=o-1;else{for(i&=2===o?31:3===o?15:7;1<o&&t<s;)i=i<<6|63&e[t++],o--;1<o?l[n++]=65533:i<65536?l[n++]=i:(i-=65536,l[n++]=55296|i>>10&1023,l[n++]=56320|1023&i)}return l.length!==n&&(l.subarray?l=l.subarray(0,n):l.length=n),r.applyFromCharCode(l)}(e=r.transformTo(i.uint8array?"uint8array":"array",e))},r.inherits(u,s),u.prototype.processChunk=function(e){var t=r.transformTo(i.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var o=t;(t=new Uint8Array(o.length+this.leftOver.length)).set(this.leftOver,0),t.set(o,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var s=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;0<=n&&128==(192&e[n]);)n--;return n<0||0===n?t:n+a[e[n]]>t?n:t}(t),l=t;s!==t.length&&(i.uint8array?(l=t.subarray(0,s),this.leftOver=t.subarray(s,t.length)):(l=t.slice(0,s),this.leftOver=t.slice(s,t.length))),this.push({data:n.utf8decode(l),meta:e.meta})},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:n.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},n.Utf8DecodeWorker=u,r.inherits(c,s),c.prototype.processChunk=function(e){this.push({data:n.utf8encode(e.data),meta:e.meta})},n.Utf8EncodeWorker=c},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,n){var r=e("./support"),i=e("./base64"),o=e("./nodejsUtils"),s=e("./external");function a(e){return e}function l(e,t){for(var n=0;n<e.length;++n)t[n]=255&e.charCodeAt(n);return t}e("setimmediate"),n.newBlob=function(e,t){n.checkSupport("blob");try{return new Blob([e],{type:t})}catch(n){try{var r=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return r.append(e),r.getBlob(t)}catch(e){throw new Error("Bug : can't construct the Blob.")}}};var u={stringifyByChunk:function(e,t,n){var r=[],i=0,o=e.length;if(o<=n)return String.fromCharCode.apply(null,e);for(;i<o;)"array"===t||"nodebuffer"===t?r.push(String.fromCharCode.apply(null,e.slice(i,Math.min(i+n,o)))):r.push(String.fromCharCode.apply(null,e.subarray(i,Math.min(i+n,o)))),i+=n;return r.join("")},stringifyByChar:function(e){for(var t="",n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t},applyCanBeUsed:{uint8array:function(){try{return r.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){return!1}}(),nodebuffer:function(){try{return r.nodebuffer&&1===String.fromCharCode.apply(null,o.allocBuffer(1)).length}catch(e){return!1}}()}};function c(e){var t=65536,r=n.getTypeOf(e),i=!0;if("uint8array"===r?i=u.applyCanBeUsed.uint8array:"nodebuffer"===r&&(i=u.applyCanBeUsed.nodebuffer),i)for(;1<t;)try{return u.stringifyByChunk(e,r,t)}catch(e){t=Math.floor(t/2)}return u.stringifyByChar(e)}function d(e,t){for(var n=0;n<e.length;n++)t[n]=e[n];return t}n.applyFromCharCode=c;var h={};h.string={string:a,array:function(e){return l(e,new Array(e.length))},arraybuffer:function(e){return h.string.uint8array(e).buffer},uint8array:function(e){return l(e,new Uint8Array(e.length))},nodebuffer:function(e){return l(e,o.allocBuffer(e.length))}},h.array={string:c,array:a,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return o.newBufferFrom(e)}},h.arraybuffer={string:function(e){return c(new Uint8Array(e))},array:function(e){return d(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:a,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return o.newBufferFrom(new Uint8Array(e))}},h.uint8array={string:c,array:function(e){return d(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:a,nodebuffer:function(e){return o.newBufferFrom(e)}},h.nodebuffer={string:c,array:function(e){return d(e,new Array(e.length))},arraybuffer:function(e){return h.nodebuffer.uint8array(e).buffer},uint8array:function(e){return d(e,new Uint8Array(e.length))},nodebuffer:a},n.transformTo=function(e,t){if(t=t||"",!e)return t;n.checkSupport(e);var r=n.getTypeOf(t);return h[r][e](t)},n.resolve=function(e){for(var t=e.split("/"),n=[],r=0;r<t.length;r++){var i=t[r];"."===i||""===i&&0!==r&&r!==t.length-1||(".."===i?n.pop():n.push(i))}return n.join("/")},n.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":r.nodebuffer&&o.isBuffer(e)?"nodebuffer":r.uint8array&&e instanceof Uint8Array?"uint8array":r.arraybuffer&&e instanceof ArrayBuffer?"arraybuffer":void 0},n.checkSupport=function(e){if(!r[e.toLowerCase()])throw new Error(e+" is not supported by this platform")},n.MAX_VALUE_16BITS=65535,n.MAX_VALUE_32BITS=-1,n.pretty=function(e){var t,n,r="";for(n=0;n<(e||"").length;n++)r+="\\x"+((t=e.charCodeAt(n))<16?"0":"")+t.toString(16).toUpperCase();return r},n.delay=function(e,t,n){setImmediate(function(){e.apply(n||null,t||[])})},n.inherits=function(e,t){function n(){}n.prototype=t.prototype,e.prototype=new n},n.extend=function(){var e,t,n={};for(e=0;e<arguments.length;e++)for(t in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],t)&&void 0===n[t]&&(n[t]=arguments[e][t]);return n},n.prepareContent=function(e,t,o,a,u){return s.Promise.resolve(t).then(function(e){return r.blob&&(e instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(e)))&&"undefined"!=typeof FileReader?new s.Promise(function(t,n){var r=new FileReader;r.onload=function(e){t(e.target.result)},r.onerror=function(e){n(e.target.error)},r.readAsArrayBuffer(e)}):e}).then(function(t){var c=n.getTypeOf(t);return c?("arraybuffer"===c?t=n.transformTo("uint8array",t):"string"===c&&(u?t=i.decode(t):o&&!0!==a&&(t=function(e){return l(e,r.uint8array?new Uint8Array(e.length):new Array(e.length))}(t))),t):s.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,t,n){var r=e("./reader/readerFor"),i=e("./utils"),o=e("./signature"),s=e("./zipEntry"),a=e("./support");function l(e){this.files=[],this.loadOptions=e}l.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+i.pretty(t)+", expected "+i.pretty(e)+")")}},isSignature:function(e,t){var n=this.reader.index;this.reader.setIndex(e);var r=this.reader.readString(4)===t;return this.reader.setIndex(n),r},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=a.uint8array?"uint8array":"array",n=i.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(n)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e,t,n,r=this.zip64EndOfCentralSize-44;0<r;)e=this.reader.readInt(2),t=this.reader.readInt(4),n=this.reader.readData(t),this.zip64ExtensibleData[e]={id:e,length:t,value:n}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(o.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER);)(e=new s({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(o.CENTRAL_DIRECTORY_END);if(e<0)throw this.isSignature(0,o.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(e);var t=e;if(this.checkSignature(o.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===i.MAX_VALUE_16BITS||this.diskWithCentralDirStart===i.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===i.MAX_VALUE_16BITS||this.centralDirRecords===i.MAX_VALUE_16BITS||this.centralDirSize===i.MAX_VALUE_32BITS||this.centralDirOffset===i.MAX_VALUE_32BITS){if(this.zip64=!0,(e=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,o.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var n=this.centralDirOffset+this.centralDirSize;this.zip64&&(n+=20,n+=12+this.zip64EndOfCentralSize);var r=t-n;if(0<r)this.isSignature(t,o.CENTRAL_FILE_HEADER)||(this.reader.zero=r);else if(r<0)throw new Error("Corrupted zip: missing "+Math.abs(r)+" bytes.")},prepareReader:function(e){this.reader=r(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=l},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,t,n){var r=e("./reader/readerFor"),i=e("./utils"),o=e("./compressedObject"),s=e("./crc32"),a=e("./utf8"),l=e("./compressions"),u=e("./support");function c(e,t){this.options=e,this.loadOptions=t}c.prototype={isEncrypted:function(){return!(1&~this.bitFlag)},useUTF8:function(){return!(2048&~this.bitFlag)},readLocalPart:function(e){var t,n;if(e.skip(22),this.fileNameLength=e.readInt(2),n=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(n),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(t=function(e){for(var t in l)if(Object.prototype.hasOwnProperty.call(l,t)&&l[t].magic===e)return l[t];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+i.pretty(this.compressionMethod)+" unknown (inner file : "+i.transformTo("string",this.fileName)+")");this.decompressed=new o(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=r(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,n,r,i=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4<i;)t=e.readInt(2),n=e.readInt(2),r=e.readData(n),this.extraFields[t]={id:t,length:n,value:r};e.setIndex(i)},handleUTF8:function(){var e=u.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=a.utf8decode(this.fileName),this.fileCommentStr=a.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(null!==t)this.fileNameStr=t;else{var n=i.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(n)}var r=this.findExtraFieldUnicodeComment();if(null!==r)this.fileCommentStr=r;else{var o=i.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(o)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=r(e.value);return 1!==t.readInt(1)||s(this.fileName)!==t.readInt(4)?null:a.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=r(e.value);return 1!==t.readInt(1)||s(this.fileComment)!==t.readInt(4)?null:a.utf8decode(t.readData(e.length-5))}return null}},t.exports=c},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,t,n){function r(e,t,n){this.name=e,this.dir=n.dir,this.date=n.date,this.comment=n.comment,this.unixPermissions=n.unixPermissions,this.dosPermissions=n.dosPermissions,this._data=t,this._dataBinary=n.binary,this.options={compression:n.compression,compressionOptions:n.compressionOptions}}var i=e("./stream/StreamHelper"),o=e("./stream/DataWorker"),s=e("./utf8"),a=e("./compressedObject"),l=e("./stream/GenericWorker");r.prototype={internalStream:function(e){var t=null,n="string";try{if(!e)throw new Error("No output type specified.");var r="string"===(n=e.toLowerCase())||"text"===n;"binarystring"!==n&&"text"!==n||(n="string"),t=this._decompressWorker();var o=!this._dataBinary;o&&!r&&(t=t.pipe(new s.Utf8EncodeWorker)),!o&&r&&(t=t.pipe(new s.Utf8DecodeWorker))}catch(e){(t=new l("error")).error(e)}return new i(t,n,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof a&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var n=this._decompressWorker();return this._dataBinary||(n=n.pipe(new s.Utf8EncodeWorker)),a.createWorkerFrom(n,e,t)},_decompressWorker:function(){return this._data instanceof a?this._data.getContentWorker():this._data instanceof l?this._data:new o(this._data)}};for(var u=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],c=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},d=0;d<u.length;d++)r.prototype[u[d]]=c;t.exports=r},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,t,n){(function(e){var n,r,i=e.MutationObserver||e.WebKitMutationObserver;if(i){var o=0,s=new i(c),a=e.document.createTextNode("");s.observe(a,{characterData:!0}),n=function(){a.data=o=++o%2}}else if(e.setImmediate||void 0===e.MessageChannel)n="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){c(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(c,0)};else{var l=new e.MessageChannel;l.port1.onmessage=c,n=function(){l.port2.postMessage(0)}}var u=[];function c(){var e,t;r=!0;for(var n=u.length;n;){for(t=u,u=[],e=-1;++e<n;)t[e]();n=u.length}r=!1}t.exports=function(e){1!==u.push(e)||r||n()}}).call(this,void 0!==p?p:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(e,t,n){var r=e("immediate");function i(){}var o={},s=["REJECTED"],a=["FULFILLED"],l=["PENDING"];function u(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,e!==i&&p(this,e)}function c(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function d(e,t,n){r(function(){var r;try{r=t(n)}catch(r){return o.reject(e,r)}r===e?o.reject(e,new TypeError("Cannot resolve promise with itself")):o.resolve(e,r)})}function h(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function p(e,t){var n=!1;function r(t){n||(n=!0,o.reject(e,t))}function i(t){n||(n=!0,o.resolve(e,t))}var s=f(function(){t(i,r)});"error"===s.status&&r(s.value)}function f(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}(t.exports=u).prototype.finally=function(e){if("function"!=typeof e)return this;var t=this.constructor;return this.then(function(n){return t.resolve(e()).then(function(){return n})},function(n){return t.resolve(e()).then(function(){throw n})})},u.prototype.catch=function(e){return this.then(null,e)},u.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===s)return this;var n=new this.constructor(i);return this.state!==l?d(n,this.state===a?e:t,this.outcome):this.queue.push(new c(n,e,t)),n},c.prototype.callFulfilled=function(e){o.resolve(this.promise,e)},c.prototype.otherCallFulfilled=function(e){d(this.promise,this.onFulfilled,e)},c.prototype.callRejected=function(e){o.reject(this.promise,e)},c.prototype.otherCallRejected=function(e){d(this.promise,this.onRejected,e)},o.resolve=function(e,t){var n=f(h,t);if("error"===n.status)return o.reject(e,n.value);var r=n.value;if(r)p(e,r);else{e.state=a,e.outcome=t;for(var i=-1,s=e.queue.length;++i<s;)e.queue[i].callFulfilled(t)}return e},o.reject=function(e,t){e.state=s,e.outcome=t;for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].callRejected(t);return e},u.resolve=function(e){return e instanceof this?e:o.resolve(new this(i),e)},u.reject=function(e){var t=new this(i);return o.reject(t,e)},u.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,r=!1;if(!n)return this.resolve([]);for(var s=new Array(n),a=0,l=-1,u=new this(i);++l<n;)c(e[l],l);return u;function c(e,i){t.resolve(e).then(function(e){s[i]=e,++a!==n||r||(r=!0,o.resolve(u,s))},function(e){r||(r=!0,o.reject(u,e))})}},u.race=function(e){if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var t=e.length,n=!1;if(!t)return this.resolve([]);for(var r,s=-1,a=new this(i);++s<t;)r=e[s],this.resolve(r).then(function(e){n||(n=!0,o.resolve(a,e))},function(e){n||(n=!0,o.reject(a,e))});return a}},{immediate:36}],38:[function(e,t,n){var r={};(0,e("./lib/utils/common").assign)(r,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=r},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,t,n){var r=e("./zlib/deflate"),i=e("./utils/common"),o=e("./utils/strings"),s=e("./zlib/messages"),a=e("./zlib/zstream"),l=Object.prototype.toString;function u(e){if(!(this instanceof u))return new u(e);this.options=i.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&&0<t.windowBits?t.windowBits=-t.windowBits:t.gzip&&0<t.windowBits&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var n=r.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==n)throw new Error(s[n]);if(t.header&&r.deflateSetHeader(this.strm,t.header),t.dictionary){var c;if(c="string"==typeof t.dictionary?o.string2buf(t.dictionary):"[object ArrayBuffer]"===l.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(n=r.deflateSetDictionary(this.strm,c)))throw new Error(s[n]);this._dict_set=!0}}function c(e,t){var n=new u(t);if(n.push(e,!0),n.err)throw n.msg||s[n.err];return n.result}u.prototype.push=function(e,t){var n,s,a=this.strm,u=this.options.chunkSize;if(this.ended)return!1;s=t===~~t?t:!0===t?4:0,"string"==typeof e?a.input=o.string2buf(e):"[object ArrayBuffer]"===l.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new i.Buf8(u),a.next_out=0,a.avail_out=u),1!==(n=r.deflate(a,s))&&0!==n)return this.onEnd(n),!(this.ended=!0);0!==a.avail_out&&(0!==a.avail_in||4!==s&&2!==s)||("string"===this.options.to?this.onData(o.buf2binstring(i.shrinkBuf(a.output,a.next_out))):this.onData(i.shrinkBuf(a.output,a.next_out)))}while((0<a.avail_in||0===a.avail_out)&&1!==n);return 4===s?(n=r.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,0===n):2!==s||(this.onEnd(0),!(a.avail_out=0))},u.prototype.onData=function(e){this.chunks.push(e)},u.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},n.Deflate=u,n.deflate=c,n.deflateRaw=function(e,t){return(t=t||{}).raw=!0,c(e,t)},n.gzip=function(e,t){return(t=t||{}).gzip=!0,c(e,t)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,n){var r=e("./zlib/inflate"),i=e("./utils/common"),o=e("./utils/strings"),s=e("./zlib/constants"),a=e("./zlib/messages"),l=e("./zlib/zstream"),u=e("./zlib/gzheader"),c=Object.prototype.toString;function d(e){if(!(this instanceof d))return new d(e);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&0<=t.windowBits&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(0<=t.windowBits&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),15<t.windowBits&&t.windowBits<48&&!(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var n=r.inflateInit2(this.strm,t.windowBits);if(n!==s.Z_OK)throw new Error(a[n]);this.header=new u,r.inflateGetHeader(this.strm,this.header)}function h(e,t){var n=new d(t);if(n.push(e,!0),n.err)throw n.msg||a[n.err];return n.result}d.prototype.push=function(e,t){var n,a,l,u,d,h,p=this.strm,f=this.options.chunkSize,m=this.options.dictionary,g=!1;if(this.ended)return!1;a=t===~~t?t:!0===t?s.Z_FINISH:s.Z_NO_FLUSH,"string"==typeof e?p.input=o.binstring2buf(e):"[object ArrayBuffer]"===c.call(e)?p.input=new Uint8Array(e):p.input=e,p.next_in=0,p.avail_in=p.input.length;do{if(0===p.avail_out&&(p.output=new i.Buf8(f),p.next_out=0,p.avail_out=f),(n=r.inflate(p,s.Z_NO_FLUSH))===s.Z_NEED_DICT&&m&&(h="string"==typeof m?o.string2buf(m):"[object ArrayBuffer]"===c.call(m)?new Uint8Array(m):m,n=r.inflateSetDictionary(this.strm,h)),n===s.Z_BUF_ERROR&&!0===g&&(n=s.Z_OK,g=!1),n!==s.Z_STREAM_END&&n!==s.Z_OK)return this.onEnd(n),!(this.ended=!0);p.next_out&&(0!==p.avail_out&&n!==s.Z_STREAM_END&&(0!==p.avail_in||a!==s.Z_FINISH&&a!==s.Z_SYNC_FLUSH)||("string"===this.options.to?(l=o.utf8border(p.output,p.next_out),u=p.next_out-l,d=o.buf2string(p.output,l),p.next_out=u,p.avail_out=f-u,u&&i.arraySet(p.output,p.output,l,u,0),this.onData(d)):this.onData(i.shrinkBuf(p.output,p.next_out)))),0===p.avail_in&&0===p.avail_out&&(g=!0)}while((0<p.avail_in||0===p.avail_out)&&n!==s.Z_STREAM_END);return n===s.Z_STREAM_END&&(a=s.Z_FINISH),a===s.Z_FINISH?(n=r.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===s.Z_OK):a!==s.Z_SYNC_FLUSH||(this.onEnd(s.Z_OK),!(p.avail_out=0))},d.prototype.onData=function(e){this.chunks.push(e)},d.prototype.onEnd=function(e){e===s.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},n.Inflate=d,n.inflate=h,n.inflateRaw=function(e,t){return(t=t||{}).raw=!0,h(e,t)},n.ungzip=h},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,t,n){var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;n.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}}return e},n.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var i={arraySet:function(e,t,n,r,i){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+r),i);else for(var o=0;o<r;o++)e[i+o]=t[n+o]},flattenChunks:function(e){var t,n,r,i,o,s;for(t=r=0,n=e.length;t<n;t++)r+=e[t].length;for(s=new Uint8Array(r),t=i=0,n=e.length;t<n;t++)o=e[t],s.set(o,i),i+=o.length;return s}},o={arraySet:function(e,t,n,r,i){for(var o=0;o<r;o++)e[i+o]=t[n+o]},flattenChunks:function(e){return[].concat.apply([],e)}};n.setTyped=function(e){e?(n.Buf8=Uint8Array,n.Buf16=Uint16Array,n.Buf32=Int32Array,n.assign(n,i)):(n.Buf8=Array,n.Buf16=Array,n.Buf32=Array,n.assign(n,o))},n.setTyped(r)},{}],42:[function(e,t,n){var r=e("./common"),i=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch(e){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){o=!1}for(var s=new r.Buf8(256),a=0;a<256;a++)s[a]=252<=a?6:248<=a?5:240<=a?4:224<=a?3:192<=a?2:1;function l(e,t){if(t<65537&&(e.subarray&&o||!e.subarray&&i))return String.fromCharCode.apply(null,r.shrinkBuf(e,t));for(var n="",s=0;s<t;s++)n+=String.fromCharCode(e[s]);return n}s[254]=s[254]=1,n.string2buf=function(e){var t,n,i,o,s,a=e.length,l=0;for(o=0;o<a;o++)55296==(64512&(n=e.charCodeAt(o)))&&o+1<a&&56320==(64512&(i=e.charCodeAt(o+1)))&&(n=65536+(n-55296<<10)+(i-56320),o++),l+=n<128?1:n<2048?2:n<65536?3:4;for(t=new r.Buf8(l),o=s=0;s<l;o++)55296==(64512&(n=e.charCodeAt(o)))&&o+1<a&&56320==(64512&(i=e.charCodeAt(o+1)))&&(n=65536+(n-55296<<10)+(i-56320),o++),n<128?t[s++]=n:(n<2048?t[s++]=192|n>>>6:(n<65536?t[s++]=224|n>>>12:(t[s++]=240|n>>>18,t[s++]=128|n>>>12&63),t[s++]=128|n>>>6&63),t[s++]=128|63&n);return t},n.buf2binstring=function(e){return l(e,e.length)},n.binstring2buf=function(e){for(var t=new r.Buf8(e.length),n=0,i=t.length;n<i;n++)t[n]=e.charCodeAt(n);return t},n.buf2string=function(e,t){var n,r,i,o,a=t||e.length,u=new Array(2*a);for(n=r=0;n<a;)if((i=e[n++])<128)u[r++]=i;else if(4<(o=s[i]))u[r++]=65533,n+=o-1;else{for(i&=2===o?31:3===o?15:7;1<o&&n<a;)i=i<<6|63&e[n++],o--;1<o?u[r++]=65533:i<65536?u[r++]=i:(i-=65536,u[r++]=55296|i>>10&1023,u[r++]=56320|1023&i)}return l(u,r)},n.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;0<=n&&128==(192&e[n]);)n--;return n<0||0===n?t:n+s[e[n]]>t?n:t}},{"./common":41}],43:[function(e,t,n){t.exports=function(e,t,n,r){for(var i=65535&e,o=e>>>16&65535,s=0;0!==n;){for(n-=s=2e3<n?2e3:n;o=o+(i=i+t[r++]|0)|0,--s;);i%=65521,o%=65521}return i|o<<16}},{}],44:[function(e,t,n){t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(e,t,n){var r=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t,n,i){var o=r,s=i+n;e^=-1;for(var a=i;a<s;a++)e=e>>>8^o[255&(e^t[a])];return~e}},{}],46:[function(e,t,n){var r,i=e("../utils/common"),o=e("./trees"),s=e("./adler32"),a=e("./crc32"),l=e("./messages"),u=-2,c=258,d=262,h=113;function p(e,t){return e.msg=l[t],t}function f(e){return(e<<1)-(4<e?9:0)}function m(e){for(var t=e.length;0<=--t;)e[t]=0}function g(e){var t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(i.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))}function y(e,t){o._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,g(e.strm)}function b(e,t){e.pending_buf[e.pending++]=t}function v(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function _(e,t){var n,r,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-d?e.strstart-(e.w_size-d):0,u=e.window,h=e.w_mask,p=e.prev,f=e.strstart+c,m=u[o+s-1],g=u[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(n=t)+s]===g&&u[n+s-1]===m&&u[n]===u[o]&&u[++n]===u[o+1]){o+=2,n++;do{}while(u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&o<f);if(r=c-(f-o),o=f-c,s<r){if(e.match_start=t,a<=(s=r))break;m=u[o+s-1],g=u[o+s]}}}while((t=p[t&h])>l&&0!=--i);return s<=e.lookahead?s:e.lookahead}function x(e){var t,n,r,o,l,u,c,h,p,f,m=e.w_size;do{if(o=e.window_size-e.lookahead-e.strstart,e.strstart>=m+(m-d)){for(i.arraySet(e.window,e.window,m,m,0),e.match_start-=m,e.strstart-=m,e.block_start-=m,t=n=e.hash_size;r=e.head[--t],e.head[t]=m<=r?r-m:0,--n;);for(t=n=m;r=e.prev[--t],e.prev[t]=m<=r?r-m:0,--n;);o+=m}if(0===e.strm.avail_in)break;if(u=e.strm,c=e.window,h=e.strstart+e.lookahead,f=void 0,(p=o)<(f=u.avail_in)&&(f=p),n=0===f?0:(u.avail_in-=f,i.arraySet(c,u.input,u.next_in,f,h),1===u.state.wrap?u.adler=s(u.adler,c,f,h):2===u.state.wrap&&(u.adler=a(u.adler,c,f,h)),u.next_in+=f,u.total_in+=f,f),e.lookahead+=n,e.lookahead+e.insert>=3)for(l=e.strstart-e.insert,e.ins_h=e.window[l],e.ins_h=(e.ins_h<<e.hash_shift^e.window[l+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[l+3-1])&e.hash_mask,e.prev[l&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=l,l++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<d&&0!==e.strm.avail_in)}function w(e,t){for(var n,r;;){if(e.lookahead<d){if(x(e),e.lookahead<d&&0===t)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==n&&e.strstart-n<=e.w_size-d&&(e.match_length=_(e,n)),e.match_length>=3)if(r=o._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart,0!=--e.match_length;);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else r=o._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(y(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(y(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(y(e,!1),0===e.strm.avail_out)?1:2}function E(e,t){for(var n,r,i;;){if(e.lookahead<d){if(x(e),e.lookahead<d&&0===t)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==n&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-d&&(e.match_length=_(e,n),e.match_length<=5&&(1===e.strategy||3===e.match_length&&4096<e.strstart-e.match_start)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-3,r=o._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!=--e.prev_length;);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(y(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((r=o._tr_tally(e,0,e.window[e.strstart-1]))&&y(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=o._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(y(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(y(e,!1),0===e.strm.avail_out)?1:2}function S(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}function T(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(1146),this.dyn_dtree=new i.Buf16(122),this.bl_tree=new i.Buf16(78),m(this.dyn_ltree),m(this.dyn_dtree),m(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(16),this.heap=new i.Buf16(573),m(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(573),m(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function k(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=2,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?42:h,e.adler=2===t.wrap?0:1,t.last_flush=0,o._tr_init(t),0):p(e,u)}function O(e){var t=k(e);return 0===t&&function(e){e.window_size=2*e.w_size,m(e.head),e.max_lazy_match=r[e.level].max_lazy,e.good_match=r[e.level].good_length,e.nice_match=r[e.level].nice_length,e.max_chain_length=r[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=2,e.match_available=0,e.ins_h=0}(e.state),t}function A(e,t,n,r,o,s){if(!e)return u;var a=1;if(-1===t&&(t=6),r<0?(a=0,r=-r):15<r&&(a=2,r-=16),o<1||9<o||8!==n||r<8||15<r||t<0||9<t||s<0||4<s)return p(e,u);8===r&&(r=9);var l=new T;return(e.state=l).strm=e,l.wrap=a,l.gzhead=null,l.w_bits=r,l.w_size=1<<l.w_bits,l.w_mask=l.w_size-1,l.hash_bits=o+7,l.hash_size=1<<l.hash_bits,l.hash_mask=l.hash_size-1,l.hash_shift=~~((l.hash_bits+3-1)/3),l.window=new i.Buf8(2*l.w_size),l.head=new i.Buf16(l.hash_size),l.prev=new i.Buf16(l.w_size),l.lit_bufsize=1<<o+6,l.pending_buf_size=4*l.lit_bufsize,l.pending_buf=new i.Buf8(l.pending_buf_size),l.d_buf=1*l.lit_bufsize,l.l_buf=3*l.lit_bufsize,l.level=t,l.strategy=s,l.method=n,O(e)}r=[new S(0,0,0,0,function(e,t){var n=65535;for(n>e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(x(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,y(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-d&&(y(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(y(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(y(e,!1),e.strm.avail_out),1)}),new S(4,4,8,4,w),new S(4,5,16,8,w),new S(4,6,32,32,w),new S(4,4,16,16,E),new S(8,16,32,32,E),new S(8,16,128,128,E),new S(8,32,128,256,E),new S(32,128,258,1024,E),new S(32,258,258,4096,E)],n.deflateInit=function(e,t){return A(e,t,8,15,8,0)},n.deflateInit2=A,n.deflateReset=O,n.deflateResetKeep=k,n.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?u:(e.state.gzhead=t,0):u},n.deflate=function(e,t){var n,i,s,l;if(!e||!e.state||5<t||t<0)return e?p(e,u):u;if(i=e.state,!e.output||!e.input&&0!==e.avail_in||666===i.status&&4!==t)return p(e,0===e.avail_out?-5:u);if(i.strm=e,n=i.last_flush,i.last_flush=t,42===i.status)if(2===i.wrap)e.adler=0,b(i,31),b(i,139),b(i,8),i.gzhead?(b(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),b(i,255&i.gzhead.time),b(i,i.gzhead.time>>8&255),b(i,i.gzhead.time>>16&255),b(i,i.gzhead.time>>24&255),b(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),b(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(b(i,255&i.gzhead.extra.length),b(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=a(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(b(i,0),b(i,0),b(i,0),b(i,0),b(i,0),b(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),b(i,3),i.status=h);else{var d=8+(i.w_bits-8<<4)<<8;d|=(2<=i.strategy||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(d|=32),d+=31-d%31,i.status=h,v(i,d),0!==i.strstart&&(v(i,e.adler>>>16),v(i,65535&e.adler)),e.adler=1}if(69===i.status)if(i.gzhead.extra){for(s=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),g(e),s=i.pending,i.pending!==i.pending_buf_size));)b(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){s=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),g(e),s=i.pending,i.pending===i.pending_buf_size)){l=1;break}l=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,b(i,l)}while(0!==l);i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),0===l&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){s=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),g(e),s=i.pending,i.pending===i.pending_buf_size)){l=1;break}l=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,b(i,l)}while(0!==l);i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),0===l&&(i.status=103)}else i.status=103;if(103===i.status&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&g(e),i.pending+2<=i.pending_buf_size&&(b(i,255&e.adler),b(i,e.adler>>8&255),e.adler=0,i.status=h)):i.status=h),0!==i.pending){if(g(e),0===e.avail_out)return i.last_flush=-1,0}else if(0===e.avail_in&&f(t)<=f(n)&&4!==t)return p(e,-5);if(666===i.status&&0!==e.avail_in)return p(e,-5);if(0!==e.avail_in||0!==i.lookahead||0!==t&&666!==i.status){var _=2===i.strategy?function(e,t){for(var n;;){if(0===e.lookahead&&(x(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,n=o._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(y(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(y(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(y(e,!1),0===e.strm.avail_out)?1:2}(i,t):3===i.strategy?function(e,t){for(var n,r,i,s,a=e.window;;){if(e.lookahead<=c){if(x(e),e.lookahead<=c&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&0<e.strstart&&(r=a[i=e.strstart-1])===a[++i]&&r===a[++i]&&r===a[++i]){s=e.strstart+c;do{}while(r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&i<s);e.match_length=c-(s-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(n=o._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=o._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(y(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(y(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(y(e,!1),0===e.strm.avail_out)?1:2}(i,t):r[i.level].func(i,t);if(3!==_&&4!==_||(i.status=666),1===_||3===_)return 0===e.avail_out&&(i.last_flush=-1),0;if(2===_&&(1===t?o._tr_align(i):5!==t&&(o._tr_stored_block(i,0,0,!1),3===t&&(m(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),g(e),0===e.avail_out))return i.last_flush=-1,0}return 4!==t?0:i.wrap<=0?1:(2===i.wrap?(b(i,255&e.adler),b(i,e.adler>>8&255),b(i,e.adler>>16&255),b(i,e.adler>>24&255),b(i,255&e.total_in),b(i,e.total_in>>8&255),b(i,e.total_in>>16&255),b(i,e.total_in>>24&255)):(v(i,e.adler>>>16),v(i,65535&e.adler)),g(e),0<i.wrap&&(i.wrap=-i.wrap),0!==i.pending?0:1)},n.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&103!==t&&t!==h&&666!==t?p(e,u):(e.state=null,t===h?p(e,-3):0):u},n.deflateSetDictionary=function(e,t){var n,r,o,a,l,c,d,h,p=t.length;if(!e||!e.state)return u;if(2===(a=(n=e.state).wrap)||1===a&&42!==n.status||n.lookahead)return u;for(1===a&&(e.adler=s(e.adler,t,p,0)),n.wrap=0,p>=n.w_size&&(0===a&&(m(n.head),n.strstart=0,n.block_start=0,n.insert=0),h=new i.Buf8(n.w_size),i.arraySet(h,t,p-n.w_size,n.w_size,0),t=h,p=n.w_size),l=e.avail_in,c=e.next_in,d=e.input,e.avail_in=p,e.next_in=0,e.input=t,x(n);n.lookahead>=3;){for(r=n.strstart,o=n.lookahead-2;n.ins_h=(n.ins_h<<n.hash_shift^n.window[r+3-1])&n.hash_mask,n.prev[r&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=r,r++,--o;);n.strstart=r,n.lookahead=2,x(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,e.next_in=c,e.input=d,e.avail_in=l,n.wrap=a,0},n.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,n){t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(e,t,n){t.exports=function(e,t){var n,r,i,o,s,a,l,u,c,d,h,p,f,m,g,y,b,v,_,x,w,E,S,T,k;n=e.state,r=e.next_in,T=e.input,i=r+(e.avail_in-5),o=e.next_out,k=e.output,s=o-(t-e.avail_out),a=o+(e.avail_out-257),l=n.dmax,u=n.wsize,c=n.whave,d=n.wnext,h=n.window,p=n.hold,f=n.bits,m=n.lencode,g=n.distcode,y=(1<<n.lenbits)-1,b=(1<<n.distbits)-1;e:do{f<15&&(p+=T[r++]<<f,f+=8,p+=T[r++]<<f,f+=8),v=m[p&y];t:for(;;){if(p>>>=_=v>>>24,f-=_,0==(_=v>>>16&255))k[o++]=65535&v;else{if(!(16&_)){if(!(64&_)){v=m[(65535&v)+(p&(1<<_)-1)];continue t}if(32&_){n.mode=12;break e}e.msg="invalid literal/length code",n.mode=30;break e}x=65535&v,(_&=15)&&(f<_&&(p+=T[r++]<<f,f+=8),x+=p&(1<<_)-1,p>>>=_,f-=_),f<15&&(p+=T[r++]<<f,f+=8,p+=T[r++]<<f,f+=8),v=g[p&b];n:for(;;){if(p>>>=_=v>>>24,f-=_,!(16&(_=v>>>16&255))){if(!(64&_)){v=g[(65535&v)+(p&(1<<_)-1)];continue n}e.msg="invalid distance code",n.mode=30;break e}if(w=65535&v,f<(_&=15)&&(p+=T[r++]<<f,(f+=8)<_&&(p+=T[r++]<<f,f+=8)),l<(w+=p&(1<<_)-1)){e.msg="invalid distance too far back",n.mode=30;break e}if(p>>>=_,f-=_,(_=o-s)<w){if(c<(_=w-_)&&n.sane){e.msg="invalid distance too far back",n.mode=30;break e}if(S=h,(E=0)===d){if(E+=u-_,_<x){for(x-=_;k[o++]=h[E++],--_;);E=o-w,S=k}}else if(d<_){if(E+=u+d-_,(_-=d)<x){for(x-=_;k[o++]=h[E++],--_;);if(E=0,d<x){for(x-=_=d;k[o++]=h[E++],--_;);E=o-w,S=k}}}else if(E+=d-_,_<x){for(x-=_;k[o++]=h[E++],--_;);E=o-w,S=k}for(;2<x;)k[o++]=S[E++],k[o++]=S[E++],k[o++]=S[E++],x-=3;x&&(k[o++]=S[E++],1<x&&(k[o++]=S[E++]))}else{for(E=o-w;k[o++]=k[E++],k[o++]=k[E++],k[o++]=k[E++],2<(x-=3););x&&(k[o++]=k[E++],1<x&&(k[o++]=k[E++]))}break}}break}}while(r<i&&o<a);r-=x=f>>3,p&=(1<<(f-=x<<3))-1,e.next_in=r,e.next_out=o,e.avail_in=r<i?i-r+5:5-(r-i),e.avail_out=o<a?a-o+257:257-(o-a),n.hold=p,n.bits=f}},{}],49:[function(e,t,n){var r=e("../utils/common"),i=e("./adler32"),o=e("./crc32"),s=e("./inffast"),a=e("./inftrees"),l=-2;function u(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function c(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function d(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new r.Buf32(852),t.distcode=t.distdyn=new r.Buf32(592),t.sane=1,t.back=-1,0):l}function h(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,d(e)):l}function p(e,t){var n,r;return e&&e.state?(r=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15<t)?l:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,h(e))):l}function f(e,t){var n,r;return e?(r=new c,(e.state=r).window=null,0!==(n=p(e,t))&&(e.state=null),n):l}var m,g,y=!0;function b(e){if(y){var t;for(m=new r.Buf32(512),g=new r.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(a(1,e.lens,0,288,m,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;a(2,e.lens,0,32,g,0,e.work,{bits:5}),y=!1}e.lencode=m,e.lenbits=9,e.distcode=g,e.distbits=5}function v(e,t,n,i){var o,s=e.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new r.Buf8(s.wsize)),i>=s.wsize?(r.arraySet(s.window,t,n-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(i<(o=s.wsize-s.wnext)&&(o=i),r.arraySet(s.window,t,n-i,o,s.wnext),(i-=o)?(r.arraySet(s.window,t,n-i,i,0),s.wnext=i,s.whave=s.wsize):(s.wnext+=o,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=o))),0}n.inflateReset=h,n.inflateReset2=p,n.inflateResetKeep=d,n.inflateInit=function(e){return f(e,15)},n.inflateInit2=f,n.inflate=function(e,t){var n,c,d,h,p,f,m,g,y,_,x,w,E,S,T,k,O,A,C,R,N,P,M,D,I=0,z=new r.Buf8(4),F=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return l;12===(n=e.state).mode&&(n.mode=13),p=e.next_out,d=e.output,m=e.avail_out,h=e.next_in,c=e.input,f=e.avail_in,g=n.hold,y=n.bits,_=f,x=m,P=0;e:for(;;)switch(n.mode){case 1:if(0===n.wrap){n.mode=13;break}for(;y<16;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}if(2&n.wrap&&35615===g){z[n.check=0]=255&g,z[1]=g>>>8&255,n.check=o(n.check,z,2,0),y=g=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&g)<<8)+(g>>8))%31){e.msg="incorrect header check",n.mode=30;break}if(8!=(15&g)){e.msg="unknown compression method",n.mode=30;break}if(y-=4,N=8+(15&(g>>>=4)),0===n.wbits)n.wbits=N;else if(N>n.wbits){e.msg="invalid window size",n.mode=30;break}n.dmax=1<<N,e.adler=n.check=1,n.mode=512&g?10:12,y=g=0;break;case 2:for(;y<16;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}if(n.flags=g,8!=(255&n.flags)){e.msg="unknown compression method",n.mode=30;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=30;break}n.head&&(n.head.text=g>>8&1),512&n.flags&&(z[0]=255&g,z[1]=g>>>8&255,n.check=o(n.check,z,2,0)),y=g=0,n.mode=3;case 3:for(;y<32;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}n.head&&(n.head.time=g),512&n.flags&&(z[0]=255&g,z[1]=g>>>8&255,z[2]=g>>>16&255,z[3]=g>>>24&255,n.check=o(n.check,z,4,0)),y=g=0,n.mode=4;case 4:for(;y<16;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}n.head&&(n.head.xflags=255&g,n.head.os=g>>8),512&n.flags&&(z[0]=255&g,z[1]=g>>>8&255,n.check=o(n.check,z,2,0)),y=g=0,n.mode=5;case 5:if(1024&n.flags){for(;y<16;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}n.length=g,n.head&&(n.head.extra_len=g),512&n.flags&&(z[0]=255&g,z[1]=g>>>8&255,n.check=o(n.check,z,2,0)),y=g=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(f<(w=n.length)&&(w=f),w&&(n.head&&(N=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),r.arraySet(n.head.extra,c,h,w,N)),512&n.flags&&(n.check=o(n.check,c,w,h)),f-=w,h+=w,n.length-=w),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===f)break e;for(w=0;N=c[h+w++],n.head&&N&&n.length<65536&&(n.head.name+=String.fromCharCode(N)),N&&w<f;);if(512&n.flags&&(n.check=o(n.check,c,w,h)),f-=w,h+=w,N)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=8;case 8:if(4096&n.flags){if(0===f)break e;for(w=0;N=c[h+w++],n.head&&N&&n.length<65536&&(n.head.comment+=String.fromCharCode(N)),N&&w<f;);if(512&n.flags&&(n.check=o(n.check,c,w,h)),f-=w,h+=w,N)break e}else n.head&&(n.head.comment=null);n.mode=9;case 9:if(512&n.flags){for(;y<16;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}if(g!==(65535&n.check)){e.msg="header crc mismatch",n.mode=30;break}y=g=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;y<32;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}e.adler=n.check=u(g),y=g=0,n.mode=11;case 11:if(0===n.havedict)return e.next_out=p,e.avail_out=m,e.next_in=h,e.avail_in=f,n.hold=g,n.bits=y,2;e.adler=n.check=1,n.mode=12;case 12:if(5===t||6===t)break e;case 13:if(n.last){g>>>=7&y,y-=7&y,n.mode=27;break}for(;y<3;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}switch(n.last=1&g,y-=1,3&(g>>>=1)){case 0:n.mode=14;break;case 1:if(b(n),n.mode=20,6!==t)break;g>>>=2,y-=2;break e;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=30}g>>>=2,y-=2;break;case 14:for(g>>>=7&y,y-=7&y;y<32;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}if((65535&g)!=(g>>>16^65535)){e.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&g,y=g=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(w=n.length){if(f<w&&(w=f),m<w&&(w=m),0===w)break e;r.arraySet(d,c,h,w,p),f-=w,h+=w,m-=w,p+=w,n.length-=w;break}n.mode=12;break;case 17:for(;y<14;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}if(n.nlen=257+(31&g),g>>>=5,y-=5,n.ndist=1+(31&g),g>>>=5,y-=5,n.ncode=4+(15&g),g>>>=4,y-=4,286<n.nlen||30<n.ndist){e.msg="too many length or distance symbols",n.mode=30;break}n.have=0,n.mode=18;case 18:for(;n.have<n.ncode;){for(;y<3;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}n.lens[F[n.have++]]=7&g,g>>>=3,y-=3}for(;n.have<19;)n.lens[F[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,M={bits:n.lenbits},P=a(0,n.lens,0,19,n.lencode,0,n.work,M),n.lenbits=M.bits,P){e.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have<n.nlen+n.ndist;){for(;k=(I=n.lencode[g&(1<<n.lenbits)-1])>>>16&255,O=65535&I,!((T=I>>>24)<=y);){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}if(O<16)g>>>=T,y-=T,n.lens[n.have++]=O;else{if(16===O){for(D=T+2;y<D;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}if(g>>>=T,y-=T,0===n.have){e.msg="invalid bit length repeat",n.mode=30;break}N=n.lens[n.have-1],w=3+(3&g),g>>>=2,y-=2}else if(17===O){for(D=T+3;y<D;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}y-=T,N=0,w=3+(7&(g>>>=T)),g>>>=3,y-=3}else{for(D=T+7;y<D;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}y-=T,N=0,w=11+(127&(g>>>=T)),g>>>=7,y-=7}if(n.have+w>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=30;break}for(;w--;)n.lens[n.have++]=N}}if(30===n.mode)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=30;break}if(n.lenbits=9,M={bits:n.lenbits},P=a(1,n.lens,0,n.nlen,n.lencode,0,n.work,M),n.lenbits=M.bits,P){e.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,M={bits:n.distbits},P=a(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,M),n.distbits=M.bits,P){e.msg="invalid distances set",n.mode=30;break}if(n.mode=20,6===t)break e;case 20:n.mode=21;case 21:if(6<=f&&258<=m){e.next_out=p,e.avail_out=m,e.next_in=h,e.avail_in=f,n.hold=g,n.bits=y,s(e,x),p=e.next_out,d=e.output,m=e.avail_out,h=e.next_in,c=e.input,f=e.avail_in,g=n.hold,y=n.bits,12===n.mode&&(n.back=-1);break}for(n.back=0;k=(I=n.lencode[g&(1<<n.lenbits)-1])>>>16&255,O=65535&I,!((T=I>>>24)<=y);){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}if(k&&!(240&k)){for(A=T,C=k,R=O;k=(I=n.lencode[R+((g&(1<<A+C)-1)>>A)])>>>16&255,O=65535&I,!(A+(T=I>>>24)<=y);){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}g>>>=A,y-=A,n.back+=A}if(g>>>=T,y-=T,n.back+=T,n.length=O,0===k){n.mode=26;break}if(32&k){n.back=-1,n.mode=12;break}if(64&k){e.msg="invalid literal/length code",n.mode=30;break}n.extra=15&k,n.mode=22;case 22:if(n.extra){for(D=n.extra;y<D;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}n.length+=g&(1<<n.extra)-1,g>>>=n.extra,y-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;k=(I=n.distcode[g&(1<<n.distbits)-1])>>>16&255,O=65535&I,!((T=I>>>24)<=y);){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}if(!(240&k)){for(A=T,C=k,R=O;k=(I=n.distcode[R+((g&(1<<A+C)-1)>>A)])>>>16&255,O=65535&I,!(A+(T=I>>>24)<=y);){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}g>>>=A,y-=A,n.back+=A}if(g>>>=T,y-=T,n.back+=T,64&k){e.msg="invalid distance code",n.mode=30;break}n.offset=O,n.extra=15&k,n.mode=24;case 24:if(n.extra){for(D=n.extra;y<D;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}n.offset+=g&(1<<n.extra)-1,g>>>=n.extra,y-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=30;break}n.mode=25;case 25:if(0===m)break e;if(w=x-m,n.offset>w){if((w=n.offset-w)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=30;break}E=w>n.wnext?(w-=n.wnext,n.wsize-w):n.wnext-w,w>n.length&&(w=n.length),S=n.window}else S=d,E=p-n.offset,w=n.length;for(m<w&&(w=m),m-=w,n.length-=w;d[p++]=S[E++],--w;);0===n.length&&(n.mode=21);break;case 26:if(0===m)break e;d[p++]=n.length,m--,n.mode=21;break;case 27:if(n.wrap){for(;y<32;){if(0===f)break e;f--,g|=c[h++]<<y,y+=8}if(x-=m,e.total_out+=x,n.total+=x,x&&(e.adler=n.check=n.flags?o(n.check,d,x,p-x):i(n.check,d,x,p-x)),x=m,(n.flags?g:u(g))!==n.check){e.msg="incorrect data check",n.mode=30;break}y=g=0}n.mode=28;case 28:if(n.wrap&&n.flags){for(;y<32;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}if(g!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=30;break}y=g=0}n.mode=29;case 29:P=1;break e;case 30:P=-3;break e;case 31:return-4;default:return l}return e.next_out=p,e.avail_out=m,e.next_in=h,e.avail_in=f,n.hold=g,n.bits=y,(n.wsize||x!==e.avail_out&&n.mode<30&&(n.mode<27||4!==t))&&v(e,e.output,e.next_out,x-e.avail_out)?(n.mode=31,-4):(_-=e.avail_in,x-=e.avail_out,e.total_in+=_,e.total_out+=x,n.total+=x,n.wrap&&x&&(e.adler=n.check=n.flags?o(n.check,d,x,e.next_out-x):i(n.check,d,x,e.next_out-x)),e.data_type=n.bits+(n.last?64:0)+(12===n.mode?128:0)+(20===n.mode||15===n.mode?256:0),(0==_&&0===x||4===t)&&0===P&&(P=-5),P)},n.inflateEnd=function(e){if(!e||!e.state)return l;var t=e.state;return t.window&&(t.window=null),e.state=null,0},n.inflateGetHeader=function(e,t){var n;return e&&e.state&&2&(n=e.state).wrap?((n.head=t).done=!1,0):l},n.inflateSetDictionary=function(e,t){var n,r=t.length;return e&&e.state?0!==(n=e.state).wrap&&11!==n.mode?l:11===n.mode&&i(1,t,r,0)!==n.check?-3:v(e,t,r,r)?(n.mode=31,-4):(n.havedict=1,0):l},n.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,n){var r=e("../utils/common"),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],s=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],a=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,n,l,u,c,d,h){var p,f,m,g,y,b,v,_,x,w=h.bits,E=0,S=0,T=0,k=0,O=0,A=0,C=0,R=0,N=0,P=0,M=null,D=0,I=new r.Buf16(16),z=new r.Buf16(16),F=null,L=0;for(E=0;E<=15;E++)I[E]=0;for(S=0;S<l;S++)I[t[n+S]]++;for(O=w,k=15;1<=k&&0===I[k];k--);if(k<O&&(O=k),0===k)return u[c++]=20971520,u[c++]=20971520,h.bits=1,0;for(T=1;T<k&&0===I[T];T++);for(O<T&&(O=T),E=R=1;E<=15;E++)if(R<<=1,(R-=I[E])<0)return-1;if(0<R&&(0===e||1!==k))return-1;for(z[1]=0,E=1;E<15;E++)z[E+1]=z[E]+I[E];for(S=0;S<l;S++)0!==t[n+S]&&(d[z[t[n+S]]++]=S);if(b=0===e?(M=F=d,19):1===e?(M=i,D-=257,F=o,L-=257,256):(M=s,F=a,-1),E=T,y=c,C=S=P=0,m=-1,g=(N=1<<(A=O))-1,1===e&&852<N||2===e&&592<N)return 1;for(;;){for(v=E-C,x=d[S]<b?(_=0,d[S]):d[S]>b?(_=F[L+d[S]],M[D+d[S]]):(_=96,0),p=1<<E-C,T=f=1<<A;u[y+(P>>C)+(f-=p)]=v<<24|_<<16|x,0!==f;);for(p=1<<E-1;P&p;)p>>=1;if(0!==p?(P&=p-1,P+=p):P=0,S++,0==--I[E]){if(E===k)break;E=t[n+d[S]]}if(O<E&&(P&g)!==m){for(0===C&&(C=O),y+=T,R=1<<(A=E-C);A+C<k&&!((R-=I[A+C])<=0);)A++,R<<=1;if(N+=1<<A,1===e&&852<N||2===e&&592<N)return 1;u[m=P&g]=O<<24|A<<16|y-c}}return 0!==P&&(u[y+P]=E-C<<24|64<<16),h.bits=O,0}},{"../utils/common":41}],51:[function(e,t,n){t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(e,t,n){var r=e("../utils/common");function i(e){for(var t=e.length;0<=--t;)e[t]=0}var o=256,s=286,a=30,l=15,u=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],c=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],d=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],h=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],p=new Array(576);i(p);var f=new Array(60);i(f);var m=new Array(512);i(m);var g=new Array(256);i(g);var y=new Array(29);i(y);var b,v,_,x=new Array(a);function w(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}function E(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function S(e){return e<256?m[e]:m[256+(e>>>7)]}function T(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function k(e,t,n){e.bi_valid>16-n?(e.bi_buf|=t<<e.bi_valid&65535,T(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=n-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)}function O(e,t,n){k(e,n[2*t],n[2*t+1])}function A(e,t){for(var n=0;n|=1&e,e>>>=1,n<<=1,0<--t;);return n>>>1}function C(e,t,n){var r,i,o=new Array(16),s=0;for(r=1;r<=l;r++)o[r]=s=s+n[r-1]<<1;for(i=0;i<=t;i++){var a=e[2*i+1];0!==a&&(e[2*i]=A(o[a]++,a))}}function R(e){var t;for(t=0;t<s;t++)e.dyn_ltree[2*t]=0;for(t=0;t<a;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function N(e){8<e.bi_valid?T(e,e.bi_buf):0<e.bi_valid&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function P(e,t,n,r){var i=2*t,o=2*n;return e[i]<e[o]||e[i]===e[o]&&r[t]<=r[n]}function M(e,t,n){for(var r=e.heap[n],i=n<<1;i<=e.heap_len&&(i<e.heap_len&&P(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!P(t,r,e.heap[i],e.depth));)e.heap[n]=e.heap[i],n=i,i<<=1;e.heap[n]=r}function D(e,t,n){var r,i,s,a,l=0;if(0!==e.last_lit)for(;r=e.pending_buf[e.d_buf+2*l]<<8|e.pending_buf[e.d_buf+2*l+1],i=e.pending_buf[e.l_buf+l],l++,0===r?O(e,i,t):(O(e,(s=g[i])+o+1,t),0!==(a=u[s])&&k(e,i-=y[s],a),O(e,s=S(--r),n),0!==(a=c[s])&&k(e,r-=x[s],a)),l<e.last_lit;);O(e,256,t)}function I(e,t){var n,r,i,o=t.dyn_tree,s=t.stat_desc.static_tree,a=t.stat_desc.has_stree,u=t.stat_desc.elems,c=-1;for(e.heap_len=0,e.heap_max=573,n=0;n<u;n++)0!==o[2*n]?(e.heap[++e.heap_len]=c=n,e.depth[n]=0):o[2*n+1]=0;for(;e.heap_len<2;)o[2*(i=e.heap[++e.heap_len]=c<2?++c:0)]=1,e.depth[i]=0,e.opt_len--,a&&(e.static_len-=s[2*i+1]);for(t.max_code=c,n=e.heap_len>>1;1<=n;n--)M(e,o,n);for(i=u;n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],M(e,o,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,o[2*i]=o[2*n]+o[2*r],e.depth[i]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,o[2*n+1]=o[2*r+1]=i,e.heap[1]=i++,M(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,r,i,o,s,a,u=t.dyn_tree,c=t.max_code,d=t.stat_desc.static_tree,h=t.stat_desc.has_stree,p=t.stat_desc.extra_bits,f=t.stat_desc.extra_base,m=t.stat_desc.max_length,g=0;for(o=0;o<=l;o++)e.bl_count[o]=0;for(u[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n<573;n++)m<(o=u[2*u[2*(r=e.heap[n])+1]+1]+1)&&(o=m,g++),u[2*r+1]=o,c<r||(e.bl_count[o]++,s=0,f<=r&&(s=p[r-f]),a=u[2*r],e.opt_len+=a*(o+s),h&&(e.static_len+=a*(d[2*r+1]+s)));if(0!==g){do{for(o=m-1;0===e.bl_count[o];)o--;e.bl_count[o]--,e.bl_count[o+1]+=2,e.bl_count[m]--,g-=2}while(0<g);for(o=m;0!==o;o--)for(r=e.bl_count[o];0!==r;)c<(i=e.heap[--n])||(u[2*i+1]!==o&&(e.opt_len+=(o-u[2*i+1])*u[2*i],u[2*i+1]=o),r--)}}(e,t),C(o,c,e.bl_count)}function z(e,t,n){var r,i,o=-1,s=t[1],a=0,l=7,u=4;for(0===s&&(l=138,u=3),t[2*(n+1)+1]=65535,r=0;r<=n;r++)i=s,s=t[2*(r+1)+1],++a<l&&i===s||(a<u?e.bl_tree[2*i]+=a:0!==i?(i!==o&&e.bl_tree[2*i]++,e.bl_tree[32]++):a<=10?e.bl_tree[34]++:e.bl_tree[36]++,o=i,u=(a=0)===s?(l=138,3):i===s?(l=6,3):(l=7,4))}function F(e,t,n){var r,i,o=-1,s=t[1],a=0,l=7,u=4;for(0===s&&(l=138,u=3),r=0;r<=n;r++)if(i=s,s=t[2*(r+1)+1],!(++a<l&&i===s)){if(a<u)for(;O(e,i,e.bl_tree),0!=--a;);else 0!==i?(i!==o&&(O(e,i,e.bl_tree),a--),O(e,16,e.bl_tree),k(e,a-3,2)):a<=10?(O(e,17,e.bl_tree),k(e,a-3,3)):(O(e,18,e.bl_tree),k(e,a-11,7));o=i,u=(a=0)===s?(l=138,3):i===s?(l=6,3):(l=7,4)}}i(x);var L=!1;function j(e,t,n,i){k(e,0+(i?1:0),3),function(e,t,n){N(e),T(e,n),T(e,~n),r.arraySet(e.pending_buf,e.window,t,n,e.pending),e.pending+=n}(e,t,n)}n._tr_init=function(e){L||(function(){var e,t,n,r,i,o=new Array(16);for(r=n=0;r<28;r++)for(y[r]=n,e=0;e<1<<u[r];e++)g[n++]=r;for(g[n-1]=r,r=i=0;r<16;r++)for(x[r]=i,e=0;e<1<<c[r];e++)m[i++]=r;for(i>>=7;r<a;r++)for(x[r]=i<<7,e=0;e<1<<c[r]-7;e++)m[256+i++]=r;for(t=0;t<=l;t++)o[t]=0;for(e=0;e<=143;)p[2*e+1]=8,e++,o[8]++;for(;e<=255;)p[2*e+1]=9,e++,o[9]++;for(;e<=279;)p[2*e+1]=7,e++,o[7]++;for(;e<=287;)p[2*e+1]=8,e++,o[8]++;for(C(p,287,o),e=0;e<a;e++)f[2*e+1]=5,f[2*e]=A(e,5);b=new w(p,u,257,s,l),v=new w(f,c,0,a,l),_=new w(new Array(0),d,0,19,7)}(),L=!0),e.l_desc=new E(e.dyn_ltree,b),e.d_desc=new E(e.dyn_dtree,v),e.bl_desc=new E(e.bl_tree,_),e.bi_buf=0,e.bi_valid=0,R(e)},n._tr_stored_block=j,n._tr_flush_block=function(e,t,n,r){var i,s,a=0;0<e.level?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<o;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),I(e,e.l_desc),I(e,e.d_desc),a=function(e){var t;for(z(e,e.dyn_ltree,e.l_desc.max_code),z(e,e.dyn_dtree,e.d_desc.max_code),I(e,e.bl_desc),t=18;3<=t&&0===e.bl_tree[2*h[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),i=e.opt_len+3+7>>>3,(s=e.static_len+3+7>>>3)<=i&&(i=s)):i=s=n+5,n+4<=i&&-1!==t?j(e,t,n,r):4===e.strategy||s===i?(k(e,2+(r?1:0),3),D(e,p,f)):(k(e,4+(r?1:0),3),function(e,t,n,r){var i;for(k(e,t-257,5),k(e,n-1,5),k(e,r-4,4),i=0;i<r;i++)k(e,e.bl_tree[2*h[i]+1],3);F(e,e.dyn_ltree,t-1),F(e,e.dyn_dtree,n-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),D(e,e.dyn_ltree,e.dyn_dtree)),R(e),r&&N(e)},n._tr_tally=function(e,t,n){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(g[n]+o+1)]++,e.dyn_dtree[2*S(t)]++),e.last_lit===e.lit_bufsize-1},n._tr_align=function(e){k(e,2,3),O(e,256,p),function(e){16===e.bi_valid?(T(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,n){t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,n){(function(e){!function(e){if(!e.setImmediate){var t,n,r,i,o=1,s={},a=!1,l=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,t="[object process]"==={}.toString.call(e.process)?function(e){!function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];_e.push(new Te(e,t)),1!==_e.length||xe||be(Se)}(function(){d(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?(i="setImmediate$"+Math.random()+"$",e.addEventListener?e.addEventListener("message",h,!1):e.attachEvent("onmessage",h),function(t){e.postMessage(i+t,"*")}):e.MessageChannel?((r=new MessageChannel).port1.onmessage=function(e){d(e.data)},function(e){r.port2.postMessage(e)}):l&&"onreadystatechange"in l.createElement("script")?(n=l.documentElement,function(e){var t=l.createElement("script");t.onreadystatechange=function(){d(e),t.onreadystatechange=null,n.removeChild(t),t=null},n.appendChild(t)}):function(e){setTimeout(d,0,e)},u.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var n=new Array(arguments.length-1),r=0;r<n.length;r++)n[r]=arguments[r+1];var i={callback:e,args:n};return s[o]=i,t(o),o++},u.clearImmediate=c}function c(e){delete s[e]}function d(e){if(a)setTimeout(d,0,e);else{var t=s[e];if(t){a=!0;try{!function(e){var t=e.callback,n=e.args;switch(n.length){case 0:t();break;case 1:t(n[0]);break;case 2:t(n[0],n[1]);break;case 3:t(n[0],n[1],n[2]);break;default:t.apply(undefined,n)}}(t)}finally{c(e),a=!1}}}}function h(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(i)&&d(+t.data.slice(i.length))}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,void 0!==p?p:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[10])(10)),lt.exports),ct=e.getDefaultExportFromCjs(ut),dt={},ht={},pt={};function ft(){if(Ce)return pt;function e(e){return null==e}return Ce=1,pt.isNothing=e,pt.isObject=function(e){return"object"==typeof e&&null!==e},pt.toArray=function(t){return Array.isArray(t)?t:e(t)?[]:[t]},pt.repeat=function(e,t){var n,r="";for(n=0;n<t;n+=1)r+=e;return r},pt.isNegativeZero=function(e){return 0===e&&Number.NEGATIVE_INFINITY===1/e},pt.extend=function(e,t){var n,r,i,o;if(t)for(n=0,r=(o=Object.keys(t)).length;n<r;n+=1)e[i=o[n]]=t[i];return e},pt}function mt(){if(Ne)return Re;function e(e,t){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||"",this.name="YAMLException",this.reason=e,this.mark=t,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():"")}return Ne=1,e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e.prototype.toString=function(e){var t=this.name+": ";return t+=this.reason||"(unknown reason)",!e&&this.mark&&(t+=" "+this.mark.toString()),t},Re=e}function gt(){if(Ie)return De;Ie=1;var e=mt(),t=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],n=["scalar","sequence","mapping"];return De=function(r,i){if(i=i||{},Object.keys(i).forEach(function(n){if(-1===t.indexOf(n))throw new e('Unknown option "'+n+'" is met in definition of "'+r+'" YAML type.')}),this.tag=r,this.kind=i.kind||null,this.resolve=i.resolve||function(){return!0},this.construct=i.construct||function(e){return e},this.instanceOf=i.instanceOf||null,this.predicate=i.predicate||null,this.represent=i.represent||null,this.defaultStyle=i.defaultStyle||null,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach(function(n){e[n].forEach(function(e){t[String(e)]=n})}),t}(i.styleAliases||null),-1===n.indexOf(this.kind))throw new e('Unknown kind "'+this.kind+'" is specified for "'+r+'" YAML type.')},De}function yt(){if(Fe)return ze;Fe=1;var e=ft(),t=mt(),n=gt();function r(e,t,n){var i=[];return e.include.forEach(function(e){n=r(e,t,n)}),e[t].forEach(function(e){n.forEach(function(t,n){t.tag===e.tag&&i.push(n)}),n.push(e)}),n.filter(function(e,t){return-1===i.indexOf(t)})}function i(e){this.include=e.include||[],this.implicit=e.implicit||[],this.explicit=e.explicit||[],this.implicit.forEach(function(e){if(e.loadKind&&"scalar"!==e.loadKind)throw new t("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}),this.compiledImplicit=r(this,"implicit",[]),this.compiledExplicit=r(this,"explicit",[]),this.compiledTypeMap=function(){var e,t,n={};function r(e){n[e.tag]=e}for(e=0,t=arguments.length;e<t;e+=1)arguments[e].forEach(r);return n}(this.compiledImplicit,this.compiledExplicit)}return i.DEFAULT=null,i.create=function(){var r,o;switch(arguments.length){case 1:r=i.DEFAULT,o=arguments[0];break;case 2:r=arguments[0],o=arguments[1];break;default:throw new t("Wrong number of arguments for Schema.create function")}if(r=e.toArray(r),o=e.toArray(o),!r.every(function(e){return e instanceof i}))throw new t("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");if(!o.every(function(e){return e instanceof n}))throw new t("Specified list of YAML types (or a single Type object) contains a non-Type object.");return new i({include:r,explicit:o})},ze=i}function bt(){if(je)return Le;je=1;var e=gt();return Le=new e("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}})}function vt(){if(Be)return $e;Be=1;var e=gt();return $e=new e("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}})}function _t(){if(Ue)return Ve;Ue=1;var e=gt();return Ve=new e("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})}function xt(){if(qe)return We;qe=1;var e=yt();return We=new e({explicit:[bt(),vt(),_t()]})}function wt(){if(He)return Ge;He=1;var e=gt();return Ge=new e("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})}function Et(){if(Ke)return Ye;Ke=1;var e=gt();return Ye=new e("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})}function St(){if(Ze)return Xe;Ze=1;var e=ft(),t=gt();function n(e){return 48<=e&&e<=55}function r(e){return 48<=e&&e<=57}return Xe=new t("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,i,o=e.length,s=0,a=!1;if(!o)return!1;if("-"!==(t=e[s])&&"+"!==t||(t=e[++s]),"0"===t){if(s+1===o)return!0;if("b"===(t=e[++s])){for(s++;s<o;s++)if("_"!==(t=e[s])){if("0"!==t&&"1"!==t)return!1;a=!0}return a}if("x"===t){for(s++;s<o;s++)if("_"!==(t=e[s])){if(!(48<=(i=e.charCodeAt(s))&&i<=57||65<=i&&i<=70||97<=i&&i<=102))return!1;a=!0}return a}for(;s<o;s++)if("_"!==(t=e[s])){if(!n(e.charCodeAt(s)))return!1;a=!0}return a}for(;s<o;s++)if("_"!==(t=e[s])){if(":"===t)break;if(!r(e.charCodeAt(s)))return!1;a=!0}return!!a&&(":"!==t||/^(:[0-5]?[0-9])+$/.test(e.slice(s)))},construct:function(e){var t,n,r=e,i=1,o=[];return-1!==r.indexOf("_")&&(r=r.replace(/_/g,"")),"-"!==(t=r[0])&&"+"!==t||("-"===t&&(i=-1),t=(r=r.slice(1))[0]),"0"===r?0:"0"===t?"b"===r[1]?i*parseInt(r.slice(2),2):"x"===r[1]?i*parseInt(r,16):i*parseInt(r,8):-1!==r.indexOf(":")?(r.split(":").forEach(function(e){o.unshift(parseInt(e,10))}),r=0,n=1,o.forEach(function(e){r+=e*n,n*=60}),i*r):i*parseInt(r,10)},predicate:function(t){return"[object Number]"===Object.prototype.toString.call(t)&&t%1==0&&!e.isNegativeZero(t)},represent:{binary:function(e){return"0b"+e.toString(2)},octal:function(e){return"0"+e.toString(8)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return"0x"+e.toString(16).toUpperCase()}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Xe}function Tt(){if(Qe)return Je;Qe=1;var e=ft(),t=gt(),n=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?|\\.[0-9_]+(?:[eE][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),r=/^[-+]?[0-9]+e/;return Je=new t("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!!n.test(e)},construct:function(e){var t,n,r,i;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,i=[],"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:t.indexOf(":")>=0?(t.split(":").forEach(function(e){i.unshift(parseFloat(e,10))}),t=0,r=1,i.forEach(function(e){t+=e*r,r*=60}),n*t):n*parseFloat(t,10)},predicate:function(t){return"[object Number]"===Object.prototype.toString.call(t)&&(t%1!=0||e.isNegativeZero(t))},represent:function(t,n){var i;if(isNaN(t))switch(n){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(n){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(n){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(e.isNegativeZero(t))return"-0.0";return i=t.toString(10),r.test(i)?i.replace("e",".e"):i},defaultStyle:"lowercase"})}function kt(){if(tt)return et;tt=1;var e=yt();return et=new e({include:[xt()],implicit:[wt(),Et(),St(),Tt()]})}function Ot(){if(rt)return nt;rt=1;var e=yt();return nt=new e({include:[kt()]})}function At(){if(ot)return it;ot=1;var e=gt(),t=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?)?$");return it=new e("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&null!==t.exec(e)},construct:function(e){var n,r,i,o,s,a,l,u,c=0,d=null;if(null===(n=t.exec(e)))throw new Error("Date resolve error");if(r=+n[1],i=+n[2]-1,o=+n[3],!n[4])return new Date(Date.UTC(r,i,o));if(s=+n[4],a=+n[5],l=+n[6],n[7]){for(c=n[7].slice(0,3);c.length<3;)c+="0";c=+c}return n[9]&&(d=6e4*(60*+n[10]+ +(n[11]||0)),"-"===n[9]&&(d=-d)),u=new Date(Date.UTC(r,i,o,s,a,l,c)),d&&u.setTime(u.getTime()-d),u},instanceOf:Date,represent:function(e){return e.toISOString()}})}function Ct(){if(at)return st;at=1;var e=gt();return st=new e("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}})}var Rt,Nt,Pt,Mt,Dt,It,zt,Ft,Lt,jt,$t,Bt,Vt,Ut,Wt,qt,Gt,Ht,Yt,Kt,Xt,Zt,Jt=e.getAugmentedNamespace(pe);function Qt(){if(Nt)return Rt;Nt=1;var e=Jt.Buffer,t=gt(),n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";return Rt=new t("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,r,i=0,o=e.length,s=n;for(r=0;r<o;r++)if(!((t=s.indexOf(e.charAt(r)))>64)){if(t<0)return!1;i+=6}return i%8==0},construct:function(t){var r,i,o=t.replace(/[\r\n=]/g,""),s=o.length,a=n,l=0,u=[];for(r=0;r<s;r++)r%4==0&&r&&(u.push(l>>16&255),u.push(l>>8&255),u.push(255&l)),l=l<<6|a.indexOf(o.charAt(r));return 0==(i=s%4*6)?(u.push(l>>16&255),u.push(l>>8&255),u.push(255&l)):18===i?(u.push(l>>10&255),u.push(l>>2&255)):12===i&&u.push(l>>4&255),e?new e(u):u},predicate:function(t){return e&&e.isBuffer(t)},represent:function(e){var t,r,i="",o=0,s=e.length,a=n;for(t=0;t<s;t++)t%3==0&&t&&(i+=a[o>>18&63],i+=a[o>>12&63],i+=a[o>>6&63],i+=a[63&o]),o=(o<<8)+e[t];return 0==(r=s%3)?(i+=a[o>>18&63],i+=a[o>>12&63],i+=a[o>>6&63],i+=a[63&o]):2===r?(i+=a[o>>10&63],i+=a[o>>4&63],i+=a[o<<2&63],i+=a[64]):1===r&&(i+=a[o>>2&63],i+=a[o<<4&63],i+=a[64],i+=a[64]),i}}),Rt}function en(){if(Mt)return Pt;Mt=1;var e=gt(),t=Object.prototype.hasOwnProperty,n=Object.prototype.toString;return Pt=new e("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var r,i,o,s,a,l=[],u=e;for(r=0,i=u.length;r<i;r+=1){if(o=u[r],a=!1,"[object Object]"!==n.call(o))return!1;for(s in o)if(t.call(o,s)){if(a)return!1;a=!0}if(!a)return!1;if(-1!==l.indexOf(s))return!1;l.push(s)}return!0},construct:function(e){return null!==e?e:[]}}),Pt}function tn(){if(It)return Dt;It=1;var e=gt(),t=Object.prototype.toString;return Dt=new e("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(e){if(null===e)return!0;var n,r,i,o,s,a=e;for(s=new Array(a.length),n=0,r=a.length;n<r;n+=1){if(i=a[n],"[object Object]"!==t.call(i))return!1;if(1!==(o=Object.keys(i)).length)return!1;s[n]=[o[0],i[o[0]]]}return!0},construct:function(e){if(null===e)return[];var t,n,r,i,o,s=e;for(o=new Array(s.length),t=0,n=s.length;t<n;t+=1)r=s[t],i=Object.keys(r),o[t]=[i[0],r[i[0]]];return o}}),Dt}function nn(){if(Ft)return zt;Ft=1;var e=gt(),t=Object.prototype.hasOwnProperty;return zt=new e("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(e){if(null===e)return!0;var n,r=e;for(n in r)if(t.call(r,n)&&null!==r[n])return!1;return!0},construct:function(e){return null!==e?e:{}}})}function rn(){if(jt)return Lt;jt=1;var e=yt();return Lt=new e({include:[Ot()],implicit:[At(),Ct()],explicit:[Qt(),en(),tn(),nn()]})}function on(){if(Bt)return $t;Bt=1;var e=gt();return $t=new e("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:function(){return!0},construct:function(){},predicate:function(e){return void 0===e},represent:function(){return""}})}function sn(){if(Ut)return Vt;Ut=1;var e=gt();return Vt=new e("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:function(e){if(null===e)return!1;if(0===e.length)return!1;var t=e,n=/\/([gim]*)$/.exec(e),r="";if("/"===t[0]){if(n&&(r=n[1]),r.length>3)return!1;if("/"!==t[t.length-r.length-1])return!1}return!0},construct:function(e){var t=e,n=/\/([gim]*)$/.exec(e),r="";return"/"===t[0]&&(n&&(r=n[1]),t=t.slice(1,t.length-r.length-1)),new RegExp(t,r)},predicate:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},represent:function(e){var t="/"+e.source+"/";return e.global&&(t+="g"),e.multiline&&(t+="m"),e.ignoreCase&&(t+="i"),t}})}function an(){if(qt)return Wt;var e;qt=1;try{e=Oe("esprima")}catch(t){"undefined"!=typeof window&&(e=window.esprima)}var t=gt();return Wt=new t("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:function(t){if(null===t)return!1;try{var n="("+t+")",r=e.parse(n,{range:!0});return"Program"===r.type&&1===r.body.length&&"ExpressionStatement"===r.body[0].type&&"FunctionExpression"===r.body[0].expression.type}catch(e){return!1}},construct:function(t){var n,r="("+t+")",i=e.parse(r,{range:!0}),o=[];if("Program"!==i.type||1!==i.body.length||"ExpressionStatement"!==i.body[0].type||"FunctionExpression"!==i.body[0].expression.type)throw new Error("Failed to resolve function");return i.body[0].expression.params.forEach(function(e){o.push(e.name)}),n=i.body[0].expression.body.range,new Function(o,r.slice(n[0]+1,n[1]-1))},predicate:function(e){return"[object Function]"===Object.prototype.toString.call(e)},represent:function(e){return e.toString()}})}function ln(){if(Ht)return Gt;Ht=1;var e=yt();return Gt=e.DEFAULT=new e({include:[rn()],explicit:[on(),sn(),an()]})}var un=function(){if(Zt)return Xt;Zt=1;var e=function(){if(Kt)return dt;Kt=1;var e=function(){if(Yt)return ht;Yt=1;var e=ft(),t=mt(),n=function(){if(Me)return Pe;Me=1;var e=ft();function t(e,t,n,r,i){this.name=e,this.buffer=t,this.position=n,this.line=r,this.column=i}return t.prototype.getSnippet=function(t,n){var r,i,o,s,a;if(!this.buffer)return null;for(t=t||4,n=n||75,r="",i=this.position;i>0&&-1==="\0\r\n
\u2028\u2029".indexOf(this.buffer.charAt(i-1));)if(i-=1,this.position-i>n/2-1){r=" ... ",i+=5;break}for(o="",s=this.position;s<this.buffer.length&&-1==="\0\r\n
\u2028\u2029".indexOf(this.buffer.charAt(s));)if((s+=1)-this.position>n/2-1){o=" ... ",s-=5;break}return a=this.buffer.slice(i,s),e.repeat(" ",t)+r+a+o+"\n"+e.repeat(" ",t+this.position-i+r.length)+"^"},t.prototype.toString=function(e){var t,n="";return this.name&&(n+='in "'+this.name+'" '),n+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet())&&(n+=":\n"+t),n},Pe=t}(),r=rn(),i=ln(),o=Object.prototype.hasOwnProperty,s=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,a=/[\x85\u2028\u2029]/,l=/[,\[\]\{\}]/,u=/^(?:!|!!|![a-z\-]+!)$/i,c=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function d(e){return 10===e||13===e}function h(e){return 9===e||32===e}function p(e){return 9===e||32===e||10===e||13===e}function f(e){return 44===e||91===e||93===e||123===e||125===e}function m(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function g(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e||9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"
":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function y(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}for(var b=new Array(256),v=new Array(256),_=0;_<256;_++)b[_]=g(_)?1:0,v[_]=g(_);function x(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||i,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function w(e,r){return new t(r,new n(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function E(e,t){throw w(e,t)}function S(e,t){e.onWarning&&e.onWarning.call(null,w(e,t))}var T={YAML:function(e,t,n){var r,i,o;null!==e.version&&E(e,"duplication of %YAML directive"),1!==n.length&&E(e,"YAML directive accepts exactly one argument"),null===(r=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&E(e,"ill-formed argument of the YAML directive"),i=parseInt(r[1],10),o=parseInt(r[2],10),1!==i&&E(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,1!==o&&2!==o&&S(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var r,i;2!==n.length&&E(e,"TAG directive accepts exactly two arguments"),r=n[0],i=n[1],u.test(r)||E(e,"ill-formed tag handle (first argument) of the TAG directive"),o.call(e.tagMap,r)&&E(e,'there is a previously declared suffix for "'+r+'" tag handle'),c.test(i)||E(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[r]=i}};function k(e,t,n,r){var i,o,a,l;if(t<n){if(l=e.input.slice(t,n),r)for(i=0,o=l.length;i<o;i+=1)9===(a=l.charCodeAt(i))||32<=a&&a<=1114111||E(e,"expected valid JSON character");else s.test(l)&&E(e,"the stream contains non-printable characters");e.result+=l}}function O(t,n,r,i){var s,a,l,u;for(e.isObject(r)||E(t,"cannot merge mappings; the provided source object is unacceptable"),l=0,u=(s=Object.keys(r)).length;l<u;l+=1)a=s[l],o.call(n,a)||(n[a]=r[a],i[a]=!0)}function A(e,t,n,r,i,s){var a,l;if(i=String(i),null===t&&(t={}),"tag:yaml.org,2002:merge"===r)if(Array.isArray(s))for(a=0,l=s.length;a<l;a+=1)O(e,t,s[a],n);else O(e,t,s,n);else e.json||o.call(n,i)||!o.call(t,i)||E(e,"duplicated mapping key"),t[i]=s,delete n[i];return t}function C(e){var t;10===(t=e.input.charCodeAt(e.position))?e.position++:13===t?(e.position++,10===e.input.charCodeAt(e.position)&&e.position++):E(e,"a line break is expected"),e.line+=1,e.lineStart=e.position}function R(e,t,n){for(var r=0,i=e.input.charCodeAt(e.position);0!==i;){for(;h(i);)i=e.input.charCodeAt(++e.position);if(t&&35===i)do{i=e.input.charCodeAt(++e.position)}while(10!==i&&13!==i&&0!==i);if(!d(i))break;for(C(e),i=e.input.charCodeAt(e.position),r++,e.lineIndent=0;32===i;)e.lineIndent++,i=e.input.charCodeAt(++e.position)}return-1!==n&&0!==r&&e.lineIndent<n&&S(e,"deficient indentation"),r}function N(e){var t,n=e.position;return!(45!==(t=e.input.charCodeAt(n))&&46!==t||t!==e.input.charCodeAt(n+1)||t!==e.input.charCodeAt(n+2)||(n+=3,0!==(t=e.input.charCodeAt(n))&&!p(t)))}function P(t,n){1===n?t.result+=" ":n>1&&(t.result+=e.repeat("\n",n-1))}function M(e,t){var n,r,i=e.tag,o=e.anchor,s=[],a=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=s),r=e.input.charCodeAt(e.position);0!==r&&45===r&&p(e.input.charCodeAt(e.position+1));)if(a=!0,e.position++,R(e,!0,-1)&&e.lineIndent<=t)s.push(null),r=e.input.charCodeAt(e.position);else if(n=e.line,z(e,t,3,!1,!0),s.push(e.result),R(e,!0,-1),r=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==r)E(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break;return!!a&&(e.tag=i,e.anchor=o,e.kind="sequence",e.result=s,!0)}function D(e){var t,n,r,i,s=!1,a=!1;if(33!==(i=e.input.charCodeAt(e.position)))return!1;if(null!==e.tag&&E(e,"duplication of a tag property"),60===(i=e.input.charCodeAt(++e.position))?(s=!0,i=e.input.charCodeAt(++e.position)):33===i?(a=!0,n="!!",i=e.input.charCodeAt(++e.position)):n="!",t=e.position,s){do{i=e.input.charCodeAt(++e.position)}while(0!==i&&62!==i);e.position<e.length?(r=e.input.slice(t,e.position),i=e.input.charCodeAt(++e.position)):E(e,"unexpected end of the stream within a verbatim tag")}else{for(;0!==i&&!p(i);)33===i&&(a?E(e,"tag suffix cannot contain exclamation marks"):(n=e.input.slice(t-1,e.position+1),u.test(n)||E(e,"named tag handle cannot contain such characters"),a=!0,t=e.position+1)),i=e.input.charCodeAt(++e.position);r=e.input.slice(t,e.position),l.test(r)&&E(e,"tag suffix cannot contain flow indicator characters")}return r&&!c.test(r)&&E(e,"tag name cannot contain such characters: "+r),s?e.tag=r:o.call(e.tagMap,n)?e.tag=e.tagMap[n]+r:"!"===n?e.tag="!"+r:"!!"===n?e.tag="tag:yaml.org,2002:"+r:E(e,'undeclared tag handle "'+n+'"'),!0}function I(e){var t,n;if(38!==(n=e.input.charCodeAt(e.position)))return!1;for(null!==e.anchor&&E(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;0!==n&&!p(n)&&!f(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&E(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function z(t,n,r,i,s){var a,l,u,c,g,_,x,w,S=1,T=!1,O=!1;if(null!==t.listener&&t.listener("open",t),t.tag=null,t.anchor=null,t.kind=null,t.result=null,a=l=u=4===r||3===r,i&&R(t,!0,-1)&&(T=!0,t.lineIndent>n?S=1:t.lineIndent===n?S=0:t.lineIndent<n&&(S=-1)),1===S)for(;D(t)||I(t);)R(t,!0,-1)?(T=!0,u=a,t.lineIndent>n?S=1:t.lineIndent===n?S=0:t.lineIndent<n&&(S=-1)):u=!1;if(u&&(u=T||s),1!==S&&4!==r||(x=1===r||2===r?n:n+1,w=t.position-t.lineStart,1===S?u&&(M(t,w)||function(e,t,n){var r,i,o,s,a=e.tag,l=e.anchor,u={},c={},d=null,f=null,m=null,g=!1,y=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=u),s=e.input.charCodeAt(e.position);0!==s;){if(r=e.input.charCodeAt(e.position+1),o=e.line,63!==s&&58!==s||!p(r)){if(!z(e,n,2,!1,!0))break;if(e.line===o){for(s=e.input.charCodeAt(e.position);h(s);)s=e.input.charCodeAt(++e.position);if(58===s)p(s=e.input.charCodeAt(++e.position))||E(e,"a whitespace character is expected after the key-value separator within a block mapping"),g&&(A(e,u,c,d,f,null),d=f=m=null),y=!0,g=!1,i=!1,d=e.tag,f=e.result;else{if(!y)return e.tag=a,e.anchor=l,!0;E(e,"can not read an implicit mapping pair; a colon is missed")}}else{if(!y)return e.tag=a,e.anchor=l,!0;E(e,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===s?(g&&(A(e,u,c,d,f,null),d=f=m=null),y=!0,g=!0,i=!0):g?(g=!1,i=!0):E(e,"incomplete explicit mapping pair; a key node is missed"),e.position+=1,s=r;if((e.line===o||e.lineIndent>t)&&(z(e,t,4,!0,i)&&(g?f=e.result:m=e.result),g||(A(e,u,c,d,f,m),d=f=m=null),R(e,!0,-1),s=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==s)E(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return g&&A(e,u,c,d,f,null),y&&(e.tag=a,e.anchor=l,e.kind="mapping",e.result=u),y}(t,w,x))||function(e,t){var n,r,i,o,s,a,l,u,c,d,h=!0,f=e.tag,m=e.anchor,g={};if(91===(d=e.input.charCodeAt(e.position)))i=93,a=!1,r=[];else{if(123!==d)return!1;i=125,a=!0,r={}}for(null!==e.anchor&&(e.anchorMap[e.anchor]=r),d=e.input.charCodeAt(++e.position);0!==d;){if(R(e,!0,t),(d=e.input.charCodeAt(e.position))===i)return e.position++,e.tag=f,e.anchor=m,e.kind=a?"mapping":"sequence",e.result=r,!0;h||E(e,"missed comma between flow collection entries"),c=null,o=s=!1,63===d&&p(e.input.charCodeAt(e.position+1))&&(o=s=!0,e.position++,R(e,!0,t)),n=e.line,z(e,t,1,!1,!0),u=e.tag,l=e.result,R(e,!0,t),d=e.input.charCodeAt(e.position),!s&&e.line!==n||58!==d||(o=!0,d=e.input.charCodeAt(++e.position),R(e,!0,t),z(e,t,1,!1,!0),c=e.result),a?A(e,r,g,u,l,c):o?r.push(A(e,null,g,u,l,c)):r.push(l),R(e,!0,t),44===(d=e.input.charCodeAt(e.position))?(h=!0,d=e.input.charCodeAt(++e.position)):h=!1}E(e,"unexpected end of the stream within a flow collection")}(t,x)?O=!0:(l&&function(t,n){var r,i,o,s,a,l=1,u=!1,c=n,p=0,f=!1;if(124===(s=t.input.charCodeAt(t.position)))i=!1;else{if(62!==s)return!1;i=!0}for(t.kind="scalar",t.result="";0!==s;)if(43===(s=t.input.charCodeAt(++t.position))||45===s)1===l?l=43===s?3:2:E(t,"repeat of a chomping mode identifier");else{if(!((o=48<=(a=s)&&a<=57?a-48:-1)>=0))break;0===o?E(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):u?E(t,"repeat of an indentation width identifier"):(c=n+o-1,u=!0)}if(h(s)){do{s=t.input.charCodeAt(++t.position)}while(h(s));if(35===s)do{s=t.input.charCodeAt(++t.position)}while(!d(s)&&0!==s)}for(;0!==s;){for(C(t),t.lineIndent=0,s=t.input.charCodeAt(t.position);(!u||t.lineIndent<c)&&32===s;)t.lineIndent++,s=t.input.charCodeAt(++t.position);if(!u&&t.lineIndent>c&&(c=t.lineIndent),d(s))p++;else{if(t.lineIndent<c){3===l?t.result+=e.repeat("\n",p):1===l&&u&&(t.result+="\n");break}for(i?h(s)?(f=!0,t.result+=e.repeat("\n",p+1)):f?(f=!1,t.result+=e.repeat("\n",p+1)):0===p?u&&(t.result+=" "):t.result+=e.repeat("\n",p):t.result+=u?e.repeat("\n",p+1):e.repeat("\n",p),u=!0,p=0,r=t.position;!d(s)&&0!==s;)s=t.input.charCodeAt(++t.position);k(t,r,t.position,!1)}}return!0}(t,x)||function(e,t){var n,r,i;if(39!==(n=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,r=i=e.position;0!==(n=e.input.charCodeAt(e.position));)if(39===n){if(k(e,r,e.position,!0),39!==(n=e.input.charCodeAt(++e.position)))return!0;r=i=e.position,e.position++}else d(n)?(k(e,r,i,!0),P(e,R(e,!1,t)),r=i=e.position):e.position===e.lineStart&&N(e)?E(e,"unexpected end of the document within a single quoted scalar"):(e.position++,i=e.position);E(e,"unexpected end of the stream within a single quoted scalar")}(t,x)||function(e,t){var n,r,i,o,s,a,l;if(34!==(a=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,n=r=e.position;0!==(a=e.input.charCodeAt(e.position));){if(34===a)return k(e,n,e.position,!0),e.position++,!0;if(92===a){if(k(e,n,e.position,!0),d(a=e.input.charCodeAt(++e.position)))R(e,!1,t);else if(a<256&&b[a])e.result+=v[a],e.position++;else if((s=120===(l=a)?2:117===l?4:85===l?8:0)>0){for(i=s,o=0;i>0;i--)(s=m(a=e.input.charCodeAt(++e.position)))>=0?o=(o<<4)+s:E(e,"expected hexadecimal character");e.result+=y(o),e.position++}else E(e,"unknown escape sequence");n=r=e.position}else d(a)?(k(e,n,r,!0),P(e,R(e,!1,t)),n=r=e.position):e.position===e.lineStart&&N(e)?E(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}E(e,"unexpected end of the stream within a double quoted scalar")}(t,x)?O=!0:function(e){var t,n,r;if(42!==(r=e.input.charCodeAt(e.position)))return!1;for(r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!p(r)&&!f(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&E(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),e.anchorMap.hasOwnProperty(n)||E(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],R(e,!0,-1),!0}(t)?(O=!0,null===t.tag&&null===t.anchor||E(t,"alias node should not have any properties")):function(e,t,n){var r,i,o,s,a,l,u,c,m=e.kind,g=e.result;if(p(c=e.input.charCodeAt(e.position))||f(c)||35===c||38===c||42===c||33===c||124===c||62===c||39===c||34===c||37===c||64===c||96===c)return!1;if((63===c||45===c)&&(p(r=e.input.charCodeAt(e.position+1))||n&&f(r)))return!1;for(e.kind="scalar",e.result="",i=o=e.position,s=!1;0!==c;){if(58===c){if(p(r=e.input.charCodeAt(e.position+1))||n&&f(r))break}else if(35===c){if(p(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&N(e)||n&&f(c))break;if(d(c)){if(a=e.line,l=e.lineStart,u=e.lineIndent,R(e,!1,-1),e.lineIndent>=t){s=!0,c=e.input.charCodeAt(e.position);continue}e.position=o,e.line=a,e.lineStart=l,e.lineIndent=u;break}}s&&(k(e,i,o,!1),P(e,e.line-a),i=o=e.position,s=!1),h(c)||(o=e.position+1),c=e.input.charCodeAt(++e.position)}return k(e,i,o,!1),!!e.result||(e.kind=m,e.result=g,!1)}(t,x,1===r)&&(O=!0,null===t.tag&&(t.tag="?")),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):0===S&&(O=u&&M(t,w))),null!==t.tag&&"!"!==t.tag)if("?"===t.tag){for(c=0,g=t.implicitTypes.length;c<g;c+=1)if((_=t.implicitTypes[c]).resolve(t.result)){t.result=_.construct(t.result),t.tag=_.tag,null!==t.anchor&&(t.anchorMap[t.anchor]=t.result);break}}else o.call(t.typeMap,t.tag)?(_=t.typeMap[t.tag],null!==t.result&&_.kind!==t.kind&&E(t,"unacceptable node kind for !<"+t.tag+'> tag; it should be "'+_.kind+'", not "'+t.kind+'"'),_.resolve(t.result)?(t.result=_.construct(t.result),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):E(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")):E(t,"unknown tag !<"+t.tag+">");return null!==t.listener&&t.listener("close",t),null!==t.tag||null!==t.anchor||O}function F(e){var t,n,r,i,s=e.position,l=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};0!==(i=e.input.charCodeAt(e.position))&&(R(e,!0,-1),i=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==i));){for(l=!0,i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!p(i);)i=e.input.charCodeAt(++e.position);for(r=[],(n=e.input.slice(t,e.position)).length<1&&E(e,"directive name must not be less than one character in length");0!==i;){for(;h(i);)i=e.input.charCodeAt(++e.position);if(35===i){do{i=e.input.charCodeAt(++e.position)}while(0!==i&&!d(i));break}if(d(i))break;for(t=e.position;0!==i&&!p(i);)i=e.input.charCodeAt(++e.position);r.push(e.input.slice(t,e.position))}0!==i&&C(e),o.call(T,n)?T[n](e,n,r):S(e,'unknown document directive "'+n+'"')}R(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,R(e,!0,-1)):l&&E(e,"directives end mark is expected"),z(e,e.lineIndent-1,4,!1,!0),R(e,!0,-1),e.checkLineBreaks&&a.test(e.input.slice(s,e.position))&&S(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&N(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,R(e,!0,-1)):e.position<e.length-1&&E(e,"end of the stream or a document separator is expected")}function L(e,t){t=t||{},0!==(e=String(e)).length&&(10!==e.charCodeAt(e.length-1)&&13!==e.charCodeAt(e.length-1)&&(e+="\n"),65279===e.charCodeAt(0)&&(e=e.slice(1)));var n=new x(e,t);for(n.input+="\0";32===n.input.charCodeAt(n.position);)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)F(n);return n.documents}function j(e,t,n){var r,i,o=L(e,n);for(r=0,i=o.length;r<i;r+=1)t(o[r])}function $(e,n){var r=L(e,n);if(0!==r.length){if(1===r.length)return r[0];throw new t("expected a single document in the stream, but found more")}}return ht.loadAll=j,ht.load=$,ht.safeLoadAll=function(t,n,i){j(t,n,e.extend({schema:r},i))},ht.safeLoad=function(t,n){return $(t,e.extend({schema:r},n))},ht}();function t(e){return function(){throw new Error("Function "+e+" is deprecated and cannot be used.")}}return dt.Type=gt(),dt.Schema=yt(),dt.FAILSAFE_SCHEMA=xt(),dt.JSON_SCHEMA=kt(),dt.CORE_SCHEMA=Ot(),dt.DEFAULT_SAFE_SCHEMA=rn(),dt.DEFAULT_FULL_SCHEMA=ln(),dt.load=e.load,dt.loadAll=e.loadAll,dt.safeLoad=e.safeLoad,dt.safeLoadAll=e.safeLoadAll,dt.YAMLException=mt(),dt.MINIMAL_SCHEMA=xt(),dt.SAFE_SCHEMA=rn(),dt.DEFAULT_SCHEMA=ln(),dt.scan=t("scan"),dt.parse=t("parse"),dt.compose=t("compose"),dt.addConstructor=t("addConstructor"),dt}();return Xt=e}(),cn=e.getDefaultExportFromCjs(un);class dn{constructor(t,n,r=null){this.url=t,!n||e.isRelativeURL(n)&&!e.isRelativeURL(this.url)?this.path=e.pathForURL(this.url):this.path=n,this.path_for_parent=n||this.path,this.parent=r,this.container=null,this.parent&&(this.parent.container?this.container=this.parent.container:this.parent.isContainer()&&(this.container=this.parent))}load(){return pn(this.url)}resourceFor(e){return{url:this.urlFor(e),path:this.pathFor(e),type:this.typeFor(e)}}urlFor(t){return u(t)?t:e.isRelativeURL(t)&&this.container?this.parent.urlFor(this.path_for_parent+t):e.addBaseURL(t,this.path)}pathFor(t){return e.pathForURL(t)}typeFor(t){return e.extensionForURL(t)}isContainer(){return!1}}class hn extends dn{constructor(e,t,n){super(e,t,n),this.zip=null,this.files={},this.root=null,this.path=""}isContainer(){return!0}async load(){if(this.zip=new ct,"string"==typeof this.url){const{body:t}=await e.Utils.io(this.url,6e4,"arraybuffer");return await this.zip.loadAsync(t),await this.parseZipFiles(),this.loadRoot()}return this}urlFor(t){return u(t)?t:e.isRelativeURL(t)?this.urlForZipFile(e.flattenRelativeURL(t)):super.urlFor(t)}typeFor(t){return e.isRelativeURL(t)?this.typeForZipFile(t):super.typeFor(t)}loadRoot(){return this.findRoot(),pn(this.urlForZipFile(this.root))}findRoot(){const t=Object.keys(this.files).filter(e=>0===this.files[e].depth).filter(t=>"yaml"===e.extensionForURL(t));if(1===t.length&&(this.root=t[0]),!this.root){let e=`Could not find root scene for bundle '${this.url}': `;throw e+="The zip archive's root level must contain a single scene file with the '.yaml' extension. ",t.length>0?e+=`Found multiple YAML files at the root level: ${t.map(e=>"'"+e+"'").join(", ")}.`:e+="Found NO YAML files at the root level.",Error(e)}}async parseZipFiles(){let t=[],n=[];this.zip.forEach((e,r)=>{r.dir||(t.push(e),n.push(r.async("arraybuffer")))});const r=await Promise.all(n);for(let n=0;n<r.length;n++){let i=t[n],o=i.split("/").length-1;this.files[i]={data:r[n],type:e.extensionForURL(i),depth:o}}}urlForZipFile(t){if(this.files[t])return this.files[t].url||(this.files[t].url=e.createObjectURL(new Blob([this.files[t].data]))),this.files[t].url}typeForZipFile(e){return this.files[e]&&this.files[e].type}}function pn(t){return new Promise((n,r)=>{"string"==typeof t?e.Utils.io(t).then(({body:e})=>{try{n(function(e){return cn.safeLoad(e,{json:!0})}(e))}catch(e){r(e)}},r):(t=Object.assign({},t),n(t))})}const fn={async loadScene(t,{path:n,type:r}={}){const i=[],o={},s=await this.loadSceneRecursive({url:t,path:n,type:r},null,o,i),{config:a,bundle:l}=this.finalize(s);if(!a)throw i[0];return i.length>0&&i.forEach(t=>{const n=`Failed to import scene: ${t.url}`;e.log("error",n,t),this.trigger("error",{type:"scene_import",message:n,error:t,url:t.url})}),{config:a,bundle:l,texture_nodes:o}},async loadSceneRecursive({url:t,path:n,type:r},i,o={},s=[]){if(!t)return{};const a=function(t,n,r,i=null){return null!=i&&"zip"===i||"string"==typeof t&&!e.isLocalURL(t)&&"zip"===e.extensionForURL(t)?new hn(t,n,r):new dn(t,n,r)}(t,n,i,r);try{let t=await a.load();if(null==t.import)return this.normalize(t,a,o),{config:t,bundle:a};Array.isArray(t.import)||(t.import=[t.import]);const n=[];t.import.forEach(t=>{"object"==typeof t&&(t=e.createObjectURL(new Blob([JSON.stringify(t)]))),n.push(a.resourceFor(t))}),delete t.import;const r=n.map(e=>this.loadSceneRecursive(e,a,o,s)),i=(await Promise.all(r)).map(e=>this.normalize(e.config,e.bundle,o)).map(e=>e.config);return this.normalize(t,a,o),t=e.mergeObjects(...i,t),{config:t,bundle:a,texture_nodes:o}}catch(e){return e.url=t,s.push(e),{}}},normalize(e,t,n={}){return this.normalizeDataSources(e,t),this.normalizeFonts(e,t),this.normalizeTextures(e,t),this.collectTextures(e,t,n),{config:e,bundle:t,texture_nodes:n}},normalizeDataSources(e,t){e.sources=e.sources||{};for(const n in e.sources)this.normalizeDataSource(e.sources[n],t);return e},normalizeDataSource(e,t){if(e.url=t.urlFor(e.url),Array.isArray(e.composite)&&e.composite.forEach(e=>e.url=t.urlFor(e.url)),e.scripts){Array.isArray(e.scripts)&&(e.scripts=e.scripts.reduce((e,t)=>(e[t]=t,e),{}));for(const n in e.scripts)e.scripts[n]=t.urlFor(e.scripts[n])}return e},normalizeFonts(e,t){e.fonts=e.fonts||{};const n=Object.values(e.fonts).filter(e=>"external"!==e);for(const e of n)(Array.isArray(e)?e:[e]).forEach(e=>e.url=t.urlFor(e.url));return e},normalizeTextures(e,t){if(e.textures=e.textures||{},e.textures)for(const n in e.textures){const r=e.textures[n];r.url&&(r.url=t.urlFor(r.url))}},collectTextures(t,n,r){if(t.styles)for(const e in t.styles){const i=t.styles[e],o=i.texture;if("string"==typeof o&&!t.textures[o]){const t=["styles",e,"texture"];this.addTextureNode(t,n,r)}i.material&&["emission","ambient","diffuse","specular","normal"].forEach(o=>{const s=null!=i.material[o]&&i.material[o].texture;if("string"==typeof s&&!t.textures[s]){const t=["styles",e,"material",o,"texture"];this.addTextureNode(t,n,r)}})}if(t.styles)for(const i in t.styles){const o=t.styles[i];o.shaders&&o.shaders.uniforms&&e.GLSL.parseUniforms(o.shaders.uniforms).forEach(({type:e,value:o,path:s})=>{if("sampler2D"===e&&"string"==typeof o&&!t.textures[o]){const e=["styles",i,"shaders","uniforms",...s];this.addTextureNode(e,n,r)}})}if(t.layers){const i=[t.layers],o=[["layers"]];for(;i.length>0;){const s=i.pop(),a=o.pop();if("object"==typeof s&&!Array.isArray(s))for(const l in s)if("draw"===l){const e=s[l];for(const i in e){if(e[i].texture){const o=e[i].texture;if("string"==typeof o&&!t.textures[o]){const e=[...a,l,"draw",i,"texture"];this.addTextureNode(e,n,r)}}if(e[i].outline&&e[i].outline.texture){const o=e[i].outline.texture;if("string"==typeof o&&!t.textures[o]){const e=[...a,l,"draw",i,"outline","texture"];this.addTextureNode(e,n,r)}}}}else{if(e.isReserved(l))continue;i.push(s[l]),o.push([...a,l])}}}},addTextureNode(e,t,n){n[JSON.stringify(e)]={path:e,bundle:t}},hoistTextureNodes(e,t,n={}){for(const{path:r,bundle:s}of Object.values(n)){const n=i(e,r);if("string"==typeof n&&null==e.textures[n])if(c(e,r)){const r=t.urlFor(n);e.textures[n]={url:r}}else{const t=s.urlFor(n);e.textures[t]={url:t},o(e,r,t)}}},applyGlobalProperties:e=>e.global&&0!==Object.keys(e.global).length?h(d(e.global),e):e,finalize:({config:e,bundle:t})=>e?(e.global=e.global||{},e.scene=e.scene||{},e.cameras=e.cameras||{},e.lights=e.lights||{},e.styles=e.styles||{},e.layers=e.layers||{},e.camera&&(e.cameras.default=e.camera),0===Object.keys(e.cameras).length&&(e.cameras.default={}),(0===Object.keys(e.lights).length||Object.keys(e.lights).every(t=>!1===e.lights[t].visible))&&(e.lights.default_light={type:"directional"}),{config:e,bundle:t}):{}};e.subscribeMixin(fn);class mn{constructor(){this.tiles={},this.max_proxy_descendant_depth=6,this.max_proxy_ancestor_depth=7,this.children_cache={}}addTile(t){for(this.tiles[t.key]=this.tiles[t.key]||{descendants:0},this.tiles[t.key].tile=t;t.style_z>=0;){if(!(t=e.TileID.parent(t)))return;this.tiles[t.key]||(this.tiles[t.key]={descendants:0}),this.tiles[t.key].descendants++}}removeTile(t){for(this.tiles[t.key]&&(delete this.tiles[t.key].tile,0===this.tiles[t.key].descendants&&delete this.tiles[t.key]);t.style_z>=0;){if(!(t=e.TileID.parent(t)))return;this.tiles[t.key]&&this.tiles[t.key].descendants>0&&(this.tiles[t.key].descendants--,0!==this.tiles[t.key].descendants||this.tiles[t.key].tile||delete this.tiles[t.key])}}getAncestor(t){let n=0;for(;n<this.max_proxy_ancestor_depth;){if(!(t=e.TileID.parent(t)))return;if(this.tiles[t.key]&&this.tiles[t.key].tile&&this.tiles[t.key].tile.loaded)return this.tiles[t.key].tile;n++}}getDescendants(t,n=0){let r=[];if(n<this.max_proxy_descendant_depth){let i=e.TileID.children(t,this.children_cache);if(!i)return;i.forEach(e=>{this.tiles[e.key]&&(this.tiles[e.key].tile&&this.tiles[e.key].tile.loaded?r.push(this.tiles[e.key].tile):this.tiles[e.key].descendants>0&&r.push(...this.getDescendants(e,n+1)))})}return r}}let gn={},yn={};function bn(t,n=null){if(this.obb)return e.Label.prototype.occluded.call(this,t,n);if(this.obbs)for(let r=0;r<this.obbs.length;r++){let i={aabb:this.aabbs[r],obb:this.obbs[r]};if(e.Label.prototype.occluded.call(i,t,n))return!0}return!1}class vn{constructor({scene:t}){this.scene=t,this.tiles={},this.pyramid=new mn,this.visible_coords={},this.queued_coords=[],this.building_tiles=null,this.renderable_tiles=[],this.collision={tile_keys:null,mesh_set:null,zoom:null,zoom_steps:3},this.main_thread_target=["TileManager",this.scene.id].join("_"),e.WorkerBroker.addTarget(this.main_thread_target,this)}destroy(){this.forEachTile(e=>e.destroy()),this.tiles={},this.pyramid=null,this.visible_coords={},this.queued_coords=[],this.scene=null,e.WorkerBroker.removeTarget(this.main_thread_target)}get view(){return this.scene.view}get style_manager(){return this.scene.style_manager}keepTile(e){this.tiles[e.key]=e,this.pyramid.addTile(e)}hasTile(e){return void 0!==this.tiles[e]}forgetTile(e){if(this.hasTile(e)){let t=this.tiles[e];this.pyramid.removeTile(t)}delete this.tiles[e],this.tileBuildStop(e)}removeTile(t){e.log("trace",`tile unload for ${t}`);var n=this.tiles[t];null!=n&&n.destroy(),this.forgetTile(n.key),this.scene.requestRedraw()}forEachTile(e){for(let t in this.tiles)e(this.tiles[t])}removeTiles(e){let t=[];for(let n in this.tiles)e(this.tiles[n])&&t.push(n);for(let e=0;e<t.length;e++){let n=t[e];this.removeTile(n)}}updateTilesForView(){this.visible_coords={};let e=this.view.findVisibleTileCoordinates();for(let t=0;t<e.length;t++){const n=e[t];this.queueCoordinate(n),this.visible_coords[n.key]=n}this.updateTileStates()}updateTileStates(){return this.forEachTile(e=>{this.updateVisibility(e)}),this.loadQueuedCoordinates(),this.updateProxyTiles(),this.view.pruneTilesForView(),this.updateRenderableTiles(),this.style_manager.updateActiveStyles(this.renderable_tiles),this.style_manager.updateActiveBlendOrders(this.renderable_tiles),this.updateLabels()}updateLabels(){var t=this;if(this.scene.building&&!this.scene.building.initial)return Promise.resolve({});const n=this.renderable_tiles.filter(e=>e.valid).filter(e=>e.built);return 0===n.length?Promise.resolve({}):(n.sort((e,t)=>e.build_id<t.build_id?-1:e.build_id>t.build_id?1:0),this.collision.zoom===_n(this.view.zoom,this.collision.zoom_steps)&&this.collision.tile_keys===JSON.stringify(n.map(e=>e.key))&&this.collision.mesh_set===xn(n)?Promise.resolve({}):(this.collision.task||(this.collision.zoom=_n(this.view.zoom,this.collision.zoom_steps),this.collision.tile_keys=JSON.stringify(n.map(e=>e.key)),this.collision.mesh_set=xn(n),this.collision.task={type:"tileManagerUpdateLabels",run:async function(r){const i=await async function(t,n,r=!1){yn=gn,gn={};let i=function(t,n){let r={};t.forEach(t=>{const i=e.Geo.unitsPerMeter(t.coords.z),o=Math.pow(2,n-t.style_z),s=i*o,a=e.Geo.metersPerPixel(n),l=Object.assign({},t.meshes,t.pending_label_meshes);for(let n in l)l[n].forEach(n=>{if(n.labels)for(let o in n.labels){if(t.isProxy()&&!yn[o])continue;const l=n.labels[o].container.label,u=n.labels[o].container.linked,c=n.labels[o].ranges;let d={};if(d.discard=bn.bind(d),d.build_id=t.build_id,Object.assign(d,l),d.layout=Object.assign({},l.layout),d.layout.repeat_scale=.75,d.layout.repeat_distance=d.layout.repeat_distance||0,d.layout.repeat_distance/=s,d.position=[d.position[0]/i+t.min.x,d.position[1]/i+t.min.y],d.unit_scale=a,"point"===d.type)e.LabelPoint.prototype.updateBBoxes.call(d);else if("straight"===d.type)e.LabelLineStraight.prototype.updateBBoxes.call(d,d.position,d.size,d.angle,d.angle,d.offset);else if(l.obbs){const n=l.obbs.map(n=>{let{x:r,y:o,a:a,w:l,h:u}=n;return r=r/i+t.min.x,o=o/i+t.min.y,l/=s,u/=s,new e.OBB(r,o,a,l,u)});d.obbs=n,d.aabbs=n.map(e=>e.getExtent())}r[o]={label:d,linked:u,ranges:c,mesh:n}}})});for(let e in r){const t=r[e];t.linked&&(t.linked=r[t.linked])}return r=Object.keys(r).map(e=>r[e]),r}(t,n);e.Collision.startTile("main",{apply_repeat_groups:!0,return_hidden:!0}),e.Collision.addStyle("main","main");const o=Math.max(0,...Object.values(t).map(e=>Object.values(e.meshes)).flat().map(e=>Math.max(0,...e.map(e=>e.labels?Object.keys(e.labels).length:0)))),s=Math.floor(o/e.Geo.tile_size);s>0?e.Collision.initGrid({anchor:{x:Math.min(...t.map(e=>e.min.x)),y:Math.min(...t.map(e=>e.min.y))},span:t[0].span.x/s}):e.Collision.initGrid();const a=await e.Collision.collide(i,"main","main");let l=[];return a.forEach(e=>{let t=0;!0!==e.show||r&&e.label.breach&&!yn[e.label.id]||(t=1),t&&(gn[e.label.id]=!0);let n=!0;e.ranges.forEach(r=>{if(!n)return;let i=e.mesh;if(!i.valid)return;let o=i.vertex_layout.offset.a_shape,s=i.vertex_layout.stride;for(let e=0;e<r[1];e++){if(i.vertex_data[r[0]+e*s+o+6]===t)return void(n=!1);i.vertex_data[r[0]+e*s+o+6]=t}-1===l.indexOf(i)&&l.push(i)})}),l.forEach(e=>e.upload()),t.forEach(e=>e.swapPendingLabels()),{labels:a,containers:i}}(n,t.collision.zoom,t.isLoadingVisibleTiles());t.scene.requestRedraw(),t.collision.task=null,e.Task.finish(r,i),t.updateTileStates()},immediate:!0},e.Task.add(this.collision.task)),this.collision.task.promise))}updateProxyTiles(){if(0===this.view.zoom_direction)return;this.forEachTile(e=>e.setProxyFor(null));let e=!1;this.forEachTile(t=>{if(t.visible&&!t.labeled){const n=this.pyramid.getAncestor(t);if(n)n.setProxyFor(t),e=!0;else{const n=this.pyramid.getDescendants(t);for(let r=0;r<n.length;r++)n[r].setProxyFor(t),e=!0}}}),e||(this.view.zoom_direction=0)}updateVisibility(t){if(t.visible=!1,t.style_z===this.view.tile_zoom)if(this.visible_coords[t.coords.key])t.visible=!0;else for(let n in this.visible_coords)if(e.TileID.isDescendant(t.coords,this.visible_coords[n])){t.visible=!0;break}}pruneToVisibleTiles(){this.removeTiles(e=>!e.visible)}getRenderableTiles(){return this.renderable_tiles}updateRenderableTiles(){this.renderable_tiles=[];for(let e in this.tiles){let t=this.tiles[e];t.visible&&t.loaded&&this.renderable_tiles.push(t)}return this.renderable_tiles}isLoadingVisibleTiles(){return Object.keys(this.tiles).some(e=>this.tiles[e].visible&&!this.tiles[e].built)}allVisibleTilesLabeled(){return this.renderable_tiles.every(e=>e.labeled)}queueCoordinate(e){this.queued_coords[this.queued_coords.length]=e}loadQueuedCoordinates(){0!==this.queued_coords.length&&(this.queued_coords.sort((t,n)=>{let r=this.view.center.meters,i=e.Geo.metersPerTile(t.z)/2,o=e.Geo.metersForTile(t);o.x+=i,o.y-=i;let s=e.Geo.metersForTile(n);s.x+=i,s.y-=i;let a=Math.abs(r.x-o.x)+Math.abs(r.y-o.y),l=Math.abs(r.x-s.x)+Math.abs(r.y-s.y);return t.center_dist=a,n.center_dist=l,l>a?-1:l===a?0:1}),this.queued_coords.forEach(e=>this.loadCoordinate(e)),this.queued_coords=[])}loadCoordinate(t){if(t.z===this.view.center.tile.z)for(let n in this.scene.sources){let r=this.scene.sources[n];if(!r.builds_geometry_tiles||!r.includesTile(t,this.view.tile_zoom))continue;let i=e.TileID.normalizedKey(t,r,this.view.tile_zoom);if(i&&!this.hasTile(i)){e.log("trace",`load tile ${i}, distance from view center: ${t.center_dist}`);let n=new e.Tile({source:r,coords:t,workers:this.scene.workers,style_z:this.view.baseZoom(t.z),view:this.view});this.keepTile(n),this.buildTile(n)}}}buildTile(e,t){this.tileBuildStart(e.key),this.updateVisibility(e),e.build(this.scene.generation,t)}buildTileStylesCompleted({tile:t,progress:n}){if(null==this.tiles[t.key])e.log("trace",`discarded tile ${t.key} in TileManager.buildTileStylesCompleted because previously removed`),e.Tile.abortBuild(t),this.updateTileStates();else if(t.generation!==this.scene.generation)e.log("trace",`discarded tile ${t.key} in TileManager.buildTileStylesCompleted because built with scene config gen ${t.generation}, current ${this.scene.generation}`),e.Tile.abortBuild(t),this.updateTileStates();else{if(this.tiles[t.key]){if(t.id<this.tiles[t.key].id)return e.log("trace",`discarded tile ${t.key} for id ${t.id} in TileManager.buildTileStylesCompleted because built for discarded tile id`),void e.Tile.abortBuild(t);t=this.tiles[t.key].merge(t)}n.done&&(t.built=!0),t.buildMeshes(this.scene.styles,n),this.updateTileStates(),this.scene.requestRedraw()}n.done&&this.tileBuildStop(t.key)}buildTileError(t){e.log("error",`Error building tile ${t.key}:`,t.error),this.forgetTile(t.key),e.Tile.abortBuild(t)}tileBuildStart(t){this.building_tiles=this.building_tiles||{},this.building_tiles[t]=!0,e.log("trace",`tileBuildStart for ${t}: ${Object.keys(this.building_tiles).length}`)}tileBuildStop(t){this.building_tiles&&(e.log("trace",`tileBuildStop for ${t}: ${Object.keys(this.building_tiles).length}`),delete this.building_tiles[t],this.checkBuildQueue())}checkBuildQueue(){this.building_tiles&&0!==Object.keys(this.building_tiles).length||(this.building_tiles=null,this.scene.tileManagerBuildDone())}getDebugProp(e,t){var n=[];for(var r in this.tiles)null==this.tiles[r].debug[e]||"function"==typeof t&&!0!==t(this.tiles[r])||n.push(this.tiles[r].debug[e]);return n}getDebugSum(e,t){var n=0;for(var r in this.tiles)null==this.tiles[r].debug[e]||"function"==typeof t&&!0!==t(this.tiles[r])||(n+=this.tiles[r].debug[e]);return n}getDebugAverage(e,t){return this.getDebugSum(e,t)/Object.keys(this.tiles).length}}function _n(e,t,n=2){return(Math.floor(e*t)/t).toFixed(n)}function xn(e){return JSON.stringify(Object.entries(e).map(([,e])=>Object.entries(e.meshes).map(([,e])=>e.map(e=>e.created_at))))}class wn{constructor(e,t){t(e),this.value=e,this.setup=t}set(e){JSON.stringify(this.value)!==JSON.stringify(e)&&(this.setup(e),this.value=e)}}class En{constructor(e){this.defaults={},this.defaults.culling=!0,this.defaults.culling_face=e.BACK,this.defaults.blending=!1,this.defaults.blending_src=e.ONE_MINUS_SRC_ALPHA,this.defaults.blending_dst=e.ONE_MINUS_SRC_ALPHA,this.defaults.blending_src_alpha=e.ONE,this.defaults.blending_dst_alpha=e.ONE_MINUS_SRC_ALPHA,this.defaults.depth_write=!0,this.defaults.depth_test=!0,e.depthFunc(e.LESS),this.culling=new wn({cull:this.defaults.culling,face:this.defaults.culling_face},t=>{t.cull?(e.enable(e.CULL_FACE),e.cullFace(t.face)):e.disable(e.CULL_FACE)}),this.blending=new wn({blend:this.defaults.blending,src:this.defaults.blending_src,dst:this.defaults.blending_dst,src_alpha:this.defaults.blending_src_alpha,dst_alpha:this.defaults.blending_dst_alpha},t=>{t.blend?(e.enable(e.BLEND),t.src_alpha&&t.dst_alpha?e.blendFuncSeparate(t.src,t.dst,t.src_alpha,t.dst_alpha):e.blendFunc(t.src,t.dst)):e.disable(e.BLEND)}),this.depth_write=new wn({depth_write:this.defaults.depth_write},t=>{e.depthMask(t.depth_write)}),this.depth_test=new wn({depth_test:this.defaults.depth_test},t=>{t.depth_test?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST)})}}class Sn{constructor(){this.canvas=null,this.gl=null,this.screenshot_canvas=null,this.screenshot_context=null,this.queue_screenshot=null,this.video_capture=null}setCanvas(e,t){this.canvas=e,this.gl=t}screenshot({background:e}={}){return null!=this.queue_screenshot||(this.queue_screenshot={background:e},this.queue_screenshot.promise=new Promise((e,t)=>{this.queue_screenshot.resolve=e,this.queue_screenshot.reject=t})),this.queue_screenshot.promise}completeScreenshot(){if(null!=this.queue_screenshot){let t=this.canvas.width,n=this.canvas.height,r=new Uint8Array(t*n*4);this.gl.readPixels(0,0,t,n,this.gl.RGBA,this.gl.UNSIGNED_BYTE,r);let i=this.queue_screenshot.background;i=i&&"transparent"!==i?e.StyleParser.parseColor(i).slice(0,3).map(e=>255*e):null;let o=new Uint8ClampedArray(t*n*4);for(let e=0;e<n;e++)for(let s=0;s<t;s++){let a=4*((n-e-1)*t+s),l=4*(e*t+s),u=r[a+3];o[l+0]=255*r[a+0]/u,o[l+1]=255*r[a+1]/u,o[l+2]=255*r[a+2]/u,o[l+3]=u,i&&(u/=255,o[l+0]=o[l+0]*u+i[0]*(1-u),o[l+1]=o[l+1]*u+i[1]*(1-u),o[l+2]=o[l+2]*u+i[2]*(1-u),o[l+3]=255)}this.screenshot_canvas=this.screenshot_canvas||document.createElement("canvas");let s=this.screenshot_canvas;s.width=t,s.height=n,this.screenshot_context=this.screenshot_context||s.getContext("2d");let a=this.screenshot_context,l=new ImageData(o,t,n);a.putImageData(l,0,0);const u=s.toDataURL("image/png"),c=atob(u.slice(22)),d=new Uint8Array(c.length);for(let e=0;e<c.length;++e)d[e]=c.charCodeAt(e);const h=new Blob([d],{type:"image/png"});this.queue_screenshot.resolve({url:u,blob:h,type:"png"}),this.queue_screenshot=null}}startVideoCapture(){if("function"!=typeof window.MediaRecorder||!this.canvas||"function"!=typeof this.canvas.captureStream)return e.log("warn","Video capture (Canvas.captureStream and/or MediaRecorder APIs) not supported by browser"),!1;if(this.video_capture)return e.log("warn","Video capture already in progress, call Scene.stopVideoCapture() first"),!1;try{let t=this.video_capture={};t.chunks=[],t.stream=this.canvas.captureStream(),t.options={mimeType:"video/webm"},t.media_recorder=new MediaRecorder(t.stream,t.options),t.media_recorder.ondataavailable=n=>{if(n.data.size>0&&t.chunks.push(n.data),t.resolve){let n=new Blob(t.chunks,{type:t.options.mimeType}),r=e.createObjectURL(n);t.stream&&(t.stream.getTracks()||[]).forEach(e=>{e.stop(),t.stream.removeTrack(e)}),t.stream=null,t.media_recorder=null,this.video_capture=null,t.resolve({url:r,blob:n,type:"webm"})}},t.media_recorder.start()}catch(t){return this.video_capture=null,e.log("error","Scene video capture failed",t),!1}return!0}stopVideoCapture(){return this.video_capture?(this.video_capture.promise=new Promise((e,t)=>{this.video_capture.resolve=e,this.video_capture.reject=t}),this.video_capture.media_recorder.stop(),this.video_capture.promise):(e.log("warn","No scene video capture in progress, call Scene.startVideoCapture() first"),Promise.resolve({}))}}function Tn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function kn(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?Tn(Object(r),!0).forEach(function(n){e._defineProperty(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Tn(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}class On{constructor(t,n){var r;n=n||{},e.subscribeMixin(this),this.id=On.id++,this.initialized=!1,this.initializing=null,this.sources={},this.view=new e.View(this,n),this.tile_manager=new vn({scene:this}),this.num_workers=n.numWorkers||2,!0===n.disableVertexArrayObjects&&(e.VertexArrayObject.disabled=!0),e.Utils.use_high_density_display=void 0===n.highDensityDisplay||n.highDensityDisplay,e.Utils.updateDevicePixelRatio(),this.config=null,this.config_source=t,this.config_bundle=null,this.last_valid_config_source=null,this.styles=null,this.style_manager=new e.StyleManager,this.building=null,this.dirty=!0,n.preUpdate&&this.subscribe({pre_update:n.preUpdate}),n.postUpdate&&this.subscribe({post_update:n.postUpdate}),this.render_loop=!n.disableRenderLoop,this.render_loop_active=!1,this.render_loop_stop=!1,this.render_count=0,this.last_render_count=0,this.render_count_changed=!1,this.frame=0,this.last_main_render=-1,this.last_selection_render=-1,this.media_capture=new Sn,this.selection=null,this.selection_feature_count=0,this.fetching_selection_map=null,this.prev_textures=null,this.introspection=!0===n.introspection,this.times={},this.resetTime(),this.container=n.container,this.canvas=null,this.contextOptions=n.webGLContextOptions,this.lights=null,this.background=null,this.createListeners(),this.updating=0,this.generation=On.generation,this.last_complete_generation=On.generation,(r=this).debug={profile(t){console.profile(`main thread: ${t}`),e.WorkerBroker.postMessage(r.workers,"self.profile",t)},profileEnd(t){console.profileEnd(`main thread: ${t}`),e.WorkerBroker.postMessage(r.workers,"self.profileEnd",t)},timeRebuild(t=1,n={}){let i=[],o=()=>{let s=+new Date;r.rebuild(n).then(()=>{if(i.push(+new Date-s),i.length<t)o();else{let n=~~(i.reduce((e,t)=>e+t)/i.length);e.log("info",`Profiled rebuild ${t} times: ${n} avg (${Math.min(...i)} min, ${Math.max(...i)} max)`)}})};o()},geometryCountByStyle(){let e={};return r.tile_manager.getRenderableTiles().forEach(t=>{for(let n in t.meshes)e[n]=e[n]||0,t.meshes[n].forEach(t=>{e[n]+=t.geometry_count})}),e},geometryCountByBaseStyle(){let e=r.debug.geometryCountByStyle(),t={};for(let n in e){let i=r.styles[n].baseStyle();t[i]=t[i]||0,t[i]+=e[n]}return t},geometryCountTotal(){const e=r.debug.geometryCountByStyle();return Object.keys(e).reduce((t,n)=>e[n]+t,0)},geometrySizeByStyle(){let e={};return r.tile_manager.getRenderableTiles().forEach(t=>{for(let n in t.meshes)e[n]=e[n]||0,t.meshes[n].forEach(t=>{e[n]+=t.buffer_size})}),e},geometrySizeByBaseStyle(){let e=r.debug.geometrySizeByStyle(),t={};for(let n in e){let i=r.styles[n].baseStyle();t[i]=t[i]||0,t[i]+=e[n]}return t},geometrySizeTotal(){const e=r.debug.geometrySizeByStyle();return Object.keys(e).reduce((t,n)=>e[n]+t,0)},textureSizeTotal:()=>Object.values(e.Texture.textures).map(e=>e.byteSize()).reduce((e,t)=>e+t),layerStats:()=>e.debugSettings.layer_stats?e.debugSumLayerStats(r.tile_manager.getRenderableTiles()):(e.log("warn","Enable the 'layer_stats' debug setting to collect layer stats"),{}),renderableTilesCount:()=>r.tile_manager.getRenderableTiles().length},this.log_level=n.logLevel||"warn",e.log.setLevel(this.log_level),e.log.reset()}static create(e,t={}){return new On(e,t)}load(t=null,n={}){var r=this;return this.initializing||(e.log.reset(),this.updating++,this.initialized=!1,this.view_complete=!1,this.times.frame=null,this.times.build=null,(n="string"==typeof n?{base_path:n}:n).blocking=void 0===n.blocking||n.blocking,!1!==this.render_loop&&this.setupRenderLoop(),this.createCanvas(),this.prev_textures=this.config&&Object.keys(this.config.textures),this.initializing=this.loadScene(t,n).then(async function({texture_nodes:t}){await r.createWorkers(),r.destroyFeatureSelection(),e.WorkerBroker.postMessage(r.workers,"self.clearFunctionStringCache");const i="object"==typeof r.config_source||r.hasSubscribersFor("load"),o=r.updateConfig({texture_nodes:t,serialize_funcs:i,normalize:!1,loading:!0,fade_in:!0});!0===n.blocking&&await o,r.freePreviousTextures(),r.updating--,r.initializing=null,r.initialized=!0,r.last_valid_config_source=r.config_source,r.last_valid_options={base_path:n.base_path,file_type:n.file_type},r.requestRedraw()}).catch(t=>{let n,r;if(this.initializing=null,this.updating=0,"YAMLException"===t.name?(n="yaml",r="Error parsing scene YAML"):r="Error initializing scene",this.trigger("error",{type:n,message:r,error:t,url:this.config_source}),r=`Scene.load() failed to load ${JSON.stringify(this.config_source)}: ${t.message}`,this.last_valid_config_source)return e.log("warn",r,t),e.log("info","Scene.load() reverting to last valid configuration"),this.load(this.last_valid_config_source,this.last_valid_base_path);throw e.log("error",r,t),t})),this.initializing}destroy(){if(this.initialized=!1,this.render_loop_stop=!0,this.destroyListeners(),this.destroyFeatureSelection(),this.canvas&&this.canvas.parentNode&&(this.canvas.parentNode.removeChild(this.canvas),this.canvas=null),this.container=null,this.gl){e.Texture.destroy(this.gl),this.style_manager.destroy(this.gl),this.styles={},e.ShaderProgram.reset();let t=this.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this.gl=null}this.sources={},this.destroyWorkers(),this.tile_manager.destroy(),this.tile_manager=null,e.log.reset()}createCanvas(){if(!this.canvas){this.container=this.container||document.body,this.canvas=document.createElement("canvas"),this.canvas.style.position="absolute",this.canvas.style.top=0,this.canvas.style.left=0,this.container.style.backgroundColor="transparent",this.container.appendChild(this.canvas);try{this.gl=n.getContext(this.canvas,Object.assign({alpha:!0,premultipliedAlpha:!0,stencil:!0,device_pixel_ratio:e.Utils.device_pixel_ratio,powerPreference:"high-performance"},this.contextOptions))}catch(e){throw new Error("Couldn't create WebGL context. Your browser may not support WebGL, or it's turned off? Visit http://webglreport.com/ for more info.")}this.resizeMap(this.container.clientWidth,this.container.clientHeight),e.VertexArrayObject.init(this.gl),this.render_states=new En(this.gl),this.media_capture.setCanvas(this.canvas,this.gl)}}updateExternalScripts(){let e=[...this.external_scripts||[]],t=[];if(this.config.scene.scripts)for(let e in this.config.scene.scripts)-1===t.indexOf(this.config.scene.scripts[e])&&t.push(this.config.scene.scripts[e]);for(let e in this.config.sources){let n=this.config.sources[e];if(n.scripts)for(let e in n.scripts)-1===t.indexOf(n.scripts[e])&&t.push(n.scripts[e])}return this.external_scripts=t,!(this.external_scripts.length===e.length&&this.external_scripts.every((t,n)=>t===e[n]))}createWorkers(){return this.updateExternalScripts()&&this.destroyWorkers(),this.workers?Promise.resolve():this.makeWorkers()}makeWorkers(){let t=!!this.gl.getExtension("OES_element_index_uint"),n=[];this.workers=[];for(let r=0;r<this.num_workers;r++){let i=new Worker(sM.workerURL);this.workers[r]=i,e.WorkerBroker.addWorker(i),e.log("debug",`Scene.makeWorkers: initializing worker ${r}`);let o=r;n.push(e.WorkerBroker.postMessage(i,"self.init",this.id,r,this.num_workers,this.log_level,e.Utils.device_pixel_ratio,t,this.external_scripts).then(t=>(e.log("debug",`Scene.makeWorkers: initialized worker ${t}`),t),t=>(e.log("error",`Scene.makeWorkers: failed to initialize worker ${o}:`,t),Promise.reject(t))))}return this.next_worker=0,Promise.all(n).then(()=>{e.log.setWorkers(this.workers)})}destroyWorkers(){this.selection=null,Array.isArray(this.workers)&&(e.log.setWorkers(null),this.workers.forEach(e=>{e.terminate()}),this.workers=null)}ready(){return!(!this.view.ready()||0===Object.keys(this.sources).length)}updateDevicePixelRatio(){e.Utils.updateDevicePixelRatio()&&e.WorkerBroker.postMessage(this.workers,"self.updateDevicePixelRatio",e.Utils.device_pixel_ratio).then(()=>this.rebuild()).then(()=>this.resizeMap(this.view.size.css.width,this.view.size.css.height))}resizeMap(t,r){0===t&&0===r||(this.dirty=!0,this.view.setViewportSize(t,r),this.gl&&n.resize(this.gl,t,r,e.Utils.device_pixel_ratio))}requestRedraw(){this.dirty=!0}immediateRedraw(){this.dirty=!0,this.update()}renderLoop(){this.render_loop_active=!0,this.update(),e.Task.setState({user_moving_view:this.view.user_input_active}),e.Task.processAll(),this.render_loop_stop?(this.render_loop_stop=!1,this.render_loop_active=!1):window.requestAnimationFrame(this.renderLoop.bind(this))}setupRenderLoop(){this.render_loop_active||setTimeout(()=>{this.renderLoop()},0)}update(){let t=this.dirty,n=!!this.selection&&this.selection.hasPendingRequests();var r=!(!1===t&&!1===n||!1===this.initialized||this.updating>0||!1===this.ready());return this.trigger("pre_update",r),this.view.update(),!!r&&(this.dirty=!1,this.updateDevicePixelRatio(),this.render({main:t,selection:n}),this.updateViewComplete(),this.media_capture.completeScreenshot(),this.trigger("post_update",r),(!0===this.animated||this.view.isAnimating())&&(this.dirty=!0),this.frame++,e.log("trace","Scene.render()"),!0)}render({main:t,selection:n}){var r=this.gl;if(this.updateBackground(),Object.keys(this.lights).forEach(e=>this.lights[e].update()),this.render_count_changed=!1,t&&(this.render_count=this.renderPass(),this.last_main_render=this.frame,this.render_count!==this.last_render_count&&(this.render_count_changed=!0,this.logFirstFrame(),this.getFeatureSelectionMapSize().then(t=>{this.selection_feature_count=t,e.log("info",`Scene: rendered ${this.render_count} primitives (${t} features in selection map)`)})),this.last_render_count=this.render_count),n){if(this.view.panning||this.view.user_input_active)return void this.selection.clearPendingRequests();!this.selection.locked&&this.last_selection_render<this.last_main_render&&(this.selection.bind(),this.renderPass("selection_program",{allow_blend:!1}),r.bindFramebuffer(r.FRAMEBUFFER,null),r.viewport(0,0,this.canvas.width,this.canvas.height),r.clearColor(...this.background.computed_color),this.last_selection_render=this.frame),this.selection.read()}return!0}renderPass(t="program",{allow_blend:n}={}){n=null==n||n,this.clearFrame();let r,i=0;const o=this.style_manager.getActiveBlendOrders();for(const{blend_order:s,styles:a}of o)for(let o=0;o<a.length;o++){let l=this.styles[a[o]];if(null==l)continue;if(l.blend!==r){let t=Object.assign({},e.Style.render_states[l.blend],{blend:n&&l.blend});this.setRenderState(t)}const u=n&&l.blend;if("translucent"===u)this.gl.colorMask(!1,!1,!1,!1),this.renderStyle(l.name,t,s),this.gl.colorMask(!0,!0,!0,!0),this.gl.depthFunc(this.gl.EQUAL),this.gl.enable(this.gl.STENCIL_TEST),this.gl.clearStencil(0),this.gl.clear(this.gl.STENCIL_BUFFER_BIT),this.gl.stencilFunc(this.gl.EQUAL,this.gl.ZERO,255),this.gl.stencilOp(this.gl.KEEP,this.gl.KEEP,this.gl.INCR),i+=this.renderStyle(l.name,t,s),this.gl.disable(this.gl.STENCIL_TEST),this.gl.depthFunc(this.gl.LESS);else if("opaque"!==u&&!0===l.stencil_proxy_tiles){const e=this.tile_manager.getRenderableTiles().filter(e=>e.meshes[l.name]).map(e=>e.proxy_level).reduce((e,t)=>(e.indexOf(t)>-1||e.push(t),e),[]).sort();if(e.length>1){this.gl.enable(this.gl.STENCIL_TEST),this.gl.clearStencil(0),this.gl.clear(this.gl.STENCIL_BUFFER_BIT),this.gl.stencilOp(this.gl.KEEP,this.gl.KEEP,this.gl.REPLACE);for(let n=0;n<e.length;n++)this.gl.stencilFunc(this.gl.GEQUAL,e.length-n,255),i+=this.renderStyle(l.name,t,s,e[n]);this.gl.disable(this.gl.STENCIL_TEST)}else i+=this.renderStyle(l.name,t,s)}else i+=this.renderStyle(l.name,t,s);r=l.blend}return i}renderStyle(e,t,n,r=null){let i,o=this.styles[e],s=!0,a=0,l=this.tile_manager.getRenderableTiles().filter(e=>"number"!=typeof r||e.proxy_level===r).map(t=>{if(t.meshes[e])return[t,t.meshes[e].filter(e=>e.variant.blend_order===n)]}).filter(e=>e),u=Math.max(...l.map(([,e])=>Math.max(...e.map(e=>e.variant.mesh_order))));for(let n=0;n<u+1;n++)for(let[r,u]of l){let l=!0;if(!r.shouldProxyForStyle(e))continue;const c=u.filter(e=>e.variant.mesh_order===n);if(0!==c.length){if(!0===s&&(s=!1,i=this.setupStyle(o,t),!i))return 0;c.forEach(e=>{!0===l&&(l=!1,this.view.setupTile(r,i)),o.render(e)&&this.requestRedraw(),a+=e.geometry_count})}}return a}setupStyle(e,t){let n;try{if(n=e.getProgram(t),!n)return}catch(t){return void this.trigger("warning",{type:"styles",message:`Error compiling style ${e.name}`,style:e,shader_errors:e.program&&e.program.shader_errors})}n.use(),e.setup(),n.uniform("1f","u_time",this.animated?(+new Date-this.start_time)/1e3:0),this.view.setupProgram(n);for(let e in this.lights)this.lights[e].setupProgram(n);return n}clearFrame(){this.initialized&&(this.render_states.depth_write.set({depth_write:!0}),this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT|this.gl.STENCIL_BUFFER_BIT))}setRenderState({depth_test:e,depth_write:t,cull_face:n,blend:r}={}){if(!this.initialized)return;let i=this.render_states;e=!1!==e&&i.defaults.depth_test,t=!1!==t&&i.defaults.depth_write,n=!1!==n&&i.defaults.culling,r=null!=r?r:i.defaults.blending;let o=this.gl;i.depth_test.set({depth_test:e}),i.depth_write.set({depth_write:t}),i.culling.set({cull:n,face:i.defaults.culling_face}),r?"opaque"===r?i.blending.set({blend:!1}):"overlay"===r||"inlay"===r||"translucent"===r?i.blending.set({blend:!0,src:o.SRC_ALPHA,dst:o.ONE_MINUS_SRC_ALPHA,src_alpha:o.ONE,dst_alpha:o.ONE_MINUS_SRC_ALPHA}):"add"===r?i.blending.set({blend:!0,src:o.ONE,dst:o.ONE}):"multiply"===r&&i.blending.set({blend:!0,src:o.ZERO,dst:o.SRC_COLOR}):i.blending.set({blend:!1})}getFeatureAt(t,{radius:n}={}){if(!this.initialized)return e.log("debug","Scene.getFeatureAt() called before scene was initialized"),Promise.resolve();if(0===this.selection_feature_count)return Promise.resolve();this.selection||this.resetFeatureSelection();let r={x:t.x/this.view.size.css.width,y:t.y/this.view.size.css.height};return n=n>0?{x:n/this.view.size.css.width,y:n/this.view.size.css.height}:null,this.selection.getFeatureAt(r,{radius:n}).then(e=>Object.assign(e,{pixel:t})).catch(e=>Promise.resolve({error:e}))}async queryFeatures({filter:t,unique:n=!0,group_by:r=null,visible:i=null,geometry:o=!1}={}){if(!this.initialized)return[];t=e.Utils.serializeWithFunctions(t);const s=!0===(n="string"==typeof n?[n]:n)||Array.isArray(n)&&n.indexOf("$id")>-1,a=n&&(t=>{const r=Array.isArray(n)?e.sliceObject(t.properties,n):t.properties,i=s?t.id:null;return o?JSON.stringify({geometry:t.geometry,properties:r,id:i}):JSON.stringify({properties:r,id:i})}),l=(r=("string"==typeof r||Array.isArray(r))&&r)&&(t=>Array.isArray(r)?JSON.stringify(e.sliceObject(t,r)):t[r]),u=this.tile_manager.getRenderableTiles().map(e=>e.key),c=await e.WorkerBroker.postMessage(this.workers,"self.queryFeatures",{filter:t,visible:i,geometry:o,tile_keys:u}),d=[],h={},p={};return c.forEach(e=>e.forEach(e=>{if(a){const t=a(e);if(h[t])return;h[t]=!0}if(l){const t=l(e.properties);p[t]=p[t]||[],p[t].push(e)}else d.push(e)})),l?p:d}rebuild({initial:t=!1,new_generation:n=!0,sources:r=null,serialize_funcs:i,profile:o=!1,fade_in:s=!1}={}){return new Promise((a,l)=>{if(this.building){this.building.queued&&this.building.queued.reject&&(e.log("debug","Scene.rebuild: request superceded by a newer call"),this.building.queued.resolve(!1));let u={initial:t,new_generation:n,sources:r,serialize_funcs:i,profile:o,fade_in:s};return this.building.queued={resolve:a,reject:l,options:u},void e.log("trace","Scene.rebuild(): queuing request")}if(this.building={resolve:a,reject:l,initial:t},o&&this.debug.profile("Scene.rebuild"),n){this.generation=++On.generation;for(let e in this.styles)this.styles[e].setGeneration(this.generation)}this.syncConfigToWorker({serialize_funcs:i}),this.resetWorkerFeatureSelection(r),this.resetTime(),this.tile_manager.pruneToVisibleTiles(),this.tile_manager.forEachTile(e=>{(!r||r.indexOf(e.source.name)>-1)&&this.tile_manager.buildTile(e,{fade_in:s})}),this.tile_manager.updateTilesForView(),this.tile_manager.checkBuildQueue()}).then(()=>{o&&this.debug.profileEnd("Scene.rebuild")})}tileManagerBuildDone(){if(e.TextCanvas.pruneTextCache(),this.building){e.log("info","Scene: build geometry finished"),this.building.resolve&&(this.logFirstBuild(),this.building.resolve(!0));var t=this.building.queued;this.building=null,t?(e.log("debug","Scene: starting queued rebuild() request"),this.rebuild(t.options).then(t.resolve,t.reject)):this.tile_manager.updateLabels()}}async loadScene(t=null,{base_path:n,file_type:r}={}){this.config_source=t||this.config_source,"string"==typeof this.config_source?this.base_path=e.pathForURL(n||this.config_source):this.base_path=e.pathForURL(n),this.config_path=this.base_path;const{config:i,bundle:o,texture_nodes:s}=await fn.loadScene(this.config_source,{path:this.base_path,type:r});return this.config=i,this.config_bundle=o,{texture_nodes:s}}setDataSource(t,n){if(!t||!n||!n.type||!n.url&&!n.data)return void e.log("error","No name provided or not a valid config:",t,n);let r=null==this.config.sources[t],i=this.config.sources[t]=Object.assign({},n);return i.data&&"object"==typeof i.data&&(i.url=e.createObjectURL(new Blob([JSON.stringify(i.data)],{type:"application/json"})),delete i.data),r?this.updateConfig({rebuild:{sources:[t]}}):this.rebuild({sources:[t]})}createDataSources(t=!1){const n=[],r=Object.keys(this.sources);let i=0;for(var o in this.config.sources){const r=this.config.sources[o],s=this.sources[o];try{const t=kn(kn({},r),{},{name:o,id:i++});if(this.sources[o]=e.DataSource.create(t,this.sources),!this.sources[o])throw{}}catch(t){delete this.sources[o];const n=`Could not create data source: ${t.message}`;e.log("warn",`Scene: ${n}`,r),this.trigger("warning",{type:"sources",source:r,message:n})}(t||e.DataSource.tileLayoutChanged(this.sources[o],s))&&n.push(o)}r.forEach(e=>{this.config.sources[e]||(delete this.sources[e],n.push(e))}),n.length>0&&this.tile_manager.removeTiles(e=>n.indexOf(e.source.name)>-1);for(let e in this.config.layers){let t=this.config.layers[e];!1!==t.enabled&&t.data&&this.sources[t.data.source]&&(this.sources[t.data.source].builds_geometry_tiles=!0)}}loadTextures(){return e.Texture.createFromObject(this.gl,this.config.textures).then(()=>e.Texture.createDefault(this.gl))}freePreviousTextures(){this.prev_textures&&(this.prev_textures.forEach(t=>{!this.config.textures[t]&&e.Texture.textures[t]&&e.Texture.textures[t].destroy()}),this.prev_textures=null)}updateStyles(){if(!this.initialized&&!this.initializing)throw new Error("Scene.updateStyles() called before scene was initialized");this.styles=this.style_manager.build(this.config.styles),this.style_manager.initStyles(this);for(let e in this.styles)this.styles[e].setGL(this.gl);this.dirty=!0}get animated(){return!1!==this.config.scene.animated&&this.style_manager.getActiveStyles().some(e=>this.styles[e].animated)}getActiveCamera(){return this.view.getActiveCamera()}setActiveCamera(e){return this.view.setActiveCamera(e)}createLights(){this.lights={},e.debugSettings.wireframe&&(e.Light.enabled=!1);for(let t in this.config.lights){if(!this.config.lights[t]||"object"!=typeof this.config.lights[t])continue;let n=this.config.lights[t];n.name=t.replace("-","_"),n.visible=!1!==n.visible,n.visible&&(this.lights[n.name]=e.Light.create(this.view,n))}e.Light.inject(this.lights)}setBackground(){const t=this.config.scene.background;this.background={},t&&t.color&&(this.background.color=e.StyleParser.createColorPropertyCache(t.color)),this.background.color||(this.background.color=e.StyleParser.createColorPropertyCache([0,0,0,0]))}updateBackground(){const t=this.background.computed_color,n=this.background.computed_color=e.StyleParser.evalCachedColorProperty(this.background.color,{zoom:this.view.tile_zoom});t&&!n.some((e,n)=>t[n]!==e)||(1===n[3]?this.canvas.style.backgroundColor=`rgba(${n.map(e=>Math.floor(255*e)).join(", ")})`:this.canvas.style.backgroundColor="transparent",this.gl.clearColor(...n))}setIntrospection(e){return e!==this.introspection?(this.introspection=null!=e&&e,this.updating++,this.updateConfig({normalize:!1}).then(()=>this.updating--)):Promise.resolve()}updateConfig({loading:t=!1,rebuild:n=!0,serialize_funcs:r,texture_nodes:i={},normalize:o=!0,fade_in:s=!1}={}){this.generation=++On.generation,this.updating++,this.config=fn.applyGlobalProperties(this.config),o&&fn.normalize(this.config,this.config_bundle,i),fn.hoistTextureNodes(this.config,this.config_bundle,i),this.trigger(t?"load":"update",{config:this.config}),this.style_manager.init(),this.view.reset(),this.createLights(),this.createDataSources(t),this.loadTextures(),this.setBackground(),e.FontManager.loadFonts(this.config.fonts),this.updateStyles();let a=n?this.rebuild(Object.assign({initial:t,new_generation:!1,serialize_funcs:r,fade_in:s},"object"==typeof n&&n)):this.syncConfigToWorker({serialize_funcs:r});return this.updating--,this.view.updateBounds(),this.requestRedraw(),a.then(()=>{this.last_render_count=0,this.requestRedraw()})}syncConfigToWorker({serialize_funcs:t=!0}={}){let n=t?e.Utils.serializeWithFunctions(this.config):JSON.stringify(this.config);return e.WorkerBroker.postMessage(this.workers,"self.updateConfig",{config:n,generation:this.generation,introspection:this.introspection},e.debugSettings)}createListeners(){this.listeners={},this.listeners.view={move:()=>this.trigger("move")},this.view.subscribe(this.listeners.view),this.listeners.texture={update:()=>this.dirty=!0,warning:e=>this.trigger("warning",Object.assign({type:"textures"},e))},e.Texture.subscribe(this.listeners.texture),this.listeners.scene_loader={error:e=>this.trigger("error",Object.assign({type:"scene"},e))},fn.subscribe(this.listeners.scene_loader)}destroyListeners(){this.unsubscribeAll(),this.view.unsubscribe(this.listeners.view),e.Texture.unsubscribe(this.listeners.texture),fn.unsubscribe(this.listeners.scene_loader),this.listeners=null}destroyFeatureSelection(){this.selection&&(this.selection.destroy(),this.selection=null)}resetFeatureSelection(){this.selection=new e.FeatureSelection(this.gl,this.workers,()=>this.building),this.last_render_count=0}resetWorkerFeatureSelection(t=null){this.workers&&e.WorkerBroker.postMessage(this.workers,"self.resetFeatureSelection",t)}getFeatureSelectionMapSize(){return null==this.fetching_selection_map&&(this.fetching_selection_map=e.WorkerBroker.postMessage(this.workers,"self.getFeatureSelectionMapSize").then(e=>(this.fetching_selection_map=null,e.reduce((e,t)=>e+t)))),this.fetching_selection_map}resetTime(){this.start_time=+new Date}updateViewComplete(){!this.render_count_changed&&this.generation===this.last_complete_generation||this.building||this.tile_manager.isLoadingVisibleTiles()||!this.tile_manager.allVisibleTilesLabeled()||(this.tile_manager.updateLabels(),this.last_complete_generation=this.generation,this.trigger("view_complete",{first:!0!==this.view_complete}),this.view_complete=!0)}resetViewComplete(){this.last_complete_generation=null}screenshot({background:e="white"}={}){return this.requestRedraw(),this.media_capture.screenshot({background:e})}startVideoCapture(){return this.requestRedraw(),this.media_capture.startVideoCapture()}stopVideoCapture(){return this.media_capture.stopVideoCapture()}logFirstFrame(){0!==this.last_render_count||this.times.first_frame||(this.times.first_frame=+new Date-this.start_time,e.log("debug",`Scene: initial frame time: ${this.times.first_frame}`))}logFirstBuild(){null==this.times.first_build&&(this.times.first_build=+new Date-this.start_time,e.log("debug",`Scene: initial build time: ${this.times.first_build}`))}}var An;On.id=0,On.generation=0;const Cn={map:{},scrollWheelZoom:{},doubleClickZoom:{}};var Rn={leafletLayer:function(t){return function(t){if(void 0!==An)return new An(t);if(e.Thread.is_main){let n,r=t.leaflet||window.L,i=r.GridLayer?r.GridLayer:r.TileLayer,o=i===r.GridLayer?"1.x":"0.7.x",s={};return i===r.TileLayer&&(s._addTile=function(){},s._removeTile=function(){},s._reset=function(){i.prototype._reset.apply(this,arguments),this.scene&&this.scene.container&&this.scene.canvas&&this.scene.container.appendChild(this.scene.canvas)}),Object.assign(s,{initialize(e){e.showDebug=!!e.showDebug,r.setOptions(this,e),this.updateTangramDebugSettings(),this.createScene(),this.hooks={},this._updating_tangram=!1},createScene(){this.scene=On.create(this.options.scene,{numWorkers:this.options.numWorkers,preUpdate:this.options.preUpdate,postUpdate:this.options.postUpdate,continuousZoom:"1.x"===An.leafletVersion,wrapView:!0!==this.options.noWrap,highDensityDisplay:this.options.highDensityDisplay,logLevel:this.options.logLevel,introspection:this.options.introspection,webGLContextOptions:this.options.webGLContextOptions,disableRenderLoop:this.options.disableRenderLoop})},onAdd(t){this.scene||this.createScene(),i.prototype.onAdd.apply(this,arguments),this.hooks.resize=()=>{this._updating_tangram=!0,this.updateSize(),this._updating_tangram=!1},t.on("resize",this.hooks.resize),this.hooks.move=()=>{if(!this._updating_tangram){this._updating_tangram=!0,this.scene.view.setPanning(!0);var n=t.getCenter();n.zoom=Math.max(Math.min(t.getZoom(),t.getMaxZoom()||e.Geo.default_view_max_zoom),t.getMinZoom()),this.scene.view.setView(n),this._mapLayerCount>1&&this.scene.immediateRedraw(),this._updating_tangram=!1}},t.on("move",this.hooks.move),this.hooks.moveend=()=>{this.scene.view.setPanning(!1),this.scene.requestRedraw()},t.on("moveend",this.hooks.moveend),this.hooks.drag=()=>{this.scene.view.markUserInput()},t.on("drag",this.hooks.drag),this._map_pane_observer=new MutationObserver(e=>{e.forEach(()=>this.reverseTransform())}),this._map_pane_observer.observe(t.getPanes().mapPane,{attributes:!0}),this.modifyScrollWheelBehavior(t),this.modifyZoomBehavior(t),this.trackMapLayerCounts(t),this.setupSelectionEventHandlers(t),this.setSelectionEvents(this.options.events,{radius:this.options.selectionRadius}),this.scene.container=this.getContainer(),this.updateSize(),this.updateView(),this.resizeOnFirstVisible(),this.scene.subscribe({move:this.onTangramViewUpdate.bind(this)}),this.scene.load(this.options.scene,{base_path:this.options.sceneBasePath,file_type:this.options.sceneFileType,blocking:!1}).then(()=>{if(!this.options.attribution)for(const[,e]of Object.entries(this.scene.config.sources))e.attribution&&t.attributionControl.addAttribution(e.attribution);this._updating_tangram=!0,this.updateSize(),this.updateView(),this.reverseTransform(),this._updating_tangram=!1,this.fire("init")}).catch(e=>{this.fire("error",e)})},onRemove(e){i.prototype.onRemove.apply(this,arguments),e.off("layeradd layerremove overlayadd overlayremove",this._updateMapLayerCount),e.off("resize",this.hooks.resize),e.off("move",this.hooks.move),e.off("moveend",this.hooks.moveend),e.off("drag",this.hooks.drag),e.off("click",this.hooks.click),e.off("mousemove",this.hooks.mousemove),e.off("mouseout",this.hooks.mouseout),document.removeEventListener("visibilitychange",this.hooks.visibilitychange),this.hooks={},this._map_pane_observer.disconnect(),this.scene&&(this.scene.destroy(),this.scene=null)},createTile(e){var t=e.x+"/"+e.y+"/"+e.z,n=document.createElement("div");if(n.setAttribute("data-tile-key",t),n.style.width="256px",n.style.height="256px",this.options.showDebug){var r=document.createElement("div");r.textContent=t,r.style.position="absolute",r.style.left=0,r.style.top=0,r.style.color="white",r.style.fontSize="16px",r.style.textOutline="1px #000000",r.style.padding="8px",n.appendChild(r),n.style.borderStyle="solid",n.style.borderColor="white",n.style.borderWidth="1px"}return n},modifyScrollWheelBehavior(e){if(this.scene.view.continuous_zoom&&e.scrollWheelZoom&&!1!==this.options.modifyScrollWheel){e.options.zoomSnap=0;const a=e.scrollWheelZoom.enabled();e.scrollWheelZoom.disable(),r.Browser.chrome||r.Browser.safari?e.scrollWheelZoom._onWheelScroll=function(e){var t=r.DomEvent.getWheelDelta(e);this._delta+=t,this._lastMousePos=this._map.mouseEventToContainerPoint(e),this._performZoom(),r.DomEvent.stop(e)}:e.options.wheelDebounceTime=20;const l=(i=function(e){e._moveEnd(!0),e.fire("viewreset")},o=2*e.options.wheelDebounceTime,function(){var e=this,t=arguments;clearTimeout(s),s=setTimeout(function(){s=null,i.apply(e,t)},o)});Cn.scrollWheelZoom._performZoom||(Cn.scrollWheelZoom._performZoom=e.scrollWheelZoom._performZoom);var t=this;e.scrollWheelZoom._performZoom=function(){if(this._map===t._map){var e=this._map,r=e.getZoom();e._stop();var i=this._delta/(4*this._map.options.wheelPxPerZoomLevel);this._delta=0,r+i>=this._map.getMaxZoom()?i=this._map.getMaxZoom()-r:r+i<=this._map.getMinZoom()&&(i=this._map.getMinZoom()-r),i&&("center"===e.options.scrollWheelZoom?n(t,e.getCenter(),r+i):n(t,this._lastMousePos,r+i),l(e))}else Cn.scrollWheelZoom._performZoom.call(this)},a&&e.scrollWheelZoom.enable()}var i,o,s},modifyZoomBehavior(e){if(this.scene.view.continuous_zoom&&!1!==this.options.modifyZoomBehavior){var t=this;const i=function(t,i,o){e._stop();var s=e._zoom;i=r.latLng(i),o=void 0===o?s:o,o=Math.min(o,e.getMaxZoom());var a=Date.now();return e._moveStart(!0),function l(){var u=(Date.now()-a)/75;u<=1?(e._flyToFrame=r.Util.requestAnimFrame(l,e),n(t,i,s+(o-s)*u)):n(t,i,o)._moveEnd(!0)}.call(e),e};if(e.doubleClickZoom){const n=e.doubleClickZoom.enabled();e.doubleClickZoom.disable(),Cn.doubleClickZoom._onDoubleClick||(Cn.doubleClickZoom._onDoubleClick=e.doubleClickZoom._onDoubleClick),e.doubleClickZoom._onDoubleClick=function(e){if(this._map===t._map){var n=this._map,r=n.getZoom(),o=n.options.zoomDelta,s=e.originalEvent.shiftKey?r-o:r+o;"center"===n.options.doubleClickZoom?i(t,n.getCenter(),s):i(t,n.containerPointToLatLng(e.containerPoint),s)}else Cn.doubleClickZoom._onDoubleClick.call(this,e)},n&&e.doubleClickZoom.enable()}e._zoomAnimated&&(Cn.map._animateZoom||(Cn.map._animateZoom=e._animateZoom),e._animateZoom=function(e,n,o,s){this===t._map?(o&&(this._animatingZoom=!0,this._animateToCenter=e,this._animateToZoom=n,i(t,e,n)),setTimeout(r.Util.bind(this._onZoomTransitionEnd,this),250)):Cn.map._animateZoom.call(this,e,n,o,s)})}},updateView(){var t=this._map.getCenter();t.zoom=Math.max(Math.min(this._map.getZoom(),this._map.getMaxZoom()||e.Geo.default_view_max_zoom),this._map.getMinZoom()),this.scene.view.setView(t)},updateSize(){var e=this._map.getSize();this.scene.resizeMap(e.x,e.y)},resizeOnFirstVisible(){let e=!0;this.hooks.visibilitychange=()=>{e&&(e=!1,this.updateSize())},document.addEventListener("visibilitychange",this.hooks.visibilitychange)},onTangramViewUpdate(){if(!this._map||this._updating_tangram)return;let e=this._map.getCenter(),t=this.scene.view.center;e.lng===t.lng&&e.lat===t.lat&&this._map.getZoom()===this.scene.view.zoom||(this._updating_tangram=!0,this._map.setView([this.scene.view.center.lat,this.scene.view.center.lng],this.scene.view.zoom,{animate:!1}),this._updating_tangram=!1)},render(){this.scene&&this.scene.update()},reverseTransform(){if(this._map&&this.scene&&this.scene.container){var e=this._map.containerPointToLayerPoint([0,0]);r.DomUtil.setPosition(this.scene.container,e)}},setupSelectionEventHandlers(e){this._selection_events={},this._selection_radius=null,this.hooks.click=e=>{"function"==typeof this._selection_events.click&&this.scene.getFeatureAt(e.containerPoint,{radius:this._selection_radius}).then(t=>{let n=Object.assign({},t,{leaflet_event:e});this._selection_events.click(n)})},e.on("click",this.hooks.click),this.hooks.mousemove=e=>{"function"==typeof this._selection_events.hover&&this.scene.getFeatureAt(e.containerPoint,{radius:this._selection_radius}).then(t=>{let n=Object.assign({},t,{leaflet_event:e});this._selection_events.hover(n)})},e.on("mousemove",this.hooks.mousemove),this.hooks.mouseout=e=>{"function"==typeof this._selection_events.hover&&this._selection_events.hover({changed:!0,leaflet_event:e})},e.on("mouseout",this.hooks.mouseout)},setSelectionEvents(e,{radius:t}={}){this._selection_events=Object.assign(this._selection_events,e),this._selection_radius=void 0!==t?t:this._selection_radius},trackMapLayerCounts(e){this._updateMapLayerCount=()=>{let t=e.getPanes().mapPane.childNodes;this._mapLayerCount=0;for(let e=0;e<t.length;e++)this._mapLayerCount+=t[e].childNodes.length},e.on("layeradd layerremove overlayadd overlayremove",this._updateMapLayerCount),this._updateMapLayerCount()},updateTangramDebugSettings(){e.mergeDebugSettings(this.options.debug||{})}}),n=function(e,t,n){var i=e._map,o=e.scene,s=i.getZoomScale(n),a=i.getSize().divideBy(2),l=(t instanceof r.Point?t:i.latLngToContainerPoint(t)).subtract(a).multiplyBy(1-1/s),u=i.containerPointToLatLng(a.add(l));return o&&o.view.markUserInput(),i._move(u,n,{flyTo:!0})},"function"!=typeof(An=i.extend(s)).remove&&(An.prototype.remove=function(){this._map&&this._map.removeLayer(this),this.fire("remove")}),An.layerBaseClass=i,An.leafletVersion=o,new An(t)}}(t)},debug:{log:e.log,yaml:cn,Utils:e.Utils,Geo:e.Geo,Vector:e.Vector,DataSource:e.DataSource,GLSL:e.GLSL,ShaderProgram:e.ShaderProgram,VertexData:e.VertexData,Texture:e.Texture,Material:e.Material,Light:e.Light,Scene:On,WorkerBroker:e.WorkerBroker,Task:e.Task,StyleManager:e.StyleManager,StyleParser:e.StyleParser,TileID:e.TileID,Collision:e.Collision,FeatureSelection:e.FeatureSelection,TextCanvas:e.TextCanvas,debugSettings:e.debugSettings},version:e.version};return Rn});try{sM.debug.ESM=!0,sM.debug.SHA="d0b887d09a3645aad91a18bd3bd0362d74627da3","object"==typeof window&&(window.Tangram=sM)}catch(KC){}var lM=Object.freeze({__proto__:null});export{zT as API_METHODS,RT as ApiService,oM as AuthPage,ST as AuthStore,Qb as Button,Ck as Card,k_ as Checkbox,TT as DartcomAuthProvider,AT as DartcomMobxProvider,NN as DartcomProviders,of as DeleteButton,Qw as DragList,af as EditButton,O_ as Form,PT as GlobalConfig,N_ as Input,Ak as LeafletLayer,tf as List,Rk as Loader,GC as LocalizationProvider,ef as NoData,FT as PanelsNames,wO as QueryProvider,R_ as Select,OT as StoreContext,BT as TangramSourceNames,$T as _backendUrl,MT as _testApiKeys,ZT as catIds,NT as createApiService,DN as encodeString,pk as getAdminAreaLayers,kk as getAllLayers,Tk as getAllPointLayers,Ek as getAllPolygonLayers,Sk as getAllPolylineLayers,dk as getBuildingLayers,YT as getBuiltupAreaLayers,nk as getCityPOILayers,ok as getConditionLayers,JT as getDefaultPOI,hk as getFacilityAreaLayers,ck as getLanduseAreaLayers,GT as getLaneMarkingLineLayers,qT as getLaneMarkingPolyLayers,xk as getLayerName,vk as getLinkLayers,fk as getNatureFieldLayers,_k as getNatureForestLayers,uk as getOceanAreaLayers,rk as getOneWayLayers,tk as getPOILayers,QT as getPOITypeLayer,HT as getParkingLineLayers,KT as getPointAddressLayers,sk as getRailroadLayers,WT as getRoadPolyLayers,ak as getWaterAreaLayers,lk as getWaterLinkLayers,xO as queryClient,kT as rootStore,wk as setLayerOrder,UT as sourceUrl,XT as text_source,VT as tile_size,A_ as useFormContext,Ok as useGetLeafletLayer,zN as useLogout,CT as useRootStore,MN as useShowErrorSnackbar,PN as useShowSnackbar,IN as useSignIn};
|
|
148
|
+
*/var Vb,Ub,Wb=($b||($b=1,"production"===process.env.NODE_ENV?Fb.exports=function(){if(Db)return Lb;Db=1;var e=r,t="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=e.useState,i=e.useEffect,o=e.useLayoutEffect,s=e.useDebugValue;function a(e){var n=e.getSnapshot;e=e.value;try{var r=n();return!t(e,r)}catch(e){return!0}}var l="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var r=t(),l=n({inst:{value:r,getSnapshot:t}}),u=l[0].inst,c=l[1];return o(function(){u.value=r,u.getSnapshot=t,a(u)&&c({inst:u})},[e,r,t]),i(function(){return a(u)&&c({inst:u}),e(function(){a(u)&&c({inst:u})})},[e]),s(r),r};return Lb.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:l,Lb}():Fb.exports=(jb||(jb=1,"production"!==process.env.NODE_ENV&&function(){function e(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!n(e,r)}catch(e){return!0}}"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=r,n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=t.useState,o=t.useEffect,s=t.useLayoutEffect,a=t.useDebugValue,l=!1,u=!1,c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(r,c){l||void 0===t.startTransition||(l=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var d=c();if(!u){var h=c();n(d,h)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),u=!0)}var p=(h=i({inst:{value:d,getSnapshot:c}}))[0].inst,f=h[1];return s(function(){p.value=d,p.getSnapshot=c,e(p)&&f({inst:p})},[r,d,c]),o(function(){return e(p)&&f({inst:p}),r(function(){e(p)&&f({inst:p})})},[r]),a(d),d};Bb.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:c,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Bb)),Fb.exports);function qb(e){e.reaction=new zg("observer".concat(e.name),function(){var t;e.stateVersion=Symbol(),null===(t=e.onStoreChange)||void 0===t||t.call(e)})}var Gb=!0,Hb="function"==typeof Symbol&&Symbol.for,Yb=null!==(Ub=null===(Vb=Object.getOwnPropertyDescriptor(function(){},"name"))||void 0===Vb?void 0:Vb.configurable)&&void 0!==Ub&&Ub,Kb=Hb?Symbol.for("react.forward_ref"):"function"==typeof i&&i(function(e){return null}).$$typeof,Xb=Hb?Symbol.for("react.memo"):"function"==typeof c&&c(function(e){return null}).$$typeof;function Zb(e,t){if(process.env.NODE_ENV,Xb&&e.$$typeof===Xb)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");var n=!1,o=e,s=e.displayName||e.name;if(Kb&&e.$$typeof===Kb&&(n=!0,"function"!=typeof(o=e.render)))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var a,l,u=function(e,t){return function(e,t){void 0===t&&(t="observed");var n=r.useRef(null);if(!n.current){var i={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(e){return zb.unregister(i),i.onStoreChange=e,i.reaction||(qb(i),i.stateVersion=Symbol()),function(){var e;i.onStoreChange=null,null===(e=i.reaction)||void 0===e||e.dispose(),i.reaction=null}},getSnapshot:function(){return i.stateVersion}};n.current=i}var o,s,a=n.current;if(a.reaction||(qb(a),zb.register(n,a,a)),r.useDebugValue(a.reaction,Mb),Wb.useSyncExternalStore(a.subscribe,a.getSnapshot,a.getSnapshot),a.reaction.track(function(){try{o=e()}catch(e){s=e}}),s)throw s;return o}(function(){return o(e,t)},s)};return u.displayName=e.displayName,Yb&&Object.defineProperty(u,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(u.contextTypes=e.contextTypes,"production"!==process.env.NODE_ENV&&Gb&&(Gb=!1,console.warn("[mobx-react-lite] Support for Legacy Context in function components will be removed in the next major release."))),n&&(u=i(u)),u=c(u),a=e,l=u,Object.keys(a).forEach(function(e){Jb[e]||Object.defineProperty(l,e,Object.getOwnPropertyDescriptor(a,e))}),"production"!==process.env.NODE_ENV&&Object.defineProperty(u,"contextTypes",{set:function(){var e,t;throw new Error("[mobx-react-lite] `".concat(this.displayName||(null===(e=this.type)||void 0===e?void 0:e.displayName)||(null===(t=this.type)||void 0===t?void 0:t.name)||"Component",".contextTypes` must be set before applying `observer`."))}}),u}var Jb={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};process.env.NODE_ENV,function(e){e||(e=Pb,"production"!==process.env.NODE_ENV&&console.warn("[MobX] Failed to get unstable_batched updates from react-dom / react-native")),uy({reactionScheduler:e})}(E),zb.finalizeAllImmediately;var Qb=Zb(t=>{const{children:n,variant:r="contained",textVariant:i="body2",loading:o,icon:s,sx:a,...l}=t;return o&&!s?e(uf,{sx:{whiteSpace:"nowrap",padding:"5px 15px",height:"23px"},loadingIndicator:e(dl,{variant:i,children:"Loading..."}),variant:r,loading:!0,...l,children:n}):s?e(il,{...l,children:s}):e(ud,{sx:{whiteSpace:"nowrap",padding:"5px 15px",textTransform:"none",...a},variant:r,...l,children:e(dl,{variant:i,children:n})})}),ev=e=>"checkbox"===e.type,tv=e=>e instanceof Date,nv=e=>null==e;const rv=e=>"object"==typeof e;var iv=e=>!nv(e)&&!Array.isArray(e)&&rv(e)&&!tv(e),ov=e=>iv(e)&&e.target?ev(e.target)?e.target.checked:e.target.value:e,sv=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),av="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function lv(e){let t;const n=Array.isArray(e),r="undefined"!=typeof FileList&&e instanceof FileList;if(e instanceof Date)t=new Date(e);else{if(av&&(e instanceof Blob||r)||!n&&!iv(e))return e;if(t=n?[]:Object.create(Object.getPrototypeOf(e)),n||(e=>{const t=e.constructor&&e.constructor.prototype;return iv(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const n in e)e.hasOwnProperty(n)&&(t[n]=lv(e[n]));else t=e}return t}var uv=e=>/^\w*$/.test(e),cv=e=>void 0===e,dv=e=>Array.isArray(e)?e.filter(Boolean):[],hv=e=>dv(e.replace(/["|']|\]/g,"").split(/\.|\[/)),pv=(e,t,n)=>{if(!t||!iv(e))return n;const r=(uv(t)?[t]:hv(t)).reduce((e,t)=>nv(e)?e:e[t],e);return cv(r)||r===e?cv(e[t])?n:e[t]:r},fv=e=>"boolean"==typeof e,mv=(e,t,n)=>{let r=-1;const i=uv(t)?[t]:hv(t),o=i.length,s=o-1;for(;++r<o;){const t=i[r];let o=n;if(r!==s){const n=e[t];o=iv(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=o,e=e[t]}};const gv="blur",yv="focusout",bv="change",vv="onBlur",_v="onChange",xv="onSubmit",wv="onTouched",Ev="all",Sv="max",Tv="min",kv="maxLength",Ov="minLength",Av="pattern",Cv="required",Rv="validate",Nv=r.createContext(null);Nv.displayName="HookFormContext";const Pv=()=>r.useContext(Nv),Mv=e=>{const{children:t,...n}=e;return r.createElement(Nv.Provider,{value:n},t)};var Dv=(e,t,n,r=!0)=>{const i={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(i,o,{get:()=>{const i=o;return t._proxyFormState[i]!==Ev&&(t._proxyFormState[i]=!r||Ev),n&&(n[i]=!0),e[i]}});return i};const Iv="undefined"!=typeof window?r.useLayoutEffect:r.useEffect;var zv=e=>"string"==typeof e,Fv=(e,t,n,r,i)=>zv(e)?(r&&t.watch.add(e),pv(n,e,i)):Array.isArray(e)?e.map(e=>(r&&t.watch.add(e),pv(n,e))):(r&&(t.watchAll=!0),n),Lv=e=>nv(e)||!rv(e);function jv(e,t,n=new WeakSet){if(Lv(e)||Lv(t))return e===t;if(tv(e)&&tv(t))return e.getTime()===t.getTime();const r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);for(const o of r){const r=e[o];if(!i.includes(o))return!1;if("ref"!==o){const e=t[o];if(tv(r)&&tv(e)||iv(r)&&iv(e)||Array.isArray(r)&&Array.isArray(e)?!jv(r,e,n):r!==e)return!1}}return!0}function $v(e){const t=Pv(),{name:n,disabled:i,control:o=t.control,shouldUnregister:s,defaultValue:a}=e,l=sv(o._names.array,n),u=r.useMemo(()=>pv(o._formValues,n,pv(o._defaultValues,n,a)),[o,n,a]),c=function(e){const t=Pv(),{control:n=t.control,name:i,defaultValue:o,disabled:s,exact:a,compute:l}=e||{},u=r.useRef(o),c=r.useRef(l),d=r.useRef(void 0),h=r.useRef(n),p=r.useRef(i);c.current=l;const[f,m]=r.useState(()=>{const e=n._getWatch(i,u.current);return c.current?c.current(e):e}),g=r.useCallback(e=>{const t=Fv(i,n._names,e||n._formValues,!1,u.current);return c.current?c.current(t):t},[n._formValues,n._names,i]),y=r.useCallback(e=>{if(!s){const t=Fv(i,n._names,e||n._formValues,!1,u.current);if(c.current){const e=c.current(t);jv(e,d.current)||(m(e),d.current=e)}else m(t)}},[n._formValues,n._names,s,i]);Iv(()=>(h.current===n&&jv(p.current,i)||(h.current=n,p.current=i,y()),n._subscribe({name:i,formState:{values:!0},exact:a,callback:e=>{y(e.values)}})),[n,a,i,y]),r.useEffect(()=>n._removeUnmounted());const b=h.current!==n,v=p.current,_=r.useMemo(()=>{if(s)return null;const e=!b&&!jv(v,i);return b||e?g():null},[s,b,i,v,g]);return null!==_?_:f}({control:o,name:n,defaultValue:u,exact:!0}),d=function(e){const t=Pv(),{control:n=t.control,disabled:i,name:o,exact:s}=e||{},[a,l]=r.useState(n._formState),u=r.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Iv(()=>n._subscribe({name:o,formState:u.current,exact:s,callback:e=>{!i&&l({...n._formState,...e})}}),[o,i,s]),r.useEffect(()=>{u.current.isValid&&n._setValid(!0)},[n]),r.useMemo(()=>Dv(a,n,u.current,!1),[a,n])}({control:o,name:n,exact:!0}),h=r.useRef(e),p=r.useRef(void 0),f=r.useRef(o.register(n,{...e.rules,value:c,...fv(e.disabled)?{disabled:e.disabled}:{}}));h.current=e;const m=r.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!pv(d.errors,n)},isDirty:{enumerable:!0,get:()=>!!pv(d.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!pv(d.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!pv(d.validatingFields,n)},error:{enumerable:!0,get:()=>pv(d.errors,n)}}),[d,n]),g=r.useCallback(e=>f.current.onChange({target:{value:ov(e),name:n},type:bv}),[n]),y=r.useCallback(()=>f.current.onBlur({target:{value:pv(o._formValues,n),name:n},type:gv}),[n,o._formValues]),b=r.useCallback(e=>{const t=pv(o._fields,n);t&&e&&(t._f.ref={focus:()=>e.focus&&e.focus(),select:()=>e.select&&e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})},[o._fields,n]),v=r.useMemo(()=>({name:n,value:c,...fv(i)||d.disabled?{disabled:d.disabled||i}:{},onChange:g,onBlur:y,ref:b}),[n,i,d.disabled,g,y,b,c]);return r.useEffect(()=>{const e=o._options.shouldUnregister||s,t=p.current;t&&t!==n&&!l&&o.unregister(t),o.register(n,{...h.current.rules,...fv(h.current.disabled)?{disabled:h.current.disabled}:{}});const r=(e,t)=>{const n=pv(o._fields,e);n&&n._f&&(n._f.mount=t)};if(r(n,!0),e){const e=lv(pv(o._options.defaultValues,n,h.current.defaultValue));mv(o._defaultValues,n,e),cv(pv(o._formValues,n))&&mv(o._formValues,n,e)}return!l&&o.register(n),p.current=n,()=>{(l?e&&!o._state.action:e)?o.unregister(n):r(n,!1)}},[n,o,l,s]),r.useEffect(()=>{o._setDisabledField({disabled:i,name:n})},[i,n,o]),r.useMemo(()=>({field:v,formState:d,fieldState:m}),[v,d,m])}const Bv=e=>e.render($v(e));var Vv=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},Uv=e=>Array.isArray(e)?e:[e],Wv=()=>{let e=[];return{get observers(){return e},next:t=>{for(const n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}};function qv(e,t){const n={};for(const r in e)if(e.hasOwnProperty(r)){const i=e[r],o=t[r];if(i&&iv(i)&&o){const e=qv(i,o);iv(e)&&(n[r]=e)}else e[r]&&(n[r]=o)}return n}var Gv=e=>iv(e)&&!Object.keys(e).length,Hv=e=>"file"===e.type,Yv=e=>"function"==typeof e,Kv=e=>{if(!av)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Xv=e=>"select-multiple"===e.type,Zv=e=>"radio"===e.type,Jv=e=>Kv(e)&&e.isConnected;function Qv(e,t){const n=Array.isArray(t)?t:uv(t)?[t]:hv(t),r=1===n.length?e:function(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=cv(e)?r++:e[t[r++]];return e}(e,n),i=n.length-1,o=n[i];return r&&delete r[o],0!==i&&(iv(r)&&Gv(r)||Array.isArray(r)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!cv(e[t]))return!1;return!0}(r))&&Qv(e,n.slice(0,-1)),e}function e_(e){return Array.isArray(e)||iv(e)&&!(e=>{for(const t in e)if(Yv(e[t]))return!0;return!1})(e)}function t_(e,t={}){for(const n in e)e_(e[n])?(t[n]=Array.isArray(e[n])?[]:{},t_(e[n],t[n])):cv(e[n])||(t[n]=!0);return t}function n_(e,t,n){n||(n=t_(t));for(const r in e)e_(e[r])?cv(t)||Lv(n[r])?n[r]=t_(e[r],Array.isArray(e[r])?[]:{}):n_(e[r],nv(t)?{}:t[r],n[r]):n[r]=!jv(e[r],t[r]);return n}const r_={value:!1,isValid:!1},i_={value:!0,isValid:!0};var o_=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!cv(e[0].attributes.value)?cv(e[0].value)||""===e[0].value?i_:{value:e[0].value,isValid:!0}:i_:r_}return r_},s_=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>cv(e)?e:t?""===e?NaN:e?+e:e:n&&zv(e)?new Date(e):r?r(e):e;const a_={isValid:!1,value:null};var l_=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,a_):a_;function u_(e){const t=e.ref;return Hv(t)?t.files:Zv(t)?l_(e.refs).value:Xv(t)?[...t.selectedOptions].map(({value:e})=>e):ev(t)?o_(e.refs).value:s_(cv(t.value)?e.ref.value:t.value,e)}var c_=e=>e instanceof RegExp,d_=e=>cv(e)?e:c_(e)?e.source:iv(e)?c_(e.value)?e.value.source:e.value:e,h_=e=>({isOnSubmit:!e||e===xv,isOnBlur:e===vv,isOnChange:e===_v,isOnAll:e===Ev,isOnTouch:e===wv});const p_="AsyncFunction";var f_=e=>!!e&&!!e.validate&&!!(Yv(e.validate)&&e.validate.constructor.name===p_||iv(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===p_)),m_=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));const g_=(e,t,n,r)=>{for(const i of n||Object.keys(e)){const n=pv(e,i);if(n){const{_f:e,...o}=n;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],i)&&!r)return!0;if(e.ref&&t(e.ref,e.name)&&!r)return!0;if(g_(o,t))break}else if(iv(o)&&g_(o,t))break}}};function y_(e,t,n){const r=pv(e,n);if(r||uv(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const r=i.join("."),o=pv(t,r),s=pv(e,r);if(o&&!Array.isArray(o)&&n!==r)return{name:n};if(s&&s.type)return{name:r,error:s};if(s&&s.root&&s.root.type)return{name:`${r}.root`,error:s.root};i.pop()}return{name:n}}var b_=(e,t,n)=>{const r=Uv(pv(e,n));return mv(r,"root",t[n]),mv(e,n,r),e};function v_(e,t,n="validate"){if(zv(e)||Array.isArray(e)&&e.every(zv)||fv(e)&&!e)return{type:n,message:zv(e)?e:"",ref:t}}var __=e=>iv(e)&&!c_(e)?e:{value:e,message:""},x_=async(e,t,n,r,i,o)=>{const{ref:s,refs:a,required:l,maxLength:u,minLength:c,min:d,max:h,pattern:p,validate:f,name:m,valueAsNumber:g,mount:y}=e._f,b=pv(n,m);if(!y||t.has(m))return{};const v=a?a[0]:s,_=e=>{i&&v.reportValidity&&(v.setCustomValidity(fv(e)?"":e||""),v.reportValidity())},x={},w=Zv(s),E=ev(s),S=w||E,T=(g||Hv(s))&&cv(s.value)&&cv(b)||Kv(s)&&""===s.value||""===b||Array.isArray(b)&&!b.length,k=Vv.bind(null,m,r,x),O=(e,t,n,r=kv,i=Ov)=>{const o=e?t:n;x[m]={type:e?r:i,message:o,ref:s,...k(e?r:i,o)}};if(o?!Array.isArray(b)||!b.length:l&&(!S&&(T||nv(b))||fv(b)&&!b||E&&!o_(a).isValid||w&&!l_(a).isValid)){const{value:e,message:t}=zv(l)?{value:!!l,message:l}:__(l);if(e&&(x[m]={type:Cv,message:t,ref:v,...k(Cv,t)},!r))return _(t),x}if(!(T||nv(d)&&nv(h))){let e,t;const n=__(h),i=__(d);if(nv(b)||isNaN(b)){const r=s.valueAsDate||new Date(b),o=e=>new Date((new Date).toDateString()+" "+e),a="time"==s.type,l="week"==s.type;zv(n.value)&&b&&(e=a?o(b)>o(n.value):l?b>n.value:r>new Date(n.value)),zv(i.value)&&b&&(t=a?o(b)<o(i.value):l?b<i.value:r<new Date(i.value))}else{const r=s.valueAsNumber||(b?+b:b);nv(n.value)||(e=r>n.value),nv(i.value)||(t=r<i.value)}if((e||t)&&(O(!!e,n.message,i.message,Sv,Tv),!r))return _(x[m].message),x}if((u||c)&&!T&&(zv(b)||o&&Array.isArray(b))){const e=__(u),t=__(c),n=!nv(e.value)&&b.length>+e.value,i=!nv(t.value)&&b.length<+t.value;if((n||i)&&(O(n,e.message,t.message),!r))return _(x[m].message),x}if(p&&!T&&zv(b)){const{value:e,message:t}=__(p);if(c_(e)&&!b.match(e)&&(x[m]={type:Av,message:t,ref:s,...k(Av,t)},!r))return _(t),x}if(f)if(Yv(f)){const e=v_(await f(b,n),v);if(e&&(x[m]={...e,...k(Rv,e.message)},!r))return _(e.message),x}else if(iv(f)){let e={};for(const t in f){if(!Gv(e)&&!r)break;const i=v_(await f[t](b,n),v,t);i&&(e={...i,...k(t,i.message)},_(i.message),r&&(x[m]=e))}if(!Gv(e)&&(x[m]={ref:v,...e},!r))return x}return _(!0),x};const w_={mode:xv,reValidateMode:_v,shouldFocusError:!0};function E_(e={}){let t,n={...w_,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:Yv(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:n.errors||{},disabled:n.disabled||!1},i={},o=(iv(n.defaultValues)||iv(n.values))&&lv(n.defaultValues||n.values)||{},s=n.shouldUnregister?{}:lv(o),a={action:!1,mount:!1,watch:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},u=0;const c={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let d={...c};const h={array:Wv(),state:Wv()},p=n.criteriaMode===Ev,f=async e=>{if(!n.disabled&&(c.isValid||d.isValid||e)){const e=n.resolver?Gv((await v()).errors):await _(i,!0);e!==r.isValid&&h.state.next({isValid:e})}},m=(e,t)=>{!n.disabled&&(c.isValidating||c.validatingFields||d.isValidating||d.validatingFields)&&((e||Array.from(l.mount)).forEach(e=>{e&&(t?mv(r.validatingFields,e,t):Qv(r.validatingFields,e))}),h.state.next({validatingFields:r.validatingFields,isValidating:!Gv(r.validatingFields)}))},g=(e,t,n,r)=>{const l=pv(i,e);if(l){const i=pv(s,e,cv(n)?pv(o,e):n);cv(i)||r&&r.defaultChecked||t?mv(s,e,t?i:u_(l._f)):E(e,i),a.mount&&f()}},y=(e,t,i,s,a)=>{let l=!1,u=!1;const p={name:e};if(!n.disabled){if(!i||s){(c.isDirty||d.isDirty)&&(u=r.isDirty,r.isDirty=p.isDirty=x(),l=u!==p.isDirty);const n=jv(pv(o,e),t);u=!!pv(r.dirtyFields,e),n?Qv(r.dirtyFields,e):mv(r.dirtyFields,e,!0),p.dirtyFields=r.dirtyFields,l=l||(c.dirtyFields||d.dirtyFields)&&u!==!n}if(i){const t=pv(r.touchedFields,e);t||(mv(r.touchedFields,e,i),p.touchedFields=r.touchedFields,l=l||(c.touchedFields||d.touchedFields)&&t!==i)}l&&a&&h.state.next(p)}return l?p:{}},b=(e,i,o,s)=>{const a=pv(r.errors,e),l=(c.isValid||d.isValid)&&fv(i)&&r.isValid!==i;var p;if(n.delayError&&o?(p=()=>((e,t)=>{mv(r.errors,e,t),h.state.next({errors:r.errors})})(e,o),t=e=>{clearTimeout(u),u=setTimeout(p,e)},t(n.delayError)):(clearTimeout(u),t=null,o?mv(r.errors,e,o):Qv(r.errors,e)),(o?!jv(a,o):a)||!Gv(s)||l){const t={...s,...l&&fv(i)?{isValid:i}:{},errors:r.errors,name:e};r={...r,...t},h.state.next(t)}},v=async e=>{m(e,!0);const t=await n.resolver(s,n.context,((e,t,n,r)=>{const i={};for(const n of e){const e=pv(t,n);e&&mv(i,n,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}})(e||l.mount,i,n.criteriaMode,n.shouldUseNativeValidation));return m(e),t},_=async(e,t,i={valid:!0})=>{for(const o in e){const a=e[o];if(a){const{_f:e,...o}=a;if(e){const o=l.array.has(e.name),u=a._f&&f_(a._f);u&&c.validatingFields&&m([e.name],!0);const d=await x_(a,l.disabled,s,p,n.shouldUseNativeValidation&&!t,o);if(u&&c.validatingFields&&m([e.name]),d[e.name]&&(i.valid=!1,t))break;!t&&(pv(d,e.name)?o?b_(r.errors,d,e.name):mv(r.errors,e.name,d[e.name]):Qv(r.errors,e.name))}!Gv(o)&&await _(o,t,i)}}return i.valid},x=(e,t)=>!n.disabled&&(e&&t&&mv(s,e,t),!jv(C(),o)),w=(e,t,n)=>Fv(e,l,{...a.mount?s:cv(t)?o:zv(e)?{[e]:t}:t},n,t),E=(e,t,n={})=>{const r=pv(i,e);let o=t;if(r){const n=r._f;n&&(!n.disabled&&mv(s,e,s_(t,n)),o=Kv(n.ref)&&nv(t)?"":t,Xv(n.ref)?[...n.ref.options].forEach(e=>e.selected=o.includes(e.value)):n.refs?ev(n.ref)?n.refs.forEach(e=>{e.defaultChecked&&e.disabled||(Array.isArray(o)?e.checked=!!o.find(t=>t===e.value):e.checked=o===e.value||!!o)}):n.refs.forEach(e=>e.checked=e.value===o):Hv(n.ref)?n.ref.value="":(n.ref.value=o,n.ref.type||h.state.next({name:e,values:lv(s)})))}(n.shouldDirty||n.shouldTouch)&&y(e,o,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&A(e)},S=(e,t,n)=>{for(const r in t){if(!t.hasOwnProperty(r))return;const o=t[r],s=e+"."+r,a=pv(i,s);(l.array.has(e)||iv(o)||a&&!a._f)&&!tv(o)?S(s,o,n):E(s,o,n)}},T=(e,t,n={})=>{const u=pv(i,e),p=l.array.has(e),f=lv(t);mv(s,e,f),p?(h.array.next({name:e,values:lv(s)}),(c.isDirty||c.dirtyFields||d.isDirty||d.dirtyFields)&&n.shouldDirty&&h.state.next({name:e,dirtyFields:n_(o,s),isDirty:x(e,f)})):!u||u._f||nv(f)?E(e,f,n):S(e,f,n),m_(e,l)&&h.state.next({...r,name:e}),h.state.next({name:a.mount?e:void 0,values:lv(s)})},k=async e=>{a.mount=!0;const o=e.target;let u=o.name,g=!0;const x=pv(i,u),w=e=>{g=Number.isNaN(e)||tv(e)&&isNaN(e.getTime())||jv(e,pv(s,u,e))},E=h_(n.mode),S=h_(n.reValidateMode);if(x){let a,k;const O=o.type?u_(x._f):ov(e),C=e.type===gv||e.type===yv,R=!((T=x._f).mount&&(T.required||T.min||T.max||T.maxLength||T.minLength||T.pattern||T.validate)||n.resolver||pv(r.errors,u)||x._f.deps)||((e,t,n,r,i)=>!i.isOnAll&&(!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:!(n?r.isOnChange:i.isOnChange)||e))(C,pv(r.touchedFields,u),r.isSubmitted,S,E),N=m_(u,l,C);mv(s,u,O),C?o&&o.readOnly||(x._f.onBlur&&x._f.onBlur(e),t&&t(0)):x._f.onChange&&x._f.onChange(e);const P=y(u,O,C),M=!Gv(P)||N;if(!C&&h.state.next({name:u,type:e.type,values:lv(s)}),R)return(c.isValid||d.isValid)&&("onBlur"===n.mode?C&&f():C||f()),M&&h.state.next({name:u,...N?{}:P});if(!C&&N&&h.state.next({...r}),n.resolver){const{errors:e}=await v([u]);if(w(O),g){const t=y_(r.errors,i,u),n=y_(e,i,t.name||u);a=n.error,u=n.name,k=Gv(e)}}else m([u],!0),a=(await x_(x,l.disabled,s,p,n.shouldUseNativeValidation))[u],m([u]),w(O),g&&(a?k=!1:(c.isValid||d.isValid)&&(k=await _(i,!0)));g&&(x._f.deps&&(!Array.isArray(x._f.deps)||x._f.deps.length>0)&&A(x._f.deps),b(u,k,a,P))}var T},O=(e,t)=>{if(pv(r.errors,t)&&e.focus)return e.focus(),1},A=async(e,t={})=>{let o,s;const a=Uv(e);if(n.resolver){const t=await(async e=>{const{errors:t}=await v(e);if(e)for(const n of e){const e=pv(t,n);e?mv(r.errors,n,e):Qv(r.errors,n)}else r.errors=t;return t})(cv(e)?e:a);o=Gv(t),s=e?!a.some(e=>pv(t,e)):o}else e?(s=(await Promise.all(a.map(async e=>{const t=pv(i,e);return await _(t&&t._f?{[e]:t}:t)}))).every(Boolean),(s||r.isValid)&&f()):s=o=await _(i);return h.state.next({...!zv(e)||(c.isValid||d.isValid)&&o!==r.isValid?{}:{name:e},...n.resolver||!e?{isValid:o}:{},errors:r.errors}),t.shouldFocus&&!s&&g_(i,O,e?a:l.mount),s},C=(e,t)=>{let n={...a.mount?s:o};return t&&(n=qv(t.dirtyFields?r.dirtyFields:r.touchedFields,n)),cv(e)?n:zv(e)?pv(n,e):e.map(e=>pv(n,e))},R=(e,t)=>({invalid:!!pv((t||r).errors,e),isDirty:!!pv((t||r).dirtyFields,e),error:pv((t||r).errors,e),isValidating:!!pv(r.validatingFields,e),isTouched:!!pv((t||r).touchedFields,e)}),N=(e,t,n)=>{const o=(pv(i,e,{_f:{}})._f||{}).ref,s=pv(r.errors,e)||{},{ref:a,message:l,type:u,...c}=s;mv(r.errors,e,{...c,...t,ref:o}),h.state.next({name:e,errors:r.errors,isValid:!1}),n&&n.shouldFocus&&o&&o.focus&&o.focus()},P=e=>h.state.subscribe({next:t=>{var n,i,a;n=e.name,i=t.name,a=e.exact,n&&i&&n!==i&&!Uv(n).some(e=>e&&(a?e===i:e.startsWith(i)||i.startsWith(e)))||!((e,t,n,r)=>{n(e);const{name:i,...o}=e;return Gv(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(e=>t[e]===(!r||Ev))})(t,e.formState||c,$,e.reRenderRoot)||e.callback({values:{...s},...r,...t,defaultValues:o})}}).unsubscribe,M=(e,t={})=>{for(const a of e?Uv(e):l.mount)l.mount.delete(a),l.array.delete(a),t.keepValue||(Qv(i,a),Qv(s,a)),!t.keepError&&Qv(r.errors,a),!t.keepDirty&&Qv(r.dirtyFields,a),!t.keepTouched&&Qv(r.touchedFields,a),!t.keepIsValidating&&Qv(r.validatingFields,a),!n.shouldUnregister&&!t.keepDefaultValue&&Qv(o,a);h.state.next({values:lv(s)}),h.state.next({...r,...t.keepDirty?{isDirty:x()}:{}}),!t.keepIsValid&&f()},D=({disabled:e,name:t})=>{(fv(e)&&a.mount||e||l.disabled.has(t))&&(e?l.disabled.add(t):l.disabled.delete(t))},I=(e,t={})=>{let r=pv(i,e);const s=fv(t.disabled)||fv(n.disabled);return mv(i,e,{...r||{},_f:{...r&&r._f?r._f:{ref:{name:e}},name:e,mount:!0,...t}}),l.mount.add(e),r?D({disabled:fv(t.disabled)?t.disabled:n.disabled,name:e}):g(e,!0,t.value),{...s?{disabled:t.disabled||n.disabled}:{},...n.progressive?{required:!!t.required,min:d_(t.min),max:d_(t.max),minLength:d_(t.minLength),maxLength:d_(t.maxLength),pattern:d_(t.pattern)}:{},name:e,onChange:k,onBlur:k,ref:s=>{if(s){I(e,t),r=pv(i,e);const n=cv(s.value)&&s.querySelectorAll&&s.querySelectorAll("input,select,textarea")[0]||s,a=(e=>Zv(e)||ev(e))(n),l=r._f.refs||[];if(a?l.find(e=>e===n):n===r._f.ref)return;mv(i,e,{_f:{...r._f,...a?{refs:[...l.filter(Jv),n,...Array.isArray(pv(o,e))?[{}]:[]],ref:{type:n.type,name:e}}:{ref:n}}}),g(e,!1,void 0,n)}else r=pv(i,e,{}),r._f&&(r._f.mount=!1),(n.shouldUnregister||t.shouldUnregister)&&(!sv(l.array,e)||!a.action)&&l.unMount.add(e)}}},z=()=>n.shouldFocusError&&g_(i,O,l.mount),F=(e,t)=>async o=>{let a;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let u=lv(s);if(h.state.next({isSubmitting:!0}),n.resolver){const{errors:e,values:t}=await v();r.errors=e,u=lv(t)}else await _(i);if(l.disabled.size)for(const e of l.disabled)Qv(u,e);if(Qv(r.errors,"root"),Gv(r.errors)){h.state.next({errors:{}});try{await e(u,o)}catch(e){a=e}}else t&&await t({...r.errors},o),z(),setTimeout(z);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Gv(r.errors)&&!a,submitCount:r.submitCount+1,errors:r.errors}),a)throw a},L=(e,t={})=>{const u=e?lv(e):o,d=lv(u),p=Gv(e),f=p?o:d;if(t.keepDefaultValues||(o=u),!t.keepValues){if(t.keepDirtyValues){const e=new Set([...l.mount,...Object.keys(n_(o,s))]);for(const t of Array.from(e))pv(r.dirtyFields,t)?mv(f,t,pv(s,t)):T(t,pv(f,t))}else{if(av&&cv(e))for(const e of l.mount){const t=pv(i,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(Kv(e)){const t=e.closest("form");if(t){t.reset();break}}}}if(t.keepFieldsRef)for(const e of l.mount)T(e,pv(f,e));else i={}}s=n.shouldUnregister?t.keepDefaultValues?lv(o):{}:lv(f),h.array.next({values:{...f}}),h.state.next({values:{...f}})}l={mount:t.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},a.mount=!c.isValid||!!t.keepIsValid||!!t.keepDirtyValues||!n.shouldUnregister&&!Gv(f),a.watch=!!n.shouldUnregister,h.state.next({submitCount:t.keepSubmitCount?r.submitCount:0,isDirty:!p&&(t.keepDirty?r.isDirty:!(!t.keepDefaultValues||jv(e,o))),isSubmitted:!!t.keepIsSubmitted&&r.isSubmitted,dirtyFields:p?{}:t.keepDirtyValues?t.keepDefaultValues&&s?n_(o,s):r.dirtyFields:t.keepDefaultValues&&e?n_(o,e):t.keepDirty?r.dirtyFields:{},touchedFields:t.keepTouched?r.touchedFields:{},errors:t.keepErrors?r.errors:{},isSubmitSuccessful:!!t.keepIsSubmitSuccessful&&r.isSubmitSuccessful,isSubmitting:!1,defaultValues:o})},j=(e,t)=>L(Yv(e)?e(s):e,t),$=e=>{r={...r,...e}},B={control:{register:I,unregister:M,getFieldState:R,handleSubmit:F,setError:N,_subscribe:P,_runSchema:v,_focusError:z,_getWatch:w,_getDirty:x,_setValid:f,_setFieldArray:(e,t=[],l,u,p=!0,f=!0)=>{if(u&&l&&!n.disabled){if(a.action=!0,f&&Array.isArray(pv(i,e))){const t=l(pv(i,e),u.argA,u.argB);p&&mv(i,e,t)}if(f&&Array.isArray(pv(r.errors,e))){const t=l(pv(r.errors,e),u.argA,u.argB);p&&mv(r.errors,e,t),((e,t)=>{!dv(pv(e,t)).length&&Qv(e,t)})(r.errors,e)}if((c.touchedFields||d.touchedFields)&&f&&Array.isArray(pv(r.touchedFields,e))){const t=l(pv(r.touchedFields,e),u.argA,u.argB);p&&mv(r.touchedFields,e,t)}(c.dirtyFields||d.dirtyFields)&&(r.dirtyFields=n_(o,s)),h.state.next({name:e,isDirty:x(e,t),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else mv(s,e,t)},_setDisabledField:D,_setErrors:e=>{r.errors=e,h.state.next({errors:r.errors,isValid:!1})},_getFieldArray:e=>dv(pv(a.mount?s:o,e,n.shouldUnregister?pv(o,e,[]):[])),_reset:L,_resetDefaultValues:()=>Yv(n.defaultValues)&&n.defaultValues().then(e=>{j(e,n.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:()=>{for(const e of l.unMount){const t=pv(i,e);t&&(t._f.refs?t._f.refs.every(e=>!Jv(e)):!Jv(t._f.ref))&&M(e)}l.unMount=new Set},_disableForm:e=>{fv(e)&&(h.state.next({disabled:e}),g_(i,(t,n)=>{const r=pv(i,n);r&&(t.disabled=r._f.disabled||e,Array.isArray(r._f.refs)&&r._f.refs.forEach(t=>{t.disabled=r._f.disabled||e}))},0,!1))},_subjects:h,_proxyFormState:c,get _fields(){return i},get _formValues(){return s},get _state(){return a},set _state(e){a=e},get _defaultValues(){return o},get _names(){return l},set _names(e){l=e},get _formState(){return r},get _options(){return n},set _options(e){n={...n,...e}}},subscribe:e=>(a.mount=!0,d={...d,...e.formState},P({...e,formState:d})),trigger:A,register:I,handleSubmit:F,watch:(e,t)=>Yv(e)?h.state.subscribe({next:n=>"values"in n&&e(w(void 0,t),n)}):w(e,t,!0),setValue:T,getValues:C,reset:j,resetField:(e,t={})=>{pv(i,e)&&(cv(t.defaultValue)?T(e,lv(pv(o,e))):(T(e,t.defaultValue),mv(o,e,lv(t.defaultValue))),t.keepTouched||Qv(r.touchedFields,e),t.keepDirty||(Qv(r.dirtyFields,e),r.isDirty=t.defaultValue?x(e,lv(pv(o,e))):x()),t.keepError||(Qv(r.errors,e),c.isValid&&f()),h.state.next({...r}))},clearErrors:e=>{e&&Uv(e).forEach(e=>Qv(r.errors,e)),h.state.next({errors:e?r.errors:{}})},unregister:M,setError:N,setFocus:(e,t={})=>{const n=pv(i,e),r=n&&n._f;if(r){const e=r.refs?r.refs[0]:r.ref;e.focus&&(e.focus(),t.shouldSelect&&Yv(e.select)&&e.select())}},getFieldState:R};return{...B,formControl:B}}const S_=({sx:t,...n})=>e(dl,{variant:"body1",sx:{color:"var(--color-white)",cursor:"default",...t},...n}),T_=fs(Ed)({padding:0,marginRight:"5px",marginLeft:"10px","& .MuiSvgIcon-root":{color:"var(--color-orange-medium)"}});function k_({label:t,name:r,...i}){const o=n.useId(),{control:s,setValue:a,watch:l}=Pv(),u=l(r),c=`${o}-${r}-${String(u)}`;return e(Bv,{control:s,name:r,render:({field:n})=>{const{value:r,name:o}=n;return t?e(wh,{color:"white",control:e(T_,{...i,checked:r,onChange:(e,t)=>{a(o,t,{shouldValidate:!0})}}),label:e(S_,{children:t})}):e(T_,{...i,checked:r,onChange:(e,t)=>{a(o,t,{shouldValidate:!0})}})}},c)}function O_({form:t,sx:n={},onSubmit:r,children:i}){const{handleSubmit:o}=t;return e(Mv,{...t,children:e(Jc,{component:"form",sx:{display:"grid",gap:"15px",...n},onSubmit:o(r),children:i})})}const A_=()=>Pv(),C_=t=>e(Qp,{size:"small",...t});function R_({name:t,items:r,label:i,sx:o,getLabel:s,getValue:a,getKey:l}){const{watch:u,resetField:c,setValue:d}=Pv(),h=u(t),p=n.useId(),f=r.find(e=>a(e)===h);return e(Vc,{value:f,options:r,id:p,getOptionLabel:e=>s(e),getOptionKey:e=>l(e),sx:{minWidth:150,...o},size:"small",onChange:(e,n)=>{n?d(t,a(n)):c(t)},renderInput:t=>e(C_,{...t,label:i})})}function N_(t){const{name:r,type:i}=t,o=n.useId(),{control:s}=Pv();return e(Bv,{name:r,control:s,render:({field:n})=>e(C_,{id:o,size:"small",...t,...n,onChange:e=>{const{target:t}=e,{value:r}=t;if("number"===i)""===r?n.onChange():n.onChange(Number(r));else n.onChange(e)}})})}const P_="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function M_(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function D_(e){return"nodeType"in e}function I_(e){var t,n;return e?M_(e)?e:D_(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function z_(e){const{Document:t}=I_(e);return e instanceof t}function F_(e){return!M_(e)&&e instanceof I_(e).HTMLElement}function L_(e){return e instanceof I_(e).SVGElement}function j_(e){return e?M_(e)?e.document:D_(e)?z_(e)?e:F_(e)||L_(e)?e.ownerDocument:document:document:document}const $_=P_?d:h;function B_(e){const t=p(e);return $_(()=>{t.current=e}),m(function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)},[])}function V_(e,t){void 0===t&&(t=[e]);const n=p(e);return $_(()=>{n.current!==e&&(n.current=e)},t),n}function U_(e,t){const n=p();return f(()=>{const t=e(n.current);return n.current=t,t},[...t])}function W_(e){const t=B_(e),n=p(null),r=m(e=>{e!==n.current&&(null==t||t(e,n.current)),n.current=e},[]);return[n,r]}function q_(e){const t=p();return h(()=>{t.current=e},[e]),t.current}let G_={};function H_(e,t){return f(()=>{if(t)return t;const n=null==G_[e]?0:G_[e]+1;return G_[e]=n,e+"-"+n},[e,t])}function Y_(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((t,n)=>{const r=Object.entries(n);for(const[n,i]of r){const r=t[n];null!=r&&(t[n]=r+e*i)}return t},{...t})}}const K_=Y_(1),X_=Y_(-1);function Z_(e){if(!e)return!1;const{KeyboardEvent:t}=I_(e.target);return t&&e instanceof t}function J_(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=I_(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return function(e){return"clientX"in e&&"clientY"in e}(e)?{x:e.clientX,y:e.clientY}:null}const Q_=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Q_.Translate.toString(e),Q_.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),ex="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function tx(e){return e.matches(ex)?e:e.querySelector(ex)}const nx={display:"none"};function rx(e){let{id:t,value:n}=e;return r.createElement("div",{id:t,style:nx},n)}function ix(e){let{id:t,announcement:n,ariaLiveType:i="assertive"}=e;return r.createElement("div",{id:t,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":i,"aria-atomic":!0},n)}const ox=g(null);const sx={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},ax={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function lx(e){let{announcements:t=ax,container:n,hiddenTextDescribedById:i,screenReaderInstructions:s=sx}=e;const{announce:a,announcement:l}=function(){const[e,t]=u("");return{announce:m(e=>{null!=e&&t(e)},[]),announcement:e}}(),c=H_("DndLiveRegion"),[d,p]=u(!1);if(h(()=>{p(!0)},[]),function(e){const t=o(ox);h(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}(f(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!d)return null;const g=r.createElement(r.Fragment,null,r.createElement(rx,{id:i,value:s.draggable}),r.createElement(ix,{id:c,announcement:l}));return n?S(g,n):g}var ux;function cx(){}!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(ux||(ux={}));const dx=Object.freeze({x:0,y:0});function hx(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function px(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function fx(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function mx(e,t,n){return void 0===t&&(t=e.left),void 0===n&&(n=e.top),{x:t+.5*e.width,y:n+.5*e.height}}const gx=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=mx(t,t.left,t.top),o=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=hx(mx(r),i);o.push({id:t,data:{droppableContainer:e,value:n}})}}return o.sort(px)};function yx(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),s=i-r,a=o-n;if(r<i&&n<o){const n=t.width*t.height,r=e.width*e.height,i=s*a;return Number((i/(n+r-i)).toFixed(4))}return 0}const bx=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const e of r){const{id:r}=e,o=n.get(r);if(o){const n=yx(o,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(fx)};function vx(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:dx}function _x(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}const xx=_x(1);const wx={ignoreTransform:!1};function Ex(e,t){void 0===t&&(t=wx);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:r}=I_(e).getComputedStyle(e);t&&(n=function(e,t,n){const r=function(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}(t);if(!r)return e;const{scaleX:i,scaleY:o,x:s,y:a}=r,l=e.left-s-(1-i)*parseFloat(n),u=e.top-a-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),c=i?e.width/i:e.width,d=o?e.height/o:e.height;return{width:c,height:d,top:u,right:l+c,bottom:u+d,left:l}}(n,t,r))}const{top:r,left:i,width:o,height:s,bottom:a,right:l}=n;return{top:r,left:i,width:o,height:s,bottom:a,right:l}}function Sx(e){return Ex(e,{ignoreTransform:!0})}function Tx(e,t){const n=[];return e?function r(i){if(null!=t&&n.length>=t)return n;if(!i)return n;if(z_(i)&&null!=i.scrollingElement&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!F_(i)||L_(i))return n;if(n.includes(i))return n;const o=I_(e).getComputedStyle(i);return i!==e&&function(e,t){void 0===t&&(t=I_(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(e=>{const r=t[e];return"string"==typeof r&&n.test(r)})}(i,o)&&n.push(i),function(e,t){return void 0===t&&(t=I_(e).getComputedStyle(e)),"fixed"===t.position}(i,o)?n:r(i.parentNode)}(e):n}function kx(e){const[t]=Tx(e,1);return null!=t?t:null}function Ox(e){return P_&&e?M_(e)?e:D_(e)?z_(e)||e===j_(e).scrollingElement?window:F_(e)?e:null:null:null}function Ax(e){return M_(e)?e.scrollX:e.scrollLeft}function Cx(e){return M_(e)?e.scrollY:e.scrollTop}function Rx(e){return{x:Ax(e),y:Cx(e)}}var Nx;function Px(e){return!(!P_||!e)&&e===document.scrollingElement}function Mx(e){const t={x:0,y:0},n=Px(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(Nx||(Nx={}));const Dx={x:.2,y:.2};function Ix(e,t,n,r,i){let{top:o,left:s,right:a,bottom:l}=n;void 0===r&&(r=10),void 0===i&&(i=Dx);const{isTop:u,isBottom:c,isLeft:d,isRight:h}=Mx(e),p={x:0,y:0},f={x:0,y:0},m=t.height*i.y,g=t.width*i.x;return!u&&o<=t.top+m?(p.y=Nx.Backward,f.y=r*Math.abs((t.top+m-o)/m)):!c&&l>=t.bottom-m&&(p.y=Nx.Forward,f.y=r*Math.abs((t.bottom-m-l)/m)),!h&&a>=t.right-g?(p.x=Nx.Forward,f.x=r*Math.abs((t.right-g-a)/g)):!d&&s<=t.left+g&&(p.x=Nx.Backward,f.x=r*Math.abs((t.left+g-s)/g)),{direction:p,speed:f}}function zx(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Fx(e){return e.reduce((e,t)=>K_(e,Rx(t)),dx)}const Lx=[["x",["left","right"],function(e){return e.reduce((e,t)=>e+Ax(t),0)}],["y",["top","bottom"],function(e){return e.reduce((e,t)=>e+Cx(t),0)}]];class jx{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=Tx(t),r=Fx(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,i]of Lx)for(const o of t)Object.defineProperty(this,o,{get:()=>{const t=i(n),s=r[e]-t;return this.rect[o]+s},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class $x{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)})},this.target=e}add(e,t,n){var r;null==(r=this.target)||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function Bx(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y}var Vx,Ux;function Wx(e){e.preventDefault()}function qx(e){e.stopPropagation()}!function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"}(Vx||(Vx={})),function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"}(Ux||(Ux={}));const Gx={start:[Ux.Space,Ux.Enter],cancel:[Ux.Esc],end:[Ux.Space,Ux.Enter,Ux.Tab]},Hx=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Ux.Right:return{...n,x:n.x+25};case Ux.Left:return{...n,x:n.x-25};case Ux.Down:return{...n,y:n.y+25};case Ux.Up:return{...n,y:n.y-25}}};class Yx{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new $x(j_(t)),this.windowListeners=new $x(I_(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Vx.Resize,this.handleCancel),this.windowListeners.add(Vx.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Vx.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&function(e,t){if(void 0===t&&(t=Ex),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);kx(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(n),t(dx)}handleKeyDown(e){if(Z_(e)){const{active:t,context:n,options:r}=this.props,{keyboardCodes:i=Gx,coordinateGetter:o=Hx,scrollBehavior:s="smooth"}=r,{code:a}=e;if(i.end.includes(a))return void this.handleEnd(e);if(i.cancel.includes(a))return void this.handleCancel(e);const{collisionRect:l}=n.current,u=l?{x:l.left,y:l.top}:dx;this.referenceCoordinates||(this.referenceCoordinates=u);const c=o(e,{active:t,context:n.current,currentCoordinates:u});if(c){const t=X_(c,u),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(const n of i){const i=e.code,{isTop:o,isRight:a,isLeft:l,isBottom:u,maxScroll:d,minScroll:h}=Mx(n),p=zx(n),f={x:Math.min(i===Ux.Right?p.right-p.width/2:p.right,Math.max(i===Ux.Right?p.left:p.left+p.width/2,c.x)),y:Math.min(i===Ux.Down?p.bottom-p.height/2:p.bottom,Math.max(i===Ux.Down?p.top:p.top+p.height/2,c.y))},m=i===Ux.Right&&!a||i===Ux.Left&&!l,g=i===Ux.Down&&!u||i===Ux.Up&&!o;if(m&&f.x!==c.x){const e=n.scrollLeft+t.x,o=i===Ux.Right&&e<=d.x||i===Ux.Left&&e>=h.x;if(o&&!t.y)return void n.scrollTo({left:e,behavior:s});r.x=o?n.scrollLeft-e:i===Ux.Right?n.scrollLeft-d.x:n.scrollLeft-h.x,r.x&&n.scrollBy({left:-r.x,behavior:s});break}if(g&&f.y!==c.y){const e=n.scrollTop+t.y,o=i===Ux.Down&&e<=d.y||i===Ux.Up&&e>=h.y;if(o&&!t.x)return void n.scrollTo({top:e,behavior:s});r.y=o?n.scrollTop-e:i===Ux.Down?n.scrollTop-d.y:n.scrollTop-h.y,r.y&&n.scrollBy({top:-r.y,behavior:s});break}}this.handleMove(e,K_(X_(c,this.referenceCoordinates),r))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function Kx(e){return Boolean(e&&"distance"in e)}function Xx(e){return Boolean(e&&"delay"in e)}Yx.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Gx,onActivation:i}=t,{active:o}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const t=o.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==i||i({event:e.nativeEvent}),!0)}return!1}}];class Zx{constructor(e,t,n){var r;void 0===n&&(n=function(e){const{EventTarget:t}=I_(e);return e instanceof t?e:j_(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:i}=e,{target:o}=i;this.props=e,this.events=t,this.document=j_(o),this.documentListeners=new $x(this.document),this.listeners=new $x(n),this.windowListeners=new $x(I_(o)),this.initialCoordinates=null!=(r=J_(i))?r:dx,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Vx.Resize,this.handleCancel),this.windowListeners.add(Vx.DragStart,Wx),this.windowListeners.add(Vx.VisibilityChange,this.handleCancel),this.windowListeners.add(Vx.ContextMenu,Wx),this.documentListeners.add(Vx.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Xx(t))return this.timeoutId=setTimeout(this.handleStart,t.delay),void this.handlePending(t);if(Kx(t))return void this.handlePending(t)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){const{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Vx.Click,qx,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Vx.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:r,props:i}=this,{onMove:o,options:{activationConstraint:s}}=i;if(!r)return;const a=null!=(t=J_(e))?t:dx,l=X_(r,a);if(!n&&s){if(Kx(s)){if(null!=s.tolerance&&Bx(l,s.tolerance))return this.handleCancel();if(Bx(l,s.distance))return this.handleStart()}return Xx(s)&&Bx(l,s.tolerance)?this.handleCancel():void this.handlePending(s,l)}e.cancelable&&e.preventDefault(),o(a)}handleEnd(){const{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){const{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===Ux.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const Jx={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Qx extends Zx{constructor(e){const{event:t}=e,n=j_(t.target);super(e,Jx,n)}}Qx.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!(!n.isPrimary||0!==n.button)&&(null==r||r({event:n}),!0)}}];const ew={move:{name:"mousemove"},end:{name:"mouseup"}};var tw;!function(e){e[e.RightClick=2]="RightClick"}(tw||(tw={}));(class extends Zx{constructor(e){super(e,ew,j_(e.event.target))}}).activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==tw.RightClick&&(null==r||r({event:n}),!0)}}];const nw={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};var rw,iw;function ow(e){let{acceleration:t,activator:n=rw.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:s=5,order:a=iw.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:c,delta:d,threshold:g}=e;const y=function(e){let{delta:t,disabled:n}=e;const r=q_(t);return U_(e=>{if(n||!r||!e)return sw;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Nx.Backward]:e.x[Nx.Backward]||-1===i.x,[Nx.Forward]:e.x[Nx.Forward]||1===i.x},y:{[Nx.Backward]:e.y[Nx.Backward]||-1===i.y,[Nx.Forward]:e.y[Nx.Forward]||1===i.y}}},[n,t,r])}({delta:d,disabled:!o}),[b,v]=function(){const e=p(null),t=m((t,n)=>{e.current=setInterval(t,n)},[]);return[t,m(()=>{null!==e.current&&(clearInterval(e.current),e.current=null)},[])]}(),_=p({x:0,y:0}),x=p({x:0,y:0}),w=f(()=>{switch(n){case rw.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case rw.DraggableRect:return i}},[n,i,l]),E=p(null),S=m(()=>{const e=E.current;if(!e)return;const t=_.current.x*x.current.x,n=_.current.y*x.current.y;e.scrollBy(t,n)},[]),T=f(()=>a===iw.TreeOrder?[...u].reverse():u,[a,u]);h(()=>{if(o&&u.length&&w){for(const e of T){if(!1===(null==r?void 0:r(e)))continue;const n=u.indexOf(e),i=c[n];if(!i)continue;const{direction:o,speed:a}=Ix(e,i,w,t,g);for(const e of["x","y"])y[e][o[e]]||(a[e]=0,o[e]=0);if(a.x>0||a.y>0)return v(),E.current=e,b(S,s),_.current=a,void(x.current=o)}_.current={x:0,y:0},x.current={x:0,y:0},v()}else v()},[t,S,r,v,o,s,JSON.stringify(w),JSON.stringify(y),b,u,T,c,JSON.stringify(g)])}(class extends Zx{constructor(e){super(e,nw)}static setup(){return window.addEventListener(nw.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(nw.move.name,e)};function e(){}}}).activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return!(i.length>1)&&(null==r||r({event:n}),!0)}}],function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"}(rw||(rw={})),function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"}(iw||(iw={}));const sw={x:{[Nx.Backward]:!1,[Nx.Forward]:!1},y:{[Nx.Backward]:!1,[Nx.Forward]:!1}};var aw,lw;!function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"}(aw||(aw={})),function(e){e.Optimized="optimized"}(lw||(lw={}));const uw=new Map;function cw(e,t){return U_(n=>e?n||("function"==typeof t?t(e):e):null,[t,e])}function dw(e){let{callback:t,disabled:n}=e;const r=B_(t),i=f(()=>{if(n||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(r)},[n]);return h(()=>()=>null==i?void 0:i.disconnect(),[i]),i}function hw(e){return new jx(Ex(e),e)}function pw(e,t,n){void 0===t&&(t=hw);const[r,i]=u(null);function o(){i(r=>{if(!e)return null;var i;if(!1===e.isConnected)return null!=(i=null!=r?r:n)?i:null;const o=t(e);return JSON.stringify(r)===JSON.stringify(o)?r:o})}const s=function(e){let{callback:t,disabled:n}=e;const r=B_(t),i=f(()=>{if(n||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(r)},[r,n]);return h(()=>()=>null==i?void 0:i.disconnect(),[i]),i}({callback(t){if(e)for(const n of t){const{type:t,target:r}=n;if("childList"===t&&r instanceof HTMLElement&&r.contains(e)){o();break}}}}),a=dw({callback:o});return $_(()=>{o(),e?(null==a||a.observe(e),null==s||s.observe(document.body,{childList:!0,subtree:!0})):(null==a||a.disconnect(),null==s||s.disconnect())},[e]),r}const fw=[];function mw(e,t){void 0===t&&(t=[]);const n=p(null);return h(()=>{n.current=null},t),h(()=>{const t=e!==dx;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?X_(e,n.current):dx}function gw(e){return f(()=>e?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(e):null,[e])}const yw=[];function bw(e){let{measure:t}=e;const[n,r]=u(null),i=m(e=>{for(const{target:n}of e)if(F_(n)){r(e=>{const r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t]),o=dw({callback:i}),s=m(e=>{const n=function(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return F_(t)?t:e}(e);null==o||o.disconnect(),n&&(null==o||o.observe(n)),r(n?t(n):null)},[t,o]),[a,l]=W_(s);return f(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const vw=[{sensor:Qx,options:{}},{sensor:Yx,options:{}}],_w={current:{}},xw={draggable:{measure:Sx},droppable:{measure:Sx,strategy:aw.WhileDragging,frequency:lw.Optimized},dragOverlay:{measure:Ex}};class ww extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}const Ew={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ww,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:cx},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:xw,measureDroppableContainers:cx,windowRect:null,measuringScheduled:!1},Sw=g({activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:cx,draggableNodes:new Map,over:null,measureDroppableContainers:cx}),Tw=g(Ew);function kw(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ww}}}function Ow(e,t){switch(t.type){case ux.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case ux.DragMove:return null==e.draggable.active?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case ux.DragEnd:case ux.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ux.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new ww(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case ux.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new ww(e.droppable.containers);return s.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:s}}}case ux.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new ww(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function Aw(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=o(Sw),s=q_(r),a=q_(null==n?void 0:n.id);return h(()=>{if(!t&&!r&&s&&null!=a){if(!Z_(s))return;if(document.activeElement===s.target)return;const e=i.get(a);if(!e)return;const{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(const e of[t.current,n.current]){if(!e)continue;const t=tx(e);if(t){t.focus();break}}})}},[r,t,i,a,s]),null}const Cw=g({...dx,scaleX:1,scaleY:1});var Rw;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(Rw||(Rw={}));const Nw=c(function(e){var t,n,i,o;let{id:s,accessibility:a,autoScroll:l=!0,children:c,sensors:d=vw,collisionDetection:g=bx,measuring:b,modifiers:v,..._}=e;const x=y(Ow,void 0,kw),[w,S]=x,[T,k]=function(){const[e]=u(()=>new Set),t=m(t=>(e.add(t),()=>e.delete(t)),[e]);return[m(t=>{let{type:n,event:r}=t;e.forEach(e=>{var t;return null==(t=e[n])?void 0:t.call(e,r)})},[e]),t]}(),[O,A]=u(Rw.Uninitialized),C=O===Rw.Initialized,{draggable:{active:R,nodes:N,translate:P},droppable:{containers:M}}=w,D=null!=R?N.get(R):null,I=p({initial:null,translated:null}),z=f(()=>{var e;return null!=R?{id:R,data:null!=(e=null==D?void 0:D.data)?e:_w,rect:I}:null},[R,D]),F=p(null),[L,j]=u(null),[$,B]=u(null),V=V_(_,Object.values(_)),U=H_("DndDescribedBy",s),W=f(()=>M.getEnabled(),[M]),q=function(e){return f(()=>({draggable:{...xw.draggable,...null==e?void 0:e.draggable},droppable:{...xw.droppable,...null==e?void 0:e.droppable},dragOverlay:{...xw.dragOverlay,...null==e?void 0:e.dragOverlay}}),[null==e?void 0:e.draggable,null==e?void 0:e.droppable,null==e?void 0:e.dragOverlay])}(b),{droppableRects:G,measureDroppableContainers:H,measuringScheduled:Y}=function(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,s]=u(null),{frequency:a,measure:l,strategy:c}=i,d=p(e),f=function(){switch(c){case aw.Always:return!1;case aw.BeforeDragging:return n;default:return!n}}(),g=V_(f),y=m(function(e){void 0===e&&(e=[]),g.current||s(t=>null===t?e:t.concat(e.filter(e=>!t.includes(e))))},[g]),b=p(null),v=U_(t=>{if(f&&!n)return uw;if(!t||t===uw||d.current!==e||null!=o){const t=new Map;for(let n of e){if(!n)continue;if(o&&o.length>0&&!o.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}const e=n.node.current,r=e?new jx(l(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,o,n,f,l]);return h(()=>{d.current=e},[e]),h(()=>{f||y()},[n,f]),h(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),h(()=>{f||"number"!=typeof a||null!==b.current||(b.current=setTimeout(()=>{y(),b.current=null},a))},[a,f,y,...r]),{droppableRects:v,measureDroppableContainers:y,measuringScheduled:null!=o}}(W,{dragging:C,dependencies:[P.x,P.y],config:q.droppable}),K=function(e,t){const n=null!=t?e.get(t):void 0,r=n?n.node.current:null;return U_(e=>{var n;return null==t?null:null!=(n=null!=r?r:e)?n:null},[r,t])}(N,R),X=f(()=>$?J_($):null,[$]),Z=function(){const e=!1===(null==L?void 0:L.autoScrollEnabled),t="object"==typeof l?!1===l.enabled:!1===l,n=C&&!e&&!t;if("object"==typeof l)return{...l,enabled:n};return{enabled:n}}(),J=function(e,t){return cw(e,t)}(K,q.draggable.measure);!function(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=p(!1),{x:s,y:a}="boolean"==typeof i?{x:i,y:i}:i;$_(()=>{if(!s&&!a||!t)return void(o.current=!1);if(o.current||!r)return;const e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;const i=vx(n(e),r);if(s||(i.x=0),a||(i.y=0),o.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){const t=kx(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,s,a,r,n])}({activeNode:null!=R?N.get(R):null,config:Z.layoutShiftCompensation,initialRect:J,measure:q.draggable.measure});const Q=pw(K,q.draggable.measure,J),ee=pw(K?K.parentElement:null),te=p({activatorEvent:null,active:null,activeNode:K,collisionRect:null,collisions:null,droppableRects:G,draggableNodes:N,draggingNode:null,draggingNodeRect:null,droppableContainers:M,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ne=M.getNodeFor(null==(t=te.current.over)?void 0:t.id),re=bw({measure:q.dragOverlay.measure}),ie=null!=(n=re.nodeRef.current)?n:K,oe=C?null!=(i=re.rect)?i:Q:null,se=Boolean(re.nodeRef.current&&re.rect),ae=vx(le=se?null:Q,cw(le));var le;const ue=gw(ie?I_(ie):null),ce=function(e){const t=p(e),n=U_(n=>e?n&&n!==fw&&e&&t.current&&e.parentNode===t.current.parentNode?n:Tx(e):fw,[e]);return h(()=>{t.current=e},[e]),n}(C?null!=ne?ne:K:null),de=function(e,t){void 0===t&&(t=Ex);const[n]=e,r=gw(n?I_(n):null),[i,o]=u(yw);function s(){o(()=>e.length?e.map(e=>Px(e)?r:new jx(t(e),e)):yw)}const a=dw({callback:s});return $_(()=>{null==a||a.disconnect(),s(),e.forEach(e=>null==a?void 0:a.observe(e))},[e]),i}(ce),he=function(e,t){let{transform:n,...r}=t;return null!=e&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}(v,{transform:{x:P.x-ae.x,y:P.y-ae.y,scaleX:1,scaleY:1},activatorEvent:$,active:z,activeNodeRect:Q,containerNodeRect:ee,draggingNodeRect:oe,over:te.current.over,overlayNodeRect:re.rect,scrollableAncestors:ce,scrollableAncestorRects:de,windowRect:ue}),pe=X?K_(X,P):null,fe=function(e){const[t,n]=u(null),r=p(e),i=m(e=>{const t=Ox(e.target);t&&n(e=>e?(e.set(t,Rx(t)),new Map(e)):null)},[]);return h(()=>{const t=r.current;if(e!==t){o(t);const s=e.map(e=>{const t=Ox(e);return t?(t.addEventListener("scroll",i,{passive:!0}),[t,Rx(t)]):null}).filter(e=>null!=e);n(s.length?new Map(s):null),r.current=e}return()=>{o(e),o(t)};function o(e){e.forEach(e=>{const t=Ox(e);null==t||t.removeEventListener("scroll",i)})}},[i,e]),f(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>K_(e,t),dx):Fx(e):dx,[e,t])}(ce),me=mw(fe),ge=mw(fe,[Q]),ye=K_(he,me),be=oe?xx(oe,he):null,ve=z&&be?g({active:z,collisionRect:be,droppableRects:G,droppableContainers:W,pointerCoordinates:pe}):null,_e=function(e,t){if(!e||0===e.length)return null;const[n]=e;return n[t]}(ve,"id"),[xe,we]=u(null),Ee=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(se?he:K_(he,ge),null!=(o=null==xe?void 0:xe.rect)?o:null,Q),Se=p(null),Te=m((e,t)=>{let{sensor:n,options:r}=t;if(null==F.current)return;const i=N.get(F.current);if(!i)return;const o=e.nativeEvent,s=new n({active:F.current,activeNode:i,event:o,options:r,context:te,onAbort(e){if(!N.get(e))return;const{onDragAbort:t}=V.current,n={id:e};null==t||t(n),T({type:"onDragAbort",event:n})},onPending(e,t,n,r){if(!N.get(e))return;const{onDragPending:i}=V.current,o={id:e,constraint:t,initialCoordinates:n,offset:r};null==i||i(o),T({type:"onDragPending",event:o})},onStart(e){const t=F.current;if(null==t)return;const n=N.get(t);if(!n)return;const{onDragStart:r}=V.current,i={activatorEvent:o,active:{id:t,data:n.data,rect:I}};E(()=>{null==r||r(i),A(Rw.Initializing),S({type:ux.DragStart,initialCoordinates:e,active:t}),T({type:"onDragStart",event:i}),j(Se.current),B(o)})},onMove(e){S({type:ux.DragMove,coordinates:e})},onEnd:a(ux.DragEnd),onCancel:a(ux.DragCancel)});function a(e){return async function(){const{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=te.current;let s=null;if(t&&i){const{cancelDrop:a}=V.current;if(s={activatorEvent:o,active:t,collisions:n,delta:i,over:r},e===ux.DragEnd&&"function"==typeof a){await Promise.resolve(a(s))&&(e=ux.DragCancel)}}F.current=null,E(()=>{S({type:e}),A(Rw.Uninitialized),we(null),j(null),B(null),Se.current=null;const t=e===ux.DragEnd?"onDragEnd":"onDragCancel";if(s){const e=V.current[t];null==e||e(s),T({type:t,event:s})}})}}Se.current=s},[N]),ke=m((e,t)=>(n,r)=>{const i=n.nativeEvent,o=N.get(r);if(null!==F.current||!o||i.dndKit||i.defaultPrevented)return;const s={active:o};!0===e(n,t.options,s)&&(i.dndKit={capturedBy:t.sensor},F.current=r,Te(n,t))},[N,Te]),Oe=function(e,t){return f(()=>e.reduce((e,n)=>{const{sensor:r}=n;return[...e,...r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}))]},[]),[e,t])}(d,ke);!function(e){h(()=>{if(!P_)return;const t=e.map(e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()});return()=>{for(const e of t)null==e||e()}},e.map(e=>{let{sensor:t}=e;return t}))}(d),$_(()=>{Q&&O===Rw.Initializing&&A(Rw.Initialized)},[Q,O]),h(()=>{const{onDragMove:e}=V.current,{active:t,activatorEvent:n,collisions:r,over:i}=te.current;if(!t||!n)return;const o={active:t,activatorEvent:n,collisions:r,delta:{x:ye.x,y:ye.y},over:i};E(()=>{null==e||e(o),T({type:"onDragMove",event:o})})},[ye.x,ye.y]),h(()=>{const{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=te.current;if(!e||null==F.current||!t||!i)return;const{onDragOver:o}=V.current,s=r.get(_e),a=s&&s.rect.current?{id:s.id,rect:s.rect.current,data:s.data,disabled:s.disabled}:null,l={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:a};E(()=>{we(a),null==o||o(l),T({type:"onDragOver",event:l})})},[_e]),$_(()=>{te.current={activatorEvent:$,active:z,activeNode:K,collisionRect:be,collisions:ve,droppableRects:G,draggableNodes:N,draggingNode:ie,draggingNodeRect:oe,droppableContainers:M,over:xe,scrollableAncestors:ce,scrollAdjustedTranslate:ye},I.current={initial:oe,translated:be}},[z,K,ve,be,N,ie,oe,G,M,xe,ce,ye]),ow({...Z,delta:P,draggingRect:be,pointerCoordinates:pe,scrollableAncestors:ce,scrollableAncestorRects:de});const Ae=f(()=>({active:z,activeNode:K,activeNodeRect:Q,activatorEvent:$,collisions:ve,containerNodeRect:ee,dragOverlay:re,draggableNodes:N,droppableContainers:M,droppableRects:G,over:xe,measureDroppableContainers:H,scrollableAncestors:ce,scrollableAncestorRects:de,measuringConfiguration:q,measuringScheduled:Y,windowRect:ue}),[z,K,Q,$,ve,ee,re,N,M,G,xe,H,ce,de,q,Y,ue]),Ce=f(()=>({activatorEvent:$,activators:Oe,active:z,activeNodeRect:Q,ariaDescribedById:{draggable:U},dispatch:S,draggableNodes:N,over:xe,measureDroppableContainers:H}),[$,Oe,z,Q,S,U,N,xe,H]);return r.createElement(ox.Provider,{value:k},r.createElement(Sw.Provider,{value:Ce},r.createElement(Tw.Provider,{value:Ae},r.createElement(Cw.Provider,{value:Ee},c)),r.createElement(Aw,{disabled:!1===(null==a?void 0:a.restoreFocus)})),r.createElement(lx,{...a,hiddenTextDescribedById:U}))}),Pw=g(null),Mw="button";function Dw(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const s=H_("Draggable"),{activators:a,activatorEvent:l,active:u,activeNodeRect:c,ariaDescribedById:d,draggableNodes:h,over:p}=o(Sw),{role:m=Mw,roleDescription:g="draggable",tabIndex:y=0}=null!=i?i:{},b=(null==u?void 0:u.id)===t,v=o(b?Cw:Pw),[_,x]=W_(),[w,E]=W_(),S=function(e,t){return f(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}(a,t),T=V_(n);$_(()=>(h.set(t,{id:t,key:s,node:_,activatorNode:w,data:T}),()=>{const e=h.get(t);e&&e.key===s&&h.delete(t)}),[h,t]);return{active:u,activatorEvent:l,activeNodeRect:c,attributes:f(()=>({role:m,tabIndex:y,"aria-disabled":r,"aria-pressed":!(!b||m!==Mw)||void 0,"aria-roledescription":g,"aria-describedby":d.draggable}),[r,m,y,b,g,d.draggable]),isDragging:b,listeners:r?void 0:S,node:_,over:p,setNodeRef:x,setActivatorNodeRef:E,transform:v}}const Iw={timeout:25};function zw(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Fw(e,t){return e.reduce((e,n,r)=>{const i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function Lw(e){return null!==e&&e>=0}const jw=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e;const o=zw(t,r,n),s=t[i],a=o[i];return a&&s?{x:a.left-s.left,y:a.top-s.top,scaleX:a.width/s.width,scaleY:a.height/s.height}:null},$w={scaleX:1,scaleY:1},Bw=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:i,rects:o,overIndex:s}=e;const a=null!=(t=o[n])?t:r;if(!a)return null;if(i===n){const e=o[s];return e?{x:0,y:n<s?e.top+e.height-(a.top+a.height):e.top-a.top,...$w}:null}const l=function(e,t,n){const r=e[t],i=e[t-1],o=e[t+1];if(!r)return 0;if(n<t)return i?r.top-(i.top+i.height):o?o.top-(r.top+r.height):0;return o?o.top-(r.top+r.height):i?r.top-(i.top+i.height):0}(o,i,n);return i>n&&i<=s?{x:0,y:-a.height-l,...$w}:i<n&&i>=s?{x:0,y:a.height+l,...$w}:{x:0,y:0,...$w}};const Vw="Sortable",Uw=r.createContext({activeIndex:-1,containerId:Vw,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:jw,disabled:{draggable:!1,droppable:!1}});function Ww(e){let{children:t,id:n,items:i,strategy:s=jw,disabled:a=!1}=e;const{active:l,dragOverlay:u,droppableRects:c,over:d,measureDroppableContainers:m}=o(Tw),g=H_(Vw,n),y=Boolean(null!==u.rect),b=f(()=>i.map(e=>"object"==typeof e&&"id"in e?e.id:e),[i]),v=null!=l,_=l?b.indexOf(l.id):-1,x=d?b.indexOf(d.id):-1,w=p(b),E=!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(b,w.current),S=-1!==x&&-1===_||E,T=function(e){return"boolean"==typeof e?{draggable:e,droppable:e}:e}(a);$_(()=>{E&&v&&m(b)},[E,b,v,m]),h(()=>{w.current=b},[b]);const k=f(()=>({activeIndex:_,containerId:g,disabled:T,disableTransforms:S,items:b,overIndex:x,useDragOverlay:y,sortedRects:Fw(b,c),strategy:s}),[_,g,T.draggable,T.droppable,S,b,x,c,y,s]);return r.createElement(Uw.Provider,{value:k},t)}const qw=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return zw(n,r,i).indexOf(t)},Gw=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:o,newIndex:s,previousItems:a,previousContainerId:l,transition:u}=e;return!(!u||!r)&&((a===o||i!==s)&&(!!n||s!==i&&t===l))},Hw={duration:200,easing:"ease"},Yw="transform",Kw=Q_.Transition.toString({property:Yw,duration:0,easing:"linear"}),Xw={roleDescription:"sortable"};function Zw(e){let{animateLayoutChanges:t=Gw,attributes:n,disabled:r,data:i,getNewIndex:s=qw,id:a,strategy:l,resizeObserverConfig:c,transition:d=Hw}=e;const{items:g,containerId:y,activeIndex:b,disabled:v,disableTransforms:_,sortedRects:x,overIndex:w,useDragOverlay:E,strategy:S}=o(Uw),T=function(e,t){var n,r;if("boolean"==typeof e)return{draggable:e,droppable:!1};return{draggable:null!=(n=null==e?void 0:e.draggable)?n:t.draggable,droppable:null!=(r=null==e?void 0:e.droppable)?r:t.droppable}}(r,v),k=g.indexOf(a),O=f(()=>({sortable:{containerId:y,index:k,items:g},...i}),[y,i,k,g]),A=f(()=>g.slice(g.indexOf(a)),[g,a]),{rect:C,node:R,isOver:N,setNodeRef:P}=function(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const s=H_("Droppable"),{active:a,dispatch:l,over:u,measureDroppableContainers:c}=o(Sw),d=p({disabled:n}),f=p(!1),g=p(null),y=p(null),{disabled:b,updateMeasurementsFor:v,timeout:_}={...Iw,...i},x=V_(null!=v?v:r),w=dw({callback:m(()=>{f.current?(null!=y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{c(Array.isArray(x.current)?x.current:[x.current]),y.current=null},_)):f.current=!0},[_]),disabled:b||!a}),E=m((e,t)=>{w&&(t&&(w.unobserve(t),f.current=!1),e&&w.observe(e))},[w]),[S,T]=W_(E),k=V_(t);return h(()=>{w&&S.current&&(w.disconnect(),f.current=!1,w.observe(S.current))},[S,w]),h(()=>(l({type:ux.RegisterDroppable,element:{id:r,key:s,disabled:n,node:S,rect:g,data:k}}),()=>l({type:ux.UnregisterDroppable,key:s,id:r})),[r]),h(()=>{n!==d.current.disabled&&(l({type:ux.SetDroppableDisabled,id:r,key:s,disabled:n}),d.current.disabled=n)},[r,s,n,l]),{active:a,rect:g,isOver:(null==u?void 0:u.id)===r,node:S,over:u,setNodeRef:T}}({id:a,data:O,disabled:T.droppable,resizeObserverConfig:{updateMeasurementsFor:A,...c}}),{active:M,activatorEvent:D,activeNodeRect:I,attributes:z,setNodeRef:F,listeners:L,isDragging:j,over:$,setActivatorNodeRef:B,transform:V}=Dw({id:a,data:O,attributes:{...Xw,...n},disabled:T.draggable}),U=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return f(()=>e=>{t.forEach(t=>t(e))},t)}(P,F),W=Boolean(M),q=W&&!_&&Lw(b)&&Lw(w),G=!E&&j,H=G&&q?V:null,Y=q?null!=H?H:(null!=l?l:S)({rects:x,activeNodeRect:I,activeIndex:b,overIndex:w,index:k}):null,K=Lw(b)&&Lw(w)?s({id:a,items:g,activeIndex:b,overIndex:w}):k,X=null==M?void 0:M.id,Z=p({activeId:X,items:g,newIndex:K,containerId:y}),J=g!==Z.current.items,Q=t({active:M,containerId:y,isDragging:j,isSorting:W,id:a,index:k,items:g,newIndex:Z.current.newIndex,previousItems:Z.current.items,previousContainerId:Z.current.containerId,transition:d,wasDragging:null!=Z.current.activeId}),ee=function(e){let{disabled:t,index:n,node:r,rect:i}=e;const[o,s]=u(null),a=p(n);return $_(()=>{if(!t&&n!==a.current&&r.current){const e=i.current;if(e){const t=Ex(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&s(n)}}n!==a.current&&(a.current=n)},[t,n,r,i]),h(()=>{o&&s(null)},[o]),o}({disabled:!Q,index:k,node:R,rect:C});return h(()=>{W&&Z.current.newIndex!==K&&(Z.current.newIndex=K),y!==Z.current.containerId&&(Z.current.containerId=y),g!==Z.current.items&&(Z.current.items=g)},[W,K,y,g]),h(()=>{if(X===Z.current.activeId)return;if(null!=X&&null==Z.current.activeId)return void(Z.current.activeId=X);const e=setTimeout(()=>{Z.current.activeId=X},50);return()=>clearTimeout(e)},[X]),{active:M,activeIndex:b,attributes:z,data:O,rect:C,index:k,newIndex:K,items:g,isOver:N,isSorting:W,isDragging:j,listeners:L,node:R,overIndex:w,over:$,setNodeRef:U,setActivatorNodeRef:B,setDroppableNodeRef:P,setDraggableNodeRef:F,transform:null!=ee?ee:Y,transition:function(){if(ee||J&&Z.current.newIndex===k)return Kw;if(G&&!Z_(D)||!d)return;if(W||Q)return Q_.Transition.toString({...d,property:Yw});return}()}}Ux.Down,Ux.Right,Ux.Up,Ux.Left;const Jw=({id:t,sx:n,children:r})=>{const{isDragging:i}=Dw({id:t}),{attributes:o,listeners:s,setNodeRef:a,transform:l,transition:u}=Zw({id:t,strategy:Bw,transition:{duration:300,easing:"cubic-bezier(0.25, 1, 0.5, 1)"}}),c={...n?.default,...i?n?.dragging:{},transform:Q_.Translate.toString(l),transition:u,cursor:"pointer"};return e(Jc,{ref:a,style:c,...s,...o,children:r})};function Qw({items:t,getItem:n,getId:r,onDragEnd:i,sx:o,title:s,draggableSx:a}){const l=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return f(()=>[...t].filter(e=>null!=e),[...t])}(f(()=>({sensor:u,options:null!=c?c:{}}),[u=Qx,c={activationConstraint:{distance:8}}]));var u,c;return e(Nw,{sensors:l,collisionDetection:gx,onDragEnd:e=>{const{active:n,over:o}=e,s=t.findIndex(e=>r(e)===n.id),a=t.findIndex(e=>r(e)===o?.id),l=zw(t,s,a);i(l)},children:e(Ww,{items:t.map(r),strategy:Bw,children:e(tf,{items:t,sx:o,title:s,getKey:r,getContent:(t,i)=>{const o=r(t);return e(Jw,{id:o,sx:a,children:n(t,i)},o)}})})})}const eE=g(null);function tE(){return function(){const e=b(eE);if(null==e)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of <MapContainer>");return e}().map}var nE={global:{links:{getIsConstruction:"function (feature) {\n const { construction } = feature;\n\n return construction;\n}\n",getIsFunctionalClass:"function (feature) {\n const { functional_class, access_id } = feature;\n\n return functional_class === 5 && access_id === 32;\n}\n",getIsLowMobility:"function (feature) {\n const { functional_class, low_mobility } = feature;\n\n return functional_class === 5 && low_mobility === 1;\n}\n"}},cameras:{camera1:{type:"perspective",vanishing_point:[0,-500]}},textures:{arrow:{url:"https://dalganmap.ru/api-image/images/arrow-20.png",sprites:{base:[0,0,20,20]}},"traffic-signal":{url:"https://dalganmap.ru/api-image/images/conditions/traffic-signal.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},pedestrian_crossing:{url:"https://dalganmap.ru/api-image/images/conditions/pedestrian_crossing.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},physical:{url:"https://dalganmap.ru/api-image/images/conditions/physical.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},gate:{url:"https://dalganmap.ru/api-image/images/conditions/gate.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_3578:{url:"https://dalganmap.ru/api-image/images/POI/3578.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5813:{url:"https://dalganmap.ru/api-image/images/POI/5813.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5541:{url:"https://dalganmap.ru/api-image/images/POI/5541.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5540:{url:"https://dalganmap.ru/api-image/images/POI/5540.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9530(Mail)":{url:"https://dalganmap.ru/api-image/images/POI/mail.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9530(Delivery)":{url:"https://dalganmap.ru/api-image/images/POI/delivery.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5400:{url:"https://dalganmap.ru/api-image/images/POI/5400.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_6000:{url:"https://dalganmap.ru/api-image/images/POI/6000.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_9565:{url:"https://dalganmap.ru/api-image/images/POI/9565.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_9583:{url:"https://dalganmap.ru/api-image/images/POI/9583.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_8060:{url:"https://dalganmap.ru/api-image/images/POI/8060.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5511:{url:"https://dalganmap.ru/api-image/images/POI/5511.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5512:{url:"https://dalganmap.ru/api-image/images/POI/5512.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5800:{url:"https://dalganmap.ru/api-image/images/POI/5800.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_5999:{url:"https://dalganmap.ru/api-image/images/POI/5999.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_7011:{url:"https://dalganmap.ru/api-image/images/POI/7011.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_7389:{url:"https://dalganmap.ru/api-image/images/POI/7389.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_7832:{url:"https://dalganmap.ru/api-image/images/POI/7832.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_7929:{url:"https://dalganmap.ru/api-image/images/POI/7929.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_7990:{url:"https://dalganmap.ru/api-image/images/POI/7990.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_7999:{url:"https://dalganmap.ru/api-image/images/POI/7999.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_8410:{url:"https://dalganmap.ru/api-image/images/POI/8410.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_9517:{url:"https://dalganmap.ru/api-image/images/POI/9517.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},POI_9718:{url:"https://dalganmap.ru/api-image/images/POI/9718.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9992(mosque)":{url:"https://dalganmap.ru/api-image/images/POI/9992_mosque.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9992(church)":{url:"https://dalganmap.ru/api-image/images/POI/9992_church.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9992(temple)":{url:"https://dalganmap.ru/api-image/images/POI/9992_temple.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9992(davidStar)":{url:"https://dalganmap.ru/api-image/images/POI/9992_davidStar.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_9992(mortar)":{url:"https://dalganmap.ru/api-image/images/POI/9992_mortar.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_4100(metro)":{url:"https://dalganmap.ru/api-image/images/POI/4100_metro.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"POI_4100(diameter)":{url:"https://dalganmap.ru/api-image/images/POI/4100_diameter.png",filtering:"mipmap",sprites:{base:[0,0,41,15]}},POI_4013:{url:"https://dalganmap.ru/api-image/images/POI/4013.png",filtering:"mipmap",sprites:{base:[0,0,20,20]}},"lane-marking":{url:"https://dalganmap.ru/api-image/images/msk/lane-marking.svg",filtering:"mipmap",sprites:{base:[0,0,11,35]}}},layers:null,styles:{buildings:{base:"polygons",shaders:{blocks:{color:"color.rgb;\n"}}}},lights:{light1:{type:"directional",direction:[.1,.5,-1],diffuse:.7,ambient:.5}},sources:null};function rE(e,t){return function(){return e.apply(t,arguments)}}const{toString:iE}=Object.prototype,{getPrototypeOf:oE}=Object,{iterator:sE,toStringTag:aE}=Symbol,lE=(uE=Object.create(null),e=>{const t=iE.call(e);return uE[t]||(uE[t]=t.slice(8,-1).toLowerCase())});var uE;const cE=e=>(e=e.toLowerCase(),t=>lE(t)===e),dE=e=>t=>typeof t===e,{isArray:hE}=Array,pE=dE("undefined");function fE(e){return null!==e&&!pE(e)&&null!==e.constructor&&!pE(e.constructor)&&yE(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const mE=cE("ArrayBuffer");const gE=dE("string"),yE=dE("function"),bE=dE("number"),vE=e=>null!==e&&"object"==typeof e,_E=e=>{if("object"!==lE(e))return!1;const t=oE(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||aE in e||sE in e)},xE=cE("Date"),wE=cE("File"),EE=cE("Blob"),SE=cE("FileList"),TE=cE("URLSearchParams"),[kE,OE,AE,CE]=["ReadableStream","Request","Response","Headers"].map(cE);function RE(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,i;if("object"!=typeof e&&(e=[e]),hE(e))for(r=0,i=e.length;r<i;r++)t.call(null,e[r],r,e);else{if(fE(e))return;const i=n?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let s;for(r=0;r<o;r++)s=i[r],t.call(null,e[s],s,e)}}function NE(e,t){if(fE(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,i=n.length;for(;i-- >0;)if(r=n[i],t===r.toLowerCase())return r;return null}const PE="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,ME=e=>!pE(e)&&e!==PE;const DE=(IE="undefined"!=typeof Uint8Array&&oE(Uint8Array),e=>IE&&e instanceof IE);var IE;const zE=cE("HTMLFormElement"),FE=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),LE=cE("RegExp"),jE=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};RE(n,(n,i)=>{let o;!1!==(o=t(n,i,e))&&(r[i]=o||n)}),Object.defineProperties(e,r)};const $E=cE("AsyncFunction"),BE=(VE="function"==typeof setImmediate,UE=yE(PE.postMessage),VE?setImmediate:UE?((e,t)=>(PE.addEventListener("message",({source:n,data:r})=>{n===PE&&r===e&&t.length&&t.shift()()},!1),n=>{t.push(n),PE.postMessage(e,"*")}))(`axios@${Math.random()}`,[]):e=>setTimeout(e));var VE,UE;const WE="undefined"!=typeof queueMicrotask?queueMicrotask.bind(PE):"undefined"!=typeof process&&process.nextTick||BE;var qE={isArray:hE,isArrayBuffer:mE,isBuffer:fE,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||yE(e.append)&&("formdata"===(t=lE(e))||"object"===t&&yE(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&mE(e.buffer),t},isString:gE,isNumber:bE,isBoolean:e=>!0===e||!1===e,isObject:vE,isPlainObject:_E,isEmptyObject:e=>{if(!vE(e)||fE(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:kE,isRequest:OE,isResponse:AE,isHeaders:CE,isUndefined:pE,isDate:xE,isFile:wE,isBlob:EE,isRegExp:LE,isFunction:yE,isStream:e=>vE(e)&&yE(e.pipe),isURLSearchParams:TE,isTypedArray:DE,isFileList:SE,forEach:RE,merge:function e(){const{caseless:t,skipUndefined:n}=ME(this)&&this||{},r={},i=(i,o)=>{const s=t&&NE(r,o)||o;_E(r[s])&&_E(i)?r[s]=e(r[s],i):_E(i)?r[s]=e({},i):hE(i)?r[s]=i.slice():n&&pE(i)||(r[s]=i)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&RE(arguments[e],i);return r},extend:(e,t,n,{allOwnKeys:r}={})=>(RE(t,(t,r)=>{n&&yE(t)?e[r]=rE(t,n):e[r]=t},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let i,o,s;const a={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)s=i[o],r&&!r(s,e,t)||a[s]||(t[s]=e[s],a[s]=!0);e=!1!==n&&oE(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:lE,kindOfTest:cE,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(hE(e))return e;let t=e.length;if(!bE(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[sE]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:zE,hasOwnProperty:FE,hasOwnProp:FE,reduceDescriptors:jE,freezeMethods:e=>{jE(e,(t,n)=>{if(yE(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];yE(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return hE(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:NE,global:PE,isContextDefined:ME,isSpecCompliantForm:function(e){return!!(e&&yE(e.append)&&"FormData"===e[aE]&&e[sE])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(vE(e)){if(t.indexOf(e)>=0)return;if(fE(e))return e;if(!("toJSON"in e)){t[r]=e;const i=hE(e)?[]:{};return RE(e,(e,t)=>{const o=n(e,r+1);!pE(o)&&(i[t]=o)}),t[r]=void 0,i}}return e};return n(e,0)},isAsyncFn:$E,isThenable:e=>e&&(vE(e)||yE(e))&&yE(e.then)&&yE(e.catch),setImmediate:BE,asap:WE,isIterable:e=>null!=e&&yE(e[sE])};function GE(e,t,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}qE.inherits(GE,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:qE.toJSONObject(this.config),code:this.code,status:this.status}}});const HE=GE.prototype,YE={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{YE[e]={value:e}}),Object.defineProperties(GE,YE),Object.defineProperty(HE,"isAxiosError",{value:!0}),GE.from=(e,t,n,r,i,o)=>{const s=Object.create(HE);qE.toFlatObject(e,s,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e);const a=e&&e.message?e.message:"Error",l=null==t&&e?e.code:t;return GE.call(s,a,l,n,r,i),e&&null==s.cause&&Object.defineProperty(s,"cause",{value:e,configurable:!0}),s.name=e&&e.name||"Error",o&&Object.assign(s,o),s};function KE(e){return qE.isPlainObject(e)||qE.isArray(e)}function XE(e){return qE.endsWith(e,"[]")?e.slice(0,-2):e}function ZE(e,t,n){return e?e.concat(t).map(function(e,t){return e=XE(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const JE=qE.toFlatObject(qE,{},null,function(e){return/^is[A-Z]/.test(e)});function QE(e,t,n){if(!qE.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=qE.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!qE.isUndefined(t[e])})).metaTokens,i=n.visitor||u,o=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&qE.isSpecCompliantForm(t);if(!qE.isFunction(i))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(qE.isDate(e))return e.toISOString();if(qE.isBoolean(e))return e.toString();if(!a&&qE.isBlob(e))throw new GE("Blob is not supported. Use a Buffer instead.");return qE.isArrayBuffer(e)||qE.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,n,i){let a=e;if(e&&!i&&"object"==typeof e)if(qE.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(qE.isArray(e)&&function(e){return qE.isArray(e)&&!e.some(KE)}(e)||(qE.isFileList(e)||qE.endsWith(n,"[]"))&&(a=qE.toArray(e)))return n=XE(n),a.forEach(function(e,r){!qE.isUndefined(e)&&null!==e&&t.append(!0===s?ZE([n],r,o):null===s?n:n+"[]",l(e))}),!1;return!!KE(e)||(t.append(ZE(i,n,o),l(e)),!1)}const c=[],d=Object.assign(JE,{defaultVisitor:u,convertValue:l,isVisitable:KE});if(!qE.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!qE.isUndefined(n)){if(-1!==c.indexOf(n))throw Error("Circular reference detected in "+r.join("."));c.push(n),qE.forEach(n,function(n,o){!0===(!(qE.isUndefined(n)||null===n)&&i.call(t,n,qE.isString(o)?o.trim():o,r,d))&&e(n,r?r.concat(o):[o])}),c.pop()}}(e),t}function eS(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function tS(e,t){this._pairs=[],e&&QE(e,this,t)}const nS=tS.prototype;function rS(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function iS(e,t,n){if(!t)return e;const r=n&&n.encode||rS;qE.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let o;if(o=i?i(t,n):qE.isURLSearchParams(t)?t.toString():new tS(t,n).toString(r),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}nS.append=function(e,t){this._pairs.push([e,t])},nS.toString=function(e){const t=e?function(t){return e.call(this,t,eS)}:eS;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class oS{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){qE.forEach(this.handlers,function(t){null!==t&&e(t)})}}var sS={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},aS={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:tS,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const lS="undefined"!=typeof window&&"undefined"!=typeof document,uS="object"==typeof navigator&&navigator||void 0,cS=lS&&(!uS||["ReactNative","NativeScript","NS"].indexOf(uS.product)<0),dS="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,hS=lS&&window.location.href||"http://localhost";var pS={...Object.freeze({__proto__:null,hasBrowserEnv:lS,hasStandardBrowserEnv:cS,hasStandardBrowserWebWorkerEnv:dS,navigator:uS,origin:hS}),...aS};function fS(e){function t(e,n,r,i){let o=e[i++];if("__proto__"===o)return!0;const s=Number.isFinite(+o),a=i>=e.length;if(o=!o&&qE.isArray(r)?r.length:o,a)return qE.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!s;r[o]&&qE.isObject(r[o])||(r[o]=[]);return t(e,n,r[o],i)&&qE.isArray(r[o])&&(r[o]=function(e){const t={},n=Object.keys(e);let r;const i=n.length;let o;for(r=0;r<i;r++)o=n[r],t[o]=e[o];return t}(r[o])),!s}if(qE.isFormData(e)&&qE.isFunction(e.entries)){const n={};return qE.forEachEntry(e,(e,r)=>{t(function(e){return qE.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const mS={transitional:sS,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,i=qE.isObject(e);i&&qE.isHTMLForm(e)&&(e=new FormData(e));if(qE.isFormData(e))return r?JSON.stringify(fS(e)):e;if(qE.isArrayBuffer(e)||qE.isBuffer(e)||qE.isStream(e)||qE.isFile(e)||qE.isBlob(e)||qE.isReadableStream(e))return e;if(qE.isArrayBufferView(e))return e.buffer;if(qE.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return QE(e,new pS.classes.URLSearchParams,{visitor:function(e,t,n,r){return pS.isNode&&qE.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=qE.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return QE(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||r?(t.setContentType("application/json",!1),function(e,t,n){if(qE.isString(e))try{return(t||JSON.parse)(e),qE.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||mS.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(qE.isResponse(e)||qE.isReadableStream(e))return e;if(e&&qE.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(e){if(n){if("SyntaxError"===e.name)throw GE.from(e,GE.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:pS.classes.FormData,Blob:pS.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};qE.forEach(["delete","get","head","post","put","patch"],e=>{mS.headers[e]={}});const gS=qE.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const yS=Symbol("internals");function bS(e){return e&&String(e).trim().toLowerCase()}function vS(e){return!1===e||null==e?e:qE.isArray(e)?e.map(vS):String(e)}function _S(e,t,n,r,i){return qE.isFunction(r)?r.call(this,t,n):(i&&(t=n),qE.isString(t)?qE.isString(r)?-1!==t.indexOf(r):qE.isRegExp(r)?r.test(t):void 0:void 0)}let xS=class{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function i(e,t,n){const i=bS(t);if(!i)throw new Error("header name must be a non-empty string");const o=qE.findKey(r,i);(!o||void 0===r[o]||!0===n||void 0===n&&!1!==r[o])&&(r[o||t]=vS(e))}const o=(e,t)=>qE.forEach(e,(e,n)=>i(e,n,t));if(qE.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(qE.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let n,r,i;return e&&e.split("\n").forEach(function(e){i=e.indexOf(":"),n=e.substring(0,i).trim().toLowerCase(),r=e.substring(i+1).trim(),!n||t[n]&&gS[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(qE.isObject(e)&&qE.isIterable(e)){let n,r,i={};for(const t of e){if(!qE.isArray(t))throw TypeError("Object iterator must return a key-value pair");i[r=t[0]]=(n=i[r])?qE.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}o(i,t)}else null!=e&&i(t,e,n);return this}get(e,t){if(e=bS(e)){const n=qE.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(qE.isFunction(t))return t.call(this,e,n);if(qE.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=bS(e)){const n=qE.findKey(this,e);return!(!n||void 0===this[n]||t&&!_S(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function i(e){if(e=bS(e)){const i=qE.findKey(n,e);!i||t&&!_S(0,n[i],i,t)||(delete n[i],r=!0)}}return qE.isArray(e)?e.forEach(i):i(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const i=t[n];e&&!_S(0,this[i],i,e,!0)||(delete this[i],r=!0)}return r}normalize(e){const t=this,n={};return qE.forEach(this,(r,i)=>{const o=qE.findKey(n,i);if(o)return t[o]=vS(r),void delete t[i];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(i):String(i).trim();s!==i&&delete t[i],t[s]=vS(r),n[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return qE.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&qE.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[yS]=this[yS]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=bS(e);t[r]||(!function(e,t){const n=qE.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,i){return this[r].call(this,t,e,n,i)},configurable:!0})})}(n,e),t[r]=!0)}return qE.isArray(e)?e.forEach(r):r(e),this}};function wS(e,t){const n=this||mS,r=t||n,i=xS.from(r.headers);let o=r.data;return qE.forEach(e,function(e){o=e.call(n,o,i.normalize(),t?t.status:void 0)}),i.normalize(),o}function ES(e){return!(!e||!e.__CANCEL__)}function SS(e,t,n){GE.call(this,null==e?"canceled":e,GE.ERR_CANCELED,t,n),this.name="CanceledError"}function TS(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new GE("Request failed with status code "+n.status,[GE.ERR_BAD_REQUEST,GE.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}xS.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),qE.reduceDescriptors(xS.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),qE.freezeMethods(xS),qE.inherits(SS,GE,{__CANCEL__:!0});const kS=(e,t,n=3)=>{let r=0;const i=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let i,o=0,s=0;return t=void 0!==t?t:1e3,function(a){const l=Date.now(),u=r[s];i||(i=l),n[o]=a,r[o]=l;let c=s,d=0;for(;c!==o;)d+=n[c++],c%=e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),l-i<t)return;const h=u&&l-u;return h?Math.round(1e3*d/h):void 0}}(50,250);return function(e,t){let n,r,i=0,o=1e3/t;const s=(t,o=Date.now())=>{i=o,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-i;a>=o?s(e,t):(n=e,r||(r=setTimeout(()=>{r=null,s(n)},o-a)))},()=>n&&s(n)]}(n=>{const o=n.loaded,s=n.lengthComputable?n.total:void 0,a=o-r,l=i(a);r=o;e({loaded:o,total:s,progress:s?o/s:void 0,bytes:a,rate:l||void 0,estimated:l&&s&&o<=s?(s-o)/l:void 0,event:n,lengthComputable:null!=s,[t?"download":"upload"]:!0})},n)},OS=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},AS=e=>(...t)=>qE.asap(()=>e(...t));var CS=pS.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,pS.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(pS.origin),pS.navigator&&/(msie|trident)/i.test(pS.navigator.userAgent)):()=>!0,RS=pS.hasStandardBrowserEnv?{write(e,t,n,r,i,o,s){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];qE.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),qE.isString(r)&&a.push(`path=${r}`),qE.isString(i)&&a.push(`domain=${i}`),!0===o&&a.push("secure"),qE.isString(s)&&a.push(`SameSite=${s}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function NS(e,t,n){let r=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const PS=e=>e instanceof xS?{...e}:e;function MS(e,t){t=t||{};const n={};function r(e,t,n,r){return qE.isPlainObject(e)&&qE.isPlainObject(t)?qE.merge.call({caseless:r},e,t):qE.isPlainObject(t)?qE.merge({},t):qE.isArray(t)?t.slice():t}function i(e,t,n,i){return qE.isUndefined(t)?qE.isUndefined(e)?void 0:r(void 0,e,0,i):r(e,t,0,i)}function o(e,t){if(!qE.isUndefined(t))return r(void 0,t)}function s(e,t){return qE.isUndefined(t)?qE.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,i,o){return o in t?r(n,i):o in e?r(void 0,n):void 0}const l={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(e,t,n)=>i(PS(e),PS(t),0,!0)};return qE.forEach(Object.keys({...e,...t}),function(r){const o=l[r]||i,s=o(e[r],t[r],r);qE.isUndefined(s)&&o!==a||(n[r]=s)}),n}var DS=e=>{const t=MS({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:o,headers:s,auth:a}=t;if(t.headers=s=xS.from(s),t.url=iS(NS(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),qE.isFormData(n))if(pS.hasStandardBrowserEnv||pS.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(qE.isFunction(n.getHeaders)){const e=n.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&s.set(e,n)})}if(pS.hasStandardBrowserEnv&&(r&&qE.isFunction(r)&&(r=r(t)),r||!1!==r&&CS(t.url))){const e=i&&o&&RS.read(o);e&&s.set(i,e)}return t};var IS="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=DS(e);let i=r.data;const o=xS.from(r.headers).normalize();let s,a,l,u,c,{responseType:d,onUploadProgress:h,onDownloadProgress:p}=r;function f(){u&&u(),c&&c(),r.cancelToken&&r.cancelToken.unsubscribe(s),r.signal&&r.signal.removeEventListener("abort",s)}let m=new XMLHttpRequest;function g(){if(!m)return;const r=xS.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());TS(function(e){t(e),f()},function(e){n(e),f()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(g)},m.onabort=function(){m&&(n(new GE("Request aborted",GE.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const r=new GE(t&&t.message?t.message:"Network Error",GE.ERR_NETWORK,e,m);r.event=t||null,n(r),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const i=r.transitional||sS;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new GE(t,i.clarifyTimeoutError?GE.ETIMEDOUT:GE.ECONNABORTED,e,m)),m=null},void 0===i&&o.setContentType(null),"setRequestHeader"in m&&qE.forEach(o.toJSON(),function(e,t){m.setRequestHeader(t,e)}),qE.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),p&&([l,c]=kS(p,!0),m.addEventListener("progress",l)),h&&m.upload&&([a,u]=kS(h),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(s=t=>{m&&(n(!t||t.type?new SS(null,e,m):t),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(s),r.signal&&(r.signal.aborted?s():r.signal.addEventListener("abort",s)));const y=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);y&&-1===pS.protocols.indexOf(y)?n(new GE("Unsupported protocol "+y+":",GE.ERR_BAD_REQUEST,e)):m.send(i||null)})};const zS=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const i=function(e){if(!n){n=!0,s();const t=e instanceof Error?e:this.reason;r.abort(t instanceof GE?t:new SS(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,i(new GE(`timeout ${t} of ms exceeded`,GE.ETIMEDOUT))},t);const s=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(i):e.removeEventListener("abort",i)}),e=null)};e.forEach(e=>e.addEventListener("abort",i));const{signal:a}=r;return a.unsubscribe=()=>qE.asap(s),a}},FS=function*(e,t){let n=e.byteLength;if(n<t)return void(yield e);let r,i=0;for(;i<n;)r=i+t,yield e.slice(i,r),i=r},LS=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},jS=(e,t,n,r)=>{const i=async function*(e,t){for await(const n of LS(e))yield*FS(n,t)}(e,t);let o,s=0,a=e=>{o||(o=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await i.next();if(t)return a(),void e.close();let o=r.byteLength;if(n){let e=s+=o;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),i.return())},{highWaterMark:2})},{isFunction:$S}=qE,BS=(({Request:e,Response:t})=>({Request:e,Response:t}))(qE.global),{ReadableStream:VS,TextEncoder:US}=qE.global,WS=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},qS=e=>{e=qE.merge.call({skipUndefined:!0},BS,e);const{fetch:t,Request:n,Response:r}=e,i=t?$S(t):"function"==typeof fetch,o=$S(n),s=$S(r);if(!i)return!1;const a=i&&$S(VS),l=i&&("function"==typeof US?(u=new US,e=>u.encode(e)):async e=>new Uint8Array(await new n(e).arrayBuffer()));var u;const c=o&&a&&WS(()=>{let e=!1;const t=new n(pS.origin,{body:new VS,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),d=s&&a&&WS(()=>qE.isReadableStream(new r("").body)),h={stream:d&&(e=>e.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!h[e]&&(h[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new GE(`Response type '${e}' is not supported`,GE.ERR_NOT_SUPPORT,n)})});const p=async(e,t)=>{const r=qE.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(qE.isBlob(e))return e.size;if(qE.isSpecCompliantForm(e)){const t=new n(pS.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return qE.isArrayBufferView(e)||qE.isArrayBuffer(e)?e.byteLength:(qE.isURLSearchParams(e)&&(e+=""),qE.isString(e)?(await l(e)).byteLength:void 0)})(t):r};return async e=>{let{url:i,method:s,data:a,signal:l,cancelToken:u,timeout:f,onDownloadProgress:m,onUploadProgress:g,responseType:y,headers:b,withCredentials:v="same-origin",fetchOptions:_}=DS(e),x=t||fetch;y=y?(y+"").toLowerCase():"text";let w=zS([l,u&&u.toAbortSignal()],f),E=null;const S=w&&w.unsubscribe&&(()=>{w.unsubscribe()});let T;try{if(g&&c&&"get"!==s&&"head"!==s&&0!==(T=await p(b,a))){let e,t=new n(i,{method:"POST",body:a,duplex:"half"});if(qE.isFormData(a)&&(e=t.headers.get("content-type"))&&b.setContentType(e),t.body){const[e,n]=OS(T,kS(AS(g)));a=jS(t.body,65536,e,n)}}qE.isString(v)||(v=v?"include":"omit");const t=o&&"credentials"in n.prototype,l={..._,signal:w,method:s.toUpperCase(),headers:b.normalize().toJSON(),body:a,duplex:"half",credentials:t?v:void 0};E=o&&new n(i,l);let u=await(o?x(E,_):x(i,l));const f=d&&("stream"===y||"response"===y);if(d&&(m||f&&S)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=u[t]});const t=qE.toFiniteNumber(u.headers.get("content-length")),[n,i]=m&&OS(t,kS(AS(m),!0))||[];u=new r(jS(u.body,65536,n,()=>{i&&i(),S&&S()}),e)}y=y||"text";let k=await h[qE.findKey(h,y)||"text"](u,e);return!f&&S&&S(),await new Promise((t,n)=>{TS(t,n,{data:k,headers:xS.from(u.headers),status:u.status,statusText:u.statusText,config:e,request:E})})}catch(t){if(S&&S(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new GE("Network Error",GE.ERR_NETWORK,e,E),{cause:t.cause||t});throw GE.from(t,t&&t.code,e,E)}}},GS=new Map,HS=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:i}=t,o=[r,i,n];let s,a,l=o.length,u=GS;for(;l--;)s=o[l],a=u.get(s),void 0===a&&u.set(s,a=l?new Map:qS(t)),u=a;return a};HS();const YS={http:null,xhr:IS,fetch:{get:HS}};qE.forEach(YS,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const KS=e=>`- ${e}`,XS=e=>qE.isFunction(e)||null===e||!1===e;var ZS={getAdapter:function(e,t){e=qE.isArray(e)?e:[e];const{length:n}=e;let r,i;const o={};for(let s=0;s<n;s++){let n;if(r=e[s],i=r,!XS(r)&&(i=YS[(n=String(r)).toLowerCase()],void 0===i))throw new GE(`Unknown adapter '${n}'`);if(i&&(qE.isFunction(i)||(i=i.get(t))))break;o[n||"#"+s]=i}if(!i){const e=Object.entries(o).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new GE("There is no suitable adapter to dispatch the request "+(n?e.length>1?"since :\n"+e.map(KS).join("\n"):" "+KS(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return i},adapters:YS};function JS(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new SS(null,e)}function QS(e){JS(e),e.headers=xS.from(e.headers),e.data=wS.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return ZS.getAdapter(e.adapter||mS.adapter,e)(e).then(function(t){return JS(e),t.data=wS.call(e,e.transformResponse,t),t.headers=xS.from(t.headers),t},function(t){return ES(t)||(JS(e),t&&t.response&&(t.response.data=wS.call(e,e.transformResponse,t.response),t.response.headers=xS.from(t.response.headers))),Promise.reject(t)})}const eT="1.13.2",tT={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{tT[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const nT={};tT.transitional=function(e,t,n){function r(e,t){return"[Axios v"+eT+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,i,o)=>{if(!1===e)throw new GE(r(i," has been removed"+(t?" in "+t:"")),GE.ERR_DEPRECATED);return t&&!nT[i]&&(nT[i]=!0,console.warn(r(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,i,o)}},tT.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};var rT={assertOptions:function(e,t,n){if("object"!=typeof e)throw new GE("options must be an object",GE.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let i=r.length;for(;i-- >0;){const o=r[i],s=t[o];if(s){const t=e[o],n=void 0===t||s(t,o,e);if(!0!==n)throw new GE("option "+o+" must be "+n,GE.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new GE("Unknown option "+o,GE.ERR_BAD_OPTION)}},validators:tT};const iT=rT.validators;let oT=class{constructor(e){this.defaults=e||{},this.interceptors={request:new oS,response:new oS}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=MS(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:i}=t;void 0!==n&&rT.assertOptions(n,{silentJSONParsing:iT.transitional(iT.boolean),forcedJSONParsing:iT.transitional(iT.boolean),clarifyTimeoutError:iT.transitional(iT.boolean)},!1),null!=r&&(qE.isFunction(r)?t.paramsSerializer={serialize:r}:rT.assertOptions(r,{encode:iT.function,serialize:iT.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),rT.assertOptions(t,{baseUrl:iT.spelling("baseURL"),withXsrfToken:iT.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=i&&qE.merge(i.common,i[t.method]);i&&qE.forEach(["delete","get","head","post","put","patch","common"],e=>{delete i[e]}),t.headers=xS.concat(o,i);const s=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,s.unshift(e.fulfilled,e.rejected))});const l=[];let u;this.interceptors.response.forEach(function(e){l.push(e.fulfilled,e.rejected)});let c,d=0;if(!a){const e=[QS.bind(this),void 0];for(e.unshift(...s),e.push(...l),c=e.length,u=Promise.resolve(t);d<c;)u=u.then(e[d++],e[d++]);return u}c=s.length;let h=t;for(;d<c;){const e=s[d++],t=s[d++];try{h=e(h)}catch(e){t.call(this,e);break}}try{u=QS.call(this,h)}catch(e){return Promise.reject(e)}for(d=0,c=l.length;d<c;)u=u.then(l[d++],l[d++]);return u}getUri(e){return iS(NS((e=MS(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};qE.forEach(["delete","get","head","options"],function(e){oT.prototype[e]=function(t,n){return this.request(MS(n||{},{method:e,url:t,data:(n||{}).data}))}}),qE.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,i){return this.request(MS(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}oT.prototype[e]=t(),oT.prototype[e+"Form"]=t(!0)});const sT={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(sT).forEach(([e,t])=>{sT[t]=e});const aT=function e(t){const n=new oT(t),r=rE(oT.prototype.request,n);return qE.extend(r,oT.prototype,n,{allOwnKeys:!0}),qE.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(MS(t,n))},r}(mS);aT.Axios=oT,aT.CanceledError=SS,aT.CancelToken=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,i){n.reason||(n.reason=new SS(e,r,i),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;const n=new e(function(e){t=e});return{token:n,cancel:t}}},aT.isCancel=ES,aT.VERSION=eT,aT.toFormData=QE,aT.AxiosError=GE,aT.Cancel=aT.CanceledError,aT.all=function(e){return Promise.all(e)},aT.spread=function(e){return function(t){return e.apply(null,t)}},aT.isAxiosError=function(e){return qE.isObject(e)&&!0===e.isAxiosError},aT.mergeConfig=MS,aT.AxiosHeaders=xS,aT.formToJSON=e=>fS(qE.isHTMLForm(e)?new FormData(e):e),aT.getAdapter=ZS.getAdapter,aT.HttpStatusCode=sT,aT.default=aT;const{Axios:lT,AxiosError:uT,CanceledError:cT,isCancel:dT,CancelToken:hT,VERSION:pT,all:fT,Cancel:mT,isAxiosError:gT,spread:yT,toFormData:bT,AxiosHeaders:vT,HttpStatusCode:_T,formToJSON:xT,getAdapter:wT,mergeConfig:ET}=aT;class ST{constructor(){var e,t,n;e=this,"production"!==process.env.NODE_ENV&&(Rf(e)||Rf(Object.getPrototypeOf(e))||df("'makeAutoObservable' can only be used for classes that don't have a superclass"),ob(e)&&df("makeAutoObservable can only be used on objects not already made observable")),Rf(e)?cy(e,e,t,n):wb(function(){var r=nb(e,n)[rm];if(!e[Ry]){var i=Object.getPrototypeOf(e),o=new Set([].concat(Lf(e),Lf(i)));o.delete("constructor"),o.delete(rm),Pf(i,Ry,o)}e[Ry].forEach(function(e){return r.make_(e,!t||!(e in t)||t[e])})})}_isUnauthorized=!1;get isUnauthorized(){return this._isUnauthorized}set isUnauthorized(e){this._isUnauthorized=e}}var TT=Zb(({onUnauthorized:t,children:r})=>{const{authStore:i}=CT();return n.useEffect(()=>{i.isUnauthorized&&t()},[i.isUnauthorized]),e(n.Fragment,{children:r})});const kT=new class{authStore=new ST},OT=n.createContext(kT),AT=({children:t})=>e(OT.Provider,{value:kT,children:t}),CT=()=>{const e=n.useContext(OT);if(null===e)throw new Error("You have forgotten to wrap your root component with RootStoreProvider");return e};class RT{client;constructor(e){this.client=aT.create({baseURL:e,timeout:1e4,headers:{"Content-Type":"application/json"}}),this.setupInterceptors()}setupInterceptors(){this.client.interceptors.request.use(e=>(kT.authStore.isUnauthorized=!1,e),e=>Promise.reject(e)),this.client.interceptors.response.use(e=>e,e=>(401===e.status&&(kT.authStore.isUnauthorized=!0),Promise.reject(e)))}async get({url:e,config:t}){return(await this.client.get(e,t)).data}async post({url:e,body:t,config:n}){return(await this.client.post(e,t,n)).data}async put({url:e,body:t,config:n}){return(await this.client.put(e,t,n)).data}async delete({url:e,config:t}){return(await this.client.delete(e,t)).data}}const NT=e=>new RT(e);class PT{_apiService;get apiService(){return this._apiService}static _instance=null;static get instance(){if(!PT._instance)throw new Error("Dartcom Config не инициализирован с приватным ключом. Вызовите Config.initialize(...) первым, чтобы иметь возможность пользоваться компонентами нашей библиотеки");return PT._instance}static initialize(e){PT._instance||(PT._instance=new PT(e))}static deactivate(){this._instance=null}constructor({apiKey:e,backendUrl:t,onCheck:n}){this._apiKey=e,this._apiService=NT(t),this._getCheckKeyData().then(e=>{if(e){const{valid:t}=e;n?.(e),this.isValidApiKey=t}})}_apiKey="";_isValidApiKey=!1;get isValidApiKey(){return this._isValidApiKey}set isValidApiKey(e){this._isValidApiKey=e}async _getCheckKeyData(){const e=await this._apiService.get({url:"check_tile_token",config:{params:{tile_token:this._apiKey}}}).then(e=>e).catch(({response:e})=>{if(e){const{data:{detail:t}}=e;return t}});return e}}const MT={valid:"18c38ab326d12f428e90be50a5141fc8949de497df7f7e0c1796d58e99d006f3",dateExpired:"8cbc5e15e61e649daf57c3a08422ae372c101afb4759036a3864a9fa588ef717",off:"b1520018920b33a4c1f8100c4f3bb3eb93661db829faa99c9cd75537f6300ba9",invalid:"abcdefghijklmnopqrstuvwxyz0123456789"};var DT,IT;var zT,FT,LT=(IT||(IT=1,DT=function(){const e=["a","b","c","d","e","f","0","1","2","3","4","5","6","7","8","9"];let t=[];for(let n=0;n<36;n++)t[n]=8===n||13===n||18===n||23===n?"-":e[Math.ceil(Math.random()*e.length-1)];return t.join("")}),DT),jT=dt(LT);!function(e){e.GET="GET",e.DELETE="DELETE",e.PUT="PUT",e.POST="POST"}(zT||(zT={})),function(e){e.TOP_RIGHT="top-right",e.BOTTOM_RIGHT="bottom-right",e.BOTTOM_LEFT="bottom-left",e.TOP_LEFT="top-left"}(FT||(FT={}));const $T="https://dalganmap.ru/api";var BT;!function(e){e.TILE="tile",e.NATURE_TILE="nature_tile",e.MSK="msk"}(BT||(BT={}));const VT=256,UT={[BT.TILE]:`${$T}/tiles/get_tile/{z}/{x}/{y}.mvt`,[BT.NATURE_TILE]:`${$T}/tiles/get_nature_tile/{z}/{x}/{y}.mvt`,[BT.MSK]:"http://89.108.118.23:3070/tiles/get_tile/{z}/{x}/{y}.mvt"},WT=e=>{const t=[],n={source:e,layer:'"RoadPoly"'},r={id:jT(),data:n,filter:"function() {\n const { type } = feature;\n\n const isFilter = type === 'Road';\n\n return isFilter;\n }",draw:{polygons:{color:"#BABCC2"}}},i={id:jT(),data:n,filter:"function() {\n const { type } = feature;\n\n const isFilter = type === 'Tram';\n\n return isFilter;\n }",draw:{polygons:{color:"#ADA8A8"}}},o={id:jT(),data:n,filter:"function() {\n const { type } = feature;\n\n const isFilter = type === 'Curb';\n\n return isFilter;\n }",draw:{polygons:{color:"#D2D9E6"}}},s={id:jT(),data:n,filter:"function() {\n const { type } = feature;\n\n const isFilter = type === 'Bridge';\n\n return isFilter;\n }",draw:{polygons:{color:"#E1DFDD"}}};return t.push(r,i,o,s),t},qT=e=>{const t=[],n={source:e,layer:'"LaneMarkingPoly"'},r={id:jT(),data:n,filter:"function() {\n const { poly_number } = feature;\n\n const isFilter = poly_number === '1.14.1';\n\n return isFilter;\n }",draw:{styles:{zebra_crossing:{attributes:{a_angle:"function() {\n return feature.angle;\n }"}}}}},i={id:jT(),data:n,filter:"function() {\n const { poly_number } = feature;\n\n const isFilter = poly_number === '1.18';\n\n return isFilter;\n }",draw:{polygons:{color:"white"}}};return t.push(i,r),t},GT=e=>{const t=[],n={source:e,layer:'"LaneMarkingLine"'},r="white",i=.5,o={id:jT(),data:n,sublayers:{1.1:{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.1';\n\n return isFilter;\n }",draw:{lines:{color:r,width:i}}},1.5:{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.5';\n\n return isFilter;\n }",draw:{lines:{color:r,width:i,dash:[4,10]}}},1.6:{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.6';\n\n return isFilter;\n }",draw:{lines:{color:r,width:i,dash:[5,5]}}},"1.16.1":{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.16.1';\n\n return isFilter;\n }",draw:{lines:{color:r,width:i}}},1.7:{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.7';\n\n return isFilter;\n }",draw:{lines:{color:r,width:i,dash:[4,10]}}},"1.7-blue":{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.7blue';\n\n return isFilter;\n }",draw:{lines:{color:"blue",width:i,dash:[4,10]}}},"1.14.3":{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.14.3';\n\n return isFilter;\n }",draw:{lines:{color:r,width:i,dash:[3,8]}}},1.12:{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.12';\n\n return isFilter;\n }",draw:{lines:{color:r,width:1.5}}},"1.17.1":{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.17.1';\n\n return isFilter;\n }",draw:{lines:{color:"yellow",width:i}}},1.26:{filter:"function () {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.26';\n\n return isFilter;\n }",draw:{lines:{color:"yellow",width:i}}}}},s={"1.3-left":{id:jT(),data:n,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.3';\n\n return isFilter;\n }",draw:{lines:{color:r,width:i,offset:-.5}}},"1.3-right":{id:jT(),data:n,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.3';\n\n return isFilter;\n }",draw:{lines:{color:r,width:i,offset:i}}},"1.11r-left":{id:jT(),data:n,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.11r';\n\n return isFilter;\n }",draw:{lines:{color:r,width:i,offset:-.5}}},"1.11r-right":{id:jT(),data:n,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.11r';\n\n return isFilter;\n }",draw:{lines:{color:r,width:i,offset:i,dash:[5,5]}}},"1.11l-left":{id:jT(),data:n,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.11l';\n\n return isFilter;\n }",draw:{lines:{color:r,width:i,offset:-.5,dash:[5,5]}}},"1.11l-right":{id:jT(),data:n,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.11l';\n\n return isFilter;\n }",draw:{lines:{color:r,width:i,offset:i}}},"1.25-left":{id:jT(),data:n,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.25';\n\n return isFilter;\n }",draw:{lines:{color:r,width:1,offset:-.5,dash:[1,1],dash_background_color:[0,0,0,0]}}},"1.25-right":{id:jT(),data:n,filter:"function() {\n const { lane_number } = feature;\n\n const isFilter = lane_number === '1.25';\n\n return isFilter;\n }",draw:{lines:{color:"rgba(0,0,0,0)",width:1,offset:.5,dash:[1,1],dash_background_color:[1,1,1]}}}};return t.push(o,...Object.values(s)),t},HT=e=>{const t=[],n={source:e,layer:'"ParkingLine"'},r={id:jT(),data:n,draw:{lines:{color:"white",width:1}}};return t.push(r),t},YT=e=>{const t=[],n={source:e,layer:'"MapAdminBuiltupArea"'},r={id:jT(),data:n,draw:{polygons:{color:"#CFC8C8"}}};return t.push(r),t},KT=e=>[{id:jT(),data:{source:e,layer:'"PointAddress"',minzoom:15},draw:{text:{interactive:!0,text_source:"address",font:{fill:"black",size:"12px"}}}}],XT='function() {\n const { poi_name, cat_id } = feature;\n\n switch (+cat_id) {\n case 4100: {\n const text = poi_name.replaceAll(/(Метро-|Станция-|МЦД-)/g, "");\n\n return text;\n }\n\n default: {\n return poi_name;\n }\n }\n}',ZT=[3578,4013,4100,5400,5511,5512,5540,5541,5800,5813,5999,6e3,7011,7389,7832,7929,7990,8060,8410,9517,9530,9565,9583,9718,9992],JT=e=>{const t={};switch(e){case 4100:t[`_${e}-metro`]={filter:`function() {\n const { poi_name, cat_id } = feature;\n\n const isMetro = poi_name.startsWith('Метро-');\n const isStation = poi_name.startsWith('Станция-');\n\n const isCatId = +cat_id === ${e};\n\n const isFilter = isCatId && (isMetro || isStation);\n\n return isFilter;\n }`,draw:{points:QT({texture:`POI_${e}(metro)`})}},t[`_${e}-diameter`]={filter:`function() {\n const { cat_id, poi_name } = feature;\n\n const isDiameter = poi_name.startsWith('МЦД-');\n\n const isCatId = +cat_id === ${e};\n\n const isFilter = isCatId && isDiameter;\n\n return isFilter;\n }`,draw:{points:QT({texture:`POI_${e}(diameter)`,size:[41,15]})}};break;case 9530:t[`_${e}-mail`]={filter:`function() {\n const { cat_id, poi_name = '' } = feature;\n\n const isCatId = +cat_id === ${e};\n\n const isMail = poi_name.startsWith('Почта');\n\n const isFilter = isCatId && isMail;\n\n return isFilter;\n }`,draw:{points:QT({texture:`POI_${e}(Mail)`})}},t[`_${e}-delivery`]={filter:`function() {\n const { cat_id, poi_name = '' } = feature;\n\n const isCatId = +cat_id === ${e};\n \n const isMail = poi_name.startsWith('Почта');\n\n const isFilter = isCatId && !isMail;\n\n return isFilter;\n }`,draw:{points:QT({texture:`POI_${e}(Delivery)`})}};break;case 9992:{const n={mosque:1,church:2,temple:3,davidStar:4,mortar:6};Object.entries(n).forEach(([n,r])=>{t[`_${e}-${n}`]={filter:`function() {\n const { cat_id, subcat_id } = feature;\n\n const isCatId = +cat_id === ${e};\n const isSubcatId = +subcat_id === ${r};\n\n const isFilter = isCatId && isSubcatId;\n\n return isFilter;\n }`,draw:{points:QT({texture:`POI_${e}(${n})`})}}});break}default:t[`_${e}`]={filter:`function {\n const { cat_id } = feature;\n\n const isFilter = +cat_id === ${e};\n\n return isFilter;\n }`,draw:{points:QT({texture:`POI_${e}`})}}}return t},QT=({texture:e,size:t="20px"})=>({texture:e,size:t,sprite:"base",placement:"midpoint"}),ek=ZT.reduce((e,t)=>({...e,...JT(t)}),{}),tk=e=>{const t=[],n={id:jT(),data:{source:e,layer:'"POI"'},draw:{points:{text:{text_source:XT,font:{fill:"#464544",size:"12px"}}}},sublayers:ek};return t.push(n),t},nk=e=>[{id:jT(),data:{source:e,layer:'"CityPOI"'},filter:"function () {\n const { capital_order8, capital_order2, capital_order1, poi_name, priority } = feature;\n\n if ($zoom >= 9 && $zoom < 13) {\n return priority < 8;\n }\n\n if ($zoom <= 11) {\n return capital_order8 === 'Y';\n }\n\n if ($zoom >= 15) {\n return capital_order2 !== 'Y';\n }\n\n return true;\n }\n ",draw:{text:{text_source:"poi_name",priority:"function () {\n const { priority } = feature;\n\n if ($zoom <= 15) {\n return priority;\n }\n\n return 1;\n }\n ",font:{fill:"black",size:"function() {\n const { capital_order8 } = feature;\n\n if (capital_order8 === 'Y') {\n return '16px';\n }\n\n return '12px';\n }",weight:"function() {\n const { capital_order2 } = feature;\n\n if (capital_order2 === 'Y') {\n return 'bold';\n }\n\n return 'normal';\n }",stroke:{color:"white",width:"2px"}}}}}],rk=e=>[{id:jT(),data:{source:e,layer:'"OneWay"'},draw:{points:{texture:"arrow",sprite:"base",angle:"function() {\n const { bearing } = feature;\n \n return bearing;\n }\n "}}}];var ik;!function(e){e.traffic_signal="traffic_signal",e.pedestrian_crossing="pedestrian_crossing",e.physical="physical",e.gate="gate"}(ik||(ik={}));const ok=e=>{const t={},n={id:jT(),data:{source:e,layer:'"Conditions"'}};return Object.values(ik).forEach(e=>{t[`_${e}`]={filter:`function() {\n const { type } = feature;\n\n const isShow = type === '${e}';\n\n return isShow;\n }`,draw:{points:{texture:e,sprite:"base",placement:"midpoint"}}}}),n.sublayers=t,[n]},sk=e=>{const t=[],n={source:e,layer:'"MapRailroadLink"'},r={id:jT(),data:n,draw:{lines:{color:"#A3A8A",width:5,dash:[1,2],dash_background_color:[0,0,0],join:"round"}}};return t.push(r),t},ak=e=>{const t=[],n={id:jT(),data:{source:e,layer:'"MapWaterArea"'},draw:{polygons:{color:"#7DBEE4"},lines:{color:"#7DBEE4",width:20,cap:"round",join:"round"}}},r={id:jT(),data:{source:e,layer:'"MapWaterAreaLabel"'},filter:"function() {\n const { display_class } = feature;\n\n if ($zoom >= 14) {\n return true;\n } else {\n return display_class <= 4;\n }\n }",draw:{text:{text_source:"name",font:{fill:"#0A80C4",size:"14px",stroke:{color:"white",width:"3px"}}}}},i={id:jT(),data:{source:e,layer:'"MapWaterLakeLabel"'},filter:"function() {\n const { display_class } = feature;\n\n if ($zoom >= 14) {\n return true;\n } else {\n return display_class <= 4;\n }\n }",draw:{text:{text_source:"name",font:{fill:"#0A80C4",size:"14px",stroke:{color:"white",width:"3px"}}}}};return t.push(n,r,i),t},lk=e=>{const t=[],n={},r={source:e,layer:'"MapWaterLink"'},i={id:jT(),data:r};return n.geometry={draw:{lines:{color:"#7DBEE4",width:5,cap:"round",join:"round"}}},n.text={filter:"function() {\n return $zoom >= 10;\n }",draw:{text:{text_source:"name",font:{fill:"#0A80C4",size:"14px",stroke:{color:"white",width:"3px"}}}}},i.sublayers=n,t.push(i),t},uk=e=>{const t=[],n={id:jT(),data:{source:e,layer:'"MapOceanArea"'},draw:{polygons:{color:"#7DBEE4"}}},r={id:jT(),data:{source:e,layer:'"MapOceanAreaLabel"'},draw:{text:{text_source:"name",font:{fill:"#0A80C4",size:"18px",stroke:{color:"white",width:"3px"}}}}};return t.push(n,r),t},ck=e=>{const t=[],n={id:jT(),data:{source:e,layer:'"MapLanduseArea"'},draw:{polygons:{interactive:!0,color:"function() {\n const { feature_type } = feature;\n\n switch (feature_type) {\n case '509998': {\n return '#ECD175';\n }\n\n case '600102':\n case '900140': {\n return '#3E9A8C';\n }\n\n case '900202':\n case '900130':\n case '900150':\n case '900103': {\n return '#96BE7D';\n }\n\n case '9997010': {\n return null;\n }\n }\n }",order:"function() {\n const { feature_type } = feature;\n\n switch(feature_type) {\n case '900150':\n case '900130':\n case '509998': {\n return 300;\n }\n\n default: {\n return 299;\n }\n }\n }"}}},r={id:jT(),data:{source:e,layer:'"MapLanduseAreaLabel"'},filter:"function() {\n return $zoom >= 15;\n }",draw:{text:{text_source:"name",font:{size:"13px",fill:"function() {\n const { feature_type } = feature;\n\n switch(feature_type) {\n case '509998': {\n return '#CD7F32';\n }\n\n default: {\n return '#00541F';\n }\n }\n }",stroke:{color:"white",width:"3px"}}}}};return t.push(n,r),t},dk=e=>{const t=[],n={source:e,layer:'"MapBuildingECArea"',minzoom:15},r={id:jT(),data:n,extruded:{draw:{polygons:{interactive:!0,style:"buildings",extrude:"function() {\n return $zoom >= 17;\n }"}}},draw:{polygons:{color:"#DDB07B",height:{property:"height"}},lines:{color:"#DB933F",width:"2px",cap:"round",join:"round"}}};return t.push(r),t},hk=e=>{const t=[],n={id:jT(),data:{source:e,layer:'"MapFacilityArea"'},draw:{polygons:{color:"function() {\n const { feature_type } = feature;\n\n switch (feature_type) {\n case '2000408': {\n return '#DBBAC4';\n }\n\n case '1900403': {\n return '#B6C3C7';\n }\n\n case '1907403': {\n return '#A3B9C0';\n }\n\n case '2000123': {\n return '#E4BA7D';\n }\n\n case '2000124': {\n return '#BFE6E3';\n }\n\n case '2000200': {\n return '#A0A9A8';\n }\n\n case '2000403': {\n return '#AF7136';\n }\n\n case '2000420': {\n return '#89AC76';\n }\n\n case '2000457': {\n return '#9494C0';\n }\n\n default: {\n return '#E1D4D4';\n }\n }\n }",order:"function() {\n const { feature_type } = feature;\n\n switch (feature_type) {\n case '1907403': {\n return 301;\n }\n\n default: {\n return 300;\n }\n }\n }"},lines:{color:"#857F7F",width:"2px",cap:"round",join:"round"}}},r={id:jT(),data:{source:e,layer:'"MapFacilityAreaLabel"'},draw:{text:{text_source:"name",font:{fill:"function() {\n const { feature_type } = feature;\n\n switch(feature_type) {\n case '1900403':\n case '1907403': {\n return '#256D7B';\n }\n\n case '2000420':\n case '2000460':\n case '2000123': {\n return '#00541F';\n }\n\n case '2000408': {\n return '#5E2129';\n }\n\n case '2000124': {\n return '#3E5F8A';\n }\n\n case '2000200': {\n return '#464451';\n }\n\n case '2000403': {\n return '#B03F35';\n }\n\n case '2000457': {\n return '#6A5ACD';\n }\n\n case '1700215':\n case '900159':\n case '900158': {\n return '#474A51';\n }\n\n default: {\n return black;\n }\n }\n }",size:"12px",stroke:{color:"white",width:"3px"}}}}};return t.push(n,r),t},pk=e=>{const t=[],n={source:e,layer:'"MapAdminArea"'},r={id:jT(),data:n,draw:{polygons:{color:"#D3D2CF"}}},i={id:jT(),data:n,filter:"function() {\n const { type } = feature;\n\n const isFilter = type === 'R';\n\n return isFilter;\n }",draw:{lines:{color:"#696969",width:"1px",cap:"round",join:"round"}}},o={id:jT(),data:n,filter:"function() {\n const { type } = feature;\n\n const isFilter = type === 'D' && $zoom >= 12;\n\n return isFilter;\n }",draw:{lines:{color:"#696969",dash:[4,7],width:"1px",cap:"round",join:"round"}}};return t.push(r,i,o),t},fk=()=>{const e=[],t={source:BT.NATURE_TILE,layer:'"MapNatureField"'},n={id:jT(),data:t,draw:{polygons:{interactive:!0,color:"#EBEEC7"}}};return e.push(n),e},mk=["-1.0","-0.5","-0.3","0.0","0.3","0.5","0.7","1.0","1.5","2.0"],gk=[[1,2],[3,4],[5]],yk="function() {\n const { functional_class, tunnel, tollway } = feature;\n\n const alpha = tunnel ? 0.89 : 1;\n\n const getRGB = (hex, alpha) => {\n const r = +(parseInt(hex.slice(1, 3), 16) / 255).toFixed(2);\n const g = +(parseInt(hex.slice(3, 5), 16) / 255).toFixed(2);\n const b = +(parseInt(hex.slice(5, 7), 16) / 255).toFixed(2);\n\n return [r, g, b, alpha];\n }\n\n if (tollway) {\n return '#D72740';\n }\n\n switch (functional_class) {\n case 1:\n case 2: {\n const color = getRGB('#D1747F', alpha);\n\n return color;\n }\n\n case 3:\n case 4: {\n const color = getRGB('#B1A7AA', alpha);\n\n return color;\n }\n\n case 5: {\n const color = getRGB('#D5CEC3', alpha);\n\n return color;\n }\n }\n}",bk="function() {\n const { functional_class, road_number } = feature;\n\n const getScale = () => {\n if ($zoom <= 15 && $zoom >= 14) { return 7; }\n\n if ($zoom <= 13 && $zoom >= 12) { return 9; }\n\n if ($zoom <= 5) { return 400; }\n\n if ($zoom <= 7) { return 200; }\n\n if ($zoom < 12) { return 50; }\n\n return 1;\n }\n\n const scale = getScale();\n\n switch(functional_class) {\n case 1:\n case 2: {\n return 8 * scale;\n }\n\n case 3:\n case 4: {\n return 7 * scale;\n }\n\n case 5: {\n if (Boolean(road_number)) {\n return 7 * scale;\n }\n\n return 6;\n }\n }\n}",vk=e=>{const t=[],n={source:e,layer:'"Link"'},r={id:jT(),data:n,draw:{text:{text_source:"road_number",font:{fill:"#181bff",size:"16px",weight:"bold",underline:!0,background:{color:"black"}}}}};t.push(r);const i={text_source:"street_name",font:{fill:"black",size:"14px",stroke:{color:"white",width:"3px"}}};return mk.forEach(e=>{const r=`function() {\n const { z_lvl } = feature;\n\n const isFilter = z_lvl === '${e}';\n\n return isFilter;\n }`,o=()=>({text:i,lines:{color:yk,width:bk,cap:"round",join:"round"}}),s=()=>({lines:{color:yk,width:bk,cap:"round",join:"round",outline:{color:"function() {\n const { functional_class, access_id, tollway } = feature;\n\n if (tollway) {\n return '#B9263B';\n }\n\n switch(functional_class) {\n case 5: {\n return '#989898';\n }\n\n case 3:\n case 4: {\n return '#8F6E78';\n }\n\n case 1:\n case 2: {\n return '#9A414B';\n }\n }\n}",width:"function() {\n const { functional_class, access_id } = feature;\n\n switch(functional_class) {\n case 5: {\n switch (access_id) {\n case 32: {\n return 0;\n }\n\n default: {\n return 1;\n }\n }\n }\n\n default: {\n return 1;\n }\n }\n}"}}});if("0.0"===e)gk.forEach(r=>{r.forEach(r=>{const i={id:jT(),data:n,filter:`function() {\n const { functional_class, z_lvl } = feature;\n\n const isFilter = z_lvl === '${e}' && functional_class === ${r};\n\n return isFilter;\n }`,draw:o(),sublayers:{construction:{filter:"function() {\n return global.links.getIsConstruction(feature);\n }",draw:{lines:{width:3,color:"#9AA096",dash:[2,1]}}},functionalClassAccessId32:{filter:"function() {\n return global.links.getIsFunctionalClass(feature);\n }",draw:{lines:{width:2,color:"#9AA096",dash:[2,1]}}},lowMobility:{filter:"function() {\n return global.links.getIsLowMobility(feature);\n }",draw:{lines:{width:4}}}}},a={id:jT(),data:n,filter:`function() {\n const { functional_class, z_lvl } = feature;\n\n const isFilter = z_lvl === '${e}' && functional_class === ${r} && !global.links.getIsConstruction(feature) && !global.links.getIsFunctionalClass(feature);\n\n return isFilter;\n }`,draw:s(),sublayers:{lowMobility:{filter:"function() {\n return global.links.getIsLowMobility(feature);\n }",draw:{lines:{width:4}}}}};t.push(a,i)})});else{const e={id:jT(),data:n,filter:r,draw:o()},i={id:jT(),data:n,filter:r,draw:s()};t.push(i,e)}}),t},_k=()=>{const e=[],t={source:BT.NATURE_TILE,layer:'"MapNatureForest"'},n={id:jT(),data:t,draw:{polygons:{interactive:!0,color:"function() {\n const { feature_type } = feature;\n\n switch (feature_type) {\n case '900202': {\n return '#96BE7D';\n }\n\n default : {\n return null;\n }\n }\n }"}}};return e.push(n),e},xk=({id:e,data:{source:t,layer:n}})=>`${e}-${t}-${n}`,wk=({layer:e,order:t})=>{const n=structuredClone(e),{draw:r,sublayers:i}=n;if(r){const{points:e,lines:i,polygons:o,text:s,styles:a}=r;e&&(r.points={...structuredClone(e),order:t}),i&&(r.lines={...structuredClone(i),order:t}),o&&(r.polygons={...structuredClone(o),order:t}),s&&(r.text={...structuredClone(s),order:t}),a&&(r.styles=Object.entries(a).reduce((e,[n,r])=>({...e,[n]:{...structuredClone(r),order:t}}),{})),n.draw=structuredClone(r)}return i&&(Object.entries(i).forEach(([e,n])=>{if(n){const{draw:r}=n;if(r){const{points:e,lines:i,polygons:o}=r;e&&(r.points={...structuredClone(e),order:t}),i&&(r.lines={...structuredClone(i),order:t}),o&&(r.polygons={...structuredClone(o),order:t}),n.draw=structuredClone(r)}i[e]=structuredClone(n)}}),n.sublayers=structuredClone(i)),n},Ek=e=>{const t=pk(e),n=fk(),r=_k(),i=YT(e),o=hk(e),s=ck(e),a=ak(e),l=uk(e),u=[];if(e===BT.MSK)u.push(...t,...i,...o,...s,...a,...l);else u.push(...t,...i,...o,...n,...r,...s,...a,...l);return u},Sk=e=>{const t=vk(e),n=sk(e),r=lk(e),i=rk(e),o=ok(e),s=[...r,...n,...t];if(e===BT.MSK)s.push(...r,...n,...t);else s.push(...r,...n,...t,...i,...o);return s},Tk=e=>{const t=tk(e),n=nk(e);return[...t,...KT(e),...n]},kk=e=>{const t=[],n=dk(e),r=Ek(e),i=Sk(e),o=Tk(e),s=WT(e),a=qT(e),l=GT(e),u=HT(e);if(e===BT.MSK)t.push(...r,...i,...s,...a,...l,...u,...n,...o);else t.push(...r,...i,...n,...o);return t},Ok=()=>{const{instance:{isValidApiKey:e}}=PT,[t,r]=n.useState(null),[i,o]=n.useState(null),[s,a]=n.useState(null),l=n.useCallback(e=>{if(!i)return void console.warn("Scene не инициализирована");if(!s)return void console.warn("Config не инициализирована");const{name:t}=e;return s.sources[t]=structuredClone(e),i.updateConfig({rebuild:!0}),b()},[i,s]),u=n.useCallback(e=>{if(s)return structuredClone(s.sources[e]);console.warn("Config не инициализирована")},[s]),c=n.useCallback((e,t)=>{if(i){if(s)return s.sources[e].url=t,i.updateConfig({rebuild:!0}),b();console.warn("Config не инициализирована")}else console.warn("Scene не инициализирована")},[s,i]),d=n.useCallback(e=>{if(!i)return void console.warn("Scene не инициализирован");if(!s)return void console.warn("Config не инициализирован");const t=g().length+1,n=wk({layer:e,order:t}),r=xk(n),{sublayers:o,draw:a}=n;if(a){const{styles:e={}}=a;e&&(n.draw={...structuredClone(n.draw),...structuredClone(e)})}return s.layers[r]={...structuredClone(n),...structuredClone(o)},i.updateConfig({rebuild:!0}),g()},[s,i]),h=n.useCallback(e=>{if(!i)return void console.warn("Scene не инициализирован");if(!s)return void console.warn("Config не инициализирован");const t=xk(e);return s.layers[t]&&delete s.layers[t],i.updateConfig({rebuild:!0}),g()},[s,i]),p=n.useCallback(({name:e,style:t})=>{i?s?(s.styles[e]=structuredClone(t),i.updateConfig({rebuild:!0})):console.warn("Config не инициализирована"):console.warn("Scene не инициализирована")},[s,i]),f=n.useCallback(e=>{if(!s)return void console.warn("Config не инициализирована");const t=xk(e),{visible:n}=s.layers[t];return n},[s]),m=n.useCallback(({layer:e,visible:t})=>{if(!i)return void console.warn("Scene не инициализирована");if(!s)return void console.warn("Config не инициализирована");const n=xk(e);return s.layers[n].visible=t,i.updateConfig(),f(e)},[s,i]),g=n.useCallback(()=>{if(!s)return[];const{layers:e}=s;return Object.keys(e)},[s]),y=n.useCallback(()=>{if(!s)return[];const{layers:e}=s;Object.values(e).forEach(h)},[s]),b=n.useCallback(()=>{if(!s)return[];const{sources:e}=s;return Object.keys(e)},[s]);return n.useEffect(()=>(e&&Promise.resolve().then(function(){return lM}).then(()=>{if(window.Tangram){const e=window.Tangram.leafletLayer({scene:nE}),{scene:t}=e;r(e),o(t)}}),()=>{r(null),o(null),a(null)}),[e]),n.useEffect(()=>{i&&i.subscribe({load:({config:e})=>{a(e)}})},[i]),n.useEffect(()=>{p({name:"space-tile",style:{shaders:{defines:{TILE_SCALE:2445e-7,"NORMALIZED_SHORT(x)":"(x * 32767.)"},blocks:{global:"\n varying vec3 v_pos;\n vec2 getTileCoords() {\n return fract(v_pos.xy);\n }\n ",position:"\n v_pos = modelPosition().xyz;\n "}}}}),p({name:"tools-aastep",style:{shaders:{extensions:"OES_standard_derivatives",blocks:{global:"\n float aastep(float threshold, float value) {\n #ifdef TANGRAM_FRAGMENT_SHADER\n #ifdef TANGRAM_EXTENSION_OES_standard_derivatives\n float afwidth = length(vec2(dFdx(value), dFdy(value))) * 0.70710678118654757;\n return smoothstep(threshold-afwidth, threshold+afwidth, value);\n #else\n return step(threshold, value);\n #endif\n #else\n return step(threshold, value);\n #endif\n }\n "}}}}),p({name:"pattern-diagonal-grid",style:{mix:["space-tile","tools-aastep"],shaders:{blocks:{global:"\n float DiagonalGrid(float scale, float lineWidth) {\n vec2 st = getTileCoords() * scale;\n\n float d1 = mod(st.x + st.y, 1.0);\n float line1 = aastep(lineWidth, d1) * aastep(1.0 - lineWidth, d1);\n\n float d2 = mod(st.x - st.y, 1.0);\n float line2 = aastep(lineWidth, d2) * aastep(1.0 - lineWidth, d2);\n\n return max(line1, line2);\n } \n "}}}}),p({name:"diagonal-grid",style:{mix:"pattern-diagonal-grid",blend:"overlay",base:"polygons",shaders:{blocks:{color:"\n float grid = DiagonalGrid(12.0, 0.08);\n\n color.a = grid;\n "}}}}),p({name:"zebra_crossing",style:{base:"polygons",lighting:!1,shaders:{attributes:{a_angle:{type:"float",default:0}},uniforms:{u_stripe_width:1},blocks:{filter:"\n vec3 pos = worldPosition().xyz;\n\n float ang = radians(a_angle);\n\n vec2 dir = vec2(sin(ang), cos(ang));\n\n float positionAlongLine = dot(pos.xy, dir);\n\n float stripe = step(1.0, mod(positionAlongLine / u_stripe_width, 2.0));\n\n color.rgb = mix(vec3(1.0, 1.0, 1.0), vec3(1.0, 0.8, 0.0), stripe);\n \n color.a = 1.0;\n "}}}})},[p]),n.useEffect(()=>{Object.values(BT).forEach(e=>{l({tile_size:256,name:e,url:UT[e],type:"MVT"})})},[l]),{layer:t,scene:i,config:s,addSource:l,getSource:u,updateSource:c,addLayer:d,removeLayer:h,addStyle:p,getLayerVisibility:f,toggleLayerVisibility:m,getSources:b,getLayers:g,removeLayers:y}},Ak=()=>{const{layer:e,addLayer:t}=Ok(),r=tE();return n.useEffect(()=>{e&&r.addLayer(e)},[e]),n.useEffect(()=>{kk(BT.MSK).map(t)},[t]),null},Ck=({children:t,sx:n={},...r})=>e(Jc,{...r,sx:{padding:"20px 15px",borderRadius:"10px",boxShadow:"0px 8px 24px 0px rgba(0,0,0,0.3)",maxHeight:"80vh",maxWidth:"90vw",overflowX:"auto",...n},children:t}),Rk=({color:t="inherit"})=>e(Qa,{color:t});var Nk=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Pk={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Mk=new class{#e=Pk;#t=!1;setTimeoutProvider(e){"production"!==process.env.NODE_ENV&&this.#t&&e!==this.#e&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:this.#e,provider:e}),this.#e=e,"production"!==process.env.NODE_ENV&&(this.#t=!1)}setTimeout(e,t){return"production"!==process.env.NODE_ENV&&(this.#t=!0),this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return"production"!==process.env.NODE_ENV&&(this.#t=!0),this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};var Dk="undefined"==typeof window||"Deno"in globalThis;function Ik(){}function zk(e,t){return"function"==typeof e?e(t):e}function Fk(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:o,queryKey:s,stale:a}=e;if(s)if(r){if(t.queryHash!==jk(s,t.options))return!1}else if(!Bk(t.queryKey,s))return!1;if("all"!==n){const e=t.isActive();if("active"===n&&!e)return!1;if("inactive"===n&&e)return!1}return("boolean"!=typeof a||t.isStale()===a)&&((!i||i===t.state.fetchStatus)&&!(o&&!o(t)))}function Lk(e,t){const{exact:n,status:r,predicate:i,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if($k(t.options.mutationKey)!==$k(o))return!1}else if(!Bk(t.options.mutationKey,o))return!1}return(!r||t.state.status===r)&&!(i&&!i(t))}function jk(e,t){return(t?.queryKeyHashFn||$k)(e)}function $k(e){return JSON.stringify(e,(e,t)=>qk(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Bk(e,t){return e===t||typeof e==typeof t&&(!(!e||!t||"object"!=typeof e||"object"!=typeof t)&&Object.keys(t).every(n=>Bk(e[n],t[n])))}var Vk=Object.prototype.hasOwnProperty;function Uk(e,t){if(e===t)return e;const n=Wk(e)&&Wk(t);if(!(n||qk(e)&&qk(t)))return t;const r=(n?e:Object.keys(e)).length,i=n?t:Object.keys(t),o=i.length,s=n?new Array(o):{};let a=0;for(let l=0;l<o;l++){const o=n?l:i[l],u=e[o],c=t[o];if(u===c){s[o]=u,(n?l<r:Vk.call(e,o))&&a++;continue}if(null===u||null===c||"object"!=typeof u||"object"!=typeof c){s[o]=c;continue}const d=Uk(u,c);s[o]=d,d===u&&a++}return r===o&&a===r?e:s}function Wk(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function qk(e){if(!Gk(e))return!1;const t=e.constructor;if(void 0===t)return!0;const n=t.prototype;return!!Gk(n)&&(!!n.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype)}function Gk(e){return"[object Object]"===Object.prototype.toString.call(e)}function Hk(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Yk(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Kk=Symbol();function Xk(e,t){return"production"!==process.env.NODE_ENV&&e.queryFn===Kk&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==Kk?e.queryFn:()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`))}var Zk=new class extends Nk{#n;#r;#i;constructor(){super(),this.#i=e=>{if(!Dk&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#r||this.setEventListener(this.#i)}onUnsubscribe(){this.hasListeners()||(this.#r?.(),this.#r=void 0)}setEventListener(e){this.#i=e,this.#r?.(),this.#r=e(e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()})}setFocused(e){this.#n!==e&&(this.#n=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return"boolean"==typeof this.#n?this.#n:"hidden"!==globalThis.document?.visibilityState}};var Jk=function(e){setTimeout(e,0)};var Qk=function(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Jk;const o=r=>{t?e.push(r):i(()=>{n(r)})};return{batch:o=>{let s;t++;try{s=o()}finally{t--,t||(()=>{const t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})})()}return s},batchCalls:e=>(...t)=>{o(()=>{e(...t)})},schedule:o,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}(),eO=new class extends Nk{#o=!0;#r;#i;constructor(){super(),this.#i=e=>{if(!Dk&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#r||this.setEventListener(this.#i)}onUnsubscribe(){this.hasListeners()||(this.#r?.(),this.#r=void 0)}setEventListener(e){this.#i=e,this.#r?.(),this.#r=e(this.setOnline.bind(this))}setOnline(e){this.#o!==e&&(this.#o=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#o}};function tO(e){return Math.min(1e3*2**e,3e4)}function nO(e){return"online"!==(e??"online")||eO.isOnline()}var rO=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function iO(e){let t,n=!1,r=0;const i=function(){let e,t;const n=new Promise((n,r)=>{e=n,t=r});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.status="pending",n.catch(()=>{}),n.resolve=t=>{r({status:"fulfilled",value:t}),e(t)},n.reject=e=>{r({status:"rejected",reason:e}),t(e)},n}(),o=()=>"pending"!==i.status,s=()=>Zk.isFocused()&&("always"===e.networkMode||eO.isOnline())&&e.canRun(),a=()=>nO(e.networkMode)&&e.canRun(),l=e=>{o()||(t?.(),i.resolve(e))},u=e=>{o()||(t?.(),i.reject(e))},c=()=>new Promise(n=>{t=e=>{(o()||s())&&n(e)},e.onPause?.()}).then(()=>{t=void 0,o()||e.onContinue?.()}),d=()=>{if(o())return;let t;const i=0===r?e.initialPromise:void 0;try{t=i??e.fn()}catch(e){t=Promise.reject(e)}Promise.resolve(t).then(l).catch(t=>{if(o())return;const i=e.retry??(Dk?0:3),a=e.retryDelay??tO,l="function"==typeof a?a(r,t):a,h=!0===i||"number"==typeof i&&r<i||"function"==typeof i&&i(r,t);!n&&h?(r++,e.onFail?.(r,t),function(e){return new Promise(t=>{Mk.setTimeout(t,e)})}(l).then(()=>s()?void 0:c()).then(()=>{n?u(t):d()})):u(t)})};return{promise:i,status:()=>i.status,cancel:t=>{if(!o()){const n=new rO(t);u(n),e.onCancel?.(n)}},continue:()=>(t?.(),i),cancelRetry:()=>{n=!0},continueRetry:()=>{n=!1},canStart:a,start:()=>(a()?d():c().then(d),i)}}var oO=class{#s;destroy(){this.clearGcTimeout()}scheduleGc(){var e;this.clearGcTimeout(),"number"==typeof(e=this.gcTime)&&e>=0&&e!==1/0&&(this.#s=Mk.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Dk?1/0:3e5))}clearGcTimeout(){this.#s&&(Mk.clearTimeout(this.#s),this.#s=void 0)}},sO=class extends oO{#a;#l;#u;#c;#d;#h;#p;constructor(e){super(),this.#p=!1,this.#h=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#c=e.client,this.#u=this.#c.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#a=uO(this.options),this.state=e.state??this.#a,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#d?.promise}setOptions(e){if(this.options={...this.#h,...e},this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){const e=uO(this.options);void 0!==e.data&&(this.setState(lO(e.data,e.dataUpdatedAt)),this.#a=e)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#u.remove(this)}setData(e,t){const n=function(e,t,n){if("function"==typeof n.structuralSharing)return n.structuralSharing(e,t);if(!1!==n.structuralSharing){if("production"!==process.env.NODE_ENV)try{return Uk(e,t)}catch(e){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${e}`),e}return Uk(e,t)}return t}(this.state.data,e,this.options);return this.#f({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#f({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#d?.promise;return this.#d?.cancel(e),t?t.then(Ik).catch(Ik):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#a)}isActive(){return this.observers.some(e=>{return!1!==(t=e.options.enabled,n=this,"function"==typeof t?t(n):t);var t,n})}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Kk||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>"static"===zk(e.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(e=0){return void 0===this.state.data||"static"!==e&&(!!this.state.isInvalidated||!function(e,t){return Math.max(e+(t||0)-Date.now(),0)}(this.state.dataUpdatedAt,e))}onFocus(){const e=this.observers.find(e=>e.shouldFetchOnWindowFocus());e?.refetch({cancelRefetch:!1}),this.#d?.continue()}onOnline(){const e=this.observers.find(e=>e.shouldFetchOnReconnect());e?.refetch({cancelRefetch:!1}),this.#d?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#u.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#d&&(this.#p?this.#d.cancel({revert:!0}):this.#d.cancelRetry()),this.scheduleGc()),this.#u.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#f({type:"invalidate"})}async fetch(e,t){if("idle"!==this.state.fetchStatus&&"rejected"!==this.#d?.status())if(void 0!==this.state.data&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#d)return this.#d.continueRetry(),this.#d.promise;if(e&&this.setOptions(e),!this.options.queryFn){const e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}"production"!==process.env.NODE_ENV&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#p=!0,n.signal)})},i=()=>{const e=Xk(this.options,t),n=(()=>{const e={client:this.#c,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#p=!1,this.options.persister?this.options.persister(e,n,this):e(n)},o=(()=>{const e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#c,state:this.state,fetchFn:i};return r(e),e})();this.options.behavior?.onFetch(o,this),this.#l=this.state,"idle"!==this.state.fetchStatus&&this.state.fetchMeta===o.fetchOptions?.meta||this.#f({type:"fetch",meta:o.fetchOptions?.meta}),this.#d=iO({initialPromise:t?.initialPromise,fn:o.fetchFn,onCancel:e=>{e instanceof rO&&e.revert&&this.setState({...this.#l,fetchStatus:"idle"}),n.abort()},onFail:(e,t)=>{this.#f({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#f({type:"pause"})},onContinue:()=>{this.#f({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0});try{const e=await this.#d.start();if(void 0===e)throw"production"!==process.env.NODE_ENV&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#u.config.onSuccess?.(e,this),this.#u.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof rO){if(e.silent)return this.#d.promise;if(e.revert){if(void 0===this.state.data)throw e;return this.state.data}}throw this.#f({type:"error",error:e}),this.#u.config.onError?.(e,this),this.#u.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#f(e){this.state=(t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":return{...t,...aO(t.data,this.options),fetchMeta:e.meta??null};case"success":const n={...t,...lO(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#l=e.manual?n:void 0,n;case"error":const r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error"};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}})(this.state),Qk.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#u.notify({query:this,type:"updated",action:e})})}};function aO(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:nO(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}function lO(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function uO(e){const t="function"==typeof e.initialData?e.initialData():e.initialData,n=void 0!==t,r=n?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}function cO(e){return{onFetch:(t,n)=>{const r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],s=t.state.data?.pageParams||[];let a={pages:[],pageParams:[]},l=0;const u=async()=>{let n=!1;const u=Xk(t.options,t.fetchOptions),c=async(e,r,i)=>{if(n)return Promise.reject();if(null==r&&e.pages.length)return Promise.resolve(e);const o=(()=>{const e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?"backward":"forward",meta:t.options.meta};return(e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(t.signal.aborted?n=!0:t.signal.addEventListener("abort",()=>{n=!0}),t.signal)})})(e),e})(),s=await u(o),{maxPages:a}=t.options,l=i?Yk:Hk;return{pages:l(e.pages,s,a),pageParams:l(e.pageParams,r,a)}};if(i&&o.length){const e="backward"===i,t={pages:o,pageParams:s},n=(e?hO:dO)(r,t);a=await c(t,n,e)}else{const t=e??o.length;do{const e=0===l?s[0]??r.initialPageParam:dO(r,a);if(l>0&&null==e)break;a=await c(a,e),l++}while(l<t)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=u}}}function dO(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function hO(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var pO=class extends oO{#c;#m;#g;#d;constructor(e){super(),this.#c=e.client,this.mutationId=e.mutationId,this.#g=e.mutationCache,this.#m=[],this.state=e.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#m.includes(e)||(this.#m.push(e),this.clearGcTimeout(),this.#g.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#m=this.#m.filter(t=>t!==e),this.scheduleGc(),this.#g.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#m.length||("pending"===this.state.status?this.scheduleGc():this.#g.remove(this))}continue(){return this.#d?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#f({type:"continue"})},n={client:this.#c,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#d=iO({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(e,t)=>{this.#f({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#f({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#g.canRun(this)});const r="pending"===this.state.status,i=!this.#d.canStart();try{if(r)t();else{this.#f({type:"pending",variables:e,isPaused:i}),await(this.#g.config.onMutate?.(e,this,n));const t=await(this.options.onMutate?.(e,n));t!==this.state.context&&this.#f({type:"pending",context:t,variables:e,isPaused:i})}const o=await this.#d.start();return await(this.#g.config.onSuccess?.(o,e,this.state.context,this,n)),await(this.options.onSuccess?.(o,e,this.state.context,n)),await(this.#g.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n)),await(this.options.onSettled?.(o,null,e,this.state.context,n)),this.#f({type:"success",data:o}),o}catch(t){try{throw await(this.#g.config.onError?.(t,e,this.state.context,this,n)),await(this.options.onError?.(t,e,this.state.context,n)),await(this.#g.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)),await(this.options.onSettled?.(void 0,t,e,this.state.context,n)),t}finally{this.#f({type:"error",error:t})}}finally{this.#g.runNext(this)}}#f(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),Qk.batch(()=>{this.#m.forEach(t=>{t.onMutationUpdate(e)}),this.#g.notify({mutation:this,type:"updated",action:e})})}};var fO=class extends Nk{constructor(e={}){super(),this.config=e,this.#y=new Set,this.#b=new Map,this.#v=0}#y;#b;#v;build(e,t,n){const r=new pO({client:e,mutationCache:this,mutationId:++this.#v,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#y.add(e);const t=mO(e);if("string"==typeof t){const n=this.#b.get(t);n?n.push(e):this.#b.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#y.delete(e)){const t=mO(e);if("string"==typeof t){const n=this.#b.get(t);if(n)if(n.length>1){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}else n[0]===e&&this.#b.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=mO(e);if("string"==typeof t){const n=this.#b.get(t),r=n?.find(e=>"pending"===e.state.status);return!r||r===e}return!0}runNext(e){const t=mO(e);if("string"==typeof t){const n=this.#b.get(t)?.find(t=>t!==e&&t.state.isPaused);return n?.continue()??Promise.resolve()}return Promise.resolve()}clear(){Qk.batch(()=>{this.#y.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#y.clear(),this.#b.clear()})}getAll(){return Array.from(this.#y)}find(e){const t={exact:!0,...e};return this.getAll().find(e=>Lk(t,e))}findAll(e={}){return this.getAll().filter(t=>Lk(e,t))}notify(e){Qk.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(e=>e.state.isPaused);return Qk.batch(()=>Promise.all(e.map(e=>e.continue().catch(Ik))))}};function mO(e){return e.options.scope?.id}var gO=class extends Nk{#c;#_=void 0;#x;#w;constructor(e,t){super(),this.#c=e,this.setOptions(t),this.bindMethods(),this.#E()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){const t=this.options;this.options=this.#c.defaultMutationOptions(e),function(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}(this.options,t)||this.#c.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#x,observer:this}),t?.mutationKey&&this.options.mutationKey&&$k(t.mutationKey)!==$k(this.options.mutationKey)?this.reset():"pending"===this.#x?.state.status&&this.#x.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#x?.removeObserver(this)}onMutationUpdate(e){this.#E(),this.#S(e)}getCurrentResult(){return this.#_}reset(){this.#x?.removeObserver(this),this.#x=void 0,this.#E(),this.#S()}mutate(e,t){return this.#w=t,this.#x?.removeObserver(this),this.#x=this.#c.getMutationCache().build(this.#c,this.options),this.#x.addObserver(this),this.#x.execute(e)}#E(){const e=this.#x?.state??{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0};this.#_={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#S(e){Qk.batch(()=>{if(this.#w&&this.hasListeners()){const t=this.#_.variables,n=this.#_.context,r={client:this.#c,meta:this.options.meta,mutationKey:this.options.mutationKey};"success"===e?.type?(this.#w.onSuccess?.(e.data,t,n,r),this.#w.onSettled?.(e.data,null,t,n,r)):"error"===e?.type&&(this.#w.onError?.(e.error,t,n,r),this.#w.onSettled?.(void 0,e.error,t,n,r))}this.listeners.forEach(e=>{e(this.#_)})})}},yO=class extends Nk{constructor(e={}){super(),this.config=e,this.#T=new Map}#T;build(e,t,n){const r=t.queryKey,i=t.queryHash??jk(r,t);let o=this.get(i);return o||(o=new sO({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(o)),o}add(e){this.#T.has(e.queryHash)||(this.#T.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#T.get(e.queryHash);t&&(e.destroy(),t===e&&this.#T.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Qk.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#T.get(e)}getAll(){return[...this.#T.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(e=>Fk(t,e))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Fk(e,t)):t}notify(e){Qk.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Qk.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Qk.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},bO=n.createContext(void 0),vO=({client:t,children:r})=>(n.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),e(bO.Provider,{value:t,children:r}));function _O(e,t){const r=(()=>{const e=n.useContext(bO);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e})(),[i]=n.useState(()=>new gO(r,e));n.useEffect(()=>{i.setOptions(e)},[i,e]);const o=n.useSyncExternalStore(n.useCallback(e=>i.subscribe(Qk.batchCalls(e)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),s=n.useCallback((e,t)=>{i.mutate(e,t).catch(Ik)},[i]);if(o.error&&(a=i.options.throwOnError,l=[o.error],"function"==typeof a?a(...l):a))throw o.error;var a,l;return{...o,mutate:s,mutateAsync:o.mutate}}const xO=new class{#k;#g;#h;#O;#A;#C;#R;#N;constructor(e={}){this.#k=e.queryCache||new yO,this.#g=e.mutationCache||new fO,this.#h=e.defaultOptions||{},this.#O=new Map,this.#A=new Map,this.#C=0}mount(){this.#C++,1===this.#C&&(this.#R=Zk.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#k.onFocus())}),this.#N=eO.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#k.onOnline())}))}unmount(){this.#C--,0===this.#C&&(this.#R?.(),this.#R=void 0,this.#N?.(),this.#N=void 0)}isFetching(e){return this.#k.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#g.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#k.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#k.build(this,t),r=n.state.data;return void 0===r?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(zk(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#k.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=this.#k.get(r.queryHash),o=i?.state.data,s=function(e,t){return"function"==typeof e?e(t):e}(t,o);if(void 0!==s)return this.#k.build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return Qk.batch(()=>this.#k.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#k.get(t.queryHash)?.state}removeQueries(e){const t=this.#k;Qk.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){const n=this.#k;return Qk.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Qk.batch(()=>this.#k.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Ik).catch(Ik)}invalidateQueries(e,t={}){return Qk.batch(()=>(this.#k.findAll(e).forEach(e=>{e.invalidate()}),"none"===e?.refetchType?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Qk.batch(()=>this.#k.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(Ik)),"paused"===e.state.fetchStatus?Promise.resolve():t}));return Promise.all(r).then(Ik)}fetchQuery(e){const t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);const n=this.#k.build(this,t);return n.isStaleByTime(zk(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ik).catch(Ik)}fetchInfiniteQuery(e){return e.behavior=cO(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ik).catch(Ik)}ensureInfiniteQueryData(e){return e.behavior=cO(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return eO.isOnline()?this.#g.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#k}getMutationCache(){return this.#g}getDefaultOptions(){return this.#h}setDefaultOptions(e){this.#h=e}setQueryDefaults(e,t){this.#O.set($k(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#O.values()],n={};return t.forEach(t=>{Bk(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#A.set($k(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#A.values()],n={};return t.forEach(t=>{Bk(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#h.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=jk(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Kk&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#h.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#k.clear(),this.#g.clear()}},wO=t=>e(vO,{...t,client:xO}),EO=["localeText"],SO=n.createContext(null);"production"!==process.env.NODE_ENV&&(SO.displayName="PickerAdapterContext");const TO=function(t){const{localeText:r}=t,i=$s(t,EO),{adapter:o,localeText:s}=n.useContext(SO)??{adapter:void 0,localeText:void 0},a=function({props:e,name:t}){return Ci({props:e,name:t,defaultTheme:cs,themeId:se})}({props:i,name:"MuiLocalizationProvider"}),{children:l,dateAdapter:u,dateFormats:c,dateLibInstance:d,adapterLocale:h,localeText:p}=a,f=n.useMemo(()=>ae({},p,s,r),[p,s,r]),m=n.useMemo(()=>{if(!u)return o||null;const e=new u({locale:h,formats:c,instance:d});if(!e.isMUIAdapter)throw new Error(["MUI X: The date adapter should be imported from `@mui/x-date-pickers` or `@mui/x-date-pickers-pro`, not from `@date-io`","For example, `import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'` instead of `import AdapterDayjs from '@date-io/dayjs'`","More information on the installation documentation: https://mui.com/x/react-date-pickers/quickstart/#installation"].join("\n"));return e},[u,h,c,d,o]),g=n.useMemo(()=>m?{minDate:m.date("1900-01-01T00:00:00.000"),maxDate:m.date("2099-12-31T00:00:00.000")}:null,[m]),y=n.useMemo(()=>({utils:m,adapter:m,defaultDates:g,localeText:f}),[g,m,f]);return e(SO.Provider,{value:y,children:l})};"production"!==process.env.NODE_ENV&&(TO.displayName="LocalizationProvider"),"production"!==process.env.NODE_ENV&&(TO.propTypes={adapterLocale:Dn.any,children:Dn.node,dateAdapter:Dn.func,dateFormats:Dn.shape({dayOfMonth:Dn.string,dayOfMonthFull:Dn.string,fullDate:Dn.string,fullTime12h:Dn.string,fullTime24h:Dn.string,hours12h:Dn.string,hours24h:Dn.string,keyboardDate:Dn.string,keyboardDateTime12h:Dn.string,keyboardDateTime24h:Dn.string,meridiem:Dn.string,minutes:Dn.string,month:Dn.string,monthShort:Dn.string,normalDate:Dn.string,normalDateWithWeekday:Dn.string,seconds:Dn.string,shortDate:Dn.string,weekday:Dn.string,weekdayShort:Dn.string,year:Dn.string}),dateLibInstance:Dn.any,localeText:Dn.object});const kO=6048e5,OO=36e5,AO=Symbol.for("constructDateFrom");function CO(e,t){return"function"==typeof e?e(t):e&&"object"==typeof e&&AO in e?e[AO](t):e instanceof Date?new e.constructor(t):new Date(t)}function RO(e,t){return CO(t||e,e)}function NO(e,t,n){const r=RO(e,n?.in);return isNaN(t)?CO(n?.in||e,NaN):t?(r.setDate(r.getDate()+t),r):r}function PO(e,t,n){return CO(e,+RO(e)+t)}function MO(e,t,n){const r=RO(e,n?.in);if(isNaN(t))return CO(e,NaN);if(!t)return r;const i=r.getDate(),o=CO(e,r.getTime());o.setMonth(r.getMonth()+t+1,0);return i>=o.getDate()?o:(r.setFullYear(o.getFullYear(),o.getMonth(),i),r)}function DO(e,t){const n=RO(e,t?.in);return n.setHours(23,59,59,999),n}let IO={};function zO(){return IO}function FO(e,t){const n=RO(e,t?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}const LO={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function jO(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const $O={date:jO({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:jO({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:jO({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},BO={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function VO(e){return(t,n)=>{let r;if("formatting"===(n?.context?String(n.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,i=n?.width?String(n.width):t;r=e.formattingValues[i]||e.formattingValues[t]}else{const t=e.defaultWidth,i=n?.width?String(n.width):e.defaultWidth;r=e.values[i]||e.values[t]}return r[e.argumentCallback?e.argumentCallback(t):t]}}const UO={ordinalNumber:(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:VO({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:VO({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:VO({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:VO({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:VO({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})};function WO(e){return(t,n={})=>{const r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],o=t.match(i);if(!o)return null;const s=o[0],a=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(a)?function(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n;return}(a,e=>e.test(s)):function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n;return}(a,e=>e.test(s));let u;u=e.valueCallback?e.valueCallback(l):l,u=n.valueCallback?n.valueCallback(u):u;return{value:u,rest:t.slice(s.length)}}}function qO(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const i=r[0],o=t.match(e.parsePattern);if(!o)return null;let s=e.valueCallback?e.valueCallback(o[0]):o[0];s=n.valueCallback?n.valueCallback(s):s;return{value:s,rest:t.slice(i.length)}}}const GO={code:"en-US",formatDistance:(e,t,n)=>{let r;const i=LO[e];return r="string"==typeof i?i:1===t?i.one:i.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r},formatLong:$O,formatRelative:(e,t,n,r)=>BO[e],localize:UO,match:{ordinalNumber:qO({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:WO({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:WO({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:WO({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:WO({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:WO({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function HO(e){const t=RO(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function YO(e,...t){const n=CO.bind(null,e||t.find(e=>"object"==typeof e));return t.map(n)}function KO(e,t){const n=RO(e,t?.in);return n.setHours(0,0,0,0),n}function XO(e,t){const n=RO(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function ZO(e,t){const n=RO(e,t?.in),r=function(e,t,n){const[r,i]=YO(n?.in,e,t),o=KO(r),s=KO(i),a=+o-HO(o),l=+s-HO(s);return Math.round((a-l)/864e5)}(n,XO(n));return r+1}function JO(e,t){const n=zO(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=RO(e,t?.in),o=i.getDay(),s=(o<r?7:0)+o-r;return i.setDate(i.getDate()-s),i.setHours(0,0,0,0),i}function QO(e,t){return JO(e,{...t,weekStartsOn:1})}function eA(e,t){const n=RO(e,t?.in),r=n.getFullYear(),i=CO(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);const o=QO(i),s=CO(n,0);s.setFullYear(r,0,4),s.setHours(0,0,0,0);const a=QO(s);return n.getTime()>=o.getTime()?r+1:n.getTime()>=a.getTime()?r:r-1}function tA(e,t){const n=RO(e,t?.in),r=+QO(n)-+function(e,t){const n=eA(e,t),r=CO(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),QO(r)}(n);return Math.round(r/kO)+1}function nA(e,t){const n=RO(e,t?.in),r=n.getFullYear(),i=zO(),o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,s=CO(t?.in||e,0);s.setFullYear(r+1,0,o),s.setHours(0,0,0,0);const a=JO(s,t),l=CO(t?.in||e,0);l.setFullYear(r,0,o),l.setHours(0,0,0,0);const u=JO(l,t);return+n>=+a?r+1:+n>=+u?r:r-1}function rA(e,t){const n=RO(e,t?.in),r=+JO(n,t)-+function(e,t){const n=zO(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=nA(e,t),o=CO(t?.in||e,0);return o.setFullYear(i,0,r),o.setHours(0,0,0,0),JO(o,t)}(n,t);return Math.round(r/kO)+1}function iA(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const oA={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return iA("yy"===t?r%100:r,t.length)},M(e,t){const n=e.getMonth();return"M"===t?String(n+1):iA(n+1,2)},d:(e,t)=>iA(e.getDate(),t.length),a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,t)=>iA(e.getHours()%12||12,t.length),H:(e,t)=>iA(e.getHours(),t.length),m:(e,t)=>iA(e.getMinutes(),t.length),s:(e,t)=>iA(e.getSeconds(),t.length),S(e,t){const n=t.length,r=e.getMilliseconds();return iA(Math.trunc(r*Math.pow(10,n-3)),t.length)}},sA="midnight",aA="noon",lA="morning",uA="afternoon",cA="evening",dA="night",hA={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if("yo"===t){const t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:"year"})}return oA.y(e,t)},Y:function(e,t,n,r){const i=nA(e,r),o=i>0?i:1-i;if("YY"===t){return iA(o%100,2)}return"Yo"===t?n.ordinalNumber(o,{unit:"year"}):iA(o,t.length)},R:function(e,t){return iA(eA(e),t.length)},u:function(e,t){return iA(e.getFullYear(),t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return iA(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return iA(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return oA.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return iA(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const i=rA(e,r);return"wo"===t?n.ordinalNumber(i,{unit:"week"}):iA(i,t.length)},I:function(e,t,n){const r=tA(e);return"Io"===t?n.ordinalNumber(r,{unit:"week"}):iA(r,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getDate(),{unit:"date"}):oA.d(e,t)},D:function(e,t,n){const r=ZO(e);return"Do"===t?n.ordinalNumber(r,{unit:"dayOfYear"}):iA(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const i=e.getDay(),o=(i-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return iA(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const i=e.getDay(),o=(i-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return iA(o,t.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),i=0===r?7:r;switch(t){case"i":return String(i);case"ii":return iA(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let i;switch(i=12===r?aA:0===r?sA:r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let i;switch(i=r>=17?cA:r>=12?uA:r>=4?lA:dA,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),n.ordinalNumber(t,{unit:"hour"})}return oA.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getHours(),{unit:"hour"}):oA.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return"Ko"===t?n.ordinalNumber(r,{unit:"hour"}):iA(r,t.length)},k:function(e,t,n){let r=e.getHours();return 0===r&&(r=24),"ko"===t?n.ordinalNumber(r,{unit:"hour"}):iA(r,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):oA.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getSeconds(),{unit:"second"}):oA.s(e,t)},S:function(e,t){return oA.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(0===r)return"Z";switch(t){case"X":return fA(r);case"XXXX":case"XX":return mA(r);default:return mA(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return fA(r);case"xxxx":case"xx":return mA(r);default:return mA(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+pA(r,":");default:return"GMT"+mA(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+pA(r,":");default:return"GMT"+mA(r,":")}},t:function(e,t,n){return iA(Math.trunc(+e/1e3),t.length)},T:function(e,t,n){return iA(+e,t.length)}};function pA(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),i=Math.trunc(r/60),o=r%60;return 0===o?n+String(i):n+String(i)+t+iA(o,2)}function fA(e,t){if(e%60==0){return(e>0?"-":"+")+iA(Math.abs(e)/60,2)}return mA(e,t)}function mA(e,t=""){const n=e>0?"-":"+",r=Math.abs(e);return n+iA(Math.trunc(r/60),2)+t+iA(r%60,2)}const gA=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},yA=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},bA={p:yA,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return gA(e,t);let o;switch(r){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;default:o=t.dateTime({width:"full"})}return o.replace("{{date}}",gA(r,t)).replace("{{time}}",yA(i,t))}},vA=/^D+$/,_A=/^Y+$/,xA=["D","DD","YY","YYYY"];function wA(e){return vA.test(e)}function EA(e){return _A.test(e)}function SA(e,t,n){const r=function(e,t,n){const r="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,n);if(console.warn(r),xA.includes(e))throw new RangeError(r)}function TA(e){return!(!((t=e)instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t))&&"number"!=typeof e||isNaN(+RO(e)));var t}const kA=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,OA=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,AA=/^'([^]*?)'?$/,CA=/''/g,RA=/[a-zA-Z]/;function NA(e){const t=e.match(AA);return t?t[1].replace(CA,"'"):e}function PA(e,t){const n=RO(e,t?.in),r=n.getFullYear(),i=n.getMonth(),o=CO(n,0);return o.setFullYear(r,i+1,0),o.setHours(0,0,0,0),o.getDate()}function MA(e,t){return+RO(e)>+RO(t)}function DA(e,t){return+RO(e)<+RO(t)}function IA(e,t){const n=RO(e,t?.in);return n.setMinutes(0,0,0),n}class zA{subPriority=0;validate(e,t){return!0}}class FA extends zA{constructor(e,t,n,r,i){super(),this.value=e,this.validateValue=t,this.setValue=n,this.priority=r,i&&(this.subPriority=i)}validate(e,t){return this.validateValue(e,this.value,t)}set(e,t,n){return this.setValue(e,t,this.value,n)}}class LA extends zA{priority=10;subPriority=-1;constructor(e,t){super(),this.context=e||(e=>CO(t,e))}set(e,t){return t.timestampIsSet?e:CO(e,function(e,t){const n=function(e){return"function"==typeof e&&e.prototype?.constructor===e}(t)?new t(0):CO(t,0);return n.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),n.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n}(e,this.context))}}class jA{run(e,t,n,r){const i=this.parse(e,t,n,r);return i?{setter:new FA(i.value,this.validate,this.set,this.priority,this.subPriority),rest:i.rest}:null}validate(e,t,n){return!0}}const $A=/^(1[0-2]|0?\d)/,BA=/^(3[0-1]|[0-2]?\d)/,VA=/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,UA=/^(5[0-3]|[0-4]?\d)/,WA=/^(2[0-3]|[0-1]?\d)/,qA=/^(2[0-4]|[0-1]?\d)/,GA=/^(1[0-1]|0?\d)/,HA=/^(1[0-2]|0?\d)/,YA=/^[0-5]?\d/,KA=/^[0-5]?\d/,XA=/^\d/,ZA=/^\d{1,2}/,JA=/^\d{1,3}/,QA=/^\d{1,4}/,eC=/^-?\d+/,tC=/^-?\d/,nC=/^-?\d{1,2}/,rC=/^-?\d{1,3}/,iC=/^-?\d{1,4}/,oC=/^([+-])(\d{2})(\d{2})?|Z/,sC=/^([+-])(\d{2})(\d{2})|Z/,aC=/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,lC=/^([+-])(\d{2}):(\d{2})|Z/,uC=/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/;function cC(e,t){return e?{value:t(e.value),rest:e.rest}:e}function dC(e,t){const n=t.match(e);return n?{value:parseInt(n[0],10),rest:t.slice(n[0].length)}:null}function hC(e,t){const n=t.match(e);if(!n)return null;if("Z"===n[0])return{value:0,rest:t.slice(1)};const r="+"===n[1]?1:-1,i=n[2]?parseInt(n[2],10):0,o=n[3]?parseInt(n[3],10):0,s=n[5]?parseInt(n[5],10):0;return{value:r*(i*OO+6e4*o+1e3*s),rest:t.slice(n[0].length)}}function pC(e){return dC(eC,e)}function fC(e,t){switch(e){case 1:return dC(XA,t);case 2:return dC(ZA,t);case 3:return dC(JA,t);case 4:return dC(QA,t);default:return dC(new RegExp("^\\d{1,"+e+"}"),t)}}function mC(e,t){switch(e){case 1:return dC(tC,t);case 2:return dC(nC,t);case 3:return dC(rC,t);case 4:return dC(iC,t);default:return dC(new RegExp("^-?\\d{1,"+e+"}"),t)}}function gC(e){switch(e){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;default:return 0}}function yC(e,t){const n=t>0,r=n?t:1-t;let i;if(r<=50)i=e||100;else{const t=r+50;i=e+100*Math.trunc(t/100)-(e>=t%100?100:0)}return n?i:1-i}function bC(e){return e%400==0||e%4==0&&e%100!=0}const vC=[31,28,31,30,31,30,31,31,30,31,30,31],_C=[31,29,31,30,31,30,31,31,30,31,30,31];function xC(e,t,n){const r=zO(),i=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,o=RO(e,n?.in),s=o.getDay(),a=7-i;return NO(o,t<0||t>6?t-(s+a)%7:((t%7+7)%7+a)%7-(s+a)%7,n)}function wC(e,t,n){const r=RO(e,n?.in),i=function(e,t){const n=RO(e,t?.in).getDay();return 0===n?7:n}(r,n);return NO(r,t-i,n)}const EC={G:new class extends jA{priority=140;parse(e,t,n){switch(t){case"G":case"GG":case"GGG":return n.era(e,{width:"abbreviated"})||n.era(e,{width:"narrow"});case"GGGGG":return n.era(e,{width:"narrow"});default:return n.era(e,{width:"wide"})||n.era(e,{width:"abbreviated"})||n.era(e,{width:"narrow"})}}set(e,t,n){return t.era=n,e.setFullYear(n,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=["R","u","t","T"]},y:new class extends jA{priority=130;incompatibleTokens=["Y","R","u","w","I","i","e","c","t","T"];parse(e,t,n){const r=e=>({year:e,isTwoDigitYear:"yy"===t});switch(t){case"y":return cC(fC(4,e),r);case"yo":return cC(n.ordinalNumber(e,{unit:"year"}),r);default:return cC(fC(t.length,e),r)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,n){const r=e.getFullYear();if(n.isTwoDigitYear){const t=yC(n.year,r);return e.setFullYear(t,0,1),e.setHours(0,0,0,0),e}const i="era"in t&&1!==t.era?1-n.year:n.year;return e.setFullYear(i,0,1),e.setHours(0,0,0,0),e}},Y:new class extends jA{priority=130;parse(e,t,n){const r=e=>({year:e,isTwoDigitYear:"YY"===t});switch(t){case"Y":return cC(fC(4,e),r);case"Yo":return cC(n.ordinalNumber(e,{unit:"year"}),r);default:return cC(fC(t.length,e),r)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,n,r){const i=nA(e,r);if(n.isTwoDigitYear){const t=yC(n.year,i);return e.setFullYear(t,0,r.firstWeekContainsDate),e.setHours(0,0,0,0),JO(e,r)}const o="era"in t&&1!==t.era?1-n.year:n.year;return e.setFullYear(o,0,r.firstWeekContainsDate),e.setHours(0,0,0,0),JO(e,r)}incompatibleTokens=["y","R","u","Q","q","M","L","I","d","D","i","t","T"]},R:new class extends jA{priority=130;parse(e,t){return mC("R"===t?4:t.length,e)}set(e,t,n){const r=CO(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),QO(r)}incompatibleTokens=["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]},u:new class extends jA{priority=130;parse(e,t){return mC("u"===t?4:t.length,e)}set(e,t,n){return e.setFullYear(n,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=["G","y","Y","R","w","I","i","e","c","t","T"]},Q:new class extends jA{priority=120;parse(e,t,n){switch(t){case"Q":case"QQ":return fC(t.length,e);case"Qo":return n.ordinalNumber(e,{unit:"quarter"});case"QQQ":return n.quarter(e,{width:"abbreviated",context:"formatting"})||n.quarter(e,{width:"narrow",context:"formatting"});case"QQQQQ":return n.quarter(e,{width:"narrow",context:"formatting"});default:return n.quarter(e,{width:"wide",context:"formatting"})||n.quarter(e,{width:"abbreviated",context:"formatting"})||n.quarter(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=1&&t<=4}set(e,t,n){return e.setMonth(3*(n-1),1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"]},q:new class extends jA{priority=120;parse(e,t,n){switch(t){case"q":case"qq":return fC(t.length,e);case"qo":return n.ordinalNumber(e,{unit:"quarter"});case"qqq":return n.quarter(e,{width:"abbreviated",context:"standalone"})||n.quarter(e,{width:"narrow",context:"standalone"});case"qqqqq":return n.quarter(e,{width:"narrow",context:"standalone"});default:return n.quarter(e,{width:"wide",context:"standalone"})||n.quarter(e,{width:"abbreviated",context:"standalone"})||n.quarter(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=1&&t<=4}set(e,t,n){return e.setMonth(3*(n-1),1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"]},M:new class extends jA{incompatibleTokens=["Y","R","q","Q","L","w","I","D","i","e","c","t","T"];priority=110;parse(e,t,n){const r=e=>e-1;switch(t){case"M":return cC(dC($A,e),r);case"MM":return cC(fC(2,e),r);case"Mo":return cC(n.ordinalNumber(e,{unit:"month"}),r);case"MMM":return n.month(e,{width:"abbreviated",context:"formatting"})||n.month(e,{width:"narrow",context:"formatting"});case"MMMMM":return n.month(e,{width:"narrow",context:"formatting"});default:return n.month(e,{width:"wide",context:"formatting"})||n.month(e,{width:"abbreviated",context:"formatting"})||n.month(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.setMonth(n,1),e.setHours(0,0,0,0),e}},L:new class extends jA{priority=110;parse(e,t,n){const r=e=>e-1;switch(t){case"L":return cC(dC($A,e),r);case"LL":return cC(fC(2,e),r);case"Lo":return cC(n.ordinalNumber(e,{unit:"month"}),r);case"LLL":return n.month(e,{width:"abbreviated",context:"standalone"})||n.month(e,{width:"narrow",context:"standalone"});case"LLLLL":return n.month(e,{width:"narrow",context:"standalone"});default:return n.month(e,{width:"wide",context:"standalone"})||n.month(e,{width:"abbreviated",context:"standalone"})||n.month(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.setMonth(n,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","M","w","I","D","i","e","c","t","T"]},w:new class extends jA{priority=100;parse(e,t,n){switch(t){case"w":return dC(UA,e);case"wo":return n.ordinalNumber(e,{unit:"week"});default:return fC(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,n,r){return JO(function(e,t,n){const r=RO(e,n?.in),i=rA(r,n)-t;return r.setDate(r.getDate()-7*i),RO(r,n?.in)}(e,n,r),r)}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","i","t","T"]},I:new class extends jA{priority=100;parse(e,t,n){switch(t){case"I":return dC(UA,e);case"Io":return n.ordinalNumber(e,{unit:"week"});default:return fC(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,n){return QO(function(e,t,n){const r=RO(e,n?.in),i=tA(r,n)-t;return r.setDate(r.getDate()-7*i),r}(e,n))}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"]},d:new class extends jA{priority=90;subPriority=1;parse(e,t,n){switch(t){case"d":return dC(BA,e);case"do":return n.ordinalNumber(e,{unit:"date"});default:return fC(t.length,e)}}validate(e,t){const n=bC(e.getFullYear()),r=e.getMonth();return n?t>=1&&t<=_C[r]:t>=1&&t<=vC[r]}set(e,t,n){return e.setDate(n),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","w","I","D","i","e","c","t","T"]},D:new class extends jA{priority=90;subpriority=1;parse(e,t,n){switch(t){case"D":case"DD":return dC(VA,e);case"Do":return n.ordinalNumber(e,{unit:"date"});default:return fC(t.length,e)}}validate(e,t){return bC(e.getFullYear())?t>=1&&t<=366:t>=1&&t<=365}set(e,t,n){return e.setMonth(0,n),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"]},E:new class extends jA{priority=90;parse(e,t,n){switch(t){case"E":case"EE":case"EEE":return n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"EEEEE":return n.day(e,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});default:return n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,r){return(e=xC(e,n,r)).setHours(0,0,0,0),e}incompatibleTokens=["D","i","e","c","t","T"]},e:new class extends jA{priority=90;parse(e,t,n,r){const i=e=>{const t=7*Math.floor((e-1)/7);return(e+r.weekStartsOn+6)%7+t};switch(t){case"e":case"ee":return cC(fC(t.length,e),i);case"eo":return cC(n.ordinalNumber(e,{unit:"day"}),i);case"eee":return n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"eeeee":return n.day(e,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});default:return n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,r){return(e=xC(e,n,r)).setHours(0,0,0,0),e}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"]},c:new class extends jA{priority=90;parse(e,t,n,r){const i=e=>{const t=7*Math.floor((e-1)/7);return(e+r.weekStartsOn+6)%7+t};switch(t){case"c":case"cc":return cC(fC(t.length,e),i);case"co":return cC(n.ordinalNumber(e,{unit:"day"}),i);case"ccc":return n.day(e,{width:"abbreviated",context:"standalone"})||n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"});case"ccccc":return n.day(e,{width:"narrow",context:"standalone"});case"cccccc":return n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"});default:return n.day(e,{width:"wide",context:"standalone"})||n.day(e,{width:"abbreviated",context:"standalone"})||n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,r){return(e=xC(e,n,r)).setHours(0,0,0,0),e}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"]},i:new class extends jA{priority=90;parse(e,t,n){const r=e=>0===e?7:e;switch(t){case"i":case"ii":return fC(t.length,e);case"io":return n.ordinalNumber(e,{unit:"day"});case"iii":return cC(n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"}),r);case"iiiii":return cC(n.day(e,{width:"narrow",context:"formatting"}),r);case"iiiiii":return cC(n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"}),r);default:return cC(n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"}),r)}}validate(e,t){return t>=1&&t<=7}set(e,t,n){return(e=wC(e,n)).setHours(0,0,0,0),e}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"]},a:new class extends jA{priority=80;parse(e,t,n){switch(t){case"a":case"aa":case"aaa":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaaa":return n.dayPeriod(e,{width:"narrow",context:"formatting"});default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,n){return e.setHours(gC(n),0,0,0),e}incompatibleTokens=["b","B","H","k","t","T"]},b:new class extends jA{priority=80;parse(e,t,n){switch(t){case"b":case"bb":case"bbb":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbbb":return n.dayPeriod(e,{width:"narrow",context:"formatting"});default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,n){return e.setHours(gC(n),0,0,0),e}incompatibleTokens=["a","B","H","k","t","T"]},B:new class extends jA{priority=80;parse(e,t,n){switch(t){case"B":case"BB":case"BBB":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBBB":return n.dayPeriod(e,{width:"narrow",context:"formatting"});default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,n){return e.setHours(gC(n),0,0,0),e}incompatibleTokens=["a","b","t","T"]},h:new class extends jA{priority=70;parse(e,t,n){switch(t){case"h":return dC(HA,e);case"ho":return n.ordinalNumber(e,{unit:"hour"});default:return fC(t.length,e)}}validate(e,t){return t>=1&&t<=12}set(e,t,n){const r=e.getHours()>=12;return r&&n<12?e.setHours(n+12,0,0,0):r||12!==n?e.setHours(n,0,0,0):e.setHours(0,0,0,0),e}incompatibleTokens=["H","K","k","t","T"]},H:new class extends jA{priority=70;parse(e,t,n){switch(t){case"H":return dC(WA,e);case"Ho":return n.ordinalNumber(e,{unit:"hour"});default:return fC(t.length,e)}}validate(e,t){return t>=0&&t<=23}set(e,t,n){return e.setHours(n,0,0,0),e}incompatibleTokens=["a","b","h","K","k","t","T"]},K:new class extends jA{priority=70;parse(e,t,n){switch(t){case"K":return dC(GA,e);case"Ko":return n.ordinalNumber(e,{unit:"hour"});default:return fC(t.length,e)}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.getHours()>=12&&n<12?e.setHours(n+12,0,0,0):e.setHours(n,0,0,0),e}incompatibleTokens=["h","H","k","t","T"]},k:new class extends jA{priority=70;parse(e,t,n){switch(t){case"k":return dC(qA,e);case"ko":return n.ordinalNumber(e,{unit:"hour"});default:return fC(t.length,e)}}validate(e,t){return t>=1&&t<=24}set(e,t,n){const r=n<=24?n%24:n;return e.setHours(r,0,0,0),e}incompatibleTokens=["a","b","h","H","K","t","T"]},m:new class extends jA{priority=60;parse(e,t,n){switch(t){case"m":return dC(YA,e);case"mo":return n.ordinalNumber(e,{unit:"minute"});default:return fC(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,n){return e.setMinutes(n,0,0),e}incompatibleTokens=["t","T"]},s:new class extends jA{priority=50;parse(e,t,n){switch(t){case"s":return dC(KA,e);case"so":return n.ordinalNumber(e,{unit:"second"});default:return fC(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,n){return e.setSeconds(n,0),e}incompatibleTokens=["t","T"]},S:new class extends jA{priority=30;parse(e,t){return cC(fC(t.length,e),e=>Math.trunc(e*Math.pow(10,3-t.length)))}set(e,t,n){return e.setMilliseconds(n),e}incompatibleTokens=["t","T"]},X:new class extends jA{priority=10;parse(e,t){switch(t){case"X":return hC(oC,e);case"XX":return hC(sC,e);case"XXXX":return hC(aC,e);case"XXXXX":return hC(uC,e);default:return hC(lC,e)}}set(e,t,n){return t.timestampIsSet?e:CO(e,e.getTime()-HO(e)-n)}incompatibleTokens=["t","T","x"]},x:new class extends jA{priority=10;parse(e,t){switch(t){case"x":return hC(oC,e);case"xx":return hC(sC,e);case"xxxx":return hC(aC,e);case"xxxxx":return hC(uC,e);default:return hC(lC,e)}}set(e,t,n){return t.timestampIsSet?e:CO(e,e.getTime()-HO(e)-n)}incompatibleTokens=["t","T","X"]},t:new class extends jA{priority=40;parse(e){return pC(e)}set(e,t,n){return[CO(e,1e3*n),{timestampIsSet:!0}]}incompatibleTokens="*"},T:new class extends jA{priority=20;parse(e){return pC(e)}set(e,t,n){return[CO(e,n),{timestampIsSet:!0}]}incompatibleTokens="*"}},SC=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,TC=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,kC=/^'([^]*?)'?$/,OC=/''/g,AC=/\S/,CC=/[a-zA-Z]/;function RC(e,t,n,r){const i=()=>CO(r?.in||n,NaN),o=Object.assign({},zO()),s=r?.locale??o.locale??GO,a=r?.firstWeekContainsDate??r?.locale?.options?.firstWeekContainsDate??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,l=r?.weekStartsOn??r?.locale?.options?.weekStartsOn??o.weekStartsOn??o.locale?.options?.weekStartsOn??0;if(!t)return e?i():RO(n,r?.in);const u={firstWeekContainsDate:a,weekStartsOn:l,locale:s},c=[new LA(r?.in,n)],d=t.match(TC).map(e=>{const t=e[0];if(t in bA){return(0,bA[t])(e,s.formatLong)}return e}).join("").match(SC),h=[];for(let n of d){!r?.useAdditionalWeekYearTokens&&EA(n)&&SA(n,t,e),!r?.useAdditionalDayOfYearTokens&&wA(n)&&SA(n,t,e);const o=n[0],a=EC[o];if(a){const{incompatibleTokens:t}=a;if(Array.isArray(t)){const e=h.find(e=>t.includes(e.token)||e.token===o);if(e)throw new RangeError(`The format string mustn't contain \`${e.fullToken}\` and \`${n}\` at the same time`)}else if("*"===a.incompatibleTokens&&h.length>0)throw new RangeError(`The format string mustn't contain \`${n}\` and any other token at the same time`);h.push({token:o,fullToken:n});const r=a.run(e,n,s.match,u);if(!r)return i();c.push(r.setter),e=r.rest}else{if(o.match(CC))throw new RangeError("Format string contains an unescaped latin alphabet character `"+o+"`");if("''"===n?n="'":"'"===o&&(n=NC(n)),0!==e.indexOf(n))return i();e=e.slice(n.length)}}if(e.length>0&&AC.test(e))return i();const p=c.map(e=>e.priority).sort((e,t)=>t-e).filter((e,t,n)=>n.indexOf(e)===t).map(e=>c.filter(t=>t.priority===e).sort((e,t)=>t.subPriority-e.subPriority)).map(e=>e[0]);let f=RO(n,r?.in);if(isNaN(+f))return i();const m={};for(const e of p){if(!e.validate(f,u))return i();const t=e.set(f,m,u);Array.isArray(t)?(f=t[0],Object.assign(m,t[1])):f=t}return f}function NC(e){return e.match(kC)[1].replace(OC,"'")}const PC={y:{sectionType:"year",contentType:"digit",maxLength:4},yy:"year",yyy:{sectionType:"year",contentType:"digit",maxLength:4},yyyy:"year",M:{sectionType:"month",contentType:"digit",maxLength:2},MM:"month",MMMM:{sectionType:"month",contentType:"letter"},MMM:{sectionType:"month",contentType:"letter"},L:{sectionType:"month",contentType:"digit",maxLength:2},LL:"month",LLL:{sectionType:"month",contentType:"letter"},LLLL:{sectionType:"month",contentType:"letter"},d:{sectionType:"day",contentType:"digit",maxLength:2},dd:"day",do:{sectionType:"day",contentType:"digit-with-letter"},E:{sectionType:"weekDay",contentType:"letter"},EE:{sectionType:"weekDay",contentType:"letter"},EEE:{sectionType:"weekDay",contentType:"letter"},EEEE:{sectionType:"weekDay",contentType:"letter"},EEEEE:{sectionType:"weekDay",contentType:"letter"},i:{sectionType:"weekDay",contentType:"digit",maxLength:1},ii:"weekDay",iii:{sectionType:"weekDay",contentType:"letter"},iiii:{sectionType:"weekDay",contentType:"letter"},e:{sectionType:"weekDay",contentType:"digit",maxLength:1},ee:"weekDay",eee:{sectionType:"weekDay",contentType:"letter"},eeee:{sectionType:"weekDay",contentType:"letter"},eeeee:{sectionType:"weekDay",contentType:"letter"},eeeeee:{sectionType:"weekDay",contentType:"letter"},c:{sectionType:"weekDay",contentType:"digit",maxLength:1},cc:"weekDay",ccc:{sectionType:"weekDay",contentType:"letter"},cccc:{sectionType:"weekDay",contentType:"letter"},ccccc:{sectionType:"weekDay",contentType:"letter"},cccccc:{sectionType:"weekDay",contentType:"letter"},a:"meridiem",aa:"meridiem",aaa:"meridiem",H:{sectionType:"hours",contentType:"digit",maxLength:2},HH:"hours",h:{sectionType:"hours",contentType:"digit",maxLength:2},hh:"hours",m:{sectionType:"minutes",contentType:"digit",maxLength:2},mm:"minutes",s:{sectionType:"seconds",contentType:"digit",maxLength:2},ss:"seconds"},MC={year:"yyyy",month:"LLLL",monthShort:"MMM",dayOfMonth:"d",dayOfMonthFull:"do",weekday:"EEEE",weekdayShort:"EEEEEE",hours24h:"HH",hours12h:"hh",meridiem:"aa",minutes:"mm",seconds:"ss",fullDate:"PP",keyboardDate:"P",shortDate:"MMM d",normalDate:"d MMMM",normalDateWithWeekday:"EEE, MMM d",fullTime12h:"hh:mm aa",fullTime24h:"HH:mm",keyboardDateTime12h:"P hh:mm aa",keyboardDateTime24h:"P HH:mm"};class DC{isMUIAdapter=!0;isTimezoneCompatible=!1;formatTokenMap=(()=>PC)();escapedCharacters={start:"'",end:"'"};constructor(e){const{locale:t,formats:n,longFormatters:r,lib:i}=e;this.locale=t,this.formats=ae({},MC,n),this.longFormatters=r,this.lib=i||"date-fns"}date=e=>void 0===e?new Date:null===e?null:new Date(e);getInvalidDate=()=>new Date("Invalid Date");getTimezone=()=>"default";setTimezone=e=>e;toJsDate=e=>e;getCurrentLocaleCode=()=>this.locale.code;is12HourCycleInCurrentLocale=()=>/a/.test(this.locale.formatLong.time({width:"short"}));expandFormat=e=>e.match(/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g).map(e=>{const t=e[0];if("p"===t||"P"===t){return(0,this.longFormatters[t])(e,this.locale.formatLong)}return e}).join("");formatNumber=e=>e;getDayOfWeek=e=>e.getDay()+1}class IC extends DC{constructor({locale:e,formats:t}={}){if("production"!==process.env.NODE_ENV&&!bA)throw new Error("MUI: The minimum supported `date-fns` package version compatible with this adapter is `3.2.x`.");super({locale:e??GO,formats:t,longFormatters:bA})}parse=(e,t)=>""===e?null:RC(e,t,new Date,{locale:this.locale});isValid=e=>null!=e&&TA(e);format=(e,t)=>this.formatByString(e,this.formats[t]);formatByString=(e,t)=>function(e,t,n){const r=zO(),i=n?.locale??r.locale??GO,o=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,s=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,a=RO(e,n?.in);if(!TA(a))throw new RangeError("Invalid time value");let l=t.match(OA).map(e=>{const t=e[0];return"p"===t||"P"===t?(0,bA[t])(e,i.formatLong):e}).join("").match(kA).map(e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:NA(e)};if(hA[t])return{isToken:!0,value:e};if(t.match(RA))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(l=i.localize.preprocessor(a,l));const u={firstWeekContainsDate:o,weekStartsOn:s,locale:i};return l.map(r=>{if(!r.isToken)return r.value;const o=r.value;return(!n?.useAdditionalWeekYearTokens&&EA(o)||!n?.useAdditionalDayOfYearTokens&&wA(o))&&SA(o,t,String(e)),(0,hA[o[0]])(a,o,i.localize,u)}).join("")}(e,t,{locale:this.locale});isEqual=(e,t)=>{return null===e&&null===t||null!==e&&null!==t&&(n=t,+RO(e)===+RO(n));var n};isSameYear=(e,t)=>function(e,t,n){const[r,i]=YO(n?.in,e,t);return r.getFullYear()===i.getFullYear()}(e,t);isSameMonth=(e,t)=>function(e,t,n){const[r,i]=YO(n?.in,e,t);return r.getFullYear()===i.getFullYear()&&r.getMonth()===i.getMonth()}(e,t);isSameDay=(e,t)=>function(e,t,n){const[r,i]=YO(n?.in,e,t);return+KO(r)===+KO(i)}(e,t);isSameHour=(e,t)=>function(e,t,n){const[r,i]=YO(n?.in,e,t);return+IA(r)===+IA(i)}(e,t);isAfter=(e,t)=>MA(e,t);isAfterYear=(e,t)=>MA(e,FO(t));isAfterDay=(e,t)=>MA(e,DO(t));isBefore=(e,t)=>DA(e,t);isBeforeYear=(e,t)=>DA(e,this.startOfYear(t));isBeforeDay=(e,t)=>DA(e,this.startOfDay(t));isWithinRange=(e,[t,n])=>function(e,t,n){const r=+RO(e,n?.in),[i,o]=[+RO(t.start,n?.in),+RO(t.end,n?.in)].sort((e,t)=>e-t);return r>=i&&r<=o}(e,{start:t,end:n});startOfYear=e=>XO(e);startOfMonth=e=>function(e,t){const n=RO(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}(e);startOfWeek=e=>JO(e,{locale:this.locale});startOfDay=e=>KO(e);endOfYear=e=>FO(e);endOfMonth=e=>function(e,t){const n=RO(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}(e);endOfWeek=e=>function(e,t){const n=zO(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=RO(e,t?.in),o=i.getDay(),s=6+(o<r?-7:0)-(o-r);return i.setDate(i.getDate()+s),i.setHours(23,59,59,999),i}(e,{locale:this.locale});endOfDay=e=>DO(e);addYears=(e,t)=>function(e,t,n){return MO(e,12*t,n)}(e,t);addMonths=(e,t)=>MO(e,t);addWeeks=(e,t)=>function(e,t,n){return NO(e,7*t,n)}(e,t);addDays=(e,t)=>NO(e,t);addHours=(e,t)=>function(e,t){return PO(e,t*OO)}(e,t);addMinutes=(e,t)=>function(e,t,n){const r=RO(e,n?.in);return r.setTime(r.getTime()+6e4*t),r}(e,t);addSeconds=(e,t)=>function(e,t){return PO(e,1e3*t)}(e,t);getYear=e=>function(e,t){return RO(e,t?.in).getFullYear()}(e);getMonth=e=>function(e,t){return RO(e,t?.in).getMonth()}(e);getDate=e=>function(e,t){return RO(e,t?.in).getDate()}(e);getHours=e=>function(e,t){return RO(e,t?.in).getHours()}(e);getMinutes=e=>function(e,t){return RO(e,t?.in).getMinutes()}(e);getSeconds=e=>function(e){return RO(e).getSeconds()}(e);getMilliseconds=e=>function(e){return RO(e).getMilliseconds()}(e);setYear=(e,t)=>function(e,t,n){const r=RO(e,n?.in);return isNaN(+r)?CO(e,NaN):(r.setFullYear(t),r)}(e,t);setMonth=(e,t)=>function(e,t,n){const r=RO(e,n?.in),i=r.getFullYear(),o=r.getDate(),s=CO(e,0);s.setFullYear(i,t,15),s.setHours(0,0,0,0);const a=PA(s);return r.setMonth(t,Math.min(o,a)),r}(e,t);setDate=(e,t)=>function(e,t,n){const r=RO(e,n?.in);return r.setDate(t),r}(e,t);setHours=(e,t)=>function(e,t,n){const r=RO(e,n?.in);return r.setHours(t),r}(e,t);setMinutes=(e,t)=>function(e,t,n){const r=RO(e,n?.in);return r.setMinutes(t),r}(e,t);setSeconds=(e,t)=>function(e,t,n){const r=RO(e,n?.in);return r.setSeconds(t),r}(e,t);setMilliseconds=(e,t)=>function(e,t,n){const r=RO(e,n?.in);return r.setMilliseconds(t),r}(e,t);getDaysInMonth=e=>PA(e);getWeekArray=e=>{const t=this.startOfWeek(this.startOfMonth(e)),n=this.endOfWeek(this.endOfMonth(e));let r=0,i=t;const o=[];for(;this.isBefore(i,n);){const e=Math.floor(r/7);o[e]=o[e]||[],o[e].push(i),i=this.addDays(i,1),r+=1}return o};getWeekNumber=e=>rA(e,{locale:this.locale});getYearRange=([e,t])=>{const n=this.startOfYear(e),r=this.endOfYear(t),i=[];let o=n;for(;this.isBefore(o,r);)i.push(o),o=this.addYears(o,1);return i}}function zC(e,t){if(void 0!==e.one&&1===t)return e.one;const n=t%10,r=t%100;return 1===n&&11!==r?e.singularNominative.replace("{{count}}",String(t)):n>=2&&n<=4&&(r<10||r>20)?e.singularGenitive.replace("{{count}}",String(t)):e.pluralGenitive.replace("{{count}}",String(t))}function FC(e){return(t,n)=>n?.addSuffix?n.comparison&&n.comparison>0?e.future?zC(e.future,t):"через "+zC(e.regular,t):e.past?zC(e.past,t):zC(e.regular,t)+" назад":zC(e.regular,t)}const LC={lessThanXSeconds:FC({regular:{one:"меньше секунды",singularNominative:"меньше {{count}} секунды",singularGenitive:"меньше {{count}} секунд",pluralGenitive:"меньше {{count}} секунд"},future:{one:"меньше, чем через секунду",singularNominative:"меньше, чем через {{count}} секунду",singularGenitive:"меньше, чем через {{count}} секунды",pluralGenitive:"меньше, чем через {{count}} секунд"}}),xSeconds:FC({regular:{singularNominative:"{{count}} секунда",singularGenitive:"{{count}} секунды",pluralGenitive:"{{count}} секунд"},past:{singularNominative:"{{count}} секунду назад",singularGenitive:"{{count}} секунды назад",pluralGenitive:"{{count}} секунд назад"},future:{singularNominative:"через {{count}} секунду",singularGenitive:"через {{count}} секунды",pluralGenitive:"через {{count}} секунд"}}),halfAMinute:(e,t)=>t?.addSuffix?t.comparison&&t.comparison>0?"через полминуты":"полминуты назад":"полминуты",lessThanXMinutes:FC({regular:{one:"меньше минуты",singularNominative:"меньше {{count}} минуты",singularGenitive:"меньше {{count}} минут",pluralGenitive:"меньше {{count}} минут"},future:{one:"меньше, чем через минуту",singularNominative:"меньше, чем через {{count}} минуту",singularGenitive:"меньше, чем через {{count}} минуты",pluralGenitive:"меньше, чем через {{count}} минут"}}),xMinutes:FC({regular:{singularNominative:"{{count}} минута",singularGenitive:"{{count}} минуты",pluralGenitive:"{{count}} минут"},past:{singularNominative:"{{count}} минуту назад",singularGenitive:"{{count}} минуты назад",pluralGenitive:"{{count}} минут назад"},future:{singularNominative:"через {{count}} минуту",singularGenitive:"через {{count}} минуты",pluralGenitive:"через {{count}} минут"}}),aboutXHours:FC({regular:{singularNominative:"около {{count}} часа",singularGenitive:"около {{count}} часов",pluralGenitive:"около {{count}} часов"},future:{singularNominative:"приблизительно через {{count}} час",singularGenitive:"приблизительно через {{count}} часа",pluralGenitive:"приблизительно через {{count}} часов"}}),xHours:FC({regular:{singularNominative:"{{count}} час",singularGenitive:"{{count}} часа",pluralGenitive:"{{count}} часов"}}),xDays:FC({regular:{singularNominative:"{{count}} день",singularGenitive:"{{count}} дня",pluralGenitive:"{{count}} дней"}}),aboutXWeeks:FC({regular:{singularNominative:"около {{count}} недели",singularGenitive:"около {{count}} недель",pluralGenitive:"около {{count}} недель"},future:{singularNominative:"приблизительно через {{count}} неделю",singularGenitive:"приблизительно через {{count}} недели",pluralGenitive:"приблизительно через {{count}} недель"}}),xWeeks:FC({regular:{singularNominative:"{{count}} неделя",singularGenitive:"{{count}} недели",pluralGenitive:"{{count}} недель"}}),aboutXMonths:FC({regular:{singularNominative:"около {{count}} месяца",singularGenitive:"около {{count}} месяцев",pluralGenitive:"около {{count}} месяцев"},future:{singularNominative:"приблизительно через {{count}} месяц",singularGenitive:"приблизительно через {{count}} месяца",pluralGenitive:"приблизительно через {{count}} месяцев"}}),xMonths:FC({regular:{singularNominative:"{{count}} месяц",singularGenitive:"{{count}} месяца",pluralGenitive:"{{count}} месяцев"}}),aboutXYears:FC({regular:{singularNominative:"около {{count}} года",singularGenitive:"около {{count}} лет",pluralGenitive:"около {{count}} лет"},future:{singularNominative:"приблизительно через {{count}} год",singularGenitive:"приблизительно через {{count}} года",pluralGenitive:"приблизительно через {{count}} лет"}}),xYears:FC({regular:{singularNominative:"{{count}} год",singularGenitive:"{{count}} года",pluralGenitive:"{{count}} лет"}}),overXYears:FC({regular:{singularNominative:"больше {{count}} года",singularGenitive:"больше {{count}} лет",pluralGenitive:"больше {{count}} лет"},future:{singularNominative:"больше, чем через {{count}} год",singularGenitive:"больше, чем через {{count}} года",pluralGenitive:"больше, чем через {{count}} лет"}}),almostXYears:FC({regular:{singularNominative:"почти {{count}} год",singularGenitive:"почти {{count}} года",pluralGenitive:"почти {{count}} лет"},future:{singularNominative:"почти через {{count}} год",singularGenitive:"почти через {{count}} года",pluralGenitive:"почти через {{count}} лет"}})},jC={date:jO({formats:{full:"EEEE, d MMMM y 'г.'",long:"d MMMM y 'г.'",medium:"d MMM y 'г.'",short:"dd.MM.y"},defaultWidth:"full"}),time:jO({formats:{full:"H:mm:ss zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},defaultWidth:"full"}),dateTime:jO({formats:{any:"{{date}}, {{time}}"},defaultWidth:"any"})};function $C(e,t,n){const[r,i]=YO(n?.in,e,t);return+JO(r,n)===+JO(i,n)}const BC=["воскресенье","понедельник","вторник","среду","четверг","пятницу","субботу"];function VC(e){const t=BC[e];return 2===e?"'во "+t+" в' p":"'в "+t+" в' p"}const UC={lastWeek:(e,t,n)=>{const r=e.getDay();return $C(e,t,n)?VC(r):function(e){const t=BC[e];switch(e){case 0:return"'в прошлое "+t+" в' p";case 1:case 2:case 4:return"'в прошлый "+t+" в' p";case 3:case 5:case 6:return"'в прошлую "+t+" в' p"}}(r)},yesterday:"'вчера в' p",today:"'сегодня в' p",tomorrow:"'завтра в' p",nextWeek:(e,t,n)=>{const r=e.getDay();return $C(e,t,n)?VC(r):function(e){const t=BC[e];switch(e){case 0:return"'в следующее "+t+" в' p";case 1:case 2:case 4:return"'в следующий "+t+" в' p";case 3:case 5:case 6:return"'в следующую "+t+" в' p"}}(r)},other:"P"},WC={ordinalNumber:(e,t)=>{const n=Number(e),r=t?.unit;let i;return i="date"===r?"-е":"week"===r||"minute"===r||"second"===r?"-я":"-й",n+i},era:VO({values:{narrow:["до н.э.","н.э."],abbreviated:["до н. э.","н. э."],wide:["до нашей эры","нашей эры"]},defaultWidth:"wide"}),quarter:VO({values:{narrow:["1","2","3","4"],abbreviated:["1-й кв.","2-й кв.","3-й кв.","4-й кв."],wide:["1-й квартал","2-й квартал","3-й квартал","4-й квартал"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:VO({values:{narrow:["Я","Ф","М","А","М","И","И","А","С","О","Н","Д"],abbreviated:["янв.","фев.","март","апр.","май","июнь","июль","авг.","сент.","окт.","нояб.","дек."],wide:["январь","февраль","март","апрель","май","июнь","июль","август","сентябрь","октябрь","ноябрь","декабрь"]},defaultWidth:"wide",formattingValues:{narrow:["Я","Ф","М","А","М","И","И","А","С","О","Н","Д"],abbreviated:["янв.","фев.","мар.","апр.","мая","июн.","июл.","авг.","сент.","окт.","нояб.","дек."],wide:["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"]},defaultFormattingWidth:"wide"}),day:VO({values:{narrow:["В","П","В","С","Ч","П","С"],short:["вс","пн","вт","ср","чт","пт","сб"],abbreviated:["вск","пнд","втр","срд","чтв","птн","суб"],wide:["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"]},defaultWidth:"wide"}),dayPeriod:VO({values:{narrow:{am:"ДП",pm:"ПП",midnight:"полн.",noon:"полд.",morning:"утро",afternoon:"день",evening:"веч.",night:"ночь"},abbreviated:{am:"ДП",pm:"ПП",midnight:"полн.",noon:"полд.",morning:"утро",afternoon:"день",evening:"веч.",night:"ночь"},wide:{am:"ДП",pm:"ПП",midnight:"полночь",noon:"полдень",morning:"утро",afternoon:"день",evening:"вечер",night:"ночь"}},defaultWidth:"any",formattingValues:{narrow:{am:"ДП",pm:"ПП",midnight:"полн.",noon:"полд.",morning:"утра",afternoon:"дня",evening:"веч.",night:"ночи"},abbreviated:{am:"ДП",pm:"ПП",midnight:"полн.",noon:"полд.",morning:"утра",afternoon:"дня",evening:"веч.",night:"ночи"},wide:{am:"ДП",pm:"ПП",midnight:"полночь",noon:"полдень",morning:"утра",afternoon:"дня",evening:"вечера",night:"ночи"}},defaultFormattingWidth:"wide"})},qC={code:"ru",formatDistance:(e,t,n)=>LC[e](t,n),formatLong:jC,formatRelative:(e,t,n,r)=>{const i=UC[e];return"function"==typeof i?i(t,n,r):i},localize:WC,match:{ordinalNumber:qO({matchPattern:/^(\d+)(-?(е|я|й|ое|ье|ая|ья|ый|ой|ий|ый))?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:WO({matchPatterns:{narrow:/^((до )?н\.?\s?э\.?)/i,abbreviated:/^((до )?н\.?\s?э\.?)/i,wide:/^(до нашей эры|нашей эры|наша эра)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^д/i,/^н/i]},defaultParseWidth:"any"}),quarter:WO({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^[1234](-?[ыои]?й?)? кв.?/i,wide:/^[1234](-?[ыои]?й?)? квартал/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:WO({matchPatterns:{narrow:/^[яфмаисонд]/i,abbreviated:/^(янв|фев|март?|апр|ма[йя]|июн[ья]?|июл[ья]?|авг|сент?|окт|нояб?|дек)\.?/i,wide:/^(январ[ья]|феврал[ья]|марта?|апрел[ья]|ма[йя]|июн[ья]|июл[ья]|августа?|сентябр[ья]|октябр[ья]|октябр[ья]|ноябр[ья]|декабр[ья])/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^я/i,/^ф/i,/^м/i,/^а/i,/^м/i,/^и/i,/^и/i,/^а/i,/^с/i,/^о/i,/^н/i,/^я/i],any:[/^я/i,/^ф/i,/^мар/i,/^ап/i,/^ма[йя]/i,/^июн/i,/^июл/i,/^ав/i,/^с/i,/^о/i,/^н/i,/^д/i]},defaultParseWidth:"any"}),day:WO({matchPatterns:{narrow:/^[впсч]/i,short:/^(вс|во|пн|по|вт|ср|чт|че|пт|пя|сб|су)\.?/i,abbreviated:/^(вск|вос|пнд|пон|втр|вто|срд|сре|чтв|чет|птн|пят|суб).?/i,wide:/^(воскресень[ея]|понедельника?|вторника?|сред[аы]|четверга?|пятниц[аы]|суббот[аы])/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^в/i,/^п/i,/^в/i,/^с/i,/^ч/i,/^п/i,/^с/i],any:[/^в[ос]/i,/^п[он]/i,/^в/i,/^ср/i,/^ч/i,/^п[ят]/i,/^с[уб]/i]},defaultParseWidth:"any"}),dayPeriod:WO({matchPatterns:{narrow:/^([дп]п|полн\.?|полд\.?|утр[оа]|день|дня|веч\.?|ноч[ьи])/i,abbreviated:/^([дп]п|полн\.?|полд\.?|утр[оа]|день|дня|веч\.?|ноч[ьи])/i,wide:/^([дп]п|полночь|полдень|утр[оа]|день|дня|вечера?|ноч[ьи])/i},defaultMatchWidth:"wide",parsePatterns:{any:{am:/^дп/i,pm:/^пп/i,midnight:/^полн/i,noon:/^полд/i,morning:/^у/i,afternoon:/^д[ен]/i,evening:/^в/i,night:/^н/i}},defaultParseWidth:"any"})},options:{weekStartsOn:1,firstWeekContainsDate:1}},GC=t=>e(TO,{...t,dateAdapter:IC,adapterLocale:qC});function HC(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=HC(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function YC(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=HC(e))&&(r&&(r+=" "),r+=t);return r}let KC={data:""},XC=e=>{if("object"==typeof window){let t=(e?e.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return t.nonce=window.__nonce__,t.parentNode||(e||document.head).appendChild(t),t.firstChild}return e||KC},ZC=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,JC=/\/\*[^]*?\*\/| +/g,QC=/\n+/g,eR=(e,t)=>{let n="",r="",i="";for(let o in e){let s=e[o];"@"==o[0]?"i"==o[1]?n=o+" "+s+";":r+="f"==o[1]?eR(s,o):o+"{"+eR(s,"k"==o[1]?"":t)+"}":"object"==typeof s?r+=eR(s,t?t.replace(/([^,])+/g,e=>o.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,t=>/&/.test(t)?t.replace(/&/g,e):e?e+" "+t:t)):o):null!=s&&(o=/^--/.test(o)?o:o.replace(/[A-Z]/g,"-$&").toLowerCase(),i+=eR.p?eR.p(o,s):o+":"+s+";")}return n+(t&&i?t+"{"+i+"}":i)+r},tR={},nR=e=>{if("object"==typeof e){let t="";for(let n in e)t+=n+nR(e[n]);return t}return e},rR=(e,t,n,r,i)=>{let o=nR(e),s=tR[o]||(tR[o]=(e=>{let t=0,n=11;for(;t<e.length;)n=101*n+e.charCodeAt(t++)>>>0;return"go"+n})(o));if(!tR[s]){let t=o!==e?e:(e=>{let t,n,r=[{}];for(;t=ZC.exec(e.replace(JC,""));)t[4]?r.shift():t[3]?(n=t[3].replace(QC," ").trim(),r.unshift(r[0][n]=r[0][n]||{})):r[0][t[1]]=t[2].replace(QC," ").trim();return r[0]})(e);tR[s]=eR(i?{["@keyframes "+s]:t}:t,n?"":"."+s)}let a=n&&tR.g?tR.g:null;return n&&(tR.g=tR[s]),((e,t,n,r)=>{r?t.data=t.data.replace(r,e):-1===t.data.indexOf(e)&&(t.data=n?e+t.data:t.data+e)})(tR[s],t,r,a),s};function iR(e){let t=this||{},n=e.call?e(t.p):e;return rR(n.unshift?n.raw?((e,t,n)=>e.reduce((e,r,i)=>{let o=t[i];if(o&&o.call){let e=o(n),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;o=t?"."+t:e&&"object"==typeof e?e.props?"":eR(e,""):!1===e?"":e}return e+r+(null==o?"":o)},""))(n,[].slice.call(arguments,1),t.p):n.reduce((e,n)=>Object.assign(e,n&&n.call?n(t.p):n),{}):n,XC(t.target),t.g,t.o,t.k)}function oR(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function sR(){return sR=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},sR.apply(this,arguments)}function aR(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function lR(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}function uR(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}iR.bind({g:1}),iR.bind({k:1});var cR=function(){return""},dR=r.createContext({enqueueSnackbar:cR,closeSnackbar:cR}),hR="@media (max-width:599.95px)",pR="@media (min-width:600px)",fR=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},mR=function(e){return""+fR(e.vertical)+fR(e.horizontal)},gR=function(e){return!!e||0===e},yR="unmounted",bR="exited",vR="entering",_R="entered",xR="exiting",wR=function(e){function t(t){var n;n=e.call(this,t)||this;var r,i=t.appear;return n.appearStatus=null,t.in?i?(r=bR,n.appearStatus=vR):r=_R:r=t.unmountOnExit||t.mountOnEnter?yR:bR,n.state={status:r},n.nextCallback=null,n}aR(t,e),t.getDerivedStateFromProps=function(e,t){return e.in&&t.status===yR?{status:bR}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(e){var t=null;if(e!==this.props){var n=this.state.status;this.props.in?n!==vR&&n!==_R&&(t=vR):n!==vR&&n!==_R||(t=xR)}this.updateStatus(!1,t)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var e=this.props.timeout,t=e,n=e;return null!=e&&"number"!=typeof e&&"string"!=typeof e&&(n=e.exit,t=e.enter),{exit:n,enter:t}},n.updateStatus=function(e,t){void 0===e&&(e=!1),null!==t?(this.cancelNextCallback(),t===vR?this.performEnter(e):this.performExit()):this.props.unmountOnExit&&this.state.status===bR&&this.setState({status:yR})},n.performEnter=function(e){var t=this,n=this.props.enter,r=e,i=this.getTimeouts();e||n?(this.props.onEnter&&this.props.onEnter(this.node,r),this.safeSetState({status:vR},function(){t.props.onEntering&&t.props.onEntering(t.node,r),t.onTransitionEnd(i.enter,function(){t.safeSetState({status:_R},function(){t.props.onEntered&&t.props.onEntered(t.node,r)})})})):this.safeSetState({status:_R},function(){t.props.onEntered&&t.props.onEntered(t.node,r)})},n.performExit=function(){var e=this,t=this.props.exit,n=this.getTimeouts();t?(this.props.onExit&&this.props.onExit(this.node),this.safeSetState({status:xR},function(){e.props.onExiting&&e.props.onExiting(e.node),e.onTransitionEnd(n.exit,function(){e.safeSetState({status:bR},function(){e.props.onExited&&e.props.onExited(e.node)})})})):this.safeSetState({status:bR},function(){e.props.onExited&&e.props.onExited(e.node)})},n.cancelNextCallback=function(){null!==this.nextCallback&&this.nextCallback.cancel&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},n.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(){n&&(n=!1,t.nextCallback=null,e())},this.nextCallback.cancel=function(){n=!1},this.nextCallback},n.onTransitionEnd=function(e,t){this.setNextCallback(t);var n=null==e&&!this.props.addEndListener;this.node&&!n?(this.props.addEndListener&&this.props.addEndListener(this.node,this.nextCallback),null!=e&&setTimeout(this.nextCallback,e)):setTimeout(this.nextCallback,0)},n.render=function(){var e=this.state.status;if(e===yR)return null;var t=this.props;return(0,t.children)(e,lR(t,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]))},oR(t,[{key:"node",get:function(){var e,t=null===(e=this.props.nodeRef)||void 0===e?void 0:e.current;if(!t)throw new Error("notistack - Custom snackbar is not refForwarding");return t}}]),t}(r.Component);function ER(){}function SR(e,t){"function"==typeof e?e(t):e&&(e.current=t)}function TR(e,t){return f(function(){return null==e&&null==t?null:function(n){SR(e,n),SR(t,n)}},[e,t])}function kR(e){var t=e.timeout,n=e.style,r=void 0===n?{}:n,i=e.mode;return{duration:"object"==typeof t?t[i]||0:t,easing:r.transitionTimingFunction,delay:r.transitionDelay}}wR.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:ER,onEntering:ER,onEntered:ER,onExit:ER,onExiting:ER,onExited:ER};var OR="cubic-bezier(0.4, 0, 0.2, 1)",AR="cubic-bezier(0.0, 0, 0.2, 1)",CR="cubic-bezier(0.4, 0, 0.6, 1)",RR=function(e){e.scrollTop=e.scrollTop},NR=function(e){return Math.round(e)+"ms"};function PR(e,t){void 0===e&&(e=["all"]);var n=t||{},r=n.duration,i=void 0===r?300:r,o=n.easing,s=void 0===o?OR:o,a=n.delay,l=void 0===a?0:a;return(Array.isArray(e)?e:[e]).map(function(e){var t="string"==typeof i?i:NR(i),n="string"==typeof l?l:NR(l);return e+" "+t+" "+s+" "+n}).join(",")}function MR(e){var t=function(e){return e&&e.ownerDocument||document}(e);return t.defaultView||window}function DR(e,t){if(t){var n=function(e,t){var n,r=t.getBoundingClientRect(),i=MR(t);if(t.fakeTransform)n=t.fakeTransform;else{var o=i.getComputedStyle(t);n=o.getPropertyValue("-webkit-transform")||o.getPropertyValue("transform")}var s=0,a=0;if(n&&"none"!==n&&"string"==typeof n){var l=n.split("(")[1].split(")")[0].split(",");s=parseInt(l[4],10),a=parseInt(l[5],10)}switch(e){case"left":return"translateX("+(i.innerWidth+s-r.left)+"px)";case"right":return"translateX(-"+(r.left+r.width-s)+"px)";case"up":return"translateY("+(i.innerHeight+a-r.top)+"px)";default:return"translateY(-"+(r.top+r.height-a)+"px)"}}(e,t);n&&(t.style.webkitTransform=n,t.style.transform=n)}}var IR=i(function(e,t){var n=e.children,r=e.direction,i=void 0===r?"down":r,o=e.in,s=e.style,l=e.timeout,u=void 0===l?0:l,c=e.onEnter,d=e.onEntered,f=e.onExit,g=e.onExited,y=lR(e,["children","direction","in","style","timeout","onEnter","onEntered","onExit","onExited"]),b=p(null),_=TR(n.ref,b),x=TR(_,t),w=m(function(){b.current&&DR(i,b.current)},[i]);return h(function(){if(!o&&"down"!==i&&"right"!==i){var e=function(e,t){var n;function r(){for(var r=this,i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];clearTimeout(n),n=setTimeout(function(){e.apply(r,o)},t)}return void 0===t&&(t=166),r.clear=function(){clearTimeout(n)},r}(function(){b.current&&DR(i,b.current)}),t=MR(b.current);return t.addEventListener("resize",e),function(){e.clear(),t.removeEventListener("resize",e)}}},[i,o]),h(function(){o||w()},[o,w]),v(wR,Object.assign({appear:!0,nodeRef:b,onEnter:function(e,t){DR(i,e),RR(e),c&&c(e,t)},onEntered:d,onEntering:function(e){var t=(null==s?void 0:s.transitionTimingFunction)||AR,n=kR({timeout:u,mode:"enter",style:sR({},s,{transitionTimingFunction:t})});e.style.webkitTransition=PR("-webkit-transform",n),e.style.transition=PR("transform",n),e.style.webkitTransform="none",e.style.transform="none"},onExit:function(e){var t=(null==s?void 0:s.transitionTimingFunction)||CR,n=kR({timeout:u,mode:"exit",style:sR({},s,{transitionTimingFunction:t})});e.style.webkitTransition=PR("-webkit-transform",n),e.style.transition=PR("transform",n),DR(i,e),f&&f(e)},onExited:function(e){e.style.webkitTransition="",e.style.transition="",g&&g(e)},in:o,timeout:u},y),function(e,t){return a(n,sR({ref:x,style:sR({visibility:"exited"!==e||o?void 0:"hidden"},s,{},n.props.style)},t))})});IR.displayName="Slide";var zR=function(e){return r.createElement("svg",Object.assign({viewBox:"0 0 24 24",focusable:"false",style:{fontSize:20,marginInlineEnd:8,userSelect:"none",width:"1em",height:"1em",display:"inline-block",fill:"currentColor",flexShrink:0}},e))},FR=function(){return r.createElement(zR,null,r.createElement("path",{d:"M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M10 17L5 12L6.41\n 10.59L10 14.17L17.59 6.58L19 8L10 17Z"}))},LR=function(){return r.createElement(zR,null,r.createElement("path",{d:"M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z"}))},jR=function(){return r.createElement(zR,null,r.createElement("path",{d:"M12,2C17.53,2 22,6.47 22,12C22,17.53 17.53,22 12,22C6.47,22 2,17.53 2,12C2,\n 6.47 6.47,2 12,2M15.59,7L12,10.59L8.41,7L7,8.41L10.59,12L7,15.59L8.41,17L12,\n 13.41L15.59,17L17,15.59L13.41,12L17,8.41L15.59,7Z"}))},$R=function(){return r.createElement(zR,null,r.createElement("path",{d:"M13,9H11V7H13M13,17H11V11H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,\n 0 22,12A10,10 0 0,0 12,2Z"}))},BR={maxSnack:3,persist:!1,hideIconVariant:!1,disableWindowBlurListener:!1,variant:"default",autoHideDuration:5e3,iconVariant:{default:void 0,success:r.createElement(FR,null),warning:r.createElement(LR,null),error:r.createElement(jR,null),info:r.createElement($R,null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},TransitionComponent:IR,transitionDuration:{enter:225,exit:195}},VR=function(e,t){return function(n,r){return void 0===r&&(r=!1),r?sR({},BR[n],{},t[n],{},e[n]):"autoHideDuration"===n?(i=e.autoHideDuration,o=t.autoHideDuration,(s=function(e){return"number"==typeof e||null===e})(i)?i:s(o)?o:BR.autoHideDuration):"transitionDuration"===n?function(e,t){var n=function(e,t){return t.some(function(t){return typeof e===t})};return n(e,["string","number"])?e:n(e,["object"])?sR({},BR.transitionDuration,{},n(t,["object"])&&t,{},e):n(t,["string","number"])?t:n(t,["object"])?sR({},BR.transitionDuration,{},t):BR.transitionDuration}(e.transitionDuration,t.transitionDuration):e[n]||t[n]||BR[n];var i,o,s}};function UR(e){return Object.entries(e).reduce(function(e,t){var n,r=t[0],i=t[1];return sR({},e,((n={})[r]=iR(i),n))},{})}var WR="notistack-SnackbarContainer",qR="notistack-Snackbar",GR="notistack-CollapseWrapper",HR="notistack-MuiContent",YR=function(e){return"notistack-MuiContent-"+e},KR=UR({root:{height:0},entered:{height:"auto"}}),XR="0px",ZR=i(function(e,t){var n=e.children,r=e.in,i=e.onExited,o=p(null),s=p(null),a=TR(t,s),l=function(){return o.current?o.current.clientHeight:0};return v(wR,{in:r,unmountOnExit:!0,onEnter:function(e){e.style.height=XR},onEntered:function(e){e.style.height="auto"},onEntering:function(e){var t=l(),n=kR({timeout:175,mode:"enter"}),r=n.duration,i=n.easing;e.style.transitionDuration="string"==typeof r?r:r+"ms",e.style.height=t+"px",e.style.transitionTimingFunction=i||""},onExit:function(e){e.style.height=l()+"px"},onExited:i,onExiting:function(e){RR(e);var t=kR({timeout:175,mode:"exit"}),n=t.duration,r=t.easing;e.style.transitionDuration="string"==typeof n?n:n+"ms",e.style.height=XR,e.style.transitionTimingFunction=r||""},nodeRef:s,timeout:175},function(e,t){return v("div",Object.assign({ref:a,className:YC(KR.root,"entered"===e&&KR.entered),style:sR({pointerEvents:"all",overflow:"hidden",minHeight:XR,transition:PR("height")},"entered"===e&&{overflow:"visible"},{},"exited"===e&&!r&&{visibility:"hidden"})},t),v("div",{ref:o,className:GR,style:{display:"flex",width:"100%"}},n))})});ZR.displayName="Collapse";var JR={right:"left",left:"right",bottom:"up",top:"down"},QR=function(e){return"anchorOrigin"+mR(e)},eN=function(){};function tN(e,t){return e.reduce(function(e,n){return null==n?e:function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];var s=[].concat(i);t&&-1===s.indexOf(t)&&s.push(t),e.apply(this,s),n.apply(this,s)}},eN)}var nN="undefined"!=typeof window?d:h;function rN(e){var t=p(e);return nN(function(){t.current=e}),m(function(){return t.current.apply(void 0,arguments)},[])}var iN,oN=i(function(e,t){var n=e.children,r=e.className,i=e.autoHideDuration,o=e.disableWindowBlurListener,s=void 0!==o&&o,a=e.onClose,l=e.id,u=e.open,c=e.SnackbarProps,d=void 0===c?{}:c,f=p(),g=rN(function(){a&&a.apply(void 0,arguments)}),y=rN(function(e){a&&null!=e&&(f.current&&clearTimeout(f.current),f.current=setTimeout(function(){g(null,"timeout",l)},e))});h(function(){return u&&y(i),function(){f.current&&clearTimeout(f.current)}},[u,i,y]);var b=function(){f.current&&clearTimeout(f.current)},_=m(function(){null!=i&&y(.5*i)},[i,y]);return h(function(){if(!s&&u)return window.addEventListener("focus",_),window.addEventListener("blur",b),function(){window.removeEventListener("focus",_),window.removeEventListener("blur",b)}},[s,_,u]),v("div",Object.assign({ref:t},d,{className:YC(qR,r),onMouseEnter:function(e){d.onMouseEnter&&d.onMouseEnter(e),b()},onMouseLeave:function(e){d.onMouseLeave&&d.onMouseLeave(e),_()}}),n)});oN.displayName="Snackbar";var sN=UR({root:(iN={display:"flex",flexWrap:"wrap",flexGrow:1},iN[pR]={flexGrow:"initial",minWidth:"288px"},iN)}),aN=i(function(e,t){var n=e.className,i=lR(e,["className"]);return r.createElement("div",Object.assign({ref:t,className:YC(sN.root,n)},i))});aN.displayName="SnackbarContent";var lN=UR({root:{backgroundColor:"#313131",fontSize:"0.875rem",lineHeight:1.43,letterSpacing:"0.01071em",color:"#fff",alignItems:"center",padding:"6px 16px",borderRadius:"4px",boxShadow:"0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)"},lessPadding:{paddingLeft:"20px"},default:{backgroundColor:"#313131"},success:{backgroundColor:"#43a047"},error:{backgroundColor:"#d32f2f"},warning:{backgroundColor:"#ff9800"},info:{backgroundColor:"#2196f3"},message:{display:"flex",alignItems:"center",padding:"8px 0"},action:{display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:"16px",marginRight:"-8px"}}),uN="notistack-snackbar",cN=i(function(e,t){var n=e.id,i=e.message,o=e.action,s=e.iconVariant,a=e.variant,l=e.hideIconVariant,u=e.style,c=e.className,d=s[a],h=o;return"function"==typeof h&&(h=h(n)),r.createElement(aN,{ref:t,role:"alert","aria-describedby":uN,style:u,className:YC(HR,YR(a),lN.root,lN[a],c,!l&&d&&lN.lessPadding)},r.createElement("div",{id:uN,className:lN.message},l?null:d,i),h&&r.createElement("div",{className:lN.action},h))});cN.displayName="MaterialDesignContent";var dN,hN,pN,fN,mN,gN=c(cN),yN=UR({wrappedRoot:{width:"100%",position:"relative",transform:"translateX(0)",top:0,right:0,bottom:0,left:0,minWidth:"288px"}}),bN=function(e){var t=p(),n=u(!0),i=n[0],o=n[1],s=tN([e.snack.onClose,e.onClose]),a=m(function(){t.current=setTimeout(function(){o(function(e){return!e})},125)},[]);h(function(){return function(){t.current&&clearTimeout(t.current)}},[]);var l,c=e.snack,d=e.classes,g=e.Component,y=void 0===g?gN:g,b=f(function(){return function(e){void 0===e&&(e={});var t={containerRoot:!0,containerAnchorOriginTopCenter:!0,containerAnchorOriginBottomCenter:!0,containerAnchorOriginTopRight:!0,containerAnchorOriginBottomRight:!0,containerAnchorOriginTopLeft:!0,containerAnchorOriginBottomLeft:!0};return Object.keys(e).filter(function(e){return!t[e]}).reduce(function(t,n){var r;return sR({},t,((r={})[n]=e[n],r))},{})}(d)},[d]),v=c.open,_=c.SnackbarProps,x=c.TransitionComponent,w=c.TransitionProps,E=c.transitionDuration,S=c.disableWindowBlurListener,T=c.content,k=lR(c,["open","SnackbarProps","TransitionComponent","TransitionProps","transitionDuration","disableWindowBlurListener","content","entered","requestClose","onEnter","onEntered","onExit","onExited"]),O=sR({direction:(l=k.anchorOrigin,"center"!==l.horizontal?JR[l.horizontal]:JR[l.vertical]),timeout:E},w),A=T;"function"==typeof A&&(A=A(k.id,k.message));var C=["onEnter","onEntered","onExit","onExited"].reduce(function(t,n){var r;return sR({},t,((r={})[n]=tN([e.snack[n],e[n]],k.id),r))},{});return r.createElement(ZR,{in:i,onExited:C.onExited},r.createElement(oN,{open:v,id:k.id,disableWindowBlurListener:S,autoHideDuration:k.autoHideDuration,className:YC(yN.wrappedRoot,b.root,b[QR(k.anchorOrigin)]),SnackbarProps:_,onClose:s},r.createElement(x,Object.assign({},O,{appear:!0,in:v,onExit:C.onExit,onExited:a,onEnter:C.onEnter,onEntered:tN([C.onEntered,function(){e.snack.requestClose&&s(null,"instructed",e.snack.id)}],k.id)}),A||r.createElement(y,Object.assign({},k)))))},vN={default:20},_N={default:6,dense:2},xN="."+GR,wN=UR({root:(dN={boxSizing:"border-box",display:"flex",maxHeight:"100%",position:"fixed",zIndex:1400,height:"auto",width:"auto",transition:PR(["top","right","bottom","left","max-width"],{duration:300,easing:"ease"}),pointerEvents:"none"},dN[xN]={padding:_N.default+"px 0px",transition:"padding 300ms ease 0ms"},dN.maxWidth="calc(100% - "+2*vN.default+"px)",dN[hR]={width:"100%",maxWidth:"calc(100% - 32px)"},dN),rootDense:(hN={},hN[xN]={padding:_N.dense+"px 0px"},hN),top:{top:vN.default-_N.default+"px",flexDirection:"column"},bottom:{bottom:vN.default-_N.default+"px",flexDirection:"column-reverse"},left:(pN={left:vN.default+"px"},pN[pR]={alignItems:"flex-start"},pN[hR]={left:"16px"},pN),right:(fN={right:vN.default+"px"},fN[pR]={alignItems:"flex-end"},fN[hR]={right:"16px"},fN),center:(mN={left:"50%",transform:"translateX(-50%)"},mN[pR]={alignItems:"center"},mN)}),EN=function(e){var t=e.classes,n=void 0===t?{}:t,i=e.anchorOrigin,o=e.dense,s=e.children,a=YC(WR,wN[i.vertical],wN[i.horizontal],wN.root,n.containerRoot,n["containerAnchorOrigin"+mR(i)],o&&wN.rootDense);return r.createElement("div",{className:a},s)},SN=c(EN),TN="production"!==process.env.NODE_ENV,kN={NO_PERSIST_ALL:"Reached maxSnack while all enqueued snackbars have 'persist' flag. Notistack will dismiss the oldest snackbar anyway to allow other ones in the queue to be presented."},ON=function(e){return!("string"==typeof e||s(e))},AN=function(e){function t(t){var n;return(n=e.call(this,t)||this).enqueueSnackbar=function(e,t){if(void 0===t&&(t={}),null==e)throw new Error("enqueueSnackbar called with invalid argument");var r=ON(e)?e:t,i=ON(e)?e.message:e,o=r.key,s=r.preventDuplicate,a=lR(r,["key","preventDuplicate"]),l=gR(o),u=l?o:(new Date).getTime()+Math.random(),c=VR(a,n.props),d=sR({id:u},a,{message:i,open:!0,entered:!1,requestClose:!1,persist:c("persist"),action:c("action"),content:c("content"),variant:c("variant"),anchorOrigin:c("anchorOrigin"),disableWindowBlurListener:c("disableWindowBlurListener"),autoHideDuration:c("autoHideDuration"),hideIconVariant:c("hideIconVariant"),TransitionComponent:c("TransitionComponent"),transitionDuration:c("transitionDuration"),TransitionProps:c("TransitionProps",!0),iconVariant:c("iconVariant",!0),style:c("style",!0),SnackbarProps:c("SnackbarProps",!0),className:YC(n.props.className,a.className)});return d.persist&&(d.autoHideDuration=void 0),n.setState(function(e){if(void 0===s&&n.props.preventDuplicate||s){var t=function(e){return l?e.id===u:e.message===i},r=e.queue.findIndex(t)>-1,o=e.snacks.findIndex(t)>-1;if(r||o)return e}return n.handleDisplaySnack(sR({},e,{queue:[].concat(e.queue,[d])}))}),u},n.handleDisplaySnack=function(e){return e.snacks.length>=n.maxSnack?n.handleDismissOldest(e):n.processQueue(e)},n.processQueue=function(e){var t=e.queue,n=e.snacks;return t.length>0?sR({},e,{snacks:[].concat(n,[t[0]]),queue:t.slice(1,t.length)}):e},n.handleDismissOldest=function(e){if(e.snacks.some(function(e){return!e.open||e.requestClose}))return e;var t=!1,r=!1;e.snacks.reduce(function(e,t){return e+(t.open&&t.persist?1:0)},0)===n.maxSnack&&("production"!==process.env.NODE_ENV&&function(e){if(TN){var t=kN[e];"undefined"!=typeof console&&console.error("WARNING - notistack: "+t);try{throw new Error(t)}catch(e){}}}("NO_PERSIST_ALL"),r=!0);var i=e.snacks.map(function(e){return t||e.persist&&!r?sR({},e):(t=!0,e.entered?(e.onClose&&e.onClose(null,"maxsnack",e.id),n.props.onClose&&n.props.onClose(null,"maxsnack",e.id),sR({},e,{open:!1})):sR({},e,{requestClose:!0}))});return sR({},e,{snacks:i})},n.handleEnteredSnack=function(e,t,r){if(!gR(r))throw new Error("handleEnteredSnack Cannot be called with undefined key");n.setState(function(e){return{snacks:e.snacks.map(function(e){return e.id===r?sR({},e,{entered:!0}):sR({},e)})}})},n.handleCloseSnack=function(e,t,r){n.props.onClose&&n.props.onClose(e,t,r);var i=void 0===r;n.setState(function(e){var t=e.snacks,n=e.queue;return{snacks:t.map(function(e){return i||e.id===r?e.entered?sR({},e,{open:!1}):sR({},e,{requestClose:!0}):sR({},e)}),queue:n.filter(function(e){return e.id!==r})}})},n.closeSnackbar=function(e){var t=n.state.snacks.find(function(t){return t.id===e});gR(e)&&t&&t.onClose&&t.onClose(null,"instructed",e),n.handleCloseSnack(null,"instructed",e)},n.handleExitedSnack=function(e,t){if(!gR(t))throw new Error("handleExitedSnack Cannot be called with undefined key");n.setState(function(e){var r=n.processQueue(sR({},e,{snacks:e.snacks.filter(function(e){return e.id!==t})}));return 0===r.queue.length?r:n.handleDismissOldest(r)})},n.enqueueSnackbar,n.closeSnackbar,n.state={snacks:[],queue:[],contextValue:{enqueueSnackbar:n.enqueueSnackbar.bind(uR(n)),closeSnackbar:n.closeSnackbar.bind(uR(n))}},n}return aR(t,e),t.prototype.render=function(){var e=this,t=this.state.contextValue,n=this.props,i=n.domRoot,o=n.children,s=n.dense,a=void 0!==s&&s,l=n.Components,u=void 0===l?{}:l,c=n.classes,d=this.state.snacks.reduce(function(e,t){var n,r=mR(t.anchorOrigin),i=e[r]||[];return sR({},e,((n={})[r]=[].concat(i,[t]),n))},{}),h=Object.keys(d).map(function(t){var n=d[t],i=n[0];return r.createElement(SN,{key:t,dense:a,anchorOrigin:i.anchorOrigin,classes:c},n.map(function(t){return r.createElement(bN,{key:t.id,snack:t,classes:c,Component:u[t.variant],onClose:e.handleCloseSnack,onEnter:e.props.onEnter,onExit:e.props.onExit,onExited:tN([e.handleExitedSnack,e.props.onExited],t.id),onEntered:tN([e.handleEnteredSnack,e.props.onEntered],t.id)})}))});return r.createElement(dR.Provider,{value:t},o,i?S(h,i):h)},oR(t,[{key:"maxSnack",get:function(){return this.props.maxSnack||BR.maxSnack}}]),t}(_);const CN=({children:t,configOptions:r})=>{const[i,o]=n.useState(null),[s,a]=n.useState("");return n.useEffect(()=>(PT.initialize({...r,onCheck:e=>{const{valid:t,reason:n}=e;a(n),o(t),r.onCheck?.(e)}}),()=>{PT.deactivate()}),[r]),null===i?e(Rk,{color:"primary"}):i?e(n.Fragment,{children:t}):e(dl,{color:"error",children:s})},RN=({children:t,themeOptions:n})=>{const r=us(n);return e(ws,{theme:r,children:t})},NN=({children:t,configOptions:n,themeOptions:r})=>e(AN,{children:e(wO,{children:e(AT,{children:e(RN,{themeOptions:r,children:e(GC,{children:e(CN,{configOptions:n,children:t})})})})})}),PN=()=>{const{enqueueSnackbar:e}=o(dR);return({variant:t,message:n})=>{e({variant:t,message:n,anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:3e3,hideIconVariant:!0})}},MN=()=>{const e=PN();return t=>{const{response:n}=t;if(n){const{data:t}=n;if(t){const{detail:n}=t;n&&n.forEach(t=>{e({variant:"error",message:t})})}}}},DN=e=>{const t=(new Date).getUTCHours();return encodeURIComponent([...e].reduce((n,r,i)=>{const o=(e.charCodeAt(i)-32+t)%95+32;return n+String.fromCharCode(o)},""))},IN=()=>_O({mutationKey:["sign-in"],mutationFn:({body:{username:e,password:t}})=>{const n={username:e,password:DN(t)},r=Object.keys(n).reduce((e,t,r)=>`${e}${0===r?"":"&"}${t}=${n[t]}`,"");return PT.instance.apiService.post({url:"token",body:r,config:{headers:{"Content-Type":"application/x-www-form-urlencoded"}}})}}),zN=()=>_O({mutationFn:async e=>await PT.instance.apiService.post({url:"logout"}),onError:MN(),onSuccess:()=>{xO.invalidateQueries({queryKey:["user"]})}}),FN=(e,t,n)=>{if(e&&"reportValidity"in e){const r=pv(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},LN=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?FN(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>FN(t,n,e))}},jN=(e,t)=>{t.shouldUseNativeValidation&&LN(e,t);const n={};for(const r in e){const i=pv(t.fields,r),o=Object.assign(e[r]||{},{ref:i&&i.ref});if($N(t.names||Object.keys(e),r)){const e=Object.assign({},pv(n,r));mv(e,"root",o),mv(n,r,e)}else mv(n,r,o)}return n},$N=(e,t)=>{const n=BN(t);return e.some(e=>BN(e).match(`^${n}\\.\\d+`))};function BN(e){return e.replace(/\]|\[/g,"")}function VN(e,t,n){return void 0===n&&(n={}),function(r,i,o){try{return Promise.resolve(function(s,a){try{var l=(null!=t&&t.context&&"development"===process.env.NODE_ENV&&console.warn("You should not used the yup options context. Please, use the 'useForm' context object instead"),Promise.resolve(e["sync"===n.mode?"validateSync":"validate"](r,Object.assign({abortEarly:!1},t,{context:i}))).then(function(e){return o.shouldUseNativeValidation&&LN({},o),{values:n.raw?Object.assign({},r):e,errors:{}}}))}catch(e){return a(e)}return l&&l.then?l.then(void 0,a):l}(0,function(e){if(!e.inner)throw e;return{values:{},errors:jN((t=e,n=!o.shouldUseNativeValidation&&"all"===o.criteriaMode,(t.inner||[]).reduce(function(e,t){if(e[t.path]||(e[t.path]={message:t.message,type:t.type}),n){var r=e[t.path].types,i=r&&r[t.type];e[t.path]=Vv(t.path,n,e,t.type,i?[].concat(i,t.message):t.message)}return e},{})),o)};var t,n}))}catch(e){return Promise.reject(e)}}}var UN,WN,qN=Zb(({children:t})=>e(Jc,{sx:{display:"flex",alignItems:"center",height:"100vh",width:"100vw",overflow:"hidden"},children:e(Jc,{sx:{margin:"auto",maxWidth:"400px",width:"100%"},children:e(Ck,{children:t})})}));var GN,HN,YN=function(){if(WN)return UN;function e(e){this._maxSize=e,this.clear()}WN=1,e.prototype.clear=function(){this._size=0,this._values=Object.create(null)},e.prototype.get=function(e){return this._values[e]},e.prototype.set=function(e,t){return this._size>=this._maxSize&&this.clear(),e in this._values||this._size++,this._values[e]=t};var t=/[^.^\]^[]+|(?=\[\]|\.\.)/g,n=/^\d+$/,r=/^\d/,i=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,o=/^\s*(['"]?)(.*?)(\1)\s*$/,s=new e(512),a=new e(512),l=new e(512);function u(e){return s.get(e)||s.set(e,c(e).map(function(e){return e.replace(o,"$2")}))}function c(e){return e.match(t)||[""]}function d(e){return"string"==typeof e&&e&&-1!==["'",'"'].indexOf(e.charAt(0))}function h(e){return!d(e)&&(function(e){return e.match(r)&&!e.match(n)}(e)||function(e){return i.test(e)}(e))}return UN={Cache:e,split:c,normalizePath:u,setter:function(e){var t=u(e);return a.get(e)||a.set(e,function(e,n){for(var r=0,i=t.length,o=e;r<i-1;){var s=t[r];if("__proto__"===s||"constructor"===s||"prototype"===s)return e;o=o[t[r++]]}o[t[r]]=n})},getter:function(e,t){var n=u(e);return l.get(e)||l.set(e,function(e){for(var r=0,i=n.length;r<i;){if(null==e&&t)return;e=e[n[r++]]}return e})},join:function(e){return e.reduce(function(e,t){return e+(d(t)||n.test(t)?"["+t+"]":(e?".":"")+t)},"")},forEach:function(e,t,n){!function(e,t,n){var r,i,o,s,a=e.length;for(i=0;i<a;i++)(r=e[i])&&(h(r)&&(r='"'+r+'"'),o=!(s=d(r))&&/^\d+$/.test(r),t.call(n,r,s,o,i,e))}(Array.isArray(e)?e:c(e),t,n)}},UN}();var KN,XN=function(){if(HN)return GN;HN=1;const e=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,t=t=>t.match(e)||[],n=e=>e[0].toUpperCase()+e.slice(1),r=(e,n)=>t(e).join(n).toLowerCase(),i=e=>t(e).reduce((e,t)=>`${e}${e?t[0].toUpperCase()+t.slice(1).toLowerCase():t.toLowerCase()}`,"");return GN={words:t,upperFirst:n,camelCase:i,pascalCase:e=>n(i(e)),snakeCase:e=>r(e,"_"),kebabCase:e=>r(e,"-"),sentenceCase:e=>n(r(e," ")),titleCase:e=>t(e).map(n).join(" ")}}(),ZN={exports:{}};var JN=function(){if(KN)return ZN.exports;function e(e,t){var n=e.length,r=new Array(n),i={},o=n,s=function(e){for(var t=new Map,n=0,r=e.length;n<r;n++){var i=e[n];t.has(i[0])||t.set(i[0],new Set),t.has(i[1])||t.set(i[1],new Set),t.get(i[0]).add(i[1])}return t}(t),a=function(e){for(var t=new Map,n=0,r=e.length;n<r;n++)t.set(e[n],n);return t}(e);for(t.forEach(function(e){if(!a.has(e[0])||!a.has(e[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});o--;)i[o]||l(e[o],o,new Set);return r;function l(e,t,o){if(o.has(e)){var u;try{u=", node was:"+JSON.stringify(e)}catch(e){u=""}throw new Error("Cyclic dependency"+u)}if(!a.has(e))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(e));if(!i[t]){i[t]=!0;var c=s.get(e)||new Set;if(t=(c=Array.from(c)).length){o.add(e);do{var d=c[--t];l(d,a.get(d),o)}while(t);o.delete(e)}r[--n]=e}}}return KN=1,ZN.exports=function(t){return e(function(e){for(var t=new Set,n=0,r=e.length;n<r;n++){var i=e[n];t.add(i[0]),t.add(i[1])}return Array.from(t)}(t),t)},ZN.exports.array=e,ZN.exports}(),QN=dt(JN);const eP=Object.prototype.toString,tP=Error.prototype.toString,nP=RegExp.prototype.toString,rP="undefined"!=typeof Symbol?Symbol.prototype.toString:()=>"",iP=/^Symbol\((.*)\)(.*)$/;function oP(e,t=!1){if(null==e||!0===e||!1===e)return""+e;const n=typeof e;if("number"===n)return function(e){return e!=+e?"NaN":0===e&&1/e<0?"-0":""+e}(e);if("string"===n)return t?`"${e}"`:e;if("function"===n)return"[Function "+(e.name||"anonymous")+"]";if("symbol"===n)return rP.call(e).replace(iP,"Symbol($1)");const r=eP.call(e).slice(8,-1);return"Date"===r?isNaN(e.getTime())?""+e:e.toISOString(e):"Error"===r||e instanceof Error?"["+tP.call(e)+"]":"RegExp"===r?nP.call(e):null}function sP(e,t){let n=oP(e,t);return null!==n?n:JSON.stringify(e,function(e,n){let r=oP(this[e],t);return null!==r?r:n},2)}function aP(e){return null==e?[]:[].concat(e)}let lP,uP,cP,dP=/\$\{\s*(\w+)\s*\}/g;lP=Symbol.toStringTag;class hP{constructor(e,t,n,r){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[lP]="Error",this.name="ValidationError",this.value=t,this.path=n,this.type=r,this.errors=[],this.inner=[],aP(e).forEach(e=>{if(pP.isError(e)){this.errors.push(...e.errors);const t=e.inner.length?e.inner:[e];this.inner.push(...t)}else this.errors.push(e)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}uP=Symbol.hasInstance,cP=Symbol.toStringTag;class pP extends Error{static formatError(e,t){const n=t.label||t.path||"this";return t=Object.assign({},t,{path:n,originalPath:t.path}),"string"==typeof e?e.replace(dP,(e,n)=>sP(t[n])):"function"==typeof e?e(t):e}static isError(e){return e&&"ValidationError"===e.name}constructor(e,t,n,r,i){const o=new hP(e,t,n,r);if(i)return o;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[cP]="Error",this.name=o.name,this.message=o.message,this.type=o.type,this.value=o.value,this.path=o.path,this.errors=o.errors,this.inner=o.inner,Error.captureStackTrace&&Error.captureStackTrace(this,pP)}static[uP](e){return hP[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let fP={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:e,type:t,value:n,originalValue:r})=>{const i=null!=r&&r!==n?` (cast from the value \`${sP(r,!0)}\`).`:".";return"mixed"!==t?`${e} must be a \`${t}\` type, but the final value was: \`${sP(n,!0)}\``+i:`${e} must match the configured type. The validated value was: \`${sP(n,!0)}\``+i}},mP={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},gP={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},yP={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},bP={notType:e=>{const{path:t,value:n,spec:r}=e,i=r.types.length;if(Array.isArray(n)){if(n.length<i)return`${t} tuple value has too few items, expected a length of ${i} but got ${n.length} for value: \`${sP(n,!0)}\``;if(n.length>i)return`${t} tuple value has too many items, expected a length of ${i} but got ${n.length} for value: \`${sP(n,!0)}\``}return pP.formatError(fP.notType,e)}};Object.assign(Object.create(null),{mixed:fP,string:mP,number:{min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},date:gP,object:yP,array:{min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},boolean:{isValue:"${path} field must be ${value}"},tuple:bP});const vP=e=>e&&e.__isYupSchema__;class _P{static fromOptions(e,t){if(!t.then&&!t.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:n,then:r,otherwise:i}=t,o="function"==typeof n?n:(...e)=>e.every(e=>e===n);return new _P(e,(e,t)=>{var n;let s=o(...e)?r:i;return null!=(n=null==s?void 0:s(t))?n:t})}constructor(e,t){this.fn=void 0,this.refs=e,this.refs=e,this.fn=t}resolve(e,t){let n=this.refs.map(e=>e.getValue(null==t?void 0:t.value,null==t?void 0:t.parent,null==t?void 0:t.context)),r=this.fn(n,e,t);if(void 0===r||r===e)return e;if(!vP(r))throw new TypeError("conditions must return a schema object");return r.resolve(t)}}const xP="$",wP=".";class EP{constructor(e,t={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,"string"!=typeof e)throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),""===e)throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===xP,this.isValue=this.key[0]===wP,this.isSibling=!this.isContext&&!this.isValue;let n=this.isContext?xP:this.isValue?wP:"";this.path=this.key.slice(n.length),this.getter=this.path&&YN.getter(this.path,!0),this.map=t.map}getValue(e,t,n){let r=this.isContext?n:this.isValue?e:t;return this.getter&&(r=this.getter(r||{})),this.map&&(r=this.map(r)),r}cast(e,t){return this.getValue(e,null==t?void 0:t.parent,null==t?void 0:t.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}EP.prototype.__isYupRef=!0;const SP=e=>null==e;function TP(e){function t({value:t,path:n="",options:r,originalValue:i,schema:o},s,a){const{name:l,test:u,params:c,message:d,skipAbsent:h}=e;let{parent:p,context:f,abortEarly:m=o.spec.abortEarly,disableStackTrace:g=o.spec.disableStackTrace}=r;const y={value:t,parent:p,context:f};function b(e={}){const r=kP(Object.assign({value:t,originalValue:i,label:o.spec.label,path:e.path||n,spec:o.spec,disableStackTrace:e.disableStackTrace||g},c,e.params),y),s=new pP(pP.formatError(e.message||d,r),t,r.path,e.type||l,r.disableStackTrace);return s.params=r,s}const v=m?s:a;let _={path:n,parent:p,type:l,from:r.from,createError:b,resolve:e=>OP(e,y),options:r,originalValue:i,schema:o};const x=e=>{pP.isError(e)?v(e):e?a(null):v(b())},w=e=>{pP.isError(e)?v(e):s(e)};if(h&&SP(t))return x(!0);let E;try{var S;if(E=u.call(_,t,_),"function"==typeof(null==(S=E)?void 0:S.then)){if(r.sync)throw new Error(`Validation test of type: "${_.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(E).then(x,w)}}catch(e){return void w(e)}x(E)}return t.OPTIONS=e,t}function kP(e,t){if(!e)return e;for(const n of Object.keys(e))e[n]=OP(e[n],t);return e}function OP(e,t){return EP.isRef(e)?e.getValue(t.value,t.parent,t.context):e}function AP(e,t,n,r=n){let i,o,s;return t?(YN.forEach(t,(a,l,u)=>{let c=l?a.slice(1,a.length-1):a,d="tuple"===(e=e.resolve({context:r,parent:i,value:n})).type,h=u?parseInt(c,10):0;if(e.innerType||d){if(d&&!u)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${s}" must contain an index to the tuple element, e.g. "${s}[0]"`);if(n&&h>=n.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${a}, in the path: ${t}. because there is no value at that index. `);i=n,n=n&&n[h],e=d?e.spec.types[h]:e.innerType}if(!u){if(!e.fields||!e.fields[c])throw new Error(`The schema does not contain the path: ${t}. (failed at: ${s} which is a type: "${e.type}")`);i=n,n=n&&n[c],e=e.fields[c]}o=c,s=l?"["+a+"]":"."+a}),{schema:e,parent:i,parentPath:o}):{parent:i,parentPath:t,schema:e}}class CP extends Set{describe(){const e=[];for(const t of this.values())e.push(EP.isRef(t)?t.describe():t);return e}resolveAll(e){let t=[];for(const n of this.values())t.push(e(n));return t}clone(){return new CP(this.values())}merge(e,t){const n=this.clone();return e.forEach(e=>n.add(e)),t.forEach(e=>n.delete(e)),n}}function RP(e,t=new Map){if(vP(e)||!e||"object"!=typeof e)return e;if(t.has(e))return t.get(e);let n;if(e instanceof Date)n=new Date(e.getTime()),t.set(e,n);else if(e instanceof RegExp)n=new RegExp(e),t.set(e,n);else if(Array.isArray(e)){n=new Array(e.length),t.set(e,n);for(let r=0;r<e.length;r++)n[r]=RP(e[r],t)}else if(e instanceof Map){n=new Map,t.set(e,n);for(const[r,i]of e.entries())n.set(r,RP(i,t))}else if(e instanceof Set){n=new Set,t.set(e,n);for(const r of e)n.add(RP(r,t))}else{if(!(e instanceof Object))throw Error(`Unable to clone ${e}`);n={},t.set(e,n);for(const[r,i]of Object.entries(e))n[r]=RP(i,t)}return n}function NP(e){if(null==e||!e.length)return;const t=[];let n="",r=!1,i=!1;for(let o=0;o<e.length;o++){const s=e[o];"["!==s||i?"]"!==s||i?'"'!==s?"."!==s||r||i?n+=s:n&&(t.push(n),n=""):i=!i:(n&&(/^\d+$/.test(n)?t.push(n):t.push(n.replace(/^"|"$/g,"")),n=""),r=!1):(n&&(t.push(...n.split(".").filter(Boolean)),n=""),r=!0)}return n&&t.push(...n.split(".").filter(Boolean)),t}function PP(e,t){var n;if((null==(n=e.inner)||!n.length)&&e.errors.length)return function(e,t){const n=t?`${t}.${e.path}`:e.path;return e.errors.map(e=>({message:e,path:NP(n)}))}(e,t);const r=t?`${t}.${e.path}`:e.path;return e.inner.flatMap(e=>PP(e,r))}class MP{constructor(e){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new CP,this._blacklist=new CP,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(fP.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},null==e?void 0:e.spec),this.withMutation(e=>{e.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const t=Object.create(Object.getPrototypeOf(this));return t.type=this.type,t._typeCheck=this._typeCheck,t._whitelist=this._whitelist.clone(),t._blacklist=this._blacklist.clone(),t.internalTests=Object.assign({},this.internalTests),t.exclusiveTests=Object.assign({},this.exclusiveTests),t.deps=[...this.deps],t.conditions=[...this.conditions],t.tests=[...this.tests],t.transforms=[...this.transforms],t.spec=RP(Object.assign({},this.spec,e)),t}label(e){let t=this.clone();return t.spec.label=e,t}meta(...e){if(0===e.length)return this.spec.meta;let t=this.clone();return t.spec.meta=Object.assign(t.spec.meta||{},e[0]),t}withMutation(e){let t=this._mutate;this._mutate=!0;let n=e(this);return this._mutate=t,n}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&"mixed"!==this.type)throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let t=this,n=e.clone();const r=Object.assign({},t.spec,n.spec);return n.spec=r,n.internalTests=Object.assign({},t.internalTests,n.internalTests),n._whitelist=t._whitelist.merge(e._whitelist,e._blacklist),n._blacklist=t._blacklist.merge(e._blacklist,e._whitelist),n.tests=t.tests,n.exclusiveTests=t.exclusiveTests,n.withMutation(t=>{e.tests.forEach(e=>{t.test(e.OPTIONS)})}),n.transforms=[...t.transforms,...n.transforms],n}isType(e){return null==e?!(!this.spec.nullable||null!==e)||!(!this.spec.optional||void 0!==e):this._typeCheck(e)}resolve(e){let t=this;if(t.conditions.length){let n=t.conditions;t=t.clone(),t.conditions=[],t=n.reduce((t,n)=>n.resolve(t,e),t),t=t.resolve(e)}return t}resolveOptions(e){var t,n,r,i;return Object.assign({},e,{from:e.from||[],strict:null!=(t=e.strict)?t:this.spec.strict,abortEarly:null!=(n=e.abortEarly)?n:this.spec.abortEarly,recursive:null!=(r=e.recursive)?r:this.spec.recursive,disableStackTrace:null!=(i=e.disableStackTrace)?i:this.spec.disableStackTrace})}cast(e,t={}){let n=this.resolve(Object.assign({},t,{value:e})),r="ignore-optionality"===t.assert,i=n._cast(e,t);if(!1!==t.assert&&!n.isType(i)){if(r&&SP(i))return i;let o=sP(e),s=sP(i);throw new TypeError(`The value of ${t.path||"field"} could not be cast to a value that satisfies the schema type: "${n.type}". \n\nattempted value: ${o} \n`+(s!==o?`result of cast: ${s}`:""))}return i}_cast(e,t){let n=void 0===e?e:this.transforms.reduce((n,r)=>r.call(this,n,e,this,t),e);return void 0===n&&(n=this.getDefault(t)),n}_validate(e,t={},n,r){let{path:i,originalValue:o=e,strict:s=this.spec.strict}=t,a=e;s||(a=this._cast(a,Object.assign({assert:!1},t)));let l=[];for(let e of Object.values(this.internalTests))e&&l.push(e);this.runTests({path:i,value:a,originalValue:o,options:t,tests:l},n,e=>{if(e.length)return r(e,a);this.runTests({path:i,value:a,originalValue:o,options:t,tests:this.tests},n,r)})}runTests(e,t,n){let r=!1,{tests:i,value:o,originalValue:s,path:a,options:l}=e,u=e=>{r||(r=!0,t(e,o))},c=e=>{r||(r=!0,n(e,o))},d=i.length,h=[];if(!d)return c([]);let p={value:o,originalValue:s,path:a,options:l,schema:this};for(let e=0;e<i.length;e++){(0,i[e])(p,u,function(e){e&&(Array.isArray(e)?h.push(...e):h.push(e)),--d<=0&&c(h)})}}asNestedTest({key:e,index:t,parent:n,parentPath:r,originalParent:i,options:o}){const s=null!=e?e:t;if(null==s)throw TypeError("Must include `key` or `index` for nested validations");const a="number"==typeof s;let l=n[s];const u=Object.assign({},o,{strict:!0,parent:n,value:l,originalValue:i[s],key:void 0,[a?"index":"key"]:s,path:a||s.includes(".")?`${r||""}[${a?s:`"${s}"`}]`:(r?`${r}.`:"")+e});return(e,t,n)=>this.resolve(u)._validate(l,u,t,n)}validate(e,t){var n;let r=this.resolve(Object.assign({},t,{value:e})),i=null!=(n=null==t?void 0:t.disableStackTrace)?n:r.spec.disableStackTrace;return new Promise((n,o)=>r._validate(e,t,(e,t)=>{pP.isError(e)&&(e.value=t),o(e)},(e,t)=>{e.length?o(new pP(e,t,void 0,void 0,i)):n(t)}))}validateSync(e,t){var n;let r,i=this.resolve(Object.assign({},t,{value:e})),o=null!=(n=null==t?void 0:t.disableStackTrace)?n:i.spec.disableStackTrace;return i._validate(e,Object.assign({},t,{sync:!0}),(e,t)=>{throw pP.isError(e)&&(e.value=t),e},(t,n)=>{if(t.length)throw new pP(t,e,void 0,void 0,o);r=n}),r}isValid(e,t){return this.validate(e,t).then(()=>!0,e=>{if(pP.isError(e))return!1;throw e})}isValidSync(e,t){try{return this.validateSync(e,t),!0}catch(e){if(pP.isError(e))return!1;throw e}}_getDefault(e){let t=this.spec.default;return null==t?t:"function"==typeof t?t.call(this,e):RP(t)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){if(0===arguments.length)return this._getDefault();return this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,t){const n=this.clone({nullable:e});return n.internalTests.nullable=TP({message:t,name:"nullable",test(e){return null!==e||this.schema.spec.nullable}}),n}optionality(e,t){const n=this.clone({optional:e});return n.internalTests.optionality=TP({message:t,name:"optionality",test(e){return void 0!==e||this.schema.spec.optional}}),n}optional(){return this.optionality(!0)}defined(e=fP.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=fP.notNull){return this.nullability(!1,e)}required(e=fP.required){return this.clone().withMutation(t=>t.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let t=this.clone();return t.transforms.push(e),t}test(...e){let t;if(t=1===e.length?"function"==typeof e[0]?{test:e[0]}:e[0]:2===e.length?{name:e[0],test:e[1]}:{name:e[0],message:e[1],test:e[2]},void 0===t.message&&(t.message=fP.default),"function"!=typeof t.test)throw new TypeError("`test` is a required parameters");let n=this.clone(),r=TP(t),i=t.exclusive||t.name&&!0===n.exclusiveTests[t.name];if(t.exclusive&&!t.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return t.name&&(n.exclusiveTests[t.name]=!!t.exclusive),n.tests=n.tests.filter(e=>{if(e.OPTIONS.name===t.name){if(i)return!1;if(e.OPTIONS.test===r.OPTIONS.test)return!1}return!0}),n.tests.push(r),n}when(e,t){Array.isArray(e)||"string"==typeof e||(t=e,e=".");let n=this.clone(),r=aP(e).map(e=>new EP(e));return r.forEach(e=>{e.isSibling&&n.deps.push(e.key)}),n.conditions.push("function"==typeof t?new _P(r,t):_P.fromOptions(r,t)),n}typeError(e){let t=this.clone();return t.internalTests.typeError=TP({message:e,name:"typeError",skipAbsent:!0,test(e){return!!this.schema._typeCheck(e)||this.createError({params:{type:this.schema.type}})}}),t}oneOf(e,t=fP.oneOf){let n=this.clone();return e.forEach(e=>{n._whitelist.add(e),n._blacklist.delete(e)}),n.internalTests.whiteList=TP({message:t,name:"oneOf",skipAbsent:!0,test(e){let t=this.schema._whitelist,n=t.resolveAll(this.resolve);return!!n.includes(e)||this.createError({params:{values:Array.from(t).join(", "),resolved:n}})}}),n}notOneOf(e,t=fP.notOneOf){let n=this.clone();return e.forEach(e=>{n._blacklist.add(e),n._whitelist.delete(e)}),n.internalTests.blacklist=TP({message:t,name:"notOneOf",test(e){let t=this.schema._blacklist,n=t.resolveAll(this.resolve);return!n.includes(e)||this.createError({params:{values:Array.from(t).join(", "),resolved:n}})}}),n}strip(e=!0){let t=this.clone();return t.spec.strip=e,t}describe(e){const t=(e?this.resolve(e):this).clone(),{label:n,meta:r,optional:i,nullable:o}=t.spec,s={meta:r,label:n,optional:i,nullable:o,default:t.getDefault(e),type:t.type,oneOf:t._whitelist.describe(),notOneOf:t._blacklist.describe(),tests:t.tests.filter((e,t,n)=>n.findIndex(t=>t.OPTIONS.name===e.OPTIONS.name)===t).map(t=>{const n=t.OPTIONS.params&&e?kP(Object.assign({},t.OPTIONS.params),e):t.OPTIONS.params;return{name:t.OPTIONS.name,params:n}})};return s}get"~standard"(){const e=this;return{version:1,vendor:"yup",async validate(t){try{return{value:await e.validate(t,{abortEarly:!1})}}catch(e){if(e instanceof pP)return{issues:PP(e)};throw e}}}}}MP.prototype.__isYupSchema__=!0;for(const e of["validate","validateSync"])MP.prototype[`${e}At`]=function(t,n,r={}){const{parent:i,parentPath:o,schema:s}=AP(this,t,n,r.context);return s[e](i&&i[o],Object.assign({},r,{parent:i,path:t}))};for(const e of["equals","is"])MP.prototype[e]=MP.prototype.oneOf;for(const e of["not","nope"])MP.prototype[e]=MP.prototype.notOneOf;const DP=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function IP(e){var t,n;const r=DP.exec(e);return r?{year:zP(r[1]),month:zP(r[2],1)-1,day:zP(r[3],1),hour:zP(r[4]),minute:zP(r[5]),second:zP(r[6]),millisecond:r[7]?zP(r[7].substring(0,3)):0,precision:null!=(t=null==(n=r[7])?void 0:n.length)?t:void 0,z:r[8]||void 0,plusMinus:r[9]||void 0,hourOffset:zP(r[10]),minuteOffset:zP(r[11])}:null}function zP(e,t=0){return Number(e)||t}let FP=/^[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])?)*$/,LP=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,jP=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,$P=new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"),BP=e=>SP(e)||e===e.trim(),VP={}.toString();function UP(){return new WP}class WP extends MP{constructor(){super({type:"string",check:e=>(e instanceof String&&(e=e.valueOf()),"string"==typeof e)}),this.withMutation(()=>{this.transform((e,t)=>{if(!this.spec.coerce||this.isType(e))return e;if(Array.isArray(e))return e;const n=null!=e&&e.toString?e.toString():e;return n===VP?e:n})})}required(e){return super.required(e).withMutation(t=>t.test({message:e||fP.required,name:"required",skipAbsent:!0,test:e=>!!e.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(e=>"required"!==e.OPTIONS.name),e))}length(e,t=mP.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(t){return t.length===this.resolve(e)}})}min(e,t=mP.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(t){return t.length>=this.resolve(e)}})}max(e,t=mP.max){return this.test({name:"max",exclusive:!0,message:t,params:{max:e},skipAbsent:!0,test(t){return t.length<=this.resolve(e)}})}matches(e,t){let n,r,i=!1;return t&&("object"==typeof t?({excludeEmptyString:i=!1,message:n,name:r}=t):n=t),this.test({name:r||"matches",message:n||mP.matches,params:{regex:e},skipAbsent:!0,test:t=>""===t&&i||-1!==t.search(e)})}email(e=mP.email){return this.matches(FP,{name:"email",message:e,excludeEmptyString:!0})}url(e=mP.url){return this.matches(LP,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=mP.uuid){return this.matches(jP,{name:"uuid",message:e,excludeEmptyString:!1})}datetime(e){let t,n,r="";return e&&("object"==typeof e?({message:r="",allowOffset:t=!1,precision:n}=e):r=e),this.matches($P,{name:"datetime",message:r||mP.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:r||mP.datetime_offset,params:{allowOffset:t},skipAbsent:!0,test:e=>{if(!e||t)return!0;const n=IP(e);return!!n&&!!n.z}}).test({name:"datetime_precision",message:r||mP.datetime_precision,params:{precision:n},skipAbsent:!0,test:e=>{if(!e||null==n)return!0;const t=IP(e);return!!t&&t.precision===n}})}ensure(){return this.default("").transform(e=>null===e?"":e)}trim(e=mP.trim){return this.transform(e=>null!=e?e.trim():e).test({message:e,name:"trim",test:BP})}lowercase(e=mP.lowercase){return this.transform(e=>SP(e)?e:e.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:e=>SP(e)||e===e.toLowerCase()})}uppercase(e=mP.uppercase){return this.transform(e=>SP(e)?e:e.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:e=>SP(e)||e===e.toUpperCase()})}}UP.prototype=WP.prototype;let qP=new Date("");class GP extends MP{constructor(){super({type:"date",check(e){return t=e,"[object Date]"===Object.prototype.toString.call(t)&&!isNaN(e.getTime());var t}}),this.withMutation(()=>{this.transform((e,t)=>!this.spec.coerce||this.isType(e)||null===e?e:(e=function(e){const t=IP(e);if(!t)return Date.parse?Date.parse(e):Number.NaN;if(void 0===t.z&&void 0===t.plusMinus)return new Date(t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond).valueOf();let n=0;return"Z"!==t.z&&void 0!==t.plusMinus&&(n=60*t.hourOffset+t.minuteOffset,"+"===t.plusMinus&&(n=0-n)),Date.UTC(t.year,t.month,t.day,t.hour,t.minute+n,t.second,t.millisecond)}(e),isNaN(e)?GP.INVALID_DATE:new Date(e)))})}prepareParam(e,t){let n;if(EP.isRef(e))n=e;else{let r=this.cast(e);if(!this._typeCheck(r))throw new TypeError(`\`${t}\` must be a Date or a value that can be \`cast()\` to a Date`);n=r}return n}min(e,t=gP.min){let n=this.prepareParam(e,"min");return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(e){return e>=this.resolve(n)}})}max(e,t=gP.max){let n=this.prepareParam(e,"max");return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(e){return e<=this.resolve(n)}})}}function HP(e,t){let n=1/0;return e.some((e,r)=>{var i;if(null!=(i=t.path)&&i.includes(e))return n=r,!0}),n}function YP(e){return(t,n)=>HP(e,t)-HP(e,n)}GP.INVALID_DATE=qP;const KP=(e,t,n)=>{if("string"!=typeof e)return e;let r=e;try{r=JSON.parse(e)}catch(e){}return n.isType(r)?r:e};function XP(e){if("fields"in e){const t={};for(const[n,r]of Object.entries(e.fields))t[n]=XP(r);return e.setFields(t)}if("array"===e.type){const t=e.optional();return t.innerType&&(t.innerType=XP(t.innerType)),t}return"tuple"===e.type?e.optional().clone({types:e.spec.types.map(XP)}):"optional"in e?e.optional():e}let ZP=e=>"[object Object]"===Object.prototype.toString.call(e);function JP(e,t){let n=Object.keys(e.fields);return Object.keys(t).filter(e=>-1===n.indexOf(e))}const QP=YP([]);function eM(e){return new tM(e)}class tM extends MP{constructor(e){super({type:"object",check:e=>ZP(e)||"function"==typeof e}),this.fields=Object.create(null),this._sortErrors=QP,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{e&&this.shape(e)})}_cast(e,t={}){var n;let r=super._cast(e,t);if(void 0===r)return this.getDefault(t);if(!this._typeCheck(r))return r;let i=this.fields,o=null!=(n=t.stripUnknown)?n:this.spec.noUnknown,s=[].concat(this._nodes,Object.keys(r).filter(e=>!this._nodes.includes(e))),a={},l=Object.assign({},t,{parent:a,__validating:t.__validating||!1}),u=!1;for(const e of s){let n=i[e],s=e in r,c=r[e];if(n){let i;l.path=(t.path?`${t.path}.`:"")+e,n=n.resolve({value:c,context:t.context,parent:a});let o=n instanceof MP?n.spec:void 0,s=null==o?void 0:o.strict;if(null!=o&&o.strip){u=u||e in r;continue}i=t.__validating&&s?c:n.cast(c,l),void 0!==i&&(a[e]=i)}else s&&!o&&(a[e]=c);s===e in a&&a[e]===c||(u=!0)}return u?a:r}_validate(e,t={},n,r){let{from:i=[],originalValue:o=e,recursive:s=this.spec.recursive}=t;t.from=[{schema:this,value:o},...i],t.__validating=!0,t.originalValue=o,super._validate(e,t,n,(e,i)=>{if(!s||!ZP(i))return void r(e,i);o=o||i;let a=[];for(let e of this._nodes){let n=this.fields[e];n&&!EP.isRef(n)&&a.push(n.asNestedTest({options:t,key:e,parent:i,parentPath:t.path,originalParent:o}))}this.runTests({tests:a,value:i,originalValue:o,options:t},n,t=>{r(t.sort(this._sortErrors).concat(e),i)})})}clone(e){const t=super.clone(e);return t.fields=Object.assign({},this.fields),t._nodes=this._nodes,t._excludedEdges=this._excludedEdges,t._sortErrors=this._sortErrors,t}concat(e){let t=super.concat(e),n=t.fields;for(let[e,t]of Object.entries(this.fields)){const r=n[e];n[e]=void 0===r?t:r}return t.withMutation(t=>t.setFields(n,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let t={};return this._nodes.forEach(n=>{var r;const i=this.fields[n];let o=e;null!=(r=o)&&r.value&&(o=Object.assign({},o,{parent:o.value,value:o.value[n]})),t[n]=i&&"getDefault"in i?i.getDefault(o):void 0}),t}setFields(e,t){let n=this.clone();return n.fields=e,n._nodes=function(e,t=[]){let n=[],r=new Set,i=new Set(t.map(([e,t])=>`${e}-${t}`));function o(e,t){let o=YN.split(e)[0];r.add(o),i.has(`${t}-${o}`)||n.push([t,o])}for(const t of Object.keys(e)){let n=e[t];r.add(t),EP.isRef(n)&&n.isSibling?o(n.path,t):vP(n)&&"deps"in n&&n.deps.forEach(e=>o(e,t))}return QN.array(Array.from(r),n).reverse()}(e,t),n._sortErrors=YP(Object.keys(e)),t&&(n._excludedEdges=t),n}shape(e,t=[]){return this.clone().withMutation(n=>{let r=n._excludedEdges;return t.length&&(Array.isArray(t[0])||(t=[t]),r=[...n._excludedEdges,...t]),n.setFields(Object.assign(n.fields,e),r)})}partial(){const e={};for(const[t,n]of Object.entries(this.fields))e[t]="optional"in n&&n.optional instanceof Function?n.optional():n;return this.setFields(e)}deepPartial(){return XP(this)}pick(e){const t={};for(const n of e)this.fields[n]&&(t[n]=this.fields[n]);return this.setFields(t,this._excludedEdges.filter(([t,n])=>e.includes(t)&&e.includes(n)))}omit(e){const t=[];for(const n of Object.keys(this.fields))e.includes(n)||t.push(n);return this.pick(t)}from(e,t,n){let r=YN.getter(e,!0);return this.transform(i=>{if(!i)return i;let o=i;return((e,t)=>{const n=[...YN.normalizePath(t)];if(1===n.length)return n[0]in e;let r=n.pop(),i=YN.getter(YN.join(n),!0)(e);return!(!i||!(r in i))})(i,e)&&(o=Object.assign({},i),n||delete o[e],o[t]=r(i)),o})}json(){return this.transform(KP)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||yP.exact,test(e){if(null==e)return!0;const t=JP(this.schema,e);return 0===t.length||this.createError({params:{properties:t.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,t=yP.noUnknown){"boolean"!=typeof e&&(t=e,e=!0);let n=this.test({name:"noUnknown",exclusive:!0,message:t,test(t){if(null==t)return!0;const n=JP(this.schema,t);return!e||0===n.length||this.createError({params:{unknown:n.join(", ")}})}});return n.spec.noUnknown=e,n}unknown(e=!0,t=yP.noUnknown){return this.noUnknown(!e,t)}transformKeys(e){return this.transform(t=>{if(!t)return t;const n={};for(const r of Object.keys(t))n[e(r)]=t[r];return n})}camelCase(){return this.transformKeys(XN.camelCase)}snakeCase(){return this.transformKeys(XN.snakeCase)}constantCase(){return this.transformKeys(e=>XN.snakeCase(e).toUpperCase())}describe(e){const t=(e?this.resolve(e):this).clone(),n=super.describe(e);n.fields={};for(const[i,o]of Object.entries(t.fields)){var r;let t=e;null!=(r=t)&&r.value&&(t=Object.assign({},t,{parent:t.value,value:t.value[i]})),n.fields[i]=o.describe(t)}return n}}eM.prototype=tM.prototype;const nM=eM().shape({username:UP().required(),password:UP().required()});var rM,iM,oM=Zb(({onSuccessSignIn:i})=>{const o=zN(),s=IN(),a=PN(),l=function(e={}){const t=r.useRef(void 0),n=r.useRef(void 0),[i,o]=r.useState({isDirty:!1,isValidating:!1,isLoading:Yv(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Yv(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:i},e.defaultValues&&!Yv(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:n,...r}=E_(e);t.current={...r,formState:i}}const s=t.current.control;return s._options=e,Iv(()=>{const e=s._subscribe({formState:s._proxyFormState,callback:()=>o({...s._formState}),reRenderRoot:!0});return o(e=>({...e,isReady:!0})),s._formState.isReady=!0,e},[s]),r.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),r.useEffect(()=>{e.mode&&(s._options.mode=e.mode),e.reValidateMode&&(s._options.reValidateMode=e.reValidateMode)},[s,e.mode,e.reValidateMode]),r.useEffect(()=>{e.errors&&(s._setErrors(e.errors),s._focusError())},[s,e.errors]),r.useEffect(()=>{e.shouldUnregister&&s._subjects.state.next({values:s._getWatch()})},[s,e.shouldUnregister]),r.useEffect(()=>{if(s._proxyFormState.isDirty){const e=s._getDirty();e!==i.isDirty&&s._subjects.state.next({isDirty:e})}},[s,i.isDirty]),r.useEffect(()=>{e.values&&!jv(e.values,n.current)?(s._reset(e.values,{keepFieldsRef:!0,...s._options.resetOptions}),n.current=e.values,o(e=>({...e}))):s._resetDefaultValues()},[s,e.values]),r.useEffect(()=>{s._state.mount||(s._setValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),t.current.formState=Dv(i,s),t.current}({defaultValues:{username:"",password:""},resolver:VN(nM)}),{register:u,formState:{isValid:c}}=l;return n.useEffect(()=>{o.mutate()},[]),n.useEffect(()=>{if(s.error){const{response:e}=s.error;if(e){const{data:{detail:t}}=e;a({message:t,variant:"error"})}}},[s.error]),n.useEffect(()=>{s.data&&i(s.data)},[s.data]),e(qN,{children:t(O_,{form:l,onSubmit:e=>{s.mutate({body:e})},sx:{justifyContent:"center",justifyItems:"center",alignContent:"center",alignItems:"center"},children:[e(dl,{variant:"h4",children:"Authorization"}),e(N_,{...u("username"),label:"Login",placeholder:"Enter your login"}),e(N_,{...u("password"),label:"Password",placeholder:"Enter your password",type:"password"}),e(Qb,{type:"submit",variant:"contained",disabled:!c,children:"Sign in"})]})})}),sM={};function aM(e,t){if(rM)if(iM){var n="var shared_chunk = {}; ("+rM+")(shared_chunk); ("+iM+")(shared_chunk);",r={};rM(r),(sM=t(r)).workerURL=window.URL.createObjectURL(new Blob([n],{type:"text/javascript"}))}else iM=t;else rM=t}aM(0,function(e){const t={};try{window instanceof Window&&window.document instanceof HTMLDocument&&(t.is_worker=!1,t.is_main=!0)}catch(e){t.is_worker=!0,t.is_main=!1,self.window={document:{}},self.document=self.window.document}function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function r(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=n(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==n(t)?t:t+""}function i(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var o,s="v0.22.0",a=o={},l=0,u={};function c(e){var t=[];"string"==typeof e&&(t=e.split("."),e=t.pop());var n=o.targets;for(let e=0;e<t.length;e++){if(!n[t[e]])return[];n=n[t[e]]}return[e,n]}function d(e,t=null,n=null,r=[]){if(!e)return r;if(Array.isArray(e))e.forEach((t,n)=>d(t,e,n,r));else if("object"==typeof e)if(e instanceof ArrayBuffer)r.push({object:e,parent:t,property:n});else if(e.buffer instanceof ArrayBuffer)r.push({object:e.buffer,parent:t,property:n});else for(let t in e)d(e[t],e,t,r);return r}function h(e){Array.isArray(e)&&e.filter(e=>e.parent&&e.property).forEach(e=>delete e.parent[e.property])}o.targets={},o.addTarget=function(e,t){o.targets[e]=t},o.removeTarget=function(e){e&&delete o.targets[e]},o.withTransferables=function(...e){if(!(this instanceof o.withTransferables))return new o.withTransferables(...e);this.value=e,this.transferables=d(this.value)},t.is_main&&(o.postMessage=function(e,t,...n){if(Array.isArray(e))return Promise.all(e.map(e=>o.postMessage(e,t,...n)));let r={};"object"==typeof t&&(r=t,t=t.method);var i=new Promise((e,r)=>{u[l]={method:t,message:n,resolve:e,reject:r}});let s,a=[];return n&&1===n.length&&n[0]instanceof o.withTransferables&&(a=n[0].transferables,n=n[0].value),s={type:"main_send",message_id:l,method:t,message:n},r.stringify&&(s=JSON.stringify(s)),e.postMessage(s,a.map(e=>e.object)),h(a),a.length>0&&g("trace",`'${t}' transferred ${a.length} objects to worker thread`),l++,i},o.addWorker=function(e){if(!(e instanceof Worker))throw Error("Worker broker could not add non-Worker object",e);e.addEventListener("message",function(t){let n="string"==typeof t.data?JSON.parse(t.data):t.data,r=n.message_id;if("worker_reply"===n.type)u[r]&&(n.error?u[r].reject(n.error):u[r].resolve(n.message),delete u[r]);else if("worker_send"===n.type&&null!=r){let t,i,s,a,l;try{if([a,s]=c(n.method),!s)throw Error(`Worker broker could not dispatch message type ${n.method} on target ${n.target} because no object with that name is registered on main thread`);if(l="function"==typeof s[a]&&s[a],!l)throw Error(`Worker broker could not dispatch message type ${n.method} on target ${n.target} because object has no method with that name`);t=l.apply(s,n.message)}catch(e){i=e}let u,d=[];t instanceof Promise?t.then(t=>{t instanceof o.withTransferables&&(d=t.transferables,t=t.value[0]),u={type:"main_reply",message_id:r,message:t},e.postMessage(u,d.map(e=>e.object)),h(d),d.length>0&&g("trace",`'${a}' transferred ${d.length} objects to worker thread`)},t=>{e.postMessage({type:"main_reply",message_id:r,error:t instanceof Error?`${t.message}: ${t.stack}`:t})}):(t instanceof o.withTransferables&&(d=t.transferables,t=t.value[0]),u={type:"main_reply",message_id:r,message:t,error:i instanceof Error?`${i.message}: ${i.stack}`:i},e.postMessage(u,d.map(e=>e.object)),h(d),d.length>0&&g("trace",`'${a}' transferred ${d.length} objects to worker thread`))}})},o.getMessages=function(){return u},o.getMessageId=function(){return l}),t.is_worker&&(o.postMessage=function(e,...t){let n={};"object"==typeof e&&(n=e,e=e.method);var r=new Promise((n,r)=>{u[l]={method:e,message:t,resolve:n,reject:r}});let i,s=[];return t&&1===t.length&&t[0]instanceof o.withTransferables&&(s=t[0].transferables,t=t[0].value),i={type:"worker_send",message_id:l,method:e,message:t},n.stringify&&(i=JSON.stringify(i)),self.postMessage(i,s.map(e=>e.object)),h(s),s.length>0&&g("trace",`'${e}' transferred ${s.length} objects to main thread`),l++,r},self.addEventListener("message",function(e){let t="string"==typeof e.data?JSON.parse(e.data):e.data,n=t.message_id;if("main_reply"===t.type)u[n]&&(t.error?u[n].reject(t.error):u[n].resolve(t.message),delete u[n]);else if("main_send"===t.type&&null!=n){let r,i,s,a,l;try{if([a,s]=c(t.method),!s)throw Error(`Worker broker could not dispatch message type ${t.method} on target ${t.target} because no object with that name is registered on main thread`);if(l="function"==typeof s[a]&&s[a],!l)throw Error(`Worker broker could not dispatch message type ${t.method} because worker has no method with that name`);r=l.apply(s,t.message)}catch(e){i=e}let u,d=[];r instanceof Promise?r.then(e=>{e instanceof o.withTransferables&&(d=e.transferables,e=e.value[0]),u={type:"worker_reply",message_id:n,message:e},self.postMessage(u,d.map(e=>e.object)),h(d),d.length>0&&g("trace",`'${a}' transferred ${d.length} objects to main thread`)},e=>{self.postMessage({type:"worker_reply",message_id:n,error:e instanceof Error?`${e.message}: ${e.stack}`:e})}):(r instanceof o.withTransferables&&(d=r.transferables,r=r.value[0]),u={type:"worker_reply",message_id:n,message:r,error:i instanceof Error?`${i.message}: ${i.stack}`:i},self.postMessage(u,d.map(e=>e.object)),h(d),d.length>0&&g("trace",`'${a}' transferred ${d.length} objects to main thread`))}}));const p={silent:-1,error:0,warn:1,info:2,debug:3,trace:4},f={};let m={};function g(e,...n){let r="object"==typeof e?e.level:e;if(p[r]<=p[g.level]){if(t.is_worker)return a.postMessage({method:"_logProxy",stringify:!0},e,...n);{if("object"==typeof e&&!0===e.once){if(m[JSON.stringify(n)])return Promise.resolve(!1);m[JSON.stringify(n)]=!0}let i=function(e){if(t.is_main)return f[e]=f[e]||(console[e]?console[e]:console.log).bind(console),f[e]}(r);n.length>1?i(`Tangram ${s} [${r}]: ${n[0]}`,...n.slice(1)):i(`Tangram ${s} [${r}]: ${n[0]}`)}return Promise.resolve(!0)}return Promise.resolve(!1)}g.level="info",g.workers=null,g.setLevel=function(e){g.level=e,t.is_main&&Array.isArray(g.workers)&&a.postMessage(g.workers,"_logSetLevelProxy",e)},t.is_main&&(g.setWorkers=function(e){g.workers=e},g.reset=function(){m={}}),a.addTarget("_logProxy",g),a.addTarget("_logSetLevelProxy",g.setLevel);const y={};let b;a.addTarget("Utils",y),y.isSafari=function(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)},y.isMicrosoft=function(){return/(Trident\/7.0|Edge[ /](\d+[.\d]+))/i.test(navigator.userAgent)},y._requests={},y._proxy_requests={},y.io=function(e,n=6e4,r="text",i="GET",o={},s=null,l=!1){if(t.is_worker&&y.isMicrosoft())return g("debug","Proxying request for URL to worker",e),s&&(y._proxy_requests[s]=!0),a.postMessage("Utils.io",e,n,r,i,o,s,!0);var u=new XMLHttpRequest,c=new Promise((t,s)=>{if(u.open(i,e,!0),u.timeout=n,u.responseType=r,o&&"object"==typeof o)for(let e in o)u.setRequestHeader(e,o[e]);u.onload=()=>{200===u.status?["text","json"].indexOf(u.responseType)>-1?t({body:u.responseText,status:u.status}):t({body:u.response,status:u.status}):204===u.status?t({body:null,status:u.status}):s(Error("Request error with a status of "+u.statusText))},u.onerror=e=>{s(Error("There was a network error"+e.toString()))},u.ontimeout=e=>{s(Error("timeout "+e.toString()))},u.send()});return c=c.then(e=>(s&&delete y._requests[s],l?a.withTransferables(e):e)),s&&(y._requests[s]=u),c},y.cancelRequest=function(e){if(t.is_worker&&y._proxy_requests[e])return a.postMessage("Utils.cancelRequest",e);y._requests[e]?(g("trace",`Cancelling network request key '${e}'`),y._requests[e].abort(),delete y._requests[e]):g("trace",`Could not find network request key '${e}'`)},y.serializeWithFunctions=function(e){return"function"==typeof e?e.toString():JSON.stringify(e,function(e,t){return"function"==typeof t?t.toString():t})},y.use_high_density_display=!0,y.updateDevicePixelRatio=function(){let e=y.device_pixel_ratio;return y.device_pixel_ratio=y.use_high_density_display&&window.devicePixelRatio||1,y.device_pixel_ratio!==e},t.is_main&&y.updateDevicePixelRatio(),y.isPowerOf2=function(e){return!(e&e-1)},y.interpolate=function(e,t,n){if(!Array.isArray(t)||!Array.isArray(t[0]))return t;if(t.length<1)return t;var r,i,o,s,a;if(e<=t[0][0])s=t[0][1],"function"==typeof n&&(s=n(s));else if(e>=t[t.length-1][0])s=t[t.length-1][1],"function"==typeof n&&(s=n(s));else for(var l=0;l<t.length-1;l++)if(e>=t[l][0]&&e<t[l+1][0]){if(r=t[l][0],i=t[l+1][0],Array.isArray(t[l][1])){s=[];for(var u=0;u<t[l][1].length;u++)"function"==typeof n?(a=n(t[l][1][u]),o=n(t[l+1][1][u])-a,s[u]=o*(e-r)/(i-r)+a):(o=t[l+1][1][u]-t[l][1][u],s[u]=o*(e-r)/(i-r)+t[l][1][u])}else"function"==typeof n?(a=n(t[l][1]),s=(o=n(t[l+1][1])-a)*(e-r)/(i-r)+a):s=(o=t[l+1][1]-t[l][1])*(e-r)/(i-r)+t[l][1];break}return s},y.toCSSColor=function(e){if(null!=e)return 1===e[3]?`rgb(${e.slice(0,3).map(e=>Math.round(255*e)).join(", ")})`:`rgba(${e.map((e,t)=>t<3&&Math.round(255*e)||e).join(", ")})`};var v=b={draw_label_collision_boxes:!1,draw_label_texture_boxes:!1,suppress_label_fade_in:!1,suppress_label_snap_animation:!1,show_hidden_labels:!1,layer_stats:!1,wireframe:!1};function _(e){if("string"==typeof e&&-1===e.search(/^(data|blob):/)){let t=e.indexOf("?");t>-1&&(e=e.substr(0,t));let n=e.indexOf("#");return n>-1&&(e=e.substr(0,n)),e.substr(0,e.lastIndexOf("/")+1)||""}return""}function x(e){if("string"==typeof e)return!(e.search(/^(http|https|data|blob):/)>-1||"//"===e.substr(0,2))}let w;function E(e,t){e=e.replace(/[[]/,"\\[").replace(/[\]]/,"\\]");var n=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(t);return null===n?"":decodeURIComponent(n[1].replace(/\+/g," "))}const S={id:0,queue:[],max_time:20,start_time:null,state:{},add(e){e.id=S.id++,e.max_time=e.max_time||S.max_time,e.pause_factor=e.pause_factor||1;let t=new Promise((t,n)=>{e.resolve=t,e.reject=n});return e.promise=t,e.elapsed=0,e.total_elapsed=0,e.stats={calls:0},this.queue.push(e),this.start_time=this.start_time||performance.now(),this.elapsed=performance.now()-this.start_time,(this.elapsed<S.max_time||e.immediate)&&this.process(e),e.promise},remove(e){let t=this.queue.indexOf(e);t>-1&&this.queue.splice(t,1)},process(e){if(!this.state.user_moving_view||!1!==e.user_moving_view)return e.pause?(e.pause--,!0):(e.stats.calls++,e.start_time=performance.now(),e.run(e))},processAll(){this.start_time=this.start_time||performance.now();for(let e=0;e<this.queue.length;e++){let t=this.queue[e];if(!0!==this.process(t)&&(t.pause||(t.pause=t.elapsed>t.max_time?t.pause_factor:0),t.total_elapsed+=t.elapsed),this.elapsed=performance.now()-this.start_time,this.elapsed>=S.max_time){this.start_time=null;break}}},finish(e,t){return e.elapsed=performance.now()-e.start_time,e.total_elapsed+=e.elapsed,this.remove(e),e.resolve(t),e.promise},cancel(e){let t;e.cancel instanceof Function&&(t=e.cancel(e)),e.resolve(t)},shouldContinue(e){return e.elapsed=performance.now()-e.start_time,this.elapsed=performance.now()-this.start_time,e.elapsed<e.max_time&&this.elapsed<S.max_time},removeForTile(e){for(let t=this.queue.length-1;t>=0;t--)this.queue[t].tile_id===e&&(this.cancel(this.queue[t]),this.queue.splice(t,1))},setState(e){this.state=e}};function T(e){let t=[];return Object.assign(e,{subscribe(e){-1===t.indexOf(e)&&t.push(e)},unsubscribe(e){let n=t.indexOf(e);n>-1&&t.splice(n,1)},unsubscribeAll(){t=[]},trigger(e,...n){t.forEach(t=>{if("function"==typeof t[e])try{t[e](...n)}catch(t){g("warn",`Caught exception in listener for event '${e}':`,t)}})},hasSubscribersFor(e){let n=!1;return t.forEach(t=>{"function"==typeof t[e]&&(n=!0)}),n}})}function k(e,t){let n={};return t.forEach(t=>n[t]=e[t]),n}class O{constructor(e,t,n={}){n=O.sliceOptions(n),this.gl=e,this.texture=e.createTexture(),this.texture&&(this.valid=!0),this.bind(),this.name=t,this.retain_count=0,this.config_type=null,this.loading=null,this.loaded=!1,this.filtering=n.filtering,this.density=n.density||1,this.sprites=n.sprites,this.texcoords={},this.sizes={},this.css_sizes={},this.aspects={},this.setData(1,1,new Uint8Array([0,0,0,0]),{filtering:"nearest"}),this.loaded=!1,O.textures[this.name]&&(this.retain_count=O.textures[this.name].retain_count,O.textures[this.name].retain_count=0,O.textures[this.name].destroy()),O.textures[this.name]=this,O.texture_configs[this.name]=JSON.stringify(Object.assign({name:t},n)),this.load(n),g("trace",`creating Texture ${this.name}`)}destroy({force:e}={}){this.retain_count>0&&!e?g("error",`Texture '${this.name}': destroying texture with retain count of '${this.retain_count}'`):this.valid&&(this.gl.deleteTexture(this.texture),this.texture=null,O.textures[this.name]===this&&(delete O.textures[this.name],delete O.texture_configs[this.name]),this.valid=!1,g("trace",`destroying Texture ${this.name}`))}retain(){this.retain_count++}release(){this.retain_count<=0&&g("error",`Texture '${this.name}': releasing texture with retain count of '${this.retain_count}'`),this.retain_count--,this.retain_count<=0&&this.destroy()}bind(e=0){this.valid&&(O.activeUnit!==e&&(this.gl.activeTexture(this.gl.TEXTURE0+e),O.activeUnit=e,O.boundTexture=null),O.boundTexture!==this.texture&&(this.gl.bindTexture(this.gl.TEXTURE_2D,this.texture),O.boundTexture=this.texture))}load(e){return e?(this.loading=null,"string"==typeof e.url?(this.config_type="url",this.setUrl(e.url,e)):e.element?(this.config_type="element",this.setElement(e.element,e)):e.data&&e.width&&e.height&&(this.config_type="data",this.setData(e.width,e.height,e.data,e)),this.loading=this.loading&&this.loading.then(()=>(this.calculateSprites(),this))||Promise.resolve(this),this.loading):this.loading||Promise.resolve(this)}setUrl(e,t={}){if(this.valid)return this.url=e,this.loading=new Promise(e=>{let n=new Image;n.onload=()=>{try{if("data:"===this.url.slice(0,5)){const e=document.createElement("canvas"),r=e.getContext("2d");e.width=n.width,e.height=n.height,r.drawImage(n,0,0),this.setElement(e,t)}else this.setElement(n,t)}catch(e){this.loaded=!1,g("warn",`Texture '${this.name}': failed to load url: '${this.url}'`,e,t),O.trigger("warning",{message:`Failed to load texture from ${this.url}`,error:e,texture:t})}this.loaded=!0,e(this)},n.onerror=n=>{this.loaded=!1,g("warn",`Texture '${this.name}': failed to load url: '${this.url}'`,n,t),O.trigger("warning",{message:`Failed to load texture from ${this.url}`,error:n,texture:t}),e(this)},y.isSafari()&&"data:"===this.url.slice(0,5)||(n.crossOrigin="anonymous"),n.src=this.url}),this.loading}setData(e,t,n,r={}){return this.width=e,this.height=t,Array.isArray(n)&&(n=new Uint8Array(n)),this.update(n,r),this.setFiltering(r),this.loaded=!0,this.loading=Promise.resolve(this),this.loading}setElement(e,t){let n=e;if("string"==typeof e&&(e=document.querySelector(e)),e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof HTMLVideoElement)this.update(e,t),this.setFiltering(t);else{this.loaded=!1;let e=`the 'element' parameter (\`element: ${JSON.stringify(n)}\`) must be a CSS `;e+="selector string, or a <canvas>, <image> or <video> object",g("warn",`Texture '${this.name}': ${e}`,t),O.trigger("warning",{message:`Failed to load texture because ${e}`,texture:t})}return this.loaded=!0,this.loading=Promise.resolve(this),this.loading}update(e,t={}){this.valid&&(this.bind(),e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLImageElement&&e.complete?(this.width=e.width,this.height=e.height,this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1!==t.UNPACK_FLIP_Y_WEBGL),this.gl.pixelStorei(this.gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.UNPACK_PREMULTIPLY_ALPHA_WEBGL||!1),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e)):(this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,null),this.gl.pixelStorei(this.gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,null),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.width,this.height,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e)),O.trigger("update",this))}setFiltering(e={}){if(this.valid){e.filtering=e.filtering||"linear";var t=this.gl;this.bind(),y.isPowerOf2(this.width)&&y.isPowerOf2(this.height)?(this.power_of_2=!0,t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,e.TEXTURE_WRAP_S||e.repeat&&t.REPEAT||t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,e.TEXTURE_WRAP_T||e.repeat&&t.REPEAT||t.CLAMP_TO_EDGE),"mipmap"===e.filtering?(this.filtering="mipmap",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.generateMipmap(t.TEXTURE_2D)):"linear"===e.filtering?(this.filtering="linear",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR)):"nearest"===e.filtering&&(this.filtering="nearest",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST))):(this.power_of_2=!1,t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),"nearest"===e.filtering?(this.filtering="nearest",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST)):(this.filtering="linear",t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR))),O.trigger("update",this)}}calculateSprites(){if(this.sprites)for(let e in this.sprites){let t=this.sprites[e];this.texcoords[e]=O.getTexcoordsForSprite([t[0],t[1]],[t[2],t[3]],[this.width,this.height]),this.sizes[e]=[t[2],t[3]],this.css_sizes[e]=[t[2]/this.density,t[3]/this.density],this.aspects[e]=t[2]/t[3]}}byteSize(){return Math.round(this.width*this.height*4*("mipmap"==this.filtering?1.33:1))}}O.create=function(e,t,n){return new O(e,t,n)},O.retain=function(e){O.textures[e]&&O.textures[e].retain()},O.release=function(e){O.textures[e]&&O.textures[e].release()},O.destroy=function(e){Object.keys(O.textures).forEach(t=>{var n=O.textures[t];n.gl===e&&n.destroy({force:!0})})},O.getSpriteInfo=function(e,t){let n=O.textures[e];return n&&{size:n.sizes[t],css_size:n.css_sizes[t],aspect:n.aspects[t],texcoords:n.texcoords[t]}},O.getTexcoordsForSprite=function(e,t,n){var r=n[1]-e[1]-t[1];return[e[0]/n[0],r/n[1],(t[0]+e[0])/n[0],(t[1]+r)/n[1]]},O.createFromObject=function(e,t){let n=[];if(t)for(let r in t){let i=t[r];if(i.skip_create)continue;if(!O.changed(r,i))continue;let o=O.create(e,r,i);n.push(o.loading)}return Promise.all(n)},O.default="__default",O.createDefault=function(e){return O.create(e,O.default)},O.sliceOptions=function(e){return{filtering:e.filtering,sprites:e.sprites,url:e.url,element:e.element,data:e.data,width:e.width,height:e.height,density:e.density,repeat:e.repeat,TEXTURE_WRAP_S:e.TEXTURE_WRAP_S,TEXTURE_WRAP_T:e.TEXTURE_WRAP_T,UNPACK_FLIP_Y_WEBGL:e.UNPACK_FLIP_Y_WEBGL,UNPACK_PREMULTIPLY_ALPHA_WEBGL:e.UNPACK_PREMULTIPLY_ALPHA_WEBGL}},O.changed=function(e,t){let n=O.textures[e];if(n){if("element"===n.config_type||null!=t.element)return!0;if(t=O.sliceOptions(t),O.texture_configs[e]===JSON.stringify(Object.assign({name:e},t)))return!1}return!0},O.getInfo=function(e){if(e||(e=Object.keys(O.textures)),Array.isArray(e))return Promise.all(e.map(e=>O.getInfo(e)));var t=O.textures[e];return t?(t.loading||Promise.resolve(t)).then(()=>({name:t.name,width:t.width,height:t.height,density:t.density,css_size:[t.width/t.density,t.height/t.density],aspect:t.width/t.height,sprites:t.sprites,texcoords:t.texcoords,sizes:t.sizes,css_sizes:t.css_sizes,aspects:t.aspects,filtering:t.filtering,power_of_2:t.power_of_2,valid:t.valid})):Promise.resolve(null)},O.syncTexturesToWorker=function(e){return a.postMessage("Texture.getInfo",e).then(e=>(e&&e.filter(e=>e).forEach(e=>O.textures[e.name]=e),O.textures))},O.getMaxTextureSize=function(e){return e.getParameter(e.MAX_TEXTURE_SIZE)},O.textures={},O.texture_configs={},O.boundTexture=null,O.activeUnit=null,a.addTarget("Texture",O),T(O);var A={parseUniforms:function(e={}){var t=[];for(const[n,r]of Object.entries(e))if("number"==typeof r)t.push({type:"float",method:"1f",name:n,value:r,path:[n]});else if(Array.isArray(r)){if("number"==typeof r[0])r.length>=2&&r.length<=4?t.push({type:"vec"+r.length,method:r.length+"fv",name:n,value:r,path:[n]}):r.length>4&&t.push({type:"float[]",method:"1fv",name:n+"[0]",value:r,path:[n]});else if("string"==typeof r[0])for(let e=0;e<r.length;e++)t.push({type:"sampler2D",method:"1i",name:n+"["+e+"]",value:r[e],path:[n,e]});else if(Array.isArray(r[0])&&"number"==typeof r[0][0]&&r[0].length>=2&&r[0].length<=4)for(let e=0;e<r.length;e++)t.push({type:"vec"+r[0].length,method:r[0].length+"fv",name:n+"["+e+"]",value:r[e],path:[n,e]})}else"boolean"==typeof r?t.push({type:"bool",method:"1i",name:n,value:r,path:[n]}):"string"==typeof r&&t.push({type:"sampler2D",method:"1i",name:n,value:r,path:[n]});return t},defineVariable:function(e,t){var n,r;if("number"==typeof t)n="float";else if(Array.isArray(t))"number"==typeof t[0]?t.length>=2&&t.length<=4?n="vec"+t.length:(n="float",r=t.length):"string"==typeof t[0]?(n="sampler2D",r=t.length):Array.isArray(t[0])&&"number"==typeof t[0][0]&&t[0].length>=2&&t[0].length<=4&&(n="vec"+t[0].length,r=t.length);else if("boolean"==typeof t)n="bool";else{if("string"!=typeof t)return;n="sampler2D"}var i="";return i+=`${n} ${e}`,r&&(i+=`[${r}]`),i+";\n"},defineUniform:function(e,t){var n=A.defineVariable(e,t);if(n)return"uniform "+n},expandVec3:function(e,t=1){let n;if(Array.isArray(e)){if(2!==e.length)return e;n=[...e,t].map(parseFloat)}else n=[e,e,e].map(parseFloat);if(n&&n.every(e=>"number"==typeof e&&!isNaN(e)))return n},expandVec4:function(e,t=1){let n;if(Array.isArray(e)){if(3!==e.length)return e;n=[...e,t].map(parseFloat)}else n=[e,e,e,t].map(parseFloat);if(n&&n.every(e=>"number"==typeof e&&!isNaN(e)))return n}};let C=[];function R(e,t){let n=C.filter(t=>t[0]===e)[0];return n=n&&n[1],n||(C.push([e,{}]),n=C[C.length-1][1]),n[t]||(n[t]=e.getExtension(t)),n[t]}function N(e){var t,n,r=0;if(0===e.length)return r;for(t=0,n=e.length;t<n;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return r}function P(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var M,D,I=(D||(D=1,M=function(e){e=String(e);for(var t,n=[];t=e.match(/ERROR\:([^\n]+)/);){e=e.slice(t.index+1);var r=(s=t[1].trim()).split(":"),i=r.slice(2).join(":").trim(),o=parseInt(r[0],10),s=parseInt(r[1],10);n.push({message:i,file:o,line:s})}return n}),M),z=P(I);const F=/^\s*#pragma.*$/gm,L=/\\\s*\n/gm;class j{constructor(e,t,n,r){r=r||{},this.gl=e,this.program=null,this.compiled=!1,this.compiling=!1,this.error=null,this.defines=Object.assign({},r.defines||{}),this.blocks=Object.assign({},r.blocks||{}),this.block_scopes=Object.assign({},r.block_scopes||{}),this.extensions=r.extensions||[],this.dependent_uniforms=r.uniforms,this.uniforms={},this.attribs={},this.vertex_source=t,this.fragment_source=n,this.id=j.id++,this.name=r.name}destroy(){this.gl.useProgram(null),this.gl.deleteProgram(this.program),this.program=null,this.uniforms={},this.attribs={},this.compiled=!1}use(){this.compiled&&(j.current!==this&&this.gl.useProgram(this.program),j.current=this)}compile(){if(this.compiling)throw new Error(`ShaderProgram.compile(): skipping for ${this.id} (${this.name}) because already compiling`);this.compiling=!0,this.compiled=!1,this.error=null,this.computed_vertex_source=this.vertex_source,this.computed_fragment_source=this.fragment_source;let e=this.checkExtensions();var t,n=this.buildDefineList(),r=this.buildShaderBlockList();for(var i in r){var o=r[i];if(o&&(!Array.isArray(o)||0!==o.length)){t=new RegExp("^\\s*#pragma\\s+tangram:\\s+"+i+"\\s*$","m");var s=this.computed_vertex_source.match(t),a=this.computed_fragment_source.match(t);if(null!=s||null!=a){var l="";o.forEach(e=>{let t=`${e.scope}, ${e.key}, ${e.num}`;l+=`\n// tangram-block-start: ${t}\n`,l+=e.source,l+=`\n// tangram-block-end: ${t}\n`}),null!=s&&(this.computed_vertex_source=this.computed_vertex_source.replace(t,l)),null!=a&&(this.computed_fragment_source=this.computed_fragment_source.replace(t,l)),n["TANGRAM_BLOCK_"+i.replace(/[\s-]+/g,"_").toUpperCase()]=!0}}}this.computed_vertex_source=this.computed_vertex_source.replace(F,""),this.computed_fragment_source=this.computed_fragment_source.replace(F,""),this.ensureUniforms(this.dependent_uniforms);let u="",c=this.gl.getShaderPrecisionFormat(this.gl.FRAGMENT_SHADER,this.gl.HIGH_FLOAT);u=c&&c.precision>0?"precision highp float;\n":"precision mediump float;\n",n.TANGRAM_VERTEX_SHADER=!0,n.TANGRAM_FRAGMENT_SHADER=!1,this.computed_vertex_source=u+j.buildDefineString(n)+this.computed_vertex_source,n.TANGRAM_VERTEX_SHADER=!1,n.TANGRAM_FRAGMENT_SHADER=!0,this.computed_fragment_source=j.buildExtensionString(e)+u+j.buildDefineString(n)+this.computed_fragment_source,this.computed_vertex_source=this.computed_vertex_source.replace(L,""),this.computed_fragment_source=this.computed_fragment_source.replace(L,"");try{this.program=j.updateProgram(this.gl,this.program,this.computed_vertex_source,this.computed_fragment_source),this.compiled=!0,this.compiling=!1}catch(e){throw this.program=null,this.compiled=!1,this.compiling=!1,this.error=e,this.error.vertex_shader_source=this.computed_vertex_source,this.error.fragment_shader_source=this.computed_fragment_source,"vertex"!==e.type&&"fragment"!==e.type||(this.shader_errors=e.errors,this.shader_errors.forEach(t=>{t.type=e.type,t.block=this.block(e.type,t.line),t.line=this.block(e.type,t.line)}),this.error.shader_errors=this.shader_errors),e}this.computed_vertex_source=null,this.computed_fragment_source=null,this.use(),this.refreshUniforms(),this.refreshAttributes()}buildDefineList(){var e,t={};for(e in j.defines)t[e]=j.defines[e];for(e in this.defines)t[e]=this.defines[e];return t}buildShaderBlockList(){let e,t={};for(e in j.blocks)t[e]=[],Array.isArray(j.blocks[e])?t[e].push(...j.blocks[e].map((t,n)=>({key:e,source:t,num:n,scope:"ShaderProgram"}))):t[e]=[{key:e,source:j.blocks[e],num:0,scope:"ShaderProgram"}];for(e in this.blocks)if(t[e]=t[e]||[],Array.isArray(this.blocks[e])){let n=this.block_scopes&&this.block_scopes[e]||[],r=null,i=0;for(let o=0;o<this.blocks[e].length;o++)n[o]!==r&&(r=n[o],i=0),t[e].push({key:e,source:this.blocks[e][o],num:i,scope:r||this.name}),i++}else t[e].push({key:e,source:this.blocks[e],num:0,scope:this.name});return t}ensureUniforms(e){if(!e)return;const t=Object.entries(e).map(([e,t])=>A.defineUniform(e,t)).filter(e=>e);this.computed_vertex_source=t.join("\n")+this.computed_vertex_source,this.computed_fragment_source=t.join("\n")+this.computed_fragment_source}setUniforms(e,t=!0){this.compiled&&(t&&(this.texture_unit=0),A.parseUniforms(e).forEach(({name:e,type:t,value:n,method:r})=>{"sampler2D"===t?this.setTextureUniform(e,n):this.uniform(r,e,n)}))}saveUniforms(e){let t=e||this.uniforms;for(let e in t){let t=this.uniforms[e];t&&(t.saved_value=t.value)}this.saved_texture_unit=this.texture_unit||0}restoreUniforms(e){let t=e||this.uniforms;for(let e in t){let t=this.uniforms[e];t&&t.saved_value&&(t.value=t.saved_value,this.updateUniform(t))}this.texture_unit=this.saved_texture_unit||0}setTextureUniform(e,t){var n=O.textures[t];null!=n?(n.bind(this.texture_unit),this.uniform("1i",e,this.texture_unit),this.texture_unit++):g("warn",`Cannot find texture '${t}'`)}uniform(e,t,n){if(!this.compiled)return;this.uniforms[t]=this.uniforms[t]||{};let r=this.uniforms[t];r.name=t,void 0===r.location&&(r.location=this.gl.getUniformLocation(this.program,t)),r.method=e,r.value=n,this.updateUniform(r)}updateUniform(e){this.compiled&&e&&null!=e.location&&(this.use(),this.commitUniform(e))}commitUniform(e){let t=e.location,n=e.value;switch(e.method){case"1i":this.gl.uniform1i(t,n);break;case"1f":this.gl.uniform1f(t,n);break;case"2f":this.gl.uniform2f(t,n[0],n[1]);break;case"3f":this.gl.uniform3f(t,n[0],n[1],n[2]);break;case"4f":this.gl.uniform4f(t,n[0],n[1],n[2],n[3]);break;case"1iv":this.gl.uniform1iv(t,n);break;case"3iv":this.gl.uniform3iv(t,n);break;case"1fv":this.gl.uniform1fv(t,n);break;case"2fv":this.gl.uniform2fv(t,n);break;case"3fv":this.gl.uniform3fv(t,n);break;case"4fv":this.gl.uniform4fv(t,n);break;case"Matrix3fv":this.gl.uniformMatrix3fv(t,!1,n);break;case"Matrix4fv":this.gl.uniformMatrix4fv(t,!1,n)}}refreshUniforms(){if(this.compiled)for(var e in this.uniforms){let t=this.uniforms[e];t.location=this.gl.getUniformLocation(this.program,e),this.updateUniform(t)}}refreshAttributes(){this.attribs={}}attribute(e){if(this.compiled){var t=this.attribs[e]=this.attribs[e]||{};return null!=t.location||(t.name=e,t.location=this.gl.getAttribLocation(this.program,e)),t}}source(e){return"vertex"===e?this.computed_vertex_source:"fragment"===e?this.computed_fragment_source:void 0}lines(e){let t=this.source(e);return t?t.split("\n"):[]}line(e,t){let n=this.lines(e);if(n)return n[t]}block(e,t){let n,r=this.lines(e);for(let e=0;e<t&&e<r.length;e++){let t=r[e],i=t.match(/\/\/ tangram-block-start: ([A-Za-z0-9_-]+), ([A-Za-z0-9_-]+), (\d+)/);i&&i.length>1?n={scope:i[1],name:i[2],num:i[3]}:(i=t.match(/\/\/ tangram-block-end: ([A-Za-z0-9_-]+), ([A-Za-z0-9_-]+), (\d+)/),i&&i.length>1&&(n=null)),n&&(n.line=null==n.line?-1:n.line+1,n.source=t)}return n}checkExtensions(){let e=[];return this.extensions.forEach(t=>{let n=R(this.gl,t),r=`TANGRAM_EXTENSION_${t}`;this.defines[r]=null!=n,n?e.push(t):g("debug",`Could not enable extension '${t}'`)}),e}}j.id=0,j.current=null,j.defines={},j.blocks={},j.reset=function(){j.programs_by_source={},j.shaders_by_source={}},j.reset(),j.buildDefineString=function(e){var t="";for(var n in e)null!=e[n]&&!1!==e[n]&&("boolean"==typeof e[n]&&!0===e[n]?t+="#define "+n+"\n":"number"==typeof e[n]&&Math.floor(e[n])===e[n]?t+="#define "+n+" "+e[n].toFixed(1)+"\n":t+="#define "+n+" "+e[n]+"\n");return t},j.buildExtensionString=function(e){let t="";return(e=e||[]).forEach(e=>{t+=`#ifdef GL_${e}\n#extension GL_${e} : enable\n#endif\n`}),t},j.addBlock=function(e,...t){j.blocks[e]=j.blocks[e]||[],j.blocks[e].push(...t)},j.removeBlock=function(e){j.blocks[e]=[]},j.replaceBlock=function(e,...t){j.removeBlock(e),j.addBlock(e,...t)},j.updateProgram=function(e,t,n,r){let i=N(e._tangram_id+"::"+n+"::"+r);if(j.programs_by_source[i])return g("trace","Reusing identical source GL program object"),j.programs_by_source[i];var o=j.createShader(e,n,e.VERTEX_SHADER),s=j.createShader(e,r,e.FRAGMENT_SHADER);if(e.useProgram(null),null!=t)for(var a=e.getAttachedShaders(t),l=0;l<a.length;l++)e.detachShader(t,a[l]);else t=e.createProgram();if(null==o||null==s)return t;if(e.attachShader(t,o),e.attachShader(t,s),e.bindAttribLocation(t,0,"a_position"),e.linkProgram(t),!e.getProgramParameter(t,e.LINK_STATUS)){let i=new Error(`WebGL program error:\n VALIDATE_STATUS: ${e.getProgramParameter(t,e.VALIDATE_STATUS)}\n ERROR: ${e.getError()}\n --- Vertex Shader ---\n ${n}\n --- Fragment Shader ---\n ${r}`);throw Object.assign(new Error(i),{type:"program"})}return j.programs_by_source[i]=t,t},j.createShader=function(e,t,n){let r=N(e._tangram_id+"::"+t);if(j.shaders_by_source[r])return g("trace","Reusing identical source GL shader object"),j.shaders_by_source[r];let i=e.createShader(n);if(e.shaderSource(i,t),e.compileShader(i),!e.getShaderParameter(i,e.COMPILE_STATUS)){let t=n===e.VERTEX_SHADER?"vertex":"fragment",r=e.getShaderInfoLog(i),o=z(r);throw Object.assign(new Error(r),{type:t,errors:o})}return j.shaders_by_source[r]=i,i};var $,B={disabled:!1,bound_vao:[],init(e){let t;!0!==this.disabled&&(t=R(e,"OES_vertex_array_object")),null!=t?g("info","Vertex Array Object extension available"):!0!==this.disabled?g("warn","Vertex Array Object extension NOT available"):g("warn","Vertex Array Object extension force disabled")},getExtension(e,t){if(!0!==this.disabled)return R(e,t)},create(e,t,n){let r={};r.setup=t,r.teardown=n;let i=this.getExtension(e,"OES_vertex_array_object");return null!=i&&(r._vao=i.createVertexArrayOES(),i.bindVertexArrayOES(r._vao)),r.setup(),r},getCurrentBinding(e){let t=this.bound_vao.filter(t=>t[0]===e)[0];return t&&t[1]},setCurrentBinding(e,t){let n=this.bound_vao,r=n.filter(t=>t[0]===e)[0];null==r?n.push([e,t]):r[1]=t},bind(e,t){let n=this.getExtension(e,"OES_vertex_array_object");if(null!=t)null!=n&&null!=t._vao?(n.bindVertexArrayOES(t._vao),this.setCurrentBinding(e,t)):t.setup();else{let t=this.getCurrentBinding(e);null!=n?n.bindVertexArrayOES(null):null!=t&&"function"==typeof t.teardown&&t.teardown(),this.setCurrentBinding(e,null)}},destroy(e,t){let n=this.getExtension(e,"OES_vertex_array_object");null!=n&&null!=t&&null!=t._vao&&(n.deleteVertexArrayOES(t._vao),t._vao=null)}};function V(e,...t){for(let n=0;n<t.length;n++){let r=t[n];if(r)for(let t in r){let n=r[t];null===n||"object"!=typeof n||Array.isArray(n)?void 0!==n&&(e[t]=n):null===e[t]||"object"!=typeof e[t]||Array.isArray(e[t])?e[t]=V({},n):e[t]=V(e[t],n)}}return e}var U=$={};$.default_source_max_zoom=18,$.default_view_max_zoom=20,$.max_style_zoom=25,$.tile_size=256,$.half_circumference_meters=20037508.342789244,$.circumference_meters=2*$.half_circumference_meters,$.min_zoom_meters_per_pixel=$.circumference_meters/$.tile_size;let W=[];$.metersPerPixel=function(e){return W[e]=W[e]||$.min_zoom_meters_per_pixel/Math.pow(2,e),W[e]};let q=[];$.metersPerTile=function(e){return q[e]=q[e]||$.circumference_meters/Math.pow(2,e),q[e]},$.tile_scale=4096,$.units_per_pixel=$.tile_scale/$.tile_size,$.height_scale=16;let G=[];$.unitsPerMeter=function(e){return G[e]=G[e]||$.tile_scale/($.tile_size*$.metersPerPixel(e)),G[e]},$.metersForTile=function(e){return{x:e.x*$.circumference_meters/Math.pow(2,e.z)-$.half_circumference_meters,y:-(e.y*$.circumference_meters/Math.pow(2,e.z)-$.half_circumference_meters)}},$.tileForMeters=function([e,t],n){return{x:Math.floor((e+$.half_circumference_meters)/($.circumference_meters/Math.pow(2,n))),y:Math.floor((-t+$.half_circumference_meters)/($.circumference_meters/Math.pow(2,n))),z:n}},$.wrapTile=function({x:e,y:t,z:n},r={x:!0,y:!1}){var i=(1<<n)-1;return r.x&&(e&=i),r.y&&(t&=i),{x:e,y:t,z:n}},$.metersToLatLng=function(e){return e[0]/=$.half_circumference_meters,e[1]/=$.half_circumference_meters,e[1]=(2*Math.atan(Math.exp(e[1]*Math.PI))-Math.PI/2)/Math.PI,e[0]*=180,e[1]*=180,e},$.latLngToMeters=function(e){return e[1]=Math.log(Math.tan(e[1]*Math.PI/360+Math.PI/4))/Math.PI,e[1]*=$.half_circumference_meters,e[0]*=$.half_circumference_meters/180,e},$.tileSpaceToLatlng=function(e,t,n){const r=$.unitsPerMeter(t);return $.transformGeometry(e,e=>{e[0]=e[0]/r+n.x,e[1]=e[1]/r+n.y,$.metersToLatLng(e)}),e},$.copyGeometry=function(e){if(null==e)return;let t={type:e.type};return"Point"===e.type?t.coordinates=[e.coordinates[0],e.coordinates[1]]:"LineString"===e.type||"MultiPoint"===e.type?t.coordinates=e.coordinates.map(e=>[e[0],e[1]]):"Polygon"===e.type||"MultiLineString"===e.type?t.coordinates=e.coordinates.map(e=>e.map(e=>[e[0],e[1]])):"MultiPolygon"===e.type&&(t.coordinates=e.coordinates.map(e=>e.map(e=>e.map(e=>[e[0],e[1]])))),t},$.transformGeometry=function(e,t){null!=e&&("Point"===e.type?t(e.coordinates):"LineString"===e.type||"MultiPoint"===e.type?e.coordinates.forEach(t):"Polygon"===e.type||"MultiLineString"===e.type?e.coordinates.forEach(e=>e.forEach(t)):"MultiPolygon"===e.type&&e.coordinates.forEach(e=>{e.forEach(e=>e.forEach(t))}))},$.boxIntersect=function(e,t){return!(t.sw.x>e.ne.x||t.ne.x<e.sw.x||t.sw.y>e.ne.y||t.ne.y<e.sw.y)},$.findBoundingBox=function(e){for(var t=1/0,n=-1/0,r=1/0,i=-1/0,o=e[0].length,s=0;s<o;s++){var a=e[0][s];a[0]<t&&(t=a[0]),a[1]<r&&(r=a[1]),a[0]>n&&(n=a[0]),a[1]>i&&(i=a[1])}return[t,r,n,i]},$.geometryType=function(e){return"Polygon"===e||"MultiPolygon"===e?"polygon":"LineString"===e||"MultiLineString"===e?"line":"Point"===e||"MultiPoint"===e?"point":void 0},$.centroid=function(e,t=!0){if(!e||0===e.length)return;let n,r=0,i=0,o=0,s=e[0],a=s.length;t&&(n=s[0],s=s.map(e=>[e[0]-n[0],e[1]-n[1]]));for(let e=0,t=a-1;e<a;t=e,e++){let n=s[e],a=s[t],l=n[1]*a[0]-a[1]*n[0];r+=(n[0]+a[0])*l,i+=(n[1]+a[1])*l,o+=3*l}if(!o)return;let l=[r/o,i/o];return t&&(l[0]+=n[0],l[1]+=n[1]),l},$.multiCentroid=function(e){let t=0,n=null;for(let r=0;r<e.length;r++){let i=$.centroid(e[r]);i&&(n=n||[0,0],n[0]+=i[0],n[1]+=i[1],t++)}return t>0&&(n[0]/=t,n[1]/=t),n},$.signedPolygonRingAreaSum=function(e){let t=0,n=e.length;for(let r=0;r<n-1;r++){let n=e[r],i=e[r+1];t+=n[0]*i[1]-i[0]*n[1]}return t+=e[n-1][0]*e[0][1]-e[0][0]*e[n-1][1],t},$.polygonRingArea=function(e){return Math.abs($.signedPolygonRingAreaSum(e))/2},$.polygonArea=function(e){if(e)return $.polygonRingArea(e[0])},$.multiPolygonArea=function(e){let t=0;for(let n=0;n<e.length;n++)t+=$.polygonArea(e[n]);return t},$.ringWinding=function(e){let t=$.signedPolygonRingAreaSum(e);return t>0?"CW":t<0?"CCW":void 0};const H={functions:{},num_functions:0,num_cached:0};function Y(e,t){if("string"==typeof e)e=K(e,t);else if(null!=e&&"object"==typeof e)for(let n in e)e[n]=Y(e[n],t);return e}function K(e,t){let n="string"==typeof e&&e.match(/^\s*function[^(]*\(([^)]*)\)\s*?\{([\s\S]*)\}$/m);if(n&&n.length>2)try{const e=n[2],r="function"==typeof t?t(e):e,i=N(r);if(void 0===H.functions[i]){let t=n[1].length>0&&n[1].split(",").map(e=>e.trim()).filter(e=>e);t=t.length>0?t:["context"],H.functions[i]=new Function(t.toString(),r),H.functions[i].source=e,H.num_functions++}else H.num_cached++;return H.functions[i]}catch(t){return e}return e}var X,Z={},J=P(function(){if(X)return Z;X=1;var e={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function t(e){return(e=Math.round(e))<0?0:e>255?255:e}function n(e){return e<0?0:e>1?1:e}function r(e){return"%"===e[e.length-1]?t(parseFloat(e)/100*255):t(parseInt(e))}function i(e){return"%"===e[e.length-1]?n(parseFloat(e)/100):n(parseFloat(e))}function o(e,t,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?e+(t-e)*n*6:2*n<1?t:3*n<2?e+(t-e)*(2/3-n)*6:e}try{Z.parseCSSColor=function(n){var s,a=n.replace(/ /g,"").toLowerCase();if(a in e)return e[a].slice();if("#"===a[0])return 4===a.length?(s=parseInt(a.substr(1),16))>=0&&s<=4095?[(3840&s)>>4|(3840&s)>>8,240&s|(240&s)>>4,15&s|(15&s)<<4,1]:null:7===a.length&&(s=parseInt(a.substr(1),16))>=0&&s<=16777215?[(16711680&s)>>16,(65280&s)>>8,255&s,1]:null;var l=a.indexOf("("),u=a.indexOf(")");if(-1!==l&&u+1===a.length){var c=a.substr(0,l),d=a.substr(l+1,u-(l+1)).split(","),h=1;switch(c){case"rgba":if(4!==d.length)return null;h=i(d.pop());case"rgb":return 3!==d.length?null:[r(d[0]),r(d[1]),r(d[2]),h];case"hsla":if(4!==d.length)return null;h=i(d.pop());case"hsl":if(3!==d.length)return null;var p=(parseFloat(d[0])%360+360)%360/360,f=i(d[1]),m=i(d[2]),g=m<=.5?m*(f+1):m+f-m*f,y=2*m-g;return[t(255*o(y,g,p+1/3)),t(255*o(y,g,p)),t(255*o(y,g,p-1/3)),h];default:return null}}return null}}catch(e){}return Z}());const Q={},ee=e=>Math.max(e,0),te=e=>isNaN(e)?0:e,ne=e=>Array.isArray(e)?e.map(parseFloat).map(te):te(parseFloat(e)),re=e=>Array.isArray(e)?e.map(ne).map(ee):ee(ne(e));Object.assign(Q,{clampPositive:ee,noNaN:te,parseNumber:ne,parsePositiveNumber:re}),Q.wrapFunction=function(e){return`\n var feature = context.feature.properties;\n var global = context.global;\n var $zoom = context.zoom;\n var $layer = context.layer;\n var $source = context.source;\n var $geometry = context.geometry;\n var $meters_per_pixel = context.meters_per_pixel;\n var $id = context.id;\n\n var val = (function(){ ${e} }());\n\n if (typeof val === 'number' && isNaN(val)) {\n val = null; // convert NaNs to nulls\n }\n\n return val;\n `},Q.zeroPair=Object.freeze([0,0]),Q.defaults={color:[1,1,1,1],width:1,size:1,extrude:!1,height:20,min_height:0,order:0,z:0,outline:{color:[0,0,0,0],width:0},material:{ambient:1,diffuse:1}},Q.macros={"Style.color.pseudoRandomColor":function(){return[parseInt(feature.id,16)/100%1*.7,parseInt(feature.id,16)/1e4%1*.7,parseInt(feature.id,16)/1e6%1*.7,1]},"Style.color.randomColor":function(){return[.7*Math.random(),.7*Math.random(),.7*Math.random(),1]}},Q.getFeatureParseContext=function(e,t,n){return{feature:e,id:e.id,tile:t,global:n,zoom:t.style_z,geometry:U.geometryType(e.geometry.type),meters_per_pixel:t.meters_per_pixel,meters_per_pixel_sq:t.meters_per_pixel_sq,units_per_meter_overzoom:t.units_per_meter_overzoom}};const ie={STATIC:0,DYNAMIC:1,ZOOM:2};Q.CACHE_TYPE=ie,Q.createPropertyCache=function(e,t=null,n=null){if(null==e)return;if(e.value)return{value:e.value,zoom:e.zoom?{}:null,type:e.type};let r={value:e,type:ie.STATIC};return Array.isArray(r.value)&&Array.isArray(r.value[0])?(r.zoom={},r.type=ie.ZOOM):"function"==typeof r.value&&(r.type=ie.DYNAMIC,r.dynamic_transform="function"==typeof n?n:null),"function"==typeof t&&(r.zoom?r.value=r.value.map((e,n)=>[e[0],t(e[1],n)]):"function"!=typeof r.value&&(r.value=t(r.value,0))),r},Q.createColorPropertyCache=function(e){return Q.createPropertyCache(e,e=>"Style.color.pseudoRandomColor"===e?K(Q.wrapFunction(Q.macros["Style.color.pseudoRandomColor"])):"Style.color.randomColor"===e?Q.macros["Style.color.randomColor"]:e)};const oe=e=>"string"==typeof e&&"%"===e[e.length-1],se=e=>"auto"===e,ae=e=>oe(e)||se(e),le="'size' can specify either width or height as derived from aspect ratio, but not both";function ue(e,t){return Q.createPropertyCache(e.value,(n,r)=>(Array.isArray(n)?(n=n.map((t,n)=>e.has_ratio[r][n]?t:re(t)).map((n,i)=>e.has_pct[r][i]?t.css_size[i]*n/100:n),e.has_ratio[r][0]?n[0]=n[1]*t.aspect:e.has_ratio[r][1]&&(n[1]=n[0]/t.aspect)):(n=re(n),n=e.has_pct[r]?t.css_size.map(e=>e*n/100):[n,n]),n))}function ce(e,t){try{return e(t)}catch(n){g("warn",`Property function in layer '${t.layers[t.layers.length-1]}' failed with\n`,`error ${n.stack}\n`,`function '${e.source}'\n`,t.feature,t)}}Q.createPointSizePropertyCache=function(e,t){let n=null,r=null;if(oe(e))n=[!0];else if(Array.isArray(e)){if(Array.isArray(e[0])){if(e.some(e=>Array.isArray(e[1])?e[1].some(e=>ae(e)):oe(e[1]))&&(n=e.map(e=>Array.isArray(e[1])?e[1].map(e=>oe(e)):oe(e[1])),r=e.map(e=>Array.isArray(e[1])&&e[1].map(e=>se(e))),r.some(e=>Array.isArray(e)&&e.every(e=>e))))throw le}else if(e.some(ae)&&(n=[e.map(oe)],r=[e.map(se)],r[0].every(e=>e)))throw le}else if(se(e))throw"this value only allowed as half of an array, eg [16px, auto]:";if(n||r){if(!t)throw"% or 'auto' keywords can only be used to specify point size when a texture is defined";(e={value:e}).has_pct=n,e.has_ratio=r,e.sprites={}}else e=Q.createPropertyCache(e,re);return e},Q.evalCachedPointSizeProperty=function(e,t,n,r){if(null!=e)return e.has_pct||e.has_ratio?t?(e.sprites[t.sprite]||(e.sprites[t.sprite]=ue(e,t)),Q.evalCachedProperty(e.sprites[t.sprite],r)):(e.texture=e.texture||ue(e,n),Q.evalCachedProperty(e.texture,r)):Q.evalCachedProperty(e,r)},Q.evalCachedProperty=function(e,t){return null==e?void 0:e.dynamic?ce(e.dynamic,t):e.static?e.static:e.zoom&&e.zoom[t.zoom]?e.zoom[t.zoom]:"function"==typeof e.value?(e.dynamic_transform?e.dynamic=function(t){return e.dynamic_transform(e.value(t))}:e.dynamic=e.value,ce(e.dynamic,t)):Array.isArray(e.value)&&Array.isArray(e.value[0])?(e.zoom=e.zoom||{},e.zoom[t.zoom]=y.interpolate(t.zoom,e.value),e.zoom[t.zoom]):(e.static=e.value,e.static)},Q.convertUnits=function(e,t){if(null!=e.value)return"px"===e.units?e.value*U.metersPerPixel(t.zoom):e.value;if("string"==typeof e)"px"===e.trim().slice(-2)?(e=ne(e),e*=U.metersPerPixel(t.zoom)):e=ne(e);else if(Array.isArray(e))return Array.isArray(e[0])?e.map(e=>[e[0],Q.convertUnits(e[1],t)]):e.map(e=>Q.convertUnits(e,t));return e},Q.parseUnits=function(e){var t={value:ne(e)};return 0!==t.value&&"string"==typeof e&&"px"===e.trim().slice(-2)&&(t.units="px"),t},Q.evalCachedDistanceProperty=function(e,t){return null==e?void 0:e.dynamic?ce(e.dynamic,t):e.zoom&&e.zoom[t.zoom]?e.zoom[t.zoom]:"function"==typeof e.value?(e.dynamic=e.value,ce(e.dynamic,t)):e.zoom?(e.zoom[t.zoom]=y.interpolate(t.zoom,e.value,e=>Q.convertUnits(e,t)),e.zoom[t.zoom]):Q.convertUnits(e.value,t)},Q.string_colors={},Q.colorForString=function(e){if(Q.string_colors[e])return Q.string_colors[e];let t=J.parseCSSColor(e);return t&&4===t.length?(t[0]/=255,t[1]/=255,t[2]/=255):t=Q.defaults.color,Q.string_colors[e]=t,t},Q.evalCachedColorProperty=function(e,t={}){if(null!=e){if(e.dynamic){let n=ce(e.dynamic,t);return"string"==typeof n&&(n=Q.colorForString(n)),n&&null==n[3]&&(n[3]=1),n}if(e.static)return e.static;if(e.zoom&&e.zoom[t.zoom])return e.zoom[t.zoom];if("function"==typeof e.value){e.dynamic=e.value;let n=ce(e.dynamic,t);return"string"==typeof n&&(n=Q.colorForString(n)),n&&null==n[3]&&(n[3]=1),n}if("string"==typeof e.value)return e.static=Q.colorForString(e.value),e.static;if(e.zoom){if(!e.zoom_preprocessed){for(let t=0;t<e.value.length;t++){let n=e.value[t];n&&"string"==typeof n[1]&&(n[1]=Q.colorForString(n[1]))}e.zoom_preprocessed=!0}return e.zoom[t.zoom]=y.interpolate(t.zoom,e.value),e.zoom[t.zoom][3]=e.zoom[t.zoom][3]||1,e.zoom[t.zoom]}return e.static=e.value.map(e=>e),e.static&&null==e.static[3]&&(e.static[3]=1),e.static}},Q.evalCachedColorPropertyWithAlpha=function(e,t,n){const r=Q.evalCachedColorProperty(e,n);if(null!=r&&null!=t){const e=Q.evalCachedProperty(t,n);if(null!=e)return[r[0],r[1],r[2],e]}return r},Q.parseColor=function(e,t={}){if("function"==typeof e&&(e=ce(e,t)),"string"==typeof e)e=Q.colorForString(e);else if(Array.isArray(e)&&Array.isArray(e[0])){for(let t=0;t<e.length;t++){let n=e[t];"string"==typeof n[1]&&(n[1]=Q.colorForString(n[1]))}t.zoom&&(e=y.interpolate(t.zoom,e))}return Array.isArray(e)?null==(e=e.map(e=>e))[3]&&(e[3]=1):e=[0,0,0,1],e},Q.calculateOrder=function(e,t){return"function"==typeof e?e=ce(e,t):"string"==typeof e&&(e=t.feature.properties[e]?t.feature.properties[e]:re(e)),e},Q.evalProperty=function(e,t){return"function"==typeof e?ce(e,t):e};class de{constructor(e,t,n){this.gl=e,this.workers=t,this._lock_fn="function"==typeof n&&n,this.init()}init(){this.requests={},this.feature=null,this.read_delay=0,this.read_delay_timer=null,this.pixels=null,this.fbo=this.gl.createFramebuffer(),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.fbo),this.fbo_size={width:256,height:256};var e=O.create(this.gl,"__selection_fbo",{filtering:"nearest"});e.setData(this.fbo_size.width,this.fbo_size.height,null,{filtering:"nearest"}),this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,this.gl.TEXTURE_2D,e.texture,0);var t=this.gl.createRenderbuffer();this.gl.bindRenderbuffer(this.gl.RENDERBUFFER,t),this.gl.renderbufferStorage(this.gl.RENDERBUFFER,this.gl.DEPTH_COMPONENT16,this.fbo_size.width,this.fbo_size.height),this.gl.framebufferRenderbuffer(this.gl.FRAMEBUFFER,this.gl.DEPTH_ATTACHMENT,this.gl.RENDERBUFFER,t),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null)}destroy(){this.gl&&this.fbo&&(this.gl.deleteFramebuffer(this.fbo),this.fbo=null,this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null))}get locked(){return this._lock_fn&&this._lock_fn()||!1}bind(){this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.fbo),this.gl.viewport(0,0,this.fbo_size.width,this.fbo_size.height),this.gl.clearColor(...de.defaultColor)}getFeatureAt(e,{radius:t}){return!e||e.x<0||e.y<0||e.x>1||e.y>1?Promise.resolve({feature:null,changed:!1}):new Promise((n,r)=>{this.selection_request_id=this.selection_request_id+1||0,this.requests[this.selection_request_id]={id:this.selection_request_id,point:e,radius:t,resolve:n,reject:r}})}pendingRequests(){return Object.keys(this.requests).length?this.requests:null}hasPendingRequests(){return null!=this.pendingRequests()}clearPendingRequests(){for(var e in this.requests){var t=this.requests[e];t.sent||(t.reject({request:t}),delete this.requests[e])}}read(){null!=this.read_delay_timer&&clearTimeout(this.read_delay_timer),this.read_delay_timer=setTimeout(()=>{if(!this.locked){var e=this.gl;for(var t in e.bindFramebuffer(e.FRAMEBUFFER,this.fbo),this.requests){var n=this.requests[t];if(n.sent)continue;let r,i,o=255,{point:s,radius:l}=n;if(l){let e=Math.min(this.fbo_size.width,this.fbo_size.height);i={x:Math.min(Math.ceil(2*l.x*this.fbo_size.width),e),y:Math.min(Math.ceil(2*l.y*this.fbo_size.height),e)}}else l={x:0,y:0},i={x:1,y:1};if((null==this.pixels||this.pixels.byteLength<i.x*i.y*4)&&(this.pixels=new Uint8Array(i.x*i.y*4)),this.pixels.fill instanceof Function)this.pixels.fill(0);else for(let e=0;e<this.pixels.length;e++)this.pixels[e]=0;e.readPixels(Math.round((s.x-l.x)*this.fbo_size.width),Math.round((1-s.y-l.y)*this.fbo_size.height),i.x,i.y,e.RGBA,e.UNSIGNED_BYTE,this.pixels);let u=4*(Math.round(i.y/2)*i.x+Math.round(i.x/2)),c=this.pixels[u]+(this.pixels[u+1]<<8)+(this.pixels[u+2]<<16);if(c>0)r=c+(this.pixels[u+3]<<24)>>>0,o=this.pixels[u+3];else{let e=-1>>>0;u=0;for(let t=0;t<i.y;t++)for(let n=0;n<i.x;n++,u+=4)if(c=this.pixels[u]+(this.pixels[u+1]<<8)+(this.pixels[u+2]<<16),c>0){let s=(n-i.x/2)*(n-i.x/2)+(t-i.y/2)*(t-i.y/2);s<=e&&(r=c+(this.pixels[u+3]<<24)>>>0,o=this.pixels[u+3],e=s)}}255!==o?null!=this.workers[o]&&a.postMessage(this.workers[o],"self.getFeatureSelection",{id:n.id,key:r}).then(e=>{this.finishRead(e)}):this.finishRead({id:n.id}),n.sent=!0}e.bindFramebuffer(e.FRAMEBUFFER,null)}},this.read_delay)}finishRead(e){var t=this.requests[e.id];if(t){var n=e.feature,r=!1;(null!=n&&null==this.feature||null==n&&null!=this.feature||null!=n&&null!=this.feature&&JSON.stringify(n)!==JSON.stringify(this.feature))&&(r=!0),this.feature=n,t.resolve({feature:n,changed:r,request:t}),delete this.requests[e.id]}else g("error","FeatureSelection.finishRead(): could not find message",e)}static makeEntry(e){this.map_entry++;var t=255&this.map_entry,n=this.map_entry>>8&255,r=this.map_entry>>16&255,i=this.map_prefix,o=t/255,s=n/255,a=r/255,l=i/255,u=t+(n<<8)+(r<<16)+(i<<24)>>>0;return this.map[u]={color:[o,s,a,l]},this.map_size++,this.tiles[e.key]||(this.tiles[e.key]={entries:[],tile:{key:e.key,coords:e.coords,style_z:e.style_z,source:e.source,generation:e.generation}}),this.tiles[e.key].entries.push(u),this.map[u]}static makeColor(e,t,n){var r=this.makeEntry(t);return r.feature={id:e.id,properties:e.properties,source_name:n.source,source_layer:n.layer,layers:n.layers,tile:this.tiles[t.key].tile},r.color}static reset(e){Array.isArray(e)?e.forEach(e=>this.clearSource(e)):(this.tiles={},this.map={},this.map_size=0,this.map_entry=0)}static clearSource(e){for(let t in this.tiles)this.tiles[t].tile.source===e&&this.clearTile(t)}static clearTile(e){this.tiles[e]&&(this.tiles[e].entries.forEach(e=>delete this.map[e]),this.map_size-=this.tiles[e].entries.length,delete this.tiles[e])}static getMapSize(){return this.map_size}static setPrefix(e){this.map_prefix=e}}var he;de.map={},de.tiles={},de.map_size=0,de.map_entry=0,de.map_prefix=0,de.defaultColor=[0,0,0,1];var pe=he={};he.BYTE=5120,he.UNSIGNED_BYTE=5121,he.SHORT=5122,he.UNSIGNED_SHORT=5123,he.INT=5124,he.UNSIGNED_INT=5125,he.FLOAT=5126;class fe{constructor(e,t,n,r,i){i=i||{},this.gl=e,this.vertex_data=t,this.element_data=n,this.vertex_layout=r,this.vertex_buffer=this.gl.createBuffer(),this.buffer_size=this.vertex_data.byteLength,this.draw_mode=i.draw_mode||this.gl.TRIANGLES,this.data_usage=i.data_usage||this.gl.STATIC_DRAW,this.vertices_per_geometry=3,this.uniforms=i.uniforms,this.textures=i.textures,this.retain=i.retain||!1,this.created_at=+new Date,this.fade_in_time=i.fade_in_time||0,this.vertex_count=this.vertex_data.byteLength/this.vertex_layout.stride,this.element_count=0,this.vaos={},this.toggle_element_array=!1,this.element_data?(this.toggle_element_array=!0,this.element_count=this.element_data.length,this.geometry_count=this.element_count/this.vertices_per_geometry,this.element_type=this.element_data.constructor===Uint16Array?this.gl.UNSIGNED_SHORT:this.gl.UNSIGNED_INT,this.element_buffer=this.gl.createBuffer(),this.buffer_size+=this.element_data.byteLength,this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.element_buffer),this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER,this.element_data,this.data_usage)):this.geometry_count=this.vertex_count/this.vertices_per_geometry,this.upload(),this.retain||(delete this.vertex_data,delete this.element_data),this.valid=!0}render(e={}){if(!this.valid)return!1;var t=e.program||j.current;t.use(),this.uniforms&&(t.saveUniforms(this.uniforms),t.setUniforms(this.uniforms,!1));let n=(+new Date-this.created_at)/1e3;return t.uniform("1f","u_visible_time",n),this.bind(t),this.toggle_element_array?this.gl.drawElements(this.draw_mode,this.element_count,this.element_type,0):this.gl.drawArrays(this.draw_mode,0,this.vertex_count),B.bind(this.gl,null),this.uniforms&&t.restoreUniforms(this.uniforms),n<this.fade_in_time}bind(e){let t=this.vaos[e.id];t?B.bind(this.gl,t):this.vaos[e.id]=B.create(this.gl,()=>{this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertex_buffer),this.toggle_element_array&&this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.element_buffer),this.vertex_layout.enableDynamicAttributes(this.gl,e)}),this.vertex_layout.enableStaticAttributes(this.gl,e)}upload(){this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertex_buffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.vertex_data,this.data_usage)}destroy(){if(!this.valid)return!1;this.valid=!1;for(let e in this.vaos)B.destroy(this.gl,this.vaos[e]);return this.gl.deleteBuffer(this.vertex_buffer),this.vertex_buffer=null,this.element_buffer&&(this.gl.deleteBuffer(this.element_buffer),this.element_buffer=null),delete this.vertex_data,delete this.element_data,this.textures&&this.textures.forEach(e=>O.release(e)),!0}}const me=["emission","ambient","diffuse","specular"];class ge{constructor(e){e=e||{},me.forEach(t=>{const n=e[t];null!=n&&(n.texture?this[t]={texture:n.texture,mapping:n.mapping||"spheremap",scale:A.expandVec3(null!=n.scale?n.scale:1),amount:A.expandVec4(null!=n.amount?n.amount:1)}:"number"==typeof n||Array.isArray(n)?this[t]={amount:A.expandVec4(n)}:this[t]="string"==typeof n?{amount:Q.parseColor(n)}:n)}),this.specular&&(this.specular.shininess=e.shininess?parseFloat(e.shininess):.2),null!=e.normal&&(this.normal={texture:e.normal.texture,mapping:e.normal.mapping||"triplanar",scale:A.expandVec3(null!=e.normal.scale?e.normal.scale:1),amount:null!=e.normal.amount?e.normal.amount:1})}static isValid(e){return null!=e&&(null!=e.emission||null!=e.ambient||null!=e.diffuse||null!=e.specular)}inject(e){me.forEach(t=>{let n=`TANGRAM_MATERIAL_${t.toUpperCase()}`,r=n+"_TEXTURE";e.defines[n]=null!=this[t],this[t]&&this[t].texture&&(e.defines[r]=!0,e.defines[r+"_"+this[t].mapping.toUpperCase()]=!0,e.defines[`TANGRAM_MATERIAL_TEXTURE_${this[t].mapping.toUpperCase()}`]=!0,e.texcoords=e.texcoords||"uv"===this[t].mapping)}),this.normal&&this.normal.texture&&(e.defines.TANGRAM_MATERIAL_NORMAL_TEXTURE=!0,e.defines["TANGRAM_MATERIAL_NORMAL_TEXTURE_"+this.normal.mapping.toUpperCase()]=!0,e.defines[`TANGRAM_MATERIAL_TEXTURE_${this.normal.mapping.toUpperCase()}`]=!0,e.texcoords=e.texcoords||"uv"===this.normal.mapping),e.replaceShaderBlock(ge.block,"/*\n\nDefines globals:\nmaterial\nlight_accumulator_*\n\n*/\n\n\n// MATERIALS\n//\nstruct Material {\n #ifdef TANGRAM_MATERIAL_EMISSION\n vec4 emission;\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE\n vec3 emissionScale;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT\n vec4 ambient;\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE\n vec3 ambientScale;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n vec4 diffuse;\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE\n vec3 diffuseScale;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n vec4 specular;\n float shininess;\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE\n vec3 specularScale;\n #endif\n #endif\n\n\n #ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE\n vec3 normalScale;\n float normalAmount;\n #endif\n};\n\n// Note: uniform is copied to a global instance to allow modification\nuniform Material u_material;\nMaterial material;\n\n#ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE\nuniform sampler2D u_material_emission_texture;\n#endif\n\n#ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE\nuniform sampler2D u_material_ambient_texture;\n#endif\n\n#ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE\nuniform sampler2D u_material_diffuse_texture;\n#endif\n\n#ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE\nuniform sampler2D u_material_specular_texture;\n#endif\n\n#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE\nuniform sampler2D u_material_normal_texture;\n#endif\n\n// Global light accumulators for each property\nvec4 light_accumulator_ambient = vec4(vec3(0.0), 1.);\nvec4 light_accumulator_diffuse = vec4(vec3(0.0), 1.);\n#ifdef TANGRAM_MATERIAL_SPECULAR\n vec4 light_accumulator_specular = vec4(vec3(0.0), 1.);\n#endif\n\n\n#ifdef TANGRAM_MATERIAL_TEXTURE_SPHEREMAP\nvec4 getSphereMap (in sampler2D _tex, in vec3 _eyeToPoint, in vec3 _normal, in vec2 _skew) {\n // Normalized vector from camera to surface\n vec3 eye = normalize(_eyeToPoint);\n\n // Adjust for camera skew\n eye.xy -= _skew;\n eye = normalize(eye);\n\n // Reflection of eye off of surface normal\n vec3 r = reflect(eye, _normal);\n\n // Map reflected vector onto the surface of a sphere\n r.z += 1.0;\n float m = 2. * length(r);\n\n // Adjust xy to account for spherical shape, and center in middle of texture\n vec2 uv = r.xy / m + .5;\n\n // Sample the environment map\n return texture2D(_tex, uv);\n}\n#endif\n\n\n#ifdef TANGRAM_MATERIAL_TEXTURE_TRIPLANAR\nvec3 getTriPlanarBlend (in vec3 _normal) {\n vec3 blending = abs(_normal);\n blending = normalize(max(blending, 0.00001));\n float b = (blending.x + blending.y + blending.z);\n return blending / b;\n}\n\nvec4 getTriPlanar (in sampler2D _tex, in vec3 _pos, in vec3 _normal, in vec3 _scale) {\n vec3 blending = getTriPlanarBlend(_normal);\n vec4 xaxis = texture2D(_tex, fract(_pos.yz * _scale.x));\n vec4 yaxis = texture2D(_tex, fract(_pos.xz * _scale.y));\n vec4 zaxis = texture2D(_tex, fract(_pos.xy * _scale.z));\n return xaxis * blending.x + yaxis * blending.y + zaxis * blending.z;\n}\n#endif\n\n\n#ifdef TANGRAM_MATERIAL_TEXTURE_PLANAR\nvec4 getPlanar (in sampler2D _tex, in vec3 _pos, in vec2 _scale) {\n return texture2D( _tex, fract(_pos.xy * _scale.x) );\n}\n#endif\n\n\n#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE\nvoid calculateNormal (inout vec3 _normal) {\n // Get NORMALMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_UV\n _normal += texture2D(u_material_normal_texture, fract(v_texcoord*material.normalScale.xy)).rgb*2.0-1.0;\n #endif\n\n #ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_PLANAR\n vec3 normalTex = getPlanar(u_material_normal_texture, v_world_position.xyz, material.normalScale.xy).rgb*2.0-1.0;\n _normal += normalTex;\n #endif\n\n #ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_TRIPLANAR\n vec3 normalTex = getTriPlanar(u_material_normal_texture, v_world_position.xyz, _normal, material.normalScale).rgb*2.0-1.0;\n _normal += normalTex;\n #endif\n\n _normal = normalize(_normal);\n}\n#endif\n\nvoid calculateMaterial (in vec3 _eyeToPoint, inout vec3 _normal) {\n // get EMISSION TEXTUREMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_UV\n material.emission *= texture2D(u_material_emission_texture,v_texcoord);\n #endif\n\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_PLANAR\n material.emission *= getPlanar(u_material_emission_texture, v_world_position.xyz, material.emissionScale.xy);\n #endif\n\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_TRIPLANAR\n material.emission *= getTriPlanar(u_material_emission_texture, v_world_position.xyz, _normal, material.emissionScale);\n #endif\n\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_SPHEREMAP\n material.emission *= getSphereMap(u_material_emission_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n\n // get AMBIENT TEXTUREMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_UV\n material.ambient *= texture2D(u_material_ambient_texture,v_texcoord);\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_PLANAR\n material.ambient *= getPlanar(u_material_ambient_texture, v_world_position.xyz, material.ambientScale.xy);\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_TRIPLANAR\n material.ambient *= getTriPlanar(u_material_ambient_texture, v_world_position.xyz, _normal, material.ambientScale);\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_SPHEREMAP\n material.ambient *= getSphereMap(u_material_ambient_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n\n // get DIFFUSE TEXTUREMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_UV\n material.diffuse *= texture2D(u_material_diffuse_texture,v_texcoord);\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_PLANAR\n material.diffuse *= getPlanar(u_material_diffuse_texture, v_world_position.xyz, material.diffuseScale.xy);\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_TRIPLANAR\n material.diffuse *= getTriPlanar(u_material_diffuse_texture, v_world_position.xyz, _normal, material.diffuseScale);\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_SPHEREMAP\n material.diffuse *= getSphereMap(u_material_diffuse_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n\n // get SPECULAR TEXTUREMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_UV\n material.specular *= texture2D(u_material_specular_texture,v_texcoord);\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_PLANAR\n material.specular *= getPlanar(u_material_specular_texture, v_world_position.xyz, material.specularScale.xy);\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_TRIPLANAR\n material.specular *= getTriPlanar(u_material_specular_texture, v_world_position.xyz, _normal, material.specularScale);\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_SPHEREMAP\n material.specular *= getSphereMap(u_material_specular_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n}\n","Material"),e.addShaderBlock("setup","\nmaterial = u_material;\n","Material")}setupProgram(e){me.forEach(t=>{this[t]&&(this[t].texture?(e.setTextureUniform(`u_material_${t}_texture`,this[t].texture),e.uniform("3fv",`u_material.${t}Scale`,this[t].scale),e.uniform("4fv",`u_material.${t}`,this[t].amount)):this[t].amount&&e.uniform("4fv",`u_material.${t}`,this[t].amount))}),this.specular&&e.uniform("1f","u_material.shininess",this.specular.shininess),this.normal&&this.normal.texture&&(e.setTextureUniform("u_material_normal_texture",this.normal.texture),e.uniform("3fv","u_material.normalScale",this.normal.scale),e.uniform("1f","u_material.normalAmount",this.normal.amount))}}var ye;ge.block="material";var be=ye={};ye.copy=function(e){for(var t=[],n=e.length,r=0;r<n;r++)t[r]=e[r];return t},ye.neg=function(e){for(var t=[],n=e.length,r=0;r<n;r++)t[r]=-e[r];return t},ye.add=function(e,t){for(var n=[],r=Math.min(e.length,t.length),i=0;i<r;i++)n[i]=e[i]+t[i];return n},ye.sub=function(e,t){for(var n=[],r=Math.min(e.length,t.length),i=0;i<r;i++)n[i]=e[i]-t[i];return n},ye.signed_area=function(e,t,n){return(t[0]-e[0])*(n[1]-e[1])-(n[0]-e[0])*(t[1]-e[1])},ye.mult=function(e,t){var n,r=[],i=e.length;if("number"==typeof t)for(n=0;n<i;n++)r[n]=e[n]*t;else for(i=Math.min(e.length,t.length),n=0;n<i;n++)r[n]=e[n]*t[n];return r},ye.div=function(e,t){var n,r=[];if("number"==typeof t)for(n=0;n<e.length;n++)r[n]=e[n]/t;else{var i=Math.min(e.length,t.length);for(n=0;n<i;n++)r[n]=e[n]/t[n]}return r},ye.perp=function(e,t){return[t[1]-e[1],e[0]-t[0]]},ye.rot=function(e,t){var n=Math.cos(t),r=Math.sin(t);return[e[0]*n-e[1]*r,e[0]*r+e[1]*n]},ye.angle=function([e,t]){return Math.atan2(t,e)},ye.angleBetween=function(e,t){var n=ye.dot(ye.normalize(ye.copy(e)),ye.normalize(ye.copy(t)));return n>1&&(n=1),Math.acos(n)},ye.isEqual=function(e,t){for(var n=e.length,r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0},ye.lengthSq=function(e){return 2===e.length?e[0]*e[0]+e[1]*e[1]:e.length>=3?e[0]*e[0]+e[1]*e[1]+e[2]*e[2]:0},ye.length=function(e){return Math.sqrt(ye.lengthSq(e))},ye.normalize=function(e){var t;if(2===e.length){if(1===(t=e[0]*e[0]+e[1]*e[1]))return e;0!==(t=Math.sqrt(t))?(e[0]/=t,e[1]/=t):(e[0]=0,e[1]=0)}else if(e.length>=3){if(1===(t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2]))return e;0!==(t=Math.sqrt(t))?(e[0]/=t,e[1]/=t,e[2]/=t):(e[0]=0,e[1]=0,e[2]=0)}return e},ye.cross=function(e,t){return 2===e.length?e[0]*t[1]-e[1]*t[0]:3===e.length?[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]:void 0},ye.dot=function(e,t){for(var n=0,r=Math.min(e.length,t.length),i=0;i<r;i++)n+=e[i]*t[i];return n};class ve{constructor(e,t){this.name=t.name,this.view=e,null==t.ambient||"number"==typeof t.ambient?this.ambient=A.expandVec3(t.ambient||0):this.ambient=Q.parseColor(t.ambient).slice(0,3),null==t.diffuse||"number"==typeof t.diffuse?this.diffuse=A.expandVec3(null!=t.diffuse?t.diffuse:1):this.diffuse=Q.parseColor(t.diffuse).slice(0,3),null==t.specular||"number"==typeof t.specular?this.specular=A.expandVec3(t.specular||0):this.specular=Q.parseColor(t.specular).slice(0,3)}static create(e,t){if(ve.types[t.type])return new ve.types[t.type](e,t)}static setMode(e,t){!0===e&&(e="fragment"),e=ve.enabled&&(null!=e?e:"fragment"),t.defines.TANGRAM_LIGHTING_FRAGMENT="fragment"===e,t.defines.TANGRAM_LIGHTING_VERTEX="vertex"===e}static inject(e){if(j.removeBlock(ve.block),!ve.enabled)return;let t="";if(e&&Object.keys(e).length>0){let n={};for(let t in e)n[e[t].type]=!0;for(let e in n)ve.types[e].inject();for(let n in e)e[n].inject(),t+=`calculateLight(${n}, _eyeToPoint, _normal);\n`}let n=`\n vec4 calculateLighting(in vec3 _eyeToPoint, in vec3 _normal, in vec4 _color) {\n\n // Do initial material calculations over normal, emission, ambient, diffuse and specular values\n calculateMaterial(_eyeToPoint,_normal);\n\n // Un roll the loop of individual ligths to calculate\n ${t}\n\n // Final light intensity calculation\n vec4 color = vec4(vec3(0.), _color.a); // start with vertex color alpha\n\n #ifdef TANGRAM_MATERIAL_EMISSION\n color.rgb = material.emission.rgb;\n color.a *= material.emission.a;\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT\n color.rgb += light_accumulator_ambient.rgb * _color.rgb * material.ambient.rgb;\n color.a *= material.ambient.a;\n #else\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n color.rgb += light_accumulator_ambient.rgb * _color.rgb * material.diffuse.rgb;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n color.rgb += light_accumulator_diffuse.rgb * _color.rgb * material.diffuse.rgb;\n color.a *= material.diffuse.a;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n color.rgb += light_accumulator_specular.rgb * material.specular.rgb;\n color.a *= material.specular.a;\n #endif\n\n // Clamp final color\n color = clamp(color, 0.0, 1.0);\n\n return color;\n }`;j.addBlock(ve.block,n)}inject(){let e=`\n uniform ${this.struct_name} u_${this.name};\n ${this.struct_name} ${this.name};\n `,t=`\n ${this.name} = u_${this.name};\n\n `;j.addBlock(ve.block,e),j.addBlock("setup",t)}update(){}setupProgram(e){e.uniform("3fv",`u_${this.name}.ambient`,this.ambient),e.uniform("3fv",`u_${this.name}.diffuse`,this.diffuse),e.uniform("3fv",`u_${this.name}.specular`,this.specular)}}ve.types={},ve.block="lighting",ve.enabled=!0,ve.types.ambient=class extends ve{constructor(e,t){super(e,t),this.type="ambient",this.struct_name="AmbientLight"}static inject(){j.addBlock(ve.block,"/*\n\nExpected globals:\nlight_accumulator_*\n\n*/\n\nstruct AmbientLight {\n vec3 ambient;\n};\n\nvoid calculateLight(in AmbientLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n light_accumulator_ambient.rgb += _light.ambient;\n}\n")}setupProgram(e){e.uniform("3fv",`u_${this.name}.ambient`,this.ambient)}},ve.types.directional=class extends ve{constructor(e,t){if(super(e,t),this.type="directional",this.struct_name="DirectionalLight",t.direction)this._direction=t.direction;else{let e=135,n=Math.sin(60*Math.PI/180);this._direction=[Math.cos(Math.PI*e/180)*n,Math.sin(Math.PI*e/180)*n,-.5],null==t.ambient&&(this.ambient=A.expandVec3(.5))}this.direction=this._direction.map(parseFloat)}get direction(){return this._direction}set direction(e){this._direction=be.normalize(be.copy(e))}static inject(){j.addBlock(ve.block,"/*\n\nExpected globals:\nmaterial\nlight_accumulator_*\n\n*/\n\nstruct DirectionalLight {\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n vec3 direction;\n};\n\nvoid calculateLight(in DirectionalLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n\n light_accumulator_ambient.rgb += _light.ambient;\n\n float nDotVP = clamp(dot(_normal, -_light.direction), 0.0, 1.0);\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n light_accumulator_diffuse.rgb += _light.diffuse * nDotVP;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n float pf = 0.0;\n if (nDotVP > 0.0) {\n vec3 reflectVector = reflect(_light.direction, _normal);\n float eyeDotR = max(dot(normalize(_eyeToPoint), reflectVector), 0.0);\n pf = pow(eyeDotR, material.shininess);\n }\n light_accumulator_specular.rgb += _light.specular * pf;\n #endif\n}\n")}setupProgram(e){super.setupProgram(e),e.uniform("3fv",`u_${this.name}.direction`,this.direction)}};class _e extends ve{constructor(e,t){super(e,t),this.type="point",this.struct_name="PointLight",this.position=t.position||[0,0,"100px"],this.position_eye=[],this.origin=t.origin||"ground",this.attenuation=isNaN(parseFloat(t.attenuation))?0:parseFloat(t.attenuation),t.radius?Array.isArray(t.radius)&&2===t.radius.length?this.radius=t.radius:this.radius=[null,t.radius]:this.radius=null}static inject(){j.addBlock(ve.block,"/*\n\nExpected globals:\nmaterial\nlight_accumulator_*\n\n*/\n\nstruct PointLight {\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n vec4 position;\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float attenuationExponent;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n float innerRadius;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float outerRadius;\n#endif\n};\n\nvoid calculateLight(in PointLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n\n float dist = length(_light.position.xyz - _eyeToPoint);\n\n // Compute vector from surface to light position\n vec3 VP = (_light.position.xyz - _eyeToPoint) / dist;\n\n // Normalize the vector from surface to light position\n float nDotVP = clamp(dot(VP, _normal), 0.0, 1.0);\n\n // Attenuation defaults\n float attenuation = 1.0;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float Rin = 1.0;\n float e = _light.attenuationExponent;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #endif\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-(pow(d,e));\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/(pow(d,e)), 0.0, 1.0);\n #endif\n #else\n float Rin = 0.0;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/d, 0.0, 1.0);\n #endif\n #else\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float d = clamp(dist/_light.outerRadius, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n attenuation = 1.0;\n #endif\n #endif\n #endif\n\n // Computer accumulators\n light_accumulator_ambient.rgb += _light.ambient * attenuation;\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n light_accumulator_diffuse.rgb += _light.diffuse * nDotVP * attenuation;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n float pf = 0.0; // power factor for shiny speculars\n if (nDotVP > 0.0) {\n vec3 reflectVector = reflect(-VP, _normal);\n float eyeDotR = max(0.0, dot(-normalize(_eyeToPoint), reflectVector));\n pf = pow(eyeDotR, material.shininess);\n }\n\n light_accumulator_specular.rgb += _light.specular * pf * attenuation;\n #endif\n}\n")}inject(){super.inject(),j.defines.TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT=0!==this.attenuation,j.defines.TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS=null!=this.radius&&null!=this.radius[0],j.defines.TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS=null!=this.radius}update(){this.updateEyePosition()}updateEyePosition(){if("world"===this.origin){const e=U.latLngToMeters([...this.position]);this.position_eye[0]=e[0]-this.view.camera.position_meters[0],this.position_eye[1]=e[1]-this.view.camera.position_meters[1],this.position_eye[2]=Q.convertUnits(this.position[2],{zoom:this.view.zoom,meters_per_pixel:U.metersPerPixel(this.view.zoom)}),this.position_eye[2]=this.position_eye[2]-this.view.camera.position_meters[2]}else"ground"!==this.origin&&"camera"!==this.origin||(this.position_eye=Q.convertUnits(this.position,{zoom:this.view.zoom,meters_per_pixel:U.metersPerPixel(this.view.zoom)}),"ground"===this.origin&&(this.position_eye[2]=this.position_eye[2]-this.view.camera.position_meters[2]));this.position_eye[3]=1}setupProgram(e){super.setupProgram(e),e.uniform("4fv",`u_${this.name}.position`,this.position_eye),j.defines.TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT&&e.uniform("1f",`u_${this.name}.attenuationExponent`,this.attenuation),j.defines.TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS&&e.uniform("1f",`u_${this.name}.innerRadius`,Q.convertUnits(this.radius[0],{zoom:this.view.zoom,meters_per_pixel:U.metersPerPixel(this.view.zoom)})),j.defines.TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS&&e.uniform("1f",`u_${this.name}.outerRadius`,Q.convertUnits(this.radius[1],{zoom:this.view.zoom,meters_per_pixel:U.metersPerPixel(this.view.zoom)}))}}ve.types.point=_e,ve.types.spotlight=class extends _e{constructor(e,t){super(e,t),this.type="spotlight",this.struct_name="SpotLight",this.direction=this._direction=(t.direction||[0,0,-1]).map(parseFloat),this.exponent=t.exponent?parseFloat(t.exponent):.2,this.angle=t.angle?parseFloat(t.angle):20}get direction(){return this._direction}set direction(e){this._direction=be.normalize(be.copy(e))}static inject(){j.addBlock(ve.block,"/*\n\nExpected globals:\nmaterial\nlight_accumulator_*\n\n*/\n\nstruct SpotLight {\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n vec4 position;\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float attenuationExponent;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n float innerRadius;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float outerRadius;\n#endif\n\n vec3 direction;\n float spotCosCutoff;\n float spotExponent;\n};\n\nvoid calculateLight(in SpotLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n\n float dist = length(_light.position.xyz - _eyeToPoint);\n\n // Compute vector from surface to light position\n vec3 VP = (_light.position.xyz - _eyeToPoint) / dist;\n\n // normal . light direction\n float nDotVP = clamp(dot(_normal, VP), 0.0, 1.0);\n\n // Attenuation defaults\n float attenuation = 1.0;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float Rin = 1.0;\n float e = _light.attenuationExponent;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #endif\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-(pow(d,e));\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/(pow(d,e)), 0.0, 1.0);\n #endif\n #else\n float Rin = 0.0;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/d, 0.0, 1.0);\n #endif\n #else\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float d = clamp(dist/_light.outerRadius, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n attenuation = 1.0;\n #endif\n #endif\n #endif\n\n // spotlight attenuation factor\n float spotAttenuation = 0.0;\n\n // See if point on surface is inside cone of illumination\n float spotDot = clamp(dot(-VP, _light.direction), 0.0, 1.0);\n\n if (spotDot >= _light.spotCosCutoff) {\n spotAttenuation = pow(spotDot, _light.spotExponent);\n }\n\n light_accumulator_ambient.rgb += _light.ambient * attenuation * spotAttenuation;\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n light_accumulator_diffuse.rgb += _light.diffuse * nDotVP * attenuation * spotAttenuation;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n // Power factor for shiny speculars\n float pf = 0.0;\n if (nDotVP > 0.0) {\n vec3 reflectVector = reflect(-VP, _normal);\n float eyeDotR = max(dot(-normalize(_eyeToPoint), reflectVector), 0.0);\n pf = pow(eyeDotR, material.shininess);\n }\n light_accumulator_specular.rgb += _light.specular * pf * attenuation * spotAttenuation;\n #endif\n}\n")}setupProgram(e){super.setupProgram(e),e.uniform("3fv",`u_${this.name}.direction`,this.direction),e.uniform("1f",`u_${this.name}.spotCosCutoff`,Math.cos(3.14159*this.angle/180)),e.uniform("1f",`u_${this.name}.spotExponent`,this.exponent)}};class xe extends Error{constructor(e){super(),this.name="MethodNotImplemented",this.message="Method "+e+" must be implemented in subclass"}}class we{constructor(e,t){this.validate(e),this.config=e,this.sources=t,this.id=e.id,this.name=e.name,this.pad_scale=e.pad_scale||1e-5,this.default_winding=null,this.rasters=[],Array.isArray(e.rasters)&&e.rasters.forEach(e=>{-1===this.rasters.indexOf(e)&&this.rasters.push(e)}),this.preprocess=e.preprocess,"function"==typeof this.preprocess&&this.preprocess.bind(this),this.transform=e.transform,"function"==typeof this.transform&&this.transform.bind(this),this.extra_data=e.extra_data,this.scripts=e.scripts,this.setZooms(e),this.zoom_offset=null!=e.zoom_offset?e.zoom_offset:0,this.zoom_offset<0&&(g({level:"warn",once:!0},`Data source '${this.name}' zoom_offset must not be negative – setting to 0.`),this.zoom_offset=0),this.setTileSize(e.tile_size),this.min_display_zoom=Math.max(e.min_display_zoom||0,this.zooms[0]),this.max_display_zoom=null!=e.max_display_zoom?e.max_display_zoom:null}static register(e,t){e&&t&&(we.types[e]=t)}static create(e,t){if("function"==typeof we.types[e.type]){const n=we.types[e.type](e);if(n)return new n(e,t)}}static tileLayoutChanged(e,t){if(!e||!t)return!0;const n=["max_zoom","zooms","min_display_zoom","max_display_zoom","bounds","tile_size","zoom_offset"],r=k(e.config,n),i=k(t.config,n);return JSON.stringify(r)!==JSON.stringify(i)}static projectData(e){var t=+new Date;for(var n in e.layers)for(var r=e.layers[n].features.length,i=0;i<r;i++){var o=e.layers[n].features[i];U.transformGeometry(o.geometry,this.projectCoord)}void 0!==e.debug&&(e.debug.projection=+new Date-t)}static projectCoord(e){U.latLngToMeters(e)}static scaleData(e,{coords:{z:t},min:n}){let r=U.unitsPerMeter(t);for(var i in e.layers)for(var o=e.layers[i].features.length,s=0;s<o;s++){var a=e.layers[i].features[s];U.transformGeometry(a.geometry,e=>{e[0]=(e[0]-n.x)*r,e[1]=(e[1]-n.y)*r*-1})}}load(e){return e.source_data={},e.source_data.layers={},e.pad_scale=this.pad_scale,e.rasters=[...this.rasters],this._load(e).then(e=>{for(let t in e.source_data.layers){let n=e.source_data.layers[t];n&&n.features&&n.features.forEach(e=>{U.transformGeometry(e.geometry,e=>{e[1]=-e[1],this.pad_scale&&(e[0]=Math.round(e[0]*(1+this.pad_scale)-U.tile_scale*this.pad_scale/2),e[1]=Math.round(e[1]*(1+this.pad_scale)-U.tile_scale*this.pad_scale/2))}),this.updateDefaultWinding(e.geometry)})}return e.default_winding=this.default_winding||"CCW",e})}_load(){throw new xe("_load")}copyTileData(e,t){return g("trace",`Copy tile data from ${e.key} to ${t.key}`),t.source_data={layers:e.source_data.layers},t.rasters=[...e.rasters],t.pad_scale=e.pad_scale,t.default_winding=e.default_winding,t}setZooms({max_zoom:e,zooms:t}){if(this.max_zoom=null!=e?e:U.default_source_max_zoom,Array.isArray(t))this.zooms=t,this.max_zoom=this.zooms[this.zooms.length-1];else{this.zooms=[];for(let e=0;e<=this.max_zoom;e++)this.zooms[e]=e}}setTileSize(e){this.tile_size=e||256,("number"!=typeof this.tile_size||this.tile_size<256||!y.isPowerOf2(this.tile_size))&&(g({level:"warn",once:!0},`Data source '${this.name}': 'tile_size' parameter must be a number that is a power of 2 greater than or equal to 256, but was '${e}'`),this.tile_size=256),this.zoom_bias=Math.log2(this.tile_size)-8+this.zoom_offset}updateDefaultWinding(e){return null==this.default_winding&&("Polygon"===e.type?this.default_winding=U.ringWinding(e.coordinates[0]):"MultiPolygon"===e.type&&(this.default_winding=U.ringWinding(e.coordinates[0][0]))),this.default_winding}includesTile(e,t){if(e.z<this.min_display_zoom||null!=this.max_display_zoom&&t>this.max_display_zoom)return!1;for(let t=0;t<this.rasters.length;t++){const n=this.rasters[t];if(this.sources[n]&&this.sources[n]!==this&&!this.sources[n].includesTile(e,e.z))return!1}return!0}validate(){}}we.types={};let Ee=0;class Se extends we{constructor(e,t){super(e,t),this.response_type="";let[n,r]=function(e,t){if(!t||0===Object.keys(t).length)return[e,[]];var n=e.indexOf("?"),r=e.indexOf("#"),i="";r>-1&&(i=e.slice(r),e=e.slice(0,r)),-1===n&&(n=e.length,e+="?"),n++;var o="",s=[];for(var a in t)""===E(a,e)?o+=`${a}=${t[a]}&`:s.push([a,t[a]]);return[e=e.slice(0,n)+o+e.slice(n)+i,s]}(e.url,e.url_params);this.url=n,r.forEach(([t,n])=>{g({level:"warn",once:!0},`Data source '${this.name}': parameter '${t}' already present in URL '${e.url}', skipping value '${t}=${n}' specified in 'url_params'`)}),e.request_headers&&"object"==typeof e.request_headers&&(this.request_headers=e.request_headers)}_load(e){let t=this.formatURL(this.url,e),n=e.source_data;return n.url=t,e.debug=e.debug||{},e.debug.network=+new Date,new Promise(r=>{let i=Ee+++"-"+t,o=y.io(t,6e4,this.response_type,"GET",this.request_headers,i);n.request_id=i,n.error=null,o.then(({body:t})=>{e.debug.response_size=t&&(t.length||t.byteLength),e.debug.network=+new Date-e.debug.network,e.debug.parsing=+new Date,null!=t&&"function"==typeof this.preprocess&&(t=this.preprocess(t)),(t=t instanceof Promise?t:Promise.resolve(t)).then(t=>{null!=t?this.parseSourceData(e,n,t):n.layers={},e.debug.parsing=+new Date-e.debug.parsing,r(e)})}).catch(t=>{n.error=t.stack,r(e)})})}validate(e){if("string"!=typeof e.url)throw Error("Network data source must provide a string `url` property")}formatURL(){throw new xe("formatURL")}parseSourceData(){throw new xe("parseSourceData")}}class Te extends Se{constructor(e,t){super(e,t),this.tiled=!0,this.bounds=this.parseBounds(e),this.builds_geometry_tiles=!1,this.tms=!0===e.tms,this.url&&this.url.search("{s}")>-1&&(Array.isArray(e.url_subdomains)&&e.url_subdomains.length>0?(this.url_subdomains=e.url_subdomains,this.next_url_subdomain=0):g({level:"warn",once:!0},`Data source '${this.name}': source URL includes '{s}' subdomain marker ('${this.url}'), but no subdomains were specified in 'url_subdomains' parameter`)),this.url&&this.url.search("{r}")>-1&&(Array.isArray(e.url_density_scales)&&e.url_density_scales.length>0?this.url_density_scales=e.url_density_scales:this.url_density_scales=[1,2])}parseBounds(e){if(Array.isArray(e.bounds)&&4===e.bounds.length){const[t,n,r,i]=e.bounds;return{latlng:[...e.bounds],meters:{min:U.latLngToMeters([t,i]),max:U.latLngToMeters([r,n])},tiles:{min:{},max:{}}}}}checkBounds(e,t){if(t){e=U.wrapTile(e);let n=t.tiles.min[e.z];n||(n=t.tiles.min[e.z]=U.tileForMeters(t.meters.min,e.z));let r=t.tiles.max[e.z];if(r||(r=t.tiles.max[e.z]=U.tileForMeters(t.meters.max,e.z)),e.y<n.y||e.y>r.y)return!1;if(n.x<=r.x){if(e.x<n.x||e.x>r.x)return!1}else if(e.x>r.x&&e.x<n.x)return!1}return!0}includesTile(e,t){return!!super.includesTile(e,t)&&!!this.checkBounds(e,this.bounds)}formatURL(e,t){let n=U.wrapTile(t.coords,{x:!0});this.tms&&(n.y=Math.pow(2,n.z)-1-n.y);let r=e.replace("{x}",n.x).replace("{y}",n.y).replace("{z}",n.z).replace("{r}",this.getDensityModifier()).replace("{q}",this.toQuadKey(n));return null!=this.url_subdomains&&(r=r.replace("{s}",this.url_subdomains[this.next_url_subdomain]),this.next_url_subdomain=(this.next_url_subdomain+1)%this.url_subdomains.length),r}getDensityModifier(){if(this.url_density_scales){const e=y.device_pixel_ratio;let t=this.url_density_scales.filter(t=>e>=t).reverse()[0];if(t=null!=t?t:this.url_density_scales[0],t>1)return`@${t}x`}return""}toQuadKey({x:e,y:t,z:n}){let r="";for(let i=n;i>0;i--){let n=0,o=1<<i-1;e&o&&n++,t&o&&(n+=2),r+=n.toString()}return r}static urlHasTilePattern(e){return e&&(e.search("{x}")>-1&&e.search("{y}")>-1&&e.search("{z}")>-1||e.search("{q}")>-1)}}const ke={coord(e){return{x:e.x,y:e.y,z:e.z,key:this.coordKey(e)}},coordKey:({x:e,y:t,z:n})=>e+"/"+t+"/"+n,key(e,t,n){if(!(e.y<0||e.y>=1<<e.z||e.z<0))return[t.name,e.x,e.y,e.z,n].join("/")},normalizedKey(e,t,n){return this.key(this.normalizedCoord(e,t),t,n)},normalizedCoord(e,t){return t.zoom_bias&&(e=this.coordAtZoom(e,Math.max(e.z-t.zoom_bias,t.zooms[0]))),this.coordForTileZooms(e,t.zooms)},coordAtZoom({x:e,y:t,z:n},r){if(n!==(r=Math.max(0,r))){let i=Math.pow(2,n-r);e=Math.floor(e/i),t=Math.floor(t/i),n=r}return this.coord({x:e,y:t,z:n})},coordForTileZooms({x:e,y:t,z:n},r){const i=this.findZoomInRange(n,r);return i!==n?this.coordAtZoom({x:e,y:t,z:n},i):this.coord({x:e,y:t,z:n})},findZoomInRange:(e,t)=>t.filter(t=>e>=t).reverse()[0]||t[0],isDescendant(e,t){if(t.z>e.z){let{x:n,y:r}=this.coordAtZoom(t,e.z);return e.x===n&&e.y===r}return!1},parent({coords:e,source:t,style_z:n}){if(n>0){n--;const r=Math.max(n-t.zoom_bias,t.zooms[0]),i=this.coordForTileZooms(this.coordAtZoom(e,r),t.zooms);return i.z>n?null:{key:this.key(i,t,n),coords:i,style_z:n,source:t}}},children({coords:e,source:t,style_z:n},r={}){n++;const i=this.coordForTileZooms(this.coordAtZoom(e,n-t.zoom_bias),t.zooms);if(i.z===e.z)return[{key:this.key(i,t,n),coords:i,style_z:n,source:t}];{const o=this.key(i,t,n);if(r[t.id]=r[t.id]||{},null==r[t.id][o]){const s=Math.pow(2,i.z-e.z),a=e.x*s,l=e.y*s;let u=[];for(let e=a;e<a+s;e++)for(let r=l;r<l+s;r++){let o=this.coord({x:e,y:r,z:i.z});u.push({key:this.key(o,t,n),coords:o,style_z:n,source:t})}r[t.id][o]=u}return r[t.id][o]}}};class Oe extends Te{constructor(e,t){super(e,t),-1===this.rasters.indexOf(this.name)&&this.rasters.unshift(this.name),this.filtering=e.filtering,this.textures={}}async load(e){e.source_data={},e.source_data.layers={},e.pad_scale=this.pad_scale,e.rasters=[...this.rasters];let t=U.tile_scale;return e.source_data.layers={_default:{type:"FeatureCollection",features:[{geometry:{type:"Polygon",coordinates:[[[0,0],[t,0],[t,-t],[0,-t],[0,0]]]},properties:{}}]}},e.default_winding="CW",e}async tileTexture(e){let t=this.adjustRasterTileZoom(e),n=t.key;if(!this.textures[n]){let e=this.formatURL(this.url,{coords:t});this.textures[n]={name:e,url:e,filtering:this.filtering,coords:t}}return this.textures[n]}adjustRasterTileZoom(e){let t=e.coords;const n=this.sources[e.source];if(n!==this){let r=this.zoom_bias-n.zoom_bias;r>0?t=ke.normalizedCoord(e.coords,{zoom_bias:r,zooms:this.zooms}):(r<0&&g({level:"warn",once:!0},`Raster source '${this.name}' supports higher zoom detail than source '${n.name}' it's attached to. Downsampling this source ${-r} extra zoom levels to match.`),t=ke.coordForTileZooms(t,this.zooms))}return t}}class Ae extends Oe{constructor(e,t){super(e,t),this.load_image={},this.alpha=null!=e.alpha?Math.max(Math.min(e.alpha,1),0):null,this.mask_alpha=!0,this.preserve_tiles_within_zoom=0,this.max_display_density=e.max_display_density,Array.isArray(e.composite)?this.images=e.composite.map(e=>({url:e.url,bounds:this.parseBounds(e),alpha:null!=e.alpha?Math.max(Math.min(e.alpha,1),0):null})):this.images=[{url:this.url,bounds:this.bounds,alpha:this.alpha}]}async tileTexture(e,{blend:t,generation:n}){let r=this.adjustRasterTileZoom(e);const i="opaque"!==t,o=`raster-${this.name}-${r.key}-${i?"alpha":"opaque"}-${n}`;if(O.textures[o])return{name:o,coords:r,skip_create:!0};let s=y.device_pixel_ratio;this.max_display_density&&(s=Math.min(s,this.max_display_density)),s*=2;const a=document.createElement("canvas"),l=a.getContext("2d");a.width=this.tile_size*s,a.height=this.tile_size*s,l.imageSmoothingEnabled="nearest"!==this.filtering;const u=this.images.filter(t=>this.checkBounds(e.coords,t.bounds));return await Promise.all(u.map(t=>{const n=i?null!=t.alpha?t.alpha:this.alpha:1;return this.drawImage(t.url,t.bounds,n,e,s,l)})),{name:o,element:a,filtering:this.filtering,coords:r}}async drawImage(e,t,n,r,i,o){const s=N(e);this.load_image[s]=this.load_image[s]||this.loadImage(e);const a=await this.load_image[s],l=U.metersPerPixel(r.coords.z)/i/(this.tile_size/U.tile_size),u=(t.meters.min[0]-r.min.x)/l,c=-(t.meters.min[1]-r.min.y)/l,d=(t.meters.max[0]-t.meters.min[0])/l,h=-(t.meters.max[1]-t.meters.min[1])/l;o.globalAlpha=null!=n?n:1,o.drawImage(a,u,c,d,h)}loadImage(e){return new Promise(t=>{let n=new Image;n.onload=()=>t(n),n.onerror=n=>{g("warn",`Raster source '${this.name}': failed to load url: '${e}'`,n),t(null)},y.isSafari()&&"data:"===e.slice(0,5)||(n.crossOrigin="anonymous"),n.src=e})}includesTile(e,t){return!!we.prototype.includesTile.call(this,e,t)&&this.images.some(t=>this.checkBounds(e,t.bounds))}validate(e){let t="Raster data source must provide a string `url` parameter, or an array of `composite` raster ";t+="image objects that each have a `url` parameter";let n="Raster data source must provide a `bounds` parameter, or an array of `composite` raster ";if(n+="image objects that each have a `bounds` parameter",Array.isArray(e.composite)){if(e.composite.some(e=>"string"!=typeof e.url))throw Error(t);if(e.composite.some(e=>!(Array.isArray(e.bounds)&&4===e.bounds.length)))throw Error(n);if(null!=e.url||null!=e.bounds)throw Error("Raster data source must have *either* a single image specified as `url` and `bounds `parameters, or an array of `composite` raster image objects, each with `url` and `bounds`.")}else{if("string"!=typeof e.url)throw Error(t);if(!Array.isArray(e.bounds)||4!==e.bounds.length)throw Error(n)}}}function Ce(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Re(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ce(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ce(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}we.register("Raster",e=>Oe.urlHasTilePattern(e.url)?Oe:Ae);var Ne={init({generation:e,styles:t,sources:n={},introspection:r}={}){this.setGeneration(e),this.styles=t,this.sources=n,this.defines=Object.prototype.hasOwnProperty.call(this,"defines")&&this.defines||{},this.shaders=Object.prototype.hasOwnProperty.call(this,"shaders")&&this.shaders||{},this.introspection=r||!1,this.selection=this.selection||this.introspection||!1,this.compile_setup=!1,this.program=null,this.selection_program=null,this.feature_style={},this.vertex_template=[],this.tile_data={},this.stencil_proxy_tiles=!0,this.variants={},this.vertex_layouts={},this.defines.TANGRAM_WORLD_POSITION_WRAP=1e5,this.blend=this.blend||"opaque","opaque"!==this.blend?null==this.blend_order&&(this.blend_order=this.default_blend_orders[this.blend]):this.blend_order=this.default_blend_orders[this.blend],this.defines[`TANGRAM_BLEND_${this.blend.toUpperCase()}`]=!0,this.removeShaderBlock("setup"),this.material instanceof ge||(ge.isValid(this.material)||(this.material=Q.defaults.material),this.material=new ge(this.material)),this.material.inject(this),ve.setMode(this.lighting,this),this.setupRasters(),this.setupCustomAttributes(),this.initialized=!0},destroy(){this.program&&(this.program.destroy(),this.program=null),this.selection_program&&(this.selection_program.destroy(),this.selection_program=null),a.removeTarget(this.main_thread_target),this.gl=null,this.initialized=!1},reset(){},baseStyle(){return this.base||this.name},setGeneration(e){this.generation=e,this.main_thread_target=["Style",this.name,this.generation].join("_"),t.is_main&&a.addTarget(this.main_thread_target,this)},startData(e){this.tile_data[e.id]=this.tile_data[e.id]||{meshes:{},uniforms:{},textures:[]}},async endData(e){var t=this.tile_data[e.id];if(this.tile_data[e.id]=null,t&&Object.keys(t.meshes).length>0){for(let e in t.meshes){let n=t.meshes[e];0!==n.vertex_data.vertex_count?(n.vertex_data.end(),n.vertex_elements=n.vertex_data.element_buffer,n.vertex_data=n.vertex_data.vertex_buffer):delete t.meshes[e]}return this.buildRasterTextures(e,t)}return null},hasDataForTile(e){return null!=this.tile_data[e.id]},getTileMesh(e,t){const n=this.tile_data[e.id].meshes;if(null==n[t.key]){const e=this.vertexLayoutForMeshVariant(t);n[t.key]={variant:t,vertex_data:e.createVertexData()}}return n[t.key]},vertexLayoutForMeshVariant(){},meshVariantTypeForDraw(){},addFeature(e,t,n){let r=n.tile;if(r.generation!==this.generation)return;this.tile_data[r.id]||this.startData(r);let i=this.parseFeature(e,t,n);i&&this.buildGeometry(e.geometry,i,n)>0&&(e.generation=this.generation)},buildGeometry(e,t,n){let r;if("Polygon"===e.type?r=this.buildPolygons([e.coordinates],t,n):"MultiPolygon"===e.type?r=this.buildPolygons(e.coordinates,t,n):"LineString"===e.type?r=this.buildLines([e.coordinates],t,n):"MultiLineString"===e.type?r=this.buildLines(e.coordinates,t,n):"Point"===e.type?r=this.buildPoints([e.coordinates],t,n):"MultiPoint"===e.type&&(r=this.buildPoints(e.coordinates,t,n)),r>0&&v.layer_stats){let e=n.tile;e.debug.layers=e.debug.layers||{list:{},tree:{}};let t=e.debug.layers.list,i=e.debug.layers.tree,o={};n.layers.forEach(e=>{Pe(t,e,1,r,{[this.name]:r},{[this.baseStyle()]:r});let n=i,s=o,a=e.split(":");for(let e=0;e<a.length;e++){let t=a[e];n[t]=n[t]||{features:0,geoms:0,styles:{},base:{}},null==s[t]&&(s[t]={},Pe(n,t,1,r,{[this.name]:r},{[this.baseStyle()]:r})),e<a.length-1&&(n[t].layers=n[t].layers||{}),n=n[t].layers,s=s[t]}})}return r},parseFeature(e,t,n){try{var r=this.feature_style;if(r.order=this.parseOrder(t.order,n),null==r.order&&"overlay"!==this.blend){let e=`Layer '${t.layers.join(", ")}', draw group '${t.group}': `;return e+="'order' parameter is required unless blend mode is 'overlay'",null!=t.order&&(e+="; 'order' was set to a dynamic value (e.g. string tied to feature property, ",e+="or JS function), but evaluated to null for one or more features"),void g({level:"warn",once:!0},e)}if(!(r=this._parseFeature(e,t,n)))return;if(this.shaders.attributes){r.attributes=r.attributes||{};for(const e in this.shaders.attributes)r.attributes[e]=Q.evalCachedProperty(t.attributes&&t.attributes[e],n),"number"!=typeof r.attributes[e]&&(r.attributes[e]=0)}return this.selection?r.interactive=Q.evalProperty(t.interactive,n):r.interactive=!1,!0===r.interactive?r.selection_color=de.makeColor(e,n.tile,n):r.selection_color=de.defaultColor,r}catch(t){g("error","Style.parseFeature: style parsing error",e,r,t.stack)}},_parseFeature(){return this.feature_style},preprocess(e){if(!e.preprocessed){if(this.draw)for(let t in this.draw){let n=this.draw[t];"object"!=typeof n||Array.isArray(n)?null==e[t]&&(e[t]=n):e[t]=V({},n,e[t])}if(this.selection?this.introspection&&(e.interactive=!0):e.interactive=!1,!(e=this._preprocess(e)))return;if(this.shaders.attributes){e.attributes=e.attributes||{};for(const t in this.shaders.attributes)e.attributes[t]=Q.createPropertyCache(null!=e.attributes[t]?e.attributes[t]:0)}e.preprocessed=!0}return e},_preprocess:e=>e,parseOrder:(e,t)=>"number"!=typeof e?Q.calculateOrder(e,t):e,scaleOrder:e=>2*e,parseColor(e,t){return e?Q.evalCachedColorProperty(e,t):this.shaders.blocks.color||this.shaders.blocks.filter?Q.defaults.color:void 0},buildPolygons:()=>0,buildLines:()=>0,buildPoints:()=>0,setGL(e){this.gl=e,this.max_texture_size=O.getMaxTextureSize(this.gl)},makeMesh(e,t,n={}){let r=this.vertexLayoutForMeshVariant(n.variant);return v.wireframe?(t=function(e){const t=new Uint16Array(2*e.length);for(let n=0;n<e.length;n+=3)t.set([e[n],e[n+1],e[n+1],e[n+2],e[n+2],e[n]],2*n);return t}(t),new fe(this.gl,e,t,r,Re(Re({},n),{},{draw_mode:this.gl.LINES}))):new fe(this.gl,e,t,r,n)},render:e=>e.render(),getProgram(e="program"){this.compileSetup();const t=this[e];if(t&&!t.error){if(!t.compiled){g("debug",`Compiling style '${this.name}', program key '${e}'`);try{t.compile()}catch(t){throw g("error",`Style: error compiling program for style '${this.name}' (program key '${e}')`,this,t.stack,t.type,t.shader_errors),t}}return t}},compileSetup(){if(!this.compile_setup){if(!this.gl)throw new Error(`style.compile(): skipping for ${this.name} because no GL context`);var e=this.buildDefineList();if(this.selection){var t=Object.assign({},e);t.TANGRAM_FEATURE_SELECTION=!0}var n=this.shaders&&this.shaders.blocks,r=this.shaders&&this.shaders.block_scopes,i=Object.assign({},this.shaders&&this.shaders.uniforms);for(let e in i)null==i[e]&&g({level:"warn",once:!0},`Style '${this.name}' has invalid uniform '${e}': uniform values must be non-null`);var o=this.shaders&&this.shaders.extensions;"string"==typeof o&&(o=[o]),this.program=new j(this.gl,this.vertex_shader_src,this.fragment_shader_src,{name:this.name,defines:e,uniforms:i,blocks:n,block_scopes:r,extensions:o}),this.selection?this.selection_program=new j(this.gl,this.vertex_shader_src,"// Fragment shader for feature selection passes\n// Renders in silhouette according to selection (picking) color, or black if none defined\n\n#ifdef TANGRAM_FEATURE_SELECTION\n varying vec4 v_selection_color;\n#endif\n\nvoid main (void) {\n #ifdef TANGRAM_FEATURE_SELECTION\n gl_FragColor = v_selection_color;\n #else\n gl_FragColor = vec4(0., 0., 0., 1.);\n #endif\n}\n",{name:this.name+" (selection)",defines:t,uniforms:i,blocks:n,block_scopes:r,extensions:o}):this.selection_program=null,this.compile_setup=!0}},addShaderBlock(e,t,n=null){this.shaders.blocks=this.shaders.blocks||{},this.shaders.blocks[e]=this.shaders.blocks[e]||[],this.shaders.blocks[e].push(t),this.shaders.block_scopes=this.shaders.block_scopes||{},this.shaders.block_scopes[e]=this.shaders.block_scopes[e]||[],this.shaders.block_scopes[e].push(n)},removeShaderBlock(e){this.shaders.blocks&&(this.shaders.blocks[e]=null),this.shaders.block_scopes&&(this.shaders.block_scopes[e]=null)},replaceShaderBlock(e,t,n=null){this.removeShaderBlock(e),this.addShaderBlock(e,t,n)},buildDefineList(){var e={};if(null!=this.defines)for(var t in this.defines)e[t]=this.defines[t];if(null!=this.shaders&&null!=this.shaders.defines)for(t in this.shaders.defines)e[t]=this.shaders.defines[t];return e},hasRasters(){return["color","normal","custom"].indexOf(this.raster)>-1},setupRasters(){if(!this.hasRasters())return;"color"===this.raster?this.defines.TANGRAM_RASTER_TEXTURE_COLOR=!0:"normal"===this.raster&&(this.defines.TANGRAM_RASTER_TEXTURE_NORMAL=!0);let e=Object.keys(this.sources).filter(e=>this.sources[e]instanceof Oe).length;if(this.defines.TANGRAM_NUM_RASTER_SOURCES=`${e}`,e>0){const t=Object.keys(this.sources).filter(e=>this.sources[e].mask_alpha).length;this.defines.TANGRAM_HAS_MASKED_RASTERS=t>0,this.defines.TANGRAM_ALL_MASKED_RASTERS=t===e,this.defines.TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING=!0,this.replaceShaderBlock("raster","// Uniforms defining raster textures and macros for accessing them\n\n#ifdef TANGRAM_FRAGMENT_SHADER\nuniform sampler2D u_rasters[TANGRAM_NUM_RASTER_SOURCES]; // raster tile texture samplers\nuniform vec2 u_raster_sizes[TANGRAM_NUM_RASTER_SOURCES]; // raster tile texture sizes (width/height in pixels)\nuniform vec3 u_raster_offsets[TANGRAM_NUM_RASTER_SOURCES]; // raster tile texture UV starting offset for tile\n\n// Raster sources can optionally mask by the alpha channel (render with only full or no alpha, based on a threshold),\n// which is used for handling transparency outside the raster image when rendering with opaque blending\n#if defined(TANGRAM_HAS_MASKED_RASTERS) && !defined(TANGRAM_ALL_MASKED_RASTERS) // only add uniform if we need it\nuniform bool u_raster_mask_alpha;\n#endif\n\n// Note: the raster accessors below are #defines rather than functions to\n// avoid issues with constant integer expressions for array indices\n\n// Adjusts UVs in model space to account for raster tile texture overzooming\n// (applies scale and offset adjustments)\n#define adjustRasterUV(raster_index, uv) \\\n ((uv) * u_raster_offsets[raster_index].z + u_raster_offsets[raster_index].xy)\n\n// Returns the UVs of the current model position for a raster sampler\n#define currentRasterUV(raster_index) \\\n (adjustRasterUV(raster_index, v_modelpos_base_zoom.xy))\n\n// Returns pixel location in raster tile texture at current model position\n#define currentRasterPixel(raster_index) \\\n (currentRasterUV(raster_index) * rasterPixelSize(raster_index))\n\n// Samples a raster tile texture for the current model position\n#define sampleRaster(raster_index) \\\n (texture2D(u_rasters[raster_index], currentRasterUV(raster_index)))\n\n// Samples a raster tile texture for a given pixel\n#define sampleRasterAtPixel(raster_index, pixel) \\\n (texture2D(u_rasters[raster_index], (pixel) / rasterPixelSize(raster_index)))\n\n// Returns size of raster sampler in pixels\n#define rasterPixelSize(raster_index) \\\n (u_raster_sizes[raster_index])\n\n#endif\n","Raster")}},async buildRasterTextures(e,t){if(!this.hasRasters())return t;if(0===e.rasters.length)return t;let n;try{n=await a.postMessage(`${this.main_thread_target}.loadTextures`,{coords:e.coords,source:e.source,rasters:e.rasters,min:e.min,max:e.max})}catch(e){return t}if(!n||n.length<1)return t;if(n.some(e=>!e.loaded))return null;t.uniforms.u_raster_mask_alpha=!0===this.sources[e.rasters[0]].mask_alpha;const r=t.uniforms.u_rasters=[],i=t.uniforms.u_raster_sizes=[],o=t.uniforms.u_raster_offsets=[];return n.forEach(n=>{const s=n.index;if(r[s]=n.name,t.textures.push(n.name),i[s]=[n.width,n.height],e.coords.z>n.coords.z){let t=e.coords.z-n.coords.z,r=Math.pow(2,t);o[s]=[(e.coords.x%r+r)%r/r,(r-1-e.coords.y%r)/r,1/r]}else o[s]=[0,0,1]}),t},async loadTextures(e){let t={},n={},r=[];e.rasters.map(e=>this.sources[e]).filter(e=>e).forEach((i,o)=>{i instanceof Oe&&r.push(i.tileTexture(e,this).then(e=>{t[e.name]=e,n[e.name]=o}))}),await Promise.all(r),await O.createFromObject(this.gl,t);let i=await Promise.all(Object.keys(t).map(e=>O.textures[e]&&O.textures[e].load()).filter(e=>e));return i.forEach(e=>e.retain()),i.map(e=>({name:e.name,width:e.width,height:e.height,loaded:e.loaded,index:n[e.name],coords:t[e.name].coords}))},setupCustomAttributes(){if(this.shaders.attributes)for(const[e,t]of Object.entries(this.shaders.attributes))"float"===t.type&&(!1!==t.varying?(this.addShaderBlock("attributes",`\n #ifdef TANGRAM_VERTEX_SHADER\n attribute float a_${e};\n varying float v_${e};\n #define ${e} a_${e}\n #else\n varying float v_${e};\n #define ${e} v_${e}\n #endif\n `),this.addShaderBlock("setup",`#ifdef TANGRAM_VERTEX_SHADER\nv_${e} = a_${e};\n#endif`)):this.addShaderBlock("attributes",`\n #ifdef TANGRAM_VERTEX_SHADER\n attribute float a_${e};\n #define ${e} a_${e}\n #endif\n `))},addCustomAttributesToAttributeList(e){if(this.shaders.attributes)for(const[t,n]of Object.entries(this.shaders.attributes))"float"===n.type&&e.push({name:`a_${t}`,size:1,type:pe.FLOAT,normalized:!1});return e},addCustomAttributesToVertexTemplate(e,t){if(this.shaders.attributes)for(let n in this.shaders.attributes)this.vertex_template[t++]=null!=e.attributes[n]?e.attributes[n]:0},setup(){this.setUniforms(),this.material.setupProgram(j.current)},setUniforms(){var e,t=j.current;t&&t.setUniforms(null===(e=this.shaders)||void 0===e?void 0:e.uniforms,!0)},render_states:{opaque:{depth_test:!0,depth_write:!0},translucent:{depth_test:!0,depth_write:!0},add:{depth_test:!0,depth_write:!1},multiply:{depth_test:!0,depth_write:!1},inlay:{depth_test:!0,depth_write:!1},overlay:{depth_test:!1,depth_write:!1}},default_blend_orders:{opaque:Number.MIN_SAFE_INTEGER,add:1,multiply:2,inlay:3,translucent:4,overlay:5},getBlendOrderForDraw(e){return"opaque"!==this.blend&&null!=e.blend_order?e.blend_order:this.blend_order}};function Pe(e,t,n,r,i,o){e[t]=e[t]||{features:0,geoms:0,styles:{},base:{}},e[t].features+=n,e[t].geoms+=r;for(let n in i)e[t].styles[n]=e[t].styles[n]||0,e[t].styles[n]+=i[n];for(let n in o)e[t].base[n]=e[t].base[n]||0,e[t].base[n]+=o[n]}let Me=Math.pow(2,16)-1,De=!1;class Ie{constructor(){this.array=[],this.has_overflown=!1}push(e){this.has_overflown&&!De||e>Me&&(this.has_overflown=!0,!De)||this.array.push(e)}end(){if(this.array.length){let t=(e=this.array,new(this.has_overflown&&De?Uint32Array:Uint16Array)(e));return this.array=[],this.has_overflown=!1,t}return!1;var e}}Ie.setElementIndexUint=function(e){De=e};let ze={[pe.FLOAT]:Float32Array,[pe.BYTE]:Int8Array,[pe.UNSIGNED_BYTE]:Uint8Array,[pe.INT]:Int32Array,[pe.UNSIGNED_INT]:Uint32Array,[pe.SHORT]:Int16Array,[pe.UNSIGNED_SHORT]:Uint16Array};class Fe{constructor(e,{prealloc:t=500}={}){this.vertex_layout=e,this.vertex_elements=new Ie,this.stride=this.vertex_layout.stride,Fe.array_pool.length>0?(this.vertex_buffer=Fe.array_pool.pop(),this.byte_length=this.vertex_buffer.byteLength,this.size=Math.floor(this.byte_length/this.stride),g("trace",`VertexData: reused buffer of bytes ${this.byte_length}, ${this.size} vertices`)):(this.size=t,this.byte_length=this.stride*this.size,this.vertex_buffer=new Uint8Array(this.byte_length)),this.offset=0,this.vertex_count=0,this.realloc_count=0,this.setBufferViews(),this.setAddVertexFunction()}setBufferViews(){this.views={},this.views[pe.UNSIGNED_BYTE]=this.vertex_buffer,this.vertex_layout.dynamic_attribs.forEach(e=>{if(null==this.views[e.type]){var t=ze[e.type];this.views[e.type]=new t(this.vertex_buffer.buffer)}})}checkBufferSize(){if(this.offset+this.stride>this.byte_length){this.size=Math.floor(1.5*this.size),this.size-=this.size%4,this.byte_length=this.stride*this.size;var e=new Uint8Array(this.byte_length);e.set(this.vertex_buffer),Fe.array_pool.push(this.vertex_buffer),this.vertex_buffer=e,this.setBufferViews(),this.realloc_count++}}setAddVertexFunction(){this.vertexLayoutAddVertex=this.vertex_layout.getAddVertexFunction()}addVertex(e){this.checkBufferSize(),this.vertexLayoutAddVertex(e,this.views,this.offset),this.offset+=this.stride,this.vertex_count++}end(){return this.vertex_buffer=this.vertex_buffer.subarray(0,this.offset),this.element_buffer=this.vertex_elements.end(),g("trace",`VertexData: ${this.size} vertices total, realloc count ${this.realloc_count}`),this}}Fe.array_pool=[];class Le{constructor(e){this.attribs=e,this.dynamic_attribs=this.attribs.filter(e=>null==e.static),this.static_attribs=this.attribs.filter(e=>null!=e.static),this.components=[],this.index={},this.offset={},this.stride=0;let t=0,n=0;for(let e=0;e<this.attribs.length;e++){let r=this.attribs[e];if(null==r.static){r.offset=this.stride,r.byte_size=r.size;let e=0;switch(r.type){case pe.FLOAT:case pe.INT:case pe.UNSIGNED_INT:r.byte_size*=4,e=2;break;case pe.SHORT:case pe.UNSIGNED_SHORT:r.byte_size*=2,e=1}3&r.byte_size&&(r.byte_size+=4-(3&r.byte_size)),this.stride+=r.byte_size;let i=r.offset>>e;for(let t=0;t<r.size;t++)this.components.push({type:r.type,shift:e,offset:i++,index:n++});this.index[r.name]=t,t+=r.size,this.offset[r.name]=r.offset}else r.static=Array.isArray(r.static)?r.static:[r.static],r.method=`vertexAttrib${r.static.length}fv`}}enableDynamicAttributes(e,t){for(const t in Le.enabled_attribs)e.disableVertexAttribArray(t);Le.enabled_attribs={},this.dynamic_attribs.forEach(n=>{const r=t.attribute(n.name).location;-1!==r&&(e.enableVertexAttribArray(r),e.vertexAttribPointer(r,n.size,n.type,n.normalized,this.stride,n.offset),Le.enabled_attribs[r]=t)})}enableStaticAttributes(e,t){this.static_attribs.forEach(n=>{const r=t.attribute(n.name).location;-1!==r&&e[n.method]instanceof Function&&(e.enableVertexAttribArray(r),e[n.method](r,n.static),e.disableVertexAttribArray(r))})}createVertexData(){return new Fe(this)}getAddVertexFunction(){return null==this.addVertex&&this.createAddVertexFunction(),this.addVertex}createAddVertexFunction(){let e=N(JSON.stringify(this.attribs));if(null==Le.add_vertex_funcs[e]){let t,n=["var t, o;"],r=[...this.components];r.sort((e,t)=>e.type!==t.type?e.type-t.type:e.index-t.index);for(let e=0;e<r.length;e++){let i=r[e];t!==i.type&&(n.push(`t = vs[${i.type}];`),n.push(`o = off${i.shift?" >> "+i.shift:""};`),t=i.type),n.push(`t[o + ${i.offset}] = v[${i.index}];`)}n=n.join("\n");let i=new Function("v","vs","off",n);Le.add_vertex_funcs[e]=i}this.addVertex=Le.add_vertex_funcs[e]}}Le.enabled_attribs={},Le.add_vertex_funcs={};const je=[{x:0,y:0},{x:U.tile_scale,y:-U.tile_scale}],$e=[0,0,1,1];function Be(e,t,n){let r=je[0],i=je[1];return e[0]<=r.x+n&&t[0]<=r.x+n||e[0]>=i.x-n&&t[0]>=i.x-n||e[1]>=r.y-n&&t[1]>=r.y-n||e[1]<=i.y+n&&t[1]<=i.y+n}function Ve(e,t){t=t||0;let n=je[0],r=je[1];return e[0]<=n.x+t||e[0]>=r.x-t||e[1]>=n.y-t||e[1]<=r.y+t}var Ue,We={exports:{}},qe=function(){if(Ue)return We.exports;function e(e,i,o){o=o||2;var s,a,c,d,p,f,m,g=i&&i.length,y=g?i[0]*o:e.length,b=t(e,0,y,o,!0),v=[];if(!b||b.next===b.prev)return v;if(g&&(b=function(e,r,i,o){var s,a,c,d=[];for(s=0,a=r.length;s<a;s++)(c=t(e,r[s]*o,s<a-1?r[s+1]*o:e.length,o,!1))===c.next&&(c.steiner=!0),d.push(h(c));for(d.sort(l),s=0;s<d.length;s++)u(d[s],i),i=n(i,i.next);return i}(e,i,b,o)),e.length>80*o){s=c=e[0],a=d=e[1];for(var _=o;_<y;_+=o)(p=e[_])<s&&(s=p),(f=e[_+1])<a&&(a=f),p>c&&(c=p),f>d&&(d=f);m=0!==(m=Math.max(c-s,d-a))?1/m:0}return r(b,v,o,s,a,m),v}function t(e,t,n,r,i){var o,s;if(i===T(e,t,n,r)>0)for(o=t;o<n;o+=r)s=w(o,e[o],e[o+1],s);else for(o=n-r;o>=t;o-=r)s=w(o,e[o],e[o+1],s);return s&&g(s,s.next)&&(E(s),s=s.next),s}function n(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!g(r,r.next)&&0!==m(r.prev,r,r.next))r=r.next;else{if(E(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function r(e,t,l,u,c,h,p){if(e){!p&&h&&function(e,t,n,r){var i=e;do{null===i.z&&(i.z=d(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){var t,n,r,i,o,s,a,l,u=1;do{for(n=e,e=null,o=null,s=0;n;){for(s++,r=n,a=0,t=0;t<u&&(a++,r=r.nextZ);t++);for(l=u;a>0||l>0&&r;)0!==a&&(0===l||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,l--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;n=r}o.nextZ=null,u*=2}while(s>1)}(i)}(e,u,c,h);for(var f,m,g=e;e.prev!==e.next;)if(f=e.prev,m=e.next,h?o(e,u,c,h):i(e))t.push(f.i/l),t.push(e.i/l),t.push(m.i/l),E(e),e=m.next,g=m.next;else if((e=m)===g){p?1===p?r(e=s(n(e),t,l),t,l,u,c,h,2):2===p&&a(e,t,l,u,c,h):r(n(e),t,l,u,c,h,1);break}}}function i(e){var t=e.prev,n=e,r=e.next;if(m(t,n,r)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(p(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&m(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function o(e,t,n,r){var i=e.prev,o=e,s=e.next;if(m(i,o,s)>=0)return!1;for(var a=i.x<o.x?i.x<s.x?i.x:s.x:o.x<s.x?o.x:s.x,l=i.y<o.y?i.y<s.y?i.y:s.y:o.y<s.y?o.y:s.y,u=i.x>o.x?i.x>s.x?i.x:s.x:o.x>s.x?o.x:s.x,c=i.y>o.y?i.y>s.y?i.y:s.y:o.y>s.y?o.y:s.y,h=d(a,l,t,n,r),f=d(u,c,t,n,r),g=e.prevZ,y=e.nextZ;g&&g.z>=h&&y&&y.z<=f;){if(g!==e.prev&&g!==e.next&&p(i.x,i.y,o.x,o.y,s.x,s.y,g.x,g.y)&&m(g.prev,g,g.next)>=0)return!1;if(g=g.prevZ,y!==e.prev&&y!==e.next&&p(i.x,i.y,o.x,o.y,s.x,s.y,y.x,y.y)&&m(y.prev,y,y.next)>=0)return!1;y=y.nextZ}for(;g&&g.z>=h;){if(g!==e.prev&&g!==e.next&&p(i.x,i.y,o.x,o.y,s.x,s.y,g.x,g.y)&&m(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;y&&y.z<=f;){if(y!==e.prev&&y!==e.next&&p(i.x,i.y,o.x,o.y,s.x,s.y,y.x,y.y)&&m(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function s(e,t,r){var i=e;do{var o=i.prev,s=i.next.next;!g(o,s)&&y(o,i,i.next,s)&&_(o,s)&&_(s,o)&&(t.push(o.i/r),t.push(i.i/r),t.push(s.i/r),E(i),E(i.next),i=e=s),i=i.next}while(i!==e);return n(i)}function a(e,t,i,o,s,a){var l=e;do{for(var u=l.next.next;u!==l.prev;){if(l.i!==u.i&&f(l,u)){var c=x(l,u);return l=n(l,l.next),c=n(c,c.next),r(l,t,i,o,s,a),void r(c,t,i,o,s,a)}u=u.next}l=l.next}while(l!==e)}function l(e,t){return e.x-t.x}function u(e,t){if(t=function(e,t){var n,r=t,i=e.x,o=e.y,s=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var a=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=i&&a>s){if(s=a,a===i){if(o===r.y)return r;if(o===r.next.y)return r.next}n=r.x<r.next.x?r:r.next}}r=r.next}while(r!==t);if(!n)return null;if(i===s)return n;var l,u=n,d=n.x,h=n.y,f=1/0;r=n;do{i>=r.x&&r.x>=d&&i!==r.x&&p(o<h?i:s,o,d,h,o<h?s:i,o,r.x,r.y)&&(l=Math.abs(o-r.y)/(i-r.x),_(r,e)&&(l<f||l===f&&(r.x>n.x||r.x===n.x&&c(n,r)))&&(n=r,f=l)),r=r.next}while(r!==u);return n}(e,t),t){var r=x(t,e);n(t,t.next),n(r,r.next)}}function c(e,t){return m(e.prev,e,t.prev)<0&&m(t.next,e,e.next)<0}function d(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function h(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function p(e,t,n,r,i,o,s,a){return(i-s)*(t-a)-(e-s)*(o-a)>=0&&(e-s)*(r-a)-(n-s)*(t-a)>=0&&(n-s)*(o-a)-(i-s)*(r-a)>=0}function f(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&y(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(_(e,t)&&_(t,e)&&function(e,t){var n=e,r=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)&&(m(e.prev,e,t.prev)||m(e,t.prev,t))||g(e,t)&&m(e.prev,e,e.next)>0&&m(t.prev,t,t.next)>0)}function m(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function g(e,t){return e.x===t.x&&e.y===t.y}function y(e,t,n,r){var i=v(m(e,t,n)),o=v(m(e,t,r)),s=v(m(n,r,e)),a=v(m(n,r,t));return i!==o&&s!==a||!(0!==i||!b(e,n,t))||!(0!==o||!b(e,r,t))||!(0!==s||!b(n,e,r))||!(0!==a||!b(n,t,r))}function b(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function v(e){return e>0?1:e<0?-1:0}function _(e,t){return m(e.prev,e,e.next)<0?m(e,t,e.next)>=0&&m(e,e.prev,t)>=0:m(e,t,e.prev)<0||m(e,e.next,t)<0}function x(e,t){var n=new S(e.i,e.x,e.y),r=new S(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function w(e,t,n,r){var i=new S(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function E(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function S(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function T(e,t,n,r){for(var i=0,o=t,s=n-r;o<n;o+=r)i+=(e[s]-e[o])*(e[o+1]+e[s+1]),s=o;return i}return Ue=1,We.exports=e,We.exports.default=e,e.deviation=function(e,t,n,r){var i=t&&t.length,o=i?t[0]*n:e.length,s=Math.abs(T(e,0,o,n));if(i)for(var a=0,l=t.length;a<l;a++){var u=t[a]*n,c=a<l-1?t[a+1]*n:e.length;s-=Math.abs(T(e,u,c,n))}var d=0;for(a=0;a<r.length;a+=3){var h=r[a]*n,p=r[a+1]*n,f=r[a+2]*n;d+=Math.abs((e[h]-e[f])*(e[p+1]-e[h+1])-(e[h]-e[p])*(e[f+1]-e[h+1]))}return 0===s&&0===d?0:Math.abs((d-s)/s)},e.flatten=function(e){for(var t=e[0][0].length,n={vertices:[],holes:[],dimensions:t},r=0,i=0;i<e.length;i++){for(var o=0;o<e[i].length;o++)for(var s=0;s<t;s++)n.vertices.push(e[i][o][s]);i>0&&(r+=e[i-1].length,n.holes.push(r))}return n},We.exports}(),Ge=P(qe);function He(e,t,n=0,r=e.length-1,i=Ke){for(;r>n;){if(r-n>600){const o=r-n+1,s=t-n+1,a=Math.log(o),l=.5*Math.exp(2*a/3),u=.5*Math.sqrt(a*l*(o-l)/o)*(s-o/2<0?-1:1);He(e,t,Math.max(n,Math.floor(t-s*l/o+u)),Math.min(r,Math.floor(t+(o-s)*l/o+u)),i)}const o=e[t];let s=n,a=r;for(Ye(e,n,t),i(e[r],o)>0&&Ye(e,n,r);s<a;){for(Ye(e,s,a),s++,a--;i(e[s],o)<0;)s++;for(;i(e[a],o)>0;)a--}0===i(e[n],o)?Ye(e,n,a):(a++,Ye(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}}function Ye(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Ke(e,t){return e<t?-1:e>t?1:0}const Xe=[0,0,1];function Ze(e,t,n,{texcoord_index:r,texcoord_scale:i,texcoord_normalize:o}){let s,a,l,u,c,d,h,p,f,m,g,y,b=t.vertex_elements,v=e.length,_=0;r&&(o=o||1,[s,a,l,u]=i||$e);for(let i=0;i<v;i++){const v=500;let w=e[i];w.length>v&&(w=[...w],He(w,v,1,w.length-1,(e,t)=>t.area-e.area),w=w.slice(0,v));const E=(x=Ge.flatten(w),Ge(x.vertices,x.holes,x.dimensions)),S=E.length,T=t.vertex_count;if(S){r&&([c,d,h,p]=U.findBoundingBox(w),f=h-c,m=p-d,g=(l-s)/f,y=(u-a)/m);for(let e=0;e<w.length;e++){let i=w[e];for(let e=0;e<i.length;e++){let l=i[e];n[0]=l[0],n[1]=l[1],r&&(n[r+0]=((l[0]-c)*g+s)*o,n[r+1]=((l[1]-d)*y+a)*o),t.addVertex(n)}}for(let e=0;e<S;e++)b.push(T+E[e]);_+=S/3}}var x;return _}var Je='uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_tile_proxy_order_offset;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\n\nuniform mat4 u_model;\nuniform mat4 u_modelView;\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nattribute vec4 a_position;\nattribute vec4 a_color;\n\n// Optional normal attribute, otherwise default to up\n#ifdef TANGRAM_NORMAL_ATTRIBUTE\n attribute vec3 a_normal;\n #define TANGRAM_NORMAL a_normal\n#else\n #define TANGRAM_NORMAL vec3(0., 0., 1.)\n#endif\n\n// Optional dynamic line extrusion\n#ifdef TANGRAM_EXTRUDE_LINES\n attribute vec2 a_extrude; // extrusion direction in xy plane\n attribute vec2 a_offset; // offset direction in xy plane\n\n // Polygon and line styles have slightly different VBO layouts, saving memory by optimizing vertex packing.\n // All lines have a width scaling factor, but only some have a height (position.z) or offset.\n // The vertex height is stored in different attributes to account for this.\n attribute vec2 a_z_and_offset_scale; // stores vertex height in x, and offset scaling factor in y\n #define TANGRAM_POSITION_Z a_z_and_offset_scale.x // vertex height is stored in separate line-specific attrib\n #define TANGRAM_OFFSET_SCALING a_z_and_offset_scale.y // zoom scaling factor for line offset\n #define TANGRAM_WIDTH_SCALING a_position.z // zoom scaling factor for line width (stored in position attrib)\n\n uniform float u_v_scale_adjust; // scales texture UVs for line dash patterns w/fractional pixel width\n#else\n #define TANGRAM_POSITION_Z a_position.z // vertex height\n#endif\n\nvarying vec4 v_position;\nvarying vec3 v_normal;\nvarying vec4 v_color;\nvarying vec4 v_world_position;\n\n// Optional texture UVs\n#if defined(TANGRAM_TEXTURE_COORDS) || defined(TANGRAM_EXTRUDE_LINES)\n attribute vec2 a_texcoord;\n varying vec2 v_texcoord;\n#endif\n\n// Optional model position varying for tile coordinate zoom\n#ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\n varying vec4 v_modelpos_base_zoom;\n#endif\n\n#if defined(TANGRAM_LIGHTING_VERTEX)\n varying vec4 v_lighting;\n#endif\n\n#define TANGRAM_UNPACK_SCALING(x) (x / 1024.)\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\nvoid main() {\n // Initialize globals\n #pragma tangram: setup\n\n // Texture UVs\n #ifdef TANGRAM_TEXTURE_COORDS\n v_texcoord = a_texcoord;\n #ifdef TANGRAM_EXTRUDE_LINES\n v_texcoord.y *= u_v_scale_adjust;\n #endif\n #endif\n\n // Pass model position to fragment shader\n #ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\n v_modelpos_base_zoom = modelPositionBaseZoom();\n #endif\n\n // Position\n vec4 position = vec4(a_position.xy, TANGRAM_POSITION_Z / TANGRAM_HEIGHT_SCALE, 1.); // convert height back to meters\n\n #ifdef TANGRAM_EXTRUDE_LINES\n vec2 _extrude = a_extrude.xy;\n vec2 _offset = a_offset.xy;\n\n // Adjust line width based on zoom level, to prevent proxied lines\n // from being either too small or too big.\n // "Flattens" the zoom between 1-2 to peg it to 1 (keeps lines from\n // prematurely shrinking), then interpolate and clamp to 4 (keeps lines\n // from becoming too small when far away).\n float _dz = clamp(u_map_position.z - u_tile_origin.z, 0., 4.);\n _dz += step(1., _dz) * (1. - _dz) + mix(0., 2., clamp((_dz - 2.) / 2., 0., 1.));\n\n // Interpolate line width between zooms\n float _mdz = (_dz - 0.5) * 2.; // zoom from mid-point\n _extrude -= _extrude * TANGRAM_UNPACK_SCALING(TANGRAM_WIDTH_SCALING) * _mdz;\n\n // Interpolate line offset between zooms\n // Scales from the larger value to the smaller one\n float _dwdz = TANGRAM_UNPACK_SCALING(TANGRAM_OFFSET_SCALING);\n float _sdwdz = sign(step(0., _dwdz) - 0.5); // sign indicates "direction" of scaling\n _offset -= _offset * abs(_dwdz) * ((1.-step(0., _sdwdz)) - (_dz * -_sdwdz)); // scale "up" or "down"\n\n // Scale line width and offset to be consistent in screen space\n float _ssz = exp2(-_dz - (u_tile_origin.z - u_tile_origin.w));\n _extrude *= _ssz;\n _offset *= _ssz;\n\n // Modify line width before extrusion\n #ifdef TANGRAM_BLOCK_WIDTH\n float width = 1.;\n #pragma tangram: width\n _extrude *= width;\n #endif\n\n position.xy += _extrude + _offset;\n #endif\n\n // World coordinates for 3d procedural textures\n v_world_position = wrapWorldPosition(u_model * position);\n\n // Adjust for tile and view position\n position = u_modelView * position;\n\n // Modify position before camera projection\n #pragma tangram: position\n\n // Setup varyings\n v_position = position;\n v_normal = normalize(u_normalMatrix * TANGRAM_NORMAL);\n v_color = a_color;\n\n #if defined(TANGRAM_LIGHTING_VERTEX)\n // Vertex lighting\n vec3 normal = v_normal;\n\n // Modify normal before lighting\n #pragma tangram: normal\n\n // Pass lighting intensity to fragment shader\n v_lighting = calculateLighting(position.xyz - u_eye, normal, vec4(1.));\n #endif\n\n // Camera\n cameraProjection(position);\n\n // +1 is to keep all layers including proxies > 0\n applyLayerOrder(a_position.w + u_tile_proxy_order_offset + 1., position);\n\n gl_Position = position;\n}\n',Qe="uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\n\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nvarying vec4 v_position;\nvarying vec3 v_normal;\nvarying vec4 v_color;\nvarying vec4 v_world_position;\n\n#ifdef TANGRAM_EXTRUDE_LINES\n uniform bool u_has_line_texture;\n uniform sampler2D u_texture;\n uniform float u_texture_ratio;\n uniform vec4 u_dash_background_color;\n uniform float u_has_dash;\n#endif\n\n#define TANGRAM_NORMAL v_normal\n\n#if defined(TANGRAM_TEXTURE_COORDS) || defined(TANGRAM_EXTRUDE_LINES)\n varying vec2 v_texcoord;\n#endif\n\n#ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\n varying vec4 v_modelpos_base_zoom;\n#endif\n\n#if defined(TANGRAM_LIGHTING_VERTEX)\n varying vec4 v_lighting;\n#endif\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\nvoid main (void) {\n // Initialize globals\n #pragma tangram: setup\n\n vec4 color = v_color;\n vec3 normal = TANGRAM_NORMAL;\n\n // Apply raster to vertex color\n #ifdef TANGRAM_RASTER_TEXTURE_COLOR\n vec4 _raster_color = sampleRaster(0);\n\n #if defined(TANGRAM_BLEND_OPAQUE) || defined(TANGRAM_BLEND_TRANSLUCENT) || defined(TANGRAM_BLEND_MULTIPLY)\n // Raster sources can optionally mask by the alpha channel, which will render with only full or no alpha.\n // This is used for handling transparency outside the raster image in some blend modes,\n // which either don't support alpha, or would cause transparent pixels to write to the depth buffer,\n // obscuring geometry underneath.\n #ifdef TANGRAM_HAS_MASKED_RASTERS // skip masking logic if no masked raster sources\n #ifndef TANGRAM_ALL_MASKED_RASTERS // skip source check for masking if *all* raster sources are masked\n if (u_raster_mask_alpha) {\n #else\n {\n #endif\n #if defined(TANGRAM_BLEND_TRANSLUCENT) || defined(TANGRAM_BLEND_MULTIPLY)\n if (_raster_color.a < TANGRAM_EPSILON) {\n discard;\n }\n #else // TANGRAM_BLEND_OPAQUE\n if (_raster_color.a < 1. - TANGRAM_EPSILON) {\n discard;\n }\n // only allow full alpha in opaque blend mode (avoids artifacts blending w/canvas tile background)\n _raster_color.a = 1.;\n #endif\n }\n #endif\n #endif\n\n color *= _raster_color; // multiplied to tint texture color\n #endif\n\n // Apply line texture\n #ifdef TANGRAM_EXTRUDE_LINES\n { // enclose in scope to avoid leakage of internal variables\n if (u_has_line_texture) {\n vec2 _line_st = vec2(v_texcoord.x, fract(v_texcoord.y / u_texture_ratio));\n vec4 _line_color = texture2D(u_texture, _line_st);\n\n // If the line has a dash pattern, the line texture indicates if the current fragment should be\n // the dash foreground or background color. If the line doesn't have a dash pattern,\n // the line texture color is used directly (but also tinted by the vertex color).\n color = mix(\n color * _line_color, // no dash: tint the line texture with the vertex color\n mix(u_dash_background_color, color, _line_color.a), // choose dash foreground or background color\n u_has_dash // 0 if no dash, 1 if has dash\n );\n\n // Use alpha discard test as a lower-quality substitute for blending\n #if defined(TANGRAM_BLEND_OPAQUE)\n if (color.a < TANGRAM_ALPHA_TEST) {\n discard;\n }\n #endif\n }\n }\n #endif\n\n // First, get normal from raster tile (if applicable)\n #ifdef TANGRAM_RASTER_TEXTURE_NORMAL\n normal = normalize(sampleRaster(0).rgb * 2. - 1.);\n #endif\n\n // Second, alter normal with normal map texture (if applicable)\n #if defined(TANGRAM_LIGHTING_FRAGMENT) && defined(TANGRAM_MATERIAL_NORMAL_TEXTURE)\n calculateNormal(normal);\n #endif\n\n // Normal modification applied here for fragment lighting or no lighting,\n // and in vertex shader for vertex lighting\n #if !defined(TANGRAM_LIGHTING_VERTEX)\n #pragma tangram: normal\n #endif\n\n // Color modification before lighting is applied\n #pragma tangram: color\n\n #if defined(TANGRAM_LIGHTING_FRAGMENT)\n // Calculate per-fragment lighting\n color = calculateLighting(v_position.xyz - u_eye, normal, color);\n #elif defined(TANGRAM_LIGHTING_VERTEX)\n // Apply lighting intensity interpolated from vertex shader\n color *= v_lighting;\n #endif\n\n // Post-processing effects (modify color after lighting)\n #pragma tangram: filter\n\n gl_FragColor = color;\n}\n";const et=Object.create(Ne);Object.assign(et,{name:"polygons",built_in:!0,vertex_shader_src:Je,fragment_shader_src:Qe,selection:!0,init(){Ne.init.apply(this,arguments),this.defines.TANGRAM_NORMAL_ATTRIBUTE=!0,this.defines.TANGRAM_TEXTURE_COORDS=this.texcoords},_parseFeature(e,t,n){var r=this.feature_style;return r.color=this.parseColor(t.color,n),r.color?(r.alpha=Q.evalCachedProperty(t.alpha,n),r.variant=t.variant,r.z=Q.evalCachedDistanceProperty(t.z,n)||Q.defaults.z,r.z*=U.height_scale,r.extrude=Q.evalProperty(t.extrude,n),r.extrude&&(!0===r.extrude?(r.height=e.properties.height||Q.defaults.height,r.min_height=e.properties.min_height||Q.defaults.min_height):"number"==typeof r.extrude?(r.height=r.extrude,r.min_height=0):Array.isArray(r.extrude)&&(r.min_height=r.extrude[0],r.height=r.extrude[1]),r.height*=U.height_scale,r.min_height*=U.height_scale),r.tile_edges=t.tile_edges,r):null},_preprocess(e){return e.color=Q.createColorPropertyCache(e.color),e.alpha=Q.createPropertyCache(e.alpha),e.z=Q.createPropertyCache(e.z,Q.parseUnits),this.computeVariant(e),e},computeVariant(e){const t=e.interactive?1:0,n=null!=e.extrude?1:0,r=this.texcoords?1:0,i=this.getBlendOrderForDraw(e),o=[t,n,r,i].join("/");e.variant=o,null==this.variants[o]&&(this.variants[o]={key:o,blend_order:i,mesh_order:0,selection:t,normal:n,texcoords:r})},vertexLayoutForMeshVariant(e){if(null==this.vertex_layouts[e.key]){const t=[{name:"a_position",size:4,type:pe.SHORT,normalized:!1},{name:"a_normal",size:3,type:pe.BYTE,normalized:!0,static:e.normal?null:[0,0,1]},{name:"a_color",size:4,type:pe.UNSIGNED_BYTE,normalized:!0},{name:"a_selection_color",size:4,type:pe.UNSIGNED_BYTE,normalized:!0,static:e.selection?null:[0,0,0,0]},{name:"a_texcoord",size:2,type:pe.UNSIGNED_SHORT,normalized:!0,static:e.texcoords?null:[0,0]}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.key]=new Le(t)}return this.vertex_layouts[e.key]},meshVariantTypeForDraw(e){return this.variants[e.variant]},makeVertexTemplate(e,t){let n=0;return this.vertex_template[n++]=0,this.vertex_template[n++]=0,this.vertex_template[n++]=e.z||0,this.vertex_template[n++]=this.scaleOrder(e.order),t.variant.normal&&(this.vertex_template[n++]=0,this.vertex_template[n++]=0,this.vertex_template[n++]=127),this.vertex_template[n++]=255*e.color[0],this.vertex_template[n++]=255*e.color[1],this.vertex_template[n++]=255*e.color[2],this.vertex_template[n++]=255*(null!=e.alpha?e.alpha:e.color[3]),t.variant.selection&&(this.vertex_template[n++]=255*e.selection_color[0],this.vertex_template[n++]=255*e.selection_color[1],this.vertex_template[n++]=255*e.selection_color[2],this.vertex_template[n++]=255*e.selection_color[3]),t.variant.texcoords&&(this.vertex_template[n++]=0,this.vertex_template[n++]=0),this.addCustomAttributesToVertexTemplate(e,n),this.vertex_template},buildPolygons(e,t,n){let r=this.getTileMesh(n.tile,this.meshVariantTypeForDraw(t)),i=r.vertex_data,o=i.vertex_layout,s=this.makeVertexTemplate(t,r),a={texcoord_index:o.index.a_texcoord,texcoord_normalize:65535,remove_tile_edges:!t.tile_edges,tile_edge_tolerance:U.tile_scale*n.tile.pad_scale*4,winding:n.winding};return t.extrude&&t.height?function(e,t,n,r,i,o,s,a,{remove_tile_edges:l,tile_edge_tolerance:u,texcoord_index:c,texcoord_scale:d,texcoord_normalize:h,winding:p}){var f=t+(r||0),m=t+n;o[2]=m;var g=Ze(e,i,o,{texcoord_index:c,texcoord_scale:d,texcoord_normalize:h}),y=i.vertex_elements,b=i.vertex_count;if(c){h=h||1;var[v,_,x,w]=d||$e,E=[[v,w],[v,_],[x,_],[x,w]]}for(var S=e.length,T=0;T<S;T++)for(var k=e[T],O=0;O<k.length;O++)for(var A=k[O],C=0;C<A.length-1;C++){if(l&&Be(A[C],A[C+1],u))continue;let e,t;"CCW"===p?(e=C,t=C+1):(e=C+1,t=C);var R=[[A[t][0],A[t][1],m],[A[t][0],A[t][1],f],[A[e][0],A[e][1],f],[A[e][0],A[e][1],m]];let n=be.normalize([A[t][0]-A[e][0],A[t][1]-A[e][1],0]),r=be.cross(Xe,n);o[s+0]=r[0]*a,o[s+1]=r[1]*a,o[s+2]=r[2]*a;for(var N=0;N<R.length;N++)o[0]=R[N][0],o[1]=R[N][1],o[2]=R[N][2],c&&(o[c+0]=E[N][0]*h,o[c+1]=E[N][1]*h),i.addVertex(o);y.push(b+0),y.push(b+1),y.push(b+2),y.push(b+2),y.push(b+3),y.push(b+0),b+=4,g+=2}return g}(e,t.z,t.height,t.min_height,i,s,o.index.a_normal,127,a):Ze(e,i,s,a)}});const tt=[0,0],nt={butt:0,square:1,round:2},rt={miter:0,bevel:1,round:2},it=U.tile_scale,ot=[0,0],st=[1,0],at=[.5,0];function lt(e,t){if(!(e.length<2)){var n,r,i,o,{join_type:s,cap_type:a,closed_polygon:l,remove_tile_edges:u,tile_edge_tolerance:c,v_scale:d,miter_len_sq:h}=t,p=null!=t.texcoord_index,f=0;if(l&&s===rt.miter){var m=function(e){if(Ve(e[0]))return 0;for(var t=0;t<e.length;t++)if(Ve(e[e.length-1-t]))return e.length-1-t;return 0}(e);if(0!==m){var g=function(e,t){var n=[];for(let i=0;i<e.length;i++){var r=(i+t)%e.length;0!==r&&n.push(e[r])}return n.push(n[0]),n}(e,m);return t.extra_lines=t.extra_lines||[],void t.extra_lines.push(g)}}var y=0,b=e.length-1,v=0;for(n=e[y],r=e[y+1];be.isEqual(n,r);)if(n=r,r=e[1+ ++y],v++,y===e.length-1)return;for(;be.isEqual(e[b],e[b-1]);)if(v++,0===--b)return;if(!(e.length<2+v))if(o=be.normalize(be.perp(n,r)),u&&Be(n,r,c)){var _=ut(e,y,c);_&&(t.extra_lines=t.extra_lines||[],t.extra_lines.push(_))}else{l?function(e,t,n,r,i){if(void 0===r||Ve(e))ft(e,n,n,1,0,i,1),ft(e,n,n,0,0,i,-1);else{r===rt.miter?dt(0,e,t,n,i.miter_len_sq,!0,i):ht(r,0,e,t,n,!0,i)}}(n,i=be.normalize(be.perp(e[b-1],n)),o,s,t):(Ve(n)||(yt(n,f,o,a,!0,t),p&&a!==nt.butt&&(f+=.5*d*t.texcoord_width)),ft(n,o,o,1,f,t,1),ft(n,o,o,0,f,t,-1)),p&&(f+=d*be.length(be.sub(r,n)));for(var x=y+1;x<b;x++){var w=x,E=x+1;if(n=e[w],r=e[E],!be.isEqual(n,r)){if(u&&Be(n,r,c)){ft(n,o,o,1,f,t,1),ft(n,o,o,0,f,t,-1),pt(1,t);var S=ut(e,w+1,c);return void(S&&(t.extra_lines=t.extra_lines||[],t.extra_lines.push(S)))}i=o,o=be.normalize(be.perp(n,r)),s===rt.miter?dt(f,n,i,o,h,!1,t):ht(s,f,n,i,o,!1,t),p&&(f+=d*be.length(be.sub(r,n)))}}n=r,i=o,l?function(e,t,n,r,i,o){if(Ve(e))ft(e,t,t,1,i,o,1),ft(e,t,t,0,i,o,-1),pt(1,o);else{var s=ct(t,n);r===rt.miter&&be.lengthSq(s)>o.miter_len_sq&&(r=rt.bevel),r===rt.miter?(ft(e,s,t,1,i,o,1),ft(e,s,t,0,i,o,-1),pt(1,o)):(ft(e,t,t,1,i,o,1),ft(e,t,t,0,i,o,-1),pt(1,o))}}(n,i,o=be.normalize(be.perp(n,e[1])),s,f,t):(ft(n,i,o,1,f,t,1),ft(n,i,o,0,f,t,-1),pt(1,t),Ve(n)||yt(n,f,i,a,!1,t))}}}function ut(e,t,n){for(var r=t;e[r+1]&&Be(e[r],e[r+1],n);)r++;return e.length-r>=2&&e.slice(r)}function ct(e,t){var n=be.normalize(be.add(e,t)),r=2/(1+Math.abs(be.dot(e,n)));return be.mult(n,r*r)}function dt(e,t,n,r,i,o,s){var a=ct(n,r);be.lengthSq(a)>i?ht(rt.bevel,e,t,n,r,o,s):(ft(t,a,a,1,e,s,1),ft(t,a,a,0,e,s,-1),o||pt(1,s))}function ht(e,t,n,r,i,o,s){var a=ct(r,i),l=i[0]*r[1]-i[1]*r[0]>0;null!=s.texcoord_index&&(ot[1]=t,st[1]=t),l?(ft(n,a,a,1,t,s,1),ft(n,r,a,0,t,s,-1),o||pt(1,s),gt(n,be.neg(r),a,be.neg(i),a,ot,st,ot,!1,e===rt.bevel,s),ft(n,a,a,1,t,s,1),ft(n,i,a,0,t,s,-1)):(ft(n,r,a,1,t,s,1),ft(n,a,a,0,t,s,-1),o||pt(1,s),gt(n,r,be.neg(a),i,a,st,ot,st,!1,e===rt.bevel,s),ft(n,i,a,1,t,s,1),ft(n,a,a,0,t,s,-1))}function pt(e,t){for(var n=t.vertex_data.vertex_elements,r=t.vertex_data.vertex_count-2*e-2,i=0;i<e;i++)n.push(r+2*i+2),n.push(r+2*i+1),n.push(r+2*i+0),n.push(r+2*i+2),n.push(r+2*i+3),n.push(r+2*i+1),t.geom_count+=2}function ft(e,t,n,r,i,o,s){var a=o.vertex_template,l=o.vertex_data;a[0]=e[0],a[1]=e[1];let u=o.half_width*s;a[o.extrude_index+0]=t[0]*u,a[o.extrude_index+1]=t[1]*u,o.offset&&(a[o.offset_index+0]=n[0]*o.offset,a[o.offset_index+1]=n[1]*o.offset),null!=o.texcoord_index&&(a[o.texcoord_index+0]=65535*r,a[o.texcoord_index+1]=65535*i),l.addVertex(a)}var mt=[0,0];function gt(e,t,n,r,i,o,s,a,l,u,c){for(var d=t[0]*r[1]-t[1]*r[0],h=be.dot(t,r),p=Math.atan2(d,h);p>=Math.PI;)p-=2*Math.PI;if(u)f=1;else{var f=function(e,t){e<0&&(e=-e);var n=t>10?Math.log2(t/5):1;return Math.ceil(e/Math.PI*n)}(p,c.half_width);if(f<1)return}var m=c.vertex_data.vertex_count,g=c.vertex_data.vertex_elements;ft(e,n,i,s[0],s[1],c,1),ft(e,t,i,o[0],o[1],c,1);var y=t,b=null!=c.texcoord_index;if(b)if(l)var v=be.sub(o,s);else{mt=be.copy(o);var _=be.div(be.sub(a,o),f)}var x=p/f;let w,E,S=p<0?-1:1;d>0?(w=2,E=1):(w=1,E=2);for(var T=0;T<f;T++)0===T&&p<0&&(y=be.neg(y)),y=be.rot(y,x),b&&(l?(v=be.rot(v,x),mt[0]=v[0]+s[0],mt[1]=v[1]*c.texcoord_width*c.v_scale+s[1]):mt=be.add(mt,_)),ft(e,y,i,mt[0],mt[1],c,S),g.push(m+T+w),g.push(m),g.push(m+T+E)}function yt(e,t,n,r,i,o){var s=be.neg(n),a=null!=o.texcoord_index;switch(r){case nt.square:var l;i?(l=[n[1],-n[0]],ft(e,be.add(n,l),n,1,t,o,1),ft(e,be.add(s,l),n,0,t,o,1),a&&(t+=.5*o.texcoord_width*o.v_scale),ft(e,n,n,1,t,o,1),ft(e,s,n,0,t,o,1)):(l=[-n[1],n[0]],ft(e,n,n,1,t,o,1),ft(e,s,n,0,t,o,1),a&&(t+=.5*o.texcoord_width*o.v_scale),ft(e,be.add(n,l),n,1,t,o,1),ft(e,be.add(s,l),n,0,t,o,1)),pt(1,o);break;case nt.round:var u,c,d=ot,h=st,p=at;i?(u=n,c=s,a&&(t+=.5*o.texcoord_width*o.v_scale,d=st,h=ot,p=at)):(u=s,c=n),a&&(ot[1]=t,st[1]=t,at[1]=t),gt(e,u,tt,c,n,d,p,h,!0,!1,o);break;case nt.butt:return}}const bt=[255,255,255,255],vt=[0,0,0,0],_t=Object.create(Ne);Object.assign(_t,{name:"lines",built_in:!0,vertex_shader_src:Je,fragment_shader_src:Qe,selection:!0,init(){Ne.init.apply(this,arguments),this.defines.TANGRAM_EXTRUDE_LINES=!0,this.defines.TANGRAM_TEXTURE_COORDS=!0,this.outline_feature_style={},this.inline_feature_style=this.feature_style,this.dash_textures={}},calcDistance:(e,t)=>Q.evalCachedDistanceProperty(e,t)||0,calcDistanceNextZoom(e,t){t.zoom++;let n=this.calcDistance(e,t);return t.zoom--,n},calcWidth(e,t,n){let r,i=this.calcDistance(e.width,n);if(!(i<0)){if(r=e.next_width?this.calcDistanceNextZoom(e.next_width,n):i/2,0===i&&0===r||r<0)return!1;if(t.width_unscaled=i,t.next_width_unscaled=r,e.next_width){r*=2;let e=.5*(i+r);t.width=e*n.units_per_meter_overzoom,t.width_scale=1-r/e}else t.width=i*n.units_per_meter_overzoom,t.width_scale=0;return e.texcoords&&(e.inline_texcoord_width?t.texcoord_width=e.inline_texcoord_width:t.texcoord_width=(t.width_unscaled||t.next_width_unscaled)*n.units_per_meter_overzoom/n.tile.overzoom2),!0}},calcOffset(e,t,n){if(e.offset_precalc)t.offset=e.offset_precalc,t.offset_scale=e.offset_scale_precalc;else if(e.offset){let r=this.calcDistance(e.offset,n);if(e.next_offset){let i=2*this.calcDistanceNextZoom(e.next_offset,n);Math.abs(r)>=Math.abs(i)?(t.offset=r*n.units_per_meter_overzoom,t.offset_scale=0!==r?1-i/r:0):(t.offset=i*n.units_per_meter_overzoom,t.offset_scale=0!==i?-1*(1-r/i):0)}else t.offset=r*n.units_per_meter_overzoom,t.offset_scale=0}else t.offset=0,t.offset_scale=0},_parseFeature(e,t,n){var r=this.feature_style;if(!1!==this.calcWidth(t,r,n)&&(this.calcOffset(t,r,n),r.color=this.parseColor(t.color,n),r.color)){if(r.alpha=Q.evalCachedProperty(t.alpha,n),r.variant=t.variant,r.z=Q.evalCachedDistanceProperty(t.z,n)||Q.defaults.z,r.height=e.properties.height||Q.defaults.height,r.extrude=Q.evalProperty(t.extrude,n),r.extrude&&("number"==typeof r.extrude?r.height=r.extrude:Array.isArray(r.extrude)&&(r.height=r.extrude[1])),r.extrude&&r.height&&(r.z+=r.height),r.z*=U.height_scale,r.cap=t.cap,r.join=t.join,r.miter_limit=t.miter_limit,r.tile_edges=t.tile_edges,r.outline=r.outline||{width:{},next_width:{},preprocessed:!0},t.outline&&!1!==t.outline.visible&&t.outline.color&&t.outline.width){let e=2*this.calcDistance(t.outline.width,n),i=2*this.calcDistanceNextZoom(t.outline.next_width,n);0===e&&0===i||e<0||i<0?(r.outline.width.value=null,r.outline.next_width.value=null,r.outline.color=null,r.outline.inline_texcoord_width=null,r.outline.texcoords=!1):(r.outline.width.value=e+r.width_unscaled,r.outline.next_width.value=i+r.next_width_unscaled,r.outline.inline_texcoord_width=r.texcoord_width,r.outline.offset_precalc=r.offset,r.outline.offset_scale_precalc=r.offset_scale,r.outline.color=t.outline.color,r.outline.alpha=t.outline.alpha,r.outline.interactive=t.outline.interactive,r.outline.cap=t.outline.cap,r.outline.join=t.outline.join,r.outline.miter_limit=t.outline.miter_limit,r.outline.texcoords=t.outline.texcoords,r.outline.extrude=t.outline.extrude,r.outline.z=t.outline.z,r.outline.style=t.outline.style,r.outline.variant=t.outline.variant,t.outline.order?r.outline.order=this.parseOrder(t.outline.order,n):r.outline.order=r.order,r.outline.order>r.order&&(r.outline.order=r.order),r.outline.order-=.5)}else r.outline.width.value=null,r.outline.next_width.value=null,r.outline.color=null,r.outline.inline_texcoord_width=null;return r}},_preprocess(e){if(e.color=Q.createColorPropertyCache(e.color),e.alpha=Q.createPropertyCache(e.alpha),e.width=Q.createPropertyCache(e.width,Q.parseUnits),e.width&&e.width.type!==Q.CACHE_TYPE.STATIC&&(e.next_width=Q.createPropertyCache(e.width,Q.parseUnits)),e.offset=e.offset&&Q.createPropertyCache(e.offset,Q.parseUnits),e.offset&&e.offset.type!==Q.CACHE_TYPE.STATIC&&(e.next_offset=Q.createPropertyCache(e.offset,Q.parseUnits)),e.z=Q.createPropertyCache(e.z,Q.parseUnits),e.dash=void 0!==e.dash?e.dash:this.dash,e.dash_key=e.dash&&this.dashTextureKey(e.dash),e.dash_background_color=void 0!==e.dash_background_color?e.dash_background_color:this.dash_background_color,e.dash_background_color=e.dash_background_color&&Q.parseColor(e.dash_background_color),e.texture_merged=e.dash_key||(void 0!==e.texture?e.texture:this.texture),e.texcoords=this.texcoords||e.texture_merged?1:0,this.computeVariant(e),e.outline){e.outline.is_outline=!0,e.outline.style=e.outline.style||this.name,e.outline.color=Q.createColorPropertyCache(e.outline.color),e.outline.alpha=Q.createPropertyCache(e.outline.alpha),e.outline.width=Q.createPropertyCache(e.outline.width,Q.parseUnits),e.outline.next_width=Q.createPropertyCache(e.outline.width,Q.parseUnits),e.outline.interactive=null!=e.outline.interactive?e.outline.interactive:e.interactive,e.outline.cap=e.outline.cap||e.cap,e.outline.join=e.outline.join||e.join,e.outline.miter_limit=null!=e.outline.miter_limit?e.outline.miter_limit:e.miter_limit,e.outline.offset=e.offset,e.outline.extrude=e.extrude,e.outline.z=e.z;let t=this.styles[e.outline.style];t?(e.outline.dash=void 0!==e.outline.dash?e.outline.dash:t.dash,e.outline.texture=void 0!==e.outline.texture?e.outline.texture:t.texture,null!=e.outline.dash?(e.outline.dash_key=e.outline.dash&&this.dashTextureKey(e.outline.dash),e.outline.texture_merged=e.outline.dash_key):null===e.outline.dash||null!=e.outline.texture?(e.outline.dash_key=null,e.outline.texture_merged=e.outline.texture):(e.outline.dash=e.dash,e.outline.dash_key=e.outline.dash&&this.dashTextureKey(e.outline.dash),e.outline.texture_merged=e.outline.dash_key),e.outline.dash_background_color=void 0!==e.outline.dash_background_color?e.outline.dash_background_color:t.dash_background_color,e.outline.dash_background_color=void 0!==e.outline.dash_background_color?e.outline.dash_background_color:e.dash_background_color,e.outline.dash_background_color=e.outline.dash_background_color&&Q.parseColor(e.outline.dash_background_color),e.outline.texcoords=t.texcoords||e.outline.texture_merged?1:0,void 0===e.outline.blend_order&&null!=e.blend_order&&(e.outline.blend_order=e.blend_order),t.computeVariant(e.outline)):(g({level:"warn",once:!0},`Layer group '${e.layers.join(", ")}': line 'outline' specifies non-existent draw style '${e.outline.style}' (or maybe the style is defined but is missing a 'base' or has another error), skipping outlines for features matching this layer group`),e.outline=null)}return e},dashTextureKey:e=>"__dash_"+JSON.stringify(e),getDashTexture(e){let t=this.dashTextureKey(e);if(null==this.dash_textures[t]){this.dash_textures[t]=!0;const n=function(e,t={}){const n=t.dash_color||bt,r=t.background_color||vt,i=e,o=t.scale||1;i.length%2==1&&Array.prototype.push.apply(i,i);let s=!0,a=[];for(let e=0;e<i.length;e++){let t=Math.floor(i[e]*o);for(let e=0;e<t;e++)Array.prototype.push.apply(a,s?n:r);s=!s}return a.reverse(),a=new Uint8Array(a),{pixels:a,length:a.length/4}}(e,{scale:20});O.create(this.gl,t,{data:n.pixels,height:n.length,width:1,filtering:"nearest"})}},async endData(e){const t=await Ne.endData.call(this,e);if(t){t.uniforms.u_has_line_texture=!1,t.uniforms.u_texture=O.default,t.uniforms.u_v_scale_adjust=U.tile_scale;let n=[];for(let r in t.meshes){let i=t.meshes[r].variant;if(i.texture){let o=t.meshes[r].uniforms=t.meshes[r].uniforms||{};if(o.u_has_line_texture=!0,o.u_texture=i.texture,o.u_texture_ratio=1,i.dash&&(o.u_v_scale_adjust=20*U.tile_scale,o.u_has_dash=null!=i.dash_background_color?1:0,o.u_dash_background_color=i.dash_background_color||[0,0,0,0]),i.dash_key&&null==this.dash_textures[i.dash_key]){this.dash_textures[i.dash_key]=!0;try{await a.postMessage(this.main_thread_target+".getDashTexture",i.dash)}catch(e){g("trace",`${this.name}: line dash texture create failed because style no longer on main thread`)}}if(null==O.textures[i.texture])n.push(O.syncTexturesToWorker([i.texture]).then(e=>{let t=e[i.texture];t&&(o.u_texture_ratio=t.height/t.width)}));else{let e=O.textures[i.texture];o.u_texture_ratio=e.height/e.width}}}await Promise.all(n)}return t},computeVariant(e){let t=e.offset?1:0;t+="/"+e.texcoords,t+="/"+(e.interactive?1:0),t+="/"+(e.extrude||e.z?1:0),t+="/"+e.is_outline,e.dash_key&&(t+=e.dash_key,e.dash_background_color&&(t+=e.dash_background_color)),e.texture_merged&&(t+=e.texture_merged);const n=this.getBlendOrderForDraw(e);t+="/"+n,t=N(t),e.variant=t,null==this.variants[t]&&(this.variants[t]={key:t,blend_order:n,mesh_order:e.is_outline?0:1,selection:e.interactive?1:0,offset:e.offset?1:0,z_or_offset:e.offset||e.extrude||e.z?1:0,texcoords:e.texcoords,texture:e.texture_merged,dash:e.dash,dash_key:e.dash_key,dash_background_color:e.dash_background_color})},vertexLayoutForMeshVariant(e){if(null==this.vertex_layouts[e.key]){const t=[{name:"a_position",size:4,type:pe.SHORT,normalized:!1},{name:"a_extrude",size:2,type:pe.SHORT,normalized:!1},{name:"a_offset",size:2,type:pe.SHORT,normalized:!1,static:e.offset?null:[0,0]},{name:"a_z_and_offset_scale",size:2,type:pe.SHORT,normalized:!1,static:e.z_or_offset?null:[0,0]},{name:"a_texcoord",size:2,type:pe.UNSIGNED_SHORT,normalized:!0,static:e.texcoords?null:[0,0]},{name:"a_color",size:4,type:pe.UNSIGNED_BYTE,normalized:!0},{name:"a_selection_color",size:4,type:pe.UNSIGNED_BYTE,normalized:!0,static:e.selection?null:[0,0,0,0]}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.key]=new Le(t)}return this.vertex_layouts[e.key]},meshVariantTypeForDraw(e){return this.variants[e.variant]},makeVertexTemplate(e,t){let n=0;return this.vertex_template[n++]=0,this.vertex_template[n++]=0,this.vertex_template[n++]=1024*e.width_scale,this.vertex_template[n++]=this.scaleOrder(e.order),this.vertex_template[n++]=0,this.vertex_template[n++]=0,t.variant.offset&&(this.vertex_template[n++]=0,this.vertex_template[n++]=0),t.variant.z_or_offset&&(this.vertex_template[n++]=e.z||0,this.vertex_template[n++]=1024*e.offset_scale),t.variant.texcoords&&(this.vertex_template[n++]=0,this.vertex_template[n++]=0),this.vertex_template[n++]=255*e.color[0],this.vertex_template[n++]=255*e.color[1],this.vertex_template[n++]=255*e.color[2],this.vertex_template[n++]=255*(null!=e.alpha?e.alpha:e.color[3]),t.variant.selection&&(this.vertex_template[n++]=255*e.selection_color[0],this.vertex_template[n++]=255*e.selection_color[1],this.vertex_template[n++]=255*e.selection_color[2],this.vertex_template[n++]=255*e.selection_color[3]),this.addCustomAttributesToVertexTemplate(e,n),this.vertex_template},buildLines(e,t,n,r){if(this.feature_style=this.outline_feature_style,t.outline&&null!=t.outline.color&&null!=t.outline.width.value){var i=this.styles[t.outline.style];i&&i.addFeature(n.feature,t.outline,n)}this.feature_style=this.inline_feature_style;let o=this.getTileMesh(n.tile,this.meshVariantTypeForDraw(t)),s=o.vertex_data,a=s.vertex_layout;return function(e,t,n,r,i,o,s,a){var l,u=t.cap?nt[t.cap]:nt.butt,c=t.join?rt[t.join]:rt.miter;if(c===rt.miter){const e=t.miter_limit||3;var d=e*e}i.a_texcoord&&(l=1/(t.texcoord_width*it));var h={closed_polygon:o,remove_tile_edges:s,tile_edge_tolerance:a,miter_len_sq:d,join_type:c,cap_type:u,vertex_data:n,vertex_template:r,half_width:t.width/2,extrude_index:i.a_extrude,offset_index:i.a_offset,v_scale:l,texcoord_index:i.a_texcoord,texcoord_width:t.texcoord_width,offset:t.offset,geom_count:0};for(let t=0;t<e.length;t++)lt(e[t],h);if(h.extra_lines)for(let e=0;e<h.extra_lines.length;e++)lt(h.extra_lines[e],h);return h.geom_count}(e,t,s,this.makeVertexTemplate(t,o),a.index,r&&r.closed_polygon,!t.tile_edges&&r&&r.remove_tile_edges,U.tile_scale*n.tile.pad_scale*2)},buildPolygons(e,t,n){let r=0;for(let i=0;i<e.length;i++)r+=this.buildLines(e[i],t,n,{closed_polygon:!0,remove_tile_edges:!0});return r}});const xt=128/Math.PI,wt=16384/Math.PI,Et=[0,2,2,0],St=[1,1,3,3],Tt=new Array(4),kt=["left","top-left","bottom-left"],Ot=["right","top-right","bottom-right"],At=["top","top-left","top-right"],Ct=["bottom","bottom-left","bottom-right"],Rt={computeOffset(e,t,n,r=null){if(!n||"center"===n)return e;let i=[e[0],e[1]];return r=r||this.default_buffer,this.isLeftAnchor(n)?(i[0]-=t[0]/2,"left"===n&&(i[0]-=r[0])):this.isRightAnchor(n)&&(i[0]+=t[0]/2,"right"===n&&(i[0]+=r[1])),this.isTopAnchor(n)?(i[1]-=t[1]/2,"top"===n&&(i[1]-=r[2])):this.isBottomAnchor(n)&&(i[1]+=t[1]/2,"bottom"===n&&(i[1]+=r[3])),i},alignForAnchor(e){if(e&&"center"!==e){if(this.isLeftAnchor(e))return"right";if(this.isRightAnchor(e))return"left"}return"center"},isLeftAnchor:e=>kt.indexOf(e)>-1,isRightAnchor:e=>Ot.indexOf(e)>-1,isTopAnchor:e=>At.indexOf(e)>-1,isBottomAnchor:e=>Ct.indexOf(e)>-1,default_buffer:[2.5,2.5,1.5,.75],zero_buffer:[0,0,0,0]};function Nt(e,t){return!(e[2]<t[0]||e[0]>t[2]||e[3]<t[1]||e[1]>t[3])}const Pt=[[1,0],[0,1]],Mt=[],Dt=[];let It,zt,Ft,Lt;class jt{constructor(e,t,n,r,i){this.dimension=[r/2,i/2],this.angle=n,this.centroid=[e,t],this.quad=null,this.axis_0=null,this.axis_1=null,this.update()}toJSON(){return{x:this.centroid[0],y:this.centroid[1],a:this.angle,w:this.dimension[0],h:this.dimension[1]}}getExtent(){return 0===this.angle?[this.quad[0],this.quad[1],this.quad[4],this.quad[5]]:[Math.min(this.quad[0],this.quad[2],this.quad[4],this.quad[6]),Math.min(this.quad[1],this.quad[3],this.quad[5],this.quad[7]),Math.max(this.quad[0],this.quad[2],this.quad[4],this.quad[6]),Math.max(this.quad[1],this.quad[3],this.quad[5],this.quad[7])]}updateAxes(){this.axis_0=be.normalize([this.quad[4]-this.quad[6],this.quad[5]-this.quad[7]]),this.axis_1=be.normalize([this.quad[4]-this.quad[2],this.quad[5]-this.quad[3]])}update(){const e=this.centroid,t=this.dimension[0],n=this.dimension[1];if(0===this.angle)this.quad=[e[0]-t,e[1]-n,e[0]+t,e[1]-n,e[0]+t,e[1]+n,e[0]-t,e[1]+n],this.axis_0=Pt[0],this.axis_1=Pt[1];else{let r=Math.cos(this.angle)*t,i=Math.sin(this.angle)*t,o=-Math.sin(this.angle)*n,s=Math.cos(this.angle)*n;this.quad=[e[0]-r-o,e[1]-i-s,e[0]+r-o,e[1]+i-s,e[0]+r+o,e[1]+i+s,e[0]-r+o,e[1]-i+s],this.updateAxes()}}static projectToAxis(e,t,n){let r=e.quad;return It=r[0]*t[0]+r[1]*t[1],zt=r[2]*t[0]+r[3]*t[1],Ft=r[4]*t[0]+r[5]*t[1],Lt=r[6]*t[0]+r[7]*t[1],n[0]=Math.min(It,zt,Ft,Lt),n[1]=Math.max(It,zt,Ft,Lt),n}static axisCollide(e,t,n,r){return jt.projectToAxis(e,n,Mt),jt.projectToAxis(t,n,Dt),!(Dt[0]>Mt[1]||Dt[1]<Mt[0]||(jt.projectToAxis(e,r,Mt),jt.projectToAxis(t,r,Dt),Dt[0]>Mt[1]||Dt[1]<Mt[0]))}static intersect(e,t){return jt.axisCollide(e,t,e.axis_0,e.axis_1)&&jt.axisCollide(e,t,t.axis_0,t.axis_1)}}class $t{constructor(e,t={}){this.id=$t.nextLabelId(),this.type="",this.size=e,this.layout=t,this.position=null,this.angle=0,this.anchor=Array.isArray(this.layout.anchor)?this.layout.anchor[0]:this.layout.anchor,this.placed=null,this.offset=t.offset,this.unit_scale=this.layout.units_per_pixel,this.aabb=null,this.obb=null,this.align="center",this.throw_away=!1}toJSON(){return{id:this.id,type:this.type,obb:this.obb.toJSON(),position:this.position,angle:this.angle,size:this.size,offset:this.offset,breach:this.breach,may_repeat_across_tiles:this.may_repeat_across_tiles,layout:Bt(this.layout)}}update(){this.align=this.layout.align||Rt.alignForAnchor(this.anchor)}occluded(e,t=null){let n=!1,r=e.aabb,i=e.obb;return r.length>0&&function(e,t,n){for(let r=0;r<t.length&&(!Nt(e,t[r])||null==n(r));r++);}(this.aabb,r,e=>{if(!t||r[e]!==t.aabb)return 0===this.obb.angle&&0===i[e].angle||jt.intersect(this.obb,i[e])?(n=!0,!0):void 0}),n}inTileBounds(){return this.aabb[0]>=0&&this.aabb[1]>-U.tile_scale&&this.aabb[0]<U.tile_scale&&this.aabb[1]<=0||this.aabb[2]>=0&&this.aabb[3]>-U.tile_scale&&this.aabb[2]<U.tile_scale&&this.aabb[3]<=0}mayRepeatAcrossTiles(){if(this.layout.collide)return!0;const e=this.layout.repeat_distance;return 0!==e&&(Math.abs(this.position[0])<e||Math.abs(this.position[0]-U.tile_scale)<e||Math.abs(this.position[1])<e||Math.abs(-(this.position[1]-U.tile_scale))<e)}discard(e,t=null){return!!this.throw_away||this.occluded(e,t)}}function Bt(e){return{priority:e.priority,collide:e.collide,repeat_distance:e.repeat_distance,repeat_group:e.repeat_group,buffer:e.buffer,italic:e.italic}}$t.add=function(e,t){if(e.placed=!0,e.aabb&&(t.aabb.push(e.aabb),t.obb.push(e.obb)),e.aabbs)for(let n=0;n<e.aabbs.length;n++)t.aabb.push(e.aabbs[n]),t.obb.push(e.obbs[n])},$t.id=0,$t.id_prefix=0,$t.id_multiplier=0,$t.nextLabelId=function(){return $t.id_prefix+$t.id++*$t.id_multiplier},$t.epsilon=.9999;class Vt{constructor(e,t){this.key=e,this.repeat_dist=t,this.repeat_dist_sq=this.repeat_dist*this.repeat_dist,this.positions=[]}check(e){let t=e.position;for(let e=0;e<this.positions.length;e++){let n=this.positions[e],r=t[0]-n[0],i=t[1]-n[1];if(r*r+i*i<this.repeat_dist_sq)return!0}}add(e){e&&e.position&&this.positions.push(e.position)}static clear(e){this.groups[e]={}}static check(e,t,n){if(t.repeat_distance&&t.repeat_group&&this.groups[n][t.repeat_group])return this.groups[n][t.repeat_group].check(e)}static add(e,t,n){t.repeat_distance&&t.repeat_group&&(null==this.groups[n][t.repeat_group]&&(this.groups[n][t.repeat_group]=new Vt(t.repeat_group,t.repeat_distance*t.repeat_scale)),this.groups[n][t.repeat_group].add(e))}}Vt.groups={};class Ut{constructor(e,t){this.anchor=e,this.span=t,this.cells={}}addLabel(e){e.aabb&&this.addLabelBboxes(e,e.aabb),e.aabbs&&e.aabbs.forEach(t=>this.addLabelBboxes(e,t))}addLabelBboxes(e,t){const n=[Math.max(Math.floor((t[0]-this.anchor.x)/this.span),0),Math.max(Math.floor(-(t[1]-this.anchor.y)/this.span),0),Math.max(Math.floor((t[2]-this.anchor.x)/this.span),0),Math.max(Math.floor(-(t[3]-this.anchor.y)/this.span),0)];e.cells=[];for(let t=n[1];t<=n[3];t++){this.cells[t]=this.cells[t]||{};for(let r=n[0];r<=n[2];r++)this.cells[t][r]=this.cells[t][r]||{aabb:[],obb:[]},e.cells.push(this.cells[t][r])}}}const Wt={tiles:{},grid:null,initGrid(e){this.grid=null==e?null:new Ut(e.anchor,e.span)},startTile(e,{apply_repeat_groups:t=!0,return_hidden:n=!1}={}){let r=this.tiles[e]={bboxes:{aabb:[],obb:[]},objects:{},labels:{},styles:{},repeat:t,return_hidden:n};null==r.complete&&(r.complete=new Promise((e,t)=>{r.resolve=e,r.reject=t}))},resetTile(e){delete this.tiles[e]},abortTile(e){this.tiles[e]&&this.tiles[e].resolve&&this.tiles[e].resolve([]),this.resetTile(e)},addStyle(e,t){this.tiles[t].styles[e]=!0},collide(e,t,n){let r=this.tiles[n];if(!r)return g("trace","Collision.collide() called with null tile",n,this.tiles,t,e),Promise.resolve([]);let i=r.objects;for(let n=0;n<e.length;n++){let r=e[n],o=r.label.layout.priority;i[o]=i[o]||{},i[o][t]=i[o][t]||[],i[o][t].push(r)}return delete r.styles[t],0===Object.keys(r.styles).length&&this.endTile(n),r.complete.then(()=>(r.resolve=null,r.labels[t]||[]))},endTile(e){let t=this.tiles[e],n=t.labels;this.grid&&this.addLabelsToGrid(e),t.repeat&&Vt.clear(e);let r=Object.keys(t.objects).sort((e,t)=>e-t);for(let i=0;i<r.length;i++){let o=t.objects[r[i]];if(o)for(let r in o){let i=o[r];n[r]=n[r]||[];for(let o=0;o<i.length;o++){let s=i[o];this.canBePlaced(s,e,s.linked,t)?s.linked?this.canBePlaced(s.linked,e,s,t)?(s.show=!0,(s.label.breach||s.linked.label.breach)&&(s.label.breach=!0,s.linked.label.breach=!0),(s.label.may_repeat_across_tiles||s.linked.label.may_repeat_across_tiles)&&(s.label.may_repeat_across_tiles=!0,s.linked.label.may_repeat_across_tiles=!0),n[r].push(s),this.place(s,e,t),this.place(s.linked,e,t)):t.return_hidden&&(s.show=!1,n[r].push(s)):(s.show=!0,n[r].push(s),this.place(s,e,t)):t.return_hidden&&(s.show=!1,n[r].push(s))}}}delete this.tiles[e],t.resolve()},addLabelsToGrid(e){const t=this.tiles[e];for(const e in t.objects){const n=t.objects[e];if(n)for(const e in n)n[e].forEach(e=>this.grid.addLabel(e.label))}},canBePlaced(e,t,n=null,{repeat:r=!0}={}){let i=e.label,o=e.label.layout;if(null!=i.placed)return i.placed;let s=!o.collide;if(s||(s=this.grid&&i.cells?i.cells.reduce((e,t)=>(e&&i.discard(t,n&&n.label)&&(e=!1),e),!0):!i.discard(this.tiles[t].bboxes,n&&n.label)),s){if(!r||!Vt.check(i,o,t))return!0;i.placed=!1}else o.collide&&(i.placed=!1);return i.placed},place({label:e},t,{repeat:n=!0}){null==e.placed&&(n&&Vt.add(e,e.layout,t),this.grid&&e.cells?e.cells.forEach(t=>$t.add(e,t)):$t.add(e,this.tiles[t].bboxes))}};class qt extends $t{constructor(e,t,n,r=0){super(t,n),this.type="point",this.position=[e[0],e[1]],this.angle=r,this.parent=this.layout.parent,this.update(),this.start_anchor_index=1,this.degenerate=!(this.size[0]||this.size[1]||this.layout.buffer[0]||this.layout.buffer[1]),this.throw_away=!1}update(){super.update(),this.computeOffset(),this.updateBBoxes()}computeOffset(){if(this.offset=[this.layout.offset[0],this.layout.offset[1]],this.parent){let e=this.parent;this.offset=Rt.computeOffset(this.offset,e.size,e.anchor,Rt.zero_buffer),this.offset=Rt.computeOffset(this.offset,e.size,this.anchor,Rt.zero_buffer),e.offset!==Q.zeroPair&&(this.offset===Q.zeroPair?this.offset=e.offset:(this.offset[0]+=e.offset[0],this.offset[1]+=e.offset[1]))}this.offset=Rt.computeOffset(this.offset,this.size,this.anchor)}updateBBoxes(){let e=(this.size[0]+2*this.layout.buffer[0])*this.unit_scale*$t.epsilon,t=(this.size[1]+2*this.layout.buffer[1])*this.unit_scale*$t.epsilon;this.layout.italic&&(e+=5*this.unit_scale),this.obb=new jt(this.position[0]+this.offset[0]*this.unit_scale,this.position[1]-this.offset[1]*this.unit_scale,-this.angle,e,t),this.aabb=this.obb.getExtent(),this.inTileBounds&&(this.breach=!this.inTileBounds()),this.mayRepeatAcrossTiles&&(this.may_repeat_across_tiles=this.mayRepeatAcrossTiles())}discard(e,t=null){if(this.degenerate)return!1;if(super.discard(e,t)){if(Array.isArray(this.layout.anchor))for(let n=this.start_anchor_index;n<this.layout.anchor.length;n++)if(this.anchor=this.layout.anchor[n],this.update(),!super.discard(e,t))return!1;return!0}return!1}}qt.PLACEMENT={VERTEX:0,MIDPOINT:1,SPACED:2,CENTROID:3};const Gt=qt.PLACEMENT;function Ht(e,t,n){const r=[],i=n.placement,o=Math.max(t[0],t[1])*n.placement_min_length_ratio*n.units_per_pixel;if(i===Gt.SPACED){let i=function(e,t,n){let r=n.units_per_pixel,i=(n.placement_spacing||80)*r,o=function(e){let t=0;for(let n=0;n<e.length-1;n++)t+=Kt(e[n],e[n+1]);return t}(e);if(o<=t)return!1;let s=Math.max(Math.floor(o/i),1),a=[],l=[],u=.5*(o-(s-1)*i);for(let r=0;r<s;r++){let{position:r,angle:o}=Xt(e,u,t,n);null!=r&&null!=o&&(a.push(r),l.push(o)),u+=i}return{positions:a,angles:l}}(e,o,n);if(!i)return[];let s=i.positions,a=i.angles;for(let e=0;e<s.length;e++){let i=s[e],o=a[e];!0!==n.tile_edges&&Ve(i)||r.push(new qt(i,t,n,o))}}else if(i===Gt.VERTEX){let i,o;for(let s=0;s<e.length-1;s++)if(i=e[s],o=e[s+1],!0===n.tile_edges||!Ve(i)){const e=Yt(i,o,n.angle);r.push(new qt(i,t,n,e))}const s=Yt(i,o,n.angle);r.push(new qt(o,t,n,s))}else if(i===Gt.MIDPOINT)for(let i=0;i<e.length-1;i++){let s=e[i],a=e[i+1],l=[.5*(s[0]+a[0]),.5*(s[1]+a[1])];if((!0===n.tile_edges||!Ve(l))&&(!o||Kt(s,a)>o)){const e=Yt(s,a,n.angle);r.push(new qt(l,t,n,e))}}return r}function Yt(e,t,n=0){return"auto"===n?Math.atan2(t[0]-e[0],t[1]-e[1]):n}function Kt(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2))}function Xt(e,t,n,r){let i,o,s=0;for(let a=0;a<e.length-1;a++){let l=e[a],u=e[a+1];const c=Kt(l,u);if(!(c<=n)&&(s+=c,s>t)){i=Zt(l,u,s-t),o=Yt(l,u,r.angle);break}}return{position:i,angle:o}}function Zt(e,t,n){let r=n/Kt(e,t);return[r*e[0]+(1-r)*t[0],r*e[1]+(1-r)*t[1]]}const Jt={key:e=>[e.style,e.weight,e.family,e.px_size,e.fill,e.stroke,e.stroke_width,e.underline_width,e.background_color,e.background_width,e.background_stroke_color,e.background_stroke_width,e.transform,e.text_wrap,e.max_lines,e.supersample,y.device_pixel_ratio].join("/"),defaults:{style:"normal",weight:"normal",size:"12px",px_size:12,family:"Helvetica",fill:[1,1,1,1],text_wrap:15,max_lines:5,align:"center"},compute(e,t){const n={};e.font=e.font||this.defaults,n.supersample=e.supersample_text?1.5:1,n.can_articulate=e.can_articulate,n.fill=Q.evalCachedColorPropertyWithAlpha(e.font.fill,e.font.alpha,t),n.fill=y.toCSSColor(n.fill),e.font.stroke&&e.font.stroke.color&&(n.stroke=Q.evalCachedColorPropertyWithAlpha(e.font.stroke.color,e.font.stroke.alpha,t),n.stroke=y.toCSSColor(n.stroke),n.stroke_width=Q.evalCachedProperty(e.font.stroke.width,t)),!0!==e.font.underline||n.can_articulate||(n.underline_width=1.5*n.supersample),e.font.background&&!n.can_articulate&&(n.background_color=Q.evalCachedColorPropertyWithAlpha(e.font.background.color,e.font.background.alpha,t),n.background_color=y.toCSSColor(n.background_color),n.background_color&&(n.background_width=Q.evalCachedProperty(e.font.background.width,t)),n.background_stroke_color=e.font.background.stroke&&e.font.background.stroke.color&&Q.evalCachedColorPropertyWithAlpha(e.font.background.stroke.color,e.font.background.stroke.alpha,t),n.background_stroke_color&&(n.background_stroke_color=y.toCSSColor(n.background_stroke_color),n.background_stroke_width=null!=e.font.background.stroke.width?Q.evalCachedProperty(e.font.background.stroke.width,t):1)),n.weight=Q.evalCachedProperty(e.font.weight,t)||this.defaults.weight,"number"==typeof n.weight&&(n.weight=Math.min(Math.max(n.weight,1),1e3)),e.font.family?(n.family=e.font.family,n.family!==this.defaults.family&&(n.family+=", "+this.defaults.family)):n.family=this.defaults.family,n.style=e.font.style||this.defaults.style,n.transform=e.font.transform,n.px_size=Q.evalCachedProperty(e.font.px_size,t)*n.supersample,n.font_css=this.fontCSS(n);let r=e.text_wrap;return null!=r||n.can_articulate||(r=!0),!0===r&&(r=this.defaults.text_wrap),n.text_wrap=r,n.max_lines=e.max_lines||this.defaults.max_lines,n},fontCSS:({style:e,weight:t,px_size:n,family:r})=>[e,t,n+"px",r].filter(e=>e).join(" ")};var Qt,en,tn={exports:{}},nn=P((Qt||(Qt=1,en=tn,function(){function e(e,t){document.addEventListener?e.addEventListener("scroll",t,!1):e.attachEvent("scroll",t)}function t(e){this.a=document.createElement("div"),this.a.setAttribute("aria-hidden","true"),this.a.appendChild(document.createTextNode(e)),this.b=document.createElement("span"),this.c=document.createElement("span"),this.h=document.createElement("span"),this.f=document.createElement("span"),this.g=-1,this.b.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.c.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.f.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.h.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;",this.b.appendChild(this.h),this.c.appendChild(this.f),this.a.appendChild(this.b),this.a.appendChild(this.c)}function n(e,t){e.a.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;left:-999px;white-space:nowrap;font:"+t+";"}function r(e){var t=e.a.offsetWidth,n=t+100;return e.f.style.width=n+"px",e.c.scrollLeft=n,e.b.scrollLeft=e.b.scrollWidth+100,e.g!==t&&(e.g=t,!0)}function i(t,n){function i(){var e=o;r(e)&&e.a.parentNode&&n(e.g)}var o=t;e(t.b,i),e(t.c,i),r(t)}function o(e,t){var n=t||{};this.family=e,this.style=n.style||"normal",this.weight=n.weight||"normal",this.stretch=n.stretch||"normal"}var s=null,a=null,l=null,u=null;function c(){if(null===l){var e=document.createElement("div");try{e.style.font="condensed 100px sans-serif"}catch(e){}l=""!==e.style.font}return l}function d(e,t){return[e.style,e.weight,c()?e.stretch:"","100px",t].join(" ")}o.prototype.load=function(e,r){var o=this,l=e||"BESbswy",c=0,h=r||3e3,p=(new Date).getTime();return new Promise(function(e,r){var f;if(null===u&&(u=!!document.fonts),(f=u)&&(null===a&&(a=/OS X.*Version\/10\..*Safari/.test(navigator.userAgent)&&/Apple/.test(navigator.vendor)),f=!a),f){f=new Promise(function(e,t){!function n(){(new Date).getTime()-p>=h?t():document.fonts.load(d(o,'"'+o.family+'"'),l).then(function(t){1<=t.length?e():setTimeout(n,25)},function(){t()})}()});var m=new Promise(function(e,t){c=setTimeout(t,h)});Promise.race([m,f]).then(function(){clearTimeout(c),e(o)},function(){r(o)})}else!function(e){document.body?e():document.addEventListener?document.addEventListener("DOMContentLoaded",function t(){document.removeEventListener("DOMContentLoaded",t),e()}):document.attachEvent("onreadystatechange",function t(){"interactive"!=document.readyState&&"complete"!=document.readyState||(document.detachEvent("onreadystatechange",t),e())})}(function(){function a(){var t;(t=-1!=g&&-1!=y||-1!=g&&-1!=b||-1!=y&&-1!=b)&&((t=g!=y&&g!=b&&y!=b)||(null===s&&(t=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),s=!!t&&(536>parseInt(t[1],10)||536===parseInt(t[1],10)&&11>=parseInt(t[2],10))),t=s&&(g==v&&y==v&&b==v||g==_&&y==_&&b==_||g==x&&y==x&&b==x)),t=!t),t&&(w.parentNode&&w.parentNode.removeChild(w),clearTimeout(c),e(o))}var u=new t(l),f=new t(l),m=new t(l),g=-1,y=-1,b=-1,v=-1,_=-1,x=-1,w=document.createElement("div");w.dir="ltr",n(u,d(o,"sans-serif")),n(f,d(o,"serif")),n(m,d(o,"monospace")),w.appendChild(u.a),w.appendChild(f.a),w.appendChild(m.a),document.body.appendChild(w),v=u.a.offsetWidth,_=f.a.offsetWidth,x=m.a.offsetWidth,function e(){if((new Date).getTime()-p>=h)w.parentNode&&w.parentNode.removeChild(w),r(o);else{var t=document.hidden;!0!==t&&void 0!==t||(g=u.a.offsetWidth,y=f.a.offsetWidth,b=m.a.offsetWidth,a()),c=setTimeout(e,50)}}(),i(u,function(e){g=e,a()}),n(u,d(o,'"'+o.family+'",sans-serif')),i(f,function(e){y=e,a()}),n(f,d(o,'"'+o.family+'",serif')),i(m,function(e){b=e,a()}),n(m,d(o,'"'+o.family+'",monospace'))})})},en.exports=o}()),tn.exports));const rn={fonts_loaded:Promise.resolve(),last_loaded:null,loadFonts(e){const t=JSON.stringify(e)===this.last_loaded;if(e&&!t){const t=[];for(const n in e)Array.isArray(e[n])?e[n].forEach(e=>t.push(this.loadFontFace(n,e))):t.push(this.loadFontFace(n,e[n]));this.last_loaded=JSON.stringify(e),this.fonts_loaded=Promise.all(t.filter(e=>e))}return this.fonts_loaded},async loadFontFace(e,t){if(null==t||"object"!=typeof t&&"external"!==t)return;const n={family:e};"object"==typeof t&&(Object.assign(n,t),"string"==typeof t.url&&await this.injectFontFace(n));try{n.weight="string"==typeof n.weight?n.weight.split(" ")[0]:n.weight;const t=new nn(e,n);await t.load(),g("debug",`Font face '${e}' is available`,n)}catch(t){g("warn",`Font face '${e}' is NOT available`,n,t)}},async injectFontFace({family:e,url:t,weight:n,style:r}){void 0===this.supports_native_font_loading&&(this.supports_native_font_loading=void 0!==window.FontFace);let i=t;if("blob:"===t.slice(0,5)){i=(await y.io(t,6e4,"arraybuffer")).body;let e=new Uint8Array(i);if(this.supports_native_font_loading)i=e;else{let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);i="data:font/opentype;base64,"+btoa(t)}}if(this.supports_native_font_loading){let t;"string"==typeof i?t=new FontFace(e,`url(${encodeURI(i)})`,{weight:n,style:r}):i instanceof Uint8Array&&(t=new FontFace(e,i,{weight:n,style:r})),document.fonts.add(t),g("trace","Adding FontFace to document.fonts:",t)}else{let t=`\n @font-face {\n font-family: '${e}';\n font-weight: ${n||"normal"};\n font-style: ${r||"normal"};\n src: url(${encodeURI(i)});\n }`,o=document.createElement("style");o.appendChild(document.createTextNode("")),document.head.appendChild(o),o.sheet.insertRule(t,0),g("trace","Injecting CSS font face:",t)}}},on=new RegExp("[֑-߿יִ-﷽ﹰ-ﻼ]");function sn(e){return on.test(e)}const an="\0-/:-@[-`{-¿×÷ʹ-˿ -⯿‐-\u2029 -⯿",ln=new RegExp("["+an+"]+");function un(e){return ln.test(e)}const cn=new RegExp("^["+an+"-ۿ]+"),dn=new RegExp("["+an+"آ-إاد-زوٱ-ٷڈ-ڙۄ-ۋۏےۓۮۯ]"),hn=new RegExp("^[ؐ-ًؚ-ٰٟۖ-ۜ۟-۪ۤۧۨ-ۭ]+"),pn="[̀-֑ͯ-ׇֽֿׁׂׅׄަ-ްऀ-ःऺ-ौॎॏ॑-ॗॢॣঁ-ঃ়া-ৌৗৢৣਁ-ਃ਼-ੌੑઁ-ઃ઼ા-ૌૢૣଁ-ଃ଼ା-ୌୖୗୢୣஂா-்ௗఀ-ఃా-ౌౕౖౢౣಁ-ಃ಼ಾ-ೌೕೖೢೣഁ-ഃാ-ൌൎൗൢൣංඃ්-ෟෲෳัิ-ฺ็-๎ັິ-ຼ່-ໍ༹༘༙༵༷༾༿ཱ-ྃ྆྇ྍ-ྼ࿆ါ-း်-ှၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏႚ-ႝ឴-៑៓ᩕ-ᩞᩡ-᩼᷀-᷿⃐-]",fn=new RegExp(`^.(?:${pn}+)?([्্੍્୍్್്྄္្᩠᩿]\\W(?:${pn}+)?)*`),mn={Mongolian:"᠀-"},gn=Object.keys(mn).map(e=>mn[e]).join(""),yn=new RegExp("["+gn+"]");function bn(e,t,n){const r=t?1:2;if(e.length<r)return[e];let i=e;if(n.segment[i])return n.stats.segment_hits++,n.segment[i];let o=[];if(cn.exec(e)){o=e.split(dn);let t=-1;for(var s=0;s<o.length-1;s++){if(s>0){let e=hn.exec(o[s]);e&&(o[s]=o[s].substring(e[0].length),o[s-1]+=e[0],t+=e[0].length)}t+=1+o[s].length,o[s]+=e.slice(t,t+1)}e=""}for(;e.length;){let t="",n=e,i=0;for(;i<r&&n.length;i++){let e=(fn.exec(n)||n)[0];t+=e,n=n.substring(e.length)}o.push(t),e=e.substring(t.length)}return t&&o.reverse(),n.stats.segment_misses++,n.segment[i]=o,o}class vn{constructor(e,t=1/0,n=1/0){this.width=0,this.height=0,this.lines=[],this.max_lines=t,this.text_wrap=n,this.context=e}createLine(e){return this.lines.length<this.max_lines&&new _n(e,this.text_wrap)}push(e){if(this.lines.length<this.max_lines){let t=this.context.measureText(e.text).width;return e.width=t,t>this.width&&(this.width=Math.ceil(t)),this.lines.push(e),this.height+=e.height,!0}return this.addEllipsis(),!1}advance(e,t){return!!this.push(e)&&this.createLine(t)}addEllipsis(){let e=this.lines[this.lines.length-1],t=Math.ceil(this.context.measureText(vn.ellipsis).width);e.append(vn.ellipsis),e.width+=t,e.width>this.width&&(this.width=e.width)}finish(e){e?this.push(e):this.addEllipsis()}static parse(e,t,n,r,i){let o;o="number"==typeof t?e.split(" "):[e];let s=new vn(i,n,t),a=s.createLine(r);for(let e=0;e<o.length;e++){let n=o[e].split("\n"),i=0===e;for(let o=0;o<n.length&&a;o++){let l=n[o];sn(l)&&un(l[l.length-1])&&(l+="");let u=i?l:" "+l;if(t&&e>0&&a.exceedsTextwrap(u)){if(a=s.advance(a,r),!a)break;a.append(l),i=!0}else a.append(u);o<n.length-1&&(a=s.advance(a,r),i=!0)}e===o.length-1&&s.finish(a)}return s}}vn.ellipsis="...";class _n{constructor(e=0,t=0){this.chars=0,this.text="",this.height=Math.ceil(e),this.text_wrap=t}append(e){this.chars+=e.length,this.text+=e}exceedsTextwrap(e){return e.length+this.chars>this.text_wrap}}function xn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function wn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?xn(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}class En{constructor(){this.createCanvas(),this.vertical_text_buffer=8,this.horizontal_text_buffer=4,this.background_size=4}createCanvas(){this.canvas=document.createElement("canvas"),this.canvas.style.backgroundColor="transparent",this.context=this.canvas.getContext("2d")}resize(e,t){this.canvas.width=e,this.canvas.height=t,this.context.clearRect(0,0,e,t)}setFont({font_css:e,fill:t,stroke:n,stroke_width:r,px_size:i,supersample:o}){this.px_size=i;let s=this.context,a=y.device_pixel_ratio*o;n&&r>0&&(s.strokeStyle=n,s.lineWidth=r*a),s.fillStyle=t,s.font=e,s.miterLimit=2}async textSizes(e,t){return await rn.loadFonts(),S.add({type:"textSizes",run:this.processTextSizesTask.bind(this),texts:t,tile_id:e,cursor:{styles:Object.keys(t),texts:null,style_idx:null,text_idx:null}})}processTextSizesTask(e){let{cursor:t,texts:n}=e;for(t.style_idx=t.style_idx||0;t.style_idx<t.styles.length;){let i=t.styles[t.style_idx];null==t.text_idx&&(t.text_idx=0,t.texts=Object.keys(n[i]));let o=n[i],s=!0;for(;t.text_idx<t.texts.length;){let n=t.texts[t.text_idx],a=o[n],l=a.text_settings;if(s&&(this.setFont(l),s=!1),a.size=this.textSize(i,n,l).size,l.can_articulate){let e=!1,t=!1;if(sn(n)&&(un(n)?e=!0:t=!0),a.isRTL=e,a.no_curving=t||(r=n,yn.test(r)),a.vertical_buffer=this.vertical_text_buffer,a.segment_sizes=[],!a.no_curving){let t=bn(n,e,En.cache);a.segments=t;for(let e=0;e<t.length;e++)a.segment_sizes.push(this.textSize(i,t[e],l).size)}}if(t.text_idx++,!S.shouldContinue(e))return!1}t.text_idx=null,t.style_idx++}var r;return S.finish(e,n),!0}textSize(e,t,{transform:n,text_wrap:r,max_lines:i,stroke_width:o=0,background_color:s,background_stroke_width:a=0,background_width:l,underline_width:u=0,supersample:c}){if(En.cache.text[e]=En.cache.text[e]||{},En.cache.text[e][t])return En.cache.stats.text_hits++,En.cache.text[e][t];En.cache.stats.text_misses++,En.cache.text_count++;const d=y.device_pixel_ratio*c,h=this.applyTextTransform(t,n),p=this.context,f=this.vertical_text_buffer*d,m=(o+this.horizontal_text_buffer)*d;l=null!=l?l:this.background_size;const g=s||a?(l+a)*d:0,b=(2+u+(u?o+1:0))*d,v=this.px_size+b;let{width:_,height:x,lines:w}=vn.parse(h,r,i,v,p);_+=2*g,x+=2*g;let E=[_/d,x/d],S=[_+2*m,x+2*f],T=[S[0]/d,S[1]/d];return En.cache.text[e][t]={lines:w,size:{collision_size:E,texture_size:S,logical_size:T,horizontal_buffer:m,vertical_buffer:f,dpr:d,line_height:v,background_size:g}},En.cache.text[e][t]}drawTextMultiLine(e,[t,n],r,i,o){const{dpr:s,collision_size:a,texture_size:l,line_height:u,horizontal_buffer:c,vertical_buffer:d}=r;if(i.background_color||i.background_stroke_color){const e=i.background_stroke_color,r=(i.background_stroke_width||0)*s;this.context.save(),i.background_color&&(this.context.fillStyle=i.background_color,this.context.fillRect(t+c+("curved"===o?l[0]:0)+r,n+d+r,s*a[0]-2*r,s*a[1]-2*r)),e&&r&&(this.context.strokeStyle=e,this.context.lineWidth=r,this.context.strokeRect(t+c+("curved"===o?l[0]:0)+.5*r,n+d+.5*r,s*a[0]-r,s*a[1]-r)),this.context.restore()}const h=i.underline_width||0,p=i.stroke_width||0;let f=n-(h?.5*(h+p+1)*s:0);for(let n=0;n<e.length;n++){let s=e[n];this.drawTextLine(s,[t,f],r,i,o),f+=u}this.drawTextDebug([t,n],r,o)}drawTextLine(e,[t,n],r,i,o){const{stroke:s,stroke_width:a,transform:l,align:u="center"}=i,{horizontal_buffer:c,vertical_buffer:d,texture_size:h,background_size:p,line_height:f,dpr:m}=r,g=(i.underline_width||0)*m,y=this.applyTextTransform(e.text,l);let b;"left"===u?b=t+c+p:"center"===u?b=t+h[0]/2-e.width/2:"right"===u&&(b=t+h[0]-e.width-c-p);const v=n+.75*d+f+p-.5*g,_=s&&a>0&&"curved"===o?h[0]:0;if(g){this.context.save(),this.context.strokeStyle=this.context.fillStyle,this.context.lineWidth=g;const t=v+(.5*a+2)*m+.5*this.context.lineWidth;this.context.beginPath(),this.context.moveTo(b+_,t),this.context.lineTo(b+_+e.width,t),this.context.stroke(),this.context.restore()}s&&a>0&&this.context.strokeText(y,b+_,v),this.context.fillText(y,b,v)}drawTextDebug([e,t],n,r){const{dpr:i,horizontal_buffer:o,vertical_buffer:s,texture_size:a,collision_size:l}=n;v.draw_label_collision_boxes&&(this.context.save(),this.context.strokeStyle="blue",this.context.lineWidth=2,this.context.strokeRect(e+o,t+s,i*l[0],i*l[1]),"curved"===r&&this.context.strokeRect(e+a[0]+o,t+s,i*l[0],i*l[1]),this.context.restore()),v.draw_label_texture_boxes&&(this.context.save(),this.context.strokeStyle="green",this.context.lineWidth=2,this.context.strokeRect(e+2,t+2,a[0]-4,a[1]-4),"curved"===r&&this.context.strokeRect(e+2+a[0],t+2,a[0]-4,a[1]-4),this.context.restore())}rasterize(e,t,n,r,i){return S.add({type:"rasterizeLabels",run:this.processRasterizeTask.bind(this),cancel:this.cancelRasterizeTask.bind(this),pause_factor:2,user_moving_view:!1,texts:e,textures:t,texture_prefix:r,gl:i,tile_id:n,cursor:{styles:Object.keys(e),texts:null,style_idx:0,text_idx:null,texture_idx:0,texture_resize:!0,texture_names:[]}})}processRasterizeTask(e){let t,{cursor:n,texts:r,textures:i}=e;for(;n.texture_idx<e.textures.length;){for(t=i[n.texture_idx],n.texture_resize&&(n.texture_resize=!1,this.resize(...t.texture_size));n.style_idx<n.styles.length;){let i=n.styles[n.style_idx];null==n.text_idx&&(n.text_idx=0,n.texts=Object.keys(r[i]));let o=r[i],s=!0;for(;n.text_idx<n.texts.length;){let r=n.texts[n.text_idx],a=o[r],l=a.text_settings;if(s&&(this.setFont(l),s=!1),l.can_articulate){a.texcoords=a.texcoords||{};for(let e=0;e<a.type.length;e++){let o=a.type[e];if("straight"===o){if(a.textures[e]!==n.texture_idx)continue;let s,u=a.isRTL?r.split().reverse().join():r,c=t.texcoord_cache[i][u];if(c.texcoord)s=c.texcoord;else{let e=c.texture_position,{size:n,lines:r}=this.textSize(i,u,l);this.drawTextMultiLine(r,e,n,l,o),s=O.getTexcoordsForSprite(e,n.texture_size,t.texture_size),c.texcoord=s}a.texcoords[o]={texcoord:s,texture_id:c.texture_id}}else if("curved"===o){let r=a.segments;a.texcoords.curved=a.texcoords.curved||[],a.texcoords_stroke=a.texcoords_stroke||[];for(let s=0;s<r.length;s++){if(a.textures[e][s]!==n.texture_idx)continue;let u,c,d=r[s],h=t.texcoord_cache[i][d];if(h.texcoord)u=h.texcoord,c=h.texcoord_stroke,a.texcoords_stroke.push(c);else{let e=h.texture_position,{size:n,lines:r}=this.textSize(i,d,l);this.drawTextMultiLine(r,e,n,l,o),u=O.getTexcoordsForSprite(e,n.texture_size,t.texture_size);let s=[e[0]+n.texture_size[0],e[1]];c=O.getTexcoordsForSprite(s,n.texture_size,t.texture_size),h.texcoord=u,h.texcoord_stroke=c,a.texcoords_stroke.push(c)}a.texcoords.curved.push({texcoord:u,texture_id:h.texture_id})}}}}else{let e=this.textSize(i,r,l).lines;const o=wn({},l);for(let r in a.align)a.align[r].texture_id===n.texture_idx&&(o.align=r,this.drawTextMultiLine(e,a.align[r].texture_position,a.size,o),a.align[r].texcoords=O.getTexcoordsForSprite(a.align[r].texture_position,a.size.texture_size,t.texture_size))}if(n.text_idx++,!S.shouldContinue(e))return!1}n.text_idx=null,n.style_idx++}let o=e.texture_prefix+n.texture_idx;O.create(e.gl,o,{element:this.canvas,filtering:"linear",UNPACK_PREMULTIPLY_ALPHA_WEBGL:!0}),O.retain(o),n.texture_names.push(o),n.texture_idx++,n.texture_resize=!0,n.style_idx=0}return S.finish(e,n.texture_names),!0}cancelRasterizeTask(e){g("trace",`RasterizeTask: release textures [${e.cursor.texture_names.join(", ")}]`),e.cursor.texture_names.forEach(e=>O.release(e))}setTextureTextPositions(e,t){let n={cx:0,cy:0,width:0,height:0,column_width:0,texture_id:0,texcoord_cache:{}},r=[];for(let i in e){let o=e[i];for(let e in o){let s,a=o[e];if(a.text_settings.can_articulate){a.textures=[],n.texcoord_cache[i]=n.texcoord_cache[i]||{};for(let o=0;o<a.type.length;o++){let l=a.type[o];if("straight"===l){let l=a.isRTL?e.split().reverse().join():e;if(!n.texcoord_cache[i][l]){let e=a.size.texture_size;s=this.placeText(e[0],e[1],i,n,r,t),n.texcoord_cache[i][l]={texture_id:n.texture_id,texture_position:s}}a.textures[o]=n.texture_id}else if("curved"===l){a.textures[o]=[];for(let e=0;e<a.segment_sizes.length;e++){let l=a.segments[e];if(!n.texcoord_cache[i][l]){let o=a.segment_sizes[e].texture_size,u=2*o[0];s=this.placeText(u,o[1],i,n,r,t),n.texcoord_cache[i][l]={texture_id:n.texture_id,texture_position:s}}a.textures[o].push(n.texture_id)}}}}else{let e=a.size.texture_size;for(let o in a.align)s=this.placeText(e[0],e[1],i,n,r,t),a.align[o].texture_id=n.texture_id,a.align[o].texture_position=s}}}return n.column_width>0&&n.height>0&&(r[n.texture_id]={texture_size:[n.width,n.height],texcoord_cache:n.texcoord_cache}),r}placeText(e,t,n,r,i,o){let s;return r.cy+t>o?(r.cx+=r.column_width,r.cy=0,r.column_width=e):r.column_width=Math.max(r.column_width,e),r.cx+r.column_width<=o?(s=[r.cx,r.cy],r.cy+=t,r.height=Math.max(r.height,r.cy),r.width=Math.max(r.width,r.cx+r.column_width)):(i[r.texture_id]={texture_size:[r.width,r.height],texcoord_cache:r.texcoord_cache},r.texcoord_cache={},r.texcoord_cache[n]={},r.texture_id++,r.cx=0,r.cy=t,r.column_width=e,r.width=e,r.height=t,s=[0,0]),s}applyTextTransform(e,t){return"capitalize"===t?e.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1)}):"uppercase"===t?e.toUpperCase():"lowercase"===t?e.toLowerCase():e}static fontPixelSize(e){if(null==e)return;e="string"==typeof e?e:String(e);let[,t,n]=e.match(En.font_size_re)||[];return n=n||"px","em"===n?t*=16:"pt"===n?t/=.75:"%"===n&&(t/=6.25),t=Q.parsePositiveNumber(t),t*=y.device_pixel_ratio,t}static pruneTextCache(){En.cache.text_count>En.cache.text_count_max&&(En.cache.text={},En.cache.text_count=0,g("debug","TextCanvas: pruning text cache")),Object.keys(En.cache.segment).length>En.cache.segment_count_max&&(En.cache.segment={},g("debug","TextCanvas: pruning segment cache"))}}function Sn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}En.font_size_re=/((?:[0-9]*\.)?[0-9]+)\s*(px|pt|em|%)?/,En.cache={text:{},text_count:0,text_count_max:2e3,segment:{},segment_count_max:2e3,stats:{text_hits:0,text_misses:0,segment_hits:0,segment_misses:0}};let Tn=0;const kn={resetText(){t.is_main?this.canvas=new En:t.is_worker&&(this.texts={})},freeText(e){delete this.texts[e.id]},parseTextFeature(e,t,n,r){let i=this.parseTextSource(e,t,n);if(null==i||""===i)return;let o=Jt.compute(t,n),s=Jt.key(o);this.texts[r.id]=this.texts[r.id]||{};let a=this.texts[r.id][s]=this.texts[r.id][s]||{};if(i instanceof Object){let l=[],u=i.left+"-"+i.right;for(let c in i){let d=i[c];if(!d)continue;let h=this.computeTextLayout({},e,t,n,r,d,o,u,c);a[d]||(a[d]={text_settings:o,ref:0}),l.push({draw:t,text:d,text_settings_key:s,layout:h})}return l.length>0&&l}{let l=this.computeTextLayout({},e,t,n,r,i,o);return a[i]||(a[i]={text_settings:o,ref:0}),{draw:t,text:i,text_settings_key:s,layout:l}}},parseTextSource(e,t,n){let r,i=t.text_source||"name";if(null==i||Array.isArray(i)||"object"!=typeof i)r=this.parseTextSourceValue(i,e,n);else{r={};for(let t in i)r[t]=this.parseTextSourceValue(i[t],e,n)}return r},parseTextSourceValue(e,t,n){let r;if(Array.isArray(e)){for(let i=0;i<e.length;i++)if("string"==typeof e[i]?r=t.properties[e[i]]:"function"==typeof e[i]&&(r=e[i](n)),r)return r}else"string"==typeof e?r=t.properties[e]:e instanceof Function&&(r=e(n));return r},async prepareTextLabels(e,t){if(0===Object.keys(this.texts[e.id]||{}).length)return[];try{const n=await a.postMessage(this.main_thread_target+".calcTextSizes",e.id,this.texts[e.id]);return e.canceled?(g("trace",`Style ${this.name}: stop tile build because tile was canceled: ${e.key}, post-calcTextSizes()`),[]):(this.texts[e.id]=n||[],n?this.buildTextLabels(e,t):(Wt.abortTile(e.id),[]))}catch(t){return Wt.abortTile(e.id),[]}},async collideAndRenderTextLabels(e,t,n){let r=await this.prepareTextLabels(e,n);if(0===r.length)return Wt.collide([],t,e.id),{};if(r=await Wt.collide(r,t,e.id),e.canceled)return g("trace",`stop tile build because tile was canceled: ${e.key}, post-collide()`),{};let o=this.texts[e.id];if(null==o||0===r.length)return{};this.cullTextStyles(o,r),r.forEach(e=>{let t=e.text_settings_key,n=o[t]&&o[t][e.text];n.text_settings.can_articulate?(n.type||(n.type=[]),-1===n.type.indexOf(e.label.type)&&n.type.push(e.label.type)):(n.align=n.align||{},n.align[e.label.align]={})});try{const t=await a.postMessage(this.main_thread_target+".rasterizeTexts",e.id,e.key,o);return e.canceled?(g("trace",`stop tile build because tile was canceled: ${e.key}, post-rasterizeTexts()`),{}):function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Sn(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Sn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({labels:r},t)}catch(e){return{}}},cullTextStyles(e,t){for(let n=0;n<t.length;n++){let r=t[n];e[r.text_settings_key][r.text].ref++}for(let t in e)for(let n in e[t])e[t][n].ref<1&&delete e[t][n];for(let t in e)0===Object.keys(e[t]).length&&delete e[t]},calcTextSizes(e,t){return this.canvas.textSizes(e,t)},async rasterizeTexts(e,t,n){let r=new En,i=Math.min(this.max_texture_size,2048),o=r.setTextureTextPositions(n,i),s=["labels",this.name,t,e,Tn,""].join("-");return Tn++,o=await r.rasterize(n,o,e,s,this.gl),o?{texts:n,textures:o}:{}},preprocessText(e){if(e&&e.font&&"object"==typeof e.font)return e.font.weight=Q.createPropertyCache(e.font.weight),e.font.fill=Q.createPropertyCache(e.font.fill||Jt.defaults.fill),e.font.alpha=Q.createPropertyCache(e.font.alpha),e.font.stroke&&(e.font.stroke.color=Q.createPropertyCache(e.font.stroke.color),e.font.stroke.alpha=Q.createPropertyCache(e.font.stroke.alpha)),e.font.background&&(e.font.background.color=Q.createPropertyCache(e.font.background.color),e.font.background.alpha=Q.createPropertyCache(e.font.background.alpha),e.font.background.width=Q.createPropertyCache(e.font.background.width,Q.parsePositiveNumber),e.font.background.stroke&&(e.font.background.stroke.color=Q.createPropertyCache(e.font.background.stroke.color),e.font.background.stroke.alpha=Q.createPropertyCache(e.font.background.stroke.alpha))),e.font.px_size=Q.createPropertyCache(e.font.size||Jt.defaults.size,En.fontPixelSize,En.fontPixelSize),e.font.stroke&&null!=e.font.stroke.width&&(e.font.stroke.width=Q.createPropertyCache(e.font.stroke.width,Q.parsePositiveNumber)),e.font.background&&e.font.background.stroke&&null!=e.font.background.stroke.width&&(e.font.background.stroke.width=Q.createPropertyCache(e.font.background.stroke.width,Q.parsePositiveNumber)),e.offset=Q.createPropertyCache(e.offset,e=>Array.isArray(e)&&e.map(Q.parseNumber)),e.buffer=Q.createPropertyCache(e.buffer,e=>(Array.isArray(e)?e:[e,e]).map(Q.parsePositiveNumber)),e.repeat_distance=Q.createPropertyCache(e.repeat_distance,Q.parsePositiveNumber),e},computeTextLayout(e,t,n,r,i,o,s,a,l){let u=e||{};return u=this.computeLayout(u,t,n,r,i),null==n.repeat_distance&&(u.repeat_distance="point"===r.geometry?0:U.tile_size,u.repeat_distance&&(u.repeat_distance*=u.units_per_pixel,u.repeat_scale=1,"function"==typeof n.repeat_group?u.repeat_group=n.repeat_group(r):u.repeat_group=n.repeat_group)),u.repeat_distance&&(a&&(u.repeat_group+="/"+a),u.repeat_group+="/"+o),u.subdiv=i.overzoom2,u.align=n.align,u.italic="normal"!==s.style,"right"===l?u.orientation=1:"left"===l&&(u.orientation=-1),u}};var On,An,Cn,Rn,Nn,Pn,Mn,Dn,In,zn,Fn,Ln,jn,$n,Bn,Vn,Un=P(An?On:(An=1,On=function(e,t){var n=t[0],r=t[1],i=t[2],o=t[3],s=t[4],a=t[5],l=t[6],u=t[7],c=t[8],d=t[9],h=t[10],p=t[11],f=t[12],m=t[13],g=t[14],y=t[15],b=n*a-r*s,v=n*l-i*s,_=n*u-o*s,x=r*l-i*a,w=r*u-o*a,E=i*u-o*l,S=c*m-d*f,T=c*g-h*f,k=c*y-p*f,O=d*g-h*m,A=d*y-p*m,C=h*y-p*g,R=b*C-v*A+_*O+x*k-w*T+E*S;return R?(R=1/R,e[0]=(a*C-l*A+u*O)*R,e[1]=(l*k-s*C-u*T)*R,e[2]=(s*A-a*k+u*S)*R,e[3]=(i*A-r*C-o*O)*R,e[4]=(n*C-i*k+o*T)*R,e[5]=(r*k-n*A-o*S)*R,e[6]=(m*E-g*w+y*x)*R,e[7]=(g*_-f*E-y*v)*R,e[8]=(f*w-m*_+y*b)*R,e):null})),Wn=P(Rn?Cn:(Rn=1,Cn=function(e,t){var n=t[0],r=t[1],i=t[2],o=t[3],s=t[4],a=t[5],l=t[6],u=t[7],c=t[8],d=c*s-a*u,h=-c*o+a*l,p=u*o-s*l,f=n*d+r*h+i*p;return f?(f=1/f,e[0]=d*f,e[1]=(-c*r+i*u)*f,e[2]=(a*r-i*s)*f,e[3]=h*f,e[4]=(c*n-i*l)*f,e[5]=(-a*n+i*o)*f,e[6]=p*f,e[7]=(-u*n+r*l)*f,e[8]=(s*n-r*o)*f,e):null})),qn=P(Pn?Nn:(Pn=1,Nn=function(e,t,n){var r=t[0],i=t[1],o=t[2],s=t[3],a=t[4],l=t[5],u=t[6],c=t[7],d=t[8],h=t[9],p=t[10],f=t[11],m=t[12],g=t[13],y=t[14],b=t[15],v=n[0],_=n[1],x=n[2],w=n[3];return e[0]=v*r+_*a+x*d+w*m,e[1]=v*i+_*l+x*h+w*g,e[2]=v*o+_*u+x*p+w*y,e[3]=v*s+_*c+x*f+w*b,v=n[4],_=n[5],x=n[6],w=n[7],e[4]=v*r+_*a+x*d+w*m,e[5]=v*i+_*l+x*h+w*g,e[6]=v*o+_*u+x*p+w*y,e[7]=v*s+_*c+x*f+w*b,v=n[8],_=n[9],x=n[10],w=n[11],e[8]=v*r+_*a+x*d+w*m,e[9]=v*i+_*l+x*h+w*g,e[10]=v*o+_*u+x*p+w*y,e[11]=v*s+_*c+x*f+w*b,v=n[12],_=n[13],x=n[14],w=n[15],e[12]=v*r+_*a+x*d+w*m,e[13]=v*i+_*l+x*h+w*g,e[14]=v*o+_*u+x*p+w*y,e[15]=v*s+_*c+x*f+w*b,e})),Gn=P(Dn?Mn:(Dn=1,Mn=function(e,t,n){var r,i,o,s,a,l,u,c,d,h,p,f,m=n[0],g=n[1],y=n[2];return t===e?(e[12]=t[0]*m+t[4]*g+t[8]*y+t[12],e[13]=t[1]*m+t[5]*g+t[9]*y+t[13],e[14]=t[2]*m+t[6]*g+t[10]*y+t[14],e[15]=t[3]*m+t[7]*g+t[11]*y+t[15]):(r=t[0],i=t[1],o=t[2],s=t[3],a=t[4],l=t[5],u=t[6],c=t[7],d=t[8],h=t[9],p=t[10],f=t[11],e[0]=r,e[1]=i,e[2]=o,e[3]=s,e[4]=a,e[5]=l,e[6]=u,e[7]=c,e[8]=d,e[9]=h,e[10]=p,e[11]=f,e[12]=r*m+a*g+d*y+t[12],e[13]=i*m+l*g+h*y+t[13],e[14]=o*m+u*g+p*y+t[14],e[15]=s*m+c*g+f*y+t[15]),e})),Hn=P(zn?In:(zn=1,In=function(e,t,n){var r=n[0],i=n[1],o=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e})),Yn=P(Ln?Fn:(Ln=1,Fn=function(e,t,n,r,i){var o=1/Math.tan(t/2),s=1/(r-i);return e[0]=o/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=(i+r)*s,e[11]=-1,e[12]=0,e[13]=0,e[14]=2*i*r*s,e[15]=0,e}));function Kn(){return $n?jn:($n=1,jn=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e})}var Xn,Zn,Jn=function(){if(Vn)return Bn;Vn=1;var e=Kn();return Bn=function(t,n,r,i){var o,s,a,l,u,c,d,h,p,f,m=n[0],g=n[1],y=n[2],b=i[0],v=i[1],_=i[2],x=r[0],w=r[1],E=r[2];return Math.abs(m-x)<1e-6&&Math.abs(g-w)<1e-6&&Math.abs(y-E)<1e-6?e(t):(d=m-x,h=g-w,p=y-E,o=v*(p*=f=1/Math.sqrt(d*d+h*h+p*p))-_*(h*=f),s=_*(d*=f)-b*p,a=b*h-v*d,(f=Math.sqrt(o*o+s*s+a*a))?(o*=f=1/f,s*=f,a*=f):(o=0,s=0,a=0),l=h*a-p*s,u=p*o-d*a,c=d*s-h*o,(f=Math.sqrt(l*l+u*u+c*c))?(l*=f=1/f,u*=f,c*=f):(l=0,u=0,c=0),t[0]=o,t[1]=l,t[2]=d,t[3]=0,t[4]=s,t[5]=u,t[6]=h,t[7]=0,t[8]=a,t[9]=c,t[10]=p,t[11]=0,t[12]=-(o*m+s*g+a*y),t[13]=-(l*m+u*g+c*y),t[14]=-(d*m+h*g+p*y),t[15]=1,t)}}(),Qn=P(Jn),er=P(Kn()),tr=P(Zn?Xn:(Zn=1,Xn=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}));const nr={fromValues(e,t,n){var r=new Float64Array(3);return r[0]=e,r[1]=t,r[2]=n,r}},rr={normalFromMat4:Un,invert:Wn},ir={multiply:qn,translate:Gn,scale:Hn,perspective:Yn,lookAt:Qn,identity:er,copy:tr};class or{constructor(e,t,n={}){this.view=t,this.position=n.position,this.zoom=n.zoom}static create(e,t,n){switch(n.type){case"isometric":return new ar(e,t,n);case"flat":return new lr(e,t,n);default:return new sr(e,t,n)}}update(){}setupProgram(){}updateView(){if(this.position||this.zoom){var e={};this.position&&(e={lng:this.position[0],lat:this.position[1],zoom:this.position[2]}),this.zoom&&(e.zoom=this.zoom),this.view.setView(e)}}setupMatrices(e,t){ir.multiply(e.model_view32,this.view_matrix,e.model),t.uniform("Matrix4fv","u_modelView",e.model_view32),rr.normalFromMat4(e.normal32,e.model_view32),rr.invert(e.inverse_normal32,e.normal32),t.uniform("Matrix3fv","u_normalMatrix",e.normal32),t.uniform("Matrix3fv","u_inverseNormalMatrix",e.inverse_normal32)}}class sr extends or{constructor(e,t,n={}){super(e,t,n),this.type="perspective",this.focal_length=n.focal_length,this.fov=n.fov,this.focal_length||this.fov||(this.focal_length=[[16,2],[17,2.5],[18,3],[19,4],[20,6]]),this.vanishing_point=n.vanishing_point||[0,0],this.vanishing_point=this.vanishing_point.map(parseFloat),this.vanishing_point_skew=[],this.position_meters=null,this.view_matrix=new Float64Array(16),this.projection_matrix=new Float32Array(16),j.replaceBlock("camera","\n uniform mat4 u_projection;\n uniform vec3 u_eye;\n uniform vec2 u_vanishing_point;\n\n void cameraProjection (inout vec4 position) {\n position = u_projection * position;\n }")}constrainCamera({view_height:e,height:t,focal_length:n,fov:r}){return t?(n=2*t/e,r=2*Math.atan(1/n)):(n?r=2*Math.atan(1/n):r&&(r=r*Math.PI/180,n=1/Math.tan(r/2)),t=e/2*n),{view_height:e,height:t,focal_length:n,fov:r}}updateMatrices(){var e=this.view.size.css.height*this.view.meters_per_pixel,{height:t,fov:n}=this.constrainCamera({view_height:e,focal_length:y.interpolate(this.view.zoom,this.focal_length),fov:y.interpolate(this.view.zoom,this.fov)}),r=[this.view.center.meters.x,this.view.center.meters.y,t];this.position_meters=r,ir.lookAt(this.view_matrix,nr.fromValues(r[0],r[1],0),nr.fromValues(r[0],r[1],-1),nr.fromValues(0,1,0)),ir.perspective(this.projection_matrix,n,this.view.aspect,1,2*t),this.vanishing_point_skew[0]=this.vanishing_point[0]/this.view.size.css.width,this.vanishing_point_skew[1]=this.vanishing_point[1]/this.view.size.css.height,this.projection_matrix[8]=2*-this.vanishing_point_skew[0],this.projection_matrix[9]=2*-this.vanishing_point_skew[1],ir.translate(this.projection_matrix,this.projection_matrix,nr.fromValues(e/2*this.view.aspect*(2*-this.vanishing_point_skew[0]),e/2*(2*-this.vanishing_point_skew[1]),0)),ir.translate(this.projection_matrix,this.projection_matrix,nr.fromValues(0,0,-t))}update(){super.update(),this.updateMatrices()}setupProgram(e){e.uniform("Matrix4fv","u_projection",this.projection_matrix),e.uniform("3f","u_eye",[0,0,this.position_meters[2]]),e.uniform("2fv","u_vanishing_point",this.vanishing_point_skew)}}class ar extends or{constructor(e,t,n={}){super(e,t,n),this.type="isometric",this.axis=n.axis||{x:0,y:1},2===this.axis.length&&(this.axis={x:this.axis[0],y:this.axis[1]}),this.position_meters=null,this.viewport_height=null,this.view_matrix=new Float64Array(16),this.projection_matrix=new Float32Array(16),j.replaceBlock("camera","\n uniform mat4 u_projection;\n uniform vec3 u_eye;\n uniform vec2 u_vanishing_point;\n\n void cameraProjection (inout vec4 position) {\n position = u_projection * position;\n // position.xy += position.z * u_isometric_axis;\n\n // Reverse z for depth buffer so up is negative,\n // and scale down values so objects higher than one screen height will not get clipped\n // pull forward slightly to avoid going past far clipping plane\n position.z = -position.z / 100. + 1. - 0.001;\n }")}update(){super.update(),this.viewport_height=this.view.size.css.height*this.view.meters_per_pixel;var e=[this.view.center.meters.x,this.view.center.meters.y,this.viewport_height];this.position_meters=e,ir.identity(this.view_matrix),ir.translate(this.view_matrix,this.view_matrix,nr.fromValues(-e[0],-e[1],0)),ir.identity(this.projection_matrix),this.projection_matrix[8]=this.axis.x/this.view.aspect,this.projection_matrix[9]=this.axis.y,ir.scale(this.projection_matrix,this.projection_matrix,nr.fromValues(2/this.view.size.meters.x,2/this.view.size.meters.y,2/this.view.size.meters.y))}setupProgram(e){e.uniform("Matrix4fv","u_projection",this.projection_matrix),e.uniform("3fv","u_eye",[0,0,this.viewport_height]),e.uniform("2fv","u_vanishing_point",[0,0])}}class lr extends ar{constructor(e,t,n={}){super(e,t,n),this.type="flat"}update(){this.axis.x=0,this.axis.y=0,super.update()}}const ur=qt.PLACEMENT,cr=Object.create(Ne),dr="__shader_point";Object.assign(cr,kn),Object.assign(cr,{name:"points",built_in:!0,vertex_shader_src:"uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_tile_proxy_order_offset;\nuniform bool u_tile_fade_in;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\nuniform float u_visible_time;\nuniform bool u_view_panning;\nuniform float u_view_pan_snap_timer;\n\nuniform mat4 u_model;\nuniform mat4 u_modelView;\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nattribute vec4 a_position;\nattribute vec4 a_shape;\nattribute vec4 a_color;\nattribute vec2 a_texcoord;\nattribute vec2 a_offset;\n\nuniform float u_point_type;\n\n#ifdef TANGRAM_CURVED_LABEL\n attribute vec4 a_offsets;\n attribute vec4 a_pre_angles;\n attribute vec4 a_angles;\n#endif\n\nvarying vec4 v_color;\nvarying vec2 v_texcoord;\nvarying vec4 v_world_position;\nvarying float v_alpha_factor;\n\n#ifdef TANGRAM_HAS_SHADER_POINTS\n attribute float a_outline_edge;\n attribute vec4 a_outline_color;\n\n varying float v_outline_edge;\n varying vec4 v_outline_color;\n varying float v_aa_offset;\n#endif\n\n#ifdef TANGRAM_SHOW_HIDDEN_LABELS\n varying float v_label_hidden;\n#endif\n\n#define TANGRAM_PI 3.14159265359\n#define TANGRAM_NORMAL vec3(0., 0., 1.)\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\nvec2 rotate2D(vec2 _st, float _angle) {\n return mat2(cos(_angle),-sin(_angle),\n sin(_angle),cos(_angle)) * _st;\n}\n\n#ifdef TANGRAM_CURVED_LABEL\n // Assumes stops are [0, 0.33, 0.66, 0.99];\n float mix4linear(vec4 v, float x) {\n x = clamp(x, 0., 1.);\n return mix(mix(v[0], v[1], 3. * x),\n mix(v[1],\n mix(v[2], v[3], 3. * (max(x, .66) - .66)),\n 3. * (clamp(x, .33, .66) - .33)),\n step(0.33, x)\n );\n }\n#endif\n\nvoid main() {\n // Initialize globals\n #pragma tangram: setup\n\n // discard hidden labels by collapsing into degenerate triangle\n #ifndef TANGRAM_SHOW_HIDDEN_LABELS\n if (a_shape.w == 0.) {\n gl_Position = vec4(0., 0., 0., 1.);\n return;\n }\n #else\n // highlight hidden label in fragment shader for debugging\n if (a_shape.w == 0.) {\n v_label_hidden = 1.; // label debug testing\n }\n else {\n v_label_hidden = 0.;\n }\n #endif\n\n v_alpha_factor = 1.0;\n v_color = a_color;\n v_texcoord = a_texcoord; // UV from vertex attribute\n\n #ifdef TANGRAM_HAS_SHADER_POINTS\n v_outline_color = a_outline_color;\n v_outline_edge = a_outline_edge;\n\n if (u_point_type == TANGRAM_POINT_TYPE_SHADER) { // shader point\n // use point dimensions for UVs instead (ignore attribute), add antialiasing info for fragment shader\n float _size = abs(a_shape.x / 128.); // radius in pixels\n v_texcoord = sign(a_shape.xy) * (_size + 1.) / _size;\n _size += 2.;\n v_aa_offset = 2. / _size;\n }\n #endif\n\n // Position\n vec4 position = u_modelView * vec4(a_position.xyz, 1.);\n\n // Apply positioning and scaling in screen space\n vec2 _shape = a_shape.xy / 256.; // values have an 8-bit fraction\n vec2 _offset = vec2(a_offset.x, -a_offset.y); // flip y to make it point down\n float _theta = a_shape.z / 4096.;\n\n #ifdef TANGRAM_CURVED_LABEL\n //TODO: potential bug? null is passed in for non-curved labels, otherwise the first offset will be 0\n if (a_offsets[0] != 0.){\n vec4 _angles_scaled = (TANGRAM_PI / 16384.) * a_angles;\n vec4 _pre_angles_scaled = (TANGRAM_PI / 128.) * a_pre_angles;\n vec4 _offsets_scaled = (1. / 64.) * a_offsets;\n\n float _zoom = clamp(u_map_position.z - u_tile_origin.z, 0., 1.); //fract(u_map_position.z);\n float _pre_angle = mix4linear(_pre_angles_scaled, _zoom);\n float _angle = mix4linear(_angles_scaled, _zoom);\n float _offset_curve = mix4linear(_offsets_scaled, _zoom);\n\n _shape = rotate2D(_shape, _pre_angle); // rotate in place\n _shape.x += _offset_curve; // offset for curved label segment\n _shape = rotate2D(_shape, _angle); // rotate relative to curved label anchor\n _shape += rotate2D(_offset, _theta); // offset if specified in the scene file\n }\n else {\n _shape = rotate2D(_shape + _offset, _theta);\n }\n #else\n _shape = rotate2D(_shape + _offset, _theta);\n #endif\n\n // Fade in (if requested) based on time mesh has been visible.\n // Value passed to fragment shader in the v_alpha_factor varying\n #ifdef TANGRAM_FADE_IN_RATE\n if (u_tile_fade_in) {\n v_alpha_factor *= clamp(u_visible_time * TANGRAM_FADE_IN_RATE, 0., 1.);\n }\n #endif\n\n // World coordinates for 3d procedural textures\n v_world_position = u_model * position;\n v_world_position.xy += _shape * u_meters_per_pixel;\n v_world_position = wrapWorldPosition(v_world_position);\n\n // Modify position before camera projection\n #pragma tangram: position\n\n cameraProjection(position);\n\n #ifdef TANGRAM_LAYER_ORDER\n // +1 is to keep all layers including proxies > 0\n applyLayerOrder(a_position.w + u_tile_proxy_order_offset + 1., position);\n #endif\n\n // Apply pixel offset in screen-space\n // Multiply by 2 is because screen is 2 units wide Normalized Device Coords (and u_resolution device pixels wide)\n // Device pixel ratio adjustment is because shape is in logical pixels\n position.xy += _shape * position.w * 2. * u_device_pixel_ratio / u_resolution;\n #ifdef TANGRAM_HAS_SHADER_POINTS\n if (u_point_type == TANGRAM_POINT_TYPE_SHADER) { // shader point\n // enlarge by 1px to catch missed MSAA fragments\n position.xy += sign(_shape) * position.w * u_device_pixel_ratio / u_resolution;\n }\n #endif\n\n // Snap to pixel grid\n // Only applied to fully upright sprites/labels (not shader-drawn points), while panning is not active\n #ifdef TANGRAM_HAS_SHADER_POINTS\n if (!u_view_panning && (abs(_theta) < TANGRAM_EPSILON) && u_point_type != TANGRAM_POINT_TYPE_SHADER) {\n #else\n if (!u_view_panning && (abs(_theta) < TANGRAM_EPSILON)) {\n #endif\n vec2 _position_fract = fract((((position.xy / position.w) + 1.) * .5) * u_resolution);\n vec2 _position_snap = position.xy + ((step(0.5, _position_fract) - _position_fract) * position.w * 2. / u_resolution);\n\n // Animate the snapping to smooth the transition and make it less noticeable\n #ifdef TANGRAM_VIEW_PAN_SNAP_RATE\n position.xy = mix(position.xy, _position_snap, clamp(u_view_pan_snap_timer * TANGRAM_VIEW_PAN_SNAP_RATE, 0., 1.));\n #else\n position.xy = _position_snap;\n #endif\n }\n\n gl_Position = position;\n}\n",fragment_shader_src:"uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\nuniform float u_visible_time;\n\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nuniform sampler2D u_texture;\nuniform float u_point_type;\nuniform bool u_apply_color_blocks;\n\nvarying vec4 v_color;\nvarying vec2 v_texcoord;\nvarying vec4 v_world_position;\nvarying float v_alpha_factor;\n\n#ifdef TANGRAM_HAS_SHADER_POINTS\n varying vec4 v_outline_color;\n varying float v_outline_edge;\n varying float v_aa_offset;\n#endif\n\n#ifdef TANGRAM_SHOW_HIDDEN_LABELS\n varying float v_label_hidden;\n#endif\n\n#define TANGRAM_NORMAL vec3(0., 0., 1.)\n\n#pragma tangram: attributes\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\n#ifdef TANGRAM_HAS_SHADER_POINTS\n //l is the distance from the center to the fragment, R is the radius of the drawn point\n float _tangram_antialias(float l, float R){\n float low = R - v_aa_offset;\n float high = R + v_aa_offset;\n return 1. - smoothstep(low, high, l);\n }\n#endif\n\nvoid main (void) {\n // Initialize globals\n #pragma tangram: setup\n\n vec4 color = v_color;\n\n #ifdef TANGRAM_HAS_SHADER_POINTS\n // Only apply shader blocks to point, not to attached text (N.B.: for compatibility with ES)\n if (u_point_type == TANGRAM_POINT_TYPE_TEXTURE) { // sprite texture\n color *= texture2D(u_texture, v_texcoord);\n }\n else if (u_point_type == TANGRAM_POINT_TYPE_LABEL) { // label texture\n color = texture2D(u_texture, v_texcoord);\n color.rgb /= max(color.a, 0.001); // un-multiply canvas texture\n }\n else if (u_point_type == TANGRAM_POINT_TYPE_SHADER) { // shader point\n // Mask of outermost circle, either outline or point boundary\n float _d = length(v_texcoord); // distance to this fragment from the point center\n float _outer_alpha = _tangram_antialias(_d, 1.);\n float _fill_alpha = _tangram_antialias(_d, 1. - (v_outline_edge * 0.5)) * color.a;\n float _stroke_alpha = (_outer_alpha - _tangram_antialias(_d, 1. - v_outline_edge)) * v_outline_color.a;\n\n // Apply alpha compositing with stroke 'over' fill.\n #ifdef TANGRAM_BLEND_ADD\n color.a = _stroke_alpha + _fill_alpha;\n color.rgb = color.rgb * _fill_alpha + v_outline_color.rgb * _stroke_alpha;\n #else // TANGRAM_BLEND_OVERLAY (and fallback for not implemented blending modes)\n color.a = _stroke_alpha + _fill_alpha * (1. - _stroke_alpha);\n color.rgb = mix(color.rgb * _fill_alpha, v_outline_color.rgb, _stroke_alpha) / max(color.a, 0.001); // avoid divide by zero\n #endif\n }\n #else\n // If shader points not supported, assume label texture\n color = texture2D(u_texture, v_texcoord);\n color.rgb /= max(color.a, 0.001); // un-multiply canvas texture\n #endif\n\n // Shader blocks for color/filter are only applied for sprites, shader points, and standalone text,\n // NOT for text attached to a point (N.B.: for compatibility with ES)\n if (u_apply_color_blocks) {\n #pragma tangram: color\n #pragma tangram: filter\n }\n\n color.a *= v_alpha_factor;\n\n // highlight hidden label in fragment shader for debugging\n #ifdef TANGRAM_SHOW_HIDDEN_LABELS\n if (v_label_hidden > 0.) {\n color.a *= 0.5;\n color.rgb = vec3(1., 0., 0.);\n }\n #endif\n\n // Use alpha test as a lower-quality substitute\n // For opaque and translucent: avoid transparent pixels writing to depth buffer, obscuring geometry underneath\n // For multiply: avoid transparent pixels multiplying geometry underneath to zero/full black\n #if defined(TANGRAM_BLEND_OPAQUE) || defined(TANGRAM_BLEND_TRANSLUCENT) || defined(TANGRAM_BLEND_MULTIPLY)\n if (color.a < TANGRAM_ALPHA_TEST) {\n discard;\n }\n #endif\n\n // Make points more visible in wireframe debug mode\n #ifdef TANGRAM_WIREFRAME\n color = vec4(vec3(0.5), 1.); // use gray outline for textured points\n #ifdef TANGRAM_HAS_SHADER_POINTS\n if (u_point_type == TANGRAM_POINT_TYPE_SHADER) {\n color = vec4(v_color.rgb, 1.); // use original vertex color outline for shader points\n }\n #endif\n #endif\n\n gl_FragColor = color;\n}\n",selection:!0,collision:!0,blend:"overlay",init(e={}){Ne.init.call(this,e),this.setupDefines(),this.defines.TANGRAM_HAS_SHADER_POINTS=!0,this.defines.TANGRAM_POINT_TYPE_TEXTURE=1,this.defines.TANGRAM_POINT_TYPE_LABEL=2,this.defines.TANGRAM_POINT_TYPE_SHADER=3,this.collision_group_points=this.name+"-points",this.collision_group_text=this.name+"-text",this.stencil_proxy_tiles=!1,this.reset()},setupDefines(){"overlay"!==this.blend&&(this.defines.TANGRAM_LAYER_ORDER=!0),!0===v.suppress_label_fade_in?(this.fade_in_time=0,this.defines.TANGRAM_FADE_IN_RATE=null):(this.fade_in_time=.15,this.defines.TANGRAM_FADE_IN_RATE=1/this.fade_in_time),!0!==v.suppress_label_snap_animation&&(this.defines.TANGRAM_VIEW_PAN_SNAP_RATE=2),!0===v.show_hidden_labels&&(this.defines.TANGRAM_SHOW_HIDDEN_LABELS=!0),!0===v.wireframe&&(this.defines.TANGRAM_WIREFRAME=!0)},reset(){this.queues={},this.resetText(),this.texture_missing_sprites={}},addFeature(e,t,n){let r=n.tile;if(r.generation!==this.generation)return;let i,o={};if(o.color=this.parseColor(t.color,n),o.texture=t.texture,o.label_texture=null,o.blend_order=t.blend_order,!o.color&&!o.texture)return;if(o.alpha=Q.evalCachedProperty(t.alpha,n),this.hasSprites(o)){if(i=this.parseSprite(o,t,n),!i)return void g({level:"debug",once:!0},`Layer group '${t.layers.join(", ")}' uses a texture '${o.texture}', but doesn't specify which sprite to draw. Features that match this layer group won't be drawn without specifying the sprite with the 'sprite' or 'sprite_default' properties. The merged draw parameters for this layer group are:`,t).then(n=>{n&&g("debug",`Example feature for layer group '${t.layers.join(", ")}'`,e)});o.texcoords=i.texcoords}else if(t.sprite)return void g({level:"warn",once:!0},`Layer group '${t.layers.join(", ")}' specifies sprite '${t.sprite}', but the texture '${t.texture}' doesn't define any sprites. Features that match this layer group won't be drawn. The merged draw parameters for this layer group are:`,t);if(this.calcSize(t,o,i,n),t.outline&&(o.outline_width=Q.evalCachedProperty(t.outline.width,n)||Q.defaults.outline.width,o.outline_color=this.parseColor(t.outline.color,n)),o.outline_edge_pct=0,o.outline_width&&o.outline_color){let e=o.outline_width;o.size[0]+=e,o.size[1]+=e,o.outline_edge_pct=e/Math.min(o.size[0],o.size[1])*2,o.outline_alpha=Q.evalCachedProperty(t.outline.alpha,n)}o.size[0]=Math.min(o.size[0],256),o.size[1]=Math.min(o.size[1],256),o.placement=t.placement,o.placement_min_length_ratio=Q.evalCachedProperty(t.placement_min_length_ratio,n),o.placement===ur.SPACED&&t.placement_spacing&&(o.placement_spacing=Q.evalCachedProperty(t.placement_spacing,n)),o.angle=Q.evalProperty(t.angle,n)||0,o.z=Q.evalCachedDistanceProperty(t.z,n)||Q.defaults.z,o.tile_edges=t.tile_edges,this.computeLayout(o,e,t,n,r);let s=t.text&&!1!==t.text.visible&&this.parseTextFeature(e,t.text,n,r);Array.isArray(s)&&(s=null,g({level:"warn",once:!0},`Layer group '${t.layers.join(", ")}': cannot use boundary labels (e.g. 'text_source: { left: ..., right: ... }') for 'text' labels attached to 'points'; provided 'text_source' value was ${JSON.stringify(t.text.text_source)}`)),s&&(s.layout.parent=o,s.layout.priority=t.text.priority?Math.max(s.layout.priority,o.priority+.5):o.priority+.5,Wt.addStyle(this.collision_group_text,r.id)),this.queueFeature({feature:e,draw:t,context:n,style:o,text_feature:s},r),Wt.addStyle(this.collision_group_points,r.id)},calcSize(e,t,n,r){if(t.size=e.size,t.size){if(t.size=Q.evalCachedPointSizeProperty(e.size,n,O.textures[t.texture],r),null==t.size)return void g({level:"warn",once:!0},`Layer group '${e.layers.join(", ")}': 'size' (${JSON.stringify(e.size.value)}) couldn't be interpreted, features that match this layer group won't be drawn`);"number"==typeof t.size&&(t.size=[t.size,t.size])}else t.size=n&&n.css_size||[16,16]},hasSprites:e=>e.texture&&O.textures[e.texture]&&O.textures[e.texture].sprites,getSpriteInfo(e,t){let n=O.textures[e.texture].sprites[t]&&O.getSpriteInfo(e.texture,t);return t&&!n?(this.texture_missing_sprites[e.texture]=this.texture_missing_sprites[e.texture]||{},this.texture_missing_sprites[e.texture][t]||(g("debug",`Style: in style '${this.name}', could not find sprite '${t}' for texture '${e.texture}'`),this.texture_missing_sprites[e.texture][t]=!0)):n&&(n.sprite=t),n},parseSprite(e,t,n){let r=Q.evalProperty(t.sprite,n);return this.getSpriteInfo(e,r)||this.getSpriteInfo(e,t.sprite_default)},queueFeature(e,t){this.tile_data[t.id]&&this.queues[t.id]||this.startData(t),this.queues[t.id]=this.queues[t.id]||[],this.queues[t.id].push(e)},async endData(e){if(e.canceled)return g("trace",`Style ${this.name}: stop tile build because tile was canceled: ${e.key}`),null;let t=this.queues[e.id];delete this.queues[e.id];let n=[],r=[];t.forEach(e=>{let t=e.style,i=e.feature,o=i.geometry,s=this.buildLabels(t.size,o,t);for(let o=0;o<s.length;o++){let a=s[o],l={feature:i,draw:e.draw,context:e.context,style:t,label:a};if(r.push(l),e.text_feature){let t={feature:i,draw:e.text_feature.draw,context:e.context,text:e.text_feature.text,text_settings_key:e.text_feature.text_settings_key,layout:e.text_feature.layout,point_label:a,linked:l};n.push(t),e.draw.text.optional||(l.linked=t)}}});const[,{labels:i,texts:o,textures:s}]=await Promise.all([Wt.collide(r,this.collision_group_points,e.id).then(e=>{e.forEach(e=>{this.feature_style=e.style,this.feature_style.label=e.label,this.feature_style.linked=e.linked,Ne.addFeature.call(this,e.feature,e.draw,e.context)})}),this.collideAndRenderTextLabels(e,this.collision_group_text,n)]);i&&o&&i.forEach(e=>{let t=e.text_settings_key,n=o[t]&&o[t][e.text],r=this.feature_style;r.label=e.label,r.linked=e.linked,r.size=n.size.logical_size,r.texcoords=n.align[e.label.align].texcoords,r.label_texture=s[n.align[e.label.align].texture_id],r.blend_order=e.draw.blend_order,Ne.addFeature.call(this,e.feature,e.draw,e.context)}),this.freeText(e);const a=await Ne.endData.call(this,e);return a&&s&&s.length&&(a.textures=a.textures||[],a.textures.push(...s)),a},_preprocess(e){e.color=Q.createColorPropertyCache(e.color),e.alpha=Q.createPropertyCache(e.alpha),e.texture=void 0!==e.texture?e.texture:this.texture,e.blend_order=this.getBlendOrderForDraw(e),e.outline&&(e.outline.color=Q.createColorPropertyCache(e.outline.color),e.outline.alpha=Q.createPropertyCache(e.outline.alpha),e.outline.width=Q.createPropertyCache(e.outline.width,Q.parsePositiveNumber)),e.z=Q.createPropertyCache(e.z,Q.parseUnits);try{e.size=Q.createPointSizePropertyCache(e.size,e.texture)}catch(t){return g({level:"warn",once:!0},`Layer group '${e.layers.join(", ")}': ${t} (${JSON.stringify(e.size)}), features that match this layer group won't be drawn.`),null}if(e.offset=Q.createPropertyCache(e.offset,e=>Array.isArray(e)&&e.map(Q.parseNumber)),e.buffer=Q.createPropertyCache(e.buffer,e=>(Array.isArray(e)?e:[e,e]).map(Q.parsePositiveNumber)),e.repeat_distance=Q.createPropertyCache(e.repeat_distance,Q.parseNumber),e.placement=ur[e.placement&&e.placement.toUpperCase()],null==e.placement&&(e.placement=ur.VERTEX),e.placement_spacing=null!=e.placement_spacing?e.placement_spacing:80,e.placement_spacing=Q.createPropertyCache(e.placement_spacing,Q.parsePositiveNumber),e.placement_min_length_ratio=null!=e.placement_min_length_ratio?e.placement_min_length_ratio:1,e.placement_min_length_ratio=Q.createPropertyCache(e.placement_min_length_ratio,Q.parsePositiveNumber),"number"==typeof e.angle)e.angle=e.angle*Math.PI/180;else if("function"==typeof e.angle){const t=e.angle;e.angle=e=>t(e)*Math.PI/180}else e.angle=e.angle||0;return e.text=this.preprocessText(e.text),e.text&&(e.text.key=e.key,e.text.group=e.group,e.text.layers=e.layers,e.text.order=e.order,e.text.blend_order=e.blend_order,e.text.repeat_group=null!=e.text.repeat_group?e.text.repeat_group:e.repeat_group,e.text.anchor=e.text.anchor||this.default_anchor,e.text.optional="boolean"==typeof e.text.optional&&e.text.optional,e.text.interactive=e.text.interactive||e.interactive),e},default_anchor:["bottom","top","right","left"],computeLayout(e,t,n,r,i){let o=e||{};o.id=t,o.units_per_pixel=i.units_per_pixel||1,o.collide=!1!==n.collide,o.anchor=n.anchor,o.offset=Q.evalCachedProperty(n.offset,r)||Q.zeroPair,o.buffer=Q.evalCachedProperty(n.buffer,r)||Q.zeroPair,o.repeat_distance=Q.evalCachedProperty(n.repeat_distance,r),o.repeat_distance&&(o.repeat_distance*=o.units_per_pixel,o.repeat_scale=1,"function"==typeof n.repeat_group?o.repeat_group=n.repeat_group(r):o.repeat_group=n.repeat_group||r.layer);let s=n.priority;return null!=s?"function"==typeof s&&(s=s(r)):s=-1>>>0,o.priority=s,o},buildTextLabels(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],o=this.texts[e.id][i.text_settings_key][i.text].size.collision_size;i.label=new qt(i.point_label.position,o,i.layout),n.push(i)}return n},buildLabels(e,t,n){let r=[];if("Point"===t.type)r.push(new qt(t.coordinates,e,n,n.angle));else if("MultiPoint"===t.type){let i=t.coordinates;for(let t=0;t<i.length;++t){let o=i[t];r.push(new qt(o,e,n,n.angle))}}else if("LineString"===t.type){let i=Ht(t.coordinates,e,n);for(let e=0;e<i.length;++e)r.push(i[e])}else if("MultiLineString"===t.type){let i=t.coordinates;for(let t=0;t<i.length;t++){let o=Ht(i[t],e,n);for(let e=0;e<o.length;++e)r.push(o[e])}}else if("Polygon"===t.type)if(n.placement===ur.CENTROID){let i=U.centroid(t.coordinates);i&&r.push(new qt(i,e,n,n.angle))}else{let i=t.coordinates;for(let t=0;t<i.length;t++){let o=Ht(i[t],e,n);for(let e=0;e<o.length;++e)r.push(o[e])}}else if("MultiPolygon"===t.type)if(n.placement===ur.CENTROID){let i=U.multiCentroid(t.coordinates);i&&r.push(new qt(i,e,n,n.angle))}else{let i=t.coordinates;for(let t=0;t<i.length;t++){let o=i[t];for(let t=0;t<o.length;t++){let i=Ht(o[t],e,n);for(let e=0;e<i.length;++e)r.push(i[e])}}}return r},makeVertexTemplate(e,t,n=!0){let r=0;this.vertex_template[r++]=0,this.vertex_template[r++]=0,this.vertex_template[r++]=e.z||0,this.vertex_template[r++]=this.scaleOrder(e.order),this.vertex_template[r++]=0,this.vertex_template[r++]=0,this.vertex_template[r++]=0,this.vertex_template[r++]=e.label.layout.collide?0:1,t.variant.shader_point||(this.vertex_template[r++]=0,this.vertex_template[r++]=0),this.vertex_template[r++]=0,this.vertex_template[r++]=0;const i=e.color||Q.defaults.color;if(this.vertex_template[r++]=255*i[0],this.vertex_template[r++]=255*i[1],this.vertex_template[r++]=255*i[2],this.vertex_template[r++]=255*(null!=e.alpha?e.alpha:i[3]),t.variant.selection&&(this.vertex_template[r++]=255*e.selection_color[0],this.vertex_template[r++]=255*e.selection_color[1],this.vertex_template[r++]=255*e.selection_color[2],this.vertex_template[r++]=255*e.selection_color[3]),t.variant.shader_point){const t=e.outline_color||Q.defaults.outline.color;this.vertex_template[r++]=255*t[0],this.vertex_template[r++]=255*t[1],this.vertex_template[r++]=255*t[2],this.vertex_template[r++]=255*(null!=e.outline_alpha?e.outline_alpha:t[3]),this.vertex_template[r++]=e.outline_edge_pct||Q.defaults.outline.width}return n&&this.addCustomAttributesToVertexTemplate(e,r),this.vertex_template},buildQuad:(e,t,n,r,i,o,s,a,l,u,c)=>t[0]<=0||t[1]<=0?0:function(e,t,n,r,i,o,s,a,l,u,c,d){const h=128*i[0],p=128*i[1];Tt[0]=-h,Tt[1]=-p,Tt[2]=h,Tt[3]=p;const f=c||$e,m=t.vertex_elements;let g=t.vertex_count;for(let i=0;i<4;i++)n[r.a_position+0]=e[0],n[r.a_position+1]=e[1],n[r.a_shape+0]=Tt[Et[i]],n[r.a_shape+1]=Tt[St[i]],n[r.a_shape+2]=l,n[r.a_offset+0]=o[0],n[r.a_offset+1]=o[1],r.a_texcoord&&(n[r.a_texcoord+0]=65535*f[Et[i]],n[r.a_texcoord+1]=65535*f[St[i]]),d&&(n[r.a_pre_angles+0]=xt*a[0],n[r.a_pre_angles+1]=xt*a[1],n[r.a_pre_angles+2]=xt*a[2],n[r.a_pre_angles+3]=xt*a[3],n[r.a_angles+0]=wt*u[0],n[r.a_angles+1]=wt*u[1],n[r.a_angles+2]=wt*u[2],n[r.a_angles+3]=wt*u[3],n[r.a_offsets+0]=64*s[0],n[r.a_offsets+1]=64*s[1],n[r.a_offsets+2]=64*s[2],n[r.a_offsets+3]=64*s[3]),t.addVertex(n);return m.push(g+0),m.push(g+1),m.push(g+2),m.push(g+2),m.push(g+3),m.push(g+0),2}(e,u,c,u.vertex_layout.index,t,o,s,i,4096*n,r,a,l),build(e,t){let n=e.label;return"curved"===n.type?this.buildCurvedLabel(n,e,t):this.buildStraightLabel(n,e,t)},buildStraightLabel(e,t,n){let r,i,o=this.getTileMesh(n.tile,this.meshVariantTypeForDraw(t)),s=this.makeVertexTemplate(t,o);"point"!==e.type?(r=t.size[e.type],i=t.texcoords[e.type].texcoord):(r=t.size,i=t.texcoords),o.uniforms=o.uniforms||{},t.label_texture?(o.uniforms.u_texture=t.label_texture,o.uniforms.u_point_type=2,o.uniforms.u_apply_color_blocks=!1):t.texture?(o.uniforms.u_texture=t.texture,o.uniforms.u_point_type=1,o.uniforms.u_apply_color_blocks=!0):(o.uniforms.u_texture=O.default,o.uniforms.u_point_type=3,o.uniforms.u_apply_color_blocks=!0);let a=e.offset,l=this.buildQuad(e.position,r,e.angle,null,null,a,null,i,!1,o.vertex_data,s);const u=t.linked&&t.linked.label.id;return this.trackLabel(e,u,o,l,n),l},buildCurvedLabel(e,t,n){let r,i,o=0;for(let s=0;s<e.num_segments;s++){let a=t.size[e.type][s],l=t.texcoords_stroke[s];t.label_texture=t.label_textures[s],r=this.getTileMesh(n.tile,this.meshVariantTypeForDraw(t)),i=this.makeVertexTemplate(t,r),r.uniforms=r.uniforms||{},r.uniforms.u_texture=t.label_texture,r.uniforms.u_point_type=2,r.uniforms.u_apply_color_blocks=!1;let u=e.offset||[0,0],c=e.position,d=e.angles[s],h=e.offsets[s],p=e.pre_angles[s],f=this.buildQuad(c,a,e.angle,d,p,u,h,l,!0,r.vertex_data,i);o+=f;const m=t.linked&&t.linked.label.id;this.trackLabel(e,m,r,f,n)}for(let s=0;s<e.num_segments;s++){let a=t.size[e.type][s],l=t.texcoords[e.type][s].texcoord;t.label_texture=t.label_textures[s],r=this.getTileMesh(n.tile,this.meshVariantTypeForDraw(t)),i=this.makeVertexTemplate(t,r),r.uniforms=r.uniforms||{},r.uniforms.u_texture=t.label_texture,r.uniforms.u_point_type=2,r.uniforms.u_apply_color_blocks=!1;let u=e.offset||[0,0],c=e.position,d=e.angles[s],h=e.offsets[s],p=e.pre_angles[s],f=this.buildQuad(c,a,e.angle,d,p,u,h,l,!0,r.vertex_data,i);o+=f;const m=t.linked&&t.linked.label.id;this.trackLabel(e,m,r,f,n)}return o},trackLabel(e,t,n,r){if(e.layout.collide||e.may_repeat_across_tiles){n.labels=n.labels||{},n.labels[e.id]=n.labels[e.id]||{container:{label:e.toJSON(),linked:t},ranges:[]};const i=2*r,o=n.vertex_data.offset-n.vertex_data.stride*i;n.labels[e.id].ranges.push([o,i])}},buildLines(e,t,n){return this.build(t,n)},buildPoints(e,t,n){return this.build(t,n)},buildPolygons(e,t,n){return this.build(t,n)},vertexLayoutForMeshVariant(e){if(null==this.vertex_layouts[e.shader_point]){const t=[{name:"a_position",size:4,type:pe.SHORT,normalized:!1},{name:"a_shape",size:4,type:pe.SHORT,normalized:!1},{name:"a_texcoord",size:2,type:pe.UNSIGNED_SHORT,normalized:!0,static:e.shader_point?[0,0]:null},{name:"a_offset",size:2,type:pe.SHORT,normalized:!1},{name:"a_color",size:4,type:pe.UNSIGNED_BYTE,normalized:!0},{name:"a_selection_color",size:4,type:pe.UNSIGNED_BYTE,normalized:!0,static:e.selection?null:[0,0,0,0]},{name:"a_outline_color",size:4,type:pe.UNSIGNED_BYTE,normalized:!0,static:e.shader_point?null:[0,0,0,0]},{name:"a_outline_edge",size:1,type:pe.FLOAT,normalized:!1,static:e.shader_point?null:0}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.shader_point]=new Le(t)}return this.vertex_layouts[e.shader_point]},meshVariantTypeForDraw(e){const t=e.label_texture||e.texture||dr,n=t+"/"+e.blend_order;return null==this.variants[n]&&(this.variants[n]={key:n,selection:1,shader_point:t===dr,blend_order:e.blend_order,mesh_order:e.label_texture?1:0}),this.variants[n]},makeMesh(e,t,n={}){return n=Object.assign({},n,{fade_in_time:this.fade_in_time}),Ne.makeMesh.call(this,e,t,n)}});const hr=[0,.33,.66,.99];let pr=function(e,t,n,r){const i=[{type:"straight",tolerance:r.no_curving?1.8:1.5},{type:"curved"},{type:"straight",tolerance:2.3}];for(let o=0;o<i.length;o++){let s,a=i[o];if("straight"===a.type?s=new mr(t,n,r,a.tolerance):"curved"===a.type&&!r.no_curving&&n.length>2&&(s=new gr(e,n,r)),s&&!s.throw_away)return s}return!1};class fr{constructor(e){this.id=$t.nextLabelId(),this.layout=e,this.position=[],this.angle=0,this.offset=e.offset.slice(),this.unit_scale=this.layout.units_per_pixel,this.obbs=[],this.aabbs=[],this.type="",this.throw_away=!1}toJSON(){return{id:this.id,type:this.type,position:this.position,size:this.size,offset:this.offset,angle:this.angle,breach:this.breach,may_repeat_across_tiles:this.may_repeat_across_tiles,layout:Bt(this.layout)}}static splitLineByOrientation(e){let t=[e[0]],n=0,r=0,i=0,o=t,s=!1;for(let a=1;a<e.length;a++){let l=e[a],u=e[a-1],c=be.length(be.sub(l,u));l[0]>u[0]?1===i?(t.push(l),n+=c,n>r&&(o=t,r=n,s=!1)):(t=[u,l],n=c,n>r&&(o=t,r=n,s=!1),i=1):l[0]<u[0]?-1===i?(t.unshift(l),n+=c,n>r&&(o=t,r=n,s=!0)):(t=[l,u],n=c,n>r&&(o=t,r=n,s=!0),i=-1):(-1===i?t.unshift(l):(t.push(l),i=1),n+=c,n>r&&(o=t,r=n,s=-1===i))}return[o,s]}discard(e,t=null){if(this.throw_away)return!0;for(let n=0;n<this.obbs.length;n++){let r={aabb:this.aabbs[n],obb:this.obbs[n]};if($t.prototype.occluded.call(r,e,t))return!0}return!1}inTileBounds(){for(let e=0;e<this.aabbs.length;e++){let t={aabb:this.aabbs[e]};if(!$t.prototype.inTileBounds.call(t))return!1}return!0}static createOBB(e,t,n,r,i,o,s){let a=e[0],l=e[1];return!o||0===o[0]&&0===o[1]||(a+=(o=be.rot(o,i))[0]*s,l-=o[1]*s),new jt(a,l,-r,t,n)}}class mr extends fr{constructor(e,t,n,r){super(n),this.type="straight",this.size=e,this.throw_away=!this.fit(e,t,n,r)}fit(e,t,n,r){let i,o=this.unit_scale;[t,i]=fr.splitLineByOrientation(t),"number"==typeof n.orientation&&(this.offset[1]+=1.2*(e[1]-n.vertical_buffer),i&&(this.offset[1]*=-1),-1===n.orientation&&(this.offset[1]*=-1));let s=vr(t),a=e[0]*o;for(let i=0;i<t.length-1;i++){let o,l=t[i],u=0,c=0,d=i+1;for(;d<t.length;){let h=t[d-1],p=t[d],f=br(h,p);if(d!==i+1&&(u+=_r(f,o)),Math.abs(u)>.1)break;if(c+=s[d-1],yr(c,a)<r){let t=be.mult(be.add(l,p),.5);return this.angle=-f,Math.abs(this.angle-Math.PI/2)<.01&&(this.angle=-Math.PI/2,"number"==typeof n.orientation&&(this.offset[1]*=-1)),this.position=t,this.updateBBoxes(this.position,e,this.angle,this.angle,this.offset),!0}o=f,d++}}return!1}updateBBoxes(e,t,n,r,i){let o=this.unit_scale;this.obbs=[],this.aabbs=[];let s=(t[0]+2*this.layout.buffer[0])*o*$t.epsilon,a=(t[1]+2*this.layout.buffer[1])*o*$t.epsilon,l=fr.createOBB(e,s,a,n,r,i,o),u=l.getExtent();this.obbs.push(l),this.aabbs.push(u),this.inTileBounds&&(this.breach=!this.inTileBounds()),this.mayRepeatAcrossTiles&&(this.may_repeat_across_tiles=this.mayRepeatAcrossTiles())}}class gr extends fr{constructor(e,t,n){super(n),this.type="curved",this.angles=[],this.pre_angles=[],this.offsets=[],this.num_segments=e.length,this.sizes=e,this.throw_away=!this.fit(this.sizes,t,n)}toJSON(){return{id:this.id,type:this.type,obbs:this.obbs.map(e=>e.toJSON()),position:this.position,breach:this.breach,may_repeat_across_tiles:this.may_repeat_across_tiles,layout:Bt(this.layout)}}fit(e,t,n){let r,i=this.unit_scale,o=Math.max(...e.map(e=>e[1])),s=o*i;[t,r]=fr.splitLineByOrientation(t),"number"==typeof n.orientation&&(this.offset[1]+=1.2*(o-n.vertical_buffer),r&&(this.offset[1]*=-1),-1===n.orientation&&(this.offset[1]*=-1));let a=vr(t),l=e.map(e=>e[0]*i),u=a.reduce((e,t)=>e+t,0),c=l.reduce((e,t)=>e+t,0);if(c>u)return!1;let d=t.length-1;if(d-0<2)return!1;let h=gr.curvaturePlacement(t,u,a,c,0,d),p=t[h];if(-1===h||d-h<2)return!1;this.position=p;for(var f=0;f<l.length;f++){this.offsets[f]=[],this.angles[f]=[],this.pre_angles[f]=[];for(var m=0;m<hr.length;m++){let e=hr[m],[n,r]=gr.scaleLine(e,t);p=n[h];let{positions:o,offsets:a,angles:u,pre_angles:c}=gr.placeAtIndex(h,n,r,l),d=a.map(e=>Math.sqrt(e[0]*e[0]+e[1]*e[1])/i);if(0===e){this.angle=1/u.length*u.reduce((e,t)=>e+t);for(let e=0;e<o.length;e++){let t=o[e],n=c[e],r=l[e],a=n+u[e],d=this.angle,h=fr.createOBB(t,r,s,a,d,this.offset,i),p=h.getExtent();this.obbs.push(h),this.aabbs.push(p)}}this.offsets[f].push(d[f]),this.angles[f].push(u[f]),this.pre_angles[f].push(c[f])}}return!0}static curvaturePlacement(e,t,n,r,i,o){i=i||0,o=o||e.length-1;var s=[];for(let t=i+1;t<o;t++){var a=e[t-1],l=e[t],u=e[t+1],c=be.perp(l,a),d=be.perp(u,l),h=be.angleBetween(c,d);h>1&&(h=1/0),s.push(h)}s.push(1/0);var p=[],f=[],m=i,g=0;for(let e=0;e<i;e++)g+=n[e];for(;g+r<t;){for(var y=g+r,b=g,v=m,_=0;v<o&&b+n[v]<y&&(_+=s[v])!==1/0;)b+=n[v],v++;if(0===_)return m;var x=_/(v-m);p.push(_),f.push(x),g+=n[m],m++}if(0===p.length)return-1;var w=Math.min.apply(null,p),E=f[p.indexOf(w)];return w<1.3&&E<.4?p.indexOf(w):-1}static scaleLine(e,t){var n=[t[0]],r=[];return t.forEach((i,o)=>{if(o!==t.length-1){var s=be.sub(t[o+1],t[o]),a=be.mult(s,1+e);n.push(be.add(n[o],a)),r.push(be.length(a))}}),[n,r]}static placeAtIndex(e,t,n,r){let i=t[e],[o,s]=gr.getIndicesAndOffsets(e,n,r),a=gr.getPositionsFromIndicesAndOffsets(t,o,s),[l,u,c]=gr.getAnglesFromIndicesAndOffsets(i,o,t,a);return{positions:a,offsets:l,angles:u,pre_angles:c}}static getIndicesAndOffsets(e,t,n){let r=n.length,i=[],o=[],s=0,a=0,l=0;for(;s<r;){let u=n[s];for(;s<r&&a+.5*u<=l+t[e];){let t=a-l+.5*u;o.push(t),i.push(e),a+=u,s++,u=n[s]}l+=t[e],e++}return[i,o]}static getPositionsFromIndicesAndOffsets(e,t,n){let r=[];for(let i=0;i<t.length;i++){let o=t[i],s=n[i],a=br(e[o],e[o+1]),l=be.rot([s,0],a),u=be.add(e[o],l);r.push(u)}return r}static getAnglesFromIndicesAndOffsets(e,t,n,r){let i=[],o=[],s=[];for(let a=0;a<r.length;a++){let l=r[a],u=t[a],c=be.sub(l,e),d=-be.angle(c),h=-br(n[u],n[u+1])-d;if(a>0){let e=i[a-1],t=o[a-1];Math.abs(d-e)>Math.PI&&(d+=d>e?-2*Math.PI:2*Math.PI),Math.abs(t-h)>Math.PI&&(h+=h>t?-2*Math.PI:2*Math.PI)}i.push(d),o.push(h),s.push(c)}return[s,i,o]}}function yr(e,t){return t/e}function br(e,t){let n=be.sub(t,e);return be.angle(n)}function vr(e){let t=[];for(let n=0;n<e.length-1;n++){let r=e[n],i=e[n+1],o=Math.hypot(r[0]-i[0],r[1]-i[1]);t.push(o)}return t}function _r(e,t){let n,r;for(e>t?(n=t,r=e):(n=e,r=t);r-n>Math.PI;)n+=2*Math.PI;return Math.abs(r-n)}let xr=Object.create(cr);Object.assign(xr,{name:"text",super:cr,built_in:!0,init(e={}){Ne.init.call(this,e),this.setupDefines(),this.defines.TANGRAM_HAS_SHADER_POINTS=!1,this.defines.TANGRAM_CURVED_LABEL=!0,this.reset()},makeVertexTemplate(e,t){this.super.makeVertexTemplate.call(this,e,t,!1);let n=t.vertex_data.vertex_layout.index.a_pre_angles;for(let e=0;e<12;e++)this.vertex_template[n++]=0;return this.addCustomAttributesToVertexTemplate(e,n),this.vertex_template},reset(){this.queues={},this.resetText()},addFeature(e,t,n){let r=n.tile;if(r.generation!==this.generation)return;let i=e.geometry.type;t.can_articulate="LineString"===i||"MultiLineString"===i,t.supersample_text="LineString"===i||"MultiLineString"===i;let o=this.parseTextFeature(e,t,n,r);o&&(o instanceof Array?o.forEach(t=>{t.feature=e,t.context=n,t.layout.vertex=!1,this.queueFeature(t,r)}):(o.feature=e,o.context=n,o.layout.vertex=!1,this.queueFeature(o,r)),Wt.addStyle(this.name,r.id))},async endData(e){let t=this.queues[e.id];delete this.queues[e.id];const{labels:n,texts:r,textures:i}=await this.collideAndRenderTextLabels(e,this.name,t);n&&r&&(this.texts[e.id]=r,n.forEach(t=>{let n=t.text_settings_key,r=this.texts[e.id][n]&&this.texts[e.id][n][t.text],o=this.feature_style;o.label=t.label,r.text_settings.can_articulate?(o.size={},o.texcoords={},"straight"===t.label.type?(o.size.straight=r.size.logical_size,o.texcoords.straight=r.texcoords.straight,o.label_texture=i[r.texcoords.straight.texture_id]):(o.size.curved=r.segment_sizes.map(function(e){return e.logical_size}),o.texcoords_stroke=r.texcoords_stroke,o.texcoords.curved=r.texcoords.curved,o.label_textures=r.texcoords.curved.map(e=>i[e.texture_id]))):(o.size=r.size.logical_size,o.texcoords=r.align[t.label.align].texcoords,o.label_texture=i[r.align[t.label.align].texture_id]),o.blend_order=t.draw.blend_order,Ne.addFeature.call(this,t.feature,t.draw,t.context)})),this.freeText(e);const o=await Ne.endData.call(this,e);if(o){i&&i.length&&o.textures.push(...i);for(let e in o.meshes)o.meshes[e].uniforms.u_apply_color_blocks=!0}return o},_preprocess(e){return e.blend_order=this.getBlendOrderForDraw(e),this.preprocessText(e)},buildTextLabels(e,t){let n=[];for(let i=0;i<t.length;i++){let o,s=t[i],a=this.texts[e.id][s.text_settings_key][s.text];if(s.layout.vertical_buffer=a.vertical_buffer,a.text_settings.can_articulate){var r=a.segment_sizes.map(e=>e.collision_size);s.layout.no_curving=a.no_curving,o=this.buildLabels(r,s.feature.geometry,s.layout,a.size.collision_size)}else o=this.buildLabels(a.size.collision_size,s.feature.geometry,s.layout);for(let e=0;e<o.length;e++){let t=Object.create(s);t.label=o[e],n.push(t)}}return n},buildLabels(e,t,n,r){let i=[];if("LineString"===t.type)Array.prototype.push.apply(i,this.buildLineLabels(t.coordinates,e,n,r));else if("MultiLineString"===t.type){let o=t.coordinates;for(let t=0;t<o.length;++t)Array.prototype.push.apply(i,this.buildLineLabels(o[t],e,n,r))}else if("Point"===t.type)i.push(new qt(t.coordinates,e,n));else if("MultiPoint"===t.type){let r=t.coordinates;for(let t=0;t<r.length;++t)i.push(new qt(r[t],e,n))}else if("Polygon"===t.type){let r=U.centroid(t.coordinates);r&&i.push(new qt(r,e,n))}else if("MultiPolygon"===t.type){let r=U.multiCentroid(t.coordinates);r&&i.push(new qt(r,e,n))}return i},buildLineLabels(e,t,n,r){let i=[],o=Math.min(n.subdiv,e.length-1);if(o>1){let s=(e.length-1)/o;for(let a=0;a<o;a++){let o=Math.floor(a*s),l=Math.floor((a+1)*s)+1,u=e.slice(o,l),c=pr(t,r,u,n);c&&i.push(c)}}if(i.length<o){let o=pr(t,r,e,n);o&&i.push(o)}return i},vertexLayoutForMeshVariant(e){if(null==this.vertex_layouts[e.shader_point]){const t=[{name:"a_position",size:4,type:pe.SHORT,normalized:!1},{name:"a_shape",size:4,type:pe.SHORT,normalized:!1},{name:"a_texcoord",size:2,type:pe.UNSIGNED_SHORT,normalized:!0},{name:"a_offset",size:2,type:pe.SHORT,normalized:!1},{name:"a_color",size:4,type:pe.UNSIGNED_BYTE,normalized:!0},{name:"a_selection_color",size:4,type:pe.UNSIGNED_BYTE,normalized:!0,static:e.selection?null:[0,0,0,0]},{name:"a_pre_angles",size:4,type:pe.BYTE,normalized:!1},{name:"a_angles",size:4,type:pe.SHORT,normalized:!1},{name:"a_offsets",size:4,type:pe.UNSIGNED_SHORT,normalized:!1}];this.addCustomAttributesToAttributeList(t),this.vertex_layouts[e.shader_point]=new Le(t)}return this.vertex_layouts[e.shader_point]}}),xr.texture_id=0;let wr=Object.create(et);function Er(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Sr(e){return null!=e}function Tr(e){return"("+e+")"}function kr(e){return"string"==typeof e?'"'+e+'"':e}function Or(e){return"$"===e[0]?"context['"+e.substring(1)+"']":e.indexOf(".")>-1?-1===e.indexOf("\\.")?`context.feature.properties${e.split(".").map(e=>"['"+e+"']").join("")}`:`context.feature.properties${e.replace(/\\\./g,"__TANGRAM_DELIMITER__").split(".").map(e=>e.replace(/__TANGRAM_DELIMITER__/g,".")).map(e=>"['"+e+"']").join("")}`:"context.feature.properties['"+e+"']"}function Ar(e,t){return Tr(kr(t)+" === "+Or(e))}function Cr(e,t){return Tr(`${"["+t.map(kr).join(",")+"]"}.indexOf(${Or(e)}) > -1`)}function Rr(e,t){return Tr(e.filter(Sr).map(function(e){return Tr(e.join(" && "))}).join(" "+t+" "))}function Nr(e,t,n){return t&&t.length>0?Rr(t.map(function(e){return Lr(e,n)}),"||"):"true"}function Pr(e,t,n){return t&&t.length>0?Rr(t.map(function(e){return Lr(e,n)}),"&&"):"true"}function Mr(e,t,n){return"!"+Tr(Lr(t,n).join(" && "))}function Dr(e,t,n){return"!"+Tr(Nr(0,t,n))}function Ir(e,t){return Tr(Or(e)+(t?" != ":" == ")+"null")}function zr(e,t,n){var r=[],i=n&&"function"==typeof n.rangeTransform&&n.rangeTransform;if(t.max){var o=i?i(t.max):t.max;r.push(Or(e)+" < "+o)}if(t.min){var s=i?s=i(t.min):t.min;r.push(Or(e)+" >= "+s)}return Tr(r.join(" && "))}function Fr(e,t){let n=[];if(t.includes_any){const r="["+(Array.isArray(t.includes_any)?t.includes_any:[t.includes_any]).map(kr).join(",")+"]";n.push(`${Or(e)} != null && ${r}.some(function(v) { return ${Or(e)}.indexOf(v) > -1 })`)}if(t.includes_all){const r="["+(Array.isArray(t.includes_all)?t.includes_all:[t.includes_all]).map(kr).join(",")+"]";n.push(`${Or(e)} != null && ${r}.every(function(v) { return ${Or(e)}.indexOf(v) > -1 })`)}return Tr(n.join(" && "))}function Lr(e,t){var n=[];if("function"==typeof e)return[Tr(e.toString()+"(context)")];if(Array.isArray(e))return[Nr(0,e,t)];if(null==e)return["true"];for(var r=Object.keys(e),i=0;i<r.length;i++){var o=r[i],s=e[o],a=typeof s;if("string"===a||"number"===a)n.push(Ar(o,s));else if("boolean"===a)n.push(Ir(o,s));else if("not"===o)n.push(Mr(0,s,t));else if("any"===o)n.push(Nr(0,s,t));else if("all"===o)n.push(Pr(0,s,t));else if("none"===o)n.push(Dr(0,s,t));else if(Array.isArray(s))n.push(Cr(o,s));else if("object"===a&&null!=s)s.max||s.min?n.push(zr(o,s,t)):(s.includes_any||s.includes_all)&&n.push(Fr(o,s));else{if(null!=s)throw new Error("Unknown Query syntax: "+s);n.push(" true ")}}return 0===r.length?["true"]:n}function jr(e,t){return null==e?function(){return!0}:new Function("context","return "+Tr(Lr(e,t).join(" && "))+";")}Object.assign(wr,{name:"raster",super:et,built_in:!0,init(){this.raster=this.raster||"color",this.super.init.apply(this,arguments),this.selection=!1},_preprocess(e){return e.color=e.color||Q.defaults.color,this.super._preprocess.apply(this,arguments)}});const $r=["filter","draw","visible","enabled","data","exclusive","priority"];let Br={};function Vr(e,t){let n,r=0;for(let t=0;t<e.length;t++)e[t].length>r&&(r=e[t].length);if(0===r)return null;let i={visible:!0};for(let o=0;o<r;o++)n=[],e.forEach(e=>{e[o]&&e[o][t]&&-1===n.indexOf(e[o][t])&&n.push(e[o][t])}),0!==n.length&&V(i,...n);return!1===i.visible?null:i}const Ur=["any","all","not","none"];class Wr{constructor({layer:e,name:t,parent:n,draw:r,visible:i,enabled:o,filter:s,exclusive:a,priority:l,styles:u}){if(this.id=Wr.id++,this.config_data=e.data,this.parent=n,this.name=t,this.full_name=this.parent?this.parent.full_name+":"+this.name:this.name,this.draw=r,this.filter=s,this.exclusive=!0===a,this.priority=null!=l?l:Number.MAX_SAFE_INTEGER,this.styles=u,this.is_built=!1,o=void 0===o?i:o,this.enabled=!1!==o,this.draw)for(let e in this.draw)if(this.draw[e]=null==this.draw[e]?{}:this.draw[e],"object"!=typeof this.draw[e]){let t=`Draw group '${e}' for layer ${this.full_name} is invalid, must be an object, `;t+=`but was set to \`${e}: ${this.draw[e]}\` instead`,g("warn",t),delete this.draw[e]}}build(){g("trace",`Building layer '${this.full_name}'`),this.buildFilter(),this.buildDraw(),this.is_built=!0}buildDraw(){this.draw=Y(this.draw,Q.wrapFunction),this.calculatedDraw=function(e){let t=[];if(e.parent){let n=e.parent.calculatedDraw||[];t.push(...n)}return t.push(e.draw),t}(this)}buildFilter(){this.filter_original=this.filter,this.filter=Y(this.filter,Q.wrapFunction);let e=typeof this.filter;if(null!=this.filter&&"object"!==e&&"function"!==e){let e=`Filter for layer ${this.full_name} is invalid, filter value must be an object or function, `;return e+=`but was set to \`filter: ${this.filter}\` instead`,void g("warn",e)}try{this.buildZooms(),this.buildPropMatches(),null!=this.filter&&("function"==typeof this.filter||Object.keys(this.filter).length>0)?this.filter=jr(this.filter,Hr):this.filter=null}catch(e){let t=`Filter for layer ${this.full_name} is invalid, \`filter: ${JSON.stringify(this.filter)}\` `;t+=`failed with error '${e.message}', stack trace: ${e.stack}`,g("warn",t)}}buildZooms(){let e=this.filter&&this.filter.$zoom,t=typeof e;if(null!=e){if(this.zooms={},"number"===t)this.zooms[e]=!0;else if(Array.isArray(e))for(let t=0;t<e.length;t++)this.zooms[e[t]]=!0;else if("object"===t&&(null!=e.min||null!=e.max)){let t=e.min||0,n=e.max||U.max_style_zoom;for(let e=t;e<n;e++)this.zooms[e]=!0}delete this.filter.$zoom}}buildPropMatches(){this.filter&&!Array.isArray(this.filter)&&"function"!=typeof this.filter&&Object.keys(this.filter).forEach(e=>{if(-1===Ur.indexOf(e)){let t=this.filter[e],n=typeof t,r=Array.isArray(t);if(!r&&"string"!==n&&"number"!==n)return;"$"===e[0]?(this.context_prop_matches=this.context_prop_matches||[],this.context_prop_matches.push([e.substring(1),r?t:[t]]),delete this.filter[e]):-1===e.indexOf(".")&&(this.feature_prop_matches=this.feature_prop_matches||[],this.feature_prop_matches.push([e,r?t:[t]]),delete this.filter[e])}})}doPropMatches(e){if(this.feature_prop_matches)for(let t=0;t<this.feature_prop_matches.length;t++){let n=this.feature_prop_matches[t],r=e.feature.properties[n[0]];if(null==r||-1===n[1].indexOf(r))return!1}if(this.context_prop_matches)for(let t=0;t<this.context_prop_matches.length;t++){let n=this.context_prop_matches[t],r=e[n[0]];if(null==r||-1===n[1].indexOf(r))return!1}return!0}doesMatch(e){if(!this.enabled)return!1;if(this.is_built||this.build(),null!=this.zooms&&!this.zooms[e.zoom])return!1;if(!this.doPropMatches(e))return!1;let t;if(this.filter instanceof Function)try{t=this.filter(e)}catch(t){let n=`Filter for this ${this.full_name}: \`filter: ${this.filter_original}\` `;n+=`failed with error '${t.message}', stack trace: ${t.stack}`,g("error",n,e.feature)}else t=null==this.filter;return!!t&&(this.children_to_parse&&(function(e,t,n){for(let r in t){let i=t[r];if("object"!=typeof i||Array.isArray(i)){let t=`Layer value must be an object: cannot create layer '${r}: ${JSON.stringify(i)}'`;t+=`, under parent layer '${e.full_name}'.`,n[e.name]&&(t+=` The parent name '${e.name}' is also the name of a style, did you mean to create a 'draw' group`,e.parent&&(t+=` under '${e.parent.name}'`),t+=" instead?"),g("warn",t)}else Kr(r,i,e,n)}e.layers.sort((e,t)=>{if(e.exclusive<t.exclusive)return 1;if(e.exclusive>t.exclusive)return-1;const n=e.exclusive?1:-1;return e.priority>t.priority?n:e.priority<t.priority?-n:e.full_name<t.full_name?n:e.full_name>t.full_name?-n:void 0})}(this,this.children_to_parse,this.styles),delete this.children_to_parse),!0)}}Wr.id=0;class qr extends Wr{constructor(e){super(e),this.is_leaf=!0}}class Gr extends Wr{constructor(e){super(e),this.is_tree=!0,this.layers=e.layers||[]}addLayer(e){this.layers.push(e)}buildDrawGroups(e){let t=[],n=[];if(Xr(e,[this],t,n),t.length>0){let e=function(e){if(e.length>1){for(var t=e[0],n=1;n<e.length;n++)t+="/"+e[n];return t}return e[0]}(n);if(void 0===Br[e]){let n=t.map(e=>e&&!1!==e.visible&&e.calculatedDraw),r={};for(let e=0;e<n.length;e++){let t=n[e];if(t)for(let e=0;e<t.length;e++){let n=t[e];for(let e in n)r[e]=!0}}for(let i in r)Br[e]=Br[e]||{},Br[e][i]=Vr(n,i),Br[e][i]?(Br[e][i].key=e+"/"+i,Br[e][i].layers=t.map(e=>e&&e.full_name),Br[e][i].group=i):delete Br[e][i];Br[e]&&0===Object.keys(Br[e]).length&&(Br[e]=null)}return Br[e]}}}const Hr={rangeTransform:e=>"string"==typeof e&&"px2"===e.trim().slice(-3)?`${parseFloat(e)} * context.meters_per_pixel_sq`:e};function Yr(e){return $r.indexOf(e)>-1}function Kr(e,t,n,r){let i={name:e,layer:t=null==t?{}:t,parent:n,styles:r},[o,s]=function(e){let t={},n={};for(let r in e)Yr(r)?t[r]=e[r]:n[r]=e[r];return[t,n]}(t),a=(l=s,0===Object.keys(l).length);var l;let u;u=a&&null!=n?qr:Gr;let c=new u(Object.assign(i,o));return c.enabled&&(n&&n.addLayer(c),c.children_to_parse=a?null:s),c}function Xr(e,t,n,r){let i=!1,o=!1;if(0!==t.length){for(let s=0;s<t.length;s++){let a=t[s];if(a.is_leaf){if(a.doesMatch(e)&&(i=!0,n.push(a),r.push(a.id),a.exclusive))break}else if(a.is_tree&&a.doesMatch(e)&&(i=!0,o=Xr(e,a.layers,n,r),o||(n.push(a),r.push(a.id)),a.exclusive))break}return i}}function Zr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Jr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Zr(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}let Qr=0,ei=0;class ti{constructor({coords:e,style_z:t,source:n,workers:r,view:i}){this.id=Qr++,this.view=i,this.source=n,this.generation=null,this.valid=!0,this.visible=!1,this.proxy_for=null,this.proxied_as=null,this.proxy_level=0,this.proxy_order_offset=0,this.fade_in=!0,this.loading=!1,this.loaded=!1,this.built=!1,this.labeled=!1,this.error=null,this.debug={},this.style_z=t,this.coords=ke.normalizedCoord(e,this.source),this.key=ke.key(this.coords,this.source,this.style_z),this.overzoom=Math.max(this.style_z-this.coords.z,0),this.overzoom2=Math.pow(2,this.overzoom),this.min=U.metersForTile(this.coords),this.max=U.metersForTile({x:this.coords.x+1,y:this.coords.y+1,z:this.coords.z}),this.span={x:this.max.x-this.min.x,y:-(this.max.y-this.min.y)},this.bounds={sw:{x:this.min.x,y:this.max.y},ne:{x:this.max.x,y:this.min.y}},this.meters_per_pixel=U.metersPerPixel(this.style_z),this.meters_per_pixel_sq=this.meters_per_pixel*this.meters_per_pixel,this.units_per_pixel=U.units_per_pixel/this.overzoom2,this.units_per_meter_overzoom=U.unitsPerMeter(this.coords.z)*this.overzoom2,this.preserve_tiles_within_zoom=this.source.preserve_tiles_within_zoom,this.meshes={},this.new_mesh_styles=[],this.pending_label_meshes=null,this.setWorker(r)}freeResources(){for(let e in this.meshes)this.meshes[e].forEach(e=>e.destroy());if(this.meshes={},this.pending_label_meshes)for(let e in this.pending_label_meshes)this.pending_label_meshes[e].forEach(e=>e.destroy());this.pending_label_meshes=null}destroy(){S.removeForTile(this.id),this.workerMessage("self.removeTile",this.key),this.freeResources(),this.worker=null,this.valid=!1}buildAsMessage(){return{id:this.id,key:this.key,source:this.source.name,coords:this.coords,min:this.min,max:this.max,units_per_pixel:this.units_per_pixel,meters_per_pixel:this.meters_per_pixel,meters_per_pixel_sq:this.meters_per_pixel_sq,units_per_meter_overzoom:this.units_per_meter_overzoom,style_z:this.style_z,overzoom:this.overzoom,overzoom2:this.overzoom2,generation:this.generation,debug:this.debug}}setWorker(e){this.source.tiled?this.worker_id=Math.abs(this.coords.x+this.coords.y+this.coords.z)%e.length:this.worker_id=this.source.id%e.length,this.worker=e[this.worker_id]}workerMessage(...e){return a.postMessage(this.worker,...e)}build(e,{fade_in:t=!0}={}){return this.generation=e,this.fade_in=t,this.loaded||(this.loading=!0,this.built=!1,this.labeled=!1),this.workerMessage("self.buildTile",{tile:this.buildAsMessage()}).catch(e=>{throw e})}static cancel(e){e&&(e.canceled=!0,e.source_data&&e.source_data.request_id&&(y.cancelRequest(e.source_data.request_id),e.source_data.request_id=null),ti.abortBuild(e))}static buildGeometry(e,{scene_id:t,layers:n,styles:r,global:i}){let o=e.source_data;e.debug.building=+new Date,e.debug.feature_count=0,e.debug.layers=null,Wt.startTile(e.id,{apply_repeat_groups:!0});for(let t in n){let s=n[t];if(!s||!s.config_data){g("warn",`Layer ${t} was defined without a geometry data source and will not be rendered.`);continue}if(s.config_data.source!==e.source)continue;let a=ti.getDataForSource(o,s.config_data,t);for(let n=0;n<a.length;n++){let o=a[n],l=o.geom;if(l)for(let n=0;n<l.features.length;n++){let a=l.features[n];if(null==a.geometry)continue;let u=Q.getFeatureParseContext(a,e,i);u.winding=e.default_winding,u.source=e.source,u.layer=o.layer;let c=s.buildDrawGroups(u,!0);if(c){for(let e in c){let n=c[e],i=n.style||e,o=r[i];o?(n=o.preprocess(n),null!=n&&!1!==n.visible&&(u.layers=n.layers,o.addFeature(a,n,u))):g("warn",`Style '${i}' not found, skipping layer '${t}':`,n,a)}e.debug.feature_count++}}}}e.debug.building=+new Date-e.debug.building;let s=this.stylesForTile(e,r).map(e=>r[e]);ti.buildStyleGroups(e,s,t,e=>e.collision?"collision":"non-collision")}static stylesForTile(e,t){let n=[];for(let r in t)t[r].hasDataForTile(e)&&n.push(r);return n}static buildStyleGroups(e,t,n,r){const i=t.reduce((e,t)=>{const n=r(t);return e[n]=e[n]||[],e[n].push(t),e},{});if(0===Object.keys(i).length)return a.postMessage(`TileManager_${n}.buildTileStylesCompleted`,a.withTransferables({tile:ti.slice(e),progress:{start:!0,done:!0}})),void Wt.resetTile(e.id);const o={};for(const t in i)ti.buildStyleGroup({group_name:t,groups:i,tile:e,progress:o,scene_id:n})}static async buildStyleGroup({group_name:e,groups:t,tile:n,progress:r,scene_id:i}){const o=t[e],s={};try{await Promise.all(o.map(async function(e){const t=await e.endData(n);t&&(s[e.name]=t)})),g("trace",`Finished style group '${e}' for tile ${n.key}`),t[e]=null,Object.keys(t).every(e=>null==t[e])&&(r.done=!0),a.postMessage(`TileManager_${i}.buildTileStylesCompleted`,a.withTransferables({tile:Jr(Jr({},ti.slice(n)),{},{mesh_data:s}),progress:r})),r.done&&Wt.resetTile(n.id)}catch(t){g("error",`Error for style group '${e}' for tile ${n.key}`,t&&t.stack||t)}}static getDataForSource(e,t,n){var r=[];if(null!=t&&null!=e&&null!=e.layers)if(!0===t.all_layers){null!=t.layer&&g({level:"warn",once:!0},`Layer ${n} includes both 'all_layers: true' and an explicit 'layer' keyword in its 'data' block. 'all_layers: true' takes precedence, 'layer' will be ignored.`);for(const t in e.layers)r.push({layer:t,geom:e.layers[t]})}else!t.layer&&e.layers._default?r.push({geom:e.layers._default}):!t.layer&&n?r.push({layer:n,geom:e.layers[n]}):"string"==typeof t.layer?r.push({layer:t.layer,geom:e.layers[t.layer]}):Array.isArray(t.layer)&&t.layer.forEach(t=>{r.push({layer:t,geom:e.layers[t]})});return r}buildMeshes(e,t){if(this.error)return;this.build_id=ei++,t.start&&(this.debug.geometry_count=0,this.debug.buffer_size=0);let n={},r=this.mesh_data;if(r)for(let t in r){for(let i in r[t].meshes){let o=r[t].meshes[i];if(o.vertex_data){if(!e[t]){g("warn",`Could not create mesh because style '${t}' not found, for tile ${this.key}, aborting tile`);break}let i=Object.assign({},r[t]);i.uniforms=Object.assign({},i.uniforms,o.uniforms),i.variant=o.variant,o.labels&&(i.retain=!0);let s=e[t].makeMesh(o.vertex_data,o.vertex_elements,i);s.variant=i.variant,s.labels=o.labels,n[t]=n[t]||[],n[t].push(s),null==s.variant.mesh_order&&(s.variant.mesh_order=n[t].length-1),this.debug.buffer_size+=s.buffer_size,this.debug.geometry_count+=s.geometry_count}}n[t]&&n[t].sort((e,t)=>{let n=e.variant.mesh_order,r=t.variant.mesh_order;return null==n?1:null==r||n<r?-1:1})}delete this.mesh_data;for(let t in n)e[t].collision?(this.pending_label_meshes=this.pending_label_meshes||{},this.pending_label_meshes[t]=n[t]):(this.meshes[t]&&this.meshes[t].forEach(e=>e.destroy()),this.meshes[t]=n[t],this.new_mesh_styles.push(t));if(t.done){for(let e in this.meshes)-1!==this.new_mesh_styles.indexOf(e)||this.pending_label_meshes&&null!=this.pending_label_meshes[e]||(this.meshes[e].forEach(e=>e.destroy()),delete this.meshes[e]);this.new_mesh_styles=[],this.debug.geometry_ratio=(this.debug.geometry_count/this.debug.feature_count).toFixed(1)}this.printDebug(t)}pendingLabelStyleCount(){return this.pending_label_meshes?Object.keys(this.pending_label_meshes).length:0}swapPendingLabels(){if(this.labeled=!0,this.pending_label_meshes){for(let e in this.pending_label_meshes)this.meshes[e]&&this.meshes[e].forEach(e=>e.destroy()),this.meshes[e]=this.pending_label_meshes[e];this.pending_label_meshes=null}}static abortBuild(e){if(S.removeForTile(e.id),Wt.abortTile(e.id),e.mesh_data)for(let t in e.mesh_data){let n=e.mesh_data[t].textures;n&&n.forEach(t=>{let n=O.textures[t];n&&(g("trace",`releasing texture ${t} for tile ${e.key}`),n.release())})}}setProxyFor(e){e?(this.visible=!0,this.proxy_for=this.proxy_for||[],this.proxy_for.push(e),this.proxy_order_offset=1,e.proxied_as=e.style_z>this.style_z?"child":"parent",this.proxy_level=Math.abs(e.style_z-this.style_z)):(this.proxy_for=null,this.proxy_order_offset=0,this.proxy_level=0)}isProxy(){return null!=this.proxy_for}shouldProxyForStyle(e){return!this.proxy_for||this.proxy_for.some(t=>null==t.meshes[e])}setupProgram({model:e,model32:t},n){n.uniform("4fv","u_tile_origin",[this.min.x,this.min.y,this.style_z,this.coords.z]),n.uniform("1f","u_tile_proxy_order_offset",this.proxy_order_offset),ir.identity(e),ir.translate(e,e,nr.fromValues(this.min.x,this.min.y,0)),ir.scale(e,e,nr.fromValues(this.span.x/U.tile_scale,this.span.y/U.tile_scale,1)),ir.copy(t,e),n.uniform("Matrix4fv","u_model",t),n.uniform("1i","u_tile_fade_in",this.fade_in&&"child"!==this.proxied_as)}static slice(e,t){let n=["id","key","loading","loaded","generation","error","debug"];Array.isArray(t)&&n.push(...t);var r={};for(let t=0;t<n.length;t++){const i=n[t];r[i]=e[i]}return r}merge(e){return this.loading=e.loading,this.loaded=e.loaded,this.generation=e.generation,this.error=e.error,this.mesh_data=e.mesh_data,this.debug=V(this.debug,e.debug),this}printDebug(e){const t=["layers"];let n={};for(let e in this.debug)-1===t.indexOf(e)&&(n[e]=this.debug[e]);g("debug",`Tile ${e.done?"(done)":""}: debug for ${this.key}: [ ${JSON.stringify(n)} ]`)}}function ni(e,t){for(let n in e){let r=e[n];Pe(t,n,r.features,r.geoms,r.styles,r.base),r.layers&&(t[n].layers=t[n].layers||{},ni(r.layers,t[n].layers))}}ti.coord_children={};var ri,ii,oi,si={};var ai,li,ui,ci,di,hi,pi,fi,mi,gi=function(){if(oi)return ii;oi=1,ii=t;var e=(ri||(ri=1,si.read=function(e,t,n,r,i){var o,s,a=8*i-r-1,l=(1<<a)-1,u=l>>1,c=-7,d=n?i-1:0,h=n?-1:1,p=e[t+d];for(d+=h,o=p&(1<<-c)-1,p>>=-c,c+=a;c>0;o=256*o+e[t+d],d+=h,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=r;c>0;s=256*s+e[t+d],d+=h,c-=8);if(0===o)o=1-u;else{if(o===l)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=u}return(p?-1:1)*s*Math.pow(2,o-r)},si.write=function(e,t,n,r,i,o){var s,a,l,u=8*o-i-1,c=(1<<u)-1,d=c>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,f=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+d>=1?h/l:h*Math.pow(2,1-d))*l>=2&&(s++,l/=2),s+d>=c?(a=0,s=c):s+d>=1?(a=(t*l-1)*Math.pow(2,i),s+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,i),s=0));i>=8;e[n+p]=255&a,p+=f,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;e[n+p]=255&s,p+=f,s/=256,u-=8);e[n+p-f]|=128*m}),si);function t(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}t.Varint=0,t.Fixed64=1,t.Bytes=2,t.Fixed32=5;var n=4294967296,r=1/n;function i(e){return e.type===t.Bytes?e.readVarint()+e.pos:e.pos+1}function o(e,t,n){return n?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function s(e,t,n){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.ceil(Math.log(t)/(7*Math.LN2));n.realloc(r);for(var i=n.pos-1;i>=e;i--)n.buf[i+r]=n.buf[i]}function a(e,t){for(var n=0;n<e.length;n++)t.writeVarint(e[n])}function l(e,t){for(var n=0;n<e.length;n++)t.writeSVarint(e[n])}function u(e,t){for(var n=0;n<e.length;n++)t.writeFloat(e[n])}function c(e,t){for(var n=0;n<e.length;n++)t.writeDouble(e[n])}function d(e,t){for(var n=0;n<e.length;n++)t.writeBoolean(e[n])}function h(e,t){for(var n=0;n<e.length;n++)t.writeFixed32(e[n])}function p(e,t){for(var n=0;n<e.length;n++)t.writeSFixed32(e[n])}function f(e,t){for(var n=0;n<e.length;n++)t.writeFixed64(e[n])}function m(e,t){for(var n=0;n<e.length;n++)t.writeSFixed64(e[n])}function g(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+16777216*e[t+3]}function y(e,t,n){e[n]=t,e[n+1]=t>>>8,e[n+2]=t>>>16,e[n+3]=t>>>24}function b(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}return t.prototype={destroy:function(){this.buf=null},readFields:function(e,t,n){for(n=n||this.length;this.pos<n;){var r=this.readVarint(),i=r>>3,o=this.pos;this.type=7&r,e(i,t,this),this.pos===o&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=g(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=b(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=g(this.buf,this.pos)+g(this.buf,this.pos+4)*n;return this.pos+=8,e},readSFixed64:function(){var e=g(this.buf,this.pos)+b(this.buf,this.pos+4)*n;return this.pos+=8,e},readFloat:function(){var t=e.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=e.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(e){var t,n,r=this.buf;return t=127&(n=r[this.pos++]),n<128?t:(t|=(127&(n=r[this.pos++]))<<7,n<128?t:(t|=(127&(n=r[this.pos++]))<<14,n<128?t:(t|=(127&(n=r[this.pos++]))<<21,n<128?t:function(e,t,n){var r,i,s=n.buf;if(r=(112&(i=s[n.pos++]))>>4,i<128)return o(e,r,t);if(r|=(127&(i=s[n.pos++]))<<3,i<128)return o(e,r,t);if(r|=(127&(i=s[n.pos++]))<<10,i<128)return o(e,r,t);if(r|=(127&(i=s[n.pos++]))<<17,i<128)return o(e,r,t);if(r|=(127&(i=s[n.pos++]))<<24,i<128)return o(e,r,t);if(r|=(1&(i=s[n.pos++]))<<31,i<128)return o(e,r,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(n=r[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=function(e,t,n){for(var r="",i=t;i<n;){var o,s,a,l=e[i],u=null,c=l>239?4:l>223?3:l>191?2:1;if(i+c>n)break;1===c?l<128&&(u=l):2===c?128==(192&(o=e[i+1]))&&(u=(31&l)<<6|63&o)<=127&&(u=null):3===c?(o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&((u=(15&l)<<12|(63&o)<<6|63&s)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&((u=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,r+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),r+=String.fromCharCode(u),i+=c}return r}(this.buf,this.pos,e);return this.pos=e,t},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){var n=i(this);for(e=e||[];this.pos<n;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){var t=i(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){var t=i(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){var t=i(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){var t=i(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){var t=i(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){var t=i(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){var t=i(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){var t=i(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var n=7&e;if(n===t.Varint)for(;this.buf[this.pos++]>127;);else if(n===t.Bytes)this.pos=this.readVarint()+this.pos;else if(n===t.Fixed32)this.pos+=4;else{if(n!==t.Fixed64)throw new Error("Unimplemented type: "+n);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var n=new Uint8Array(t);n.set(this.buf),this.buf=n,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),y(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),y(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),y(this.buf,-1&e,this.pos),y(this.buf,Math.floor(e*r),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),y(this.buf,-1&e,this.pos),y(this.buf,Math.floor(e*r),this.pos+4),this.pos+=8},writeVarint:function(e){(e=+e||0)>268435455||e<0?function(e,t){var n,r;if(e>=0?(n=e%4294967296|0,r=e/4294967296|0):(r=~(-e/4294967296),4294967295^(n=~(-e%4294967296))?n=n+1|0:(n=0,r=r+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,n){n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos]=127&e}(n,0,t),function(e,t){var n=(7&e)<<4;t.buf[t.pos++]|=n|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(r,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,n){for(var r,i,o=0;o<t.length;o++){if((r=t.charCodeAt(o))>55295&&r<57344){if(!i){r>56319||o+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):i=r;continue}if(r<56320){e[n++]=239,e[n++]=191,e[n++]=189,i=r;continue}r=i-55296<<10|r-56320|65536,i=null}else i&&(e[n++]=239,e[n++]=191,e[n++]=189,i=null);r<128?e[n++]=r:(r<2048?e[n++]=r>>6|192:(r<65536?e[n++]=r>>12|224:(e[n++]=r>>18|240,e[n++]=r>>12&63|128),e[n++]=r>>6&63|128),e[n++]=63&r|128)}return n}(this.buf,e,this.pos);var n=this.pos-t;n>=128&&s(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n},writeFloat:function(t){this.realloc(4),e.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),e.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var n=0;n<t;n++)this.buf[this.pos++]=e[n]},writeRawMessage:function(e,t){this.pos++;var n=this.pos;e(t,this);var r=this.pos-n;r>=128&&s(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,n,r){this.writeTag(e,t.Bytes),this.writeRawMessage(n,r)},writePackedVarint:function(e,t){this.writeMessage(e,a,t)},writePackedSVarint:function(e,t){this.writeMessage(e,l,t)},writePackedBoolean:function(e,t){this.writeMessage(e,d,t)},writePackedFloat:function(e,t){this.writeMessage(e,u,t)},writePackedDouble:function(e,t){this.writeMessage(e,c,t)},writePackedFixed32:function(e,t){this.writeMessage(e,h,t)},writePackedSFixed32:function(e,t){this.writeMessage(e,p,t)},writePackedFixed64:function(e,t){this.writeMessage(e,f,t)},writePackedSFixed64:function(e,t){this.writeMessage(e,m,t)},writeBytesField:function(e,n){this.writeTag(e,t.Bytes),this.writeBytes(n)},writeFixed32Field:function(e,n){this.writeTag(e,t.Fixed32),this.writeFixed32(n)},writeSFixed32Field:function(e,n){this.writeTag(e,t.Fixed32),this.writeSFixed32(n)},writeFixed64Field:function(e,n){this.writeTag(e,t.Fixed64),this.writeFixed64(n)},writeSFixed64Field:function(e,n){this.writeTag(e,t.Fixed64),this.writeSFixed64(n)},writeVarintField:function(e,n){this.writeTag(e,t.Varint),this.writeVarint(n)},writeSVarintField:function(e,n){this.writeTag(e,t.Varint),this.writeSVarint(n)},writeStringField:function(e,n){this.writeTag(e,t.Bytes),this.writeString(n)},writeFloatField:function(e,n){this.writeTag(e,t.Fixed32),this.writeFloat(n)},writeDoubleField:function(e,n){this.writeTag(e,t.Fixed64),this.writeDouble(n)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}},ii}(),yi=P(gi),bi={};function vi(){if(ci)return ui;ci=1;var e=function(){if(li)return ai;function e(e,t){this.x=e,this.y=t}return li=1,ai=e,e.prototype={clone:function(){return new e(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},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(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,n=e.y-this.y;return t*t+n*n},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[0]*this.x+e[1]*this.y,n=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=n,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),n=Math.sin(e),r=t*this.x-n*this.y,i=n*this.x+t*this.y;return this.x=r,this.y=i,this},_rotateAround:function(e,t){var n=Math.cos(e),r=Math.sin(e),i=t.x+n*(this.x-t.x)-r*(this.y-t.y),o=t.y+r*(this.x-t.x)+n*(this.y-t.y);return this.x=i,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},e.convert=function(t){return t instanceof e?t:Array.isArray(t)?new e(t[0],t[1]):t},ai}();function t(e,t,r,i,o){this.properties={},this.extent=r,this.type=0,this._pbf=e,this._geometry=-1,this._keys=i,this._values=o,e.readFields(n,this,t)}function n(e,t,n){1==e?t.id=n.readVarint():2==e?function(e,t){for(var n=e.readVarint()+e.pos;e.pos<n;){var r=t._keys[e.readVarint()],i=t._values[e.readVarint()];t.properties[r]=i}}(n,t):3==e?t.type=n.readVarint():4==e&&(t._geometry=n.pos)}function r(e){for(var t,n,r=0,i=0,o=e.length,s=o-1;i<o;s=i++)t=e[i],r+=((n=e[s]).x-t.x)*(t.y+n.y);return r}return ui=t,t.types=["Unknown","Point","LineString","Polygon"],t.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var n,r=t.readVarint()+t.pos,i=1,o=0,s=0,a=0,l=[];t.pos<r;){if(!o){var u=t.readVarint();i=7&u,o=u>>3}if(o--,1===i||2===i)s+=t.readSVarint(),a+=t.readSVarint(),1===i&&(n&&l.push(n),n=[]),n.push(new e(s,a));else{if(7!==i)throw new Error("unknown command "+i);n&&n.push(n[0].clone())}}return n&&l.push(n),l},t.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,n=1,r=0,i=0,o=0,s=1/0,a=-1/0,l=1/0,u=-1/0;e.pos<t;){if(!r){var c=e.readVarint();n=7&c,r=c>>3}if(r--,1===n||2===n)(i+=e.readSVarint())<s&&(s=i),i>a&&(a=i),(o+=e.readSVarint())<l&&(l=o),o>u&&(u=o);else if(7!==n)throw new Error("unknown command "+n)}return[s,l,a,u]},t.prototype.toGeoJSON=function(e,n,i){var o,s,a=this.extent*Math.pow(2,i),l=this.extent*e,u=this.extent*n,c=this.loadGeometry(),d=t.types[this.type];function h(e){for(var t=0;t<e.length;t++){var n=e[t],r=180-360*(n.y+u)/a;e[t]=[360*(n.x+l)/a-180,360/Math.PI*Math.atan(Math.exp(r*Math.PI/180))-90]}}switch(this.type){case 1:var p=[];for(o=0;o<c.length;o++)p[o]=c[o][0];h(c=p);break;case 2:for(o=0;o<c.length;o++)h(c[o]);break;case 3:for(c=function(e){var t=e.length;if(t<=1)return[e];for(var n,i,o=[],s=0;s<t;s++){var a=r(e[s]);0!==a&&(void 0===i&&(i=a<0),i===a<0?(n&&o.push(n),n=[e[s]]):n.push(e[s]))}return n&&o.push(n),o}(c),o=0;o<c.length;o++)for(s=0;s<c[o].length;s++)h(c[o][s])}1===c.length?c=c[0]:d="Multi"+d;var f={type:"Feature",geometry:{type:d,coordinates:c},properties:this.properties};return"id"in this&&(f.id=this.id),f},ui}function _i(){if(hi)return di;hi=1;var e=vi();function t(e,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(n,this,t),this.length=this._features.length}function n(e,t,n){15===e?t.version=n.readVarint():1===e?t.name=n.readString():5===e?t.extent=n.readVarint():2===e?t._features.push(n.pos):3===e?t._keys.push(n.readString()):4===e&&t._values.push(function(e){for(var t=null,n=e.readVarint()+e.pos;e.pos<n;){var r=e.readVarint()>>3;t=1===r?e.readString():2===r?e.readFloat():3===r?e.readDouble():4===r?e.readVarint64():5===r?e.readVarint():6===r?e.readSVarint():7===r?e.readBoolean():null}return t}(n))}return di=t,t.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var n=this._pbf.readVarint()+this._pbf.pos;return new e(this._pbf,n,this.extent,this._keys,this._values)},di}var xi=(mi||(mi=1,bi.VectorTile=function(){if(fi)return pi;fi=1;var e=_i();function t(t,n,r){if(3===t){var i=new e(r,r.readVarint()+r.pos);i.length&&(n[i.name]=i)}}return pi=function(e,n){this.layers=e.readFields(t,{},n)},pi}(),bi.VectorTileFeature=vi(),bi.VectorTileLayer=_i()),bi);const wi=["{","["];class Ei extends Te{constructor(e,t){super(e,t),this.response_type="arraybuffer",!0===e.parse_json?this.parse_json_type=1:Array.isArray(e.parse_json)?(this.parse_json_type=2,this.parse_json_prop_list=e.parse_json):(null!=e.parse_json&&g({level:"warn",once:!0},`Data source '${this.name}': 'parse_json' parameter should be 'true', or an array of property names (was '${JSON.stringify(e.parse_json)}')`),this.parse_json_type=0)}parseSourceData(e,t,n){var r=new Uint8Array(n),i=new yi(r);if(t.data=new xi.VectorTile(i),t.layers=this.toGeoJSON(t.data),"function"==typeof this.transform){const n={min:Object.assign({},e.min),max:Object.assign({},e.max),coords:Object.assign({},e.coords)};t.layers=this.transform(t.layers,this.extra_data,n)}delete t.data}toGeoJSON(e){var t={};for(var n in e.layers){for(var r=e.layers[n],i=U.tile_scale/r.extent,o={type:"FeatureCollection",features:[]},s=0;s<r.length;s++){var a=r.feature(s),l={type:"Feature",geometry:{},id:a.id,properties:a.properties};this.parseJSONProperties(l);for(var u=l.geometry,c=a.loadGeometry(),d=0;d<c.length;d++)for(var h=c[d],p=0;p<h.length;p++)h[p]=[h[p].x*i,h[p].y*i];u.coordinates=c,"Point"===xi.VectorTileFeature.types[a.type]?1===c.length?(u.type="Point",u.coordinates=u.coordinates[0][0]):(u.type="MultiPoint",u.coordinates=u.coordinates[0]):"LineString"===xi.VectorTileFeature.types[a.type]?1===c.length?(u.type="LineString",u.coordinates=u.coordinates[0]):u.type="MultiLineString":"Polygon"===xi.VectorTileFeature.types[a.type]&&(u=Si(u)),o.features.push(l)}t[n]=o}return t}parseJSONProperties(e){if(0!==this.parse_json_type){const t=e.properties;if(2===this.parse_json_type)this.parse_json_prop_list.forEach(e=>{try{t[e]=JSON.parse(t[e])}catch(e){}});else for(const n in t)if(wi.indexOf(t[n][0])>-1)try{t[n]=JSON.parse(t[n])}catch(e){}}}}function Si(e){let t,n=[],r=[];for(let i=0;i<e.coordinates.length;i++){let o=e.coordinates[i],s=U.ringWinding(o);null!=s&&(t=t||s,s===t&&r.length>0&&(n.push(r),r=[]),r.push(o))}return r.length>0&&n.push(r),1===n.length?(e.type="Polygon",e.coordinates=n[0]):n.length>1?(e.type="MultiPolygon",e.coordinates=n):e=null,e}function Ti(e,t,n,r){for(var i,o=r,s=n-t>>1,a=n-t,l=e[t],u=e[t+1],c=e[n],d=e[n+1],h=t+3;h<n;h+=3){var p=ki(e[h],e[h+1],l,u,c,d);if(p>o)i=h,o=p;else if(p===o){var f=Math.abs(h-s);f<a&&(i=h,a=f)}}o>r&&(i-t>3&&Ti(e,t,i,r),e[i+2]=o,n-i>3&&Ti(e,i,n,r))}function ki(e,t,n,r,i,o){var s=i-n,a=o-r;if(0!==s||0!==a){var l=((e-n)*s+(t-r)*a)/(s*s+a*a);l>1?(n=i,r=o):l>0&&(n+=s*l,r+=a*l)}return(s=e-n)*s+(a=t-r)*a}function Oi(e,t,n,r){var i={id:void 0===e?null:e,type:t,geometry:n,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(e){var t=e.geometry,n=e.type;if("Point"===n||"MultiPoint"===n||"LineString"===n)Ai(e,t);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r<t.length;r++)Ai(e,t[r]);else if("MultiPolygon"===n)for(r=0;r<t.length;r++)for(var i=0;i<t[r].length;i++)Ai(e,t[r][i])}(i),i}function Ai(e,t){for(var n=0;n<t.length;n+=3)e.minX=Math.min(e.minX,t[n]),e.minY=Math.min(e.minY,t[n+1]),e.maxX=Math.max(e.maxX,t[n]),e.maxY=Math.max(e.maxY,t[n+1])}function Ci(e,t,n,r){if(t.geometry){var i=t.geometry.coordinates,o=t.geometry.type,s=Math.pow(n.tolerance/((1<<n.maxZoom)*n.extent),2),a=[],l=t.id;if(n.promoteId?l=t.properties[n.promoteId]:n.generateId&&(l=r||0),"Point"===o)Ri(i,a);else if("MultiPoint"===o)for(var u=0;u<i.length;u++)Ri(i[u],a);else if("LineString"===o)Ni(i,a,s,!1);else if("MultiLineString"===o){if(n.lineMetrics){for(u=0;u<i.length;u++)a=[],Ni(i[u],a,s,!1),e.push(Oi(l,"LineString",a,t.properties));return}Pi(i,a,s,!1)}else if("Polygon"===o)Pi(i,a,s,!0);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(u=0;u<t.geometry.geometries.length;u++)Ci(e,{id:l,geometry:t.geometry.geometries[u],properties:t.properties},n,r);return}throw new Error("Input data is not a valid GeoJSON object.")}for(u=0;u<i.length;u++){var c=[];Pi(i[u],c,s,!0),a.push(c)}}e.push(Oi(l,o,a,t.properties))}}function Ri(e,t){t.push(Mi(e[0])),t.push(Di(e[1])),t.push(0)}function Ni(e,t,n,r){for(var i,o,s=0,a=0;a<e.length;a++){var l=Mi(e[a][0]),u=Di(e[a][1]);t.push(l),t.push(u),t.push(0),a>0&&(s+=r?(i*u-l*o)/2:Math.sqrt(Math.pow(l-i,2)+Math.pow(u-o,2))),i=l,o=u}var c=t.length-3;t[2]=1,Ti(t,0,c,n),t[c+2]=1,t.size=Math.abs(s),t.start=0,t.end=t.size}function Pi(e,t,n,r){for(var i=0;i<e.length;i++){var o=[];Ni(e[i],o,n,r),t.push(o)}}function Mi(e){return e/360+.5}function Di(e){var t=Math.sin(e*Math.PI/180),n=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return n<0?0:n>1?1:n}function Ii(e,t,n,r,i,o,s,a){if(r/=t,o>=(n/=t)&&s<r)return e;if(s<n||o>=r)return null;for(var l=[],u=0;u<e.length;u++){var c=e[u],d=c.geometry,h=c.type,p=0===i?c.minX:c.minY,f=0===i?c.maxX:c.maxY;if(p>=n&&f<r)l.push(c);else if(!(f<n||p>=r)){var m=[];if("Point"===h||"MultiPoint"===h)zi(d,m,n,r,i);else if("LineString"===h)Fi(d,m,n,r,i,!1,a.lineMetrics);else if("MultiLineString"===h)ji(d,m,n,r,i,!1);else if("Polygon"===h)ji(d,m,n,r,i,!0);else if("MultiPolygon"===h)for(var g=0;g<d.length;g++){var y=[];ji(d[g],y,n,r,i,!0),y.length&&m.push(y)}if(m.length){if(a.lineMetrics&&"LineString"===h){for(g=0;g<m.length;g++)l.push(Oi(c.id,h,m[g],c.tags));continue}"LineString"!==h&&"MultiLineString"!==h||(1===m.length?(h="LineString",m=m[0]):h="MultiLineString"),"Point"!==h&&"MultiPoint"!==h||(h=3===m.length?"Point":"MultiPoint"),l.push(Oi(c.id,h,m,c.tags))}}}return l.length?l:null}function zi(e,t,n,r,i){for(var o=0;o<e.length;o+=3){var s=e[o+i];s>=n&&s<=r&&(t.push(e[o]),t.push(e[o+1]),t.push(e[o+2]))}}function Fi(e,t,n,r,i,o,s){for(var a,l,u=Li(e),c=0===i?Bi:Vi,d=e.start,h=0;h<e.length-3;h+=3){var p=e[h],f=e[h+1],m=e[h+2],g=e[h+3],y=e[h+4],b=0===i?p:f,v=0===i?g:y,_=!1;s&&(a=Math.sqrt(Math.pow(p-g,2)+Math.pow(f-y,2))),b<n?v>n&&(l=c(u,p,f,g,y,n),s&&(u.start=d+a*l)):b>r?v<r&&(l=c(u,p,f,g,y,r),s&&(u.start=d+a*l)):$i(u,p,f,m),v<n&&b>=n&&(l=c(u,p,f,g,y,n),_=!0),v>r&&b<=r&&(l=c(u,p,f,g,y,r),_=!0),!o&&_&&(s&&(u.end=d+a*l),t.push(u),u=Li(e)),s&&(d+=a)}var x=e.length-3;p=e[x],f=e[x+1],m=e[x+2],(b=0===i?p:f)>=n&&b<=r&&$i(u,p,f,m),x=u.length-3,o&&x>=3&&(u[x]!==u[0]||u[x+1]!==u[1])&&$i(u,u[0],u[1],u[2]),u.length&&t.push(u)}function Li(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function ji(e,t,n,r,i,o){for(var s=0;s<e.length;s++)Fi(e[s],t,n,r,i,o,!1)}function $i(e,t,n,r){e.push(t),e.push(n),e.push(r)}function Bi(e,t,n,r,i,o){var s=(o-t)/(r-t);return e.push(o),e.push(n+(i-n)*s),e.push(1),s}function Vi(e,t,n,r,i,o){var s=(o-n)/(i-n);return e.push(t+(r-t)*s),e.push(o),e.push(1),s}function Ui(e,t){for(var n=[],r=0;r<e.length;r++){var i,o=e[r],s=o.type;if("Point"===s||"MultiPoint"===s||"LineString"===s)i=Wi(o.geometry,t);else if("MultiLineString"===s||"Polygon"===s){i=[];for(var a=0;a<o.geometry.length;a++)i.push(Wi(o.geometry[a],t))}else if("MultiPolygon"===s)for(i=[],a=0;a<o.geometry.length;a++){for(var l=[],u=0;u<o.geometry[a].length;u++)l.push(Wi(o.geometry[a][u],t));i.push(l)}n.push(Oi(o.id,s,i,o.tags))}return n}function Wi(e,t){var n=[];n.size=e.size,void 0!==e.start&&(n.start=e.start,n.end=e.end);for(var r=0;r<e.length;r+=3)n.push(e[r]+t,e[r+1],e[r+2]);return n}function qi(e,t){if(e.transformed)return e;var n,r,i,o=1<<e.z,s=e.x,a=e.y;for(n=0;n<e.features.length;n++){var l=e.features[n],u=l.geometry,c=l.type;if(l.geometry=[],1===c)for(r=0;r<u.length;r+=2)l.geometry.push(Gi(u[r],u[r+1],t,o,s,a));else for(r=0;r<u.length;r++){var d=[];for(i=0;i<u[r].length;i+=2)d.push(Gi(u[r][i],u[r][i+1],t,o,s,a));l.geometry.push(d)}}return e.transformed=!0,e}function Gi(e,t,n,r,i,o){return[Math.round(n*(e*r-i)),Math.round(n*(t*r-o))]}function Hi(e,t,n,r,i){for(var o=t===i.maxZoom?0:i.tolerance/((1<<t)*i.extent),s={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:n,y:r,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},a=0;a<e.length;a++){s.numFeatures++,Yi(s,e[a],o,i);var l=e[a].minX,u=e[a].minY,c=e[a].maxX,d=e[a].maxY;l<s.minX&&(s.minX=l),u<s.minY&&(s.minY=u),c>s.maxX&&(s.maxX=c),d>s.maxY&&(s.maxY=d)}return s}function Yi(e,t,n,r){var i=t.geometry,o=t.type,s=[];if("Point"===o||"MultiPoint"===o)for(var a=0;a<i.length;a+=3)s.push(i[a]),s.push(i[a+1]),e.numPoints++,e.numSimplified++;else if("LineString"===o)Ki(s,i,e,n,!1,!1);else if("MultiLineString"===o||"Polygon"===o)for(a=0;a<i.length;a++)Ki(s,i[a],e,n,"Polygon"===o,0===a);else if("MultiPolygon"===o)for(var l=0;l<i.length;l++){var u=i[l];for(a=0;a<u.length;a++)Ki(s,u[a],e,n,!0,0===a)}if(s.length){var c=t.tags||null;if("LineString"===o&&r.lineMetrics){for(var d in c={},t.tags)c[d]=t.tags[d];c.mapbox_clip_start=i.start/i.size,c.mapbox_clip_end=i.end/i.size}var h={geometry:s,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:c};null!==t.id&&(h.id=t.id),e.features.push(h)}}function Ki(e,t,n,r,i,o){var s=r*r;if(r>0&&t.size<(i?s:r))n.numPoints+=t.length/3;else{for(var a=[],l=0;l<t.length;l+=3)(0===r||t[l+2]>s)&&(n.numSimplified++,a.push(t[l]),a.push(t[l+1])),n.numPoints++;i&&function(e,t){for(var n=0,r=0,i=e.length,o=i-2;r<i;o=r,r+=2)n+=(e[r]-e[o])*(e[r+1]+e[o+1]);if(n>0===t)for(r=0,i=e.length;r<i/2;r+=2){var s=e[r],a=e[r+1];e[r]=e[i-2-r],e[r+1]=e[i-1-r],e[i-2-r]=s,e[i-1-r]=a}}(a,o),e.push(a)}}function Xi(e,t){return new Zi(e,t)}function Zi(e,t){var n=(t=this.options=function(e,t){for(var n in t)e[n]=t[n];return e}(Object.create(this.options),t)).debug;if(n&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");var r=function(e,t){var n=[];if("FeatureCollection"===e.type)for(var r=0;r<e.features.length;r++)Ci(n,e.features[r],t,r);else"Feature"===e.type?Ci(n,e,t):Ci(n,{geometry:e},t);return n}(e,t);this.tiles={},this.tileCoords=[],n&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),r=function(e,t){var n=t.buffer/t.extent,r=e,i=Ii(e,1,-1-n,n,0,-1,2,t),o=Ii(e,1,1-n,2+n,0,-1,2,t);return(i||o)&&(r=Ii(e,1,-n,1+n,0,-1,2,t)||[],i&&(r=Ui(i,1).concat(r)),o&&(r=r.concat(Ui(o,-1)))),r}(r,t),r.length&&this.splitTile(r,0,0,0),n&&(r.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function Ji(e,t,n){return 32*((1<<e)*n+t)+e}we.register("MVT",()=>Ei),Zi.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},Zi.prototype.splitTile=function(e,t,n,r,i,o,s){for(var a=[e,t,n,r],l=this.options,u=l.debug;a.length;){r=a.pop(),n=a.pop(),t=a.pop(),e=a.pop();var c=1<<t,d=Ji(t,n,r),h=this.tiles[d];if(!h&&(u>1&&console.time("creation"),h=this.tiles[d]=Hi(e,t,n,r,l),this.tileCoords.push({z:t,x:n,y:r}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,n,r,h.numFeatures,h.numPoints,h.numSimplified),console.timeEnd("creation"));var p="z"+t;this.stats[p]=(this.stats[p]||0)+1,this.total++}if(h.source=e,i){if(t===l.maxZoom||t===i)continue;var f=1<<i-t;if(n!==Math.floor(o/f)||r!==Math.floor(s/f))continue}else if(t===l.indexMaxZoom||h.numPoints<=l.indexMaxPoints)continue;if(h.source=null,0!==e.length){u>1&&console.time("clipping");var m,g,y,b,v,_,x=.5*l.buffer/l.extent,w=.5-x,E=.5+x,S=1+x;m=g=y=b=null,v=Ii(e,c,n-x,n+E,0,h.minX,h.maxX,l),_=Ii(e,c,n+w,n+S,0,h.minX,h.maxX,l),e=null,v&&(m=Ii(v,c,r-x,r+E,1,h.minY,h.maxY,l),g=Ii(v,c,r+w,r+S,1,h.minY,h.maxY,l),v=null),_&&(y=Ii(_,c,r-x,r+E,1,h.minY,h.maxY,l),b=Ii(_,c,r+w,r+S,1,h.minY,h.maxY,l),_=null),u>1&&console.timeEnd("clipping"),a.push(m||[],t+1,2*n,2*r),a.push(g||[],t+1,2*n,2*r+1),a.push(y||[],t+1,2*n+1,2*r),a.push(b||[],t+1,2*n+1,2*r+1)}}},Zi.prototype.getTile=function(e,t,n){var r=this.options,i=r.extent,o=r.debug;if(e<0||e>24)return null;var s=1<<e,a=Ji(e,t=(t%s+s)%s,n);if(this.tiles[a])return qi(this.tiles[a],i);o>1&&console.log("drilling down to z%d-%d-%d",e,t,n);for(var l,u=e,c=t,d=n;!l&&u>0;)u--,c=Math.floor(c/2),d=Math.floor(d/2),l=this.tiles[Ji(u,c,d)];return l&&l.source?(o>1&&console.log("found parent tile z%d-%d-%d",u,c,d),o>1&&console.time("drilling down"),this.splitTile(l.source,u,c,d,e,t,n),o>1&&console.timeEnd("drilling down"),this.tiles[a]?qi(this.tiles[a],i):null):null};class Qi extends Se{constructor(e,t){super(e,t),this.load_data=null,this.tile_indexes={},this.setTileSize(512),this.pad_scale=0}_load(e){return this.load_data||(this.load_data=super._load({source_data:{layers:{}}}).then(e=>{e.source_data.error&&g("warn",`data source load error(s) for source '${this.name}', URL '${this.url}': ${e.source_data.error}`);let t=e.source_data.layers;for(let e in t)this.tile_indexes[e]=Xi(t[e],{maxZoom:this.max_zoom,tolerance:1.5,extent:U.tile_scale,buffer:1e-4});return this.loaded=!0,e})),this.load_data.then(()=>{for(let t in this.tile_indexes)e.source_data.layers[t]=this.getTileFeatures(e,t);return e})}getTileFeatures(e,t){let n,r=U.wrapTile(e.coords,{x:!0}),i=this.tile_indexes[t].getTile(r.z,r.x,r.y);if(i&&i.features){n={type:"FeatureCollection",features:[]};for(let e=0;e<i.features.length;e++){const t=i.features[e];let r={type:"Feature",geometry:{},id:t.id,properties:t.tags};if(1===t.type)r.geometry.coordinates=t.geometry.map(e=>[e[0],e[1]]),r.geometry.type="MultiPoint";else{if(2!==t.type&&3!==t.type)continue;if(r.geometry.coordinates=t.geometry.map(e=>e.map(e=>[e[0],e[1]])),2===t.type)r.geometry.type="MultiLineString";else if(r.geometry=Si(r.geometry),null==r.geometry)continue}n.features.push(r)}}return n}formatURL(){return this.url}parseSourceData(e,t,n){let r="string"==typeof n?JSON.parse(n):n,i=this.getLayers(r);t.layers=this.preprocessLayers(i,e)}preprocessLayers(e,t){for(let t in e){let n=e[t];n.features=this.preprocessFeatures(n.features)}if("function"==typeof this.transform){const n={min:Object.assign({},t.min),max:Object.assign({},t.max),coords:Object.assign({},t.coords)};1===Object.keys(e).length&&e._default?e._default=this.transform(e._default,this.extra_data,n):e=this.transform(e,this.extra_data,n)}return e}preprocessFeatures(e){if(e=e.filter(e=>null!=e.geometry),this.config.generate_label_centroids){let t=[],n={label_placement:!0};e.forEach(e=>{let r,i;if("Polygon"===e.geometry.type)r=e.geometry.coordinates,i=to(r,e.id,e.properties,n),t.push(i);else if("MultiPolygon"===e.geometry.type){r=e.geometry.coordinates;let o=-1/0,s=0;for(let e=0;e<r.length;e++){let t=U.polygonArea(r[e]);t>o&&(o=t,s=e)}i=to(r[s],e.id,e.properties,n),t.push(i)}}),t=t.filter(e=>e),Array.prototype.push.apply(e,t)}return e}getLayers(e){return"Feature"===e.type?{_default:{type:"FeatureCollection",features:[e]}}:"FeatureCollection"===e.type?{_default:e}:e}}class eo extends Te{constructor(e,t){super(e,t)}parseSourceData(e,t,n){let r="string"==typeof n?JSON.parse(n):n;this.prepareGeoJSON(r,e,t)}prepareGeoJSON(e,t,n){if("function"==typeof this.transform){const n={min:Object.assign({},t.min),max:Object.assign({},t.max),coords:Object.assign({},t.coords)};e=this.transform(e,this.extra_data,n)}n.layers=Qi.prototype.getLayers(e);let r={coords:t.coords,min:U.metersForTile(U.wrapTile(t.coords,{x:!0}))};we.projectData(n),we.scaleData(n,r)}}function to(e,t,n,r){let i=U.centroid(e);if(!i)return;let o={};return Object.assign(o,n,r),{type:"Feature",id:t,properties:o,geometry:{type:"Point",coordinates:i}}}function no(e){return e}function ro(e,t){var n=t.id,r=t.bbox,i=null==t.properties?{}:t.properties,o=function(e,t){var n=function(e){if(null==(t=e.transform))return no;var t,n,r,i=t.scale[0],o=t.scale[1],s=t.translate[0],a=t.translate[1];return function(e,t){return t||(n=r=0),e[0]=(n+=e[0])*i+s,e[1]=(r+=e[1])*o+a,e}}(e),r=e.arcs;function i(e,t){t.length&&t.pop();for(var i=r[e<0?~e:e],o=0,s=i.length;o<s;++o)t.push(n(i[o].slice(),o));e<0&&function(e,t){for(var n,r=e.length,i=r-t;i<--r;)n=e[i],e[i++]=e[r],e[r]=n}(t,s)}function o(e){return n(e.slice())}function s(e){for(var t=[],n=0,r=e.length;n<r;++n)i(e[n],t);return t.length<2&&t.push(t[0].slice()),t}function a(e){for(var t=s(e);t.length<4;)t.push(t[0].slice());return t}function l(e){return e.map(a)}return function e(t){var n,r=t.type;switch(r){case"GeometryCollection":return{type:r,geometries:t.geometries.map(e)};case"Point":n=o(t.coordinates);break;case"MultiPoint":n=t.coordinates.map(o);break;case"LineString":n=s(t.arcs);break;case"MultiLineString":n=t.arcs.map(s);break;case"Polygon":n=l(t.arcs);break;case"MultiPolygon":n=t.arcs.map(l);break;default:return null}return{type:r,coordinates:n}}(t)}(e,t);return null==n&&null==r?{type:"Feature",properties:i,geometry:o}:null==r?{type:"Feature",id:n,properties:i,geometry:o}:{type:"Feature",id:n,bbox:r,properties:i,geometry:o}}we.register("GeoJSON",e=>eo.urlHasTilePattern(e.url)?eo:Qi);class io extends Qi{parseSourceData(e,t,n){let r="string"==typeof n?JSON.parse(n):n;r=this.toGeoJSON(r);let i=this.getLayers(r);super.preprocessLayers(i,e),t.layers=i}toGeoJSON(e){if(e.objects&&1===Object.keys(e.objects).length){let t=Object.keys(e.objects)[0];e=oo(e,e.objects[t])}else{let t={};for(let n in e.objects)t[n]=oo(e,e.objects[n]);e=t}return e}}function oo(e,t){let n=function(e,t){return"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map(function(t){return ro(e,t)})}:ro(e,t)}(e,t);return"Feature"===n.type&&(n={type:"FeatureCollection",features:[n]}),n}class so extends eo{constructor(e,t){super(e,t)}parseSourceData(e,t,n){let r="string"==typeof n?JSON.parse(n):n;r=io.prototype.toGeoJSON(r),this.prepareGeoJSON(r,e,t)}}we.register("TopoJSON",e=>so.urlHasTilePattern(e.url)?so:io),e.Collision=Wt,e.DataSource=we,e.FeatureSelection=de,e.FilterOptions=Hr,e.FontManager=rn,e.GLSL=A,e.Geo=U,e.Label=$t,e.LabelLineStraight=mr,e.LabelPoint=qt,e.Light=ve,e.Material=ge,e.OBB=jt,e.ShaderProgram=j,e.Style=Ne,e.StyleManager=class{constructor(){this.styles={},this.base_styles={},this.active_styles=[],this.active_blend_orders=[],this.register(Object.create(et)),this.register(Object.create(_t)),this.register(Object.create(cr)),this.register(Object.create(xr)),this.register(Object.create(wr))}init(){j.removeBlock("global"),j.removeBlock("setup"),j.addBlock("global","#ifdef TANGRAM_VERTEX_SHADER\n\n// Apply layer ordering to avoid z-fighting\nvoid applyLayerOrder (float layer, inout vec4 position) {\n position.z -= layer * TANGRAM_LAYER_DELTA * position.w;\n}\n\n// Vertex position in model space: [0, 1] range over the local tile\n// Note positions can be outside that range due to unclipped geometry, geometry higher than a unit cube, etc.\nvec4 modelPosition() {\n return\n vec4(\n a_position.xyz / TANGRAM_TILE_SCALE // scale coords to ~0-1 range\n * exp2(u_tile_origin.z - u_tile_origin.w), // adjust for tile overzooming\n 1.)\n + vec4(0., 1., 0., 0.);\n // NB: additional offset to account for unusual Tangram JS y coords,\n // should be refactored to remove\n}\n\n// Position in model space as above, but according to tile coordinate (as opposed to style) zoom\n// e.g. unadjusted for tile overzooming\nvec4 modelPositionBaseZoom() {\n return\n vec4(\n a_position.xyz / TANGRAM_TILE_SCALE, // scale coords to ~0-1 range\n 1.)\n + vec4(0., 1., 0., 0.); // see note on offset above\n}\n\n#endif\n\n// Vertex position in world coordinates, useful for 3d procedural textures, etc.\nvec4 worldPosition() {\n return v_world_position;\n}\n\n// Optionally wrap world coordinates (allows more precision at higher zooms)\n// e.g. at wrap 1000, the world space will wrap every 1000 meters\n#ifdef TANGRAM_VERTEX_SHADER\n\nvec4 wrapWorldPosition(vec4 world_position) {\n #if defined(TANGRAM_WORLD_POSITION_WRAP)\n vec2 anchor = u_tile_origin.xy - mod(u_tile_origin.xy, TANGRAM_WORLD_POSITION_WRAP);\n world_position.xy -= anchor;\n #endif\n return world_position;\n}\n\n#endif\n\n// Normal in world space\n#if defined(TANGRAM_VERTEX_SHADER)\n\nvec3 worldNormal() {\n return TANGRAM_NORMAL;\n}\n\n#elif defined(TANGRAM_FRAGMENT_SHADER)\n\nvec3 worldNormal() {\n return u_inverseNormalMatrix * TANGRAM_NORMAL;\n}\n\n#endif\n"),j.addBlock("global","// Vertex attribute + varying for feature selection\n#if defined(TANGRAM_FEATURE_SELECTION) && defined(TANGRAM_VERTEX_SHADER)\n attribute vec4 a_selection_color;\n varying vec4 v_selection_color;\n#endif\n"),j.replaceBlock("setup","// Selection pass-specific rendering\n#if defined(TANGRAM_FEATURE_SELECTION) && defined(TANGRAM_VERTEX_SHADER)\n if (a_selection_color.rgb == vec3(0.)) {\n // Discard by forcing invalid triangle if we're in the feature\n // selection pass but have no selection info\n // TODO: in some cases we may actually want non-selectable features to occlude selectable ones?\n gl_Position = vec4(0., 0., 0., 1.);\n return;\n }\n v_selection_color = a_selection_color;\n#endif\n"),j.defines.TANGRAM_EPSILON=1e-5,j.defines.TANGRAM_LAYER_DELTA=1/16384,j.defines.TANGRAM_TILE_SCALE=`vec3(${U.tile_scale}., ${U.tile_scale}., u_meters_per_pixel * ${U.tile_size}.)`,j.defines.TANGRAM_HEIGHT_SCALE=U.height_scale,j.defines.TANGRAM_ALPHA_TEST=.5}destroy(e){Object.keys(this.styles).forEach(t=>{let n=this.styles[t];n.gl===e&&(g("trace",`StyleManager.destroy: destroying render style ${n.name}`),n.base&&this.remove(n.name),n.destroy())})}register(e){this.styles[e.name]=e,this.base_styles[e.name]=e}remove(e){delete this.styles[e]}getActiveStyles(){return this.active_styles}updateActiveStyles(e){return this.active_styles=Object.keys(e.reduce((e,t)=>(Object.keys(t.meshes).forEach(t=>e[t]=!0),e),{})),this.active_styles}getActiveBlendOrders(){return this.active_blend_orders}updateActiveBlendOrders(e){const t=[];e.forEach(e=>{Object.entries(e.meshes).forEach(([e,n])=>{n.forEach(n=>{const r=n.variant.blend_order;let i=t.findIndex(e=>e.blend_order===r);i=i>-1?i:t.push({blend_order:r,styles:[]})-1,-1===t[i].styles.indexOf(e)&&t[i].styles.push(e)})})}),this.active_blend_orders=t.sort((e,t)=>e.blend_order-t.blend_order)}mix(e,t){if(e.mixed)return e;e.mixed={};let n=[];e.mix&&(Array.isArray(e.mix)?n.push(...e.mix):n.push(e.mix),n=n.map(e=>t[e]).filter(t=>t&&t!==e),n.forEach(t=>e.mixed[t.name]=!0)),n.push(e),e.animated=n.some(e=>e&&e.animated),e.texcoords=n.some(e=>e&&e.texcoords),e.base=n.map(e=>e.base).filter(e=>e).pop(),e.lighting=n.map(e=>e.lighting).filter(e=>null!=e).pop(),e.texture=n.map(e=>e.texture).filter(e=>e).pop(),e.raster=n.map(e=>e.raster).filter(e=>null!=e).pop(),e.dash=n.map(e=>e.dash).filter(e=>null!=e).pop(),e.dash_background_color=n.map(e=>e.dash_background_color).filter(e=>null!=e).pop(),n.some(e=>Object.prototype.hasOwnProperty.call(e,"blend")&&e.blend)&&(e.blend=n.map(e=>Object.prototype.hasOwnProperty.call(e,"blend")&&e.blend).filter(e=>e).pop()),e.blend_order=n.map(e=>e.blend_order).filter(e=>null!=e).pop(),e.defines=Object.assign({},...n.map(e=>e.defines).filter(e=>e)),e.material=Object.assign({},...n.map(e=>e.material).filter(e=>e));let r=n.map(e=>e.draw).filter(e=>e);return r.length>0&&(e.draw=V({},...r)),this.mixShaders(e,t,n),e}mixShaders(e,t,n){let r={},i=n.map(e=>e.shaders).filter(e=>e);if(r.defines=Object.assign({},...i.map(e=>e.defines).filter(e=>e)),r.attributes=Object.assign({},...i.map(e=>e.attributes).filter(e=>e)),r.uniforms={},r._uniforms=e.shaders&&e.shaders.uniforms||{},r._uniform_scopes={},n.filter(e=>e.shaders&&e.shaders.uniforms).forEach(e=>{for(let n in e.shaders.uniforms)r._uniform_scopes[n]=e.name,Object.defineProperty(r.uniforms,n,{enumerable:!0,configurable:!0,get:function(){return void 0!==r._uniforms[n]?r._uniforms[n]:t[r._uniform_scopes[n]].shaders.uniforms!==r.uniforms?t[r._uniform_scopes[n]].shaders.uniforms[n]:void 0},set:function(e){r._uniforms[n]=e}})}),r.extensions=Object.keys(i.map(e=>e.extensions).filter(e=>e).reduce((e,t)=>("string"==typeof t?e[t]=!0:t.forEach(t=>e[t]=!0),e),{})||{}),e.shaders&&e.shaders.blocks){e.shaders.block_scopes=e.shaders.block_scopes||{};for(let t in e.shaders.blocks){let n=e.shaders.blocks[t];e.shaders.block_scopes[t]=e.shaders.block_scopes[t]||[],Array.isArray(n)?e.shaders.block_scopes[t].push(...n.map(()=>e.name)):e.shaders.block_scopes[t].push(e.name)}}let o={};return i.forEach(e=>{if(!e.blocks)return;r.blocks=r.blocks||{},r.block_scopes=r.block_scopes||{};let t={};for(let n in e.blocks){let i=e.blocks[n],s=e.block_scopes[n];r.blocks[n]=r.blocks[n]||[],r.block_scopes[n]=r.block_scopes[n]||[],i=Array.isArray(i)?i:[i],s=Array.isArray(s)?s:[s];for(let e=0;e<i.length;e++)o[s[e]]||(t[s[e]]=!0,r.blocks[n].push(i[e]),r.block_scopes[n].push(s[e]))}Object.assign(o,t)}),Object.assign(e.mixed,o),e.shaders=r,e}create(e,t,n={}){let r=V({},t);return r.name=e,r=this.mix(r,n),r.base&&this.base_styles[r.base]?this.styles[e]=r=Object.assign(Object.create(this.base_styles[r.base]),r):r.base=null,r}build(e){const t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Er(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Er(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},e);this.styles&&Object.values(this.styles).forEach(e=>a.removeTarget(e.main_thread_target));const n=["opaque","add","multiply","overlay","inlay","translucent"],r=["polygons","lines","points","text","raster"];for(const e of n)for(const n of r){const r=e+"_"+n;null==t[r]&&(t[r]={base:n,blend:e})}let o=Object.keys(t).sort((e,n)=>this.inheritanceDepth(e,t)-this.inheritanceDepth(n,t));for(let e in this.styles)this.base_styles[e]?this.styles[e].reset():delete this.styles[e];let s={};return o.forEach(e=>{s[e]=this.create(e,t[e],s)}),this.styles}initStyles(e={}){for(let t in this.styles)this.styles[t].init(e)}inheritanceDepth(e,t){let n=0;for(;;){let r=t[e];if(!r)break;if(!r.mix)break;if(n++,Array.isArray(r.mix)){n+=Math.max(...r.mix.map(n=>{if(e!==n)return this.inheritanceDepth(n,t)}));break}if(e===r.mix)break;e=r.mix}return n}},e.StyleParser=Q,e.Task=S,e.TextCanvas=En,e.Texture=O,e.Thread=t,e.Tile=ti,e.TileID=ke,e.Utils=y,e.Vector=be,e.VertexArrayObject=B,e.VertexData=Fe,e.VertexElements=Ie,e.View=class{constructor(e,t){T(this),this.scene=e,this.createMatrices(),this.zoom=null,this.center=null,this.bounds=null,this.meters_per_pixel=null,this.panning=!1,this.panning_stop_at=0,this.pan_snap_timer=0,this.zoom_direction=0,this.user_input_at=0,this.user_input_timeout=50,this.user_input_active=!1,this.size={css:{},device:{},meters:{}},this.aspect=null,this.buffer=0,this.continuous_zoom="boolean"!=typeof t.continuousZoom||t.continuousZoom,this.wrap=!1!==t.wrapView,this.preserve_tiles_within_zoom=1,this.reset()}reset(){this.createCamera()}createCamera(){let e=this.getActiveCamera();e&&(this.camera=or.create(e,this,this.scene.config.cameras[e]),this.camera.updateView())}getActiveCamera(){if(this.scene.config&&this.scene.config.cameras){for(let e in this.scene.config.cameras)if(this.scene.config.cameras[e].active)return e;let e=Object.keys(this.scene.config.cameras);return e.length&&e[0]}}setActiveCamera(e){let t=this.getActiveCamera();return t===e?e:(this.scene.config.cameras[e]&&(this.scene.config.cameras[e].active=!0,t&&this.scene.config.cameras[t]&&delete this.scene.config.cameras[t].active),this.scene.updateConfig({rebuild:!1,normalize:!1}),this.getActiveCamera())}update(){null!=this.camera&&this.ready()&&this.camera.update(),this.pan_snap_timer=(+new Date-this.panning_stop_at)/1e3,this.user_input_active=+new Date-this.user_input_at<this.user_input_timeout}setViewportSize(e,t){this.size.css={width:e,height:t},this.size.device={width:Math.round(this.size.css.width*y.device_pixel_ratio),height:Math.round(this.size.css.height*y.device_pixel_ratio)},this.aspect=this.size.css.width/this.size.css.height,this.updateBounds()}setView({lng:e,lat:t,zoom:n}={}){var r=!1;return"number"==typeof e&&"number"==typeof t&&(this.center&&e===this.center.lng&&t===this.center.lat||(r=!0,this.center={lng:e,lat:t})),"number"==typeof n&&n!==this.zoom&&(r=!0,this.setZoom(n)),r&&this.updateBounds(),r}setZoom(e){let t=this.tile_zoom,n=this.baseZoom(e);this.continuous_zoom||(e=n),n!==t&&(this.zoom_direction=n>t?1:-1),this.zoom=e,this.tile_zoom=n,this.updateBounds(),this.scene.requestRedraw()}baseZoom(e){return Math.floor(e)}setPanning(e){this.panning=e,this.panning||(this.panning_stop_at=+new Date)}markUserInput(){this.user_input_at=+new Date}ready(){return"number"==typeof this.size.css.width&&"number"==typeof this.size.css.height&&null!=this.center&&"number"==typeof this.zoom}updateBounds(){if(!this.ready())return;this.meters_per_pixel=U.metersPerPixel(this.zoom),this.size.meters={x:this.size.css.width*this.meters_per_pixel,y:this.size.css.height*this.meters_per_pixel};const e=U.latLngToMeters([this.center.lng,this.center.lat]);this.center.meters={x:e[0],y:e[1]},this.center.tile=U.tileForMeters([this.center.meters.x,this.center.meters.y],this.tile_zoom),this.bounds={sw:{x:this.center.meters.x-this.size.meters.x/2,y:this.center.meters.y-this.size.meters.y/2},ne:{x:this.center.meters.x+this.size.meters.x/2,y:this.center.meters.y+this.size.meters.y/2}},this.scene.tile_manager.updateTilesForView(),this.trigger("move"),this.scene.requestRedraw()}findVisibleTileCoordinates(){if(!this.bounds)return[];let e=this.tile_zoom,t=U.tileForMeters([this.bounds.sw.x,this.bounds.sw.y],e),n=U.tileForMeters([this.bounds.ne.x,this.bounds.ne.y],e),r=[t.x-this.buffer,n.x+this.buffer,n.y-this.buffer,t.y+this.buffer];if(!1===this.wrap){let t=(1<<e)-1;r=r.map(e=>Math.min(Math.max(0,e),t))}let i=[];for(let t=r[0];t<=r[1];t++)for(let n=r[2];n<=r[3];n++)i.push(ke.coord({x:t,y:n,z:e}));return i}pruneTilesForView(){this.ready()&&this.scene.tile_manager.removeTiles(e=>{if(e.visible||e.isProxy())return!1;if(e.loading&&e.style_z!==this.tile_zoom)return!0;if(Math.abs(e.style_z-this.tile_zoom)>(null!=e.preserve_tiles_within_zoom?e.preserve_tiles_within_zoom:this.preserve_tiles_within_zoom))return!0;const t=this.meters_per_pixel*U.tile_size,n=ke.coordAtZoom(U.tileForMeters([this.center.meters.x-this.size.meters.x/2-t,this.center.meters.y+this.size.meters.y/2+t],this.tile_zoom),e.coords.z),r=ke.coordAtZoom(U.tileForMeters([this.center.meters.x+this.size.meters.x/2+t,this.center.meters.y-this.size.meters.y/2-t],this.tile_zoom),e.coords.z);return(e.coords.x<n.x||e.coords.x>r.x||e.coords.y<n.y||e.coords.y>r.y)&&(g("trace",`View: remove tile ${e.key} (as ${e.coords.key}) for being too far out of visible area (${n.key}, ${r.key})`),!0)})}createMatrices(){this.matrices={},this.matrices.model=new Float64Array(16),this.matrices.model32=new Float32Array(16),this.matrices.model_view=new Float64Array(16),this.matrices.model_view32=new Float32Array(16),this.matrices.normal=new Float64Array(9),this.matrices.normal32=new Float32Array(9),this.matrices.inverse_normal32=new Float32Array(9)}setupTile(e,t){e.setupProgram(this.matrices,t),this.camera.setupMatrices(this.matrices,t)}setupProgram(e){e.uniform("2fv","u_resolution",[this.size.device.width,this.size.device.height]),e.uniform("3fv","u_map_position",[this.center.meters.x,this.center.meters.y,this.zoom]),e.uniform("1f","u_meters_per_pixel",this.meters_per_pixel),e.uniform("1f","u_device_pixel_ratio",y.device_pixel_ratio),e.uniform("1f","u_view_pan_snap_timer",this.pan_snap_timer),e.uniform("1i","u_view_panning",this.panning),this.camera.setupProgram(e)}isAnimating(){return this.pan_snap_timer<=.5}},e.WorkerBroker=a,e._defineProperty=i,e.addBaseURL=function(e,t){if(!e||!x(e))return e;var n,r="/"!==e[0];if(t?(n=document.createElement("a")).href=t:n=window.location,r)e=_(n.href)+e;else{let t=n.origin;t||(t=n.protocol+"//"+n.host),e=t+e}return e},e.buildFilter=jr,e.cache=H,e.clearFunctionStringCache=function(){H.functions={},H.num_functions=0,H.num_cached=0},e.compileFunctionStrings=Y,e.createObjectURL=function(e){return void 0===w&&(w=window.URL&&window.URL.createObjectURL||window.webkitURL&&window.webkitURL.createObjectURL,"function"!=typeof w&&(w=null,g("warn","window.URL.createObjectURL (or vendor prefix) not found, unable to create local blob URLs"))),w?w(e):e},e.debugSettings=v,e.debugSumLayerStats=function(e){let t={},n={};return e.filter(e=>e.debug.layers).forEach(e=>{Object.keys(e.debug.layers.list).forEach(n=>{let r=e.debug.layers.list[n];Pe(t,n,r.features,r.geoms,r.styles,r.base)}),ni(e.debug.layers.tree,n)}),{list:t,tree:n}},e.extensionForURL=function(e){let t=(e=e.split("/").pop()).lastIndexOf(".");if(t>-1)return e.substring(t+1)},e.flattenRelativeURL=function(e){let t=(e||"").split("/");for(let e=1;e<t.length;e++)"."===t[e]?(t.splice(e,1),e--):".."===t[e]&&(e+=0,t.splice(e-1,2),e--);return t.join("/")},e.getAugmentedNamespace=function(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n},e.getDefaultExportFromCjs=P,e.isLocalURL=function(e){if("string"==typeof e)return e.search(/^(data|blob):/)>-1},e.isRelativeURL=x,e.isReserved=Yr,e.layerCache=function(){return Br},e.log=g,e.mergeDebugSettings=function(e){Object.assign(b,e)},e.mergeObjects=V,e.parseLayers=function(e,t){Br={};let n={};for(let r in e){let i=e[r];i&&(n[r]=Kr(r,i,null,t))}return n},e.pathForURL=_,e.sliceObject=k,e.subscribeMixin=T,e.version=s}),aM(0,function(e){const t=Object.assign(self,{FeatureSelection:e.FeatureSelection,sources:{},styles:{},layers:{},tiles:{},init(t,n,r,i,o,s,a){return this.scene_id=t,this._worker_id=n,this.num_workers=r,e.log.setLevel(i),e.Utils.device_pixel_ratio=o,e.VertexElements.setElementIndexUint(s),e.FeatureSelection.setPrefix(this._worker_id),this.style_manager=new e.StyleManager,this.importExternalScripts(a),e.Label.id_prefix=n,e.Label.id_multiplier=r,n},importExternalScripts(t){if(0===t.length)return;e.log("debug","loading custom data source scripts in worker:",t);let n=Object.getOwnPropertyNames(window);importScripts(...t),Object.getOwnPropertyNames(window).forEach(e=>{-1===n.indexOf(e)&&(this[e]=window[e])})},updateConfig({config:t,generation:n,introspection:r},i){return t=JSON.parse(t),e.mergeDebugSettings(i),this.generation=n,this.introspection=r,this.global=e.compileFunctionStrings(t.global),this.createDataSources(t),t.styles=e.compileFunctionStrings(t.styles,e.StyleParser.wrapFunction),this.styles=this.style_manager.build(t.styles),this.style_manager.initStyles({generation:this.generation,styles:this.styles,sources:this.sources,introspection:this.introspection}),this.layers=e.parseLayers(t.layers,this.style_manager.styles),this.syncing_textures=this.syncTextures(t.textures),this.configuring=this.syncing_textures.then(()=>{e.log("debug","updated config")}),this.configuring},createDataSources(t){this.last_config_sources=this.config_sources||{},this.config_sources=e.mergeObjects({},t.sources);let n=this.sources,r=[];this.sources={};for(let i in t.sources){if(JSON.stringify(this.last_config_sources[i])===JSON.stringify(t.sources[i])){this.sources[i]=n[i];continue}let o;t.sources[i]=e.compileFunctionStrings(t.sources[i]);try{o=e.DataSource.create(Object.assign({},t.sources[i],{name:i}),this.sources)}catch(e){continue}o&&(this.sources[i]=o,r.push(i))}r.forEach(e=>{for(let t in this.tiles)this.tiles[t].source===e&&delete this.tiles[t]})},awaitConfiguration(){return this.configuring},buildTile({tile:t}){if(null==this.getTile(t.key)||!0!==this.getTile(t.key).loading)return t=this.tiles[t.key]=Object.assign(this.getTile(t.key)||{},t),this.awaitConfiguration().then(()=>{if(!0!==t.loaded)t.loading=!0,t.loaded=!1,t.error=null,this.loadTileSourceData(t).then(()=>{this.getTile(t.key)?(t.source_data.error&&e.log("warn",`tile load error(s) for ${t.key}: ${t.source_data.error}`),t.loading=!1,t.loaded=!0,e.Tile.buildGeometry(t,this)):e.log("trace",`stop tile build after data source load because tile was removed: ${t.key}`)}).catch(n=>{t.loading=!1,t.loaded=!1,t.error=n.stack,e.log("error",`tile load error for ${t.key}: ${t.error}`),e.WorkerBroker.postMessage(`TileManager_${this.scene_id}.buildTileError`,e.Tile.slice(t))});else{e.log("trace",`used worker cache for tile ${t.key}`);try{e.Tile.buildGeometry(t,this)}catch(n){t.error=n.toString(),e.WorkerBroker.postMessage(`TileManager_${this.scene_id}.buildTileError`,e.Tile.slice(t))}}})},loadTileSourceData(e){const t=this.sources[e.source];if(t){for(const n in this.tiles){const r=this.tiles[n];if(r.source===e.source&&r.coords.key===e.coords.key&&r.loaded)return Promise.resolve(t.copyTileData(r,e))}return t.load(e)}return e.source_data={},Promise.resolve(e)},getTile(e){return this.tiles[e]},removeTile(t){var n=this.tiles[t];null!=n&&(!0===n.loading&&(e.log("trace",`cancel tile load for ${t}`),n.loading=!1,e.Tile.cancel(n)),e.FeatureSelection.clearTile(t),delete this.tiles[t],e.log("trace",`remove tile from cache for ${t}`))},queryFeatures({filter:t,visible:n,geometry:r,tile_keys:i}){let o=[],s=i.map(e=>this.tiles[e]).filter(e=>e&&e.loaded);return null!=t&&(t=["{","["].indexOf(t[0])>-1?JSON.parse(t):t,t=e.compileFunctionStrings(t,e.StyleParser.wrapFunction)),t=e.buildFilter(t,e.FilterOptions),s.forEach(i=>{for(let s in i.source_data.layers){let a=i.source_data.layers[s];if(null==a)return;a.features.forEach(a=>{const l=a.generation===this.generation;if(!0===n&&!l||!1===n&&l)return;let u=e.StyleParser.getFeatureParseContext(a,i,this.global);if(u.source=i.source,u.layer=s,u.id=a.id,!t(u))return;let c={type:a.type,id:a.id,properties:Object.assign({},a.properties,{$source:u.source,$layer:u.layer,$geometry:u.geometry,$visible:l})};!0===r&&(c.geometry=e.Geo.copyGeometry(a.geometry),e.Geo.tileSpaceToLatlng(c.geometry,i.coords.z,i.min)),o.push(c)})}}),o},getFeatureSelection({id:t,key:n}={}){var r=e.FeatureSelection.map[n];return{id:t,feature:r&&r.feature}},resetFeatureSelection(t=null){e.FeatureSelection.reset(t)},getFeatureSelectionMapSize:()=>e.FeatureSelection.getMapSize(),syncTextures(t){let n=[];return t&&n.push(...Object.keys(t)),e.log("trace","sync textures to worker:",n),n.length>0?e.Texture.syncTexturesToWorker(n):Promise.resolve()},updateDevicePixelRatio(t){e.Utils.device_pixel_ratio=t},clearFunctionStringCache(){e.clearFunctionStringCache()},profile(e){console.profile(`worker ${this._worker_id}: ${e}`)},profileEnd(e){console.profileEnd(`worker ${this._worker_id}: ${e}`)},debug:{debugSettings:e.debugSettings,layerCache:e.layerCache,functionStringCache:e.cache}});e.WorkerBroker.addTarget("self",t)}),aM(0,function(e){var t,n=t={};let r=0;function i(e,t){var n;const r=t[t.length-1];return null===(n=s(e,t))||void 0===n?void 0:n[r]}function o(e,t,n){const r=t[t.length-1],i=s(e,t);i&&(i[r]=n)}function s(e,t){if(0===t.length)return;let n=e;for(let e=0;e<t.length-1;e++)if(n=n[t[e]],null==n)return;return n}t.getContext=function(e,n){var i=!1;null==e&&((e=document.createElement("canvas")).style.position="absolute",e.style.top=0,e.style.left=0,e.style.zIndex=-1,document.body.appendChild(e),i=!0),e.addEventListener("webglcontextlost",()=>{}),e.addEventListener("webglcontextrestored",()=>{});var o=e.getContext("webgl",n)||e.getContext("experimental-webgl",n);if(!o)throw new Error("Couldn't create WebGL context.");return o._tangram_id=r++,i?(t.resize(o,window.innerWidth,window.innerHeight,n.device_pixel_ratio),window.addEventListener("resize",function(){t.resize(o,window.innerWidth,window.innerHeight,n.device_pixel_ratio)})):t.resize(o,parseFloat(e.style.width),parseFloat(e.style.height),n.device_pixel_ratio),o},t.resize=function(e,t,n,r){r=r||window.devicePixelRatio||1,e.canvas.style.width=t+"px",e.canvas.style.height=n+"px",e.canvas.width=Math.round(t*r),e.canvas.height=Math.round(n*r),e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,e.canvas.width,e.canvas.height)};const a="global.",l="__global_prop";function u(e){return(null==e?void 0:e.slice(0,7))===a}function c(e,t){var n;const r=Array.isArray(t)?t:[t],i=s(e,r),o=r[r.length-1];return void 0!==(null==i||null===(n=i[l])||void 0===n?void 0:n[o])}function d(e,t=null,n={}){t=t?t+".":a;for(const r in e){const i=t+r,o=e[r];n[i]=o,"object"!=typeof o||Array.isArray(o)||d(o,i,n)}return n}function h(t,n,r,i){var o;let s;if(null!=r&&null!==(o=r[l])&&void 0!==o&&o[i]?s=r[l][i]:"string"==typeof n&&n.slice(0,7)===a&&(s=n),s){null==r[l]&&Object.defineProperty(r,l,{value:{}}),r[l][i]=s;let n,o=t[s];for(;"string"==typeof o&&o.slice(0,7)===a;){if(n=n||[s],n.indexOf(o)>-1){e.log({level:"warn",once:!0},"Global properties: cyclical reference detected",n),o=null;break}n.push(o),o=t[o]}Object.defineProperty(r,i,{enumerable:!0,get:function(){return o},set:function(e){delete r[l][i],delete r[i],r[i]=e}})}else if(Array.isArray(n))for(let e=0;e<n.length;e++)h(t,n[e],n,e);else if("object"==typeof n)for(const e in n)h(t,n[e],n,e);return n}var p="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},f=[],m=[],g="undefined"!=typeof Uint8Array?Uint8Array:Array,y=!1;function b(){y=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)f[t]=e[t],m[e.charCodeAt(t)]=t;m["-".charCodeAt(0)]=62,m["_".charCodeAt(0)]=63}function v(e,t,n){for(var r,i,o=[],s=t;s<n;s+=3)r=(e[s]<<16)+(e[s+1]<<8)+e[s+2],o.push(f[(i=r)>>18&63]+f[i>>12&63]+f[i>>6&63]+f[63&i]);return o.join("")}function _(e){var t;y||b();for(var n=e.length,r=n%3,i="",o=[],s=16383,a=0,l=n-r;a<l;a+=s)o.push(v(e,a,a+s>l?l:a+s));return 1===r?(t=e[n-1],i+=f[t>>2],i+=f[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=f[t>>10],i+=f[t>>4&63],i+=f[t<<2&63],i+="="),o.push(i),o.join("")}function x(e,t,n,r,i){var o,s,a=8*i-r-1,l=(1<<a)-1,u=l>>1,c=-7,d=n?i-1:0,h=n?-1:1,p=e[t+d];for(d+=h,o=p&(1<<-c)-1,p>>=-c,c+=a;c>0;o=256*o+e[t+d],d+=h,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=r;c>0;s=256*s+e[t+d],d+=h,c-=8);if(0===o)o=1-u;else{if(o===l)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=u}return(p?-1:1)*s*Math.pow(2,o-r)}function w(e,t,n,r,i,o){var s,a,l,u=8*o-i-1,c=(1<<u)-1,d=c>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,f=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+d>=1?h/l:h*Math.pow(2,1-d))*l>=2&&(s++,l/=2),s+d>=c?(a=0,s=c):s+d>=1?(a=(t*l-1)*Math.pow(2,i),s+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,i),s=0));i>=8;e[n+p]=255&a,p+=f,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;e[n+p]=255&s,p+=f,s/=256,u-=8);e[n+p-f]|=128*m}var E={}.toString,S=Array.isArray||function(e){return"[object Array]"==E.call(e)};A.TYPED_ARRAY_SUPPORT=void 0===p.TYPED_ARRAY_SUPPORT||p.TYPED_ARRAY_SUPPORT;var T=k();function k(){return A.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function O(e,t){if(k()<t)throw new RangeError("Invalid typed array length");return A.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=A.prototype:(null===e&&(e=new A(t)),e.length=t),e}function A(e,t,n){if(!(A.TYPED_ARRAY_SUPPORT||this instanceof A))return new A(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return N(this,e)}return C(this,e,t,n)}function C(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");return t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r),A.TYPED_ARRAY_SUPPORT?(e=t).__proto__=A.prototype:e=P(e,t),e}(e,t,n,r):"string"==typeof t?function(e,t,n){if("string"==typeof n&&""!==n||(n="utf8"),!A.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|I(t,n),i=(e=O(e,r)).write(t,n);return i!==r&&(e=e.slice(0,i)),e}(e,t,n):function(e,t){if(D(t)){var n=0|M(t.length);return 0===(e=O(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?O(e,0):P(e,t);if("Buffer"===t.type&&S(t.data))return P(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function R(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function N(e,t){if(R(t),e=O(e,t<0?0:0|M(t)),!A.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function P(e,t){var n=t.length<0?0:0|M(t.length);e=O(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function M(e){if(e>=k())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+k().toString(16)+" bytes");return 0|e}function D(e){return!(null==e||!e._isBuffer)}function I(e,t){if(D(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return le(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return ue(e).length;default:if(r)return le(e).length;t=(""+t).toLowerCase(),r=!0}}function z(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return Z(this,t,n);case"utf8":case"utf-8":return H(this,t,n);case"ascii":return K(this,t,n);case"latin1":case"binary":return X(this,t,n);case"base64":return G(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return J(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function F(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function L(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=A.from(t,r)),D(t))return 0===t.length?-1:j(e,t,n,r,i);if("number"==typeof t)return t&=255,A.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):j(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function j(e,t,n,r,i){var o,s=1,a=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,l/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var c=-1;for(o=n;o<a;o++)if(u(e,o)===u(t,-1===c?0:o-c)){if(-1===c&&(c=o),o-c+1===l)return c*s}else-1!==c&&(o-=o-c),c=-1}else for(n+l>a&&(n=a-l),o=n;o>=0;o--){for(var d=!0,h=0;h<l;h++)if(u(e,o+h)!==u(t,h)){d=!1;break}if(d)return o}return-1}function $(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[n+s]=a}return s}function B(e,t,n,r){return ce(le(t,e.length-n),e,n,r)}function V(e,t,n,r){return ce(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function U(e,t,n,r){return V(e,t,n,r)}function W(e,t,n,r){return ce(ue(t),e,n,r)}function q(e,t,n,r){return ce(function(e,t){for(var n,r,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)r=(n=e.charCodeAt(s))>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function G(e,t,n){return 0===t&&n===e.length?_(e):_(e.slice(t,n))}function H(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var o,s,a,l,u=e[i],c=null,d=u>239?4:u>223?3:u>191?2:1;if(i+d<=n)switch(d){case 1:u<128&&(c=u);break;case 2:128==(192&(o=e[i+1]))&&(l=(31&u)<<6|63&o)>127&&(c=l);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(l=(15&u)<<12|(63&o)<<6|63&s)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(l=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&l<1114112&&(c=l)}null===c?(c=65533,d=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=d}return function(e){var t=e.length;if(t<=Y)return String.fromCharCode.apply(String,e);for(var n="",r=0;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=Y));return n}(r)}A.poolSize=8192,A._augment=function(e){return e.__proto__=A.prototype,e},A.from=function(e,t,n){return C(null,e,t,n)},A.TYPED_ARRAY_SUPPORT&&(A.prototype.__proto__=Uint8Array.prototype,A.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&A[Symbol.species]),A.alloc=function(e,t,n){return function(e,t,n,r){return R(t),t<=0?O(e,t):void 0!==n?"string"==typeof r?O(e,t).fill(n,r):O(e,t).fill(n):O(e,t)}(null,e,t,n)},A.allocUnsafe=function(e){return N(null,e)},A.allocUnsafeSlow=function(e){return N(null,e)},A.isBuffer=de,A.compare=function(e,t){if(!D(e)||!D(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},A.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},A.concat=function(e,t){if(!S(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return A.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=A.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var o=e[n];if(!D(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},A.byteLength=I,A.prototype._isBuffer=!0,A.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)F(this,t,t+1);return this},A.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)F(this,t,t+3),F(this,t+1,t+2);return this},A.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)F(this,t,t+7),F(this,t+1,t+6),F(this,t+2,t+5),F(this,t+3,t+4);return this},A.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?H(this,0,e):z.apply(this,arguments)},A.prototype.equals=function(e){if(!D(e))throw new TypeError("Argument must be a Buffer");return this===e||0===A.compare(this,e)},A.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},A.prototype.compare=function(e,t,n,r,i){if(!D(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(r,i),u=e.slice(t,n),c=0;c<a;++c)if(l[c]!==u[c]){o=l[c],s=u[c];break}return o<s?-1:s<o?1:0},A.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},A.prototype.indexOf=function(e,t,n){return L(this,e,t,n,!0)},A.prototype.lastIndexOf=function(e,t,n){return L(this,e,t,n,!1)},A.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return $(this,e,t,n);case"utf8":case"utf-8":return B(this,e,t,n);case"ascii":return V(this,e,t,n);case"latin1":case"binary":return U(this,e,t,n);case"base64":return W(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return q(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},A.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Y=4096;function K(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function X(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function Z(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=t;o<n;++o)i+=ae(e[o]);return i}function J(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function Q(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function ee(e,t,n,r,i,o){if(!D(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function te(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i<o;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function ne(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i<o;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function re(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function ie(e,t,n,r,i){return i||re(e,0,n,4),w(e,t,n,r,23,4),n+4}function oe(e,t,n,r,i){return i||re(e,0,n,8),w(e,t,n,r,52,8),n+8}A.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),A.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=A.prototype;else{var i=t-e;n=new A(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+e]}return n},A.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||Q(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},A.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||Q(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},A.prototype.readUInt8=function(e,t){return t||Q(e,1,this.length),this[e]},A.prototype.readUInt16LE=function(e,t){return t||Q(e,2,this.length),this[e]|this[e+1]<<8},A.prototype.readUInt16BE=function(e,t){return t||Q(e,2,this.length),this[e]<<8|this[e+1]},A.prototype.readUInt32LE=function(e,t){return t||Q(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},A.prototype.readUInt32BE=function(e,t){return t||Q(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},A.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||Q(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},A.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||Q(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},A.prototype.readInt8=function(e,t){return t||Q(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},A.prototype.readInt16LE=function(e,t){t||Q(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},A.prototype.readInt16BE=function(e,t){t||Q(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},A.prototype.readInt32LE=function(e,t){return t||Q(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},A.prototype.readInt32BE=function(e,t){return t||Q(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},A.prototype.readFloatLE=function(e,t){return t||Q(e,4,this.length),x(this,e,!0,23,4)},A.prototype.readFloatBE=function(e,t){return t||Q(e,4,this.length),x(this,e,!1,23,4)},A.prototype.readDoubleLE=function(e,t){return t||Q(e,8,this.length),x(this,e,!0,52,8)},A.prototype.readDoubleBE=function(e,t){return t||Q(e,8,this.length),x(this,e,!1,52,8)},A.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||ee(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},A.prototype.writeUIntBE=function(e,t,n,r){e=+e,t|=0,n|=0,r||ee(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},A.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||ee(this,e,t,1,255,0),A.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},A.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||ee(this,e,t,2,65535,0),A.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):te(this,e,t,!0),t+2},A.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||ee(this,e,t,2,65535,0),A.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):te(this,e,t,!1),t+2},A.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||ee(this,e,t,4,4294967295,0),A.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):ne(this,e,t,!0),t+4},A.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||ee(this,e,t,4,4294967295,0),A.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):ne(this,e,t,!1),t+4},A.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);ee(this,e,t,n,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<n&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s|0)-a&255;return t+n},A.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);ee(this,e,t,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s|0)-a&255;return t+n},A.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||ee(this,e,t,1,127,-128),A.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},A.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||ee(this,e,t,2,32767,-32768),A.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):te(this,e,t,!0),t+2},A.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||ee(this,e,t,2,32767,-32768),A.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):te(this,e,t,!1),t+2},A.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||ee(this,e,t,4,2147483647,-2147483648),A.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):ne(this,e,t,!0),t+4},A.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||ee(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),A.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):ne(this,e,t,!1),t+4},A.prototype.writeFloatLE=function(e,t,n){return ie(this,e,t,!0,n)},A.prototype.writeFloatBE=function(e,t,n){return ie(this,e,t,!1,n)},A.prototype.writeDoubleLE=function(e,t,n){return oe(this,e,t,!0,n)},A.prototype.writeDoubleBE=function(e,t,n){return oe(this,e,t,!1,n)},A.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,o=r-n;if(this===e&&n<t&&t<r)for(i=o-1;i>=0;--i)e[i+t]=this[i+n];else if(o<1e3||!A.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},A.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!A.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var s=D(e)?e:le(new A(e,r).toString()),a=s.length;for(o=0;o<n-t;++o)this[o+t]=s[o%a]}return this};var se=/[^+\/0-9A-Za-z-_]/g;function ae(e){return e<16?"0"+e.toString(16):e.toString(16)}function le(e,t){var n;t=t||1/0;for(var r=e.length,i=null,o=[],s=0;s<r;++s){if((n=e.charCodeAt(s))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function ue(e){return function(e){var t,n,r,i,o,s;y||b();var a=e.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[a-2]?2:"="===e[a-1]?1:0,s=new g(3*a/4-o),r=o>0?a-4:a;var l=0;for(t=0,n=0;t<r;t+=4,n+=3)i=m[e.charCodeAt(t)]<<18|m[e.charCodeAt(t+1)]<<12|m[e.charCodeAt(t+2)]<<6|m[e.charCodeAt(t+3)],s[l++]=i>>16&255,s[l++]=i>>8&255,s[l++]=255&i;return 2===o?(i=m[e.charCodeAt(t)]<<2|m[e.charCodeAt(t+1)]>>4,s[l++]=255&i):1===o&&(i=m[e.charCodeAt(t)]<<10|m[e.charCodeAt(t+1)]<<4|m[e.charCodeAt(t+2)]>>2,s[l++]=i>>8&255,s[l++]=255&i),s}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(se,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function ce(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function de(e){return null!=e&&(!!e._isBuffer||he(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&he(e.slice(0,0))}(e))}function he(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var pe=Object.freeze({__proto__:null,Buffer:A,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),A.alloc(+e)},isBuffer:de,kMaxLength:T});function fe(){throw new Error("setTimeout has not been defined")}function me(){throw new Error("clearTimeout has not been defined")}var ge=fe,ye=me;function be(e){if(ge===setTimeout)return setTimeout(e,0);if((ge===fe||!ge)&&setTimeout)return ge=setTimeout,setTimeout(e,0);try{return ge(e,0)}catch(t){try{return ge.call(null,e,0)}catch(t){return ge.call(this,e,0)}}}"function"==typeof p.setTimeout&&(ge=setTimeout),"function"==typeof p.clearTimeout&&(ye=clearTimeout);var ve,_e=[],xe=!1,we=-1;function Ee(){xe&&ve&&(xe=!1,ve.length?_e=ve.concat(_e):we=-1,_e.length&&Se())}function Se(){if(!xe){var e=be(Ee);xe=!0;for(var t=_e.length;t;){for(ve=_e,_e=[];++we<t;)ve&&ve[we].run();we=-1,t=_e.length}ve=null,xe=!1,function(e){if(ye===clearTimeout)return clearTimeout(e);if((ye===me||!ye)&&clearTimeout)return ye=clearTimeout,clearTimeout(e);try{return ye(e)}catch(t){try{return ye.call(null,e)}catch(t){return ye.call(this,e)}}}(e)}}function Te(e,t){this.fun=e,this.array=t}Te.prototype.run=function(){this.fun.apply(null,this.array)};var ke=p.performance||{};function Oe(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}ke.now||ke.mozNow||ke.msNow||ke.oNow||ke.webkitNow;var Ae,Ce,Re,Ne,Pe,Me,De,Ie,ze,Fe,Le,je,$e,Be,Ve,Ue,We,qe,Ge,He,Ye,Ke,Xe,Ze,Je,Qe,et,tt,nt,rt,it,ot,st,at,lt={exports:{}},ut=(Ae||(Ae=1,lt.exports=function e(t,n,r){function i(s,a){if(!n[s]){if(!t[s]){if(!a&&Oe)return Oe(s);if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var u=n[s]={exports:{}};t[s][0].call(u.exports,function(e){return i(t[s][1][e]||e)},u,u.exports,e,t,n,r)}return n[s].exports}for(var o=Oe,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(e,t,n){var r=e("./utils"),i=e("./support"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";n.encode=function(e){for(var t,n,i,s,a,l,u,c=[],d=0,h=e.length,p=h,f="string"!==r.getTypeOf(e);d<e.length;)p=h-d,i=f?(t=e[d++],n=d<h?e[d++]:0,d<h?e[d++]:0):(t=e.charCodeAt(d++),n=d<h?e.charCodeAt(d++):0,d<h?e.charCodeAt(d++):0),s=t>>2,a=(3&t)<<4|n>>4,l=1<p?(15&n)<<2|i>>6:64,u=2<p?63&i:64,c.push(o.charAt(s)+o.charAt(a)+o.charAt(l)+o.charAt(u));return c.join("")},n.decode=function(e){var t,n,r,s,a,l,u=0,c=0,d="data:";if(e.substr(0,5)===d)throw new Error("Invalid base64 input, it looks like a data url.");var h,p=3*(e=e.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(e.charAt(e.length-1)===o.charAt(64)&&p--,e.charAt(e.length-2)===o.charAt(64)&&p--,p%1!=0)throw new Error("Invalid base64 input, bad content length.");for(h=i.uint8array?new Uint8Array(0|p):new Array(0|p);u<e.length;)t=o.indexOf(e.charAt(u++))<<2|(s=o.indexOf(e.charAt(u++)))>>4,n=(15&s)<<4|(a=o.indexOf(e.charAt(u++)))>>2,r=(3&a)<<6|(l=o.indexOf(e.charAt(u++))),h[c++]=t,64!==a&&(h[c++]=n),64!==l&&(h[c++]=r);return h}},{"./support":30,"./utils":32}],2:[function(e,t,n){var r=e("./external"),i=e("./stream/DataWorker"),o=e("./stream/Crc32Probe"),s=e("./stream/DataLengthProbe");function a(e,t,n,r,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=n,this.compression=r,this.compressedContent=i}a.prototype={getContentWorker:function(){var e=new i(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new s("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new i(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(e,t,n){return e.pipe(new o).pipe(new s("uncompressedSize")).pipe(t.compressWorker(n)).pipe(new s("compressedSize")).withStreamInfo("compression",t)},t.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,n){var r=e("./stream/GenericWorker");n.STORE={magic:"\0\0",compressWorker:function(){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},n.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,n){var r=e("./utils"),i=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==r.getTypeOf(e)?function(e,t,n){var r=i,o=0+n;e^=-1;for(var s=0;s<o;s++)e=e>>>8^r[255&(e^t[s])];return~e}(0|t,e,e.length):function(e,t,n){var r=i,o=0+n;e^=-1;for(var s=0;s<o;s++)e=e>>>8^r[255&(e^t.charCodeAt(s))];return~e}(0|t,e,e.length):0}},{"./utils":32}],5:[function(e,t,n){n.base64=!1,n.binary=!1,n.dir=!1,n.createFolders=!0,n.date=null,n.compression=null,n.compressionOptions=null,n.comment=null,n.unixPermissions=null,n.dosPermissions=null},{}],6:[function(e,t,n){var r;r="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:r}},{lie:37}],7:[function(e,t,n){var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,i=e("pako"),o=e("./utils"),s=e("./stream/GenericWorker"),a=r?"uint8array":"array";function l(e,t){s.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}n.magic="\b\0",o.inherits(l,s),l.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(o.transformTo(a,e.data),!1)},l.prototype.flush=function(){s.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},l.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this._pako=null},l.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},n.compressWorker=function(e){return new l("Deflate",e)},n.uncompressWorker=function(){return new l("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,n){function r(e,t){var n,r="";for(n=0;n<t;n++)r+=String.fromCharCode(255&e),e>>>=8;return r}function i(e,t,n,i,s,c){var d,h,p=e.file,f=e.compression,m=c!==a.utf8encode,g=o.transformTo("string",c(p.name)),y=o.transformTo("string",a.utf8encode(p.name)),b=p.comment,v=o.transformTo("string",c(b)),_=o.transformTo("string",a.utf8encode(b)),x=y.length!==p.name.length,w=_.length!==b.length,E="",S="",T="",k=p.dir,O=p.date,A={crc32:0,compressedSize:0,uncompressedSize:0};t&&!n||(A.crc32=e.crc32,A.compressedSize=e.compressedSize,A.uncompressedSize=e.uncompressedSize);var C=0;t&&(C|=8),m||!x&&!w||(C|=2048);var R=0,N=0;k&&(R|=16),"UNIX"===s?(N=798,R|=function(e,t){var n=e;return e||(n=t?16893:33204),(65535&n)<<16}(p.unixPermissions,k)):(N=20,R|=function(e){return 63&(e||0)}(p.dosPermissions)),d=O.getUTCHours(),d<<=6,d|=O.getUTCMinutes(),d<<=5,d|=O.getUTCSeconds()/2,h=O.getUTCFullYear()-1980,h<<=4,h|=O.getUTCMonth()+1,h<<=5,h|=O.getUTCDate(),x&&(S=r(1,1)+r(l(g),4)+y,E+="up"+r(S.length,2)+S),w&&(T=r(1,1)+r(l(v),4)+_,E+="uc"+r(T.length,2)+T);var P="";return P+="\n\0",P+=r(C,2),P+=f.magic,P+=r(d,2),P+=r(h,2),P+=r(A.crc32,4),P+=r(A.compressedSize,4),P+=r(A.uncompressedSize,4),P+=r(g.length,2),P+=r(E.length,2),{fileRecord:u.LOCAL_FILE_HEADER+P+g+E,dirRecord:u.CENTRAL_FILE_HEADER+r(N,2)+P+r(v.length,2)+"\0\0\0\0"+r(R,4)+r(i,4)+g+E+v}}var o=e("../utils"),s=e("../stream/GenericWorker"),a=e("../utf8"),l=e("../crc32"),u=e("../signature");function c(e,t,n,r){s.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=n,this.encodeFileName=r,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(c,s),c.prototype.push=function(e){var t=e.meta.percent||0,n=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,s.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:n?(t+100*(n-r-1))/n:100}}))},c.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var n=i(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},c.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,n=i(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),t)this.push({data:function(e){return u.DATA_DESCRIPTOR+r(e.crc32,4)+r(e.compressedSize,4)+r(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},c.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var n=this.bytesWritten-e,i=function(e,t,n,i,s){var a=o.transformTo("string",s(i));return u.CENTRAL_DIRECTORY_END+"\0\0\0\0"+r(e,2)+r(e,2)+r(t,4)+r(n,4)+r(a.length,2)+a}(this.dirRecords.length,n,e,this.zipComment,this.encodeFileName);this.push({data:i,meta:{percent:100}})},c.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},c.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()}),e.on("error",function(e){t.error(e)}),this},c.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},c.prototype.error=function(e){var t=this._sources;if(!s.prototype.error.call(this,e))return!1;for(var n=0;n<t.length;n++)try{t[n].error(e)}catch(e){}return!0},c.prototype.lock=function(){s.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()},t.exports=c},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,n){var r=e("../compressions"),i=e("./ZipFileWorker");n.generateWorker=function(e,t,n){var o=new i(t.streamFiles,n,t.platform,t.encodeFileName),s=0;try{e.forEach(function(e,n){s++;var i=function(e,t){var n=e||t,i=r[n];if(!i)throw new Error(n+" is not a valid compression method !");return i}(n.options.compression,t.compression),a=n.options.compressionOptions||t.compressionOptions||{},l=n.dir,u=n.date;n._compressWorker(i,a).withStreamInfo("file",{name:e,dir:l,date:u,comment:n.comment||"",unixPermissions:n.unixPermissions,dosPermissions:n.dosPermissions}).pipe(o)}),o.entriesCount=s}catch(e){o.error(e)}return o}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,n){function r(){if(!(this instanceof r))return new r;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e=new r;for(var t in this)"function"!=typeof this[t]&&(e[t]=this[t]);return e}}(r.prototype=e("./object")).loadAsync=e("./load"),r.support=e("./support"),r.defaults=e("./defaults"),r.version="3.10.1",r.loadAsync=function(e,t){return(new r).loadAsync(e,t)},r.external=e("./external"),t.exports=r},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,n){var r=e("./utils"),i=e("./external"),o=e("./utf8"),s=e("./zipEntries"),a=e("./stream/Crc32Probe"),l=e("./nodejsUtils");function u(e){return new i.Promise(function(t,n){var r=e.decompressed.getContentWorker().pipe(new a);r.on("error",function(e){n(e)}).on("end",function(){r.streamInfo.crc32!==e.decompressed.crc32?n(new Error("Corrupted zip : CRC32 mismatch")):t()}).resume()})}t.exports=function(e,t){var n=this;return t=r.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),l.isNode&&l.isStream(e)?i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):r.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then(function(e){var n=new s(t);return n.load(e),n}).then(function(e){var n=[i.Promise.resolve(e)],r=e.files;if(t.checkCRC32)for(var o=0;o<r.length;o++)n.push(u(r[o]));return i.Promise.all(n)}).then(function(e){for(var i=e.shift(),o=i.files,s=0;s<o.length;s++){var a=o[s],l=a.fileNameStr,u=r.resolve(a.fileNameStr);n.file(u,a.decompressed,{binary:!0,optimizedBinaryString:!0,date:a.date,dir:a.dir,comment:a.fileCommentStr.length?a.fileCommentStr:null,unixPermissions:a.unixPermissions,dosPermissions:a.dosPermissions,createFolders:t.createFolders}),a.dir||(n.file(u).unsafeOriginalName=l)}return i.zipComment.length&&(n.comment=i.zipComment),n})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,n){var r=e("../utils"),i=e("../stream/GenericWorker");function o(e,t){i.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}r.inherits(o,i),o.prototype._bindStream=function(e){var t=this;(this._stream=e).pause(),e.on("data",function(e){t.push({data:e,meta:{percent:0}})}).on("error",function(e){t.isPaused?this.generatedError=e:t.error(e)}).on("end",function(){t.isPaused?t._upstreamEnded=!0:t.end()})},o.prototype.pause=function(){return!!i.prototype.pause.call(this)&&(this._stream.pause(),!0)},o.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=o},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,n){var r=e("readable-stream").Readable;function i(e,t,n){r.call(this,t),this._helper=e;var i=this;e.on("data",function(e,t){i.push(e)||i._helper.pause(),n&&n(t)}).on("error",function(e){i.emit("error",e)}).on("end",function(){i.push(null)})}e("../utils").inherits(i,r),i.prototype._read=function(){this._helper.resume()},t.exports=i},{"../utils":32,"readable-stream":16}],14:[function(e,t,n){t.exports={isNode:void 0!==A,newBufferFrom:function(e,t){if(A.from&&A.from!==Uint8Array.from)return A.from(e,t);if("number"==typeof e)throw new Error('The "data" argument must not be a number');return new A(e,t)},allocBuffer:function(e){if(A.alloc)return A.alloc(e);var t=new A(e);return t.fill(0),t},isBuffer:function(e){return de(e)},isStream:function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume}}},{}],15:[function(e,t,n){function r(e,t,n){var r,i=o.getTypeOf(t),a=o.extend(n||{},l);a.date=a.date||new Date,null!==a.compression&&(a.compression=a.compression.toUpperCase()),"string"==typeof a.unixPermissions&&(a.unixPermissions=parseInt(a.unixPermissions,8)),a.unixPermissions&&16384&a.unixPermissions&&(a.dir=!0),a.dosPermissions&&16&a.dosPermissions&&(a.dir=!0),a.dir&&(e=m(e)),a.createFolders&&(r=f(e))&&g.call(this,r,!0);var d="string"===i&&!1===a.binary&&!1===a.base64;n&&void 0!==n.binary||(a.binary=!d),(t instanceof u&&0===t.uncompressedSize||a.dir||!t||0===t.length)&&(a.base64=!1,a.binary=!0,t="",a.compression="STORE",i="string");var y;y=t instanceof u||t instanceof s?t:h.isNode&&h.isStream(t)?new p(e,t):o.prepareContent(e,t,a.binary,a.optimizedBinaryString,a.base64);var b=new c(e,y,a);this.files[e]=b}var i=e("./utf8"),o=e("./utils"),s=e("./stream/GenericWorker"),a=e("./stream/StreamHelper"),l=e("./defaults"),u=e("./compressedObject"),c=e("./zipObject"),d=e("./generate"),h=e("./nodejsUtils"),p=e("./nodejs/NodejsStreamInputAdapter"),f=function(e){"/"===e.slice(-1)&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return 0<t?e.substring(0,t):""},m=function(e){return"/"!==e.slice(-1)&&(e+="/"),e},g=function(e,t){return t=void 0!==t?t:l.createFolders,e=m(e),this.files[e]||r.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function y(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var b={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,n,r;for(t in this.files)r=this.files[t],(n=t.slice(this.root.length,t.length))&&t.slice(0,this.root.length)===this.root&&e(n,r)},filter:function(e){var t=[];return this.forEach(function(n,r){e(n,r)&&t.push(r)}),t},file:function(e,t,n){if(1!==arguments.length)return e=this.root+e,r.call(this,e,t,n),this;if(y(e)){var i=e;return this.filter(function(e,t){return!t.dir&&i.test(e)})}var o=this.files[this.root+e];return o&&!o.dir?o:null},folder:function(e){if(!e)return this;if(y(e))return this.filter(function(t,n){return n.dir&&e.test(t)});var t=this.root+e,n=g.call(this,t),r=this.clone();return r.root=n.name,r},remove:function(e){e=this.root+e;var t=this.files[e];if(t||("/"!==e.slice(-1)&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var n=this.filter(function(t,n){return n.name.slice(0,e.length)===e}),r=0;r<n.length;r++)delete this.files[n[r].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,n={};try{if((n=o.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:i.utf8encode})).type=n.type.toLowerCase(),n.compression=n.compression.toUpperCase(),"binarystring"===n.type&&(n.type="string"),!n.type)throw new Error("No output type specified.");o.checkSupport(n.type),"darwin"!==n.platform&&"freebsd"!==n.platform&&"linux"!==n.platform&&"sunos"!==n.platform||(n.platform="UNIX"),"win32"===n.platform&&(n.platform="DOS");var r=n.comment||this.comment||"";t=d.generateWorker(this,n,r)}catch(e){(t=new s("error")).error(e)}return new a(t,n.type||"string",n.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return(e=e||{}).type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}};t.exports=b},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,t,n){t.exports=e("stream")},{stream:void 0}],17:[function(e,t,n){var r=e("./DataReader");function i(e){r.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=255&e[t]}e("../utils").inherits(i,r),i.prototype.byteAt=function(e){return this.data[this.zero+e]},i.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),n=e.charCodeAt(1),r=e.charCodeAt(2),i=e.charCodeAt(3),o=this.length-4;0<=o;--o)if(this.data[o]===t&&this.data[o+1]===n&&this.data[o+2]===r&&this.data[o+3]===i)return o-this.zero;return-1},i.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),n=e.charCodeAt(1),r=e.charCodeAt(2),i=e.charCodeAt(3),o=this.readData(4);return t===o[0]&&n===o[1]&&r===o[2]&&i===o[3]},i.prototype.readData=function(e){if(this.checkOffset(e),0===e)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],18:[function(e,t,n){var r=e("../utils");function i(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}i.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t,n=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)n=(n<<8)+this.byteAt(t);return this.index+=e,n},readString:function(e){return r.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=i},{"../utils":32}],19:[function(e,t,n){var r=e("./Uint8ArrayReader");function i(e){r.call(this,e)}e("../utils").inherits(i,r),i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,n){var r=e("./DataReader");function i(e){r.call(this,e)}e("../utils").inherits(i,r),i.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},i.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},i.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(e,t,n){var r=e("./ArrayReader");function i(e){r.call(this,e)}e("../utils").inherits(i,r),i.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,n){var r=e("../utils"),i=e("../support"),o=e("./ArrayReader"),s=e("./StringReader"),a=e("./NodeBufferReader"),l=e("./Uint8ArrayReader");t.exports=function(e){var t=r.getTypeOf(e);return r.checkSupport(t),"string"!==t||i.uint8array?"nodebuffer"===t?new a(e):i.uint8array?new l(r.transformTo("uint8array",e)):new o(r.transformTo("array",e)):new s(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,n){n.LOCAL_FILE_HEADER="PK",n.CENTRAL_FILE_HEADER="PK",n.CENTRAL_DIRECTORY_END="PK",n.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",n.ZIP64_CENTRAL_DIRECTORY_END="PK",n.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,n){var r=e("./GenericWorker"),i=e("../utils");function o(e){r.call(this,"ConvertWorker to "+e),this.destType=e}i.inherits(o,r),o.prototype.processChunk=function(e){this.push({data:i.transformTo(this.destType,e.data),meta:e.meta})},t.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,n){var r=e("./GenericWorker"),i=e("../crc32");function o(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(o,r),o.prototype.processChunk=function(e){this.streamInfo.crc32=i(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,n){var r=e("../utils"),i=e("./GenericWorker");function o(e){i.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}r.inherits(o,i),o.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}i.prototype.processChunk.call(this,e)},t.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,n){var r=e("../utils"),i=e("./GenericWorker");function o(e){i.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=r.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}r.inherits(o,i),o.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,n){function r(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var n=0;n<this._listeners[e].length;n++)this._listeners[e][n].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.end()}),e.on("error",function(e){t.error(e)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var e=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}},t.exports=r},{}],29:[function(e,t,n){var r=e("../utils"),i=e("./ConvertWorker"),o=e("./GenericWorker"),s=e("../base64"),a=e("../support"),l=e("../external"),u=null;if(a.nodestream)try{u=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function c(e,t,n){var s=t;switch(t){case"blob":case"arraybuffer":s="uint8array";break;case"base64":s="string"}try{this._internalType=s,this._outputType=t,this._mimeType=n,r.checkSupport(s),this._worker=e.pipe(new i(s)),e.lock()}catch(e){this._worker=new o("error"),this._worker.error(e)}}c.prototype={accumulate:function(e){return function(e,t){return new l.Promise(function(n,i){var o=[],a=e._internalType,l=e._outputType,u=e._mimeType;e.on("data",function(e,n){o.push(e),t&&t(n)}).on("error",function(e){o=[],i(e)}).on("end",function(){try{var e=function(e,t,n){switch(e){case"blob":return r.newBlob(r.transformTo("arraybuffer",t),n);case"base64":return s.encode(t);default:return r.transformTo(e,t)}}(l,function(e,t){var n,r=0,i=null,o=0;for(n=0;n<t.length;n++)o+=t[n].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(i=new Uint8Array(o),n=0;n<t.length;n++)i.set(t[n],r),r+=t[n].length;return i;case"nodebuffer":return A.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}(a,o),u);n(e)}catch(e){i(e)}o=[]}).resume()})}(this,e)},on:function(e,t){var n=this;return"data"===e?this._worker.on(e,function(e){t.call(n,e.data,e.meta)}):this._worker.on(e,function(){r.delay(t,arguments,n)}),this},resume:function(){return r.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(r.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new u(this,{objectMode:"nodebuffer"!==this._outputType},e)}},t.exports=c},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,t,n){if(n.base64=!0,n.array=!0,n.string=!0,n.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,n.nodebuffer=void 0!==A,n.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)n.blob=!1;else{var r=new ArrayBuffer(0);try{n.blob=0===new Blob([r],{type:"application/zip"}).size}catch(e){try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(r),n.blob=0===i.getBlob("application/zip").size}catch(e){n.blob=!1}}}try{n.nodestream=!!e("readable-stream").Readable}catch(e){n.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,n){for(var r=e("./utils"),i=e("./support"),o=e("./nodejsUtils"),s=e("./stream/GenericWorker"),a=new Array(256),l=0;l<256;l++)a[l]=252<=l?6:248<=l?5:240<=l?4:224<=l?3:192<=l?2:1;function u(){s.call(this,"utf-8 decode"),this.leftOver=null}function c(){s.call(this,"utf-8 encode")}a[254]=a[254]=1,n.utf8encode=function(e){return i.nodebuffer?o.newBufferFrom(e,"utf-8"):function(e){var t,n,r,o,s,a=e.length,l=0;for(o=0;o<a;o++)55296==(64512&(n=e.charCodeAt(o)))&&o+1<a&&56320==(64512&(r=e.charCodeAt(o+1)))&&(n=65536+(n-55296<<10)+(r-56320),o++),l+=n<128?1:n<2048?2:n<65536?3:4;for(t=i.uint8array?new Uint8Array(l):new Array(l),o=s=0;s<l;o++)55296==(64512&(n=e.charCodeAt(o)))&&o+1<a&&56320==(64512&(r=e.charCodeAt(o+1)))&&(n=65536+(n-55296<<10)+(r-56320),o++),n<128?t[s++]=n:(n<2048?t[s++]=192|n>>>6:(n<65536?t[s++]=224|n>>>12:(t[s++]=240|n>>>18,t[s++]=128|n>>>12&63),t[s++]=128|n>>>6&63),t[s++]=128|63&n);return t}(e)},n.utf8decode=function(e){return i.nodebuffer?r.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,n,i,o,s=e.length,l=new Array(2*s);for(t=n=0;t<s;)if((i=e[t++])<128)l[n++]=i;else if(4<(o=a[i]))l[n++]=65533,t+=o-1;else{for(i&=2===o?31:3===o?15:7;1<o&&t<s;)i=i<<6|63&e[t++],o--;1<o?l[n++]=65533:i<65536?l[n++]=i:(i-=65536,l[n++]=55296|i>>10&1023,l[n++]=56320|1023&i)}return l.length!==n&&(l.subarray?l=l.subarray(0,n):l.length=n),r.applyFromCharCode(l)}(e=r.transformTo(i.uint8array?"uint8array":"array",e))},r.inherits(u,s),u.prototype.processChunk=function(e){var t=r.transformTo(i.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var o=t;(t=new Uint8Array(o.length+this.leftOver.length)).set(this.leftOver,0),t.set(o,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var s=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;0<=n&&128==(192&e[n]);)n--;return n<0||0===n?t:n+a[e[n]]>t?n:t}(t),l=t;s!==t.length&&(i.uint8array?(l=t.subarray(0,s),this.leftOver=t.subarray(s,t.length)):(l=t.slice(0,s),this.leftOver=t.slice(s,t.length))),this.push({data:n.utf8decode(l),meta:e.meta})},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:n.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},n.Utf8DecodeWorker=u,r.inherits(c,s),c.prototype.processChunk=function(e){this.push({data:n.utf8encode(e.data),meta:e.meta})},n.Utf8EncodeWorker=c},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,n){var r=e("./support"),i=e("./base64"),o=e("./nodejsUtils"),s=e("./external");function a(e){return e}function l(e,t){for(var n=0;n<e.length;++n)t[n]=255&e.charCodeAt(n);return t}e("setimmediate"),n.newBlob=function(e,t){n.checkSupport("blob");try{return new Blob([e],{type:t})}catch(n){try{var r=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return r.append(e),r.getBlob(t)}catch(e){throw new Error("Bug : can't construct the Blob.")}}};var u={stringifyByChunk:function(e,t,n){var r=[],i=0,o=e.length;if(o<=n)return String.fromCharCode.apply(null,e);for(;i<o;)"array"===t||"nodebuffer"===t?r.push(String.fromCharCode.apply(null,e.slice(i,Math.min(i+n,o)))):r.push(String.fromCharCode.apply(null,e.subarray(i,Math.min(i+n,o)))),i+=n;return r.join("")},stringifyByChar:function(e){for(var t="",n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t},applyCanBeUsed:{uint8array:function(){try{return r.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){return!1}}(),nodebuffer:function(){try{return r.nodebuffer&&1===String.fromCharCode.apply(null,o.allocBuffer(1)).length}catch(e){return!1}}()}};function c(e){var t=65536,r=n.getTypeOf(e),i=!0;if("uint8array"===r?i=u.applyCanBeUsed.uint8array:"nodebuffer"===r&&(i=u.applyCanBeUsed.nodebuffer),i)for(;1<t;)try{return u.stringifyByChunk(e,r,t)}catch(e){t=Math.floor(t/2)}return u.stringifyByChar(e)}function d(e,t){for(var n=0;n<e.length;n++)t[n]=e[n];return t}n.applyFromCharCode=c;var h={};h.string={string:a,array:function(e){return l(e,new Array(e.length))},arraybuffer:function(e){return h.string.uint8array(e).buffer},uint8array:function(e){return l(e,new Uint8Array(e.length))},nodebuffer:function(e){return l(e,o.allocBuffer(e.length))}},h.array={string:c,array:a,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return o.newBufferFrom(e)}},h.arraybuffer={string:function(e){return c(new Uint8Array(e))},array:function(e){return d(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:a,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return o.newBufferFrom(new Uint8Array(e))}},h.uint8array={string:c,array:function(e){return d(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:a,nodebuffer:function(e){return o.newBufferFrom(e)}},h.nodebuffer={string:c,array:function(e){return d(e,new Array(e.length))},arraybuffer:function(e){return h.nodebuffer.uint8array(e).buffer},uint8array:function(e){return d(e,new Uint8Array(e.length))},nodebuffer:a},n.transformTo=function(e,t){if(t=t||"",!e)return t;n.checkSupport(e);var r=n.getTypeOf(t);return h[r][e](t)},n.resolve=function(e){for(var t=e.split("/"),n=[],r=0;r<t.length;r++){var i=t[r];"."===i||""===i&&0!==r&&r!==t.length-1||(".."===i?n.pop():n.push(i))}return n.join("/")},n.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":r.nodebuffer&&o.isBuffer(e)?"nodebuffer":r.uint8array&&e instanceof Uint8Array?"uint8array":r.arraybuffer&&e instanceof ArrayBuffer?"arraybuffer":void 0},n.checkSupport=function(e){if(!r[e.toLowerCase()])throw new Error(e+" is not supported by this platform")},n.MAX_VALUE_16BITS=65535,n.MAX_VALUE_32BITS=-1,n.pretty=function(e){var t,n,r="";for(n=0;n<(e||"").length;n++)r+="\\x"+((t=e.charCodeAt(n))<16?"0":"")+t.toString(16).toUpperCase();return r},n.delay=function(e,t,n){setImmediate(function(){e.apply(n||null,t||[])})},n.inherits=function(e,t){function n(){}n.prototype=t.prototype,e.prototype=new n},n.extend=function(){var e,t,n={};for(e=0;e<arguments.length;e++)for(t in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],t)&&void 0===n[t]&&(n[t]=arguments[e][t]);return n},n.prepareContent=function(e,t,o,a,u){return s.Promise.resolve(t).then(function(e){return r.blob&&(e instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(e)))&&"undefined"!=typeof FileReader?new s.Promise(function(t,n){var r=new FileReader;r.onload=function(e){t(e.target.result)},r.onerror=function(e){n(e.target.error)},r.readAsArrayBuffer(e)}):e}).then(function(t){var c=n.getTypeOf(t);return c?("arraybuffer"===c?t=n.transformTo("uint8array",t):"string"===c&&(u?t=i.decode(t):o&&!0!==a&&(t=function(e){return l(e,r.uint8array?new Uint8Array(e.length):new Array(e.length))}(t))),t):s.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,t,n){var r=e("./reader/readerFor"),i=e("./utils"),o=e("./signature"),s=e("./zipEntry"),a=e("./support");function l(e){this.files=[],this.loadOptions=e}l.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+i.pretty(t)+", expected "+i.pretty(e)+")")}},isSignature:function(e,t){var n=this.reader.index;this.reader.setIndex(e);var r=this.reader.readString(4)===t;return this.reader.setIndex(n),r},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=a.uint8array?"uint8array":"array",n=i.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(n)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e,t,n,r=this.zip64EndOfCentralSize-44;0<r;)e=this.reader.readInt(2),t=this.reader.readInt(4),n=this.reader.readData(t),this.zip64ExtensibleData[e]={id:e,length:t,value:n}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(o.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER);)(e=new s({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(o.CENTRAL_DIRECTORY_END);if(e<0)throw this.isSignature(0,o.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(e);var t=e;if(this.checkSignature(o.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===i.MAX_VALUE_16BITS||this.diskWithCentralDirStart===i.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===i.MAX_VALUE_16BITS||this.centralDirRecords===i.MAX_VALUE_16BITS||this.centralDirSize===i.MAX_VALUE_32BITS||this.centralDirOffset===i.MAX_VALUE_32BITS){if(this.zip64=!0,(e=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,o.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var n=this.centralDirOffset+this.centralDirSize;this.zip64&&(n+=20,n+=12+this.zip64EndOfCentralSize);var r=t-n;if(0<r)this.isSignature(t,o.CENTRAL_FILE_HEADER)||(this.reader.zero=r);else if(r<0)throw new Error("Corrupted zip: missing "+Math.abs(r)+" bytes.")},prepareReader:function(e){this.reader=r(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=l},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,t,n){var r=e("./reader/readerFor"),i=e("./utils"),o=e("./compressedObject"),s=e("./crc32"),a=e("./utf8"),l=e("./compressions"),u=e("./support");function c(e,t){this.options=e,this.loadOptions=t}c.prototype={isEncrypted:function(){return!(1&~this.bitFlag)},useUTF8:function(){return!(2048&~this.bitFlag)},readLocalPart:function(e){var t,n;if(e.skip(22),this.fileNameLength=e.readInt(2),n=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(n),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(t=function(e){for(var t in l)if(Object.prototype.hasOwnProperty.call(l,t)&&l[t].magic===e)return l[t];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+i.pretty(this.compressionMethod)+" unknown (inner file : "+i.transformTo("string",this.fileName)+")");this.decompressed=new o(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=r(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,n,r,i=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4<i;)t=e.readInt(2),n=e.readInt(2),r=e.readData(n),this.extraFields[t]={id:t,length:n,value:r};e.setIndex(i)},handleUTF8:function(){var e=u.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=a.utf8decode(this.fileName),this.fileCommentStr=a.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(null!==t)this.fileNameStr=t;else{var n=i.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(n)}var r=this.findExtraFieldUnicodeComment();if(null!==r)this.fileCommentStr=r;else{var o=i.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(o)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=r(e.value);return 1!==t.readInt(1)||s(this.fileName)!==t.readInt(4)?null:a.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=r(e.value);return 1!==t.readInt(1)||s(this.fileComment)!==t.readInt(4)?null:a.utf8decode(t.readData(e.length-5))}return null}},t.exports=c},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,t,n){function r(e,t,n){this.name=e,this.dir=n.dir,this.date=n.date,this.comment=n.comment,this.unixPermissions=n.unixPermissions,this.dosPermissions=n.dosPermissions,this._data=t,this._dataBinary=n.binary,this.options={compression:n.compression,compressionOptions:n.compressionOptions}}var i=e("./stream/StreamHelper"),o=e("./stream/DataWorker"),s=e("./utf8"),a=e("./compressedObject"),l=e("./stream/GenericWorker");r.prototype={internalStream:function(e){var t=null,n="string";try{if(!e)throw new Error("No output type specified.");var r="string"===(n=e.toLowerCase())||"text"===n;"binarystring"!==n&&"text"!==n||(n="string"),t=this._decompressWorker();var o=!this._dataBinary;o&&!r&&(t=t.pipe(new s.Utf8EncodeWorker)),!o&&r&&(t=t.pipe(new s.Utf8DecodeWorker))}catch(e){(t=new l("error")).error(e)}return new i(t,n,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof a&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var n=this._decompressWorker();return this._dataBinary||(n=n.pipe(new s.Utf8EncodeWorker)),a.createWorkerFrom(n,e,t)},_decompressWorker:function(){return this._data instanceof a?this._data.getContentWorker():this._data instanceof l?this._data:new o(this._data)}};for(var u=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],c=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},d=0;d<u.length;d++)r.prototype[u[d]]=c;t.exports=r},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,t,n){(function(e){var n,r,i=e.MutationObserver||e.WebKitMutationObserver;if(i){var o=0,s=new i(c),a=e.document.createTextNode("");s.observe(a,{characterData:!0}),n=function(){a.data=o=++o%2}}else if(e.setImmediate||void 0===e.MessageChannel)n="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){c(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(c,0)};else{var l=new e.MessageChannel;l.port1.onmessage=c,n=function(){l.port2.postMessage(0)}}var u=[];function c(){var e,t;r=!0;for(var n=u.length;n;){for(t=u,u=[],e=-1;++e<n;)t[e]();n=u.length}r=!1}t.exports=function(e){1!==u.push(e)||r||n()}}).call(this,void 0!==p?p:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(e,t,n){var r=e("immediate");function i(){}var o={},s=["REJECTED"],a=["FULFILLED"],l=["PENDING"];function u(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,e!==i&&p(this,e)}function c(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function d(e,t,n){r(function(){var r;try{r=t(n)}catch(r){return o.reject(e,r)}r===e?o.reject(e,new TypeError("Cannot resolve promise with itself")):o.resolve(e,r)})}function h(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function p(e,t){var n=!1;function r(t){n||(n=!0,o.reject(e,t))}function i(t){n||(n=!0,o.resolve(e,t))}var s=f(function(){t(i,r)});"error"===s.status&&r(s.value)}function f(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}(t.exports=u).prototype.finally=function(e){if("function"!=typeof e)return this;var t=this.constructor;return this.then(function(n){return t.resolve(e()).then(function(){return n})},function(n){return t.resolve(e()).then(function(){throw n})})},u.prototype.catch=function(e){return this.then(null,e)},u.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===s)return this;var n=new this.constructor(i);return this.state!==l?d(n,this.state===a?e:t,this.outcome):this.queue.push(new c(n,e,t)),n},c.prototype.callFulfilled=function(e){o.resolve(this.promise,e)},c.prototype.otherCallFulfilled=function(e){d(this.promise,this.onFulfilled,e)},c.prototype.callRejected=function(e){o.reject(this.promise,e)},c.prototype.otherCallRejected=function(e){d(this.promise,this.onRejected,e)},o.resolve=function(e,t){var n=f(h,t);if("error"===n.status)return o.reject(e,n.value);var r=n.value;if(r)p(e,r);else{e.state=a,e.outcome=t;for(var i=-1,s=e.queue.length;++i<s;)e.queue[i].callFulfilled(t)}return e},o.reject=function(e,t){e.state=s,e.outcome=t;for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].callRejected(t);return e},u.resolve=function(e){return e instanceof this?e:o.resolve(new this(i),e)},u.reject=function(e){var t=new this(i);return o.reject(t,e)},u.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,r=!1;if(!n)return this.resolve([]);for(var s=new Array(n),a=0,l=-1,u=new this(i);++l<n;)c(e[l],l);return u;function c(e,i){t.resolve(e).then(function(e){s[i]=e,++a!==n||r||(r=!0,o.resolve(u,s))},function(e){r||(r=!0,o.reject(u,e))})}},u.race=function(e){if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var t=e.length,n=!1;if(!t)return this.resolve([]);for(var r,s=-1,a=new this(i);++s<t;)r=e[s],this.resolve(r).then(function(e){n||(n=!0,o.resolve(a,e))},function(e){n||(n=!0,o.reject(a,e))});return a}},{immediate:36}],38:[function(e,t,n){var r={};(0,e("./lib/utils/common").assign)(r,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=r},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,t,n){var r=e("./zlib/deflate"),i=e("./utils/common"),o=e("./utils/strings"),s=e("./zlib/messages"),a=e("./zlib/zstream"),l=Object.prototype.toString;function u(e){if(!(this instanceof u))return new u(e);this.options=i.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&&0<t.windowBits?t.windowBits=-t.windowBits:t.gzip&&0<t.windowBits&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var n=r.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==n)throw new Error(s[n]);if(t.header&&r.deflateSetHeader(this.strm,t.header),t.dictionary){var c;if(c="string"==typeof t.dictionary?o.string2buf(t.dictionary):"[object ArrayBuffer]"===l.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(n=r.deflateSetDictionary(this.strm,c)))throw new Error(s[n]);this._dict_set=!0}}function c(e,t){var n=new u(t);if(n.push(e,!0),n.err)throw n.msg||s[n.err];return n.result}u.prototype.push=function(e,t){var n,s,a=this.strm,u=this.options.chunkSize;if(this.ended)return!1;s=t===~~t?t:!0===t?4:0,"string"==typeof e?a.input=o.string2buf(e):"[object ArrayBuffer]"===l.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new i.Buf8(u),a.next_out=0,a.avail_out=u),1!==(n=r.deflate(a,s))&&0!==n)return this.onEnd(n),!(this.ended=!0);0!==a.avail_out&&(0!==a.avail_in||4!==s&&2!==s)||("string"===this.options.to?this.onData(o.buf2binstring(i.shrinkBuf(a.output,a.next_out))):this.onData(i.shrinkBuf(a.output,a.next_out)))}while((0<a.avail_in||0===a.avail_out)&&1!==n);return 4===s?(n=r.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,0===n):2!==s||(this.onEnd(0),!(a.avail_out=0))},u.prototype.onData=function(e){this.chunks.push(e)},u.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},n.Deflate=u,n.deflate=c,n.deflateRaw=function(e,t){return(t=t||{}).raw=!0,c(e,t)},n.gzip=function(e,t){return(t=t||{}).gzip=!0,c(e,t)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,n){var r=e("./zlib/inflate"),i=e("./utils/common"),o=e("./utils/strings"),s=e("./zlib/constants"),a=e("./zlib/messages"),l=e("./zlib/zstream"),u=e("./zlib/gzheader"),c=Object.prototype.toString;function d(e){if(!(this instanceof d))return new d(e);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&0<=t.windowBits&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(0<=t.windowBits&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),15<t.windowBits&&t.windowBits<48&&!(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var n=r.inflateInit2(this.strm,t.windowBits);if(n!==s.Z_OK)throw new Error(a[n]);this.header=new u,r.inflateGetHeader(this.strm,this.header)}function h(e,t){var n=new d(t);if(n.push(e,!0),n.err)throw n.msg||a[n.err];return n.result}d.prototype.push=function(e,t){var n,a,l,u,d,h,p=this.strm,f=this.options.chunkSize,m=this.options.dictionary,g=!1;if(this.ended)return!1;a=t===~~t?t:!0===t?s.Z_FINISH:s.Z_NO_FLUSH,"string"==typeof e?p.input=o.binstring2buf(e):"[object ArrayBuffer]"===c.call(e)?p.input=new Uint8Array(e):p.input=e,p.next_in=0,p.avail_in=p.input.length;do{if(0===p.avail_out&&(p.output=new i.Buf8(f),p.next_out=0,p.avail_out=f),(n=r.inflate(p,s.Z_NO_FLUSH))===s.Z_NEED_DICT&&m&&(h="string"==typeof m?o.string2buf(m):"[object ArrayBuffer]"===c.call(m)?new Uint8Array(m):m,n=r.inflateSetDictionary(this.strm,h)),n===s.Z_BUF_ERROR&&!0===g&&(n=s.Z_OK,g=!1),n!==s.Z_STREAM_END&&n!==s.Z_OK)return this.onEnd(n),!(this.ended=!0);p.next_out&&(0!==p.avail_out&&n!==s.Z_STREAM_END&&(0!==p.avail_in||a!==s.Z_FINISH&&a!==s.Z_SYNC_FLUSH)||("string"===this.options.to?(l=o.utf8border(p.output,p.next_out),u=p.next_out-l,d=o.buf2string(p.output,l),p.next_out=u,p.avail_out=f-u,u&&i.arraySet(p.output,p.output,l,u,0),this.onData(d)):this.onData(i.shrinkBuf(p.output,p.next_out)))),0===p.avail_in&&0===p.avail_out&&(g=!0)}while((0<p.avail_in||0===p.avail_out)&&n!==s.Z_STREAM_END);return n===s.Z_STREAM_END&&(a=s.Z_FINISH),a===s.Z_FINISH?(n=r.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===s.Z_OK):a!==s.Z_SYNC_FLUSH||(this.onEnd(s.Z_OK),!(p.avail_out=0))},d.prototype.onData=function(e){this.chunks.push(e)},d.prototype.onEnd=function(e){e===s.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},n.Inflate=d,n.inflate=h,n.inflateRaw=function(e,t){return(t=t||{}).raw=!0,h(e,t)},n.ungzip=h},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,t,n){var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;n.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}}return e},n.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var i={arraySet:function(e,t,n,r,i){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+r),i);else for(var o=0;o<r;o++)e[i+o]=t[n+o]},flattenChunks:function(e){var t,n,r,i,o,s;for(t=r=0,n=e.length;t<n;t++)r+=e[t].length;for(s=new Uint8Array(r),t=i=0,n=e.length;t<n;t++)o=e[t],s.set(o,i),i+=o.length;return s}},o={arraySet:function(e,t,n,r,i){for(var o=0;o<r;o++)e[i+o]=t[n+o]},flattenChunks:function(e){return[].concat.apply([],e)}};n.setTyped=function(e){e?(n.Buf8=Uint8Array,n.Buf16=Uint16Array,n.Buf32=Int32Array,n.assign(n,i)):(n.Buf8=Array,n.Buf16=Array,n.Buf32=Array,n.assign(n,o))},n.setTyped(r)},{}],42:[function(e,t,n){var r=e("./common"),i=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch(e){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){o=!1}for(var s=new r.Buf8(256),a=0;a<256;a++)s[a]=252<=a?6:248<=a?5:240<=a?4:224<=a?3:192<=a?2:1;function l(e,t){if(t<65537&&(e.subarray&&o||!e.subarray&&i))return String.fromCharCode.apply(null,r.shrinkBuf(e,t));for(var n="",s=0;s<t;s++)n+=String.fromCharCode(e[s]);return n}s[254]=s[254]=1,n.string2buf=function(e){var t,n,i,o,s,a=e.length,l=0;for(o=0;o<a;o++)55296==(64512&(n=e.charCodeAt(o)))&&o+1<a&&56320==(64512&(i=e.charCodeAt(o+1)))&&(n=65536+(n-55296<<10)+(i-56320),o++),l+=n<128?1:n<2048?2:n<65536?3:4;for(t=new r.Buf8(l),o=s=0;s<l;o++)55296==(64512&(n=e.charCodeAt(o)))&&o+1<a&&56320==(64512&(i=e.charCodeAt(o+1)))&&(n=65536+(n-55296<<10)+(i-56320),o++),n<128?t[s++]=n:(n<2048?t[s++]=192|n>>>6:(n<65536?t[s++]=224|n>>>12:(t[s++]=240|n>>>18,t[s++]=128|n>>>12&63),t[s++]=128|n>>>6&63),t[s++]=128|63&n);return t},n.buf2binstring=function(e){return l(e,e.length)},n.binstring2buf=function(e){for(var t=new r.Buf8(e.length),n=0,i=t.length;n<i;n++)t[n]=e.charCodeAt(n);return t},n.buf2string=function(e,t){var n,r,i,o,a=t||e.length,u=new Array(2*a);for(n=r=0;n<a;)if((i=e[n++])<128)u[r++]=i;else if(4<(o=s[i]))u[r++]=65533,n+=o-1;else{for(i&=2===o?31:3===o?15:7;1<o&&n<a;)i=i<<6|63&e[n++],o--;1<o?u[r++]=65533:i<65536?u[r++]=i:(i-=65536,u[r++]=55296|i>>10&1023,u[r++]=56320|1023&i)}return l(u,r)},n.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;0<=n&&128==(192&e[n]);)n--;return n<0||0===n?t:n+s[e[n]]>t?n:t}},{"./common":41}],43:[function(e,t,n){t.exports=function(e,t,n,r){for(var i=65535&e,o=e>>>16&65535,s=0;0!==n;){for(n-=s=2e3<n?2e3:n;o=o+(i=i+t[r++]|0)|0,--s;);i%=65521,o%=65521}return i|o<<16}},{}],44:[function(e,t,n){t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(e,t,n){var r=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t,n,i){var o=r,s=i+n;e^=-1;for(var a=i;a<s;a++)e=e>>>8^o[255&(e^t[a])];return~e}},{}],46:[function(e,t,n){var r,i=e("../utils/common"),o=e("./trees"),s=e("./adler32"),a=e("./crc32"),l=e("./messages"),u=-2,c=258,d=262,h=113;function p(e,t){return e.msg=l[t],t}function f(e){return(e<<1)-(4<e?9:0)}function m(e){for(var t=e.length;0<=--t;)e[t]=0}function g(e){var t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(i.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))}function y(e,t){o._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,g(e.strm)}function b(e,t){e.pending_buf[e.pending++]=t}function v(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function _(e,t){var n,r,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-d?e.strstart-(e.w_size-d):0,u=e.window,h=e.w_mask,p=e.prev,f=e.strstart+c,m=u[o+s-1],g=u[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(n=t)+s]===g&&u[n+s-1]===m&&u[n]===u[o]&&u[++n]===u[o+1]){o+=2,n++;do{}while(u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&o<f);if(r=c-(f-o),o=f-c,s<r){if(e.match_start=t,a<=(s=r))break;m=u[o+s-1],g=u[o+s]}}}while((t=p[t&h])>l&&0!=--i);return s<=e.lookahead?s:e.lookahead}function x(e){var t,n,r,o,l,u,c,h,p,f,m=e.w_size;do{if(o=e.window_size-e.lookahead-e.strstart,e.strstart>=m+(m-d)){for(i.arraySet(e.window,e.window,m,m,0),e.match_start-=m,e.strstart-=m,e.block_start-=m,t=n=e.hash_size;r=e.head[--t],e.head[t]=m<=r?r-m:0,--n;);for(t=n=m;r=e.prev[--t],e.prev[t]=m<=r?r-m:0,--n;);o+=m}if(0===e.strm.avail_in)break;if(u=e.strm,c=e.window,h=e.strstart+e.lookahead,f=void 0,(p=o)<(f=u.avail_in)&&(f=p),n=0===f?0:(u.avail_in-=f,i.arraySet(c,u.input,u.next_in,f,h),1===u.state.wrap?u.adler=s(u.adler,c,f,h):2===u.state.wrap&&(u.adler=a(u.adler,c,f,h)),u.next_in+=f,u.total_in+=f,f),e.lookahead+=n,e.lookahead+e.insert>=3)for(l=e.strstart-e.insert,e.ins_h=e.window[l],e.ins_h=(e.ins_h<<e.hash_shift^e.window[l+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[l+3-1])&e.hash_mask,e.prev[l&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=l,l++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<d&&0!==e.strm.avail_in)}function w(e,t){for(var n,r;;){if(e.lookahead<d){if(x(e),e.lookahead<d&&0===t)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==n&&e.strstart-n<=e.w_size-d&&(e.match_length=_(e,n)),e.match_length>=3)if(r=o._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart,0!=--e.match_length;);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else r=o._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(y(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(y(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(y(e,!1),0===e.strm.avail_out)?1:2}function E(e,t){for(var n,r,i;;){if(e.lookahead<d){if(x(e),e.lookahead<d&&0===t)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==n&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-d&&(e.match_length=_(e,n),e.match_length<=5&&(1===e.strategy||3===e.match_length&&4096<e.strstart-e.match_start)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-3,r=o._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!=--e.prev_length;);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(y(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((r=o._tr_tally(e,0,e.window[e.strstart-1]))&&y(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=o._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(y(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(y(e,!1),0===e.strm.avail_out)?1:2}function S(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}function T(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(1146),this.dyn_dtree=new i.Buf16(122),this.bl_tree=new i.Buf16(78),m(this.dyn_ltree),m(this.dyn_dtree),m(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(16),this.heap=new i.Buf16(573),m(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(573),m(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function k(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=2,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?42:h,e.adler=2===t.wrap?0:1,t.last_flush=0,o._tr_init(t),0):p(e,u)}function O(e){var t=k(e);return 0===t&&function(e){e.window_size=2*e.w_size,m(e.head),e.max_lazy_match=r[e.level].max_lazy,e.good_match=r[e.level].good_length,e.nice_match=r[e.level].nice_length,e.max_chain_length=r[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=2,e.match_available=0,e.ins_h=0}(e.state),t}function A(e,t,n,r,o,s){if(!e)return u;var a=1;if(-1===t&&(t=6),r<0?(a=0,r=-r):15<r&&(a=2,r-=16),o<1||9<o||8!==n||r<8||15<r||t<0||9<t||s<0||4<s)return p(e,u);8===r&&(r=9);var l=new T;return(e.state=l).strm=e,l.wrap=a,l.gzhead=null,l.w_bits=r,l.w_size=1<<l.w_bits,l.w_mask=l.w_size-1,l.hash_bits=o+7,l.hash_size=1<<l.hash_bits,l.hash_mask=l.hash_size-1,l.hash_shift=~~((l.hash_bits+3-1)/3),l.window=new i.Buf8(2*l.w_size),l.head=new i.Buf16(l.hash_size),l.prev=new i.Buf16(l.w_size),l.lit_bufsize=1<<o+6,l.pending_buf_size=4*l.lit_bufsize,l.pending_buf=new i.Buf8(l.pending_buf_size),l.d_buf=1*l.lit_bufsize,l.l_buf=3*l.lit_bufsize,l.level=t,l.strategy=s,l.method=n,O(e)}r=[new S(0,0,0,0,function(e,t){var n=65535;for(n>e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(x(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,y(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-d&&(y(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(y(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(y(e,!1),e.strm.avail_out),1)}),new S(4,4,8,4,w),new S(4,5,16,8,w),new S(4,6,32,32,w),new S(4,4,16,16,E),new S(8,16,32,32,E),new S(8,16,128,128,E),new S(8,32,128,256,E),new S(32,128,258,1024,E),new S(32,258,258,4096,E)],n.deflateInit=function(e,t){return A(e,t,8,15,8,0)},n.deflateInit2=A,n.deflateReset=O,n.deflateResetKeep=k,n.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?u:(e.state.gzhead=t,0):u},n.deflate=function(e,t){var n,i,s,l;if(!e||!e.state||5<t||t<0)return e?p(e,u):u;if(i=e.state,!e.output||!e.input&&0!==e.avail_in||666===i.status&&4!==t)return p(e,0===e.avail_out?-5:u);if(i.strm=e,n=i.last_flush,i.last_flush=t,42===i.status)if(2===i.wrap)e.adler=0,b(i,31),b(i,139),b(i,8),i.gzhead?(b(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),b(i,255&i.gzhead.time),b(i,i.gzhead.time>>8&255),b(i,i.gzhead.time>>16&255),b(i,i.gzhead.time>>24&255),b(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),b(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(b(i,255&i.gzhead.extra.length),b(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=a(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(b(i,0),b(i,0),b(i,0),b(i,0),b(i,0),b(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),b(i,3),i.status=h);else{var d=8+(i.w_bits-8<<4)<<8;d|=(2<=i.strategy||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(d|=32),d+=31-d%31,i.status=h,v(i,d),0!==i.strstart&&(v(i,e.adler>>>16),v(i,65535&e.adler)),e.adler=1}if(69===i.status)if(i.gzhead.extra){for(s=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),g(e),s=i.pending,i.pending!==i.pending_buf_size));)b(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){s=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),g(e),s=i.pending,i.pending===i.pending_buf_size)){l=1;break}l=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,b(i,l)}while(0!==l);i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),0===l&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){s=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),g(e),s=i.pending,i.pending===i.pending_buf_size)){l=1;break}l=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,b(i,l)}while(0!==l);i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),0===l&&(i.status=103)}else i.status=103;if(103===i.status&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&g(e),i.pending+2<=i.pending_buf_size&&(b(i,255&e.adler),b(i,e.adler>>8&255),e.adler=0,i.status=h)):i.status=h),0!==i.pending){if(g(e),0===e.avail_out)return i.last_flush=-1,0}else if(0===e.avail_in&&f(t)<=f(n)&&4!==t)return p(e,-5);if(666===i.status&&0!==e.avail_in)return p(e,-5);if(0!==e.avail_in||0!==i.lookahead||0!==t&&666!==i.status){var _=2===i.strategy?function(e,t){for(var n;;){if(0===e.lookahead&&(x(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,n=o._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(y(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(y(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(y(e,!1),0===e.strm.avail_out)?1:2}(i,t):3===i.strategy?function(e,t){for(var n,r,i,s,a=e.window;;){if(e.lookahead<=c){if(x(e),e.lookahead<=c&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&0<e.strstart&&(r=a[i=e.strstart-1])===a[++i]&&r===a[++i]&&r===a[++i]){s=e.strstart+c;do{}while(r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&i<s);e.match_length=c-(s-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(n=o._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=o._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(y(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(y(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(y(e,!1),0===e.strm.avail_out)?1:2}(i,t):r[i.level].func(i,t);if(3!==_&&4!==_||(i.status=666),1===_||3===_)return 0===e.avail_out&&(i.last_flush=-1),0;if(2===_&&(1===t?o._tr_align(i):5!==t&&(o._tr_stored_block(i,0,0,!1),3===t&&(m(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),g(e),0===e.avail_out))return i.last_flush=-1,0}return 4!==t?0:i.wrap<=0?1:(2===i.wrap?(b(i,255&e.adler),b(i,e.adler>>8&255),b(i,e.adler>>16&255),b(i,e.adler>>24&255),b(i,255&e.total_in),b(i,e.total_in>>8&255),b(i,e.total_in>>16&255),b(i,e.total_in>>24&255)):(v(i,e.adler>>>16),v(i,65535&e.adler)),g(e),0<i.wrap&&(i.wrap=-i.wrap),0!==i.pending?0:1)},n.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&103!==t&&t!==h&&666!==t?p(e,u):(e.state=null,t===h?p(e,-3):0):u},n.deflateSetDictionary=function(e,t){var n,r,o,a,l,c,d,h,p=t.length;if(!e||!e.state)return u;if(2===(a=(n=e.state).wrap)||1===a&&42!==n.status||n.lookahead)return u;for(1===a&&(e.adler=s(e.adler,t,p,0)),n.wrap=0,p>=n.w_size&&(0===a&&(m(n.head),n.strstart=0,n.block_start=0,n.insert=0),h=new i.Buf8(n.w_size),i.arraySet(h,t,p-n.w_size,n.w_size,0),t=h,p=n.w_size),l=e.avail_in,c=e.next_in,d=e.input,e.avail_in=p,e.next_in=0,e.input=t,x(n);n.lookahead>=3;){for(r=n.strstart,o=n.lookahead-2;n.ins_h=(n.ins_h<<n.hash_shift^n.window[r+3-1])&n.hash_mask,n.prev[r&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=r,r++,--o;);n.strstart=r,n.lookahead=2,x(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,e.next_in=c,e.input=d,e.avail_in=l,n.wrap=a,0},n.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,n){t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(e,t,n){t.exports=function(e,t){var n,r,i,o,s,a,l,u,c,d,h,p,f,m,g,y,b,v,_,x,w,E,S,T,k;n=e.state,r=e.next_in,T=e.input,i=r+(e.avail_in-5),o=e.next_out,k=e.output,s=o-(t-e.avail_out),a=o+(e.avail_out-257),l=n.dmax,u=n.wsize,c=n.whave,d=n.wnext,h=n.window,p=n.hold,f=n.bits,m=n.lencode,g=n.distcode,y=(1<<n.lenbits)-1,b=(1<<n.distbits)-1;e:do{f<15&&(p+=T[r++]<<f,f+=8,p+=T[r++]<<f,f+=8),v=m[p&y];t:for(;;){if(p>>>=_=v>>>24,f-=_,0==(_=v>>>16&255))k[o++]=65535&v;else{if(!(16&_)){if(!(64&_)){v=m[(65535&v)+(p&(1<<_)-1)];continue t}if(32&_){n.mode=12;break e}e.msg="invalid literal/length code",n.mode=30;break e}x=65535&v,(_&=15)&&(f<_&&(p+=T[r++]<<f,f+=8),x+=p&(1<<_)-1,p>>>=_,f-=_),f<15&&(p+=T[r++]<<f,f+=8,p+=T[r++]<<f,f+=8),v=g[p&b];n:for(;;){if(p>>>=_=v>>>24,f-=_,!(16&(_=v>>>16&255))){if(!(64&_)){v=g[(65535&v)+(p&(1<<_)-1)];continue n}e.msg="invalid distance code",n.mode=30;break e}if(w=65535&v,f<(_&=15)&&(p+=T[r++]<<f,(f+=8)<_&&(p+=T[r++]<<f,f+=8)),l<(w+=p&(1<<_)-1)){e.msg="invalid distance too far back",n.mode=30;break e}if(p>>>=_,f-=_,(_=o-s)<w){if(c<(_=w-_)&&n.sane){e.msg="invalid distance too far back",n.mode=30;break e}if(S=h,(E=0)===d){if(E+=u-_,_<x){for(x-=_;k[o++]=h[E++],--_;);E=o-w,S=k}}else if(d<_){if(E+=u+d-_,(_-=d)<x){for(x-=_;k[o++]=h[E++],--_;);if(E=0,d<x){for(x-=_=d;k[o++]=h[E++],--_;);E=o-w,S=k}}}else if(E+=d-_,_<x){for(x-=_;k[o++]=h[E++],--_;);E=o-w,S=k}for(;2<x;)k[o++]=S[E++],k[o++]=S[E++],k[o++]=S[E++],x-=3;x&&(k[o++]=S[E++],1<x&&(k[o++]=S[E++]))}else{for(E=o-w;k[o++]=k[E++],k[o++]=k[E++],k[o++]=k[E++],2<(x-=3););x&&(k[o++]=k[E++],1<x&&(k[o++]=k[E++]))}break}}break}}while(r<i&&o<a);r-=x=f>>3,p&=(1<<(f-=x<<3))-1,e.next_in=r,e.next_out=o,e.avail_in=r<i?i-r+5:5-(r-i),e.avail_out=o<a?a-o+257:257-(o-a),n.hold=p,n.bits=f}},{}],49:[function(e,t,n){var r=e("../utils/common"),i=e("./adler32"),o=e("./crc32"),s=e("./inffast"),a=e("./inftrees"),l=-2;function u(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function c(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function d(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new r.Buf32(852),t.distcode=t.distdyn=new r.Buf32(592),t.sane=1,t.back=-1,0):l}function h(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,d(e)):l}function p(e,t){var n,r;return e&&e.state?(r=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15<t)?l:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,h(e))):l}function f(e,t){var n,r;return e?(r=new c,(e.state=r).window=null,0!==(n=p(e,t))&&(e.state=null),n):l}var m,g,y=!0;function b(e){if(y){var t;for(m=new r.Buf32(512),g=new r.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(a(1,e.lens,0,288,m,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;a(2,e.lens,0,32,g,0,e.work,{bits:5}),y=!1}e.lencode=m,e.lenbits=9,e.distcode=g,e.distbits=5}function v(e,t,n,i){var o,s=e.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new r.Buf8(s.wsize)),i>=s.wsize?(r.arraySet(s.window,t,n-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(i<(o=s.wsize-s.wnext)&&(o=i),r.arraySet(s.window,t,n-i,o,s.wnext),(i-=o)?(r.arraySet(s.window,t,n-i,i,0),s.wnext=i,s.whave=s.wsize):(s.wnext+=o,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=o))),0}n.inflateReset=h,n.inflateReset2=p,n.inflateResetKeep=d,n.inflateInit=function(e){return f(e,15)},n.inflateInit2=f,n.inflate=function(e,t){var n,c,d,h,p,f,m,g,y,_,x,w,E,S,T,k,O,A,C,R,N,P,M,D,I=0,z=new r.Buf8(4),F=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return l;12===(n=e.state).mode&&(n.mode=13),p=e.next_out,d=e.output,m=e.avail_out,h=e.next_in,c=e.input,f=e.avail_in,g=n.hold,y=n.bits,_=f,x=m,P=0;e:for(;;)switch(n.mode){case 1:if(0===n.wrap){n.mode=13;break}for(;y<16;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}if(2&n.wrap&&35615===g){z[n.check=0]=255&g,z[1]=g>>>8&255,n.check=o(n.check,z,2,0),y=g=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&g)<<8)+(g>>8))%31){e.msg="incorrect header check",n.mode=30;break}if(8!=(15&g)){e.msg="unknown compression method",n.mode=30;break}if(y-=4,N=8+(15&(g>>>=4)),0===n.wbits)n.wbits=N;else if(N>n.wbits){e.msg="invalid window size",n.mode=30;break}n.dmax=1<<N,e.adler=n.check=1,n.mode=512&g?10:12,y=g=0;break;case 2:for(;y<16;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}if(n.flags=g,8!=(255&n.flags)){e.msg="unknown compression method",n.mode=30;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=30;break}n.head&&(n.head.text=g>>8&1),512&n.flags&&(z[0]=255&g,z[1]=g>>>8&255,n.check=o(n.check,z,2,0)),y=g=0,n.mode=3;case 3:for(;y<32;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}n.head&&(n.head.time=g),512&n.flags&&(z[0]=255&g,z[1]=g>>>8&255,z[2]=g>>>16&255,z[3]=g>>>24&255,n.check=o(n.check,z,4,0)),y=g=0,n.mode=4;case 4:for(;y<16;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}n.head&&(n.head.xflags=255&g,n.head.os=g>>8),512&n.flags&&(z[0]=255&g,z[1]=g>>>8&255,n.check=o(n.check,z,2,0)),y=g=0,n.mode=5;case 5:if(1024&n.flags){for(;y<16;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}n.length=g,n.head&&(n.head.extra_len=g),512&n.flags&&(z[0]=255&g,z[1]=g>>>8&255,n.check=o(n.check,z,2,0)),y=g=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(f<(w=n.length)&&(w=f),w&&(n.head&&(N=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),r.arraySet(n.head.extra,c,h,w,N)),512&n.flags&&(n.check=o(n.check,c,w,h)),f-=w,h+=w,n.length-=w),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===f)break e;for(w=0;N=c[h+w++],n.head&&N&&n.length<65536&&(n.head.name+=String.fromCharCode(N)),N&&w<f;);if(512&n.flags&&(n.check=o(n.check,c,w,h)),f-=w,h+=w,N)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=8;case 8:if(4096&n.flags){if(0===f)break e;for(w=0;N=c[h+w++],n.head&&N&&n.length<65536&&(n.head.comment+=String.fromCharCode(N)),N&&w<f;);if(512&n.flags&&(n.check=o(n.check,c,w,h)),f-=w,h+=w,N)break e}else n.head&&(n.head.comment=null);n.mode=9;case 9:if(512&n.flags){for(;y<16;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}if(g!==(65535&n.check)){e.msg="header crc mismatch",n.mode=30;break}y=g=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;y<32;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}e.adler=n.check=u(g),y=g=0,n.mode=11;case 11:if(0===n.havedict)return e.next_out=p,e.avail_out=m,e.next_in=h,e.avail_in=f,n.hold=g,n.bits=y,2;e.adler=n.check=1,n.mode=12;case 12:if(5===t||6===t)break e;case 13:if(n.last){g>>>=7&y,y-=7&y,n.mode=27;break}for(;y<3;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}switch(n.last=1&g,y-=1,3&(g>>>=1)){case 0:n.mode=14;break;case 1:if(b(n),n.mode=20,6!==t)break;g>>>=2,y-=2;break e;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=30}g>>>=2,y-=2;break;case 14:for(g>>>=7&y,y-=7&y;y<32;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}if((65535&g)!=(g>>>16^65535)){e.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&g,y=g=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(w=n.length){if(f<w&&(w=f),m<w&&(w=m),0===w)break e;r.arraySet(d,c,h,w,p),f-=w,h+=w,m-=w,p+=w,n.length-=w;break}n.mode=12;break;case 17:for(;y<14;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}if(n.nlen=257+(31&g),g>>>=5,y-=5,n.ndist=1+(31&g),g>>>=5,y-=5,n.ncode=4+(15&g),g>>>=4,y-=4,286<n.nlen||30<n.ndist){e.msg="too many length or distance symbols",n.mode=30;break}n.have=0,n.mode=18;case 18:for(;n.have<n.ncode;){for(;y<3;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}n.lens[F[n.have++]]=7&g,g>>>=3,y-=3}for(;n.have<19;)n.lens[F[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,M={bits:n.lenbits},P=a(0,n.lens,0,19,n.lencode,0,n.work,M),n.lenbits=M.bits,P){e.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have<n.nlen+n.ndist;){for(;k=(I=n.lencode[g&(1<<n.lenbits)-1])>>>16&255,O=65535&I,!((T=I>>>24)<=y);){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}if(O<16)g>>>=T,y-=T,n.lens[n.have++]=O;else{if(16===O){for(D=T+2;y<D;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}if(g>>>=T,y-=T,0===n.have){e.msg="invalid bit length repeat",n.mode=30;break}N=n.lens[n.have-1],w=3+(3&g),g>>>=2,y-=2}else if(17===O){for(D=T+3;y<D;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}y-=T,N=0,w=3+(7&(g>>>=T)),g>>>=3,y-=3}else{for(D=T+7;y<D;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}y-=T,N=0,w=11+(127&(g>>>=T)),g>>>=7,y-=7}if(n.have+w>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=30;break}for(;w--;)n.lens[n.have++]=N}}if(30===n.mode)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=30;break}if(n.lenbits=9,M={bits:n.lenbits},P=a(1,n.lens,0,n.nlen,n.lencode,0,n.work,M),n.lenbits=M.bits,P){e.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,M={bits:n.distbits},P=a(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,M),n.distbits=M.bits,P){e.msg="invalid distances set",n.mode=30;break}if(n.mode=20,6===t)break e;case 20:n.mode=21;case 21:if(6<=f&&258<=m){e.next_out=p,e.avail_out=m,e.next_in=h,e.avail_in=f,n.hold=g,n.bits=y,s(e,x),p=e.next_out,d=e.output,m=e.avail_out,h=e.next_in,c=e.input,f=e.avail_in,g=n.hold,y=n.bits,12===n.mode&&(n.back=-1);break}for(n.back=0;k=(I=n.lencode[g&(1<<n.lenbits)-1])>>>16&255,O=65535&I,!((T=I>>>24)<=y);){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}if(k&&!(240&k)){for(A=T,C=k,R=O;k=(I=n.lencode[R+((g&(1<<A+C)-1)>>A)])>>>16&255,O=65535&I,!(A+(T=I>>>24)<=y);){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}g>>>=A,y-=A,n.back+=A}if(g>>>=T,y-=T,n.back+=T,n.length=O,0===k){n.mode=26;break}if(32&k){n.back=-1,n.mode=12;break}if(64&k){e.msg="invalid literal/length code",n.mode=30;break}n.extra=15&k,n.mode=22;case 22:if(n.extra){for(D=n.extra;y<D;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}n.length+=g&(1<<n.extra)-1,g>>>=n.extra,y-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;k=(I=n.distcode[g&(1<<n.distbits)-1])>>>16&255,O=65535&I,!((T=I>>>24)<=y);){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}if(!(240&k)){for(A=T,C=k,R=O;k=(I=n.distcode[R+((g&(1<<A+C)-1)>>A)])>>>16&255,O=65535&I,!(A+(T=I>>>24)<=y);){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}g>>>=A,y-=A,n.back+=A}if(g>>>=T,y-=T,n.back+=T,64&k){e.msg="invalid distance code",n.mode=30;break}n.offset=O,n.extra=15&k,n.mode=24;case 24:if(n.extra){for(D=n.extra;y<D;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}n.offset+=g&(1<<n.extra)-1,g>>>=n.extra,y-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=30;break}n.mode=25;case 25:if(0===m)break e;if(w=x-m,n.offset>w){if((w=n.offset-w)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=30;break}E=w>n.wnext?(w-=n.wnext,n.wsize-w):n.wnext-w,w>n.length&&(w=n.length),S=n.window}else S=d,E=p-n.offset,w=n.length;for(m<w&&(w=m),m-=w,n.length-=w;d[p++]=S[E++],--w;);0===n.length&&(n.mode=21);break;case 26:if(0===m)break e;d[p++]=n.length,m--,n.mode=21;break;case 27:if(n.wrap){for(;y<32;){if(0===f)break e;f--,g|=c[h++]<<y,y+=8}if(x-=m,e.total_out+=x,n.total+=x,x&&(e.adler=n.check=n.flags?o(n.check,d,x,p-x):i(n.check,d,x,p-x)),x=m,(n.flags?g:u(g))!==n.check){e.msg="incorrect data check",n.mode=30;break}y=g=0}n.mode=28;case 28:if(n.wrap&&n.flags){for(;y<32;){if(0===f)break e;f--,g+=c[h++]<<y,y+=8}if(g!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=30;break}y=g=0}n.mode=29;case 29:P=1;break e;case 30:P=-3;break e;case 31:return-4;default:return l}return e.next_out=p,e.avail_out=m,e.next_in=h,e.avail_in=f,n.hold=g,n.bits=y,(n.wsize||x!==e.avail_out&&n.mode<30&&(n.mode<27||4!==t))&&v(e,e.output,e.next_out,x-e.avail_out)?(n.mode=31,-4):(_-=e.avail_in,x-=e.avail_out,e.total_in+=_,e.total_out+=x,n.total+=x,n.wrap&&x&&(e.adler=n.check=n.flags?o(n.check,d,x,e.next_out-x):i(n.check,d,x,e.next_out-x)),e.data_type=n.bits+(n.last?64:0)+(12===n.mode?128:0)+(20===n.mode||15===n.mode?256:0),(0==_&&0===x||4===t)&&0===P&&(P=-5),P)},n.inflateEnd=function(e){if(!e||!e.state)return l;var t=e.state;return t.window&&(t.window=null),e.state=null,0},n.inflateGetHeader=function(e,t){var n;return e&&e.state&&2&(n=e.state).wrap?((n.head=t).done=!1,0):l},n.inflateSetDictionary=function(e,t){var n,r=t.length;return e&&e.state?0!==(n=e.state).wrap&&11!==n.mode?l:11===n.mode&&i(1,t,r,0)!==n.check?-3:v(e,t,r,r)?(n.mode=31,-4):(n.havedict=1,0):l},n.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,n){var r=e("../utils/common"),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],s=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],a=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,n,l,u,c,d,h){var p,f,m,g,y,b,v,_,x,w=h.bits,E=0,S=0,T=0,k=0,O=0,A=0,C=0,R=0,N=0,P=0,M=null,D=0,I=new r.Buf16(16),z=new r.Buf16(16),F=null,L=0;for(E=0;E<=15;E++)I[E]=0;for(S=0;S<l;S++)I[t[n+S]]++;for(O=w,k=15;1<=k&&0===I[k];k--);if(k<O&&(O=k),0===k)return u[c++]=20971520,u[c++]=20971520,h.bits=1,0;for(T=1;T<k&&0===I[T];T++);for(O<T&&(O=T),E=R=1;E<=15;E++)if(R<<=1,(R-=I[E])<0)return-1;if(0<R&&(0===e||1!==k))return-1;for(z[1]=0,E=1;E<15;E++)z[E+1]=z[E]+I[E];for(S=0;S<l;S++)0!==t[n+S]&&(d[z[t[n+S]]++]=S);if(b=0===e?(M=F=d,19):1===e?(M=i,D-=257,F=o,L-=257,256):(M=s,F=a,-1),E=T,y=c,C=S=P=0,m=-1,g=(N=1<<(A=O))-1,1===e&&852<N||2===e&&592<N)return 1;for(;;){for(v=E-C,x=d[S]<b?(_=0,d[S]):d[S]>b?(_=F[L+d[S]],M[D+d[S]]):(_=96,0),p=1<<E-C,T=f=1<<A;u[y+(P>>C)+(f-=p)]=v<<24|_<<16|x,0!==f;);for(p=1<<E-1;P&p;)p>>=1;if(0!==p?(P&=p-1,P+=p):P=0,S++,0==--I[E]){if(E===k)break;E=t[n+d[S]]}if(O<E&&(P&g)!==m){for(0===C&&(C=O),y+=T,R=1<<(A=E-C);A+C<k&&!((R-=I[A+C])<=0);)A++,R<<=1;if(N+=1<<A,1===e&&852<N||2===e&&592<N)return 1;u[m=P&g]=O<<24|A<<16|y-c}}return 0!==P&&(u[y+P]=E-C<<24|64<<16),h.bits=O,0}},{"../utils/common":41}],51:[function(e,t,n){t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(e,t,n){var r=e("../utils/common");function i(e){for(var t=e.length;0<=--t;)e[t]=0}var o=256,s=286,a=30,l=15,u=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],c=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],d=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],h=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],p=new Array(576);i(p);var f=new Array(60);i(f);var m=new Array(512);i(m);var g=new Array(256);i(g);var y=new Array(29);i(y);var b,v,_,x=new Array(a);function w(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}function E(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function S(e){return e<256?m[e]:m[256+(e>>>7)]}function T(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function k(e,t,n){e.bi_valid>16-n?(e.bi_buf|=t<<e.bi_valid&65535,T(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=n-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)}function O(e,t,n){k(e,n[2*t],n[2*t+1])}function A(e,t){for(var n=0;n|=1&e,e>>>=1,n<<=1,0<--t;);return n>>>1}function C(e,t,n){var r,i,o=new Array(16),s=0;for(r=1;r<=l;r++)o[r]=s=s+n[r-1]<<1;for(i=0;i<=t;i++){var a=e[2*i+1];0!==a&&(e[2*i]=A(o[a]++,a))}}function R(e){var t;for(t=0;t<s;t++)e.dyn_ltree[2*t]=0;for(t=0;t<a;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function N(e){8<e.bi_valid?T(e,e.bi_buf):0<e.bi_valid&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function P(e,t,n,r){var i=2*t,o=2*n;return e[i]<e[o]||e[i]===e[o]&&r[t]<=r[n]}function M(e,t,n){for(var r=e.heap[n],i=n<<1;i<=e.heap_len&&(i<e.heap_len&&P(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!P(t,r,e.heap[i],e.depth));)e.heap[n]=e.heap[i],n=i,i<<=1;e.heap[n]=r}function D(e,t,n){var r,i,s,a,l=0;if(0!==e.last_lit)for(;r=e.pending_buf[e.d_buf+2*l]<<8|e.pending_buf[e.d_buf+2*l+1],i=e.pending_buf[e.l_buf+l],l++,0===r?O(e,i,t):(O(e,(s=g[i])+o+1,t),0!==(a=u[s])&&k(e,i-=y[s],a),O(e,s=S(--r),n),0!==(a=c[s])&&k(e,r-=x[s],a)),l<e.last_lit;);O(e,256,t)}function I(e,t){var n,r,i,o=t.dyn_tree,s=t.stat_desc.static_tree,a=t.stat_desc.has_stree,u=t.stat_desc.elems,c=-1;for(e.heap_len=0,e.heap_max=573,n=0;n<u;n++)0!==o[2*n]?(e.heap[++e.heap_len]=c=n,e.depth[n]=0):o[2*n+1]=0;for(;e.heap_len<2;)o[2*(i=e.heap[++e.heap_len]=c<2?++c:0)]=1,e.depth[i]=0,e.opt_len--,a&&(e.static_len-=s[2*i+1]);for(t.max_code=c,n=e.heap_len>>1;1<=n;n--)M(e,o,n);for(i=u;n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],M(e,o,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,o[2*i]=o[2*n]+o[2*r],e.depth[i]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,o[2*n+1]=o[2*r+1]=i,e.heap[1]=i++,M(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,r,i,o,s,a,u=t.dyn_tree,c=t.max_code,d=t.stat_desc.static_tree,h=t.stat_desc.has_stree,p=t.stat_desc.extra_bits,f=t.stat_desc.extra_base,m=t.stat_desc.max_length,g=0;for(o=0;o<=l;o++)e.bl_count[o]=0;for(u[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n<573;n++)m<(o=u[2*u[2*(r=e.heap[n])+1]+1]+1)&&(o=m,g++),u[2*r+1]=o,c<r||(e.bl_count[o]++,s=0,f<=r&&(s=p[r-f]),a=u[2*r],e.opt_len+=a*(o+s),h&&(e.static_len+=a*(d[2*r+1]+s)));if(0!==g){do{for(o=m-1;0===e.bl_count[o];)o--;e.bl_count[o]--,e.bl_count[o+1]+=2,e.bl_count[m]--,g-=2}while(0<g);for(o=m;0!==o;o--)for(r=e.bl_count[o];0!==r;)c<(i=e.heap[--n])||(u[2*i+1]!==o&&(e.opt_len+=(o-u[2*i+1])*u[2*i],u[2*i+1]=o),r--)}}(e,t),C(o,c,e.bl_count)}function z(e,t,n){var r,i,o=-1,s=t[1],a=0,l=7,u=4;for(0===s&&(l=138,u=3),t[2*(n+1)+1]=65535,r=0;r<=n;r++)i=s,s=t[2*(r+1)+1],++a<l&&i===s||(a<u?e.bl_tree[2*i]+=a:0!==i?(i!==o&&e.bl_tree[2*i]++,e.bl_tree[32]++):a<=10?e.bl_tree[34]++:e.bl_tree[36]++,o=i,u=(a=0)===s?(l=138,3):i===s?(l=6,3):(l=7,4))}function F(e,t,n){var r,i,o=-1,s=t[1],a=0,l=7,u=4;for(0===s&&(l=138,u=3),r=0;r<=n;r++)if(i=s,s=t[2*(r+1)+1],!(++a<l&&i===s)){if(a<u)for(;O(e,i,e.bl_tree),0!=--a;);else 0!==i?(i!==o&&(O(e,i,e.bl_tree),a--),O(e,16,e.bl_tree),k(e,a-3,2)):a<=10?(O(e,17,e.bl_tree),k(e,a-3,3)):(O(e,18,e.bl_tree),k(e,a-11,7));o=i,u=(a=0)===s?(l=138,3):i===s?(l=6,3):(l=7,4)}}i(x);var L=!1;function j(e,t,n,i){k(e,0+(i?1:0),3),function(e,t,n){N(e),T(e,n),T(e,~n),r.arraySet(e.pending_buf,e.window,t,n,e.pending),e.pending+=n}(e,t,n)}n._tr_init=function(e){L||(function(){var e,t,n,r,i,o=new Array(16);for(r=n=0;r<28;r++)for(y[r]=n,e=0;e<1<<u[r];e++)g[n++]=r;for(g[n-1]=r,r=i=0;r<16;r++)for(x[r]=i,e=0;e<1<<c[r];e++)m[i++]=r;for(i>>=7;r<a;r++)for(x[r]=i<<7,e=0;e<1<<c[r]-7;e++)m[256+i++]=r;for(t=0;t<=l;t++)o[t]=0;for(e=0;e<=143;)p[2*e+1]=8,e++,o[8]++;for(;e<=255;)p[2*e+1]=9,e++,o[9]++;for(;e<=279;)p[2*e+1]=7,e++,o[7]++;for(;e<=287;)p[2*e+1]=8,e++,o[8]++;for(C(p,287,o),e=0;e<a;e++)f[2*e+1]=5,f[2*e]=A(e,5);b=new w(p,u,257,s,l),v=new w(f,c,0,a,l),_=new w(new Array(0),d,0,19,7)}(),L=!0),e.l_desc=new E(e.dyn_ltree,b),e.d_desc=new E(e.dyn_dtree,v),e.bl_desc=new E(e.bl_tree,_),e.bi_buf=0,e.bi_valid=0,R(e)},n._tr_stored_block=j,n._tr_flush_block=function(e,t,n,r){var i,s,a=0;0<e.level?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<o;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),I(e,e.l_desc),I(e,e.d_desc),a=function(e){var t;for(z(e,e.dyn_ltree,e.l_desc.max_code),z(e,e.dyn_dtree,e.d_desc.max_code),I(e,e.bl_desc),t=18;3<=t&&0===e.bl_tree[2*h[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),i=e.opt_len+3+7>>>3,(s=e.static_len+3+7>>>3)<=i&&(i=s)):i=s=n+5,n+4<=i&&-1!==t?j(e,t,n,r):4===e.strategy||s===i?(k(e,2+(r?1:0),3),D(e,p,f)):(k(e,4+(r?1:0),3),function(e,t,n,r){var i;for(k(e,t-257,5),k(e,n-1,5),k(e,r-4,4),i=0;i<r;i++)k(e,e.bl_tree[2*h[i]+1],3);F(e,e.dyn_ltree,t-1),F(e,e.dyn_dtree,n-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),D(e,e.dyn_ltree,e.dyn_dtree)),R(e),r&&N(e)},n._tr_tally=function(e,t,n){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(g[n]+o+1)]++,e.dyn_dtree[2*S(t)]++),e.last_lit===e.lit_bufsize-1},n._tr_align=function(e){k(e,2,3),O(e,256,p),function(e){16===e.bi_valid?(T(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,n){t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,n){(function(e){!function(e){if(!e.setImmediate){var t,n,r,i,o=1,s={},a=!1,l=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,t="[object process]"==={}.toString.call(e.process)?function(e){!function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];_e.push(new Te(e,t)),1!==_e.length||xe||be(Se)}(function(){d(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?(i="setImmediate$"+Math.random()+"$",e.addEventListener?e.addEventListener("message",h,!1):e.attachEvent("onmessage",h),function(t){e.postMessage(i+t,"*")}):e.MessageChannel?((r=new MessageChannel).port1.onmessage=function(e){d(e.data)},function(e){r.port2.postMessage(e)}):l&&"onreadystatechange"in l.createElement("script")?(n=l.documentElement,function(e){var t=l.createElement("script");t.onreadystatechange=function(){d(e),t.onreadystatechange=null,n.removeChild(t),t=null},n.appendChild(t)}):function(e){setTimeout(d,0,e)},u.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var n=new Array(arguments.length-1),r=0;r<n.length;r++)n[r]=arguments[r+1];var i={callback:e,args:n};return s[o]=i,t(o),o++},u.clearImmediate=c}function c(e){delete s[e]}function d(e){if(a)setTimeout(d,0,e);else{var t=s[e];if(t){a=!0;try{!function(e){var t=e.callback,n=e.args;switch(n.length){case 0:t();break;case 1:t(n[0]);break;case 2:t(n[0],n[1]);break;case 3:t(n[0],n[1],n[2]);break;default:t.apply(undefined,n)}}(t)}finally{c(e),a=!1}}}}function h(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(i)&&d(+t.data.slice(i.length))}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,void 0!==p?p:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[10])(10)),lt.exports),ct=e.getDefaultExportFromCjs(ut),dt={},ht={},pt={};function ft(){if(Ce)return pt;function e(e){return null==e}return Ce=1,pt.isNothing=e,pt.isObject=function(e){return"object"==typeof e&&null!==e},pt.toArray=function(t){return Array.isArray(t)?t:e(t)?[]:[t]},pt.repeat=function(e,t){var n,r="";for(n=0;n<t;n+=1)r+=e;return r},pt.isNegativeZero=function(e){return 0===e&&Number.NEGATIVE_INFINITY===1/e},pt.extend=function(e,t){var n,r,i,o;if(t)for(n=0,r=(o=Object.keys(t)).length;n<r;n+=1)e[i=o[n]]=t[i];return e},pt}function mt(){if(Ne)return Re;function e(e,t){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||"",this.name="YAMLException",this.reason=e,this.mark=t,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():"")}return Ne=1,e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e.prototype.toString=function(e){var t=this.name+": ";return t+=this.reason||"(unknown reason)",!e&&this.mark&&(t+=" "+this.mark.toString()),t},Re=e}function gt(){if(Ie)return De;Ie=1;var e=mt(),t=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],n=["scalar","sequence","mapping"];return De=function(r,i){if(i=i||{},Object.keys(i).forEach(function(n){if(-1===t.indexOf(n))throw new e('Unknown option "'+n+'" is met in definition of "'+r+'" YAML type.')}),this.tag=r,this.kind=i.kind||null,this.resolve=i.resolve||function(){return!0},this.construct=i.construct||function(e){return e},this.instanceOf=i.instanceOf||null,this.predicate=i.predicate||null,this.represent=i.represent||null,this.defaultStyle=i.defaultStyle||null,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach(function(n){e[n].forEach(function(e){t[String(e)]=n})}),t}(i.styleAliases||null),-1===n.indexOf(this.kind))throw new e('Unknown kind "'+this.kind+'" is specified for "'+r+'" YAML type.')},De}function yt(){if(Fe)return ze;Fe=1;var e=ft(),t=mt(),n=gt();function r(e,t,n){var i=[];return e.include.forEach(function(e){n=r(e,t,n)}),e[t].forEach(function(e){n.forEach(function(t,n){t.tag===e.tag&&i.push(n)}),n.push(e)}),n.filter(function(e,t){return-1===i.indexOf(t)})}function i(e){this.include=e.include||[],this.implicit=e.implicit||[],this.explicit=e.explicit||[],this.implicit.forEach(function(e){if(e.loadKind&&"scalar"!==e.loadKind)throw new t("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}),this.compiledImplicit=r(this,"implicit",[]),this.compiledExplicit=r(this,"explicit",[]),this.compiledTypeMap=function(){var e,t,n={};function r(e){n[e.tag]=e}for(e=0,t=arguments.length;e<t;e+=1)arguments[e].forEach(r);return n}(this.compiledImplicit,this.compiledExplicit)}return i.DEFAULT=null,i.create=function(){var r,o;switch(arguments.length){case 1:r=i.DEFAULT,o=arguments[0];break;case 2:r=arguments[0],o=arguments[1];break;default:throw new t("Wrong number of arguments for Schema.create function")}if(r=e.toArray(r),o=e.toArray(o),!r.every(function(e){return e instanceof i}))throw new t("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");if(!o.every(function(e){return e instanceof n}))throw new t("Specified list of YAML types (or a single Type object) contains a non-Type object.");return new i({include:r,explicit:o})},ze=i}function bt(){if(je)return Le;je=1;var e=gt();return Le=new e("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}})}function vt(){if(Be)return $e;Be=1;var e=gt();return $e=new e("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}})}function _t(){if(Ue)return Ve;Ue=1;var e=gt();return Ve=new e("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})}function xt(){if(qe)return We;qe=1;var e=yt();return We=new e({explicit:[bt(),vt(),_t()]})}function wt(){if(He)return Ge;He=1;var e=gt();return Ge=new e("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})}function Et(){if(Ke)return Ye;Ke=1;var e=gt();return Ye=new e("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})}function St(){if(Ze)return Xe;Ze=1;var e=ft(),t=gt();function n(e){return 48<=e&&e<=55}function r(e){return 48<=e&&e<=57}return Xe=new t("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,i,o=e.length,s=0,a=!1;if(!o)return!1;if("-"!==(t=e[s])&&"+"!==t||(t=e[++s]),"0"===t){if(s+1===o)return!0;if("b"===(t=e[++s])){for(s++;s<o;s++)if("_"!==(t=e[s])){if("0"!==t&&"1"!==t)return!1;a=!0}return a}if("x"===t){for(s++;s<o;s++)if("_"!==(t=e[s])){if(!(48<=(i=e.charCodeAt(s))&&i<=57||65<=i&&i<=70||97<=i&&i<=102))return!1;a=!0}return a}for(;s<o;s++)if("_"!==(t=e[s])){if(!n(e.charCodeAt(s)))return!1;a=!0}return a}for(;s<o;s++)if("_"!==(t=e[s])){if(":"===t)break;if(!r(e.charCodeAt(s)))return!1;a=!0}return!!a&&(":"!==t||/^(:[0-5]?[0-9])+$/.test(e.slice(s)))},construct:function(e){var t,n,r=e,i=1,o=[];return-1!==r.indexOf("_")&&(r=r.replace(/_/g,"")),"-"!==(t=r[0])&&"+"!==t||("-"===t&&(i=-1),t=(r=r.slice(1))[0]),"0"===r?0:"0"===t?"b"===r[1]?i*parseInt(r.slice(2),2):"x"===r[1]?i*parseInt(r,16):i*parseInt(r,8):-1!==r.indexOf(":")?(r.split(":").forEach(function(e){o.unshift(parseInt(e,10))}),r=0,n=1,o.forEach(function(e){r+=e*n,n*=60}),i*r):i*parseInt(r,10)},predicate:function(t){return"[object Number]"===Object.prototype.toString.call(t)&&t%1==0&&!e.isNegativeZero(t)},represent:{binary:function(e){return"0b"+e.toString(2)},octal:function(e){return"0"+e.toString(8)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return"0x"+e.toString(16).toUpperCase()}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Xe}function Tt(){if(Qe)return Je;Qe=1;var e=ft(),t=gt(),n=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?|\\.[0-9_]+(?:[eE][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),r=/^[-+]?[0-9]+e/;return Je=new t("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!!n.test(e)},construct:function(e){var t,n,r,i;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,i=[],"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:t.indexOf(":")>=0?(t.split(":").forEach(function(e){i.unshift(parseFloat(e,10))}),t=0,r=1,i.forEach(function(e){t+=e*r,r*=60}),n*t):n*parseFloat(t,10)},predicate:function(t){return"[object Number]"===Object.prototype.toString.call(t)&&(t%1!=0||e.isNegativeZero(t))},represent:function(t,n){var i;if(isNaN(t))switch(n){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(n){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(n){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(e.isNegativeZero(t))return"-0.0";return i=t.toString(10),r.test(i)?i.replace("e",".e"):i},defaultStyle:"lowercase"})}function kt(){if(tt)return et;tt=1;var e=yt();return et=new e({include:[xt()],implicit:[wt(),Et(),St(),Tt()]})}function Ot(){if(rt)return nt;rt=1;var e=yt();return nt=new e({include:[kt()]})}function At(){if(ot)return it;ot=1;var e=gt(),t=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?)?$");return it=new e("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&null!==t.exec(e)},construct:function(e){var n,r,i,o,s,a,l,u,c=0,d=null;if(null===(n=t.exec(e)))throw new Error("Date resolve error");if(r=+n[1],i=+n[2]-1,o=+n[3],!n[4])return new Date(Date.UTC(r,i,o));if(s=+n[4],a=+n[5],l=+n[6],n[7]){for(c=n[7].slice(0,3);c.length<3;)c+="0";c=+c}return n[9]&&(d=6e4*(60*+n[10]+ +(n[11]||0)),"-"===n[9]&&(d=-d)),u=new Date(Date.UTC(r,i,o,s,a,l,c)),d&&u.setTime(u.getTime()-d),u},instanceOf:Date,represent:function(e){return e.toISOString()}})}function Ct(){if(at)return st;at=1;var e=gt();return st=new e("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}})}var Rt,Nt,Pt,Mt,Dt,It,zt,Ft,Lt,jt,$t,Bt,Vt,Ut,Wt,qt,Gt,Ht,Yt,Kt,Xt,Zt,Jt=e.getAugmentedNamespace(pe);function Qt(){if(Nt)return Rt;Nt=1;var e=Jt.Buffer,t=gt(),n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";return Rt=new t("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,r,i=0,o=e.length,s=n;for(r=0;r<o;r++)if(!((t=s.indexOf(e.charAt(r)))>64)){if(t<0)return!1;i+=6}return i%8==0},construct:function(t){var r,i,o=t.replace(/[\r\n=]/g,""),s=o.length,a=n,l=0,u=[];for(r=0;r<s;r++)r%4==0&&r&&(u.push(l>>16&255),u.push(l>>8&255),u.push(255&l)),l=l<<6|a.indexOf(o.charAt(r));return 0==(i=s%4*6)?(u.push(l>>16&255),u.push(l>>8&255),u.push(255&l)):18===i?(u.push(l>>10&255),u.push(l>>2&255)):12===i&&u.push(l>>4&255),e?new e(u):u},predicate:function(t){return e&&e.isBuffer(t)},represent:function(e){var t,r,i="",o=0,s=e.length,a=n;for(t=0;t<s;t++)t%3==0&&t&&(i+=a[o>>18&63],i+=a[o>>12&63],i+=a[o>>6&63],i+=a[63&o]),o=(o<<8)+e[t];return 0==(r=s%3)?(i+=a[o>>18&63],i+=a[o>>12&63],i+=a[o>>6&63],i+=a[63&o]):2===r?(i+=a[o>>10&63],i+=a[o>>4&63],i+=a[o<<2&63],i+=a[64]):1===r&&(i+=a[o>>2&63],i+=a[o<<4&63],i+=a[64],i+=a[64]),i}}),Rt}function en(){if(Mt)return Pt;Mt=1;var e=gt(),t=Object.prototype.hasOwnProperty,n=Object.prototype.toString;return Pt=new e("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var r,i,o,s,a,l=[],u=e;for(r=0,i=u.length;r<i;r+=1){if(o=u[r],a=!1,"[object Object]"!==n.call(o))return!1;for(s in o)if(t.call(o,s)){if(a)return!1;a=!0}if(!a)return!1;if(-1!==l.indexOf(s))return!1;l.push(s)}return!0},construct:function(e){return null!==e?e:[]}}),Pt}function tn(){if(It)return Dt;It=1;var e=gt(),t=Object.prototype.toString;return Dt=new e("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(e){if(null===e)return!0;var n,r,i,o,s,a=e;for(s=new Array(a.length),n=0,r=a.length;n<r;n+=1){if(i=a[n],"[object Object]"!==t.call(i))return!1;if(1!==(o=Object.keys(i)).length)return!1;s[n]=[o[0],i[o[0]]]}return!0},construct:function(e){if(null===e)return[];var t,n,r,i,o,s=e;for(o=new Array(s.length),t=0,n=s.length;t<n;t+=1)r=s[t],i=Object.keys(r),o[t]=[i[0],r[i[0]]];return o}}),Dt}function nn(){if(Ft)return zt;Ft=1;var e=gt(),t=Object.prototype.hasOwnProperty;return zt=new e("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(e){if(null===e)return!0;var n,r=e;for(n in r)if(t.call(r,n)&&null!==r[n])return!1;return!0},construct:function(e){return null!==e?e:{}}})}function rn(){if(jt)return Lt;jt=1;var e=yt();return Lt=new e({include:[Ot()],implicit:[At(),Ct()],explicit:[Qt(),en(),tn(),nn()]})}function on(){if(Bt)return $t;Bt=1;var e=gt();return $t=new e("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:function(){return!0},construct:function(){},predicate:function(e){return void 0===e},represent:function(){return""}})}function sn(){if(Ut)return Vt;Ut=1;var e=gt();return Vt=new e("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:function(e){if(null===e)return!1;if(0===e.length)return!1;var t=e,n=/\/([gim]*)$/.exec(e),r="";if("/"===t[0]){if(n&&(r=n[1]),r.length>3)return!1;if("/"!==t[t.length-r.length-1])return!1}return!0},construct:function(e){var t=e,n=/\/([gim]*)$/.exec(e),r="";return"/"===t[0]&&(n&&(r=n[1]),t=t.slice(1,t.length-r.length-1)),new RegExp(t,r)},predicate:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},represent:function(e){var t="/"+e.source+"/";return e.global&&(t+="g"),e.multiline&&(t+="m"),e.ignoreCase&&(t+="i"),t}})}function an(){if(qt)return Wt;var e;qt=1;try{e=Oe("esprima")}catch(t){"undefined"!=typeof window&&(e=window.esprima)}var t=gt();return Wt=new t("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:function(t){if(null===t)return!1;try{var n="("+t+")",r=e.parse(n,{range:!0});return"Program"===r.type&&1===r.body.length&&"ExpressionStatement"===r.body[0].type&&"FunctionExpression"===r.body[0].expression.type}catch(e){return!1}},construct:function(t){var n,r="("+t+")",i=e.parse(r,{range:!0}),o=[];if("Program"!==i.type||1!==i.body.length||"ExpressionStatement"!==i.body[0].type||"FunctionExpression"!==i.body[0].expression.type)throw new Error("Failed to resolve function");return i.body[0].expression.params.forEach(function(e){o.push(e.name)}),n=i.body[0].expression.body.range,new Function(o,r.slice(n[0]+1,n[1]-1))},predicate:function(e){return"[object Function]"===Object.prototype.toString.call(e)},represent:function(e){return e.toString()}})}function ln(){if(Ht)return Gt;Ht=1;var e=yt();return Gt=e.DEFAULT=new e({include:[rn()],explicit:[on(),sn(),an()]})}var un=function(){if(Zt)return Xt;Zt=1;var e=function(){if(Kt)return dt;Kt=1;var e=function(){if(Yt)return ht;Yt=1;var e=ft(),t=mt(),n=function(){if(Me)return Pe;Me=1;var e=ft();function t(e,t,n,r,i){this.name=e,this.buffer=t,this.position=n,this.line=r,this.column=i}return t.prototype.getSnippet=function(t,n){var r,i,o,s,a;if(!this.buffer)return null;for(t=t||4,n=n||75,r="",i=this.position;i>0&&-1==="\0\r\n
\u2028\u2029".indexOf(this.buffer.charAt(i-1));)if(i-=1,this.position-i>n/2-1){r=" ... ",i+=5;break}for(o="",s=this.position;s<this.buffer.length&&-1==="\0\r\n
\u2028\u2029".indexOf(this.buffer.charAt(s));)if((s+=1)-this.position>n/2-1){o=" ... ",s-=5;break}return a=this.buffer.slice(i,s),e.repeat(" ",t)+r+a+o+"\n"+e.repeat(" ",t+this.position-i+r.length)+"^"},t.prototype.toString=function(e){var t,n="";return this.name&&(n+='in "'+this.name+'" '),n+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet())&&(n+=":\n"+t),n},Pe=t}(),r=rn(),i=ln(),o=Object.prototype.hasOwnProperty,s=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,a=/[\x85\u2028\u2029]/,l=/[,\[\]\{\}]/,u=/^(?:!|!!|![a-z\-]+!)$/i,c=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function d(e){return 10===e||13===e}function h(e){return 9===e||32===e}function p(e){return 9===e||32===e||10===e||13===e}function f(e){return 44===e||91===e||93===e||123===e||125===e}function m(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function g(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e||9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"
":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function y(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}for(var b=new Array(256),v=new Array(256),_=0;_<256;_++)b[_]=g(_)?1:0,v[_]=g(_);function x(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||i,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function w(e,r){return new t(r,new n(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function E(e,t){throw w(e,t)}function S(e,t){e.onWarning&&e.onWarning.call(null,w(e,t))}var T={YAML:function(e,t,n){var r,i,o;null!==e.version&&E(e,"duplication of %YAML directive"),1!==n.length&&E(e,"YAML directive accepts exactly one argument"),null===(r=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&E(e,"ill-formed argument of the YAML directive"),i=parseInt(r[1],10),o=parseInt(r[2],10),1!==i&&E(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,1!==o&&2!==o&&S(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var r,i;2!==n.length&&E(e,"TAG directive accepts exactly two arguments"),r=n[0],i=n[1],u.test(r)||E(e,"ill-formed tag handle (first argument) of the TAG directive"),o.call(e.tagMap,r)&&E(e,'there is a previously declared suffix for "'+r+'" tag handle'),c.test(i)||E(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[r]=i}};function k(e,t,n,r){var i,o,a,l;if(t<n){if(l=e.input.slice(t,n),r)for(i=0,o=l.length;i<o;i+=1)9===(a=l.charCodeAt(i))||32<=a&&a<=1114111||E(e,"expected valid JSON character");else s.test(l)&&E(e,"the stream contains non-printable characters");e.result+=l}}function O(t,n,r,i){var s,a,l,u;for(e.isObject(r)||E(t,"cannot merge mappings; the provided source object is unacceptable"),l=0,u=(s=Object.keys(r)).length;l<u;l+=1)a=s[l],o.call(n,a)||(n[a]=r[a],i[a]=!0)}function A(e,t,n,r,i,s){var a,l;if(i=String(i),null===t&&(t={}),"tag:yaml.org,2002:merge"===r)if(Array.isArray(s))for(a=0,l=s.length;a<l;a+=1)O(e,t,s[a],n);else O(e,t,s,n);else e.json||o.call(n,i)||!o.call(t,i)||E(e,"duplicated mapping key"),t[i]=s,delete n[i];return t}function C(e){var t;10===(t=e.input.charCodeAt(e.position))?e.position++:13===t?(e.position++,10===e.input.charCodeAt(e.position)&&e.position++):E(e,"a line break is expected"),e.line+=1,e.lineStart=e.position}function R(e,t,n){for(var r=0,i=e.input.charCodeAt(e.position);0!==i;){for(;h(i);)i=e.input.charCodeAt(++e.position);if(t&&35===i)do{i=e.input.charCodeAt(++e.position)}while(10!==i&&13!==i&&0!==i);if(!d(i))break;for(C(e),i=e.input.charCodeAt(e.position),r++,e.lineIndent=0;32===i;)e.lineIndent++,i=e.input.charCodeAt(++e.position)}return-1!==n&&0!==r&&e.lineIndent<n&&S(e,"deficient indentation"),r}function N(e){var t,n=e.position;return!(45!==(t=e.input.charCodeAt(n))&&46!==t||t!==e.input.charCodeAt(n+1)||t!==e.input.charCodeAt(n+2)||(n+=3,0!==(t=e.input.charCodeAt(n))&&!p(t)))}function P(t,n){1===n?t.result+=" ":n>1&&(t.result+=e.repeat("\n",n-1))}function M(e,t){var n,r,i=e.tag,o=e.anchor,s=[],a=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=s),r=e.input.charCodeAt(e.position);0!==r&&45===r&&p(e.input.charCodeAt(e.position+1));)if(a=!0,e.position++,R(e,!0,-1)&&e.lineIndent<=t)s.push(null),r=e.input.charCodeAt(e.position);else if(n=e.line,z(e,t,3,!1,!0),s.push(e.result),R(e,!0,-1),r=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==r)E(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break;return!!a&&(e.tag=i,e.anchor=o,e.kind="sequence",e.result=s,!0)}function D(e){var t,n,r,i,s=!1,a=!1;if(33!==(i=e.input.charCodeAt(e.position)))return!1;if(null!==e.tag&&E(e,"duplication of a tag property"),60===(i=e.input.charCodeAt(++e.position))?(s=!0,i=e.input.charCodeAt(++e.position)):33===i?(a=!0,n="!!",i=e.input.charCodeAt(++e.position)):n="!",t=e.position,s){do{i=e.input.charCodeAt(++e.position)}while(0!==i&&62!==i);e.position<e.length?(r=e.input.slice(t,e.position),i=e.input.charCodeAt(++e.position)):E(e,"unexpected end of the stream within a verbatim tag")}else{for(;0!==i&&!p(i);)33===i&&(a?E(e,"tag suffix cannot contain exclamation marks"):(n=e.input.slice(t-1,e.position+1),u.test(n)||E(e,"named tag handle cannot contain such characters"),a=!0,t=e.position+1)),i=e.input.charCodeAt(++e.position);r=e.input.slice(t,e.position),l.test(r)&&E(e,"tag suffix cannot contain flow indicator characters")}return r&&!c.test(r)&&E(e,"tag name cannot contain such characters: "+r),s?e.tag=r:o.call(e.tagMap,n)?e.tag=e.tagMap[n]+r:"!"===n?e.tag="!"+r:"!!"===n?e.tag="tag:yaml.org,2002:"+r:E(e,'undeclared tag handle "'+n+'"'),!0}function I(e){var t,n;if(38!==(n=e.input.charCodeAt(e.position)))return!1;for(null!==e.anchor&&E(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;0!==n&&!p(n)&&!f(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&E(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function z(t,n,r,i,s){var a,l,u,c,g,_,x,w,S=1,T=!1,O=!1;if(null!==t.listener&&t.listener("open",t),t.tag=null,t.anchor=null,t.kind=null,t.result=null,a=l=u=4===r||3===r,i&&R(t,!0,-1)&&(T=!0,t.lineIndent>n?S=1:t.lineIndent===n?S=0:t.lineIndent<n&&(S=-1)),1===S)for(;D(t)||I(t);)R(t,!0,-1)?(T=!0,u=a,t.lineIndent>n?S=1:t.lineIndent===n?S=0:t.lineIndent<n&&(S=-1)):u=!1;if(u&&(u=T||s),1!==S&&4!==r||(x=1===r||2===r?n:n+1,w=t.position-t.lineStart,1===S?u&&(M(t,w)||function(e,t,n){var r,i,o,s,a=e.tag,l=e.anchor,u={},c={},d=null,f=null,m=null,g=!1,y=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=u),s=e.input.charCodeAt(e.position);0!==s;){if(r=e.input.charCodeAt(e.position+1),o=e.line,63!==s&&58!==s||!p(r)){if(!z(e,n,2,!1,!0))break;if(e.line===o){for(s=e.input.charCodeAt(e.position);h(s);)s=e.input.charCodeAt(++e.position);if(58===s)p(s=e.input.charCodeAt(++e.position))||E(e,"a whitespace character is expected after the key-value separator within a block mapping"),g&&(A(e,u,c,d,f,null),d=f=m=null),y=!0,g=!1,i=!1,d=e.tag,f=e.result;else{if(!y)return e.tag=a,e.anchor=l,!0;E(e,"can not read an implicit mapping pair; a colon is missed")}}else{if(!y)return e.tag=a,e.anchor=l,!0;E(e,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===s?(g&&(A(e,u,c,d,f,null),d=f=m=null),y=!0,g=!0,i=!0):g?(g=!1,i=!0):E(e,"incomplete explicit mapping pair; a key node is missed"),e.position+=1,s=r;if((e.line===o||e.lineIndent>t)&&(z(e,t,4,!0,i)&&(g?f=e.result:m=e.result),g||(A(e,u,c,d,f,m),d=f=m=null),R(e,!0,-1),s=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==s)E(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return g&&A(e,u,c,d,f,null),y&&(e.tag=a,e.anchor=l,e.kind="mapping",e.result=u),y}(t,w,x))||function(e,t){var n,r,i,o,s,a,l,u,c,d,h=!0,f=e.tag,m=e.anchor,g={};if(91===(d=e.input.charCodeAt(e.position)))i=93,a=!1,r=[];else{if(123!==d)return!1;i=125,a=!0,r={}}for(null!==e.anchor&&(e.anchorMap[e.anchor]=r),d=e.input.charCodeAt(++e.position);0!==d;){if(R(e,!0,t),(d=e.input.charCodeAt(e.position))===i)return e.position++,e.tag=f,e.anchor=m,e.kind=a?"mapping":"sequence",e.result=r,!0;h||E(e,"missed comma between flow collection entries"),c=null,o=s=!1,63===d&&p(e.input.charCodeAt(e.position+1))&&(o=s=!0,e.position++,R(e,!0,t)),n=e.line,z(e,t,1,!1,!0),u=e.tag,l=e.result,R(e,!0,t),d=e.input.charCodeAt(e.position),!s&&e.line!==n||58!==d||(o=!0,d=e.input.charCodeAt(++e.position),R(e,!0,t),z(e,t,1,!1,!0),c=e.result),a?A(e,r,g,u,l,c):o?r.push(A(e,null,g,u,l,c)):r.push(l),R(e,!0,t),44===(d=e.input.charCodeAt(e.position))?(h=!0,d=e.input.charCodeAt(++e.position)):h=!1}E(e,"unexpected end of the stream within a flow collection")}(t,x)?O=!0:(l&&function(t,n){var r,i,o,s,a,l=1,u=!1,c=n,p=0,f=!1;if(124===(s=t.input.charCodeAt(t.position)))i=!1;else{if(62!==s)return!1;i=!0}for(t.kind="scalar",t.result="";0!==s;)if(43===(s=t.input.charCodeAt(++t.position))||45===s)1===l?l=43===s?3:2:E(t,"repeat of a chomping mode identifier");else{if(!((o=48<=(a=s)&&a<=57?a-48:-1)>=0))break;0===o?E(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):u?E(t,"repeat of an indentation width identifier"):(c=n+o-1,u=!0)}if(h(s)){do{s=t.input.charCodeAt(++t.position)}while(h(s));if(35===s)do{s=t.input.charCodeAt(++t.position)}while(!d(s)&&0!==s)}for(;0!==s;){for(C(t),t.lineIndent=0,s=t.input.charCodeAt(t.position);(!u||t.lineIndent<c)&&32===s;)t.lineIndent++,s=t.input.charCodeAt(++t.position);if(!u&&t.lineIndent>c&&(c=t.lineIndent),d(s))p++;else{if(t.lineIndent<c){3===l?t.result+=e.repeat("\n",p):1===l&&u&&(t.result+="\n");break}for(i?h(s)?(f=!0,t.result+=e.repeat("\n",p+1)):f?(f=!1,t.result+=e.repeat("\n",p+1)):0===p?u&&(t.result+=" "):t.result+=e.repeat("\n",p):t.result+=u?e.repeat("\n",p+1):e.repeat("\n",p),u=!0,p=0,r=t.position;!d(s)&&0!==s;)s=t.input.charCodeAt(++t.position);k(t,r,t.position,!1)}}return!0}(t,x)||function(e,t){var n,r,i;if(39!==(n=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,r=i=e.position;0!==(n=e.input.charCodeAt(e.position));)if(39===n){if(k(e,r,e.position,!0),39!==(n=e.input.charCodeAt(++e.position)))return!0;r=i=e.position,e.position++}else d(n)?(k(e,r,i,!0),P(e,R(e,!1,t)),r=i=e.position):e.position===e.lineStart&&N(e)?E(e,"unexpected end of the document within a single quoted scalar"):(e.position++,i=e.position);E(e,"unexpected end of the stream within a single quoted scalar")}(t,x)||function(e,t){var n,r,i,o,s,a,l;if(34!==(a=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,n=r=e.position;0!==(a=e.input.charCodeAt(e.position));){if(34===a)return k(e,n,e.position,!0),e.position++,!0;if(92===a){if(k(e,n,e.position,!0),d(a=e.input.charCodeAt(++e.position)))R(e,!1,t);else if(a<256&&b[a])e.result+=v[a],e.position++;else if((s=120===(l=a)?2:117===l?4:85===l?8:0)>0){for(i=s,o=0;i>0;i--)(s=m(a=e.input.charCodeAt(++e.position)))>=0?o=(o<<4)+s:E(e,"expected hexadecimal character");e.result+=y(o),e.position++}else E(e,"unknown escape sequence");n=r=e.position}else d(a)?(k(e,n,r,!0),P(e,R(e,!1,t)),n=r=e.position):e.position===e.lineStart&&N(e)?E(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}E(e,"unexpected end of the stream within a double quoted scalar")}(t,x)?O=!0:function(e){var t,n,r;if(42!==(r=e.input.charCodeAt(e.position)))return!1;for(r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!p(r)&&!f(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&E(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),e.anchorMap.hasOwnProperty(n)||E(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],R(e,!0,-1),!0}(t)?(O=!0,null===t.tag&&null===t.anchor||E(t,"alias node should not have any properties")):function(e,t,n){var r,i,o,s,a,l,u,c,m=e.kind,g=e.result;if(p(c=e.input.charCodeAt(e.position))||f(c)||35===c||38===c||42===c||33===c||124===c||62===c||39===c||34===c||37===c||64===c||96===c)return!1;if((63===c||45===c)&&(p(r=e.input.charCodeAt(e.position+1))||n&&f(r)))return!1;for(e.kind="scalar",e.result="",i=o=e.position,s=!1;0!==c;){if(58===c){if(p(r=e.input.charCodeAt(e.position+1))||n&&f(r))break}else if(35===c){if(p(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&N(e)||n&&f(c))break;if(d(c)){if(a=e.line,l=e.lineStart,u=e.lineIndent,R(e,!1,-1),e.lineIndent>=t){s=!0,c=e.input.charCodeAt(e.position);continue}e.position=o,e.line=a,e.lineStart=l,e.lineIndent=u;break}}s&&(k(e,i,o,!1),P(e,e.line-a),i=o=e.position,s=!1),h(c)||(o=e.position+1),c=e.input.charCodeAt(++e.position)}return k(e,i,o,!1),!!e.result||(e.kind=m,e.result=g,!1)}(t,x,1===r)&&(O=!0,null===t.tag&&(t.tag="?")),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):0===S&&(O=u&&M(t,w))),null!==t.tag&&"!"!==t.tag)if("?"===t.tag){for(c=0,g=t.implicitTypes.length;c<g;c+=1)if((_=t.implicitTypes[c]).resolve(t.result)){t.result=_.construct(t.result),t.tag=_.tag,null!==t.anchor&&(t.anchorMap[t.anchor]=t.result);break}}else o.call(t.typeMap,t.tag)?(_=t.typeMap[t.tag],null!==t.result&&_.kind!==t.kind&&E(t,"unacceptable node kind for !<"+t.tag+'> tag; it should be "'+_.kind+'", not "'+t.kind+'"'),_.resolve(t.result)?(t.result=_.construct(t.result),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):E(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")):E(t,"unknown tag !<"+t.tag+">");return null!==t.listener&&t.listener("close",t),null!==t.tag||null!==t.anchor||O}function F(e){var t,n,r,i,s=e.position,l=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};0!==(i=e.input.charCodeAt(e.position))&&(R(e,!0,-1),i=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==i));){for(l=!0,i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!p(i);)i=e.input.charCodeAt(++e.position);for(r=[],(n=e.input.slice(t,e.position)).length<1&&E(e,"directive name must not be less than one character in length");0!==i;){for(;h(i);)i=e.input.charCodeAt(++e.position);if(35===i){do{i=e.input.charCodeAt(++e.position)}while(0!==i&&!d(i));break}if(d(i))break;for(t=e.position;0!==i&&!p(i);)i=e.input.charCodeAt(++e.position);r.push(e.input.slice(t,e.position))}0!==i&&C(e),o.call(T,n)?T[n](e,n,r):S(e,'unknown document directive "'+n+'"')}R(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,R(e,!0,-1)):l&&E(e,"directives end mark is expected"),z(e,e.lineIndent-1,4,!1,!0),R(e,!0,-1),e.checkLineBreaks&&a.test(e.input.slice(s,e.position))&&S(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&N(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,R(e,!0,-1)):e.position<e.length-1&&E(e,"end of the stream or a document separator is expected")}function L(e,t){t=t||{},0!==(e=String(e)).length&&(10!==e.charCodeAt(e.length-1)&&13!==e.charCodeAt(e.length-1)&&(e+="\n"),65279===e.charCodeAt(0)&&(e=e.slice(1)));var n=new x(e,t);for(n.input+="\0";32===n.input.charCodeAt(n.position);)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)F(n);return n.documents}function j(e,t,n){var r,i,o=L(e,n);for(r=0,i=o.length;r<i;r+=1)t(o[r])}function $(e,n){var r=L(e,n);if(0!==r.length){if(1===r.length)return r[0];throw new t("expected a single document in the stream, but found more")}}return ht.loadAll=j,ht.load=$,ht.safeLoadAll=function(t,n,i){j(t,n,e.extend({schema:r},i))},ht.safeLoad=function(t,n){return $(t,e.extend({schema:r},n))},ht}();function t(e){return function(){throw new Error("Function "+e+" is deprecated and cannot be used.")}}return dt.Type=gt(),dt.Schema=yt(),dt.FAILSAFE_SCHEMA=xt(),dt.JSON_SCHEMA=kt(),dt.CORE_SCHEMA=Ot(),dt.DEFAULT_SAFE_SCHEMA=rn(),dt.DEFAULT_FULL_SCHEMA=ln(),dt.load=e.load,dt.loadAll=e.loadAll,dt.safeLoad=e.safeLoad,dt.safeLoadAll=e.safeLoadAll,dt.YAMLException=mt(),dt.MINIMAL_SCHEMA=xt(),dt.SAFE_SCHEMA=rn(),dt.DEFAULT_SCHEMA=ln(),dt.scan=t("scan"),dt.parse=t("parse"),dt.compose=t("compose"),dt.addConstructor=t("addConstructor"),dt}();return Xt=e}(),cn=e.getDefaultExportFromCjs(un);class dn{constructor(t,n,r=null){this.url=t,!n||e.isRelativeURL(n)&&!e.isRelativeURL(this.url)?this.path=e.pathForURL(this.url):this.path=n,this.path_for_parent=n||this.path,this.parent=r,this.container=null,this.parent&&(this.parent.container?this.container=this.parent.container:this.parent.isContainer()&&(this.container=this.parent))}load(){return pn(this.url)}resourceFor(e){return{url:this.urlFor(e),path:this.pathFor(e),type:this.typeFor(e)}}urlFor(t){return u(t)?t:e.isRelativeURL(t)&&this.container?this.parent.urlFor(this.path_for_parent+t):e.addBaseURL(t,this.path)}pathFor(t){return e.pathForURL(t)}typeFor(t){return e.extensionForURL(t)}isContainer(){return!1}}class hn extends dn{constructor(e,t,n){super(e,t,n),this.zip=null,this.files={},this.root=null,this.path=""}isContainer(){return!0}async load(){if(this.zip=new ct,"string"==typeof this.url){const{body:t}=await e.Utils.io(this.url,6e4,"arraybuffer");return await this.zip.loadAsync(t),await this.parseZipFiles(),this.loadRoot()}return this}urlFor(t){return u(t)?t:e.isRelativeURL(t)?this.urlForZipFile(e.flattenRelativeURL(t)):super.urlFor(t)}typeFor(t){return e.isRelativeURL(t)?this.typeForZipFile(t):super.typeFor(t)}loadRoot(){return this.findRoot(),pn(this.urlForZipFile(this.root))}findRoot(){const t=Object.keys(this.files).filter(e=>0===this.files[e].depth).filter(t=>"yaml"===e.extensionForURL(t));if(1===t.length&&(this.root=t[0]),!this.root){let e=`Could not find root scene for bundle '${this.url}': `;throw e+="The zip archive's root level must contain a single scene file with the '.yaml' extension. ",t.length>0?e+=`Found multiple YAML files at the root level: ${t.map(e=>"'"+e+"'").join(", ")}.`:e+="Found NO YAML files at the root level.",Error(e)}}async parseZipFiles(){let t=[],n=[];this.zip.forEach((e,r)=>{r.dir||(t.push(e),n.push(r.async("arraybuffer")))});const r=await Promise.all(n);for(let n=0;n<r.length;n++){let i=t[n],o=i.split("/").length-1;this.files[i]={data:r[n],type:e.extensionForURL(i),depth:o}}}urlForZipFile(t){if(this.files[t])return this.files[t].url||(this.files[t].url=e.createObjectURL(new Blob([this.files[t].data]))),this.files[t].url}typeForZipFile(e){return this.files[e]&&this.files[e].type}}function pn(t){return new Promise((n,r)=>{"string"==typeof t?e.Utils.io(t).then(({body:e})=>{try{n(function(e){return cn.safeLoad(e,{json:!0})}(e))}catch(e){r(e)}},r):(t=Object.assign({},t),n(t))})}const fn={async loadScene(t,{path:n,type:r}={}){const i=[],o={},s=await this.loadSceneRecursive({url:t,path:n,type:r},null,o,i),{config:a,bundle:l}=this.finalize(s);if(!a)throw i[0];return i.length>0&&i.forEach(t=>{const n=`Failed to import scene: ${t.url}`;e.log("error",n,t),this.trigger("error",{type:"scene_import",message:n,error:t,url:t.url})}),{config:a,bundle:l,texture_nodes:o}},async loadSceneRecursive({url:t,path:n,type:r},i,o={},s=[]){if(!t)return{};const a=function(t,n,r,i=null){return null!=i&&"zip"===i||"string"==typeof t&&!e.isLocalURL(t)&&"zip"===e.extensionForURL(t)?new hn(t,n,r):new dn(t,n,r)}(t,n,i,r);try{let t=await a.load();if(null==t.import)return this.normalize(t,a,o),{config:t,bundle:a};Array.isArray(t.import)||(t.import=[t.import]);const n=[];t.import.forEach(t=>{"object"==typeof t&&(t=e.createObjectURL(new Blob([JSON.stringify(t)]))),n.push(a.resourceFor(t))}),delete t.import;const r=n.map(e=>this.loadSceneRecursive(e,a,o,s)),i=(await Promise.all(r)).map(e=>this.normalize(e.config,e.bundle,o)).map(e=>e.config);return this.normalize(t,a,o),t=e.mergeObjects(...i,t),{config:t,bundle:a,texture_nodes:o}}catch(e){return e.url=t,s.push(e),{}}},normalize(e,t,n={}){return this.normalizeDataSources(e,t),this.normalizeFonts(e,t),this.normalizeTextures(e,t),this.collectTextures(e,t,n),{config:e,bundle:t,texture_nodes:n}},normalizeDataSources(e,t){e.sources=e.sources||{};for(const n in e.sources)this.normalizeDataSource(e.sources[n],t);return e},normalizeDataSource(e,t){if(e.url=t.urlFor(e.url),Array.isArray(e.composite)&&e.composite.forEach(e=>e.url=t.urlFor(e.url)),e.scripts){Array.isArray(e.scripts)&&(e.scripts=e.scripts.reduce((e,t)=>(e[t]=t,e),{}));for(const n in e.scripts)e.scripts[n]=t.urlFor(e.scripts[n])}return e},normalizeFonts(e,t){e.fonts=e.fonts||{};const n=Object.values(e.fonts).filter(e=>"external"!==e);for(const e of n)(Array.isArray(e)?e:[e]).forEach(e=>e.url=t.urlFor(e.url));return e},normalizeTextures(e,t){if(e.textures=e.textures||{},e.textures)for(const n in e.textures){const r=e.textures[n];r.url&&(r.url=t.urlFor(r.url))}},collectTextures(t,n,r){if(t.styles)for(const e in t.styles){const i=t.styles[e],o=i.texture;if("string"==typeof o&&!t.textures[o]){const t=["styles",e,"texture"];this.addTextureNode(t,n,r)}i.material&&["emission","ambient","diffuse","specular","normal"].forEach(o=>{const s=null!=i.material[o]&&i.material[o].texture;if("string"==typeof s&&!t.textures[s]){const t=["styles",e,"material",o,"texture"];this.addTextureNode(t,n,r)}})}if(t.styles)for(const i in t.styles){const o=t.styles[i];o.shaders&&o.shaders.uniforms&&e.GLSL.parseUniforms(o.shaders.uniforms).forEach(({type:e,value:o,path:s})=>{if("sampler2D"===e&&"string"==typeof o&&!t.textures[o]){const e=["styles",i,"shaders","uniforms",...s];this.addTextureNode(e,n,r)}})}if(t.layers){const i=[t.layers],o=[["layers"]];for(;i.length>0;){const s=i.pop(),a=o.pop();if("object"==typeof s&&!Array.isArray(s))for(const l in s)if("draw"===l){const e=s[l];for(const i in e){if(e[i].texture){const o=e[i].texture;if("string"==typeof o&&!t.textures[o]){const e=[...a,l,"draw",i,"texture"];this.addTextureNode(e,n,r)}}if(e[i].outline&&e[i].outline.texture){const o=e[i].outline.texture;if("string"==typeof o&&!t.textures[o]){const e=[...a,l,"draw",i,"outline","texture"];this.addTextureNode(e,n,r)}}}}else{if(e.isReserved(l))continue;i.push(s[l]),o.push([...a,l])}}}},addTextureNode(e,t,n){n[JSON.stringify(e)]={path:e,bundle:t}},hoistTextureNodes(e,t,n={}){for(const{path:r,bundle:s}of Object.values(n)){const n=i(e,r);if("string"==typeof n&&null==e.textures[n])if(c(e,r)){const r=t.urlFor(n);e.textures[n]={url:r}}else{const t=s.urlFor(n);e.textures[t]={url:t},o(e,r,t)}}},applyGlobalProperties:e=>e.global&&0!==Object.keys(e.global).length?h(d(e.global),e):e,finalize:({config:e,bundle:t})=>e?(e.global=e.global||{},e.scene=e.scene||{},e.cameras=e.cameras||{},e.lights=e.lights||{},e.styles=e.styles||{},e.layers=e.layers||{},e.camera&&(e.cameras.default=e.camera),0===Object.keys(e.cameras).length&&(e.cameras.default={}),(0===Object.keys(e.lights).length||Object.keys(e.lights).every(t=>!1===e.lights[t].visible))&&(e.lights.default_light={type:"directional"}),{config:e,bundle:t}):{}};e.subscribeMixin(fn);class mn{constructor(){this.tiles={},this.max_proxy_descendant_depth=6,this.max_proxy_ancestor_depth=7,this.children_cache={}}addTile(t){for(this.tiles[t.key]=this.tiles[t.key]||{descendants:0},this.tiles[t.key].tile=t;t.style_z>=0;){if(!(t=e.TileID.parent(t)))return;this.tiles[t.key]||(this.tiles[t.key]={descendants:0}),this.tiles[t.key].descendants++}}removeTile(t){for(this.tiles[t.key]&&(delete this.tiles[t.key].tile,0===this.tiles[t.key].descendants&&delete this.tiles[t.key]);t.style_z>=0;){if(!(t=e.TileID.parent(t)))return;this.tiles[t.key]&&this.tiles[t.key].descendants>0&&(this.tiles[t.key].descendants--,0!==this.tiles[t.key].descendants||this.tiles[t.key].tile||delete this.tiles[t.key])}}getAncestor(t){let n=0;for(;n<this.max_proxy_ancestor_depth;){if(!(t=e.TileID.parent(t)))return;if(this.tiles[t.key]&&this.tiles[t.key].tile&&this.tiles[t.key].tile.loaded)return this.tiles[t.key].tile;n++}}getDescendants(t,n=0){let r=[];if(n<this.max_proxy_descendant_depth){let i=e.TileID.children(t,this.children_cache);if(!i)return;i.forEach(e=>{this.tiles[e.key]&&(this.tiles[e.key].tile&&this.tiles[e.key].tile.loaded?r.push(this.tiles[e.key].tile):this.tiles[e.key].descendants>0&&r.push(...this.getDescendants(e,n+1)))})}return r}}let gn={},yn={};function bn(t,n=null){if(this.obb)return e.Label.prototype.occluded.call(this,t,n);if(this.obbs)for(let r=0;r<this.obbs.length;r++){let i={aabb:this.aabbs[r],obb:this.obbs[r]};if(e.Label.prototype.occluded.call(i,t,n))return!0}return!1}class vn{constructor({scene:t}){this.scene=t,this.tiles={},this.pyramid=new mn,this.visible_coords={},this.queued_coords=[],this.building_tiles=null,this.renderable_tiles=[],this.collision={tile_keys:null,mesh_set:null,zoom:null,zoom_steps:3},this.main_thread_target=["TileManager",this.scene.id].join("_"),e.WorkerBroker.addTarget(this.main_thread_target,this)}destroy(){this.forEachTile(e=>e.destroy()),this.tiles={},this.pyramid=null,this.visible_coords={},this.queued_coords=[],this.scene=null,e.WorkerBroker.removeTarget(this.main_thread_target)}get view(){return this.scene.view}get style_manager(){return this.scene.style_manager}keepTile(e){this.tiles[e.key]=e,this.pyramid.addTile(e)}hasTile(e){return void 0!==this.tiles[e]}forgetTile(e){if(this.hasTile(e)){let t=this.tiles[e];this.pyramid.removeTile(t)}delete this.tiles[e],this.tileBuildStop(e)}removeTile(t){e.log("trace",`tile unload for ${t}`);var n=this.tiles[t];null!=n&&n.destroy(),this.forgetTile(n.key),this.scene.requestRedraw()}forEachTile(e){for(let t in this.tiles)e(this.tiles[t])}removeTiles(e){let t=[];for(let n in this.tiles)e(this.tiles[n])&&t.push(n);for(let e=0;e<t.length;e++){let n=t[e];this.removeTile(n)}}updateTilesForView(){this.visible_coords={};let e=this.view.findVisibleTileCoordinates();for(let t=0;t<e.length;t++){const n=e[t];this.queueCoordinate(n),this.visible_coords[n.key]=n}this.updateTileStates()}updateTileStates(){return this.forEachTile(e=>{this.updateVisibility(e)}),this.loadQueuedCoordinates(),this.updateProxyTiles(),this.view.pruneTilesForView(),this.updateRenderableTiles(),this.style_manager.updateActiveStyles(this.renderable_tiles),this.style_manager.updateActiveBlendOrders(this.renderable_tiles),this.updateLabels()}updateLabels(){var t=this;if(this.scene.building&&!this.scene.building.initial)return Promise.resolve({});const n=this.renderable_tiles.filter(e=>e.valid).filter(e=>e.built);return 0===n.length?Promise.resolve({}):(n.sort((e,t)=>e.build_id<t.build_id?-1:e.build_id>t.build_id?1:0),this.collision.zoom===_n(this.view.zoom,this.collision.zoom_steps)&&this.collision.tile_keys===JSON.stringify(n.map(e=>e.key))&&this.collision.mesh_set===xn(n)?Promise.resolve({}):(this.collision.task||(this.collision.zoom=_n(this.view.zoom,this.collision.zoom_steps),this.collision.tile_keys=JSON.stringify(n.map(e=>e.key)),this.collision.mesh_set=xn(n),this.collision.task={type:"tileManagerUpdateLabels",run:async function(r){const i=await async function(t,n,r=!1){yn=gn,gn={};let i=function(t,n){let r={};t.forEach(t=>{const i=e.Geo.unitsPerMeter(t.coords.z),o=Math.pow(2,n-t.style_z),s=i*o,a=e.Geo.metersPerPixel(n),l=Object.assign({},t.meshes,t.pending_label_meshes);for(let n in l)l[n].forEach(n=>{if(n.labels)for(let o in n.labels){if(t.isProxy()&&!yn[o])continue;const l=n.labels[o].container.label,u=n.labels[o].container.linked,c=n.labels[o].ranges;let d={};if(d.discard=bn.bind(d),d.build_id=t.build_id,Object.assign(d,l),d.layout=Object.assign({},l.layout),d.layout.repeat_scale=.75,d.layout.repeat_distance=d.layout.repeat_distance||0,d.layout.repeat_distance/=s,d.position=[d.position[0]/i+t.min.x,d.position[1]/i+t.min.y],d.unit_scale=a,"point"===d.type)e.LabelPoint.prototype.updateBBoxes.call(d);else if("straight"===d.type)e.LabelLineStraight.prototype.updateBBoxes.call(d,d.position,d.size,d.angle,d.angle,d.offset);else if(l.obbs){const n=l.obbs.map(n=>{let{x:r,y:o,a:a,w:l,h:u}=n;return r=r/i+t.min.x,o=o/i+t.min.y,l/=s,u/=s,new e.OBB(r,o,a,l,u)});d.obbs=n,d.aabbs=n.map(e=>e.getExtent())}r[o]={label:d,linked:u,ranges:c,mesh:n}}})});for(let e in r){const t=r[e];t.linked&&(t.linked=r[t.linked])}return r=Object.keys(r).map(e=>r[e]),r}(t,n);e.Collision.startTile("main",{apply_repeat_groups:!0,return_hidden:!0}),e.Collision.addStyle("main","main");const o=Math.max(0,...Object.values(t).map(e=>Object.values(e.meshes)).flat().map(e=>Math.max(0,...e.map(e=>e.labels?Object.keys(e.labels).length:0)))),s=Math.floor(o/e.Geo.tile_size);s>0?e.Collision.initGrid({anchor:{x:Math.min(...t.map(e=>e.min.x)),y:Math.min(...t.map(e=>e.min.y))},span:t[0].span.x/s}):e.Collision.initGrid();const a=await e.Collision.collide(i,"main","main");let l=[];return a.forEach(e=>{let t=0;!0!==e.show||r&&e.label.breach&&!yn[e.label.id]||(t=1),t&&(gn[e.label.id]=!0);let n=!0;e.ranges.forEach(r=>{if(!n)return;let i=e.mesh;if(!i.valid)return;let o=i.vertex_layout.offset.a_shape,s=i.vertex_layout.stride;for(let e=0;e<r[1];e++){if(i.vertex_data[r[0]+e*s+o+6]===t)return void(n=!1);i.vertex_data[r[0]+e*s+o+6]=t}-1===l.indexOf(i)&&l.push(i)})}),l.forEach(e=>e.upload()),t.forEach(e=>e.swapPendingLabels()),{labels:a,containers:i}}(n,t.collision.zoom,t.isLoadingVisibleTiles());t.scene.requestRedraw(),t.collision.task=null,e.Task.finish(r,i),t.updateTileStates()},immediate:!0},e.Task.add(this.collision.task)),this.collision.task.promise))}updateProxyTiles(){if(0===this.view.zoom_direction)return;this.forEachTile(e=>e.setProxyFor(null));let e=!1;this.forEachTile(t=>{if(t.visible&&!t.labeled){const n=this.pyramid.getAncestor(t);if(n)n.setProxyFor(t),e=!0;else{const n=this.pyramid.getDescendants(t);for(let r=0;r<n.length;r++)n[r].setProxyFor(t),e=!0}}}),e||(this.view.zoom_direction=0)}updateVisibility(t){if(t.visible=!1,t.style_z===this.view.tile_zoom)if(this.visible_coords[t.coords.key])t.visible=!0;else for(let n in this.visible_coords)if(e.TileID.isDescendant(t.coords,this.visible_coords[n])){t.visible=!0;break}}pruneToVisibleTiles(){this.removeTiles(e=>!e.visible)}getRenderableTiles(){return this.renderable_tiles}updateRenderableTiles(){this.renderable_tiles=[];for(let e in this.tiles){let t=this.tiles[e];t.visible&&t.loaded&&this.renderable_tiles.push(t)}return this.renderable_tiles}isLoadingVisibleTiles(){return Object.keys(this.tiles).some(e=>this.tiles[e].visible&&!this.tiles[e].built)}allVisibleTilesLabeled(){return this.renderable_tiles.every(e=>e.labeled)}queueCoordinate(e){this.queued_coords[this.queued_coords.length]=e}loadQueuedCoordinates(){0!==this.queued_coords.length&&(this.queued_coords.sort((t,n)=>{let r=this.view.center.meters,i=e.Geo.metersPerTile(t.z)/2,o=e.Geo.metersForTile(t);o.x+=i,o.y-=i;let s=e.Geo.metersForTile(n);s.x+=i,s.y-=i;let a=Math.abs(r.x-o.x)+Math.abs(r.y-o.y),l=Math.abs(r.x-s.x)+Math.abs(r.y-s.y);return t.center_dist=a,n.center_dist=l,l>a?-1:l===a?0:1}),this.queued_coords.forEach(e=>this.loadCoordinate(e)),this.queued_coords=[])}loadCoordinate(t){if(t.z===this.view.center.tile.z)for(let n in this.scene.sources){let r=this.scene.sources[n];if(!r.builds_geometry_tiles||!r.includesTile(t,this.view.tile_zoom))continue;let i=e.TileID.normalizedKey(t,r,this.view.tile_zoom);if(i&&!this.hasTile(i)){e.log("trace",`load tile ${i}, distance from view center: ${t.center_dist}`);let n=new e.Tile({source:r,coords:t,workers:this.scene.workers,style_z:this.view.baseZoom(t.z),view:this.view});this.keepTile(n),this.buildTile(n)}}}buildTile(e,t){this.tileBuildStart(e.key),this.updateVisibility(e),e.build(this.scene.generation,t)}buildTileStylesCompleted({tile:t,progress:n}){if(null==this.tiles[t.key])e.log("trace",`discarded tile ${t.key} in TileManager.buildTileStylesCompleted because previously removed`),e.Tile.abortBuild(t),this.updateTileStates();else if(t.generation!==this.scene.generation)e.log("trace",`discarded tile ${t.key} in TileManager.buildTileStylesCompleted because built with scene config gen ${t.generation}, current ${this.scene.generation}`),e.Tile.abortBuild(t),this.updateTileStates();else{if(this.tiles[t.key]){if(t.id<this.tiles[t.key].id)return e.log("trace",`discarded tile ${t.key} for id ${t.id} in TileManager.buildTileStylesCompleted because built for discarded tile id`),void e.Tile.abortBuild(t);t=this.tiles[t.key].merge(t)}n.done&&(t.built=!0),t.buildMeshes(this.scene.styles,n),this.updateTileStates(),this.scene.requestRedraw()}n.done&&this.tileBuildStop(t.key)}buildTileError(t){e.log("error",`Error building tile ${t.key}:`,t.error),this.forgetTile(t.key),e.Tile.abortBuild(t)}tileBuildStart(t){this.building_tiles=this.building_tiles||{},this.building_tiles[t]=!0,e.log("trace",`tileBuildStart for ${t}: ${Object.keys(this.building_tiles).length}`)}tileBuildStop(t){this.building_tiles&&(e.log("trace",`tileBuildStop for ${t}: ${Object.keys(this.building_tiles).length}`),delete this.building_tiles[t],this.checkBuildQueue())}checkBuildQueue(){this.building_tiles&&0!==Object.keys(this.building_tiles).length||(this.building_tiles=null,this.scene.tileManagerBuildDone())}getDebugProp(e,t){var n=[];for(var r in this.tiles)null==this.tiles[r].debug[e]||"function"==typeof t&&!0!==t(this.tiles[r])||n.push(this.tiles[r].debug[e]);return n}getDebugSum(e,t){var n=0;for(var r in this.tiles)null==this.tiles[r].debug[e]||"function"==typeof t&&!0!==t(this.tiles[r])||(n+=this.tiles[r].debug[e]);return n}getDebugAverage(e,t){return this.getDebugSum(e,t)/Object.keys(this.tiles).length}}function _n(e,t,n=2){return(Math.floor(e*t)/t).toFixed(n)}function xn(e){return JSON.stringify(Object.entries(e).map(([,e])=>Object.entries(e.meshes).map(([,e])=>e.map(e=>e.created_at))))}class wn{constructor(e,t){t(e),this.value=e,this.setup=t}set(e){JSON.stringify(this.value)!==JSON.stringify(e)&&(this.setup(e),this.value=e)}}class En{constructor(e){this.defaults={},this.defaults.culling=!0,this.defaults.culling_face=e.BACK,this.defaults.blending=!1,this.defaults.blending_src=e.ONE_MINUS_SRC_ALPHA,this.defaults.blending_dst=e.ONE_MINUS_SRC_ALPHA,this.defaults.blending_src_alpha=e.ONE,this.defaults.blending_dst_alpha=e.ONE_MINUS_SRC_ALPHA,this.defaults.depth_write=!0,this.defaults.depth_test=!0,e.depthFunc(e.LESS),this.culling=new wn({cull:this.defaults.culling,face:this.defaults.culling_face},t=>{t.cull?(e.enable(e.CULL_FACE),e.cullFace(t.face)):e.disable(e.CULL_FACE)}),this.blending=new wn({blend:this.defaults.blending,src:this.defaults.blending_src,dst:this.defaults.blending_dst,src_alpha:this.defaults.blending_src_alpha,dst_alpha:this.defaults.blending_dst_alpha},t=>{t.blend?(e.enable(e.BLEND),t.src_alpha&&t.dst_alpha?e.blendFuncSeparate(t.src,t.dst,t.src_alpha,t.dst_alpha):e.blendFunc(t.src,t.dst)):e.disable(e.BLEND)}),this.depth_write=new wn({depth_write:this.defaults.depth_write},t=>{e.depthMask(t.depth_write)}),this.depth_test=new wn({depth_test:this.defaults.depth_test},t=>{t.depth_test?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST)})}}class Sn{constructor(){this.canvas=null,this.gl=null,this.screenshot_canvas=null,this.screenshot_context=null,this.queue_screenshot=null,this.video_capture=null}setCanvas(e,t){this.canvas=e,this.gl=t}screenshot({background:e}={}){return null!=this.queue_screenshot||(this.queue_screenshot={background:e},this.queue_screenshot.promise=new Promise((e,t)=>{this.queue_screenshot.resolve=e,this.queue_screenshot.reject=t})),this.queue_screenshot.promise}completeScreenshot(){if(null!=this.queue_screenshot){let t=this.canvas.width,n=this.canvas.height,r=new Uint8Array(t*n*4);this.gl.readPixels(0,0,t,n,this.gl.RGBA,this.gl.UNSIGNED_BYTE,r);let i=this.queue_screenshot.background;i=i&&"transparent"!==i?e.StyleParser.parseColor(i).slice(0,3).map(e=>255*e):null;let o=new Uint8ClampedArray(t*n*4);for(let e=0;e<n;e++)for(let s=0;s<t;s++){let a=4*((n-e-1)*t+s),l=4*(e*t+s),u=r[a+3];o[l+0]=255*r[a+0]/u,o[l+1]=255*r[a+1]/u,o[l+2]=255*r[a+2]/u,o[l+3]=u,i&&(u/=255,o[l+0]=o[l+0]*u+i[0]*(1-u),o[l+1]=o[l+1]*u+i[1]*(1-u),o[l+2]=o[l+2]*u+i[2]*(1-u),o[l+3]=255)}this.screenshot_canvas=this.screenshot_canvas||document.createElement("canvas");let s=this.screenshot_canvas;s.width=t,s.height=n,this.screenshot_context=this.screenshot_context||s.getContext("2d");let a=this.screenshot_context,l=new ImageData(o,t,n);a.putImageData(l,0,0);const u=s.toDataURL("image/png"),c=atob(u.slice(22)),d=new Uint8Array(c.length);for(let e=0;e<c.length;++e)d[e]=c.charCodeAt(e);const h=new Blob([d],{type:"image/png"});this.queue_screenshot.resolve({url:u,blob:h,type:"png"}),this.queue_screenshot=null}}startVideoCapture(){if("function"!=typeof window.MediaRecorder||!this.canvas||"function"!=typeof this.canvas.captureStream)return e.log("warn","Video capture (Canvas.captureStream and/or MediaRecorder APIs) not supported by browser"),!1;if(this.video_capture)return e.log("warn","Video capture already in progress, call Scene.stopVideoCapture() first"),!1;try{let t=this.video_capture={};t.chunks=[],t.stream=this.canvas.captureStream(),t.options={mimeType:"video/webm"},t.media_recorder=new MediaRecorder(t.stream,t.options),t.media_recorder.ondataavailable=n=>{if(n.data.size>0&&t.chunks.push(n.data),t.resolve){let n=new Blob(t.chunks,{type:t.options.mimeType}),r=e.createObjectURL(n);t.stream&&(t.stream.getTracks()||[]).forEach(e=>{e.stop(),t.stream.removeTrack(e)}),t.stream=null,t.media_recorder=null,this.video_capture=null,t.resolve({url:r,blob:n,type:"webm"})}},t.media_recorder.start()}catch(t){return this.video_capture=null,e.log("error","Scene video capture failed",t),!1}return!0}stopVideoCapture(){return this.video_capture?(this.video_capture.promise=new Promise((e,t)=>{this.video_capture.resolve=e,this.video_capture.reject=t}),this.video_capture.media_recorder.stop(),this.video_capture.promise):(e.log("warn","No scene video capture in progress, call Scene.startVideoCapture() first"),Promise.resolve({}))}}function Tn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function kn(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?Tn(Object(r),!0).forEach(function(n){e._defineProperty(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Tn(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}class On{constructor(t,n){var r;n=n||{},e.subscribeMixin(this),this.id=On.id++,this.initialized=!1,this.initializing=null,this.sources={},this.view=new e.View(this,n),this.tile_manager=new vn({scene:this}),this.num_workers=n.numWorkers||2,!0===n.disableVertexArrayObjects&&(e.VertexArrayObject.disabled=!0),e.Utils.use_high_density_display=void 0===n.highDensityDisplay||n.highDensityDisplay,e.Utils.updateDevicePixelRatio(),this.config=null,this.config_source=t,this.config_bundle=null,this.last_valid_config_source=null,this.styles=null,this.style_manager=new e.StyleManager,this.building=null,this.dirty=!0,n.preUpdate&&this.subscribe({pre_update:n.preUpdate}),n.postUpdate&&this.subscribe({post_update:n.postUpdate}),this.render_loop=!n.disableRenderLoop,this.render_loop_active=!1,this.render_loop_stop=!1,this.render_count=0,this.last_render_count=0,this.render_count_changed=!1,this.frame=0,this.last_main_render=-1,this.last_selection_render=-1,this.media_capture=new Sn,this.selection=null,this.selection_feature_count=0,this.fetching_selection_map=null,this.prev_textures=null,this.introspection=!0===n.introspection,this.times={},this.resetTime(),this.container=n.container,this.canvas=null,this.contextOptions=n.webGLContextOptions,this.lights=null,this.background=null,this.createListeners(),this.updating=0,this.generation=On.generation,this.last_complete_generation=On.generation,(r=this).debug={profile(t){console.profile(`main thread: ${t}`),e.WorkerBroker.postMessage(r.workers,"self.profile",t)},profileEnd(t){console.profileEnd(`main thread: ${t}`),e.WorkerBroker.postMessage(r.workers,"self.profileEnd",t)},timeRebuild(t=1,n={}){let i=[],o=()=>{let s=+new Date;r.rebuild(n).then(()=>{if(i.push(+new Date-s),i.length<t)o();else{let n=~~(i.reduce((e,t)=>e+t)/i.length);e.log("info",`Profiled rebuild ${t} times: ${n} avg (${Math.min(...i)} min, ${Math.max(...i)} max)`)}})};o()},geometryCountByStyle(){let e={};return r.tile_manager.getRenderableTiles().forEach(t=>{for(let n in t.meshes)e[n]=e[n]||0,t.meshes[n].forEach(t=>{e[n]+=t.geometry_count})}),e},geometryCountByBaseStyle(){let e=r.debug.geometryCountByStyle(),t={};for(let n in e){let i=r.styles[n].baseStyle();t[i]=t[i]||0,t[i]+=e[n]}return t},geometryCountTotal(){const e=r.debug.geometryCountByStyle();return Object.keys(e).reduce((t,n)=>e[n]+t,0)},geometrySizeByStyle(){let e={};return r.tile_manager.getRenderableTiles().forEach(t=>{for(let n in t.meshes)e[n]=e[n]||0,t.meshes[n].forEach(t=>{e[n]+=t.buffer_size})}),e},geometrySizeByBaseStyle(){let e=r.debug.geometrySizeByStyle(),t={};for(let n in e){let i=r.styles[n].baseStyle();t[i]=t[i]||0,t[i]+=e[n]}return t},geometrySizeTotal(){const e=r.debug.geometrySizeByStyle();return Object.keys(e).reduce((t,n)=>e[n]+t,0)},textureSizeTotal:()=>Object.values(e.Texture.textures).map(e=>e.byteSize()).reduce((e,t)=>e+t),layerStats:()=>e.debugSettings.layer_stats?e.debugSumLayerStats(r.tile_manager.getRenderableTiles()):(e.log("warn","Enable the 'layer_stats' debug setting to collect layer stats"),{}),renderableTilesCount:()=>r.tile_manager.getRenderableTiles().length},this.log_level=n.logLevel||"warn",e.log.setLevel(this.log_level),e.log.reset()}static create(e,t={}){return new On(e,t)}load(t=null,n={}){var r=this;return this.initializing||(e.log.reset(),this.updating++,this.initialized=!1,this.view_complete=!1,this.times.frame=null,this.times.build=null,(n="string"==typeof n?{base_path:n}:n).blocking=void 0===n.blocking||n.blocking,!1!==this.render_loop&&this.setupRenderLoop(),this.createCanvas(),this.prev_textures=this.config&&Object.keys(this.config.textures),this.initializing=this.loadScene(t,n).then(async function({texture_nodes:t}){await r.createWorkers(),r.destroyFeatureSelection(),e.WorkerBroker.postMessage(r.workers,"self.clearFunctionStringCache");const i="object"==typeof r.config_source||r.hasSubscribersFor("load"),o=r.updateConfig({texture_nodes:t,serialize_funcs:i,normalize:!1,loading:!0,fade_in:!0});!0===n.blocking&&await o,r.freePreviousTextures(),r.updating--,r.initializing=null,r.initialized=!0,r.last_valid_config_source=r.config_source,r.last_valid_options={base_path:n.base_path,file_type:n.file_type},r.requestRedraw()}).catch(t=>{let n,r;if(this.initializing=null,this.updating=0,"YAMLException"===t.name?(n="yaml",r="Error parsing scene YAML"):r="Error initializing scene",this.trigger("error",{type:n,message:r,error:t,url:this.config_source}),r=`Scene.load() failed to load ${JSON.stringify(this.config_source)}: ${t.message}`,this.last_valid_config_source)return e.log("warn",r,t),e.log("info","Scene.load() reverting to last valid configuration"),this.load(this.last_valid_config_source,this.last_valid_base_path);throw e.log("error",r,t),t})),this.initializing}destroy(){if(this.initialized=!1,this.render_loop_stop=!0,this.destroyListeners(),this.destroyFeatureSelection(),this.canvas&&this.canvas.parentNode&&(this.canvas.parentNode.removeChild(this.canvas),this.canvas=null),this.container=null,this.gl){e.Texture.destroy(this.gl),this.style_manager.destroy(this.gl),this.styles={},e.ShaderProgram.reset();let t=this.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this.gl=null}this.sources={},this.destroyWorkers(),this.tile_manager.destroy(),this.tile_manager=null,e.log.reset()}createCanvas(){if(!this.canvas){this.container=this.container||document.body,this.canvas=document.createElement("canvas"),this.canvas.style.position="absolute",this.canvas.style.top=0,this.canvas.style.left=0,this.container.style.backgroundColor="transparent",this.container.appendChild(this.canvas);try{this.gl=n.getContext(this.canvas,Object.assign({alpha:!0,premultipliedAlpha:!0,stencil:!0,device_pixel_ratio:e.Utils.device_pixel_ratio,powerPreference:"high-performance"},this.contextOptions))}catch(e){throw new Error("Couldn't create WebGL context. Your browser may not support WebGL, or it's turned off? Visit http://webglreport.com/ for more info.")}this.resizeMap(this.container.clientWidth,this.container.clientHeight),e.VertexArrayObject.init(this.gl),this.render_states=new En(this.gl),this.media_capture.setCanvas(this.canvas,this.gl)}}updateExternalScripts(){let e=[...this.external_scripts||[]],t=[];if(this.config.scene.scripts)for(let e in this.config.scene.scripts)-1===t.indexOf(this.config.scene.scripts[e])&&t.push(this.config.scene.scripts[e]);for(let e in this.config.sources){let n=this.config.sources[e];if(n.scripts)for(let e in n.scripts)-1===t.indexOf(n.scripts[e])&&t.push(n.scripts[e])}return this.external_scripts=t,!(this.external_scripts.length===e.length&&this.external_scripts.every((t,n)=>t===e[n]))}createWorkers(){return this.updateExternalScripts()&&this.destroyWorkers(),this.workers?Promise.resolve():this.makeWorkers()}makeWorkers(){let t=!!this.gl.getExtension("OES_element_index_uint"),n=[];this.workers=[];for(let r=0;r<this.num_workers;r++){let i=new Worker(sM.workerURL);this.workers[r]=i,e.WorkerBroker.addWorker(i),e.log("debug",`Scene.makeWorkers: initializing worker ${r}`);let o=r;n.push(e.WorkerBroker.postMessage(i,"self.init",this.id,r,this.num_workers,this.log_level,e.Utils.device_pixel_ratio,t,this.external_scripts).then(t=>(e.log("debug",`Scene.makeWorkers: initialized worker ${t}`),t),t=>(e.log("error",`Scene.makeWorkers: failed to initialize worker ${o}:`,t),Promise.reject(t))))}return this.next_worker=0,Promise.all(n).then(()=>{e.log.setWorkers(this.workers)})}destroyWorkers(){this.selection=null,Array.isArray(this.workers)&&(e.log.setWorkers(null),this.workers.forEach(e=>{e.terminate()}),this.workers=null)}ready(){return!(!this.view.ready()||0===Object.keys(this.sources).length)}updateDevicePixelRatio(){e.Utils.updateDevicePixelRatio()&&e.WorkerBroker.postMessage(this.workers,"self.updateDevicePixelRatio",e.Utils.device_pixel_ratio).then(()=>this.rebuild()).then(()=>this.resizeMap(this.view.size.css.width,this.view.size.css.height))}resizeMap(t,r){0===t&&0===r||(this.dirty=!0,this.view.setViewportSize(t,r),this.gl&&n.resize(this.gl,t,r,e.Utils.device_pixel_ratio))}requestRedraw(){this.dirty=!0}immediateRedraw(){this.dirty=!0,this.update()}renderLoop(){this.render_loop_active=!0,this.update(),e.Task.setState({user_moving_view:this.view.user_input_active}),e.Task.processAll(),this.render_loop_stop?(this.render_loop_stop=!1,this.render_loop_active=!1):window.requestAnimationFrame(this.renderLoop.bind(this))}setupRenderLoop(){this.render_loop_active||setTimeout(()=>{this.renderLoop()},0)}update(){let t=this.dirty,n=!!this.selection&&this.selection.hasPendingRequests();var r=!(!1===t&&!1===n||!1===this.initialized||this.updating>0||!1===this.ready());return this.trigger("pre_update",r),this.view.update(),!!r&&(this.dirty=!1,this.updateDevicePixelRatio(),this.render({main:t,selection:n}),this.updateViewComplete(),this.media_capture.completeScreenshot(),this.trigger("post_update",r),(!0===this.animated||this.view.isAnimating())&&(this.dirty=!0),this.frame++,e.log("trace","Scene.render()"),!0)}render({main:t,selection:n}){var r=this.gl;if(this.updateBackground(),Object.keys(this.lights).forEach(e=>this.lights[e].update()),this.render_count_changed=!1,t&&(this.render_count=this.renderPass(),this.last_main_render=this.frame,this.render_count!==this.last_render_count&&(this.render_count_changed=!0,this.logFirstFrame(),this.getFeatureSelectionMapSize().then(t=>{this.selection_feature_count=t,e.log("info",`Scene: rendered ${this.render_count} primitives (${t} features in selection map)`)})),this.last_render_count=this.render_count),n){if(this.view.panning||this.view.user_input_active)return void this.selection.clearPendingRequests();!this.selection.locked&&this.last_selection_render<this.last_main_render&&(this.selection.bind(),this.renderPass("selection_program",{allow_blend:!1}),r.bindFramebuffer(r.FRAMEBUFFER,null),r.viewport(0,0,this.canvas.width,this.canvas.height),r.clearColor(...this.background.computed_color),this.last_selection_render=this.frame),this.selection.read()}return!0}renderPass(t="program",{allow_blend:n}={}){n=null==n||n,this.clearFrame();let r,i=0;const o=this.style_manager.getActiveBlendOrders();for(const{blend_order:s,styles:a}of o)for(let o=0;o<a.length;o++){let l=this.styles[a[o]];if(null==l)continue;if(l.blend!==r){let t=Object.assign({},e.Style.render_states[l.blend],{blend:n&&l.blend});this.setRenderState(t)}const u=n&&l.blend;if("translucent"===u)this.gl.colorMask(!1,!1,!1,!1),this.renderStyle(l.name,t,s),this.gl.colorMask(!0,!0,!0,!0),this.gl.depthFunc(this.gl.EQUAL),this.gl.enable(this.gl.STENCIL_TEST),this.gl.clearStencil(0),this.gl.clear(this.gl.STENCIL_BUFFER_BIT),this.gl.stencilFunc(this.gl.EQUAL,this.gl.ZERO,255),this.gl.stencilOp(this.gl.KEEP,this.gl.KEEP,this.gl.INCR),i+=this.renderStyle(l.name,t,s),this.gl.disable(this.gl.STENCIL_TEST),this.gl.depthFunc(this.gl.LESS);else if("opaque"!==u&&!0===l.stencil_proxy_tiles){const e=this.tile_manager.getRenderableTiles().filter(e=>e.meshes[l.name]).map(e=>e.proxy_level).reduce((e,t)=>(e.indexOf(t)>-1||e.push(t),e),[]).sort();if(e.length>1){this.gl.enable(this.gl.STENCIL_TEST),this.gl.clearStencil(0),this.gl.clear(this.gl.STENCIL_BUFFER_BIT),this.gl.stencilOp(this.gl.KEEP,this.gl.KEEP,this.gl.REPLACE);for(let n=0;n<e.length;n++)this.gl.stencilFunc(this.gl.GEQUAL,e.length-n,255),i+=this.renderStyle(l.name,t,s,e[n]);this.gl.disable(this.gl.STENCIL_TEST)}else i+=this.renderStyle(l.name,t,s)}else i+=this.renderStyle(l.name,t,s);r=l.blend}return i}renderStyle(e,t,n,r=null){let i,o=this.styles[e],s=!0,a=0,l=this.tile_manager.getRenderableTiles().filter(e=>"number"!=typeof r||e.proxy_level===r).map(t=>{if(t.meshes[e])return[t,t.meshes[e].filter(e=>e.variant.blend_order===n)]}).filter(e=>e),u=Math.max(...l.map(([,e])=>Math.max(...e.map(e=>e.variant.mesh_order))));for(let n=0;n<u+1;n++)for(let[r,u]of l){let l=!0;if(!r.shouldProxyForStyle(e))continue;const c=u.filter(e=>e.variant.mesh_order===n);if(0!==c.length){if(!0===s&&(s=!1,i=this.setupStyle(o,t),!i))return 0;c.forEach(e=>{!0===l&&(l=!1,this.view.setupTile(r,i)),o.render(e)&&this.requestRedraw(),a+=e.geometry_count})}}return a}setupStyle(e,t){let n;try{if(n=e.getProgram(t),!n)return}catch(t){return void this.trigger("warning",{type:"styles",message:`Error compiling style ${e.name}`,style:e,shader_errors:e.program&&e.program.shader_errors})}n.use(),e.setup(),n.uniform("1f","u_time",this.animated?(+new Date-this.start_time)/1e3:0),this.view.setupProgram(n);for(let e in this.lights)this.lights[e].setupProgram(n);return n}clearFrame(){this.initialized&&(this.render_states.depth_write.set({depth_write:!0}),this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT|this.gl.STENCIL_BUFFER_BIT))}setRenderState({depth_test:e,depth_write:t,cull_face:n,blend:r}={}){if(!this.initialized)return;let i=this.render_states;e=!1!==e&&i.defaults.depth_test,t=!1!==t&&i.defaults.depth_write,n=!1!==n&&i.defaults.culling,r=null!=r?r:i.defaults.blending;let o=this.gl;i.depth_test.set({depth_test:e}),i.depth_write.set({depth_write:t}),i.culling.set({cull:n,face:i.defaults.culling_face}),r?"opaque"===r?i.blending.set({blend:!1}):"overlay"===r||"inlay"===r||"translucent"===r?i.blending.set({blend:!0,src:o.SRC_ALPHA,dst:o.ONE_MINUS_SRC_ALPHA,src_alpha:o.ONE,dst_alpha:o.ONE_MINUS_SRC_ALPHA}):"add"===r?i.blending.set({blend:!0,src:o.ONE,dst:o.ONE}):"multiply"===r&&i.blending.set({blend:!0,src:o.ZERO,dst:o.SRC_COLOR}):i.blending.set({blend:!1})}getFeatureAt(t,{radius:n}={}){if(!this.initialized)return e.log("debug","Scene.getFeatureAt() called before scene was initialized"),Promise.resolve();if(0===this.selection_feature_count)return Promise.resolve();this.selection||this.resetFeatureSelection();let r={x:t.x/this.view.size.css.width,y:t.y/this.view.size.css.height};return n=n>0?{x:n/this.view.size.css.width,y:n/this.view.size.css.height}:null,this.selection.getFeatureAt(r,{radius:n}).then(e=>Object.assign(e,{pixel:t})).catch(e=>Promise.resolve({error:e}))}async queryFeatures({filter:t,unique:n=!0,group_by:r=null,visible:i=null,geometry:o=!1}={}){if(!this.initialized)return[];t=e.Utils.serializeWithFunctions(t);const s=!0===(n="string"==typeof n?[n]:n)||Array.isArray(n)&&n.indexOf("$id")>-1,a=n&&(t=>{const r=Array.isArray(n)?e.sliceObject(t.properties,n):t.properties,i=s?t.id:null;return o?JSON.stringify({geometry:t.geometry,properties:r,id:i}):JSON.stringify({properties:r,id:i})}),l=(r=("string"==typeof r||Array.isArray(r))&&r)&&(t=>Array.isArray(r)?JSON.stringify(e.sliceObject(t,r)):t[r]),u=this.tile_manager.getRenderableTiles().map(e=>e.key),c=await e.WorkerBroker.postMessage(this.workers,"self.queryFeatures",{filter:t,visible:i,geometry:o,tile_keys:u}),d=[],h={},p={};return c.forEach(e=>e.forEach(e=>{if(a){const t=a(e);if(h[t])return;h[t]=!0}if(l){const t=l(e.properties);p[t]=p[t]||[],p[t].push(e)}else d.push(e)})),l?p:d}rebuild({initial:t=!1,new_generation:n=!0,sources:r=null,serialize_funcs:i,profile:o=!1,fade_in:s=!1}={}){return new Promise((a,l)=>{if(this.building){this.building.queued&&this.building.queued.reject&&(e.log("debug","Scene.rebuild: request superceded by a newer call"),this.building.queued.resolve(!1));let u={initial:t,new_generation:n,sources:r,serialize_funcs:i,profile:o,fade_in:s};return this.building.queued={resolve:a,reject:l,options:u},void e.log("trace","Scene.rebuild(): queuing request")}if(this.building={resolve:a,reject:l,initial:t},o&&this.debug.profile("Scene.rebuild"),n){this.generation=++On.generation;for(let e in this.styles)this.styles[e].setGeneration(this.generation)}this.syncConfigToWorker({serialize_funcs:i}),this.resetWorkerFeatureSelection(r),this.resetTime(),this.tile_manager.pruneToVisibleTiles(),this.tile_manager.forEachTile(e=>{(!r||r.indexOf(e.source.name)>-1)&&this.tile_manager.buildTile(e,{fade_in:s})}),this.tile_manager.updateTilesForView(),this.tile_manager.checkBuildQueue()}).then(()=>{o&&this.debug.profileEnd("Scene.rebuild")})}tileManagerBuildDone(){if(e.TextCanvas.pruneTextCache(),this.building){e.log("info","Scene: build geometry finished"),this.building.resolve&&(this.logFirstBuild(),this.building.resolve(!0));var t=this.building.queued;this.building=null,t?(e.log("debug","Scene: starting queued rebuild() request"),this.rebuild(t.options).then(t.resolve,t.reject)):this.tile_manager.updateLabels()}}async loadScene(t=null,{base_path:n,file_type:r}={}){this.config_source=t||this.config_source,"string"==typeof this.config_source?this.base_path=e.pathForURL(n||this.config_source):this.base_path=e.pathForURL(n),this.config_path=this.base_path;const{config:i,bundle:o,texture_nodes:s}=await fn.loadScene(this.config_source,{path:this.base_path,type:r});return this.config=i,this.config_bundle=o,{texture_nodes:s}}setDataSource(t,n){if(!t||!n||!n.type||!n.url&&!n.data)return void e.log("error","No name provided or not a valid config:",t,n);let r=null==this.config.sources[t],i=this.config.sources[t]=Object.assign({},n);return i.data&&"object"==typeof i.data&&(i.url=e.createObjectURL(new Blob([JSON.stringify(i.data)],{type:"application/json"})),delete i.data),r?this.updateConfig({rebuild:{sources:[t]}}):this.rebuild({sources:[t]})}createDataSources(t=!1){const n=[],r=Object.keys(this.sources);let i=0;for(var o in this.config.sources){const r=this.config.sources[o],s=this.sources[o];try{const t=kn(kn({},r),{},{name:o,id:i++});if(this.sources[o]=e.DataSource.create(t,this.sources),!this.sources[o])throw{}}catch(t){delete this.sources[o];const n=`Could not create data source: ${t.message}`;e.log("warn",`Scene: ${n}`,r),this.trigger("warning",{type:"sources",source:r,message:n})}(t||e.DataSource.tileLayoutChanged(this.sources[o],s))&&n.push(o)}r.forEach(e=>{this.config.sources[e]||(delete this.sources[e],n.push(e))}),n.length>0&&this.tile_manager.removeTiles(e=>n.indexOf(e.source.name)>-1);for(let e in this.config.layers){let t=this.config.layers[e];!1!==t.enabled&&t.data&&this.sources[t.data.source]&&(this.sources[t.data.source].builds_geometry_tiles=!0)}}loadTextures(){return e.Texture.createFromObject(this.gl,this.config.textures).then(()=>e.Texture.createDefault(this.gl))}freePreviousTextures(){this.prev_textures&&(this.prev_textures.forEach(t=>{!this.config.textures[t]&&e.Texture.textures[t]&&e.Texture.textures[t].destroy()}),this.prev_textures=null)}updateStyles(){if(!this.initialized&&!this.initializing)throw new Error("Scene.updateStyles() called before scene was initialized");this.styles=this.style_manager.build(this.config.styles),this.style_manager.initStyles(this);for(let e in this.styles)this.styles[e].setGL(this.gl);this.dirty=!0}get animated(){return!1!==this.config.scene.animated&&this.style_manager.getActiveStyles().some(e=>this.styles[e].animated)}getActiveCamera(){return this.view.getActiveCamera()}setActiveCamera(e){return this.view.setActiveCamera(e)}createLights(){this.lights={},e.debugSettings.wireframe&&(e.Light.enabled=!1);for(let t in this.config.lights){if(!this.config.lights[t]||"object"!=typeof this.config.lights[t])continue;let n=this.config.lights[t];n.name=t.replace("-","_"),n.visible=!1!==n.visible,n.visible&&(this.lights[n.name]=e.Light.create(this.view,n))}e.Light.inject(this.lights)}setBackground(){const t=this.config.scene.background;this.background={},t&&t.color&&(this.background.color=e.StyleParser.createColorPropertyCache(t.color)),this.background.color||(this.background.color=e.StyleParser.createColorPropertyCache([0,0,0,0]))}updateBackground(){const t=this.background.computed_color,n=this.background.computed_color=e.StyleParser.evalCachedColorProperty(this.background.color,{zoom:this.view.tile_zoom});t&&!n.some((e,n)=>t[n]!==e)||(1===n[3]?this.canvas.style.backgroundColor=`rgba(${n.map(e=>Math.floor(255*e)).join(", ")})`:this.canvas.style.backgroundColor="transparent",this.gl.clearColor(...n))}setIntrospection(e){return e!==this.introspection?(this.introspection=null!=e&&e,this.updating++,this.updateConfig({normalize:!1}).then(()=>this.updating--)):Promise.resolve()}updateConfig({loading:t=!1,rebuild:n=!0,serialize_funcs:r,texture_nodes:i={},normalize:o=!0,fade_in:s=!1}={}){this.generation=++On.generation,this.updating++,this.config=fn.applyGlobalProperties(this.config),o&&fn.normalize(this.config,this.config_bundle,i),fn.hoistTextureNodes(this.config,this.config_bundle,i),this.trigger(t?"load":"update",{config:this.config}),this.style_manager.init(),this.view.reset(),this.createLights(),this.createDataSources(t),this.loadTextures(),this.setBackground(),e.FontManager.loadFonts(this.config.fonts),this.updateStyles();let a=n?this.rebuild(Object.assign({initial:t,new_generation:!1,serialize_funcs:r,fade_in:s},"object"==typeof n&&n)):this.syncConfigToWorker({serialize_funcs:r});return this.updating--,this.view.updateBounds(),this.requestRedraw(),a.then(()=>{this.last_render_count=0,this.requestRedraw()})}syncConfigToWorker({serialize_funcs:t=!0}={}){let n=t?e.Utils.serializeWithFunctions(this.config):JSON.stringify(this.config);return e.WorkerBroker.postMessage(this.workers,"self.updateConfig",{config:n,generation:this.generation,introspection:this.introspection},e.debugSettings)}createListeners(){this.listeners={},this.listeners.view={move:()=>this.trigger("move")},this.view.subscribe(this.listeners.view),this.listeners.texture={update:()=>this.dirty=!0,warning:e=>this.trigger("warning",Object.assign({type:"textures"},e))},e.Texture.subscribe(this.listeners.texture),this.listeners.scene_loader={error:e=>this.trigger("error",Object.assign({type:"scene"},e))},fn.subscribe(this.listeners.scene_loader)}destroyListeners(){this.unsubscribeAll(),this.view.unsubscribe(this.listeners.view),e.Texture.unsubscribe(this.listeners.texture),fn.unsubscribe(this.listeners.scene_loader),this.listeners=null}destroyFeatureSelection(){this.selection&&(this.selection.destroy(),this.selection=null)}resetFeatureSelection(){this.selection=new e.FeatureSelection(this.gl,this.workers,()=>this.building),this.last_render_count=0}resetWorkerFeatureSelection(t=null){this.workers&&e.WorkerBroker.postMessage(this.workers,"self.resetFeatureSelection",t)}getFeatureSelectionMapSize(){return null==this.fetching_selection_map&&(this.fetching_selection_map=e.WorkerBroker.postMessage(this.workers,"self.getFeatureSelectionMapSize").then(e=>(this.fetching_selection_map=null,e.reduce((e,t)=>e+t)))),this.fetching_selection_map}resetTime(){this.start_time=+new Date}updateViewComplete(){!this.render_count_changed&&this.generation===this.last_complete_generation||this.building||this.tile_manager.isLoadingVisibleTiles()||!this.tile_manager.allVisibleTilesLabeled()||(this.tile_manager.updateLabels(),this.last_complete_generation=this.generation,this.trigger("view_complete",{first:!0!==this.view_complete}),this.view_complete=!0)}resetViewComplete(){this.last_complete_generation=null}screenshot({background:e="white"}={}){return this.requestRedraw(),this.media_capture.screenshot({background:e})}startVideoCapture(){return this.requestRedraw(),this.media_capture.startVideoCapture()}stopVideoCapture(){return this.media_capture.stopVideoCapture()}logFirstFrame(){0!==this.last_render_count||this.times.first_frame||(this.times.first_frame=+new Date-this.start_time,e.log("debug",`Scene: initial frame time: ${this.times.first_frame}`))}logFirstBuild(){null==this.times.first_build&&(this.times.first_build=+new Date-this.start_time,e.log("debug",`Scene: initial build time: ${this.times.first_build}`))}}var An;On.id=0,On.generation=0;const Cn={map:{},scrollWheelZoom:{},doubleClickZoom:{}};var Rn={leafletLayer:function(t){return function(t){if(void 0!==An)return new An(t);if(e.Thread.is_main){let n,r=t.leaflet||window.L,i=r.GridLayer?r.GridLayer:r.TileLayer,o=i===r.GridLayer?"1.x":"0.7.x",s={};return i===r.TileLayer&&(s._addTile=function(){},s._removeTile=function(){},s._reset=function(){i.prototype._reset.apply(this,arguments),this.scene&&this.scene.container&&this.scene.canvas&&this.scene.container.appendChild(this.scene.canvas)}),Object.assign(s,{initialize(e){e.showDebug=!!e.showDebug,r.setOptions(this,e),this.updateTangramDebugSettings(),this.createScene(),this.hooks={},this._updating_tangram=!1},createScene(){this.scene=On.create(this.options.scene,{numWorkers:this.options.numWorkers,preUpdate:this.options.preUpdate,postUpdate:this.options.postUpdate,continuousZoom:"1.x"===An.leafletVersion,wrapView:!0!==this.options.noWrap,highDensityDisplay:this.options.highDensityDisplay,logLevel:this.options.logLevel,introspection:this.options.introspection,webGLContextOptions:this.options.webGLContextOptions,disableRenderLoop:this.options.disableRenderLoop})},onAdd(t){this.scene||this.createScene(),i.prototype.onAdd.apply(this,arguments),this.hooks.resize=()=>{this._updating_tangram=!0,this.updateSize(),this._updating_tangram=!1},t.on("resize",this.hooks.resize),this.hooks.move=()=>{if(!this._updating_tangram){this._updating_tangram=!0,this.scene.view.setPanning(!0);var n=t.getCenter();n.zoom=Math.max(Math.min(t.getZoom(),t.getMaxZoom()||e.Geo.default_view_max_zoom),t.getMinZoom()),this.scene.view.setView(n),this._mapLayerCount>1&&this.scene.immediateRedraw(),this._updating_tangram=!1}},t.on("move",this.hooks.move),this.hooks.moveend=()=>{this.scene.view.setPanning(!1),this.scene.requestRedraw()},t.on("moveend",this.hooks.moveend),this.hooks.drag=()=>{this.scene.view.markUserInput()},t.on("drag",this.hooks.drag),this._map_pane_observer=new MutationObserver(e=>{e.forEach(()=>this.reverseTransform())}),this._map_pane_observer.observe(t.getPanes().mapPane,{attributes:!0}),this.modifyScrollWheelBehavior(t),this.modifyZoomBehavior(t),this.trackMapLayerCounts(t),this.setupSelectionEventHandlers(t),this.setSelectionEvents(this.options.events,{radius:this.options.selectionRadius}),this.scene.container=this.getContainer(),this.updateSize(),this.updateView(),this.resizeOnFirstVisible(),this.scene.subscribe({move:this.onTangramViewUpdate.bind(this)}),this.scene.load(this.options.scene,{base_path:this.options.sceneBasePath,file_type:this.options.sceneFileType,blocking:!1}).then(()=>{if(!this.options.attribution)for(const[,e]of Object.entries(this.scene.config.sources))e.attribution&&t.attributionControl.addAttribution(e.attribution);this._updating_tangram=!0,this.updateSize(),this.updateView(),this.reverseTransform(),this._updating_tangram=!1,this.fire("init")}).catch(e=>{this.fire("error",e)})},onRemove(e){i.prototype.onRemove.apply(this,arguments),e.off("layeradd layerremove overlayadd overlayremove",this._updateMapLayerCount),e.off("resize",this.hooks.resize),e.off("move",this.hooks.move),e.off("moveend",this.hooks.moveend),e.off("drag",this.hooks.drag),e.off("click",this.hooks.click),e.off("mousemove",this.hooks.mousemove),e.off("mouseout",this.hooks.mouseout),document.removeEventListener("visibilitychange",this.hooks.visibilitychange),this.hooks={},this._map_pane_observer.disconnect(),this.scene&&(this.scene.destroy(),this.scene=null)},createTile(e){var t=e.x+"/"+e.y+"/"+e.z,n=document.createElement("div");if(n.setAttribute("data-tile-key",t),n.style.width="256px",n.style.height="256px",this.options.showDebug){var r=document.createElement("div");r.textContent=t,r.style.position="absolute",r.style.left=0,r.style.top=0,r.style.color="white",r.style.fontSize="16px",r.style.textOutline="1px #000000",r.style.padding="8px",n.appendChild(r),n.style.borderStyle="solid",n.style.borderColor="white",n.style.borderWidth="1px"}return n},modifyScrollWheelBehavior(e){if(this.scene.view.continuous_zoom&&e.scrollWheelZoom&&!1!==this.options.modifyScrollWheel){e.options.zoomSnap=0;const a=e.scrollWheelZoom.enabled();e.scrollWheelZoom.disable(),r.Browser.chrome||r.Browser.safari?e.scrollWheelZoom._onWheelScroll=function(e){var t=r.DomEvent.getWheelDelta(e);this._delta+=t,this._lastMousePos=this._map.mouseEventToContainerPoint(e),this._performZoom(),r.DomEvent.stop(e)}:e.options.wheelDebounceTime=20;const l=(i=function(e){e._moveEnd(!0),e.fire("viewreset")},o=2*e.options.wheelDebounceTime,function(){var e=this,t=arguments;clearTimeout(s),s=setTimeout(function(){s=null,i.apply(e,t)},o)});Cn.scrollWheelZoom._performZoom||(Cn.scrollWheelZoom._performZoom=e.scrollWheelZoom._performZoom);var t=this;e.scrollWheelZoom._performZoom=function(){if(this._map===t._map){var e=this._map,r=e.getZoom();e._stop();var i=this._delta/(4*this._map.options.wheelPxPerZoomLevel);this._delta=0,r+i>=this._map.getMaxZoom()?i=this._map.getMaxZoom()-r:r+i<=this._map.getMinZoom()&&(i=this._map.getMinZoom()-r),i&&("center"===e.options.scrollWheelZoom?n(t,e.getCenter(),r+i):n(t,this._lastMousePos,r+i),l(e))}else Cn.scrollWheelZoom._performZoom.call(this)},a&&e.scrollWheelZoom.enable()}var i,o,s},modifyZoomBehavior(e){if(this.scene.view.continuous_zoom&&!1!==this.options.modifyZoomBehavior){var t=this;const i=function(t,i,o){e._stop();var s=e._zoom;i=r.latLng(i),o=void 0===o?s:o,o=Math.min(o,e.getMaxZoom());var a=Date.now();return e._moveStart(!0),function l(){var u=(Date.now()-a)/75;u<=1?(e._flyToFrame=r.Util.requestAnimFrame(l,e),n(t,i,s+(o-s)*u)):n(t,i,o)._moveEnd(!0)}.call(e),e};if(e.doubleClickZoom){const n=e.doubleClickZoom.enabled();e.doubleClickZoom.disable(),Cn.doubleClickZoom._onDoubleClick||(Cn.doubleClickZoom._onDoubleClick=e.doubleClickZoom._onDoubleClick),e.doubleClickZoom._onDoubleClick=function(e){if(this._map===t._map){var n=this._map,r=n.getZoom(),o=n.options.zoomDelta,s=e.originalEvent.shiftKey?r-o:r+o;"center"===n.options.doubleClickZoom?i(t,n.getCenter(),s):i(t,n.containerPointToLatLng(e.containerPoint),s)}else Cn.doubleClickZoom._onDoubleClick.call(this,e)},n&&e.doubleClickZoom.enable()}e._zoomAnimated&&(Cn.map._animateZoom||(Cn.map._animateZoom=e._animateZoom),e._animateZoom=function(e,n,o,s){this===t._map?(o&&(this._animatingZoom=!0,this._animateToCenter=e,this._animateToZoom=n,i(t,e,n)),setTimeout(r.Util.bind(this._onZoomTransitionEnd,this),250)):Cn.map._animateZoom.call(this,e,n,o,s)})}},updateView(){var t=this._map.getCenter();t.zoom=Math.max(Math.min(this._map.getZoom(),this._map.getMaxZoom()||e.Geo.default_view_max_zoom),this._map.getMinZoom()),this.scene.view.setView(t)},updateSize(){var e=this._map.getSize();this.scene.resizeMap(e.x,e.y)},resizeOnFirstVisible(){let e=!0;this.hooks.visibilitychange=()=>{e&&(e=!1,this.updateSize())},document.addEventListener("visibilitychange",this.hooks.visibilitychange)},onTangramViewUpdate(){if(!this._map||this._updating_tangram)return;let e=this._map.getCenter(),t=this.scene.view.center;e.lng===t.lng&&e.lat===t.lat&&this._map.getZoom()===this.scene.view.zoom||(this._updating_tangram=!0,this._map.setView([this.scene.view.center.lat,this.scene.view.center.lng],this.scene.view.zoom,{animate:!1}),this._updating_tangram=!1)},render(){this.scene&&this.scene.update()},reverseTransform(){if(this._map&&this.scene&&this.scene.container){var e=this._map.containerPointToLayerPoint([0,0]);r.DomUtil.setPosition(this.scene.container,e)}},setupSelectionEventHandlers(e){this._selection_events={},this._selection_radius=null,this.hooks.click=e=>{"function"==typeof this._selection_events.click&&this.scene.getFeatureAt(e.containerPoint,{radius:this._selection_radius}).then(t=>{let n=Object.assign({},t,{leaflet_event:e});this._selection_events.click(n)})},e.on("click",this.hooks.click),this.hooks.mousemove=e=>{"function"==typeof this._selection_events.hover&&this.scene.getFeatureAt(e.containerPoint,{radius:this._selection_radius}).then(t=>{let n=Object.assign({},t,{leaflet_event:e});this._selection_events.hover(n)})},e.on("mousemove",this.hooks.mousemove),this.hooks.mouseout=e=>{"function"==typeof this._selection_events.hover&&this._selection_events.hover({changed:!0,leaflet_event:e})},e.on("mouseout",this.hooks.mouseout)},setSelectionEvents(e,{radius:t}={}){this._selection_events=Object.assign(this._selection_events,e),this._selection_radius=void 0!==t?t:this._selection_radius},trackMapLayerCounts(e){this._updateMapLayerCount=()=>{let t=e.getPanes().mapPane.childNodes;this._mapLayerCount=0;for(let e=0;e<t.length;e++)this._mapLayerCount+=t[e].childNodes.length},e.on("layeradd layerremove overlayadd overlayremove",this._updateMapLayerCount),this._updateMapLayerCount()},updateTangramDebugSettings(){e.mergeDebugSettings(this.options.debug||{})}}),n=function(e,t,n){var i=e._map,o=e.scene,s=i.getZoomScale(n),a=i.getSize().divideBy(2),l=(t instanceof r.Point?t:i.latLngToContainerPoint(t)).subtract(a).multiplyBy(1-1/s),u=i.containerPointToLatLng(a.add(l));return o&&o.view.markUserInput(),i._move(u,n,{flyTo:!0})},"function"!=typeof(An=i.extend(s)).remove&&(An.prototype.remove=function(){this._map&&this._map.removeLayer(this),this.fire("remove")}),An.layerBaseClass=i,An.leafletVersion=o,new An(t)}}(t)},debug:{log:e.log,yaml:cn,Utils:e.Utils,Geo:e.Geo,Vector:e.Vector,DataSource:e.DataSource,GLSL:e.GLSL,ShaderProgram:e.ShaderProgram,VertexData:e.VertexData,Texture:e.Texture,Material:e.Material,Light:e.Light,Scene:On,WorkerBroker:e.WorkerBroker,Task:e.Task,StyleManager:e.StyleManager,StyleParser:e.StyleParser,TileID:e.TileID,Collision:e.Collision,FeatureSelection:e.FeatureSelection,TextCanvas:e.TextCanvas,debugSettings:e.debugSettings},version:e.version};return Rn});try{sM.debug.ESM=!0,sM.debug.SHA="d0b887d09a3645aad91a18bd3bd0362d74627da3","object"==typeof window&&(window.Tangram=sM)}catch(KC){}var lM=Object.freeze({__proto__:null});export{zT as API_METHODS,RT as ApiService,oM as AuthPage,ST as AuthStore,Qb as Button,Ck as Card,k_ as Checkbox,TT as DartcomAuthProvider,AT as DartcomMobxProvider,NN as DartcomProviders,of as DeleteButton,Qw as DragList,af as EditButton,O_ as Form,PT as GlobalConfig,N_ as Input,Ak as LeafletLayer,tf as List,Rk as Loader,GC as LocalizationProvider,ef as NoData,FT as PanelsNames,wO as QueryProvider,R_ as Select,OT as StoreContext,BT as TangramSourceNames,$T as _backendUrl,MT as _testApiKeys,ZT as catIds,NT as createApiService,DN as encodeString,pk as getAdminAreaLayers,kk as getAllLayers,Tk as getAllPointLayers,Ek as getAllPolygonLayers,Sk as getAllPolylineLayers,dk as getBuildingLayers,YT as getBuiltupAreaLayers,nk as getCityPOILayers,ok as getConditionLayers,JT as getDefaultPOI,hk as getFacilityAreaLayers,ck as getLanduseAreaLayers,GT as getLaneMarkingLineLayers,qT as getLaneMarkingPolyLayers,xk as getLayerName,vk as getLinkLayers,fk as getNatureFieldLayers,_k as getNatureForestLayers,uk as getOceanAreaLayers,rk as getOneWayLayers,tk as getPOILayers,QT as getPOITypeLayer,HT as getParkingLineLayers,KT as getPointAddressLayers,sk as getRailroadLayers,WT as getRoadPolyLayers,ak as getWaterAreaLayers,lk as getWaterLinkLayers,xO as queryClient,kT as rootStore,wk as setLayerOrder,UT as sourceUrl,XT as text_source,VT as tile_size,A_ as useFormContext,Ok as useGetLeafletLayer,zN as useLogout,CT as useRootStore,MN as useShowErrorSnackbar,PN as useShowSnackbar,IN as useSignIn};
|
|
149
149
|
//# sourceMappingURL=index.esm.js.map
|