@nyaruka/temba-components 0.124.3 → 0.126.0
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/.eslintrc.js +3 -1
- package/CHANGELOG.md +23 -0
- package/demo/data/flows/sample-flow.json +926 -0
- package/demo/data/server/sample-flow.json +0 -0
- package/demo/flow/example.html +46 -0
- package/demo/index.html +155 -144
- package/demo/webchat/example.html +71 -0
- package/dist/temba-components.js +89 -41
- package/dist/temba-components.js.map +1 -1
- package/out-tsc/src/chart/TembaChart.js +118 -48
- package/out-tsc/src/chart/TembaChart.js.map +1 -1
- package/out-tsc/src/flow/Editor.js +70 -5
- package/out-tsc/src/flow/Editor.js.map +1 -1
- package/out-tsc/src/flow/EditorNode.js +140 -4
- package/out-tsc/src/flow/EditorNode.js.map +1 -1
- package/out-tsc/src/flow/Plumber.js +57 -0
- package/out-tsc/src/flow/Plumber.js.map +1 -1
- package/out-tsc/src/flow/config.js +70 -20
- package/out-tsc/src/flow/config.js.map +1 -1
- package/out-tsc/src/formfield/FormField.js +4 -1
- package/out-tsc/src/formfield/FormField.js.map +1 -1
- package/out-tsc/src/interfaces.js +1 -0
- package/out-tsc/src/interfaces.js.map +1 -1
- package/out-tsc/src/store/AppState.js +22 -5
- package/out-tsc/src/store/AppState.js.map +1 -1
- package/out-tsc/src/utils/index.js +3 -0
- package/out-tsc/src/utils/index.js.map +1 -1
- package/out-tsc/src/webchat/WebChat.js +2 -0
- package/out-tsc/src/webchat/WebChat.js.map +1 -1
- package/out-tsc/test/temba-chart.test.js +29 -15
- package/out-tsc/test/temba-chart.test.js.map +1 -1
- package/out-tsc/test/temba-flow-node-drag.test.js +257 -0
- package/out-tsc/test/temba-flow-node-drag.test.js.map +1 -0
- package/out-tsc/test/temba-formfield.test.js +94 -0
- package/out-tsc/test/temba-formfield.test.js.map +1 -0
- package/out-tsc/test/temba-integration-markdown.test.js +36 -0
- package/out-tsc/test/temba-integration-markdown.test.js.map +1 -0
- package/out-tsc/test/temba-select.test.js +14 -1
- package/out-tsc/test/temba-select.test.js.map +1 -1
- package/package.json +2 -1
- package/screenshots/truth/formfield/markdown-errors.png +0 -0
- package/screenshots/truth/formfield/no-errors.png +0 -0
- package/screenshots/truth/formfield/plain-text-errors.png +0 -0
- package/screenshots/truth/formfield/widget-only-markdown-errors.png +0 -0
- package/screenshots/truth/integration/checkbox-markdown-errors.png +0 -0
- package/src/chart/TembaChart.ts +130 -48
- package/src/flow/Editor.ts +78 -6
- package/src/flow/EditorNode.ts +164 -4
- package/src/flow/Plumber.ts +65 -0
- package/src/flow/config.ts +71 -20
- package/src/formfield/FormField.ts +4 -1
- package/src/interfaces.ts +2 -1
- package/src/store/AppState.ts +28 -7
- package/src/utils/index.ts +3 -0
- package/src/webchat/WebChat.ts +2 -0
- package/test/temba-chart.test.ts +35 -15
- package/test/temba-flow-node-drag.test.ts +337 -0
- package/test/temba-formfield.test.ts +121 -0
- package/test/temba-integration-markdown.test.ts +45 -0
- package/test/temba-select.test.ts +17 -0
- package/web-dev-server.config.mjs +43 -0
package/dist/temba-components.js
CHANGED
|
@@ -293,7 +293,7 @@ const xe=t=>t??G
|
|
|
293
293
|
<slot></slot>
|
|
294
294
|
</div>
|
|
295
295
|
</temba-field>
|
|
296
|
-
`}}t([ue({type:Boolean})],Ie.prototype,"textarea",void 0),t([ue({type:String})],Ie.prototype,"placeholder",void 0),t([ue({type:Boolean})],Ie.prototype,"password",void 0),t([ue({type:Number})],Ie.prototype,"maxlength",void 0),t([ue({type:Object})],Ie.prototype,"inputElement",void 0),t([ue({type:Boolean})],Ie.prototype,"clearable",void 0),t([ue({type:Boolean})],Ie.prototype,"gsm",void 0),t([ue({type:String})],Ie.prototype,"counter",void 0),t([ue({type:Boolean})],Ie.prototype,"loading",void 0),t([ue({type:Boolean})],Ie.prototype,"submitOnEnter",void 0),t([ue()],Ie.prototype,"onBlur",void 0),t([ue({type:Boolean})],Ie.prototype,"autogrow",void 0),t([ue({type:String})],Ie.prototype,"type",void 0),function(t){t.DayFirst="day_first",t.MonthFirst="month_first",t.YearFirst="year_first"}(Te||(Te={})),function(t){t.CampaignEvent="campaign_event",t.ScheduledBroadcast="scheduled_broadcast",t.ScheduledTrigger="scheduled_trigger"}(Pe||(Pe={})),function(t){t.Open="open",t.Closed="closed"}(Oe||(Oe={})),function(t){t.Loaded="temba-loaded",t.Loading="temba-loading",t.Canceled="temba-canceled",t.CursorChanged="temba-cursor-changed",t.Refreshed="temba-refreshed",t.Selection="temba-selection",t.ButtonClicked="temba-button-clicked",t.DialogHidden="temba-dialog-hidden",t.ScrollThreshold="temba-scroll-threshold",t.ContentChanged="temba-content-changed",t.ContextChanged="temba-context-changed",t.FetchComplete="temba-fetch-complete",t.MessageSent="temba-message-sent",t.Submitted="temba-submitted",t.Redirected="temba-redirected",t.NoPath="temba-no-path",t.StoreUpdated="temba-store-updated",t.Ready="temba-ready",t.OrderChanged="temba-order-changed",t.DragStart="temba-drag-start",t.DragStop="temba-drag-stop",t.Resized="temba-resized",t.DetailsChanged="temba-details-changed",t.Error="temba-error",t.Interrupt="temba-interrupt",t.Opened="temba-opened",t.TicketUpdated="temba-ticket-updated"}(De||(De={}));
|
|
296
|
+
`}}t([ue({type:Boolean})],Ie.prototype,"textarea",void 0),t([ue({type:String})],Ie.prototype,"placeholder",void 0),t([ue({type:Boolean})],Ie.prototype,"password",void 0),t([ue({type:Number})],Ie.prototype,"maxlength",void 0),t([ue({type:Object})],Ie.prototype,"inputElement",void 0),t([ue({type:Boolean})],Ie.prototype,"clearable",void 0),t([ue({type:Boolean})],Ie.prototype,"gsm",void 0),t([ue({type:String})],Ie.prototype,"counter",void 0),t([ue({type:Boolean})],Ie.prototype,"loading",void 0),t([ue({type:Boolean})],Ie.prototype,"submitOnEnter",void 0),t([ue()],Ie.prototype,"onBlur",void 0),t([ue({type:Boolean})],Ie.prototype,"autogrow",void 0),t([ue({type:String})],Ie.prototype,"type",void 0),function(t){t.DayFirst="day_first",t.MonthFirst="month_first",t.YearFirst="year_first"}(Te||(Te={})),function(t){t.CampaignEvent="campaign_event",t.ScheduledBroadcast="scheduled_broadcast",t.ScheduledTrigger="scheduled_trigger"}(Pe||(Pe={})),function(t){t.Open="open",t.Closed="closed"}(Oe||(Oe={})),function(t){t.Loaded="temba-loaded",t.Loading="temba-loading",t.Canceled="temba-canceled",t.CursorChanged="temba-cursor-changed",t.Refreshed="temba-refreshed",t.Selection="temba-selection",t.ButtonClicked="temba-button-clicked",t.DialogHidden="temba-dialog-hidden",t.ScrollThreshold="temba-scroll-threshold",t.ContentChanged="temba-content-changed",t.ContextChanged="temba-context-changed",t.FetchComplete="temba-fetch-complete",t.MessageSent="temba-message-sent",t.Submitted="temba-submitted",t.Redirected="temba-redirected",t.NoPath="temba-no-path",t.StoreUpdated="temba-store-updated",t.Ready="temba-ready",t.OrderChanged="temba-order-changed",t.DragStart="temba-drag-start",t.DragStop="temba-drag-stop",t.Resized="temba-resized",t.DetailsChanged="temba-details-changed",t.Error="temba-error",t.Interrupt="temba-interrupt",t.Opened="temba-opened",t.TicketUpdated="temba-ticket-updated",t.Moved="temba-moved"}(De||(De={}));
|
|
297
297
|
/**
|
|
298
298
|
* tiny-lru
|
|
299
299
|
*
|
|
@@ -391,7 +391,7 @@ let br=Qs,xr=!1;const _r=["es","fr","pt"],wr="data:image/png;base64,iVBORw0KGgoA
|
|
|
391
391
|
-webkit-box-orient: vertical;
|
|
392
392
|
overflow: hidden;
|
|
393
393
|
}
|
|
394
|
-
`,t([ue({type:Number})],Sr.prototype,"scale",void 0),t([ue({type:Boolean})],Sr.prototype,"showName",void 0),t([ue({type:Boolean})],Sr.prototype,"system",void 0),t([ue({type:String,attribute:!1})],Sr.prototype,"bgimage",void 0),t([ue({type:String,attribute:!1})],Sr.prototype,"bgcolor",void 0),t([ue({type:String,attribute:!1})],Sr.prototype,"initials",void 0),t([ue({type:String})],Sr.prototype,"name",void 0),t([ue({type:String})],Sr.prototype,"email",void 0),t([ue({type:String})],Sr.prototype,"avatar",void 0);const Cr=t=>{let e;const i=new Set,n=(t,n)=>{const o="function"==typeof t?t(e):t;if(!Object.is(o,e)){const t=e;e=(null!=n?n:"object"!=typeof o||null===o)?o:Object.assign({},e,o),i.forEach((i=>i(e,t)))}},o=()=>e,s={setState:n,getState:o,getInitialState:()=>r,subscribe:t=>(i.add(t),()=>i.delete(t))},r=e=t(n,o,s);return s};var Er=Symbol.for("immer-nothing"),Ar=Symbol.for("immer-draftable"),Mr=Symbol.for("immer-state"),Tr=[function(t){return`The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`},function(t){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${t}'`},"This object has been frozen and should not be mutated",function(t){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+t},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(t){return`'current' expects a draft, got: ${t}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(t){return`'original' expects a draft, got: ${t}`}];function Pr(t,...e){{const i=Tr[t],n="function"==typeof i?i.apply(null,e):i;throw new Error(`[Immer] ${n}`)}}var Or=Object.getPrototypeOf;function Dr(t){return!!t&&!!t[Mr]}function Ir(t){return!!t&&($r(t)||Array.isArray(t)||!!t[Ar]||!!t.constructor?.[Ar]||jr(t)||Fr(t))}var Lr=Object.prototype.constructor.toString();function $r(t){if(!t||"object"!=typeof t)return!1;const e=Or(t);if(null===e)return!0;const i=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return i===Object||"function"==typeof i&&Function.toString.call(i)===Lr}function zr(t,e){0===Rr(t)?Reflect.ownKeys(t).forEach((i=>{e(i,t[i],t)})):t.forEach(((i,n)=>e(n,i,t)))}function Rr(t){const e=t[Mr];return e?e.type_:Array.isArray(t)?1:jr(t)?2:Fr(t)?3:0}function Nr(t,e){return 2===Rr(t)?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function Br(t,e,i){const n=Rr(t);2===n?t.set(e,i):3===n?t.add(i):t[e]=i}function jr(t){return t instanceof Map}function Fr(t){return t instanceof Set}function qr(t){return t.copy_||t.base_}function Vr(t,e){if(jr(t))return new Map(t);if(Fr(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const i=$r(t);if(!0===e||"class_only"===e&&!i){const e=Object.getOwnPropertyDescriptors(t);delete e[Mr];let i=Reflect.ownKeys(e);for(let n=0;n<i.length;n++){const o=i[n],s=e[o];!1===s.writable&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(e[o]={configurable:!0,writable:!0,enumerable:s.enumerable,value:t[o]})}return Object.create(Or(t),e)}{const e=Or(t);if(null!==e&&i)return{...t};const n=Object.create(e);return Object.assign(n,t)}}function Hr(t,e=!1){return Wr(t)||Dr(t)||!Ir(t)||(Rr(t)>1&&(t.set=t.add=t.clear=t.delete=Ur),Object.freeze(t),e&&Object.entries(t).forEach((([t,e])=>Hr(e,!0)))),t}function Ur(){Pr(2)}function Wr(t){return Object.isFrozen(t)}var Gr,Zr={};function Yr(t){const e=Zr[t];return e||Pr(0,t),e}function Xr(){return Gr}function Kr(t,e){e&&(Yr("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function Qr(t){Jr(t),t.drafts_.forEach(ea),t.drafts_=null}function Jr(t){t===Gr&&(Gr=t.parent_)}function ta(t){return Gr={drafts_:[],parent_:Gr,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function ea(t){const e=t[Mr];0===e.type_||1===e.type_?e.revoke_():e.revoked_=!0}function ia(t,e){e.unfinalizedDrafts_=e.drafts_.length;const i=e.drafts_[0];return void 0!==t&&t!==i?(i[Mr].modified_&&(Qr(e),Pr(4)),Ir(t)&&(t=na(e,t),e.parent_||sa(e,t)),e.patches_&&Yr("Patches").generateReplacementPatches_(i[Mr].base_,t,e.patches_,e.inversePatches_)):t=na(e,i,[]),Qr(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==Er?t:void 0}function na(t,e,i){if(Wr(e))return e;const n=e[Mr];if(!n)return zr(e,((o,s)=>oa(t,n,e,o,s,i))),e;if(n.scope_!==t)return e;if(!n.modified_)return sa(t,n.base_,!0),n.base_;if(!n.finalized_){n.finalized_=!0,n.scope_.unfinalizedDrafts_--;const e=n.copy_;let o=e,s=!1;3===n.type_&&(o=new Set(e),e.clear(),s=!0),zr(o,((o,r)=>oa(t,n,e,o,r,i,s))),sa(t,e,!1),i&&t.patches_&&Yr("Patches").generatePatches_(n,i,t.patches_,t.inversePatches_)}return n.copy_}function oa(t,e,i,n,o,s,r){if(o===i&&Pr(5),Dr(o)){const r=na(t,o,s&&e&&3!==e.type_&&!Nr(e.assigned_,n)?s.concat(n):void 0);if(Br(i,n,r),!Dr(r))return;t.canAutoFreeze_=!1}else r&&i.add(o);if(Ir(o)&&!Wr(o)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;na(t,o),e&&e.scope_.parent_||"symbol"==typeof n||!Object.prototype.propertyIsEnumerable.call(i,n)||sa(t,o)}}function sa(t,e,i=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&Hr(e,i)}var ra={get(t,e){if(e===Mr)return t;const i=qr(t);if(!Nr(i,e))return function(t,e,i){const n=ca(e,i);return n?"value"in n?n.value:n.get?.call(t.draft_):void 0}(t,i,e);const n=i[e];return t.finalized_||!Ir(n)?n:n===la(t.base_,e)?(da(t),t.copy_[e]=ua(n,t)):n},has:(t,e)=>e in qr(t),ownKeys:t=>Reflect.ownKeys(qr(t)),set(t,e,i){const n=ca(qr(t),e);if(n?.set)return n.set.call(t.draft_,i),!0;if(!t.modified_){const n=la(qr(t),e),o=n?.[Mr];if(o&&o.base_===i)return t.copy_[e]=i,t.assigned_[e]=!1,!0;if(function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}(i,n)&&(void 0!==i||Nr(t.base_,e)))return!0;da(t),ha(t)}return t.copy_[e]===i&&(void 0!==i||e in t.copy_)||Number.isNaN(i)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=i,t.assigned_[e]=!0),!0},deleteProperty:(t,e)=>(void 0!==la(t.base_,e)||e in t.base_?(t.assigned_[e]=!1,da(t),ha(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0),getOwnPropertyDescriptor(t,e){const i=qr(t),n=Reflect.getOwnPropertyDescriptor(i,e);return n?{writable:!0,configurable:1!==t.type_||"length"!==e,enumerable:n.enumerable,value:i[e]}:n},defineProperty(){Pr(11)},getPrototypeOf:t=>Or(t.base_),setPrototypeOf(){Pr(12)}},aa={};function la(t,e){const i=t[Mr];return(i?qr(i):t)[e]}function ca(t,e){if(!(e in t))return;let i=Or(t);for(;i;){const t=Object.getOwnPropertyDescriptor(i,e);if(t)return t;i=Or(i)}}function ha(t){t.modified_||(t.modified_=!0,t.parent_&&ha(t.parent_))}function da(t){t.copy_||(t.copy_=Vr(t.base_,t.scope_.immer_.useStrictShallowCopy_))}zr(ra,((t,e)=>{aa[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}})),aa.deleteProperty=function(t,e){return isNaN(parseInt(e))&&Pr(13),aa.set.call(this,t,e,void 0)},aa.set=function(t,e,i){return"length"!==e&&isNaN(parseInt(e))&&Pr(14),ra.set.call(this,t[0],e,i,t[0])};function ua(t,e){const i=jr(t)?Yr("MapSet").proxyMap_(t,e):Fr(t)?Yr("MapSet").proxySet_(t,e):function(t,e){const i=Array.isArray(t),n={type_:i?1:0,scope_:e?e.scope_:Xr(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=n,s=ra;i&&(o=[n],s=aa);const{revoke:r,proxy:a}=Proxy.revocable(o,s);return n.draft_=a,n.revoke_=r,a}(t,e);return(e?e.scope_:Xr()).drafts_.push(i),i}function pa(t){if(!Ir(t)||Wr(t))return t;const e=t[Mr];let i;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,i=Vr(t,e.scope_.immer_.useStrictShallowCopy_)}else i=Vr(t,!0);return zr(i,((t,e)=>{Br(i,t,pa(e))})),e&&(e.finalized_=!1),i}var fa=new class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,e,i)=>{if("function"==typeof t&&"function"!=typeof e){const i=e;e=t;const n=this;return function(t=i,...o){return n.produce(t,(t=>e.call(this,t,...o)))}}let n;if("function"!=typeof e&&Pr(6),void 0!==i&&"function"!=typeof i&&Pr(7),Ir(t)){const o=ta(this),s=ua(t,void 0);let r=!0;try{n=e(s),r=!1}finally{r?Qr(o):Jr(o)}return Kr(o,i),ia(n,o)}if(!t||"object"!=typeof t){if(n=e(t),void 0===n&&(n=t),n===Er&&(n=void 0),this.autoFreeze_&&Hr(n,!0),i){const e=[],o=[];Yr("Patches").generateReplacementPatches_(t,n,e,o),i(e,o)}return n}Pr(1,t)},this.produceWithPatches=(t,e)=>{if("function"==typeof t)return(e,...i)=>this.produceWithPatches(e,(e=>t(e,...i)));let i,n;const o=this.produce(t,e,((t,e)=>{i=t,n=e}));return[o,i,n]},"boolean"==typeof t?.autoFreeze&&this.setAutoFreeze(t.autoFreeze),"boolean"==typeof t?.useStrictShallowCopy&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){Ir(t)||Pr(8),Dr(t)&&(t=function(t){Dr(t)||Pr(10,t);return pa(t)}(t));const e=ta(this),i=ua(t,void 0);return i[Mr].isManual_=!0,Jr(e),i}finishDraft(t,e){const i=t&&t[Mr];i&&i.isManual_||Pr(9);const{scope_:n}=i;return Kr(n,e),ia(void 0,n)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,e){let i;for(i=e.length-1;i>=0;i--){const n=e[i];if(0===n.path.length&&"replace"===n.op){t=n.value;break}}i>-1&&(e=e.slice(i+1));const n=Yr("Patches").applyPatches_;return Dr(t)?n(t,e):this.produce(t,(t=>n(t,e)))}},ma=fa.produce;fa.produceWithPatches.bind(fa),fa.setAutoFreeze.bind(fa),fa.setUseStrictShallowCopy.bind(fa),fa.applyPatches.bind(fa),fa.createDraft.bind(fa),fa.finishDraft.bind(fa);const ga=t=>(e,i,n)=>(n.setState=(t,i,...n)=>{const o="function"==typeof t?ma(t):t;return e(o,i,...n)},t(n.setState,i,n)),va=t=>(e,i,n)=>{const o=n.subscribe;n.subscribe=(t,e,i)=>{let s=t;if(e){const o=(null==i?void 0:i.equalityFn)||Object.is;let r=t(n.getState());s=i=>{const n=t(i);if(!o(r,n)){const t=r;e(r=n,t)}},(null==i?void 0:i.fireImmediately)&&e(r,r)}return o(s)};return t(e,i,n)},ya=Cr(va(ga(((t,e)=>({languageNames:{},canvasSize:{width:0,height:0},languageCode:"",workspace:null,flowDefinition:null,flowInfo:null,isTranslating:!1,fetchRevision:async(e,i=null)=>{i||(i="latest");const n=await fetch(`${e}/${i}/?version=14.3`);if(!n.ok)throw new Error("Network response was not ok");const o=await n.json();t({flowInfo:o.info,flowDefinition:o.definition})},fetchWorkspace:async e=>{const i=await fetch(e);if(!i.ok)throw new Error("Network response was not ok");const n=await i.json();t({workspace:n})},fetchAllLanguages:async e=>{const i=(await Zt(e)).reduce((function(t,e){return t[e.value]=e.name,t}),{});t({languageNames:i})},getFlowResults:()=>e().flowInfo.results,getResultByKey:t=>e().flowInfo.results.find((e=>e.key===t)),getLanguage:()=>{const t=e(),i=t.languageCode;return{name:t.languageNames[i],code:i}},setFlowContents:e=>{t((t=>{const i=e.definition.language;t.flowDefinition=e.definition,t.flowInfo=e.info,t.languageCode=i,t.isTranslating=!1}))},setFlowInfo:e=>{t((t=>{t.flowInfo=e}))},setLanguageCode:e=>{t((t=>{t.languageCode=e,t.isTranslating=t.flowDefinition.language!==e}))},setTestUpdate:()=>{t((t=>{t.flowDefinition.name="Bloop!"}))},expandCanvas:(e,i)=>{t((t=>{const n=Math.max(t.canvasSize.width,e+800),o=Math.max(t.canvasSize.height,i+800);t.canvasSize.width=n,t.canvasSize.height=o}))},updateCanvasPositions:e=>{t((t=>{for(const i in e)t.flowDefinition._ui.nodes[i]&&(t.flowDefinition._ui.nodes[i].position=e[i])}))},removeNodes:e=>{t((t=>{for(const i of e)delete t.flowDefinition._ui.nodes[i];t.flowDefinition.nodes=t.flowDefinition.nodes.filter((t=>!e.includes(t.uuid)))}))}})))));function ba(t,e){return(i,n)=>{ue()(i,n);const o="connectedCallback",s="disconnectedCallback",r=i[o],a=i[s];i[o]=function(){var i;null!==(i=this._zustandUnsubscribe)&&void 0!==i||(this._zustandUnsubscribe={}),this[n]=e(t.getState()),this._zustandUnsubscribe[n]=t.subscribe(e,(t=>{this[n]=t})),r&&r.call(this)},i[s]=function(){var t,e;null===(e=null===(t=this._zustandUnsubscribe)||void 0===t?void 0:t[n])||void 0===e||e.call(t),a&&a.call(this)}}}const{setLocale:xa}=(t=>(function(t){if(xr)throw new Error("lit-localize can only be configured once");br=t,xr=!0}(((t,e)=>ar(pr,t,e))),fr=hr=t.sourceLocale,dr=new Set(t.targetLocales),dr.add(t.sourceLocale),ur=t.loadLocale,{getLocale:vr,setLocale:yr}))({sourceLocale:"en",targetLocales:_r,loadLocale:t=>import(`./locales/${t}.js`)}),_a=()=>document.querySelector("temba-store");class wa extends ge{constructor(){super(...arguments),this.settings={},this.ttl=6e4,this.max=20,this.ready=!1,this.loader=!1,this.keyedAssets={},this.locale=[...navigator.languages],this.fields={},this.groups={},this.shortcuts=[],this.languages={},this.featuredFields=[],this.dirtyElements=[],this.pendingResolves={},this.fetching={}}static get styles(){return a`
|
|
394
|
+
`,t([ue({type:Number})],Sr.prototype,"scale",void 0),t([ue({type:Boolean})],Sr.prototype,"showName",void 0),t([ue({type:Boolean})],Sr.prototype,"system",void 0),t([ue({type:String,attribute:!1})],Sr.prototype,"bgimage",void 0),t([ue({type:String,attribute:!1})],Sr.prototype,"bgcolor",void 0),t([ue({type:String,attribute:!1})],Sr.prototype,"initials",void 0),t([ue({type:String})],Sr.prototype,"name",void 0),t([ue({type:String})],Sr.prototype,"email",void 0),t([ue({type:String})],Sr.prototype,"avatar",void 0);const Cr=t=>{let e;const i=new Set,n=(t,n)=>{const o="function"==typeof t?t(e):t;if(!Object.is(o,e)){const t=e;e=(null!=n?n:"object"!=typeof o||null===o)?o:Object.assign({},e,o),i.forEach((i=>i(e,t)))}},o=()=>e,s={setState:n,getState:o,getInitialState:()=>r,subscribe:t=>(i.add(t),()=>i.delete(t))},r=e=t(n,o,s);return s};var Er=Symbol.for("immer-nothing"),Ar=Symbol.for("immer-draftable"),Mr=Symbol.for("immer-state"),Tr=[function(t){return`The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`},function(t){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${t}'`},"This object has been frozen and should not be mutated",function(t){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+t},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(t){return`'current' expects a draft, got: ${t}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(t){return`'original' expects a draft, got: ${t}`}];function Pr(t,...e){{const i=Tr[t],n="function"==typeof i?i.apply(null,e):i;throw new Error(`[Immer] ${n}`)}}var Or=Object.getPrototypeOf;function Dr(t){return!!t&&!!t[Mr]}function Ir(t){return!!t&&($r(t)||Array.isArray(t)||!!t[Ar]||!!t.constructor?.[Ar]||jr(t)||Fr(t))}var Lr=Object.prototype.constructor.toString();function $r(t){if(!t||"object"!=typeof t)return!1;const e=Or(t);if(null===e)return!0;const i=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return i===Object||"function"==typeof i&&Function.toString.call(i)===Lr}function zr(t,e){0===Rr(t)?Reflect.ownKeys(t).forEach((i=>{e(i,t[i],t)})):t.forEach(((i,n)=>e(n,i,t)))}function Rr(t){const e=t[Mr];return e?e.type_:Array.isArray(t)?1:jr(t)?2:Fr(t)?3:0}function Nr(t,e){return 2===Rr(t)?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function Br(t,e,i){const n=Rr(t);2===n?t.set(e,i):3===n?t.add(i):t[e]=i}function jr(t){return t instanceof Map}function Fr(t){return t instanceof Set}function qr(t){return t.copy_||t.base_}function Vr(t,e){if(jr(t))return new Map(t);if(Fr(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const i=$r(t);if(!0===e||"class_only"===e&&!i){const e=Object.getOwnPropertyDescriptors(t);delete e[Mr];let i=Reflect.ownKeys(e);for(let n=0;n<i.length;n++){const o=i[n],s=e[o];!1===s.writable&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(e[o]={configurable:!0,writable:!0,enumerable:s.enumerable,value:t[o]})}return Object.create(Or(t),e)}{const e=Or(t);if(null!==e&&i)return{...t};const n=Object.create(e);return Object.assign(n,t)}}function Hr(t,e=!1){return Wr(t)||Dr(t)||!Ir(t)||(Rr(t)>1&&(t.set=t.add=t.clear=t.delete=Ur),Object.freeze(t),e&&Object.entries(t).forEach((([t,e])=>Hr(e,!0)))),t}function Ur(){Pr(2)}function Wr(t){return Object.isFrozen(t)}var Gr,Zr={};function Yr(t){const e=Zr[t];return e||Pr(0,t),e}function Xr(){return Gr}function Kr(t,e){e&&(Yr("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function Qr(t){Jr(t),t.drafts_.forEach(ea),t.drafts_=null}function Jr(t){t===Gr&&(Gr=t.parent_)}function ta(t){return Gr={drafts_:[],parent_:Gr,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function ea(t){const e=t[Mr];0===e.type_||1===e.type_?e.revoke_():e.revoked_=!0}function ia(t,e){e.unfinalizedDrafts_=e.drafts_.length;const i=e.drafts_[0];return void 0!==t&&t!==i?(i[Mr].modified_&&(Qr(e),Pr(4)),Ir(t)&&(t=na(e,t),e.parent_||sa(e,t)),e.patches_&&Yr("Patches").generateReplacementPatches_(i[Mr].base_,t,e.patches_,e.inversePatches_)):t=na(e,i,[]),Qr(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==Er?t:void 0}function na(t,e,i){if(Wr(e))return e;const n=e[Mr];if(!n)return zr(e,((o,s)=>oa(t,n,e,o,s,i))),e;if(n.scope_!==t)return e;if(!n.modified_)return sa(t,n.base_,!0),n.base_;if(!n.finalized_){n.finalized_=!0,n.scope_.unfinalizedDrafts_--;const e=n.copy_;let o=e,s=!1;3===n.type_&&(o=new Set(e),e.clear(),s=!0),zr(o,((o,r)=>oa(t,n,e,o,r,i,s))),sa(t,e,!1),i&&t.patches_&&Yr("Patches").generatePatches_(n,i,t.patches_,t.inversePatches_)}return n.copy_}function oa(t,e,i,n,o,s,r){if(o===i&&Pr(5),Dr(o)){const r=na(t,o,s&&e&&3!==e.type_&&!Nr(e.assigned_,n)?s.concat(n):void 0);if(Br(i,n,r),!Dr(r))return;t.canAutoFreeze_=!1}else r&&i.add(o);if(Ir(o)&&!Wr(o)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;na(t,o),e&&e.scope_.parent_||"symbol"==typeof n||!Object.prototype.propertyIsEnumerable.call(i,n)||sa(t,o)}}function sa(t,e,i=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&Hr(e,i)}var ra={get(t,e){if(e===Mr)return t;const i=qr(t);if(!Nr(i,e))return function(t,e,i){const n=ca(e,i);return n?"value"in n?n.value:n.get?.call(t.draft_):void 0}(t,i,e);const n=i[e];return t.finalized_||!Ir(n)?n:n===la(t.base_,e)?(da(t),t.copy_[e]=ua(n,t)):n},has:(t,e)=>e in qr(t),ownKeys:t=>Reflect.ownKeys(qr(t)),set(t,e,i){const n=ca(qr(t),e);if(n?.set)return n.set.call(t.draft_,i),!0;if(!t.modified_){const n=la(qr(t),e),o=n?.[Mr];if(o&&o.base_===i)return t.copy_[e]=i,t.assigned_[e]=!1,!0;if(function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}(i,n)&&(void 0!==i||Nr(t.base_,e)))return!0;da(t),ha(t)}return t.copy_[e]===i&&(void 0!==i||e in t.copy_)||Number.isNaN(i)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=i,t.assigned_[e]=!0),!0},deleteProperty:(t,e)=>(void 0!==la(t.base_,e)||e in t.base_?(t.assigned_[e]=!1,da(t),ha(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0),getOwnPropertyDescriptor(t,e){const i=qr(t),n=Reflect.getOwnPropertyDescriptor(i,e);return n?{writable:!0,configurable:1!==t.type_||"length"!==e,enumerable:n.enumerable,value:i[e]}:n},defineProperty(){Pr(11)},getPrototypeOf:t=>Or(t.base_),setPrototypeOf(){Pr(12)}},aa={};function la(t,e){const i=t[Mr];return(i?qr(i):t)[e]}function ca(t,e){if(!(e in t))return;let i=Or(t);for(;i;){const t=Object.getOwnPropertyDescriptor(i,e);if(t)return t;i=Or(i)}}function ha(t){t.modified_||(t.modified_=!0,t.parent_&&ha(t.parent_))}function da(t){t.copy_||(t.copy_=Vr(t.base_,t.scope_.immer_.useStrictShallowCopy_))}zr(ra,((t,e)=>{aa[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}})),aa.deleteProperty=function(t,e){return isNaN(parseInt(e))&&Pr(13),aa.set.call(this,t,e,void 0)},aa.set=function(t,e,i){return"length"!==e&&isNaN(parseInt(e))&&Pr(14),ra.set.call(this,t[0],e,i,t[0])};function ua(t,e){const i=jr(t)?Yr("MapSet").proxyMap_(t,e):Fr(t)?Yr("MapSet").proxySet_(t,e):function(t,e){const i=Array.isArray(t),n={type_:i?1:0,scope_:e?e.scope_:Xr(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=n,s=ra;i&&(o=[n],s=aa);const{revoke:r,proxy:a}=Proxy.revocable(o,s);return n.draft_=a,n.revoke_=r,a}(t,e);return(e?e.scope_:Xr()).drafts_.push(i),i}function pa(t){if(!Ir(t)||Wr(t))return t;const e=t[Mr];let i;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,i=Vr(t,e.scope_.immer_.useStrictShallowCopy_)}else i=Vr(t,!0);return zr(i,((t,e)=>{Br(i,t,pa(e))})),e&&(e.finalized_=!1),i}var fa=new class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,e,i)=>{if("function"==typeof t&&"function"!=typeof e){const i=e;e=t;const n=this;return function(t=i,...o){return n.produce(t,(t=>e.call(this,t,...o)))}}let n;if("function"!=typeof e&&Pr(6),void 0!==i&&"function"!=typeof i&&Pr(7),Ir(t)){const o=ta(this),s=ua(t,void 0);let r=!0;try{n=e(s),r=!1}finally{r?Qr(o):Jr(o)}return Kr(o,i),ia(n,o)}if(!t||"object"!=typeof t){if(n=e(t),void 0===n&&(n=t),n===Er&&(n=void 0),this.autoFreeze_&&Hr(n,!0),i){const e=[],o=[];Yr("Patches").generateReplacementPatches_(t,n,e,o),i(e,o)}return n}Pr(1,t)},this.produceWithPatches=(t,e)=>{if("function"==typeof t)return(e,...i)=>this.produceWithPatches(e,(e=>t(e,...i)));let i,n;const o=this.produce(t,e,((t,e)=>{i=t,n=e}));return[o,i,n]},"boolean"==typeof t?.autoFreeze&&this.setAutoFreeze(t.autoFreeze),"boolean"==typeof t?.useStrictShallowCopy&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){Ir(t)||Pr(8),Dr(t)&&(t=function(t){Dr(t)||Pr(10,t);return pa(t)}(t));const e=ta(this),i=ua(t,void 0);return i[Mr].isManual_=!0,Jr(e),i}finishDraft(t,e){const i=t&&t[Mr];i&&i.isManual_||Pr(9);const{scope_:n}=i;return Kr(n,e),ia(void 0,n)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,e){let i;for(i=e.length-1;i>=0;i--){const n=e[i];if(0===n.path.length&&"replace"===n.op){t=n.value;break}}i>-1&&(e=e.slice(i+1));const n=Yr("Patches").applyPatches_;return Dr(t)?n(t,e):this.produce(t,(t=>n(t,e)))}},ma=fa.produce;fa.produceWithPatches.bind(fa),fa.setAutoFreeze.bind(fa),fa.setUseStrictShallowCopy.bind(fa),fa.applyPatches.bind(fa),fa.createDraft.bind(fa),fa.finishDraft.bind(fa);const ga=t=>(e,i,n)=>(n.setState=(t,i,...n)=>{const o="function"==typeof t?ma(t):t;return e(o,i,...n)},t(n.setState,i,n)),va=t=>(e,i,n)=>{const o=n.subscribe;n.subscribe=(t,e,i)=>{let s=t;if(e){const o=(null==i?void 0:i.equalityFn)||Object.is;let r=t(n.getState());s=i=>{const n=t(i);if(!o(r,n)){const t=r;e(r=n,t)}},(null==i?void 0:i.fireImmediately)&&e(r,r)}return o(s)};return t(e,i,n)},ya=Cr(va(ga(((t,e)=>({languageNames:{},canvasSize:{width:0,height:0},languageCode:"",workspace:null,flowDefinition:null,flowInfo:null,isTranslating:!1,dirtyDate:null,setDirtyDate:e=>{t((t=>{t.dirtyDate=e}))},fetchRevision:async(e,i=null)=>{i||(i="latest");const n=await fetch(`${e}/${i}/?version=14.3`);if(!n.ok)throw new Error("Network response was not ok");const o=await n.json();t({flowInfo:o.info,flowDefinition:o.definition})},fetchWorkspace:async e=>{const i=await fetch(e);if(!i.ok)throw new Error("Network response was not ok");const n=await i.json();t({workspace:n})},fetchAllLanguages:async e=>{const i=(await Zt(e)).reduce((function(t,e){return t[e.value]=e.name,t}),{});t({languageNames:i})},getFlowResults:()=>e().flowInfo.results,getResultByKey:t=>e().flowInfo.results.find((e=>e.key===t)),getLanguage:()=>{const t=e(),i=t.languageCode;return{name:t.languageNames[i],code:i}},setFlowContents:e=>{t((t=>{const i=e.definition.language;t.flowDefinition=e.definition,t.flowInfo=e.info,t.languageCode=i,t.isTranslating=!1}))},setFlowInfo:e=>{t((t=>{t.flowInfo=e}))},setLanguageCode:e=>{t((t=>{t.languageCode=e,t.isTranslating=t.flowDefinition.language!==e}))},expandCanvas:(e,i)=>{t((t=>{const n=Math.max(t.canvasSize.width,e+800),o=Math.max(t.canvasSize.height,i+800);t.canvasSize.width=n,t.canvasSize.height=o}))},updateCanvasPositions:e=>{t((t=>{for(const i in e)t.flowDefinition._ui.nodes[i]&&(t.flowDefinition._ui.nodes[i].position=e[i])}))},updateNodePosition:(e,i)=>{t((t=>{t.flowDefinition._ui.nodes[e]?t.flowDefinition._ui.nodes[e].position=i:t.flowDefinition._ui.nodes[e]={position:i,type:null,config:{}},t.dirtyDate=new Date}))},removeNodes:e=>{t((t=>{for(const i of e)delete t.flowDefinition._ui.nodes[i];t.flowDefinition.nodes=t.flowDefinition.nodes.filter((t=>!e.includes(t.uuid)))}))}})))));function ba(t,e){return(i,n)=>{ue()(i,n);const o="connectedCallback",s="disconnectedCallback",r=i[o],a=i[s];i[o]=function(){var i;null!==(i=this._zustandUnsubscribe)&&void 0!==i||(this._zustandUnsubscribe={}),this[n]=e(t.getState()),this._zustandUnsubscribe[n]=t.subscribe(e,(t=>{this[n]=t})),r&&r.call(this)},i[s]=function(){var t,e;null===(e=null===(t=this._zustandUnsubscribe)||void 0===t?void 0:t[n])||void 0===e||e.call(t),a&&a.call(this)}}}const{setLocale:xa}=(t=>(function(t){if(xr)throw new Error("lit-localize can only be configured once");br=t,xr=!0}(((t,e)=>ar(pr,t,e))),fr=hr=t.sourceLocale,dr=new Set(t.targetLocales),dr.add(t.sourceLocale),ur=t.loadLocale,{getLocale:vr,setLocale:yr}))({sourceLocale:"en",targetLocales:_r,loadLocale:t=>import(`./locales/${t}.js`)}),_a=()=>document.querySelector("temba-store");class wa extends ge{constructor(){super(...arguments),this.settings={},this.ttl=6e4,this.max=20,this.ready=!1,this.loader=!1,this.keyedAssets={},this.locale=[...navigator.languages],this.fields={},this.groups={},this.shortcuts=[],this.languages={},this.featuredFields=[],this.dirtyElements=[],this.pendingResolves={},this.fetching={}}static get styles(){return a`
|
|
395
395
|
:host {
|
|
396
396
|
position: fixed;
|
|
397
397
|
z-index: 1000;
|
|
@@ -1936,7 +1936,9 @@ let br=Qs,xr=!1;const _r=["es","fr","pt"],wr="data:image/png;base64,iVBORw0KGgoA
|
|
|
1936
1936
|
opacity: var(--disabled-opacity) !important;
|
|
1937
1937
|
pointer-events: none !important;
|
|
1938
1938
|
}
|
|
1939
|
-
`}render(){const t=this.hideErrors?[]:(this.errors||[]).map((t=>U`
|
|
1939
|
+
`}render(){const t=this.hideErrors?[]:(this.errors||[]).map((t=>U`
|
|
1940
|
+
<div class="alert-error">${nc(t)}</div>
|
|
1941
|
+
`));return this.widgetOnly?U`
|
|
1940
1942
|
<div class="${this.disabled?"disabled":""}"><slot></slot></div>
|
|
1941
1943
|
${t}
|
|
1942
1944
|
`:U`
|
|
@@ -4724,7 +4726,7 @@ let br=Qs,xr=!1;const _r=["es","fr","pt"],wr="data:image/png;base64,iVBORw0KGgoA
|
|
|
4724
4726
|
`}updated(t){super.updated(t),t.has("selected")&&this.classList.toggle("selected",this.selected)}hasBadge(){return this.count>0}handleDetailsChanged(t){"dirty"in t.detail&&(this.dirty=t.detail.dirty),"count"in t.detail&&(this.count=t.detail.count,this.hideEmpty&&(this.hidden=0===this.count))}render(){return U`<slot
|
|
4725
4727
|
@temba-details-changed=${this.handleDetailsChanged}
|
|
4726
4728
|
class="${Wt({selected:this.selected})}"
|
|
4727
|
-
></slot> `}}t([ue({type:String})],Ch.prototype,"name",void 0),t([ue({type:String})],Ch.prototype,"icon",void 0),t([ue({type:String})],Ch.prototype,"selectionColor",void 0),t([ue({type:String})],Ch.prototype,"selectionBackground",void 0),t([ue({type:String})],Ch.prototype,"borderColor",void 0),t([ue({type:String})],Ch.prototype,"activityColor",void 0),t([ue({type:Boolean})],Ch.prototype,"selected",void 0),t([ue({type:Boolean})],Ch.prototype,"notify",void 0),t([ue({type:Boolean})],Ch.prototype,"alert",void 0),t([ue({type:Boolean})],Ch.prototype,"hidden",void 0),t([ue({type:Boolean})],Ch.prototype,"hideEmpty",void 0),t([ue({type:Boolean})],Ch.prototype,"activity",void 0),t([ue({type:Number})],Ch.prototype,"count",void 0),t([ue({type:Boolean})],Ch.prototype,"checked",void 0),t([ue({type:Boolean})],Ch.prototype,"dirty",void 0);
|
|
4729
|
+
></slot> `}}t([ue({type:String})],Ch.prototype,"name",void 0),t([ue({type:String})],Ch.prototype,"icon",void 0),t([ue({type:String})],Ch.prototype,"selectionColor",void 0),t([ue({type:String})],Ch.prototype,"selectionBackground",void 0),t([ue({type:String})],Ch.prototype,"borderColor",void 0),t([ue({type:String})],Ch.prototype,"activityColor",void 0),t([ue({type:Boolean})],Ch.prototype,"selected",void 0),t([ue({type:Boolean})],Ch.prototype,"notify",void 0),t([ue({type:Boolean})],Ch.prototype,"alert",void 0),t([ue({type:Boolean})],Ch.prototype,"hidden",void 0),t([ue({type:Boolean})],Ch.prototype,"hideEmpty",void 0),t([ue({type:Boolean})],Ch.prototype,"activity",void 0),t([ue({type:Number})],Ch.prototype,"count",void 0),t([ue({type:Boolean})],Ch.prototype,"checked",void 0),t([ue({type:Boolean})],Ch.prototype,"dirty",void 0);let Eh=class extends ct{static get styles(){return a`
|
|
4728
4730
|
:host {
|
|
4729
4731
|
display: inline-block;
|
|
4730
4732
|
}
|
|
@@ -4808,7 +4810,7 @@ let br=Qs,xr=!1;const _r=["es","fr","pt"],wr="data:image/png;base64,iVBORw0KGgoA
|
|
|
4808
4810
|
<slot></slot>
|
|
4809
4811
|
</div>
|
|
4810
4812
|
</div>
|
|
4811
|
-
`}}t([ue({type:Boolean})],Eh.prototype,"clickable",void 0),t([ue({type:Boolean})],Eh.prototype,"primary",void 0),t([ue({type:Boolean})],Eh.prototype,"secondary",void 0),t([ue({type:Boolean})],Eh.prototype,"tertiary",void 0),t([ue({type:Boolean})],Eh.prototype,"danger",void 0),t([ue({type:Boolean})],Eh.prototype,"dark",void 0),t([ue({type:Boolean})],Eh.prototype,"shadow",void 0),t([ue({type:String})],Eh.prototype,"icon",void 0),t([ue()],Eh.prototype,"backgroundColor",void 0),t([ue()],Eh.prototype,"textColor",void 0);class Ah extends ge{constructor(){super(...arguments),this.size=20}static get styles(){return a`
|
|
4813
|
+
`}};t([ue({type:Boolean})],Eh.prototype,"clickable",void 0),t([ue({type:Boolean})],Eh.prototype,"primary",void 0),t([ue({type:Boolean})],Eh.prototype,"secondary",void 0),t([ue({type:Boolean})],Eh.prototype,"tertiary",void 0),t([ue({type:Boolean})],Eh.prototype,"danger",void 0),t([ue({type:Boolean})],Eh.prototype,"dark",void 0),t([ue({type:Boolean})],Eh.prototype,"shadow",void 0),t([ue({type:String})],Eh.prototype,"icon",void 0),t([ue()],Eh.prototype,"backgroundColor",void 0),t([ue()],Eh.prototype,"textColor",void 0);class Ah extends ge{constructor(){super(...arguments),this.size=20}static get styles(){return a`
|
|
4812
4814
|
:host {
|
|
4813
4815
|
display: flex;
|
|
4814
4816
|
align-items: center;
|
|
@@ -8050,18 +8052,18 @@ const{I:hd}=at,dd=()=>document.createComment(""),ud=(t,e,i)=>{const n=t._$AA.par
|
|
|
8050
8052
|
${this.renderUploader()}
|
|
8051
8053
|
</div>
|
|
8052
8054
|
</div>
|
|
8053
|
-
</div>`}}function _d(t){return _d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_d(t)}function wd(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function kd(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Sd(t,e,i){return e&&kd(t.prototype,e),i&&kd(t,i),t}function Cd(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Ed(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Md(t,e)}function Ad(t){return Ad=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Ad(t)}function Md(t,e){return Md=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Md(t,e)}function Td(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Pd(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=Ad(t);if(e){var o=Ad(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return function(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?Td(t):e}(this,i)}}function Od(t,e,i){return Od="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,i){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Ad(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(i):o.value}},Od(t,e,i||t)}function Dd(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==i)return;var n,o,s=[],r=!0,a=!1;try{for(i=i.call(t);!(r=(n=i.next()).done)&&(s.push(n.value),!e||s.length!==e);r=!0);}catch(t){a=!0,o=t}finally{try{r||null==i.return||i.return()}finally{if(a)throw o}}return s}(t,e)||Ld(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Id(t){return function(t){if(Array.isArray(t))return $d(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Ld(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ld(t,e){if(t){if("string"==typeof t)return $d(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?$d(t,e):void 0}}function $d(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function zd(t,e,i){return"*"===t||(t.length>0?-1!==t.indexOf(e):!i)}function Rd(t,e,i){var n,o=t=t||{},s=e=e||{};for(n in s)o[n]=s[n];return t}function Nd(t){return"[object Number]"===Object.prototype.toString.call(t)}function Bd(t){return"string"==typeof t}function jd(t){return"boolean"==typeof t}function Fd(t){return null!=t&&"[object Object]"===Object.prototype.toString.call(t)}function qd(t){return"[object Function]"===Object.prototype.toString.call(t)}function Vd(t){if(Bd(t))return""+t;if(jd(t))return!!t;if(function(t){return"[object Date]"===Object.prototype.toString.call(t)}(t))return new Date(t.getTime());if(qd(t))return t;if(Array.isArray(t)){for(var e=[],i=0;i<t.length;i++)e.push(Vd(t[i]));return e}if(Fd(t)){var n={};for(var o in t)n[o]=Vd(t[o]);return n}return t}function Hd(t,e,i,n){var o,s,r={},a={};for(i=i||[],n=n||[],s=0;s<i.length;s++)r[i[s]]=!0;for(s=0;s<n.length;s++)a[n[s]]=!0;var l=Vd(t);for(s in e)if(null==l[s]||a[s])l[s]=e[s];else if(r[s])(o=[]).push.apply(o,Array.isArray(l[s])?l[s]:[l[s]]),o.push(e[s]),l[s]=o;else if(Bd(e[s])||jd(e[s])||qd(e[s])||Nd(e[s]))l[s]=e[s];else if(Array.isArray(e[s]))o=[],Array.isArray(l[s])&&o.push.apply(o,l[s]),o.push.apply(o,e[s]),l[s]=o;else if(Fd(e[s]))for(var c in Fd(l[s])||(l[s]={}),e[s])l[s][c]=e[s][c];return l}function Ud(t,e,i){for(var n=0;n<i.length;n++){var o=i[n][0][i[n][1]].apply(i[n][0],i[n][2]);if(o===e)return o}return t}function Wd(t,e,i,n){return function t(o){if(null!=o){if(Bd(o))return function(t){var i=t.match(/(\${.*?})/g);if(null!=i)for(var n=0;n<i.length;n++){var o=e[i[n].substring(2,i[n].length-1)]||"";null!=o&&(t=t.replace(i[n],o))}if(null!=(i=t.match(/({{.*?}})/g)))for(var s=0;s<i.length;s++){var r=e[i[s].substring(2,i[s].length-2)]||"";null!=r&&(t=t.replace(i[s],r))}return t}(o);if(qd(o)&&!n&&0===(o.name||"").indexOf(i))return o(e);if(Array.isArray(o)){for(var s=[],r=0;r<o.length;r++)s.push(t(o[r]));return s}if(Fd(o)){var a={};for(var l in o)a[l]=t(o[l]);return a}return o}}(t)}function Gd(t,e){if(!t)return null;for(var i=0;i<t.length;i++)e(t[i])}function Zd(t,e){if(t)for(var i=0;i<t.length;i++)if(e(t[i]))return i;return-1}function Yd(t,e){var i=Zd(t,e);return-1===i?null:t[i]}function Xd(t,e){var i=null;return t.forEach((function(t){e(t)&&(i=t)})),i}function Kd(t,e){var i=Zd(t,e);return i>-1&&t.splice(i,1),-1!==i}function Qd(t){if(null!=Array.fromArray)return Array.from(t);var e=[];return Array.prototype.push.apply(e,t),e}function Jd(t,e){var i=t.indexOf(e);return i>-1&&t.splice(i,1),-1!==i}function tu(t,e,i,n){var o=t[e];return null==o&&(o=[],t[e]=o),o[n?"unshift":"push"](i),o}function eu(t,e,i){return-1===t.indexOf(e)&&(t.push(e),!0)}t([ue({type:String,attribute:!1})],xd.prototype,"endpoint",void 0),t([ue({type:Boolean})],xd.prototype,"pendingDrop",void 0),t([ue({type:String})],xd.prototype,"icon",void 0),t([ue({type:String})],xd.prototype,"accept",void 0),t([ue({type:Number})],xd.prototype,"max",void 0),t([ue({type:Array})],xd.prototype,"attachments",void 0),t([ue({type:Boolean,attribute:!1})],xd.prototype,"uploading",void 0);for(var iu,nu=[],ou=0;ou<256;ou++)nu[ou]=(ou<16?"0":"")+ou.toString(16);function su(){var t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return nu[255&t]+nu[t>>8&255]+nu[t>>16&255]+nu[t>>24&255]+"-"+nu[255&e]+nu[e>>8&255]+"-"+nu[e>>16&15|64]+nu[e>>24&255]+"-"+nu[63&i|128]+nu[i>>8&255]+"-"+nu[i>>16&255]+nu[i>>24&255]+nu[255&n]+nu[n>>8&255]+nu[n>>16&255]+nu[n>>24&255]}function ru(t,e,i){var n=t.x-e.x,o=t.y-e.y,s=Math.cos(i/360*Math.PI*2),r=Math.sin(i/360*Math.PI*2);return{x:n*s-o*r+e.x,y:o*s+n*r+e.y,cr:s,sr:r}}function au(t){if(null==t)return null;for(var e=t.replace(/^\s\s*/,""),i=/\s/,n=e.length;i.test(e.charAt(--n)););return e.slice(0,n+1)}function lu(t,e){for(var i=[],n=0;n<t.length;n++)i.push(e(t[n]));return i}function cu(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];if("undefined"!=typeof console)try{var n=arguments[arguments.length-1];console.log(n)}catch(t){}}function hu(t){return t<0?-1:t>0?1:0}function du(t,e,i){return function(){var n=null;try{null!=e&&(n=e.apply(this,arguments))}catch(t){cu("jsPlumb function failed : "+t)}if(null!=t&&(null==i||n!==i))try{n=t.apply(this,arguments)}catch(t){cu("wrapped function failed : "+t)}return n}}function uu(t,e,i){return t.has(e)||t.set(e,i()),t.get(e)}function pu(t,e){for(var i=t.__proto__;null!=i;){if(i instanceof e)return!0;i=i.__proto__}return!1}function fu(t,e,i){for(var n=(i=i||t.parentNode).querySelectorAll(e),o=0;o<n.length;o++)if(n[o]===t)return!0;return!1}function mu(t,e){t.stopPropagation?t.stopPropagation():t.returnValue=!1,!e&&t.preventDefault&&t.preventDefault()}function gu(t,e,i,n){if(n&&fu(t,e,i))return t;for(t=t.parentNode;null!=t&&t!==i;){if(fu(t,e))return t;t=t.parentNode}}function vu(t){return t.srcElement||t.target}function yu(t){return null!=t.className?void 0===t.className.baseVal?t.className:t.className.baseVal:""}function bu(t,e,i){var n=null==e?[]:Array.isArray(e)?e:e.split(/\s+/),o=null==i?[]:Array.isArray(i)?i:i.split(/\s+/),s=yu(t).split(/\s+/),r=function(t,e){for(var i=0;i<e.length;i++)if(t)-1===s.indexOf(e[i])&&s.push(e[i]);else{var n=s.indexOf(e[i]);-1!==n&&s.splice(n,1)}};r(!0,n),r(!1,o),function(t,e,i){e=au(e),void 0!==t.className.baseVal?t.className.baseVal=e:t.className=e;try{var n=t.classList;if(null!=n){for(;n.length>0;)n.remove(n.item(0));for(var o=0;o<i.length;o++)i[o]&&n.add(i[o])}}catch(t){cu("WARN: cannot set class list",t)}}(t,s.join(" "),s)}function xu(t){return!Bd(t)&&!Array.isArray(t)&&null!=t.length&&null==t.documentElement&&null==t.nodeType}function _u(t,e){var i=function(t,e){null!=t&&null!=e&&e.length>0&&(t.classList?Gd(au(e).split(/\s+/),(function(e){t.classList.add(e)})):bu(t,e))};xu(t)?Gd(t,(function(t){return i(t,e)})):i(t,e)}function wu(t,e){var i=function(t,e){null!=t&&null!=e&&e.length>0&&(t.classList?au(e).split(/\s+/).forEach((function(e){t.classList.remove(e)})):bu(t,null,e))};xu(t)?Gd(t,(function(t){return i(t,e)})):i(t,e)}function ku(t,e,i,n){return Su(null,t,e,i,n)}function Su(t,e,i,n,o){var s,r=null==t?document.createElement(e):document.createElementNS(t,e);for(s in i=i||{})r.style[s]=i[s];for(s in n&&(r.className=n),o=o||{})r.setAttribute(s,""+o[s]);return r}function Cu(t){var e=t.getBoundingClientRect(),i=document.body,n=document.documentElement,o=window.pageYOffset||n.scrollTop||i.scrollTop,s=window.pageXOffset||n.scrollLeft||i.scrollLeft,r=n.clientTop||i.clientTop||0,a=n.clientLeft||i.clientLeft||0,l=e.top+o-r,c=e.left+s-a;return{x:Math.round(c),y:Math.round(l)}}function Eu(t,e){var i=e.getContainer().getBoundingClientRect(),n=t.getBoundingClientRect(),o=e.currentZoom;return{x:(n.left-i.left)/o,y:(n.top-i.top)/o}}function Au(t,e){var i=t.getBoundingClientRect(),n=e.currentZoom;return{w:i.width/n,h:i.height/n}}function Mu(t){return t instanceof SVGElement?iu.SVG:iu.HTML}function Tu(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return e.map((function(t){return"."+t})).join(",")}function Pu(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return e.map((function(t){return"["+t+"]"})).join(",")}!function(t){t.SVG="SVG",t.HTML="HTML"}(iu||(iu={}));var Ou="source",Du="target",Iu="block",Lu="none",$u="absolute",zu="fixed",Ru="data-jtk-group",Nu="data-jtk-managed",Bu="data-jtk-not-draggable",ju="tabindex",Fu="data-jtk-scope-",qu="checkCondition",Vu="jtk-connector",Hu="jtk-endpoint",Uu="jtk-floating-endpoint",Wu="jtk-group-collapsed",Gu="jtk-group-expanded",Zu="jtk-overlay",Yu="connection",Xu="internal.connection",Ku="connection:move",Qu="internal.endpoint:unregistered",Ju="internal.connection:detached",tp="element:manage",ep="maxConnections",ip="element:unmanage",np="zoom",op="isDetachAllowed",sp="beforeDrop",rp="beforeDetach",ap=Pu(Nu),lp={"stroke-linejoin":"stroke-linejoin","stroke-dashoffset":"stroke-dashoffset","stroke-linecap":"stroke-linecap"},cp="stroke-dasharray",hp="dashstyle",dp="fill",up="stroke",pp="stroke-width",fp="strokeWidth",mp="svg",gp="path",vp={svg:"http://www.w3.org/2000/svg"};function yp(t,e){for(var i in e)t.setAttribute(i,""+e[i])}function bp(t,e){return(e=e||{}).version="1.1",e.xmlns=vp.svg,Su(vp.svg,t,null,null,e)}function xp(t){return"position:absolute;left:"+t[0]+"px;top:"+t[1]+"px"}function _p(t,e,i){if(e.setAttribute(dp,i.fill?i.fill:Lu),e.setAttribute(up,i.stroke?i.stroke:Lu),i.strokeWidth&&e.setAttribute(pp,i.strokeWidth),i[hp]&&i[fp]&&!i[cp]){var n=-1===i[hp].indexOf(",")?" ":",",o=i[hp].split(n),s="";Gd(o,(function(t){s+=Math.floor(t*i.strokeWidth)+n})),e.setAttribute(cp,s)}else i[cp]&&e.setAttribute(cp,i[cp]);for(var r in lp)i[r]&&e.setAttribute(lp[r],i[r])}function wp(t,e,i){t.childNodes.length>i?t.insertBefore(e,t.childNodes[i]):t.appendChild(e)}function kp(t,e,i){return[t,e].join(":")}var Sp,Cp,Ep="data-jtk-container",Ap="data-jtk-enabled",Mp="data-jtk-scope",Tp="endpoint",Pp="element",Op="connection",Dp="click",Ip="contextmenu",Lp="dblclick",$p="dbltap",zp="mousedown",Rp="mouseenter",Np="mouseexit",Bp="mousemove",jp="mouseup",Fp="mouseout",qp="mouseover",Vp="tap",Hp="revert",Up="connection:drag",Wp=kp(Pp,Dp),Gp=kp(Pp,Lp),Zp=kp(Pp,$p),Yp=kp(Pp,Fp),Xp=kp(Pp,qp),Kp=kp(Pp,Bp),Qp=kp(Pp,jp),Jp=kp(Pp,zp),tf=kp(Pp,Ip),ef=kp(Pp,Vp),nf=kp(Tp,Dp),of=kp(Tp,Lp),sf=kp(Tp,Fp),rf=kp(Tp,qp),af=kp(Tp,jp),lf=kp(Tp,zp),cf=kp(Op,Dp),hf=kp(Op,Lp),df=kp(Op,$p),uf=kp(Op,Fp),pf=kp(Op,qp),ff=kp(Op,jp),mf=kp(Op,zp),gf=kp(Op,Ip),vf=kp(Op,Vp),yf="position",bf=Tu(Vu),xf=Tu(Hu),_f=Pu(Ru),wf=Pu("data-jtk-group-content"),kf=Tu(Zu);!function(t){t.Circle="Circle",t.Ellipse="Ellipse",t.Triangle="Triangle",t.Diamond="Diamond",t.Rectangle="Rectangle",t.Square="Square"}(Sp||(Sp={})),function(t){t.Assign="Assign",t.AutoDefault="AutoDefault",t.Bottom="Bottom",t.BottomLeft="BottomLeft",t.BottomRight="BottomRight",t.Center="Center",t.Continuous="Continuous",t.ContinuousBottom="ContinuousBottom",t.ContinuousLeft="ContinuousLeft",t.ContinuousRight="ContinuousRight",t.ContinuousTop="ContinuousTop",t.ContinuousLeftRight="ContinuousLeftRight",t.ContinuousTopBottom="ContinuousTopBottom",t.Left="Left",t.Perimeter="Perimeter",t.Right="Right",t.Top="Top",t.TopLeft="TopLeft",t.TopRight="TopRight"}(Cp||(Cp={}));var Sf,Cf,Ef=function(){function t(e){wd(this,t),this.params=e,Cd(this,"x1",void 0),Cd(this,"x2",void 0),Cd(this,"y1",void 0),Cd(this,"y2",void 0),Cd(this,"extents",{xmin:1/0,xmax:-1/0,ymin:1/0,ymax:-1/0}),Cd(this,"type",void 0),this.x1=e.x1,this.y1=e.y1,this.x2=e.x2,this.y2=e.y2}return Sd(t,[{key:"findClosestPointOnPath",value:function(t,e){return{d:1/0,x:null,y:null,l:null,x1:null,y1:null,x2:null,y2:null}}},{key:"lineIntersection",value:function(t,e,i,n){return[]}},{key:"boxIntersection",value:function(t,e,i,n){var o=[];return o.push.apply(o,this.lineIntersection(t,e,t+i,e)),o.push.apply(o,this.lineIntersection(t+i,e,t+i,e+n)),o.push.apply(o,this.lineIntersection(t+i,e+n,t,e+n)),o.push.apply(o,this.lineIntersection(t,e+n,t,e)),o}},{key:"boundingBoxIntersection",value:function(t){return this.boxIntersection(t.x,t.y,t.w,t.h)}}]),t}(),Af="undefined",Mf="default",Tf="true",Pf="false",Of="*";function Df(t,e,i,n,o,s,r){return function(){var t=[];return t.push.apply(t,arguments),t.item=function(t){return this[t]},t}(function(t,e,i,n,o,s,r){return new Touch({target:t,identifier:su(),pageX:e,pageY:i,screenX:n,screenY:o,clientX:s||n,clientY:r||o})}(t,e,i,n,o,s,r))}function If(t,e,i){for(var n=(i=i||t.parentNode).querySelectorAll(e),o=0;o<n.length;o++)if(n[o]===t)return!0;return!1}function Lf(t){return t.srcElement||t.target}function $f(t,e,i,n){if(n){var o=t.composedPath?t.composedPath():t.path;if(void 0!==o&&o.indexOf)return{path:o,end:o.indexOf(i)};var s={path:[],end:-1};return function t(e){s.path.push(e),e===i?s.end=s.path.length-1:null!=e.parentNode&&t(e.parentNode)}(e),s}return{path:[e],end:1}}var zf=1;function Rf(){return"ontouchstart"in document.documentElement||null!=navigator.maxTouchPoints&&navigator.maxTouchPoints>0}function Nf(){return"onmousedown"in document.documentElement}var Bf=(Cd(Sf={},zp,"touchstart"),Cd(Sf,jp,"touchend"),Cd(Sf,Bp,"touchmove"),Sf),jf="page";function Ff(t,e){if(null==t)return{x:0,y:0};var i=function(t,e){return t.item?t.item(e):t[e]}(Vf(t),0);return{x:i[e+"X"],y:i[e+"Y"]}}function qf(t){return Ff(t,jf)}function Vf(t){return t.touches&&t.touches.length>0?t.touches:t.changedTouches&&t.changedTouches.length>0?t.changedTouches:t.targetTouches&&t.targetTouches.length>0?t.targetTouches:[t]}function Hf(t,e,i,n,o){if(Gf(t,e,i),n.__tauid=i.__tauid,t.addEventListener)t.addEventListener(e,i,!1,o);else if(t.attachEvent){var s=e+i.__tauid;t["e"+s]=i,t[s]=function(){t["e"+s]&&t["e"+s](window.event)},t.attachEvent("on"+e,t[s])}}function Uf(t,e,i){var n=this;null!=i&&Wf(t,(function(o){if(function(t,e,i){if(t.__ta&&t.__ta[e]&&delete t.__ta[e][i.__tauid],i.__taExtra){for(var n=0;n<i.__taExtra.length;n++)Uf(t,i.__taExtra[n][0],i.__taExtra[n][1]);i.__taExtra.length=0}i.__taUnstore&&i.__taUnstore()}(o,e,i),null!=i.__tauid)if(o.removeEventListener)o.removeEventListener(e,i,!1),Rf()&&Bf[e]&&o.removeEventListener(Bf[e],i,!1);else if(n.detachEvent){var s=e+i.__tauid;o[s]&&o.detachEvent("on"+e,o[s]),o[s]=null,o["e"+s]=null}i.__taTouchProxy&&Uf(t,i.__taTouchProxy[1],i.__taTouchProxy[0])}))}function Wf(t,e){if(null!=t)for(var i="string"==typeof t?document.querySelectorAll(t):null!=t.length?t:[t],n=0;n<i.length;n++)e(i[n])}function Gf(t,e,i){var n=zf++;return t.__ta=t.__ta||{},t.__ta[e]=t.__ta[e]||{},t.__ta[e][n]=i,i.__tauid=n,n}var Zf=/:not\(([^)]+)\)/;function Yf(t,e,i,n){if(null==t)return i;var o=t.split(","),s=[],r=[];Gd(o,(function(t){var e=t.match(Zf);null!=e?r.push(e[1]):s.push(t)})),r.length>0&&0===s.length&&s.push(Of);var a=function n(o){n.__tauid=i.__tauid;var a=Lf(o),l=!1,c=a,h=$f(o,a,e,null!=t);if(-1!=h.end)for(var d=0;!l&&d<h.end;d++){c=h.path[d];for(var u=0;u<r.length;u++)if(If(c,r[u],e))return;for(var p=0;!l&&p<s.length;p++)if(If(c,s[p],e)){i.apply(c,[o,c]),l=!0;break}}};return function(t,e,i){t.__taExtra=t.__taExtra||[],t.__taExtra.push([e,i])}(i,n,a),a}var Xf=function(t,e,i,n,o){if(Rf()&&Bf[e]){var s=Yf(n,t,i,Bf[e]);Hf(t,Bf[e],s,i,o)}"focus"===e&&null==t.getAttribute(ju)&&t.setAttribute(ju,"1"),Hf(t,e,Yf(n,t,i,e),i,o)},Kf=(Cd(Cf={},Vp,{touches:1,taps:1}),Cd(Cf,$p,{touches:1,taps:2}),Cd(Cf,Ip,{touches:2,taps:1}),Cf);function Qf(t,e,i,n){for(var o in i.__tamee[t])i.__tamee[t].hasOwnProperty(o)&&i.__tamee[t][o].apply(n,[e])}var Jf=function(){function t(){wd(this,t)}return Sd(t,null,[{key:"generate",value:function(t,e){return function(i,n,o,s){if(n==Ip&&Nf())Xf(i,n,o,s);else{if(null==i.__taTapHandler){var r=i.__taTapHandler={tap:[],dbltap:[],down:!1,taps:0,downSelectors:[]},a=function(n){for(var o=Lf(n),a=$f(n,o,i,null!=s),l=!1,d=0;d<a.end;d++){if(l)return;o=a.path[d];for(var u=0;u<r.downSelectors.length;u++)if(null==r.downSelectors[u]||If(o,r.downSelectors[u],i)){r.down=!0,setTimeout(c,t),setTimeout(h,e),l=!0;break}}},l=function(t){if(r.down){var e,n,o=Lf(t);r.taps++;var s=function(t){return Vf(t).length}(t);for(var a in Kf)if(Kf.hasOwnProperty(a)){var l=Kf[a];if(l.touches===s&&(1===l.taps||l.taps===r.taps))for(var c=0;c<r[a].length;c++){n=$f(t,o,i,null!=r[a][c][1]);for(var h=0;h<n.end;h++)if(e=n.path[h],null==r[a][c][1]||If(e,r[a][c][1],i)){r[a][c][0].apply(e,[t,e]);break}}}}},c=function(){r.down=!1},h=function(){r.taps=0};i.__taTapHandler.downHandler=a,i.__taTapHandler.upHandler=l,Xf(i,zp,a),Xf(i,jp,l)}i.__taTapHandler.downSelectors.push(s),i.__taTapHandler[n].push([o,s]),o.__taUnstore=function(){null!=i.__taTapHandler&&(Kd(i.__taTapHandler.downSelectors,(function(t){return t===s})),function(t,e){var i,n=0;for(n=0,i=t.length;n<i&&t[n][0]!==e;n++);n<t.length&&t.splice(n,1)}(i.__taTapHandler[n],o),0===i.__taTapHandler.downSelectors.length&&(Uf(i,zp,i.__taTapHandler.downHandler),Uf(i,jp,i.__taTapHandler.upHandler),delete i.__taTapHandler))}}}}}]),t}(),tm=function(){function t(){wd(this,t)}return Sd(t,null,[{key:"generate",value:function(){var t=[];return function(e,i,n,o){if(!e.__tamee){e.__tamee={over:!1,mouseenter:[],mouseexit:[]};var s=function(i){var n=Lf(i);(null==o&&n==e&&!e.__tamee.over||If(n,o,e)&&(null==n.__tamee||!n.__tamee.over))&&(Qf(Rp,i,e,n),n.__tamee=n.__tamee||{},n.__tamee.over=!0,t.push(n))},r=function(i){for(var n=Lf(i),o=0;o<t.length;o++)n!=t[o]||If(i.relatedTarget||i.toElement,"*",n)||(n.__tamee.over=!1,t.splice(o,1),Qf(Np,i,e,n))};Hf(e,qp,Yf(o,e,s,qp),s),Hf(e,Fp,Yf(o,e,r,Fp),r)}n.__taUnstore=function(){delete e.__tamee[i][n.__tauid]},Gf(e,i,n),e.__tamee[i][n.__tauid]=n}}}]),t}(),em=function(){function t(e){wd(this,t),Cd(this,"clickThreshold",void 0),Cd(this,"dblClickThreshold",void 0),Cd(this,"tapHandler",void 0),Cd(this,"mouseEnterExitHandler",void 0),e=e||{},this.clickThreshold=e.clickThreshold||250,this.dblClickThreshold=e.dblClickThreshold||450,this.mouseEnterExitHandler=tm.generate(),this.tapHandler=Jf.generate(this.clickThreshold,this.dblClickThreshold)}return Sd(t,[{key:"_doBind",value:function(t,e,i,n,o){if(null!=i){var s=t;e===Vp||e===$p||e===Ip?this.tapHandler(s,e,i,n,o):e===Rp||e==Np?this.mouseEnterExitHandler(s,e,i,n,o):Xf(s,e,i,n,o)}}},{key:"on",value:function(t,e,i,n,o){var s=null==n?null:i,r=null==n?i:n;return this._doBind(t,e,r,s,o),this}},{key:"off",value:function(t,e,i){return Uf(t,e,i),this}},{key:"trigger",value:function(t,e,i,n,o){var s=Nf()&&("undefined"==typeof MouseEvent||null==i||i.constructor===MouseEvent),r=Rf()&&!Nf()&&Bf[e]?Bf[e]:e,a=!(Rf()&&!Nf()&&Bf[e]),l=qf(i),c=function(t){return Ff(t,"screen")}(i),h=function(t){return Ff(t,"client")}(i);return Wf(t,(function(t){var d;i=i||{screenX:c.x,screenY:c.y,clientX:h.x,clientY:h.y};var u,p={TouchEvent:function(e){var i=Df(t,l.x,l.y,c.x,c.y,h.x,h.y);(e.initTouchEvent||e.initEvent)(r,!0,!0,window,null,c.x,c.y,h.x,h.y,!1,!1,!1,!1,i,i,i,1,0)},MouseEvents:function(e){e.initMouseEvent(r,!0,!0,window,null==o?1:o,c.x,c.y,h.x,h.y,!1,!1,!1,!1,1,t)}},f=!a&&!s&&Rf()&&Bf[e]?"TouchEvent":"MouseEvents";d=document.createEvent(f),p[f](d),u=d,n&&(u.payload=n),t.dispatchEvent(d)})),this}}]),t}(),im=[null,[1,-1],[1,1],[-1,1],[-1,-1]],nm=[null,[-1,-1],[-1,1],[1,1],[1,-1]],om=2*Math.PI;function sm(t,e){return e.x===t.x?e.y>t.y?1/0:-1/0:e.y===t.y?e.x>t.x?0:-0:(e.y-t.y)/(e.x-t.x)}function rm(t,e){return Math.sqrt(Math.pow(e.y-t.y,2)+Math.pow(e.x-t.x,2))}function am(t,e){return e.x>t.x||e.x==t.x?e.y>t.y?2:1:e.y>t.y?3:4}function lm(t,e){var i=t.x,n=t.x+t.w,o=t.y,s=t.y+t.h,r=e.x,a=e.x+e.w,l=e.y,c=e.y+e.h;return i<=r&&r<=n&&o<=l&&l<=s||i<=a&&a<=n&&o<=l&&l<=s||i<=r&&r<=n&&o<=c&&c<=s||i<=a&&r<=n&&o<=c&&c<=s||r<=i&&i<=a&&l<=o&&o<=c||r<=n&&n<=a&&l<=o&&o<=c||r<=i&&i<=a&&l<=s&&s<=c||r<=n&&i<=a&&l<=s&&s<=c}function cm(t,e,i){var n=sm(t,e),o=am(t,e),s=i>0?im[o]:nm[o],r=Math.atan(n),a=Math.abs(i*Math.sin(r))*s[1],l=Math.abs(i*Math.cos(r))*s[0];return{x:t.x+l,y:t.y+a}}function hm(t,e,i){if(fu(e,i,t))return e;for(var n=e.parentNode;null!=n&&n!==t;){if(fu(n,i,t))return n;n=n.parentNode}}function dm(t,e,i){var n=e.parentNode,o=t.getSize(n),s=t.getSize(e),r=i.x,a=r+s.w,l=i.y,c=l+s.h;return a>0&&r<o.w&&c>0&&l<o.h}var um,pm="start",fm="beforeStart",mm="drag",gm="stop",vm="katavorio-draggable",ym=function(){return!0},bm=function(){return!1},xm="katavorio-delegated-draggable",_m="katavorio-drag-no-select",wm="katavorio-ghost-proxy",km="katavorio-clone-drag";!function(t){t.absolutePosition="absolutePosition",t.transform="transform",t.xyAttributes="xyAttributes"}(um||(um={}));var Sm=new Map;Sm.set(um.absolutePosition,(function(t,e){t.style.left="".concat(e.x,"px"),t.style.top="".concat(e.y,"px")})),Sm.set(um.xyAttributes,(function(t,e){t.setAttribute("x","".concat(e.x)),t.setAttribute("y","".concat(e.y))}));var Cm=new Map;Cm.set(um.absolutePosition,(function(t){return{x:t.offsetLeft,y:t.offsetTop}})),Cm.set(um.xyAttributes,(function(t){return{x:parseFloat(t.getAttribute("x")),y:parseFloat(t.getAttribute("y"))}}));var Em=new Map;Em.set(um.absolutePosition,(function(t,e){t.style.width="".concat(e.w,"px"),t.style.height="".concat(e.h,"px")})),Em.set(um.xyAttributes,(function(t,e){t.setAttribute("width","".concat(e.w)),t.setAttribute("height","".concat(e.h))}));var Am=new Map;Am.set(um.absolutePosition,(function(t){return{w:t.offsetWidth,h:t.offsetHeight}})),Am.set(um.xyAttributes,(function(t){return{w:parseFloat(t.getAttribute("width")),h:parseFloat(t.getAttribute("height"))}}));var Mm,Tm=[gm,pm,mm,"drop","over","out",fm],Pm=function(){},Om=function(t,e){if(null!=t){t=Bd(t)||null!=t.tagName||null==t.length?[t]:t;for(var i=0;i<t.length;i++)e.apply(t[i],[t[i]])}},Dm=function(){function t(e,i){wd(this,t),this.el=e,this.manager=i,Cd(this,"_class",void 0),Cd(this,"uuid",su()),Cd(this,"enabled",!0),Cd(this,"scopes",[]),Cd(this,"eventManager",void 0),this.eventManager=i.eventManager}return Sd(t,[{key:"setEnabled",value:function(t){this.enabled=t}},{key:"isEnabled",value:function(){return this.enabled}},{key:"toggleEnabled",value:function(){this.enabled=!this.enabled}},{key:"addScope",value:function(t){var e={};for(var i in Om(this.scopes,(function(t){e[t]=!0})),Om(t?t.split(/\s+/):[],(function(t){e[t]=!0})),this.scopes.length=0,e)this.scopes.push(i)}},{key:"removeScope",value:function(t){var e={};for(var i in Om(this.scopes,(function(t){e[t]=!0})),Om(t?t.split(/\s+/):[],(function(t){delete e[t]})),this.scopes.length=0,e)this.scopes.push(i)}},{key:"toggleScope",value:function(t){var e={};for(var i in Om(this.scopes,(function(t){e[t]=!0})),Om(t?t.split(/\s+/):[],(function(t){e[t]?delete e[t]:e[t]=!0})),this.scopes.length=0,e)this.scopes.push(i)}}]),t}();!function(t){t.notNegative="notNegative",t.parent="parent",t.parentEnclosed="parentEnclosed"}(Mm||(Mm={}));var Im=function(t){Ed(i,t);var e=Pd(i);function i(t,n,o){var s;if(wd(this,i),Cd(Td(s=e.call(this,t,o)),"_class",void 0),Cd(Td(s),"rightButtonCanDrag",void 0),Cd(Td(s),"consumeStartEvent",void 0),Cd(Td(s),"clone",void 0),Cd(Td(s),"scroll",void 0),Cd(Td(s),"trackScroll",void 0),Cd(Td(s),"_downAt",void 0),Cd(Td(s),"_posAtDown",void 0),Cd(Td(s),"_pagePosAtDown",void 0),Cd(Td(s),"_pageDelta",{x:0,y:0}),Cd(Td(s),"_moving",void 0),Cd(Td(s),"_lastPosition",void 0),Cd(Td(s),"_lastScrollValues",{x:0,y:0}),Cd(Td(s),"_initialScroll",{x:0,y:0}),Cd(Td(s),"_size",void 0),Cd(Td(s),"_currentParentPosition",void 0),Cd(Td(s),"_ghostParentPosition",void 0),Cd(Td(s),"_dragEl",void 0),Cd(Td(s),"_multipleDrop",void 0),Cd(Td(s),"_ghostProxyOffsets",void 0),Cd(Td(s),"_ghostDx",void 0),Cd(Td(s),"_ghostDy",void 0),Cd(Td(s),"_isConstrained",!1),Cd(Td(s),"_ghostProxyParent",void 0),Cd(Td(s),"_useGhostProxy",void 0),Cd(Td(s),"_ghostProxyFunction",void 0),Cd(Td(s),"_activeSelectorParams",void 0),Cd(Td(s),"_availableSelectors",[]),Cd(Td(s),"_canDrag",void 0),Cd(Td(s),"_consumeFilteredEvents",void 0),Cd(Td(s),"_parent",void 0),Cd(Td(s),"_ignoreZoom",void 0),Cd(Td(s),"_filters",{}),Cd(Td(s),"_constrainRect",void 0),Cd(Td(s),"_elementToDrag",void 0),Cd(Td(s),"downListener",void 0),Cd(Td(s),"moveListener",void 0),Cd(Td(s),"upListener",void 0),Cd(Td(s),"scrollTracker",void 0),Cd(Td(s),"listeners",{start:[],drag:[],stop:[],over:[],out:[],beforeStart:[],revert:[]}),s._class=s.manager.css.draggable,_u(s.el,s._class),s.downListener=s._downListener.bind(Td(s)),s.upListener=s._upListener.bind(Td(s)),s.moveListener=s._moveListener.bind(Td(s)),s.rightButtonCanDrag=!0===n.rightButtonCanDrag,s.consumeStartEvent=!1!==n.consumeStartEvent,s._dragEl=s.el,s.clone=!0===n.clone,s.scroll=!0===n.scroll,s.trackScroll=!1!==n.trackScroll,s._multipleDrop=!1!==n.multipleDrop,s._canDrag=n.canDrag||ym,s._consumeFilteredEvents=n.consumeFilteredEvents,s._parent=n.parent,s._ignoreZoom=!0===n.ignoreZoom,s._ghostProxyParent=n.ghostProxyParent,s.trackScroll&&(s.scrollTracker=s._trackScroll.bind(Td(s)),document.addEventListener("scroll",s.scrollTracker)),!0===n.ghostProxy?s._useGhostProxy=ym:n.ghostProxy&&"function"==typeof n.ghostProxy?s._useGhostProxy=n.ghostProxy:s._useGhostProxy=function(t,e){return!(!s._activeSelectorParams||!s._activeSelectorParams.useGhostProxy)&&s._activeSelectorParams.useGhostProxy(t,e)},n.makeGhostProxy?s._ghostProxyFunction=n.makeGhostProxy:s._ghostProxyFunction=function(t){return s._activeSelectorParams&&s._activeSelectorParams.makeGhostProxy?s._activeSelectorParams.makeGhostProxy(t):t.cloneNode(!0)},n.selector){var r=s.el.getAttribute(vm);null==r&&(r=""+(new Date).getTime(),s.el.setAttribute("katavorio-draggable",r)),s._availableSelectors.push(n)}return s.eventManager.on(s.el,zp,s.downListener),s}return Sd(i,[{key:"_trackScroll",value:function(t){if(this._moving){var e={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop},i=e.x-this._lastScrollValues.x,n=e.y-this._lastScrollValues.y,o={x:i+this._lastPosition.x,y:n+this._lastPosition.y},s=o.x-this._downAt.x,r=o.y-this._downAt.y,a=this._ignoreZoom?1:this.manager.getZoom();this._dragEl&&this._dragEl.parentNode&&(s+=this._dragEl.parentNode.scrollLeft-this._initialScroll.x,r+=this._dragEl.parentNode.scrollTop-this._initialScroll.y),s/=a,r/=a,this.moveBy(s,r,t),this._lastPosition=o,this._lastScrollValues=e}}},{key:"on",value:function(t,e){this.listeners[t]&&this.listeners[t].push(e)}},{key:"off",value:function(t,e){if(this.listeners[t]){for(var i=[],n=0;n<this.listeners[t].length;n++)this.listeners[t][n]!==e&&i.push(this.listeners[t][n]);this.listeners[t]=i}}},{key:"_upListener",value:function(t){this._downAt&&(this._downAt=null,this.eventManager.off(document,Bp,this.moveListener),this.eventManager.off(document,jp,this.upListener),wu(document.body,_m),this.unmark(t),this.stop(t),this._moving=!1,this.clone?(this._dragEl&&this._dragEl.parentNode&&this._dragEl.parentNode.removeChild(this._dragEl),this._dragEl=null):this._activeSelectorParams&&this._activeSelectorParams.revertFunction&&!0===this._activeSelectorParams.revertFunction(this._dragEl,this.manager.getPosition(this._dragEl))&&(this.manager.setPosition(this._dragEl,this._posAtDown),this._dispatch(Hp,this._dragEl)))}},{key:"_downListener",value:function(t){if(!t.defaultPrevented&&((this.rightButtonCanDrag||3!==t.which&&2!==t.button)&&this.isEnabled()&&this._canDrag())){var e=this._testFilter(t)&&function(t,e,i){return!fu(t.srcElement||t.target,i.getInputFilterSelector(),e)}(t,this.el,this.manager);if(e){this._activeSelectorParams=null,this._elementToDrag=null,0===this._availableSelectors.length&&console.log("JSPLUMB: no available drag selectors");var i=t.target||t.srcElement,n=function(t,e,i){for(var n=null,o=e.getAttribute("katavorio-draggable"),s=null!=o?"[katavorio-draggable='"+o+"'] ":"",r=0;r<t.length;r++)if(null!=(n=hm(e,i,s+t[r].selector))){if(t[r].filter){var a=fu(i,t[r].filter,n);if(!0===t[r].filterExclude&&!a||a)return null}return[t[r],n]}return null}(this._availableSelectors,this.el,i);if(null!=n&&(this._activeSelectorParams=n[0],this._elementToDrag=n[1]),null==this._activeSelectorParams||null==this._elementToDrag)return;var o=this._activeSelectorParams.dragInit?this._activeSelectorParams.dragInit(this._elementToDrag,t):null;if(null!=o&&(this._elementToDrag=o),this.clone)if(this._dragEl=this._elementToDrag.cloneNode(!0),_u(this._dragEl,km),this._dragEl.setAttribute("id",null),this._dragEl.style.position="absolute",null!=this._parent){var s=this.manager.getPosition(this.el);this._dragEl.style.left=s.x+"px",this._dragEl.style.top=s.y+"px",this._parent.appendChild(this._dragEl)}else{var r=Cu(this._elementToDrag);this._dragEl.style.left=r.x+"px",this._dragEl.style.top=r.y+"px",document.body.appendChild(this._dragEl)}else this._dragEl=this._elementToDrag;this.consumeStartEvent&&mu(t),this._downAt=qf(t),this._dragEl&&this._dragEl.parentNode&&(this._initialScroll={x:this._dragEl.parentNode.scrollLeft,y:this._dragEl.parentNode.scrollTop}),this._posAtDown=this.manager.getPosition(this._dragEl),this._pagePosAtDown=Cu(this._dragEl),this._pageDelta={x:this._pagePosAtDown.x-this._posAtDown.x,y:this._pagePosAtDown.y-this._posAtDown.y},this._size=this.manager.getSize(this._dragEl),this.eventManager.on(document,Bp,this.moveListener),this.eventManager.on(document,jp,this.upListener),_u(document.body,_m),this._dispatch(fm,{el:this.el,pos:this._posAtDown,e:t,drag:this,size:this._size})}else this._consumeFilteredEvents&&mu(t)}}},{key:"_moveListener",value:function(t){if(this._downAt){if(!this._moving){var e=this._dispatch(pm,{el:this.el,pos:this._posAtDown,e:t,drag:this,size:this._size});if(!1!==e){if(!this._downAt)return;this.mark(e),this._moving=!0}else this.abort()}if(this._downAt){var i=qf(t),n=i.x-this._downAt.x,o=i.y-this._downAt.y,s=this._ignoreZoom?1:this.manager.getZoom();this._lastPosition={x:i.x,y:i.y},this._lastScrollValues={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop},this._dragEl&&this._dragEl.parentNode&&(n+=this._dragEl.parentNode.scrollLeft-this._initialScroll.x,o+=this._dragEl.parentNode.scrollTop-this._initialScroll.y),n/=s,o/=s,this.moveBy(n,o,t)}}}},{key:"getDragDelta",value:function(){return null!=this._posAtDown&&null!=this._downAt?{x:this._downAt.x-this._posAtDown.x,y:this._downAt.y-this._posAtDown.y}:{x:0,y:0}}},{key:"mark",value:function(t){var e;this._posAtDown=this.manager.getPosition(this._dragEl),this._pagePosAtDown=Cu(this._dragEl),this._pageDelta={x:this._pagePosAtDown.x-this._posAtDown.x,y:this._pagePosAtDown.y-this._posAtDown.y},this._size=this.manager.getSize(this._dragEl),_u(this._dragEl,this.manager.css.drag),this._constrainRect={w:(e=this._dragEl).parentNode.offsetWidth+e.parentNode.scrollLeft,h:e.parentNode.offsetHeight+e.parentNode.scrollTop},this._ghostDx=0,this._ghostDy=0}},{key:"unmark",value:function(t){this._isConstrained&&this._useGhostProxy(this._elementToDrag,this._dragEl)?(this._ghostProxyOffsets={x:this._dragEl.offsetLeft-this._ghostDx,y:this._dragEl.offsetTop-this._ghostDy},this._dragEl.parentNode.removeChild(this._dragEl),this._dragEl=this._elementToDrag):this._ghostProxyOffsets=null,wu(this._dragEl,this.manager.css.drag),this._isConstrained=!1}},{key:"moveBy",value:function(t,e,i){var n=this.toGrid({x:this._posAtDown.x+t,y:this._posAtDown.y+e}),o=this._doConstrain(n,this._dragEl,this._constrainRect,this._size,i);if(null!=o){if(this._useGhostProxy(this.el,this._dragEl))if(n.x!==o.x||n.y!==o.y){if(!this._isConstrained){var s=this._ghostProxyFunction(this._elementToDrag);_u(s,wm),this._ghostProxyParent?(this._ghostProxyParent.appendChild(s),this._currentParentPosition=Cu(this._elementToDrag.parentNode),this._ghostParentPosition=Cu(this._ghostProxyParent),this._ghostDx=this._currentParentPosition.x-this._ghostParentPosition.x,this._ghostDy=this._currentParentPosition.y-this._ghostParentPosition.y):this._elementToDrag.parentNode.appendChild(s),this._dragEl=s,this._isConstrained=!0}o=n}else this._isConstrained&&(this._dragEl.parentNode.removeChild(this._dragEl),this._dragEl=this._elementToDrag,this._isConstrained=!1,this._currentParentPosition=null,this._ghostParentPosition=null,this._ghostDx=0,this._ghostDy=0);this.manager.setPosition(this._dragEl,{x:o.x+this._ghostDx,y:o.y+this._ghostDy}),this._dispatch(mm,{el:this.el,pos:o,e:i,drag:this,size:this._size,originalPos:this._posAtDown})}}},{key:"abort",value:function(){null!=this._downAt&&this._upListener()}},{key:"getDragElement",value:function(t){return t?this._elementToDrag||this.el:this._dragEl||this.el}},{key:"stop",value:function(t,e){if(e||this._moving){var i=[],n=this.manager.getPosition(this._dragEl);i.push([this._dragEl,n,this,this._size]),this._dispatch(gm,{el:this._dragEl,pos:this._ghostProxyOffsets||n,finalPos:n,e:t,drag:this,selection:i,size:this._size,originalPos:{x:this._posAtDown.x,y:this._posAtDown.y}})}else this._moving||this._activeSelectorParams.dragAbort&&this._activeSelectorParams.dragAbort(this._elementToDrag)}},{key:"_dispatch",value:function(t,e){var i=null;if(this._activeSelectorParams&&this._activeSelectorParams[t])i=this._activeSelectorParams[t](e);else if(this.listeners[t])for(var n=0;n<this.listeners[t].length;n++)try{var o=this.listeners[t][n](e);null!=o&&(i=o)}catch(t){}return i}},{key:"resolveGrid",value:function(){var t={grid:null,thresholdX:5,thresholdY:5};return null!=this._activeSelectorParams&&null!=this._activeSelectorParams.grid&&(t.grid=this._activeSelectorParams.grid,null!=this._activeSelectorParams.snapThreshold&&(t.thresholdX=this._activeSelectorParams.snapThreshold,t.thresholdY=this._activeSelectorParams.snapThreshold)),t}},{key:"toGrid",value:function(t){var e=this.resolveGrid(),i=e.grid,n=e.thresholdX,o=e.thresholdY;return null==i?t:function(t,e,i,n){i=null==i?null==e.thresholdX?e.w/2:e.thresholdX:i,n=null==n?null==e.thresholdY?e.h/2:e.thresholdY:n;var o=Math.floor(t.x/e.w),s=e.w*o,r=s+e.w,a=Math.abs(t.x-s)<=i?s:Math.abs(r-t.x)<=i?r:t.x,l=Math.floor(t.y/e.h),c=e.h*l,h=c+e.h;return{x:a,y:Math.abs(t.y-c)<=n?c:Math.abs(h-t.y)<=n?h:t.y}}(t,i,i?i.w/2:n,i?i.h/2:o)}},{key:"setUseGhostProxy",value:function(t){this._useGhostProxy=t?ym:bm}},{key:"_doConstrain",value:function(t,e,i,n,o){return null!=this._activeSelectorParams&&this._activeSelectorParams.constrainFunction&&"function"==typeof this._activeSelectorParams.constrainFunction?this._activeSelectorParams.constrainFunction(t,e,i,n,o):t}},{key:"_testFilter",value:function(t){for(var e in this._filters){var i=this._filters[e],n=i[0](t);if(i[1]&&(n=!n),!n)return!1}return!0}},{key:"addFilter",value:function(t,e){var i,n=this;if(t){var o="function"==typeof(i=t)?(i._katavorioId=su(),i._katavorioId):i;this._filters[o]=[function(e){var i,o=e.srcElement||e.target;return Bd(t)?i=fu(o,t,n.el):"function"==typeof t&&(i=t(e,n.el)),i},!1!==e]}}},{key:"removeFilter",value:function(t){var e="function"==typeof t?t._katavorioId:t;delete this._filters[e]}},{key:"clearAllFilters",value:function(){this._filters={}}},{key:"addSelector",value:function(t,e){t.selector&&(e?this._availableSelectors.unshift(t):this._availableSelectors.push(t))}},{key:"destroy",value:function(){this.eventManager.off(this.el,zp,this.downListener),this.eventManager.off(document,Bp,this.moveListener),this.eventManager.off(document,jp,this.upListener),this.downListener=null,this.upListener=null,this.moveListener=null,null!=this.scrollTracker&&document.removeEventListener("scroll",this.scrollTracker)}}]),i}(Dm),Lm=["input","textarea","select","button","option"].join(","),$m=function(){function t(e){wd(this,t),Cd(this,"eventManager",void 0),Cd(this,"zoom",1),Cd(this,"css",{}),Cd(this,"inputFilterSelector",void 0),Cd(this,"positioningStrategy",void 0),Cd(this,"_positionSetter",void 0),Cd(this,"_positionGetter",void 0),Cd(this,"_sizeSetter",void 0),Cd(this,"_sizeGetter",void 0),e=e||{},this.inputFilterSelector=e.inputFilterSelector||Lm,this.eventManager=new em,this.zoom=e.zoom||1,this.positioningStrategy=e.positioningStrategy||um.absolutePosition,this._positionGetter=Cm.get(this.positioningStrategy),this._positionSetter=Sm.get(this.positioningStrategy),this._sizeGetter=Am.get(this.positioningStrategy),this._sizeSetter=Em.get(this.positioningStrategy);var i=e.css||{};Rd(this.css,i)}return Sd(t,[{key:"getPosition",value:function(t){return this._positionGetter(t)}},{key:"setPosition",value:function(t,e){this._positionSetter(t,e)}},{key:"getSize",value:function(t){return this._sizeGetter(t)}},{key:"getZoom",value:function(){return this.zoom}},{key:"setZoom",value:function(t){this.zoom=t}},{key:"_prepareParams",value:function(t){t=t||{};var e,i={events:{}};for(e in t)i[e]=t[e];for(e=0;e<Tm.length;e++)i.events[Tm[e]]=t[Tm[e]]||Pm;return i}},{key:"getInputFilterSelector",value:function(){return this.inputFilterSelector}},{key:"setInputFilterSelector",value:function(t){return this.inputFilterSelector=t,this}},{key:"draggable",value:function(t,e){if(null==t._katavorioDrag){var i=this._prepareParams(e),n=new Im(t,i,this);return _u(t,xm),t._katavorioDrag=n,n}return t._katavorioDrag}},{key:"destroyDraggable",value:function(t){t._katavorioDrag&&(t._katavorioDrag.destroy(),delete t._katavorioDrag)}}]),t}(),zm="jtk-drag-selected",Rm=function(){function t(e){wd(this,t),this.instance=e,Cd(this,"_dragSelection",[]),Cd(this,"_dragSizes",new Map),Cd(this,"_dragElements",new Map),Cd(this,"_dragElementStartPositions",new Map),Cd(this,"_dragElementPositions",new Map),Cd(this,"__activeSet",void 0)}return Sd(t,[{key:"_activeSet",get:function(){return null==this.__activeSet?this._dragSelection:this.__activeSet}},{key:"length",get:function(){return this._dragSelection.length}},{key:"filterActiveSet",value:function(t){var e=this;this.__activeSet=[],Gd(this._dragSelection,(function(i){t(i)&&e.__activeSet.push(i)}))}},{key:"clear",value:function(){var t=this;this.reset(),Gd(this._dragSelection,(function(e){return t.instance.removeClass(e.jel,zm)})),this._dragSelection.length=0}},{key:"reset",value:function(){this._dragElementStartPositions.clear(),this._dragElementPositions.clear(),this._dragSizes.clear(),this._dragElements.clear(),this.__activeSet=null}},{key:"initialisePositions",value:function(){var t=this;Gd(this._activeSet,(function(e){var i=t.instance.viewport.getPosition(e.id),n={x:parseInt(""+e.jel.offsetLeft,10),y:parseInt(""+e.jel.offsetTop,10)};t._dragElementStartPositions.set(e.id,n),t._dragElementPositions.set(e.id,n),t._dragSizes.set(e.id,{w:i.w,h:i.h})}))}},{key:"updatePositions",value:function(t,e,i){var n=this,o=t.x-e.x,s=t.y-e.y;Gd(this._activeSet,(function(t){var e=n._dragElementStartPositions.get(t.id);if(e){var r=e.x+o,a=e.y+s,l=n._dragSizes.get(t.id),c={x:r,y:a,w:l.w,h:l.h};if(t.jel._jsPlumbParentGroup&&t.jel._jsPlumbParentGroup.constrain){var h={w:t.jel.parentNode.offsetWidth+t.jel.parentNode.scrollLeft,h:t.jel.parentNode.offsetHeight+t.jel.parentNode.scrollTop};c.x=Math.max(c.x,0),c.y=Math.max(c.y,0),c.x=Math.min(c.x,h.w-l.w),c.y=Math.min(c.y,h.h-l.h)}n._dragElementPositions.set(t.id,{x:r,y:a}),t.jel.style.left=c.x+"px",t.jel.style.top=c.y+"px",i(t.jel,t.id,l,c)}}))}},{key:"each",value:function(t){var e=this;Gd(this._activeSet,(function(i){var n=e._dragSizes.get(i.id),o=e._dragElementPositions.get(i.id),s=e._dragElementStartPositions.get(i.id);t(i.jel,i.id,o,n,s)}))}},{key:"add",value:function(t,e){var i=t;e=e||this.instance.getId(i);var n=Zd(this._dragSelection,(function(t){return t.id===e}));-1===n&&(this.instance.addClass(t,zm),this._dragSelection.push({id:e,jel:i}))}},{key:"remove",value:function(t){var e=this,i=t;this._dragSelection=this._dragSelection.filter((function(t){var n=t.jel!==i;return n||e.instance.removeClass(t.jel,zm),n}))}},{key:"toggle",value:function(t){var e=t,i=Zd(this._dragSelection,(function(t){return t.jel===e}));-1!==i?this.remove(e):this.add(t)}}]),t}(),Nm="jtk-drag-active",Bm="jtk-drag-hover",jm=function(){function t(e,i,n){var o=this;wd(this,t),this.instance=e,this.dragSelection=i,Cd(this,"collicat",void 0),Cd(this,"drag",void 0),Cd(this,"_draggables",{}),Cd(this,"_dlist",[]),Cd(this,"_elementsWithEndpoints",{}),Cd(this,"_draggablesForElements",{}),Cd(this,"handlers",[]),Cd(this,"_trackScroll",void 0),Cd(this,"_filtersToAdd",[]),this.collicat=new $m({zoom:this.instance.currentZoom,css:{noSelect:this.instance.dragSelectClass,delegatedDraggable:"jtk-delegated-draggable",draggable:"jtk-draggable",drag:"jtk-drag",selected:zm,active:Nm,hover:Bm,ghostProxy:"jtk-ghost-proxy"}}),this.instance.bind(np,(function(t){o.collicat.setZoom(t)})),n=n||{},this._trackScroll=!1!==n.trackScroll}return Sd(t,[{key:"addHandler",value:function(t,e){var i=this,n=Rd({selector:t.selector},e||{});n.start=du(n.start,(function(e){return t.onStart(e)}),!1),n.drag=du(n.drag,(function(e){return t.onDrag(e)})),n.stop=du(n.stop,(function(e){return t.onStop(e)}));var o=(t.onBeforeStart||function(t){}).bind(t);if(n.beforeStart=du(n.beforeStart,(function(t){return o(t)})),n.dragInit=function(e,i){return t.onDragInit(e,i)},n.dragAbort=function(e){return t.onDragAbort(e)},t.useGhostProxy&&(n.useGhostProxy=t.useGhostProxy,n.makeGhostProxy=t.makeGhostProxy),null==n.constrainFunction&&null!=n.containment)switch(n.containment){case Mm.notNegative:n.constrainFunction=function(t,e,i,n){return{x:Math.max(0,Math.min(t.x)),y:Math.max(0,Math.min(t.y))}};break;case Mm.parent:var s=n.containmentPadding||5;n.constrainFunction=function(t,e,i,n){return{x:t.x<0?0:t.x>i.w-s?i.w-s:t.x,y:t.y<0?0:t.y>i.h-s?i.h-s:t.y}};break;case Mm.parentEnclosed:n.constrainFunction=function(t,e,i,n){return{x:t.x<0?0:t.x+n.w>i.w?i.w-n.w:t.x,y:t.y<0?0:t.y+n.h>i.h?i.h-n.h:t.y}}}null==this.drag?(n.trackScroll=this._trackScroll,this.drag=this.collicat.draggable(this.instance.getContainer(),n),Gd(this._filtersToAdd,(function(t){return i.drag.addFilter(t[0],t[1])})),this.drag.on(Hp,(function(t){i.instance.revalidate(t)}))):this.drag.addSelector(n),this.handlers.push({handler:t,options:n}),t.init(this.drag)}},{key:"addSelector",value:function(t,e){this.drag&&this.drag.addSelector(t,e)}},{key:"addFilter",value:function(t,e){null==this.drag?this._filtersToAdd.push([t,!0===e]):this.drag.addFilter(t,e)}},{key:"removeFilter",value:function(t){null!=this.drag&&this.drag.removeFilter(t)}},{key:"setFilters",value:function(t){var e=this;Gd(t,(function(t){e.drag.addFilter(t[0],t[1])}))}},{key:"reset",value:function(){var t=[];if(Gd(this.handlers,(function(t){t.handler.reset()})),this.handlers.length=0,null!=this.drag){var e=this.drag._filters;for(var i in e)t.push([i,e[i][1]]);this.collicat.destroyDraggable(this.instance.getContainer())}return delete this.drag,t}},{key:"setOption",value:function(t,e){var i=Yd(this.handlers,(function(e){return e.handler===t}));null!=i&&Rd(i.options,e||{})}}]),t}();var Fm,qm,Vm,Hm,Um=function(){function t(e,i){wd(this,t),this.instance=e,this._dragSelection=i,Cd(this,"selector","> "+ap+":not("+Tu(Zu)+")"),Cd(this,"_dragOffset",null),Cd(this,"_groupLocations",[]),Cd(this,"_intersectingGroups",[]),Cd(this,"_currentDragParentGroup",null),Cd(this,"_dragGroupByElementIdMap",{}),Cd(this,"_dragGroupMap",{}),Cd(this,"_currentDragGroup",null),Cd(this,"_currentDragGroupOffsets",new Map),Cd(this,"_currentDragGroupSizes",new Map),Cd(this,"_currentDragGroupOriginalPositions",new Map),Cd(this,"_dragPayload",null),Cd(this,"drag",void 0),Cd(this,"originalPosition",void 0)}return Sd(t,[{key:"onDragInit",value:function(t){return null}},{key:"onDragAbort",value:function(t){return null}},{key:"getDropGroup",value:function(){var t=null;if(this._intersectingGroups.length>0){var e=this._intersectingGroups[0].groupLoc.group,i=this._intersectingGroups[0].intersectingElement,n=i._jsPlumbParentGroup;n!==e&&(null!=n&&n.overrideDrop(i,e)||(t=this._intersectingGroups[0]))}return t}},{key:"onStop",value:function(t){var e,i=this,n=t.drag.getDragElement(),o=this.getDropGroup(),s=[];function r(t,e,i,n,r){var a=i.x,l=i.y;if(t._jsPlumbParentGroup&&t._jsPlumbParentGroup.constrain){var c={w:t.parentNode.offsetWidth+t.parentNode.scrollLeft,h:t.parentNode.offsetHeight+t.parentNode.scrollTop};a=Math.max(a,0),l=Math.max(l,0),a=Math.min(a,c.w-n.w),l=Math.min(l,c.h-n.h),i.x=a,i.y=l}s.push({el:t,id:e,pos:i,originalPos:r,originalGroup:t._jsPlumbParentGroup,redrawResult:null,reverted:!1,dropGroup:null==o?void 0:o.groupLoc.group})}if(s.push({el:n,id:this.instance.getId(n),pos:t.finalPos,originalGroup:n._jsPlumbParentGroup,redrawResult:null,originalPos:t.originalPos,reverted:!1,dropGroup:null!=o?o.groupLoc.group:null}),this._dragSelection.each((function(e,i,n,o,s){e!==t.el&&r(e,i,{x:n.x,y:n.y},o,s)})),null===(e=this._currentDragGroup)||void 0===e||e.members.forEach((function(e){if(e.el!==t.el){var n=i._currentDragGroupOffsets.get(e.elId),o=i._currentDragGroupSizes.get(e.elId),s={x:t.finalPos.x+n[0].x,y:t.finalPos.y+n[0].y};r(e.el,e.elId,s,o,i._currentDragGroupOriginalPositions.get(e.elId))}})),Gd(s,(function(t){var e=null!=t.originalGroup,n=e&&dm(i.instance,t.el,t.pos),s={x:0,y:0};if(e&&!n){if(null==o){var r=i._pruneOrOrphan(t,!0,!0);null!=r.pos?t.pos=r.pos.pos:!r.pruned&&t.originalGroup.revert&&(t.pos=t.originalPos,t.reverted=!0)}}else e&&n&&(s=i._computeOffsetByParentGroup(t.originalGroup));null==o||n?t.dropGroup=null:i.instance.groupManager.addToGroup(o.groupLoc.group,!1,t.el),t.reverted&&i.instance.setPosition(t.el,t.pos),t.redrawResult=i.instance.setElementPosition(t.el,t.pos.x+s.x,t.pos.y+s.y),i.instance.removeClass(t.el,"jtk-dragged"),i.instance.select({source:t.el}).removeClass(i.instance.elementDraggingClass+" "+i.instance.sourceElementDraggingClass,!0),i.instance.select({target:t.el}).removeClass(i.instance.elementDraggingClass+" "+i.instance.targetElementDraggingClass,!0)})),null!=s[0].originalGroup){var a=n._jsPlumbParentGroup;if(a!==s[0].originalGroup){var l=t.drag.getDragElement(!0);if(s[0].originalGroup.ghost){var c=this.instance.getPosition(this.instance.getGroupContentArea(a)),h=this.instance.getPosition(this.instance.getGroupContentArea(s[0].originalGroup)),d={x:h.x+t.pos.x-c.x,y:h.y+t.pos.y-c.y};l.style.left=d.x+"px",l.style.top=d.y+"px",this.instance.revalidate(l)}}}this.instance.fire("drag:stop",{elements:s,e:t.e,el:n,payload:this._dragPayload}),this._cleanup()}},{key:"_cleanup",value:function(){var t=this;Gd(this._groupLocations,(function(e){t.instance.removeClass(e.el,Nm),t.instance.removeClass(e.el,Bm)})),this._currentDragParentGroup=null,this._groupLocations.length=0,this.instance.hoverSuspended=!1,this._dragOffset=null,this._dragSelection.reset(),this._dragPayload=null,this._currentDragGroupOffsets.clear(),this._currentDragGroupSizes.clear(),this._currentDragGroupOriginalPositions.clear(),this._currentDragGroup=null}},{key:"reset",value:function(){}},{key:"init",value:function(t){this.drag=t}},{key:"onDrag",value:function(t){var e=this,i=t.drag.getDragElement(),n=this.instance.getId(i),o=t.pos,s=this.instance.viewport.getPosition(n),r={x:o.x,y:o.y};this._intersectingGroups.length=0,null!=this._dragOffset&&(r.x+=this._dragOffset.x,r.y+=this._dragOffset.y);var a=function(i,n,o){if(o){var s=new Set;Gd(e._groupLocations,(function(i){!s.has(i.group.id)&&lm(n,i.r)?(i.group!==e._currentDragParentGroup&&e.instance.addClass(i.el,Bm),e._intersectingGroups.push({groupLoc:i,intersectingElement:t.drag.getDragElement(!0),d:0}),Gd(e.instance.groupManager.getAncestors(i.group),(function(t){return s.add(t.id)}))):e.instance.removeClass(i.el,Bm)}))}e.instance.setElementPosition(i,n.x,n.y),e.instance.fire("drag:move",{el:i,e:t.e,pos:{x:n.x,y:n.y},originalPosition:e.originalPosition,payload:e._dragPayload})},l={x:r.x,y:r.y,w:s.w,h:s.h};a(i,l,!0),this._dragSelection.updatePositions(o,this.originalPosition,(function(t,e,i,n){a(t,n,!1)})),this._currentDragGroupOffsets.forEach((function(t,i){var n=e._currentDragGroupSizes.get(i),o={x:l.x+t[0].x,y:l.y+t[0].y,w:n.w,h:n.h};t[1].style.left=o.x+"px",t[1].style.top=o.y+"px",a(t[1],o,!1)}))}},{key:"_computeOffsetByParentGroup",value:function(t){var e=this.instance.getPosition(t.el),i=t.contentArea;if(i!==t.el){var n=this.instance.getPosition(i);e.x+=n.x,e.y+=n.y}if(t.el._jsPlumbParentGroup){var o=this._computeOffsetByParentGroup(t.el._jsPlumbParentGroup);e.x+=o.x,e.y+=o.y}return e}},{key:"onStart",value:function(t){var e=this,i=t.drag.getDragElement(),n=this.instance.getPosition(i);this.originalPosition={x:t.pos.x,y:t.pos.y},i._jsPlumbParentGroup&&(this._dragOffset=this._computeOffsetByParentGroup(i._jsPlumbParentGroup),this._currentDragParentGroup=i._jsPlumbParentGroup);var o=!0,s=i.getAttribute(Bu);if((!1===this.instance.elementsDraggable||null!=s&&s!==Pf)&&(o=!1),o){this._groupLocations.length=0,this._intersectingGroups.length=0,this.instance.hoverSuspended=!0;var r=t.drag.getDragElement(!0),a=r.querySelectorAll(ap),l=function(t){for(var e=[],i=t._jsPlumbParentGroup;null!=i;)e.push(i.el),i=i.group;return e}(r),c=[];Array.prototype.push.apply(c,a),Array.prototype.push.apply(c,l),this._dragSelection.filterActiveSet((function(t){return-1===c.indexOf(t.jel)})),this._dragSelection.initialisePositions();var h=function(i,n,o){if(!i._isJsPlumbGroup||e.instance.allowNestedGroups){var s=!i._jsPlumbParentGroup,r=s||!0!==i._jsPlumbParentGroup.dropOverride,a=!s&&(i._jsPlumbParentGroup.ghost||!0!==i._jsPlumbParentGroup.constrain);(s||r&&a)&&(Gd(e.instance.groupManager.getGroups(),(function(t){var n=i._jsPlumbGroup;if(!1!==t.droppable&&!1!==t.enabled&&i._jsPlumbGroup!==t&&!e.instance.groupManager.isDescendant(t,n)){var o=t.el,s=e.instance.getId(o),r=e.instance.viewport.getPosition(s),a={el:o,r:{x:r.x,y:r.y,w:r.w,h:r.h},group:t};e._groupLocations.push(a),t!==e._currentDragParentGroup&&e.instance.addClass(o,Nm)}})),e._groupLocations.sort((function(t,i){return e.instance.groupManager.isDescendant(t.group,i.group)?-1:e.instance.groupManager.isAncestor(i.group,t.group)?1:0})))}return e.instance.select({source:i}).addClass(e.instance.elementDraggingClass+" "+e.instance.sourceElementDraggingClass,!0),e.instance.select({target:i}).addClass(e.instance.elementDraggingClass+" "+e.instance.targetElementDraggingClass,!0),e.instance.fire("drag:start",{el:i,e:t.e,originalPosition:e.originalPosition,pos:e.originalPosition,dragGroup:n,dragGroupMemberSpec:o})},d=this.instance.getId(i);this._currentDragGroup=this._dragGroupByElementIdMap[d],this._currentDragGroup&&!function(t,e){var i=Xd(t.members,(function(t){return t.el===e}));return null!==i&&!0===i.active}(this._currentDragGroup,i)&&(this._currentDragGroup=null);var u=h(i);if(!1===u)return this._cleanup(),!1;this._dragPayload=u,null!=this._currentDragGroup&&(this._currentDragGroupOffsets.clear(),this._currentDragGroupSizes.clear(),this._currentDragGroup.members.forEach((function(t){var i=e.instance.viewport.getPosition(t.elId);e._currentDragGroupOffsets.set(t.elId,[{x:i.x-n.x,y:i.y-n.y},t.el]),e._currentDragGroupSizes.set(t.elId,i),e._currentDragGroupOriginalPositions.set(t.elId,{x:i.x,y:i.y}),h(t.el,e._currentDragGroup,t)})))}return o}},{key:"addToDragGroup",value:function(t){var e=this,i=function(t,e){return Bd(e)?{id:e,active:!0}:{id:e.id,active:e.active}}(this.instance,t),n=this._dragGroupMap[i.id];null==n&&(n={id:i.id,members:new Set},this._dragGroupMap[i.id]=n);for(var o=arguments.length,s=new Array(o>1?o-1:0),r=1;r<o;r++)s[r-1]=arguments[r];this.removeFromDragGroup.apply(this,s),Gd(s,(function(t){var o=e.instance.getId(t);n.members.add({elId:o,el:t,active:i.active}),e._dragGroupByElementIdMap[o]=n}))}},{key:"removeFromDragGroup",value:function(){for(var t=this,e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];Gd(i,(function(e){var i=t.instance.getId(e),n=t._dragGroupByElementIdMap[i];if(null!=n){var o=new Set;n.members.forEach((function(t){t.el!==e&&o.add(t)})),n.members=o,delete t._dragGroupByElementIdMap[i]}}))}},{key:"setDragGroupState",value:function(t){for(var e=this,i=arguments.length,n=new Array(i>1?i-1:0),o=1;o<i;o++)n[o-1]=arguments[o];Gd(n.map((function(t){return e.instance.getId(t)})),(function(i){var n=e._dragGroupByElementIdMap[i];if(null!=n){var o=Xd(n.members,(function(t){return t.elId===i}));null!=o&&(o.active=t)}}))}},{key:"clearDragGroup",value:function(t){var e=this,i=this._dragGroupMap[t];null!=i&&(i.members.forEach((function(t){delete e._dragGroupByElementIdMap[t.elId]})),i.members.clear())}},{key:"_pruneOrOrphan",value:function(t,e,i){var n=t.el,o={pruned:!1,pos:null};if(i||!dm(this.instance,n,t.pos)){var s=n._jsPlumbParentGroup;s.prune?(n._isJsPlumbGroup?this.instance.removeGroup(n._jsPlumbGroup):s.remove(t.el,!0),o.pruned=!0):s.orphan&&(o.pos=this.instance.groupManager.orphan(t.el,e),n._isJsPlumbGroup?s.removeGroup(n._jsPlumbGroup):s.remove(t.el))}return o}}]),t}(),Wm={},Gm={},Zm={},Ym={get:function(t,e,i){var n=Wm[e];if(n)return new n(t,i);throw{message:"jsPlumb: unknown endpoint type '"+e+"'"}},clone:function(t){var e=Zm[t.type];return Ym.get(t.endpoint,t.type,e.getParams(t))},compute:function(t,e,i,n){var o=Gm[t.type];if(null!=o)return o(t,e,i,n);cu("jsPlumb: cannot find endpoint calculator for endpoint of type ",t.type)},registerHandler:function(t){Zm[t.type]=t,Wm[t.type]=t.cls,Gm[t.type]=t.compute}},Xm=function(){function t(e,i){wd(this,t),this.endpoint=e,Cd(this,"typeId",void 0),Cd(this,"x",void 0),Cd(this,"y",void 0),Cd(this,"w",void 0),Cd(this,"h",void 0),Cd(this,"computedValue",void 0),Cd(this,"bounds",{xmin:1/0,xmax:-1/0,ymin:1/0,ymax:-1/0}),Cd(this,"classes",[]),Cd(this,"instance",void 0),Cd(this,"type",void 0),i=i||{},this.instance=e.instance,e.cssClass&&this.classes.push(e.cssClass),i.cssClass&&this.classes.push(i.cssClass)}return Sd(t,[{key:"addClass",value:function(t){this.classes.push(t),this.instance.addEndpointClass(this.endpoint,t)}},{key:"removeClass",value:function(t){this.classes=this.classes.filter((function(e){return e!==t})),this.instance.removeEndpointClass(this.endpoint,t)}},{key:"compute",value:function(t,e,i){this.computedValue=Ym.compute(this,t,e,i),this.bounds.xmin=this.x,this.bounds.ymin=this.y,this.bounds.xmax=this.x+this.w,this.bounds.ymax=this.y+this.h}},{key:"setVisible",value:function(t){this.instance.setEndpointVisible(this.endpoint,t)}}]),t}();!function(t){t.top="top",t.left="left",t.right="right",t.bottom="bottom"}(Hm||(Hm={}));var Km=Hm.top,Qm=Hm.left,Jm=Hm.right,tg=Hm.bottom,eg=[Qm,Jm],ig=[Km,tg],ng=function(){function t(e,i,n){wd(this,t),this.instance=e,this.element=i,Cd(this,"isFloating",!0),Cd(this,"isContinuous",void 0),Cd(this,"isDynamic",void 0),Cd(this,"locations",[]),Cd(this,"currentLocation",0),Cd(this,"locked",!1),Cd(this,"cssClass",""),Cd(this,"timestamp",null),Cd(this,"type","Floating"),Cd(this,"id",su()),Cd(this,"orientation",[0,0]),Cd(this,"size",void 0),this.size=e.viewport.getPosition(n),this.locations.push({x:.5,y:.5,ox:this.orientation[0],oy:this.orientation[1],offx:0,offy:0,iox:this.orientation[0],ioy:this.orientation[1],cls:""})}return Sd(t,[{key:"_updateOrientationInRouter",value:function(){this.instance.router.setAnchorOrientation(this,[this.locations[0].ox,this.locations[0].oy])}},{key:"over",value:function(t){this.orientation=this.instance.router.getEndpointOrientation(t),this.locations[0].ox=this.orientation[0],this.locations[0].oy=this.orientation[1],this._updateOrientationInRouter()}},{key:"out",value:function(){this.orientation=null,this.locations[0].ox=this.locations[0].iox,this.locations[0].oy=this.locations[0].ioy,this._updateOrientationInRouter()}}]),t}(),og=(Cd(Fm={},Km,tg),Cd(Fm,Jm,Qm),Cd(Fm,Qm,Jm),Cd(Fm,tg,Km),Fm),sg=(Cd(qm={},Km,Jm),Cd(qm,Jm,tg),Cd(qm,Qm,Km),Cd(qm,tg,Qm),qm),rg=(Cd(Vm={},Km,Qm),Cd(Vm,Jm,Km),Cd(Vm,Qm,tg),Cd(Vm,tg,Jm),Vm);function ag(t){return 0===t.faces.length?Km:t.faces[0]}function lg(t,e){return-1!==t.faces.indexOf(e)}function cg(t,e){return null==t.lockedAxis?null==t.lockedFace?!0===lg(t,e):t.lockedFace===e:-1!==t.lockedAxis.indexOf(e)}function hg(t,e){if(lg(t,e))return e;if(lg(t,og[e]))return og[e];var i=function(t,e){return(t.clockwise?sg:rg)[e]}(t,e);if(lg(t,i))return i;var n=function(t,e){return(t.clockwise?rg:sg)[e]}(t,e);return lg(t,n)?n:e}var dg={x:.5,y:0,ox:0,oy:-1,offx:0,offy:0},ug={x:.5,y:1,ox:0,oy:1,offx:0,offy:0},pg={x:0,y:.5,ox:-1,oy:0,offx:0,offy:0},fg={x:1,y:.5,ox:1,oy:0,offx:0,offy:0},mg={Top:[dg],Bottom:[ug],Left:[pg],Right:[fg],TopLeft:[{x:0,y:0,ox:0,oy:-1,offx:0,offy:0}],TopRight:[{x:1,y:0,ox:1,oy:-1,offx:0,offy:0}],BottomLeft:[{x:0,y:1,ox:0,oy:1,offx:0,offy:0}],BottomRight:[{x:1,y:1,ox:0,oy:1,offx:0,offy:0}],Center:[{x:.5,y:.5,ox:0,oy:0,offx:0,offy:0}],AutoDefault:[dg,pg,ug,fg]},gg={Continuous:{faces:[Km,Qm,tg,Jm]},ContinuousTop:{faces:[Km]},ContinuousRight:{faces:[Jm]},ContinuousBottom:{faces:[tg]},ContinuousLeft:{faces:[Qm]},ContinuousLeftRight:{faces:[Qm,Jm]},ContinuousTopBottom:{faces:[Km,tg]}};function vg(t,e){if(e=e||{},t===Cp.Perimeter)return function(t){t=t||{};var e=t.anchorCount||60,i=t.shape;if(!i)throw new Error("no shape supplied to Perimeter Anchor type");if(!Cg.has(i))throw new Error("Shape ["+i+"] is unknown by Perimeter Anchor type");var n=Cg.get(i)(e);t.rotation&&(n=function(t,e){for(var i=[],n=e/180*Math.PI,o=0;o<t.length;o++){var s=t[o].x-.5,r=t[o].y-.5;i.push({x:s*Math.cos(n)-r*Math.sin(n)+.5,y:s*Math.sin(n)+r*Math.cos(n)+.5,ox:t[o].ox,oy:t[o].oy,offx:0,offy:0,iox:0,ioy:0,cls:""})}return i}(n,t.rotation));var o=yg(Cp.Perimeter,n,t),s=Rd(o,{shape:i});return s}(e);var i=mg[t];if(null!=i)return yg(t,lu(i,(function(t){return Rd({iox:t.ox,ioy:t.oy},t)})),e);if(null!=(i=gg[t]))return function(t,e,i){var n={type:t,locations:[],currentLocation:0,locked:!1,id:su(),cssClass:i.cssClass||"",isFloating:!1,isContinuous:!0,timestamp:null,faces:i.faces||e,lockedFace:null,lockedAxis:null,clockwise:!(!1===i.clockwise),__currentFace:null};return Object.defineProperty(n,bg,{get:function(){return this.__currentFace},set:function(t){this.__currentFace=hg(this,t)}}),n}(t,i.faces,e);throw{message:"jsPlumb: unknown anchor type '"+t+"'"}}function yg(t,e,i){return{type:t,locations:e,currentLocation:0,locked:!1,id:su(),isFloating:!1,isContinuous:!1,isDynamic:e.length>1,timestamp:null,cssClass:i.cssClass||""}}var bg="currentFace";function xg(t){return t.length<7&&t.every(Nd)||7===t.length&&t.slice(0,5).every(Nd)&&Bd(t[6])}function _g(t){if(Bd(t))return vg(t,null);if(Array.isArray(t)){if(xg(t)){var e=t;return yg(null,[{x:e[0],y:e[1],ox:e[2],oy:e[3],offx:null==e[4]?0:e[4],offy:null==e[5]?0:e[5],iox:e[2],ioy:e[3],cls:e[6]||""}],{cssClass:e[6]||""})}var i=lu(t,(function(t){if(Bd(t)){var e=mg[t];return null!=e?Rd({iox:e[0].ox,ioy:e[0].oy,cls:""},e[0]):null}if(xg(t))return{x:t[0],y:t[1],ox:t[2],oy:t[3],offx:null==t[4]?0:t[4],offy:null==t[5]?0:t[5],iox:t[2],ioy:t[3],cls:t[6]||""}})).filter((function(t){return null!=t}));return yg("Dynamic",i,{})}var n=t;return vg(n.type,n.options)}function wg(t){for(var e=.5,i=2*Math.PI/t,n=[],o=0,s=0;s<t;s++){var r=e+e*Math.sin(o),a=e+e*Math.cos(o);n.push({x:r,y:a,ox:0,oy:0,offx:0,offy:0,iox:0,ioy:0,cls:""}),o+=i}return n}function kg(t,e){for(var i=[],n=0;n<t.length;n++)i.push([t[n][0],t[n][1],t[n][2],t[n][3],1/t.length,t[n][4],t[n][5]]);return function(t,e){for(var i=e/t.length,n=[],o=function(t,o,s,r,a,l,c){for(var h=(s-t)/(i=e*a),d=(r-o)/i,u=0;u<i;u++)n.push({x:t+h*u,y:o+d*u,ox:null==l?0:l,oy:null==c?0:c,offx:0,offy:0,iox:0,ioy:0,cls:""})},s=0;s<t.length;s++)o.apply(null,t[s]);return n}(i,e)}function Sg(t){return kg([[0,0,1,0,0,-1],[1,0,1,1,1,0],[1,1,0,1,0,1],[0,1,0,0,-1,0]],t)}var Cg=new Map;Cg.set(Sp.Circle,wg),Cg.set(Sp.Ellipse,wg),Cg.set(Sp.Rectangle,Sg),Cg.set(Sp.Square,Sg),Cg.set(Sp.Diamond,(function(t){return kg([[.5,0,1,.5],[1,.5,.5,1],[.5,1,0,.5],[0,.5,.5,0]],t)})),Cg.set(Sp.Triangle,(function(t){return kg([[.5,0,1,1],[1,1,0,1],[0,1,.5,0]],t)}));var Eg=function(){function t(e,i){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];wd(this,t),this.selector=e,this.def=i,this.exclude=n,Cd(this,"id",void 0),Cd(this,"redrop",void 0),this.id=su(),this.redrop=i.def.redrop||Ag}return Sd(t,[{key:"setEnabled",value:function(t){this.def.enabled=t}},{key:"isEnabled",value:function(){return!1!==this.def.enabled}}]),t}(),Ag="strict";function Mg(t,e,i,n,o,s){var r=function(t,e,i){return new ng(t,e,i)}(s,n,o),a={paintStyle:t.getPaintStyle(),preparedAnchor:r,element:n,scope:t.scope,cssClass:[Uu,t.cssClass].join(" ")};null!=e&&(pu(e,Xm)?a.existingEndpoint=e:a.endpoint=e);var l=s._internal_newEndpoint(a);return s._paintEndpoint(l,{}),l}function Tg(t,e,i,n,o){for(var s=t.target||t.srcElement,r=!1,a=n.getSelector(e,i),l=0;l<a.length;l++)if(a[l]===s){r=!0;break}return o?!r:r}var Pg=Tu(Nm,Bm),Og="sourceSelectorEndpoint",Dg=function(){function t(e){wd(this,t),this.instance=e,Cd(this,"jpc",void 0),Cd(this,"existingJpc",void 0),Cd(this,"_originalAnchorSpec",void 0),Cd(this,"ep",void 0),Cd(this,"endpointRepresentation",void 0),Cd(this,"canvasElement",void 0),Cd(this,"_activeDefinition",void 0),Cd(this,"placeholderInfo",{id:null,element:null}),Cd(this,"floatingIndex",void 0),Cd(this,"floatingId",void 0),Cd(this,"floatingElement",void 0),Cd(this,"floatingEndpoint",void 0),Cd(this,"floatingAnchor",void 0),Cd(this,"_stopped",void 0),Cd(this,"inPlaceCopy",void 0),Cd(this,"endpointDropTargets",[]),Cd(this,"currentDropTarget",null),Cd(this,"payload",void 0),Cd(this,"floatingConnections",{}),Cd(this,"_forceReattach",void 0),Cd(this,"_forceDetach",void 0),Cd(this,"mousedownHandler",void 0),Cd(this,"mouseupHandler",void 0),Cd(this,"selector",Tu(Hu));var i=e.getContainer();this.mousedownHandler=this._mousedownHandler.bind(this),this.mouseupHandler=this._mouseupHandler.bind(this),e.on(i,zp,ap,this.mousedownHandler),e.on(i,jp,[ap,Tu(Hu)].join(","),this.mouseupHandler)}return Sd(t,[{key:"_resolveDragParent",value:function(t,e){var i=this.instance.getContainer(),n=gu(e,ap,i,!0);if(null!=t.parentSelector){var o=gu(e,t.parentSelector,i,!0);return null!=o&&(n=gu(o.parentNode,ap,i,!1)),o||n}return n}},{key:"_mousedownHandler",value:function(t){var e,i;if(3!==t.which&&2!==t.button){var n=t.target||t.srcElement;if((null==(i=this._getSourceDefinition(t))||null!=(e=this._resolveDragParent(i.def.def,n))&&e.getAttribute(Ap)!==Pf)&&i){var o,s=t.currentTarget;if(n.getAttribute(Ap)!==Pf){if(mu(t),this._activeDefinition=i,null!=(o=i.def.def).canAcceptNewConnection&&!o.canAcceptNewConnection(e,t))return!1;var r=ty(t,e,this.instance.currentZoom),a={element:e};if(Rd(a,o),a.isTemporarySource=!0,o.scope)a.scope=o.scope;else{var l=n.getAttribute(Mp);null!=l&&(a.scope=l)}if(null!=(a=Hd(a,o.parameterExtractor?o.parameterExtractor(e,n,t):{})).maxConnections&&a.maxConnections>=0)if(this.instance.select({source:e}).length>=a.maxConnections)return mu(t),o.onMaxConnections&&o.onMaxConnections({element:e,maxConnections:a.maxConnections},t),t.stopImmediatePropagation&&t.stopImmediatePropagation(),!1;if(o.anchorPositionFinder){var c=o.anchorPositionFinder(e,r,o,t);null!=c&&(a.anchor=c)}this._originalAnchorSpec=a.anchor||(this.instance.areDefaultAnchorsSet()?this.instance.defaults.anchors[0]:this.instance.defaults.anchor);var h=this.instance.router.prepareAnchor(this._originalAnchorSpec),d=[r.x,r.y,0,0];if(h.locations.length>0)d[2]=h.locations[0].ox,d[3]=h.locations[0].oy;else if(h.isContinuous){var u=r.x<.5?r.x:1-r.x,p=r.y<.5?r.y:1-r.y;d[2]=u<p?r.x<.5?-1:1:0,d[3]=p<u?r.y<.5?-1:1:0}a.anchor=d,a.deleteOnEmpty=!0,this.ep=this.instance._internal_newEndpoint(a);var f={};if(o.extract){for(var m in o.extract){var g=n.getAttribute(m);g&&(f[o.extract[m]]=g)}this.ep.mergeParameters(f)}if(a.uniqueEndpoint){var v=this.ep.elementId,y=this.instance.getManagedData(v,Og,i.id);null==y?(this.instance.setManagedData(v,Og,i.id,this.ep),this.ep.deleteOnEmpty=!1):this.ep.finalEndpoint=y}s._jsPlumbOrphanedEndpoints=s._jsPlumbOrphanedEndpoints||[],s._jsPlumbOrphanedEndpoints.push(this.ep),this.instance.trigger(this.ep.endpoint.canvas,zp,t,f)}}}}},{key:"_mouseupHandler",value:function(t){var e=t.currentTarget||t.srcElement;e._jsPlumbOrphanedEndpoints&&(!function(t,e){t=null==t.length||"string"==typeof t?[t]:t;for(var i=0;i<t.length;i++)e(t[i])}(e._jsPlumbOrphanedEndpoints,this.instance._maybePruneEndpoint.bind(this.instance)),e._jsPlumbOrphanedEndpoints.length=0),this._activeDefinition=null}},{key:"onDragInit",value:function(t){var e=Eu(t,this.instance),i=Au(t,this.instance);return this._makeDraggablePlaceholder(e,i),this.placeholderInfo.element.jtk=t.jtk,this.placeholderInfo.element}},{key:"onDragAbort",value:function(t){this._cleanupDraggablePlaceholder()}},{key:"_makeDraggablePlaceholder",value:function(t,e){this.placeholderInfo=this.placeholderInfo||{};var i=ku("div",{position:"absolute"});this.instance._appendElementToContainer(i);var n=this.instance.getId(i);return this.instance.setPosition(i,t),i.style.width=e.w+"px",i.style.height=e.h+"px",this.instance.manage(i),this.placeholderInfo.id=n,this.placeholderInfo.element=i,i}},{key:"_cleanupDraggablePlaceholder",value:function(){this.placeholderInfo.element&&(this.instance.unmanage(this.placeholderInfo.element,!0),delete this.placeholderInfo.element,delete this.placeholderInfo.id)}},{key:"reset",value:function(){var t=this.instance.getContainer();this.instance.off(t,jp,this.mouseupHandler),this.instance.off(t,zp,this.mousedownHandler)}},{key:"init",value:function(t){}},{key:"startNewConnectionDrag",value:function(t,e){this.jpc=this.instance._newConnection({sourceEndpoint:this.ep,targetEndpoint:this.floatingEndpoint,source:this.ep.element,target:this.placeholderInfo.element,paintStyle:this.ep.connectorStyle,hoverPaintStyle:this.ep.connectorHoverStyle,connector:this.ep.connector,overlays:this.ep.connectorOverlays,type:this.ep.edgeType,cssClass:this.ep.connectorClass,hoverClass:this.ep.connectorHoverClass,scope:t,data:e}),this.jpc.pending=!0,this.jpc.addClass(this.instance.draggingClass),this.ep.addClass(this.instance.draggingClass),this.instance.fire(Up,this.jpc)}},{key:"startExistingConnectionDrag",value:function(){this.existingJpc=!0,this.instance.setHover(this.jpc,!1);var t=this.jpc.endpoints[0].id===this.ep.id?0:1;this.ep.detachFromConnection(this.jpc,null,!0),this.floatingEndpoint.addConnection(this.jpc),this.instance.fire(Up,this.jpc),this.instance.sourceOrTargetChanged(this.jpc.endpoints[t].elementId,this.placeholderInfo.id,this.jpc,this.placeholderInfo.element,t),this.jpc.suspendedEndpoint=this.jpc.endpoints[t],this.jpc.suspendedElement=this.jpc.endpoints[t].element,this.jpc.suspendedElementId=this.jpc.endpoints[t].elementId,this.jpc.suspendedElementType=0===t?Ou:Du,this.instance.setHover(this.jpc.suspendedEndpoint,!1),this.floatingEndpoint.referenceEndpoint=this.jpc.suspendedEndpoint,this.floatingEndpoint.mergeParameters(this.jpc.suspendedEndpoint.parameters),this.jpc.endpoints[t]=this.floatingEndpoint,this.jpc.addClass(this.instance.draggingClass),this.floatingId=this.placeholderInfo.id,this.floatingIndex=t,this.instance._refreshEndpoint(this.ep)}},{key:"_shouldStartDrag",value:function(){var t=!0;this.ep.enabled||(t=!1),null!=this.jpc||this.ep.isSource||this.ep.isTemporarySource||(t=!1),!this.ep.isSource||!this.ep.isFull()||null!=this.jpc&&this.ep.dragAllowedWhenFull||(t=!1),null==this.jpc||this.jpc.isDetachable(this.ep)||(this.ep.isFull()?t=!1:this.jpc=null);var e={},i=this.instance.checkCondition(null==this.jpc?"beforeDrag":"beforeStartDetach",{endpoint:this.ep,source:this.ep.element,sourceId:this.ep.elementId,connection:this.jpc});return!1===i?t=!1:"object"===_d(i)?Rd(e=i,this.payload||{}):e=this.payload||{},[t,e]}},{key:"_createFloatingEndpoint",value:function(t){var e=this.ep.endpoint;null!=this.ep.edgeType&&(e=this.instance._deriveEndpointAndAnchorSpec(this.ep.edgeType).endpoints[1]);this.floatingEndpoint=Mg(this.ep,e,0,this.placeholderInfo.element,this.placeholderInfo.id,this.instance),this.floatingAnchor=this.floatingEndpoint._anchor,this.floatingEndpoint.deleteOnEmpty=!0,this.floatingElement=this.floatingEndpoint.endpoint.canvas,this.floatingId=this.instance.getId(this.floatingElement)}},{key:"_populateTargets",value:function(t,e){var i,n=this,o=this.jpc&&this.jpc.endpoints[0]===this.ep;if(Gd(this.instance.getContainer().querySelectorAll([".",Hu,"[",Fu,this.ep.scope,"]:not(.",Uu,")"].join("")),(function(e){if(!(null==n.jpc&&e===t||e===n.floatingElement||null==n.jpc&&e.jtk.endpoint.isFull())&&(o&&e.jtk.endpoint.isSource||!o&&e.jtk.endpoint.isTarget)){var s=Eu(e,n.instance),r=Au(e,n.instance);i={x:s.x,y:s.y,w:r.w,h:r.h},n.endpointDropTargets.push({el:e,targetEl:e,r:i,endpoint:e.jtk.endpoint,def:null}),n.instance.addClass(e,Nm)}})),o){var s=Yd(this.instance.sourceSelectors,(function(t){return t.isEnabled()&&(null==t.def.def.scope||t.def.def.scope===n.ep.scope)}));if(null!=s)Gd(this._findTargetZones(s),(function(t){if(t.getAttribute(Ap)!==Pf){var e=t.getAttribute(Mp);if(null!=e&&e!==n.ep.scope)return;var i={r:null,el:t};i.targetEl=gu(t,ap,n.instance.getContainer(),!0);var o=Eu(i.el,n.instance),r=Au(i.el,n.instance);i.r={x:o.x,y:o.y,w:r.w,h:r.h},null!=s.def.def.rank&&(i.rank=s.def.def.rank),i.def=s.def,n.endpointDropTargets.push(i),n.instance.addClass(i.targetEl,Nm)}}))}else{var r=function(t,e){var i=function(t,e){var i=[];if(t)for(var n=0;n<t.length;n++)e(t[n])&&i.push(n);return i}(t,e);return i.map((function(e){return t[e]}))}(this.instance.targetSelectors,(function(t){return t.isEnabled()}));r.forEach((function(t){Gd(n._findTargetZones(t),(function(i){if(i.getAttribute(Ap)!==Pf){var o=i.getAttribute(Mp);if(null!=o&&o!==n.ep.scope)return;var s={r:null,el:i};if(null!=t.def.def.parentSelector&&(s.targetEl=gu(i,t.def.def.parentSelector,n.instance.getContainer(),!0)),null==s.targetEl&&(s.targetEl=gu(i,ap,n.instance.getContainer(),!0)),(!1===t.def.def.allowLoopback||n._activeDefinition&&!1===n._activeDefinition.def.def.allowLoopback)&&s.targetEl===n.ep.element)return;if(null!=t.def.def.canAcceptNewConnection&&!t.def.def.canAcceptNewConnection(s.targetEl,e))return;var r=t.def.def.maxConnections;if(null!=r&&-1!==r&&n.instance.select({target:s.targetEl}).length>=r)return;var a=Eu(i,n.instance),l=Au(i,n.instance);s.r={x:a.x,y:a.y,w:l.w,h:l.h},s.def=t.def,null!=t.def.def.rank&&(s.rank=t.def.def.rank),n.endpointDropTargets.push(s),n.instance.addClass(s.targetEl,Nm)}}))}))}this.endpointDropTargets.sort((function(t,e){if(t.targetEl._isJsPlumbGroup&&!e.targetEl._isJsPlumbGroup)return 1;if(!t.targetEl._isJsPlumbGroup&&e.targetEl._isJsPlumbGroup)return-1;if(t.targetEl._isJsPlumbGroup&&e.targetEl._isJsPlumbGroup){if(n.instance.groupManager.isAncestor(t.targetEl._jsPlumbGroup,e.targetEl._jsPlumbGroup))return-1;if(n.instance.groupManager.isAncestor(e.targetEl._jsPlumbGroup,t.targetEl._jsPlumbGroup))return 1}else{if(null==t.rank||null==e.rank)return 0;if(t.rank>e.rank)return-1;if(t.rank<e.rank)return 1}}))}},{key:"_findTargetZones",value:function(t){var e;if("any"===t.redrop){var i=this.instance.targetSelectors.map((function(t){return t.selector}));i.push.apply(i,Id(this.instance.sourceSelectors.map((function(t){return t.selector})))),i.push(ap),e=i.join(",")}else if(t.redrop===Ag)e=t.selector;else if("anySource"===t.redrop)e=this.instance.sourceSelectors.map((function(t){return t.selector})).join(",");else if("anyTarget"===t.redrop)e=this.instance.targetSelectors.map((function(t){return t.selector})).join(",");else if("anySourceOrTarget"===t.redrop){var n=this.instance.targetSelectors.map((function(t){return t.selector}));n.push.apply(n,Id(this.instance.sourceSelectors.map((function(t){return t.selector})))),e=n.join(",")}return this.instance.getContainer().querySelectorAll(e)}},{key:"onStart",value:function(t){this.endpointDropTargets.length=0,this.currentDropTarget=null,this._stopped=!1;var e=t.drag.getDragElement();if(this.ep=e.jtk.endpoint,!this.ep)return!1;this.endpointRepresentation=this.ep.endpoint,this.canvasElement=this.endpointRepresentation.canvas,this.jpc=this.ep.connectorSelector();var i=Dd(this._shouldStartDrag(),2),n=i[0],o=i[1];if(!1===n)return this._stopped=!0,!1;this.instance.setHover(this.ep,!1),this.instance.isConnectionBeingDragged=!0,this.jpc&&!this.ep.isFull()&&this.ep.isSource&&(this.jpc=null),this._createFloatingEndpoint(this.canvasElement),this._populateTargets(this.canvasElement,t.e),null==this.jpc?this.startNewConnectionDrag(this.ep.scope,o):this.startExistingConnectionDrag(),this._registerFloatingConnection(this.placeholderInfo,this.jpc),this.instance.currentlyDragging=!0}},{key:"onBeforeStart",value:function(t){this.payload=t.e.payload||{}}},{key:"onDrag",value:function(t){if(this._stopped)return!0;if(this.placeholderInfo.element){var e=Au(this.floatingElement,this.instance);this.instance.setElementPosition(this.placeholderInfo.element,t.pos.x,t.pos.y);for(var i,n,o={x:t.pos.x,y:t.pos.y,w:e.w,h:e.h},s=0;s<this.endpointDropTargets.length;s++)if(lm(o,this.endpointDropTargets[s].r)){i=this.endpointDropTargets[s];break}if(i!==this.currentDropTarget&&null!=this.currentDropTarget&&(n=this._getFloatingAnchorIndex(),this.instance.removeClass(this.currentDropTarget.el,Bm),this.currentDropTarget.endpoint&&(this.currentDropTarget.endpoint.endpoint.removeClass(this.instance.endpointDropAllowedClass),this.currentDropTarget.endpoint.endpoint.removeClass(this.instance.endpointDropForbiddenClass)),this.floatingAnchor.out()),null!=i)if(this.instance.addClass(i.el,Bm),n=this._getFloatingAnchorIndex(),null!=i.endpoint)if(i.endpoint.isSource&&0===n||i.endpoint.isTarget&&0!==n||this.jpc.suspendedEndpoint&&i.endpoint.referenceEndpoint&&i.endpoint.referenceEndpoint.id===this.jpc.suspendedEndpoint.id)this.instance.checkCondition("checkDropAllowed",{sourceEndpoint:this.jpc.endpoints[n],targetEndpoint:i.endpoint.endpoint,connection:this.jpc})?(i.endpoint.endpoint.addClass(this.instance.endpointDropAllowedClass),i.endpoint.endpoint.removeClass(this.instance.endpointDropForbiddenClass)):(i.endpoint.endpoint.removeClass(this.instance.endpointDropAllowedClass),i.endpoint.endpoint.addClass(this.instance.endpointDropForbiddenClass)),this.floatingAnchor.over(i.endpoint),this.instance._paintConnection(this.jpc);else i=null;this.currentDropTarget=i}}},{key:"_maybeCleanup",value:function(t){t._mtNew&&0===t.connections.length?this.instance.deleteEndpoint(t):delete t._mtNew}},{key:"_reattachOrDiscard",value:function(t){var e=null!=this.jpc.suspendedEndpoint,i=this._getFloatingAnchorIndex();return e&&this._shouldReattach()?(0===i?(this.jpc.source=this.jpc.suspendedElement,this.jpc.sourceId=this.jpc.suspendedElementId):(this.jpc.target=this.jpc.suspendedElement,this.jpc.targetId=this.jpc.suspendedElementId),this._doForceReattach(i),!0):(this._discard(i,t),!1)}},{key:"onStop",value:function(t){var e=this,i=t.e;this.instance.isConnectionBeingDragged=!1,this.instance.currentlyDragging=!1;var n=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return e.join(" ")}(Bm,Nm);if(Gd(this.instance.getContainer().querySelectorAll(Pg),(function(t){e.instance.removeClass(t,n)})),this.jpc&&null!=this.jpc.endpoints){var o,s=null!=this.jpc.suspendedEndpoint,r=this._getFloatingAnchorIndex(),a=this.jpc.suspendedEndpoint;if(null!=this.currentDropTarget)if(null==(o=this._getDropEndpoint(t,this.jpc)))this._reattachOrDiscard(t.e);else if(a&&a.id===o.id)this._doForceReattach(r);else if(o.enabled)if(o.isFull())o.fire(ep,{endpoint:this,connection:this.jpc,maxConnections:this.instance.defaults.maxConnections},i),this._reattachOrDiscard(t.e);else{0===r?(this.jpc.source=o.element,this.jpc.sourceId=o.elementId):(this.jpc.target=o.element,this.jpc.targetId=o.elementId);var l=!0;s&&this.jpc.suspendedEndpoint.id!==o.id&&(this.jpc.isDetachAllowed(this.jpc)&&this.jpc.endpoints[r].isDetachAllowed(this.jpc)&&this.jpc.suspendedEndpoint.isDetachAllowed(this.jpc)&&this.instance.checkCondition("beforeDetach",this.jpc)||(l=!1)),(l=l&&o.isDropAllowed(this.jpc.sourceId,this.jpc.targetId,this.jpc.scope,this.jpc,o))?this._drop(o,r,i,l):this._reattachOrDiscard(t.e)}else this._reattachOrDiscard(t.e);else this._reattachOrDiscard(t.e);this.instance._refreshEndpoint(this.ep),this.ep.removeClass(this.instance.draggingClass),this._cleanupDraggablePlaceholder(),this.jpc.removeClass(this.instance.draggingClass),delete this.jpc.suspendedEndpoint,delete this.jpc.suspendedElement,delete this.jpc.suspendedElementType,delete this.jpc.suspendedElementId,delete this.jpc.suspendedIndex,delete this.floatingId,delete this.floatingIndex,delete this.floatingElement,delete this.floatingEndpoint,delete this.floatingAnchor,delete this.jpc.pending,null!=o&&this._maybeCleanup(o)}}},{key:"_getSourceDefinition",value:function(t){for(var e,i=this.instance.getContainer(),n=0;n<this.instance.sourceSelectors.length;n++){if((e=this.instance.sourceSelectors[n]).isEnabled())if(!1!==Tg(t,i,e.selector,this.instance,e.exclude))return e}}},{key:"_getDropEndpoint",value:function(t,e){var i;if(null==this.currentDropTarget.endpoint){var n=this.currentDropTarget.def,o=t.e.target||t.e.srcElement;if(null==n)return null;var s=this.currentDropTarget.targetEl,r=ty(t.e,s,this.instance.currentZoom),a=this.instance._deriveEndpointAndAnchorSpec(e.getType().join(" "),!0),l=a.endpoints?Rd(t,{endpoint:n.def.endpoint||a.endpoints[1],cssClass:n.def.cssClass||"",source:!0===n.def.source,target:!0===n.def.target}):t,c=this.instance.validAnchorsSpec(a.anchors)?a.anchors:this.instance.areDefaultAnchorsSet()?this.instance.defaults.anchors:null,h=n.def.anchor,d=n.def.anchorPositionFinder?n.def.anchorPositionFinder(s,r,n.def,t.e):null,u=null!=d?d:null!=h?h:null!=c&&null!=c[1]?c[1]:null;if(null!=u&&(l=Rd(l,{anchor:u})),null!=n.def.portId&&(l.portId=n.def.portId),(l=Hd(l,n.def.parameterExtractor?n.def.parameterExtractor(this.currentDropTarget.el,o,t.e):{})).element=s,(i=this.instance._internal_newEndpoint(l))._mtNew=!0,i.deleteOnEmpty=!0,n.def.parameters&&i.mergeParameters(n.def.parameters),n.def.extract){var p={};for(var f in n.def.extract){var m=this.currentDropTarget.el.getAttribute(f);m&&(p[n.def.extract[f]]=m)}i.mergeParameters(p)}}else i=this.currentDropTarget.endpoint;return i&&(i.removeClass(this.instance.endpointDropAllowedClass),i.removeClass(this.instance.endpointDropForbiddenClass)),i}},{key:"_doForceReattach",value:function(t){this.floatingEndpoint.detachFromConnection(this.jpc,null,!0),this.jpc.endpoints[t]=this.jpc.suspendedEndpoint,this.instance.setHover(this.jpc,!1),this.jpc._forceDetach=!0,this.jpc.suspendedEndpoint.addConnection(this.jpc),this.instance.sourceOrTargetChanged(this.floatingId,this.jpc.suspendedEndpoint.elementId,this.jpc,this.jpc.suspendedEndpoint.element,t),this.instance.deleteEndpoint(this.floatingEndpoint),this.instance.repaint(this.jpc.source),delete this.jpc._forceDetach}},{key:"_shouldReattach",value:function(){if(this.jpc.isReattach()||this.jpc._forceReattach)return!0;var t=this.jpc.suspendedEndpoint,e=this.jpc.suspendedElementType==Ou?1:0,i=this.jpc.endpoints[e];return!Ud(!0,!1,[[t,op,[this.jpc]],[i,op,[this.jpc]],[this.jpc,op,[this.jpc]],[this.instance,qu,[rp,this.jpc]]])}},{key:"_discard",value:function(t,e){this.jpc.pending?this.instance.fire("connection:abort",this.jpc,e):(0===t?(this.jpc.source=this.jpc.suspendedEndpoint.element,this.jpc.sourceId=this.jpc.suspendedEndpoint.elementId):(this.jpc.target=this.jpc.suspendedEndpoint.element,this.jpc.targetId=this.jpc.suspendedEndpoint.elementId),this.jpc.endpoints[t]=this.jpc.suspendedEndpoint),this.floatingEndpoint&&this.floatingEndpoint.detachFromConnection(this.jpc),this.instance.deleteConnection(this.jpc,{originalEvent:e,force:!0})}},{key:"_drop",value:function(t,e,i,n){if(this.jpc.endpoints[e].detachFromConnection(this.jpc),this.jpc.suspendedEndpoint&&this.jpc.suspendedEndpoint.detachFromConnection(this.jpc),this.jpc.endpoints[e]=t,t.addConnection(this.jpc),this.jpc.suspendedEndpoint){var o=this.jpc.suspendedEndpoint.elementId;this.instance.fireMoveEvent({index:e,originalSourceId:0===e?o:this.jpc.sourceId,newSourceId:0===e?t.elementId:this.jpc.sourceId,originalTargetId:1===e?o:this.jpc.targetId,newTargetId:1===e?t.elementId:this.jpc.targetId,originalEndpoint:this.jpc.suspendedEndpoint,connection:this.jpc,newEndpoint:t},i)}(1===e?this.instance.sourceOrTargetChanged(this.floatingId,this.jpc.targetId,this.jpc,this.jpc.target,1):this.instance.sourceOrTargetChanged(this.floatingId,this.jpc.sourceId,this.jpc,this.jpc.source,0),this.jpc.endpoints[0].finalEndpoint)&&(this.jpc.endpoints[0].detachFromConnection(this.jpc),this.jpc.endpoints[0]=this.jpc.endpoints[0].finalEndpoint,this.jpc.endpoints[0].addConnection(this.jpc));Fd(n)&&this.jpc.mergeData(n),this._originalAnchorSpec&&(this.jpc.endpoints[0].setAnchor(this._originalAnchorSpec),this._originalAnchorSpec=null),this.instance._finaliseConnection(this.jpc,null,i),this.instance.setHover(this.jpc,!1),this.instance.revalidate(this.jpc.endpoints[0].element)}},{key:"_registerFloatingConnection",value:function(t,e){this.floatingConnections[t.id]=e}},{key:"_getFloatingAnchorIndex",value:function(){return null==this.floatingIndex?1:this.floatingIndex}}]),t}(),Ig=function(t){Ed(i,t);var e=Pd(i);function i(t,n){var o;return wd(this,i),(o=e.call(this,t,n)).instance=t,o.dragSelection=n,Cd(Td(o),"selector",[">",_f,ap].join(" ")),Cd(Td(o),"doRevalidate",void 0),o.doRevalidate=o._revalidate.bind(Td(o)),o}return Sd(i,[{key:"reset",value:function(){this.drag.off(Hp,this.doRevalidate)}},{key:"_revalidate",value:function(t){this.instance.revalidate(t)}},{key:"init",value:function(t){this.drag=t,t.on(Hp,this.doRevalidate)}},{key:"useGhostProxy",value:function(t,e){var i=e._jsPlumbParentGroup;return null!=i&&!0===i.ghost}},{key:"makeGhostProxy",value:function(t){var e=t,i=e.cloneNode(!0);return i._jsPlumbParentGroup=e._jsPlumbParentGroup,i}}]),i}(Um),Lg=function(){function t(e,i){wd(this,t),this.instance=e,this.overlay=i,Cd(this,"htmlElementOverlay",void 0),this.htmlElementOverlay=i}return Sd(t,null,[{key:"getElement",value:function(t,e,i){if(null==t.canvas){if(i&&e){t.canvas=i(e);var n=t.instance.overlayClass+" "+(t.cssClass?t.cssClass:"");t.instance.addClass(t.canvas,n)}else t.canvas=ku("div",{},t.instance.overlayClass+" "+(t.cssClass?t.cssClass:""));for(var o in t.instance.setAttribute(t.canvas,"jtk-overlay-id",t.id),t.attributes)t.instance.setAttribute(t.canvas,o,t.attributes[o]);t.canvas.style.position=$u,t.instance._appendElement(t.canvas,t.instance.getContainer()),t.instance.getId(t.canvas);var s="translate(-50%, -50%)";t.canvas.style.webkitTransform=s,t.canvas.style.mozTransform=s,t.canvas.style.msTransform=s,t.canvas.style.oTransform=s,t.canvas.style.transform=s,t.isVisible()||(t.canvas.style.display=Lu),t.canvas.jtk={overlay:t}}return t.canvas}},{key:"destroy",value:function(t){t.canvas&&t.canvas.parentNode&&t.canvas.parentNode.removeChild(t.canvas),delete t.canvas,delete t.cachedDimensions}},{key:"_getDimensions",value:function(t,e){return(null==t.cachedDimensions||e)&&(t.cachedDimensions={w:1,h:1}),t.cachedDimensions}}]),t}(),$g=function(){function t(){wd(this,t),Cd(this,"_listeners",{}),Cd(this,"eventsSuspended",!1),Cd(this,"tick",!1),Cd(this,"eventsToDieOn",{ready:!0}),Cd(this,"queue",[])}return Sd(t,[{key:"fire",value:function(t,e,i){var n=null;if(this.tick)this.queue.unshift(arguments);else{if(this.tick=!0,!this.eventsSuspended&&this._listeners[t]){var o=this._listeners[t].length,s=0,r=!1;if(!this.shouldFireEvent||this.shouldFireEvent(t,e,i))for(;!r&&s<o&&!1!==n;){if(this.eventsToDieOn[t])this._listeners[t][s](e,i);else try{n=this._listeners[t][s](e,i)}catch(e){cu("jsPlumb: fire failed for event "+t+" : "+(e.message||e))}s++,null!=this._listeners&&null!=this._listeners[t]||(r=!0)}}this.tick=!1,this._drain()}return n}},{key:"_drain",value:function(){var t=this.queue.pop();t&&this.fire.apply(this,t)}},{key:"unbind",value:function(t,e){if(0===arguments.length)this._listeners={};else if(1===arguments.length){if("string"==typeof t)delete this._listeners[t];else if(t.__jsPlumb){var i;for(var n in t.__jsPlumb)i=t.__jsPlumb[n],Jd(this._listeners[i]||[],t)}}else 2===arguments.length&&Jd(this._listeners[t]||[],e);return this}},{key:"getListener",value:function(t){return this._listeners[t]||[]}},{key:"isSuspendEvents",value:function(){return this.eventsSuspended}},{key:"setSuspendEvents",value:function(t){this.eventsSuspended=t}},{key:"bind",value:function(t,e,i){var n=this,o=function(t){tu(n._listeners,t,e,i),e.__jsPlumb=e.__jsPlumb||{},e.__jsPlumb[su()]=t};if("string"==typeof t)o(t);else if(null!=t.length)for(var s=0;s<t.length;s++)o(t[s]);return this}},{key:"silently",value:function(t){this.setSuspendEvents(!0);try{t()}catch(t){cu("Cannot execute silent function "+t)}this.setSuspendEvents(!1)}}]),t}();function zg(t){var e=null;return(e=Bd(t)?{type:t,options:{}}:t).options.id=e.options.id||su(),e}!function(t){Ed(i,t);var e=Pd(i);function i(){return wd(this,i),e.apply(this,arguments)}Sd(i,[{key:"shouldFireEvent",value:function(t,e,i){return!0}}])}($g);var Rg=function(t){Ed(i,t);var e=Pd(i);function i(t,n,o){var s;for(var r in wd(this,i),(s=e.call(this)).instance=t,s.component=n,Cd(Td(s),"id",void 0),Cd(Td(s),"type",void 0),Cd(Td(s),"cssClass",void 0),Cd(Td(s),"visible",!0),Cd(Td(s),"location",void 0),Cd(Td(s),"events",void 0),Cd(Td(s),"attributes",void 0),o=o||{},s.id=o.id||su(),s.cssClass=o.cssClass||"",s.setLocation(o.location),s.events=o.events||{},s.attributes=o.attributes||{},s.events)s.bind(r,s.events[r]);return s}return Sd(i,[{key:"setLocation",value:function(t){var e=null==this.location?.5:this.location;if(null!=t)try{var i="string"==typeof t?parseFloat(t):t;isNaN(i)||(e=i)}catch(t){}this.location=e}},{key:"shouldFireEvent",value:function(t,e,i){return!0}},{key:"setVisible",value:function(t){this.visible=t,this.instance.setOverlayVisible(this,t)}},{key:"isVisible",value:function(){return this.visible}}]),i}($g),Ng={},Bg=function(t,e,i,n){var o=Ng[e];if(o)return new o(t,i,n);throw{message:"jsPlumb: unknown overlay type '"+e+"'"}},jg=function(t,e){Ng[t]=e},Fg=function(t){Ed(i,t);var e=Pd(i);function i(t,n,o){var s;return wd(this,i),(s=e.call(this,t,n,o)).instance=t,s.component=n,Cd(Td(s),"label",void 0),Cd(Td(s),"labelText",void 0),Cd(Td(s),"type",i.type),Cd(Td(s),"cachedDimensions",void 0),o=o||{label:""},s.setLabel(o.label),s}return Sd(i,[{key:"getLabel",value:function(){return qd(this.label)?this.label(this):this.labelText}},{key:"setLabel",value:function(t){this.label=t,this.labelText=null,this.instance.updateLabel(this)}},{key:"getDimensions",value:function(){return{w:1,h:1}}},{key:"updateFrom",value:function(t){null!=t.label&&this.setLabel(t.label),null!=t.location&&(this.setLocation(t.location),this.instance.updateLabel(this))}}]),i}(Rg);function qg(t){return t.type===Fg.type}function Vg(t){return null==t?null:t.split(" ").filter((function(t){return null!=t&&t.length>0}))}function Hg(t,e,i){for(var n in e)t[n]=i}Cd(Fg,"type","Label"),jg(Fg.type,Fg);var Ug="__default",Wg="__label",Gg="overlay",Zg="remove";function Yg(t,e){if(t.getDefaultType){var i=t.getTypeDescriptor(),n={},o=t.getDefaultType(),s=Rd({},o);Hg(n,o,Ug),t._types.forEach((function(e){if(e!==Ug){var o=t.instance.getType(e,i);if(null!=o){var r=new Set(["connector","anchor","anchors"]);if("override"===o.mergeStrategy)for(var a in o)r.add(a);s=Hd(s,o,["cssClass"],function(t){var e=[];return t.forEach((function(t){e.push(t)})),e}(r)),Hg(n,o,e)}}})),e&&(s=Wd(s,e,"_")),t.applyType(s,n)}}function Xg(t,e){var i=t.instance.getType(e,t.getTypeDescriptor());null!=i&&i.cssClass&&t.removeClass(i.cssClass)}function Kg(t){if(t.paintStyle&&t.hoverPaintStyle){var e={};Rd(e,t.paintStyle),Rd(e,t.hoverPaintStyle),t.hoverPaintStyle=e}}var Qg=function(t){Ed(i,t);var e=Pd(i);function i(t,n){var o;if(wd(this,i),(o=e.call(this)).instance=t,Cd(Td(o),"defaultLabelLocation",.5),Cd(Td(o),"overlays",{}),Cd(Td(o),"overlayPositions",{}),Cd(Td(o),"overlayPlacements",{}),Cd(Td(o),"clone",void 0),Cd(Td(o),"deleted",void 0),Cd(Td(o),"segment",void 0),Cd(Td(o),"x",void 0),Cd(Td(o),"y",void 0),Cd(Td(o),"w",void 0),Cd(Td(o),"h",void 0),Cd(Td(o),"id",void 0),Cd(Td(o),"visible",!0),Cd(Td(o),"typeId",void 0),Cd(Td(o),"params",{}),Cd(Td(o),"paintStyle",void 0),Cd(Td(o),"hoverPaintStyle",void 0),Cd(Td(o),"paintStyleInUse",void 0),Cd(Td(o),"_hover",!1),Cd(Td(o),"lastPaintedAt",void 0),Cd(Td(o),"data",void 0),Cd(Td(o),"_defaultType",void 0),Cd(Td(o),"events",void 0),Cd(Td(o),"parameters",void 0),Cd(Td(o),"_types",void 0),Cd(Td(o),"_typeCache",void 0),Cd(Td(o),"cssClass",void 0),Cd(Td(o),"hoverClass",void 0),Cd(Td(o),"beforeDetach",void 0),Cd(Td(o),"beforeDrop",void 0),n=n||{},o.cssClass=n.cssClass||"",o.hoverClass=n.hoverClass||t.defaults.hoverClass,o.beforeDetach=n.beforeDetach,o.beforeDrop=n.beforeDrop,o._types=new Set,o._typeCache={},o.parameters=Vd(n.parameters||{}),o.id=n.id||o.getIdPrefix()+(new Date).getTime(),o._defaultType={parameters:o.parameters,scope:n.scope||o.instance.defaultScope,overlays:{}},n.events)for(var s in n.events)o.bind(s,n.events[s]);o.clone=function(){var e=Object.create(o.constructor.prototype);return o.constructor.apply(e,[t,n]),e},o.overlays={},o.overlayPositions={};var r=n.overlays||[],a={},l=o.getDefaultOverlayKey();if(l){var c=o.instance.defaults[l];c&&r.push.apply(r,Id(c));for(var h=0;h<r.length;h++){var d=zg(r[h]);a[d.options.id]=d}}return o._defaultType.overlays=a,n.label&&(o.getDefaultType().overlays[Wg]={type:Fg.type,options:{label:n.label,location:n.labelLocation||o.defaultLabelLocation,id:Wg,cssClass:"jtk-default-label"}}),o}return Sd(i,[{key:"isDetachAllowed",value:function(t){var e=!0;if(this.beforeDetach)try{e=this.beforeDetach(t)}catch(t){cu("jsPlumb: beforeDetach callback failed",t)}return e}},{key:"isDropAllowed",value:function(t,e,i,n,o){var s,r={sourceId:t,targetId:e,scope:i,connection:n,dropEndpoint:o};if(this.beforeDrop)try{s=this.beforeDrop(r)}catch(t){cu("jsPlumb: beforeDrop callback failed",t)}else s=this.instance.checkCondition(sp,r);return s}},{key:"getDefaultType",value:function(){return this._defaultType}},{key:"appendToDefaultType",value:function(t){for(var e in t)this._defaultType[e]=t[e]}},{key:"getId",value:function(){return this.id}},{key:"cacheTypeItem",value:function(t,e,i){this._typeCache[i]=this._typeCache[i]||{},this._typeCache[i][t]=e}},{key:"getCachedTypeItem",value:function(t,e){return this._typeCache[e]?this._typeCache[e][t]:null}},{key:"setType",value:function(t,e){this.clearTypes(),(Vg(t)||[]).forEach(this._types.add,this._types),Yg(this,e)}},{key:"getType",value:function(){return Array.from(this._types.keys())}},{key:"reapplyTypes",value:function(t){Yg(this,t)}},{key:"hasType",value:function(t){return this._types.has(t)}},{key:"addType",value:function(t,e){var i=Vg(t),n=!1;if(null!=i){for(var o=0,s=i.length;o<s;o++)this._types.has(i[o])||(this._types.add(i[o]),n=!0);n&&Yg(this,e)}}},{key:"removeType",value:function(t,e){var i,n=this,o=Vg(t),s=!1;if(null!=o){for(var r=0,a=o.length;r<a;r++)i=o[r],s=!!n._types.has(i)&&(Xg(n,i),n._types.delete(i),!0)||s;s&&Yg(this,e)}}},{key:"clearTypes",value:function(t){var e=this;this._types.forEach((function(t){Xg(e,t)})),this._types.clear(),Yg(this,t)}},{key:"toggleType",value:function(t,e){var i=Vg(t);if(null!=i){for(var n=0,o=i.length;n<o;n++)this._types.has(i[n])?(Xg(this,i[n]),this._types.delete(i[n])):this._types.add(i[n]);Yg(this,e)}}},{key:"applyType",value:function(t,e){if(this.setPaintStyle(t.paintStyle),this.setHoverPaintStyle(t.hoverPaintStyle),this.mergeParameters(t.parameters),this.paintStyleInUse=this.getPaintStyle(),t.overlays){var i,n={};for(i in t.overlays){var o=this.overlays[t.overlays[i].options.id];if(o)o.updateFrom(t.overlays[i].options),n[t.overlays[i].options.id]=!0,this.instance.reattachOverlay(o,this);else{var s=this.getCachedTypeItem(Gg,t.overlays[i].options.id);null!=s?(this.instance.reattachOverlay(s,this),s.setVisible(!0),s.updateFrom(t.overlays[i].options),this.overlays[s.id]=s):s=this.addOverlay(t.overlays[i]),n[s.id]=!0}}for(i in this.overlays)null==n[this.overlays[i].id]&&this.removeOverlay(this.overlays[i].id,!0)}}},{key:"setPaintStyle",value:function(t){this.paintStyle=t,this.paintStyleInUse=this.paintStyle,Kg(this)}},{key:"getPaintStyle",value:function(){return this.paintStyle}},{key:"setHoverPaintStyle",value:function(t){this.hoverPaintStyle=t,Kg(this)}},{key:"getHoverPaintStyle",value:function(){return this.hoverPaintStyle}},{key:"destroy",value:function(){for(var t in this.overlays)this.instance.destroyOverlay(this.overlays[t]);this.overlays={},this.overlayPositions={},this.unbind(),this.clone=null}},{key:"isHover",value:function(){return this._hover}},{key:"mergeParameters",value:function(t){null!=t&&Rd(this.parameters,t)}},{key:"setVisible",value:function(t){this.visible=t,t?this.showOverlays():this.hideOverlays()}},{key:"isVisible",value:function(){return this.visible}},{key:"setAbsoluteOverlayPosition",value:function(t,e){this.overlayPositions[t.id]=e}},{key:"getAbsoluteOverlayPosition",value:function(t){return this.overlayPositions?this.overlayPositions[t.id]:null}},{key:"_clazzManip",value:function(t,e){for(var i in this.overlays)"add"===t?this.instance.addOverlayClass(this.overlays[i],e):t===Zg&&this.instance.removeOverlayClass(this.overlays[i],e)}},{key:"addClass",value:function(t,e){var i=(this.cssClass||"").split(" ");i.push(t),this.cssClass=i.join(" "),this._clazzManip("add",t)}},{key:"removeClass",value:function(t,e){var i=(this.cssClass||"").split(" ");this.cssClass=i.filter((function(e){return e!==t})).join(" "),this._clazzManip(Zg,t)}},{key:"getClass",value:function(){return this.cssClass}},{key:"shouldFireEvent",value:function(t,e,i){return!0}},{key:"getData",value:function(){return this.data}},{key:"setData",value:function(t){this.data=t||{}}},{key:"mergeData",value:function(t){this.data=Rd(this.data,t)}},{key:"addOverlay",value:function(t){var e=function(t,e){var i=null;if(Bd(e))i=Bg(t.instance,e,t,{});else if(null!=e.type&&null!=e.options){var n=e,o=Rd({},n.options);i=Bg(t.instance,n.type,t,o)}else i=e;return i.id=i.id||su(),t.cacheTypeItem(Gg,i,i.id),t.overlays[i.id]=i,i}(this,t);if(this.getData&&e.type===Fg.type&&!Bd(t)){var i=this.getData(),n=t.options;if(i){var o=i[n.labelLocationAttribute||"labelLocation"];o&&(e.location=o)}}return e}},{key:"getOverlay",value:function(t){return this.overlays[t]}},{key:"getOverlays",value:function(){return this.overlays}},{key:"hideOverlay",value:function(t){var e=this.getOverlay(t);e&&e.setVisible(!1)}},{key:"hideOverlays",value:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];for(var n in e=e||[],this.overlays)0!==e.length&&-1===e.indexOf(n)||this.overlays[n].setVisible(!1)}},{key:"showOverlay",value:function(t){var e=this.getOverlay(t);e&&e.setVisible(!0)}},{key:"showOverlays",value:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];for(var n in e=e||[],this.overlays)0!==e.length&&-1===e.indexOf(n)||this.overlays[n].setVisible(!0)}},{key:"removeAllOverlays",value:function(){for(var t in this.overlays)this.instance.destroyOverlay(this.overlays[t]);this.overlays={},this.overlayPositions=null,this.overlayPlacements={}}},{key:"removeOverlay",value:function(t,e){var i=this.overlays[t];i&&(i.setVisible(!1),e||this.instance.destroyOverlay(i),delete this.overlays[t],this.overlayPositions&&delete this.overlayPositions[t],this.overlayPlacements&&delete this.overlayPlacements[t])}},{key:"removeOverlays",value:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];for(var n=0,o=e.length;n<o;n++)this.removeOverlay(arguments[n])}},{key:"getLabel",value:function(){var t=this.getLabelOverlay();return null!=t?t.getLabel():null}},{key:"getLabelOverlay",value:function(){return this.getOverlay(Wg)}},{key:"setLabel",value:function(t){var e,i,n,o=this.getLabelOverlay();if(o)if(Bd(t)||qd(t))o.setLabel(t);else{var s=t;s.label&&o.setLabel(s.label),s.location&&(o.location=s.location)}else{var r=Bd(t)||qd(t)?{label:t}:t;e=this,n=Rd({cssClass:(i=r).cssClass,id:Wg,component:e},i),o=new Fg(e.instance,e,n),this.overlays[Wg]=o}}}]),i}($g),Jg=["connectorStyle","connectorHoverStyle","connectorOverlays","connector","connectionType","connectorClass","connectorHoverClass"],tv=function(t){Ed(i,t);var e=Pd(i);function i(t,n){var o;wd(this,i),(o=e.call(this,t,n)).instance=t,Cd(Td(o),"connections",[]),Cd(Td(o),"endpoint",void 0),Cd(Td(o),"element",void 0),Cd(Td(o),"elementId",void 0),Cd(Td(o),"dragAllowedWhenFull",!0),Cd(Td(o),"timestamp",void 0),Cd(Td(o),"portId",void 0),Cd(Td(o),"maxConnections",void 0),Cd(Td(o),"proxiedBy",void 0),Cd(Td(o),"connectorClass",void 0),Cd(Td(o),"connectorHoverClass",void 0),Cd(Td(o),"finalEndpoint",void 0),Cd(Td(o),"enabled",!0),Cd(Td(o),"isSource",void 0),Cd(Td(o),"isTarget",void 0),Cd(Td(o),"isTemporarySource",void 0),Cd(Td(o),"connectionCost",1),Cd(Td(o),"connectionsDirected",void 0),Cd(Td(o),"connectionsDetachable",void 0),Cd(Td(o),"reattachConnections",void 0),Cd(Td(o),"currentAnchorClass",void 0),Cd(Td(o),"referenceEndpoint",void 0),Cd(Td(o),"edgeType",void 0),Cd(Td(o),"connector",void 0),Cd(Td(o),"connectorOverlays",void 0),Cd(Td(o),"connectorStyle",void 0),Cd(Td(o),"connectorHoverStyle",void 0),Cd(Td(o),"deleteOnEmpty",void 0),Cd(Td(o),"uuid",void 0),Cd(Td(o),"scope",void 0),Cd(Td(o),"_anchor",void 0),Cd(Td(o),"defaultLabelLocation",[.5,.5]),o.appendToDefaultType({edgeType:n.edgeType,maxConnections:null==n.maxConnections?o.instance.defaults.maxConnections:n.maxConnections,paintStyle:n.paintStyle||o.instance.defaults.endpointStyle,hoverPaintStyle:n.hoverPaintStyle||o.instance.defaults.endpointHoverStyle,connectorStyle:n.connectorStyle,connectorHoverStyle:n.connectorHoverStyle,connectorClass:n.connectorClass,connectorHoverClass:n.connectorHoverClass,connectorOverlays:n.connectorOverlays,connector:n.connector}),o.enabled=!(!1===n.enabled),o.visible=!0,o.element=n.element,o.uuid=n.uuid,o.portId=n.portId,o.elementId=n.elementId,o.connectionCost=null==n.connectionCost?1:n.connectionCost,o.connectionsDirected=n.connectionsDirected,o.currentAnchorClass="",o.events={},o.connectorOverlays=n.connectorOverlays,o.connectorStyle=n.connectorStyle,o.connectorHoverStyle=n.connectorHoverStyle,o.connector=n.connector,o.edgeType=n.edgeType,o.connectorClass=n.connectorClass,o.connectorHoverClass=n.connectorHoverClass,o.deleteOnEmpty=!0===n.deleteOnEmpty,o.isSource=n.source||!1,o.isTemporarySource=n.isTemporarySource||!1,o.isTarget=n.target||!1,o.connections=n.connections||[],o.scope=n.scope||t.defaultScope,o.timestamp=null,o.reattachConnections=n.reattachConnections||t.defaults.reattachConnections,o.connectionsDetachable=t.defaults.connectionsDetachable,!1===n.connectionsDetachable&&(o.connectionsDetachable=!1),o.dragAllowedWhenFull=!1!==n.dragAllowedWhenFull,n.onMaxConnections&&o.bind(ep,n.onMaxConnections);var s=n.endpoint||n.existingEndpoint||t.defaults.endpoint;if(o.setEndpoint(s),null!=n.preparedAnchor)o.setPreparedAnchor(n.preparedAnchor);else{var r=n.anchor?n.anchor:n.anchors?n.anchors:t.defaults.anchor||Cp.Top;o.setAnchor(r)}var a=[Mf,n.type||""].join(" ");return o.addType(a,n.data),o}return Sd(i,[{key:"getIdPrefix",value:function(){return"_jsplumb_e"}},{key:"getTypeDescriptor",value:function(){return"endpoint"}},{key:"getXY",value:function(){return{x:this.endpoint.x,y:this.endpoint.y}}},{key:"getDefaultOverlayKey",value:function(){return"endpointOverlays"}},{key:"_updateAnchorClass",value:function(){var t=this._anchor&&this._anchor.cssClass;if(null!=t&&t.length>0){var e=this.instance.endpointAnchorClassPrefix+"-"+this.currentAnchorClass;this.currentAnchorClass=t;var i=this.instance.endpointAnchorClassPrefix+(this.currentAnchorClass?"-"+this.currentAnchorClass:"");e!==i&&(this.removeClass(e),this.addClass(i),this.instance.removeClass(this.element,e),this.instance.addClass(this.element,i))}}},{key:"setPreparedAnchor",value:function(t){return this.instance.router.setAnchor(this,t),this._updateAnchorClass(),this}},{key:"_anchorLocationChanged",value:function(t){this.fire("anchor:changed",{endpoint:this,anchor:t}),this._updateAnchorClass()}},{key:"setAnchor",value:function(t){var e=this.instance.router.prepareAnchor(t);return this.setPreparedAnchor(e),this}},{key:"addConnection",value:function(t){this.connections.push(t),this.instance._refreshEndpoint(this)}},{key:"detachFromConnection",value:function(t,e,i){(e=null==e?this.connections.indexOf(t):e)>=0&&(this.connections.splice(e,1),this.instance._refreshEndpoint(this)),!i&&this.deleteOnEmpty&&0===this.connections.length&&this.instance.deleteEndpoint(this)}},{key:"deleteEveryConnection",value:function(t){for(var e=this.connections.length,i=0;i<e;i++)this.instance.deleteConnection(this.connections[0],t)}},{key:"detachFrom",value:function(t){for(var e=[],i=0;i<this.connections.length;i++)this.connections[i].endpoints[1]!==t&&this.connections[i].endpoints[0]!==t||e.push(this.connections[i]);for(var n=0,o=e.length;n<o;n++)this.instance.deleteConnection(e[0]);return this}},{key:"setVisible",value:function(t,e,n){if(Od(Ad(i.prototype),"setVisible",this).call(this,t),this.endpoint.setVisible(t),t?this.showOverlays():this.hideOverlays(),!e)for(var o=0;o<this.connections.length;o++)if(this.connections[o].setVisible(t),!n){var s=this===this.connections[o].endpoints[0]?1:0;1===this.connections[o].endpoints[s].connections.length&&this.connections[o].endpoints[s].setVisible(t,!0,!0)}}},{key:"applyType",value:function(t,e){Od(Ad(i.prototype),"applyType",this).call(this,t,e),this.setPaintStyle(t.endpointStyle||t.paintStyle),this.setHoverPaintStyle(t.endpointHoverStyle||t.hoverPaintStyle),this.connectorStyle=t.connectorStyle,this.connectorHoverStyle=t.connectorHoverStyle,this.connector=t.connector,this.connectorOverlays=t.connectorOverlays,this.edgeType=t.edgeType,null!=t.maxConnections&&(this.maxConnections=t.maxConnections),t.scope&&(this.scope=t.scope),Rd(t,Jg),this.instance.applyEndpointType(this,t)}},{key:"destroy",value:function(){Od(Ad(i.prototype),"destroy",this).call(this),this.deleted=!0,null!=this.endpoint&&this.instance.destroyEndpoint(this)}},{key:"isFull",value:function(){return 0===this.maxConnections||!(this.isFloating()||this.maxConnections<0||this.connections.length<this.maxConnections)}},{key:"isFloating",value:function(){return this.instance.router.isFloating(this)}},{key:"isConnectedTo",value:function(t){var e=!1;if(t)for(var i=0;i<this.connections.length;i++)if(this.connections[i].endpoints[1]===t||this.connections[i].endpoints[0]===t){e=!0;break}return e}},{key:"setDragAllowedWhenFull",value:function(t){this.dragAllowedWhenFull=t}},{key:"getUuid",value:function(){return this.uuid}},{key:"connectorSelector",value:function(){return this.connections[0]}},{key:"prepareEndpoint",value:function(t,e){var i,n={cssClass:this.cssClass,endpoint:this};if(pu(t,Xm)){var o=t;(i=Ym.clone(o)).classes=n.cssClass.split(" ")}else if(Bd(t))i=Ym.get(this,t,n);else{var s=t;Rd(n,s.options||{}),i=Ym.get(this,s.type,n)}return i.typeId=e,i}},{key:"setEndpoint",value:function(t){var e=this.prepareEndpoint(t);this.setPreparedEndpoint(e)}},{key:"setPreparedEndpoint",value:function(t){null!=this.endpoint&&this.instance.destroyEndpoint(this),this.endpoint=t}},{key:"addClass",value:function(t,e){Od(Ad(i.prototype),"addClass",this).call(this,t,e),null!=this.endpoint&&this.endpoint.addClass(t)}},{key:"removeClass",value:function(t,e){Od(Ad(i.prototype),"removeClass",this).call(this,t,e),null!=this.endpoint&&this.endpoint.removeClass(t)}}]),i}(Qg),ev="anchors",iv="connector";function nv(t,e,i,n,o,s,r){var a;if(e)t.endpoints[i]=e,e.addConnection(t);else{var l=r||t.endpointSpec||t.endpointsSpec[i]||t.instance.defaults.endpoints[i]||t.instance.defaults.endpoint,c=t.endpointStyles[i]||t.endpointStyle||t.instance.defaults.endpointStyles[i]||t.instance.defaults.endpointStyle;null==c.fill&&null!=t.paintStyle&&(c.fill=t.paintStyle.stroke),null==c.outlineStroke&&null!=t.paintStyle&&(c.outlineStroke=t.paintStyle.outlineStroke),null==c.outlineWidth&&null!=t.paintStyle&&(c.outlineWidth=t.paintStyle.outlineWidth);var h=t.endpointHoverStyles[i]||t.endpointHoverStyle||t.endpointHoverStyle||t.instance.defaults.endpointHoverStyles[i]||t.instance.defaults.endpointHoverStyle;null!=t.hoverPaintStyle&&(null==h&&(h={}),null==h.fill&&(h.fill=t.hoverPaintStyle.stroke));var d=t.uuids?t.uuids[i]:null;n=null!=n?n:null!=t.instance.defaults.anchors?t.instance.defaults.anchors[i]:t.instance.defaults.anchor,a=t.instance._internal_newEndpoint({paintStyle:c,hoverPaintStyle:h,endpoint:l,connections:[t],uuid:d,element:o,scope:t.scope,anchor:n,reattachConnections:t.reattach||t.instance.defaults.reattachConnections,connectionsDetachable:t.detachable||t.instance.defaults.connectionsDetachable}),t.instance._refreshEndpoint(a),null==e&&(a.deleteOnEmpty=!0),t.endpoints[i]=a}return a}var ov=function(t){Ed(i,t);var e=Pd(i);function i(t,n){var o;wd(this,i),(o=e.call(this,t,n)).instance=t,Cd(Td(o),"connector",void 0),Cd(Td(o),"defaultLabelLocation",.5),Cd(Td(o),"scope",void 0),Cd(Td(o),"typeId","_jsplumb_connection"),Cd(Td(o),"previousConnection",void 0),Cd(Td(o),"sourceId",void 0),Cd(Td(o),"targetId",void 0),Cd(Td(o),"source",void 0),Cd(Td(o),"target",void 0),Cd(Td(o),"detachable",!0),Cd(Td(o),"reattach",!1),Cd(Td(o),"uuids",void 0),Cd(Td(o),"cost",1),Cd(Td(o),"directed",void 0),Cd(Td(o),"endpoints",[null,null]),Cd(Td(o),"endpointStyles",void 0),Cd(Td(o),"endpointSpec",void 0),Cd(Td(o),"endpointsSpec",void 0),Cd(Td(o),"endpointStyle",{}),Cd(Td(o),"endpointHoverStyle",{}),Cd(Td(o),"endpointHoverStyles",void 0),Cd(Td(o),"suspendedEndpoint",void 0),Cd(Td(o),"suspendedIndex",void 0),Cd(Td(o),"suspendedElement",void 0),Cd(Td(o),"suspendedElementId",void 0),Cd(Td(o),"suspendedElementType",void 0),Cd(Td(o),"_forceReattach",void 0),Cd(Td(o),"_forceDetach",void 0),Cd(Td(o),"proxies",[]),Cd(Td(o),"pending",!1),o.id=n.id,o.previousConnection=n.previousConnection,o.source=n.source,o.target=n.target,n.sourceEndpoint?(o.source=n.sourceEndpoint.element,o.sourceId=n.sourceEndpoint.elementId):o.sourceId=t.getId(o.source),n.targetEndpoint?(o.target=n.targetEndpoint.element,o.targetId=n.targetEndpoint.elementId):o.targetId=t.getId(o.target),o.scope=n.scope;var s=n.anchors?n.anchors[0]:n.anchor,r=n.anchors?n.anchors[1]:n.anchor;t.manage(o.source),t.manage(o.target),o.visible=!0,o.params={cssClass:n.cssClass,hoverClass:n.hoverClass,"pointer-events":n["pointer-events"],overlays:n.overlays},o.lastPaintedAt=null,n.type&&(n.endpoints=n.endpoints||o.instance._deriveEndpointAndAnchorSpec(n.type).endpoints),o.endpointSpec=n.endpoint,o.endpointsSpec=n.endpoints||[null,null],o.endpointStyle=n.endpointStyle,o.endpointHoverStyle=n.endpointHoverStyle,o.endpointStyles=n.endpointStyles||[null,null],o.endpointHoverStyles=n.endpointHoverStyles||[null,null],o.paintStyle=n.paintStyle,o.hoverPaintStyle=n.hoverPaintStyle,o.uuids=n.uuids,o.makeEndpoint(!0,o.source,o.sourceId,s,n.sourceEndpoint),o.makeEndpoint(!1,o.target,o.targetId,r,n.targetEndpoint),o.scope||(o.scope=o.endpoints[0].scope),null!=n.deleteEndpointsOnEmpty&&(o.endpoints[0].deleteOnEmpty=n.deleteEndpointsOnEmpty,o.endpoints[1].deleteOnEmpty=n.deleteEndpointsOnEmpty);var a=o.instance.defaults.connectionsDetachable;!1===n.detachable&&(a=!1),!1===o.endpoints[0].connectionsDetachable&&(a=!1),!1===o.endpoints[1].connectionsDetachable&&(a=!1),o.endpointsSpec=n.endpoints||[null,null],o.endpointSpec=n.endpoint||null;var l=n.reattach||o.endpoints[0].reattachConnections||o.endpoints[1].reattachConnections||o.instance.defaults.reattachConnections,c=Rd({},o.endpoints[0].connectorStyle||o.endpoints[1].connectorStyle||n.paintStyle||o.instance.defaults.paintStyle);if(o.appendToDefaultType({detachable:a,reattach:l,paintStyle:c,hoverPaintStyle:Rd({},o.endpoints[0].connectorHoverStyle||o.endpoints[1].connectorHoverStyle||n.hoverPaintStyle||o.instance.defaults.hoverPaintStyle)}),n.outlineWidth&&(c.outlineWidth=n.outlineWidth),n.outlineColor&&(c.outlineStroke=n.outlineColor),n.lineWidth&&(c.strokeWidth=n.lineWidth),n.color&&(c.stroke=n.color),!o.instance._suspendDrawing){var h=o.instance._suspendedAt||su();o.instance._paintEndpoint(o.endpoints[0],{timestamp:h}),o.instance._paintEndpoint(o.endpoints[1],{timestamp:h})}o.cost=n.cost||o.endpoints[0].connectionCost,o.directed=n.directed,null==n.directed&&(o.directed=o.endpoints[0].connectionsDirected);var d=Rd({},o.endpoints[1].parameters);Rd(d,o.endpoints[0].parameters),Rd(d,o.parameters),o.parameters=d,o.paintStyleInUse=o.getPaintStyle()||{},o._setConnector(o.endpoints[0].connector||o.endpoints[1].connector||n.connector||o.instance.defaults.connector,!0);var u=null!=n.data&&Fd(n.data)?n.data:{};o.setData(u);var p=[Mf,o.endpoints[0].edgeType,o.endpoints[1].edgeType,n.type].join(" ");return/[^\s]/.test(p)&&o.addType(p,n.data),o}return Sd(i,[{key:"getIdPrefix",value:function(){return"_jsPlumb_c"}},{key:"getDefaultOverlayKey",value:function(){return"connectionOverlays"}},{key:"getXY",value:function(){return{x:this.connector.x,y:this.connector.y}}},{key:"makeEndpoint",value:function(t,e,i,n,o){return i=i||this.instance.getId(e),nv(this,o,t?0:1,n,e)}},{key:"getTypeDescriptor",value:function(){return i.type}},{key:"isDetachable",value:function(t){return!1!==this.detachable&&(null!=t?!0===t.connectionsDetachable:!0===this.detachable)}},{key:"setDetachable",value:function(t){this.detachable=!0===t}},{key:"isReattach",value:function(){return!0===this.reattach||!0===this.endpoints[0].reattachConnections||!0===this.endpoints[1].reattachConnections}},{key:"setReattach",value:function(t){this.reattach=!0===t}},{key:"applyType",value:function(t,e){var n=null;null!=t.connector&&(null==(n=this.getCachedTypeItem(iv,e.connector))&&(n=this.prepareConnector(t.connector,e.connector),this.cacheTypeItem(iv,n,e.connector)),this.setPreparedConnector(n)),Od(Ad(i.prototype),"applyType",this).call(this,t,e),null!=t.detachable&&this.setDetachable(t.detachable),null!=t.reattach&&this.setReattach(t.reattach),t.scope&&(this.scope=t.scope);var o=null;t.anchor?null==(o=this.getCachedTypeItem(ev,e.anchor))&&(o=[_g(t.anchor),_g(t.anchor)],this.cacheTypeItem(ev,o,e.anchor)):t.anchors&&null==(o=this.getCachedTypeItem(ev,e.anchors))&&(o=[_g(t.anchors[0]),_g(t.anchors[1])],this.cacheTypeItem(ev,o,e.anchors)),null!=o&&(this.instance.router.setConnectionAnchors(this,o),this.instance.router.isDynamicAnchor(this.endpoints[1])&&this.instance.repaint(this.endpoints[1].element)),this.instance.applyConnectorType(this.connector,t)}},{key:"addClass",value:function(t,e){Od(Ad(i.prototype),"addClass",this).call(this,t),e&&(this.endpoints[0].addClass(t),this.endpoints[1].addClass(t),this.suspendedEndpoint&&this.suspendedEndpoint.addClass(t)),this.connector&&this.instance.addConnectorClass(this.connector,t)}},{key:"removeClass",value:function(t,e){Od(Ad(i.prototype),"removeClass",this).call(this,t),e&&(this.endpoints[0].removeClass(t),this.endpoints[1].removeClass(t),this.suspendedEndpoint&&this.suspendedEndpoint.removeClass(t)),this.connector&&this.instance.removeConnectorClass(this.connector,t)}},{key:"setVisible",value:function(t){Od(Ad(i.prototype),"setVisible",this).call(this,t),this.connector&&this.instance.setConnectorVisible(this.connector,t),this.instance._paintConnection(this)}},{key:"destroy",value:function(){Od(Ad(i.prototype),"destroy",this).call(this),this.endpoints=null,this.endpointStyles=null,this.source=null,this.target=null,this.instance.destroyConnector(this),this.connector=null,this.deleted=!0}},{key:"getUuids",value:function(){return[this.endpoints[0].getUuid(),this.endpoints[1].getUuid()]}},{key:"prepareConnector",value:function(t,e){var i,n={cssClass:this.params.cssClass,hoverClass:this.params.hoverClass,"pointer-events":this.params["pointer-events"]};if(Bd(t))i=this.instance._makeConnector(this,t,n);else{var o=t;i=this.instance._makeConnector(this,o.type,Hd(o.options||{},n))}return null!=e&&(i.typeId=e),i}},{key:"setPreparedConnector",value:function(t,e,i,n){if(this.connector!==t){var o,s="";if(null!=this.connector&&(o=this.connector,s=this.instance.getConnectorClass(this.connector),this.instance.destroyConnector(this)),this.connector=t,n&&this.cacheTypeItem(iv,t,n),this.addClass(s),null!=o){var r=this.getOverlays();for(var a in r)this.instance.reattachOverlay(r[a],this)}e||this.instance._paintConnection(this)}}},{key:"_setConnector",value:function(t,e,i,n){var o=this.prepareConnector(t,n);this.setPreparedConnector(o,e,i,n)}},{key:"replaceEndpoint",value:function(t,e){var i=this.endpoints[t],n=(i.elementId,this.instance.getEndpoints(i.element)),o=n.indexOf(i),s=nv(this,null,t,null,i.element,0,e);this.endpoints[t]=s,n.splice(o,1,s),i.detachFromConnection(this),this.instance.deleteEndpoint(i),this.instance.fire("endpoint:replaced",{previous:i,current:s})}}]),i}(Qg);function sv(t){if(null==t.path){var e=Rd({"jtk-overlay-id":t.id},t.attributes);t.path=bp(gp,e);var i=t.instance.overlayClass+" "+(t.cssClass?t.cssClass:"");t.instance.addClass(t.path,i),t.path.jtk={overlay:t}}var n=t.path.parentNode;if(null==n){if(t.component instanceof ov){var o=t.component.connector;n=null!=o?o.canvas:null}else if(t.component instanceof tv){var s=t.component.endpoint;n=null!=s?s.canvas:s}null!=n&&wp(n,t.path,1)}return t.path}Cd(ov,"type","connection"),function(t){Ed(i,t);var e=Pd(i);function i(){var t;wd(this,i);for(var n=arguments.length,o=new Array(n),s=0;s<n;s++)o[s]=arguments[s];return Cd(Td(t=e.call.apply(e,[this].concat(o))),"path",void 0),t}}(Rg);var rv=function(){function t(){wd(this,t)}return Sd(t,null,[{key:"paint",value:function(t,e,i,n){if(null!=i){var o=[t.x,t.y],s=[t.w,t.h];if(null!=n&&(n.xmin<0&&(o[0]+=n.xmin),n.ymin<0&&(o[1]+=n.ymin),s[0]=n.xmax+(n.xmin<0?-n.xmin:0),s[1]=n.ymax+(n.ymin<0?-n.ymin:0)),isFinite(s[0])&&isFinite(s[1])){var r={width:""+(s[0]||0),height:""+(s[1]||0)};e.containerType===iu.HTML?yp(t.canvas,Rd(r,{style:xp([o[0],o[1]])})):yp(t.canvas,Rd(r,{x:o[0],y:o[1]}))}}}}]),t}();function av(t,e,i,n){!function(t,e){if(null!=e.canvas)return e.canvas;var i=bp(mp,{style:"",width:"0",height:"0","pointer-events":Lu,position:$u});e.canvas=i,t._appendElement(e.canvas,t.getContainer()),null!=e.cssClass&&t.addClass(i,e.cssClass),t.addClass(i,t.connectorClass),i.jtk=i.jtk||{},i.jtk.connector=e}(t,e),rv.paint(e,t,i,n);var o=[0,0];if(n.xmin<0&&(o[0]=-n.xmin),n.ymin<0&&(o[1]=-n.ymin),e.segments.length>0){var s={d:t.getPathData(e),transform:"translate("+o[0]+","+o[1]+")","pointer-events":"visibleStroke"},r=null;if(i.outlineStroke){var a=i.outlineWidth||1,l=i.strokeWidth+2*a;(r=Rd({},i)).stroke=i.outlineStroke,r.strokeWidth=l,null==e.bgPath?(e.bgPath=bp(gp,s),t.addClass(e.bgPath,t.connectorOutlineClass),wp(e.canvas,e.bgPath,0)):yp(e.bgPath,s),_p(e.canvas,e.bgPath,r)}var c=e;null==c.path?(c.path=bp(gp,s),wp(c.canvas,c.path,i.outlineStroke?1:0)):(c.path.parentNode!==c.canvas&&wp(c.canvas,c.path,i.outlineStroke?1:0),yp(e.path,s)),_p(e.canvas,e.path,i)}}var lv=function(){function t(){wd(this,t)}return Sd(t,null,[{key:"getEndpointElement",value:function(t){if(null!=t.canvas)return t.canvas;var e=bp(mp,{style:"",width:"0",height:"0","pointer-events":"all",position:$u});t.canvas=e;var i=t.classes.join(" ");t.instance.addClass(e,i);for(var n=t.endpoint.scope.split(/\s/),o=0;o<n.length;o++)t.instance.setAttribute(e,Fu+n[o],Tf);return t.instance._appendElementToContainer(e),null!=t.cssClass&&t.instance.addClass(e,t.cssClass),t.instance.addClass(e,t.instance.endpointClass),e.jtk=e.jtk||{},e.jtk.endpoint=t.endpoint,e.style.display=!1!==t.endpoint.visible?Iu:Lu,e}},{key:"paint",value:function(t,e,i){if(!0!==t.endpoint.deleted){this.getEndpointElement(t),rv.paint(t,t.instance,i);var n=Rd({},i);n.outlineStroke&&(n.stroke=n.outlineStroke),null==t.node?(t.node=e.makeNode(t,n),t.canvas.appendChild(t.node)):null!=e.updateNode&&e.updateNode(t,t.node),_p(t.canvas,t.node,n)}}}]),t}(),cv=function(){function t(e,i){wd(this,t),this.connection=e,Cd(this,"type",void 0),Cd(this,"edited",!1),Cd(this,"stub",void 0),Cd(this,"sourceStub",void 0),Cd(this,"targetStub",void 0),Cd(this,"maxStub",void 0),Cd(this,"typeId",void 0),Cd(this,"gap",void 0),Cd(this,"sourceGap",void 0),Cd(this,"targetGap",void 0),Cd(this,"segments",[]),Cd(this,"totalLength",0),Cd(this,"segmentProportions",[]),Cd(this,"segmentProportionalLengths",[]),Cd(this,"paintInfo",null),Cd(this,"strokeWidth",void 0),Cd(this,"x",void 0),Cd(this,"y",void 0),Cd(this,"w",void 0),Cd(this,"h",void 0),Cd(this,"segment",void 0),Cd(this,"bounds",{xmin:1/0,xmax:-1/0,ymin:1/0,ymax:-1/0}),Cd(this,"cssClass",void 0),Cd(this,"hoverClass",void 0),Cd(this,"geometry",void 0),this.stub=i.stub||this.getDefaultStubs(),this.sourceStub=Array.isArray(this.stub)?this.stub[0]:this.stub,this.targetStub=Array.isArray(this.stub)?this.stub[1]:this.stub,this.gap=i.gap||0,this.sourceGap=Array.isArray(this.gap)?this.gap[0]:this.gap,this.targetGap=Array.isArray(this.gap)?this.gap[1]:this.gap,this.maxStub=Math.max(this.sourceStub,this.targetStub),this.cssClass=i.cssClass||"",this.hoverClass=i.hoverClass||""}return Sd(t,[{key:"getTypeDescriptor",value:function(){return"connector"}},{key:"getIdPrefix",value:function(){return"_jsplumb_connector"}},{key:"setGeometry",value:function(t,e){this.geometry=t,this.edited=null!=t&&!e}},{key:"exportGeometry",value:function(){return this.geometry}},{key:"importGeometry",value:function(t){return this.geometry=t,!0}},{key:"resetGeometry",value:function(){this.geometry=null,this.edited=!1}},{key:"transformAnchorPlacement",value:function(t,e,i){return{x:t.x,y:t.y,ox:t.ox,oy:t.oy,curX:t.curX+e,curY:t.curY+i}}},{key:"resetBounds",value:function(){this.bounds={xmin:1/0,xmax:-1/0,ymin:1/0,ymax:-1/0}}},{key:"findSegmentForPoint",value:function(t,e){for(var i={d:1/0,s:null,x:null,y:null,l:null,x1:null,y1:null,x2:null,y2:null,index:null,connectorLocation:null},n=0;n<this.segments.length;n++){var o=this.segments[n].findClosestPointOnPath(t,e);o.d<i.d&&(i.d=o.d,i.l=o.l,i.x=o.x,i.y=o.y,i.s=this.segments[n],i.x1=o.x1,i.x2=o.x2,i.y1=o.y1,i.y2=o.y2,i.index=n,i.connectorLocation=this.segmentProportions[n][0]+o.l*(this.segmentProportions[n][1]-this.segmentProportions[n][0]))}return i}},{key:"lineIntersection",value:function(t,e,i,n){for(var o=[],s=0;s<this.segments.length;s++)o.push.apply(o,this.segments[s].lineIntersection(t,e,i,n));return o}},{key:"boxIntersection",value:function(t,e,i,n){for(var o=[],s=0;s<this.segments.length;s++)o.push.apply(o,this.segments[s].boxIntersection(t,e,i,n));return o}},{key:"boundingBoxIntersection",value:function(t){for(var e=[],i=0;i<this.segments.length;i++)e.push.apply(e,this.segments[i].boundingBoxIntersection(t));return e}},{key:"_updateSegmentProportions",value:function(){for(var t=0,e=0;e<this.segments.length;e++){var i=this.segments[e].getLength();this.segmentProportionalLengths[e]=i/this.totalLength,this.segmentProportions[e]=[t,t+=i/this.totalLength]}}},{key:"_findSegmentForLocation",value:function(t,e){var i,n,o;if(e&&(t=t>0?t/this.totalLength:(this.totalLength+t)/this.totalLength),1===t)i=this.segments.length-1,o=1;else if(0===t)o=0,i=0;else if(t>=.5){for(i=0,o=0,n=this.segmentProportions.length-1;n>-1;n--)if(this.segmentProportions[n][1]>=t&&this.segmentProportions[n][0]<=t){i=n,o=(t-this.segmentProportions[n][0])/this.segmentProportionalLengths[n];break}}else for(i=this.segmentProportions.length-1,o=1,n=0;n<this.segmentProportions.length;n++)if(this.segmentProportions[n][1]>=t){i=n,o=(t-this.segmentProportions[n][0])/this.segmentProportionalLengths[n];break}return{segment:this.segments[i],proportion:o,index:i}}},{key:"_addSegment",value:function(t,e){if(e.x1!==e.x2||e.y1!==e.y2){var i=new t(e);this.segments.push(i),this.totalLength+=i.getLength(),this.updateBounds(i)}}},{key:"_clearSegments",value:function(){this.totalLength=0,this.segments.length=0,this.segmentProportions.length=0,this.segmentProportionalLengths.length=0}},{key:"getLength",value:function(){return this.totalLength}},{key:"_prepareCompute",value:function(t){this.strokeWidth=t.strokeWidth;var e=t.sourcePos.curX,i=t.targetPos.curX,n=t.sourcePos.curY,o=t.targetPos.curY,s=am({x:e,y:n},{x:i,y:o}),r=i<e,a=o<n,l=[t.sourcePos.ox,t.sourcePos.oy],c=[t.targetPos.ox,t.targetPos.oy],h=r?i:e,d=a?o:n,u=Math.abs(i-e),p=Math.abs(o-n),f=0===l[0]&&0===l[1],m=0===c[0]&&0===c[1];if(f||m){var g=u>p?0:1,v=[1,0][g],y=0===g?e:n,b=0===g?i:o;f&&(l[g]=y>b?-1:1,l[v]=0),m&&(c[g]=y>b?1:-1,c[v]=0)}var x=r?u+this.sourceGap*l[0]:this.sourceGap*l[0],_=a?p+this.sourceGap*l[1]:this.sourceGap*l[1],w=r?this.targetGap*c[0]:u+this.targetGap*c[0],k=a?this.targetGap*c[1]:p+this.targetGap*c[1],S=l[0]*c[0]+l[1]*c[1],C={sx:x,sy:_,tx:w,ty:k,xSpan:Math.abs(w-x),ySpan:Math.abs(k-_),mx:(x+w)/2,my:(_+k)/2,so:l,to:c,x:h,y:d,w:u,h:p,segment:s,startStubX:x+l[0]*this.sourceStub,startStubY:_+l[1]*this.sourceStub,endStubX:w+c[0]*this.targetStub,endStubY:k+c[1]*this.targetStub,isXGreaterThanStubTimes2:Math.abs(x-w)>this.sourceStub+this.targetStub,isYGreaterThanStubTimes2:Math.abs(_-k)>this.sourceStub+this.targetStub,opposite:-1===S,perpendicular:0===S,orthogonal:1===S,sourceAxis:0===l[0]?"y":"x",points:[h,d,u,p,x,_,w,k],stubs:[this.sourceStub,this.targetStub]};return C.anchorOrientation=C.opposite?"opposite":C.orthogonal?"orthogonal":"perpendicular",C}},{key:"updateBounds",value:function(t){var e=t.extents;this.bounds.xmin=Math.min(this.bounds.xmin,e.xmin),this.bounds.xmax=Math.max(this.bounds.xmax,e.xmax),this.bounds.ymin=Math.min(this.bounds.ymin,e.ymin),this.bounds.ymax=Math.max(this.bounds.ymax,e.ymax)}},{key:"dumpSegmentsToConsole",value:function(){cu("SEGMENTS:");for(var t=0;t<this.segments.length;t++)cu(this.segments[t].type,""+this.segments[t].getLength(),""+this.segmentProportions[t])}},{key:"pointOnPath",value:function(t,e){var i=this._findSegmentForLocation(t,e);return i.segment&&i.segment.pointOnPath(i.proportion,!1)||{x:0,y:0}}},{key:"gradientAtPoint",value:function(t,e){var i=this._findSegmentForLocation(t,e);return i.segment&&i.segment.gradientAtPoint(i.proportion,!1)||0}},{key:"pointAlongPathFrom",value:function(t,e,i){var n=this._findSegmentForLocation(t,i);return n.segment&&n.segment.pointAlongPathFrom(n.proportion,e,!1)||{x:0,y:0}}},{key:"compute",value:function(t){this.paintInfo=this._prepareCompute(t),this._clearSegments(),this._compute(this.paintInfo,t),this.x=this.paintInfo.points[0],this.y=this.paintInfo.points[1],this.w=this.paintInfo.points[2],this.h=this.paintInfo.points[3],this.segment=this.paintInfo.segment,this._updateSegmentProportions()}},{key:"setAnchorOrientation",value:function(t,e){}}]),t}(),hv=function(t){Ed(i,t);var e=Pd(i);function i(t,n,o){var s;return wd(this,i),(s=e.call(this,t,n,o)).instance=t,s.component=n,Cd(Td(s),"width",void 0),Cd(Td(s),"length",void 0),Cd(Td(s),"foldback",void 0),Cd(Td(s),"direction",void 0),Cd(Td(s),"location",.5),Cd(Td(s),"paintStyle",void 0),Cd(Td(s),"type",i.type),Cd(Td(s),"cachedDimensions",void 0),o=o||{},s.width=o.width||20,s.length=o.length||20,s.direction=(o.direction||1)<0?-1:1,s.foldback=o.foldback||.623,s.paintStyle=o.paintStyle||{strokeWidth:1},s.location=null==o.location?s.location:Array.isArray(o.location)?o.location[0]:o.location,s}return Sd(i,[{key:"draw",value:function(t,e,i){if(t instanceof cv){var n,o,s,r=t;if(this.location>1||this.location<0){var a=this.location<0?1:0;o=cm(n=r.pointAlongPathFrom(a,this.location,!1),r.pointAlongPathFrom(a,this.location-this.direction*this.length/2,!1),this.length)}else if(1===this.location){if(o=cm(n=r.pointOnPath(this.location),r.pointAlongPathFrom(this.location,-this.length),this.length),-1===this.direction){var l=o;o=n,n=l}}else if(0===this.location){if(n=cm(o=r.pointOnPath(this.location),r.pointAlongPathFrom(this.location,this.length),this.length),-1===this.direction){var c=o;o=n,n=c}}else o=cm(n=r.pointAlongPathFrom(this.location,this.direction*this.length/2),r.pointOnPath(this.location),this.length);s=function(t,e,i){var n=sm(t,e),o=Math.atan(-1/n),s=i/2*Math.sin(o),r=i/2*Math.cos(o);return[{x:e.x+r,y:e.y+s},{x:e.x-r,y:e.y-s}]}(n,o,this.width);var h={hxy:n,tail:s,cxy:cm(n,o,this.foldback*this.length)},d=this.paintStyle.stroke||e.stroke,u=this.paintStyle.fill||e.stroke;return{component:t,d:h,"stroke-width":this.paintStyle.strokeWidth||e.strokeWidth,stroke:d,fill:u,xmin:Math.min(n.x,s[0].x,s[1].x),xmax:Math.max(n.x,s[0].x,s[1].x),ymin:Math.min(n.y,s[0].y,s[1].y),ymax:Math.max(n.y,s[0].y,s[1].y)}}}},{key:"updateFrom",value:function(t){}}]),i}(Rg);function dv(t){return t.type===hv.type}Cd(hv,"type","Arrow"),jg(hv.type,hv);var uv=function(t){Ed(i,t);var e=Pd(i);function i(t,n,o){var s;return wd(this,i),(s=e.call(this,t,n,o)).instance=t,Cd(Td(s),"type",i.type),s.length=s.length/2,s.foldback=2,s}return i}(hv);function pv(t){return t.type===uv.type}Cd(uv,"type","Diamond"),jg(uv.type,uv);var fv=function(t){Ed(i,t);var e=Pd(i);function i(t,n,o){var s;return wd(this,i),(s=e.call(this,t,n,o)).instance=t,Cd(Td(s),"type",i.type),s.foldback=1,s}return i}(hv);function mv(t){return t.type===fv.type}Cd(fv,"type","PlainArrow"),jg("PlainArrow",fv);var gv=function(t){Ed(i,t);var e=Pd(i);function i(t,n,o){var s;return wd(this,i),(s=e.call(this,t,n,o)).instance=t,s.component=n,Cd(Td(s),"create",void 0),Cd(Td(s),"type",i.type),s.create=o.create,s}return Sd(i,[{key:"updateFrom",value:function(t){}}]),i}(Rg);function vv(t){return t.type===gv.type}Cd(gv,"type","Custom"),jg(gv.type,gv);var yv="paintStyle",bv=function(t){Ed(i,t);var e=Pd(i);function i(t,n){var o;return wd(this,i),Cd(Td(o=e.call(this,t,n)),"radius",void 0),Cd(Td(o),"defaultOffset",void 0),Cd(Td(o),"defaultInnerRadius",void 0),Cd(Td(o),"type",i.type),n=n||{},o.radius=n.radius||5,o.defaultOffset=.5*o.radius,o.defaultInnerRadius=o.radius/3,o}return i}(Xm);Cd(bv,"type","Dot");var xv={type:bv.type,cls:bv,compute:function(t,e,i,n){var o=e.curX-t.radius,s=e.curY-t.radius,r=2*t.radius,a=2*t.radius;if(n&&n.stroke){var l=n.strokeWidth||1;o-=l,s-=l,r+=2*l,a+=2*l}return t.x=o,t.y=s,t.w=r,t.h=a,[o,s,r,a,t.radius]},getParams:function(t){return{radius:t.radius}}},_v=function t(e,i){wd(this,t),this.instance=e,this.el=i,Cd(this,"group",void 0)},wv=function(t){Ed(i,t);var e=Pd(i);function i(t,n,o){var s;wd(this,i),(s=e.call(this,t,n)).instance=t,Cd(Td(s),"children",[]),Cd(Td(s),"collapsed",!1),Cd(Td(s),"droppable",void 0),Cd(Td(s),"enabled",void 0),Cd(Td(s),"orphan",void 0),Cd(Td(s),"constrain",void 0),Cd(Td(s),"proxied",void 0),Cd(Td(s),"ghost",void 0),Cd(Td(s),"revert",void 0),Cd(Td(s),"prune",void 0),Cd(Td(s),"dropOverride",void 0),Cd(Td(s),"anchor",void 0),Cd(Td(s),"endpoint",void 0),Cd(Td(s),"connections",{source:[],target:[],internal:[]}),Cd(Td(s),"manager",void 0),Cd(Td(s),"id",void 0),Cd(Td(s),"elId",void 0);var r=s.el;return r._isJsPlumbGroup=!0,r._jsPlumbGroup=Td(s),s.elId=t.getId(n),s.orphan=!0===o.orphan,s.revert=!0!==s.orphan&&!1!==o.revert,s.droppable=!1!==o.droppable,s.ghost=!0===o.ghost,s.enabled=!1!==o.enabled,s.prune=!0!==s.orphan&&!0===o.prune,s.constrain=s.ghost||!0===o.constrain,s.proxied=!1!==o.proxied,s.id=o.id||su(),s.dropOverride=!0===o.dropOverride,s.anchor=o.anchor,s.endpoint=o.endpoint,s.anchor=o.anchor,t.setAttribute(n,Ru,""),s}return Sd(i,[{key:"contentArea",get:function(){return this.instance.getGroupContentArea(this)}},{key:"overrideDrop",value:function(t,e){return this.dropOverride&&(this.revert||this.prune||this.orphan)}},{key:"getAnchor",value:function(t,e){return this.anchor||"Continuous"}},{key:"getEndpoint",value:function(t,e){return this.endpoint||{type:bv.type,options:{radius:10}}}},{key:"add",value:function(t,e){var i=this.instance.getGroupContentArea(this),n=t;if(null!=n._jsPlumbParentGroup){if(n._jsPlumbParentGroup===this)return;n._jsPlumbParentGroup.remove(t,!0,e,!1)}n._jsPlumbParentGroup=this,this.children.push(new _v(this.instance,t)),this.instance._appendElement(n,i),this.manager._updateConnectionsForGroup(this)}},{key:"resolveNode",value:function(t){return null==t?null:Yd(this.children,(function(e){return e.el===t}))}},{key:"remove",value:function(t,e,i,n,o){var s=this.resolveNode(t);null!=s&&this._doRemove(s,e,i,n,o)}},{key:"_doRemove",value:function(t,e,i,n,o){var s=t.el;if(delete s._jsPlumbParentGroup,Kd(this.children,(function(e){return e===t})),e)try{this.instance.getGroupContentArea(this).removeChild(s)}catch(t){cu("Could not remove element from Group "+t)}if(!i){var r={group:this,el:s};o&&(r.targetGroup=o),this.instance.fire("group:member:removed",r)}n||this.manager._updateConnectionsForGroup(this)}},{key:"removeAll",value:function(t,e){for(var i=0,n=this.children.length;i<n;i++){var o=this.children[0];this._doRemove(o,t,e,!0),this.instance.unmanage(o.el,!0)}this.children.length=0,this.manager._updateConnectionsForGroup(this)}},{key:"orphanAll",value:function(){for(var t={},e=0;e<this.children.length;e++){var i=this.manager.orphan(this.children[e].el,!1);t[i.id]=i.pos}return this.children.length=0,t}},{key:"addGroup",value:function(t){if(this.instance.allowNestedGroups&&t!==this){if(this.instance.groupManager.isAncestor(this,t))return!1;null!=t.group&&t.group.removeGroup(t);var e=this.instance.getId(t.el);this.instance.getManagedElements()[e].group=this.elId;var i=this.instance.getOffsetRelativeToRoot(t.el),n=this.collapsed?this.instance.getOffsetRelativeToRoot(this.el):this.instance.getOffsetRelativeToRoot(this.instance.getGroupContentArea(this));t.el._jsPlumbParentGroup=this,this.children.push(t),this.instance._appendElementToGroup(this,t.el),t.group=this;var o={x:i.x-n.x,y:i.y-n.y};return this.instance.setPosition(t.el,o),this.instance.fire("group:nested:added",{parent:this,child:t}),!0}return!1}},{key:"removeGroup",value:function(t){if(t.group===this){var e=t.el,i=this.instance.getGroupContentArea(this);i===e.parentNode&&i.removeChild(t.el);var n=this.instance.getId(t.el),o=this.instance.getManagedElements()[n];o&&delete o.group,this.children=this.children.filter((function(e){return e.id!==t.id})),delete t.group,delete e._jsPlumbParentGroup,this.instance.fire("group:nested:removed",{parent:this,child:t})}}},{key:"getGroups",value:function(){return this.children.filter((function(t){return t.constructor===i}))}},{key:"getNodes",value:function(){return this.children.filter((function(t){return t.constructor===_v}))}},{key:"collapseParent",get:function(){var t=null;if(null==this.group)return null;for(var e=this.group;null!=e;)e.collapsed&&(t=e),e=e.group;return t}}]),i}(_v),kv=function(){function t(e){var i=this;wd(this,t),this.instance=e,Cd(this,"groupMap",{}),Cd(this,"_connectionSourceMap",{}),Cd(this,"_connectionTargetMap",{}),e.bind(Xu,(function(t){var e=i.getGroupFor(t.source),n=i.getGroupFor(t.target);null!=e&&null!=n&&e===n?(i._connectionSourceMap[t.connection.id]=e,i._connectionTargetMap[t.connection.id]=e,eu(e.connections.internal,t.connection)):(null!=e&&(t.target._jsPlumbGroup===e?eu(e.connections.internal,t.connection):eu(e.connections.source,t.connection),i._connectionSourceMap[t.connection.id]=e),null!=n&&(t.source._jsPlumbGroup===n?eu(n.connections.internal,t.connection):eu(n.connections.target,t.connection),i._connectionTargetMap[t.connection.id]=n))})),e.bind(Ju,(function(t){i._cleanupDetachedConnection(t.connection)})),e.bind(Ku,(function(t){var e=t.originalEndpoint.element,n=i.getGroupFor(e),o=t.connection.endpoints[t.index].element,s=i.getGroupFor(o),r=0===t.index?i._connectionSourceMap:i._connectionTargetMap,a=0===t.index?i._connectionTargetMap:i._connectionSourceMap;null!=s?(r[t.connection.id]=s,t.connection.source===t.connection.target&&(a[t.connection.id]=s)):(delete r[t.connection.id],t.connection.source===t.connection.target&&delete a[t.connection.id]),null!=n&&i._updateConnectionsForGroup(n),null!=s&&i._updateConnectionsForGroup(s)}))}return Sd(t,[{key:"_cleanupDetachedConnection",value:function(t){t.proxies.length=0;var e,i=this._connectionSourceMap[t.id];null!=i&&(e=function(e){return e.id===t.id},Kd(i.connections.source,e),Kd(i.connections.target,e),Kd(i.connections.internal,e),delete this._connectionSourceMap[t.id]),null!=(i=this._connectionTargetMap[t.id])&&(e=function(e){return e.id===t.id},Kd(i.connections.source,e),Kd(i.connections.target,e),Kd(i.connections.internal,e),delete this._connectionTargetMap[t.id])}},{key:"addGroup",value:function(t){var e=t.el;if(null!=this.groupMap[t.id])throw new Error("cannot create Group ["+t.id+"]; a Group with that ID exists");if(null!=e._isJsPlumbGroup)throw new Error("cannot create Group ["+t.id+"]; the given element is already a Group");var i=new wv(this.instance,t.el,t);return this.groupMap[i.id]=i,t.collapsed&&this.collapseGroup(i),this.instance.manage(i.el),this.instance.addClass(i.el,Gu),i.manager=this,this._updateConnectionsForGroup(i),this.instance.fire("group:added",{group:i}),i}},{key:"getGroup",value:function(t){var e=t;if(Bd(t)&&null==(e=this.groupMap[t]))throw new Error("No such group ["+t+"]");return e}},{key:"getGroupFor",value:function(t){for(var e=t,i=this.instance.getContainer(),n=!1,o=null;!n;)null==e||e===i?n=!0:e._jsPlumbParentGroup?(o=e._jsPlumbParentGroup,n=!0):e=e.parentNode;return o}},{key:"getGroups",value:function(){var t=[];for(var e in this.groupMap)t.push(this.groupMap[e]);return t}},{key:"removeGroup",value:function(t,e,i,n){var o=this,s=this.getGroup(t);this.expandGroup(s,!0);var r={};return Gd(s.children,(function(t){var e=o.instance.getManagedElements()[o.instance.getId(t.el)];e&&delete e.group})),e?(Gd(s.getGroups(),(function(t){return o.removeGroup(t,e,i)})),s.removeAll(i,n)):(s.group&&Gd(s.children,(function(t){return s.group.add(t.el)})),r=s.orphanAll()),s.group&&s.group.removeGroup(s),this.instance.unmanage(s.el,!0),delete this.groupMap[s.id],this.instance.fire("group:removed",{group:s}),r}},{key:"removeAllGroups",value:function(t,e,i){for(var n in this.groupMap)this.removeGroup(this.groupMap[n],t,e,i)}},{key:"forEach",value:function(t){for(var e in this.groupMap)t(this.groupMap[e])}},{key:"orphan",value:function(t,e){var i=t;if(i._jsPlumbParentGroup){var n=i._jsPlumbParentGroup,o=this.instance.getId(i),s=this.instance.getOffset(t);return!0!==e&&n.group?this.instance._appendElementToGroup(n.group,t):this.instance._appendElementToContainer(t),this.instance.setPosition(t,s),delete i._jsPlumbParentGroup,{id:o,pos:s}}}},{key:"_updateConnectionsForGroup",value:function(t){var e=this;t.connections.source.length=0,t.connections.target.length=0,t.connections.internal.length=0;var i=t.children.slice().map((function(t){return t.el})),n=[];if(Gd(i,(function(t){Array.prototype.push.apply(n,e.instance.getSelector(t,ap))})),Array.prototype.push.apply(i,n),i.length>0){var o,s,r=this.instance.getConnections({source:i,scope:Of},!0),a=this.instance.getConnections({target:i,scope:Of},!0),l={},c=function(i){for(var n=0;n<i.length;n++)l[i[n].id]||(l[i[n].id]=!0,o=e.getGroupFor(i[n].source),s=e.getGroupFor(i[n].target),i[n].source===t.el&&s===t||i[n].target===t.el&&o===t?t.connections.internal.push(i[n]):o===t?(s!==t?t.connections.source.push(i[n]):t.connections.internal.push(i[n]),e._connectionSourceMap[i[n].id]=t):s===t&&(t.connections.target.push(i[n]),e._connectionTargetMap[i[n].id]=t))};c(r),c(a)}}},{key:"_collapseConnection",value:function(t,e,i){var n=t.endpoints[0===e?1:0].element;if(n._jsPlumbParentGroup&&!n._jsPlumbParentGroup.proxied&&n._jsPlumbParentGroup.collapsed)return!1;var o=t.endpoints[0].element._jsPlumbParentGroup,s=null!=o?o.collapseParent||o:null,r=t.endpoints[1].element._jsPlumbParentGroup,a=null!=r?r.collapseParent||r:null;if(null==s||null==a||s.id!==a.id){var l=i.el;return this.instance.getId(l),this.instance.proxyConnection(t,e,l,(function(t,e){return i.getEndpoint(t,e)}),(function(t,e){return i.getAnchor(t,e)})),!0}return!1}},{key:"_expandConnection",value:function(t,e,i){this.instance.unproxyConnection(t,e)}},{key:"isElementDescendant",value:function(t,e){for(var i=this.instance.getContainer();;){if(null==t||t===i)return!1;if(t===e)return!0;t=t.parentNode}}},{key:"collapseGroup",value:function(t){var e=this,i=this.getGroup(t);if(null!=i&&!i.collapsed){var n=i.el;if(null==i.collapseParent){if(this.instance.setGroupVisible(i,!1),i.collapsed=!0,this.instance.removeClass(n,Gu),this.instance.addClass(n,Wu),i.proxied){var o=new Set,s=function(t,n){for(var s=0;s<t.length;s++){var r=t[s];!0===e._collapseConnection(r,n,i)&&o.add(r.id)}};s(i.connections.source,0),s(i.connections.target,1),Gd(i.getGroups(),(function(t){e.cascadeCollapse(i,t,o)}))}this.instance.revalidate(n),this.repaintGroup(i),this.instance.fire("group:collapse",{group:i})}else i.collapsed=!0,this.instance.removeClass(n,Gu),this.instance.addClass(n,Wu)}}},{key:"cascadeCollapse",value:function(t,e,i){var n=this;if(t.proxied){var o=function(e,o){for(var s=0;s<e.length;s++){var r=e[s];i.has(r.id)||!0===n._collapseConnection(r,o,t)&&i.add(r.id)}};o(e.connections.source,0),o(e.connections.target,1)}Gd(e.getGroups(),(function(e){n.cascadeCollapse(t,e,i)}))}},{key:"expandGroup",value:function(t,e){var i=this,n=this.getGroup(t);if(null!=n){var o=n.el;if(null==n.collapseParent){if(this.instance.setGroupVisible(n,!0),n.collapsed=!1,this.instance.addClass(o,Gu),this.instance.removeClass(o,Wu),n.proxied){var s=function(t,e){for(var o=0;o<t.length;o++){var s=t[o];i._expandConnection(s,e,n)}};s(n.connections.source,0),s(n.connections.target,1);Gd(n.getGroups(),(function t(e,n){if(n||e.collapsed){var o=function(t,n){for(var o=0;o<t.length;o++){var s=t[o];i._collapseConnection(s,n,e.collapseParent||e)}};o(e.connections.source,0),o(e.connections.target,1),Gd(e.connections.internal,(function(t){return t.setVisible(!1)})),Gd(e.getGroups(),(function(e){return t(e,!0)}))}else i.expandGroup(e,!0)}))}this.instance.revalidate(o),this.repaintGroup(n),e||this.instance.fire("group:expand",{group:n})}else n.collapsed=!1,this.instance.addClass(o,Gu),this.instance.removeClass(o,Wu)}}},{key:"toggleGroup",value:function(t){null!=(t=this.getGroup(t))&&(t.collapsed?this.expandGroup(t):this.collapseGroup(t))}},{key:"repaintGroup",value:function(t){for(var e=this.getGroup(t).children,i=0;i<e.length;i++)this.instance.revalidate(e[i].el)}},{key:"addToGroup",value:function(t,e){var i=this,n=this.getGroup(t);if(n){for(var o=n.el,s=arguments.length,r=new Array(s>2?s-2:0),a=2;a<s;a++)r[a-2]=arguments[a];Gd(r,(function(t){var s=t,r=null!=s._isJsPlumbGroup,a=s._jsPlumbGroup,l=s._jsPlumbParentGroup;if(l!==n){var c=i.instance.manage(t),h=i.instance.getOffset(t),d=n.collapsed?i.instance.getOffsetRelativeToRoot(o):i.instance.getOffset(i.instance.getGroupContentArea(n));c.group=n.elId,null!=l&&(l.remove(t,!1,e,!1,n),i._updateConnectionsForGroup(l)),r?n.addGroup(a):n.add(t,e);var u=function(t,e){var o=0===e?1:0;t.each((function(t){t.setVisible(!1),t.endpoints[o].element._jsPlumbGroup===n?(t.endpoints[o].setVisible(!1),i._expandConnection(t,o,n)):(t.endpoints[e].setVisible(!1),i._collapseConnection(t,e,n))}))};n.collapsed&&(u(i.instance.select({source:t}),0),u(i.instance.select({target:t}),1)),i.instance.getId(t);var p={x:h.x-d.x,y:h.y-d.y};if(i.instance.setPosition(t,p),i._updateConnectionsForGroup(n),i.instance.revalidate(t),!e){var f={group:n,el:t,pos:p};l&&(f.sourceGroup=l),i.instance.fire("group:member:added",f)}}}))}}},{key:"removeFromGroup",value:function(t,e){var i=this,n=this.getGroup(t);if(n){for(var o=arguments.length,s=new Array(o>2?o-2:0),r=2;r<o;r++)s[r-2]=arguments[r];Gd(s,(function(t){if(n.collapsed){var o=function(e,o){for(var s=0;s<e.length;s++){var r=e[s];if(r.proxies)for(var a=0;a<r.proxies.length;a++)if(null!=r.proxies[a]){var l=r.proxies[a].originalEp.element;(l===t||i.isElementDescendant(l,t))&&i._expandConnection(r,o,n)}}};o(n.connections.source.slice(),0),o(n.connections.target.slice(),1)}n.remove(t,null,e);var s=i.instance.getManagedElements()[i.instance.getId(t)];s&&delete s.group}))}}},{key:"getAncestors",value:function(t){for(var e=[],i=t.group;null!=i;)e.push(i),i=i.group;return e}},{key:"isAncestor",value:function(t,e){return null!=t&&null!=e&&-1!==this.getAncestors(t).indexOf(e)}},{key:"getDescendants",value:function(t){var e=[];return function t(i){var n=i.getGroups();e.push.apply(e,Id(n)),Gd(n,t)}(t),e}},{key:"isDescendant",value:function(t,e){return null!=t&&null!=e&&-1!==this.getDescendants(e).indexOf(t)}},{key:"reset",value:function(){this._connectionSourceMap={},this._connectionTargetMap={},this.groupMap={}}}]),t}(),Sv=function(){function t(e,i){wd(this,t),this.instance=e,this.entries=i}return Sd(t,[{key:"length",get:function(){return this.entries.length}},{key:"each",value:function(t){return Gd(this.entries,(function(e){return t(e)})),this}},{key:"get",value:function(t){return this.entries[t]}},{key:"addClass",value:function(t,e){return this.each((function(i){return i.addClass(t,e)})),this}},{key:"removeClass",value:function(t,e){return this.each((function(i){return i.removeClass(t,e)})),this}},{key:"removeAllOverlays",value:function(){return this.each((function(t){return t.removeAllOverlays()})),this}},{key:"setLabel",value:function(t){return this.each((function(e){return e.setLabel(t)})),this}},{key:"clear",value:function(){return this.entries.length=0,this}},{key:"map",value:function(t){var e=[];return this.each((function(i){return e.push(t(i))})),e}},{key:"addOverlay",value:function(t){return this.each((function(e){return e.addOverlay(t)})),this}},{key:"removeOverlay",value:function(t){return this.each((function(e){return e.removeOverlay(t)})),this}},{key:"removeOverlays",value:function(){return this.each((function(t){return t.removeOverlays()})),this}},{key:"showOverlay",value:function(t){return this.each((function(e){return e.showOverlay(t)})),this}},{key:"hideOverlay",value:function(t){return this.each((function(e){return e.hideOverlay(t)})),this}},{key:"setPaintStyle",value:function(t){return this.each((function(e){return e.setPaintStyle(t)})),this}},{key:"setHoverPaintStyle",value:function(t){return this.each((function(e){return e.setHoverPaintStyle(t)})),this}},{key:"setSuspendEvents",value:function(t){return this.each((function(e){return e.setSuspendEvents(t)})),this}},{key:"setParameter",value:function(t,e){return this.each((function(i){return i.parameters[t]=e})),this}},{key:"setParameters",value:function(t){return this.each((function(e){return e.parameters=t})),this}},{key:"setVisible",value:function(t){return this.each((function(e){return e.setVisible(t)})),this}},{key:"addType",value:function(t){return this.each((function(e){return e.addType(t)})),this}},{key:"toggleType",value:function(t){return this.each((function(e){return e.toggleType(t)})),this}},{key:"removeType",value:function(t){return this.each((function(e){return e.removeType(t)})),this}},{key:"bind",value:function(t,e){return this.each((function(i){return i.bind(t,e)})),this}},{key:"unbind",value:function(t,e){return this.each((function(i){return i.unbind(t,e)})),this}},{key:"setHover",value:function(t){var e=this;return this.each((function(i){return e.instance.setHover(i,t)})),this}}]),t}(),Cv=function(t){Ed(i,t);var e=Pd(i);function i(){return wd(this,i),e.apply(this,arguments)}return Sd(i,[{key:"setEnabled",value:function(t){return this.each((function(e){return e.enabled=t})),this}},{key:"setAnchor",value:function(t){return this.each((function(e){return e.setAnchor(t)})),this}},{key:"deleteEveryConnection",value:function(){return this.each((function(t){return t.deleteEveryConnection()})),this}},{key:"deleteAll",value:function(){var t=this;return this.each((function(e){return t.instance.deleteEndpoint(e)})),this.clear(),this}}]),i}(Sv),Ev=function(t){Ed(i,t);var e=Pd(i);function i(){return wd(this,i),e.apply(this,arguments)}return Sd(i,[{key:"setDetachable",value:function(t){return this.each((function(e){return e.setDetachable(t)})),this}},{key:"setReattach",value:function(t){return this.each((function(e){return e.setReattach(t)})),this}},{key:"setConnector",value:function(t){return this.each((function(e){return e._setConnector(t)})),this}},{key:"deleteAll",value:function(){var t=this;this.each((function(e){return t.instance.deleteConnection(e)})),this.clear()}},{key:"repaint",value:function(){var t=this;return this.each((function(e){return t.instance._paintConnection(e)})),this}}]),i}(Sv),Av=function t(){wd(this,t),Cd(this,"affectedElements",new Set)};function Mv(){return{x:0,y:0,w:0,h:0,r:0,c:{x:0,y:0},x2:0,y2:0,t:{x:0,y:0,c:{x:0,y:0},w:0,h:0,r:0,x2:0,y2:0,cr:0,sr:0},dirty:!0}}var Tv=function(t,e){var i=0;return e[1]>t[1]?i=-1:e[1]<t[1]&&(i=1),i},Pv=function(t,e){return-1*Tv(t,e)};function Ov(t,e,i,n){!function(t,e,i,n){if(0===e.length)e.push(t);else{for(var o=n?-1:1,s=0,r=e.length,a=Math.floor((s+r)/2);r>s;)i(t,e[a])*o<0?r=a:s=a+1,a=Math.floor((s+r)/2);e.splice(a,0,t)}}([t,e],i,Tv,n)}function Dv(t,e){var i=Zd(e,(function(e){return e[0]===t}));i>-1&&e.splice(i,1)}var Iv,Lv=function(t){Ed(i,t);var e=Pd(i);function i(t){var n;return wd(this,i),(n=e.call(this)).instance=t,Cd(Td(n),"_currentTransaction",null),Cd(Td(n),"_sortedElements",{xmin:[],xmax:[],ymin:[],ymax:[]}),Cd(Td(n),"_elementMap",new Map),Cd(Td(n),"_transformedElementMap",new Map),Cd(Td(n),"_bounds",{minx:0,maxx:0,miny:0,maxy:0}),n}return Sd(i,[{key:"_updateBounds",value:function(t,e,i){null!=e&&(Dv(t,this._sortedElements.xmin),Dv(t,this._sortedElements.xmax),Dv(t,this._sortedElements.ymin),Dv(t,this._sortedElements.ymax),Ov(t,e.t.x,this._sortedElements.xmin,!1),Ov(t,e.t.x+e.t.w,this._sortedElements.xmax,!0),Ov(t,e.t.y,this._sortedElements.ymin,!1),Ov(t,e.t.y+e.t.h,this._sortedElements.ymax,!0),!0!==i&&this._recalculateBounds())}},{key:"_recalculateBounds",value:function(){this._bounds.minx=this._sortedElements.xmin.length>0?this._sortedElements.xmin[0][1]:0,this._bounds.maxx=this._sortedElements.xmax.length>0?this._sortedElements.xmax[0][1]:0,this._bounds.miny=this._sortedElements.ymin.length>0?this._sortedElements.ymin[0][1]:0,this._bounds.maxy=this._sortedElements.ymax.length>0?this._sortedElements.ymax[0][1]:0}},{key:"recomputeBounds",value:function(){var t=this;this._sortedElements.xmin.length=0,this._sortedElements.xmax.length=0,this._sortedElements.ymin.length=0,this._sortedElements.ymax.length=0,this._elementMap.forEach((function(e,i){t._sortedElements.xmin.push([i,e.t.x]),t._sortedElements.xmax.push([i,e.t.x+e.t.w]),t._sortedElements.ymin.push([i,e.t.y]),t._sortedElements.ymax.push([i,e.t.y+e.t.h])})),this._sortedElements.xmin.sort(Tv),this._sortedElements.ymin.sort(Tv),this._sortedElements.xmax.sort(Pv),this._sortedElements.ymax.sort(Pv),this._recalculateBounds()}},{key:"_finaliseUpdate",value:function(t,e,i){e.t=function(t,e,i,n,o){var s=t+i/2,r=e+n/2,a=Math.cos(o/360*Math.PI*2),l=Math.sin(o/360*Math.PI*2),c=function(t,e){return{x:s+Math.round((t-s)*a-(e-r)*l),y:r+Math.round((e-r)*a-(t-s)*l)}},h=c(t,e),d=c(t+i,e),u=c(t+i,e+n),p=c(t,e+n),f=c(t+i/2,e+n/2),m=Math.min(h.x,d.x,u.x,p.x),g=Math.max(h.x,d.x,u.x,p.x),v=Math.min(h.y,d.y,u.y,p.y),y=Math.max(h.y,d.y,u.y,p.y);return{x:m,y:v,w:g-m,h:y-v,c:f,r:o,x2:g,y2:y,cr:a,sr:l}}(e.x,e.y,e.w,e.h,e.r),this._transformedElementMap.set(t,e.t),!0!==i&&this._updateBounds(t,e,i)}},{key:"shouldFireEvent",value:function(t,e,i){return!0}},{key:"startTransaction",value:function(){if(null!=this._currentTransaction)throw new Error("Viewport: cannot start transaction; a transaction is currently active.");this._currentTransaction=new Av}},{key:"endTransaction",value:function(){var t=this;null!=this._currentTransaction&&(this._currentTransaction.affectedElements.forEach((function(e){var i=t.getPosition(e);t._finaliseUpdate(e,i,!0)})),this.recomputeBounds(),this._currentTransaction=null)}},{key:"updateElements",value:function(t){var e=this;Gd(t,(function(t){return e.updateElement(t.id,t.x,t.y,t.width,t.height,t.rotation)}))}},{key:"updateElement",value:function(t,e,i,n,o,s,r){var a=uu(this._elementMap,t,Mv);return a.dirty=null==e&&null==a.x||null==i&&null==a.y||null==n&&null==a.w||null==o&&null==a.h,null!=e&&(a.x=e),null!=i&&(a.y=i),null!=n&&(a.w=n),null!=o&&(a.h=o),null!=s&&(a.r=s||0),a.c.x=a.x+a.w/2,a.c.y=a.y+a.h/2,a.x2=a.x+a.w,a.y2=a.y+a.h,null==this._currentTransaction?this._finaliseUpdate(t,a,r):this._currentTransaction.affectedElements.add(t),a}},{key:"refreshElement",value:function(t,e){var i=this.instance.getManagedElements(),n=i[t]?i[t].el:null;if(null!=n){var o=this.getSize(n),s=this.getOffset(n);return this.updateElement(t,s.x,s.y,o.w,o.h,null,e)}return null}},{key:"getSize",value:function(t){return this.instance.getSize(t)}},{key:"getOffset",value:function(t){return this.instance.getOffset(t)}},{key:"registerElement",value:function(t,e){return this.updateElement(t,0,0,0,0,0,e)}},{key:"addElement",value:function(t,e,i,n,o,s){return this.updateElement(t,e,i,n,o,s)}},{key:"rotateElement",value:function(t,e){var i=uu(this._elementMap,t,Mv);return i.r=e||0,this._finaliseUpdate(t,i),i}},{key:"getBoundsWidth",value:function(){return this._bounds.maxx-this._bounds.minx}},{key:"getBoundsHeight",value:function(){return this._bounds.maxy-this._bounds.miny}},{key:"getX",value:function(){return this._bounds.minx}},{key:"getY",value:function(){return this._bounds.miny}},{key:"setSize",value:function(t,e,i){if(this._elementMap.has(t))return this.updateElement(t,null,null,e,i,null)}},{key:"setPosition",value:function(t,e,i){if(this._elementMap.has(t))return this.updateElement(t,e,i,null,null,null)}},{key:"reset",value:function(){this._sortedElements.xmin.length=0,this._sortedElements.xmax.length=0,this._sortedElements.ymin.length=0,this._sortedElements.ymax.length=0,this._elementMap.clear(),this._transformedElementMap.clear(),this._recalculateBounds()}},{key:"remove",value:function(t){Dv(t,this._sortedElements.xmin),Dv(t,this._sortedElements.xmax),Dv(t,this._sortedElements.ymin),Dv(t,this._sortedElements.ymax),this._elementMap.delete(t),this._transformedElementMap.delete(t),this._recalculateBounds()}},{key:"getPosition",value:function(t){return this._elementMap.get(t)}},{key:"getElements",value:function(){return this._elementMap}},{key:"isEmpty",value:function(){return 0===this._elementMap.size}}]),i}($g);function $v(t,e){return e.theta-t.theta}function zv(t,e){return(t.theta<0?-Math.PI-t.theta:Math.PI-t.theta)-(e.theta<0?-Math.PI-e.theta:Math.PI-e.theta)}var Rv=(Cd(Iv={},Km,zv),Cd(Iv,Jm,$v),Cd(Iv,tg,$v),Cd(Iv,Qm,zv),Iv);function Nv(t){return!0===t.isContinuous}function Bv(t){return!0===t.isContinuous}function jv(t){return t.locations.length>1}function Fv(t){return[t.currentLocation,t.locations[t.currentLocation]]}var qv=function(){function t(e){var i=this;wd(this,t),this.instance=e,Cd(this,"anchorLists",new Map),Cd(this,"anchorLocations",new Map),e.bind(Ju,(function(t){t.sourceEndpoint._anchor.isContinuous&&i._removeEndpointFromAnchorLists(t.sourceEndpoint),t.targetEndpoint._anchor.isContinuous&&i._removeEndpointFromAnchorLists(t.targetEndpoint)})),e.bind(Qu,(function(t){i._removeEndpointFromAnchorLists(t)}))}return Sd(t,[{key:"getAnchorOrientation",value:function(t){var e=this.anchorLocations.get(t.id);return e?[e.ox,e.oy]:[0,0]}},{key:"_distance",value:function(t,e,i,n,o,s,r){var a=n.x+t.x*o.w,l=n.y+t.y*o.h,c=n.x+o.w/2,h=n.y+o.h/2;if(null!=s&&s.length>0){var d=this.instance._applyRotations([a,l,0,0],s);a=d.x,l=d.y}return Math.sqrt(Math.pow(e-a,2)+Math.pow(i-l,2))+Math.sqrt(Math.pow(c-a,2)+Math.pow(h-l,2))}},{key:"_anchorSelector",value:function(t,e,i,n,o,s,r){for(var a=i.x+n.w/2,l=i.y+n.h/2,c=-1,h=1/0,d=0;d<r.length;d++){var u=this._distance(r[d],a,l,t,e,o,s);u<h&&(c=d+0,h=u)}return[c,r[c]]}},{key:"_floatingAnchorCompute",value:function(t,e){var i=e.xy,n={curX:i.x+t.size.w/2,curY:i.y+t.size.h/2,x:0,y:0,ox:0,oy:0};return this._setComputedPosition(t,n)}},{key:"_setComputedPosition",value:function(t,e,i){return this.anchorLocations.set(t.id,e),t.computedPosition=e,i&&(t.timestamp=i),e}},{key:"_computeSingleLocation",value:function(t,e,i,n){var o,s=n.rotation,r={curX:e.x+t.x*i.w+t.offx,curY:e.y+t.y*i.h+t.offy,x:t.x,y:t.y,ox:0,oy:0};if(null!=s&&s.length>0){var a=[t.iox,t.ioy],l={x:r.curX,y:r.curY,cr:0,sr:0};Gd(s,(function(t){l=ru(l,t.c,t.r);var e=[Math.round(a[0]*l.cr-a[1]*l.sr),Math.round(a[1]*l.cr+a[0]*l.sr)];a=e.slice()})),t.ox=a[0],t.oy=a[1],o={curX:l.x,curY:l.y,x:t.x,y:t.y,ox:a[0],oy:a[1]}}else t.ox=t.iox,t.oy=t.ioy,o=Rd({ox:t.iox,oy:t.ioy},r);return o}},{key:"_singleAnchorCompute",value:function(t,e){var i=e.xy,n=e.wh,o=e.timestamp,s=this.anchorLocations.get(t.id);if(null!=s&&o&&o===t.timestamp)return s;var r=Dd(Fv(t),2);r[0];var a=r[1];return s=this._computeSingleLocation(a,i,n,e),this._setComputedPosition(t,s,o)}},{key:"_defaultAnchorCompute",value:function(t,e){var i;if(1===t.locations.length)return this._singleAnchorCompute(t,e);var n=e.xy,o=e.wh,s=e.txy,r=e.twh,a=Dd(Fv(t),2),l=a[0],c=a[1];if(t.locked||null==s||null==r)i=this._computeSingleLocation(c,n,o,e);else{var h=Dd(this._anchorSelector(n,o,s,r,e.rotation,e.tRotation,t.locations),2),d=h[0],u=h[1];t.currentLocation=d,d!==l&&(t.cssClass=u.cls||t.cssClass,e.element._anchorLocationChanged(t)),i=this._computeSingleLocation(u,n,o,e)}return this._setComputedPosition(t,i,e.timestamp)}},{key:"_placeAnchors",value:function(t,e){var i=this,n=this.instance.viewport.getPosition(t),o=function(e,o,s,r,a,l){if(s.length>0)for(var c=s.sort(Rv[e]),h=function(t,e,i,n,o){for(var s=i?t.w:t.h,r=i?t.h:t.w,a=[],l=s/(e.length+1),c=0;c<e.length;c++){var h=(c+1)*l,d=n*r;o&&(h=s-h);var u=i?h:d,p=t.x+u,f=u/t.w,m=i?d:h,g=t.y+m,v=m/t.h;if(0!==t.r&&null!=t.r){var y=ru({x:p,y:g},t.c,t.r);p=y.x,g=y.y}a.push({x:p,y:g,xLoc:f,yLoc:v,c:e[c].c})}return a}(n,c,r,a,e===Jm||e===Km),d=0;d<h.length;d++){var u=h[d].c,p=u.endpoints[0].elementId===t?u.endpoints[0]:u.endpoints[1];i._setComputedPosition(p._anchor,{curX:h[d].x,curY:h[d].y,x:h[d].xLoc,y:h[d].yLoc,ox:l[0],oy:l[1]})}};o(tg,0,e.bottom,!0,1,[0,1]),o(Km,0,e.top,!0,0,[0,-1]),o(Qm,0,e.left,!1,0,[-1,0]),o(Jm,0,e.right,!1,1,[1,0])}},{key:"_updateAnchorList",value:function(t,e,i,n,o,s,r,a,l,c,h){var d,u=n.endpoints[r],p=u.id,f=[1,0][r],m={theta:e,order:i,c:n,b:o,elId:s,epId:p},g=t[l],v=u._continuousAnchorEdge?t[u._continuousAnchorEdge]:null;if(v){var y=Zd(v,(function(t){return t.epId===p}));if(-1!==y){v.splice(y,1);for(var b=0;b<v.length;b++)!0!==(d=v[b].c).placeholder&&c.add(d),h.add(v[b].c.endpoints[r]),h.add(v[b].c.endpoints[f])}}for(var x=0;x<g.length;x++)!0!==(d=g[x].c).placeholder&&c.add(d),h.add(g[x].c.endpoints[r]),h.add(g[x].c.endpoints[f]);var _=a?0:g.length;g.splice(_,0,m),u._continuousAnchorEdge=l}},{key:"_removeEndpointFromAnchorLists",value:function(t){var e=this.anchorLists.get(t.elementId),i=0;!function(t,e){if(t){var n=function(t){return t.epId===e};Kd(t.top,n),Kd(t.left,n),Kd(t.bottom,n),Kd(t.right,n),i+=t.top.length,i+=t.left.length,i+=t.bottom.length,i+=t.right.length}}(e,t.id),0===i&&this.anchorLists.delete(t.elementId),this.anchorLocations.delete(t._anchor.id)}},{key:"computeAnchorLocation",value:function(t,e){var i;return i=Nv(t)?this.anchorLocations.get(t.id)||{curX:0,curY:0,x:0,y:0,ox:0,oy:0}:Bv(t)?this._floatingAnchorCompute(t,e):this._defaultAnchorCompute(t,e),t.timestamp=e.timestamp,i}},{key:"computePath",value:function(t,e){var i=this.instance.viewport.getPosition(t.sourceId),n=this.instance.viewport.getPosition(t.targetId),o=t.endpoints[0],s=t.endpoints[1],r=this.getEndpointLocation(o,{xy:i,wh:i,element:o,timestamp:e,rotation:this.instance._getRotations(t.sourceId)}),a=this.getEndpointLocation(s,{xy:n,wh:n,element:s,timestamp:e,rotation:this.instance._getRotations(t.targetId)});t.connector.resetBounds(),t.connector.compute({sourcePos:r,targetPos:a,sourceEndpoint:t.endpoints[0],targetEndpoint:t.endpoints[1],strokeWidth:t.paintStyleInUse.strokeWidth,sourceInfo:i,targetInfo:n})}},{key:"getEndpointLocation",value:function(t,e){e=e||{};var i=t._anchor,n=this.anchorLocations.get(i.id);return(null==n||null!=e.timestamp&&i.timestamp!==e.timestamp)&&(n=this.computeAnchorLocation(i,e),this._setComputedPosition(i,n,e.timestamp)),n}},{key:"getEndpointOrientation",value:function(t){return t._anchor?this.getAnchorOrientation(t._anchor):[0,0]}},{key:"setAnchorOrientation",value:function(t,e){var i=this.anchorLocations.get(t.id);null!=i&&(i.ox=e[0],i.oy=e[1])}},{key:"isDynamicAnchor",value:function(t){return!!t._anchor&&(!Nv(t._anchor)&&t._anchor.locations.length>1)}},{key:"isFloating",value:function(t){return!!t._anchor&&Bv(t._anchor)}},{key:"prepareAnchor",value:function(t){return _g(t)}},{key:"redraw",value:function(t,e,i){var n=this,o=new Set,s=new Set,r=new Set;if(!this.instance._suspendDrawing){var a=this.instance.endpointsByElement[t]||[];e=e||su();for(var l,c,h={},d=0;d<a.length;d++)if(!1!==(c=a[d]).visible)if(s.add(c),l=c._anchor,0===c.connections.length)Nv(l)&&(this.anchorLists.has(t)||this.anchorLists.set(t,{top:[],right:[],bottom:[],left:[]}),this._updateAnchorList(this.anchorLists.get(t),-Math.PI/2,0,{endpoints:[c,c],placeholder:!0},!1,t,0,!1,ag(l),o,s),r.add(t));else for(var u=0;u<c.connections.length;u++){var p=c.connections[u],f=p.sourceId,m=p.targetId,g=Nv(p.endpoints[0]._anchor),v=Nv(p.endpoints[1]._anchor);if(g||v){var y=[f,(p.endpoints[0]._anchor.faces||[]).join("-"),m,(p.endpoints[1]._anchor.faces||[]).join("-")].join("-"),b=h[y],x=p.sourceId===t?1:0;g&&!this.anchorLists.has(f)&&this.anchorLists.set(f,{top:[],right:[],bottom:[],left:[]}),v&&!this.anchorLists.has(m)&&this.anchorLists.set(m,{top:[],right:[],bottom:[],left:[]});var _=this.instance.viewport.getPosition(m),w=this.instance.viewport.getPosition(f);if(m===f&&(g||v))this._updateAnchorList(this.anchorLists.get(f),-Math.PI/2,0,p,!1,m,0,!1,Km,o,s),this._updateAnchorList(this.anchorLists.get(m),-Math.PI/2,0,p,!1,f,1,!1,Km,o,s);else{var k=this.instance._getRotations(f),S=this.instance._getRotations(m);b||(b=this._calculateOrientation(f,m,w,_,p.endpoints[0]._anchor,p.endpoints[1]._anchor,k,S),h[y]=b),g&&this._updateAnchorList(this.anchorLists.get(f),b.theta,0,p,!1,m,0,!1,b.a[0],o,s),v&&this._updateAnchorList(this.anchorLists.get(m),b.theta2,-1,p,!0,f,1,!0,b.a[1],o,s)}g&&r.add(f),v&&r.add(m),o.add(p),(g&&0===x||v&&1===x)&&s.add(p.endpoints[x])}else{var C=c.connections[u].endpoints[p.sourceId===t?1:0];if(jv(C._anchor)){this.instance._paintEndpoint(C,{elementWithPrecedence:t,timestamp:e}),o.add(c.connections[u]);for(var E=0;E<C.connections.length;E++)C.connections[E]!==c.connections[u]&&o.add(C.connections[E])}else o.add(c.connections[u])}}r.forEach((function(t){n._placeAnchors(t,n.anchorLists.get(t))})),s.forEach((function(t){var i=n.instance.viewport.getPosition(t.elementId);n.instance._paintEndpoint(t,{timestamp:e,offset:i})})),o.forEach((function(t){n.instance._paintConnection(t,{timestamp:e})}))}return{c:o,e:s}}},{key:"reset",value:function(){this.anchorLocations.clear(),this.anchorLists.clear()}},{key:"setAnchor",value:function(t,e){null!=e&&(t._anchor=e)}},{key:"setConnectionAnchors",value:function(t,e){t.endpoints[0]._anchor=e[0],t.endpoints[1]._anchor=e[1]}},{key:"_calculateOrientation",value:function(t,e,i,n,o,s,r,a){var l=this;if(t===e)return{orientation:"identity",a:[Km,Km]};var c=Math.atan2(n.c.y-i.c.y,n.c.x-i.c.x),h=Math.atan2(i.c.y-n.c.y,i.c.x-n.c.x),d=[],u={};!function(t,e){for(var i=0;i<t.length;i++){var n;if(u[t[i]]=(Cd(n={},Qm,{x:e[i][0].x,y:e[i][0].c.y}),Cd(n,Jm,{x:e[i][0].x+e[i][0].w,y:e[i][0].c.y}),Cd(n,Km,{x:e[i][0].c.x,y:e[i][0].y}),Cd(n,tg,{x:e[i][0].c.x,y:e[i][0].y+e[i][0].h}),n),null!=e[i][1]&&e[i][1].length>0)for(var o in u[t[i]])u[t[i]][o]=l.instance._applyRotationsXY(u[t[i]][o],e[i][1])}}([Ou,Du],[[i,r],[n,a]]);for(var p=[Km,Qm,Jm,tg],f=0;f<p.length;f++)for(var m=0;m<p.length;m++)d.push({source:p[f],target:p[m],dist:rm(u.source[p[f]],u.target[p[m]])});d.sort((function(t,e){if(t.dist<e.dist)return-1;if(e.dist<t.dist)return 1;var i,n=(Cd(i={},Qm,0),Cd(i,Km,1),Cd(i,Jm,2),Cd(i,tg,3),i),o=n[t.source],s=n[e.source],r=n[t.target],a=n[e.target];return o<s?-1:s<o?1:r<a?-1:a<r?1:0}));for(var g=d[0].source,v=d[0].target,y=0;y<d.length&&(g=Nv(o)&&o.locked?o.currentFace:!o.isContinuous||cg(o,d[y].source)?d[y].source:null,v=s.isContinuous&&s.locked?s.currentFace:!s.isContinuous||cg(s,d[y].target)?d[y].target:null,null==g||null==v);y++);return o.isContinuous&&this.setCurrentFace(o,g),s.isContinuous&&this.setCurrentFace(s,v),{a:[g,v],theta:c,theta2:h}}},{key:"setCurrentFace",value:function(t,e,i){t.currentFace=e,i&&null!=t.lockedFace&&(t.lockedFace=t.currentFace)}},{key:"lock",value:function(t){t.locked=!0,Nv(t)&&(t.lockedFace=t.currentFace)}},{key:"unlock",value:function(t){t.locked=!1,Nv(t)&&(t.lockedFace=null)}},{key:"selectAnchorLocation",value:function(t,e){var i=Zd(t.locations,(function(t){return t.x===e.x&&t.y===e.y}));return-1!==i&&(t.currentLocation=i,!0)}},{key:"lockCurrentAxis",value:function(t){null!=t.currentFace&&(t.lockedAxis=t.currentFace===Qm||t.currentFace===Jm?eg:ig)}},{key:"unlockCurrentAxis",value:function(t){t.lockedAxis=null}},{key:"anchorsEqual",value:function(t,e){if(!t||!e)return!1;var i=t.locations[t.currentLocation],n=e.locations[e.currentLocation];return i.x===n.x&&i.y===n.y&&i.offx===n.offx&&i.offy===n.offy&&i.ox===n.ox&&i.oy===n.oy}}]),t}(),Vv={},Hv=function(t,e,i){var n=Vv[e];if(n)return new n(t,i);throw{message:"jsPlumb: unknown connector type '"+e+"'"}},Uv=function(t,e){Vv[t]=e},Wv=function(t){Ed(i,t);var e=Pd(i);function i(t){var n;return wd(this,i),Cd(Td(n=e.call(this,t)),"length",void 0),Cd(Td(n),"m",void 0),Cd(Td(n),"m2",void 0),Cd(Td(n),"type",i.segmentType),n._setCoordinates({x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}),n}return Sd(i,[{key:"getPath",value:function(t){return(t?"M "+this.x1+" "+this.y1+" ":"")+"L "+this.x2+" "+this.y2}},{key:"_recalc",value:function(){this.length=Math.sqrt(Math.pow(this.x2-this.x1,2)+Math.pow(this.y2-this.y1,2)),this.m=sm({x:this.x1,y:this.y1},{x:this.x2,y:this.y2}),this.m2=-1/this.m,this.extents={xmin:Math.min(this.x1,this.x2),ymin:Math.min(this.y1,this.y2),xmax:Math.max(this.x1,this.x2),ymax:Math.max(this.y1,this.y2)}}},{key:"getLength",value:function(){return this.length}},{key:"getGradient",value:function(){return this.m}},{key:"_setCoordinates",value:function(t){this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this._recalc()}},{key:"pointOnPath",value:function(t,e){if(0!==t||e){if(1!==t||e){var i=e?t>0?t:this.length+t:t*this.length;return cm({x:this.x1,y:this.y1},{x:this.x2,y:this.y2},i)}return{x:this.x2,y:this.y2}}return{x:this.x1,y:this.y1}}},{key:"gradientAtPoint",value:function(t,e){return this.m}},{key:"pointAlongPathFrom",value:function(t,e,i){var n=this.pointOnPath(t,i),o=e<=0?{x:this.x1,y:this.y1}:{x:this.x2,y:this.y2};return e<=0&&Math.abs(e)>1&&(e*=-1),cm(n,o,e)}},{key:"within",value:function(t,e,i){return i>=Math.min(t,e)&&i<=Math.max(t,e)}},{key:"closest",value:function(t,e,i){return Math.abs(i-t)<Math.abs(i-e)?t:e}},{key:"findClosestPointOnPath",value:function(t,e){var i={d:1/0,x:null,y:null,l:null,x1:this.x1,x2:this.x2,y1:this.y1,y2:this.y2};if(0===this.m)i.y=this.y1,i.x=this.within(this.x1,this.x2,t)?t:this.closest(this.x1,this.x2,t);else if(this.m===1/0||this.m===-1/0)i.x=this.x1,i.y=this.within(this.y1,this.y2,e)?e:this.closest(this.y1,this.y2,e);else{var n=this.y1-this.m*this.x1,o=(e-this.m2*t-n)/(this.m-this.m2),s=this.m*o+n;i.x=this.within(this.x1,this.x2,o)?o:this.closest(this.x1,this.x2,o),i.y=this.within(this.y1,this.y2,s)?s:this.closest(this.y1,this.y2,s)}var r=rm({x:i.x,y:i.y},{x:this.x1,y:this.y1});return i.d=rm({x:t,y:e},i),i.l=r/length,i}},{key:"_pointLiesBetween",value:function(t,e,i){return i>e?e<=t&&t<=i:e>=t&&t>=i}},{key:"lineIntersection",value:function(t,e,i,n){var o=Math.abs(sm({x:t,y:e},{x:i,y:n})),s=Math.abs(this.m),r=s===1/0?this.x1:this.y1-s*this.x1,a=[],l=o===1/0?t:e-o*t;if(o!==s)if(o===1/0&&0===s)this._pointLiesBetween(t,this.x1,this.x2)&&this._pointLiesBetween(this.y1,e,n)&&a.push({x:t,y:this.y1});else if(0===o&&s===1/0)this._pointLiesBetween(e,this.y1,this.y2)&&this._pointLiesBetween(this.x1,t,i)&&a.push({x:this.x1,y:e});else{var c,h;o===1/0?(c=t,this._pointLiesBetween(c,this.x1,this.x2)&&(h=s*t+r,this._pointLiesBetween(h,e,n)&&a.push({x:c,y:h}))):0===o?(h=e,this._pointLiesBetween(h,this.y1,this.y2)&&(c=(e-r)/s,this._pointLiesBetween(c,t,i)&&a.push({x:c,y:h}))):(h=s*(c=(l-r)/(s-o))+r,this._pointLiesBetween(c,this.x1,this.x2)&&this._pointLiesBetween(h,this.y1,this.y2)&&a.push({x:c,y:h}))}return a}},{key:"boxIntersection",value:function(t,e,i,n){var o=[];return o.push.apply(o,this.lineIntersection(t,e,t+i,e)),o.push.apply(o,this.lineIntersection(t+i,e,t+i,e+n)),o.push.apply(o,this.lineIntersection(t+i,e+n,t,e+n)),o.push.apply(o,this.lineIntersection(t,e+n,t,e)),o}}]),i}(Ef);Cd(Wv,"segmentType","Straight");var Gv=function(t){Ed(i,t);var e=Pd(i);function i(){var t;wd(this,i);for(var n=arguments.length,o=new Array(n),s=0;s<n;s++)o[s]=arguments[s];return Cd(Td(t=e.call.apply(e,[this].concat(o))),"type",i.type),t}return Sd(i,[{key:"getDefaultStubs",value:function(){return[0,0]}},{key:"_compute",value:function(t,e){this._addSegment(Wv,{x1:t.sx,y1:t.sy,x2:t.startStubX,y2:t.startStubY}),this._addSegment(Wv,{x1:t.startStubX,y1:t.startStubY,x2:t.endStubX,y2:t.endStubY}),this._addSegment(Wv,{x1:t.endStubX,y1:t.endStubY,x2:t.tx,y2:t.ty}),this.geometry={source:e.sourcePos,target:e.targetPos}}},{key:"transformGeometry",value:function(t,e,i){return{source:this.transformAnchorPlacement(t.source,e,i),target:this.transformAnchorPlacement(t.target,e,i)}}}]),i}(cv);function Zv(t,e,i){var n=[],o=function(e){return Bd(e)?e:t.getId(e)};if(e)if("string"==typeof e){if("*"===e)return e;n.push(e)}else{var s;if(i)n=e;else if(null!=e.length)(s=n).push.apply(s,Id(Id(e).map(o)));else n.push(o(e))}return n}function Yv(t,e,i){null!=e&&(e.connections.push(t),1===e.connections.length&&t.instance.addClass(t.source,t.instance.connectedClass)),null!=i&&(null!=e&&t.sourceId===t.targetId||(i.connections.push(t),1===i.connections.length&&t.instance.addClass(t.target,t.instance.connectedClass)))}function Xv(t,e,i){if(null!=e){var n=e.connections.length;Kd(e.connections,(function(e){return t.id===e.id})),n>0&&0===e.connections.length&&t.instance.removeClass(t.source,t.instance.connectedClass)}if(null!=i){var o=i.connections.length;null!=e&&t.sourceId===t.targetId||Kd(i.connections,(function(e){return t.id===e.id})),o>0&&0===i.connections.length&&t.instance.removeClass(t.target,t.instance.connectedClass)}}Cd(Gv,"type","Straight");var Kv=function(t){Ed(i,t);var e=Pd(i);function i(t,n){var o;return wd(this,i),(o=e.call(this))._instanceIndex=t,Cd(Td(o),"defaults",void 0),Cd(Td(o),"_initialDefaults",{}),Cd(Td(o),"isConnectionBeingDragged",!1),Cd(Td(o),"currentlyDragging",!1),Cd(Td(o),"hoverSuspended",!1),Cd(Td(o),"_suspendDrawing",!1),Cd(Td(o),"_suspendedAt",null),Cd(Td(o),"connectorClass",Vu),Cd(Td(o),"connectorOutlineClass","jtk-connector-outline"),Cd(Td(o),"connectedClass","jtk-connected"),Cd(Td(o),"endpointClass",Hu),Cd(Td(o),"endpointConnectedClass","jtk-endpoint-connected"),Cd(Td(o),"endpointFullClass","jtk-endpoint-full"),Cd(Td(o),"endpointFloatingClass",Uu),Cd(Td(o),"endpointDropAllowedClass","jtk-endpoint-drop-allowed"),Cd(Td(o),"endpointDropForbiddenClass","jtk-endpoint-drop-forbidden"),Cd(Td(o),"endpointAnchorClassPrefix","jtk-endpoint-anchor"),Cd(Td(o),"overlayClass",Zu),Cd(Td(o),"connections",[]),Cd(Td(o),"endpointsByElement",{}),Cd(Td(o),"endpointsByUUID",new Map),Cd(Td(o),"sourceSelectors",[]),Cd(Td(o),"targetSelectors",[]),Cd(Td(o),"allowNestedGroups",void 0),Cd(Td(o),"_curIdStamp",1),Cd(Td(o),"viewport",new Lv(Td(o))),Cd(Td(o),"router",void 0),Cd(Td(o),"groupManager",void 0),Cd(Td(o),"_connectionTypes",new Map),Cd(Td(o),"_endpointTypes",new Map),Cd(Td(o),"_container",void 0),Cd(Td(o),"_managedElements",{}),Cd(Td(o),"DEFAULT_SCOPE",void 0),Cd(Td(o),"_zoom",1),o.defaults={anchor:Cp.Bottom,anchors:[null,null],connectionsDetachable:!0,connectionOverlays:[],connector:Gv.type,container:null,endpoint:bv.type,endpointOverlays:[],endpoints:[null,null],endpointStyle:{fill:"#456"},endpointStyles:[null,null],endpointHoverStyle:null,endpointHoverStyles:[null,null],hoverPaintStyle:null,listStyle:{},maxConnections:1,paintStyle:{strokeWidth:2,stroke:"#456"},reattachConnections:!1,scope:"jsplumb_defaultscope",allowNestedGroups:!0},n&&Rd(o.defaults,n),Rd(o._initialDefaults,o.defaults),null!=o._initialDefaults[yv]&&(o._initialDefaults[yv].strokeWidth=o._initialDefaults[yv].strokeWidth||2),o.DEFAULT_SCOPE=o.defaults.scope,o.allowNestedGroups=!1!==o._initialDefaults.allowNestedGroups,o.router=new qv(Td(o)),o.groupManager=new kv(Td(o)),o.setContainer(o._initialDefaults.container),o}return Sd(i,[{key:"defaultScope",get:function(){return this.DEFAULT_SCOPE}},{key:"currentZoom",get:function(){return this._zoom}},{key:"areDefaultAnchorsSet",value:function(){return this.validAnchorsSpec(this.defaults.anchors)}},{key:"validAnchorsSpec",value:function(t){return null!=t&&null!=t[0]&&null!=t[1]}},{key:"getContainer",value:function(){return this._container}},{key:"setZoom",value:function(t,e){return this._zoom=t,this.fire(np,this._zoom),e&&this.repaintEverything(),!0}},{key:"_idstamp",value:function(){return""+this._curIdStamp++}},{key:"checkCondition",value:function(t,e){var i=this.getListener(t),n=!0;if(i&&i.length>0){var o=Array.prototype.slice.call(arguments,1);try{for(var s=0,r=i.length;s<r;s++)n=n&&i[s].apply(i[s],o)}catch(e){cu("cannot check condition ["+t+"]"+e)}}return n}},{key:"getId",value:function(t,e){if(null==t)return null;var i=this.getAttribute(t,Nu);return i&&"undefined"!==i||(2===arguments.length&&void 0!==arguments[1]?i=e:(1===arguments.length||3===arguments.length&&!arguments[2])&&(i="jsplumb-"+this._instanceIndex+"-"+this._idstamp()),this.setAttribute(t,Nu,i)),i}},{key:"getConnections",value:function(t,e){t?t.constructor===String&&(t={scope:t}):t={};for(var i=Zv(this,t.scope||this.defaultScope,!0),n=Zv(this,t.source),o=Zv(this,t.target),s=!e&&i.length>1?{}:[],r=function(t,n){if(!e&&i.length>1){var o=s[t];null==o&&(o=s[t]=[]),o.push(n)}else s.push(n)},a=0,l=this.connections.length;a<l;a++){var c=this.connections[a],h=c.proxies&&c.proxies[0]?c.proxies[0].originalEp.elementId:c.sourceId,d=c.proxies&&c.proxies[1]?c.proxies[1].originalEp.elementId:c.targetId;zd(i,c.scope)&&zd(n,h)&&zd(o,d)&&r(c.scope,c)}return s}},{key:"select",value:function(t){return(t=t||{}).scope=t.scope||"*",new Ev(this,t.connections||this.getConnections(t,!0))}},{key:"selectEndpoints",value:function(t){(t=t||{}).scope=t.scope||Of;var e=!t.element&&!t.source&&!t.target,i=e?Of:Zv(this,t.element),n=e?Of:Zv(this,t.source),o=e?Of:Zv(this,t.target),s=Zv(this,t.scope,!0),r=[];for(var a in this.endpointsByElement){var l=zd(i,a,!0),c=zd(n,a,!0),h="*"!==n,d=zd(o,a,!0),u="*"!==o;if(l||c||d)t:for(var p=0,f=this.endpointsByElement[a].length;p<f;p++){var m=this.endpointsByElement[a][p];if(zd(s,m.scope,!0)){var g=h&&n.length>0&&!m.isSource,v=u&&o.length>0&&!m.isTarget;if(g||v)continue t;r.push(m)}}}return new Cv(this,r)}},{key:"setContainer",value:function(t){this._container=t,this.fire("container:change",this._container)}},{key:"_set",value:function(t,e,i){var n,o,s=[{el:"source",elId:"sourceId"},{el:"target",elId:"targetId"}][i],r=t[s.elId],a=t.endpoints[i],l={index:i,originalEndpoint:a,originalSourceId:0===i?r:t.sourceId,newSourceId:t.sourceId,originalTargetId:1===i?r:t.targetId,newTargetId:t.targetId,connection:t,newEndpoint:a};return e instanceof tv?(n=e).addConnection(t):n=(o=this.getId(e))===t[s.elId]?null:t.makeEndpoint(0===i,e,o),null!=n&&(l.newEndpoint=n,a.detachFromConnection(t),t.endpoints[i]=n,t[s.el]=n.element,t[s.elId]=n.elementId,l[0===i?"newSourceId":"newTargetId"]=n.elementId,this.fireMoveEvent(l),this._paintConnection(t)),l}},{key:"setSource",value:function(t,e){Xv(t,this._managedElements[t.sourceId]);var i=this._set(t,e,0);Yv(t,this._managedElements[i.newSourceId])}},{key:"setTarget",value:function(t,e){Xv(t,this._managedElements[t.targetId]);var i=this._set(t,e,1);Yv(t,this._managedElements[i.newTargetId])}},{key:"setConnectionType",value:function(t,e,i){t.setType(e,i),this._paintConnection(t)}},{key:"isHoverSuspended",value:function(){return this.hoverSuspended}},{key:"setSuspendDrawing",value:function(t,e){var i=this._suspendDrawing;return this._suspendDrawing=t,t?this._suspendedAt=""+(new Date).getTime():(this._suspendedAt=null,this.viewport.recomputeBounds()),e&&this.repaintEverything(),i}},{key:"getSuspendedAt",value:function(){return this._suspendedAt}},{key:"batch",value:function(t,e){var i=!0===this._suspendDrawing;i||this.setSuspendDrawing(!0),t(),i||this.setSuspendDrawing(!1,!e)}},{key:"each",value:function(t,e){if(null!=t){if(null!=t.length)for(var i=0;i<t.length;i++)e(t[i]);else e(t);return this}}},{key:"updateOffset",value:function(t){var e=t.elId;return t.recalc?this.viewport.refreshElement(e):this.viewport.getPosition(e)}},{key:"deleteConnection",value:function(t,e){if(null!=t&&!0!==t.deleted&&((e=e||{}).force||Ud(!0,!1,[[t.endpoints[0],op,[t]],[t.endpoints[1],op,[t]],[t,op,[t]],[this,qu,[rp,t]]]))){Xv(t,this._managedElements[t.sourceId],this._managedElements[t.targetId]),this.fireDetachEvent(t,!t.pending&&!1!==e.fireEvent,e.originalEvent);var i=t.endpoints[0],n=t.endpoints[1];return i!==e.endpointToIgnore&&i.detachFromConnection(t,null,!0),n!==e.endpointToIgnore&&n.detachFromConnection(t,null,!0),Kd(this.connections,(function(e){return t.id===e.id})),t.destroy(),i!==e.endpointToIgnore&&i.deleteOnEmpty&&0===i.connections.length&&this.deleteEndpoint(i),n!==e.endpointToIgnore&&n.deleteOnEmpty&&0===n.connections.length&&this.deleteEndpoint(n),!0}return!1}},{key:"deleteEveryConnection",value:function(t){var e=this;t=t||{};var i=this.connections.length,n=0;return this.batch((function(){for(var o=0;o<i;o++)n+=e.deleteConnection(e.connections[0],t)?1:0})),n}},{key:"deleteConnectionsForElement",value:function(t,e){var i=this.getId(t),n=this._managedElements[i];if(n)for(var o=n.connections.length,s=0;s<o;s++)this.deleteConnection(n.connections[0],e);return this}},{key:"fireDetachEvent",value:function(t,e,i){var n=null!=t.id?{connection:t,source:t.source,target:t.target,sourceId:t.sourceId,targetId:t.targetId,sourceEndpoint:t.endpoints[0],targetEndpoint:t.endpoints[1]}:t;e&&this.fire("connection:detach",n,i),this.fire(Ju,n,i)}},{key:"fireMoveEvent",value:function(t,e){this.fire(Ku,t,e)}},{key:"manageAll",value:function(t,e){for(var i=Bd(t)?this.getSelector(this.getContainer(),t):t,n=0;n<i.length;n++)this.manage(i[n],null,e)}},{key:"manage",value:function(t,e,i){null==this.getAttribute(t,Nu)&&(e=e||this.getAttribute(t,"id")||su(),this.setAttribute(t,Nu,e));var n=this.getId(t);if(this._managedElements[n])i&&(this._managedElements[n].viewportElement=this.updateOffset({elId:n,timestamp:null,recalc:!0}));else{var o={el:t,endpoints:[],connections:[],rotation:0,data:{}};this._managedElements[n]=o,this._suspendDrawing?o.viewportElement=this.viewport.registerElement(n,!0):o.viewportElement=this.updateOffset({elId:n,recalc:!0}),this.fire(tp,{el:t})}return this._managedElements[n]}},{key:"getManagedData",value:function(t,e,i){if(this._managedElements[t]){var n=this._managedElements[t].data[e];return null!=n?n[i]:null}}},{key:"setManagedData",value:function(t,e,i,n){this._managedElements[t]&&(this._managedElements[t].data[e]=this._managedElements[t].data[e]||{},this._managedElements[t].data[e][i]=n)}},{key:"getManagedElement",value:function(t){return this._managedElements[t]?this._managedElements[t].el:null}},{key:"unmanage",value:function(t,e){var i=this;this.removeAllEndpoints(t,!0);var n=function(t){var n=i.getId(t);i.removeAttribute(t,Nu),delete i._managedElements[n],i.viewport.remove(n),i.fire(ip,{el:t,id:n}),t&&e&&i._removeElement(t)};this._getAssociatedElements(t).map(n),n(t)}},{key:"rotate",value:function(t,e,i){var n=this.getId(t);return this._managedElements[n]&&(this._managedElements[n].rotation=e,this.viewport.rotateElement(n,e),!0!==i)?this.revalidate(t):{c:new Set,e:new Set}}},{key:"_getRotation",value:function(t){var e=this._managedElements[t];return null!=e&&e.rotation||0}},{key:"_getRotations",value:function(t){var e=this,i=[],n=this._managedElements[t];return null!=n&&(i.push({r:n.viewportElement.r||0,c:n.viewportElement.c}),function t(n){if(null!=n.group){var o=e._managedElements[n.group];null!=o&&(i.push({r:o.viewportElement.r,c:o.viewportElement.c}),t(o))}}(n)),i}},{key:"_applyRotations",value:function(t,e){var i=t.slice(),n={x:i[0],y:i[1],cr:0,sr:0};return Gd(e,(function(t){n=ru(n,t.c,t.r)})),n}},{key:"_applyRotationsXY",value:function(t,e){return Gd(e,(function(e){t=ru(t,e.c,e.r)})),t}},{key:"_internal_newEndpoint",value:function(t){var e=Rd({},t),i=this.manage(e.element);e.elementId=this.getId(e.element),e.id="ep_"+this._idstamp();var n=new tv(this,e);return function(t,e){null!=t&&t.endpoints.push(e)}(i,n),t.uuid&&this.endpointsByUUID.set(t.uuid,n),tu(this.endpointsByElement,n.elementId,n),this._suspendDrawing||this._paintEndpoint(n,{timestamp:this._suspendedAt}),n}},{key:"_deriveEndpointAndAnchorSpec",value:function(t,e){for(var i=((e?"":"default ")+t).split(/[\s]/),n=null,o=null,s=null,r=null,a=0;a<i.length;a++){var l=this.getConnectionType(i[a]);l&&(l.endpoints&&(n=l.endpoints),l.endpoint&&(o=l.endpoint),l.anchors&&(r=l.anchors),l.anchor&&(s=l.anchor))}return{endpoints:n||[o,o],anchors:r||[s,s]}}},{key:"revalidate",value:function(t,e){var i=this.getId(t);return this.updateOffset({elId:i,recalc:!0,timestamp:e}),this.repaint(t)}},{key:"repaintEverything",value:function(){var t,e=su();for(t in this._managedElements)this.viewport.refreshElement(t,!0);for(t in this.viewport.recomputeBounds(),this._managedElements)this.repaint(this._managedElements[t].el,e,!0);return this}},{key:"setElementPosition",value:function(t,e,i){var n=this.getId(t);return this.viewport.setPosition(n,e,i),this.repaint(t)}},{key:"repaint",value:function(t,e,i){var n={c:new Set,e:new Set},o=function(t){t.c.forEach((function(t){return n.c.add(t)})),t.e.forEach((function(t){return n.e.add(t)}))};if(!this._suspendDrawing){var s=this.getId(t);if(null!=t){var r=this._getAssociatedElements(t);if(null==e&&(e=su()),!i)for(var a=0;a<r.length;a++)this.updateOffset({elId:this.getId(r[a]),recalc:!0,timestamp:e});if(o(this.router.redraw(s,e,null)),r.length>0)for(var l=0;l<r.length;l++)o(this.router.redraw(this.getId(r[l]),e,null))}}return n}},{key:"unregisterEndpoint",value:function(t){var e=t.getUuid();e&&this.endpointsByUUID.delete(e),function(t,e){null!=t&&Kd(t.endpoints,(function(t){return t===e}))}(this._managedElements[t.elementId],t);var i=this.endpointsByElement[t.elementId];null!=i&&(this.endpointsByElement[t.elementId]=i.filter((function(e){return e!==t}))),this.fire(Qu,t)}},{key:"_maybePruneEndpoint",value:function(t){return!(!t.deleteOnEmpty||0!==t.connections.length)&&(this.deleteEndpoint(t),!0)}},{key:"deleteEndpoint",value:function(t){var e=this,i="string"==typeof t?this.endpointsByUUID.get(t):t;if(i){var n=i.proxiedBy,o=i.connections.slice();Gd(o,(function(t){i.detachFromConnection(t,null,!0)})),this.unregisterEndpoint(i),i.destroy(),Gd(o,(function(t){e.deleteConnection(t,{force:!0,endpointToIgnore:i})})),null!=n&&this.deleteEndpoint(n)}return this}},{key:"addEndpoint",value:function(t,e,i){var n=Rd({},i=i||{});Rd(n,e||{});var o=Rd({element:t},n);return this._internal_newEndpoint(o)}},{key:"addEndpoints",value:function(t,e,i){for(var n=[],o=0,s=e.length;o<s;o++)n.push(this.addEndpoint(t,e[o],i));return n}},{key:"reset",value:function(){var t=this;this.silently((function(){t.endpointsByElement={},t._managedElements={},t.endpointsByUUID.clear(),t.viewport.reset(),t.router.reset(),t.groupManager.reset(),t.connections.length=0}))}},{key:"destroy",value:function(){this.reset(),this.unbind(),this.sourceSelectors.length=0,this.targetSelectors.length=0,this._connectionTypes.clear(),this._endpointTypes.clear()}},{key:"getEndpoints",value:function(t){return this.endpointsByElement[this.getId(t)]||[]}},{key:"getEndpoint",value:function(t){return this.endpointsByUUID.get(t)}},{key:"setEndpointUuid",value:function(t,e){t.uuid&&this.endpointsByUUID.delete(t.uuid),t.uuid=e,this.endpointsByUUID.set(e,t)}},{key:"connect",value:function(t,e){try{var i=this._prepareConnectionParams(t,e),n=this._newConnection(i);return this._finaliseConnection(n,i),n}catch(t){return void cu(t)}}},{key:"_prepareConnectionParams",value:function(t,e){var i=Rd({},t);e&&Rd(i,e);var n=i;if(n.source&&n.source.endpoint&&(n.sourceEndpoint=n.source),n.target&&n.target.endpoint&&(n.targetEndpoint=n.target),t.uuids&&(n.sourceEndpoint=this.getEndpoint(t.uuids[0]),n.targetEndpoint=this.getEndpoint(t.uuids[1])),null!=n.sourceEndpoint){if(n.sourceEndpoint.isFull())throw"Cannot establish connection: source endpoint is full";if(n.type||(n.type=n.sourceEndpoint.edgeType),n.sourceEndpoint.connectorOverlays){n.overlays=n.overlays||[];for(var o=0,s=n.sourceEndpoint.connectorOverlays.length;o<s;o++)n.overlays.push(n.sourceEndpoint.connectorOverlays[o])}n.sourceEndpoint.scope&&(n.scope=n.sourceEndpoint.scope)}else if(null==n.source)throw"Cannot establish connection: source does not exist";if(null!=n.targetEndpoint){if(n.targetEndpoint.isFull())throw"Cannot establish connection: target endpoint is full"}else if(null==n.target)throw"Cannot establish connection: target does not exist";if(n.sourceEndpoint&&n.targetEndpoint&&!function(t,e){for(var i=t.scope.split(/\s/),n=e.scope.split(/\s/),o=0;o<i.length;o++)for(var s=0;s<n.length;s++)if(n[s]===i[o])return!0;return!1}(n.sourceEndpoint,n.targetEndpoint))throw"Cannot establish connection: scopes do not match";return n}},{key:"_newConnection",value:function(t){t.id="con_"+this._idstamp();var e=new ov(this,t);return Yv(e,this._managedElements[e.sourceId],this._managedElements[e.targetId]),this._paintConnection(e),e}},{key:"_finaliseConnection",value:function(t,e,i){e=e||{},t.suspendedEndpoint||this.connections.push(t),t.pending=null,t.endpoints[0].isTemporarySource=!1,this.repaint(t.source);var n={connection:t,source:t.source,target:t.target,sourceId:t.sourceId,targetId:t.targetId,sourceEndpoint:t.endpoints[0],targetEndpoint:t.endpoints[1]};this.fire(Xu,n,i),e.doNotFireConnectionEvent||!1===e.fireEvent||this.fire(Yu,n,i)}},{key:"removeAllEndpoints",value:function(t,e){var i=this,n=function(t){var e,n,o=i.getId(t),s=i.endpointsByElement[o];if(s)for(e=0,n=s.length;e<n;e++)i.deleteEndpoint(s[e]);delete i.endpointsByElement[o]};return e&&this._getAssociatedElements(t).map(n),n(t),this}},{key:"_createSourceDefinition",value:function(t,e){var i=Rd({},e);Rd(i,t),i.edgeType=i.edgeType||Mf;var n=this._deriveEndpointAndAnchorSpec(i.edgeType);i.endpoint=i.endpoint||n.endpoints[0],i.anchor=i.anchor||n.anchors[0];var o=i.maxConnections||-1;return{def:Rd({},i),uniqueEndpoint:i.uniqueEndpoint,maxConnections:o,enabled:!0,endpoint:null}}},{key:"addSourceSelector",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=this._createSourceDefinition(e),o=new Eg(t,n,i);return this.sourceSelectors.push(o),o}},{key:"removeSourceSelector",value:function(t){Kd(this.sourceSelectors,(function(e){return e===t}))}},{key:"removeTargetSelector",value:function(t){Kd(this.targetSelectors,(function(e){return e===t}))}},{key:"addTargetSelector",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=this._createTargetDefinition(e),o=new Eg(t,n,i);return this.targetSelectors.push(o),o}},{key:"_createTargetDefinition",value:function(t,e){var i=Rd({},e);Rd(i,t),i.edgeType=i.edgeType||Mf;var n=i.maxConnections||-1;return{def:Rd({},i),uniqueEndpoint:i.uniqueEndpoint,maxConnections:n,enabled:!0,endpoint:null}}},{key:"show",value:function(t,e){return this._setVisible(t,Iu,e)}},{key:"hide",value:function(t,e){return this._setVisible(t,Lu,e)}},{key:"_setVisible",value:function(t,e,i){var n=e===Iu,o=null;i&&(o=function(t){t.setVisible(n,!0,!0)});var s=this.getId(t);return this._operation(t,(function(t){if(n&&i){var e=t.sourceId===s?1:0;t.endpoints[e].isVisible()&&t.setVisible(!0)}else t.setVisible(n)}),o),this}},{key:"toggleVisible",value:function(t,e){var i=null;e&&(i=function(t){var e=t.isVisible();t.setVisible(!e)}),this._operation(t,(function(t){var e=t.isVisible();t.setVisible(!e)}),i)}},{key:"_operation",value:function(t,e,i){var n=this.getId(t),o=this.endpointsByElement[n];if(o&&o.length)for(var s=0,r=o.length;s<r;s++){for(var a=0,l=o[s].connections.length;a<l;a++){if(e(o[s].connections[a]))return}i&&i(o[s])}}},{key:"registerConnectionType",value:function(t,e){if(this._connectionTypes.set(t,Rd({},e)),e.overlays){for(var i={},n=0;n<e.overlays.length;n++){var o=zg(e.overlays[n]);i[o.options.id]=o}this._connectionTypes.get(t).overlays=i}}},{key:"registerConnectionTypes",value:function(t){for(var e in t)this.registerConnectionType(e,t[e])}},{key:"registerEndpointType",value:function(t,e){if(this._endpointTypes.set(t,Rd({},e)),e.overlays){for(var i={},n=0;n<e.overlays.length;n++){var o=zg(e.overlays[n]);i[o.options.id]=o}this._endpointTypes.get(t).overlays=i}}},{key:"registerEndpointTypes",value:function(t){for(var e in t)this.registerEndpointType(e,t[e])}},{key:"getType",value:function(t,e){return"connection"===e?this.getConnectionType(t):this.getEndpointType(t)}},{key:"getConnectionType",value:function(t){return this._connectionTypes.get(t)}},{key:"getEndpointType",value:function(t){return this._endpointTypes.get(t)}},{key:"importDefaults",value:function(t){for(var e in t)this.defaults[e]=t[e];return null!=this.defaults[yv]&&(this.defaults[yv].strokeWidth=this.defaults[yv].strokeWidth||2),t.container&&this.setContainer(t.container),this}},{key:"restoreDefaults",value:function(){return this.defaults=Rd({},this._initialDefaults),this}},{key:"getManagedElements",value:function(){return this._managedElements}},{key:"proxyConnection",value:function(t,e,i,n,o){var s,r=null!=t.proxies[e],a=r?t.proxies[e].originalEp.elementId:t.endpoints[e].elementId,l=r?t.proxies[e].originalEp:t.endpoints[e],c=this.getId(i);t.proxies[e]?t.proxies[e].ep.elementId===c?s=t.proxies[e].ep:(t.proxies[e].ep.detachFromConnection(t,e),s=this._internal_newEndpoint({element:i,endpoint:n(t,e),anchor:o(t,e),parameters:{isProxyEndpoint:!0}})):s=this._internal_newEndpoint({element:i,endpoint:n(t,e),anchor:o(t,e),parameters:{isProxyEndpoint:!0}}),s.deleteOnEmpty=!0,t.proxies[e]={ep:s,originalEp:l},this.sourceOrTargetChanged(a,c,t,i,e),l.detachFromConnection(t,null,!0),s.connections=[t],t.endpoints[e]=s,l.proxiedBy=s,l.setVisible(!1),t.setVisible(!0),this.revalidate(i)}},{key:"unproxyConnection",value:function(t,e){if(null!=t.proxies&&null!=t.proxies[e]){var i=t.proxies[e].originalEp.element,n=t.proxies[e].originalEp.elementId,o=t.proxies[e].ep.elementId;t.endpoints[e]=t.proxies[e].originalEp,delete t.proxies[e].originalEp.proxiedBy,this.sourceOrTargetChanged(o,n,t,i,e),t.proxies[e].ep.detachFromConnection(t,null),t.proxies[e].originalEp.addConnection(t),t.isVisible()&&t.proxies[e].originalEp.setVisible(!0),t.proxies[e]=null,-1===Zd(t.proxies,(function(t){return null!=t}))&&(t.proxies.length=0)}}},{key:"sourceOrTargetChanged",value:function(t,e,i,n,o){t!==e&&(0===o?(i.sourceId=e,i.source=n):1===o&&(i.targetId=e,i.target=n),Xv(i,this._managedElements[t]),Yv(i,this._managedElements[e]))}},{key:"getGroup",value:function(t){return this.groupManager.getGroup(t)}},{key:"getGroupFor",value:function(t){return this.groupManager.getGroupFor(t)}},{key:"addGroup",value:function(t){return this.groupManager.addGroup(t)}},{key:"addToGroup",value:function(t){for(var e,i=arguments.length,n=new Array(i>1?i-1:0),o=1;o<i;o++)n[o-1]=arguments[o];return(e=this.groupManager).addToGroup.apply(e,[t,!1].concat(n))}},{key:"collapseGroup",value:function(t){this.groupManager.collapseGroup(t)}},{key:"expandGroup",value:function(t){this.groupManager.expandGroup(t)}},{key:"toggleGroup",value:function(t){this.groupManager.toggleGroup(t)}},{key:"removeGroup",value:function(t,e,i,n){return this.groupManager.removeGroup(t,e,i,n)}},{key:"removeAllGroups",value:function(t,e){this.groupManager.removeAllGroups(t,e,!1)}},{key:"removeFromGroup",value:function(t,e,i){this.groupManager.removeFromGroup(t,i,e),this._appendElement(e,this.getContainer()),this.updateOffset({recalc:!0,elId:this.getId(e)})}},{key:"_paintEndpoint",value:function(t,e){var i=(e=e||{}).timestamp,n=!(!1===e.recalc);if(!i||t.timestamp!==i){var o=this.viewport.getPosition(t.elementId),s=e.offset?{x:e.offset.x,y:e.offset.y}:{x:o.x,y:o.y};if(null!=s){var r=e.anchorLoc;if(null==r){var a={xy:s,wh:o,element:t,timestamp:i};if(n&&this.router.isDynamicAnchor(t)&&t.connections.length>0){var l=function(t){var i=0;if(null!=e.elementWithPrecedence)for(var n=0;n<t.connections.length;n++)if(t.connections[n].sourceId===e.elementWithPrecedence||t.connections[n].targetId===e.elementWithPrecedence){i=n;break}return t.connections[i]}(t),c=l.endpoints[0]===t?1:0,h=0===c?l.sourceId:l.targetId,d=this.viewport.getPosition(h);a.index=0===c?1:0,a.connection=l,a.txy=d,a.twh=d,a.tElement=l.endpoints[c],a.tRotation=this._getRotations(h)}else t.connections.length>0&&(a.connection=t.connections[0]);a.rotation=this._getRotations(t.elementId),r=this.router.computeAnchorLocation(t._anchor,a)}for(var u in t.endpoint.compute(r,this.router.getEndpointOrientation(t),t.paintStyleInUse),this.renderEndpoint(t,t.paintStyleInUse),t.timestamp=i,t.overlays)if(t.overlays.hasOwnProperty(u)){var p=t.overlays[u];p.isVisible()&&(t.overlayPlacements[u]=this.drawOverlay(p,t.endpoint,t.paintStyleInUse,t.getAbsoluteOverlayPosition(p)),this._paintOverlay(p,t.overlayPlacements[u],{xmin:0,ymin:0}))}}}}},{key:"_paintConnection",value:function(t,e){if(!this._suspendDrawing&&!1!==t.visible){var i=(e=e||{}).timestamp;if(null!=i&&i===t.lastPaintedAt)return;if(null==i||i!==t.lastPaintedAt){this.router.computePath(t,i);var n={xmin:1/0,ymin:1/0,xmax:-1/0,ymax:-1/0};for(var o in t.overlays)if(t.overlays.hasOwnProperty(o)){var s=t.overlays[o];s.isVisible()&&(t.overlayPlacements[o]=this.drawOverlay(s,t.connector,t.paintStyleInUse,t.getAbsoluteOverlayPosition(s)),n.xmin=Math.min(n.xmin,t.overlayPlacements[o].xmin),n.xmax=Math.max(n.xmax,t.overlayPlacements[o].xmax),n.ymin=Math.min(n.ymin,t.overlayPlacements[o].ymin),n.ymax=Math.max(n.ymax,t.overlayPlacements[o].ymax))}var r=parseFloat(""+t.paintStyleInUse.strokeWidth||"1")/2,a=parseFloat(""+t.paintStyleInUse.strokeWidth||"0"),l={xmin:Math.min(t.connector.bounds.xmin-(r+a),n.xmin),ymin:Math.min(t.connector.bounds.ymin-(r+a),n.ymin),xmax:Math.max(t.connector.bounds.xmax+(r+a),n.xmax),ymax:Math.max(t.connector.bounds.ymax+(r+a),n.ymax)};for(var c in this.paintConnector(t.connector,t.paintStyleInUse,l),t.overlays)if(t.overlays.hasOwnProperty(c)){var h=t.overlays[c];h.isVisible()&&this._paintOverlay(h,t.overlayPlacements[c],l)}}t.lastPaintedAt=i}}},{key:"_refreshEndpoint",value:function(t){t._anchor.isFloating||(t.connections.length>0?this.addEndpointClass(t,this.endpointConnectedClass):this.removeEndpointClass(t,this.endpointConnectedClass),t.isFull()?this.addEndpointClass(t,this.endpointFullClass):this.removeEndpointClass(t,this.endpointFullClass))}},{key:"_makeConnector",value:function(t,e,i){return Hv(t,e,i)}},{key:"addOverlay",value:function(t,e,i){if(t.addOverlay(e),!i){var n=t instanceof tv?t.element:t.source;this.revalidate(n)}}},{key:"removeOverlay",value:function(t,e){t.removeOverlay(e);var i=t instanceof tv?t.element:t.source;this.revalidate(i)}},{key:"setOutlineColor",value:function(t,e){t.paintStyleInUse.outlineStroke=e,this._paintConnection(t)}},{key:"setOutlineWidth",value:function(t,e){t.paintStyleInUse.outlineWidth=e,this._paintConnection(t)}},{key:"setColor",value:function(t,e){t.paintStyleInUse.stroke=e,this._paintConnection(t)}},{key:"setLineWidth",value:function(t,e){t.paintStyleInUse.strokeWidth=e,this._paintConnection(t)}},{key:"setLineStyle",value:function(t,e){null!=e.lineWidth&&(t.paintStyleInUse.strokeWidth=e.lineWidth),null!=e.outlineWidth&&(t.paintStyleInUse.outlineWidth=e.outlineWidth),null!=e.color&&(t.paintStyleInUse.stroke=e.color),null!=e.outlineColor&&(t.paintStyleInUse.outlineStroke=e.outlineColor),this._paintConnection(t)}},{key:"getPathData",value:function(t){for(var e="",i=0;i<t.segments.length;i++)e+=t.segments[i].getPath(0===i),e+=" ";return e}}]),i}($g),Qv={};function Jv(t,e){Qv[t]=e}function ty(t,e,i){var n=e,o=_d(e.getBoundingClientRect)!==Af?e.getBoundingClientRect():{left:0,top:0,width:0,height:0},s=document.body,r=document.documentElement,a=window.pageYOffset||r.scrollTop||s.scrollTop,l=window.pageXOffset||r.scrollLeft||s.scrollLeft,c=r.clientTop||s.clientTop||0,h=r.clientLeft||s.clientLeft||0,d=o.top+a-c+0*i,u=o.left+l-h+0*i,p=qf(t),f=o.width||n.offsetWidth*i,m=o.height||n.offsetHeight*i;return{x:(p.x-u)/f,y:(p.y-d)/m}}function ey(t){return dv(t)||pv(t)||mv(t)}function iy(t,e){t.canvas&&(t.canvas.style.display=e?"block":"none")}function ny(t){t.canvas&&t.canvas.parentNode.removeChild(t.canvas),delete t.canvas}function oy(t){return t.canvas}function sy(t){return Lg.getElement(t)}function ry(t){return Lg.getElement(t,t.component,(function(e){var i=t.create(e);return t.instance.addClass(i,t.instance.overlayClass),i}))}function ay(t,e,i,n){var o=t.x,s=t.y;return e._jsPlumbParentGroup&&e._jsPlumbParentGroup.constrain&&(o=Math.max(t.x,0),s=Math.max(t.y,0),o=Math.min(o,i.w-n.w),s=Math.min(s,i.h-n.h)),{x:o,y:s}}var ly=function(t){Ed(i,t);var e=Pd(i);function i(t,n){var o;if(wd(this,i),(o=e.call(this,t,n))._instanceIndex=t,Cd(Td(o),"containerType",null),Cd(Td(o),"dragSelection",void 0),Cd(Td(o),"dragManager",void 0),Cd(Td(o),"_connectorClick",void 0),Cd(Td(o),"_connectorDblClick",void 0),Cd(Td(o),"_connectorTap",void 0),Cd(Td(o),"_connectorDblTap",void 0),Cd(Td(o),"_endpointClick",void 0),Cd(Td(o),"_endpointDblClick",void 0),Cd(Td(o),"_overlayClick",void 0),Cd(Td(o),"_overlayDblClick",void 0),Cd(Td(o),"_overlayTap",void 0),Cd(Td(o),"_overlayDblTap",void 0),Cd(Td(o),"_connectorMouseover",void 0),Cd(Td(o),"_connectorMouseout",void 0),Cd(Td(o),"_endpointMouseover",void 0),Cd(Td(o),"_endpointMouseout",void 0),Cd(Td(o),"_connectorContextmenu",void 0),Cd(Td(o),"_connectorMousedown",void 0),Cd(Td(o),"_connectorMouseup",void 0),Cd(Td(o),"_endpointMousedown",void 0),Cd(Td(o),"_endpointMouseup",void 0),Cd(Td(o),"_overlayMouseover",void 0),Cd(Td(o),"_overlayMouseout",void 0),Cd(Td(o),"_elementClick",void 0),Cd(Td(o),"_elementTap",void 0),Cd(Td(o),"_elementDblTap",void 0),Cd(Td(o),"_elementMouseenter",void 0),Cd(Td(o),"_elementMouseexit",void 0),Cd(Td(o),"_elementMousemove",void 0),Cd(Td(o),"_elementMouseup",void 0),Cd(Td(o),"_elementMousedown",void 0),Cd(Td(o),"_elementContextmenu",void 0),Cd(Td(o),"_resizeObserver",void 0),Cd(Td(o),"eventManager",void 0),Cd(Td(o),"draggingClass","jtk-dragging"),Cd(Td(o),"elementDraggingClass","jtk-element-dragging"),Cd(Td(o),"hoverClass","jtk-hover"),Cd(Td(o),"sourceElementDraggingClass","jtk-source-element-dragging"),Cd(Td(o),"targetElementDraggingClass","jtk-target-element-dragging"),Cd(Td(o),"hoverSourceClass","jtk-source-hover"),Cd(Td(o),"hoverTargetClass","jtk-target-hover"),Cd(Td(o),"dragSelectClass","jtk-drag-select"),Cd(Td(o),"managedElementsSelector",void 0),Cd(Td(o),"elementsDraggable",void 0),Cd(Td(o),"elementDragHandler",void 0),Cd(Td(o),"groupDragOptions",void 0),Cd(Td(o),"elementDragOptions",void 0),Cd(Td(o),"svg",{node:function(t,e){return bp(t,e)},attr:function(t,e){return yp(t,e)},pos:function(t){return xp(t)}}),n=n||{},o.containerType=Mu(o.getContainer()),o.elementsDraggable=n&&!1!==n.elementsDraggable,o.managedElementsSelector=n&&n.managedElementsSelector||ap,o.eventManager=new em,o.dragSelection=new Rm(Td(o)),o.dragManager=new jm(Td(o),o.dragSelection),o.dragManager.addHandler(new Dg(Td(o))),o.groupDragOptions={constrainFunction:ay},o.dragManager.addHandler(new Ig(Td(o),o.dragSelection),o.groupDragOptions),o.elementDragHandler=new Um(Td(o),o.dragSelection),o.elementDragOptions=n&&n.dragOptions||{},o.dragManager.addHandler(o.elementDragHandler,o.elementDragOptions),n&&n.dragOptions&&n.dragOptions.filter&&o.dragManager.addFilter(n.dragOptions.filter),o._createEventListeners(),o._attachEventDelegates(),!1!==n.resizeObserver)try{o._resizeObserver=new ResizeObserver((function(t){var e=t.filter((function(t){var e=o.getAttribute(t.target,Nu);if(null!=e){var i=o.viewport._elementMap.get(e);return!!i&&(i.w!==t.contentRect.width||i.h!==t.contentRect.height)}return!1}));e.forEach((function(t){return o.revalidate(t.target)}))}))}catch(t){cu("WARN: ResizeObserver could not be attached.")}return o}return Sd(i,[{key:"fireOverlayMethod",value:function(t,e,i){var n=kp(t.component instanceof ov?Op:Tp,e);i._jsPlumbOverlay=t,t.fire(e,{e:i,overlay:t}),this.fire(n,t.component,i)}},{key:"addDragFilter",value:function(t,e){this.dragManager.addFilter(t,e)}},{key:"removeDragFilter",value:function(t){this.dragManager.removeFilter(t)}},{key:"setDragGrid",value:function(t){this.dragManager.setOption(this.elementDragHandler,{grid:t})}},{key:"setDragConstrainFunction",value:function(t){this.dragManager.setOption(this.elementDragHandler,{constrainFunction:t})}},{key:"_removeElement",value:function(t){t.parentNode&&t.parentNode.removeChild(t)}},{key:"_appendElement",value:function(t,e){e&&e.appendChild(t)}},{key:"_appendElementToGroup",value:function(t,e){this.getGroupContentArea(t).appendChild(e)}},{key:"_appendElementToContainer",value:function(t){this._appendElement(t,this.getContainer())}},{key:"_getAssociatedElements",value:function(t){var e=[];if(3!==t.nodeType&&8!==t.nodeType){var i=t.querySelectorAll(ap);Array.prototype.push.apply(e,i)}return e.filter((function(t){return 3!==t.nodeType&&8!==t.nodeType}))}},{key:"shouldFireEvent",value:function(t,e,i){return!0}},{key:"getClass",value:function(t){return function(t){return yu(t)}(t)}},{key:"addClass",value:function(t,e){_u(t,e)}},{key:"hasClass",value:function(t,e){return function(t,e){return t.classList?t.classList.contains(e):-1!==yu(t).indexOf(e)}(t,e)}},{key:"removeClass",value:function(t,e){wu(t,e)}},{key:"toggleClass",value:function(t,e){!function(t,e){var i=this,n=function(t,e){null!=t&&null!=e&&e.length>0&&(t.classList?t.classList.toggle(e):i.hasClass(t,e)?i.removeClass(t,e):i.addClass(t,e))};xu(t)?Gd(t,(function(t){return n(t,e)})):n(t,e)}(t,e)}},{key:"setAttribute",value:function(t,e,i){t.setAttribute(e,i)}},{key:"getAttribute",value:function(t,e){return t.getAttribute(e)}},{key:"setAttributes",value:function(t,e){for(var i in e)t.setAttribute(i,e[i])}},{key:"removeAttribute",value:function(t,e){t.removeAttribute&&t.removeAttribute(e)}},{key:"on",value:function(t,e,i,n){var o=this,s=function(t){null==n?o.eventManager.on(t,e,i):o.eventManager.on(t,e,i,n)};return xu(t)?Gd(t,(function(t){return s(t)})):s(t),this}},{key:"off",value:function(t,e,i){var n=this;return xu(t)?Gd(t,(function(t){return n.eventManager.off(t,e,i)})):this.eventManager.off(t,e,i),this}},{key:"trigger",value:function(t,e,i,n,o){this.eventManager.trigger(t,e,i,n,o)}},{key:"getOffsetRelativeToRoot",value:function(t){return Cu(t)}},{key:"getOffset",value:function(t){for(var e,i=t,n=this.getContainer(),o=this.getPosition(i),s=t!==n&&i.offsetParent!==n?i.offsetParent:null;null!=s;)o.x+=s.offsetLeft,o.y+=s.offsetTop,null!=(e=s)&&e!==document.body&&(e.scrollTop>0||e.scrollLeft>0)&&(o.x-=e.scrollLeft,o.y-=e.scrollTop),s=s.offsetParent===n?null:s.offsetParent;if(null!=n&&(n.scrollTop>0||n.scrollLeft>0)){var r=null!=i.offsetParent?this.getStyle(i.offsetParent,yf):"static",a=this.getStyle(i,yf);a!==$u&&a!==zu&&r!==$u&&r!==zu&&(o.x-=n.scrollLeft,o.y-=n.scrollTop)}return o}},{key:"getSize",value:function(t){var e=t;return null!=e.offsetWidth?function(t){return{w:t.offsetWidth,h:t.offsetHeight}}(t):e.width&&e.width.baseVal?function(t){try{return{w:parseFloat(t.width.baseVal.value),h:parseFloat(t.height.baseVal.value)}}catch(t){return{w:0,h:0}}}(e):void 0}},{key:"getPosition",value:function(t){var e=t;return null!=e.offsetLeft?{x:parseFloat(e.offsetLeft),y:parseFloat(e.offsetTop)}:e.x&&e.x.baseVal?function(t){try{return{x:parseFloat(t.x.baseVal.value),y:parseFloat(t.y.baseVal.value)}}catch(t){return{x:0,y:0}}}(e):void 0}},{key:"getStyle",value:function(t,e){return _d(window.getComputedStyle)!==Af?getComputedStyle(t,null).getPropertyValue(e):t.currentStyle[e]}},{key:"getGroupContentArea",value:function(t){var e=this.getSelector(t.el,wf);return e&&e.length>0?e[0]:t.el}},{key:"getSelector",value:function(t,e){var i=null;if(1===arguments.length){if(!Bd(t)){var n=document.createDocumentFragment();return n.appendChild(t),Qd(n.childNodes)}i=Qd(document.querySelectorAll(t))}else i=Qd(t.querySelectorAll(e));return i}},{key:"setPosition",value:function(t,e){var i=t;i.style.left=e.x+"px",i.style.top=e.y+"px"}},{key:"setDraggable",value:function(t,e){e?this.removeAttribute(t,Bu):this.setAttribute(t,Bu,Tf)}},{key:"isDraggable",value:function(t){var e=this.getAttribute(t,Bu);return null==e||e===Pf}},{key:"toggleDraggable",value:function(t){var e=this.isDraggable(t);return this.setDraggable(t,!e),!e}},{key:"_createEventListeners",value:function(){var t=function(t,e){if(!e.defaultPrevented&&null==e._jsPlumbOverlay){var i=gu(vu(e),bf,this.getContainer(),!0);this.fire(t,i.jtk.connector.connection,e)}};this._connectorClick=t.bind(this,cf),this._connectorDblClick=t.bind(this,hf),this._connectorTap=t.bind(this,vf),this._connectorDblTap=t.bind(this,df);var e=function(t,e){var i=vu(e).parentNode;if(i.jtk&&i.jtk.connector){var n=i.jtk.connector,o=n.connection;this.setConnectorHover(n,t),t?(this.addClass(o.source,this.hoverSourceClass),this.addClass(o.target,this.hoverTargetClass)):(this.removeClass(o.source,this.hoverSourceClass),this.removeClass(o.target,this.hoverTargetClass)),this.fire(t?pf:uf,i.jtk.connector.connection,e)}};this._connectorMouseover=e.bind(this,!0),this._connectorMouseout=e.bind(this,!1);var i=function(t,e){var i=vu(e).parentNode;i.jtk&&i.jtk.connector&&this.fire(t?ff:mf,i.jtk.connector.connection,e)};this._connectorMouseup=i.bind(this,!0),this._connectorMousedown=i.bind(this,!1),this._connectorContextmenu=function(t){var e=vu(t).parentNode;e.jtk&&e.jtk.connector&&this.fire(gf,e.jtk.connector.connection,t)}.bind(this);var n=function(t,e,i){e.defaultPrevented||null!=e._jsPlumbOverlay||this.fire(t,i.jtk.endpoint,e)};this._endpointClick=n.bind(this,nf),this._endpointDblClick=n.bind(this,of);var o=function(t,e){var i=vu(e);i.jtk&&i.jtk.endpoint&&(this.setEndpointHover(i.jtk.endpoint,t),this.fire(t?rf:sf,i.jtk.endpoint,e))};this._endpointMouseover=o.bind(this,!0),this._endpointMouseout=o.bind(this,!1);var s=function(t,e){var i=vu(e);i.jtk&&i.jtk.endpoint&&this.fire(t?af:lf,i.jtk.endpoint,e)};this._endpointMouseup=s.bind(this,!0),this._endpointMousedown=s.bind(this,!1);var r=function(t,e){var i=gu(vu(e),kf,this.getContainer(),!0).jtk.overlay;i&&this.fireOverlayMethod(i,t,e)}.bind(this);this._overlayClick=r.bind(this,Dp),this._overlayDblClick=r.bind(this,Lp),this._overlayTap=r.bind(this,Vp),this._overlayDblTap=r.bind(this,$p);var a=function(t,e){var i=gu(vu(e),kf,this.getContainer(),!0).jtk.overlay;i&&this.setOverlayHover(i,t)};this._overlayMouseover=a.bind(this,!0),this._overlayMouseout=a.bind(this,!1);this._elementClick=function(t,e,i){e.defaultPrevented||this.fire(1===e.detail?Wp:Gp,i,e)}.bind(this,Wp);this._elementTap=function(t,e,i){e.defaultPrevented||this.fire(ef,i,e)}.bind(this,ef);this._elementDblTap=function(t,e,i){e.defaultPrevented||this.fire(Zp,i,e)}.bind(this,Zp);var l=function(t,e){this.fire(t?Xp:Yp,vu(e),e)};this._elementMouseenter=l.bind(this,!0),this._elementMouseexit=l.bind(this,!1),this._elementMousemove=function(t){this.fire(Kp,vu(t),t)}.bind(this),this._elementMouseup=function(t){this.fire(Qp,vu(t),t)}.bind(this),this._elementMousedown=function(t){this.fire(Jp,vu(t),t)}.bind(this),this._elementContextmenu=function(t){this.fire(tf,vu(t),t)}.bind(this)}},{key:"_attachEventDelegates",value:function(){var t=this.getContainer();this.eventManager.on(t,Dp,kf,this._overlayClick),this.eventManager.on(t,Lp,kf,this._overlayDblClick),this.eventManager.on(t,Vp,kf,this._overlayTap),this.eventManager.on(t,$p,kf,this._overlayDblTap),this.eventManager.on(t,Dp,bf,this._connectorClick),this.eventManager.on(t,Lp,bf,this._connectorDblClick),this.eventManager.on(t,Vp,bf,this._connectorTap),this.eventManager.on(t,$p,bf,this._connectorDblTap),this.eventManager.on(t,Dp,xf,this._endpointClick),this.eventManager.on(t,Lp,xf,this._endpointDblClick),this.eventManager.on(t,Dp,this.managedElementsSelector,this._elementClick),this.eventManager.on(t,Vp,this.managedElementsSelector,this._elementTap),this.eventManager.on(t,$p,this.managedElementsSelector,this._elementDblTap),this.eventManager.on(t,qp,bf,this._connectorMouseover),this.eventManager.on(t,Fp,bf,this._connectorMouseout),this.eventManager.on(t,Ip,bf,this._connectorContextmenu),this.eventManager.on(t,jp,bf,this._connectorMouseup),this.eventManager.on(t,zp,bf,this._connectorMousedown),this.eventManager.on(t,qp,xf,this._endpointMouseover),this.eventManager.on(t,Fp,xf,this._endpointMouseout),this.eventManager.on(t,jp,xf,this._endpointMouseup),this.eventManager.on(t,zp,xf,this._endpointMousedown),this.eventManager.on(t,qp,kf,this._overlayMouseover),this.eventManager.on(t,Fp,kf,this._overlayMouseout),this.eventManager.on(t,qp,ap,this._elementMouseenter),this.eventManager.on(t,Fp,ap,this._elementMouseexit),this.eventManager.on(t,Bp,ap,this._elementMousemove),this.eventManager.on(t,jp,ap,this._elementMouseup),this.eventManager.on(t,zp,ap,this._elementMousedown),this.eventManager.on(t,Ip,ap,this._elementContextmenu)}},{key:"_detachEventDelegates",value:function(){var t=this.getContainer();t&&(this.eventManager.off(t,Dp,this._connectorClick),this.eventManager.off(t,Lp,this._connectorDblClick),this.eventManager.off(t,Vp,this._connectorTap),this.eventManager.off(t,$p,this._connectorDblTap),this.eventManager.off(t,Dp,this._endpointClick),this.eventManager.off(t,Lp,this._endpointDblClick),this.eventManager.off(t,Dp,this._overlayClick),this.eventManager.off(t,Lp,this._overlayDblClick),this.eventManager.off(t,Vp,this._overlayTap),this.eventManager.off(t,$p,this._overlayDblTap),this.eventManager.off(t,Dp,this._elementClick),this.eventManager.off(t,Vp,this._elementTap),this.eventManager.off(t,$p,this._elementDblTap),this.eventManager.off(t,qp,this._connectorMouseover),this.eventManager.off(t,Fp,this._connectorMouseout),this.eventManager.off(t,Ip,this._connectorContextmenu),this.eventManager.off(t,jp,this._connectorMouseup),this.eventManager.off(t,zp,this._connectorMousedown),this.eventManager.off(t,qp,this._endpointMouseover),this.eventManager.off(t,Fp,this._endpointMouseout),this.eventManager.off(t,jp,this._endpointMouseup),this.eventManager.off(t,zp,this._endpointMousedown),this.eventManager.off(t,qp,this._overlayMouseover),this.eventManager.off(t,Fp,this._overlayMouseout),this.eventManager.off(t,Rp,this._elementMouseenter),this.eventManager.off(t,Np,this._elementMouseexit),this.eventManager.off(t,Bp,this._elementMousemove),this.eventManager.off(t,jp,this._elementMouseup),this.eventManager.off(t,zp,this._elementMousedown),this.eventManager.off(t,Ip,this._elementContextmenu))}},{key:"setContainer",value:function(t){var e,n=this;if(t===document||t===document.body)throw new Error("Cannot set document or document.body as container element");this._detachEventDelegates(),null!=this.dragManager&&(e=this.dragManager.reset()),this.setAttribute(t,Ep,su().replace("-",""));var o=this.getContainer();null!=o&&(o.removeAttribute(Ep),Gd(Qd(o.childNodes).filter((function(t){return null!=t&&(n.hasClass(t,Vu)||n.hasClass(t,Hu)||n.hasClass(t,Zu)||t.getAttribute&&null!=t.getAttribute(Nu))})),(function(e){t.appendChild(e)})));Od(Ad(i.prototype),"setContainer",this).call(this,t),this.containerType=Mu(t),null!=this.eventManager&&this._attachEventDelegates(),null!=this.dragManager&&(this.dragManager.addHandler(new Dg(this)),this.dragManager.addHandler(new Ig(this,this.dragSelection),this.groupDragOptions),this.elementDragHandler=new Um(this,this.dragSelection),this.dragManager.addHandler(this.elementDragHandler,this.elementDragOptions),null!=e&&this.dragManager.setFilters(e))}},{key:"reset",value:function(){Od(Ad(i.prototype),"reset",this).call(this),this._resizeObserver&&this._resizeObserver.disconnect(),Gd(this.getContainer().querySelectorAll([ap,xf,bf,kf].join(",")),(function(t){return t.parentNode&&t.parentNode.removeChild(t)}))}},{key:"destroy",value:function(){this._detachEventDelegates(),null!=this.dragManager&&this.dragManager.reset(),this.clearDragSelection(),Od(Ad(i.prototype),"destroy",this).call(this)}},{key:"unmanage",value:function(t,e){null!=this._resizeObserver&&this._resizeObserver.unobserve(t),this.removeFromDragSelection(t),Od(Ad(i.prototype),"unmanage",this).call(this,t,e)}},{key:"addToDragSelection",value:function(){for(var t=this,e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];Gd(i,(function(e){return t.dragSelection.add(e)}))}},{key:"clearDragSelection",value:function(){this.dragSelection.clear()}},{key:"removeFromDragSelection",value:function(){for(var t=this,e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];Gd(i,(function(e){return t.dragSelection.remove(e)}))}},{key:"toggleDragSelection",value:function(){for(var t=this,e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];Gd(i,(function(e){return t.dragSelection.toggle(e)}))}},{key:"addToDragGroup",value:function(t){for(var e,i=arguments.length,n=new Array(i>1?i-1:0),o=1;o<i;o++)n[o-1]=arguments[o];(e=this.elementDragHandler).addToDragGroup.apply(e,[t].concat(n))}},{key:"removeFromDragGroup",value:function(){var t;(t=this.elementDragHandler).removeFromDragGroup.apply(t,arguments)}},{key:"setDragGroupState",value:function(t){for(var e,i=arguments.length,n=new Array(i>1?i-1:0),o=1;o<i;o++)n[o-1]=arguments[o];(e=this.elementDragHandler).setDragGroupState.apply(e,[t].concat(n))}},{key:"clearDragGroup",value:function(t){this.elementDragHandler.clearDragGroup(t)}},{key:"consume",value:function(t,e){mu(t,e)}},{key:"rotate",value:function(t,e,n){var o=this.getId(t);return this._managedElements[o]?(this._managedElements[o].el.style.transform="rotate("+e+"deg)",this._managedElements[o].el.style.transformOrigin="center center",Od(Ad(i.prototype),"rotate",this).call(this,t,e,n)):{c:new Set,e:new Set}}},{key:"addOverlayClass",value:function(t,e){if(qg(t))t.instance.addClass(sy(t),e);else if(ey(t))t.instance.addClass(sv(t),e);else{if(!vv(t))throw"Could not add class to overlay of type ["+t.type+"]";t.instance.addClass(ry(t),e)}}},{key:"removeOverlayClass",value:function(t,e){if(qg(t))t.instance.removeClass(sy(t),e);else if(ey(t))t.instance.removeClass(sv(t),e);else{if(!vv(t))throw"Could not remove class from overlay of type ["+t.type+"]";t.instance.removeClass(ry(t),e)}}},{key:"_paintOverlay",value:function(t,e,i){if(qg(t)){sy(t);var n=t.component.getXY();t.canvas.style.left=n.x+e.d.minx+"px",t.canvas.style.top=n.y+e.d.miny+"px"}else if(ey(t)){!function(t,e,i,n){sv(t);var o=[0,0];n.xmin<0&&(o[0]=-n.xmin),n.ymin<0&&(o[1]=-n.ymin);var s={d:e,stroke:i.stroke?i.stroke:null,fill:i.fill?i.fill:null,transform:"translate("+o[0]+","+o[1]+")","pointer-events":"visibleStroke"};yp(t.path,s)}(t,isNaN(e.d.cxy.x)||isNaN(e.d.cxy.y)?"M 0 0":"M"+e.d.hxy.x+","+e.d.hxy.y+" L"+e.d.tail[0].x+","+e.d.tail[0].y+" L"+e.d.cxy.x+","+e.d.cxy.y+" L"+e.d.tail[1].x+","+e.d.tail[1].y+" Z",e,i)}else{if(!vv(t))throw"Could not paint overlay of type ["+t.type+"]";ry(t);var o=t.component.getXY();t.canvas.style.left=o.x+e.d.minx+"px",t.canvas.style.top=o.y+e.d.miny+"px"}}},{key:"setOverlayVisible",value:function(t,e){var i=e?"block":"none";function n(t){null!=t&&(t.style.display=i)}qg(t)?n(sy(t)):vv(t)?n(ry(t)):ey(t)&&n(t.path)}},{key:"reattachOverlay",value:function(t,e){qg(t)?t.instance._appendElement(sy(t),this.getContainer()):vv(t)?t.instance._appendElement(ry(t),this.getContainer()):ey(t)&&this._appendElement(sv(t),e.connector.canvas)}},{key:"setOverlayHover",value:function(t,e){var i;qg(t)?i=sy(t):vv(t)?i=ry(t):ey(t)&&(i=sv(t)),null!=i&&(null!=this.hoverClass&&(e?this.addClass(i,this.hoverClass):this.removeClass(i,this.hoverClass)),this.setHover(t.component,e))}},{key:"destroyOverlay",value:function(t){if(qg(t)){var e=sy(t);e.parentNode.removeChild(e),delete t.canvas,delete t.cachedDimensions}else if(dv(t)||pv(t)||mv(t))!function(t,e){var i=t;null!=i.path&&null!=i.path.parentNode&&i.path.parentNode.removeChild(i.path),null!=i.bgPath&&null!=i.bgPath.parentNode&&i.bgPath.parentNode.removeChild(i.bgPath),delete i.path,delete i.bgPath}(t);else if(vv(t)){var i=ry(t);i.parentNode.removeChild(i),delete t.canvas,delete t.cachedDimensions}}},{key:"drawOverlay",value:function(t,e,i,n){if(qg(t)||vv(t)){var o=Lg._getDimensions(t);if(null!=o&&null!=o.w&&null!=o.h){var s={x:0,y:0};if(n)s={x:n.x,y:n.y};else if(e instanceof Xm){var r=Array.isArray(t.location)?t.location:[t.location,t.location];s={x:r[0]*e.w,y:r[1]*e.h}}else{var a=t.location,l=!1;(Bd(t.location)||t.location<0||t.location>1)&&(a=parseInt(""+t.location,10),l=!0),s=e.pointOnPath(a,l)}var c=s.x-o.w/2,h=s.y-o.h/2;return{component:t,d:{minx:c,miny:h,td:o,cxy:s},xmin:c,xmax:c+o.w,ymin:h,ymax:h+o.h}}return{xmin:0,xmax:0,ymin:0,ymax:0}}if(dv(t)||pv(t)||mv(t))return t.draw(e,i,n);throw"Could not draw overlay of type ["+t.type+"]"}},{key:"updateLabel",value:function(t){if(qd(t.label)){var e=t.label(this);sy(t).innerText=null!=e?e:""}else null==t.labelText&&(t.labelText=t.label,null!=t.labelText?sy(t).innerText=t.labelText:sy(t).innerText="")}},{key:"setHover",value:function(t,e){t._hover=e,t instanceof tv&&null!=t.endpoint?this.setEndpointHover(t,e,-1):t instanceof ov&&null!=t.connector&&this.setConnectorHover(t.connector,e)}},{key:"paintConnector",value:function(t,e,i){av(this,t,e,i)}},{key:"setConnectorHover",value:function(t,e,i){if(!1===e||!this.currentlyDragging&&!this.isHoverSuspended()){var n=t.canvas;null!=n&&(null!=t.hoverClass&&(e?this.addClass(n,t.hoverClass):this.removeClass(n,t.hoverClass)),e?this.addClass(n,this.hoverClass):this.removeClass(n,this.hoverClass)),null!=t.connection.hoverPaintStyle&&(t.connection.paintStyleInUse=e?t.connection.hoverPaintStyle:t.connection.paintStyle,this._suspendDrawing||this._paintConnection(t.connection)),t.connection.endpoints[0]!==i&&this.setEndpointHover(t.connection.endpoints[0],e,0,!0),t.connection.endpoints[1]!==i&&this.setEndpointHover(t.connection.endpoints[1],e,1,!0)}}},{key:"destroyConnector",value:function(t){null!=t.connector&&ny(t.connector)}},{key:"addConnectorClass",value:function(t,e){t.canvas&&this.addClass(t.canvas,e)}},{key:"removeConnectorClass",value:function(t,e){t.canvas&&this.removeClass(t.canvas,e)}},{key:"getConnectorClass",value:function(t){return t.canvas?t.canvas.className.baseVal:""}},{key:"setConnectorVisible",value:function(t,e){iy(t,e)}},{key:"applyConnectorType",value:function(t,e){if(t.canvas&&e.cssClass){var i=Array.isArray(e.cssClass)?e.cssClass:[e.cssClass];this.addClass(t.canvas,i.join(" "))}}},{key:"addEndpointClass",value:function(t,e){var i=oy(t.endpoint);null!=i&&this.addClass(i,e)}},{key:"applyEndpointType",value:function(t,e){if(e.cssClass){var i=oy(t.endpoint);if(i){var n=Array.isArray(e.cssClass)?e.cssClass:[e.cssClass];this.addClass(i,n.join(" "))}}}},{key:"destroyEndpoint",value:function(t){var e=this.endpointAnchorClassPrefix+(t.currentAnchorClass?"-"+t.currentAnchorClass:"");this.removeClass(t.element,e),ny(t.endpoint)}},{key:"renderEndpoint",value:function(t,e){var i=Qv[t.endpoint.type];null!=i?lv.paint(t.endpoint,i,e):cu("jsPlumb: no endpoint renderer found for type ["+t.endpoint.type+"]")}},{key:"removeEndpointClass",value:function(t,e){var i=oy(t.endpoint);null!=i&&this.removeClass(i,e)}},{key:"getEndpointClass",value:function(t){var e=oy(t.endpoint);return null!=e?e.className:""}},{key:"setEndpointHover",value:function(t,e,i,n){if(null!=t&&(!1===e||!this.currentlyDragging&&!this.isHoverSuspended())){var o=oy(t.endpoint);if(null!=o&&(null!=t.hoverClass&&(e?this.addClass(o,t.hoverClass):this.removeClass(o,t.hoverClass)),0===i||1===i)){var s=0===i?this.hoverSourceClass:this.hoverTargetClass;e?this.addClass(o,s):this.removeClass(o,s)}if(null!=t.hoverPaintStyle&&(t.paintStyleInUse=e?t.hoverPaintStyle:t.paintStyle,this._suspendDrawing||this.renderEndpoint(t,t.paintStyleInUse)),!n)for(var r=0;r<t.connections.length;r++)this.setConnectorHover(t.connections[r].connector,e,t)}}},{key:"setEndpointVisible",value:function(t,e){iy(t.endpoint,e)}},{key:"setGroupVisible",value:function(t,e){for(var i=t.el.querySelectorAll(ap),n=0;n<i.length;n++)e?this.show(i[n],!0):this.hide(i[n],!0)}},{key:"deleteConnection",value:function(t,e){return null!=t&&!0!==t.deleted&&(!0!==t.endpoints[0].deleted&&this.setEndpointHover(t.endpoints[0],!1,0,!0),!0!==t.endpoints[1].deleted&&this.setEndpointHover(t.endpoints[1],!1,1,!0),Od(Ad(i.prototype),"deleteConnection",this).call(this,t,e))}},{key:"addSourceSelector",value:function(t,e,n){return this.addDragFilter(t),Od(Ad(i.prototype),"addSourceSelector",this).call(this,t,e,n)}},{key:"removeSourceSelector",value:function(t){this.removeDragFilter(t.selector),Od(Ad(i.prototype),"removeSourceSelector",this).call(this,t)}},{key:"manage",value:function(t,e,n){if(this.containerType===iu.SVG&&Mu(t)!==iu.SVG)throw new Error("ERROR: cannot manage non-svg element when container is an SVG element.");var o=Od(Ad(i.prototype),"manage",this).call(this,t,e,n);return null!=o&&null!=this._resizeObserver&&this._resizeObserver.observe(o.el),o}}]),i}(Kv),cy=function(t){Ed(i,t);var e=Pd(i);function i(t,n){var o;return wd(this,i),Cd(Td(o=e.call(this,t,n)),"width",void 0),Cd(Td(o),"height",void 0),Cd(Td(o),"type",i.type),n=n||{},o.width=n.width||10,o.height=n.height||10,o}return Sd(i,null,[{key:"_getParams",value:function(t){return{width:t.width,height:t.height}}}]),i}(Xm);Cd(cy,"type","Rectangle");var hy={type:cy.type,cls:cy,compute:function(t,e,i,n){var o=n.width||t.width,s=n.height||t.height,r=e.curX-o/2,a=e.curY-s/2;return t.x=r,t.y=a,t.w=o,t.h=s,[r,a,o,s]},getParams:function(t){return{width:t.width,height:t.height}}},dy=function(t){Ed(i,t);var e=Pd(i);function i(t,n){var o;return wd(this,i),Cd(Td(o=e.call(this,t,n)),"type",i.type),o}return i}(Xm);Cd(dy,"type","Blank");var uy,py={type:dy.type,cls:dy,compute:function(t,e,i,n){return t.x=e.curX,t.y=e.curY,t.w=10,t.h=0,[e.curX,e.curY,10,0]},getParams:function(t){return{}}},fy={width:10,height:0,fill:"transparent",stroke:"transparent"};Jv(bv.type,{makeNode:function(t,e){return bp("circle",{cx:t.w/2,cy:t.h/2,r:t.radius})},updateNode:function(t,e){yp(e,{cx:""+t.w/2,cy:""+t.h/2,r:""+t.radius})}}),Jv(dy.type,{makeNode:function(t,e){return bp("rect",fy)},updateNode:function(t,e){yp(e,fy)}}),Jv(cy.type,{makeNode:function(t,e){return bp("rect",{width:t.w,height:t.h})},updateNode:function(t,e){yp(e,{width:t.w,height:t.h})}}),function(t){t[t.top=0]="top",t[t.bottom=1]="bottom"}(uy||(uy={}));var my=new Map;my.set(uy.top,[Cp.TopRight,Cp.TopLeft]),my.set(uy.bottom,[Cp.BottomRight,Cp.BottomLeft]);var gy={deriveAnchor:function(t,e,i,n){return my.get(t)[e]}},vy="jtk-scrollable-list",yy=Pu(vy),by="scroll";!function(){function t(e,i){var n=this;wd(this,t),this.instance=e,Cd(this,"options",void 0),Cd(this,"count",void 0),Cd(this,"lists",void 0),this.count=0,this.lists={},this.options=i||{},this.instance.bind(tp,(function(t){for(var e=n.instance.getSelector(t.el,yy),i=0;i<e.length;i++)n.addList(e[i])})),this.instance.bind(ip,(function(t){n.removeList(t.el)})),this.instance.bind(Yu,(function(t,e){if(null==e){var i=n.findParentList(t.target);null!=i&&i.newConnection(t.connection,t.target,1);var o=n.findParentList(t.source);null!=o&&o.newConnection(t.connection,t.source,0)}})),this.instance.bind(sp,(function(t){var e=t.dropEndpoint.element,i=n.findParentList(e);return null==i||e.offsetTop>=i.domElement.scrollTop&&e.offsetTop+e.offsetHeight<=i.domElement.scrollTop+i.domElement.offsetHeight}))}Sd(t,[{key:"addList",value:function(t,e){var i=Rd({},gy);Rd(i,this.options),e=Rd(i,e||{});var n=[this.instance._instanceIndex,this.count++].join("_");return this.lists[n]=new xy(this.instance,t,e,n),this.lists[n]}},{key:"getList",value:function(t){var e=this.instance.getAttribute(t,vy);if(null!=e)return this.lists[e]}},{key:"removeList",value:function(t){var e=this.getList(t);e&&(e.destroy(),delete this.lists[e.id])}},{key:"findParentList",value:function(t){for(var e,i=t.parentNode,n=this.instance.getContainer();null!=i&&i!==n&&i!==document;){if(null!=(e=this.getList(i)))return e;i=i.parentNode}}}])}();var xy=function(){function t(e,i,n,o){wd(this,t),this.instance=e,this.el=i,this.options=n,this.id=o,Cd(this,"_scrollHandler",void 0),Cd(this,"domElement",void 0),Cd(this,"elId",void 0),this.domElement=i,this.elId=this.instance.getId(i),e.setAttribute(i,vy,o),this._scrollHandler=this.scrollHandler.bind(this),this.domElement._jsPlumbScrollHandler=this._scrollHandler,e.on(i,by,this._scrollHandler),this._scrollHandler()}return Sd(t,[{key:"deriveAnchor",value:function(t,e,i,n){return this.options.anchor?this.options.anchor:this.options.deriveAnchor(t,e,i,n)}},{key:"deriveEndpoint",value:function(t,e,i,n){return this.options.deriveEndpoint?this.options.deriveEndpoint(t,e,i,n):this.options.endpoint?this.options.endpoint:i.endpoint.type}},{key:"newConnection",value:function(t,e,i){e.offsetTop<this.el.scrollTop?this._proxyConnection(e,t,i,uy.top):e.offsetTop+e.offsetHeight>this.el.scrollTop+this.domElement.offsetHeight&&this._proxyConnection(e,t,i,uy.bottom)}},{key:"scrollHandler",value:function(){for(var t=this,e=this.instance.getSelector(this.el,ap),i=function(i){if(e[i].offsetTop<t.el.scrollTop)e[i]._jsPlumbProxies=e[i]._jsPlumbProxies||[],t.instance.select({source:e[i]}).each((function(n){t._proxyConnection(e[i],n,0,uy.top)})),t.instance.select({target:e[i]}).each((function(n){t._proxyConnection(e[i],n,1,uy.top)}));else if(e[i].offsetTop+e[i].offsetHeight>t.el.scrollTop+t.domElement.offsetHeight)e[i]._jsPlumbProxies=e[i]._jsPlumbProxies||[],t.instance.select({source:e[i]}).each((function(n){t._proxyConnection(e[i],n,0,uy.bottom)})),t.instance.select({target:e[i]}).each((function(n){t._proxyConnection(e[i],n,1,uy.bottom)}));else if(e[i]._jsPlumbProxies){for(var n=0;n<e[i]._jsPlumbProxies.length;n++)t.instance.unproxyConnection(e[i]._jsPlumbProxies[n][0],e[i]._jsPlumbProxies[n][1]);delete e[i]._jsPlumbProxies}t.instance.revalidate(e[i])},n=0;n<e.length;n++)i(n)}},{key:"_proxyConnection",value:function(t,e,i,n){var o=this;this.instance.proxyConnection(e,i,this.domElement,(function(t,i){return o.deriveEndpoint(n,i,e.endpoints[i],e)}),(function(t,i){return o.deriveAnchor(n,i,e.endpoints[i],e)})),t._jsPlumbProxies=t._jsPlumbProxies||[],t._jsPlumbProxies.push([e,i])}},{key:"destroy",value:function(){this.instance.off(this.el,by,this._scrollHandler),delete this.domElement._jsPlumbScrollHandler;for(var t=this.instance.getSelector(this.el,ap),e=0;e<t.length;e++)if(t[e]._jsPlumbProxies){for(var i=0;i<t[e]._jsPlumbProxies.length;i++)this.instance.unproxyConnection(t[e]._jsPlumbProxies[i][0],t[e]._jsPlumbProxies[i][1]);delete t[e]._jsPlumbProxies}}}]),t}();function _y(t){var e=Math.floor(t),i=Math.ceil(t);return t-e<1e-10?e:i-t<1e-10?i:t}var wy=function(t){Ed(i,t);var e=Pd(i);function i(t){var n;wd(this,i),Cd(Td(n=e.call(this,t)),"type",i.segmentType),Cd(Td(n),"cx",void 0),Cd(Td(n),"cy",void 0),Cd(Td(n),"radius",void 0),Cd(Td(n),"anticlockwise",void 0),Cd(Td(n),"startAngle",void 0),Cd(Td(n),"endAngle",void 0),Cd(Td(n),"sweep",void 0),Cd(Td(n),"length",void 0),Cd(Td(n),"circumference",void 0),Cd(Td(n),"frac",void 0),n.cx=t.cx,n.cy=t.cy,n.radius=t.r,n.anticlockwise=t.ac,t.startAngle&&t.endAngle?(n.startAngle=t.startAngle,n.endAngle=t.endAngle,n.x1=n.cx+n.radius*Math.cos(n.startAngle),n.y1=n.cy+n.radius*Math.sin(n.startAngle),n.x2=n.cx+n.radius*Math.cos(n.endAngle),n.y2=n.cy+n.radius*Math.sin(n.endAngle)):(n.startAngle=n._calcAngle(n.x1,n.y1),n.endAngle=n._calcAngle(n.x2,n.y2)),n.endAngle<0&&(n.endAngle+=om),n.startAngle<0&&(n.startAngle+=om);var o=n.endAngle<n.startAngle?n.endAngle+om:n.endAngle;return n.sweep=Math.abs(o-n.startAngle),n.anticlockwise&&(n.sweep=om-n.sweep),n.circumference=2*Math.PI*n.radius,n.frac=n.sweep/om,n.length=n.circumference*n.frac,n.extents={xmin:n.cx-n.radius,xmax:n.cx+n.radius,ymin:n.cy-n.radius,ymax:n.cy+n.radius},n}return Sd(i,[{key:"_calcAngle",value:function(t,e){return function(t,e){var i=sm(t,e),n=Math.atan(i),o=am(t,e);return 4!=o&&3!=o||(n+=Math.PI),n<0&&(n+=2*Math.PI),n}({x:this.cx,y:this.cy},{x:t,y:e})}},{key:"_calcAngleForLocation",value:function(t,e){if(t.anticlockwise){var i=t.startAngle<t.endAngle?t.startAngle+om:t.startAngle;return i-Math.abs(i-t.endAngle)*e}var n=t.endAngle<t.startAngle?t.endAngle+om:t.endAngle,o=Math.abs(n-t.startAngle);return t.startAngle+o*e}},{key:"getPath",value:function(t){var e=this.sweep>Math.PI?1:0,i=this.anticlockwise?0:1;return(t?"M"+this.x1+" "+this.y1+" ":"")+"A "+this.radius+" "+this.radius+" 0 "+e+","+i+" "+this.x2+" "+this.y2}},{key:"getLength",value:function(){return this.length}},{key:"pointOnPath",value:function(t,e){if(0===t)return{x:this.x1,y:this.y1,theta:this.startAngle};if(1===t)return{x:this.x2,y:this.y2,theta:this.endAngle};e&&(t/=length);var i=this._calcAngleForLocation(this,t),n=this.cx+this.radius*Math.cos(i),o=this.cy+this.radius*Math.sin(i);return{x:_y(n),y:_y(o),theta:i}}},{key:"gradientAtPoint",value:function(t,e){var i=this.pointOnPath(t,e),n=-1/sm({x:this.cx,y:this.cy},i);return this.anticlockwise||n!==1/0&&n!==-1/0||(n*=-1),n}},{key:"pointAlongPathFrom",value:function(t,e,i){var n=this.pointOnPath(t,i),o=e/this.circumference*2*Math.PI,s=this.anticlockwise?-1:1,r=n.theta+s*o;return{x:this.cx+this.radius*Math.cos(r),y:this.cy+this.radius*Math.sin(r)}}}]),i}(Ef);Cd(wy,"segmentType","Arc");var ky=function(t){Ed(i,t);var e=Pd(i);function i(t,n){var o;return wd(this,i),(o=e.call(this,t,n)).connection=t,Cd(Td(o),"showLoopback",void 0),Cd(Td(o),"curviness",void 0),Cd(Td(o),"margin",void 0),Cd(Td(o),"proximityLimit",void 0),Cd(Td(o),"orientation",void 0),Cd(Td(o),"loopbackRadius",void 0),Cd(Td(o),"clockwise",void 0),Cd(Td(o),"isLoopbackCurrently",void 0),Cd(Td(o),"geometry",null),n=n||{},o.showLoopback=!1!==n.showLoopback,o.curviness=n.curviness||10,o.margin=n.margin||5,o.proximityLimit=n.proximityLimit||80,o.clockwise=n.orientation&&"clockwise"===n.orientation,o.loopbackRadius=n.loopbackRadius||25,o.isLoopbackCurrently=!1,o}return Sd(i,[{key:"getDefaultStubs",value:function(){return[0,0]}},{key:"_compute",value:function(t,e){var i=e.sourcePos,n=e.targetPos,o=Math.abs(i.curX-n.curX),s=Math.abs(i.curY-n.curY);if(this.showLoopback&&e.sourceEndpoint.elementId===e.targetEndpoint.elementId){this.isLoopbackCurrently=!0;var r=e.sourcePos.curX,a=e.sourcePos.curY-this.margin,l=r,c=a-this.loopbackRadius,h=l-this.loopbackRadius,d=c-this.loopbackRadius;o=2*this.loopbackRadius,s=2*this.loopbackRadius,t.points[0]=h,t.points[1]=d,t.points[2]=o,t.points[3]=s,this._addSegment(wy,{loopback:!0,x1:r-h+4,y1:a-d,startAngle:0,endAngle:2*Math.PI,r:this.loopbackRadius,ac:!this.clockwise,x2:r-h-4,y2:a-d,cx:l-h,cy:c-d})}else this.isLoopbackCurrently=!1,this._computeBezier(t,e,i,n,o,s)}},{key:"exportGeometry",value:function(){return null==this.geometry?null:{controlPoints:[Rd({},this.geometry.controlPoints[0]),Rd({},this.geometry.controlPoints[1])],source:Rd({},this.geometry.source),target:Rd({},this.geometry.target)}}},{key:"transformGeometry",value:function(t,e,i){return{controlPoints:[{x:t.controlPoints[0].x+e,y:t.controlPoints[0].y+i},{x:t.controlPoints[1].x+e,y:t.controlPoints[1].y+i}],source:this.transformAnchorPlacement(t.source,e,i),target:this.transformAnchorPlacement(t.target,e,i)}}},{key:"importGeometry",value:function(t){return null!=t&&(null==t.controlPoints||2!=t.controlPoints.length?(cu("jsPlumb Bezier: cannot import geometry; controlPoints missing or does not have length 2"),this.setGeometry(null,!0),!1):null==t.controlPoints[0].x||null==t.controlPoints[0].y||null==t.controlPoints[1].x||null==t.controlPoints[1].y?(cu("jsPlumb Bezier: cannot import geometry; controlPoints malformed"),this.setGeometry(null,!0),!1):null==t.source||null==t.source.curX||null==t.source.curY?(cu("jsPlumb Bezier: cannot import geometry; source missing or malformed"),this.setGeometry(null,!0),!1):null==t.target||null==t.target.curX||null==t.target.curY?(cu("jsPlumb Bezier: cannot import geometry; target missing or malformed"),this.setGeometry(null,!0),!1):(this.setGeometry(t,!1),!0))}}]),i}(cv),Sy={subtract:function(t,e){return{x:t.x-e.x,y:t.y-e.y}},dotProduct:function(t,e){return t.x*e.x+t.y*e.y},square:function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},scale:function(t,e){return{x:t.x*e,y:t.y*e}}},Cy=64,Ey=Math.pow(2,-Cy-1);function Ay(t,e){for(var i,n=[],o=function(t,e){for(var i=e.length-1,n=2*i-1,o=[],s=[],r=[],a=[],l=[[1,.6,.3,.1],[.4,.6,.6,.4],[.1,.3,.6,1]],c=0;c<=i;c++)o[c]=Sy.subtract(e[c],t);for(var h=0;h<=i-1;h++)s[h]=Sy.subtract(e[h+1],e[h]),s[h]=Sy.scale(s[h],3);for(var d=0;d<=i-1;d++)for(var u=0;u<=i;u++)r[d]||(r[d]=[]),r[d][u]=Sy.dotProduct(s[d],o[u]);for(var p=0;p<=n;p++)a[p]||(a[p]=[]),a[p].y=0,a[p].x=parseFloat(""+p)/n;for(var f=i,m=i-1,g=0;g<=f+m;g++)for(var v=Math.max(0,g-m),y=Math.min(g,f),b=v;b<=y;b++){var x=g-b;a[b+x].y+=r[x][b]*l[x][b]}return a}(t,e),s=e.length-1,r=My(o,2*s-1,n,0),a=Sy.subtract(t,e[0]),l=Sy.square(a),c=0,h=0;h<r;h++)a=Sy.subtract(t,Ty(e,s,n[h],null,null)),(i=Sy.square(a))<l&&(l=i,c=n[h]);return a=Sy.subtract(t,e[s]),(i=Sy.square(a))<l&&(l=i,c=1),{location:c,distance:l}}function My(t,e,i,n){var o,s,r=[],a=[],l=[],c=[];switch(function(t,e){var i,n,o=0;i=n=hu(t[0].y);for(var s=1;s<=e;s++)(i=hu(t[s].y))!=n&&o++,n=i;return o}(t,e)){case 0:return 0;case 1:if(n>=Cy)return i[0]=(t[0].x+t[e].x)/2,1;if(function(t,e){var i,n,o,s,r,a,l,c,h,d,u,p,f,m,g;r=t[0].y-t[e].y,a=t[e].x-t[0].x,l=t[0].x*t[e].y-t[e].x*t[0].y,m=g=0;for(var v=1;v<e;v++){var y=r*t[v].x+a*t[v].y+l;y>m?m=y:y<g&&(g=y)}return u=r,p=a,f=l-m,i=((h=1)*f-p*(d=0))*(1/((c=0)*p-u*h)),u=r,p=a,f=l-g,n=(h*f-p*d)*(1/(c*p-u*h)),o=Math.min(i,n),s=Math.max(i,n),s-o<Ey?1:0}(t,e))return i[0]=function(t,e){var i=1,n=0,o=t[e].x-t[0].x,s=t[e].y-t[0].y,r=t[0].x-0,a=t[0].y-0,l=1/(o*n-s*i)*(o*a-s*r);return 0+i*l}(t,e),1}Ty(t,e,.5,r,a),o=My(r,e,l,n+1),s=My(a,e,c,n+1);for(var h=0;h<o;h++)i[h]=l[h];for(var d=0;d<s;d++)i[d+o]=c[d];return o+s}function Ty(t,e,i,n,o){for(var s=[[]],r=0;r<=e;r++)s[0][r]=t[r];for(var a=1;a<=e;a++)for(var l=0;l<=e-a;l++)s[a]||(s[a]=[]),s[a][l]||(s[a][l]={}),s[a][l].x=(1-i)*s[a-1][l].x+i*s[a-1][l+1].x,s[a][l].y=(1-i)*s[a-1][l].y+i*s[a-1][l+1].y;if(null!=n)for(var c=0;c<=e;c++)n[c]=s[c][0];if(null!=o)for(var h=0;h<=e;h++)o[h]=s[e-h][h];return s[e][0]}function Py(t,e){var i={x:0,y:0};if(0===t)return e[0];var n=e.length-1;if(1===t)return e[n];var o=e,s=1-t;if(0===n)return e[0];if(1===n)return{x:s*o[0].x+t*o[1].x,y:s*o[0].y+t*o[1].y};if(4>n){var r,a,l,c=s*s,h=t*t,d=0;return 2===n?(o=[o[0],o[1],o[2],i],r=c,a=s*t*2,l=h):3===n&&(r=c*s,a=c*t*3,l=s*h*3,d=t*h),{x:r*o[0].x+a*o[1].x+l*o[2].x+d*o[3].x,y:r*o[0].y+a*o[1].y+l*o[2].y+d*o[3].y}}return i}function Oy(t){var e=0;if(!$y(t))for(var i=function(t,e){var i=[];t--;for(var n=0;n<=t;n++)i.push(Py(n/t,e));return i}(16,t),n=0;n<15;n++){e+=Ly(i[n],i[n+1])}return e}var Dy=new Map;function Iy(t,e){for(var i=function(t){var e=Dy.get(t);if(!e){var i=function(t){return function(e){return t}},n=function(t){return function(e){for(var i=1,n=0;n<t.length;n++)i*=t[n](e);return i}};(e=[]).push((function(e){return Math.pow(e,t)}));for(var o=1;o<t;o++){for(var s=[i(t)],r=0;r<t-o;r++)s.push((function(t){return t}));for(var a=0;a<o;a++)s.push((function(t){return 1-t}));e.push(n(s))}e.push((function(e){return Math.pow(1-e,t)})),Dy.set(t,e)}return e}(t.length-1),n=0,o=0,s=0;s<t.length;s++)n+=t[s].x*i[s](e),o+=t[s].y*i[s](e);return{x:n,y:o}}function Ly(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function $y(t){return t[0].x===t[1].x&&t[0].y===t[1].y}function zy(t,e,i){if($y(t))return{point:t[0],location:e};for(var n=Iy(t,e),o=0,s=e,r=i>0?1:-1,a=null;o<Math.abs(i);)o+=Ly(a=Iy(t,s+=.005*r),n),n=a;return{point:a,location:s}}function Ry(t,e,i,n,o){var s=n-e,r=t-i,a=t*(e-n)+e*(i-t),l=function(t){return[Ny(t,"x"),Ny(t,"y")]}(o),c=[s*l[0][0]+r*l[1][0],s*l[0][1]+r*l[1][1],s*l[0][2]+r*l[1][2],s*l[0][3]+r*l[1][3]+a],h=By.apply(null,c),d=[];if(null!=h)for(var u=0;u<3;u++){var p=h[u],f=Math.pow(p,2),m=Math.pow(p,3),g={x:l[0][0]*m+l[0][1]*f+l[0][2]*p+l[0][3],y:l[1][0]*m+l[1][1]*f+l[1][2]*p+l[1][3]},v=void 0;v=i-t!=0?(g[0]-t)/(i-t):(g[1]-e)/(n-e),p>=0&&p<=1&&v>=0&&v<=1&&d.push(g)}return d}function Ny(t,e){return[-t[0][e]+3*t[1][e]+-3*t[2][e]+t[3][e],3*t[0][e]-6*t[1][e]+3*t[2][e],-3*t[0][e]+3*t[1][e],t[0][e]]}function By(t,e,i,n){var o,s,r=e/t,a=i/t,l=n/t,c=(3*a-Math.pow(r,2))/9,h=(9*r*a-27*l-2*Math.pow(r,3))/54,d=Math.pow(c,3)+Math.pow(h,2),u=[0,0,0];if(d>=0)o=hu(h+Math.sqrt(d))*Math.pow(Math.abs(h+Math.sqrt(d)),1/3),s=hu(h-Math.sqrt(d))*Math.pow(Math.abs(h-Math.sqrt(d)),1/3),u[0]=-r/3+(o+s),u[1]=-r/3-(o+s)/2,u[2]=-r/3-(o+s)/2,0!==Math.abs(Math.sqrt(3)*(o-s)/2)&&(u[1]=-1,u[2]=-1);else{var p=Math.acos(h/Math.sqrt(-Math.pow(c,3)));u[0]=2*Math.sqrt(-c)*Math.cos(p/3)-r/3,u[1]=2*Math.sqrt(-c)*Math.cos((p+2*Math.PI)/3)-r/3,u[2]=2*Math.sqrt(-c)*Math.cos((p+4*Math.PI)/3)-r/3}for(var f=0;f<3;f++)(u[f]<0||u[f]>1)&&(u[f]=-1);return u}var jy=function(t){Ed(i,t);var e=Pd(i);function i(t){var n;return wd(this,i),Cd(Td(n=e.call(this,t)),"curve",void 0),Cd(Td(n),"cp1x",void 0),Cd(Td(n),"cp1y",void 0),Cd(Td(n),"cp2x",void 0),Cd(Td(n),"cp2y",void 0),Cd(Td(n),"length",0),Cd(Td(n),"type",i.segmentType),n.cp1x=t.cp1x,n.cp1y=t.cp1y,n.cp2x=t.cp2x,n.cp2y=t.cp2y,n.x1=t.x1,n.x2=t.x2,n.y1=t.y1,n.y2=t.y2,n.curve=[{x:n.x1,y:n.y1},{x:n.cp1x,y:n.cp1y},{x:n.cp2x,y:n.cp2y},{x:n.x2,y:n.y2}],n.extents={xmin:Math.min(n.x1,n.x2,n.cp1x,n.cp2x),ymin:Math.min(n.y1,n.y2,n.cp1y,n.cp2y),xmax:Math.max(n.x1,n.x2,n.cp1x,n.cp2x),ymax:Math.max(n.y1,n.y2,n.cp1y,n.cp2y)},n}return Sd(i,[{key:"getPath",value:function(t){return(t?"M "+this.x2+" "+this.y2+" ":"")+"C "+this.cp2x+" "+this.cp2y+" "+this.cp1x+" "+this.cp1y+" "+this.x1+" "+this.y1}},{key:"pointOnPath",value:function(t,e){return t=i._translateLocation(this.curve,t,e),Iy(this.curve,t)}},{key:"gradientAtPoint",value:function(t,e){return t=i._translateLocation(this.curve,t,e),function(t,e){var i=Iy(t,e),n=Iy(t.slice(0,t.length-1),e),o=n.y-i.y,s=n.x-i.x;return 0===o?1/0:Math.atan(o/s)}(this.curve,t)}},{key:"pointAlongPathFrom",value:function(t,e,n){return t=i._translateLocation(this.curve,t,n),function(t,e,i){return zy(t,e,i).point}(this.curve,t,e)}},{key:"getLength",value:function(){return null!=this.length&&0!==this.length||(this.length=Oy(this.curve)),this.length}},{key:"findClosestPointOnPath",value:function(t,e){var i,n,o,s=(i={x:t,y:e},n=this.curve,o=Ay(i,n),{point:Ty(n,n.length-1,o.location,null,null),location:o.location});return{d:Math.sqrt(Math.pow(s.point.x-t,2)+Math.pow(s.point.y-e,2)),x:s.point.x,y:s.point.y,l:1-s.location,s:this,x1:null,y1:null,x2:null,y2:null}}},{key:"lineIntersection",value:function(t,e,i,n){return Ry(t,e,i,n,this.curve)}}],[{key:"_translateLocation",value:function(t,e,i){return i&&(e=function(t,e,i){return zy(t,e,i).location}(t,e>0?0:1,e)),e}}]),i}(Ef);Cd(jy,"segmentType","Bezier");var Fy=function(t){Ed(i,t);var e=Pd(i);function i(t,n){var o;return wd(this,i),(o=e.call(this,t,n)).connection=t,Cd(Td(o),"type",i.type),Cd(Td(o),"majorAnchor",void 0),Cd(Td(o),"minorAnchor",void 0),n=n||{},o.majorAnchor=n.curviness||150,o.minorAnchor=10,o}return Sd(i,[{key:"getCurviness",value:function(){return this.majorAnchor}},{key:"_findControlPoint",value:function(t,e,i,n,o){var s={x:0,y:0};return n[0]!==o[0]||n[1]===o[1]?(0===o[0]?s.x=i.curX<e.curX?t.x+this.minorAnchor:t.x-this.minorAnchor:s.x=t.x+this.majorAnchor*o[0],0===o[1]?s.y=i.curY<e.curY?t.y+this.minorAnchor:t.y-this.minorAnchor:s.y=t.y+this.majorAnchor*n[1]):(0===n[0]?s.x=e.curX<i.curX?t.x+this.minorAnchor:t.x-this.minorAnchor:s.x=t.x-this.majorAnchor*n[0],0===n[1]?s.y=e.curY<i.curY?t.y+this.minorAnchor:t.y-this.minorAnchor:s.y=t.y+this.majorAnchor*o[1]),s}},{key:"_computeBezier",value:function(t,e,i,n,o,s){var r,a,l=i.curX<n.curX?o:0,c=i.curY<n.curY?s:0,h=i.curX<n.curX?0:o,d=i.curY<n.curY?0:s;!0!==this.edited?(r=this._findControlPoint({x:l,y:c},i,n,t.so,t.to),a=this._findControlPoint({x:h,y:d},n,i,t.to,t.so)):(r=this.geometry.controlPoints[0],a=this.geometry.controlPoints[1]),this.geometry={controlPoints:[r,a],source:e.sourcePos,target:e.targetPos},this._addSegment(jy,{x1:l,y1:c,x2:h,y2:d,cp1x:r.x,cp1y:r.y,cp2x:a.x,cp2y:a.y})}}]),i}(ky);Cd(Fy,"type","Bezier");var qy=function(t){Ed(i,t);var e=Pd(i);function i(t,n){var o;return wd(this,i),(o=e.call(this,t,n)).connection=t,Cd(Td(o),"type",i.type),Cd(Td(o),"_controlPoint",void 0),o.curviness=n.curviness||10,o.margin=n.margin||5,o.proximityLimit=n.proximityLimit||80,o.clockwise=n.orientation&&"clockwise"===n.orientation,o}return Sd(i,[{key:"_computeBezier",value:function(t,e,i,n,o,s){var r,a,l,c,h,d,u,p,f=i.curX<n.curX?0:o,m=i.curY<n.curY?0:s,g=i.curX<n.curX?o:0,v=i.curY<n.curY?s:0;if(0===i.x&&(f-=this.margin),1===i.x&&(f+=this.margin),0===i.y&&(m-=this.margin),1===i.y&&(m+=this.margin),0===n.x&&(g-=this.margin),1===n.x&&(g+=this.margin),0===n.y&&(v-=this.margin),1===n.y&&(v+=this.margin),!0!==this.edited){var y=(f+g)/2,b=(m+v)/2,x=(a=m,c=v,(r=f)<=(l=g)&&c<=a?1:r<=l&&a<=c?2:l<=r&&c>=a?3:4),_=Math.sqrt(Math.pow(g-f,2)+Math.pow(v-m,2));this._controlPoint=function(t,e,i,n,o,s,r,a,l){return a<=l?{x:t,y:e}:1===i?n.curY<=0&&o.curY>=1?{x:t+(n.x<.5?-1*s:s),y:e}:n.curX>=1&&o.curX<=0?{x:t,y:e+(n.y<.5?-1*r:r)}:{x:t+-1*s,y:e+-1*r}:2===i?n.curY>=1&&o.curY<=0?{x:t+(n.x<.5?-1*s:s),y:e}:n.curX>=1&&o.curX<=0?{x:t,y:e+(n.y<.5?-1*r:r)}:{x:t+s,y:e+-1*r}:3===i?n.curY>=1&&o.curY<=0?{x:t+(n.x<.5?-1*s:s),y:e}:n.curX<=0&&o.curX>=1?{x:t,y:e+(n.y<.5?-1*r:r)}:{x:t+-1*s,y:e+-1*r}:4===i?n.curY<=0&&o.curY>=1?{x:t+(n.x<.5?-1*s:s),y:e}:n.curX<=0&&o.curX>=1?{x:t,y:e+(n.y<.5?-1*r:r)}:{x:t+s,y:e+-1*r}:void 0}(y,b,x,e.sourcePos,e.targetPos,this.curviness,this.curviness,_,this.proximityLimit)}else this._controlPoint=this.geometry.controlPoints[0];h=this._controlPoint.x,d=this._controlPoint.x,u=this._controlPoint.y,p=this._controlPoint.y,this.geometry={controlPoints:[this._controlPoint,this._controlPoint],source:e.sourcePos,target:e.targetPos},this._addSegment(jy,{x1:g,y1:v,x2:f,y2:m,cp1x:h,cp1y:u,cp2x:d,cp2y:p})}}]),i}(ky);function Vy(t){return t<0?-1:0===t?0:1}function Hy(t){return[Vy(t[2]-t[0]),Vy(t[3]-t[1])]}function Uy(t){return Math.sqrt(Math.pow(t[0]-t[2],2)+Math.pow(t[1]-t[3],2))}function Wy(t){var e=[];return e.push.apply(e,t),e}Cd(qy,"type","StateMachine"),Uv(Fy.type,Fy),Uv(qy.type,qy);var Gy=function(t){Ed(i,t);var e=Pd(i);function i(t,n){var o;return wd(this,i),(o=e.call(this,t,n)).connection=t,Cd(Td(o),"type",i.type),Cd(Td(o),"internalSegments",[]),Cd(Td(o),"midpoint",void 0),Cd(Td(o),"alwaysRespectStubs",void 0),Cd(Td(o),"cornerRadius",void 0),Cd(Td(o),"lastx",void 0),Cd(Td(o),"lasty",void 0),Cd(Td(o),"lastOrientation",void 0),Cd(Td(o),"loopbackRadius",void 0),Cd(Td(o),"isLoopbackCurrently",void 0),o.midpoint=null==n.midpoint||isNaN(n.midpoint)?.5:n.midpoint,o.cornerRadius=null!=n.cornerRadius?n.cornerRadius:0,o.alwaysRespectStubs=!0===n.alwaysRespectStubs,o.lastx=null,o.lasty=null,o.lastOrientation=null,o.loopbackRadius=n.loopbackRadius||25,o.isLoopbackCurrently=!1,o}return Sd(i,[{key:"getDefaultStubs",value:function(){return[30,30]}},{key:"addASegment",value:function(t,e,i){if(this.lastx!==t||this.lasty!==e){var n=null==this.lastx?i.sx:this.lastx,o=null==this.lasty?i.sy:this.lasty,s=n===t?"v":"h";this.lastx=t,this.lasty=e,this.internalSegments.push([n,o,t,e,s])}}},{key:"writeSegments",value:function(t){for(var e,i,n,o=null,s=0;s<this.internalSegments.length-1;s++){if(o=o||Wy(this.internalSegments[s]),e=Wy(this.internalSegments[s+1]),i=Hy(o),n=Hy(e),this.cornerRadius>0&&o[4]!==e[4]){var r=Math.min(Uy(o),Uy(e)),a=Math.min(this.cornerRadius,r/2);o[2]-=i[0]*a,o[3]-=i[1]*a,e[0]+=n[0]*a,e[1]+=n[1]*a;var l=i[1]===n[0]&&1===n[0]||i[1]===n[0]&&0===n[0]&&i[0]!==n[1]||i[1]===n[0]&&-1===n[0],c=(e[1]>o[3]?1:-1)===(e[0]>o[2]?1:-1),h=c&&l||!c&&!l?e[0]:o[2],d=c&&l||!c&&!l?o[3]:e[1];this._addSegment(Wv,{x1:o[0],y1:o[1],x2:o[2],y2:o[3]}),this._addSegment(wy,{r:a,x1:o[2],y1:o[3],x2:e[0],y2:e[1],cx:h,cy:d,ac:l})}else this._addSegment(Wv,{x1:o[0],y1:o[1],x2:o[2],y2:o[3]});o=e}null!=e&&this._addSegment(Wv,{x1:e[0],y1:e[1],x2:e[2],y2:e[3]})}},{key:"_compute",value:function(t,e){var i=this;this.internalSegments.length=0,this.lastx=null,this.lasty=null,this.lastOrientation=null;var n=function(e){return[t.startStubX,t.startStubY,t.endStubX,t.endStubY]},o={perpendicular:n,orthogonal:n,opposite:function(e){var n=t,o="x"===e?0:1,s={x:function(){return 1===n.so[o]&&(n.startStubX>n.endStubX&&n.tx>n.startStubX||n.sx>n.endStubX&&n.tx>n.sx)||-1===n.so[o]&&(n.startStubX<n.endStubX&&n.tx<n.startStubX||n.sx<n.endStubX&&n.tx<n.sx)},y:function(){return 1===n.so[o]&&(n.startStubY>n.endStubY&&n.ty>n.startStubY||n.sy>n.endStubY&&n.ty>n.sy)||-1===n.so[o]&&(n.startStubY<n.endStubY&&n.ty<n.startStubY||n.sy<n.endStubY&&n.ty<n.sy)}};return!i.alwaysRespectStubs&&s[e]()?{x:[(t.sx+t.tx)/2,t.startStubY,(t.sx+t.tx)/2,t.endStubY],y:[t.startStubX,(t.sy+t.ty)/2,t.endStubX,(t.sy+t.ty)/2]}[e]:[t.startStubX,t.startStubY,t.endStubX,t.endStubY]}},s=o[t.anchorOrientation](t.sourceAxis),r="x"===t.sourceAxis?0:1,a="x"===t.sourceAxis?1:0,l=s[r],c=s[a],h=s[r+2],d=s[a+2];this.addASegment(s[0],s[1],t);var u=t.startStubX+(t.endStubX-t.startStubX)*this.midpoint,p=t.startStubY+(t.endStubY-t.startStubY)*this.midpoint,f={x:[0,1],y:[1,0]},m={perpendicular:function(e,i,n,o,s){var r=t,a={x:[[r.startStubX,r.endStubX],null,[r.endStubX,r.startStubX]],y:[[r.startStubY,r.endStubY],null,[r.endStubY,r.startStubY]]},l={x:[[u,r.startStubY],[u,r.endStubY]],y:[[r.startStubX,p],[r.endStubX,p]]},c={x:[[r.endStubX,r.startStubY]],y:[[r.startStubX,r.endStubY]]},h={x:[[r.startStubX,r.endStubY],[r.endStubX,r.endStubY]],y:[[r.endStubX,r.startStubY],[r.endStubX,r.endStubY]]},d={x:[[r.startStubX,p],[r.endStubX,p],[r.endStubX,r.endStubY]],y:[[u,r.startStubY],[u,r.endStubY],[r.endStubX,r.endStubY]]},m={x:[r.startStubY,r.endStubY],y:[r.startStubX,r.endStubX]},g=f[e][0],v=f[e][1],y=r.so[g]+1,b=r.to[v]+1,x=-1===r.to[v]&&m[e][1]<m[e][0]||1===r.to[v]&&m[e][1]>m[e][0],_=a[e][y][0],w=a[e][y][1],k={x:[[[1,2,3,4],null,[2,1,4,3]],null,[[4,3,2,1],null,[3,4,1,2]]],y:[[[3,2,1,4],null,[2,3,4,1]],null,[[4,1,2,3],null,[1,4,3,2]]]}[e][y][b];return r.segment===k[3]||r.segment===k[2]&&x?l[e]:r.segment===k[2]&&w<_?c[e]:r.segment===k[2]&&w>=_||r.segment===k[1]&&!x?d[e]:r.segment===k[0]||r.segment===k[1]&&x?h[e]:void 0},orthogonal:function(e,i,n,o,s){var r=t,a={x:-1===r.so[0]?Math.min(i,o):Math.max(i,o),y:-1===r.so[1]?Math.min(i,o):Math.max(i,o)}[e];return{x:[[a,n],[a,s],[o,s]],y:[[n,a],[s,a],[s,o]]}[e]},opposite:function(n,o,s,a,l){var c=t,h={x:"y",y:"x"}[n],d={x:"h",y:"w"}[n],f=c["is"+n.toUpperCase()+"GreaterThanStubTimes2"];if(e.sourceEndpoint.elementId===e.targetEndpoint.elementId){var m=s+(1-e.sourceEndpoint._anchor.computedPosition[h])*e.sourceInfo[d]+i.maxStub;return{x:[[o,m],[a,m]],y:[[m,o],[m,a]]}[n]}return!f||1===c.so[r]&&o>a||-1===c.so[r]&&o<a?{x:[[o,p],[a,p]],y:[[u,o],[u,a]]}[n]:1===c.so[r]&&o<a||-1===c.so[r]&&o>a?{x:[[u,c.sy],[u,c.ty]],y:[[c.sx,p],[c.tx,p]]}[n]:void 0}},g=m[t.anchorOrientation](t.sourceAxis,l,c,h,d);if(g)for(var v=0;v<g.length;v++)this.addASegment(g[v][0],g[v][1],t);this.addASegment(s[2],s[3],t),this.addASegment(t.tx,t.ty,t),this.writeSegments(t)}},{key:"transformGeometry",value:function(t,e,i){return t}}]),i}(cv);function Zy(){var t=Math.floor(2e3*Math.random()),e=Math.floor(2e3*Math.random());return{clientX:t,clientY:e,screenX:t,screenY:e,pageX:t,pageY:e}}Cd(Gy,"type","Flowchart"),Uv(Gy.type,Gy),Ym.registerHandler(xv),Ym.registerHandler(hy),Ym.registerHandler(py),Uv(Gv.type,Gv);for(var Yy={clientX:5e4,clientY:5e4,screenX:5e4,screenY:5e4,pageX:5e4,pageY:5e4},Xy=0;Xy<256;Xy++)Xy.toString(16);!function(){function t(e,i,n){wd(this,t),this._jsPlumb=e,this.ok=i,this.equal=n,Cd(this,"_divs",[]),Cd(this,"mottle",void 0),this.mottle=new em}Sd(t,[{key:"_t",value:function(t,e,i,n){this.mottle.trigger(t,e,{pageX:i,pageY:n,screenX:i,screenY:n,clientX:i,clientY:n})}},{key:"addDiv",value:function(t,e,i,n,o,s,r){var a=document.createElement("div");return a.style.position="absolute",a.innerHTML=t,e?e.appendChild(a):this._jsPlumb.getContainer().appendChild(a),a.setAttribute("id",t),a.style.left=(null!=n?n:Math.floor(1e3*Math.random()))+"px",a.style.top=(null!=o?o:Math.floor(1e3*Math.random()))+"px",i&&(a.className=i),s&&(a.style.width=s+"px"),r&&(a.style.height=r+"px"),this._divs.push(t),a}},{key:"addDivs",value:function(t,e){for(var i=0;i<t.length;i++)this.addDiv(t[i],e)}},{key:"assertEndpointCount",value:function(t,e){var i=this._jsPlumb.getEndpoints(t),n=i?i.length:0;this.equal(n,e,t.getAttribute("data-jtk-managed")+" has "+e+(e>1||0==e?" endpoints":" endpoint"))}},{key:"_assertManagedEndpointCount",value:function(t,e){var i=this._jsPlumb.getId(t),n=this._jsPlumb._managedElements[i];this.equal(n.endpoints.length,e,i+" has "+e+" endpoints in managed record")}},{key:"_assertManagedConnectionCount",value:function(t,e){var i=this._jsPlumb.getId(t),n=this._jsPlumb._managedElements[i];this.equal(n.connections.length,e,i+" has "+e+" connections in managed record")}},{key:"_registerDiv",value:function(t){this._divs.push(t)}},{key:"makeDragStartEvt",value:function(t){var e=this.makeEvent(t),i=this._jsPlumb.getContainer();return e.clientX+=i.offsetLeft,e.screenX+=i.offsetLeft,e.pageX+=i.offsetLeft,e.clientY+=i.offsetTop,e.screenY+=i.offsetTop,e.pageY+=i.offsetTop,e}},{key:"getAttribute",value:function(t,e){return t.getAttribute(e)}},{key:"dragNodeBy",value:function(t,e,i,n){(n=n||{}).before&&n.before();var o=this.makeEvent(t);this._jsPlumb.trigger(t,zp,o),n.beforeMouseMove&&n.beforeMouseMove(),this._t(document,Bp,o.pageX+e,o.pageY+i),n.beforeMouseUp&&n.beforeMouseUp(),this.mottle.trigger(document,jp,null),n.after&&n.after()}},{key:"dragNodeTo",value:function(t,e,i,n){n=n||{};var o=this._jsPlumb.viewport.getPosition(this._jsPlumb.getId(t));n.before&&n.before();var s=this.makeEvent(t);this._jsPlumb.trigger(t,zp,s);var r=this._jsPlumb.getContainer().getBoundingClientRect();n.beforeMouseMove&&n.beforeMouseMove(),this._t(document,Bp,r.x+e+o.w/2,r.y+i+o.h/2),n.beforeMouseUp&&n.beforeMouseUp(),this.mottle.trigger(document,jp,null),n.after&&n.after()}},{key:"dragToGroup",value:function(t,e,i){var n=this._jsPlumb.getGroup(e),o=this._jsPlumb.viewport.getPosition(n.elId),s=o.x+o.w/2,r=o.y+o.h/2;this.dragNodeTo(t,s,r,i)}},{key:"aSyncDragNodeBy",value:function(t,e,i,n){var o=this;(n=n||{}).before&&n.before();var s=this.makeEvent(t);this._jsPlumb.trigger(t,zp,s),n.beforeMouseMove&&n.beforeMouseMove(),setTimeout((function(){o._t(document,Bp,s.pageX+e,s.pageY+i),n.beforeMouseUp&&n.beforeMouseUp(),setTimeout((function(){o.mottle.trigger(document,jp,null),n.after&&n.after()}),45)}),45)}},{key:"dragANodeAround",value:function(t,e,i){this._jsPlumb.trigger(t,zp,this.makeEvent(t));for(var n=50*Math.random(),o=0;o<n;o++){var s=Zy();t.style.left=s.screenX+"px",t.style.top=s.screenY+"px",this._jsPlumb.trigger(document,Bp,s)}e&&this.ok(e(),i||"while dragging assert"),this._jsPlumb.trigger(document,jp,Yy)}},{key:"dragConnection",value:function(t,e,i,n){var o=this.getCanvas(t),s=this.getCanvas(e),r=this.makeEvent(o),a=this.makeEvent(s);n=n||{};var l=this._jsPlumb.select().length;return this._jsPlumb.trigger(o,zp,r),n.beforeMouseMove&&n.beforeMouseMove(),this._jsPlumb.trigger(i?s:document,Bp,a),n.beforeMouseUp&&n.beforeMouseUp(),this._jsPlumb.trigger(i?s:document,jp,a),this._jsPlumb.select().get(l)}},{key:"aSyncDragConnection",value:function(t,e,i){var n=this;i=i||{};var o=this.getCanvas(t),s=this.getCanvas(e),r=this.makeEvent(o),a=this.makeEvent(s),l=this._jsPlumb.select().length;this._jsPlumb.trigger(o,zp,r),setTimeout((function(){i.beforeMouseMove&&i.beforeMouseMove(),n._jsPlumb.trigger(document,Bp,a),setTimeout((function(){i.beforeMouseUp&&i.beforeMouseUp(),n._jsPlumb.trigger(s,jp,a),i.after&&i.after(n._jsPlumb.select().get(l))}),5)}),5)}},{key:"dragAndAbortConnection",value:function(t){var e=this.getCanvas(t),i=this.makeEvent(e);this._jsPlumb.trigger(e,zp,i),this._jsPlumb.trigger(document,Bp,Yy),this._jsPlumb.trigger(document,jp,Yy)}},{key:"detachConnection",value:function(t,e){e=e||{};var i=this.getEndpointCanvas(t),n=this.makeEvent(i);e.before&&e.before(),this._jsPlumb.trigger(i,zp,n),e.beforeMouseMove&&e.beforeMouseMove(),this._jsPlumb.trigger(document,Bp,Yy),e.beforeMouseUp&&e.beforeMouseUp(),this._jsPlumb.trigger(document,jp,Yy),e.after&&e.after()}},{key:"detachAndReattachConnection",value:function(t,e){e=e||{};var i=this.getEndpointCanvas(t),n=this.makeEvent(i);e.before&&e.before(),this._jsPlumb.trigger(i,zp,n),e.beforeMouseMove&&e.beforeMouseMove(),this._jsPlumb.trigger(document,Bp,Yy),this._jsPlumb.trigger(document,Bp,n),e.beforeMouseUp&&e.beforeMouseUp(),this._jsPlumb.trigger(document,jp,n),e.after&&e.after()}},{key:"detachConnectionByTarget",value:function(t,e){this.detachConnection(t.endpoints[1],e)}},{key:"relocateTarget",value:function(t,e,i){this.relocate(t,1,e,i)}},{key:"relocate",value:function(t,e,i,n){n=n||{},i=this.getCanvas(i);var o=this.getEndpointCanvas(t.endpoints[e]),s=this.makeEvent(o),r=this.makeEvent(i);n.before&&n.before(),this._jsPlumb.trigger(o,zp,s),n.beforeMouseMove&&n.beforeMouseMove(),this._jsPlumb.trigger(document,Bp,r),n.beforeMouseUp&&n.beforeMouseUp(),this._jsPlumb.trigger(i,jp,r),n.after&&n.after()}},{key:"relocateSource",value:function(t,e,i){this.relocate(t,0,e,i)}},{key:"makeEvent",value:function(t){var e=t.getBoundingClientRect(),i=e.x+e.width/2,n=e.y+e.height/2;return{clientX:i,clientY:n,screenX:i,screenY:n,pageX:i,pageY:n}}},{key:"getCanvas",value:function(t){return t.endpoint?this.getEndpointCanvas(t):t}},{key:"getEndpointCanvas",value:function(t){return t.endpoint.canvas}},{key:"getConnectionCanvas",value:function(t){return t.connector.canvas}},{key:"getEndpointCanvasPosition",value:function(t){var e=this.getEndpointCanvas(t);return{x:parseInt(e.style.left,10),y:parseInt(e.style.top,10),w:e.getAttribute("width"),h:e.getAttribute("height")}}},{key:"within",value:function(t,e,i){this.ok(Math.abs(t-e)<1e-11,i+"[expected: "+e+" got "+t+"] [diff:"+Math.abs(t-e)+"]")}},{key:"assertManagedEndpointCount",value:function(t,e){var i=this._jsPlumb.getId(t),n=this._jsPlumb._managedElements[i];this.equal(n.endpoints.length,e,i+" has "+e+" endpoints in managed record")}},{key:"assertManagedConnectionCount",value:function(t,e){var i=this._jsPlumb.getId(t),n=this._jsPlumb._managedElements[i];this.equal(n.connections.length,e,i+" has "+e+" connections in managed record")}},{key:"fireEventOnEndpoint",value:function(t){for(var e=this.getEndpointCanvas(t),i=0;i<(arguments.length<=1?0:arguments.length-1);i++)this._jsPlumb.trigger(e,i+1<1||arguments.length<=i+1?void 0:arguments[i+1])}},{key:"fireEventOnElement",value:function(t){for(var e=0;e<(arguments.length<=1?0:arguments.length-1);e++)this._jsPlumb.trigger(t,e+1<1||arguments.length<=e+1?void 0:arguments[e+1])}},{key:"fireEventOnConnection",value:function(t){for(var e=this.getConnectionCanvas(t),i=arguments.length,n=new Array(i>1?i-1:0),o=1;o<i;o++)n[o-1]=arguments[o];this.fireEventOnElement.apply(this,[e].concat(n))}},{key:"clickOnConnection",value:function(t){this.fireEventOnConnection(t,Dp)}},{key:"dblClickOnConnection",value:function(t){this.fireEventOnConnection(t,Lp)}},{key:"tapOnConnection",value:function(t){this.fireEventOnConnection(t,zp),this.fireEventOnConnection(t,jp)}},{key:"dblTapOnConnection",value:function(t){this.fireEventOnConnection(t,zp),this.fireEventOnConnection(t,jp),this.fireEventOnConnection(t,zp),this.fireEventOnConnection(t,jp)}},{key:"clickOnElement",value:function(t,e){this._jsPlumb.trigger(t,Dp,null,null,null==e?1:e)}},{key:"dblClickOnElement",value:function(t){this._jsPlumb.trigger(t,Lp)}},{key:"tapOnElement",value:function(t){this._jsPlumb.trigger(t,zp),this._jsPlumb.trigger(t,jp)}},{key:"dblTapOnElement",value:function(t){this._jsPlumb.trigger(t,zp),this._jsPlumb.trigger(t,jp),this._jsPlumb.trigger(t,zp),this._jsPlumb.trigger(t,jp)}},{key:"getOverlayCanvas",value:function(t){return t.canvas||t.path}},{key:"fireEventOnOverlay",value:function(t,e,i){var n=t.getOverlay(e),o=this.getOverlayCanvas(n);this._jsPlumb.trigger(o,i)}},{key:"clickOnOverlay",value:function(t,e){this.fireEventOnOverlay(t,e,Dp)}},{key:"dblClickOnOverlay",value:function(t,e){this.fireEventOnOverlay(t,e,Lp)}},{key:"tapOnOverlay",value:function(t,e){this.fireEventOnOverlay(t,e,zp),this.fireEventOnOverlay(t,e,jp)}},{key:"dblTapOnOverlay",value:function(t,e){this.fireEventOnOverlay(t,e,zp),this.fireEventOnOverlay(t,e,jp),this.fireEventOnOverlay(t,e,zp),this.fireEventOnOverlay(t,e,jp)}},{key:"cleanup",value:function(){var t=this._jsPlumb.getContainer();for(var e in this._jsPlumb.destroy(),this._divs){var i=document.getElementById(this._divs[e]);i&&i.parentNode.removeChild(i)}this._divs.length=0;var n=this._jsPlumb.select().length,o=this._jsPlumb.selectEndpoints().length,s=t.querySelectorAll(".jtk-endpoint").length,r=t.querySelectorAll(".jtk-connector").length;for(var a in t.__ta)for(var l in t.__ta[a])throw"Container event bindings not empty for key "+a;if(n>0)throw"there are connections in the data model!";if(o>0)throw"there are endpoints in the data model!";if(s>0)throw"there are "+s+" endpoints left in the dom!";if(r>0)throw"there are "+r+" connections left in the dom!"}},{key:"makeContent",value:function(t){var e=document.createElement("div");return e.innerHTML=t,e.firstChild}},{key:"length",value:function(t){var e=0;for(var i in t)t.hasOwnProperty(i)&&e++;return e}},{key:"head",value:function(t){for(var e in t)return t[e]}},{key:"uuid",value:function(){return su()}}])}();var Ky=0;function Qy(t){return new ly(function(){var t=Ky+1;return Ky++,t}(),t)}const Jy={endpoint:{type:bv.type,options:{radius:6,connectedClass:"plumb-connected",cssClass:"plumb-source",hoverClass:"plumb-source-hover"}},anchors:["Bottom","Continuous"],maxConnections:1,dragAllowedWhenFull:!1,deleteEndpointsOnEmpty:!0,isSource:!0},tb={endpoint:{type:cy.type,options:{width:23,height:23,cssClass:"plumb-target",hoverClass:"plumb-target-hover"}},anchor:{type:"Continuous",options:{faces:["top","left","right"],cssClass:"continuos plumb-target-anchor"}},dragAllowedWhenFull:!1,deleteEndpointsOnEmpty:!0,isTarget:!0};class eb{constructor(t){this.jsPlumb=null,this.pendingConnections=[],this.connectionWait=null,function(t){!function e(){/complete|loaded|interactive/.test(document.readyState)&&void 0!==document.body&&null!=document.body?t():setTimeout(e,9)}()}((()=>{this.jsPlumb=Qy({container:t})}))}makeTarget(t){const e=document.getElementById(t);this.jsPlumb.addEndpoint(e,tb)}makeSource(t){const e=document.getElementById(t);this.jsPlumb.addEndpoint(e,Jy)}processPendingConnections(){this.connectionWait&&(clearTimeout(this.connectionWait),this.connectionWait=null),this.connectionWait=setTimeout((()=>{this.jsPlumb.batch((()=>{this.pendingConnections.forEach((t=>{const{fromId:e,toId:i}=t,n=document.getElementById(e),o=document.getElementById(i),s=this.jsPlumb.addEndpoint(n,{...Jy,endpoint:{...Jy.endpoint,options:{...Jy.endpoint.options,cssClass:"plumb-source connected"}}}),r=this.jsPlumb.addEndpoint(o,tb);this.jsPlumb.connect({source:s,target:r,connector:{type:Gy.type,options:{stub:12,midpoint:.75,alwaysRespectStubs:!1,gap:[0,5],cornerRadius:3,cssClass:"plumb-connector"}},overlays:[{type:"PlainArrow",options:{width:13,length:13,location:.999,cssClass:"plumb-arrow"}}]})})),this.pendingConnections=[]}))}),50)}connectIds(t,e){this.pendingConnections.push({fromId:t,toId:e}),this.processPendingConnections()}}const ib={add_input_labels:{name:"Add Labels",color:"#01c1af"},add_contact_urn:{name:"Add Contact URN",color:"#01c1af"},set_contact_field:{name:"Update Contact Field",color:"#01c1af"},send_broadcast:{name:"Send Broadcast",color:"#8e5ea7;"},set_run_result:{name:"Save Flow Result",color:"#1a777c",render:(t,e)=>U`<div>Save ${e.value} as <b>${e.name}</b></div>`},send_msg:{name:"Send Message",color:"#3498db",render:(t,e)=>{const i=e.text.replace(/\n/g,"<br>");return U`
|
|
8055
|
+
</div>`}}function _d(t){return _d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_d(t)}function wd(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function kd(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Sd(t,e,i){return e&&kd(t.prototype,e),i&&kd(t,i),t}function Cd(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Ed(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Md(t,e)}function Ad(t){return Ad=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Ad(t)}function Md(t,e){return Md=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Md(t,e)}function Td(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Pd(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=Ad(t);if(e){var o=Ad(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return function(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?Td(t):e}(this,i)}}function Od(t,e,i){return Od="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,i){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Ad(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(i):o.value}},Od(t,e,i||t)}function Dd(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==i)return;var n,o,s=[],r=!0,a=!1;try{for(i=i.call(t);!(r=(n=i.next()).done)&&(s.push(n.value),!e||s.length!==e);r=!0);}catch(t){a=!0,o=t}finally{try{r||null==i.return||i.return()}finally{if(a)throw o}}return s}(t,e)||Ld(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Id(t){return function(t){if(Array.isArray(t))return $d(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Ld(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ld(t,e){if(t){if("string"==typeof t)return $d(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?$d(t,e):void 0}}function $d(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function zd(t,e,i){return"*"===t||(t.length>0?-1!==t.indexOf(e):!i)}function Rd(t,e,i){var n,o=t=t||{},s=e=e||{};for(n in s)o[n]=s[n];return t}function Nd(t){return"[object Number]"===Object.prototype.toString.call(t)}function Bd(t){return"string"==typeof t}function jd(t){return"boolean"==typeof t}function Fd(t){return null!=t&&"[object Object]"===Object.prototype.toString.call(t)}function qd(t){return"[object Function]"===Object.prototype.toString.call(t)}function Vd(t){if(Bd(t))return""+t;if(jd(t))return!!t;if(function(t){return"[object Date]"===Object.prototype.toString.call(t)}(t))return new Date(t.getTime());if(qd(t))return t;if(Array.isArray(t)){for(var e=[],i=0;i<t.length;i++)e.push(Vd(t[i]));return e}if(Fd(t)){var n={};for(var o in t)n[o]=Vd(t[o]);return n}return t}function Hd(t,e,i,n){var o,s,r={},a={};for(i=i||[],n=n||[],s=0;s<i.length;s++)r[i[s]]=!0;for(s=0;s<n.length;s++)a[n[s]]=!0;var l=Vd(t);for(s in e)if(null==l[s]||a[s])l[s]=e[s];else if(r[s])(o=[]).push.apply(o,Array.isArray(l[s])?l[s]:[l[s]]),o.push(e[s]),l[s]=o;else if(Bd(e[s])||jd(e[s])||qd(e[s])||Nd(e[s]))l[s]=e[s];else if(Array.isArray(e[s]))o=[],Array.isArray(l[s])&&o.push.apply(o,l[s]),o.push.apply(o,e[s]),l[s]=o;else if(Fd(e[s]))for(var c in Fd(l[s])||(l[s]={}),e[s])l[s][c]=e[s][c];return l}function Ud(t,e,i){for(var n=0;n<i.length;n++){var o=i[n][0][i[n][1]].apply(i[n][0],i[n][2]);if(o===e)return o}return t}function Wd(t,e,i,n){return function t(o){if(null!=o){if(Bd(o))return function(t){var i=t.match(/(\${.*?})/g);if(null!=i)for(var n=0;n<i.length;n++){var o=e[i[n].substring(2,i[n].length-1)]||"";null!=o&&(t=t.replace(i[n],o))}if(null!=(i=t.match(/({{.*?}})/g)))for(var s=0;s<i.length;s++){var r=e[i[s].substring(2,i[s].length-2)]||"";null!=r&&(t=t.replace(i[s],r))}return t}(o);if(qd(o)&&!n&&0===(o.name||"").indexOf(i))return o(e);if(Array.isArray(o)){for(var s=[],r=0;r<o.length;r++)s.push(t(o[r]));return s}if(Fd(o)){var a={};for(var l in o)a[l]=t(o[l]);return a}return o}}(t)}function Gd(t,e){if(!t)return null;for(var i=0;i<t.length;i++)e(t[i])}function Zd(t,e){if(t)for(var i=0;i<t.length;i++)if(e(t[i]))return i;return-1}function Yd(t,e){var i=Zd(t,e);return-1===i?null:t[i]}function Xd(t,e){var i=null;return t.forEach((function(t){e(t)&&(i=t)})),i}function Kd(t,e){var i=Zd(t,e);return i>-1&&t.splice(i,1),-1!==i}function Qd(t){if(null!=Array.fromArray)return Array.from(t);var e=[];return Array.prototype.push.apply(e,t),e}function Jd(t,e){var i=t.indexOf(e);return i>-1&&t.splice(i,1),-1!==i}function tu(t,e,i,n){var o=t[e];return null==o&&(o=[],t[e]=o),o[n?"unshift":"push"](i),o}function eu(t,e,i){return-1===t.indexOf(e)&&(t.push(e),!0)}t([ue({type:String,attribute:!1})],xd.prototype,"endpoint",void 0),t([ue({type:Boolean})],xd.prototype,"pendingDrop",void 0),t([ue({type:String})],xd.prototype,"icon",void 0),t([ue({type:String})],xd.prototype,"accept",void 0),t([ue({type:Number})],xd.prototype,"max",void 0),t([ue({type:Array})],xd.prototype,"attachments",void 0),t([ue({type:Boolean,attribute:!1})],xd.prototype,"uploading",void 0);for(var iu,nu=[],ou=0;ou<256;ou++)nu[ou]=(ou<16?"0":"")+ou.toString(16);function su(){var t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return nu[255&t]+nu[t>>8&255]+nu[t>>16&255]+nu[t>>24&255]+"-"+nu[255&e]+nu[e>>8&255]+"-"+nu[e>>16&15|64]+nu[e>>24&255]+"-"+nu[63&i|128]+nu[i>>8&255]+"-"+nu[i>>16&255]+nu[i>>24&255]+nu[255&n]+nu[n>>8&255]+nu[n>>16&255]+nu[n>>24&255]}function ru(t,e,i){var n=t.x-e.x,o=t.y-e.y,s=Math.cos(i/360*Math.PI*2),r=Math.sin(i/360*Math.PI*2);return{x:n*s-o*r+e.x,y:o*s+n*r+e.y,cr:s,sr:r}}function au(t){if(null==t)return null;for(var e=t.replace(/^\s\s*/,""),i=/\s/,n=e.length;i.test(e.charAt(--n)););return e.slice(0,n+1)}function lu(t,e){for(var i=[],n=0;n<t.length;n++)i.push(e(t[n]));return i}function cu(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];if("undefined"!=typeof console)try{var n=arguments[arguments.length-1];console.log(n)}catch(t){}}function hu(t){return t<0?-1:t>0?1:0}function du(t,e,i){return function(){var n=null;try{null!=e&&(n=e.apply(this,arguments))}catch(t){cu("jsPlumb function failed : "+t)}if(null!=t&&(null==i||n!==i))try{n=t.apply(this,arguments)}catch(t){cu("wrapped function failed : "+t)}return n}}function uu(t,e,i){return t.has(e)||t.set(e,i()),t.get(e)}function pu(t,e){for(var i=t.__proto__;null!=i;){if(i instanceof e)return!0;i=i.__proto__}return!1}function fu(t,e,i){for(var n=(i=i||t.parentNode).querySelectorAll(e),o=0;o<n.length;o++)if(n[o]===t)return!0;return!1}function mu(t,e){t.stopPropagation?t.stopPropagation():t.returnValue=!1,!e&&t.preventDefault&&t.preventDefault()}function gu(t,e,i,n){if(n&&fu(t,e,i))return t;for(t=t.parentNode;null!=t&&t!==i;){if(fu(t,e))return t;t=t.parentNode}}function vu(t){return t.srcElement||t.target}function yu(t){return null!=t.className?void 0===t.className.baseVal?t.className:t.className.baseVal:""}function bu(t,e,i){var n=null==e?[]:Array.isArray(e)?e:e.split(/\s+/),o=null==i?[]:Array.isArray(i)?i:i.split(/\s+/),s=yu(t).split(/\s+/),r=function(t,e){for(var i=0;i<e.length;i++)if(t)-1===s.indexOf(e[i])&&s.push(e[i]);else{var n=s.indexOf(e[i]);-1!==n&&s.splice(n,1)}};r(!0,n),r(!1,o),function(t,e,i){e=au(e),void 0!==t.className.baseVal?t.className.baseVal=e:t.className=e;try{var n=t.classList;if(null!=n){for(;n.length>0;)n.remove(n.item(0));for(var o=0;o<i.length;o++)i[o]&&n.add(i[o])}}catch(t){cu("WARN: cannot set class list",t)}}(t,s.join(" "),s)}function xu(t){return!Bd(t)&&!Array.isArray(t)&&null!=t.length&&null==t.documentElement&&null==t.nodeType}function _u(t,e){var i=function(t,e){null!=t&&null!=e&&e.length>0&&(t.classList?Gd(au(e).split(/\s+/),(function(e){t.classList.add(e)})):bu(t,e))};xu(t)?Gd(t,(function(t){return i(t,e)})):i(t,e)}function wu(t,e){var i=function(t,e){null!=t&&null!=e&&e.length>0&&(t.classList?au(e).split(/\s+/).forEach((function(e){t.classList.remove(e)})):bu(t,null,e))};xu(t)?Gd(t,(function(t){return i(t,e)})):i(t,e)}function ku(t,e,i,n){return Su(null,t,e,i,n)}function Su(t,e,i,n,o){var s,r=null==t?document.createElement(e):document.createElementNS(t,e);for(s in i=i||{})r.style[s]=i[s];for(s in n&&(r.className=n),o=o||{})r.setAttribute(s,""+o[s]);return r}function Cu(t){var e=t.getBoundingClientRect(),i=document.body,n=document.documentElement,o=window.pageYOffset||n.scrollTop||i.scrollTop,s=window.pageXOffset||n.scrollLeft||i.scrollLeft,r=n.clientTop||i.clientTop||0,a=n.clientLeft||i.clientLeft||0,l=e.top+o-r,c=e.left+s-a;return{x:Math.round(c),y:Math.round(l)}}function Eu(t,e){var i=e.getContainer().getBoundingClientRect(),n=t.getBoundingClientRect(),o=e.currentZoom;return{x:(n.left-i.left)/o,y:(n.top-i.top)/o}}function Au(t,e){var i=t.getBoundingClientRect(),n=e.currentZoom;return{w:i.width/n,h:i.height/n}}function Mu(t){return t instanceof SVGElement?iu.SVG:iu.HTML}function Tu(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return e.map((function(t){return"."+t})).join(",")}function Pu(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return e.map((function(t){return"["+t+"]"})).join(",")}!function(t){t.SVG="SVG",t.HTML="HTML"}(iu||(iu={}));var Ou="source",Du="target",Iu="block",Lu="none",$u="absolute",zu="fixed",Ru="data-jtk-group",Nu="data-jtk-managed",Bu="data-jtk-not-draggable",ju="tabindex",Fu="data-jtk-scope-",qu="checkCondition",Vu="jtk-connector",Hu="jtk-endpoint",Uu="jtk-floating-endpoint",Wu="jtk-group-collapsed",Gu="jtk-group-expanded",Zu="jtk-overlay",Yu="connection",Xu="internal.connection",Ku="connection:move",Qu="internal.endpoint:unregistered",Ju="internal.connection:detached",tp="element:manage",ep="maxConnections",ip="element:unmanage",np="zoom",op="isDetachAllowed",sp="beforeDrop",rp="beforeDetach",ap=Pu(Nu),lp={"stroke-linejoin":"stroke-linejoin","stroke-dashoffset":"stroke-dashoffset","stroke-linecap":"stroke-linecap"},cp="stroke-dasharray",hp="dashstyle",dp="fill",up="stroke",pp="stroke-width",fp="strokeWidth",mp="svg",gp="path",vp={svg:"http://www.w3.org/2000/svg"};function yp(t,e){for(var i in e)t.setAttribute(i,""+e[i])}function bp(t,e){return(e=e||{}).version="1.1",e.xmlns=vp.svg,Su(vp.svg,t,null,null,e)}function xp(t){return"position:absolute;left:"+t[0]+"px;top:"+t[1]+"px"}function _p(t,e,i){if(e.setAttribute(dp,i.fill?i.fill:Lu),e.setAttribute(up,i.stroke?i.stroke:Lu),i.strokeWidth&&e.setAttribute(pp,i.strokeWidth),i[hp]&&i[fp]&&!i[cp]){var n=-1===i[hp].indexOf(",")?" ":",",o=i[hp].split(n),s="";Gd(o,(function(t){s+=Math.floor(t*i.strokeWidth)+n})),e.setAttribute(cp,s)}else i[cp]&&e.setAttribute(cp,i[cp]);for(var r in lp)i[r]&&e.setAttribute(lp[r],i[r])}function wp(t,e,i){t.childNodes.length>i?t.insertBefore(e,t.childNodes[i]):t.appendChild(e)}function kp(t,e,i){return[t,e].join(":")}var Sp,Cp,Ep="data-jtk-container",Ap="data-jtk-enabled",Mp="data-jtk-scope",Tp="endpoint",Pp="element",Op="connection",Dp="click",Ip="contextmenu",Lp="dblclick",$p="dbltap",zp="mousedown",Rp="mouseenter",Np="mouseexit",Bp="mousemove",jp="mouseup",Fp="mouseout",qp="mouseover",Vp="tap",Hp="revert",Up="connection:drag",Wp=kp(Pp,Dp),Gp=kp(Pp,Lp),Zp=kp(Pp,$p),Yp=kp(Pp,Fp),Xp=kp(Pp,qp),Kp=kp(Pp,Bp),Qp=kp(Pp,jp),Jp=kp(Pp,zp),tf=kp(Pp,Ip),ef=kp(Pp,Vp),nf=kp(Tp,Dp),of=kp(Tp,Lp),sf=kp(Tp,Fp),rf=kp(Tp,qp),af=kp(Tp,jp),lf=kp(Tp,zp),cf=kp(Op,Dp),hf=kp(Op,Lp),df=kp(Op,$p),uf=kp(Op,Fp),pf=kp(Op,qp),ff=kp(Op,jp),mf=kp(Op,zp),gf=kp(Op,Ip),vf=kp(Op,Vp),yf="position",bf=Tu(Vu),xf=Tu(Hu),_f=Pu(Ru),wf=Pu("data-jtk-group-content"),kf=Tu(Zu);!function(t){t.Circle="Circle",t.Ellipse="Ellipse",t.Triangle="Triangle",t.Diamond="Diamond",t.Rectangle="Rectangle",t.Square="Square"}(Sp||(Sp={})),function(t){t.Assign="Assign",t.AutoDefault="AutoDefault",t.Bottom="Bottom",t.BottomLeft="BottomLeft",t.BottomRight="BottomRight",t.Center="Center",t.Continuous="Continuous",t.ContinuousBottom="ContinuousBottom",t.ContinuousLeft="ContinuousLeft",t.ContinuousRight="ContinuousRight",t.ContinuousTop="ContinuousTop",t.ContinuousLeftRight="ContinuousLeftRight",t.ContinuousTopBottom="ContinuousTopBottom",t.Left="Left",t.Perimeter="Perimeter",t.Right="Right",t.Top="Top",t.TopLeft="TopLeft",t.TopRight="TopRight"}(Cp||(Cp={}));var Sf,Cf,Ef=function(){function t(e){wd(this,t),this.params=e,Cd(this,"x1",void 0),Cd(this,"x2",void 0),Cd(this,"y1",void 0),Cd(this,"y2",void 0),Cd(this,"extents",{xmin:1/0,xmax:-1/0,ymin:1/0,ymax:-1/0}),Cd(this,"type",void 0),this.x1=e.x1,this.y1=e.y1,this.x2=e.x2,this.y2=e.y2}return Sd(t,[{key:"findClosestPointOnPath",value:function(t,e){return{d:1/0,x:null,y:null,l:null,x1:null,y1:null,x2:null,y2:null}}},{key:"lineIntersection",value:function(t,e,i,n){return[]}},{key:"boxIntersection",value:function(t,e,i,n){var o=[];return o.push.apply(o,this.lineIntersection(t,e,t+i,e)),o.push.apply(o,this.lineIntersection(t+i,e,t+i,e+n)),o.push.apply(o,this.lineIntersection(t+i,e+n,t,e+n)),o.push.apply(o,this.lineIntersection(t,e+n,t,e)),o}},{key:"boundingBoxIntersection",value:function(t){return this.boxIntersection(t.x,t.y,t.w,t.h)}}]),t}(),Af="undefined",Mf="default",Tf="true",Pf="false",Of="*";function Df(t,e,i,n,o,s,r){return function(){var t=[];return t.push.apply(t,arguments),t.item=function(t){return this[t]},t}(function(t,e,i,n,o,s,r){return new Touch({target:t,identifier:su(),pageX:e,pageY:i,screenX:n,screenY:o,clientX:s||n,clientY:r||o})}(t,e,i,n,o,s,r))}function If(t,e,i){for(var n=(i=i||t.parentNode).querySelectorAll(e),o=0;o<n.length;o++)if(n[o]===t)return!0;return!1}function Lf(t){return t.srcElement||t.target}function $f(t,e,i,n){if(n){var o=t.composedPath?t.composedPath():t.path;if(void 0!==o&&o.indexOf)return{path:o,end:o.indexOf(i)};var s={path:[],end:-1};return function t(e){s.path.push(e),e===i?s.end=s.path.length-1:null!=e.parentNode&&t(e.parentNode)}(e),s}return{path:[e],end:1}}var zf=1;function Rf(){return"ontouchstart"in document.documentElement||null!=navigator.maxTouchPoints&&navigator.maxTouchPoints>0}function Nf(){return"onmousedown"in document.documentElement}var Bf=(Cd(Sf={},zp,"touchstart"),Cd(Sf,jp,"touchend"),Cd(Sf,Bp,"touchmove"),Sf),jf="page";function Ff(t,e){if(null==t)return{x:0,y:0};var i=function(t,e){return t.item?t.item(e):t[e]}(Vf(t),0);return{x:i[e+"X"],y:i[e+"Y"]}}function qf(t){return Ff(t,jf)}function Vf(t){return t.touches&&t.touches.length>0?t.touches:t.changedTouches&&t.changedTouches.length>0?t.changedTouches:t.targetTouches&&t.targetTouches.length>0?t.targetTouches:[t]}function Hf(t,e,i,n,o){if(Gf(t,e,i),n.__tauid=i.__tauid,t.addEventListener)t.addEventListener(e,i,!1,o);else if(t.attachEvent){var s=e+i.__tauid;t["e"+s]=i,t[s]=function(){t["e"+s]&&t["e"+s](window.event)},t.attachEvent("on"+e,t[s])}}function Uf(t,e,i){var n=this;null!=i&&Wf(t,(function(o){if(function(t,e,i){if(t.__ta&&t.__ta[e]&&delete t.__ta[e][i.__tauid],i.__taExtra){for(var n=0;n<i.__taExtra.length;n++)Uf(t,i.__taExtra[n][0],i.__taExtra[n][1]);i.__taExtra.length=0}i.__taUnstore&&i.__taUnstore()}(o,e,i),null!=i.__tauid)if(o.removeEventListener)o.removeEventListener(e,i,!1),Rf()&&Bf[e]&&o.removeEventListener(Bf[e],i,!1);else if(n.detachEvent){var s=e+i.__tauid;o[s]&&o.detachEvent("on"+e,o[s]),o[s]=null,o["e"+s]=null}i.__taTouchProxy&&Uf(t,i.__taTouchProxy[1],i.__taTouchProxy[0])}))}function Wf(t,e){if(null!=t)for(var i="string"==typeof t?document.querySelectorAll(t):null!=t.length?t:[t],n=0;n<i.length;n++)e(i[n])}function Gf(t,e,i){var n=zf++;return t.__ta=t.__ta||{},t.__ta[e]=t.__ta[e]||{},t.__ta[e][n]=i,i.__tauid=n,n}var Zf=/:not\(([^)]+)\)/;function Yf(t,e,i,n){if(null==t)return i;var o=t.split(","),s=[],r=[];Gd(o,(function(t){var e=t.match(Zf);null!=e?r.push(e[1]):s.push(t)})),r.length>0&&0===s.length&&s.push(Of);var a=function n(o){n.__tauid=i.__tauid;var a=Lf(o),l=!1,c=a,h=$f(o,a,e,null!=t);if(-1!=h.end)for(var d=0;!l&&d<h.end;d++){c=h.path[d];for(var u=0;u<r.length;u++)if(If(c,r[u],e))return;for(var p=0;!l&&p<s.length;p++)if(If(c,s[p],e)){i.apply(c,[o,c]),l=!0;break}}};return function(t,e,i){t.__taExtra=t.__taExtra||[],t.__taExtra.push([e,i])}(i,n,a),a}var Xf=function(t,e,i,n,o){if(Rf()&&Bf[e]){var s=Yf(n,t,i,Bf[e]);Hf(t,Bf[e],s,i,o)}"focus"===e&&null==t.getAttribute(ju)&&t.setAttribute(ju,"1"),Hf(t,e,Yf(n,t,i,e),i,o)},Kf=(Cd(Cf={},Vp,{touches:1,taps:1}),Cd(Cf,$p,{touches:1,taps:2}),Cd(Cf,Ip,{touches:2,taps:1}),Cf);function Qf(t,e,i,n){for(var o in i.__tamee[t])i.__tamee[t].hasOwnProperty(o)&&i.__tamee[t][o].apply(n,[e])}var Jf=function(){function t(){wd(this,t)}return Sd(t,null,[{key:"generate",value:function(t,e){return function(i,n,o,s){if(n==Ip&&Nf())Xf(i,n,o,s);else{if(null==i.__taTapHandler){var r=i.__taTapHandler={tap:[],dbltap:[],down:!1,taps:0,downSelectors:[]},a=function(n){for(var o=Lf(n),a=$f(n,o,i,null!=s),l=!1,d=0;d<a.end;d++){if(l)return;o=a.path[d];for(var u=0;u<r.downSelectors.length;u++)if(null==r.downSelectors[u]||If(o,r.downSelectors[u],i)){r.down=!0,setTimeout(c,t),setTimeout(h,e),l=!0;break}}},l=function(t){if(r.down){var e,n,o=Lf(t);r.taps++;var s=function(t){return Vf(t).length}(t);for(var a in Kf)if(Kf.hasOwnProperty(a)){var l=Kf[a];if(l.touches===s&&(1===l.taps||l.taps===r.taps))for(var c=0;c<r[a].length;c++){n=$f(t,o,i,null!=r[a][c][1]);for(var h=0;h<n.end;h++)if(e=n.path[h],null==r[a][c][1]||If(e,r[a][c][1],i)){r[a][c][0].apply(e,[t,e]);break}}}}},c=function(){r.down=!1},h=function(){r.taps=0};i.__taTapHandler.downHandler=a,i.__taTapHandler.upHandler=l,Xf(i,zp,a),Xf(i,jp,l)}i.__taTapHandler.downSelectors.push(s),i.__taTapHandler[n].push([o,s]),o.__taUnstore=function(){null!=i.__taTapHandler&&(Kd(i.__taTapHandler.downSelectors,(function(t){return t===s})),function(t,e){var i,n=0;for(n=0,i=t.length;n<i&&t[n][0]!==e;n++);n<t.length&&t.splice(n,1)}(i.__taTapHandler[n],o),0===i.__taTapHandler.downSelectors.length&&(Uf(i,zp,i.__taTapHandler.downHandler),Uf(i,jp,i.__taTapHandler.upHandler),delete i.__taTapHandler))}}}}}]),t}(),tm=function(){function t(){wd(this,t)}return Sd(t,null,[{key:"generate",value:function(){var t=[];return function(e,i,n,o){if(!e.__tamee){e.__tamee={over:!1,mouseenter:[],mouseexit:[]};var s=function(i){var n=Lf(i);(null==o&&n==e&&!e.__tamee.over||If(n,o,e)&&(null==n.__tamee||!n.__tamee.over))&&(Qf(Rp,i,e,n),n.__tamee=n.__tamee||{},n.__tamee.over=!0,t.push(n))},r=function(i){for(var n=Lf(i),o=0;o<t.length;o++)n!=t[o]||If(i.relatedTarget||i.toElement,"*",n)||(n.__tamee.over=!1,t.splice(o,1),Qf(Np,i,e,n))};Hf(e,qp,Yf(o,e,s,qp),s),Hf(e,Fp,Yf(o,e,r,Fp),r)}n.__taUnstore=function(){delete e.__tamee[i][n.__tauid]},Gf(e,i,n),e.__tamee[i][n.__tauid]=n}}}]),t}(),em=function(){function t(e){wd(this,t),Cd(this,"clickThreshold",void 0),Cd(this,"dblClickThreshold",void 0),Cd(this,"tapHandler",void 0),Cd(this,"mouseEnterExitHandler",void 0),e=e||{},this.clickThreshold=e.clickThreshold||250,this.dblClickThreshold=e.dblClickThreshold||450,this.mouseEnterExitHandler=tm.generate(),this.tapHandler=Jf.generate(this.clickThreshold,this.dblClickThreshold)}return Sd(t,[{key:"_doBind",value:function(t,e,i,n,o){if(null!=i){var s=t;e===Vp||e===$p||e===Ip?this.tapHandler(s,e,i,n,o):e===Rp||e==Np?this.mouseEnterExitHandler(s,e,i,n,o):Xf(s,e,i,n,o)}}},{key:"on",value:function(t,e,i,n,o){var s=null==n?null:i,r=null==n?i:n;return this._doBind(t,e,r,s,o),this}},{key:"off",value:function(t,e,i){return Uf(t,e,i),this}},{key:"trigger",value:function(t,e,i,n,o){var s=Nf()&&("undefined"==typeof MouseEvent||null==i||i.constructor===MouseEvent),r=Rf()&&!Nf()&&Bf[e]?Bf[e]:e,a=!(Rf()&&!Nf()&&Bf[e]),l=qf(i),c=function(t){return Ff(t,"screen")}(i),h=function(t){return Ff(t,"client")}(i);return Wf(t,(function(t){var d;i=i||{screenX:c.x,screenY:c.y,clientX:h.x,clientY:h.y};var u,p={TouchEvent:function(e){var i=Df(t,l.x,l.y,c.x,c.y,h.x,h.y);(e.initTouchEvent||e.initEvent)(r,!0,!0,window,null,c.x,c.y,h.x,h.y,!1,!1,!1,!1,i,i,i,1,0)},MouseEvents:function(e){e.initMouseEvent(r,!0,!0,window,null==o?1:o,c.x,c.y,h.x,h.y,!1,!1,!1,!1,1,t)}},f=!a&&!s&&Rf()&&Bf[e]?"TouchEvent":"MouseEvents";d=document.createEvent(f),p[f](d),u=d,n&&(u.payload=n),t.dispatchEvent(d)})),this}}]),t}(),im=[null,[1,-1],[1,1],[-1,1],[-1,-1]],nm=[null,[-1,-1],[-1,1],[1,1],[1,-1]],om=2*Math.PI;function sm(t,e){return e.x===t.x?e.y>t.y?1/0:-1/0:e.y===t.y?e.x>t.x?0:-0:(e.y-t.y)/(e.x-t.x)}function rm(t,e){return Math.sqrt(Math.pow(e.y-t.y,2)+Math.pow(e.x-t.x,2))}function am(t,e){return e.x>t.x||e.x==t.x?e.y>t.y?2:1:e.y>t.y?3:4}function lm(t,e){var i=t.x,n=t.x+t.w,o=t.y,s=t.y+t.h,r=e.x,a=e.x+e.w,l=e.y,c=e.y+e.h;return i<=r&&r<=n&&o<=l&&l<=s||i<=a&&a<=n&&o<=l&&l<=s||i<=r&&r<=n&&o<=c&&c<=s||i<=a&&r<=n&&o<=c&&c<=s||r<=i&&i<=a&&l<=o&&o<=c||r<=n&&n<=a&&l<=o&&o<=c||r<=i&&i<=a&&l<=s&&s<=c||r<=n&&i<=a&&l<=s&&s<=c}function cm(t,e,i){var n=sm(t,e),o=am(t,e),s=i>0?im[o]:nm[o],r=Math.atan(n),a=Math.abs(i*Math.sin(r))*s[1],l=Math.abs(i*Math.cos(r))*s[0];return{x:t.x+l,y:t.y+a}}function hm(t,e,i){if(fu(e,i,t))return e;for(var n=e.parentNode;null!=n&&n!==t;){if(fu(n,i,t))return n;n=n.parentNode}}function dm(t,e,i){var n=e.parentNode,o=t.getSize(n),s=t.getSize(e),r=i.x,a=r+s.w,l=i.y,c=l+s.h;return a>0&&r<o.w&&c>0&&l<o.h}var um,pm="start",fm="beforeStart",mm="drag",gm="stop",vm="katavorio-draggable",ym=function(){return!0},bm=function(){return!1},xm="katavorio-delegated-draggable",_m="katavorio-drag-no-select",wm="katavorio-ghost-proxy",km="katavorio-clone-drag";!function(t){t.absolutePosition="absolutePosition",t.transform="transform",t.xyAttributes="xyAttributes"}(um||(um={}));var Sm=new Map;Sm.set(um.absolutePosition,(function(t,e){t.style.left="".concat(e.x,"px"),t.style.top="".concat(e.y,"px")})),Sm.set(um.xyAttributes,(function(t,e){t.setAttribute("x","".concat(e.x)),t.setAttribute("y","".concat(e.y))}));var Cm=new Map;Cm.set(um.absolutePosition,(function(t){return{x:t.offsetLeft,y:t.offsetTop}})),Cm.set(um.xyAttributes,(function(t){return{x:parseFloat(t.getAttribute("x")),y:parseFloat(t.getAttribute("y"))}}));var Em=new Map;Em.set(um.absolutePosition,(function(t,e){t.style.width="".concat(e.w,"px"),t.style.height="".concat(e.h,"px")})),Em.set(um.xyAttributes,(function(t,e){t.setAttribute("width","".concat(e.w)),t.setAttribute("height","".concat(e.h))}));var Am=new Map;Am.set(um.absolutePosition,(function(t){return{w:t.offsetWidth,h:t.offsetHeight}})),Am.set(um.xyAttributes,(function(t){return{w:parseFloat(t.getAttribute("width")),h:parseFloat(t.getAttribute("height"))}}));var Mm,Tm=[gm,pm,mm,"drop","over","out",fm],Pm=function(){},Om=function(t,e){if(null!=t){t=Bd(t)||null!=t.tagName||null==t.length?[t]:t;for(var i=0;i<t.length;i++)e.apply(t[i],[t[i]])}},Dm=function(){function t(e,i){wd(this,t),this.el=e,this.manager=i,Cd(this,"_class",void 0),Cd(this,"uuid",su()),Cd(this,"enabled",!0),Cd(this,"scopes",[]),Cd(this,"eventManager",void 0),this.eventManager=i.eventManager}return Sd(t,[{key:"setEnabled",value:function(t){this.enabled=t}},{key:"isEnabled",value:function(){return this.enabled}},{key:"toggleEnabled",value:function(){this.enabled=!this.enabled}},{key:"addScope",value:function(t){var e={};for(var i in Om(this.scopes,(function(t){e[t]=!0})),Om(t?t.split(/\s+/):[],(function(t){e[t]=!0})),this.scopes.length=0,e)this.scopes.push(i)}},{key:"removeScope",value:function(t){var e={};for(var i in Om(this.scopes,(function(t){e[t]=!0})),Om(t?t.split(/\s+/):[],(function(t){delete e[t]})),this.scopes.length=0,e)this.scopes.push(i)}},{key:"toggleScope",value:function(t){var e={};for(var i in Om(this.scopes,(function(t){e[t]=!0})),Om(t?t.split(/\s+/):[],(function(t){e[t]?delete e[t]:e[t]=!0})),this.scopes.length=0,e)this.scopes.push(i)}}]),t}();!function(t){t.notNegative="notNegative",t.parent="parent",t.parentEnclosed="parentEnclosed"}(Mm||(Mm={}));var Im=function(t){Ed(i,t);var e=Pd(i);function i(t,n,o){var s;if(wd(this,i),Cd(Td(s=e.call(this,t,o)),"_class",void 0),Cd(Td(s),"rightButtonCanDrag",void 0),Cd(Td(s),"consumeStartEvent",void 0),Cd(Td(s),"clone",void 0),Cd(Td(s),"scroll",void 0),Cd(Td(s),"trackScroll",void 0),Cd(Td(s),"_downAt",void 0),Cd(Td(s),"_posAtDown",void 0),Cd(Td(s),"_pagePosAtDown",void 0),Cd(Td(s),"_pageDelta",{x:0,y:0}),Cd(Td(s),"_moving",void 0),Cd(Td(s),"_lastPosition",void 0),Cd(Td(s),"_lastScrollValues",{x:0,y:0}),Cd(Td(s),"_initialScroll",{x:0,y:0}),Cd(Td(s),"_size",void 0),Cd(Td(s),"_currentParentPosition",void 0),Cd(Td(s),"_ghostParentPosition",void 0),Cd(Td(s),"_dragEl",void 0),Cd(Td(s),"_multipleDrop",void 0),Cd(Td(s),"_ghostProxyOffsets",void 0),Cd(Td(s),"_ghostDx",void 0),Cd(Td(s),"_ghostDy",void 0),Cd(Td(s),"_isConstrained",!1),Cd(Td(s),"_ghostProxyParent",void 0),Cd(Td(s),"_useGhostProxy",void 0),Cd(Td(s),"_ghostProxyFunction",void 0),Cd(Td(s),"_activeSelectorParams",void 0),Cd(Td(s),"_availableSelectors",[]),Cd(Td(s),"_canDrag",void 0),Cd(Td(s),"_consumeFilteredEvents",void 0),Cd(Td(s),"_parent",void 0),Cd(Td(s),"_ignoreZoom",void 0),Cd(Td(s),"_filters",{}),Cd(Td(s),"_constrainRect",void 0),Cd(Td(s),"_elementToDrag",void 0),Cd(Td(s),"downListener",void 0),Cd(Td(s),"moveListener",void 0),Cd(Td(s),"upListener",void 0),Cd(Td(s),"scrollTracker",void 0),Cd(Td(s),"listeners",{start:[],drag:[],stop:[],over:[],out:[],beforeStart:[],revert:[]}),s._class=s.manager.css.draggable,_u(s.el,s._class),s.downListener=s._downListener.bind(Td(s)),s.upListener=s._upListener.bind(Td(s)),s.moveListener=s._moveListener.bind(Td(s)),s.rightButtonCanDrag=!0===n.rightButtonCanDrag,s.consumeStartEvent=!1!==n.consumeStartEvent,s._dragEl=s.el,s.clone=!0===n.clone,s.scroll=!0===n.scroll,s.trackScroll=!1!==n.trackScroll,s._multipleDrop=!1!==n.multipleDrop,s._canDrag=n.canDrag||ym,s._consumeFilteredEvents=n.consumeFilteredEvents,s._parent=n.parent,s._ignoreZoom=!0===n.ignoreZoom,s._ghostProxyParent=n.ghostProxyParent,s.trackScroll&&(s.scrollTracker=s._trackScroll.bind(Td(s)),document.addEventListener("scroll",s.scrollTracker)),!0===n.ghostProxy?s._useGhostProxy=ym:n.ghostProxy&&"function"==typeof n.ghostProxy?s._useGhostProxy=n.ghostProxy:s._useGhostProxy=function(t,e){return!(!s._activeSelectorParams||!s._activeSelectorParams.useGhostProxy)&&s._activeSelectorParams.useGhostProxy(t,e)},n.makeGhostProxy?s._ghostProxyFunction=n.makeGhostProxy:s._ghostProxyFunction=function(t){return s._activeSelectorParams&&s._activeSelectorParams.makeGhostProxy?s._activeSelectorParams.makeGhostProxy(t):t.cloneNode(!0)},n.selector){var r=s.el.getAttribute(vm);null==r&&(r=""+(new Date).getTime(),s.el.setAttribute("katavorio-draggable",r)),s._availableSelectors.push(n)}return s.eventManager.on(s.el,zp,s.downListener),s}return Sd(i,[{key:"_trackScroll",value:function(t){if(this._moving){var e={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop},i=e.x-this._lastScrollValues.x,n=e.y-this._lastScrollValues.y,o={x:i+this._lastPosition.x,y:n+this._lastPosition.y},s=o.x-this._downAt.x,r=o.y-this._downAt.y,a=this._ignoreZoom?1:this.manager.getZoom();this._dragEl&&this._dragEl.parentNode&&(s+=this._dragEl.parentNode.scrollLeft-this._initialScroll.x,r+=this._dragEl.parentNode.scrollTop-this._initialScroll.y),s/=a,r/=a,this.moveBy(s,r,t),this._lastPosition=o,this._lastScrollValues=e}}},{key:"on",value:function(t,e){this.listeners[t]&&this.listeners[t].push(e)}},{key:"off",value:function(t,e){if(this.listeners[t]){for(var i=[],n=0;n<this.listeners[t].length;n++)this.listeners[t][n]!==e&&i.push(this.listeners[t][n]);this.listeners[t]=i}}},{key:"_upListener",value:function(t){this._downAt&&(this._downAt=null,this.eventManager.off(document,Bp,this.moveListener),this.eventManager.off(document,jp,this.upListener),wu(document.body,_m),this.unmark(t),this.stop(t),this._moving=!1,this.clone?(this._dragEl&&this._dragEl.parentNode&&this._dragEl.parentNode.removeChild(this._dragEl),this._dragEl=null):this._activeSelectorParams&&this._activeSelectorParams.revertFunction&&!0===this._activeSelectorParams.revertFunction(this._dragEl,this.manager.getPosition(this._dragEl))&&(this.manager.setPosition(this._dragEl,this._posAtDown),this._dispatch(Hp,this._dragEl)))}},{key:"_downListener",value:function(t){if(!t.defaultPrevented&&((this.rightButtonCanDrag||3!==t.which&&2!==t.button)&&this.isEnabled()&&this._canDrag())){var e=this._testFilter(t)&&function(t,e,i){return!fu(t.srcElement||t.target,i.getInputFilterSelector(),e)}(t,this.el,this.manager);if(e){this._activeSelectorParams=null,this._elementToDrag=null,0===this._availableSelectors.length&&console.log("JSPLUMB: no available drag selectors");var i=t.target||t.srcElement,n=function(t,e,i){for(var n=null,o=e.getAttribute("katavorio-draggable"),s=null!=o?"[katavorio-draggable='"+o+"'] ":"",r=0;r<t.length;r++)if(null!=(n=hm(e,i,s+t[r].selector))){if(t[r].filter){var a=fu(i,t[r].filter,n);if(!0===t[r].filterExclude&&!a||a)return null}return[t[r],n]}return null}(this._availableSelectors,this.el,i);if(null!=n&&(this._activeSelectorParams=n[0],this._elementToDrag=n[1]),null==this._activeSelectorParams||null==this._elementToDrag)return;var o=this._activeSelectorParams.dragInit?this._activeSelectorParams.dragInit(this._elementToDrag,t):null;if(null!=o&&(this._elementToDrag=o),this.clone)if(this._dragEl=this._elementToDrag.cloneNode(!0),_u(this._dragEl,km),this._dragEl.setAttribute("id",null),this._dragEl.style.position="absolute",null!=this._parent){var s=this.manager.getPosition(this.el);this._dragEl.style.left=s.x+"px",this._dragEl.style.top=s.y+"px",this._parent.appendChild(this._dragEl)}else{var r=Cu(this._elementToDrag);this._dragEl.style.left=r.x+"px",this._dragEl.style.top=r.y+"px",document.body.appendChild(this._dragEl)}else this._dragEl=this._elementToDrag;this.consumeStartEvent&&mu(t),this._downAt=qf(t),this._dragEl&&this._dragEl.parentNode&&(this._initialScroll={x:this._dragEl.parentNode.scrollLeft,y:this._dragEl.parentNode.scrollTop}),this._posAtDown=this.manager.getPosition(this._dragEl),this._pagePosAtDown=Cu(this._dragEl),this._pageDelta={x:this._pagePosAtDown.x-this._posAtDown.x,y:this._pagePosAtDown.y-this._posAtDown.y},this._size=this.manager.getSize(this._dragEl),this.eventManager.on(document,Bp,this.moveListener),this.eventManager.on(document,jp,this.upListener),_u(document.body,_m),this._dispatch(fm,{el:this.el,pos:this._posAtDown,e:t,drag:this,size:this._size})}else this._consumeFilteredEvents&&mu(t)}}},{key:"_moveListener",value:function(t){if(this._downAt){if(!this._moving){var e=this._dispatch(pm,{el:this.el,pos:this._posAtDown,e:t,drag:this,size:this._size});if(!1!==e){if(!this._downAt)return;this.mark(e),this._moving=!0}else this.abort()}if(this._downAt){var i=qf(t),n=i.x-this._downAt.x,o=i.y-this._downAt.y,s=this._ignoreZoom?1:this.manager.getZoom();this._lastPosition={x:i.x,y:i.y},this._lastScrollValues={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop},this._dragEl&&this._dragEl.parentNode&&(n+=this._dragEl.parentNode.scrollLeft-this._initialScroll.x,o+=this._dragEl.parentNode.scrollTop-this._initialScroll.y),n/=s,o/=s,this.moveBy(n,o,t)}}}},{key:"getDragDelta",value:function(){return null!=this._posAtDown&&null!=this._downAt?{x:this._downAt.x-this._posAtDown.x,y:this._downAt.y-this._posAtDown.y}:{x:0,y:0}}},{key:"mark",value:function(t){var e;this._posAtDown=this.manager.getPosition(this._dragEl),this._pagePosAtDown=Cu(this._dragEl),this._pageDelta={x:this._pagePosAtDown.x-this._posAtDown.x,y:this._pagePosAtDown.y-this._posAtDown.y},this._size=this.manager.getSize(this._dragEl),_u(this._dragEl,this.manager.css.drag),this._constrainRect={w:(e=this._dragEl).parentNode.offsetWidth+e.parentNode.scrollLeft,h:e.parentNode.offsetHeight+e.parentNode.scrollTop},this._ghostDx=0,this._ghostDy=0}},{key:"unmark",value:function(t){this._isConstrained&&this._useGhostProxy(this._elementToDrag,this._dragEl)?(this._ghostProxyOffsets={x:this._dragEl.offsetLeft-this._ghostDx,y:this._dragEl.offsetTop-this._ghostDy},this._dragEl.parentNode.removeChild(this._dragEl),this._dragEl=this._elementToDrag):this._ghostProxyOffsets=null,wu(this._dragEl,this.manager.css.drag),this._isConstrained=!1}},{key:"moveBy",value:function(t,e,i){var n=this.toGrid({x:this._posAtDown.x+t,y:this._posAtDown.y+e}),o=this._doConstrain(n,this._dragEl,this._constrainRect,this._size,i);if(null!=o){if(this._useGhostProxy(this.el,this._dragEl))if(n.x!==o.x||n.y!==o.y){if(!this._isConstrained){var s=this._ghostProxyFunction(this._elementToDrag);_u(s,wm),this._ghostProxyParent?(this._ghostProxyParent.appendChild(s),this._currentParentPosition=Cu(this._elementToDrag.parentNode),this._ghostParentPosition=Cu(this._ghostProxyParent),this._ghostDx=this._currentParentPosition.x-this._ghostParentPosition.x,this._ghostDy=this._currentParentPosition.y-this._ghostParentPosition.y):this._elementToDrag.parentNode.appendChild(s),this._dragEl=s,this._isConstrained=!0}o=n}else this._isConstrained&&(this._dragEl.parentNode.removeChild(this._dragEl),this._dragEl=this._elementToDrag,this._isConstrained=!1,this._currentParentPosition=null,this._ghostParentPosition=null,this._ghostDx=0,this._ghostDy=0);this.manager.setPosition(this._dragEl,{x:o.x+this._ghostDx,y:o.y+this._ghostDy}),this._dispatch(mm,{el:this.el,pos:o,e:i,drag:this,size:this._size,originalPos:this._posAtDown})}}},{key:"abort",value:function(){null!=this._downAt&&this._upListener()}},{key:"getDragElement",value:function(t){return t?this._elementToDrag||this.el:this._dragEl||this.el}},{key:"stop",value:function(t,e){if(e||this._moving){var i=[],n=this.manager.getPosition(this._dragEl);i.push([this._dragEl,n,this,this._size]),this._dispatch(gm,{el:this._dragEl,pos:this._ghostProxyOffsets||n,finalPos:n,e:t,drag:this,selection:i,size:this._size,originalPos:{x:this._posAtDown.x,y:this._posAtDown.y}})}else this._moving||this._activeSelectorParams.dragAbort&&this._activeSelectorParams.dragAbort(this._elementToDrag)}},{key:"_dispatch",value:function(t,e){var i=null;if(this._activeSelectorParams&&this._activeSelectorParams[t])i=this._activeSelectorParams[t](e);else if(this.listeners[t])for(var n=0;n<this.listeners[t].length;n++)try{var o=this.listeners[t][n](e);null!=o&&(i=o)}catch(t){}return i}},{key:"resolveGrid",value:function(){var t={grid:null,thresholdX:5,thresholdY:5};return null!=this._activeSelectorParams&&null!=this._activeSelectorParams.grid&&(t.grid=this._activeSelectorParams.grid,null!=this._activeSelectorParams.snapThreshold&&(t.thresholdX=this._activeSelectorParams.snapThreshold,t.thresholdY=this._activeSelectorParams.snapThreshold)),t}},{key:"toGrid",value:function(t){var e=this.resolveGrid(),i=e.grid,n=e.thresholdX,o=e.thresholdY;return null==i?t:function(t,e,i,n){i=null==i?null==e.thresholdX?e.w/2:e.thresholdX:i,n=null==n?null==e.thresholdY?e.h/2:e.thresholdY:n;var o=Math.floor(t.x/e.w),s=e.w*o,r=s+e.w,a=Math.abs(t.x-s)<=i?s:Math.abs(r-t.x)<=i?r:t.x,l=Math.floor(t.y/e.h),c=e.h*l,h=c+e.h;return{x:a,y:Math.abs(t.y-c)<=n?c:Math.abs(h-t.y)<=n?h:t.y}}(t,i,i?i.w/2:n,i?i.h/2:o)}},{key:"setUseGhostProxy",value:function(t){this._useGhostProxy=t?ym:bm}},{key:"_doConstrain",value:function(t,e,i,n,o){return null!=this._activeSelectorParams&&this._activeSelectorParams.constrainFunction&&"function"==typeof this._activeSelectorParams.constrainFunction?this._activeSelectorParams.constrainFunction(t,e,i,n,o):t}},{key:"_testFilter",value:function(t){for(var e in this._filters){var i=this._filters[e],n=i[0](t);if(i[1]&&(n=!n),!n)return!1}return!0}},{key:"addFilter",value:function(t,e){var i,n=this;if(t){var o="function"==typeof(i=t)?(i._katavorioId=su(),i._katavorioId):i;this._filters[o]=[function(e){var i,o=e.srcElement||e.target;return Bd(t)?i=fu(o,t,n.el):"function"==typeof t&&(i=t(e,n.el)),i},!1!==e]}}},{key:"removeFilter",value:function(t){var e="function"==typeof t?t._katavorioId:t;delete this._filters[e]}},{key:"clearAllFilters",value:function(){this._filters={}}},{key:"addSelector",value:function(t,e){t.selector&&(e?this._availableSelectors.unshift(t):this._availableSelectors.push(t))}},{key:"destroy",value:function(){this.eventManager.off(this.el,zp,this.downListener),this.eventManager.off(document,Bp,this.moveListener),this.eventManager.off(document,jp,this.upListener),this.downListener=null,this.upListener=null,this.moveListener=null,null!=this.scrollTracker&&document.removeEventListener("scroll",this.scrollTracker)}}]),i}(Dm),Lm=["input","textarea","select","button","option"].join(","),$m=function(){function t(e){wd(this,t),Cd(this,"eventManager",void 0),Cd(this,"zoom",1),Cd(this,"css",{}),Cd(this,"inputFilterSelector",void 0),Cd(this,"positioningStrategy",void 0),Cd(this,"_positionSetter",void 0),Cd(this,"_positionGetter",void 0),Cd(this,"_sizeSetter",void 0),Cd(this,"_sizeGetter",void 0),e=e||{},this.inputFilterSelector=e.inputFilterSelector||Lm,this.eventManager=new em,this.zoom=e.zoom||1,this.positioningStrategy=e.positioningStrategy||um.absolutePosition,this._positionGetter=Cm.get(this.positioningStrategy),this._positionSetter=Sm.get(this.positioningStrategy),this._sizeGetter=Am.get(this.positioningStrategy),this._sizeSetter=Em.get(this.positioningStrategy);var i=e.css||{};Rd(this.css,i)}return Sd(t,[{key:"getPosition",value:function(t){return this._positionGetter(t)}},{key:"setPosition",value:function(t,e){this._positionSetter(t,e)}},{key:"getSize",value:function(t){return this._sizeGetter(t)}},{key:"getZoom",value:function(){return this.zoom}},{key:"setZoom",value:function(t){this.zoom=t}},{key:"_prepareParams",value:function(t){t=t||{};var e,i={events:{}};for(e in t)i[e]=t[e];for(e=0;e<Tm.length;e++)i.events[Tm[e]]=t[Tm[e]]||Pm;return i}},{key:"getInputFilterSelector",value:function(){return this.inputFilterSelector}},{key:"setInputFilterSelector",value:function(t){return this.inputFilterSelector=t,this}},{key:"draggable",value:function(t,e){if(null==t._katavorioDrag){var i=this._prepareParams(e),n=new Im(t,i,this);return _u(t,xm),t._katavorioDrag=n,n}return t._katavorioDrag}},{key:"destroyDraggable",value:function(t){t._katavorioDrag&&(t._katavorioDrag.destroy(),delete t._katavorioDrag)}}]),t}(),zm="jtk-drag-selected",Rm=function(){function t(e){wd(this,t),this.instance=e,Cd(this,"_dragSelection",[]),Cd(this,"_dragSizes",new Map),Cd(this,"_dragElements",new Map),Cd(this,"_dragElementStartPositions",new Map),Cd(this,"_dragElementPositions",new Map),Cd(this,"__activeSet",void 0)}return Sd(t,[{key:"_activeSet",get:function(){return null==this.__activeSet?this._dragSelection:this.__activeSet}},{key:"length",get:function(){return this._dragSelection.length}},{key:"filterActiveSet",value:function(t){var e=this;this.__activeSet=[],Gd(this._dragSelection,(function(i){t(i)&&e.__activeSet.push(i)}))}},{key:"clear",value:function(){var t=this;this.reset(),Gd(this._dragSelection,(function(e){return t.instance.removeClass(e.jel,zm)})),this._dragSelection.length=0}},{key:"reset",value:function(){this._dragElementStartPositions.clear(),this._dragElementPositions.clear(),this._dragSizes.clear(),this._dragElements.clear(),this.__activeSet=null}},{key:"initialisePositions",value:function(){var t=this;Gd(this._activeSet,(function(e){var i=t.instance.viewport.getPosition(e.id),n={x:parseInt(""+e.jel.offsetLeft,10),y:parseInt(""+e.jel.offsetTop,10)};t._dragElementStartPositions.set(e.id,n),t._dragElementPositions.set(e.id,n),t._dragSizes.set(e.id,{w:i.w,h:i.h})}))}},{key:"updatePositions",value:function(t,e,i){var n=this,o=t.x-e.x,s=t.y-e.y;Gd(this._activeSet,(function(t){var e=n._dragElementStartPositions.get(t.id);if(e){var r=e.x+o,a=e.y+s,l=n._dragSizes.get(t.id),c={x:r,y:a,w:l.w,h:l.h};if(t.jel._jsPlumbParentGroup&&t.jel._jsPlumbParentGroup.constrain){var h={w:t.jel.parentNode.offsetWidth+t.jel.parentNode.scrollLeft,h:t.jel.parentNode.offsetHeight+t.jel.parentNode.scrollTop};c.x=Math.max(c.x,0),c.y=Math.max(c.y,0),c.x=Math.min(c.x,h.w-l.w),c.y=Math.min(c.y,h.h-l.h)}n._dragElementPositions.set(t.id,{x:r,y:a}),t.jel.style.left=c.x+"px",t.jel.style.top=c.y+"px",i(t.jel,t.id,l,c)}}))}},{key:"each",value:function(t){var e=this;Gd(this._activeSet,(function(i){var n=e._dragSizes.get(i.id),o=e._dragElementPositions.get(i.id),s=e._dragElementStartPositions.get(i.id);t(i.jel,i.id,o,n,s)}))}},{key:"add",value:function(t,e){var i=t;e=e||this.instance.getId(i);var n=Zd(this._dragSelection,(function(t){return t.id===e}));-1===n&&(this.instance.addClass(t,zm),this._dragSelection.push({id:e,jel:i}))}},{key:"remove",value:function(t){var e=this,i=t;this._dragSelection=this._dragSelection.filter((function(t){var n=t.jel!==i;return n||e.instance.removeClass(t.jel,zm),n}))}},{key:"toggle",value:function(t){var e=t,i=Zd(this._dragSelection,(function(t){return t.jel===e}));-1!==i?this.remove(e):this.add(t)}}]),t}(),Nm="jtk-drag-active",Bm="jtk-drag-hover",jm=function(){function t(e,i,n){var o=this;wd(this,t),this.instance=e,this.dragSelection=i,Cd(this,"collicat",void 0),Cd(this,"drag",void 0),Cd(this,"_draggables",{}),Cd(this,"_dlist",[]),Cd(this,"_elementsWithEndpoints",{}),Cd(this,"_draggablesForElements",{}),Cd(this,"handlers",[]),Cd(this,"_trackScroll",void 0),Cd(this,"_filtersToAdd",[]),this.collicat=new $m({zoom:this.instance.currentZoom,css:{noSelect:this.instance.dragSelectClass,delegatedDraggable:"jtk-delegated-draggable",draggable:"jtk-draggable",drag:"jtk-drag",selected:zm,active:Nm,hover:Bm,ghostProxy:"jtk-ghost-proxy"}}),this.instance.bind(np,(function(t){o.collicat.setZoom(t)})),n=n||{},this._trackScroll=!1!==n.trackScroll}return Sd(t,[{key:"addHandler",value:function(t,e){var i=this,n=Rd({selector:t.selector},e||{});n.start=du(n.start,(function(e){return t.onStart(e)}),!1),n.drag=du(n.drag,(function(e){return t.onDrag(e)})),n.stop=du(n.stop,(function(e){return t.onStop(e)}));var o=(t.onBeforeStart||function(t){}).bind(t);if(n.beforeStart=du(n.beforeStart,(function(t){return o(t)})),n.dragInit=function(e,i){return t.onDragInit(e,i)},n.dragAbort=function(e){return t.onDragAbort(e)},t.useGhostProxy&&(n.useGhostProxy=t.useGhostProxy,n.makeGhostProxy=t.makeGhostProxy),null==n.constrainFunction&&null!=n.containment)switch(n.containment){case Mm.notNegative:n.constrainFunction=function(t,e,i,n){return{x:Math.max(0,Math.min(t.x)),y:Math.max(0,Math.min(t.y))}};break;case Mm.parent:var s=n.containmentPadding||5;n.constrainFunction=function(t,e,i,n){return{x:t.x<0?0:t.x>i.w-s?i.w-s:t.x,y:t.y<0?0:t.y>i.h-s?i.h-s:t.y}};break;case Mm.parentEnclosed:n.constrainFunction=function(t,e,i,n){return{x:t.x<0?0:t.x+n.w>i.w?i.w-n.w:t.x,y:t.y<0?0:t.y+n.h>i.h?i.h-n.h:t.y}}}null==this.drag?(n.trackScroll=this._trackScroll,this.drag=this.collicat.draggable(this.instance.getContainer(),n),Gd(this._filtersToAdd,(function(t){return i.drag.addFilter(t[0],t[1])})),this.drag.on(Hp,(function(t){i.instance.revalidate(t)}))):this.drag.addSelector(n),this.handlers.push({handler:t,options:n}),t.init(this.drag)}},{key:"addSelector",value:function(t,e){this.drag&&this.drag.addSelector(t,e)}},{key:"addFilter",value:function(t,e){null==this.drag?this._filtersToAdd.push([t,!0===e]):this.drag.addFilter(t,e)}},{key:"removeFilter",value:function(t){null!=this.drag&&this.drag.removeFilter(t)}},{key:"setFilters",value:function(t){var e=this;Gd(t,(function(t){e.drag.addFilter(t[0],t[1])}))}},{key:"reset",value:function(){var t=[];if(Gd(this.handlers,(function(t){t.handler.reset()})),this.handlers.length=0,null!=this.drag){var e=this.drag._filters;for(var i in e)t.push([i,e[i][1]]);this.collicat.destroyDraggable(this.instance.getContainer())}return delete this.drag,t}},{key:"setOption",value:function(t,e){var i=Yd(this.handlers,(function(e){return e.handler===t}));null!=i&&Rd(i.options,e||{})}}]),t}();var Fm,qm,Vm,Hm,Um=function(){function t(e,i){wd(this,t),this.instance=e,this._dragSelection=i,Cd(this,"selector","> "+ap+":not("+Tu(Zu)+")"),Cd(this,"_dragOffset",null),Cd(this,"_groupLocations",[]),Cd(this,"_intersectingGroups",[]),Cd(this,"_currentDragParentGroup",null),Cd(this,"_dragGroupByElementIdMap",{}),Cd(this,"_dragGroupMap",{}),Cd(this,"_currentDragGroup",null),Cd(this,"_currentDragGroupOffsets",new Map),Cd(this,"_currentDragGroupSizes",new Map),Cd(this,"_currentDragGroupOriginalPositions",new Map),Cd(this,"_dragPayload",null),Cd(this,"drag",void 0),Cd(this,"originalPosition",void 0)}return Sd(t,[{key:"onDragInit",value:function(t){return null}},{key:"onDragAbort",value:function(t){return null}},{key:"getDropGroup",value:function(){var t=null;if(this._intersectingGroups.length>0){var e=this._intersectingGroups[0].groupLoc.group,i=this._intersectingGroups[0].intersectingElement,n=i._jsPlumbParentGroup;n!==e&&(null!=n&&n.overrideDrop(i,e)||(t=this._intersectingGroups[0]))}return t}},{key:"onStop",value:function(t){var e,i=this,n=t.drag.getDragElement(),o=this.getDropGroup(),s=[];function r(t,e,i,n,r){var a=i.x,l=i.y;if(t._jsPlumbParentGroup&&t._jsPlumbParentGroup.constrain){var c={w:t.parentNode.offsetWidth+t.parentNode.scrollLeft,h:t.parentNode.offsetHeight+t.parentNode.scrollTop};a=Math.max(a,0),l=Math.max(l,0),a=Math.min(a,c.w-n.w),l=Math.min(l,c.h-n.h),i.x=a,i.y=l}s.push({el:t,id:e,pos:i,originalPos:r,originalGroup:t._jsPlumbParentGroup,redrawResult:null,reverted:!1,dropGroup:null==o?void 0:o.groupLoc.group})}if(s.push({el:n,id:this.instance.getId(n),pos:t.finalPos,originalGroup:n._jsPlumbParentGroup,redrawResult:null,originalPos:t.originalPos,reverted:!1,dropGroup:null!=o?o.groupLoc.group:null}),this._dragSelection.each((function(e,i,n,o,s){e!==t.el&&r(e,i,{x:n.x,y:n.y},o,s)})),null===(e=this._currentDragGroup)||void 0===e||e.members.forEach((function(e){if(e.el!==t.el){var n=i._currentDragGroupOffsets.get(e.elId),o=i._currentDragGroupSizes.get(e.elId),s={x:t.finalPos.x+n[0].x,y:t.finalPos.y+n[0].y};r(e.el,e.elId,s,o,i._currentDragGroupOriginalPositions.get(e.elId))}})),Gd(s,(function(t){var e=null!=t.originalGroup,n=e&&dm(i.instance,t.el,t.pos),s={x:0,y:0};if(e&&!n){if(null==o){var r=i._pruneOrOrphan(t,!0,!0);null!=r.pos?t.pos=r.pos.pos:!r.pruned&&t.originalGroup.revert&&(t.pos=t.originalPos,t.reverted=!0)}}else e&&n&&(s=i._computeOffsetByParentGroup(t.originalGroup));null==o||n?t.dropGroup=null:i.instance.groupManager.addToGroup(o.groupLoc.group,!1,t.el),t.reverted&&i.instance.setPosition(t.el,t.pos),t.redrawResult=i.instance.setElementPosition(t.el,t.pos.x+s.x,t.pos.y+s.y),i.instance.removeClass(t.el,"jtk-dragged"),i.instance.select({source:t.el}).removeClass(i.instance.elementDraggingClass+" "+i.instance.sourceElementDraggingClass,!0),i.instance.select({target:t.el}).removeClass(i.instance.elementDraggingClass+" "+i.instance.targetElementDraggingClass,!0)})),null!=s[0].originalGroup){var a=n._jsPlumbParentGroup;if(a!==s[0].originalGroup){var l=t.drag.getDragElement(!0);if(s[0].originalGroup.ghost){var c=this.instance.getPosition(this.instance.getGroupContentArea(a)),h=this.instance.getPosition(this.instance.getGroupContentArea(s[0].originalGroup)),d={x:h.x+t.pos.x-c.x,y:h.y+t.pos.y-c.y};l.style.left=d.x+"px",l.style.top=d.y+"px",this.instance.revalidate(l)}}}this.instance.fire("drag:stop",{elements:s,e:t.e,el:n,payload:this._dragPayload}),this._cleanup()}},{key:"_cleanup",value:function(){var t=this;Gd(this._groupLocations,(function(e){t.instance.removeClass(e.el,Nm),t.instance.removeClass(e.el,Bm)})),this._currentDragParentGroup=null,this._groupLocations.length=0,this.instance.hoverSuspended=!1,this._dragOffset=null,this._dragSelection.reset(),this._dragPayload=null,this._currentDragGroupOffsets.clear(),this._currentDragGroupSizes.clear(),this._currentDragGroupOriginalPositions.clear(),this._currentDragGroup=null}},{key:"reset",value:function(){}},{key:"init",value:function(t){this.drag=t}},{key:"onDrag",value:function(t){var e=this,i=t.drag.getDragElement(),n=this.instance.getId(i),o=t.pos,s=this.instance.viewport.getPosition(n),r={x:o.x,y:o.y};this._intersectingGroups.length=0,null!=this._dragOffset&&(r.x+=this._dragOffset.x,r.y+=this._dragOffset.y);var a=function(i,n,o){if(o){var s=new Set;Gd(e._groupLocations,(function(i){!s.has(i.group.id)&&lm(n,i.r)?(i.group!==e._currentDragParentGroup&&e.instance.addClass(i.el,Bm),e._intersectingGroups.push({groupLoc:i,intersectingElement:t.drag.getDragElement(!0),d:0}),Gd(e.instance.groupManager.getAncestors(i.group),(function(t){return s.add(t.id)}))):e.instance.removeClass(i.el,Bm)}))}e.instance.setElementPosition(i,n.x,n.y),e.instance.fire("drag:move",{el:i,e:t.e,pos:{x:n.x,y:n.y},originalPosition:e.originalPosition,payload:e._dragPayload})},l={x:r.x,y:r.y,w:s.w,h:s.h};a(i,l,!0),this._dragSelection.updatePositions(o,this.originalPosition,(function(t,e,i,n){a(t,n,!1)})),this._currentDragGroupOffsets.forEach((function(t,i){var n=e._currentDragGroupSizes.get(i),o={x:l.x+t[0].x,y:l.y+t[0].y,w:n.w,h:n.h};t[1].style.left=o.x+"px",t[1].style.top=o.y+"px",a(t[1],o,!1)}))}},{key:"_computeOffsetByParentGroup",value:function(t){var e=this.instance.getPosition(t.el),i=t.contentArea;if(i!==t.el){var n=this.instance.getPosition(i);e.x+=n.x,e.y+=n.y}if(t.el._jsPlumbParentGroup){var o=this._computeOffsetByParentGroup(t.el._jsPlumbParentGroup);e.x+=o.x,e.y+=o.y}return e}},{key:"onStart",value:function(t){var e=this,i=t.drag.getDragElement(),n=this.instance.getPosition(i);this.originalPosition={x:t.pos.x,y:t.pos.y},i._jsPlumbParentGroup&&(this._dragOffset=this._computeOffsetByParentGroup(i._jsPlumbParentGroup),this._currentDragParentGroup=i._jsPlumbParentGroup);var o=!0,s=i.getAttribute(Bu);if((!1===this.instance.elementsDraggable||null!=s&&s!==Pf)&&(o=!1),o){this._groupLocations.length=0,this._intersectingGroups.length=0,this.instance.hoverSuspended=!0;var r=t.drag.getDragElement(!0),a=r.querySelectorAll(ap),l=function(t){for(var e=[],i=t._jsPlumbParentGroup;null!=i;)e.push(i.el),i=i.group;return e}(r),c=[];Array.prototype.push.apply(c,a),Array.prototype.push.apply(c,l),this._dragSelection.filterActiveSet((function(t){return-1===c.indexOf(t.jel)})),this._dragSelection.initialisePositions();var h=function(i,n,o){if(!i._isJsPlumbGroup||e.instance.allowNestedGroups){var s=!i._jsPlumbParentGroup,r=s||!0!==i._jsPlumbParentGroup.dropOverride,a=!s&&(i._jsPlumbParentGroup.ghost||!0!==i._jsPlumbParentGroup.constrain);(s||r&&a)&&(Gd(e.instance.groupManager.getGroups(),(function(t){var n=i._jsPlumbGroup;if(!1!==t.droppable&&!1!==t.enabled&&i._jsPlumbGroup!==t&&!e.instance.groupManager.isDescendant(t,n)){var o=t.el,s=e.instance.getId(o),r=e.instance.viewport.getPosition(s),a={el:o,r:{x:r.x,y:r.y,w:r.w,h:r.h},group:t};e._groupLocations.push(a),t!==e._currentDragParentGroup&&e.instance.addClass(o,Nm)}})),e._groupLocations.sort((function(t,i){return e.instance.groupManager.isDescendant(t.group,i.group)?-1:e.instance.groupManager.isAncestor(i.group,t.group)?1:0})))}return e.instance.select({source:i}).addClass(e.instance.elementDraggingClass+" "+e.instance.sourceElementDraggingClass,!0),e.instance.select({target:i}).addClass(e.instance.elementDraggingClass+" "+e.instance.targetElementDraggingClass,!0),e.instance.fire("drag:start",{el:i,e:t.e,originalPosition:e.originalPosition,pos:e.originalPosition,dragGroup:n,dragGroupMemberSpec:o})},d=this.instance.getId(i);this._currentDragGroup=this._dragGroupByElementIdMap[d],this._currentDragGroup&&!function(t,e){var i=Xd(t.members,(function(t){return t.el===e}));return null!==i&&!0===i.active}(this._currentDragGroup,i)&&(this._currentDragGroup=null);var u=h(i);if(!1===u)return this._cleanup(),!1;this._dragPayload=u,null!=this._currentDragGroup&&(this._currentDragGroupOffsets.clear(),this._currentDragGroupSizes.clear(),this._currentDragGroup.members.forEach((function(t){var i=e.instance.viewport.getPosition(t.elId);e._currentDragGroupOffsets.set(t.elId,[{x:i.x-n.x,y:i.y-n.y},t.el]),e._currentDragGroupSizes.set(t.elId,i),e._currentDragGroupOriginalPositions.set(t.elId,{x:i.x,y:i.y}),h(t.el,e._currentDragGroup,t)})))}return o}},{key:"addToDragGroup",value:function(t){var e=this,i=function(t,e){return Bd(e)?{id:e,active:!0}:{id:e.id,active:e.active}}(this.instance,t),n=this._dragGroupMap[i.id];null==n&&(n={id:i.id,members:new Set},this._dragGroupMap[i.id]=n);for(var o=arguments.length,s=new Array(o>1?o-1:0),r=1;r<o;r++)s[r-1]=arguments[r];this.removeFromDragGroup.apply(this,s),Gd(s,(function(t){var o=e.instance.getId(t);n.members.add({elId:o,el:t,active:i.active}),e._dragGroupByElementIdMap[o]=n}))}},{key:"removeFromDragGroup",value:function(){for(var t=this,e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];Gd(i,(function(e){var i=t.instance.getId(e),n=t._dragGroupByElementIdMap[i];if(null!=n){var o=new Set;n.members.forEach((function(t){t.el!==e&&o.add(t)})),n.members=o,delete t._dragGroupByElementIdMap[i]}}))}},{key:"setDragGroupState",value:function(t){for(var e=this,i=arguments.length,n=new Array(i>1?i-1:0),o=1;o<i;o++)n[o-1]=arguments[o];Gd(n.map((function(t){return e.instance.getId(t)})),(function(i){var n=e._dragGroupByElementIdMap[i];if(null!=n){var o=Xd(n.members,(function(t){return t.elId===i}));null!=o&&(o.active=t)}}))}},{key:"clearDragGroup",value:function(t){var e=this,i=this._dragGroupMap[t];null!=i&&(i.members.forEach((function(t){delete e._dragGroupByElementIdMap[t.elId]})),i.members.clear())}},{key:"_pruneOrOrphan",value:function(t,e,i){var n=t.el,o={pruned:!1,pos:null};if(i||!dm(this.instance,n,t.pos)){var s=n._jsPlumbParentGroup;s.prune?(n._isJsPlumbGroup?this.instance.removeGroup(n._jsPlumbGroup):s.remove(t.el,!0),o.pruned=!0):s.orphan&&(o.pos=this.instance.groupManager.orphan(t.el,e),n._isJsPlumbGroup?s.removeGroup(n._jsPlumbGroup):s.remove(t.el))}return o}}]),t}(),Wm={},Gm={},Zm={},Ym={get:function(t,e,i){var n=Wm[e];if(n)return new n(t,i);throw{message:"jsPlumb: unknown endpoint type '"+e+"'"}},clone:function(t){var e=Zm[t.type];return Ym.get(t.endpoint,t.type,e.getParams(t))},compute:function(t,e,i,n){var o=Gm[t.type];if(null!=o)return o(t,e,i,n);cu("jsPlumb: cannot find endpoint calculator for endpoint of type ",t.type)},registerHandler:function(t){Zm[t.type]=t,Wm[t.type]=t.cls,Gm[t.type]=t.compute}},Xm=function(){function t(e,i){wd(this,t),this.endpoint=e,Cd(this,"typeId",void 0),Cd(this,"x",void 0),Cd(this,"y",void 0),Cd(this,"w",void 0),Cd(this,"h",void 0),Cd(this,"computedValue",void 0),Cd(this,"bounds",{xmin:1/0,xmax:-1/0,ymin:1/0,ymax:-1/0}),Cd(this,"classes",[]),Cd(this,"instance",void 0),Cd(this,"type",void 0),i=i||{},this.instance=e.instance,e.cssClass&&this.classes.push(e.cssClass),i.cssClass&&this.classes.push(i.cssClass)}return Sd(t,[{key:"addClass",value:function(t){this.classes.push(t),this.instance.addEndpointClass(this.endpoint,t)}},{key:"removeClass",value:function(t){this.classes=this.classes.filter((function(e){return e!==t})),this.instance.removeEndpointClass(this.endpoint,t)}},{key:"compute",value:function(t,e,i){this.computedValue=Ym.compute(this,t,e,i),this.bounds.xmin=this.x,this.bounds.ymin=this.y,this.bounds.xmax=this.x+this.w,this.bounds.ymax=this.y+this.h}},{key:"setVisible",value:function(t){this.instance.setEndpointVisible(this.endpoint,t)}}]),t}();!function(t){t.top="top",t.left="left",t.right="right",t.bottom="bottom"}(Hm||(Hm={}));var Km=Hm.top,Qm=Hm.left,Jm=Hm.right,tg=Hm.bottom,eg=[Qm,Jm],ig=[Km,tg],ng=function(){function t(e,i,n){wd(this,t),this.instance=e,this.element=i,Cd(this,"isFloating",!0),Cd(this,"isContinuous",void 0),Cd(this,"isDynamic",void 0),Cd(this,"locations",[]),Cd(this,"currentLocation",0),Cd(this,"locked",!1),Cd(this,"cssClass",""),Cd(this,"timestamp",null),Cd(this,"type","Floating"),Cd(this,"id",su()),Cd(this,"orientation",[0,0]),Cd(this,"size",void 0),this.size=e.viewport.getPosition(n),this.locations.push({x:.5,y:.5,ox:this.orientation[0],oy:this.orientation[1],offx:0,offy:0,iox:this.orientation[0],ioy:this.orientation[1],cls:""})}return Sd(t,[{key:"_updateOrientationInRouter",value:function(){this.instance.router.setAnchorOrientation(this,[this.locations[0].ox,this.locations[0].oy])}},{key:"over",value:function(t){this.orientation=this.instance.router.getEndpointOrientation(t),this.locations[0].ox=this.orientation[0],this.locations[0].oy=this.orientation[1],this._updateOrientationInRouter()}},{key:"out",value:function(){this.orientation=null,this.locations[0].ox=this.locations[0].iox,this.locations[0].oy=this.locations[0].ioy,this._updateOrientationInRouter()}}]),t}(),og=(Cd(Fm={},Km,tg),Cd(Fm,Jm,Qm),Cd(Fm,Qm,Jm),Cd(Fm,tg,Km),Fm),sg=(Cd(qm={},Km,Jm),Cd(qm,Jm,tg),Cd(qm,Qm,Km),Cd(qm,tg,Qm),qm),rg=(Cd(Vm={},Km,Qm),Cd(Vm,Jm,Km),Cd(Vm,Qm,tg),Cd(Vm,tg,Jm),Vm);function ag(t){return 0===t.faces.length?Km:t.faces[0]}function lg(t,e){return-1!==t.faces.indexOf(e)}function cg(t,e){return null==t.lockedAxis?null==t.lockedFace?!0===lg(t,e):t.lockedFace===e:-1!==t.lockedAxis.indexOf(e)}function hg(t,e){if(lg(t,e))return e;if(lg(t,og[e]))return og[e];var i=function(t,e){return(t.clockwise?sg:rg)[e]}(t,e);if(lg(t,i))return i;var n=function(t,e){return(t.clockwise?rg:sg)[e]}(t,e);return lg(t,n)?n:e}var dg={x:.5,y:0,ox:0,oy:-1,offx:0,offy:0},ug={x:.5,y:1,ox:0,oy:1,offx:0,offy:0},pg={x:0,y:.5,ox:-1,oy:0,offx:0,offy:0},fg={x:1,y:.5,ox:1,oy:0,offx:0,offy:0},mg={Top:[dg],Bottom:[ug],Left:[pg],Right:[fg],TopLeft:[{x:0,y:0,ox:0,oy:-1,offx:0,offy:0}],TopRight:[{x:1,y:0,ox:1,oy:-1,offx:0,offy:0}],BottomLeft:[{x:0,y:1,ox:0,oy:1,offx:0,offy:0}],BottomRight:[{x:1,y:1,ox:0,oy:1,offx:0,offy:0}],Center:[{x:.5,y:.5,ox:0,oy:0,offx:0,offy:0}],AutoDefault:[dg,pg,ug,fg]},gg={Continuous:{faces:[Km,Qm,tg,Jm]},ContinuousTop:{faces:[Km]},ContinuousRight:{faces:[Jm]},ContinuousBottom:{faces:[tg]},ContinuousLeft:{faces:[Qm]},ContinuousLeftRight:{faces:[Qm,Jm]},ContinuousTopBottom:{faces:[Km,tg]}};function vg(t,e){if(e=e||{},t===Cp.Perimeter)return function(t){t=t||{};var e=t.anchorCount||60,i=t.shape;if(!i)throw new Error("no shape supplied to Perimeter Anchor type");if(!Cg.has(i))throw new Error("Shape ["+i+"] is unknown by Perimeter Anchor type");var n=Cg.get(i)(e);t.rotation&&(n=function(t,e){for(var i=[],n=e/180*Math.PI,o=0;o<t.length;o++){var s=t[o].x-.5,r=t[o].y-.5;i.push({x:s*Math.cos(n)-r*Math.sin(n)+.5,y:s*Math.sin(n)+r*Math.cos(n)+.5,ox:t[o].ox,oy:t[o].oy,offx:0,offy:0,iox:0,ioy:0,cls:""})}return i}(n,t.rotation));var o=yg(Cp.Perimeter,n,t),s=Rd(o,{shape:i});return s}(e);var i=mg[t];if(null!=i)return yg(t,lu(i,(function(t){return Rd({iox:t.ox,ioy:t.oy},t)})),e);if(null!=(i=gg[t]))return function(t,e,i){var n={type:t,locations:[],currentLocation:0,locked:!1,id:su(),cssClass:i.cssClass||"",isFloating:!1,isContinuous:!0,timestamp:null,faces:i.faces||e,lockedFace:null,lockedAxis:null,clockwise:!(!1===i.clockwise),__currentFace:null};return Object.defineProperty(n,bg,{get:function(){return this.__currentFace},set:function(t){this.__currentFace=hg(this,t)}}),n}(t,i.faces,e);throw{message:"jsPlumb: unknown anchor type '"+t+"'"}}function yg(t,e,i){return{type:t,locations:e,currentLocation:0,locked:!1,id:su(),isFloating:!1,isContinuous:!1,isDynamic:e.length>1,timestamp:null,cssClass:i.cssClass||""}}var bg="currentFace";function xg(t){return t.length<7&&t.every(Nd)||7===t.length&&t.slice(0,5).every(Nd)&&Bd(t[6])}function _g(t){if(Bd(t))return vg(t,null);if(Array.isArray(t)){if(xg(t)){var e=t;return yg(null,[{x:e[0],y:e[1],ox:e[2],oy:e[3],offx:null==e[4]?0:e[4],offy:null==e[5]?0:e[5],iox:e[2],ioy:e[3],cls:e[6]||""}],{cssClass:e[6]||""})}var i=lu(t,(function(t){if(Bd(t)){var e=mg[t];return null!=e?Rd({iox:e[0].ox,ioy:e[0].oy,cls:""},e[0]):null}if(xg(t))return{x:t[0],y:t[1],ox:t[2],oy:t[3],offx:null==t[4]?0:t[4],offy:null==t[5]?0:t[5],iox:t[2],ioy:t[3],cls:t[6]||""}})).filter((function(t){return null!=t}));return yg("Dynamic",i,{})}var n=t;return vg(n.type,n.options)}function wg(t){for(var e=.5,i=2*Math.PI/t,n=[],o=0,s=0;s<t;s++){var r=e+e*Math.sin(o),a=e+e*Math.cos(o);n.push({x:r,y:a,ox:0,oy:0,offx:0,offy:0,iox:0,ioy:0,cls:""}),o+=i}return n}function kg(t,e){for(var i=[],n=0;n<t.length;n++)i.push([t[n][0],t[n][1],t[n][2],t[n][3],1/t.length,t[n][4],t[n][5]]);return function(t,e){for(var i=e/t.length,n=[],o=function(t,o,s,r,a,l,c){for(var h=(s-t)/(i=e*a),d=(r-o)/i,u=0;u<i;u++)n.push({x:t+h*u,y:o+d*u,ox:null==l?0:l,oy:null==c?0:c,offx:0,offy:0,iox:0,ioy:0,cls:""})},s=0;s<t.length;s++)o.apply(null,t[s]);return n}(i,e)}function Sg(t){return kg([[0,0,1,0,0,-1],[1,0,1,1,1,0],[1,1,0,1,0,1],[0,1,0,0,-1,0]],t)}var Cg=new Map;Cg.set(Sp.Circle,wg),Cg.set(Sp.Ellipse,wg),Cg.set(Sp.Rectangle,Sg),Cg.set(Sp.Square,Sg),Cg.set(Sp.Diamond,(function(t){return kg([[.5,0,1,.5],[1,.5,.5,1],[.5,1,0,.5],[0,.5,.5,0]],t)})),Cg.set(Sp.Triangle,(function(t){return kg([[.5,0,1,1],[1,1,0,1],[0,1,.5,0]],t)}));var Eg=function(){function t(e,i){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];wd(this,t),this.selector=e,this.def=i,this.exclude=n,Cd(this,"id",void 0),Cd(this,"redrop",void 0),this.id=su(),this.redrop=i.def.redrop||Ag}return Sd(t,[{key:"setEnabled",value:function(t){this.def.enabled=t}},{key:"isEnabled",value:function(){return!1!==this.def.enabled}}]),t}(),Ag="strict";function Mg(t,e,i,n,o,s){var r=function(t,e,i){return new ng(t,e,i)}(s,n,o),a={paintStyle:t.getPaintStyle(),preparedAnchor:r,element:n,scope:t.scope,cssClass:[Uu,t.cssClass].join(" ")};null!=e&&(pu(e,Xm)?a.existingEndpoint=e:a.endpoint=e);var l=s._internal_newEndpoint(a);return s._paintEndpoint(l,{}),l}function Tg(t,e,i,n,o){for(var s=t.target||t.srcElement,r=!1,a=n.getSelector(e,i),l=0;l<a.length;l++)if(a[l]===s){r=!0;break}return o?!r:r}var Pg=Tu(Nm,Bm),Og="sourceSelectorEndpoint",Dg=function(){function t(e){wd(this,t),this.instance=e,Cd(this,"jpc",void 0),Cd(this,"existingJpc",void 0),Cd(this,"_originalAnchorSpec",void 0),Cd(this,"ep",void 0),Cd(this,"endpointRepresentation",void 0),Cd(this,"canvasElement",void 0),Cd(this,"_activeDefinition",void 0),Cd(this,"placeholderInfo",{id:null,element:null}),Cd(this,"floatingIndex",void 0),Cd(this,"floatingId",void 0),Cd(this,"floatingElement",void 0),Cd(this,"floatingEndpoint",void 0),Cd(this,"floatingAnchor",void 0),Cd(this,"_stopped",void 0),Cd(this,"inPlaceCopy",void 0),Cd(this,"endpointDropTargets",[]),Cd(this,"currentDropTarget",null),Cd(this,"payload",void 0),Cd(this,"floatingConnections",{}),Cd(this,"_forceReattach",void 0),Cd(this,"_forceDetach",void 0),Cd(this,"mousedownHandler",void 0),Cd(this,"mouseupHandler",void 0),Cd(this,"selector",Tu(Hu));var i=e.getContainer();this.mousedownHandler=this._mousedownHandler.bind(this),this.mouseupHandler=this._mouseupHandler.bind(this),e.on(i,zp,ap,this.mousedownHandler),e.on(i,jp,[ap,Tu(Hu)].join(","),this.mouseupHandler)}return Sd(t,[{key:"_resolveDragParent",value:function(t,e){var i=this.instance.getContainer(),n=gu(e,ap,i,!0);if(null!=t.parentSelector){var o=gu(e,t.parentSelector,i,!0);return null!=o&&(n=gu(o.parentNode,ap,i,!1)),o||n}return n}},{key:"_mousedownHandler",value:function(t){var e,i;if(3!==t.which&&2!==t.button){var n=t.target||t.srcElement;if((null==(i=this._getSourceDefinition(t))||null!=(e=this._resolveDragParent(i.def.def,n))&&e.getAttribute(Ap)!==Pf)&&i){var o,s=t.currentTarget;if(n.getAttribute(Ap)!==Pf){if(mu(t),this._activeDefinition=i,null!=(o=i.def.def).canAcceptNewConnection&&!o.canAcceptNewConnection(e,t))return!1;var r=ty(t,e,this.instance.currentZoom),a={element:e};if(Rd(a,o),a.isTemporarySource=!0,o.scope)a.scope=o.scope;else{var l=n.getAttribute(Mp);null!=l&&(a.scope=l)}if(null!=(a=Hd(a,o.parameterExtractor?o.parameterExtractor(e,n,t):{})).maxConnections&&a.maxConnections>=0)if(this.instance.select({source:e}).length>=a.maxConnections)return mu(t),o.onMaxConnections&&o.onMaxConnections({element:e,maxConnections:a.maxConnections},t),t.stopImmediatePropagation&&t.stopImmediatePropagation(),!1;if(o.anchorPositionFinder){var c=o.anchorPositionFinder(e,r,o,t);null!=c&&(a.anchor=c)}this._originalAnchorSpec=a.anchor||(this.instance.areDefaultAnchorsSet()?this.instance.defaults.anchors[0]:this.instance.defaults.anchor);var h=this.instance.router.prepareAnchor(this._originalAnchorSpec),d=[r.x,r.y,0,0];if(h.locations.length>0)d[2]=h.locations[0].ox,d[3]=h.locations[0].oy;else if(h.isContinuous){var u=r.x<.5?r.x:1-r.x,p=r.y<.5?r.y:1-r.y;d[2]=u<p?r.x<.5?-1:1:0,d[3]=p<u?r.y<.5?-1:1:0}a.anchor=d,a.deleteOnEmpty=!0,this.ep=this.instance._internal_newEndpoint(a);var f={};if(o.extract){for(var m in o.extract){var g=n.getAttribute(m);g&&(f[o.extract[m]]=g)}this.ep.mergeParameters(f)}if(a.uniqueEndpoint){var v=this.ep.elementId,y=this.instance.getManagedData(v,Og,i.id);null==y?(this.instance.setManagedData(v,Og,i.id,this.ep),this.ep.deleteOnEmpty=!1):this.ep.finalEndpoint=y}s._jsPlumbOrphanedEndpoints=s._jsPlumbOrphanedEndpoints||[],s._jsPlumbOrphanedEndpoints.push(this.ep),this.instance.trigger(this.ep.endpoint.canvas,zp,t,f)}}}}},{key:"_mouseupHandler",value:function(t){var e=t.currentTarget||t.srcElement;e._jsPlumbOrphanedEndpoints&&(!function(t,e){t=null==t.length||"string"==typeof t?[t]:t;for(var i=0;i<t.length;i++)e(t[i])}(e._jsPlumbOrphanedEndpoints,this.instance._maybePruneEndpoint.bind(this.instance)),e._jsPlumbOrphanedEndpoints.length=0),this._activeDefinition=null}},{key:"onDragInit",value:function(t){var e=Eu(t,this.instance),i=Au(t,this.instance);return this._makeDraggablePlaceholder(e,i),this.placeholderInfo.element.jtk=t.jtk,this.placeholderInfo.element}},{key:"onDragAbort",value:function(t){this._cleanupDraggablePlaceholder()}},{key:"_makeDraggablePlaceholder",value:function(t,e){this.placeholderInfo=this.placeholderInfo||{};var i=ku("div",{position:"absolute"});this.instance._appendElementToContainer(i);var n=this.instance.getId(i);return this.instance.setPosition(i,t),i.style.width=e.w+"px",i.style.height=e.h+"px",this.instance.manage(i),this.placeholderInfo.id=n,this.placeholderInfo.element=i,i}},{key:"_cleanupDraggablePlaceholder",value:function(){this.placeholderInfo.element&&(this.instance.unmanage(this.placeholderInfo.element,!0),delete this.placeholderInfo.element,delete this.placeholderInfo.id)}},{key:"reset",value:function(){var t=this.instance.getContainer();this.instance.off(t,jp,this.mouseupHandler),this.instance.off(t,zp,this.mousedownHandler)}},{key:"init",value:function(t){}},{key:"startNewConnectionDrag",value:function(t,e){this.jpc=this.instance._newConnection({sourceEndpoint:this.ep,targetEndpoint:this.floatingEndpoint,source:this.ep.element,target:this.placeholderInfo.element,paintStyle:this.ep.connectorStyle,hoverPaintStyle:this.ep.connectorHoverStyle,connector:this.ep.connector,overlays:this.ep.connectorOverlays,type:this.ep.edgeType,cssClass:this.ep.connectorClass,hoverClass:this.ep.connectorHoverClass,scope:t,data:e}),this.jpc.pending=!0,this.jpc.addClass(this.instance.draggingClass),this.ep.addClass(this.instance.draggingClass),this.instance.fire(Up,this.jpc)}},{key:"startExistingConnectionDrag",value:function(){this.existingJpc=!0,this.instance.setHover(this.jpc,!1);var t=this.jpc.endpoints[0].id===this.ep.id?0:1;this.ep.detachFromConnection(this.jpc,null,!0),this.floatingEndpoint.addConnection(this.jpc),this.instance.fire(Up,this.jpc),this.instance.sourceOrTargetChanged(this.jpc.endpoints[t].elementId,this.placeholderInfo.id,this.jpc,this.placeholderInfo.element,t),this.jpc.suspendedEndpoint=this.jpc.endpoints[t],this.jpc.suspendedElement=this.jpc.endpoints[t].element,this.jpc.suspendedElementId=this.jpc.endpoints[t].elementId,this.jpc.suspendedElementType=0===t?Ou:Du,this.instance.setHover(this.jpc.suspendedEndpoint,!1),this.floatingEndpoint.referenceEndpoint=this.jpc.suspendedEndpoint,this.floatingEndpoint.mergeParameters(this.jpc.suspendedEndpoint.parameters),this.jpc.endpoints[t]=this.floatingEndpoint,this.jpc.addClass(this.instance.draggingClass),this.floatingId=this.placeholderInfo.id,this.floatingIndex=t,this.instance._refreshEndpoint(this.ep)}},{key:"_shouldStartDrag",value:function(){var t=!0;this.ep.enabled||(t=!1),null!=this.jpc||this.ep.isSource||this.ep.isTemporarySource||(t=!1),!this.ep.isSource||!this.ep.isFull()||null!=this.jpc&&this.ep.dragAllowedWhenFull||(t=!1),null==this.jpc||this.jpc.isDetachable(this.ep)||(this.ep.isFull()?t=!1:this.jpc=null);var e={},i=this.instance.checkCondition(null==this.jpc?"beforeDrag":"beforeStartDetach",{endpoint:this.ep,source:this.ep.element,sourceId:this.ep.elementId,connection:this.jpc});return!1===i?t=!1:"object"===_d(i)?Rd(e=i,this.payload||{}):e=this.payload||{},[t,e]}},{key:"_createFloatingEndpoint",value:function(t){var e=this.ep.endpoint;null!=this.ep.edgeType&&(e=this.instance._deriveEndpointAndAnchorSpec(this.ep.edgeType).endpoints[1]);this.floatingEndpoint=Mg(this.ep,e,0,this.placeholderInfo.element,this.placeholderInfo.id,this.instance),this.floatingAnchor=this.floatingEndpoint._anchor,this.floatingEndpoint.deleteOnEmpty=!0,this.floatingElement=this.floatingEndpoint.endpoint.canvas,this.floatingId=this.instance.getId(this.floatingElement)}},{key:"_populateTargets",value:function(t,e){var i,n=this,o=this.jpc&&this.jpc.endpoints[0]===this.ep;if(Gd(this.instance.getContainer().querySelectorAll([".",Hu,"[",Fu,this.ep.scope,"]:not(.",Uu,")"].join("")),(function(e){if(!(null==n.jpc&&e===t||e===n.floatingElement||null==n.jpc&&e.jtk.endpoint.isFull())&&(o&&e.jtk.endpoint.isSource||!o&&e.jtk.endpoint.isTarget)){var s=Eu(e,n.instance),r=Au(e,n.instance);i={x:s.x,y:s.y,w:r.w,h:r.h},n.endpointDropTargets.push({el:e,targetEl:e,r:i,endpoint:e.jtk.endpoint,def:null}),n.instance.addClass(e,Nm)}})),o){var s=Yd(this.instance.sourceSelectors,(function(t){return t.isEnabled()&&(null==t.def.def.scope||t.def.def.scope===n.ep.scope)}));if(null!=s)Gd(this._findTargetZones(s),(function(t){if(t.getAttribute(Ap)!==Pf){var e=t.getAttribute(Mp);if(null!=e&&e!==n.ep.scope)return;var i={r:null,el:t};i.targetEl=gu(t,ap,n.instance.getContainer(),!0);var o=Eu(i.el,n.instance),r=Au(i.el,n.instance);i.r={x:o.x,y:o.y,w:r.w,h:r.h},null!=s.def.def.rank&&(i.rank=s.def.def.rank),i.def=s.def,n.endpointDropTargets.push(i),n.instance.addClass(i.targetEl,Nm)}}))}else{var r=function(t,e){var i=function(t,e){var i=[];if(t)for(var n=0;n<t.length;n++)e(t[n])&&i.push(n);return i}(t,e);return i.map((function(e){return t[e]}))}(this.instance.targetSelectors,(function(t){return t.isEnabled()}));r.forEach((function(t){Gd(n._findTargetZones(t),(function(i){if(i.getAttribute(Ap)!==Pf){var o=i.getAttribute(Mp);if(null!=o&&o!==n.ep.scope)return;var s={r:null,el:i};if(null!=t.def.def.parentSelector&&(s.targetEl=gu(i,t.def.def.parentSelector,n.instance.getContainer(),!0)),null==s.targetEl&&(s.targetEl=gu(i,ap,n.instance.getContainer(),!0)),(!1===t.def.def.allowLoopback||n._activeDefinition&&!1===n._activeDefinition.def.def.allowLoopback)&&s.targetEl===n.ep.element)return;if(null!=t.def.def.canAcceptNewConnection&&!t.def.def.canAcceptNewConnection(s.targetEl,e))return;var r=t.def.def.maxConnections;if(null!=r&&-1!==r&&n.instance.select({target:s.targetEl}).length>=r)return;var a=Eu(i,n.instance),l=Au(i,n.instance);s.r={x:a.x,y:a.y,w:l.w,h:l.h},s.def=t.def,null!=t.def.def.rank&&(s.rank=t.def.def.rank),n.endpointDropTargets.push(s),n.instance.addClass(s.targetEl,Nm)}}))}))}this.endpointDropTargets.sort((function(t,e){if(t.targetEl._isJsPlumbGroup&&!e.targetEl._isJsPlumbGroup)return 1;if(!t.targetEl._isJsPlumbGroup&&e.targetEl._isJsPlumbGroup)return-1;if(t.targetEl._isJsPlumbGroup&&e.targetEl._isJsPlumbGroup){if(n.instance.groupManager.isAncestor(t.targetEl._jsPlumbGroup,e.targetEl._jsPlumbGroup))return-1;if(n.instance.groupManager.isAncestor(e.targetEl._jsPlumbGroup,t.targetEl._jsPlumbGroup))return 1}else{if(null==t.rank||null==e.rank)return 0;if(t.rank>e.rank)return-1;if(t.rank<e.rank)return 1}}))}},{key:"_findTargetZones",value:function(t){var e;if("any"===t.redrop){var i=this.instance.targetSelectors.map((function(t){return t.selector}));i.push.apply(i,Id(this.instance.sourceSelectors.map((function(t){return t.selector})))),i.push(ap),e=i.join(",")}else if(t.redrop===Ag)e=t.selector;else if("anySource"===t.redrop)e=this.instance.sourceSelectors.map((function(t){return t.selector})).join(",");else if("anyTarget"===t.redrop)e=this.instance.targetSelectors.map((function(t){return t.selector})).join(",");else if("anySourceOrTarget"===t.redrop){var n=this.instance.targetSelectors.map((function(t){return t.selector}));n.push.apply(n,Id(this.instance.sourceSelectors.map((function(t){return t.selector})))),e=n.join(",")}return this.instance.getContainer().querySelectorAll(e)}},{key:"onStart",value:function(t){this.endpointDropTargets.length=0,this.currentDropTarget=null,this._stopped=!1;var e=t.drag.getDragElement();if(this.ep=e.jtk.endpoint,!this.ep)return!1;this.endpointRepresentation=this.ep.endpoint,this.canvasElement=this.endpointRepresentation.canvas,this.jpc=this.ep.connectorSelector();var i=Dd(this._shouldStartDrag(),2),n=i[0],o=i[1];if(!1===n)return this._stopped=!0,!1;this.instance.setHover(this.ep,!1),this.instance.isConnectionBeingDragged=!0,this.jpc&&!this.ep.isFull()&&this.ep.isSource&&(this.jpc=null),this._createFloatingEndpoint(this.canvasElement),this._populateTargets(this.canvasElement,t.e),null==this.jpc?this.startNewConnectionDrag(this.ep.scope,o):this.startExistingConnectionDrag(),this._registerFloatingConnection(this.placeholderInfo,this.jpc),this.instance.currentlyDragging=!0}},{key:"onBeforeStart",value:function(t){this.payload=t.e.payload||{}}},{key:"onDrag",value:function(t){if(this._stopped)return!0;if(this.placeholderInfo.element){var e=Au(this.floatingElement,this.instance);this.instance.setElementPosition(this.placeholderInfo.element,t.pos.x,t.pos.y);for(var i,n,o={x:t.pos.x,y:t.pos.y,w:e.w,h:e.h},s=0;s<this.endpointDropTargets.length;s++)if(lm(o,this.endpointDropTargets[s].r)){i=this.endpointDropTargets[s];break}if(i!==this.currentDropTarget&&null!=this.currentDropTarget&&(n=this._getFloatingAnchorIndex(),this.instance.removeClass(this.currentDropTarget.el,Bm),this.currentDropTarget.endpoint&&(this.currentDropTarget.endpoint.endpoint.removeClass(this.instance.endpointDropAllowedClass),this.currentDropTarget.endpoint.endpoint.removeClass(this.instance.endpointDropForbiddenClass)),this.floatingAnchor.out()),null!=i)if(this.instance.addClass(i.el,Bm),n=this._getFloatingAnchorIndex(),null!=i.endpoint)if(i.endpoint.isSource&&0===n||i.endpoint.isTarget&&0!==n||this.jpc.suspendedEndpoint&&i.endpoint.referenceEndpoint&&i.endpoint.referenceEndpoint.id===this.jpc.suspendedEndpoint.id)this.instance.checkCondition("checkDropAllowed",{sourceEndpoint:this.jpc.endpoints[n],targetEndpoint:i.endpoint.endpoint,connection:this.jpc})?(i.endpoint.endpoint.addClass(this.instance.endpointDropAllowedClass),i.endpoint.endpoint.removeClass(this.instance.endpointDropForbiddenClass)):(i.endpoint.endpoint.removeClass(this.instance.endpointDropAllowedClass),i.endpoint.endpoint.addClass(this.instance.endpointDropForbiddenClass)),this.floatingAnchor.over(i.endpoint),this.instance._paintConnection(this.jpc);else i=null;this.currentDropTarget=i}}},{key:"_maybeCleanup",value:function(t){t._mtNew&&0===t.connections.length?this.instance.deleteEndpoint(t):delete t._mtNew}},{key:"_reattachOrDiscard",value:function(t){var e=null!=this.jpc.suspendedEndpoint,i=this._getFloatingAnchorIndex();return e&&this._shouldReattach()?(0===i?(this.jpc.source=this.jpc.suspendedElement,this.jpc.sourceId=this.jpc.suspendedElementId):(this.jpc.target=this.jpc.suspendedElement,this.jpc.targetId=this.jpc.suspendedElementId),this._doForceReattach(i),!0):(this._discard(i,t),!1)}},{key:"onStop",value:function(t){var e=this,i=t.e;this.instance.isConnectionBeingDragged=!1,this.instance.currentlyDragging=!1;var n=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return e.join(" ")}(Bm,Nm);if(Gd(this.instance.getContainer().querySelectorAll(Pg),(function(t){e.instance.removeClass(t,n)})),this.jpc&&null!=this.jpc.endpoints){var o,s=null!=this.jpc.suspendedEndpoint,r=this._getFloatingAnchorIndex(),a=this.jpc.suspendedEndpoint;if(null!=this.currentDropTarget)if(null==(o=this._getDropEndpoint(t,this.jpc)))this._reattachOrDiscard(t.e);else if(a&&a.id===o.id)this._doForceReattach(r);else if(o.enabled)if(o.isFull())o.fire(ep,{endpoint:this,connection:this.jpc,maxConnections:this.instance.defaults.maxConnections},i),this._reattachOrDiscard(t.e);else{0===r?(this.jpc.source=o.element,this.jpc.sourceId=o.elementId):(this.jpc.target=o.element,this.jpc.targetId=o.elementId);var l=!0;s&&this.jpc.suspendedEndpoint.id!==o.id&&(this.jpc.isDetachAllowed(this.jpc)&&this.jpc.endpoints[r].isDetachAllowed(this.jpc)&&this.jpc.suspendedEndpoint.isDetachAllowed(this.jpc)&&this.instance.checkCondition("beforeDetach",this.jpc)||(l=!1)),(l=l&&o.isDropAllowed(this.jpc.sourceId,this.jpc.targetId,this.jpc.scope,this.jpc,o))?this._drop(o,r,i,l):this._reattachOrDiscard(t.e)}else this._reattachOrDiscard(t.e);else this._reattachOrDiscard(t.e);this.instance._refreshEndpoint(this.ep),this.ep.removeClass(this.instance.draggingClass),this._cleanupDraggablePlaceholder(),this.jpc.removeClass(this.instance.draggingClass),delete this.jpc.suspendedEndpoint,delete this.jpc.suspendedElement,delete this.jpc.suspendedElementType,delete this.jpc.suspendedElementId,delete this.jpc.suspendedIndex,delete this.floatingId,delete this.floatingIndex,delete this.floatingElement,delete this.floatingEndpoint,delete this.floatingAnchor,delete this.jpc.pending,null!=o&&this._maybeCleanup(o)}}},{key:"_getSourceDefinition",value:function(t){for(var e,i=this.instance.getContainer(),n=0;n<this.instance.sourceSelectors.length;n++){if((e=this.instance.sourceSelectors[n]).isEnabled())if(!1!==Tg(t,i,e.selector,this.instance,e.exclude))return e}}},{key:"_getDropEndpoint",value:function(t,e){var i;if(null==this.currentDropTarget.endpoint){var n=this.currentDropTarget.def,o=t.e.target||t.e.srcElement;if(null==n)return null;var s=this.currentDropTarget.targetEl,r=ty(t.e,s,this.instance.currentZoom),a=this.instance._deriveEndpointAndAnchorSpec(e.getType().join(" "),!0),l=a.endpoints?Rd(t,{endpoint:n.def.endpoint||a.endpoints[1],cssClass:n.def.cssClass||"",source:!0===n.def.source,target:!0===n.def.target}):t,c=this.instance.validAnchorsSpec(a.anchors)?a.anchors:this.instance.areDefaultAnchorsSet()?this.instance.defaults.anchors:null,h=n.def.anchor,d=n.def.anchorPositionFinder?n.def.anchorPositionFinder(s,r,n.def,t.e):null,u=null!=d?d:null!=h?h:null!=c&&null!=c[1]?c[1]:null;if(null!=u&&(l=Rd(l,{anchor:u})),null!=n.def.portId&&(l.portId=n.def.portId),(l=Hd(l,n.def.parameterExtractor?n.def.parameterExtractor(this.currentDropTarget.el,o,t.e):{})).element=s,(i=this.instance._internal_newEndpoint(l))._mtNew=!0,i.deleteOnEmpty=!0,n.def.parameters&&i.mergeParameters(n.def.parameters),n.def.extract){var p={};for(var f in n.def.extract){var m=this.currentDropTarget.el.getAttribute(f);m&&(p[n.def.extract[f]]=m)}i.mergeParameters(p)}}else i=this.currentDropTarget.endpoint;return i&&(i.removeClass(this.instance.endpointDropAllowedClass),i.removeClass(this.instance.endpointDropForbiddenClass)),i}},{key:"_doForceReattach",value:function(t){this.floatingEndpoint.detachFromConnection(this.jpc,null,!0),this.jpc.endpoints[t]=this.jpc.suspendedEndpoint,this.instance.setHover(this.jpc,!1),this.jpc._forceDetach=!0,this.jpc.suspendedEndpoint.addConnection(this.jpc),this.instance.sourceOrTargetChanged(this.floatingId,this.jpc.suspendedEndpoint.elementId,this.jpc,this.jpc.suspendedEndpoint.element,t),this.instance.deleteEndpoint(this.floatingEndpoint),this.instance.repaint(this.jpc.source),delete this.jpc._forceDetach}},{key:"_shouldReattach",value:function(){if(this.jpc.isReattach()||this.jpc._forceReattach)return!0;var t=this.jpc.suspendedEndpoint,e=this.jpc.suspendedElementType==Ou?1:0,i=this.jpc.endpoints[e];return!Ud(!0,!1,[[t,op,[this.jpc]],[i,op,[this.jpc]],[this.jpc,op,[this.jpc]],[this.instance,qu,[rp,this.jpc]]])}},{key:"_discard",value:function(t,e){this.jpc.pending?this.instance.fire("connection:abort",this.jpc,e):(0===t?(this.jpc.source=this.jpc.suspendedEndpoint.element,this.jpc.sourceId=this.jpc.suspendedEndpoint.elementId):(this.jpc.target=this.jpc.suspendedEndpoint.element,this.jpc.targetId=this.jpc.suspendedEndpoint.elementId),this.jpc.endpoints[t]=this.jpc.suspendedEndpoint),this.floatingEndpoint&&this.floatingEndpoint.detachFromConnection(this.jpc),this.instance.deleteConnection(this.jpc,{originalEvent:e,force:!0})}},{key:"_drop",value:function(t,e,i,n){if(this.jpc.endpoints[e].detachFromConnection(this.jpc),this.jpc.suspendedEndpoint&&this.jpc.suspendedEndpoint.detachFromConnection(this.jpc),this.jpc.endpoints[e]=t,t.addConnection(this.jpc),this.jpc.suspendedEndpoint){var o=this.jpc.suspendedEndpoint.elementId;this.instance.fireMoveEvent({index:e,originalSourceId:0===e?o:this.jpc.sourceId,newSourceId:0===e?t.elementId:this.jpc.sourceId,originalTargetId:1===e?o:this.jpc.targetId,newTargetId:1===e?t.elementId:this.jpc.targetId,originalEndpoint:this.jpc.suspendedEndpoint,connection:this.jpc,newEndpoint:t},i)}(1===e?this.instance.sourceOrTargetChanged(this.floatingId,this.jpc.targetId,this.jpc,this.jpc.target,1):this.instance.sourceOrTargetChanged(this.floatingId,this.jpc.sourceId,this.jpc,this.jpc.source,0),this.jpc.endpoints[0].finalEndpoint)&&(this.jpc.endpoints[0].detachFromConnection(this.jpc),this.jpc.endpoints[0]=this.jpc.endpoints[0].finalEndpoint,this.jpc.endpoints[0].addConnection(this.jpc));Fd(n)&&this.jpc.mergeData(n),this._originalAnchorSpec&&(this.jpc.endpoints[0].setAnchor(this._originalAnchorSpec),this._originalAnchorSpec=null),this.instance._finaliseConnection(this.jpc,null,i),this.instance.setHover(this.jpc,!1),this.instance.revalidate(this.jpc.endpoints[0].element)}},{key:"_registerFloatingConnection",value:function(t,e){this.floatingConnections[t.id]=e}},{key:"_getFloatingAnchorIndex",value:function(){return null==this.floatingIndex?1:this.floatingIndex}}]),t}(),Ig=function(t){Ed(i,t);var e=Pd(i);function i(t,n){var o;return wd(this,i),(o=e.call(this,t,n)).instance=t,o.dragSelection=n,Cd(Td(o),"selector",[">",_f,ap].join(" ")),Cd(Td(o),"doRevalidate",void 0),o.doRevalidate=o._revalidate.bind(Td(o)),o}return Sd(i,[{key:"reset",value:function(){this.drag.off(Hp,this.doRevalidate)}},{key:"_revalidate",value:function(t){this.instance.revalidate(t)}},{key:"init",value:function(t){this.drag=t,t.on(Hp,this.doRevalidate)}},{key:"useGhostProxy",value:function(t,e){var i=e._jsPlumbParentGroup;return null!=i&&!0===i.ghost}},{key:"makeGhostProxy",value:function(t){var e=t,i=e.cloneNode(!0);return i._jsPlumbParentGroup=e._jsPlumbParentGroup,i}}]),i}(Um),Lg=function(){function t(e,i){wd(this,t),this.instance=e,this.overlay=i,Cd(this,"htmlElementOverlay",void 0),this.htmlElementOverlay=i}return Sd(t,null,[{key:"getElement",value:function(t,e,i){if(null==t.canvas){if(i&&e){t.canvas=i(e);var n=t.instance.overlayClass+" "+(t.cssClass?t.cssClass:"");t.instance.addClass(t.canvas,n)}else t.canvas=ku("div",{},t.instance.overlayClass+" "+(t.cssClass?t.cssClass:""));for(var o in t.instance.setAttribute(t.canvas,"jtk-overlay-id",t.id),t.attributes)t.instance.setAttribute(t.canvas,o,t.attributes[o]);t.canvas.style.position=$u,t.instance._appendElement(t.canvas,t.instance.getContainer()),t.instance.getId(t.canvas);var s="translate(-50%, -50%)";t.canvas.style.webkitTransform=s,t.canvas.style.mozTransform=s,t.canvas.style.msTransform=s,t.canvas.style.oTransform=s,t.canvas.style.transform=s,t.isVisible()||(t.canvas.style.display=Lu),t.canvas.jtk={overlay:t}}return t.canvas}},{key:"destroy",value:function(t){t.canvas&&t.canvas.parentNode&&t.canvas.parentNode.removeChild(t.canvas),delete t.canvas,delete t.cachedDimensions}},{key:"_getDimensions",value:function(t,e){return(null==t.cachedDimensions||e)&&(t.cachedDimensions={w:1,h:1}),t.cachedDimensions}}]),t}(),$g=function(){function t(){wd(this,t),Cd(this,"_listeners",{}),Cd(this,"eventsSuspended",!1),Cd(this,"tick",!1),Cd(this,"eventsToDieOn",{ready:!0}),Cd(this,"queue",[])}return Sd(t,[{key:"fire",value:function(t,e,i){var n=null;if(this.tick)this.queue.unshift(arguments);else{if(this.tick=!0,!this.eventsSuspended&&this._listeners[t]){var o=this._listeners[t].length,s=0,r=!1;if(!this.shouldFireEvent||this.shouldFireEvent(t,e,i))for(;!r&&s<o&&!1!==n;){if(this.eventsToDieOn[t])this._listeners[t][s](e,i);else try{n=this._listeners[t][s](e,i)}catch(e){cu("jsPlumb: fire failed for event "+t+" : "+(e.message||e))}s++,null!=this._listeners&&null!=this._listeners[t]||(r=!0)}}this.tick=!1,this._drain()}return n}},{key:"_drain",value:function(){var t=this.queue.pop();t&&this.fire.apply(this,t)}},{key:"unbind",value:function(t,e){if(0===arguments.length)this._listeners={};else if(1===arguments.length){if("string"==typeof t)delete this._listeners[t];else if(t.__jsPlumb){var i;for(var n in t.__jsPlumb)i=t.__jsPlumb[n],Jd(this._listeners[i]||[],t)}}else 2===arguments.length&&Jd(this._listeners[t]||[],e);return this}},{key:"getListener",value:function(t){return this._listeners[t]||[]}},{key:"isSuspendEvents",value:function(){return this.eventsSuspended}},{key:"setSuspendEvents",value:function(t){this.eventsSuspended=t}},{key:"bind",value:function(t,e,i){var n=this,o=function(t){tu(n._listeners,t,e,i),e.__jsPlumb=e.__jsPlumb||{},e.__jsPlumb[su()]=t};if("string"==typeof t)o(t);else if(null!=t.length)for(var s=0;s<t.length;s++)o(t[s]);return this}},{key:"silently",value:function(t){this.setSuspendEvents(!0);try{t()}catch(t){cu("Cannot execute silent function "+t)}this.setSuspendEvents(!1)}}]),t}();function zg(t){var e=null;return(e=Bd(t)?{type:t,options:{}}:t).options.id=e.options.id||su(),e}!function(t){Ed(i,t);var e=Pd(i);function i(){return wd(this,i),e.apply(this,arguments)}Sd(i,[{key:"shouldFireEvent",value:function(t,e,i){return!0}}])}($g);var Rg=function(t){Ed(i,t);var e=Pd(i);function i(t,n,o){var s;for(var r in wd(this,i),(s=e.call(this)).instance=t,s.component=n,Cd(Td(s),"id",void 0),Cd(Td(s),"type",void 0),Cd(Td(s),"cssClass",void 0),Cd(Td(s),"visible",!0),Cd(Td(s),"location",void 0),Cd(Td(s),"events",void 0),Cd(Td(s),"attributes",void 0),o=o||{},s.id=o.id||su(),s.cssClass=o.cssClass||"",s.setLocation(o.location),s.events=o.events||{},s.attributes=o.attributes||{},s.events)s.bind(r,s.events[r]);return s}return Sd(i,[{key:"setLocation",value:function(t){var e=null==this.location?.5:this.location;if(null!=t)try{var i="string"==typeof t?parseFloat(t):t;isNaN(i)||(e=i)}catch(t){}this.location=e}},{key:"shouldFireEvent",value:function(t,e,i){return!0}},{key:"setVisible",value:function(t){this.visible=t,this.instance.setOverlayVisible(this,t)}},{key:"isVisible",value:function(){return this.visible}}]),i}($g),Ng={},Bg=function(t,e,i,n){var o=Ng[e];if(o)return new o(t,i,n);throw{message:"jsPlumb: unknown overlay type '"+e+"'"}},jg=function(t,e){Ng[t]=e},Fg=function(t){Ed(i,t);var e=Pd(i);function i(t,n,o){var s;return wd(this,i),(s=e.call(this,t,n,o)).instance=t,s.component=n,Cd(Td(s),"label",void 0),Cd(Td(s),"labelText",void 0),Cd(Td(s),"type",i.type),Cd(Td(s),"cachedDimensions",void 0),o=o||{label:""},s.setLabel(o.label),s}return Sd(i,[{key:"getLabel",value:function(){return qd(this.label)?this.label(this):this.labelText}},{key:"setLabel",value:function(t){this.label=t,this.labelText=null,this.instance.updateLabel(this)}},{key:"getDimensions",value:function(){return{w:1,h:1}}},{key:"updateFrom",value:function(t){null!=t.label&&this.setLabel(t.label),null!=t.location&&(this.setLocation(t.location),this.instance.updateLabel(this))}}]),i}(Rg);function qg(t){return t.type===Fg.type}function Vg(t){return null==t?null:t.split(" ").filter((function(t){return null!=t&&t.length>0}))}function Hg(t,e,i){for(var n in e)t[n]=i}Cd(Fg,"type","Label"),jg(Fg.type,Fg);var Ug="__default",Wg="__label",Gg="overlay",Zg="remove";function Yg(t,e){if(t.getDefaultType){var i=t.getTypeDescriptor(),n={},o=t.getDefaultType(),s=Rd({},o);Hg(n,o,Ug),t._types.forEach((function(e){if(e!==Ug){var o=t.instance.getType(e,i);if(null!=o){var r=new Set(["connector","anchor","anchors"]);if("override"===o.mergeStrategy)for(var a in o)r.add(a);s=Hd(s,o,["cssClass"],function(t){var e=[];return t.forEach((function(t){e.push(t)})),e}(r)),Hg(n,o,e)}}})),e&&(s=Wd(s,e,"_")),t.applyType(s,n)}}function Xg(t,e){var i=t.instance.getType(e,t.getTypeDescriptor());null!=i&&i.cssClass&&t.removeClass(i.cssClass)}function Kg(t){if(t.paintStyle&&t.hoverPaintStyle){var e={};Rd(e,t.paintStyle),Rd(e,t.hoverPaintStyle),t.hoverPaintStyle=e}}var Qg=function(t){Ed(i,t);var e=Pd(i);function i(t,n){var o;if(wd(this,i),(o=e.call(this)).instance=t,Cd(Td(o),"defaultLabelLocation",.5),Cd(Td(o),"overlays",{}),Cd(Td(o),"overlayPositions",{}),Cd(Td(o),"overlayPlacements",{}),Cd(Td(o),"clone",void 0),Cd(Td(o),"deleted",void 0),Cd(Td(o),"segment",void 0),Cd(Td(o),"x",void 0),Cd(Td(o),"y",void 0),Cd(Td(o),"w",void 0),Cd(Td(o),"h",void 0),Cd(Td(o),"id",void 0),Cd(Td(o),"visible",!0),Cd(Td(o),"typeId",void 0),Cd(Td(o),"params",{}),Cd(Td(o),"paintStyle",void 0),Cd(Td(o),"hoverPaintStyle",void 0),Cd(Td(o),"paintStyleInUse",void 0),Cd(Td(o),"_hover",!1),Cd(Td(o),"lastPaintedAt",void 0),Cd(Td(o),"data",void 0),Cd(Td(o),"_defaultType",void 0),Cd(Td(o),"events",void 0),Cd(Td(o),"parameters",void 0),Cd(Td(o),"_types",void 0),Cd(Td(o),"_typeCache",void 0),Cd(Td(o),"cssClass",void 0),Cd(Td(o),"hoverClass",void 0),Cd(Td(o),"beforeDetach",void 0),Cd(Td(o),"beforeDrop",void 0),n=n||{},o.cssClass=n.cssClass||"",o.hoverClass=n.hoverClass||t.defaults.hoverClass,o.beforeDetach=n.beforeDetach,o.beforeDrop=n.beforeDrop,o._types=new Set,o._typeCache={},o.parameters=Vd(n.parameters||{}),o.id=n.id||o.getIdPrefix()+(new Date).getTime(),o._defaultType={parameters:o.parameters,scope:n.scope||o.instance.defaultScope,overlays:{}},n.events)for(var s in n.events)o.bind(s,n.events[s]);o.clone=function(){var e=Object.create(o.constructor.prototype);return o.constructor.apply(e,[t,n]),e},o.overlays={},o.overlayPositions={};var r=n.overlays||[],a={},l=o.getDefaultOverlayKey();if(l){var c=o.instance.defaults[l];c&&r.push.apply(r,Id(c));for(var h=0;h<r.length;h++){var d=zg(r[h]);a[d.options.id]=d}}return o._defaultType.overlays=a,n.label&&(o.getDefaultType().overlays[Wg]={type:Fg.type,options:{label:n.label,location:n.labelLocation||o.defaultLabelLocation,id:Wg,cssClass:"jtk-default-label"}}),o}return Sd(i,[{key:"isDetachAllowed",value:function(t){var e=!0;if(this.beforeDetach)try{e=this.beforeDetach(t)}catch(t){cu("jsPlumb: beforeDetach callback failed",t)}return e}},{key:"isDropAllowed",value:function(t,e,i,n,o){var s,r={sourceId:t,targetId:e,scope:i,connection:n,dropEndpoint:o};if(this.beforeDrop)try{s=this.beforeDrop(r)}catch(t){cu("jsPlumb: beforeDrop callback failed",t)}else s=this.instance.checkCondition(sp,r);return s}},{key:"getDefaultType",value:function(){return this._defaultType}},{key:"appendToDefaultType",value:function(t){for(var e in t)this._defaultType[e]=t[e]}},{key:"getId",value:function(){return this.id}},{key:"cacheTypeItem",value:function(t,e,i){this._typeCache[i]=this._typeCache[i]||{},this._typeCache[i][t]=e}},{key:"getCachedTypeItem",value:function(t,e){return this._typeCache[e]?this._typeCache[e][t]:null}},{key:"setType",value:function(t,e){this.clearTypes(),(Vg(t)||[]).forEach(this._types.add,this._types),Yg(this,e)}},{key:"getType",value:function(){return Array.from(this._types.keys())}},{key:"reapplyTypes",value:function(t){Yg(this,t)}},{key:"hasType",value:function(t){return this._types.has(t)}},{key:"addType",value:function(t,e){var i=Vg(t),n=!1;if(null!=i){for(var o=0,s=i.length;o<s;o++)this._types.has(i[o])||(this._types.add(i[o]),n=!0);n&&Yg(this,e)}}},{key:"removeType",value:function(t,e){var i,n=this,o=Vg(t),s=!1;if(null!=o){for(var r=0,a=o.length;r<a;r++)i=o[r],s=!!n._types.has(i)&&(Xg(n,i),n._types.delete(i),!0)||s;s&&Yg(this,e)}}},{key:"clearTypes",value:function(t){var e=this;this._types.forEach((function(t){Xg(e,t)})),this._types.clear(),Yg(this,t)}},{key:"toggleType",value:function(t,e){var i=Vg(t);if(null!=i){for(var n=0,o=i.length;n<o;n++)this._types.has(i[n])?(Xg(this,i[n]),this._types.delete(i[n])):this._types.add(i[n]);Yg(this,e)}}},{key:"applyType",value:function(t,e){if(this.setPaintStyle(t.paintStyle),this.setHoverPaintStyle(t.hoverPaintStyle),this.mergeParameters(t.parameters),this.paintStyleInUse=this.getPaintStyle(),t.overlays){var i,n={};for(i in t.overlays){var o=this.overlays[t.overlays[i].options.id];if(o)o.updateFrom(t.overlays[i].options),n[t.overlays[i].options.id]=!0,this.instance.reattachOverlay(o,this);else{var s=this.getCachedTypeItem(Gg,t.overlays[i].options.id);null!=s?(this.instance.reattachOverlay(s,this),s.setVisible(!0),s.updateFrom(t.overlays[i].options),this.overlays[s.id]=s):s=this.addOverlay(t.overlays[i]),n[s.id]=!0}}for(i in this.overlays)null==n[this.overlays[i].id]&&this.removeOverlay(this.overlays[i].id,!0)}}},{key:"setPaintStyle",value:function(t){this.paintStyle=t,this.paintStyleInUse=this.paintStyle,Kg(this)}},{key:"getPaintStyle",value:function(){return this.paintStyle}},{key:"setHoverPaintStyle",value:function(t){this.hoverPaintStyle=t,Kg(this)}},{key:"getHoverPaintStyle",value:function(){return this.hoverPaintStyle}},{key:"destroy",value:function(){for(var t in this.overlays)this.instance.destroyOverlay(this.overlays[t]);this.overlays={},this.overlayPositions={},this.unbind(),this.clone=null}},{key:"isHover",value:function(){return this._hover}},{key:"mergeParameters",value:function(t){null!=t&&Rd(this.parameters,t)}},{key:"setVisible",value:function(t){this.visible=t,t?this.showOverlays():this.hideOverlays()}},{key:"isVisible",value:function(){return this.visible}},{key:"setAbsoluteOverlayPosition",value:function(t,e){this.overlayPositions[t.id]=e}},{key:"getAbsoluteOverlayPosition",value:function(t){return this.overlayPositions?this.overlayPositions[t.id]:null}},{key:"_clazzManip",value:function(t,e){for(var i in this.overlays)"add"===t?this.instance.addOverlayClass(this.overlays[i],e):t===Zg&&this.instance.removeOverlayClass(this.overlays[i],e)}},{key:"addClass",value:function(t,e){var i=(this.cssClass||"").split(" ");i.push(t),this.cssClass=i.join(" "),this._clazzManip("add",t)}},{key:"removeClass",value:function(t,e){var i=(this.cssClass||"").split(" ");this.cssClass=i.filter((function(e){return e!==t})).join(" "),this._clazzManip(Zg,t)}},{key:"getClass",value:function(){return this.cssClass}},{key:"shouldFireEvent",value:function(t,e,i){return!0}},{key:"getData",value:function(){return this.data}},{key:"setData",value:function(t){this.data=t||{}}},{key:"mergeData",value:function(t){this.data=Rd(this.data,t)}},{key:"addOverlay",value:function(t){var e=function(t,e){var i=null;if(Bd(e))i=Bg(t.instance,e,t,{});else if(null!=e.type&&null!=e.options){var n=e,o=Rd({},n.options);i=Bg(t.instance,n.type,t,o)}else i=e;return i.id=i.id||su(),t.cacheTypeItem(Gg,i,i.id),t.overlays[i.id]=i,i}(this,t);if(this.getData&&e.type===Fg.type&&!Bd(t)){var i=this.getData(),n=t.options;if(i){var o=i[n.labelLocationAttribute||"labelLocation"];o&&(e.location=o)}}return e}},{key:"getOverlay",value:function(t){return this.overlays[t]}},{key:"getOverlays",value:function(){return this.overlays}},{key:"hideOverlay",value:function(t){var e=this.getOverlay(t);e&&e.setVisible(!1)}},{key:"hideOverlays",value:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];for(var n in e=e||[],this.overlays)0!==e.length&&-1===e.indexOf(n)||this.overlays[n].setVisible(!1)}},{key:"showOverlay",value:function(t){var e=this.getOverlay(t);e&&e.setVisible(!0)}},{key:"showOverlays",value:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];for(var n in e=e||[],this.overlays)0!==e.length&&-1===e.indexOf(n)||this.overlays[n].setVisible(!0)}},{key:"removeAllOverlays",value:function(){for(var t in this.overlays)this.instance.destroyOverlay(this.overlays[t]);this.overlays={},this.overlayPositions=null,this.overlayPlacements={}}},{key:"removeOverlay",value:function(t,e){var i=this.overlays[t];i&&(i.setVisible(!1),e||this.instance.destroyOverlay(i),delete this.overlays[t],this.overlayPositions&&delete this.overlayPositions[t],this.overlayPlacements&&delete this.overlayPlacements[t])}},{key:"removeOverlays",value:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];for(var n=0,o=e.length;n<o;n++)this.removeOverlay(arguments[n])}},{key:"getLabel",value:function(){var t=this.getLabelOverlay();return null!=t?t.getLabel():null}},{key:"getLabelOverlay",value:function(){return this.getOverlay(Wg)}},{key:"setLabel",value:function(t){var e,i,n,o=this.getLabelOverlay();if(o)if(Bd(t)||qd(t))o.setLabel(t);else{var s=t;s.label&&o.setLabel(s.label),s.location&&(o.location=s.location)}else{var r=Bd(t)||qd(t)?{label:t}:t;e=this,n=Rd({cssClass:(i=r).cssClass,id:Wg,component:e},i),o=new Fg(e.instance,e,n),this.overlays[Wg]=o}}}]),i}($g),Jg=["connectorStyle","connectorHoverStyle","connectorOverlays","connector","connectionType","connectorClass","connectorHoverClass"],tv=function(t){Ed(i,t);var e=Pd(i);function i(t,n){var o;wd(this,i),(o=e.call(this,t,n)).instance=t,Cd(Td(o),"connections",[]),Cd(Td(o),"endpoint",void 0),Cd(Td(o),"element",void 0),Cd(Td(o),"elementId",void 0),Cd(Td(o),"dragAllowedWhenFull",!0),Cd(Td(o),"timestamp",void 0),Cd(Td(o),"portId",void 0),Cd(Td(o),"maxConnections",void 0),Cd(Td(o),"proxiedBy",void 0),Cd(Td(o),"connectorClass",void 0),Cd(Td(o),"connectorHoverClass",void 0),Cd(Td(o),"finalEndpoint",void 0),Cd(Td(o),"enabled",!0),Cd(Td(o),"isSource",void 0),Cd(Td(o),"isTarget",void 0),Cd(Td(o),"isTemporarySource",void 0),Cd(Td(o),"connectionCost",1),Cd(Td(o),"connectionsDirected",void 0),Cd(Td(o),"connectionsDetachable",void 0),Cd(Td(o),"reattachConnections",void 0),Cd(Td(o),"currentAnchorClass",void 0),Cd(Td(o),"referenceEndpoint",void 0),Cd(Td(o),"edgeType",void 0),Cd(Td(o),"connector",void 0),Cd(Td(o),"connectorOverlays",void 0),Cd(Td(o),"connectorStyle",void 0),Cd(Td(o),"connectorHoverStyle",void 0),Cd(Td(o),"deleteOnEmpty",void 0),Cd(Td(o),"uuid",void 0),Cd(Td(o),"scope",void 0),Cd(Td(o),"_anchor",void 0),Cd(Td(o),"defaultLabelLocation",[.5,.5]),o.appendToDefaultType({edgeType:n.edgeType,maxConnections:null==n.maxConnections?o.instance.defaults.maxConnections:n.maxConnections,paintStyle:n.paintStyle||o.instance.defaults.endpointStyle,hoverPaintStyle:n.hoverPaintStyle||o.instance.defaults.endpointHoverStyle,connectorStyle:n.connectorStyle,connectorHoverStyle:n.connectorHoverStyle,connectorClass:n.connectorClass,connectorHoverClass:n.connectorHoverClass,connectorOverlays:n.connectorOverlays,connector:n.connector}),o.enabled=!(!1===n.enabled),o.visible=!0,o.element=n.element,o.uuid=n.uuid,o.portId=n.portId,o.elementId=n.elementId,o.connectionCost=null==n.connectionCost?1:n.connectionCost,o.connectionsDirected=n.connectionsDirected,o.currentAnchorClass="",o.events={},o.connectorOverlays=n.connectorOverlays,o.connectorStyle=n.connectorStyle,o.connectorHoverStyle=n.connectorHoverStyle,o.connector=n.connector,o.edgeType=n.edgeType,o.connectorClass=n.connectorClass,o.connectorHoverClass=n.connectorHoverClass,o.deleteOnEmpty=!0===n.deleteOnEmpty,o.isSource=n.source||!1,o.isTemporarySource=n.isTemporarySource||!1,o.isTarget=n.target||!1,o.connections=n.connections||[],o.scope=n.scope||t.defaultScope,o.timestamp=null,o.reattachConnections=n.reattachConnections||t.defaults.reattachConnections,o.connectionsDetachable=t.defaults.connectionsDetachable,!1===n.connectionsDetachable&&(o.connectionsDetachable=!1),o.dragAllowedWhenFull=!1!==n.dragAllowedWhenFull,n.onMaxConnections&&o.bind(ep,n.onMaxConnections);var s=n.endpoint||n.existingEndpoint||t.defaults.endpoint;if(o.setEndpoint(s),null!=n.preparedAnchor)o.setPreparedAnchor(n.preparedAnchor);else{var r=n.anchor?n.anchor:n.anchors?n.anchors:t.defaults.anchor||Cp.Top;o.setAnchor(r)}var a=[Mf,n.type||""].join(" ");return o.addType(a,n.data),o}return Sd(i,[{key:"getIdPrefix",value:function(){return"_jsplumb_e"}},{key:"getTypeDescriptor",value:function(){return"endpoint"}},{key:"getXY",value:function(){return{x:this.endpoint.x,y:this.endpoint.y}}},{key:"getDefaultOverlayKey",value:function(){return"endpointOverlays"}},{key:"_updateAnchorClass",value:function(){var t=this._anchor&&this._anchor.cssClass;if(null!=t&&t.length>0){var e=this.instance.endpointAnchorClassPrefix+"-"+this.currentAnchorClass;this.currentAnchorClass=t;var i=this.instance.endpointAnchorClassPrefix+(this.currentAnchorClass?"-"+this.currentAnchorClass:"");e!==i&&(this.removeClass(e),this.addClass(i),this.instance.removeClass(this.element,e),this.instance.addClass(this.element,i))}}},{key:"setPreparedAnchor",value:function(t){return this.instance.router.setAnchor(this,t),this._updateAnchorClass(),this}},{key:"_anchorLocationChanged",value:function(t){this.fire("anchor:changed",{endpoint:this,anchor:t}),this._updateAnchorClass()}},{key:"setAnchor",value:function(t){var e=this.instance.router.prepareAnchor(t);return this.setPreparedAnchor(e),this}},{key:"addConnection",value:function(t){this.connections.push(t),this.instance._refreshEndpoint(this)}},{key:"detachFromConnection",value:function(t,e,i){(e=null==e?this.connections.indexOf(t):e)>=0&&(this.connections.splice(e,1),this.instance._refreshEndpoint(this)),!i&&this.deleteOnEmpty&&0===this.connections.length&&this.instance.deleteEndpoint(this)}},{key:"deleteEveryConnection",value:function(t){for(var e=this.connections.length,i=0;i<e;i++)this.instance.deleteConnection(this.connections[0],t)}},{key:"detachFrom",value:function(t){for(var e=[],i=0;i<this.connections.length;i++)this.connections[i].endpoints[1]!==t&&this.connections[i].endpoints[0]!==t||e.push(this.connections[i]);for(var n=0,o=e.length;n<o;n++)this.instance.deleteConnection(e[0]);return this}},{key:"setVisible",value:function(t,e,n){if(Od(Ad(i.prototype),"setVisible",this).call(this,t),this.endpoint.setVisible(t),t?this.showOverlays():this.hideOverlays(),!e)for(var o=0;o<this.connections.length;o++)if(this.connections[o].setVisible(t),!n){var s=this===this.connections[o].endpoints[0]?1:0;1===this.connections[o].endpoints[s].connections.length&&this.connections[o].endpoints[s].setVisible(t,!0,!0)}}},{key:"applyType",value:function(t,e){Od(Ad(i.prototype),"applyType",this).call(this,t,e),this.setPaintStyle(t.endpointStyle||t.paintStyle),this.setHoverPaintStyle(t.endpointHoverStyle||t.hoverPaintStyle),this.connectorStyle=t.connectorStyle,this.connectorHoverStyle=t.connectorHoverStyle,this.connector=t.connector,this.connectorOverlays=t.connectorOverlays,this.edgeType=t.edgeType,null!=t.maxConnections&&(this.maxConnections=t.maxConnections),t.scope&&(this.scope=t.scope),Rd(t,Jg),this.instance.applyEndpointType(this,t)}},{key:"destroy",value:function(){Od(Ad(i.prototype),"destroy",this).call(this),this.deleted=!0,null!=this.endpoint&&this.instance.destroyEndpoint(this)}},{key:"isFull",value:function(){return 0===this.maxConnections||!(this.isFloating()||this.maxConnections<0||this.connections.length<this.maxConnections)}},{key:"isFloating",value:function(){return this.instance.router.isFloating(this)}},{key:"isConnectedTo",value:function(t){var e=!1;if(t)for(var i=0;i<this.connections.length;i++)if(this.connections[i].endpoints[1]===t||this.connections[i].endpoints[0]===t){e=!0;break}return e}},{key:"setDragAllowedWhenFull",value:function(t){this.dragAllowedWhenFull=t}},{key:"getUuid",value:function(){return this.uuid}},{key:"connectorSelector",value:function(){return this.connections[0]}},{key:"prepareEndpoint",value:function(t,e){var i,n={cssClass:this.cssClass,endpoint:this};if(pu(t,Xm)){var o=t;(i=Ym.clone(o)).classes=n.cssClass.split(" ")}else if(Bd(t))i=Ym.get(this,t,n);else{var s=t;Rd(n,s.options||{}),i=Ym.get(this,s.type,n)}return i.typeId=e,i}},{key:"setEndpoint",value:function(t){var e=this.prepareEndpoint(t);this.setPreparedEndpoint(e)}},{key:"setPreparedEndpoint",value:function(t){null!=this.endpoint&&this.instance.destroyEndpoint(this),this.endpoint=t}},{key:"addClass",value:function(t,e){Od(Ad(i.prototype),"addClass",this).call(this,t,e),null!=this.endpoint&&this.endpoint.addClass(t)}},{key:"removeClass",value:function(t,e){Od(Ad(i.prototype),"removeClass",this).call(this,t,e),null!=this.endpoint&&this.endpoint.removeClass(t)}}]),i}(Qg),ev="anchors",iv="connector";function nv(t,e,i,n,o,s,r){var a;if(e)t.endpoints[i]=e,e.addConnection(t);else{var l=r||t.endpointSpec||t.endpointsSpec[i]||t.instance.defaults.endpoints[i]||t.instance.defaults.endpoint,c=t.endpointStyles[i]||t.endpointStyle||t.instance.defaults.endpointStyles[i]||t.instance.defaults.endpointStyle;null==c.fill&&null!=t.paintStyle&&(c.fill=t.paintStyle.stroke),null==c.outlineStroke&&null!=t.paintStyle&&(c.outlineStroke=t.paintStyle.outlineStroke),null==c.outlineWidth&&null!=t.paintStyle&&(c.outlineWidth=t.paintStyle.outlineWidth);var h=t.endpointHoverStyles[i]||t.endpointHoverStyle||t.endpointHoverStyle||t.instance.defaults.endpointHoverStyles[i]||t.instance.defaults.endpointHoverStyle;null!=t.hoverPaintStyle&&(null==h&&(h={}),null==h.fill&&(h.fill=t.hoverPaintStyle.stroke));var d=t.uuids?t.uuids[i]:null;n=null!=n?n:null!=t.instance.defaults.anchors?t.instance.defaults.anchors[i]:t.instance.defaults.anchor,a=t.instance._internal_newEndpoint({paintStyle:c,hoverPaintStyle:h,endpoint:l,connections:[t],uuid:d,element:o,scope:t.scope,anchor:n,reattachConnections:t.reattach||t.instance.defaults.reattachConnections,connectionsDetachable:t.detachable||t.instance.defaults.connectionsDetachable}),t.instance._refreshEndpoint(a),null==e&&(a.deleteOnEmpty=!0),t.endpoints[i]=a}return a}var ov=function(t){Ed(i,t);var e=Pd(i);function i(t,n){var o;wd(this,i),(o=e.call(this,t,n)).instance=t,Cd(Td(o),"connector",void 0),Cd(Td(o),"defaultLabelLocation",.5),Cd(Td(o),"scope",void 0),Cd(Td(o),"typeId","_jsplumb_connection"),Cd(Td(o),"previousConnection",void 0),Cd(Td(o),"sourceId",void 0),Cd(Td(o),"targetId",void 0),Cd(Td(o),"source",void 0),Cd(Td(o),"target",void 0),Cd(Td(o),"detachable",!0),Cd(Td(o),"reattach",!1),Cd(Td(o),"uuids",void 0),Cd(Td(o),"cost",1),Cd(Td(o),"directed",void 0),Cd(Td(o),"endpoints",[null,null]),Cd(Td(o),"endpointStyles",void 0),Cd(Td(o),"endpointSpec",void 0),Cd(Td(o),"endpointsSpec",void 0),Cd(Td(o),"endpointStyle",{}),Cd(Td(o),"endpointHoverStyle",{}),Cd(Td(o),"endpointHoverStyles",void 0),Cd(Td(o),"suspendedEndpoint",void 0),Cd(Td(o),"suspendedIndex",void 0),Cd(Td(o),"suspendedElement",void 0),Cd(Td(o),"suspendedElementId",void 0),Cd(Td(o),"suspendedElementType",void 0),Cd(Td(o),"_forceReattach",void 0),Cd(Td(o),"_forceDetach",void 0),Cd(Td(o),"proxies",[]),Cd(Td(o),"pending",!1),o.id=n.id,o.previousConnection=n.previousConnection,o.source=n.source,o.target=n.target,n.sourceEndpoint?(o.source=n.sourceEndpoint.element,o.sourceId=n.sourceEndpoint.elementId):o.sourceId=t.getId(o.source),n.targetEndpoint?(o.target=n.targetEndpoint.element,o.targetId=n.targetEndpoint.elementId):o.targetId=t.getId(o.target),o.scope=n.scope;var s=n.anchors?n.anchors[0]:n.anchor,r=n.anchors?n.anchors[1]:n.anchor;t.manage(o.source),t.manage(o.target),o.visible=!0,o.params={cssClass:n.cssClass,hoverClass:n.hoverClass,"pointer-events":n["pointer-events"],overlays:n.overlays},o.lastPaintedAt=null,n.type&&(n.endpoints=n.endpoints||o.instance._deriveEndpointAndAnchorSpec(n.type).endpoints),o.endpointSpec=n.endpoint,o.endpointsSpec=n.endpoints||[null,null],o.endpointStyle=n.endpointStyle,o.endpointHoverStyle=n.endpointHoverStyle,o.endpointStyles=n.endpointStyles||[null,null],o.endpointHoverStyles=n.endpointHoverStyles||[null,null],o.paintStyle=n.paintStyle,o.hoverPaintStyle=n.hoverPaintStyle,o.uuids=n.uuids,o.makeEndpoint(!0,o.source,o.sourceId,s,n.sourceEndpoint),o.makeEndpoint(!1,o.target,o.targetId,r,n.targetEndpoint),o.scope||(o.scope=o.endpoints[0].scope),null!=n.deleteEndpointsOnEmpty&&(o.endpoints[0].deleteOnEmpty=n.deleteEndpointsOnEmpty,o.endpoints[1].deleteOnEmpty=n.deleteEndpointsOnEmpty);var a=o.instance.defaults.connectionsDetachable;!1===n.detachable&&(a=!1),!1===o.endpoints[0].connectionsDetachable&&(a=!1),!1===o.endpoints[1].connectionsDetachable&&(a=!1),o.endpointsSpec=n.endpoints||[null,null],o.endpointSpec=n.endpoint||null;var l=n.reattach||o.endpoints[0].reattachConnections||o.endpoints[1].reattachConnections||o.instance.defaults.reattachConnections,c=Rd({},o.endpoints[0].connectorStyle||o.endpoints[1].connectorStyle||n.paintStyle||o.instance.defaults.paintStyle);if(o.appendToDefaultType({detachable:a,reattach:l,paintStyle:c,hoverPaintStyle:Rd({},o.endpoints[0].connectorHoverStyle||o.endpoints[1].connectorHoverStyle||n.hoverPaintStyle||o.instance.defaults.hoverPaintStyle)}),n.outlineWidth&&(c.outlineWidth=n.outlineWidth),n.outlineColor&&(c.outlineStroke=n.outlineColor),n.lineWidth&&(c.strokeWidth=n.lineWidth),n.color&&(c.stroke=n.color),!o.instance._suspendDrawing){var h=o.instance._suspendedAt||su();o.instance._paintEndpoint(o.endpoints[0],{timestamp:h}),o.instance._paintEndpoint(o.endpoints[1],{timestamp:h})}o.cost=n.cost||o.endpoints[0].connectionCost,o.directed=n.directed,null==n.directed&&(o.directed=o.endpoints[0].connectionsDirected);var d=Rd({},o.endpoints[1].parameters);Rd(d,o.endpoints[0].parameters),Rd(d,o.parameters),o.parameters=d,o.paintStyleInUse=o.getPaintStyle()||{},o._setConnector(o.endpoints[0].connector||o.endpoints[1].connector||n.connector||o.instance.defaults.connector,!0);var u=null!=n.data&&Fd(n.data)?n.data:{};o.setData(u);var p=[Mf,o.endpoints[0].edgeType,o.endpoints[1].edgeType,n.type].join(" ");return/[^\s]/.test(p)&&o.addType(p,n.data),o}return Sd(i,[{key:"getIdPrefix",value:function(){return"_jsPlumb_c"}},{key:"getDefaultOverlayKey",value:function(){return"connectionOverlays"}},{key:"getXY",value:function(){return{x:this.connector.x,y:this.connector.y}}},{key:"makeEndpoint",value:function(t,e,i,n,o){return i=i||this.instance.getId(e),nv(this,o,t?0:1,n,e)}},{key:"getTypeDescriptor",value:function(){return i.type}},{key:"isDetachable",value:function(t){return!1!==this.detachable&&(null!=t?!0===t.connectionsDetachable:!0===this.detachable)}},{key:"setDetachable",value:function(t){this.detachable=!0===t}},{key:"isReattach",value:function(){return!0===this.reattach||!0===this.endpoints[0].reattachConnections||!0===this.endpoints[1].reattachConnections}},{key:"setReattach",value:function(t){this.reattach=!0===t}},{key:"applyType",value:function(t,e){var n=null;null!=t.connector&&(null==(n=this.getCachedTypeItem(iv,e.connector))&&(n=this.prepareConnector(t.connector,e.connector),this.cacheTypeItem(iv,n,e.connector)),this.setPreparedConnector(n)),Od(Ad(i.prototype),"applyType",this).call(this,t,e),null!=t.detachable&&this.setDetachable(t.detachable),null!=t.reattach&&this.setReattach(t.reattach),t.scope&&(this.scope=t.scope);var o=null;t.anchor?null==(o=this.getCachedTypeItem(ev,e.anchor))&&(o=[_g(t.anchor),_g(t.anchor)],this.cacheTypeItem(ev,o,e.anchor)):t.anchors&&null==(o=this.getCachedTypeItem(ev,e.anchors))&&(o=[_g(t.anchors[0]),_g(t.anchors[1])],this.cacheTypeItem(ev,o,e.anchors)),null!=o&&(this.instance.router.setConnectionAnchors(this,o),this.instance.router.isDynamicAnchor(this.endpoints[1])&&this.instance.repaint(this.endpoints[1].element)),this.instance.applyConnectorType(this.connector,t)}},{key:"addClass",value:function(t,e){Od(Ad(i.prototype),"addClass",this).call(this,t),e&&(this.endpoints[0].addClass(t),this.endpoints[1].addClass(t),this.suspendedEndpoint&&this.suspendedEndpoint.addClass(t)),this.connector&&this.instance.addConnectorClass(this.connector,t)}},{key:"removeClass",value:function(t,e){Od(Ad(i.prototype),"removeClass",this).call(this,t),e&&(this.endpoints[0].removeClass(t),this.endpoints[1].removeClass(t),this.suspendedEndpoint&&this.suspendedEndpoint.removeClass(t)),this.connector&&this.instance.removeConnectorClass(this.connector,t)}},{key:"setVisible",value:function(t){Od(Ad(i.prototype),"setVisible",this).call(this,t),this.connector&&this.instance.setConnectorVisible(this.connector,t),this.instance._paintConnection(this)}},{key:"destroy",value:function(){Od(Ad(i.prototype),"destroy",this).call(this),this.endpoints=null,this.endpointStyles=null,this.source=null,this.target=null,this.instance.destroyConnector(this),this.connector=null,this.deleted=!0}},{key:"getUuids",value:function(){return[this.endpoints[0].getUuid(),this.endpoints[1].getUuid()]}},{key:"prepareConnector",value:function(t,e){var i,n={cssClass:this.params.cssClass,hoverClass:this.params.hoverClass,"pointer-events":this.params["pointer-events"]};if(Bd(t))i=this.instance._makeConnector(this,t,n);else{var o=t;i=this.instance._makeConnector(this,o.type,Hd(o.options||{},n))}return null!=e&&(i.typeId=e),i}},{key:"setPreparedConnector",value:function(t,e,i,n){if(this.connector!==t){var o,s="";if(null!=this.connector&&(o=this.connector,s=this.instance.getConnectorClass(this.connector),this.instance.destroyConnector(this)),this.connector=t,n&&this.cacheTypeItem(iv,t,n),this.addClass(s),null!=o){var r=this.getOverlays();for(var a in r)this.instance.reattachOverlay(r[a],this)}e||this.instance._paintConnection(this)}}},{key:"_setConnector",value:function(t,e,i,n){var o=this.prepareConnector(t,n);this.setPreparedConnector(o,e,i,n)}},{key:"replaceEndpoint",value:function(t,e){var i=this.endpoints[t],n=(i.elementId,this.instance.getEndpoints(i.element)),o=n.indexOf(i),s=nv(this,null,t,null,i.element,0,e);this.endpoints[t]=s,n.splice(o,1,s),i.detachFromConnection(this),this.instance.deleteEndpoint(i),this.instance.fire("endpoint:replaced",{previous:i,current:s})}}]),i}(Qg);function sv(t){if(null==t.path){var e=Rd({"jtk-overlay-id":t.id},t.attributes);t.path=bp(gp,e);var i=t.instance.overlayClass+" "+(t.cssClass?t.cssClass:"");t.instance.addClass(t.path,i),t.path.jtk={overlay:t}}var n=t.path.parentNode;if(null==n){if(t.component instanceof ov){var o=t.component.connector;n=null!=o?o.canvas:null}else if(t.component instanceof tv){var s=t.component.endpoint;n=null!=s?s.canvas:s}null!=n&&wp(n,t.path,1)}return t.path}Cd(ov,"type","connection"),function(t){Ed(i,t);var e=Pd(i);function i(){var t;wd(this,i);for(var n=arguments.length,o=new Array(n),s=0;s<n;s++)o[s]=arguments[s];return Cd(Td(t=e.call.apply(e,[this].concat(o))),"path",void 0),t}}(Rg);var rv=function(){function t(){wd(this,t)}return Sd(t,null,[{key:"paint",value:function(t,e,i,n){if(null!=i){var o=[t.x,t.y],s=[t.w,t.h];if(null!=n&&(n.xmin<0&&(o[0]+=n.xmin),n.ymin<0&&(o[1]+=n.ymin),s[0]=n.xmax+(n.xmin<0?-n.xmin:0),s[1]=n.ymax+(n.ymin<0?-n.ymin:0)),isFinite(s[0])&&isFinite(s[1])){var r={width:""+(s[0]||0),height:""+(s[1]||0)};e.containerType===iu.HTML?yp(t.canvas,Rd(r,{style:xp([o[0],o[1]])})):yp(t.canvas,Rd(r,{x:o[0],y:o[1]}))}}}}]),t}();function av(t,e,i,n){!function(t,e){if(null!=e.canvas)return e.canvas;var i=bp(mp,{style:"",width:"0",height:"0","pointer-events":Lu,position:$u});e.canvas=i,t._appendElement(e.canvas,t.getContainer()),null!=e.cssClass&&t.addClass(i,e.cssClass),t.addClass(i,t.connectorClass),i.jtk=i.jtk||{},i.jtk.connector=e}(t,e),rv.paint(e,t,i,n);var o=[0,0];if(n.xmin<0&&(o[0]=-n.xmin),n.ymin<0&&(o[1]=-n.ymin),e.segments.length>0){var s={d:t.getPathData(e),transform:"translate("+o[0]+","+o[1]+")","pointer-events":"visibleStroke"},r=null;if(i.outlineStroke){var a=i.outlineWidth||1,l=i.strokeWidth+2*a;(r=Rd({},i)).stroke=i.outlineStroke,r.strokeWidth=l,null==e.bgPath?(e.bgPath=bp(gp,s),t.addClass(e.bgPath,t.connectorOutlineClass),wp(e.canvas,e.bgPath,0)):yp(e.bgPath,s),_p(e.canvas,e.bgPath,r)}var c=e;null==c.path?(c.path=bp(gp,s),wp(c.canvas,c.path,i.outlineStroke?1:0)):(c.path.parentNode!==c.canvas&&wp(c.canvas,c.path,i.outlineStroke?1:0),yp(e.path,s)),_p(e.canvas,e.path,i)}}var lv=function(){function t(){wd(this,t)}return Sd(t,null,[{key:"getEndpointElement",value:function(t){if(null!=t.canvas)return t.canvas;var e=bp(mp,{style:"",width:"0",height:"0","pointer-events":"all",position:$u});t.canvas=e;var i=t.classes.join(" ");t.instance.addClass(e,i);for(var n=t.endpoint.scope.split(/\s/),o=0;o<n.length;o++)t.instance.setAttribute(e,Fu+n[o],Tf);return t.instance._appendElementToContainer(e),null!=t.cssClass&&t.instance.addClass(e,t.cssClass),t.instance.addClass(e,t.instance.endpointClass),e.jtk=e.jtk||{},e.jtk.endpoint=t.endpoint,e.style.display=!1!==t.endpoint.visible?Iu:Lu,e}},{key:"paint",value:function(t,e,i){if(!0!==t.endpoint.deleted){this.getEndpointElement(t),rv.paint(t,t.instance,i);var n=Rd({},i);n.outlineStroke&&(n.stroke=n.outlineStroke),null==t.node?(t.node=e.makeNode(t,n),t.canvas.appendChild(t.node)):null!=e.updateNode&&e.updateNode(t,t.node),_p(t.canvas,t.node,n)}}}]),t}(),cv=function(){function t(e,i){wd(this,t),this.connection=e,Cd(this,"type",void 0),Cd(this,"edited",!1),Cd(this,"stub",void 0),Cd(this,"sourceStub",void 0),Cd(this,"targetStub",void 0),Cd(this,"maxStub",void 0),Cd(this,"typeId",void 0),Cd(this,"gap",void 0),Cd(this,"sourceGap",void 0),Cd(this,"targetGap",void 0),Cd(this,"segments",[]),Cd(this,"totalLength",0),Cd(this,"segmentProportions",[]),Cd(this,"segmentProportionalLengths",[]),Cd(this,"paintInfo",null),Cd(this,"strokeWidth",void 0),Cd(this,"x",void 0),Cd(this,"y",void 0),Cd(this,"w",void 0),Cd(this,"h",void 0),Cd(this,"segment",void 0),Cd(this,"bounds",{xmin:1/0,xmax:-1/0,ymin:1/0,ymax:-1/0}),Cd(this,"cssClass",void 0),Cd(this,"hoverClass",void 0),Cd(this,"geometry",void 0),this.stub=i.stub||this.getDefaultStubs(),this.sourceStub=Array.isArray(this.stub)?this.stub[0]:this.stub,this.targetStub=Array.isArray(this.stub)?this.stub[1]:this.stub,this.gap=i.gap||0,this.sourceGap=Array.isArray(this.gap)?this.gap[0]:this.gap,this.targetGap=Array.isArray(this.gap)?this.gap[1]:this.gap,this.maxStub=Math.max(this.sourceStub,this.targetStub),this.cssClass=i.cssClass||"",this.hoverClass=i.hoverClass||""}return Sd(t,[{key:"getTypeDescriptor",value:function(){return"connector"}},{key:"getIdPrefix",value:function(){return"_jsplumb_connector"}},{key:"setGeometry",value:function(t,e){this.geometry=t,this.edited=null!=t&&!e}},{key:"exportGeometry",value:function(){return this.geometry}},{key:"importGeometry",value:function(t){return this.geometry=t,!0}},{key:"resetGeometry",value:function(){this.geometry=null,this.edited=!1}},{key:"transformAnchorPlacement",value:function(t,e,i){return{x:t.x,y:t.y,ox:t.ox,oy:t.oy,curX:t.curX+e,curY:t.curY+i}}},{key:"resetBounds",value:function(){this.bounds={xmin:1/0,xmax:-1/0,ymin:1/0,ymax:-1/0}}},{key:"findSegmentForPoint",value:function(t,e){for(var i={d:1/0,s:null,x:null,y:null,l:null,x1:null,y1:null,x2:null,y2:null,index:null,connectorLocation:null},n=0;n<this.segments.length;n++){var o=this.segments[n].findClosestPointOnPath(t,e);o.d<i.d&&(i.d=o.d,i.l=o.l,i.x=o.x,i.y=o.y,i.s=this.segments[n],i.x1=o.x1,i.x2=o.x2,i.y1=o.y1,i.y2=o.y2,i.index=n,i.connectorLocation=this.segmentProportions[n][0]+o.l*(this.segmentProportions[n][1]-this.segmentProportions[n][0]))}return i}},{key:"lineIntersection",value:function(t,e,i,n){for(var o=[],s=0;s<this.segments.length;s++)o.push.apply(o,this.segments[s].lineIntersection(t,e,i,n));return o}},{key:"boxIntersection",value:function(t,e,i,n){for(var o=[],s=0;s<this.segments.length;s++)o.push.apply(o,this.segments[s].boxIntersection(t,e,i,n));return o}},{key:"boundingBoxIntersection",value:function(t){for(var e=[],i=0;i<this.segments.length;i++)e.push.apply(e,this.segments[i].boundingBoxIntersection(t));return e}},{key:"_updateSegmentProportions",value:function(){for(var t=0,e=0;e<this.segments.length;e++){var i=this.segments[e].getLength();this.segmentProportionalLengths[e]=i/this.totalLength,this.segmentProportions[e]=[t,t+=i/this.totalLength]}}},{key:"_findSegmentForLocation",value:function(t,e){var i,n,o;if(e&&(t=t>0?t/this.totalLength:(this.totalLength+t)/this.totalLength),1===t)i=this.segments.length-1,o=1;else if(0===t)o=0,i=0;else if(t>=.5){for(i=0,o=0,n=this.segmentProportions.length-1;n>-1;n--)if(this.segmentProportions[n][1]>=t&&this.segmentProportions[n][0]<=t){i=n,o=(t-this.segmentProportions[n][0])/this.segmentProportionalLengths[n];break}}else for(i=this.segmentProportions.length-1,o=1,n=0;n<this.segmentProportions.length;n++)if(this.segmentProportions[n][1]>=t){i=n,o=(t-this.segmentProportions[n][0])/this.segmentProportionalLengths[n];break}return{segment:this.segments[i],proportion:o,index:i}}},{key:"_addSegment",value:function(t,e){if(e.x1!==e.x2||e.y1!==e.y2){var i=new t(e);this.segments.push(i),this.totalLength+=i.getLength(),this.updateBounds(i)}}},{key:"_clearSegments",value:function(){this.totalLength=0,this.segments.length=0,this.segmentProportions.length=0,this.segmentProportionalLengths.length=0}},{key:"getLength",value:function(){return this.totalLength}},{key:"_prepareCompute",value:function(t){this.strokeWidth=t.strokeWidth;var e=t.sourcePos.curX,i=t.targetPos.curX,n=t.sourcePos.curY,o=t.targetPos.curY,s=am({x:e,y:n},{x:i,y:o}),r=i<e,a=o<n,l=[t.sourcePos.ox,t.sourcePos.oy],c=[t.targetPos.ox,t.targetPos.oy],h=r?i:e,d=a?o:n,u=Math.abs(i-e),p=Math.abs(o-n),f=0===l[0]&&0===l[1],m=0===c[0]&&0===c[1];if(f||m){var g=u>p?0:1,v=[1,0][g],y=0===g?e:n,b=0===g?i:o;f&&(l[g]=y>b?-1:1,l[v]=0),m&&(c[g]=y>b?1:-1,c[v]=0)}var x=r?u+this.sourceGap*l[0]:this.sourceGap*l[0],_=a?p+this.sourceGap*l[1]:this.sourceGap*l[1],w=r?this.targetGap*c[0]:u+this.targetGap*c[0],k=a?this.targetGap*c[1]:p+this.targetGap*c[1],S=l[0]*c[0]+l[1]*c[1],C={sx:x,sy:_,tx:w,ty:k,xSpan:Math.abs(w-x),ySpan:Math.abs(k-_),mx:(x+w)/2,my:(_+k)/2,so:l,to:c,x:h,y:d,w:u,h:p,segment:s,startStubX:x+l[0]*this.sourceStub,startStubY:_+l[1]*this.sourceStub,endStubX:w+c[0]*this.targetStub,endStubY:k+c[1]*this.targetStub,isXGreaterThanStubTimes2:Math.abs(x-w)>this.sourceStub+this.targetStub,isYGreaterThanStubTimes2:Math.abs(_-k)>this.sourceStub+this.targetStub,opposite:-1===S,perpendicular:0===S,orthogonal:1===S,sourceAxis:0===l[0]?"y":"x",points:[h,d,u,p,x,_,w,k],stubs:[this.sourceStub,this.targetStub]};return C.anchorOrientation=C.opposite?"opposite":C.orthogonal?"orthogonal":"perpendicular",C}},{key:"updateBounds",value:function(t){var e=t.extents;this.bounds.xmin=Math.min(this.bounds.xmin,e.xmin),this.bounds.xmax=Math.max(this.bounds.xmax,e.xmax),this.bounds.ymin=Math.min(this.bounds.ymin,e.ymin),this.bounds.ymax=Math.max(this.bounds.ymax,e.ymax)}},{key:"dumpSegmentsToConsole",value:function(){cu("SEGMENTS:");for(var t=0;t<this.segments.length;t++)cu(this.segments[t].type,""+this.segments[t].getLength(),""+this.segmentProportions[t])}},{key:"pointOnPath",value:function(t,e){var i=this._findSegmentForLocation(t,e);return i.segment&&i.segment.pointOnPath(i.proportion,!1)||{x:0,y:0}}},{key:"gradientAtPoint",value:function(t,e){var i=this._findSegmentForLocation(t,e);return i.segment&&i.segment.gradientAtPoint(i.proportion,!1)||0}},{key:"pointAlongPathFrom",value:function(t,e,i){var n=this._findSegmentForLocation(t,i);return n.segment&&n.segment.pointAlongPathFrom(n.proportion,e,!1)||{x:0,y:0}}},{key:"compute",value:function(t){this.paintInfo=this._prepareCompute(t),this._clearSegments(),this._compute(this.paintInfo,t),this.x=this.paintInfo.points[0],this.y=this.paintInfo.points[1],this.w=this.paintInfo.points[2],this.h=this.paintInfo.points[3],this.segment=this.paintInfo.segment,this._updateSegmentProportions()}},{key:"setAnchorOrientation",value:function(t,e){}}]),t}(),hv=function(t){Ed(i,t);var e=Pd(i);function i(t,n,o){var s;return wd(this,i),(s=e.call(this,t,n,o)).instance=t,s.component=n,Cd(Td(s),"width",void 0),Cd(Td(s),"length",void 0),Cd(Td(s),"foldback",void 0),Cd(Td(s),"direction",void 0),Cd(Td(s),"location",.5),Cd(Td(s),"paintStyle",void 0),Cd(Td(s),"type",i.type),Cd(Td(s),"cachedDimensions",void 0),o=o||{},s.width=o.width||20,s.length=o.length||20,s.direction=(o.direction||1)<0?-1:1,s.foldback=o.foldback||.623,s.paintStyle=o.paintStyle||{strokeWidth:1},s.location=null==o.location?s.location:Array.isArray(o.location)?o.location[0]:o.location,s}return Sd(i,[{key:"draw",value:function(t,e,i){if(t instanceof cv){var n,o,s,r=t;if(this.location>1||this.location<0){var a=this.location<0?1:0;o=cm(n=r.pointAlongPathFrom(a,this.location,!1),r.pointAlongPathFrom(a,this.location-this.direction*this.length/2,!1),this.length)}else if(1===this.location){if(o=cm(n=r.pointOnPath(this.location),r.pointAlongPathFrom(this.location,-this.length),this.length),-1===this.direction){var l=o;o=n,n=l}}else if(0===this.location){if(n=cm(o=r.pointOnPath(this.location),r.pointAlongPathFrom(this.location,this.length),this.length),-1===this.direction){var c=o;o=n,n=c}}else o=cm(n=r.pointAlongPathFrom(this.location,this.direction*this.length/2),r.pointOnPath(this.location),this.length);s=function(t,e,i){var n=sm(t,e),o=Math.atan(-1/n),s=i/2*Math.sin(o),r=i/2*Math.cos(o);return[{x:e.x+r,y:e.y+s},{x:e.x-r,y:e.y-s}]}(n,o,this.width);var h={hxy:n,tail:s,cxy:cm(n,o,this.foldback*this.length)},d=this.paintStyle.stroke||e.stroke,u=this.paintStyle.fill||e.stroke;return{component:t,d:h,"stroke-width":this.paintStyle.strokeWidth||e.strokeWidth,stroke:d,fill:u,xmin:Math.min(n.x,s[0].x,s[1].x),xmax:Math.max(n.x,s[0].x,s[1].x),ymin:Math.min(n.y,s[0].y,s[1].y),ymax:Math.max(n.y,s[0].y,s[1].y)}}}},{key:"updateFrom",value:function(t){}}]),i}(Rg);function dv(t){return t.type===hv.type}Cd(hv,"type","Arrow"),jg(hv.type,hv);var uv=function(t){Ed(i,t);var e=Pd(i);function i(t,n,o){var s;return wd(this,i),(s=e.call(this,t,n,o)).instance=t,Cd(Td(s),"type",i.type),s.length=s.length/2,s.foldback=2,s}return i}(hv);function pv(t){return t.type===uv.type}Cd(uv,"type","Diamond"),jg(uv.type,uv);var fv=function(t){Ed(i,t);var e=Pd(i);function i(t,n,o){var s;return wd(this,i),(s=e.call(this,t,n,o)).instance=t,Cd(Td(s),"type",i.type),s.foldback=1,s}return i}(hv);function mv(t){return t.type===fv.type}Cd(fv,"type","PlainArrow"),jg("PlainArrow",fv);var gv=function(t){Ed(i,t);var e=Pd(i);function i(t,n,o){var s;return wd(this,i),(s=e.call(this,t,n,o)).instance=t,s.component=n,Cd(Td(s),"create",void 0),Cd(Td(s),"type",i.type),s.create=o.create,s}return Sd(i,[{key:"updateFrom",value:function(t){}}]),i}(Rg);function vv(t){return t.type===gv.type}Cd(gv,"type","Custom"),jg(gv.type,gv);var yv="paintStyle",bv=function(t){Ed(i,t);var e=Pd(i);function i(t,n){var o;return wd(this,i),Cd(Td(o=e.call(this,t,n)),"radius",void 0),Cd(Td(o),"defaultOffset",void 0),Cd(Td(o),"defaultInnerRadius",void 0),Cd(Td(o),"type",i.type),n=n||{},o.radius=n.radius||5,o.defaultOffset=.5*o.radius,o.defaultInnerRadius=o.radius/3,o}return i}(Xm);Cd(bv,"type","Dot");var xv={type:bv.type,cls:bv,compute:function(t,e,i,n){var o=e.curX-t.radius,s=e.curY-t.radius,r=2*t.radius,a=2*t.radius;if(n&&n.stroke){var l=n.strokeWidth||1;o-=l,s-=l,r+=2*l,a+=2*l}return t.x=o,t.y=s,t.w=r,t.h=a,[o,s,r,a,t.radius]},getParams:function(t){return{radius:t.radius}}},_v=function t(e,i){wd(this,t),this.instance=e,this.el=i,Cd(this,"group",void 0)},wv=function(t){Ed(i,t);var e=Pd(i);function i(t,n,o){var s;wd(this,i),(s=e.call(this,t,n)).instance=t,Cd(Td(s),"children",[]),Cd(Td(s),"collapsed",!1),Cd(Td(s),"droppable",void 0),Cd(Td(s),"enabled",void 0),Cd(Td(s),"orphan",void 0),Cd(Td(s),"constrain",void 0),Cd(Td(s),"proxied",void 0),Cd(Td(s),"ghost",void 0),Cd(Td(s),"revert",void 0),Cd(Td(s),"prune",void 0),Cd(Td(s),"dropOverride",void 0),Cd(Td(s),"anchor",void 0),Cd(Td(s),"endpoint",void 0),Cd(Td(s),"connections",{source:[],target:[],internal:[]}),Cd(Td(s),"manager",void 0),Cd(Td(s),"id",void 0),Cd(Td(s),"elId",void 0);var r=s.el;return r._isJsPlumbGroup=!0,r._jsPlumbGroup=Td(s),s.elId=t.getId(n),s.orphan=!0===o.orphan,s.revert=!0!==s.orphan&&!1!==o.revert,s.droppable=!1!==o.droppable,s.ghost=!0===o.ghost,s.enabled=!1!==o.enabled,s.prune=!0!==s.orphan&&!0===o.prune,s.constrain=s.ghost||!0===o.constrain,s.proxied=!1!==o.proxied,s.id=o.id||su(),s.dropOverride=!0===o.dropOverride,s.anchor=o.anchor,s.endpoint=o.endpoint,s.anchor=o.anchor,t.setAttribute(n,Ru,""),s}return Sd(i,[{key:"contentArea",get:function(){return this.instance.getGroupContentArea(this)}},{key:"overrideDrop",value:function(t,e){return this.dropOverride&&(this.revert||this.prune||this.orphan)}},{key:"getAnchor",value:function(t,e){return this.anchor||"Continuous"}},{key:"getEndpoint",value:function(t,e){return this.endpoint||{type:bv.type,options:{radius:10}}}},{key:"add",value:function(t,e){var i=this.instance.getGroupContentArea(this),n=t;if(null!=n._jsPlumbParentGroup){if(n._jsPlumbParentGroup===this)return;n._jsPlumbParentGroup.remove(t,!0,e,!1)}n._jsPlumbParentGroup=this,this.children.push(new _v(this.instance,t)),this.instance._appendElement(n,i),this.manager._updateConnectionsForGroup(this)}},{key:"resolveNode",value:function(t){return null==t?null:Yd(this.children,(function(e){return e.el===t}))}},{key:"remove",value:function(t,e,i,n,o){var s=this.resolveNode(t);null!=s&&this._doRemove(s,e,i,n,o)}},{key:"_doRemove",value:function(t,e,i,n,o){var s=t.el;if(delete s._jsPlumbParentGroup,Kd(this.children,(function(e){return e===t})),e)try{this.instance.getGroupContentArea(this).removeChild(s)}catch(t){cu("Could not remove element from Group "+t)}if(!i){var r={group:this,el:s};o&&(r.targetGroup=o),this.instance.fire("group:member:removed",r)}n||this.manager._updateConnectionsForGroup(this)}},{key:"removeAll",value:function(t,e){for(var i=0,n=this.children.length;i<n;i++){var o=this.children[0];this._doRemove(o,t,e,!0),this.instance.unmanage(o.el,!0)}this.children.length=0,this.manager._updateConnectionsForGroup(this)}},{key:"orphanAll",value:function(){for(var t={},e=0;e<this.children.length;e++){var i=this.manager.orphan(this.children[e].el,!1);t[i.id]=i.pos}return this.children.length=0,t}},{key:"addGroup",value:function(t){if(this.instance.allowNestedGroups&&t!==this){if(this.instance.groupManager.isAncestor(this,t))return!1;null!=t.group&&t.group.removeGroup(t);var e=this.instance.getId(t.el);this.instance.getManagedElements()[e].group=this.elId;var i=this.instance.getOffsetRelativeToRoot(t.el),n=this.collapsed?this.instance.getOffsetRelativeToRoot(this.el):this.instance.getOffsetRelativeToRoot(this.instance.getGroupContentArea(this));t.el._jsPlumbParentGroup=this,this.children.push(t),this.instance._appendElementToGroup(this,t.el),t.group=this;var o={x:i.x-n.x,y:i.y-n.y};return this.instance.setPosition(t.el,o),this.instance.fire("group:nested:added",{parent:this,child:t}),!0}return!1}},{key:"removeGroup",value:function(t){if(t.group===this){var e=t.el,i=this.instance.getGroupContentArea(this);i===e.parentNode&&i.removeChild(t.el);var n=this.instance.getId(t.el),o=this.instance.getManagedElements()[n];o&&delete o.group,this.children=this.children.filter((function(e){return e.id!==t.id})),delete t.group,delete e._jsPlumbParentGroup,this.instance.fire("group:nested:removed",{parent:this,child:t})}}},{key:"getGroups",value:function(){return this.children.filter((function(t){return t.constructor===i}))}},{key:"getNodes",value:function(){return this.children.filter((function(t){return t.constructor===_v}))}},{key:"collapseParent",get:function(){var t=null;if(null==this.group)return null;for(var e=this.group;null!=e;)e.collapsed&&(t=e),e=e.group;return t}}]),i}(_v),kv=function(){function t(e){var i=this;wd(this,t),this.instance=e,Cd(this,"groupMap",{}),Cd(this,"_connectionSourceMap",{}),Cd(this,"_connectionTargetMap",{}),e.bind(Xu,(function(t){var e=i.getGroupFor(t.source),n=i.getGroupFor(t.target);null!=e&&null!=n&&e===n?(i._connectionSourceMap[t.connection.id]=e,i._connectionTargetMap[t.connection.id]=e,eu(e.connections.internal,t.connection)):(null!=e&&(t.target._jsPlumbGroup===e?eu(e.connections.internal,t.connection):eu(e.connections.source,t.connection),i._connectionSourceMap[t.connection.id]=e),null!=n&&(t.source._jsPlumbGroup===n?eu(n.connections.internal,t.connection):eu(n.connections.target,t.connection),i._connectionTargetMap[t.connection.id]=n))})),e.bind(Ju,(function(t){i._cleanupDetachedConnection(t.connection)})),e.bind(Ku,(function(t){var e=t.originalEndpoint.element,n=i.getGroupFor(e),o=t.connection.endpoints[t.index].element,s=i.getGroupFor(o),r=0===t.index?i._connectionSourceMap:i._connectionTargetMap,a=0===t.index?i._connectionTargetMap:i._connectionSourceMap;null!=s?(r[t.connection.id]=s,t.connection.source===t.connection.target&&(a[t.connection.id]=s)):(delete r[t.connection.id],t.connection.source===t.connection.target&&delete a[t.connection.id]),null!=n&&i._updateConnectionsForGroup(n),null!=s&&i._updateConnectionsForGroup(s)}))}return Sd(t,[{key:"_cleanupDetachedConnection",value:function(t){t.proxies.length=0;var e,i=this._connectionSourceMap[t.id];null!=i&&(e=function(e){return e.id===t.id},Kd(i.connections.source,e),Kd(i.connections.target,e),Kd(i.connections.internal,e),delete this._connectionSourceMap[t.id]),null!=(i=this._connectionTargetMap[t.id])&&(e=function(e){return e.id===t.id},Kd(i.connections.source,e),Kd(i.connections.target,e),Kd(i.connections.internal,e),delete this._connectionTargetMap[t.id])}},{key:"addGroup",value:function(t){var e=t.el;if(null!=this.groupMap[t.id])throw new Error("cannot create Group ["+t.id+"]; a Group with that ID exists");if(null!=e._isJsPlumbGroup)throw new Error("cannot create Group ["+t.id+"]; the given element is already a Group");var i=new wv(this.instance,t.el,t);return this.groupMap[i.id]=i,t.collapsed&&this.collapseGroup(i),this.instance.manage(i.el),this.instance.addClass(i.el,Gu),i.manager=this,this._updateConnectionsForGroup(i),this.instance.fire("group:added",{group:i}),i}},{key:"getGroup",value:function(t){var e=t;if(Bd(t)&&null==(e=this.groupMap[t]))throw new Error("No such group ["+t+"]");return e}},{key:"getGroupFor",value:function(t){for(var e=t,i=this.instance.getContainer(),n=!1,o=null;!n;)null==e||e===i?n=!0:e._jsPlumbParentGroup?(o=e._jsPlumbParentGroup,n=!0):e=e.parentNode;return o}},{key:"getGroups",value:function(){var t=[];for(var e in this.groupMap)t.push(this.groupMap[e]);return t}},{key:"removeGroup",value:function(t,e,i,n){var o=this,s=this.getGroup(t);this.expandGroup(s,!0);var r={};return Gd(s.children,(function(t){var e=o.instance.getManagedElements()[o.instance.getId(t.el)];e&&delete e.group})),e?(Gd(s.getGroups(),(function(t){return o.removeGroup(t,e,i)})),s.removeAll(i,n)):(s.group&&Gd(s.children,(function(t){return s.group.add(t.el)})),r=s.orphanAll()),s.group&&s.group.removeGroup(s),this.instance.unmanage(s.el,!0),delete this.groupMap[s.id],this.instance.fire("group:removed",{group:s}),r}},{key:"removeAllGroups",value:function(t,e,i){for(var n in this.groupMap)this.removeGroup(this.groupMap[n],t,e,i)}},{key:"forEach",value:function(t){for(var e in this.groupMap)t(this.groupMap[e])}},{key:"orphan",value:function(t,e){var i=t;if(i._jsPlumbParentGroup){var n=i._jsPlumbParentGroup,o=this.instance.getId(i),s=this.instance.getOffset(t);return!0!==e&&n.group?this.instance._appendElementToGroup(n.group,t):this.instance._appendElementToContainer(t),this.instance.setPosition(t,s),delete i._jsPlumbParentGroup,{id:o,pos:s}}}},{key:"_updateConnectionsForGroup",value:function(t){var e=this;t.connections.source.length=0,t.connections.target.length=0,t.connections.internal.length=0;var i=t.children.slice().map((function(t){return t.el})),n=[];if(Gd(i,(function(t){Array.prototype.push.apply(n,e.instance.getSelector(t,ap))})),Array.prototype.push.apply(i,n),i.length>0){var o,s,r=this.instance.getConnections({source:i,scope:Of},!0),a=this.instance.getConnections({target:i,scope:Of},!0),l={},c=function(i){for(var n=0;n<i.length;n++)l[i[n].id]||(l[i[n].id]=!0,o=e.getGroupFor(i[n].source),s=e.getGroupFor(i[n].target),i[n].source===t.el&&s===t||i[n].target===t.el&&o===t?t.connections.internal.push(i[n]):o===t?(s!==t?t.connections.source.push(i[n]):t.connections.internal.push(i[n]),e._connectionSourceMap[i[n].id]=t):s===t&&(t.connections.target.push(i[n]),e._connectionTargetMap[i[n].id]=t))};c(r),c(a)}}},{key:"_collapseConnection",value:function(t,e,i){var n=t.endpoints[0===e?1:0].element;if(n._jsPlumbParentGroup&&!n._jsPlumbParentGroup.proxied&&n._jsPlumbParentGroup.collapsed)return!1;var o=t.endpoints[0].element._jsPlumbParentGroup,s=null!=o?o.collapseParent||o:null,r=t.endpoints[1].element._jsPlumbParentGroup,a=null!=r?r.collapseParent||r:null;if(null==s||null==a||s.id!==a.id){var l=i.el;return this.instance.getId(l),this.instance.proxyConnection(t,e,l,(function(t,e){return i.getEndpoint(t,e)}),(function(t,e){return i.getAnchor(t,e)})),!0}return!1}},{key:"_expandConnection",value:function(t,e,i){this.instance.unproxyConnection(t,e)}},{key:"isElementDescendant",value:function(t,e){for(var i=this.instance.getContainer();;){if(null==t||t===i)return!1;if(t===e)return!0;t=t.parentNode}}},{key:"collapseGroup",value:function(t){var e=this,i=this.getGroup(t);if(null!=i&&!i.collapsed){var n=i.el;if(null==i.collapseParent){if(this.instance.setGroupVisible(i,!1),i.collapsed=!0,this.instance.removeClass(n,Gu),this.instance.addClass(n,Wu),i.proxied){var o=new Set,s=function(t,n){for(var s=0;s<t.length;s++){var r=t[s];!0===e._collapseConnection(r,n,i)&&o.add(r.id)}};s(i.connections.source,0),s(i.connections.target,1),Gd(i.getGroups(),(function(t){e.cascadeCollapse(i,t,o)}))}this.instance.revalidate(n),this.repaintGroup(i),this.instance.fire("group:collapse",{group:i})}else i.collapsed=!0,this.instance.removeClass(n,Gu),this.instance.addClass(n,Wu)}}},{key:"cascadeCollapse",value:function(t,e,i){var n=this;if(t.proxied){var o=function(e,o){for(var s=0;s<e.length;s++){var r=e[s];i.has(r.id)||!0===n._collapseConnection(r,o,t)&&i.add(r.id)}};o(e.connections.source,0),o(e.connections.target,1)}Gd(e.getGroups(),(function(e){n.cascadeCollapse(t,e,i)}))}},{key:"expandGroup",value:function(t,e){var i=this,n=this.getGroup(t);if(null!=n){var o=n.el;if(null==n.collapseParent){if(this.instance.setGroupVisible(n,!0),n.collapsed=!1,this.instance.addClass(o,Gu),this.instance.removeClass(o,Wu),n.proxied){var s=function(t,e){for(var o=0;o<t.length;o++){var s=t[o];i._expandConnection(s,e,n)}};s(n.connections.source,0),s(n.connections.target,1);Gd(n.getGroups(),(function t(e,n){if(n||e.collapsed){var o=function(t,n){for(var o=0;o<t.length;o++){var s=t[o];i._collapseConnection(s,n,e.collapseParent||e)}};o(e.connections.source,0),o(e.connections.target,1),Gd(e.connections.internal,(function(t){return t.setVisible(!1)})),Gd(e.getGroups(),(function(e){return t(e,!0)}))}else i.expandGroup(e,!0)}))}this.instance.revalidate(o),this.repaintGroup(n),e||this.instance.fire("group:expand",{group:n})}else n.collapsed=!1,this.instance.addClass(o,Gu),this.instance.removeClass(o,Wu)}}},{key:"toggleGroup",value:function(t){null!=(t=this.getGroup(t))&&(t.collapsed?this.expandGroup(t):this.collapseGroup(t))}},{key:"repaintGroup",value:function(t){for(var e=this.getGroup(t).children,i=0;i<e.length;i++)this.instance.revalidate(e[i].el)}},{key:"addToGroup",value:function(t,e){var i=this,n=this.getGroup(t);if(n){for(var o=n.el,s=arguments.length,r=new Array(s>2?s-2:0),a=2;a<s;a++)r[a-2]=arguments[a];Gd(r,(function(t){var s=t,r=null!=s._isJsPlumbGroup,a=s._jsPlumbGroup,l=s._jsPlumbParentGroup;if(l!==n){var c=i.instance.manage(t),h=i.instance.getOffset(t),d=n.collapsed?i.instance.getOffsetRelativeToRoot(o):i.instance.getOffset(i.instance.getGroupContentArea(n));c.group=n.elId,null!=l&&(l.remove(t,!1,e,!1,n),i._updateConnectionsForGroup(l)),r?n.addGroup(a):n.add(t,e);var u=function(t,e){var o=0===e?1:0;t.each((function(t){t.setVisible(!1),t.endpoints[o].element._jsPlumbGroup===n?(t.endpoints[o].setVisible(!1),i._expandConnection(t,o,n)):(t.endpoints[e].setVisible(!1),i._collapseConnection(t,e,n))}))};n.collapsed&&(u(i.instance.select({source:t}),0),u(i.instance.select({target:t}),1)),i.instance.getId(t);var p={x:h.x-d.x,y:h.y-d.y};if(i.instance.setPosition(t,p),i._updateConnectionsForGroup(n),i.instance.revalidate(t),!e){var f={group:n,el:t,pos:p};l&&(f.sourceGroup=l),i.instance.fire("group:member:added",f)}}}))}}},{key:"removeFromGroup",value:function(t,e){var i=this,n=this.getGroup(t);if(n){for(var o=arguments.length,s=new Array(o>2?o-2:0),r=2;r<o;r++)s[r-2]=arguments[r];Gd(s,(function(t){if(n.collapsed){var o=function(e,o){for(var s=0;s<e.length;s++){var r=e[s];if(r.proxies)for(var a=0;a<r.proxies.length;a++)if(null!=r.proxies[a]){var l=r.proxies[a].originalEp.element;(l===t||i.isElementDescendant(l,t))&&i._expandConnection(r,o,n)}}};o(n.connections.source.slice(),0),o(n.connections.target.slice(),1)}n.remove(t,null,e);var s=i.instance.getManagedElements()[i.instance.getId(t)];s&&delete s.group}))}}},{key:"getAncestors",value:function(t){for(var e=[],i=t.group;null!=i;)e.push(i),i=i.group;return e}},{key:"isAncestor",value:function(t,e){return null!=t&&null!=e&&-1!==this.getAncestors(t).indexOf(e)}},{key:"getDescendants",value:function(t){var e=[];return function t(i){var n=i.getGroups();e.push.apply(e,Id(n)),Gd(n,t)}(t),e}},{key:"isDescendant",value:function(t,e){return null!=t&&null!=e&&-1!==this.getDescendants(e).indexOf(t)}},{key:"reset",value:function(){this._connectionSourceMap={},this._connectionTargetMap={},this.groupMap={}}}]),t}(),Sv=function(){function t(e,i){wd(this,t),this.instance=e,this.entries=i}return Sd(t,[{key:"length",get:function(){return this.entries.length}},{key:"each",value:function(t){return Gd(this.entries,(function(e){return t(e)})),this}},{key:"get",value:function(t){return this.entries[t]}},{key:"addClass",value:function(t,e){return this.each((function(i){return i.addClass(t,e)})),this}},{key:"removeClass",value:function(t,e){return this.each((function(i){return i.removeClass(t,e)})),this}},{key:"removeAllOverlays",value:function(){return this.each((function(t){return t.removeAllOverlays()})),this}},{key:"setLabel",value:function(t){return this.each((function(e){return e.setLabel(t)})),this}},{key:"clear",value:function(){return this.entries.length=0,this}},{key:"map",value:function(t){var e=[];return this.each((function(i){return e.push(t(i))})),e}},{key:"addOverlay",value:function(t){return this.each((function(e){return e.addOverlay(t)})),this}},{key:"removeOverlay",value:function(t){return this.each((function(e){return e.removeOverlay(t)})),this}},{key:"removeOverlays",value:function(){return this.each((function(t){return t.removeOverlays()})),this}},{key:"showOverlay",value:function(t){return this.each((function(e){return e.showOverlay(t)})),this}},{key:"hideOverlay",value:function(t){return this.each((function(e){return e.hideOverlay(t)})),this}},{key:"setPaintStyle",value:function(t){return this.each((function(e){return e.setPaintStyle(t)})),this}},{key:"setHoverPaintStyle",value:function(t){return this.each((function(e){return e.setHoverPaintStyle(t)})),this}},{key:"setSuspendEvents",value:function(t){return this.each((function(e){return e.setSuspendEvents(t)})),this}},{key:"setParameter",value:function(t,e){return this.each((function(i){return i.parameters[t]=e})),this}},{key:"setParameters",value:function(t){return this.each((function(e){return e.parameters=t})),this}},{key:"setVisible",value:function(t){return this.each((function(e){return e.setVisible(t)})),this}},{key:"addType",value:function(t){return this.each((function(e){return e.addType(t)})),this}},{key:"toggleType",value:function(t){return this.each((function(e){return e.toggleType(t)})),this}},{key:"removeType",value:function(t){return this.each((function(e){return e.removeType(t)})),this}},{key:"bind",value:function(t,e){return this.each((function(i){return i.bind(t,e)})),this}},{key:"unbind",value:function(t,e){return this.each((function(i){return i.unbind(t,e)})),this}},{key:"setHover",value:function(t){var e=this;return this.each((function(i){return e.instance.setHover(i,t)})),this}}]),t}(),Cv=function(t){Ed(i,t);var e=Pd(i);function i(){return wd(this,i),e.apply(this,arguments)}return Sd(i,[{key:"setEnabled",value:function(t){return this.each((function(e){return e.enabled=t})),this}},{key:"setAnchor",value:function(t){return this.each((function(e){return e.setAnchor(t)})),this}},{key:"deleteEveryConnection",value:function(){return this.each((function(t){return t.deleteEveryConnection()})),this}},{key:"deleteAll",value:function(){var t=this;return this.each((function(e){return t.instance.deleteEndpoint(e)})),this.clear(),this}}]),i}(Sv),Ev=function(t){Ed(i,t);var e=Pd(i);function i(){return wd(this,i),e.apply(this,arguments)}return Sd(i,[{key:"setDetachable",value:function(t){return this.each((function(e){return e.setDetachable(t)})),this}},{key:"setReattach",value:function(t){return this.each((function(e){return e.setReattach(t)})),this}},{key:"setConnector",value:function(t){return this.each((function(e){return e._setConnector(t)})),this}},{key:"deleteAll",value:function(){var t=this;this.each((function(e){return t.instance.deleteConnection(e)})),this.clear()}},{key:"repaint",value:function(){var t=this;return this.each((function(e){return t.instance._paintConnection(e)})),this}}]),i}(Sv),Av=function t(){wd(this,t),Cd(this,"affectedElements",new Set)};function Mv(){return{x:0,y:0,w:0,h:0,r:0,c:{x:0,y:0},x2:0,y2:0,t:{x:0,y:0,c:{x:0,y:0},w:0,h:0,r:0,x2:0,y2:0,cr:0,sr:0},dirty:!0}}var Tv=function(t,e){var i=0;return e[1]>t[1]?i=-1:e[1]<t[1]&&(i=1),i},Pv=function(t,e){return-1*Tv(t,e)};function Ov(t,e,i,n){!function(t,e,i,n){if(0===e.length)e.push(t);else{for(var o=n?-1:1,s=0,r=e.length,a=Math.floor((s+r)/2);r>s;)i(t,e[a])*o<0?r=a:s=a+1,a=Math.floor((s+r)/2);e.splice(a,0,t)}}([t,e],i,Tv,n)}function Dv(t,e){var i=Zd(e,(function(e){return e[0]===t}));i>-1&&e.splice(i,1)}var Iv,Lv=function(t){Ed(i,t);var e=Pd(i);function i(t){var n;return wd(this,i),(n=e.call(this)).instance=t,Cd(Td(n),"_currentTransaction",null),Cd(Td(n),"_sortedElements",{xmin:[],xmax:[],ymin:[],ymax:[]}),Cd(Td(n),"_elementMap",new Map),Cd(Td(n),"_transformedElementMap",new Map),Cd(Td(n),"_bounds",{minx:0,maxx:0,miny:0,maxy:0}),n}return Sd(i,[{key:"_updateBounds",value:function(t,e,i){null!=e&&(Dv(t,this._sortedElements.xmin),Dv(t,this._sortedElements.xmax),Dv(t,this._sortedElements.ymin),Dv(t,this._sortedElements.ymax),Ov(t,e.t.x,this._sortedElements.xmin,!1),Ov(t,e.t.x+e.t.w,this._sortedElements.xmax,!0),Ov(t,e.t.y,this._sortedElements.ymin,!1),Ov(t,e.t.y+e.t.h,this._sortedElements.ymax,!0),!0!==i&&this._recalculateBounds())}},{key:"_recalculateBounds",value:function(){this._bounds.minx=this._sortedElements.xmin.length>0?this._sortedElements.xmin[0][1]:0,this._bounds.maxx=this._sortedElements.xmax.length>0?this._sortedElements.xmax[0][1]:0,this._bounds.miny=this._sortedElements.ymin.length>0?this._sortedElements.ymin[0][1]:0,this._bounds.maxy=this._sortedElements.ymax.length>0?this._sortedElements.ymax[0][1]:0}},{key:"recomputeBounds",value:function(){var t=this;this._sortedElements.xmin.length=0,this._sortedElements.xmax.length=0,this._sortedElements.ymin.length=0,this._sortedElements.ymax.length=0,this._elementMap.forEach((function(e,i){t._sortedElements.xmin.push([i,e.t.x]),t._sortedElements.xmax.push([i,e.t.x+e.t.w]),t._sortedElements.ymin.push([i,e.t.y]),t._sortedElements.ymax.push([i,e.t.y+e.t.h])})),this._sortedElements.xmin.sort(Tv),this._sortedElements.ymin.sort(Tv),this._sortedElements.xmax.sort(Pv),this._sortedElements.ymax.sort(Pv),this._recalculateBounds()}},{key:"_finaliseUpdate",value:function(t,e,i){e.t=function(t,e,i,n,o){var s=t+i/2,r=e+n/2,a=Math.cos(o/360*Math.PI*2),l=Math.sin(o/360*Math.PI*2),c=function(t,e){return{x:s+Math.round((t-s)*a-(e-r)*l),y:r+Math.round((e-r)*a-(t-s)*l)}},h=c(t,e),d=c(t+i,e),u=c(t+i,e+n),p=c(t,e+n),f=c(t+i/2,e+n/2),m=Math.min(h.x,d.x,u.x,p.x),g=Math.max(h.x,d.x,u.x,p.x),v=Math.min(h.y,d.y,u.y,p.y),y=Math.max(h.y,d.y,u.y,p.y);return{x:m,y:v,w:g-m,h:y-v,c:f,r:o,x2:g,y2:y,cr:a,sr:l}}(e.x,e.y,e.w,e.h,e.r),this._transformedElementMap.set(t,e.t),!0!==i&&this._updateBounds(t,e,i)}},{key:"shouldFireEvent",value:function(t,e,i){return!0}},{key:"startTransaction",value:function(){if(null!=this._currentTransaction)throw new Error("Viewport: cannot start transaction; a transaction is currently active.");this._currentTransaction=new Av}},{key:"endTransaction",value:function(){var t=this;null!=this._currentTransaction&&(this._currentTransaction.affectedElements.forEach((function(e){var i=t.getPosition(e);t._finaliseUpdate(e,i,!0)})),this.recomputeBounds(),this._currentTransaction=null)}},{key:"updateElements",value:function(t){var e=this;Gd(t,(function(t){return e.updateElement(t.id,t.x,t.y,t.width,t.height,t.rotation)}))}},{key:"updateElement",value:function(t,e,i,n,o,s,r){var a=uu(this._elementMap,t,Mv);return a.dirty=null==e&&null==a.x||null==i&&null==a.y||null==n&&null==a.w||null==o&&null==a.h,null!=e&&(a.x=e),null!=i&&(a.y=i),null!=n&&(a.w=n),null!=o&&(a.h=o),null!=s&&(a.r=s||0),a.c.x=a.x+a.w/2,a.c.y=a.y+a.h/2,a.x2=a.x+a.w,a.y2=a.y+a.h,null==this._currentTransaction?this._finaliseUpdate(t,a,r):this._currentTransaction.affectedElements.add(t),a}},{key:"refreshElement",value:function(t,e){var i=this.instance.getManagedElements(),n=i[t]?i[t].el:null;if(null!=n){var o=this.getSize(n),s=this.getOffset(n);return this.updateElement(t,s.x,s.y,o.w,o.h,null,e)}return null}},{key:"getSize",value:function(t){return this.instance.getSize(t)}},{key:"getOffset",value:function(t){return this.instance.getOffset(t)}},{key:"registerElement",value:function(t,e){return this.updateElement(t,0,0,0,0,0,e)}},{key:"addElement",value:function(t,e,i,n,o,s){return this.updateElement(t,e,i,n,o,s)}},{key:"rotateElement",value:function(t,e){var i=uu(this._elementMap,t,Mv);return i.r=e||0,this._finaliseUpdate(t,i),i}},{key:"getBoundsWidth",value:function(){return this._bounds.maxx-this._bounds.minx}},{key:"getBoundsHeight",value:function(){return this._bounds.maxy-this._bounds.miny}},{key:"getX",value:function(){return this._bounds.minx}},{key:"getY",value:function(){return this._bounds.miny}},{key:"setSize",value:function(t,e,i){if(this._elementMap.has(t))return this.updateElement(t,null,null,e,i,null)}},{key:"setPosition",value:function(t,e,i){if(this._elementMap.has(t))return this.updateElement(t,e,i,null,null,null)}},{key:"reset",value:function(){this._sortedElements.xmin.length=0,this._sortedElements.xmax.length=0,this._sortedElements.ymin.length=0,this._sortedElements.ymax.length=0,this._elementMap.clear(),this._transformedElementMap.clear(),this._recalculateBounds()}},{key:"remove",value:function(t){Dv(t,this._sortedElements.xmin),Dv(t,this._sortedElements.xmax),Dv(t,this._sortedElements.ymin),Dv(t,this._sortedElements.ymax),this._elementMap.delete(t),this._transformedElementMap.delete(t),this._recalculateBounds()}},{key:"getPosition",value:function(t){return this._elementMap.get(t)}},{key:"getElements",value:function(){return this._elementMap}},{key:"isEmpty",value:function(){return 0===this._elementMap.size}}]),i}($g);function $v(t,e){return e.theta-t.theta}function zv(t,e){return(t.theta<0?-Math.PI-t.theta:Math.PI-t.theta)-(e.theta<0?-Math.PI-e.theta:Math.PI-e.theta)}var Rv=(Cd(Iv={},Km,zv),Cd(Iv,Jm,$v),Cd(Iv,tg,$v),Cd(Iv,Qm,zv),Iv);function Nv(t){return!0===t.isContinuous}function Bv(t){return!0===t.isContinuous}function jv(t){return t.locations.length>1}function Fv(t){return[t.currentLocation,t.locations[t.currentLocation]]}var qv=function(){function t(e){var i=this;wd(this,t),this.instance=e,Cd(this,"anchorLists",new Map),Cd(this,"anchorLocations",new Map),e.bind(Ju,(function(t){t.sourceEndpoint._anchor.isContinuous&&i._removeEndpointFromAnchorLists(t.sourceEndpoint),t.targetEndpoint._anchor.isContinuous&&i._removeEndpointFromAnchorLists(t.targetEndpoint)})),e.bind(Qu,(function(t){i._removeEndpointFromAnchorLists(t)}))}return Sd(t,[{key:"getAnchorOrientation",value:function(t){var e=this.anchorLocations.get(t.id);return e?[e.ox,e.oy]:[0,0]}},{key:"_distance",value:function(t,e,i,n,o,s,r){var a=n.x+t.x*o.w,l=n.y+t.y*o.h,c=n.x+o.w/2,h=n.y+o.h/2;if(null!=s&&s.length>0){var d=this.instance._applyRotations([a,l,0,0],s);a=d.x,l=d.y}return Math.sqrt(Math.pow(e-a,2)+Math.pow(i-l,2))+Math.sqrt(Math.pow(c-a,2)+Math.pow(h-l,2))}},{key:"_anchorSelector",value:function(t,e,i,n,o,s,r){for(var a=i.x+n.w/2,l=i.y+n.h/2,c=-1,h=1/0,d=0;d<r.length;d++){var u=this._distance(r[d],a,l,t,e,o,s);u<h&&(c=d+0,h=u)}return[c,r[c]]}},{key:"_floatingAnchorCompute",value:function(t,e){var i=e.xy,n={curX:i.x+t.size.w/2,curY:i.y+t.size.h/2,x:0,y:0,ox:0,oy:0};return this._setComputedPosition(t,n)}},{key:"_setComputedPosition",value:function(t,e,i){return this.anchorLocations.set(t.id,e),t.computedPosition=e,i&&(t.timestamp=i),e}},{key:"_computeSingleLocation",value:function(t,e,i,n){var o,s=n.rotation,r={curX:e.x+t.x*i.w+t.offx,curY:e.y+t.y*i.h+t.offy,x:t.x,y:t.y,ox:0,oy:0};if(null!=s&&s.length>0){var a=[t.iox,t.ioy],l={x:r.curX,y:r.curY,cr:0,sr:0};Gd(s,(function(t){l=ru(l,t.c,t.r);var e=[Math.round(a[0]*l.cr-a[1]*l.sr),Math.round(a[1]*l.cr+a[0]*l.sr)];a=e.slice()})),t.ox=a[0],t.oy=a[1],o={curX:l.x,curY:l.y,x:t.x,y:t.y,ox:a[0],oy:a[1]}}else t.ox=t.iox,t.oy=t.ioy,o=Rd({ox:t.iox,oy:t.ioy},r);return o}},{key:"_singleAnchorCompute",value:function(t,e){var i=e.xy,n=e.wh,o=e.timestamp,s=this.anchorLocations.get(t.id);if(null!=s&&o&&o===t.timestamp)return s;var r=Dd(Fv(t),2);r[0];var a=r[1];return s=this._computeSingleLocation(a,i,n,e),this._setComputedPosition(t,s,o)}},{key:"_defaultAnchorCompute",value:function(t,e){var i;if(1===t.locations.length)return this._singleAnchorCompute(t,e);var n=e.xy,o=e.wh,s=e.txy,r=e.twh,a=Dd(Fv(t),2),l=a[0],c=a[1];if(t.locked||null==s||null==r)i=this._computeSingleLocation(c,n,o,e);else{var h=Dd(this._anchorSelector(n,o,s,r,e.rotation,e.tRotation,t.locations),2),d=h[0],u=h[1];t.currentLocation=d,d!==l&&(t.cssClass=u.cls||t.cssClass,e.element._anchorLocationChanged(t)),i=this._computeSingleLocation(u,n,o,e)}return this._setComputedPosition(t,i,e.timestamp)}},{key:"_placeAnchors",value:function(t,e){var i=this,n=this.instance.viewport.getPosition(t),o=function(e,o,s,r,a,l){if(s.length>0)for(var c=s.sort(Rv[e]),h=function(t,e,i,n,o){for(var s=i?t.w:t.h,r=i?t.h:t.w,a=[],l=s/(e.length+1),c=0;c<e.length;c++){var h=(c+1)*l,d=n*r;o&&(h=s-h);var u=i?h:d,p=t.x+u,f=u/t.w,m=i?d:h,g=t.y+m,v=m/t.h;if(0!==t.r&&null!=t.r){var y=ru({x:p,y:g},t.c,t.r);p=y.x,g=y.y}a.push({x:p,y:g,xLoc:f,yLoc:v,c:e[c].c})}return a}(n,c,r,a,e===Jm||e===Km),d=0;d<h.length;d++){var u=h[d].c,p=u.endpoints[0].elementId===t?u.endpoints[0]:u.endpoints[1];i._setComputedPosition(p._anchor,{curX:h[d].x,curY:h[d].y,x:h[d].xLoc,y:h[d].yLoc,ox:l[0],oy:l[1]})}};o(tg,0,e.bottom,!0,1,[0,1]),o(Km,0,e.top,!0,0,[0,-1]),o(Qm,0,e.left,!1,0,[-1,0]),o(Jm,0,e.right,!1,1,[1,0])}},{key:"_updateAnchorList",value:function(t,e,i,n,o,s,r,a,l,c,h){var d,u=n.endpoints[r],p=u.id,f=[1,0][r],m={theta:e,order:i,c:n,b:o,elId:s,epId:p},g=t[l],v=u._continuousAnchorEdge?t[u._continuousAnchorEdge]:null;if(v){var y=Zd(v,(function(t){return t.epId===p}));if(-1!==y){v.splice(y,1);for(var b=0;b<v.length;b++)!0!==(d=v[b].c).placeholder&&c.add(d),h.add(v[b].c.endpoints[r]),h.add(v[b].c.endpoints[f])}}for(var x=0;x<g.length;x++)!0!==(d=g[x].c).placeholder&&c.add(d),h.add(g[x].c.endpoints[r]),h.add(g[x].c.endpoints[f]);var _=a?0:g.length;g.splice(_,0,m),u._continuousAnchorEdge=l}},{key:"_removeEndpointFromAnchorLists",value:function(t){var e=this.anchorLists.get(t.elementId),i=0;!function(t,e){if(t){var n=function(t){return t.epId===e};Kd(t.top,n),Kd(t.left,n),Kd(t.bottom,n),Kd(t.right,n),i+=t.top.length,i+=t.left.length,i+=t.bottom.length,i+=t.right.length}}(e,t.id),0===i&&this.anchorLists.delete(t.elementId),this.anchorLocations.delete(t._anchor.id)}},{key:"computeAnchorLocation",value:function(t,e){var i;return i=Nv(t)?this.anchorLocations.get(t.id)||{curX:0,curY:0,x:0,y:0,ox:0,oy:0}:Bv(t)?this._floatingAnchorCompute(t,e):this._defaultAnchorCompute(t,e),t.timestamp=e.timestamp,i}},{key:"computePath",value:function(t,e){var i=this.instance.viewport.getPosition(t.sourceId),n=this.instance.viewport.getPosition(t.targetId),o=t.endpoints[0],s=t.endpoints[1],r=this.getEndpointLocation(o,{xy:i,wh:i,element:o,timestamp:e,rotation:this.instance._getRotations(t.sourceId)}),a=this.getEndpointLocation(s,{xy:n,wh:n,element:s,timestamp:e,rotation:this.instance._getRotations(t.targetId)});t.connector.resetBounds(),t.connector.compute({sourcePos:r,targetPos:a,sourceEndpoint:t.endpoints[0],targetEndpoint:t.endpoints[1],strokeWidth:t.paintStyleInUse.strokeWidth,sourceInfo:i,targetInfo:n})}},{key:"getEndpointLocation",value:function(t,e){e=e||{};var i=t._anchor,n=this.anchorLocations.get(i.id);return(null==n||null!=e.timestamp&&i.timestamp!==e.timestamp)&&(n=this.computeAnchorLocation(i,e),this._setComputedPosition(i,n,e.timestamp)),n}},{key:"getEndpointOrientation",value:function(t){return t._anchor?this.getAnchorOrientation(t._anchor):[0,0]}},{key:"setAnchorOrientation",value:function(t,e){var i=this.anchorLocations.get(t.id);null!=i&&(i.ox=e[0],i.oy=e[1])}},{key:"isDynamicAnchor",value:function(t){return!!t._anchor&&(!Nv(t._anchor)&&t._anchor.locations.length>1)}},{key:"isFloating",value:function(t){return!!t._anchor&&Bv(t._anchor)}},{key:"prepareAnchor",value:function(t){return _g(t)}},{key:"redraw",value:function(t,e,i){var n=this,o=new Set,s=new Set,r=new Set;if(!this.instance._suspendDrawing){var a=this.instance.endpointsByElement[t]||[];e=e||su();for(var l,c,h={},d=0;d<a.length;d++)if(!1!==(c=a[d]).visible)if(s.add(c),l=c._anchor,0===c.connections.length)Nv(l)&&(this.anchorLists.has(t)||this.anchorLists.set(t,{top:[],right:[],bottom:[],left:[]}),this._updateAnchorList(this.anchorLists.get(t),-Math.PI/2,0,{endpoints:[c,c],placeholder:!0},!1,t,0,!1,ag(l),o,s),r.add(t));else for(var u=0;u<c.connections.length;u++){var p=c.connections[u],f=p.sourceId,m=p.targetId,g=Nv(p.endpoints[0]._anchor),v=Nv(p.endpoints[1]._anchor);if(g||v){var y=[f,(p.endpoints[0]._anchor.faces||[]).join("-"),m,(p.endpoints[1]._anchor.faces||[]).join("-")].join("-"),b=h[y],x=p.sourceId===t?1:0;g&&!this.anchorLists.has(f)&&this.anchorLists.set(f,{top:[],right:[],bottom:[],left:[]}),v&&!this.anchorLists.has(m)&&this.anchorLists.set(m,{top:[],right:[],bottom:[],left:[]});var _=this.instance.viewport.getPosition(m),w=this.instance.viewport.getPosition(f);if(m===f&&(g||v))this._updateAnchorList(this.anchorLists.get(f),-Math.PI/2,0,p,!1,m,0,!1,Km,o,s),this._updateAnchorList(this.anchorLists.get(m),-Math.PI/2,0,p,!1,f,1,!1,Km,o,s);else{var k=this.instance._getRotations(f),S=this.instance._getRotations(m);b||(b=this._calculateOrientation(f,m,w,_,p.endpoints[0]._anchor,p.endpoints[1]._anchor,k,S),h[y]=b),g&&this._updateAnchorList(this.anchorLists.get(f),b.theta,0,p,!1,m,0,!1,b.a[0],o,s),v&&this._updateAnchorList(this.anchorLists.get(m),b.theta2,-1,p,!0,f,1,!0,b.a[1],o,s)}g&&r.add(f),v&&r.add(m),o.add(p),(g&&0===x||v&&1===x)&&s.add(p.endpoints[x])}else{var C=c.connections[u].endpoints[p.sourceId===t?1:0];if(jv(C._anchor)){this.instance._paintEndpoint(C,{elementWithPrecedence:t,timestamp:e}),o.add(c.connections[u]);for(var E=0;E<C.connections.length;E++)C.connections[E]!==c.connections[u]&&o.add(C.connections[E])}else o.add(c.connections[u])}}r.forEach((function(t){n._placeAnchors(t,n.anchorLists.get(t))})),s.forEach((function(t){var i=n.instance.viewport.getPosition(t.elementId);n.instance._paintEndpoint(t,{timestamp:e,offset:i})})),o.forEach((function(t){n.instance._paintConnection(t,{timestamp:e})}))}return{c:o,e:s}}},{key:"reset",value:function(){this.anchorLocations.clear(),this.anchorLists.clear()}},{key:"setAnchor",value:function(t,e){null!=e&&(t._anchor=e)}},{key:"setConnectionAnchors",value:function(t,e){t.endpoints[0]._anchor=e[0],t.endpoints[1]._anchor=e[1]}},{key:"_calculateOrientation",value:function(t,e,i,n,o,s,r,a){var l=this;if(t===e)return{orientation:"identity",a:[Km,Km]};var c=Math.atan2(n.c.y-i.c.y,n.c.x-i.c.x),h=Math.atan2(i.c.y-n.c.y,i.c.x-n.c.x),d=[],u={};!function(t,e){for(var i=0;i<t.length;i++){var n;if(u[t[i]]=(Cd(n={},Qm,{x:e[i][0].x,y:e[i][0].c.y}),Cd(n,Jm,{x:e[i][0].x+e[i][0].w,y:e[i][0].c.y}),Cd(n,Km,{x:e[i][0].c.x,y:e[i][0].y}),Cd(n,tg,{x:e[i][0].c.x,y:e[i][0].y+e[i][0].h}),n),null!=e[i][1]&&e[i][1].length>0)for(var o in u[t[i]])u[t[i]][o]=l.instance._applyRotationsXY(u[t[i]][o],e[i][1])}}([Ou,Du],[[i,r],[n,a]]);for(var p=[Km,Qm,Jm,tg],f=0;f<p.length;f++)for(var m=0;m<p.length;m++)d.push({source:p[f],target:p[m],dist:rm(u.source[p[f]],u.target[p[m]])});d.sort((function(t,e){if(t.dist<e.dist)return-1;if(e.dist<t.dist)return 1;var i,n=(Cd(i={},Qm,0),Cd(i,Km,1),Cd(i,Jm,2),Cd(i,tg,3),i),o=n[t.source],s=n[e.source],r=n[t.target],a=n[e.target];return o<s?-1:s<o?1:r<a?-1:a<r?1:0}));for(var g=d[0].source,v=d[0].target,y=0;y<d.length&&(g=Nv(o)&&o.locked?o.currentFace:!o.isContinuous||cg(o,d[y].source)?d[y].source:null,v=s.isContinuous&&s.locked?s.currentFace:!s.isContinuous||cg(s,d[y].target)?d[y].target:null,null==g||null==v);y++);return o.isContinuous&&this.setCurrentFace(o,g),s.isContinuous&&this.setCurrentFace(s,v),{a:[g,v],theta:c,theta2:h}}},{key:"setCurrentFace",value:function(t,e,i){t.currentFace=e,i&&null!=t.lockedFace&&(t.lockedFace=t.currentFace)}},{key:"lock",value:function(t){t.locked=!0,Nv(t)&&(t.lockedFace=t.currentFace)}},{key:"unlock",value:function(t){t.locked=!1,Nv(t)&&(t.lockedFace=null)}},{key:"selectAnchorLocation",value:function(t,e){var i=Zd(t.locations,(function(t){return t.x===e.x&&t.y===e.y}));return-1!==i&&(t.currentLocation=i,!0)}},{key:"lockCurrentAxis",value:function(t){null!=t.currentFace&&(t.lockedAxis=t.currentFace===Qm||t.currentFace===Jm?eg:ig)}},{key:"unlockCurrentAxis",value:function(t){t.lockedAxis=null}},{key:"anchorsEqual",value:function(t,e){if(!t||!e)return!1;var i=t.locations[t.currentLocation],n=e.locations[e.currentLocation];return i.x===n.x&&i.y===n.y&&i.offx===n.offx&&i.offy===n.offy&&i.ox===n.ox&&i.oy===n.oy}}]),t}(),Vv={},Hv=function(t,e,i){var n=Vv[e];if(n)return new n(t,i);throw{message:"jsPlumb: unknown connector type '"+e+"'"}},Uv=function(t,e){Vv[t]=e},Wv=function(t){Ed(i,t);var e=Pd(i);function i(t){var n;return wd(this,i),Cd(Td(n=e.call(this,t)),"length",void 0),Cd(Td(n),"m",void 0),Cd(Td(n),"m2",void 0),Cd(Td(n),"type",i.segmentType),n._setCoordinates({x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}),n}return Sd(i,[{key:"getPath",value:function(t){return(t?"M "+this.x1+" "+this.y1+" ":"")+"L "+this.x2+" "+this.y2}},{key:"_recalc",value:function(){this.length=Math.sqrt(Math.pow(this.x2-this.x1,2)+Math.pow(this.y2-this.y1,2)),this.m=sm({x:this.x1,y:this.y1},{x:this.x2,y:this.y2}),this.m2=-1/this.m,this.extents={xmin:Math.min(this.x1,this.x2),ymin:Math.min(this.y1,this.y2),xmax:Math.max(this.x1,this.x2),ymax:Math.max(this.y1,this.y2)}}},{key:"getLength",value:function(){return this.length}},{key:"getGradient",value:function(){return this.m}},{key:"_setCoordinates",value:function(t){this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this._recalc()}},{key:"pointOnPath",value:function(t,e){if(0!==t||e){if(1!==t||e){var i=e?t>0?t:this.length+t:t*this.length;return cm({x:this.x1,y:this.y1},{x:this.x2,y:this.y2},i)}return{x:this.x2,y:this.y2}}return{x:this.x1,y:this.y1}}},{key:"gradientAtPoint",value:function(t,e){return this.m}},{key:"pointAlongPathFrom",value:function(t,e,i){var n=this.pointOnPath(t,i),o=e<=0?{x:this.x1,y:this.y1}:{x:this.x2,y:this.y2};return e<=0&&Math.abs(e)>1&&(e*=-1),cm(n,o,e)}},{key:"within",value:function(t,e,i){return i>=Math.min(t,e)&&i<=Math.max(t,e)}},{key:"closest",value:function(t,e,i){return Math.abs(i-t)<Math.abs(i-e)?t:e}},{key:"findClosestPointOnPath",value:function(t,e){var i={d:1/0,x:null,y:null,l:null,x1:this.x1,x2:this.x2,y1:this.y1,y2:this.y2};if(0===this.m)i.y=this.y1,i.x=this.within(this.x1,this.x2,t)?t:this.closest(this.x1,this.x2,t);else if(this.m===1/0||this.m===-1/0)i.x=this.x1,i.y=this.within(this.y1,this.y2,e)?e:this.closest(this.y1,this.y2,e);else{var n=this.y1-this.m*this.x1,o=(e-this.m2*t-n)/(this.m-this.m2),s=this.m*o+n;i.x=this.within(this.x1,this.x2,o)?o:this.closest(this.x1,this.x2,o),i.y=this.within(this.y1,this.y2,s)?s:this.closest(this.y1,this.y2,s)}var r=rm({x:i.x,y:i.y},{x:this.x1,y:this.y1});return i.d=rm({x:t,y:e},i),i.l=r/length,i}},{key:"_pointLiesBetween",value:function(t,e,i){return i>e?e<=t&&t<=i:e>=t&&t>=i}},{key:"lineIntersection",value:function(t,e,i,n){var o=Math.abs(sm({x:t,y:e},{x:i,y:n})),s=Math.abs(this.m),r=s===1/0?this.x1:this.y1-s*this.x1,a=[],l=o===1/0?t:e-o*t;if(o!==s)if(o===1/0&&0===s)this._pointLiesBetween(t,this.x1,this.x2)&&this._pointLiesBetween(this.y1,e,n)&&a.push({x:t,y:this.y1});else if(0===o&&s===1/0)this._pointLiesBetween(e,this.y1,this.y2)&&this._pointLiesBetween(this.x1,t,i)&&a.push({x:this.x1,y:e});else{var c,h;o===1/0?(c=t,this._pointLiesBetween(c,this.x1,this.x2)&&(h=s*t+r,this._pointLiesBetween(h,e,n)&&a.push({x:c,y:h}))):0===o?(h=e,this._pointLiesBetween(h,this.y1,this.y2)&&(c=(e-r)/s,this._pointLiesBetween(c,t,i)&&a.push({x:c,y:h}))):(h=s*(c=(l-r)/(s-o))+r,this._pointLiesBetween(c,this.x1,this.x2)&&this._pointLiesBetween(h,this.y1,this.y2)&&a.push({x:c,y:h}))}return a}},{key:"boxIntersection",value:function(t,e,i,n){var o=[];return o.push.apply(o,this.lineIntersection(t,e,t+i,e)),o.push.apply(o,this.lineIntersection(t+i,e,t+i,e+n)),o.push.apply(o,this.lineIntersection(t+i,e+n,t,e+n)),o.push.apply(o,this.lineIntersection(t,e+n,t,e)),o}}]),i}(Ef);Cd(Wv,"segmentType","Straight");var Gv=function(t){Ed(i,t);var e=Pd(i);function i(){var t;wd(this,i);for(var n=arguments.length,o=new Array(n),s=0;s<n;s++)o[s]=arguments[s];return Cd(Td(t=e.call.apply(e,[this].concat(o))),"type",i.type),t}return Sd(i,[{key:"getDefaultStubs",value:function(){return[0,0]}},{key:"_compute",value:function(t,e){this._addSegment(Wv,{x1:t.sx,y1:t.sy,x2:t.startStubX,y2:t.startStubY}),this._addSegment(Wv,{x1:t.startStubX,y1:t.startStubY,x2:t.endStubX,y2:t.endStubY}),this._addSegment(Wv,{x1:t.endStubX,y1:t.endStubY,x2:t.tx,y2:t.ty}),this.geometry={source:e.sourcePos,target:e.targetPos}}},{key:"transformGeometry",value:function(t,e,i){return{source:this.transformAnchorPlacement(t.source,e,i),target:this.transformAnchorPlacement(t.target,e,i)}}}]),i}(cv);function Zv(t,e,i){var n=[],o=function(e){return Bd(e)?e:t.getId(e)};if(e)if("string"==typeof e){if("*"===e)return e;n.push(e)}else{var s;if(i)n=e;else if(null!=e.length)(s=n).push.apply(s,Id(Id(e).map(o)));else n.push(o(e))}return n}function Yv(t,e,i){null!=e&&(e.connections.push(t),1===e.connections.length&&t.instance.addClass(t.source,t.instance.connectedClass)),null!=i&&(null!=e&&t.sourceId===t.targetId||(i.connections.push(t),1===i.connections.length&&t.instance.addClass(t.target,t.instance.connectedClass)))}function Xv(t,e,i){if(null!=e){var n=e.connections.length;Kd(e.connections,(function(e){return t.id===e.id})),n>0&&0===e.connections.length&&t.instance.removeClass(t.source,t.instance.connectedClass)}if(null!=i){var o=i.connections.length;null!=e&&t.sourceId===t.targetId||Kd(i.connections,(function(e){return t.id===e.id})),o>0&&0===i.connections.length&&t.instance.removeClass(t.target,t.instance.connectedClass)}}Cd(Gv,"type","Straight");var Kv=function(t){Ed(i,t);var e=Pd(i);function i(t,n){var o;return wd(this,i),(o=e.call(this))._instanceIndex=t,Cd(Td(o),"defaults",void 0),Cd(Td(o),"_initialDefaults",{}),Cd(Td(o),"isConnectionBeingDragged",!1),Cd(Td(o),"currentlyDragging",!1),Cd(Td(o),"hoverSuspended",!1),Cd(Td(o),"_suspendDrawing",!1),Cd(Td(o),"_suspendedAt",null),Cd(Td(o),"connectorClass",Vu),Cd(Td(o),"connectorOutlineClass","jtk-connector-outline"),Cd(Td(o),"connectedClass","jtk-connected"),Cd(Td(o),"endpointClass",Hu),Cd(Td(o),"endpointConnectedClass","jtk-endpoint-connected"),Cd(Td(o),"endpointFullClass","jtk-endpoint-full"),Cd(Td(o),"endpointFloatingClass",Uu),Cd(Td(o),"endpointDropAllowedClass","jtk-endpoint-drop-allowed"),Cd(Td(o),"endpointDropForbiddenClass","jtk-endpoint-drop-forbidden"),Cd(Td(o),"endpointAnchorClassPrefix","jtk-endpoint-anchor"),Cd(Td(o),"overlayClass",Zu),Cd(Td(o),"connections",[]),Cd(Td(o),"endpointsByElement",{}),Cd(Td(o),"endpointsByUUID",new Map),Cd(Td(o),"sourceSelectors",[]),Cd(Td(o),"targetSelectors",[]),Cd(Td(o),"allowNestedGroups",void 0),Cd(Td(o),"_curIdStamp",1),Cd(Td(o),"viewport",new Lv(Td(o))),Cd(Td(o),"router",void 0),Cd(Td(o),"groupManager",void 0),Cd(Td(o),"_connectionTypes",new Map),Cd(Td(o),"_endpointTypes",new Map),Cd(Td(o),"_container",void 0),Cd(Td(o),"_managedElements",{}),Cd(Td(o),"DEFAULT_SCOPE",void 0),Cd(Td(o),"_zoom",1),o.defaults={anchor:Cp.Bottom,anchors:[null,null],connectionsDetachable:!0,connectionOverlays:[],connector:Gv.type,container:null,endpoint:bv.type,endpointOverlays:[],endpoints:[null,null],endpointStyle:{fill:"#456"},endpointStyles:[null,null],endpointHoverStyle:null,endpointHoverStyles:[null,null],hoverPaintStyle:null,listStyle:{},maxConnections:1,paintStyle:{strokeWidth:2,stroke:"#456"},reattachConnections:!1,scope:"jsplumb_defaultscope",allowNestedGroups:!0},n&&Rd(o.defaults,n),Rd(o._initialDefaults,o.defaults),null!=o._initialDefaults[yv]&&(o._initialDefaults[yv].strokeWidth=o._initialDefaults[yv].strokeWidth||2),o.DEFAULT_SCOPE=o.defaults.scope,o.allowNestedGroups=!1!==o._initialDefaults.allowNestedGroups,o.router=new qv(Td(o)),o.groupManager=new kv(Td(o)),o.setContainer(o._initialDefaults.container),o}return Sd(i,[{key:"defaultScope",get:function(){return this.DEFAULT_SCOPE}},{key:"currentZoom",get:function(){return this._zoom}},{key:"areDefaultAnchorsSet",value:function(){return this.validAnchorsSpec(this.defaults.anchors)}},{key:"validAnchorsSpec",value:function(t){return null!=t&&null!=t[0]&&null!=t[1]}},{key:"getContainer",value:function(){return this._container}},{key:"setZoom",value:function(t,e){return this._zoom=t,this.fire(np,this._zoom),e&&this.repaintEverything(),!0}},{key:"_idstamp",value:function(){return""+this._curIdStamp++}},{key:"checkCondition",value:function(t,e){var i=this.getListener(t),n=!0;if(i&&i.length>0){var o=Array.prototype.slice.call(arguments,1);try{for(var s=0,r=i.length;s<r;s++)n=n&&i[s].apply(i[s],o)}catch(e){cu("cannot check condition ["+t+"]"+e)}}return n}},{key:"getId",value:function(t,e){if(null==t)return null;var i=this.getAttribute(t,Nu);return i&&"undefined"!==i||(2===arguments.length&&void 0!==arguments[1]?i=e:(1===arguments.length||3===arguments.length&&!arguments[2])&&(i="jsplumb-"+this._instanceIndex+"-"+this._idstamp()),this.setAttribute(t,Nu,i)),i}},{key:"getConnections",value:function(t,e){t?t.constructor===String&&(t={scope:t}):t={};for(var i=Zv(this,t.scope||this.defaultScope,!0),n=Zv(this,t.source),o=Zv(this,t.target),s=!e&&i.length>1?{}:[],r=function(t,n){if(!e&&i.length>1){var o=s[t];null==o&&(o=s[t]=[]),o.push(n)}else s.push(n)},a=0,l=this.connections.length;a<l;a++){var c=this.connections[a],h=c.proxies&&c.proxies[0]?c.proxies[0].originalEp.elementId:c.sourceId,d=c.proxies&&c.proxies[1]?c.proxies[1].originalEp.elementId:c.targetId;zd(i,c.scope)&&zd(n,h)&&zd(o,d)&&r(c.scope,c)}return s}},{key:"select",value:function(t){return(t=t||{}).scope=t.scope||"*",new Ev(this,t.connections||this.getConnections(t,!0))}},{key:"selectEndpoints",value:function(t){(t=t||{}).scope=t.scope||Of;var e=!t.element&&!t.source&&!t.target,i=e?Of:Zv(this,t.element),n=e?Of:Zv(this,t.source),o=e?Of:Zv(this,t.target),s=Zv(this,t.scope,!0),r=[];for(var a in this.endpointsByElement){var l=zd(i,a,!0),c=zd(n,a,!0),h="*"!==n,d=zd(o,a,!0),u="*"!==o;if(l||c||d)t:for(var p=0,f=this.endpointsByElement[a].length;p<f;p++){var m=this.endpointsByElement[a][p];if(zd(s,m.scope,!0)){var g=h&&n.length>0&&!m.isSource,v=u&&o.length>0&&!m.isTarget;if(g||v)continue t;r.push(m)}}}return new Cv(this,r)}},{key:"setContainer",value:function(t){this._container=t,this.fire("container:change",this._container)}},{key:"_set",value:function(t,e,i){var n,o,s=[{el:"source",elId:"sourceId"},{el:"target",elId:"targetId"}][i],r=t[s.elId],a=t.endpoints[i],l={index:i,originalEndpoint:a,originalSourceId:0===i?r:t.sourceId,newSourceId:t.sourceId,originalTargetId:1===i?r:t.targetId,newTargetId:t.targetId,connection:t,newEndpoint:a};return e instanceof tv?(n=e).addConnection(t):n=(o=this.getId(e))===t[s.elId]?null:t.makeEndpoint(0===i,e,o),null!=n&&(l.newEndpoint=n,a.detachFromConnection(t),t.endpoints[i]=n,t[s.el]=n.element,t[s.elId]=n.elementId,l[0===i?"newSourceId":"newTargetId"]=n.elementId,this.fireMoveEvent(l),this._paintConnection(t)),l}},{key:"setSource",value:function(t,e){Xv(t,this._managedElements[t.sourceId]);var i=this._set(t,e,0);Yv(t,this._managedElements[i.newSourceId])}},{key:"setTarget",value:function(t,e){Xv(t,this._managedElements[t.targetId]);var i=this._set(t,e,1);Yv(t,this._managedElements[i.newTargetId])}},{key:"setConnectionType",value:function(t,e,i){t.setType(e,i),this._paintConnection(t)}},{key:"isHoverSuspended",value:function(){return this.hoverSuspended}},{key:"setSuspendDrawing",value:function(t,e){var i=this._suspendDrawing;return this._suspendDrawing=t,t?this._suspendedAt=""+(new Date).getTime():(this._suspendedAt=null,this.viewport.recomputeBounds()),e&&this.repaintEverything(),i}},{key:"getSuspendedAt",value:function(){return this._suspendedAt}},{key:"batch",value:function(t,e){var i=!0===this._suspendDrawing;i||this.setSuspendDrawing(!0),t(),i||this.setSuspendDrawing(!1,!e)}},{key:"each",value:function(t,e){if(null!=t){if(null!=t.length)for(var i=0;i<t.length;i++)e(t[i]);else e(t);return this}}},{key:"updateOffset",value:function(t){var e=t.elId;return t.recalc?this.viewport.refreshElement(e):this.viewport.getPosition(e)}},{key:"deleteConnection",value:function(t,e){if(null!=t&&!0!==t.deleted&&((e=e||{}).force||Ud(!0,!1,[[t.endpoints[0],op,[t]],[t.endpoints[1],op,[t]],[t,op,[t]],[this,qu,[rp,t]]]))){Xv(t,this._managedElements[t.sourceId],this._managedElements[t.targetId]),this.fireDetachEvent(t,!t.pending&&!1!==e.fireEvent,e.originalEvent);var i=t.endpoints[0],n=t.endpoints[1];return i!==e.endpointToIgnore&&i.detachFromConnection(t,null,!0),n!==e.endpointToIgnore&&n.detachFromConnection(t,null,!0),Kd(this.connections,(function(e){return t.id===e.id})),t.destroy(),i!==e.endpointToIgnore&&i.deleteOnEmpty&&0===i.connections.length&&this.deleteEndpoint(i),n!==e.endpointToIgnore&&n.deleteOnEmpty&&0===n.connections.length&&this.deleteEndpoint(n),!0}return!1}},{key:"deleteEveryConnection",value:function(t){var e=this;t=t||{};var i=this.connections.length,n=0;return this.batch((function(){for(var o=0;o<i;o++)n+=e.deleteConnection(e.connections[0],t)?1:0})),n}},{key:"deleteConnectionsForElement",value:function(t,e){var i=this.getId(t),n=this._managedElements[i];if(n)for(var o=n.connections.length,s=0;s<o;s++)this.deleteConnection(n.connections[0],e);return this}},{key:"fireDetachEvent",value:function(t,e,i){var n=null!=t.id?{connection:t,source:t.source,target:t.target,sourceId:t.sourceId,targetId:t.targetId,sourceEndpoint:t.endpoints[0],targetEndpoint:t.endpoints[1]}:t;e&&this.fire("connection:detach",n,i),this.fire(Ju,n,i)}},{key:"fireMoveEvent",value:function(t,e){this.fire(Ku,t,e)}},{key:"manageAll",value:function(t,e){for(var i=Bd(t)?this.getSelector(this.getContainer(),t):t,n=0;n<i.length;n++)this.manage(i[n],null,e)}},{key:"manage",value:function(t,e,i){null==this.getAttribute(t,Nu)&&(e=e||this.getAttribute(t,"id")||su(),this.setAttribute(t,Nu,e));var n=this.getId(t);if(this._managedElements[n])i&&(this._managedElements[n].viewportElement=this.updateOffset({elId:n,timestamp:null,recalc:!0}));else{var o={el:t,endpoints:[],connections:[],rotation:0,data:{}};this._managedElements[n]=o,this._suspendDrawing?o.viewportElement=this.viewport.registerElement(n,!0):o.viewportElement=this.updateOffset({elId:n,recalc:!0}),this.fire(tp,{el:t})}return this._managedElements[n]}},{key:"getManagedData",value:function(t,e,i){if(this._managedElements[t]){var n=this._managedElements[t].data[e];return null!=n?n[i]:null}}},{key:"setManagedData",value:function(t,e,i,n){this._managedElements[t]&&(this._managedElements[t].data[e]=this._managedElements[t].data[e]||{},this._managedElements[t].data[e][i]=n)}},{key:"getManagedElement",value:function(t){return this._managedElements[t]?this._managedElements[t].el:null}},{key:"unmanage",value:function(t,e){var i=this;this.removeAllEndpoints(t,!0);var n=function(t){var n=i.getId(t);i.removeAttribute(t,Nu),delete i._managedElements[n],i.viewport.remove(n),i.fire(ip,{el:t,id:n}),t&&e&&i._removeElement(t)};this._getAssociatedElements(t).map(n),n(t)}},{key:"rotate",value:function(t,e,i){var n=this.getId(t);return this._managedElements[n]&&(this._managedElements[n].rotation=e,this.viewport.rotateElement(n,e),!0!==i)?this.revalidate(t):{c:new Set,e:new Set}}},{key:"_getRotation",value:function(t){var e=this._managedElements[t];return null!=e&&e.rotation||0}},{key:"_getRotations",value:function(t){var e=this,i=[],n=this._managedElements[t];return null!=n&&(i.push({r:n.viewportElement.r||0,c:n.viewportElement.c}),function t(n){if(null!=n.group){var o=e._managedElements[n.group];null!=o&&(i.push({r:o.viewportElement.r,c:o.viewportElement.c}),t(o))}}(n)),i}},{key:"_applyRotations",value:function(t,e){var i=t.slice(),n={x:i[0],y:i[1],cr:0,sr:0};return Gd(e,(function(t){n=ru(n,t.c,t.r)})),n}},{key:"_applyRotationsXY",value:function(t,e){return Gd(e,(function(e){t=ru(t,e.c,e.r)})),t}},{key:"_internal_newEndpoint",value:function(t){var e=Rd({},t),i=this.manage(e.element);e.elementId=this.getId(e.element),e.id="ep_"+this._idstamp();var n=new tv(this,e);return function(t,e){null!=t&&t.endpoints.push(e)}(i,n),t.uuid&&this.endpointsByUUID.set(t.uuid,n),tu(this.endpointsByElement,n.elementId,n),this._suspendDrawing||this._paintEndpoint(n,{timestamp:this._suspendedAt}),n}},{key:"_deriveEndpointAndAnchorSpec",value:function(t,e){for(var i=((e?"":"default ")+t).split(/[\s]/),n=null,o=null,s=null,r=null,a=0;a<i.length;a++){var l=this.getConnectionType(i[a]);l&&(l.endpoints&&(n=l.endpoints),l.endpoint&&(o=l.endpoint),l.anchors&&(r=l.anchors),l.anchor&&(s=l.anchor))}return{endpoints:n||[o,o],anchors:r||[s,s]}}},{key:"revalidate",value:function(t,e){var i=this.getId(t);return this.updateOffset({elId:i,recalc:!0,timestamp:e}),this.repaint(t)}},{key:"repaintEverything",value:function(){var t,e=su();for(t in this._managedElements)this.viewport.refreshElement(t,!0);for(t in this.viewport.recomputeBounds(),this._managedElements)this.repaint(this._managedElements[t].el,e,!0);return this}},{key:"setElementPosition",value:function(t,e,i){var n=this.getId(t);return this.viewport.setPosition(n,e,i),this.repaint(t)}},{key:"repaint",value:function(t,e,i){var n={c:new Set,e:new Set},o=function(t){t.c.forEach((function(t){return n.c.add(t)})),t.e.forEach((function(t){return n.e.add(t)}))};if(!this._suspendDrawing){var s=this.getId(t);if(null!=t){var r=this._getAssociatedElements(t);if(null==e&&(e=su()),!i)for(var a=0;a<r.length;a++)this.updateOffset({elId:this.getId(r[a]),recalc:!0,timestamp:e});if(o(this.router.redraw(s,e,null)),r.length>0)for(var l=0;l<r.length;l++)o(this.router.redraw(this.getId(r[l]),e,null))}}return n}},{key:"unregisterEndpoint",value:function(t){var e=t.getUuid();e&&this.endpointsByUUID.delete(e),function(t,e){null!=t&&Kd(t.endpoints,(function(t){return t===e}))}(this._managedElements[t.elementId],t);var i=this.endpointsByElement[t.elementId];null!=i&&(this.endpointsByElement[t.elementId]=i.filter((function(e){return e!==t}))),this.fire(Qu,t)}},{key:"_maybePruneEndpoint",value:function(t){return!(!t.deleteOnEmpty||0!==t.connections.length)&&(this.deleteEndpoint(t),!0)}},{key:"deleteEndpoint",value:function(t){var e=this,i="string"==typeof t?this.endpointsByUUID.get(t):t;if(i){var n=i.proxiedBy,o=i.connections.slice();Gd(o,(function(t){i.detachFromConnection(t,null,!0)})),this.unregisterEndpoint(i),i.destroy(),Gd(o,(function(t){e.deleteConnection(t,{force:!0,endpointToIgnore:i})})),null!=n&&this.deleteEndpoint(n)}return this}},{key:"addEndpoint",value:function(t,e,i){var n=Rd({},i=i||{});Rd(n,e||{});var o=Rd({element:t},n);return this._internal_newEndpoint(o)}},{key:"addEndpoints",value:function(t,e,i){for(var n=[],o=0,s=e.length;o<s;o++)n.push(this.addEndpoint(t,e[o],i));return n}},{key:"reset",value:function(){var t=this;this.silently((function(){t.endpointsByElement={},t._managedElements={},t.endpointsByUUID.clear(),t.viewport.reset(),t.router.reset(),t.groupManager.reset(),t.connections.length=0}))}},{key:"destroy",value:function(){this.reset(),this.unbind(),this.sourceSelectors.length=0,this.targetSelectors.length=0,this._connectionTypes.clear(),this._endpointTypes.clear()}},{key:"getEndpoints",value:function(t){return this.endpointsByElement[this.getId(t)]||[]}},{key:"getEndpoint",value:function(t){return this.endpointsByUUID.get(t)}},{key:"setEndpointUuid",value:function(t,e){t.uuid&&this.endpointsByUUID.delete(t.uuid),t.uuid=e,this.endpointsByUUID.set(e,t)}},{key:"connect",value:function(t,e){try{var i=this._prepareConnectionParams(t,e),n=this._newConnection(i);return this._finaliseConnection(n,i),n}catch(t){return void cu(t)}}},{key:"_prepareConnectionParams",value:function(t,e){var i=Rd({},t);e&&Rd(i,e);var n=i;if(n.source&&n.source.endpoint&&(n.sourceEndpoint=n.source),n.target&&n.target.endpoint&&(n.targetEndpoint=n.target),t.uuids&&(n.sourceEndpoint=this.getEndpoint(t.uuids[0]),n.targetEndpoint=this.getEndpoint(t.uuids[1])),null!=n.sourceEndpoint){if(n.sourceEndpoint.isFull())throw"Cannot establish connection: source endpoint is full";if(n.type||(n.type=n.sourceEndpoint.edgeType),n.sourceEndpoint.connectorOverlays){n.overlays=n.overlays||[];for(var o=0,s=n.sourceEndpoint.connectorOverlays.length;o<s;o++)n.overlays.push(n.sourceEndpoint.connectorOverlays[o])}n.sourceEndpoint.scope&&(n.scope=n.sourceEndpoint.scope)}else if(null==n.source)throw"Cannot establish connection: source does not exist";if(null!=n.targetEndpoint){if(n.targetEndpoint.isFull())throw"Cannot establish connection: target endpoint is full"}else if(null==n.target)throw"Cannot establish connection: target does not exist";if(n.sourceEndpoint&&n.targetEndpoint&&!function(t,e){for(var i=t.scope.split(/\s/),n=e.scope.split(/\s/),o=0;o<i.length;o++)for(var s=0;s<n.length;s++)if(n[s]===i[o])return!0;return!1}(n.sourceEndpoint,n.targetEndpoint))throw"Cannot establish connection: scopes do not match";return n}},{key:"_newConnection",value:function(t){t.id="con_"+this._idstamp();var e=new ov(this,t);return Yv(e,this._managedElements[e.sourceId],this._managedElements[e.targetId]),this._paintConnection(e),e}},{key:"_finaliseConnection",value:function(t,e,i){e=e||{},t.suspendedEndpoint||this.connections.push(t),t.pending=null,t.endpoints[0].isTemporarySource=!1,this.repaint(t.source);var n={connection:t,source:t.source,target:t.target,sourceId:t.sourceId,targetId:t.targetId,sourceEndpoint:t.endpoints[0],targetEndpoint:t.endpoints[1]};this.fire(Xu,n,i),e.doNotFireConnectionEvent||!1===e.fireEvent||this.fire(Yu,n,i)}},{key:"removeAllEndpoints",value:function(t,e){var i=this,n=function(t){var e,n,o=i.getId(t),s=i.endpointsByElement[o];if(s)for(e=0,n=s.length;e<n;e++)i.deleteEndpoint(s[e]);delete i.endpointsByElement[o]};return e&&this._getAssociatedElements(t).map(n),n(t),this}},{key:"_createSourceDefinition",value:function(t,e){var i=Rd({},e);Rd(i,t),i.edgeType=i.edgeType||Mf;var n=this._deriveEndpointAndAnchorSpec(i.edgeType);i.endpoint=i.endpoint||n.endpoints[0],i.anchor=i.anchor||n.anchors[0];var o=i.maxConnections||-1;return{def:Rd({},i),uniqueEndpoint:i.uniqueEndpoint,maxConnections:o,enabled:!0,endpoint:null}}},{key:"addSourceSelector",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=this._createSourceDefinition(e),o=new Eg(t,n,i);return this.sourceSelectors.push(o),o}},{key:"removeSourceSelector",value:function(t){Kd(this.sourceSelectors,(function(e){return e===t}))}},{key:"removeTargetSelector",value:function(t){Kd(this.targetSelectors,(function(e){return e===t}))}},{key:"addTargetSelector",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=this._createTargetDefinition(e),o=new Eg(t,n,i);return this.targetSelectors.push(o),o}},{key:"_createTargetDefinition",value:function(t,e){var i=Rd({},e);Rd(i,t),i.edgeType=i.edgeType||Mf;var n=i.maxConnections||-1;return{def:Rd({},i),uniqueEndpoint:i.uniqueEndpoint,maxConnections:n,enabled:!0,endpoint:null}}},{key:"show",value:function(t,e){return this._setVisible(t,Iu,e)}},{key:"hide",value:function(t,e){return this._setVisible(t,Lu,e)}},{key:"_setVisible",value:function(t,e,i){var n=e===Iu,o=null;i&&(o=function(t){t.setVisible(n,!0,!0)});var s=this.getId(t);return this._operation(t,(function(t){if(n&&i){var e=t.sourceId===s?1:0;t.endpoints[e].isVisible()&&t.setVisible(!0)}else t.setVisible(n)}),o),this}},{key:"toggleVisible",value:function(t,e){var i=null;e&&(i=function(t){var e=t.isVisible();t.setVisible(!e)}),this._operation(t,(function(t){var e=t.isVisible();t.setVisible(!e)}),i)}},{key:"_operation",value:function(t,e,i){var n=this.getId(t),o=this.endpointsByElement[n];if(o&&o.length)for(var s=0,r=o.length;s<r;s++){for(var a=0,l=o[s].connections.length;a<l;a++){if(e(o[s].connections[a]))return}i&&i(o[s])}}},{key:"registerConnectionType",value:function(t,e){if(this._connectionTypes.set(t,Rd({},e)),e.overlays){for(var i={},n=0;n<e.overlays.length;n++){var o=zg(e.overlays[n]);i[o.options.id]=o}this._connectionTypes.get(t).overlays=i}}},{key:"registerConnectionTypes",value:function(t){for(var e in t)this.registerConnectionType(e,t[e])}},{key:"registerEndpointType",value:function(t,e){if(this._endpointTypes.set(t,Rd({},e)),e.overlays){for(var i={},n=0;n<e.overlays.length;n++){var o=zg(e.overlays[n]);i[o.options.id]=o}this._endpointTypes.get(t).overlays=i}}},{key:"registerEndpointTypes",value:function(t){for(var e in t)this.registerEndpointType(e,t[e])}},{key:"getType",value:function(t,e){return"connection"===e?this.getConnectionType(t):this.getEndpointType(t)}},{key:"getConnectionType",value:function(t){return this._connectionTypes.get(t)}},{key:"getEndpointType",value:function(t){return this._endpointTypes.get(t)}},{key:"importDefaults",value:function(t){for(var e in t)this.defaults[e]=t[e];return null!=this.defaults[yv]&&(this.defaults[yv].strokeWidth=this.defaults[yv].strokeWidth||2),t.container&&this.setContainer(t.container),this}},{key:"restoreDefaults",value:function(){return this.defaults=Rd({},this._initialDefaults),this}},{key:"getManagedElements",value:function(){return this._managedElements}},{key:"proxyConnection",value:function(t,e,i,n,o){var s,r=null!=t.proxies[e],a=r?t.proxies[e].originalEp.elementId:t.endpoints[e].elementId,l=r?t.proxies[e].originalEp:t.endpoints[e],c=this.getId(i);t.proxies[e]?t.proxies[e].ep.elementId===c?s=t.proxies[e].ep:(t.proxies[e].ep.detachFromConnection(t,e),s=this._internal_newEndpoint({element:i,endpoint:n(t,e),anchor:o(t,e),parameters:{isProxyEndpoint:!0}})):s=this._internal_newEndpoint({element:i,endpoint:n(t,e),anchor:o(t,e),parameters:{isProxyEndpoint:!0}}),s.deleteOnEmpty=!0,t.proxies[e]={ep:s,originalEp:l},this.sourceOrTargetChanged(a,c,t,i,e),l.detachFromConnection(t,null,!0),s.connections=[t],t.endpoints[e]=s,l.proxiedBy=s,l.setVisible(!1),t.setVisible(!0),this.revalidate(i)}},{key:"unproxyConnection",value:function(t,e){if(null!=t.proxies&&null!=t.proxies[e]){var i=t.proxies[e].originalEp.element,n=t.proxies[e].originalEp.elementId,o=t.proxies[e].ep.elementId;t.endpoints[e]=t.proxies[e].originalEp,delete t.proxies[e].originalEp.proxiedBy,this.sourceOrTargetChanged(o,n,t,i,e),t.proxies[e].ep.detachFromConnection(t,null),t.proxies[e].originalEp.addConnection(t),t.isVisible()&&t.proxies[e].originalEp.setVisible(!0),t.proxies[e]=null,-1===Zd(t.proxies,(function(t){return null!=t}))&&(t.proxies.length=0)}}},{key:"sourceOrTargetChanged",value:function(t,e,i,n,o){t!==e&&(0===o?(i.sourceId=e,i.source=n):1===o&&(i.targetId=e,i.target=n),Xv(i,this._managedElements[t]),Yv(i,this._managedElements[e]))}},{key:"getGroup",value:function(t){return this.groupManager.getGroup(t)}},{key:"getGroupFor",value:function(t){return this.groupManager.getGroupFor(t)}},{key:"addGroup",value:function(t){return this.groupManager.addGroup(t)}},{key:"addToGroup",value:function(t){for(var e,i=arguments.length,n=new Array(i>1?i-1:0),o=1;o<i;o++)n[o-1]=arguments[o];return(e=this.groupManager).addToGroup.apply(e,[t,!1].concat(n))}},{key:"collapseGroup",value:function(t){this.groupManager.collapseGroup(t)}},{key:"expandGroup",value:function(t){this.groupManager.expandGroup(t)}},{key:"toggleGroup",value:function(t){this.groupManager.toggleGroup(t)}},{key:"removeGroup",value:function(t,e,i,n){return this.groupManager.removeGroup(t,e,i,n)}},{key:"removeAllGroups",value:function(t,e){this.groupManager.removeAllGroups(t,e,!1)}},{key:"removeFromGroup",value:function(t,e,i){this.groupManager.removeFromGroup(t,i,e),this._appendElement(e,this.getContainer()),this.updateOffset({recalc:!0,elId:this.getId(e)})}},{key:"_paintEndpoint",value:function(t,e){var i=(e=e||{}).timestamp,n=!(!1===e.recalc);if(!i||t.timestamp!==i){var o=this.viewport.getPosition(t.elementId),s=e.offset?{x:e.offset.x,y:e.offset.y}:{x:o.x,y:o.y};if(null!=s){var r=e.anchorLoc;if(null==r){var a={xy:s,wh:o,element:t,timestamp:i};if(n&&this.router.isDynamicAnchor(t)&&t.connections.length>0){var l=function(t){var i=0;if(null!=e.elementWithPrecedence)for(var n=0;n<t.connections.length;n++)if(t.connections[n].sourceId===e.elementWithPrecedence||t.connections[n].targetId===e.elementWithPrecedence){i=n;break}return t.connections[i]}(t),c=l.endpoints[0]===t?1:0,h=0===c?l.sourceId:l.targetId,d=this.viewport.getPosition(h);a.index=0===c?1:0,a.connection=l,a.txy=d,a.twh=d,a.tElement=l.endpoints[c],a.tRotation=this._getRotations(h)}else t.connections.length>0&&(a.connection=t.connections[0]);a.rotation=this._getRotations(t.elementId),r=this.router.computeAnchorLocation(t._anchor,a)}for(var u in t.endpoint.compute(r,this.router.getEndpointOrientation(t),t.paintStyleInUse),this.renderEndpoint(t,t.paintStyleInUse),t.timestamp=i,t.overlays)if(t.overlays.hasOwnProperty(u)){var p=t.overlays[u];p.isVisible()&&(t.overlayPlacements[u]=this.drawOverlay(p,t.endpoint,t.paintStyleInUse,t.getAbsoluteOverlayPosition(p)),this._paintOverlay(p,t.overlayPlacements[u],{xmin:0,ymin:0}))}}}}},{key:"_paintConnection",value:function(t,e){if(!this._suspendDrawing&&!1!==t.visible){var i=(e=e||{}).timestamp;if(null!=i&&i===t.lastPaintedAt)return;if(null==i||i!==t.lastPaintedAt){this.router.computePath(t,i);var n={xmin:1/0,ymin:1/0,xmax:-1/0,ymax:-1/0};for(var o in t.overlays)if(t.overlays.hasOwnProperty(o)){var s=t.overlays[o];s.isVisible()&&(t.overlayPlacements[o]=this.drawOverlay(s,t.connector,t.paintStyleInUse,t.getAbsoluteOverlayPosition(s)),n.xmin=Math.min(n.xmin,t.overlayPlacements[o].xmin),n.xmax=Math.max(n.xmax,t.overlayPlacements[o].xmax),n.ymin=Math.min(n.ymin,t.overlayPlacements[o].ymin),n.ymax=Math.max(n.ymax,t.overlayPlacements[o].ymax))}var r=parseFloat(""+t.paintStyleInUse.strokeWidth||"1")/2,a=parseFloat(""+t.paintStyleInUse.strokeWidth||"0"),l={xmin:Math.min(t.connector.bounds.xmin-(r+a),n.xmin),ymin:Math.min(t.connector.bounds.ymin-(r+a),n.ymin),xmax:Math.max(t.connector.bounds.xmax+(r+a),n.xmax),ymax:Math.max(t.connector.bounds.ymax+(r+a),n.ymax)};for(var c in this.paintConnector(t.connector,t.paintStyleInUse,l),t.overlays)if(t.overlays.hasOwnProperty(c)){var h=t.overlays[c];h.isVisible()&&this._paintOverlay(h,t.overlayPlacements[c],l)}}t.lastPaintedAt=i}}},{key:"_refreshEndpoint",value:function(t){t._anchor.isFloating||(t.connections.length>0?this.addEndpointClass(t,this.endpointConnectedClass):this.removeEndpointClass(t,this.endpointConnectedClass),t.isFull()?this.addEndpointClass(t,this.endpointFullClass):this.removeEndpointClass(t,this.endpointFullClass))}},{key:"_makeConnector",value:function(t,e,i){return Hv(t,e,i)}},{key:"addOverlay",value:function(t,e,i){if(t.addOverlay(e),!i){var n=t instanceof tv?t.element:t.source;this.revalidate(n)}}},{key:"removeOverlay",value:function(t,e){t.removeOverlay(e);var i=t instanceof tv?t.element:t.source;this.revalidate(i)}},{key:"setOutlineColor",value:function(t,e){t.paintStyleInUse.outlineStroke=e,this._paintConnection(t)}},{key:"setOutlineWidth",value:function(t,e){t.paintStyleInUse.outlineWidth=e,this._paintConnection(t)}},{key:"setColor",value:function(t,e){t.paintStyleInUse.stroke=e,this._paintConnection(t)}},{key:"setLineWidth",value:function(t,e){t.paintStyleInUse.strokeWidth=e,this._paintConnection(t)}},{key:"setLineStyle",value:function(t,e){null!=e.lineWidth&&(t.paintStyleInUse.strokeWidth=e.lineWidth),null!=e.outlineWidth&&(t.paintStyleInUse.outlineWidth=e.outlineWidth),null!=e.color&&(t.paintStyleInUse.stroke=e.color),null!=e.outlineColor&&(t.paintStyleInUse.outlineStroke=e.outlineColor),this._paintConnection(t)}},{key:"getPathData",value:function(t){for(var e="",i=0;i<t.segments.length;i++)e+=t.segments[i].getPath(0===i),e+=" ";return e}}]),i}($g),Qv={};function Jv(t,e){Qv[t]=e}function ty(t,e,i){var n=e,o=_d(e.getBoundingClientRect)!==Af?e.getBoundingClientRect():{left:0,top:0,width:0,height:0},s=document.body,r=document.documentElement,a=window.pageYOffset||r.scrollTop||s.scrollTop,l=window.pageXOffset||r.scrollLeft||s.scrollLeft,c=r.clientTop||s.clientTop||0,h=r.clientLeft||s.clientLeft||0,d=o.top+a-c+0*i,u=o.left+l-h+0*i,p=qf(t),f=o.width||n.offsetWidth*i,m=o.height||n.offsetHeight*i;return{x:(p.x-u)/f,y:(p.y-d)/m}}function ey(t){return dv(t)||pv(t)||mv(t)}function iy(t,e){t.canvas&&(t.canvas.style.display=e?"block":"none")}function ny(t){t.canvas&&t.canvas.parentNode.removeChild(t.canvas),delete t.canvas}function oy(t){return t.canvas}function sy(t){return Lg.getElement(t)}function ry(t){return Lg.getElement(t,t.component,(function(e){var i=t.create(e);return t.instance.addClass(i,t.instance.overlayClass),i}))}function ay(t,e,i,n){var o=t.x,s=t.y;return e._jsPlumbParentGroup&&e._jsPlumbParentGroup.constrain&&(o=Math.max(t.x,0),s=Math.max(t.y,0),o=Math.min(o,i.w-n.w),s=Math.min(s,i.h-n.h)),{x:o,y:s}}var ly=function(t){Ed(i,t);var e=Pd(i);function i(t,n){var o;if(wd(this,i),(o=e.call(this,t,n))._instanceIndex=t,Cd(Td(o),"containerType",null),Cd(Td(o),"dragSelection",void 0),Cd(Td(o),"dragManager",void 0),Cd(Td(o),"_connectorClick",void 0),Cd(Td(o),"_connectorDblClick",void 0),Cd(Td(o),"_connectorTap",void 0),Cd(Td(o),"_connectorDblTap",void 0),Cd(Td(o),"_endpointClick",void 0),Cd(Td(o),"_endpointDblClick",void 0),Cd(Td(o),"_overlayClick",void 0),Cd(Td(o),"_overlayDblClick",void 0),Cd(Td(o),"_overlayTap",void 0),Cd(Td(o),"_overlayDblTap",void 0),Cd(Td(o),"_connectorMouseover",void 0),Cd(Td(o),"_connectorMouseout",void 0),Cd(Td(o),"_endpointMouseover",void 0),Cd(Td(o),"_endpointMouseout",void 0),Cd(Td(o),"_connectorContextmenu",void 0),Cd(Td(o),"_connectorMousedown",void 0),Cd(Td(o),"_connectorMouseup",void 0),Cd(Td(o),"_endpointMousedown",void 0),Cd(Td(o),"_endpointMouseup",void 0),Cd(Td(o),"_overlayMouseover",void 0),Cd(Td(o),"_overlayMouseout",void 0),Cd(Td(o),"_elementClick",void 0),Cd(Td(o),"_elementTap",void 0),Cd(Td(o),"_elementDblTap",void 0),Cd(Td(o),"_elementMouseenter",void 0),Cd(Td(o),"_elementMouseexit",void 0),Cd(Td(o),"_elementMousemove",void 0),Cd(Td(o),"_elementMouseup",void 0),Cd(Td(o),"_elementMousedown",void 0),Cd(Td(o),"_elementContextmenu",void 0),Cd(Td(o),"_resizeObserver",void 0),Cd(Td(o),"eventManager",void 0),Cd(Td(o),"draggingClass","jtk-dragging"),Cd(Td(o),"elementDraggingClass","jtk-element-dragging"),Cd(Td(o),"hoverClass","jtk-hover"),Cd(Td(o),"sourceElementDraggingClass","jtk-source-element-dragging"),Cd(Td(o),"targetElementDraggingClass","jtk-target-element-dragging"),Cd(Td(o),"hoverSourceClass","jtk-source-hover"),Cd(Td(o),"hoverTargetClass","jtk-target-hover"),Cd(Td(o),"dragSelectClass","jtk-drag-select"),Cd(Td(o),"managedElementsSelector",void 0),Cd(Td(o),"elementsDraggable",void 0),Cd(Td(o),"elementDragHandler",void 0),Cd(Td(o),"groupDragOptions",void 0),Cd(Td(o),"elementDragOptions",void 0),Cd(Td(o),"svg",{node:function(t,e){return bp(t,e)},attr:function(t,e){return yp(t,e)},pos:function(t){return xp(t)}}),n=n||{},o.containerType=Mu(o.getContainer()),o.elementsDraggable=n&&!1!==n.elementsDraggable,o.managedElementsSelector=n&&n.managedElementsSelector||ap,o.eventManager=new em,o.dragSelection=new Rm(Td(o)),o.dragManager=new jm(Td(o),o.dragSelection),o.dragManager.addHandler(new Dg(Td(o))),o.groupDragOptions={constrainFunction:ay},o.dragManager.addHandler(new Ig(Td(o),o.dragSelection),o.groupDragOptions),o.elementDragHandler=new Um(Td(o),o.dragSelection),o.elementDragOptions=n&&n.dragOptions||{},o.dragManager.addHandler(o.elementDragHandler,o.elementDragOptions),n&&n.dragOptions&&n.dragOptions.filter&&o.dragManager.addFilter(n.dragOptions.filter),o._createEventListeners(),o._attachEventDelegates(),!1!==n.resizeObserver)try{o._resizeObserver=new ResizeObserver((function(t){var e=t.filter((function(t){var e=o.getAttribute(t.target,Nu);if(null!=e){var i=o.viewport._elementMap.get(e);return!!i&&(i.w!==t.contentRect.width||i.h!==t.contentRect.height)}return!1}));e.forEach((function(t){return o.revalidate(t.target)}))}))}catch(t){cu("WARN: ResizeObserver could not be attached.")}return o}return Sd(i,[{key:"fireOverlayMethod",value:function(t,e,i){var n=kp(t.component instanceof ov?Op:Tp,e);i._jsPlumbOverlay=t,t.fire(e,{e:i,overlay:t}),this.fire(n,t.component,i)}},{key:"addDragFilter",value:function(t,e){this.dragManager.addFilter(t,e)}},{key:"removeDragFilter",value:function(t){this.dragManager.removeFilter(t)}},{key:"setDragGrid",value:function(t){this.dragManager.setOption(this.elementDragHandler,{grid:t})}},{key:"setDragConstrainFunction",value:function(t){this.dragManager.setOption(this.elementDragHandler,{constrainFunction:t})}},{key:"_removeElement",value:function(t){t.parentNode&&t.parentNode.removeChild(t)}},{key:"_appendElement",value:function(t,e){e&&e.appendChild(t)}},{key:"_appendElementToGroup",value:function(t,e){this.getGroupContentArea(t).appendChild(e)}},{key:"_appendElementToContainer",value:function(t){this._appendElement(t,this.getContainer())}},{key:"_getAssociatedElements",value:function(t){var e=[];if(3!==t.nodeType&&8!==t.nodeType){var i=t.querySelectorAll(ap);Array.prototype.push.apply(e,i)}return e.filter((function(t){return 3!==t.nodeType&&8!==t.nodeType}))}},{key:"shouldFireEvent",value:function(t,e,i){return!0}},{key:"getClass",value:function(t){return function(t){return yu(t)}(t)}},{key:"addClass",value:function(t,e){_u(t,e)}},{key:"hasClass",value:function(t,e){return function(t,e){return t.classList?t.classList.contains(e):-1!==yu(t).indexOf(e)}(t,e)}},{key:"removeClass",value:function(t,e){wu(t,e)}},{key:"toggleClass",value:function(t,e){!function(t,e){var i=this,n=function(t,e){null!=t&&null!=e&&e.length>0&&(t.classList?t.classList.toggle(e):i.hasClass(t,e)?i.removeClass(t,e):i.addClass(t,e))};xu(t)?Gd(t,(function(t){return n(t,e)})):n(t,e)}(t,e)}},{key:"setAttribute",value:function(t,e,i){t.setAttribute(e,i)}},{key:"getAttribute",value:function(t,e){return t.getAttribute(e)}},{key:"setAttributes",value:function(t,e){for(var i in e)t.setAttribute(i,e[i])}},{key:"removeAttribute",value:function(t,e){t.removeAttribute&&t.removeAttribute(e)}},{key:"on",value:function(t,e,i,n){var o=this,s=function(t){null==n?o.eventManager.on(t,e,i):o.eventManager.on(t,e,i,n)};return xu(t)?Gd(t,(function(t){return s(t)})):s(t),this}},{key:"off",value:function(t,e,i){var n=this;return xu(t)?Gd(t,(function(t){return n.eventManager.off(t,e,i)})):this.eventManager.off(t,e,i),this}},{key:"trigger",value:function(t,e,i,n,o){this.eventManager.trigger(t,e,i,n,o)}},{key:"getOffsetRelativeToRoot",value:function(t){return Cu(t)}},{key:"getOffset",value:function(t){for(var e,i=t,n=this.getContainer(),o=this.getPosition(i),s=t!==n&&i.offsetParent!==n?i.offsetParent:null;null!=s;)o.x+=s.offsetLeft,o.y+=s.offsetTop,null!=(e=s)&&e!==document.body&&(e.scrollTop>0||e.scrollLeft>0)&&(o.x-=e.scrollLeft,o.y-=e.scrollTop),s=s.offsetParent===n?null:s.offsetParent;if(null!=n&&(n.scrollTop>0||n.scrollLeft>0)){var r=null!=i.offsetParent?this.getStyle(i.offsetParent,yf):"static",a=this.getStyle(i,yf);a!==$u&&a!==zu&&r!==$u&&r!==zu&&(o.x-=n.scrollLeft,o.y-=n.scrollTop)}return o}},{key:"getSize",value:function(t){var e=t;return null!=e.offsetWidth?function(t){return{w:t.offsetWidth,h:t.offsetHeight}}(t):e.width&&e.width.baseVal?function(t){try{return{w:parseFloat(t.width.baseVal.value),h:parseFloat(t.height.baseVal.value)}}catch(t){return{w:0,h:0}}}(e):void 0}},{key:"getPosition",value:function(t){var e=t;return null!=e.offsetLeft?{x:parseFloat(e.offsetLeft),y:parseFloat(e.offsetTop)}:e.x&&e.x.baseVal?function(t){try{return{x:parseFloat(t.x.baseVal.value),y:parseFloat(t.y.baseVal.value)}}catch(t){return{x:0,y:0}}}(e):void 0}},{key:"getStyle",value:function(t,e){return _d(window.getComputedStyle)!==Af?getComputedStyle(t,null).getPropertyValue(e):t.currentStyle[e]}},{key:"getGroupContentArea",value:function(t){var e=this.getSelector(t.el,wf);return e&&e.length>0?e[0]:t.el}},{key:"getSelector",value:function(t,e){var i=null;if(1===arguments.length){if(!Bd(t)){var n=document.createDocumentFragment();return n.appendChild(t),Qd(n.childNodes)}i=Qd(document.querySelectorAll(t))}else i=Qd(t.querySelectorAll(e));return i}},{key:"setPosition",value:function(t,e){var i=t;i.style.left=e.x+"px",i.style.top=e.y+"px"}},{key:"setDraggable",value:function(t,e){e?this.removeAttribute(t,Bu):this.setAttribute(t,Bu,Tf)}},{key:"isDraggable",value:function(t){var e=this.getAttribute(t,Bu);return null==e||e===Pf}},{key:"toggleDraggable",value:function(t){var e=this.isDraggable(t);return this.setDraggable(t,!e),!e}},{key:"_createEventListeners",value:function(){var t=function(t,e){if(!e.defaultPrevented&&null==e._jsPlumbOverlay){var i=gu(vu(e),bf,this.getContainer(),!0);this.fire(t,i.jtk.connector.connection,e)}};this._connectorClick=t.bind(this,cf),this._connectorDblClick=t.bind(this,hf),this._connectorTap=t.bind(this,vf),this._connectorDblTap=t.bind(this,df);var e=function(t,e){var i=vu(e).parentNode;if(i.jtk&&i.jtk.connector){var n=i.jtk.connector,o=n.connection;this.setConnectorHover(n,t),t?(this.addClass(o.source,this.hoverSourceClass),this.addClass(o.target,this.hoverTargetClass)):(this.removeClass(o.source,this.hoverSourceClass),this.removeClass(o.target,this.hoverTargetClass)),this.fire(t?pf:uf,i.jtk.connector.connection,e)}};this._connectorMouseover=e.bind(this,!0),this._connectorMouseout=e.bind(this,!1);var i=function(t,e){var i=vu(e).parentNode;i.jtk&&i.jtk.connector&&this.fire(t?ff:mf,i.jtk.connector.connection,e)};this._connectorMouseup=i.bind(this,!0),this._connectorMousedown=i.bind(this,!1),this._connectorContextmenu=function(t){var e=vu(t).parentNode;e.jtk&&e.jtk.connector&&this.fire(gf,e.jtk.connector.connection,t)}.bind(this);var n=function(t,e,i){e.defaultPrevented||null!=e._jsPlumbOverlay||this.fire(t,i.jtk.endpoint,e)};this._endpointClick=n.bind(this,nf),this._endpointDblClick=n.bind(this,of);var o=function(t,e){var i=vu(e);i.jtk&&i.jtk.endpoint&&(this.setEndpointHover(i.jtk.endpoint,t),this.fire(t?rf:sf,i.jtk.endpoint,e))};this._endpointMouseover=o.bind(this,!0),this._endpointMouseout=o.bind(this,!1);var s=function(t,e){var i=vu(e);i.jtk&&i.jtk.endpoint&&this.fire(t?af:lf,i.jtk.endpoint,e)};this._endpointMouseup=s.bind(this,!0),this._endpointMousedown=s.bind(this,!1);var r=function(t,e){var i=gu(vu(e),kf,this.getContainer(),!0).jtk.overlay;i&&this.fireOverlayMethod(i,t,e)}.bind(this);this._overlayClick=r.bind(this,Dp),this._overlayDblClick=r.bind(this,Lp),this._overlayTap=r.bind(this,Vp),this._overlayDblTap=r.bind(this,$p);var a=function(t,e){var i=gu(vu(e),kf,this.getContainer(),!0).jtk.overlay;i&&this.setOverlayHover(i,t)};this._overlayMouseover=a.bind(this,!0),this._overlayMouseout=a.bind(this,!1);this._elementClick=function(t,e,i){e.defaultPrevented||this.fire(1===e.detail?Wp:Gp,i,e)}.bind(this,Wp);this._elementTap=function(t,e,i){e.defaultPrevented||this.fire(ef,i,e)}.bind(this,ef);this._elementDblTap=function(t,e,i){e.defaultPrevented||this.fire(Zp,i,e)}.bind(this,Zp);var l=function(t,e){this.fire(t?Xp:Yp,vu(e),e)};this._elementMouseenter=l.bind(this,!0),this._elementMouseexit=l.bind(this,!1),this._elementMousemove=function(t){this.fire(Kp,vu(t),t)}.bind(this),this._elementMouseup=function(t){this.fire(Qp,vu(t),t)}.bind(this),this._elementMousedown=function(t){this.fire(Jp,vu(t),t)}.bind(this),this._elementContextmenu=function(t){this.fire(tf,vu(t),t)}.bind(this)}},{key:"_attachEventDelegates",value:function(){var t=this.getContainer();this.eventManager.on(t,Dp,kf,this._overlayClick),this.eventManager.on(t,Lp,kf,this._overlayDblClick),this.eventManager.on(t,Vp,kf,this._overlayTap),this.eventManager.on(t,$p,kf,this._overlayDblTap),this.eventManager.on(t,Dp,bf,this._connectorClick),this.eventManager.on(t,Lp,bf,this._connectorDblClick),this.eventManager.on(t,Vp,bf,this._connectorTap),this.eventManager.on(t,$p,bf,this._connectorDblTap),this.eventManager.on(t,Dp,xf,this._endpointClick),this.eventManager.on(t,Lp,xf,this._endpointDblClick),this.eventManager.on(t,Dp,this.managedElementsSelector,this._elementClick),this.eventManager.on(t,Vp,this.managedElementsSelector,this._elementTap),this.eventManager.on(t,$p,this.managedElementsSelector,this._elementDblTap),this.eventManager.on(t,qp,bf,this._connectorMouseover),this.eventManager.on(t,Fp,bf,this._connectorMouseout),this.eventManager.on(t,Ip,bf,this._connectorContextmenu),this.eventManager.on(t,jp,bf,this._connectorMouseup),this.eventManager.on(t,zp,bf,this._connectorMousedown),this.eventManager.on(t,qp,xf,this._endpointMouseover),this.eventManager.on(t,Fp,xf,this._endpointMouseout),this.eventManager.on(t,jp,xf,this._endpointMouseup),this.eventManager.on(t,zp,xf,this._endpointMousedown),this.eventManager.on(t,qp,kf,this._overlayMouseover),this.eventManager.on(t,Fp,kf,this._overlayMouseout),this.eventManager.on(t,qp,ap,this._elementMouseenter),this.eventManager.on(t,Fp,ap,this._elementMouseexit),this.eventManager.on(t,Bp,ap,this._elementMousemove),this.eventManager.on(t,jp,ap,this._elementMouseup),this.eventManager.on(t,zp,ap,this._elementMousedown),this.eventManager.on(t,Ip,ap,this._elementContextmenu)}},{key:"_detachEventDelegates",value:function(){var t=this.getContainer();t&&(this.eventManager.off(t,Dp,this._connectorClick),this.eventManager.off(t,Lp,this._connectorDblClick),this.eventManager.off(t,Vp,this._connectorTap),this.eventManager.off(t,$p,this._connectorDblTap),this.eventManager.off(t,Dp,this._endpointClick),this.eventManager.off(t,Lp,this._endpointDblClick),this.eventManager.off(t,Dp,this._overlayClick),this.eventManager.off(t,Lp,this._overlayDblClick),this.eventManager.off(t,Vp,this._overlayTap),this.eventManager.off(t,$p,this._overlayDblTap),this.eventManager.off(t,Dp,this._elementClick),this.eventManager.off(t,Vp,this._elementTap),this.eventManager.off(t,$p,this._elementDblTap),this.eventManager.off(t,qp,this._connectorMouseover),this.eventManager.off(t,Fp,this._connectorMouseout),this.eventManager.off(t,Ip,this._connectorContextmenu),this.eventManager.off(t,jp,this._connectorMouseup),this.eventManager.off(t,zp,this._connectorMousedown),this.eventManager.off(t,qp,this._endpointMouseover),this.eventManager.off(t,Fp,this._endpointMouseout),this.eventManager.off(t,jp,this._endpointMouseup),this.eventManager.off(t,zp,this._endpointMousedown),this.eventManager.off(t,qp,this._overlayMouseover),this.eventManager.off(t,Fp,this._overlayMouseout),this.eventManager.off(t,Rp,this._elementMouseenter),this.eventManager.off(t,Np,this._elementMouseexit),this.eventManager.off(t,Bp,this._elementMousemove),this.eventManager.off(t,jp,this._elementMouseup),this.eventManager.off(t,zp,this._elementMousedown),this.eventManager.off(t,Ip,this._elementContextmenu))}},{key:"setContainer",value:function(t){var e,n=this;if(t===document||t===document.body)throw new Error("Cannot set document or document.body as container element");this._detachEventDelegates(),null!=this.dragManager&&(e=this.dragManager.reset()),this.setAttribute(t,Ep,su().replace("-",""));var o=this.getContainer();null!=o&&(o.removeAttribute(Ep),Gd(Qd(o.childNodes).filter((function(t){return null!=t&&(n.hasClass(t,Vu)||n.hasClass(t,Hu)||n.hasClass(t,Zu)||t.getAttribute&&null!=t.getAttribute(Nu))})),(function(e){t.appendChild(e)})));Od(Ad(i.prototype),"setContainer",this).call(this,t),this.containerType=Mu(t),null!=this.eventManager&&this._attachEventDelegates(),null!=this.dragManager&&(this.dragManager.addHandler(new Dg(this)),this.dragManager.addHandler(new Ig(this,this.dragSelection),this.groupDragOptions),this.elementDragHandler=new Um(this,this.dragSelection),this.dragManager.addHandler(this.elementDragHandler,this.elementDragOptions),null!=e&&this.dragManager.setFilters(e))}},{key:"reset",value:function(){Od(Ad(i.prototype),"reset",this).call(this),this._resizeObserver&&this._resizeObserver.disconnect(),Gd(this.getContainer().querySelectorAll([ap,xf,bf,kf].join(",")),(function(t){return t.parentNode&&t.parentNode.removeChild(t)}))}},{key:"destroy",value:function(){this._detachEventDelegates(),null!=this.dragManager&&this.dragManager.reset(),this.clearDragSelection(),Od(Ad(i.prototype),"destroy",this).call(this)}},{key:"unmanage",value:function(t,e){null!=this._resizeObserver&&this._resizeObserver.unobserve(t),this.removeFromDragSelection(t),Od(Ad(i.prototype),"unmanage",this).call(this,t,e)}},{key:"addToDragSelection",value:function(){for(var t=this,e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];Gd(i,(function(e){return t.dragSelection.add(e)}))}},{key:"clearDragSelection",value:function(){this.dragSelection.clear()}},{key:"removeFromDragSelection",value:function(){for(var t=this,e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];Gd(i,(function(e){return t.dragSelection.remove(e)}))}},{key:"toggleDragSelection",value:function(){for(var t=this,e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];Gd(i,(function(e){return t.dragSelection.toggle(e)}))}},{key:"addToDragGroup",value:function(t){for(var e,i=arguments.length,n=new Array(i>1?i-1:0),o=1;o<i;o++)n[o-1]=arguments[o];(e=this.elementDragHandler).addToDragGroup.apply(e,[t].concat(n))}},{key:"removeFromDragGroup",value:function(){var t;(t=this.elementDragHandler).removeFromDragGroup.apply(t,arguments)}},{key:"setDragGroupState",value:function(t){for(var e,i=arguments.length,n=new Array(i>1?i-1:0),o=1;o<i;o++)n[o-1]=arguments[o];(e=this.elementDragHandler).setDragGroupState.apply(e,[t].concat(n))}},{key:"clearDragGroup",value:function(t){this.elementDragHandler.clearDragGroup(t)}},{key:"consume",value:function(t,e){mu(t,e)}},{key:"rotate",value:function(t,e,n){var o=this.getId(t);return this._managedElements[o]?(this._managedElements[o].el.style.transform="rotate("+e+"deg)",this._managedElements[o].el.style.transformOrigin="center center",Od(Ad(i.prototype),"rotate",this).call(this,t,e,n)):{c:new Set,e:new Set}}},{key:"addOverlayClass",value:function(t,e){if(qg(t))t.instance.addClass(sy(t),e);else if(ey(t))t.instance.addClass(sv(t),e);else{if(!vv(t))throw"Could not add class to overlay of type ["+t.type+"]";t.instance.addClass(ry(t),e)}}},{key:"removeOverlayClass",value:function(t,e){if(qg(t))t.instance.removeClass(sy(t),e);else if(ey(t))t.instance.removeClass(sv(t),e);else{if(!vv(t))throw"Could not remove class from overlay of type ["+t.type+"]";t.instance.removeClass(ry(t),e)}}},{key:"_paintOverlay",value:function(t,e,i){if(qg(t)){sy(t);var n=t.component.getXY();t.canvas.style.left=n.x+e.d.minx+"px",t.canvas.style.top=n.y+e.d.miny+"px"}else if(ey(t)){!function(t,e,i,n){sv(t);var o=[0,0];n.xmin<0&&(o[0]=-n.xmin),n.ymin<0&&(o[1]=-n.ymin);var s={d:e,stroke:i.stroke?i.stroke:null,fill:i.fill?i.fill:null,transform:"translate("+o[0]+","+o[1]+")","pointer-events":"visibleStroke"};yp(t.path,s)}(t,isNaN(e.d.cxy.x)||isNaN(e.d.cxy.y)?"M 0 0":"M"+e.d.hxy.x+","+e.d.hxy.y+" L"+e.d.tail[0].x+","+e.d.tail[0].y+" L"+e.d.cxy.x+","+e.d.cxy.y+" L"+e.d.tail[1].x+","+e.d.tail[1].y+" Z",e,i)}else{if(!vv(t))throw"Could not paint overlay of type ["+t.type+"]";ry(t);var o=t.component.getXY();t.canvas.style.left=o.x+e.d.minx+"px",t.canvas.style.top=o.y+e.d.miny+"px"}}},{key:"setOverlayVisible",value:function(t,e){var i=e?"block":"none";function n(t){null!=t&&(t.style.display=i)}qg(t)?n(sy(t)):vv(t)?n(ry(t)):ey(t)&&n(t.path)}},{key:"reattachOverlay",value:function(t,e){qg(t)?t.instance._appendElement(sy(t),this.getContainer()):vv(t)?t.instance._appendElement(ry(t),this.getContainer()):ey(t)&&this._appendElement(sv(t),e.connector.canvas)}},{key:"setOverlayHover",value:function(t,e){var i;qg(t)?i=sy(t):vv(t)?i=ry(t):ey(t)&&(i=sv(t)),null!=i&&(null!=this.hoverClass&&(e?this.addClass(i,this.hoverClass):this.removeClass(i,this.hoverClass)),this.setHover(t.component,e))}},{key:"destroyOverlay",value:function(t){if(qg(t)){var e=sy(t);e.parentNode.removeChild(e),delete t.canvas,delete t.cachedDimensions}else if(dv(t)||pv(t)||mv(t))!function(t,e){var i=t;null!=i.path&&null!=i.path.parentNode&&i.path.parentNode.removeChild(i.path),null!=i.bgPath&&null!=i.bgPath.parentNode&&i.bgPath.parentNode.removeChild(i.bgPath),delete i.path,delete i.bgPath}(t);else if(vv(t)){var i=ry(t);i.parentNode.removeChild(i),delete t.canvas,delete t.cachedDimensions}}},{key:"drawOverlay",value:function(t,e,i,n){if(qg(t)||vv(t)){var o=Lg._getDimensions(t);if(null!=o&&null!=o.w&&null!=o.h){var s={x:0,y:0};if(n)s={x:n.x,y:n.y};else if(e instanceof Xm){var r=Array.isArray(t.location)?t.location:[t.location,t.location];s={x:r[0]*e.w,y:r[1]*e.h}}else{var a=t.location,l=!1;(Bd(t.location)||t.location<0||t.location>1)&&(a=parseInt(""+t.location,10),l=!0),s=e.pointOnPath(a,l)}var c=s.x-o.w/2,h=s.y-o.h/2;return{component:t,d:{minx:c,miny:h,td:o,cxy:s},xmin:c,xmax:c+o.w,ymin:h,ymax:h+o.h}}return{xmin:0,xmax:0,ymin:0,ymax:0}}if(dv(t)||pv(t)||mv(t))return t.draw(e,i,n);throw"Could not draw overlay of type ["+t.type+"]"}},{key:"updateLabel",value:function(t){if(qd(t.label)){var e=t.label(this);sy(t).innerText=null!=e?e:""}else null==t.labelText&&(t.labelText=t.label,null!=t.labelText?sy(t).innerText=t.labelText:sy(t).innerText="")}},{key:"setHover",value:function(t,e){t._hover=e,t instanceof tv&&null!=t.endpoint?this.setEndpointHover(t,e,-1):t instanceof ov&&null!=t.connector&&this.setConnectorHover(t.connector,e)}},{key:"paintConnector",value:function(t,e,i){av(this,t,e,i)}},{key:"setConnectorHover",value:function(t,e,i){if(!1===e||!this.currentlyDragging&&!this.isHoverSuspended()){var n=t.canvas;null!=n&&(null!=t.hoverClass&&(e?this.addClass(n,t.hoverClass):this.removeClass(n,t.hoverClass)),e?this.addClass(n,this.hoverClass):this.removeClass(n,this.hoverClass)),null!=t.connection.hoverPaintStyle&&(t.connection.paintStyleInUse=e?t.connection.hoverPaintStyle:t.connection.paintStyle,this._suspendDrawing||this._paintConnection(t.connection)),t.connection.endpoints[0]!==i&&this.setEndpointHover(t.connection.endpoints[0],e,0,!0),t.connection.endpoints[1]!==i&&this.setEndpointHover(t.connection.endpoints[1],e,1,!0)}}},{key:"destroyConnector",value:function(t){null!=t.connector&&ny(t.connector)}},{key:"addConnectorClass",value:function(t,e){t.canvas&&this.addClass(t.canvas,e)}},{key:"removeConnectorClass",value:function(t,e){t.canvas&&this.removeClass(t.canvas,e)}},{key:"getConnectorClass",value:function(t){return t.canvas?t.canvas.className.baseVal:""}},{key:"setConnectorVisible",value:function(t,e){iy(t,e)}},{key:"applyConnectorType",value:function(t,e){if(t.canvas&&e.cssClass){var i=Array.isArray(e.cssClass)?e.cssClass:[e.cssClass];this.addClass(t.canvas,i.join(" "))}}},{key:"addEndpointClass",value:function(t,e){var i=oy(t.endpoint);null!=i&&this.addClass(i,e)}},{key:"applyEndpointType",value:function(t,e){if(e.cssClass){var i=oy(t.endpoint);if(i){var n=Array.isArray(e.cssClass)?e.cssClass:[e.cssClass];this.addClass(i,n.join(" "))}}}},{key:"destroyEndpoint",value:function(t){var e=this.endpointAnchorClassPrefix+(t.currentAnchorClass?"-"+t.currentAnchorClass:"");this.removeClass(t.element,e),ny(t.endpoint)}},{key:"renderEndpoint",value:function(t,e){var i=Qv[t.endpoint.type];null!=i?lv.paint(t.endpoint,i,e):cu("jsPlumb: no endpoint renderer found for type ["+t.endpoint.type+"]")}},{key:"removeEndpointClass",value:function(t,e){var i=oy(t.endpoint);null!=i&&this.removeClass(i,e)}},{key:"getEndpointClass",value:function(t){var e=oy(t.endpoint);return null!=e?e.className:""}},{key:"setEndpointHover",value:function(t,e,i,n){if(null!=t&&(!1===e||!this.currentlyDragging&&!this.isHoverSuspended())){var o=oy(t.endpoint);if(null!=o&&(null!=t.hoverClass&&(e?this.addClass(o,t.hoverClass):this.removeClass(o,t.hoverClass)),0===i||1===i)){var s=0===i?this.hoverSourceClass:this.hoverTargetClass;e?this.addClass(o,s):this.removeClass(o,s)}if(null!=t.hoverPaintStyle&&(t.paintStyleInUse=e?t.hoverPaintStyle:t.paintStyle,this._suspendDrawing||this.renderEndpoint(t,t.paintStyleInUse)),!n)for(var r=0;r<t.connections.length;r++)this.setConnectorHover(t.connections[r].connector,e,t)}}},{key:"setEndpointVisible",value:function(t,e){iy(t.endpoint,e)}},{key:"setGroupVisible",value:function(t,e){for(var i=t.el.querySelectorAll(ap),n=0;n<i.length;n++)e?this.show(i[n],!0):this.hide(i[n],!0)}},{key:"deleteConnection",value:function(t,e){return null!=t&&!0!==t.deleted&&(!0!==t.endpoints[0].deleted&&this.setEndpointHover(t.endpoints[0],!1,0,!0),!0!==t.endpoints[1].deleted&&this.setEndpointHover(t.endpoints[1],!1,1,!0),Od(Ad(i.prototype),"deleteConnection",this).call(this,t,e))}},{key:"addSourceSelector",value:function(t,e,n){return this.addDragFilter(t),Od(Ad(i.prototype),"addSourceSelector",this).call(this,t,e,n)}},{key:"removeSourceSelector",value:function(t){this.removeDragFilter(t.selector),Od(Ad(i.prototype),"removeSourceSelector",this).call(this,t)}},{key:"manage",value:function(t,e,n){if(this.containerType===iu.SVG&&Mu(t)!==iu.SVG)throw new Error("ERROR: cannot manage non-svg element when container is an SVG element.");var o=Od(Ad(i.prototype),"manage",this).call(this,t,e,n);return null!=o&&null!=this._resizeObserver&&this._resizeObserver.observe(o.el),o}}]),i}(Kv),cy=function(t){Ed(i,t);var e=Pd(i);function i(t,n){var o;return wd(this,i),Cd(Td(o=e.call(this,t,n)),"width",void 0),Cd(Td(o),"height",void 0),Cd(Td(o),"type",i.type),n=n||{},o.width=n.width||10,o.height=n.height||10,o}return Sd(i,null,[{key:"_getParams",value:function(t){return{width:t.width,height:t.height}}}]),i}(Xm);Cd(cy,"type","Rectangle");var hy={type:cy.type,cls:cy,compute:function(t,e,i,n){var o=n.width||t.width,s=n.height||t.height,r=e.curX-o/2,a=e.curY-s/2;return t.x=r,t.y=a,t.w=o,t.h=s,[r,a,o,s]},getParams:function(t){return{width:t.width,height:t.height}}},dy=function(t){Ed(i,t);var e=Pd(i);function i(t,n){var o;return wd(this,i),Cd(Td(o=e.call(this,t,n)),"type",i.type),o}return i}(Xm);Cd(dy,"type","Blank");var uy,py={type:dy.type,cls:dy,compute:function(t,e,i,n){return t.x=e.curX,t.y=e.curY,t.w=10,t.h=0,[e.curX,e.curY,10,0]},getParams:function(t){return{}}},fy={width:10,height:0,fill:"transparent",stroke:"transparent"};Jv(bv.type,{makeNode:function(t,e){return bp("circle",{cx:t.w/2,cy:t.h/2,r:t.radius})},updateNode:function(t,e){yp(e,{cx:""+t.w/2,cy:""+t.h/2,r:""+t.radius})}}),Jv(dy.type,{makeNode:function(t,e){return bp("rect",fy)},updateNode:function(t,e){yp(e,fy)}}),Jv(cy.type,{makeNode:function(t,e){return bp("rect",{width:t.w,height:t.h})},updateNode:function(t,e){yp(e,{width:t.w,height:t.h})}}),function(t){t[t.top=0]="top",t[t.bottom=1]="bottom"}(uy||(uy={}));var my=new Map;my.set(uy.top,[Cp.TopRight,Cp.TopLeft]),my.set(uy.bottom,[Cp.BottomRight,Cp.BottomLeft]);var gy={deriveAnchor:function(t,e,i,n){return my.get(t)[e]}},vy="jtk-scrollable-list",yy=Pu(vy),by="scroll";!function(){function t(e,i){var n=this;wd(this,t),this.instance=e,Cd(this,"options",void 0),Cd(this,"count",void 0),Cd(this,"lists",void 0),this.count=0,this.lists={},this.options=i||{},this.instance.bind(tp,(function(t){for(var e=n.instance.getSelector(t.el,yy),i=0;i<e.length;i++)n.addList(e[i])})),this.instance.bind(ip,(function(t){n.removeList(t.el)})),this.instance.bind(Yu,(function(t,e){if(null==e){var i=n.findParentList(t.target);null!=i&&i.newConnection(t.connection,t.target,1);var o=n.findParentList(t.source);null!=o&&o.newConnection(t.connection,t.source,0)}})),this.instance.bind(sp,(function(t){var e=t.dropEndpoint.element,i=n.findParentList(e);return null==i||e.offsetTop>=i.domElement.scrollTop&&e.offsetTop+e.offsetHeight<=i.domElement.scrollTop+i.domElement.offsetHeight}))}Sd(t,[{key:"addList",value:function(t,e){var i=Rd({},gy);Rd(i,this.options),e=Rd(i,e||{});var n=[this.instance._instanceIndex,this.count++].join("_");return this.lists[n]=new xy(this.instance,t,e,n),this.lists[n]}},{key:"getList",value:function(t){var e=this.instance.getAttribute(t,vy);if(null!=e)return this.lists[e]}},{key:"removeList",value:function(t){var e=this.getList(t);e&&(e.destroy(),delete this.lists[e.id])}},{key:"findParentList",value:function(t){for(var e,i=t.parentNode,n=this.instance.getContainer();null!=i&&i!==n&&i!==document;){if(null!=(e=this.getList(i)))return e;i=i.parentNode}}}])}();var xy=function(){function t(e,i,n,o){wd(this,t),this.instance=e,this.el=i,this.options=n,this.id=o,Cd(this,"_scrollHandler",void 0),Cd(this,"domElement",void 0),Cd(this,"elId",void 0),this.domElement=i,this.elId=this.instance.getId(i),e.setAttribute(i,vy,o),this._scrollHandler=this.scrollHandler.bind(this),this.domElement._jsPlumbScrollHandler=this._scrollHandler,e.on(i,by,this._scrollHandler),this._scrollHandler()}return Sd(t,[{key:"deriveAnchor",value:function(t,e,i,n){return this.options.anchor?this.options.anchor:this.options.deriveAnchor(t,e,i,n)}},{key:"deriveEndpoint",value:function(t,e,i,n){return this.options.deriveEndpoint?this.options.deriveEndpoint(t,e,i,n):this.options.endpoint?this.options.endpoint:i.endpoint.type}},{key:"newConnection",value:function(t,e,i){e.offsetTop<this.el.scrollTop?this._proxyConnection(e,t,i,uy.top):e.offsetTop+e.offsetHeight>this.el.scrollTop+this.domElement.offsetHeight&&this._proxyConnection(e,t,i,uy.bottom)}},{key:"scrollHandler",value:function(){for(var t=this,e=this.instance.getSelector(this.el,ap),i=function(i){if(e[i].offsetTop<t.el.scrollTop)e[i]._jsPlumbProxies=e[i]._jsPlumbProxies||[],t.instance.select({source:e[i]}).each((function(n){t._proxyConnection(e[i],n,0,uy.top)})),t.instance.select({target:e[i]}).each((function(n){t._proxyConnection(e[i],n,1,uy.top)}));else if(e[i].offsetTop+e[i].offsetHeight>t.el.scrollTop+t.domElement.offsetHeight)e[i]._jsPlumbProxies=e[i]._jsPlumbProxies||[],t.instance.select({source:e[i]}).each((function(n){t._proxyConnection(e[i],n,0,uy.bottom)})),t.instance.select({target:e[i]}).each((function(n){t._proxyConnection(e[i],n,1,uy.bottom)}));else if(e[i]._jsPlumbProxies){for(var n=0;n<e[i]._jsPlumbProxies.length;n++)t.instance.unproxyConnection(e[i]._jsPlumbProxies[n][0],e[i]._jsPlumbProxies[n][1]);delete e[i]._jsPlumbProxies}t.instance.revalidate(e[i])},n=0;n<e.length;n++)i(n)}},{key:"_proxyConnection",value:function(t,e,i,n){var o=this;this.instance.proxyConnection(e,i,this.domElement,(function(t,i){return o.deriveEndpoint(n,i,e.endpoints[i],e)}),(function(t,i){return o.deriveAnchor(n,i,e.endpoints[i],e)})),t._jsPlumbProxies=t._jsPlumbProxies||[],t._jsPlumbProxies.push([e,i])}},{key:"destroy",value:function(){this.instance.off(this.el,by,this._scrollHandler),delete this.domElement._jsPlumbScrollHandler;for(var t=this.instance.getSelector(this.el,ap),e=0;e<t.length;e++)if(t[e]._jsPlumbProxies){for(var i=0;i<t[e]._jsPlumbProxies.length;i++)this.instance.unproxyConnection(t[e]._jsPlumbProxies[i][0],t[e]._jsPlumbProxies[i][1]);delete t[e]._jsPlumbProxies}}}]),t}();function _y(t){var e=Math.floor(t),i=Math.ceil(t);return t-e<1e-10?e:i-t<1e-10?i:t}var wy=function(t){Ed(i,t);var e=Pd(i);function i(t){var n;wd(this,i),Cd(Td(n=e.call(this,t)),"type",i.segmentType),Cd(Td(n),"cx",void 0),Cd(Td(n),"cy",void 0),Cd(Td(n),"radius",void 0),Cd(Td(n),"anticlockwise",void 0),Cd(Td(n),"startAngle",void 0),Cd(Td(n),"endAngle",void 0),Cd(Td(n),"sweep",void 0),Cd(Td(n),"length",void 0),Cd(Td(n),"circumference",void 0),Cd(Td(n),"frac",void 0),n.cx=t.cx,n.cy=t.cy,n.radius=t.r,n.anticlockwise=t.ac,t.startAngle&&t.endAngle?(n.startAngle=t.startAngle,n.endAngle=t.endAngle,n.x1=n.cx+n.radius*Math.cos(n.startAngle),n.y1=n.cy+n.radius*Math.sin(n.startAngle),n.x2=n.cx+n.radius*Math.cos(n.endAngle),n.y2=n.cy+n.radius*Math.sin(n.endAngle)):(n.startAngle=n._calcAngle(n.x1,n.y1),n.endAngle=n._calcAngle(n.x2,n.y2)),n.endAngle<0&&(n.endAngle+=om),n.startAngle<0&&(n.startAngle+=om);var o=n.endAngle<n.startAngle?n.endAngle+om:n.endAngle;return n.sweep=Math.abs(o-n.startAngle),n.anticlockwise&&(n.sweep=om-n.sweep),n.circumference=2*Math.PI*n.radius,n.frac=n.sweep/om,n.length=n.circumference*n.frac,n.extents={xmin:n.cx-n.radius,xmax:n.cx+n.radius,ymin:n.cy-n.radius,ymax:n.cy+n.radius},n}return Sd(i,[{key:"_calcAngle",value:function(t,e){return function(t,e){var i=sm(t,e),n=Math.atan(i),o=am(t,e);return 4!=o&&3!=o||(n+=Math.PI),n<0&&(n+=2*Math.PI),n}({x:this.cx,y:this.cy},{x:t,y:e})}},{key:"_calcAngleForLocation",value:function(t,e){if(t.anticlockwise){var i=t.startAngle<t.endAngle?t.startAngle+om:t.startAngle;return i-Math.abs(i-t.endAngle)*e}var n=t.endAngle<t.startAngle?t.endAngle+om:t.endAngle,o=Math.abs(n-t.startAngle);return t.startAngle+o*e}},{key:"getPath",value:function(t){var e=this.sweep>Math.PI?1:0,i=this.anticlockwise?0:1;return(t?"M"+this.x1+" "+this.y1+" ":"")+"A "+this.radius+" "+this.radius+" 0 "+e+","+i+" "+this.x2+" "+this.y2}},{key:"getLength",value:function(){return this.length}},{key:"pointOnPath",value:function(t,e){if(0===t)return{x:this.x1,y:this.y1,theta:this.startAngle};if(1===t)return{x:this.x2,y:this.y2,theta:this.endAngle};e&&(t/=length);var i=this._calcAngleForLocation(this,t),n=this.cx+this.radius*Math.cos(i),o=this.cy+this.radius*Math.sin(i);return{x:_y(n),y:_y(o),theta:i}}},{key:"gradientAtPoint",value:function(t,e){var i=this.pointOnPath(t,e),n=-1/sm({x:this.cx,y:this.cy},i);return this.anticlockwise||n!==1/0&&n!==-1/0||(n*=-1),n}},{key:"pointAlongPathFrom",value:function(t,e,i){var n=this.pointOnPath(t,i),o=e/this.circumference*2*Math.PI,s=this.anticlockwise?-1:1,r=n.theta+s*o;return{x:this.cx+this.radius*Math.cos(r),y:this.cy+this.radius*Math.sin(r)}}}]),i}(Ef);Cd(wy,"segmentType","Arc");var ky=function(t){Ed(i,t);var e=Pd(i);function i(t,n){var o;return wd(this,i),(o=e.call(this,t,n)).connection=t,Cd(Td(o),"showLoopback",void 0),Cd(Td(o),"curviness",void 0),Cd(Td(o),"margin",void 0),Cd(Td(o),"proximityLimit",void 0),Cd(Td(o),"orientation",void 0),Cd(Td(o),"loopbackRadius",void 0),Cd(Td(o),"clockwise",void 0),Cd(Td(o),"isLoopbackCurrently",void 0),Cd(Td(o),"geometry",null),n=n||{},o.showLoopback=!1!==n.showLoopback,o.curviness=n.curviness||10,o.margin=n.margin||5,o.proximityLimit=n.proximityLimit||80,o.clockwise=n.orientation&&"clockwise"===n.orientation,o.loopbackRadius=n.loopbackRadius||25,o.isLoopbackCurrently=!1,o}return Sd(i,[{key:"getDefaultStubs",value:function(){return[0,0]}},{key:"_compute",value:function(t,e){var i=e.sourcePos,n=e.targetPos,o=Math.abs(i.curX-n.curX),s=Math.abs(i.curY-n.curY);if(this.showLoopback&&e.sourceEndpoint.elementId===e.targetEndpoint.elementId){this.isLoopbackCurrently=!0;var r=e.sourcePos.curX,a=e.sourcePos.curY-this.margin,l=r,c=a-this.loopbackRadius,h=l-this.loopbackRadius,d=c-this.loopbackRadius;o=2*this.loopbackRadius,s=2*this.loopbackRadius,t.points[0]=h,t.points[1]=d,t.points[2]=o,t.points[3]=s,this._addSegment(wy,{loopback:!0,x1:r-h+4,y1:a-d,startAngle:0,endAngle:2*Math.PI,r:this.loopbackRadius,ac:!this.clockwise,x2:r-h-4,y2:a-d,cx:l-h,cy:c-d})}else this.isLoopbackCurrently=!1,this._computeBezier(t,e,i,n,o,s)}},{key:"exportGeometry",value:function(){return null==this.geometry?null:{controlPoints:[Rd({},this.geometry.controlPoints[0]),Rd({},this.geometry.controlPoints[1])],source:Rd({},this.geometry.source),target:Rd({},this.geometry.target)}}},{key:"transformGeometry",value:function(t,e,i){return{controlPoints:[{x:t.controlPoints[0].x+e,y:t.controlPoints[0].y+i},{x:t.controlPoints[1].x+e,y:t.controlPoints[1].y+i}],source:this.transformAnchorPlacement(t.source,e,i),target:this.transformAnchorPlacement(t.target,e,i)}}},{key:"importGeometry",value:function(t){return null!=t&&(null==t.controlPoints||2!=t.controlPoints.length?(cu("jsPlumb Bezier: cannot import geometry; controlPoints missing or does not have length 2"),this.setGeometry(null,!0),!1):null==t.controlPoints[0].x||null==t.controlPoints[0].y||null==t.controlPoints[1].x||null==t.controlPoints[1].y?(cu("jsPlumb Bezier: cannot import geometry; controlPoints malformed"),this.setGeometry(null,!0),!1):null==t.source||null==t.source.curX||null==t.source.curY?(cu("jsPlumb Bezier: cannot import geometry; source missing or malformed"),this.setGeometry(null,!0),!1):null==t.target||null==t.target.curX||null==t.target.curY?(cu("jsPlumb Bezier: cannot import geometry; target missing or malformed"),this.setGeometry(null,!0),!1):(this.setGeometry(t,!1),!0))}}]),i}(cv),Sy={subtract:function(t,e){return{x:t.x-e.x,y:t.y-e.y}},dotProduct:function(t,e){return t.x*e.x+t.y*e.y},square:function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},scale:function(t,e){return{x:t.x*e,y:t.y*e}}},Cy=64,Ey=Math.pow(2,-Cy-1);function Ay(t,e){for(var i,n=[],o=function(t,e){for(var i=e.length-1,n=2*i-1,o=[],s=[],r=[],a=[],l=[[1,.6,.3,.1],[.4,.6,.6,.4],[.1,.3,.6,1]],c=0;c<=i;c++)o[c]=Sy.subtract(e[c],t);for(var h=0;h<=i-1;h++)s[h]=Sy.subtract(e[h+1],e[h]),s[h]=Sy.scale(s[h],3);for(var d=0;d<=i-1;d++)for(var u=0;u<=i;u++)r[d]||(r[d]=[]),r[d][u]=Sy.dotProduct(s[d],o[u]);for(var p=0;p<=n;p++)a[p]||(a[p]=[]),a[p].y=0,a[p].x=parseFloat(""+p)/n;for(var f=i,m=i-1,g=0;g<=f+m;g++)for(var v=Math.max(0,g-m),y=Math.min(g,f),b=v;b<=y;b++){var x=g-b;a[b+x].y+=r[x][b]*l[x][b]}return a}(t,e),s=e.length-1,r=My(o,2*s-1,n,0),a=Sy.subtract(t,e[0]),l=Sy.square(a),c=0,h=0;h<r;h++)a=Sy.subtract(t,Ty(e,s,n[h],null,null)),(i=Sy.square(a))<l&&(l=i,c=n[h]);return a=Sy.subtract(t,e[s]),(i=Sy.square(a))<l&&(l=i,c=1),{location:c,distance:l}}function My(t,e,i,n){var o,s,r=[],a=[],l=[],c=[];switch(function(t,e){var i,n,o=0;i=n=hu(t[0].y);for(var s=1;s<=e;s++)(i=hu(t[s].y))!=n&&o++,n=i;return o}(t,e)){case 0:return 0;case 1:if(n>=Cy)return i[0]=(t[0].x+t[e].x)/2,1;if(function(t,e){var i,n,o,s,r,a,l,c,h,d,u,p,f,m,g;r=t[0].y-t[e].y,a=t[e].x-t[0].x,l=t[0].x*t[e].y-t[e].x*t[0].y,m=g=0;for(var v=1;v<e;v++){var y=r*t[v].x+a*t[v].y+l;y>m?m=y:y<g&&(g=y)}return u=r,p=a,f=l-m,i=((h=1)*f-p*(d=0))*(1/((c=0)*p-u*h)),u=r,p=a,f=l-g,n=(h*f-p*d)*(1/(c*p-u*h)),o=Math.min(i,n),s=Math.max(i,n),s-o<Ey?1:0}(t,e))return i[0]=function(t,e){var i=1,n=0,o=t[e].x-t[0].x,s=t[e].y-t[0].y,r=t[0].x-0,a=t[0].y-0,l=1/(o*n-s*i)*(o*a-s*r);return 0+i*l}(t,e),1}Ty(t,e,.5,r,a),o=My(r,e,l,n+1),s=My(a,e,c,n+1);for(var h=0;h<o;h++)i[h]=l[h];for(var d=0;d<s;d++)i[d+o]=c[d];return o+s}function Ty(t,e,i,n,o){for(var s=[[]],r=0;r<=e;r++)s[0][r]=t[r];for(var a=1;a<=e;a++)for(var l=0;l<=e-a;l++)s[a]||(s[a]=[]),s[a][l]||(s[a][l]={}),s[a][l].x=(1-i)*s[a-1][l].x+i*s[a-1][l+1].x,s[a][l].y=(1-i)*s[a-1][l].y+i*s[a-1][l+1].y;if(null!=n)for(var c=0;c<=e;c++)n[c]=s[c][0];if(null!=o)for(var h=0;h<=e;h++)o[h]=s[e-h][h];return s[e][0]}function Py(t,e){var i={x:0,y:0};if(0===t)return e[0];var n=e.length-1;if(1===t)return e[n];var o=e,s=1-t;if(0===n)return e[0];if(1===n)return{x:s*o[0].x+t*o[1].x,y:s*o[0].y+t*o[1].y};if(4>n){var r,a,l,c=s*s,h=t*t,d=0;return 2===n?(o=[o[0],o[1],o[2],i],r=c,a=s*t*2,l=h):3===n&&(r=c*s,a=c*t*3,l=s*h*3,d=t*h),{x:r*o[0].x+a*o[1].x+l*o[2].x+d*o[3].x,y:r*o[0].y+a*o[1].y+l*o[2].y+d*o[3].y}}return i}function Oy(t){var e=0;if(!$y(t))for(var i=function(t,e){var i=[];t--;for(var n=0;n<=t;n++)i.push(Py(n/t,e));return i}(16,t),n=0;n<15;n++){e+=Ly(i[n],i[n+1])}return e}var Dy=new Map;function Iy(t,e){for(var i=function(t){var e=Dy.get(t);if(!e){var i=function(t){return function(e){return t}},n=function(t){return function(e){for(var i=1,n=0;n<t.length;n++)i*=t[n](e);return i}};(e=[]).push((function(e){return Math.pow(e,t)}));for(var o=1;o<t;o++){for(var s=[i(t)],r=0;r<t-o;r++)s.push((function(t){return t}));for(var a=0;a<o;a++)s.push((function(t){return 1-t}));e.push(n(s))}e.push((function(e){return Math.pow(1-e,t)})),Dy.set(t,e)}return e}(t.length-1),n=0,o=0,s=0;s<t.length;s++)n+=t[s].x*i[s](e),o+=t[s].y*i[s](e);return{x:n,y:o}}function Ly(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function $y(t){return t[0].x===t[1].x&&t[0].y===t[1].y}function zy(t,e,i){if($y(t))return{point:t[0],location:e};for(var n=Iy(t,e),o=0,s=e,r=i>0?1:-1,a=null;o<Math.abs(i);)o+=Ly(a=Iy(t,s+=.005*r),n),n=a;return{point:a,location:s}}function Ry(t,e,i,n,o){var s=n-e,r=t-i,a=t*(e-n)+e*(i-t),l=function(t){return[Ny(t,"x"),Ny(t,"y")]}(o),c=[s*l[0][0]+r*l[1][0],s*l[0][1]+r*l[1][1],s*l[0][2]+r*l[1][2],s*l[0][3]+r*l[1][3]+a],h=By.apply(null,c),d=[];if(null!=h)for(var u=0;u<3;u++){var p=h[u],f=Math.pow(p,2),m=Math.pow(p,3),g={x:l[0][0]*m+l[0][1]*f+l[0][2]*p+l[0][3],y:l[1][0]*m+l[1][1]*f+l[1][2]*p+l[1][3]},v=void 0;v=i-t!=0?(g[0]-t)/(i-t):(g[1]-e)/(n-e),p>=0&&p<=1&&v>=0&&v<=1&&d.push(g)}return d}function Ny(t,e){return[-t[0][e]+3*t[1][e]+-3*t[2][e]+t[3][e],3*t[0][e]-6*t[1][e]+3*t[2][e],-3*t[0][e]+3*t[1][e],t[0][e]]}function By(t,e,i,n){var o,s,r=e/t,a=i/t,l=n/t,c=(3*a-Math.pow(r,2))/9,h=(9*r*a-27*l-2*Math.pow(r,3))/54,d=Math.pow(c,3)+Math.pow(h,2),u=[0,0,0];if(d>=0)o=hu(h+Math.sqrt(d))*Math.pow(Math.abs(h+Math.sqrt(d)),1/3),s=hu(h-Math.sqrt(d))*Math.pow(Math.abs(h-Math.sqrt(d)),1/3),u[0]=-r/3+(o+s),u[1]=-r/3-(o+s)/2,u[2]=-r/3-(o+s)/2,0!==Math.abs(Math.sqrt(3)*(o-s)/2)&&(u[1]=-1,u[2]=-1);else{var p=Math.acos(h/Math.sqrt(-Math.pow(c,3)));u[0]=2*Math.sqrt(-c)*Math.cos(p/3)-r/3,u[1]=2*Math.sqrt(-c)*Math.cos((p+2*Math.PI)/3)-r/3,u[2]=2*Math.sqrt(-c)*Math.cos((p+4*Math.PI)/3)-r/3}for(var f=0;f<3;f++)(u[f]<0||u[f]>1)&&(u[f]=-1);return u}var jy=function(t){Ed(i,t);var e=Pd(i);function i(t){var n;return wd(this,i),Cd(Td(n=e.call(this,t)),"curve",void 0),Cd(Td(n),"cp1x",void 0),Cd(Td(n),"cp1y",void 0),Cd(Td(n),"cp2x",void 0),Cd(Td(n),"cp2y",void 0),Cd(Td(n),"length",0),Cd(Td(n),"type",i.segmentType),n.cp1x=t.cp1x,n.cp1y=t.cp1y,n.cp2x=t.cp2x,n.cp2y=t.cp2y,n.x1=t.x1,n.x2=t.x2,n.y1=t.y1,n.y2=t.y2,n.curve=[{x:n.x1,y:n.y1},{x:n.cp1x,y:n.cp1y},{x:n.cp2x,y:n.cp2y},{x:n.x2,y:n.y2}],n.extents={xmin:Math.min(n.x1,n.x2,n.cp1x,n.cp2x),ymin:Math.min(n.y1,n.y2,n.cp1y,n.cp2y),xmax:Math.max(n.x1,n.x2,n.cp1x,n.cp2x),ymax:Math.max(n.y1,n.y2,n.cp1y,n.cp2y)},n}return Sd(i,[{key:"getPath",value:function(t){return(t?"M "+this.x2+" "+this.y2+" ":"")+"C "+this.cp2x+" "+this.cp2y+" "+this.cp1x+" "+this.cp1y+" "+this.x1+" "+this.y1}},{key:"pointOnPath",value:function(t,e){return t=i._translateLocation(this.curve,t,e),Iy(this.curve,t)}},{key:"gradientAtPoint",value:function(t,e){return t=i._translateLocation(this.curve,t,e),function(t,e){var i=Iy(t,e),n=Iy(t.slice(0,t.length-1),e),o=n.y-i.y,s=n.x-i.x;return 0===o?1/0:Math.atan(o/s)}(this.curve,t)}},{key:"pointAlongPathFrom",value:function(t,e,n){return t=i._translateLocation(this.curve,t,n),function(t,e,i){return zy(t,e,i).point}(this.curve,t,e)}},{key:"getLength",value:function(){return null!=this.length&&0!==this.length||(this.length=Oy(this.curve)),this.length}},{key:"findClosestPointOnPath",value:function(t,e){var i,n,o,s=(i={x:t,y:e},n=this.curve,o=Ay(i,n),{point:Ty(n,n.length-1,o.location,null,null),location:o.location});return{d:Math.sqrt(Math.pow(s.point.x-t,2)+Math.pow(s.point.y-e,2)),x:s.point.x,y:s.point.y,l:1-s.location,s:this,x1:null,y1:null,x2:null,y2:null}}},{key:"lineIntersection",value:function(t,e,i,n){return Ry(t,e,i,n,this.curve)}}],[{key:"_translateLocation",value:function(t,e,i){return i&&(e=function(t,e,i){return zy(t,e,i).location}(t,e>0?0:1,e)),e}}]),i}(Ef);Cd(jy,"segmentType","Bezier");var Fy=function(t){Ed(i,t);var e=Pd(i);function i(t,n){var o;return wd(this,i),(o=e.call(this,t,n)).connection=t,Cd(Td(o),"type",i.type),Cd(Td(o),"majorAnchor",void 0),Cd(Td(o),"minorAnchor",void 0),n=n||{},o.majorAnchor=n.curviness||150,o.minorAnchor=10,o}return Sd(i,[{key:"getCurviness",value:function(){return this.majorAnchor}},{key:"_findControlPoint",value:function(t,e,i,n,o){var s={x:0,y:0};return n[0]!==o[0]||n[1]===o[1]?(0===o[0]?s.x=i.curX<e.curX?t.x+this.minorAnchor:t.x-this.minorAnchor:s.x=t.x+this.majorAnchor*o[0],0===o[1]?s.y=i.curY<e.curY?t.y+this.minorAnchor:t.y-this.minorAnchor:s.y=t.y+this.majorAnchor*n[1]):(0===n[0]?s.x=e.curX<i.curX?t.x+this.minorAnchor:t.x-this.minorAnchor:s.x=t.x-this.majorAnchor*n[0],0===n[1]?s.y=e.curY<i.curY?t.y+this.minorAnchor:t.y-this.minorAnchor:s.y=t.y+this.majorAnchor*o[1]),s}},{key:"_computeBezier",value:function(t,e,i,n,o,s){var r,a,l=i.curX<n.curX?o:0,c=i.curY<n.curY?s:0,h=i.curX<n.curX?0:o,d=i.curY<n.curY?0:s;!0!==this.edited?(r=this._findControlPoint({x:l,y:c},i,n,t.so,t.to),a=this._findControlPoint({x:h,y:d},n,i,t.to,t.so)):(r=this.geometry.controlPoints[0],a=this.geometry.controlPoints[1]),this.geometry={controlPoints:[r,a],source:e.sourcePos,target:e.targetPos},this._addSegment(jy,{x1:l,y1:c,x2:h,y2:d,cp1x:r.x,cp1y:r.y,cp2x:a.x,cp2y:a.y})}}]),i}(ky);Cd(Fy,"type","Bezier");var qy=function(t){Ed(i,t);var e=Pd(i);function i(t,n){var o;return wd(this,i),(o=e.call(this,t,n)).connection=t,Cd(Td(o),"type",i.type),Cd(Td(o),"_controlPoint",void 0),o.curviness=n.curviness||10,o.margin=n.margin||5,o.proximityLimit=n.proximityLimit||80,o.clockwise=n.orientation&&"clockwise"===n.orientation,o}return Sd(i,[{key:"_computeBezier",value:function(t,e,i,n,o,s){var r,a,l,c,h,d,u,p,f=i.curX<n.curX?0:o,m=i.curY<n.curY?0:s,g=i.curX<n.curX?o:0,v=i.curY<n.curY?s:0;if(0===i.x&&(f-=this.margin),1===i.x&&(f+=this.margin),0===i.y&&(m-=this.margin),1===i.y&&(m+=this.margin),0===n.x&&(g-=this.margin),1===n.x&&(g+=this.margin),0===n.y&&(v-=this.margin),1===n.y&&(v+=this.margin),!0!==this.edited){var y=(f+g)/2,b=(m+v)/2,x=(a=m,c=v,(r=f)<=(l=g)&&c<=a?1:r<=l&&a<=c?2:l<=r&&c>=a?3:4),_=Math.sqrt(Math.pow(g-f,2)+Math.pow(v-m,2));this._controlPoint=function(t,e,i,n,o,s,r,a,l){return a<=l?{x:t,y:e}:1===i?n.curY<=0&&o.curY>=1?{x:t+(n.x<.5?-1*s:s),y:e}:n.curX>=1&&o.curX<=0?{x:t,y:e+(n.y<.5?-1*r:r)}:{x:t+-1*s,y:e+-1*r}:2===i?n.curY>=1&&o.curY<=0?{x:t+(n.x<.5?-1*s:s),y:e}:n.curX>=1&&o.curX<=0?{x:t,y:e+(n.y<.5?-1*r:r)}:{x:t+s,y:e+-1*r}:3===i?n.curY>=1&&o.curY<=0?{x:t+(n.x<.5?-1*s:s),y:e}:n.curX<=0&&o.curX>=1?{x:t,y:e+(n.y<.5?-1*r:r)}:{x:t+-1*s,y:e+-1*r}:4===i?n.curY<=0&&o.curY>=1?{x:t+(n.x<.5?-1*s:s),y:e}:n.curX<=0&&o.curX>=1?{x:t,y:e+(n.y<.5?-1*r:r)}:{x:t+s,y:e+-1*r}:void 0}(y,b,x,e.sourcePos,e.targetPos,this.curviness,this.curviness,_,this.proximityLimit)}else this._controlPoint=this.geometry.controlPoints[0];h=this._controlPoint.x,d=this._controlPoint.x,u=this._controlPoint.y,p=this._controlPoint.y,this.geometry={controlPoints:[this._controlPoint,this._controlPoint],source:e.sourcePos,target:e.targetPos},this._addSegment(jy,{x1:g,y1:v,x2:f,y2:m,cp1x:h,cp1y:u,cp2x:d,cp2y:p})}}]),i}(ky);function Vy(t){return t<0?-1:0===t?0:1}function Hy(t){return[Vy(t[2]-t[0]),Vy(t[3]-t[1])]}function Uy(t){return Math.sqrt(Math.pow(t[0]-t[2],2)+Math.pow(t[1]-t[3],2))}function Wy(t){var e=[];return e.push.apply(e,t),e}Cd(qy,"type","StateMachine"),Uv(Fy.type,Fy),Uv(qy.type,qy);var Gy=function(t){Ed(i,t);var e=Pd(i);function i(t,n){var o;return wd(this,i),(o=e.call(this,t,n)).connection=t,Cd(Td(o),"type",i.type),Cd(Td(o),"internalSegments",[]),Cd(Td(o),"midpoint",void 0),Cd(Td(o),"alwaysRespectStubs",void 0),Cd(Td(o),"cornerRadius",void 0),Cd(Td(o),"lastx",void 0),Cd(Td(o),"lasty",void 0),Cd(Td(o),"lastOrientation",void 0),Cd(Td(o),"loopbackRadius",void 0),Cd(Td(o),"isLoopbackCurrently",void 0),o.midpoint=null==n.midpoint||isNaN(n.midpoint)?.5:n.midpoint,o.cornerRadius=null!=n.cornerRadius?n.cornerRadius:0,o.alwaysRespectStubs=!0===n.alwaysRespectStubs,o.lastx=null,o.lasty=null,o.lastOrientation=null,o.loopbackRadius=n.loopbackRadius||25,o.isLoopbackCurrently=!1,o}return Sd(i,[{key:"getDefaultStubs",value:function(){return[30,30]}},{key:"addASegment",value:function(t,e,i){if(this.lastx!==t||this.lasty!==e){var n=null==this.lastx?i.sx:this.lastx,o=null==this.lasty?i.sy:this.lasty,s=n===t?"v":"h";this.lastx=t,this.lasty=e,this.internalSegments.push([n,o,t,e,s])}}},{key:"writeSegments",value:function(t){for(var e,i,n,o=null,s=0;s<this.internalSegments.length-1;s++){if(o=o||Wy(this.internalSegments[s]),e=Wy(this.internalSegments[s+1]),i=Hy(o),n=Hy(e),this.cornerRadius>0&&o[4]!==e[4]){var r=Math.min(Uy(o),Uy(e)),a=Math.min(this.cornerRadius,r/2);o[2]-=i[0]*a,o[3]-=i[1]*a,e[0]+=n[0]*a,e[1]+=n[1]*a;var l=i[1]===n[0]&&1===n[0]||i[1]===n[0]&&0===n[0]&&i[0]!==n[1]||i[1]===n[0]&&-1===n[0],c=(e[1]>o[3]?1:-1)===(e[0]>o[2]?1:-1),h=c&&l||!c&&!l?e[0]:o[2],d=c&&l||!c&&!l?o[3]:e[1];this._addSegment(Wv,{x1:o[0],y1:o[1],x2:o[2],y2:o[3]}),this._addSegment(wy,{r:a,x1:o[2],y1:o[3],x2:e[0],y2:e[1],cx:h,cy:d,ac:l})}else this._addSegment(Wv,{x1:o[0],y1:o[1],x2:o[2],y2:o[3]});o=e}null!=e&&this._addSegment(Wv,{x1:e[0],y1:e[1],x2:e[2],y2:e[3]})}},{key:"_compute",value:function(t,e){var i=this;this.internalSegments.length=0,this.lastx=null,this.lasty=null,this.lastOrientation=null;var n=function(e){return[t.startStubX,t.startStubY,t.endStubX,t.endStubY]},o={perpendicular:n,orthogonal:n,opposite:function(e){var n=t,o="x"===e?0:1,s={x:function(){return 1===n.so[o]&&(n.startStubX>n.endStubX&&n.tx>n.startStubX||n.sx>n.endStubX&&n.tx>n.sx)||-1===n.so[o]&&(n.startStubX<n.endStubX&&n.tx<n.startStubX||n.sx<n.endStubX&&n.tx<n.sx)},y:function(){return 1===n.so[o]&&(n.startStubY>n.endStubY&&n.ty>n.startStubY||n.sy>n.endStubY&&n.ty>n.sy)||-1===n.so[o]&&(n.startStubY<n.endStubY&&n.ty<n.startStubY||n.sy<n.endStubY&&n.ty<n.sy)}};return!i.alwaysRespectStubs&&s[e]()?{x:[(t.sx+t.tx)/2,t.startStubY,(t.sx+t.tx)/2,t.endStubY],y:[t.startStubX,(t.sy+t.ty)/2,t.endStubX,(t.sy+t.ty)/2]}[e]:[t.startStubX,t.startStubY,t.endStubX,t.endStubY]}},s=o[t.anchorOrientation](t.sourceAxis),r="x"===t.sourceAxis?0:1,a="x"===t.sourceAxis?1:0,l=s[r],c=s[a],h=s[r+2],d=s[a+2];this.addASegment(s[0],s[1],t);var u=t.startStubX+(t.endStubX-t.startStubX)*this.midpoint,p=t.startStubY+(t.endStubY-t.startStubY)*this.midpoint,f={x:[0,1],y:[1,0]},m={perpendicular:function(e,i,n,o,s){var r=t,a={x:[[r.startStubX,r.endStubX],null,[r.endStubX,r.startStubX]],y:[[r.startStubY,r.endStubY],null,[r.endStubY,r.startStubY]]},l={x:[[u,r.startStubY],[u,r.endStubY]],y:[[r.startStubX,p],[r.endStubX,p]]},c={x:[[r.endStubX,r.startStubY]],y:[[r.startStubX,r.endStubY]]},h={x:[[r.startStubX,r.endStubY],[r.endStubX,r.endStubY]],y:[[r.endStubX,r.startStubY],[r.endStubX,r.endStubY]]},d={x:[[r.startStubX,p],[r.endStubX,p],[r.endStubX,r.endStubY]],y:[[u,r.startStubY],[u,r.endStubY],[r.endStubX,r.endStubY]]},m={x:[r.startStubY,r.endStubY],y:[r.startStubX,r.endStubX]},g=f[e][0],v=f[e][1],y=r.so[g]+1,b=r.to[v]+1,x=-1===r.to[v]&&m[e][1]<m[e][0]||1===r.to[v]&&m[e][1]>m[e][0],_=a[e][y][0],w=a[e][y][1],k={x:[[[1,2,3,4],null,[2,1,4,3]],null,[[4,3,2,1],null,[3,4,1,2]]],y:[[[3,2,1,4],null,[2,3,4,1]],null,[[4,1,2,3],null,[1,4,3,2]]]}[e][y][b];return r.segment===k[3]||r.segment===k[2]&&x?l[e]:r.segment===k[2]&&w<_?c[e]:r.segment===k[2]&&w>=_||r.segment===k[1]&&!x?d[e]:r.segment===k[0]||r.segment===k[1]&&x?h[e]:void 0},orthogonal:function(e,i,n,o,s){var r=t,a={x:-1===r.so[0]?Math.min(i,o):Math.max(i,o),y:-1===r.so[1]?Math.min(i,o):Math.max(i,o)}[e];return{x:[[a,n],[a,s],[o,s]],y:[[n,a],[s,a],[s,o]]}[e]},opposite:function(n,o,s,a,l){var c=t,h={x:"y",y:"x"}[n],d={x:"h",y:"w"}[n],f=c["is"+n.toUpperCase()+"GreaterThanStubTimes2"];if(e.sourceEndpoint.elementId===e.targetEndpoint.elementId){var m=s+(1-e.sourceEndpoint._anchor.computedPosition[h])*e.sourceInfo[d]+i.maxStub;return{x:[[o,m],[a,m]],y:[[m,o],[m,a]]}[n]}return!f||1===c.so[r]&&o>a||-1===c.so[r]&&o<a?{x:[[o,p],[a,p]],y:[[u,o],[u,a]]}[n]:1===c.so[r]&&o<a||-1===c.so[r]&&o>a?{x:[[u,c.sy],[u,c.ty]],y:[[c.sx,p],[c.tx,p]]}[n]:void 0}},g=m[t.anchorOrientation](t.sourceAxis,l,c,h,d);if(g)for(var v=0;v<g.length;v++)this.addASegment(g[v][0],g[v][1],t);this.addASegment(s[2],s[3],t),this.addASegment(t.tx,t.ty,t),this.writeSegments(t)}},{key:"transformGeometry",value:function(t,e,i){return t}}]),i}(cv);function Zy(){var t=Math.floor(2e3*Math.random()),e=Math.floor(2e3*Math.random());return{clientX:t,clientY:e,screenX:t,screenY:e,pageX:t,pageY:e}}Cd(Gy,"type","Flowchart"),Uv(Gy.type,Gy),Ym.registerHandler(xv),Ym.registerHandler(hy),Ym.registerHandler(py),Uv(Gv.type,Gv);for(var Yy={clientX:5e4,clientY:5e4,screenX:5e4,screenY:5e4,pageX:5e4,pageY:5e4},Xy=0;Xy<256;Xy++)Xy.toString(16);!function(){function t(e,i,n){wd(this,t),this._jsPlumb=e,this.ok=i,this.equal=n,Cd(this,"_divs",[]),Cd(this,"mottle",void 0),this.mottle=new em}Sd(t,[{key:"_t",value:function(t,e,i,n){this.mottle.trigger(t,e,{pageX:i,pageY:n,screenX:i,screenY:n,clientX:i,clientY:n})}},{key:"addDiv",value:function(t,e,i,n,o,s,r){var a=document.createElement("div");return a.style.position="absolute",a.innerHTML=t,e?e.appendChild(a):this._jsPlumb.getContainer().appendChild(a),a.setAttribute("id",t),a.style.left=(null!=n?n:Math.floor(1e3*Math.random()))+"px",a.style.top=(null!=o?o:Math.floor(1e3*Math.random()))+"px",i&&(a.className=i),s&&(a.style.width=s+"px"),r&&(a.style.height=r+"px"),this._divs.push(t),a}},{key:"addDivs",value:function(t,e){for(var i=0;i<t.length;i++)this.addDiv(t[i],e)}},{key:"assertEndpointCount",value:function(t,e){var i=this._jsPlumb.getEndpoints(t),n=i?i.length:0;this.equal(n,e,t.getAttribute("data-jtk-managed")+" has "+e+(e>1||0==e?" endpoints":" endpoint"))}},{key:"_assertManagedEndpointCount",value:function(t,e){var i=this._jsPlumb.getId(t),n=this._jsPlumb._managedElements[i];this.equal(n.endpoints.length,e,i+" has "+e+" endpoints in managed record")}},{key:"_assertManagedConnectionCount",value:function(t,e){var i=this._jsPlumb.getId(t),n=this._jsPlumb._managedElements[i];this.equal(n.connections.length,e,i+" has "+e+" connections in managed record")}},{key:"_registerDiv",value:function(t){this._divs.push(t)}},{key:"makeDragStartEvt",value:function(t){var e=this.makeEvent(t),i=this._jsPlumb.getContainer();return e.clientX+=i.offsetLeft,e.screenX+=i.offsetLeft,e.pageX+=i.offsetLeft,e.clientY+=i.offsetTop,e.screenY+=i.offsetTop,e.pageY+=i.offsetTop,e}},{key:"getAttribute",value:function(t,e){return t.getAttribute(e)}},{key:"dragNodeBy",value:function(t,e,i,n){(n=n||{}).before&&n.before();var o=this.makeEvent(t);this._jsPlumb.trigger(t,zp,o),n.beforeMouseMove&&n.beforeMouseMove(),this._t(document,Bp,o.pageX+e,o.pageY+i),n.beforeMouseUp&&n.beforeMouseUp(),this.mottle.trigger(document,jp,null),n.after&&n.after()}},{key:"dragNodeTo",value:function(t,e,i,n){n=n||{};var o=this._jsPlumb.viewport.getPosition(this._jsPlumb.getId(t));n.before&&n.before();var s=this.makeEvent(t);this._jsPlumb.trigger(t,zp,s);var r=this._jsPlumb.getContainer().getBoundingClientRect();n.beforeMouseMove&&n.beforeMouseMove(),this._t(document,Bp,r.x+e+o.w/2,r.y+i+o.h/2),n.beforeMouseUp&&n.beforeMouseUp(),this.mottle.trigger(document,jp,null),n.after&&n.after()}},{key:"dragToGroup",value:function(t,e,i){var n=this._jsPlumb.getGroup(e),o=this._jsPlumb.viewport.getPosition(n.elId),s=o.x+o.w/2,r=o.y+o.h/2;this.dragNodeTo(t,s,r,i)}},{key:"aSyncDragNodeBy",value:function(t,e,i,n){var o=this;(n=n||{}).before&&n.before();var s=this.makeEvent(t);this._jsPlumb.trigger(t,zp,s),n.beforeMouseMove&&n.beforeMouseMove(),setTimeout((function(){o._t(document,Bp,s.pageX+e,s.pageY+i),n.beforeMouseUp&&n.beforeMouseUp(),setTimeout((function(){o.mottle.trigger(document,jp,null),n.after&&n.after()}),45)}),45)}},{key:"dragANodeAround",value:function(t,e,i){this._jsPlumb.trigger(t,zp,this.makeEvent(t));for(var n=50*Math.random(),o=0;o<n;o++){var s=Zy();t.style.left=s.screenX+"px",t.style.top=s.screenY+"px",this._jsPlumb.trigger(document,Bp,s)}e&&this.ok(e(),i||"while dragging assert"),this._jsPlumb.trigger(document,jp,Yy)}},{key:"dragConnection",value:function(t,e,i,n){var o=this.getCanvas(t),s=this.getCanvas(e),r=this.makeEvent(o),a=this.makeEvent(s);n=n||{};var l=this._jsPlumb.select().length;return this._jsPlumb.trigger(o,zp,r),n.beforeMouseMove&&n.beforeMouseMove(),this._jsPlumb.trigger(i?s:document,Bp,a),n.beforeMouseUp&&n.beforeMouseUp(),this._jsPlumb.trigger(i?s:document,jp,a),this._jsPlumb.select().get(l)}},{key:"aSyncDragConnection",value:function(t,e,i){var n=this;i=i||{};var o=this.getCanvas(t),s=this.getCanvas(e),r=this.makeEvent(o),a=this.makeEvent(s),l=this._jsPlumb.select().length;this._jsPlumb.trigger(o,zp,r),setTimeout((function(){i.beforeMouseMove&&i.beforeMouseMove(),n._jsPlumb.trigger(document,Bp,a),setTimeout((function(){i.beforeMouseUp&&i.beforeMouseUp(),n._jsPlumb.trigger(s,jp,a),i.after&&i.after(n._jsPlumb.select().get(l))}),5)}),5)}},{key:"dragAndAbortConnection",value:function(t){var e=this.getCanvas(t),i=this.makeEvent(e);this._jsPlumb.trigger(e,zp,i),this._jsPlumb.trigger(document,Bp,Yy),this._jsPlumb.trigger(document,jp,Yy)}},{key:"detachConnection",value:function(t,e){e=e||{};var i=this.getEndpointCanvas(t),n=this.makeEvent(i);e.before&&e.before(),this._jsPlumb.trigger(i,zp,n),e.beforeMouseMove&&e.beforeMouseMove(),this._jsPlumb.trigger(document,Bp,Yy),e.beforeMouseUp&&e.beforeMouseUp(),this._jsPlumb.trigger(document,jp,Yy),e.after&&e.after()}},{key:"detachAndReattachConnection",value:function(t,e){e=e||{};var i=this.getEndpointCanvas(t),n=this.makeEvent(i);e.before&&e.before(),this._jsPlumb.trigger(i,zp,n),e.beforeMouseMove&&e.beforeMouseMove(),this._jsPlumb.trigger(document,Bp,Yy),this._jsPlumb.trigger(document,Bp,n),e.beforeMouseUp&&e.beforeMouseUp(),this._jsPlumb.trigger(document,jp,n),e.after&&e.after()}},{key:"detachConnectionByTarget",value:function(t,e){this.detachConnection(t.endpoints[1],e)}},{key:"relocateTarget",value:function(t,e,i){this.relocate(t,1,e,i)}},{key:"relocate",value:function(t,e,i,n){n=n||{},i=this.getCanvas(i);var o=this.getEndpointCanvas(t.endpoints[e]),s=this.makeEvent(o),r=this.makeEvent(i);n.before&&n.before(),this._jsPlumb.trigger(o,zp,s),n.beforeMouseMove&&n.beforeMouseMove(),this._jsPlumb.trigger(document,Bp,r),n.beforeMouseUp&&n.beforeMouseUp(),this._jsPlumb.trigger(i,jp,r),n.after&&n.after()}},{key:"relocateSource",value:function(t,e,i){this.relocate(t,0,e,i)}},{key:"makeEvent",value:function(t){var e=t.getBoundingClientRect(),i=e.x+e.width/2,n=e.y+e.height/2;return{clientX:i,clientY:n,screenX:i,screenY:n,pageX:i,pageY:n}}},{key:"getCanvas",value:function(t){return t.endpoint?this.getEndpointCanvas(t):t}},{key:"getEndpointCanvas",value:function(t){return t.endpoint.canvas}},{key:"getConnectionCanvas",value:function(t){return t.connector.canvas}},{key:"getEndpointCanvasPosition",value:function(t){var e=this.getEndpointCanvas(t);return{x:parseInt(e.style.left,10),y:parseInt(e.style.top,10),w:e.getAttribute("width"),h:e.getAttribute("height")}}},{key:"within",value:function(t,e,i){this.ok(Math.abs(t-e)<1e-11,i+"[expected: "+e+" got "+t+"] [diff:"+Math.abs(t-e)+"]")}},{key:"assertManagedEndpointCount",value:function(t,e){var i=this._jsPlumb.getId(t),n=this._jsPlumb._managedElements[i];this.equal(n.endpoints.length,e,i+" has "+e+" endpoints in managed record")}},{key:"assertManagedConnectionCount",value:function(t,e){var i=this._jsPlumb.getId(t),n=this._jsPlumb._managedElements[i];this.equal(n.connections.length,e,i+" has "+e+" connections in managed record")}},{key:"fireEventOnEndpoint",value:function(t){for(var e=this.getEndpointCanvas(t),i=0;i<(arguments.length<=1?0:arguments.length-1);i++)this._jsPlumb.trigger(e,i+1<1||arguments.length<=i+1?void 0:arguments[i+1])}},{key:"fireEventOnElement",value:function(t){for(var e=0;e<(arguments.length<=1?0:arguments.length-1);e++)this._jsPlumb.trigger(t,e+1<1||arguments.length<=e+1?void 0:arguments[e+1])}},{key:"fireEventOnConnection",value:function(t){for(var e=this.getConnectionCanvas(t),i=arguments.length,n=new Array(i>1?i-1:0),o=1;o<i;o++)n[o-1]=arguments[o];this.fireEventOnElement.apply(this,[e].concat(n))}},{key:"clickOnConnection",value:function(t){this.fireEventOnConnection(t,Dp)}},{key:"dblClickOnConnection",value:function(t){this.fireEventOnConnection(t,Lp)}},{key:"tapOnConnection",value:function(t){this.fireEventOnConnection(t,zp),this.fireEventOnConnection(t,jp)}},{key:"dblTapOnConnection",value:function(t){this.fireEventOnConnection(t,zp),this.fireEventOnConnection(t,jp),this.fireEventOnConnection(t,zp),this.fireEventOnConnection(t,jp)}},{key:"clickOnElement",value:function(t,e){this._jsPlumb.trigger(t,Dp,null,null,null==e?1:e)}},{key:"dblClickOnElement",value:function(t){this._jsPlumb.trigger(t,Lp)}},{key:"tapOnElement",value:function(t){this._jsPlumb.trigger(t,zp),this._jsPlumb.trigger(t,jp)}},{key:"dblTapOnElement",value:function(t){this._jsPlumb.trigger(t,zp),this._jsPlumb.trigger(t,jp),this._jsPlumb.trigger(t,zp),this._jsPlumb.trigger(t,jp)}},{key:"getOverlayCanvas",value:function(t){return t.canvas||t.path}},{key:"fireEventOnOverlay",value:function(t,e,i){var n=t.getOverlay(e),o=this.getOverlayCanvas(n);this._jsPlumb.trigger(o,i)}},{key:"clickOnOverlay",value:function(t,e){this.fireEventOnOverlay(t,e,Dp)}},{key:"dblClickOnOverlay",value:function(t,e){this.fireEventOnOverlay(t,e,Lp)}},{key:"tapOnOverlay",value:function(t,e){this.fireEventOnOverlay(t,e,zp),this.fireEventOnOverlay(t,e,jp)}},{key:"dblTapOnOverlay",value:function(t,e){this.fireEventOnOverlay(t,e,zp),this.fireEventOnOverlay(t,e,jp),this.fireEventOnOverlay(t,e,zp),this.fireEventOnOverlay(t,e,jp)}},{key:"cleanup",value:function(){var t=this._jsPlumb.getContainer();for(var e in this._jsPlumb.destroy(),this._divs){var i=document.getElementById(this._divs[e]);i&&i.parentNode.removeChild(i)}this._divs.length=0;var n=this._jsPlumb.select().length,o=this._jsPlumb.selectEndpoints().length,s=t.querySelectorAll(".jtk-endpoint").length,r=t.querySelectorAll(".jtk-connector").length;for(var a in t.__ta)for(var l in t.__ta[a])throw"Container event bindings not empty for key "+a;if(n>0)throw"there are connections in the data model!";if(o>0)throw"there are endpoints in the data model!";if(s>0)throw"there are "+s+" endpoints left in the dom!";if(r>0)throw"there are "+r+" connections left in the dom!"}},{key:"makeContent",value:function(t){var e=document.createElement("div");return e.innerHTML=t,e.firstChild}},{key:"length",value:function(t){var e=0;for(var i in t)t.hasOwnProperty(i)&&e++;return e}},{key:"head",value:function(t){for(var e in t)return t[e]}},{key:"uuid",value:function(){return su()}}])}();var Ky=0;function Qy(t){return new ly(function(){var t=Ky+1;return Ky++,t}(),t)}const Jy={endpoint:{type:bv.type,options:{radius:6,connectedClass:"plumb-connected",cssClass:"plumb-source",hoverClass:"plumb-source-hover"}},anchors:["Bottom","Continuous"],maxConnections:1,dragAllowedWhenFull:!1,deleteEndpointsOnEmpty:!0,isSource:!0},tb={endpoint:{type:cy.type,options:{width:23,height:23,cssClass:"plumb-target",hoverClass:"plumb-target-hover"}},anchor:{type:"Continuous",options:{faces:["top","left","right"],cssClass:"continuos plumb-target-anchor"}},dragAllowedWhenFull:!1,deleteEndpointsOnEmpty:!0,isTarget:!0};class eb{constructor(t){this.jsPlumb=null,this.pendingConnections=[],this.connectionWait=null,function(t){!function e(){/complete|loaded|interactive/.test(document.readyState)&&void 0!==document.body&&null!=document.body?t():setTimeout(e,9)}()}((()=>{this.jsPlumb=Qy({container:t})}))}makeTarget(t){const e=document.getElementById(t);this.jsPlumb.addEndpoint(e,tb)}makeSource(t){const e=document.getElementById(t);this.jsPlumb.addEndpoint(e,Jy)}processPendingConnections(){this.connectionWait&&(clearTimeout(this.connectionWait),this.connectionWait=null),this.connectionWait=setTimeout((()=>{this.jsPlumb.batch((()=>{this.pendingConnections.forEach((t=>{const{fromId:e,toId:i}=t,n=document.getElementById(e),o=document.getElementById(i),s=this.jsPlumb.addEndpoint(n,{...Jy,endpoint:{...Jy.endpoint,options:{...Jy.endpoint.options,cssClass:"plumb-source connected"}}}),r=this.jsPlumb.addEndpoint(o,tb);this.jsPlumb.connect({source:s,target:r,connector:{type:Gy.type,options:{stub:12,midpoint:.75,alwaysRespectStubs:!1,gap:[0,5],cornerRadius:3,cssClass:"plumb-connector"}},overlays:[{type:"PlainArrow",options:{width:13,length:13,location:.999,cssClass:"plumb-arrow"}}]})})),this.pendingConnections=[]}))}),50)}connectIds(t,e){this.pendingConnections.push({fromId:t,toId:e}),this.processPendingConnections()}repaintEverything(){this.jsPlumb&&this.jsPlumb.repaintEverything()}elevateNodeConnections(t){if(!this.jsPlumb)return;const e=this.jsPlumb.getConnections(),i=document.getElementById(t),n=i?i.querySelectorAll(".exit"):[],o=Array.from(n).map((t=>t.id));e.forEach((e=>{const i=e.source.id;if(e.target.id===t||o.includes(i)){const t=e.connector.canvas;t&&t.classList.add("elevated")}}))}restoreNodeConnections(t){if(!this.jsPlumb)return;const e=this.jsPlumb.getConnections(),i=document.getElementById(t),n=i?i.querySelectorAll(".exit"):[],o=Array.from(n).map((t=>t.id));e.forEach((e=>{const i=e.source.id;if(e.target.id===t||o.includes(i)){const t=e.connector.canvas;t&&t.classList.remove("elevated")}}))}}const ib="#3498db",nb="#01c1af",ob="#8e5ea7",sb="#e68628",rb="#aaaaaa",ab="#666666",lb={add_input_labels:{name:"Add Labels",color:nb},add_contact_urn:{name:"Add Contact URN",color:nb},set_contact_field:{name:"Update Contact Field",color:nb},set_contact_channel:{name:"Update Contact Channel",color:nb},set_contact_language:{name:"Update Contact Language",color:nb},send_broadcast:{name:"Send Broadcast",color:ob},set_run_result:{name:"Save Flow Result",color:"#1a777c",render:(t,e)=>U`<div>Save ${e.value} as <b>${e.name}</b></div>`},send_msg:{name:"Send Message",color:ib,render:(t,e)=>{const i=e.text.replace(/\n/g,"<br>");return U`
|
|
8054
8056
|
${Pa(i)}
|
|
8055
8057
|
${e.quick_replies.length>0?U`<div class="quick-replies">
|
|
8056
8058
|
${e.quick_replies.map((t=>U`<div class="quick-reply">${t}</div>`))}
|
|
8057
8059
|
</div>`:null}
|
|
8058
|
-
`}},send_email:{name:"Send Email",color:
|
|
8060
|
+
`}},send_email:{name:"Send Email",color:ob},start_session:{name:"Start Somebody Else",color:ob},open_ticket:{name:"Open Ticket",color:ab},call_webhook:{name:"Call Webhook",color:sb,render:(t,e)=>U`<div style="word-break: break-all">${e.url}</div>`},enter_flow:{name:"Enter Subflow",color:ab},call_llm:{name:"Call AI",color:sb},transfer_airtime:{name:"Send Airtime",color:sb},wait_for_response:{name:"Wait for Response",color:"#4d7dad"},set_contact_name:{name:"Update Contact",color:"#01c1af",render:(t,e)=>U`<div>Set contact name to <b>${e.name}</b></div>`},add_contact_groups:{name:"Add to Group",color:"#309c42",render:(t,e)=>{return U`<div>${i=e.groups,n="group",i.map((t=>U`<div style="display:flex;items-align:center">
|
|
8059
8061
|
${U`<temba-icon
|
|
8060
8062
|
name=${n}
|
|
8061
8063
|
style="margin-right:0.5em"
|
|
8062
8064
|
></temba-icon>`}
|
|
8063
8065
|
<div>${t.name}</div>
|
|
8064
|
-
</div>`))}</div>`;var i,n}},remove_contact_groups:{name:"Remove from Group",color:"#
|
|
8066
|
+
</div>`))}</div>`;var i,n}},remove_contact_groups:{name:"Remove from Group",color:"#e74c3c"},request_optin:{name:"Request Opt-in",color:ib},split_by_run_result:{name:"Split by Flow Result",color:rb},split_by_expression:{name:"Split by Expression",color:rb},split_by_contact_field:{name:"Split by <Contact Field Name>",color:rb},split_by_groups:{name:"Split by Group",color:rb},split_by_scheme:{name:"Split by URN Type",color:rb},split_by_random:{name:"Split by Random",color:rb}};class cb extends ge{constructor(){super(...arguments),this.isDragging=!1,this.dragStartPos={x:0,y:0},this.nodeStartPos={left:0,top:0},this.boundMouseMove=this.handleMouseMove.bind(this),this.boundMouseUp=this.handleMouseUp.bind(this)}createRenderRoot(){return this}snapToGrid(t){return 20*Math.round(t/20)}static get styles(){return a`
|
|
8065
8067
|
.node {
|
|
8066
8068
|
position: absolute;
|
|
8067
8069
|
background-color: #fff;
|
|
@@ -8069,8 +8071,22 @@ const{I:hd}=at,dd=()=>document.createComment(""),ud=(t,e,i)=>{const n=t._$AA.par
|
|
|
8069
8071
|
min-width: 200px;
|
|
8070
8072
|
border-radius: calc(var(--curvature) * 1.5);
|
|
8071
8073
|
overflow: hidden;
|
|
8074
|
+
color: #333;
|
|
8075
|
+
cursor: move;
|
|
8076
|
+
user-select: none;
|
|
8077
|
+
z-index: 500;
|
|
8078
|
+
}
|
|
8079
|
+
|
|
8080
|
+
.node:hover {
|
|
8081
|
+
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
|
|
8072
8082
|
}
|
|
8073
8083
|
|
|
8084
|
+
.node.dragging {
|
|
8085
|
+
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
|
|
8086
|
+
transform: scale(1.02);
|
|
8087
|
+
z-index: 1000;
|
|
8088
|
+
}
|
|
8089
|
+
|
|
8074
8090
|
.action {
|
|
8075
8091
|
max-width: 200px;
|
|
8076
8092
|
}
|
|
@@ -8139,14 +8155,14 @@ const{I:hd}=at,dd=()=>document.createComment(""),ud=(t,e,i)=>{const n=t._$AA.par
|
|
|
8139
8155
|
padding-top: 10px;
|
|
8140
8156
|
margin-bottom: -10px;
|
|
8141
8157
|
}
|
|
8142
|
-
}`}updated(t){if(super.updated(t),t.has("node")){this.plumber.makeTarget(this.node.uuid);for(const t of this.node.exits)t.destination_uuid?this.plumber.connectIds(t.uuid,t.destination_uuid):this.plumber.makeSource(t.uuid);const t=this.querySelector(".node").getBoundingClientRect();_a().getState().expandCanvas(this.ui.position.left+t.width,this.ui.position.top+t.height)}}renderTitle(t){return U`<div class="title" style="background:${t.color}">
|
|
8158
|
+
}`}updated(t){if(super.updated(t),t.has("node")){this.plumber.makeTarget(this.node.uuid);for(const t of this.node.exits)t.destination_uuid?this.plumber.connectIds(t.uuid,t.destination_uuid):this.plumber.makeSource(t.uuid);const t=this.querySelector(".node").getBoundingClientRect();_a().getState().expandCanvas(this.ui.position.left+t.width,this.ui.position.top+t.height),this.addDragEventListeners()}}addDragEventListeners(){const t=this.querySelector(".node");t&&(t.addEventListener("mousedown",this.handleMouseDown.bind(this)),document.addEventListener("mousemove",this.boundMouseMove),document.addEventListener("mouseup",this.boundMouseUp))}handleMouseDown(t){const e=t.target;if(e.classList.contains("exit")||e.closest(".exit"))return;this.isDragging=!0,this.dragStartPos={x:t.clientX,y:t.clientY},this.nodeStartPos={left:this.ui.position.left,top:this.ui.position.top};const i=this.querySelector(".node");i&&i.classList.add("dragging"),this.plumber&&this.plumber.elevateNodeConnections(this.node.uuid),t.preventDefault(),t.stopPropagation()}handleMouseMove(t){if(!this.isDragging)return;const e=t.clientX-this.dragStartPos.x,i=t.clientY-this.dragStartPos.y,n=this.nodeStartPos.left+e,o=this.nodeStartPos.top+i,s=this.snapToGrid(n),r=this.snapToGrid(o),a=this.querySelector(".node");a&&(a.style.left=`${s}px`,a.style.top=`${r}px`),this.plumber&&this.plumber.repaintEverything()}handleMouseUp(t){if(!this.isDragging)return;this.isDragging=!1;const e=this.querySelector(".node");e&&e.classList.remove("dragging"),this.plumber&&this.plumber.restoreNodeConnections(this.node.uuid);const i=t.clientX-this.dragStartPos.x,n=t.clientY-this.dragStartPos.y,o=this.nodeStartPos.left+i,s=this.nodeStartPos.top+n,r={left:this.snapToGrid(o),top:this.snapToGrid(s)};_a().getState().updateCanvasPositions({[this.node.uuid]:r}),this.plumber&&this.plumber.repaintEverything(),_a().getState().updateNodePosition(this.node.uuid,r)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousemove",this.boundMouseMove),document.removeEventListener("mouseup",this.boundMouseUp)}renderTitle(t){return U`<div class="title" style="background:${t.color}">
|
|
8143
8159
|
${t.name}
|
|
8144
|
-
</div>`}renderAction(t,e){const i=
|
|
8160
|
+
</div>`}renderAction(t,e){const i=lb[e.type];return i?U`<div class="action ${e.type}">
|
|
8145
8161
|
${this.renderTitle(i)}
|
|
8146
8162
|
<div class="body">
|
|
8147
8163
|
${i.render?i.render(t,e):U`<pre>${e.type}</pre>`}
|
|
8148
8164
|
</div>
|
|
8149
|
-
</div>`:U`<div>${e.type}</div>`}renderRouter(t,e){const i=
|
|
8165
|
+
</div>`:U`<div>${e.type}</div>`}renderRouter(t,e){const i=lb[e.type];if(i)return U`<div class="router">
|
|
8150
8166
|
${this.renderTitle(i)}
|
|
8151
8167
|
${t.result_name?U`<div class="body">
|
|
8152
8168
|
Save as
|
|
@@ -8158,7 +8174,7 @@ const{I:hd}=at,dd=()=>document.createComment(""),ud=(t,e,i)=>{const n=t._$AA.par
|
|
|
8158
8174
|
</div>`}));return U`<div class="categories">${e}</div>`}renderExit(t){return U`<div
|
|
8159
8175
|
id="${t.uuid}"
|
|
8160
8176
|
class=${Wt({exit:!0,connected:!!t.destination_uuid})}
|
|
8161
|
-
></div>`}render(){return U`
|
|
8177
|
+
></div>`}render(){return this.node&&this.ui?U`
|
|
8162
8178
|
<div
|
|
8163
8179
|
id="${this.node.uuid}"
|
|
8164
8180
|
class="node"
|
|
@@ -8170,7 +8186,7 @@ const{I:hd}=at,dd=()=>document.createComment(""),ud=(t,e,i)=>{const n=t._$AA.par
|
|
|
8170
8186
|
${this.node.exits.map((t=>this.renderExit(t)))}
|
|
8171
8187
|
</div>`}
|
|
8172
8188
|
</div>
|
|
8173
|
-
|
|
8189
|
+
`:U`<div class="node">Loading...</div>`}}t([ue({type:Object})],cb.prototype,"plumber",void 0),t([ue({type:Object})],cb.prototype,"node",void 0),t([ue({type:Object})],cb.prototype,"ui",void 0);class hb extends ge{createRenderRoot(){return this}static get styles(){return a`
|
|
8174
8190
|
#editor {
|
|
8175
8191
|
overflow: scroll;
|
|
8176
8192
|
flex: 1;
|
|
@@ -8179,7 +8195,7 @@ const{I:hd}=at,dd=()=>document.createComment(""),ud=(t,e,i)=>{const n=t._$AA.par
|
|
|
8179
8195
|
#grid {
|
|
8180
8196
|
position: relative;
|
|
8181
8197
|
background-color: #f9f9f9;
|
|
8182
|
-
background-position:
|
|
8198
|
+
background-position: 10px 10px;
|
|
8183
8199
|
background-image: linear-gradient(
|
|
8184
8200
|
0deg,
|
|
8185
8201
|
transparent 24%,
|
|
@@ -8223,11 +8239,11 @@ const{I:hd}=at,dd=()=>document.createComment(""),ud=(t,e,i)=>{const n=t._$AA.par
|
|
|
8223
8239
|
}
|
|
8224
8240
|
|
|
8225
8241
|
.jtk-endpoint {
|
|
8226
|
-
z-index:
|
|
8242
|
+
z-index: 600;
|
|
8227
8243
|
}
|
|
8228
8244
|
|
|
8229
8245
|
.plumb-source {
|
|
8230
|
-
z-index:
|
|
8246
|
+
z-index: 600;
|
|
8231
8247
|
border: 0px solid var(--color-connectors);
|
|
8232
8248
|
}
|
|
8233
8249
|
|
|
@@ -8251,7 +8267,7 @@ const{I:hd}=at,dd=()=>document.createComment(""),ud=(t,e,i)=>{const n=t._$AA.par
|
|
|
8251
8267
|
|
|
8252
8268
|
.plumb-target {
|
|
8253
8269
|
margin-top: -6px;
|
|
8254
|
-
z-index:
|
|
8270
|
+
z-index: 600;
|
|
8255
8271
|
opacity: 0;
|
|
8256
8272
|
cursor: pointer;
|
|
8257
8273
|
}
|
|
@@ -8259,6 +8275,29 @@ const{I:hd}=at,dd=()=>document.createComment(""),ud=(t,e,i)=>{const n=t._$AA.par
|
|
|
8259
8275
|
body .plumb-connector path {
|
|
8260
8276
|
stroke: var(--color-connectors) !important;
|
|
8261
8277
|
stroke-width: 3px;
|
|
8278
|
+
z-index: 10;
|
|
8279
|
+
}
|
|
8280
|
+
|
|
8281
|
+
body .plumb-connector {
|
|
8282
|
+
z-index: 10;
|
|
8283
|
+
}
|
|
8284
|
+
|
|
8285
|
+
body .plumb-connector.elevated {
|
|
8286
|
+
z-index: 550;
|
|
8287
|
+
}
|
|
8288
|
+
|
|
8289
|
+
body .plumb-connector.elevated path {
|
|
8290
|
+
stroke: var(--color-connectors) !important;
|
|
8291
|
+
stroke-width: 3px;
|
|
8292
|
+
z-index: 550;
|
|
8293
|
+
}
|
|
8294
|
+
|
|
8295
|
+
body .plumb-connector.elevated .plumb-arrow {
|
|
8296
|
+
fill: var(--color-connectors);
|
|
8297
|
+
stroke: var(--color-connectors);
|
|
8298
|
+
stroke-width: 0px;
|
|
8299
|
+
margin-top: 6px;
|
|
8300
|
+
z-index: 550;
|
|
8262
8301
|
}
|
|
8263
8302
|
|
|
8264
8303
|
body .plumb-connector .plumb-arrow {
|
|
@@ -8266,6 +8305,7 @@ const{I:hd}=at,dd=()=>document.createComment(""),ud=(t,e,i)=>{const n=t._$AA.par
|
|
|
8266
8305
|
stroke: var(--color-connectors);
|
|
8267
8306
|
stroke-width: 0px;
|
|
8268
8307
|
margin-top: 6px;
|
|
8308
|
+
z-index: 10;
|
|
8269
8309
|
}
|
|
8270
8310
|
|
|
8271
8311
|
body svg.jtk-connector.jtk-hover path {
|
|
@@ -8276,10 +8316,11 @@ const{I:hd}=at,dd=()=>document.createComment(""),ud=(t,e,i)=>{const n=t._$AA.par
|
|
|
8276
8316
|
body .plumb-connector.jtk-hover .plumb-arrow {
|
|
8277
8317
|
fill: var(--color-success) !important;
|
|
8278
8318
|
stroke-width: 0px;
|
|
8319
|
+
z-index: 10;
|
|
8279
8320
|
}
|
|
8280
|
-
`}constructor(){super()}firstUpdated(t){super.firstUpdated(t),this.plumber=new eb(this.querySelector("#canvas")),t.has("flow")&&_a().getState().fetchRevision(`/flow/revisions/${this.flow}`)}updated(t){super.updated(t),t.has("canvasSize")}render(){const t=U`<style>
|
|
8281
|
-
${r(
|
|
8282
|
-
${r(
|
|
8321
|
+
`}constructor(){super(),this.saveTimer=null}firstUpdated(t){super.firstUpdated(t),this.plumber=new eb(this.querySelector("#canvas")),t.has("flow")&&_a().getState().fetchRevision(`/flow/revisions/${this.flow}`)}updated(t){super.updated(t),t.has("canvasSize"),t.has("dirtyDate")&&this.dirtyDate&&this.debouncedSave()}debouncedSave(){null!==this.saveTimer&&clearTimeout(this.saveTimer),this.saveTimer=window.setTimeout((()=>{(new Date).getTime()-this.dirtyDate.getTime()>=500?(this.saveChanges(),this.saveTimer=null):this.debouncedSave()}),500)}saveChanges(){_a().postJSON(`/flow/revisions/${this.flow}`,this.definition),_a().getState().setDirtyDate(null)}disconnectedCallback(){super.disconnectedCallback(),null!==this.saveTimer&&(clearTimeout(this.saveTimer),this.saveTimer=null)}render(){const t=U`<style>
|
|
8322
|
+
${r(hb.styles.cssText)}
|
|
8323
|
+
${r(cb.styles.cssText)}
|
|
8283
8324
|
</style>`;return U`${t}
|
|
8284
8325
|
<div id="editor">
|
|
8285
8326
|
<div
|
|
@@ -8294,7 +8335,7 @@ const{I:hd}=at,dd=()=>document.createComment(""),ud=(t,e,i)=>{const n=t._$AA.par
|
|
|
8294
8335
|
></temba-flow-node>`)):U`<temba-loading></temba-loading>`}
|
|
8295
8336
|
</div>
|
|
8296
8337
|
</div>
|
|
8297
|
-
</div>`}}t([ue({type:String})],
|
|
8338
|
+
</div>`}}t([ue({type:String})],hb.prototype,"flow",void 0),t([ue({type:String})],hb.prototype,"version",void 0),t([ba(ya,(t=>t.flowDefinition))],hb.prototype,"definition",void 0),t([ba(ya,(t=>t.canvasSize))],hb.prototype,"canvasSize",void 0),t([ba(ya,(t=>t.dirtyDate))],hb.prototype,"dirtyDate",void 0);class db extends Dc{constructor(){super(...arguments),this.dirtyMessage="You have unsaved changes to the contact notepad. Are you sure you want to contiunue?"}static get styles(){return a`
|
|
8298
8339
|
:host {
|
|
8299
8340
|
height: 100%;
|
|
8300
8341
|
display: flex;
|
|
@@ -8364,7 +8405,7 @@ const{I:hd}=at,dd=()=>document.createComment(""),ud=(t,e,i)=>{const n=t._$AA.par
|
|
|
8364
8405
|
`:null}
|
|
8365
8406
|
</div>
|
|
8366
8407
|
</div>
|
|
8367
|
-
`:super.render()}}t([ue({type:Object,attribute:!1})],
|
|
8408
|
+
`:super.render()}}t([ue({type:Object,attribute:!1})],db.prototype,"note",void 0),t([ue({type:String})],db.prototype,"dirtyMessage",void 0);class ub extends ge{constructor(){super(...arguments),this.total=100,this.current=0,this.pct=0,this.done=!1,this.showEstimatedCompletion=!1,this.showPercentage=!1}updated(t){if(t.has("eta")&&this.eta&&(this.estimatedCompletionDate=new Date(this.eta),this.showEstimatedCompletion=this.estimatedCompletionDate>new Date),t.has("current")){const t=Math.floor(Math.min(this.current/this.total*100,100));Number.isNaN(t)?this.showPercentage=!1:(this.pct=t,this.showPercentage=!0),this.done=this.pct>=100}}render(){return U`<div class="wrapper ${this.done?"complete":""}">
|
|
8368
8409
|
<div class="meter ${this.done?"done":""}">
|
|
8369
8410
|
${this.message?U`<div class="message">${this.message}</div>`:null}
|
|
8370
8411
|
<span class="complete" style="flex-basis: ${this.pct}%"></span>
|
|
@@ -8381,7 +8422,7 @@ const{I:hd}=at,dd=()=>document.createComment(""),ud=(t,e,i)=>{const n=t._$AA.par
|
|
|
8381
8422
|
</div>`:null}
|
|
8382
8423
|
|
|
8383
8424
|
<slot></slot>
|
|
8384
|
-
</div>`}}
|
|
8425
|
+
</div>`}}ub.styles=a`
|
|
8385
8426
|
.wrapper {
|
|
8386
8427
|
display: flex;
|
|
8387
8428
|
box-sizing: content-box;
|
|
@@ -8503,7 +8544,7 @@ const{I:hd}=at,dd=()=>document.createComment(""),ud=(t,e,i)=>{const n=t._$AA.par
|
|
|
8503
8544
|
.meter.done > span {
|
|
8504
8545
|
background: rgb(var(--success-rgb));
|
|
8505
8546
|
}
|
|
8506
|
-
`,t([ue({type:Number})],
|
|
8547
|
+
`,t([ue({type:Number})],ub.prototype,"total",void 0),t([ue({type:Number})],ub.prototype,"current",void 0),t([ue({type:Number})],ub.prototype,"pct",void 0),t([ue({type:Boolean})],ub.prototype,"done",void 0),t([ue({type:String})],ub.prototype,"eta",void 0),t([ue({type:String,attribute:!1})],ub.prototype,"estimatedCompletionDate",void 0),t([ue({type:Boolean})],ub.prototype,"showEstimatedCompletion",void 0),t([ue({type:Boolean})],ub.prototype,"showPercentage",void 0),t([ue({type:String})],ub.prototype,"message",void 0);class pb extends ge{constructor(){super(...arguments),this.refreshes=0,this.complete=!1,this.running=!1}updated(t){super.updated(t),t.has("id")&&this.refresh()}interruptStart(){var t,e;t=this.interruptTitle,e=this.interruptEndpoint,window.showModax(t,e)}refresh(){Zt(this.statusEndpoint,this.getHeaders()).then((t=>{if(t.length>0){this.refreshes++;const e=t[0];if(this.current=e.progress.current,this.total=e.progress.total,this.complete="Completed"==e.status||"Failed"==e.status||"Interrupted"==e.status,this.running="Started"===e.status,"Pending"===e.status?this.message="Preparing to start..":"Queued"===e.status?this.message="Waiting..":this.message=null,"Started"===e.status){const t=(new Date).getTime()-new Date(e.modified_on).getTime(),i=this.current/t;if(i>.1){const t=new Date((new Date).getTime()+(this.total-this.current)/i),e=new Date;e.setMonth(e.getMonth()+2),this.eta=t>e?null:t.toISOString()}}!this.complete&&this.current<this.total&&setTimeout((()=>{this.refresh()}),Math.min(1e3*this.refreshes,6e4)),this.complete&&this.scheduleRemoval()}}))}scheduleRemoval(){setTimeout((()=>{this.remove()}),5e3)}render(){return U`<temba-progress
|
|
8507
8548
|
total=${this.total}
|
|
8508
8549
|
current=${this.current}
|
|
8509
8550
|
eta=${this.eta}
|
|
@@ -8513,7 +8554,7 @@ const{I:hd}=at,dd=()=>document.createComment(""),ud=(t,e,i)=>{const n=t._$AA.par
|
|
|
8513
8554
|
name="close"
|
|
8514
8555
|
@click=${this.interruptStart}
|
|
8515
8556
|
></temba-icon>`:null}
|
|
8516
|
-
</temba-progress>`}}
|
|
8557
|
+
</temba-progress>`}}pb.styles=a`
|
|
8517
8558
|
temba-icon[name='close'] {
|
|
8518
8559
|
cursor: pointer;
|
|
8519
8560
|
margin: 0 4px;
|
|
@@ -8522,7 +8563,7 @@ const{I:hd}=at,dd=()=>document.createComment(""),ud=(t,e,i)=>{const n=t._$AA.par
|
|
|
8522
8563
|
temba-icon[name='close']:hover {
|
|
8523
8564
|
color: var(--color-primary-dark);
|
|
8524
8565
|
}
|
|
8525
|
-
`,t([ue({type:String})],
|
|
8566
|
+
`,t([ue({type:String})],pb.prototype,"id",void 0),t([ue({type:Number})],pb.prototype,"current",void 0),t([ue({type:Number})],pb.prototype,"total",void 0),t([ue({type:Number})],pb.prototype,"refreshes",void 0),t([ue({type:String})],pb.prototype,"eta",void 0),t([ue({type:Boolean})],pb.prototype,"complete",void 0),t([ue({type:Boolean})],pb.prototype,"running",void 0),t([ue({type:String})],pb.prototype,"message",void 0),t([ue({type:String})],pb.prototype,"statusEndpoint",void 0),t([ue({type:String})],pb.prototype,"interruptTitle",void 0),t([ue({type:String})],pb.prototype,"interruptEndpoint",void 0);class fb extends Pc{static get styles(){return a`
|
|
8526
8567
|
temba-options {
|
|
8527
8568
|
display: block;
|
|
8528
8569
|
width: 100%;
|
|
@@ -8587,7 +8628,7 @@ const{I:hd}=at,dd=()=>document.createComment(""),ud=(t,e,i)=>{const n=t._$AA.par
|
|
|
8587
8628
|
.cursorIndex=${this.cursorIndex}
|
|
8588
8629
|
.options=${this.filteredShortcuts}
|
|
8589
8630
|
></temba-options>
|
|
8590
|
-
`}}t([ue({type:String})],
|
|
8631
|
+
`}}t([ue({type:String})],fb.prototype,"filter",void 0),t([ue({type:Array})],fb.prototype,"filteredShortcuts",void 0),t([ue({type:Number})],fb.prototype,"cursorIndex",void 0);class mb extends ge{constructor(){super(...arguments),this.placeholder="",this.endpoint=""}handleChange(){this.blur()}render(){return U`
|
|
8591
8632
|
<div>
|
|
8592
8633
|
<temba-dropdown>
|
|
8593
8634
|
<div slot="toggle"><slot name="toggle"></slot></div>
|
|
@@ -8602,7 +8643,7 @@ const{I:hd}=at,dd=()=>document.createComment(""),ud=(t,e,i)=>{const n=t._$AA.par
|
|
|
8602
8643
|
</div>
|
|
8603
8644
|
</temba-dropdown>
|
|
8604
8645
|
</div>
|
|
8605
|
-
`}}
|
|
8646
|
+
`}}mb.styles=a`
|
|
8606
8647
|
:host {
|
|
8607
8648
|
}
|
|
8608
8649
|
|
|
@@ -8619,7 +8660,7 @@ const{I:hd}=at,dd=()=>document.createComment(""),ud=(t,e,i)=>{const n=t._$AA.par
|
|
|
8619
8660
|
--color-widget-border: transparent;
|
|
8620
8661
|
--widget-box-shadow: none;
|
|
8621
8662
|
}
|
|
8622
|
-
`,t([ue({type:String})],
|
|
8663
|
+
`,t([ue({type:String})],mb.prototype,"placeholder",void 0),t([ue({type:String})],mb.prototype,"endpoint",void 0);class gb extends uc{static get styles(){return[super.styles,a`
|
|
8623
8664
|
:host {
|
|
8624
8665
|
width: 150px;
|
|
8625
8666
|
display: block;
|
|
@@ -8629,7 +8670,7 @@ const{I:hd}=at,dd=()=>document.createComment(""),ud=(t,e,i)=>{const n=t._$AA.par
|
|
|
8629
8670
|
name=${t.name}
|
|
8630
8671
|
avatar=${t.avatar}
|
|
8631
8672
|
showname
|
|
8632
|
-
></temba-user>`:U``}}t([ue({type:String})],
|
|
8673
|
+
></temba-user>`:U``}}t([ue({type:String})],gb.prototype,"endpoint",void 0),t([ue({type:String})],gb.prototype,"nameKey",void 0),t([ue({type:String})],gb.prototype,"valueKey",void 0),t([ue({type:String})],gb.prototype,"placeholder",void 0),t([ue({type:Boolean})],gb.prototype,"sorted",void 0),t([ue({type:Object})],gb.prototype,"user",void 0);class vb extends uc{static get styles(){return[super.styles,a`
|
|
8633
8674
|
:host {
|
|
8634
8675
|
border: 0px solid blue;
|
|
8635
8676
|
}
|
|
@@ -8640,26 +8681,33 @@ const{I:hd}=at,dd=()=>document.createComment(""),ud=(t,e,i)=>{const n=t._$AA.par
|
|
|
8640
8681
|
* (c) 2024 Jukka Kurkela
|
|
8641
8682
|
* Released under the MIT License
|
|
8642
8683
|
*/
|
|
8643
|
-
function
|
|
8684
|
+
function yb(t){return t+.5|0}t([ue({type:String})],vb.prototype,"endpoint",void 0),t([ue({type:String})],vb.prototype,"nameKey",void 0),t([ue({type:String})],vb.prototype,"valueKey",void 0),t([ue({type:String})],vb.prototype,"placeholder",void 0),t([ue({type:Boolean})],vb.prototype,"sorted",void 0),t([ue({type:Object})],vb.prototype,"workspace",void 0);const bb=(t,e,i)=>Math.max(Math.min(t,i),e);function xb(t){return bb(yb(2.55*t),0,255)}function _b(t){return bb(yb(255*t),0,255)}function wb(t){return bb(yb(t/2.55)/100,0,1)}function kb(t){return bb(yb(100*t),0,100)}const Sb={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Cb=[..."0123456789ABCDEF"],Eb=t=>Cb[15&t],Ab=t=>Cb[(240&t)>>4]+Cb[15&t],Mb=t=>(240&t)>>4==(15&t);function Tb(t){var e=(t=>Mb(t.r)&&Mb(t.g)&&Mb(t.b)&&Mb(t.a))(t)?Eb:Ab;return t?"#"+e(t.r)+e(t.g)+e(t.b)+((t,e)=>t<255?e(t):"")(t.a,e):void 0}const Pb=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Ob(t,e,i){const n=e*Math.min(i,1-i),o=(e,o=(e+t/30)%12)=>i-n*Math.max(Math.min(o-3,9-o,1),-1);return[o(0),o(8),o(4)]}function Db(t,e,i){const n=(n,o=(n+t/60)%6)=>i-i*e*Math.max(Math.min(o,4-o,1),0);return[n(5),n(3),n(1)]}function Ib(t,e,i){const n=Ob(t,1,.5);let o;for(e+i>1&&(o=1/(e+i),e*=o,i*=o),o=0;o<3;o++)n[o]*=1-e-i,n[o]+=e;return n}function Lb(t){const e=t.r/255,i=t.g/255,n=t.b/255,o=Math.max(e,i,n),s=Math.min(e,i,n),r=(o+s)/2;let a,l,c;return o!==s&&(c=o-s,l=r>.5?c/(2-o-s):c/(o+s),a=function(t,e,i,n,o){return t===o?(e-i)/n+(e<i?6:0):e===o?(i-t)/n+2:(t-e)/n+4}(e,i,n,c,o),a=60*a+.5),[0|a,l||0,r]}function $b(t,e,i,n){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,i,n)).map(_b)}function zb(t,e,i){return $b(Ob,t,e,i)}function Rb(t){return(t%360+360)%360}function Nb(t){const e=Pb.exec(t);let i,n=255;if(!e)return;e[5]!==i&&(n=e[6]?xb(+e[5]):_b(+e[5]));const o=Rb(+e[2]),s=+e[3]/100,r=+e[4]/100;return i="hwb"===e[1]?function(t,e,i){return $b(Ib,t,e,i)}(o,s,r):"hsv"===e[1]?function(t,e,i){return $b(Db,t,e,i)}(o,s,r):zb(o,s,r),{r:i[0],g:i[1],b:i[2],a:n}}const Bb={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},jb={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};let Fb;function qb(t){Fb||(Fb=function(){const t={},e=Object.keys(jb),i=Object.keys(Bb);let n,o,s,r,a;for(n=0;n<e.length;n++){for(r=a=e[n],o=0;o<i.length;o++)s=i[o],a=a.replace(s,Bb[s]);s=parseInt(jb[r],16),t[a]=[s>>16&255,s>>8&255,255&s]}return t}(),Fb.transparent=[0,0,0,0]);const e=Fb[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:4===e.length?e[3]:255}}const Vb=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;const Hb=t=>t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,Ub=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function Wb(t,e,i){if(t){let n=Lb(t);n[e]=Math.max(0,Math.min(n[e]+n[e]*i,0===e?360:1)),n=zb(n),t.r=n[0],t.g=n[1],t.b=n[2]}}function Gb(t,e){return t?Object.assign(e||{},t):t}function Zb(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=_b(t[3]))):(e=Gb(t,{r:0,g:0,b:0,a:1})).a=_b(e.a),e}function Yb(t){return"r"===t.charAt(0)?function(t){const e=Vb.exec(t);let i,n,o,s=255;if(e){if(e[7]!==i){const t=+e[7];s=e[8]?xb(t):bb(255*t,0,255)}return i=+e[1],n=+e[3],o=+e[5],i=255&(e[2]?xb(i):bb(i,0,255)),n=255&(e[4]?xb(n):bb(n,0,255)),o=255&(e[6]?xb(o):bb(o,0,255)),{r:i,g:n,b:o,a:s}}}(t):Nb(t)}class Xb{constructor(t){if(t instanceof Xb)return t;const e=typeof t;let i;var n,o,s;"object"===e?i=Zb(t):"string"===e&&(s=(n=t).length,"#"===n[0]&&(4===s||5===s?o={r:255&17*Sb[n[1]],g:255&17*Sb[n[2]],b:255&17*Sb[n[3]],a:5===s?17*Sb[n[4]]:255}:7!==s&&9!==s||(o={r:Sb[n[1]]<<4|Sb[n[2]],g:Sb[n[3]]<<4|Sb[n[4]],b:Sb[n[5]]<<4|Sb[n[6]],a:9===s?Sb[n[7]]<<4|Sb[n[8]]:255})),i=o||qb(t)||Yb(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=Gb(this._rgb);return t&&(t.a=wb(t.a)),t}set rgb(t){this._rgb=Zb(t)}rgbString(){return this._valid?function(t){return t&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${wb(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`)}(this._rgb):void 0}hexString(){return this._valid?Tb(this._rgb):void 0}hslString(){return this._valid?function(t){if(!t)return;const e=Lb(t),i=e[0],n=kb(e[1]),o=kb(e[2]);return t.a<255?`hsla(${i}, ${n}%, ${o}%, ${wb(t.a)})`:`hsl(${i}, ${n}%, ${o}%)`}(this._rgb):void 0}mix(t,e){if(t){const i=this.rgb,n=t.rgb;let o;const s=e===o?.5:e,r=2*s-1,a=i.a-n.a,l=((r*a==-1?r:(r+a)/(1+r*a))+1)/2;o=1-l,i.r=255&l*i.r+o*n.r+.5,i.g=255&l*i.g+o*n.g+.5,i.b=255&l*i.b+o*n.b+.5,i.a=s*i.a+(1-s)*n.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=function(t,e,i){const n=Ub(wb(t.r)),o=Ub(wb(t.g)),s=Ub(wb(t.b));return{r:_b(Hb(n+i*(Ub(wb(e.r))-n))),g:_b(Hb(o+i*(Ub(wb(e.g))-o))),b:_b(Hb(s+i*(Ub(wb(e.b))-s))),a:t.a+i*(e.a-t.a)}}(this._rgb,t._rgb,e)),this}clone(){return new Xb(this.rgb)}alpha(t){return this._rgb.a=_b(t),this}clearer(t){return this._rgb.a*=1-t,this}greyscale(){const t=this._rgb,e=yb(.3*t.r+.59*t.g+.11*t.b);return t.r=t.g=t.b=e,this}opaquer(t){return this._rgb.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Wb(this._rgb,2,t),this}darken(t){return Wb(this._rgb,2,-t),this}saturate(t){return Wb(this._rgb,1,t),this}desaturate(t){return Wb(this._rgb,1,-t),this}rotate(t){return function(t,e){var i=Lb(t);i[0]=Rb(i[0]+e),i=zb(i),t.r=i[0],t.g=i[1],t.b=i[2]}(this._rgb,t),this}}
|
|
8644
8685
|
/*!
|
|
8645
8686
|
* Chart.js v4.4.8
|
|
8646
8687
|
* https://www.chartjs.org
|
|
8647
8688
|
* (c) 2025 Chart.js Contributors
|
|
8648
8689
|
* Released under the MIT License
|
|
8649
|
-
*/function Ub(){}const Wb=(()=>{let t=0;return()=>t++})();function Gb(t){return null==t}function Zb(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return"[object"===e.slice(0,7)&&"Array]"===e.slice(-6)}function Yb(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}function Xb(t){return("number"==typeof t||t instanceof Number)&&isFinite(+t)}function Kb(t,e){return Xb(t)?t:e}function Qb(t,e){return void 0===t?e:t}const Jb=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function tx(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function ex(t,e,i,n){let o,s,r;if(Zb(t))for(s=t.length,o=0;o<s;o++)e.call(i,t[o],o);else if(Yb(t))for(r=Object.keys(t),s=r.length,o=0;o<s;o++)e.call(i,t[r[o]],r[o])}function ix(t,e){let i,n,o,s;if(!t||!e||t.length!==e.length)return!1;for(i=0,n=t.length;i<n;++i)if(o=t[i],s=e[i],o.datasetIndex!==s.datasetIndex||o.index!==s.index)return!1;return!0}function nx(t){if(Zb(t))return t.map(nx);if(Yb(t)){const e=Object.create(null),i=Object.keys(t),n=i.length;let o=0;for(;o<n;++o)e[i[o]]=nx(t[i[o]]);return e}return t}function ox(t){return-1===["__proto__","prototype","constructor"].indexOf(t)}function sx(t,e,i,n){if(!ox(t))return;const o=e[t],s=i[t];Yb(o)&&Yb(s)?rx(o,s,n):e[t]=nx(s)}function rx(t,e,i){const n=Zb(e)?e:[e],o=n.length;if(!Yb(t))return t;const s=(i=i||{}).merger||sx;let r;for(let e=0;e<o;++e){if(r=n[e],!Yb(r))continue;const o=Object.keys(r);for(let e=0,n=o.length;e<n;++e)s(o[e],t,r,i)}return t}function ax(t,e){return rx(t,e,{merger:lx})}function lx(t,e,i){if(!ox(t))return;const n=e[t],o=i[t];Yb(n)&&Yb(o)?ax(n,o):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=nx(o))}const cx={"":t=>t,x:t=>t.x,y:t=>t.y};function hx(t,e){const i=cx[e]||(cx[e]=function(t){const e=function(t){const e=t.split("."),i=[];let n="";for(const t of e)n+=t,n.endsWith("\\")?n=n.slice(0,-1)+".":(i.push(n),n="");return i}(t);return t=>{for(const i of e){if(""===i)break;t=t&&t[i]}return t}}(e));return i(t)}function dx(t){return t.charAt(0).toUpperCase()+t.slice(1)}const ux=t=>void 0!==t,px=t=>"function"==typeof t,fx=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0};const mx=Math.PI,gx=2*mx,vx=gx+mx,yx=Number.POSITIVE_INFINITY,bx=mx/180,xx=mx/2,_x=mx/4,wx=2*mx/3,kx=Math.log10,Sx=Math.sign;function Cx(t,e,i){return Math.abs(t-e)<i}function Ex(t){const e=Math.round(t);t=Cx(t,e,t/1e3)?e:t;const i=Math.pow(10,Math.floor(kx(t))),n=t/i;return(n<=1?1:n<=2?2:n<=5?5:10)*i}function Ax(t){return!function(t){return"symbol"==typeof t||"object"==typeof t&&null!==t&&!(Symbol.toPrimitive in t||"toString"in t||"valueOf"in t)}(t)&&!isNaN(parseFloat(t))&&isFinite(t)}function Mx(t,e,i){let n,o,s;for(n=0,o=t.length;n<o;n++)s=t[n][i],isNaN(s)||(e.min=Math.min(e.min,s),e.max=Math.max(e.max,s))}function Tx(t){return t*(mx/180)}function Px(t){return t*(180/mx)}function Ox(t){if(!Xb(t))return;let e=1,i=0;for(;Math.round(t*e)/e!==t;)e*=10,i++;return i}function Dx(t,e){const i=e.x-t.x,n=e.y-t.y,o=Math.sqrt(i*i+n*n);let s=Math.atan2(n,i);return s<-.5*mx&&(s+=gx),{angle:s,distance:o}}function Ix(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Lx(t,e){return(t-e+vx)%gx-mx}function $x(t){return(t%gx+gx)%gx}function zx(t,e,i,n){const o=$x(t),s=$x(e),r=$x(i),a=$x(s-o),l=$x(r-o),c=$x(o-s),h=$x(o-r);return o===s||o===r||n&&s===r||a>l&&c<h}function Rx(t,e,i){return Math.max(e,Math.min(i,t))}function Nx(t,e,i,n=1e-6){return t>=Math.min(e,i)-n&&t<=Math.max(e,i)+n}function Bx(t,e,i){i=i||(i=>t[i]<e);let n,o=t.length-1,s=0;for(;o-s>1;)n=s+o>>1,i(n)?s=n:o=n;return{lo:s,hi:o}}const jx=(t,e,i,n)=>Bx(t,i,n?n=>{const o=t[n][e];return o<i||o===i&&t[n+1][e]===i}:n=>t[n][e]<i),Fx=(t,e,i)=>Bx(t,i,(n=>t[n][e]>=i));const qx=["push","pop","shift","splice","unshift"];function Vx(t,e){const i=t._chartjs;if(!i)return;const n=i.listeners,o=n.indexOf(e);-1!==o&&n.splice(o,1),n.length>0||(qx.forEach((e=>{delete t[e]})),delete t._chartjs)}function Hx(t){const e=new Set(t);return e.size===t.length?t:Array.from(e)}const Ux="undefined"==typeof window?function(t){return t()}:window.requestAnimationFrame;function Wx(t,e){let i=[],n=!1;return function(...o){i=o,n||(n=!0,Ux.call(window,(()=>{n=!1,t.apply(e,i)})))}}const Gx=t=>"start"===t?"left":"end"===t?"right":"center",Zx=(t,e,i)=>"start"===t?e:"end"===t?i:(e+i)/2;function Yx(t,e,i){const n=e.length;let o=0,s=n;if(t._sorted){const{iScale:r,vScale:a,_parsed:l}=t,c=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null,h=r.axis,{min:d,max:u,minDefined:p,maxDefined:f}=r.getUserBounds();if(p){if(o=Math.min(jx(l,h,d).lo,i?n:jx(e,h,r.getPixelForValue(d)).lo),c){const t=l.slice(0,o+1).reverse().findIndex((t=>!Gb(t[a.axis])));o-=Math.max(0,t)}o=Rx(o,0,n-1)}if(f){let t=Math.max(jx(l,r.axis,u,!0).hi+1,i?0:jx(e,h,r.getPixelForValue(u),!0).hi+1);if(c){const e=l.slice(t-1).findIndex((t=>!Gb(t[a.axis])));t+=Math.max(0,e)}s=Rx(t,o,n)-o}else s=n-o}return{start:o,count:s}}function Xx(t){const{xScale:e,yScale:i,_scaleRanges:n}=t,o={xmin:e.min,xmax:e.max,ymin:i.min,ymax:i.max};if(!n)return t._scaleRanges=o,!0;const s=n.xmin!==e.min||n.xmax!==e.max||n.ymin!==i.min||n.ymax!==i.max;return Object.assign(n,o),s}const Kx=t=>0===t||1===t,Qx=(t,e,i)=>-Math.pow(2,10*(t-=1))*Math.sin((t-e)*gx/i),Jx=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*gx/i)+1,t_={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>1-Math.cos(t*xx),easeOutSine:t=>Math.sin(t*xx),easeInOutSine:t=>-.5*(Math.cos(mx*t)-1),easeInExpo:t=>0===t?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>1===t?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>Kx(t)?t:t<.5?.5*Math.pow(2,10*(2*t-1)):.5*(2-Math.pow(2,-10*(2*t-1))),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>Kx(t)?t:Qx(t,.075,.3),easeOutElastic:t=>Kx(t)?t:Jx(t,.075,.3),easeInOutElastic(t){const e=.1125;return Kx(t)?t:t<.5?.5*Qx(2*t,e,.45):.5+.5*Jx(2*t-1,e,.45)},easeInBack(t){const e=1.70158;return t*t*((e+1)*t-e)},easeOutBack(t){const e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:t=>1-t_.easeOutBounce(1-t),easeOutBounce(t){const e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375},easeInOutBounce:t=>t<.5?.5*t_.easeInBounce(2*t):.5*t_.easeOutBounce(2*t-1)+.5};function e_(t){if(t&&"object"==typeof t){const e=t.toString();return"[object CanvasPattern]"===e||"[object CanvasGradient]"===e}return!1}function i_(t){return e_(t)?t:new Hb(t)}function n_(t){return e_(t)?t:new Hb(t).saturate(.5).darken(.1).hexString()}const o_=["x","y","borderWidth","radius","tension"],s_=["color","borderColor","backgroundColor"];const r_=new Map;function a_(t,e,i){return function(t,e){e=e||{};const i=t+JSON.stringify(e);let n=r_.get(i);return n||(n=new Intl.NumberFormat(t,e),r_.set(i,n)),n}(e,i).format(t)}const l_={values:t=>Zb(t)?t:""+t,numeric(t,e,i){if(0===t)return"0";const n=this.chart.options.locale;let o,s=t;if(i.length>1){const e=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));(e<1e-4||e>1e15)&&(o="scientific"),s=function(t,e){let i=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;Math.abs(i)>=1&&t!==Math.floor(t)&&(i=t-Math.floor(t));return i}(t,i)}const r=kx(Math.abs(s)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:o,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),a_(t,n,l)},logarithmic(t,e,i){if(0===t)return"0";const n=i[e].significand||t/Math.pow(10,Math.floor(kx(t)));return[1,2,3,5,10,15].includes(n)||e>.8*i.length?l_.numeric.call(this,t,e,i):""}};var c_={formatters:l_};const h_=Object.create(null),d_=Object.create(null);function u_(t,e){if(!e)return t;const i=e.split(".");for(let e=0,n=i.length;e<n;++e){const n=i[e];t=t[n]||(t[n]=Object.create(null))}return t}function p_(t,e,i){return"string"==typeof e?rx(u_(t,e),i):rx(u_(t,""),e)}class f_{constructor(t,e){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=t=>t.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(t,e)=>n_(e.backgroundColor),this.hoverBorderColor=(t,e)=>n_(e.borderColor),this.hoverColor=(t,e)=>n_(e.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return p_(this,t,e)}get(t){return u_(this,t)}describe(t,e){return p_(d_,t,e)}override(t,e){return p_(h_,t,e)}route(t,e,i,n){const o=u_(this,t),s=u_(this,i),r="_"+e;Object.defineProperties(o,{[r]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const t=this[r],e=s[n];return Yb(t)?Object.assign({},e,t):Qb(t,e)},set(t){this[r]=t}}})}apply(t){t.forEach((t=>t(this)))}}var m_=new f_({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[function(t){t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),t.set("animations",{colors:{type:"color",properties:s_},numbers:{type:"number",properties:o_}}),t.describe("animations",{_fallback:"animation"}),t.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>0|t}}}})},function(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})},function(t){t.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:c_.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),t.route("scale.ticks","color","","color"),t.route("scale.grid","color","","borderColor"),t.route("scale.border","color","","borderColor"),t.route("scale.title","color","","color"),t.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t&&"dash"!==t}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t})}]);function g_(t,e,i,n,o){let s=e[o];return s||(s=e[o]=t.measureText(o).width,i.push(o)),s>n&&(n=s),n}function v_(t,e,i,n){let o=(n=n||{}).data=n.data||{},s=n.garbageCollect=n.garbageCollect||[];n.font!==e&&(o=n.data={},s=n.garbageCollect=[],n.font=e),t.save(),t.font=e;let r=0;const a=i.length;let l,c,h,d,u;for(l=0;l<a;l++)if(d=i[l],null==d||Zb(d)){if(Zb(d))for(c=0,h=d.length;c<h;c++)u=d[c],null==u||Zb(u)||(r=g_(t,o,s,r,u))}else r=g_(t,o,s,r,d);t.restore();const p=s.length/2;if(p>i.length){for(l=0;l<p;l++)delete o[s[l]];s.splice(0,p)}return r}function y_(t,e,i){const n=t.currentDevicePixelRatio,o=0!==i?Math.max(i/2,.5):0;return Math.round((e-o)*n)/n+o}function b_(t,e){(e||t)&&((e=e||t.getContext("2d")).save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore())}function x_(t,e,i,n){__(t,e,i,n,null)}function __(t,e,i,n,o){let s,r,a,l,c,h,d,u;const p=e.pointStyle,f=e.rotation,m=e.radius;let g=(f||0)*bx;if(p&&"object"==typeof p&&(s=p.toString(),"[object HTMLImageElement]"===s||"[object HTMLCanvasElement]"===s))return t.save(),t.translate(i,n),t.rotate(g),t.drawImage(p,-p.width/2,-p.height/2,p.width,p.height),void t.restore();if(!(isNaN(m)||m<=0)){switch(t.beginPath(),p){default:o?t.ellipse(i,n,o/2,m,0,0,gx):t.arc(i,n,m,0,gx),t.closePath();break;case"triangle":h=o?o/2:m,t.moveTo(i+Math.sin(g)*h,n-Math.cos(g)*m),g+=wx,t.lineTo(i+Math.sin(g)*h,n-Math.cos(g)*m),g+=wx,t.lineTo(i+Math.sin(g)*h,n-Math.cos(g)*m),t.closePath();break;case"rectRounded":c=.516*m,l=m-c,r=Math.cos(g+_x)*l,d=Math.cos(g+_x)*(o?o/2-c:l),a=Math.sin(g+_x)*l,u=Math.sin(g+_x)*(o?o/2-c:l),t.arc(i-d,n-a,c,g-mx,g-xx),t.arc(i+u,n-r,c,g-xx,g),t.arc(i+d,n+a,c,g,g+xx),t.arc(i-u,n+r,c,g+xx,g+mx),t.closePath();break;case"rect":if(!f){l=Math.SQRT1_2*m,h=o?o/2:l,t.rect(i-h,n-l,2*h,2*l);break}g+=_x;case"rectRot":d=Math.cos(g)*(o?o/2:m),r=Math.cos(g)*m,a=Math.sin(g)*m,u=Math.sin(g)*(o?o/2:m),t.moveTo(i-d,n-a),t.lineTo(i+u,n-r),t.lineTo(i+d,n+a),t.lineTo(i-u,n+r),t.closePath();break;case"crossRot":g+=_x;case"cross":d=Math.cos(g)*(o?o/2:m),r=Math.cos(g)*m,a=Math.sin(g)*m,u=Math.sin(g)*(o?o/2:m),t.moveTo(i-d,n-a),t.lineTo(i+d,n+a),t.moveTo(i+u,n-r),t.lineTo(i-u,n+r);break;case"star":d=Math.cos(g)*(o?o/2:m),r=Math.cos(g)*m,a=Math.sin(g)*m,u=Math.sin(g)*(o?o/2:m),t.moveTo(i-d,n-a),t.lineTo(i+d,n+a),t.moveTo(i+u,n-r),t.lineTo(i-u,n+r),g+=_x,d=Math.cos(g)*(o?o/2:m),r=Math.cos(g)*m,a=Math.sin(g)*m,u=Math.sin(g)*(o?o/2:m),t.moveTo(i-d,n-a),t.lineTo(i+d,n+a),t.moveTo(i+u,n-r),t.lineTo(i-u,n+r);break;case"line":r=o?o/2:Math.cos(g)*m,a=Math.sin(g)*m,t.moveTo(i-r,n-a),t.lineTo(i+r,n+a);break;case"dash":t.moveTo(i,n),t.lineTo(i+Math.cos(g)*(o?o/2:m),n+Math.sin(g)*m);break;case!1:t.closePath()}t.fill(),e.borderWidth>0&&t.stroke()}}function w_(t,e,i){return i=i||.5,!e||t&&t.x>e.left-i&&t.x<e.right+i&&t.y>e.top-i&&t.y<e.bottom+i}function k_(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function S_(t){t.restore()}function C_(t,e,i,n,o){if(!e)return t.lineTo(i.x,i.y);if("middle"===o){const n=(e.x+i.x)/2;t.lineTo(n,e.y),t.lineTo(n,i.y)}else"after"===o!=!!n?t.lineTo(e.x,i.y):t.lineTo(i.x,e.y);t.lineTo(i.x,i.y)}function E_(t,e,i,n){if(!e)return t.lineTo(i.x,i.y);t.bezierCurveTo(n?e.cp1x:e.cp2x,n?e.cp1y:e.cp2y,n?i.cp2x:i.cp1x,n?i.cp2y:i.cp1y,i.x,i.y)}function A_(t,e,i,n,o){if(o.strikethrough||o.underline){const s=t.measureText(n),r=e-s.actualBoundingBoxLeft,a=e+s.actualBoundingBoxRight,l=i-s.actualBoundingBoxAscent,c=i+s.actualBoundingBoxDescent,h=o.strikethrough?(l+c)/2:c;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=o.decorationWidth||2,t.moveTo(r,h),t.lineTo(a,h),t.stroke()}}function M_(t,e){const i=t.fillStyle;t.fillStyle=e.color,t.fillRect(e.left,e.top,e.width,e.height),t.fillStyle=i}function T_(t,e,i,n,o,s={}){const r=Zb(e)?e:[e],a=s.strokeWidth>0&&""!==s.strokeColor;let l,c;for(t.save(),t.font=o.string,function(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]),Gb(e.rotation)||t.rotate(e.rotation),e.color&&(t.fillStyle=e.color),e.textAlign&&(t.textAlign=e.textAlign),e.textBaseline&&(t.textBaseline=e.textBaseline)}(t,s),l=0;l<r.length;++l)c=r[l],s.backdrop&&M_(t,s.backdrop),a&&(s.strokeColor&&(t.strokeStyle=s.strokeColor),Gb(s.strokeWidth)||(t.lineWidth=s.strokeWidth),t.strokeText(c,i,n,s.maxWidth)),t.fillText(c,i,n,s.maxWidth),A_(t,i,n,c,s),n+=Number(o.lineHeight);t.restore()}function P_(t,e){const{x:i,y:n,w:o,h:s,radius:r}=e;t.arc(i+r.topLeft,n+r.topLeft,r.topLeft,1.5*mx,mx,!0),t.lineTo(i,n+s-r.bottomLeft),t.arc(i+r.bottomLeft,n+s-r.bottomLeft,r.bottomLeft,mx,xx,!0),t.lineTo(i+o-r.bottomRight,n+s),t.arc(i+o-r.bottomRight,n+s-r.bottomRight,r.bottomRight,xx,0,!0),t.lineTo(i+o,n+r.topRight),t.arc(i+o-r.topRight,n+r.topRight,r.topRight,0,-xx,!0),t.lineTo(i+r.topLeft,n)}const O_=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,D_=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function I_(t,e){const i=(""+t).match(O_);if(!i||"normal"===i[1])return 1.2*e;switch(t=+i[2],i[3]){case"px":return t;case"%":t/=100}return e*t}const L_=t=>+t||0;function $_(t,e){const i={},n=Yb(e),o=n?Object.keys(e):e,s=Yb(t)?n?i=>Qb(t[i],t[e[i]]):e=>t[e]:()=>t;for(const t of o)i[t]=L_(s(t));return i}function z_(t){return $_(t,{top:"y",right:"x",bottom:"y",left:"x"})}function R_(t){return $_(t,["topLeft","topRight","bottomLeft","bottomRight"])}function N_(t){const e=z_(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function B_(t,e){t=t||{},e=e||m_.font;let i=Qb(t.size,e.size);"string"==typeof i&&(i=parseInt(i,10));let n=Qb(t.style,e.style);n&&!(""+n).match(D_)&&(console.warn('Invalid font style specified: "'+n+'"'),n=void 0);const o={family:Qb(t.family,e.family),lineHeight:I_(Qb(t.lineHeight,e.lineHeight),i),size:i,style:n,weight:Qb(t.weight,e.weight),string:""};return o.string=function(t){return!t||Gb(t.size)||Gb(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}(o),o}function j_(t,e,i,n){let o,s,r;for(o=0,s=t.length;o<s;++o)if(r=t[o],void 0!==r&&void 0!==r)return r}function F_(t,e){return Object.assign(Object.create(t),e)}function q_(t,e=[""],i,n,o=(()=>t[0])){const s=i||t;void 0===n&&(n=J_("_fallback",t));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:s,_fallback:n,_getTarget:o,override:i=>q_([i,...t],e,s,n)};return new Proxy(r,{deleteProperty:(e,i)=>(delete e[i],delete e._keys,delete t[0][i],!0),get:(i,n)=>G_(i,n,(()=>function(t,e,i,n){let o;for(const s of e)if(o=J_(U_(s,t),i),void 0!==o)return W_(t,o)?K_(i,n,t,o):o}(n,e,t,i))),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(t._scopes[0],e),getPrototypeOf:()=>Reflect.getPrototypeOf(t[0]),has:(t,e)=>tw(t).includes(e),ownKeys:t=>tw(t),set(t,e,i){const n=t._storage||(t._storage=o());return t[e]=n[e]=i,delete t._keys,!0}})}function V_(t,e,i,n){const o={_cacheable:!1,_proxy:t,_context:e,_subProxy:i,_stack:new Set,_descriptors:H_(t,n),setContext:e=>V_(t,e,i,n),override:o=>V_(t.override(o),e,i,n)};return new Proxy(o,{deleteProperty:(e,i)=>(delete e[i],delete t[i],!0),get:(t,e,i)=>G_(t,e,(()=>function(t,e,i){const{_proxy:n,_context:o,_subProxy:s,_descriptors:r}=t;let a=n[e];px(a)&&r.isScriptable(e)&&(a=function(t,e,i,n){const{_proxy:o,_context:s,_subProxy:r,_stack:a}=i;if(a.has(t))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+t);a.add(t);let l=e(s,r||n);a.delete(t),W_(t,l)&&(l=K_(o._scopes,o,t,l));return l}(e,a,t,i));Zb(a)&&a.length&&(a=function(t,e,i,n){const{_proxy:o,_context:s,_subProxy:r,_descriptors:a}=i;if(void 0!==s.index&&n(t))return e[s.index%e.length];if(Yb(e[0])){const i=e,n=o._scopes.filter((t=>t!==i));e=[];for(const l of i){const i=K_(n,o,t,l);e.push(V_(i,s,r&&r[t],a))}}return e}(e,a,t,r.isIndexable));W_(e,a)&&(a=V_(a,o,s&&s[e],r));return a}(t,e,i))),getOwnPropertyDescriptor:(e,i)=>e._descriptors.allKeys?Reflect.has(t,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,i),getPrototypeOf:()=>Reflect.getPrototypeOf(t),has:(e,i)=>Reflect.has(t,i),ownKeys:()=>Reflect.ownKeys(t),set:(e,i,n)=>(t[i]=n,delete e[i],!0)})}function H_(t,e={scriptable:!0,indexable:!0}){const{_scriptable:i=e.scriptable,_indexable:n=e.indexable,_allKeys:o=e.allKeys}=t;return{allKeys:o,scriptable:i,indexable:n,isScriptable:px(i)?i:()=>i,isIndexable:px(n)?n:()=>n}}const U_=(t,e)=>t?t+dx(e):e,W_=(t,e)=>Yb(e)&&"adapters"!==t&&(null===Object.getPrototypeOf(e)||e.constructor===Object);function G_(t,e,i){if(Object.prototype.hasOwnProperty.call(t,e)||"constructor"===e)return t[e];const n=i();return t[e]=n,n}function Z_(t,e,i){return px(t)?t(e,i):t}const Y_=(t,e)=>!0===t?e:"string"==typeof t?hx(e,t):void 0;function X_(t,e,i,n,o){for(const s of e){const e=Y_(i,s);if(e){t.add(e);const s=Z_(e._fallback,i,o);if(void 0!==s&&s!==i&&s!==n)return s}else if(!1===e&&void 0!==n&&i!==n)return null}return!1}function K_(t,e,i,n){const o=e._rootScopes,s=Z_(e._fallback,i,n),r=[...t,...o],a=new Set;a.add(n);let l=Q_(a,r,i,s||i,n);return null!==l&&((void 0===s||s===i||(l=Q_(a,r,s,l,n),null!==l))&&q_(Array.from(a),[""],o,s,(()=>function(t,e,i){const n=t._getTarget();e in n||(n[e]={});const o=n[e];if(Zb(o)&&Yb(i))return i;return o||{}}(e,i,n))))}function Q_(t,e,i,n,o){for(;i;)i=X_(t,e,i,n,o);return i}function J_(t,e){for(const i of e){if(!i)continue;const e=i[t];if(void 0!==e)return e}}function tw(t){let e=t._keys;return e||(e=t._keys=function(t){const e=new Set;for(const i of t)for(const t of Object.keys(i).filter((t=>!t.startsWith("_"))))e.add(t);return Array.from(e)}(t._scopes)),e}function ew(t,e,i,n){const{iScale:o}=t,{key:s="r"}=this._parsing,r=new Array(n);let a,l,c,h;for(a=0,l=n;a<l;++a)c=a+i,h=e[c],r[a]={r:o.parse(hx(h,s),c)};return r}const iw=Number.EPSILON||1e-14,nw=(t,e)=>e<t.length&&!t[e].skip&&t[e],ow=t=>"x"===t?"y":"x";function sw(t,e,i,n){const o=t.skip?e:t,s=e,r=i.skip?e:i,a=Ix(s,o),l=Ix(r,s);let c=a/(a+l),h=l/(a+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const d=n*c,u=n*h;return{previous:{x:s.x-d*(r.x-o.x),y:s.y-d*(r.y-o.y)},next:{x:s.x+u*(r.x-o.x),y:s.y+u*(r.y-o.y)}}}function rw(t,e="x"){const i=ow(e),n=t.length,o=Array(n).fill(0),s=Array(n);let r,a,l,c=nw(t,0);for(r=0;r<n;++r)if(a=l,l=c,c=nw(t,r+1),l){if(c){const t=c[e]-l[e];o[r]=0!==t?(c[i]-l[i])/t:0}s[r]=a?c?Sx(o[r-1])!==Sx(o[r])?0:(o[r-1]+o[r])/2:o[r-1]:o[r]}!function(t,e,i){const n=t.length;let o,s,r,a,l,c=nw(t,0);for(let h=0;h<n-1;++h)l=c,c=nw(t,h+1),l&&c&&(Cx(e[h],0,iw)?i[h]=i[h+1]=0:(o=i[h]/e[h],s=i[h+1]/e[h],a=Math.pow(o,2)+Math.pow(s,2),a<=9||(r=3/Math.sqrt(a),i[h]=o*r*e[h],i[h+1]=s*r*e[h])))}(t,o,s),function(t,e,i="x"){const n=ow(i),o=t.length;let s,r,a,l=nw(t,0);for(let c=0;c<o;++c){if(r=a,a=l,l=nw(t,c+1),!a)continue;const o=a[i],h=a[n];r&&(s=(o-r[i])/3,a[`cp1${i}`]=o-s,a[`cp1${n}`]=h-s*e[c]),l&&(s=(l[i]-o)/3,a[`cp2${i}`]=o+s,a[`cp2${n}`]=h+s*e[c])}}(t,s,e)}function aw(t,e,i){return Math.max(Math.min(t,i),e)}function lw(t,e,i,n,o){let s,r,a,l;if(e.spanGaps&&(t=t.filter((t=>!t.skip))),"monotone"===e.cubicInterpolationMode)rw(t,o);else{let i=n?t[t.length-1]:t[0];for(s=0,r=t.length;s<r;++s)a=t[s],l=sw(i,a,t[Math.min(s+1,r-(n?0:1))%r],e.tension),a.cp1x=l.previous.x,a.cp1y=l.previous.y,a.cp2x=l.next.x,a.cp2y=l.next.y,i=a}e.capBezierPoints&&function(t,e){let i,n,o,s,r,a=w_(t[0],e);for(i=0,n=t.length;i<n;++i)r=s,s=a,a=i<n-1&&w_(t[i+1],e),s&&(o=t[i],r&&(o.cp1x=aw(o.cp1x,e.left,e.right),o.cp1y=aw(o.cp1y,e.top,e.bottom)),a&&(o.cp2x=aw(o.cp2x,e.left,e.right),o.cp2y=aw(o.cp2y,e.top,e.bottom)))}(t,i)}function cw(){return"undefined"!=typeof window&&"undefined"!=typeof document}function hw(t){let e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e}function dw(t,e,i){let n;return"string"==typeof t?(n=parseInt(t,10),-1!==t.indexOf("%")&&(n=n/100*e.parentNode[i])):n=t,n}const uw=t=>t.ownerDocument.defaultView.getComputedStyle(t,null);const pw=["top","right","bottom","left"];function fw(t,e,i){const n={};i=i?"-"+i:"";for(let o=0;o<4;o++){const s=pw[o];n[s]=parseFloat(t[e+"-"+s+i])||0}return n.width=n.left+n.right,n.height=n.top+n.bottom,n}const mw=(t,e,i)=>(t>0||e>0)&&(!i||!i.shadowRoot);function gw(t,e){if("native"in t)return t;const{canvas:i,currentDevicePixelRatio:n}=e,o=uw(i),s="border-box"===o.boxSizing,r=fw(o,"padding"),a=fw(o,"border","width"),{x:l,y:c,box:h}=function(t,e){const i=t.touches,n=i&&i.length?i[0]:t,{offsetX:o,offsetY:s}=n;let r,a,l=!1;if(mw(o,s,t.target))r=o,a=s;else{const t=e.getBoundingClientRect();r=n.clientX-t.left,a=n.clientY-t.top,l=!0}return{x:r,y:a,box:l}}(t,i),d=r.left+(h&&a.left),u=r.top+(h&&a.top);let{width:p,height:f}=e;return s&&(p-=r.width+a.width,f-=r.height+a.height),{x:Math.round((l-d)/p*i.width/n),y:Math.round((c-u)/f*i.height/n)}}const vw=t=>Math.round(10*t)/10;function yw(t,e,i,n){const o=uw(t),s=fw(o,"margin"),r=dw(o.maxWidth,t,"clientWidth")||yx,a=dw(o.maxHeight,t,"clientHeight")||yx,l=function(t,e,i){let n,o;if(void 0===e||void 0===i){const s=t&&hw(t);if(s){const t=s.getBoundingClientRect(),r=uw(s),a=fw(r,"border","width"),l=fw(r,"padding");e=t.width-l.width-a.width,i=t.height-l.height-a.height,n=dw(r.maxWidth,s,"clientWidth"),o=dw(r.maxHeight,s,"clientHeight")}else e=t.clientWidth,i=t.clientHeight}return{width:e,height:i,maxWidth:n||yx,maxHeight:o||yx}}(t,e,i);let{width:c,height:h}=l;if("content-box"===o.boxSizing){const t=fw(o,"border","width"),e=fw(o,"padding");c-=e.width+t.width,h-=e.height+t.height}c=Math.max(0,c-s.width),h=Math.max(0,n?c/n:h-s.height),c=vw(Math.min(c,r,l.maxWidth)),h=vw(Math.min(h,a,l.maxHeight)),c&&!h&&(h=vw(c/2));return(void 0!==e||void 0!==i)&&n&&l.height&&h>l.height&&(h=l.height,c=vw(Math.floor(h*n))),{width:c,height:h}}function bw(t,e,i){const n=e||1,o=Math.floor(t.height*n),s=Math.floor(t.width*n);t.height=Math.floor(t.height),t.width=Math.floor(t.width);const r=t.canvas;return r.style&&(i||!r.style.height&&!r.style.width)&&(r.style.height=`${t.height}px`,r.style.width=`${t.width}px`),(t.currentDevicePixelRatio!==n||r.height!==o||r.width!==s)&&(t.currentDevicePixelRatio=n,r.height=o,r.width=s,t.ctx.setTransform(n,0,0,n,0,0),!0)}const xw=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};cw()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch(t){}return t}();function _w(t,e){const i=function(t,e){return uw(t).getPropertyValue(e)}(t,e),n=i&&i.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}function ww(t,e,i,n){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function kw(t,e,i,n){return{x:t.x+i*(e.x-t.x),y:"middle"===n?i<.5?t.y:e.y:"after"===n?i<1?t.y:e.y:i>0?e.y:t.y}}function Sw(t,e,i,n){const o={x:t.cp2x,y:t.cp2y},s={x:e.cp1x,y:e.cp1y},r=ww(t,o,i),a=ww(o,s,i),l=ww(s,e,i),c=ww(r,a,i),h=ww(a,l,i);return ww(c,h,i)}function Cw(t,e,i){return t?function(t,e){return{x:i=>t+t+e-i,setWidth(t){e=t},textAlign:t=>"center"===t?t:"right"===t?"left":"right",xPlus:(t,e)=>t-e,leftForLtr:(t,e)=>t-e}}(e,i):{x:t=>t,setWidth(t){},textAlign:t=>t,xPlus:(t,e)=>t+e,leftForLtr:(t,e)=>t}}function Ew(t,e){let i,n;"ltr"!==e&&"rtl"!==e||(i=t.canvas.style,n=[i.getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",e,"important"),t.prevTextDirection=n)}function Aw(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function Mw(t){return"angle"===t?{between:zx,compare:Lx,normalize:$x}:{between:Nx,compare:(t,e)=>t-e,normalize:t=>t}}function Tw({start:t,end:e,count:i,loop:n,style:o}){return{start:t%i,end:e%i,loop:n&&(e-t+1)%i==0,style:o}}function Pw(t,e,i){if(!i)return[t];const{property:n,start:o,end:s}=i,r=e.length,{compare:a,between:l,normalize:c}=Mw(n),{start:h,end:d,loop:u,style:p}=function(t,e,i){const{property:n,start:o,end:s}=i,{between:r,normalize:a}=Mw(n),l=e.length;let c,h,{start:d,end:u,loop:p}=t;if(p){for(d+=l,u+=l,c=0,h=l;c<h&&r(a(e[d%l][n]),o,s);++c)d--,u--;d%=l,u%=l}return u<d&&(u+=l),{start:d,end:u,loop:p,style:t.style}}(t,e,i),f=[];let m,g,v,y=!1,b=null;const x=()=>y||l(o,v,m)&&0!==a(o,v),_=()=>!y||0===a(s,m)||l(s,v,m);for(let t=h,i=h;t<=d;++t)g=e[t%r],g.skip||(m=c(g[n]),m!==v&&(y=l(m,o,s),null===b&&x()&&(b=0===a(m,o)?t:i),null!==b&&_()&&(f.push(Tw({start:b,end:t,loop:u,count:r,style:p})),b=null),i=t,v=m));return null!==b&&f.push(Tw({start:b,end:d,loop:u,count:r,style:p})),f}function Ow(t,e){const i=[],n=t.segments;for(let o=0;o<n.length;o++){const s=Pw(n[o],t.points,e);s.length&&i.push(...s)}return i}function Dw(t,e,i,n){return n&&n.setContext&&i?function(t,e,i,n){const o=t._chart.getContext(),s=Iw(t.options),{_datasetIndex:r,options:{spanGaps:a}}=t,l=i.length,c=[];let h=s,d=e[0].start,u=d;function p(t,e,n,o){const s=a?-1:1;if(t!==e){for(t+=l;i[t%l].skip;)t-=s;for(;i[e%l].skip;)e+=s;t%l!=e%l&&(c.push({start:t%l,end:e%l,loop:n,style:o}),h=o,d=e%l)}}for(const t of e){d=a?d:t.start;let e,s=i[d%l];for(u=d+1;u<=t.end;u++){const a=i[u%l];e=Iw(n.setContext(F_(o,{type:"segment",p0:s,p1:a,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:r}))),Lw(e,h)&&p(d,u-1,t.loop,h),s=a,h=e}d<u-1&&p(d,u-1,t.loop,h)}return c}(t,e,i,n):e}function Iw(t){return{backgroundColor:t.backgroundColor,borderCapStyle:t.borderCapStyle,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderJoinStyle:t.borderJoinStyle,borderWidth:t.borderWidth,borderColor:t.borderColor}}function Lw(t,e){if(!e)return!1;const i=[],n=function(t,e){return e_(e)?(i.includes(e)||i.push(e),i.indexOf(e)):e};return JSON.stringify(t,n)!==JSON.stringify(e,n)}
|
|
8690
|
+
*/function Kb(){}const Qb=(()=>{let t=0;return()=>t++})();function Jb(t){return null==t}function tx(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return"[object"===e.slice(0,7)&&"Array]"===e.slice(-6)}function ex(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}function ix(t){return("number"==typeof t||t instanceof Number)&&isFinite(+t)}function nx(t,e){return ix(t)?t:e}function ox(t,e){return void 0===t?e:t}const sx=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function rx(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function ax(t,e,i,n){let o,s,r;if(tx(t))for(s=t.length,o=0;o<s;o++)e.call(i,t[o],o);else if(ex(t))for(r=Object.keys(t),s=r.length,o=0;o<s;o++)e.call(i,t[r[o]],r[o])}function lx(t,e){let i,n,o,s;if(!t||!e||t.length!==e.length)return!1;for(i=0,n=t.length;i<n;++i)if(o=t[i],s=e[i],o.datasetIndex!==s.datasetIndex||o.index!==s.index)return!1;return!0}function cx(t){if(tx(t))return t.map(cx);if(ex(t)){const e=Object.create(null),i=Object.keys(t),n=i.length;let o=0;for(;o<n;++o)e[i[o]]=cx(t[i[o]]);return e}return t}function hx(t){return-1===["__proto__","prototype","constructor"].indexOf(t)}function dx(t,e,i,n){if(!hx(t))return;const o=e[t],s=i[t];ex(o)&&ex(s)?ux(o,s,n):e[t]=cx(s)}function ux(t,e,i){const n=tx(e)?e:[e],o=n.length;if(!ex(t))return t;const s=(i=i||{}).merger||dx;let r;for(let e=0;e<o;++e){if(r=n[e],!ex(r))continue;const o=Object.keys(r);for(let e=0,n=o.length;e<n;++e)s(o[e],t,r,i)}return t}function px(t,e){return ux(t,e,{merger:fx})}function fx(t,e,i){if(!hx(t))return;const n=e[t],o=i[t];ex(n)&&ex(o)?px(n,o):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=cx(o))}const mx={"":t=>t,x:t=>t.x,y:t=>t.y};function gx(t,e){const i=mx[e]||(mx[e]=function(t){const e=function(t){const e=t.split("."),i=[];let n="";for(const t of e)n+=t,n.endsWith("\\")?n=n.slice(0,-1)+".":(i.push(n),n="");return i}(t);return t=>{for(const i of e){if(""===i)break;t=t&&t[i]}return t}}(e));return i(t)}function vx(t){return t.charAt(0).toUpperCase()+t.slice(1)}const yx=t=>void 0!==t,bx=t=>"function"==typeof t,xx=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0};const _x=Math.PI,wx=2*_x,kx=wx+_x,Sx=Number.POSITIVE_INFINITY,Cx=_x/180,Ex=_x/2,Ax=_x/4,Mx=2*_x/3,Tx=Math.log10,Px=Math.sign;function Ox(t,e,i){return Math.abs(t-e)<i}function Dx(t){const e=Math.round(t);t=Ox(t,e,t/1e3)?e:t;const i=Math.pow(10,Math.floor(Tx(t))),n=t/i;return(n<=1?1:n<=2?2:n<=5?5:10)*i}function Ix(t){return!function(t){return"symbol"==typeof t||"object"==typeof t&&null!==t&&!(Symbol.toPrimitive in t||"toString"in t||"valueOf"in t)}(t)&&!isNaN(parseFloat(t))&&isFinite(t)}function Lx(t,e,i){let n,o,s;for(n=0,o=t.length;n<o;n++)s=t[n][i],isNaN(s)||(e.min=Math.min(e.min,s),e.max=Math.max(e.max,s))}function $x(t){return t*(_x/180)}function zx(t){return t*(180/_x)}function Rx(t){if(!ix(t))return;let e=1,i=0;for(;Math.round(t*e)/e!==t;)e*=10,i++;return i}function Nx(t,e){const i=e.x-t.x,n=e.y-t.y,o=Math.sqrt(i*i+n*n);let s=Math.atan2(n,i);return s<-.5*_x&&(s+=wx),{angle:s,distance:o}}function Bx(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function jx(t,e){return(t-e+kx)%wx-_x}function Fx(t){return(t%wx+wx)%wx}function qx(t,e,i,n){const o=Fx(t),s=Fx(e),r=Fx(i),a=Fx(s-o),l=Fx(r-o),c=Fx(o-s),h=Fx(o-r);return o===s||o===r||n&&s===r||a>l&&c<h}function Vx(t,e,i){return Math.max(e,Math.min(i,t))}function Hx(t,e,i,n=1e-6){return t>=Math.min(e,i)-n&&t<=Math.max(e,i)+n}function Ux(t,e,i){i=i||(i=>t[i]<e);let n,o=t.length-1,s=0;for(;o-s>1;)n=s+o>>1,i(n)?s=n:o=n;return{lo:s,hi:o}}const Wx=(t,e,i,n)=>Ux(t,i,n?n=>{const o=t[n][e];return o<i||o===i&&t[n+1][e]===i}:n=>t[n][e]<i),Gx=(t,e,i)=>Ux(t,i,(n=>t[n][e]>=i));const Zx=["push","pop","shift","splice","unshift"];function Yx(t,e){const i=t._chartjs;if(!i)return;const n=i.listeners,o=n.indexOf(e);-1!==o&&n.splice(o,1),n.length>0||(Zx.forEach((e=>{delete t[e]})),delete t._chartjs)}function Xx(t){const e=new Set(t);return e.size===t.length?t:Array.from(e)}const Kx="undefined"==typeof window?function(t){return t()}:window.requestAnimationFrame;function Qx(t,e){let i=[],n=!1;return function(...o){i=o,n||(n=!0,Kx.call(window,(()=>{n=!1,t.apply(e,i)})))}}const Jx=t=>"start"===t?"left":"end"===t?"right":"center",t_=(t,e,i)=>"start"===t?e:"end"===t?i:(e+i)/2;function e_(t,e,i){const n=e.length;let o=0,s=n;if(t._sorted){const{iScale:r,vScale:a,_parsed:l}=t,c=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null,h=r.axis,{min:d,max:u,minDefined:p,maxDefined:f}=r.getUserBounds();if(p){if(o=Math.min(Wx(l,h,d).lo,i?n:Wx(e,h,r.getPixelForValue(d)).lo),c){const t=l.slice(0,o+1).reverse().findIndex((t=>!Jb(t[a.axis])));o-=Math.max(0,t)}o=Vx(o,0,n-1)}if(f){let t=Math.max(Wx(l,r.axis,u,!0).hi+1,i?0:Wx(e,h,r.getPixelForValue(u),!0).hi+1);if(c){const e=l.slice(t-1).findIndex((t=>!Jb(t[a.axis])));t+=Math.max(0,e)}s=Vx(t,o,n)-o}else s=n-o}return{start:o,count:s}}function i_(t){const{xScale:e,yScale:i,_scaleRanges:n}=t,o={xmin:e.min,xmax:e.max,ymin:i.min,ymax:i.max};if(!n)return t._scaleRanges=o,!0;const s=n.xmin!==e.min||n.xmax!==e.max||n.ymin!==i.min||n.ymax!==i.max;return Object.assign(n,o),s}const n_=t=>0===t||1===t,o_=(t,e,i)=>-Math.pow(2,10*(t-=1))*Math.sin((t-e)*wx/i),s_=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*wx/i)+1,r_={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>1-Math.cos(t*Ex),easeOutSine:t=>Math.sin(t*Ex),easeInOutSine:t=>-.5*(Math.cos(_x*t)-1),easeInExpo:t=>0===t?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>1===t?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>n_(t)?t:t<.5?.5*Math.pow(2,10*(2*t-1)):.5*(2-Math.pow(2,-10*(2*t-1))),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>n_(t)?t:o_(t,.075,.3),easeOutElastic:t=>n_(t)?t:s_(t,.075,.3),easeInOutElastic(t){const e=.1125;return n_(t)?t:t<.5?.5*o_(2*t,e,.45):.5+.5*s_(2*t-1,e,.45)},easeInBack(t){const e=1.70158;return t*t*((e+1)*t-e)},easeOutBack(t){const e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:t=>1-r_.easeOutBounce(1-t),easeOutBounce(t){const e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375},easeInOutBounce:t=>t<.5?.5*r_.easeInBounce(2*t):.5*r_.easeOutBounce(2*t-1)+.5};function a_(t){if(t&&"object"==typeof t){const e=t.toString();return"[object CanvasPattern]"===e||"[object CanvasGradient]"===e}return!1}function l_(t){return a_(t)?t:new Xb(t)}function c_(t){return a_(t)?t:new Xb(t).saturate(.5).darken(.1).hexString()}const h_=["x","y","borderWidth","radius","tension"],d_=["color","borderColor","backgroundColor"];const u_=new Map;function p_(t,e,i){return function(t,e){e=e||{};const i=t+JSON.stringify(e);let n=u_.get(i);return n||(n=new Intl.NumberFormat(t,e),u_.set(i,n)),n}(e,i).format(t)}const f_={values:t=>tx(t)?t:""+t,numeric(t,e,i){if(0===t)return"0";const n=this.chart.options.locale;let o,s=t;if(i.length>1){const e=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));(e<1e-4||e>1e15)&&(o="scientific"),s=function(t,e){let i=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;Math.abs(i)>=1&&t!==Math.floor(t)&&(i=t-Math.floor(t));return i}(t,i)}const r=Tx(Math.abs(s)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:o,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),p_(t,n,l)},logarithmic(t,e,i){if(0===t)return"0";const n=i[e].significand||t/Math.pow(10,Math.floor(Tx(t)));return[1,2,3,5,10,15].includes(n)||e>.8*i.length?f_.numeric.call(this,t,e,i):""}};var m_={formatters:f_};const g_=Object.create(null),v_=Object.create(null);function y_(t,e){if(!e)return t;const i=e.split(".");for(let e=0,n=i.length;e<n;++e){const n=i[e];t=t[n]||(t[n]=Object.create(null))}return t}function b_(t,e,i){return"string"==typeof e?ux(y_(t,e),i):ux(y_(t,""),e)}class x_{constructor(t,e){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=t=>t.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(t,e)=>c_(e.backgroundColor),this.hoverBorderColor=(t,e)=>c_(e.borderColor),this.hoverColor=(t,e)=>c_(e.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return b_(this,t,e)}get(t){return y_(this,t)}describe(t,e){return b_(v_,t,e)}override(t,e){return b_(g_,t,e)}route(t,e,i,n){const o=y_(this,t),s=y_(this,i),r="_"+e;Object.defineProperties(o,{[r]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const t=this[r],e=s[n];return ex(t)?Object.assign({},e,t):ox(t,e)},set(t){this[r]=t}}})}apply(t){t.forEach((t=>t(this)))}}var __=new x_({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[function(t){t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),t.set("animations",{colors:{type:"color",properties:d_},numbers:{type:"number",properties:h_}}),t.describe("animations",{_fallback:"animation"}),t.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>0|t}}}})},function(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})},function(t){t.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:m_.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),t.route("scale.ticks","color","","color"),t.route("scale.grid","color","","borderColor"),t.route("scale.border","color","","borderColor"),t.route("scale.title","color","","color"),t.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t&&"dash"!==t}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t})}]);function w_(t,e,i,n,o){let s=e[o];return s||(s=e[o]=t.measureText(o).width,i.push(o)),s>n&&(n=s),n}function k_(t,e,i,n){let o=(n=n||{}).data=n.data||{},s=n.garbageCollect=n.garbageCollect||[];n.font!==e&&(o=n.data={},s=n.garbageCollect=[],n.font=e),t.save(),t.font=e;let r=0;const a=i.length;let l,c,h,d,u;for(l=0;l<a;l++)if(d=i[l],null==d||tx(d)){if(tx(d))for(c=0,h=d.length;c<h;c++)u=d[c],null==u||tx(u)||(r=w_(t,o,s,r,u))}else r=w_(t,o,s,r,d);t.restore();const p=s.length/2;if(p>i.length){for(l=0;l<p;l++)delete o[s[l]];s.splice(0,p)}return r}function S_(t,e,i){const n=t.currentDevicePixelRatio,o=0!==i?Math.max(i/2,.5):0;return Math.round((e-o)*n)/n+o}function C_(t,e){(e||t)&&((e=e||t.getContext("2d")).save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore())}function E_(t,e,i,n){A_(t,e,i,n,null)}function A_(t,e,i,n,o){let s,r,a,l,c,h,d,u;const p=e.pointStyle,f=e.rotation,m=e.radius;let g=(f||0)*Cx;if(p&&"object"==typeof p&&(s=p.toString(),"[object HTMLImageElement]"===s||"[object HTMLCanvasElement]"===s))return t.save(),t.translate(i,n),t.rotate(g),t.drawImage(p,-p.width/2,-p.height/2,p.width,p.height),void t.restore();if(!(isNaN(m)||m<=0)){switch(t.beginPath(),p){default:o?t.ellipse(i,n,o/2,m,0,0,wx):t.arc(i,n,m,0,wx),t.closePath();break;case"triangle":h=o?o/2:m,t.moveTo(i+Math.sin(g)*h,n-Math.cos(g)*m),g+=Mx,t.lineTo(i+Math.sin(g)*h,n-Math.cos(g)*m),g+=Mx,t.lineTo(i+Math.sin(g)*h,n-Math.cos(g)*m),t.closePath();break;case"rectRounded":c=.516*m,l=m-c,r=Math.cos(g+Ax)*l,d=Math.cos(g+Ax)*(o?o/2-c:l),a=Math.sin(g+Ax)*l,u=Math.sin(g+Ax)*(o?o/2-c:l),t.arc(i-d,n-a,c,g-_x,g-Ex),t.arc(i+u,n-r,c,g-Ex,g),t.arc(i+d,n+a,c,g,g+Ex),t.arc(i-u,n+r,c,g+Ex,g+_x),t.closePath();break;case"rect":if(!f){l=Math.SQRT1_2*m,h=o?o/2:l,t.rect(i-h,n-l,2*h,2*l);break}g+=Ax;case"rectRot":d=Math.cos(g)*(o?o/2:m),r=Math.cos(g)*m,a=Math.sin(g)*m,u=Math.sin(g)*(o?o/2:m),t.moveTo(i-d,n-a),t.lineTo(i+u,n-r),t.lineTo(i+d,n+a),t.lineTo(i-u,n+r),t.closePath();break;case"crossRot":g+=Ax;case"cross":d=Math.cos(g)*(o?o/2:m),r=Math.cos(g)*m,a=Math.sin(g)*m,u=Math.sin(g)*(o?o/2:m),t.moveTo(i-d,n-a),t.lineTo(i+d,n+a),t.moveTo(i+u,n-r),t.lineTo(i-u,n+r);break;case"star":d=Math.cos(g)*(o?o/2:m),r=Math.cos(g)*m,a=Math.sin(g)*m,u=Math.sin(g)*(o?o/2:m),t.moveTo(i-d,n-a),t.lineTo(i+d,n+a),t.moveTo(i+u,n-r),t.lineTo(i-u,n+r),g+=Ax,d=Math.cos(g)*(o?o/2:m),r=Math.cos(g)*m,a=Math.sin(g)*m,u=Math.sin(g)*(o?o/2:m),t.moveTo(i-d,n-a),t.lineTo(i+d,n+a),t.moveTo(i+u,n-r),t.lineTo(i-u,n+r);break;case"line":r=o?o/2:Math.cos(g)*m,a=Math.sin(g)*m,t.moveTo(i-r,n-a),t.lineTo(i+r,n+a);break;case"dash":t.moveTo(i,n),t.lineTo(i+Math.cos(g)*(o?o/2:m),n+Math.sin(g)*m);break;case!1:t.closePath()}t.fill(),e.borderWidth>0&&t.stroke()}}function M_(t,e,i){return i=i||.5,!e||t&&t.x>e.left-i&&t.x<e.right+i&&t.y>e.top-i&&t.y<e.bottom+i}function T_(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function P_(t){t.restore()}function O_(t,e,i,n,o){if(!e)return t.lineTo(i.x,i.y);if("middle"===o){const n=(e.x+i.x)/2;t.lineTo(n,e.y),t.lineTo(n,i.y)}else"after"===o!=!!n?t.lineTo(e.x,i.y):t.lineTo(i.x,e.y);t.lineTo(i.x,i.y)}function D_(t,e,i,n){if(!e)return t.lineTo(i.x,i.y);t.bezierCurveTo(n?e.cp1x:e.cp2x,n?e.cp1y:e.cp2y,n?i.cp2x:i.cp1x,n?i.cp2y:i.cp1y,i.x,i.y)}function I_(t,e,i,n,o){if(o.strikethrough||o.underline){const s=t.measureText(n),r=e-s.actualBoundingBoxLeft,a=e+s.actualBoundingBoxRight,l=i-s.actualBoundingBoxAscent,c=i+s.actualBoundingBoxDescent,h=o.strikethrough?(l+c)/2:c;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=o.decorationWidth||2,t.moveTo(r,h),t.lineTo(a,h),t.stroke()}}function L_(t,e){const i=t.fillStyle;t.fillStyle=e.color,t.fillRect(e.left,e.top,e.width,e.height),t.fillStyle=i}function $_(t,e,i,n,o,s={}){const r=tx(e)?e:[e],a=s.strokeWidth>0&&""!==s.strokeColor;let l,c;for(t.save(),t.font=o.string,function(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]),Jb(e.rotation)||t.rotate(e.rotation),e.color&&(t.fillStyle=e.color),e.textAlign&&(t.textAlign=e.textAlign),e.textBaseline&&(t.textBaseline=e.textBaseline)}(t,s),l=0;l<r.length;++l)c=r[l],s.backdrop&&L_(t,s.backdrop),a&&(s.strokeColor&&(t.strokeStyle=s.strokeColor),Jb(s.strokeWidth)||(t.lineWidth=s.strokeWidth),t.strokeText(c,i,n,s.maxWidth)),t.fillText(c,i,n,s.maxWidth),I_(t,i,n,c,s),n+=Number(o.lineHeight);t.restore()}function z_(t,e){const{x:i,y:n,w:o,h:s,radius:r}=e;t.arc(i+r.topLeft,n+r.topLeft,r.topLeft,1.5*_x,_x,!0),t.lineTo(i,n+s-r.bottomLeft),t.arc(i+r.bottomLeft,n+s-r.bottomLeft,r.bottomLeft,_x,Ex,!0),t.lineTo(i+o-r.bottomRight,n+s),t.arc(i+o-r.bottomRight,n+s-r.bottomRight,r.bottomRight,Ex,0,!0),t.lineTo(i+o,n+r.topRight),t.arc(i+o-r.topRight,n+r.topRight,r.topRight,0,-Ex,!0),t.lineTo(i+r.topLeft,n)}const R_=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,N_=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function B_(t,e){const i=(""+t).match(R_);if(!i||"normal"===i[1])return 1.2*e;switch(t=+i[2],i[3]){case"px":return t;case"%":t/=100}return e*t}const j_=t=>+t||0;function F_(t,e){const i={},n=ex(e),o=n?Object.keys(e):e,s=ex(t)?n?i=>ox(t[i],t[e[i]]):e=>t[e]:()=>t;for(const t of o)i[t]=j_(s(t));return i}function q_(t){return F_(t,{top:"y",right:"x",bottom:"y",left:"x"})}function V_(t){return F_(t,["topLeft","topRight","bottomLeft","bottomRight"])}function H_(t){const e=q_(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function U_(t,e){t=t||{},e=e||__.font;let i=ox(t.size,e.size);"string"==typeof i&&(i=parseInt(i,10));let n=ox(t.style,e.style);n&&!(""+n).match(N_)&&(console.warn('Invalid font style specified: "'+n+'"'),n=void 0);const o={family:ox(t.family,e.family),lineHeight:B_(ox(t.lineHeight,e.lineHeight),i),size:i,style:n,weight:ox(t.weight,e.weight),string:""};return o.string=function(t){return!t||Jb(t.size)||Jb(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}(o),o}function W_(t,e,i,n){let o,s,r;for(o=0,s=t.length;o<s;++o)if(r=t[o],void 0!==r&&(void 0!==e&&"function"==typeof r&&(r=r(e)),void 0!==i&&tx(r)&&(r=r[i%r.length]),void 0!==r))return r}function G_(t,e){return Object.assign(Object.create(t),e)}function Z_(t,e=[""],i,n,o=(()=>t[0])){const s=i||t;void 0===n&&(n=sw("_fallback",t));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:s,_fallback:n,_getTarget:o,override:i=>Z_([i,...t],e,s,n)};return new Proxy(r,{deleteProperty:(e,i)=>(delete e[i],delete e._keys,delete t[0][i],!0),get:(i,n)=>J_(i,n,(()=>function(t,e,i,n){let o;for(const s of e)if(o=sw(K_(s,t),i),void 0!==o)return Q_(t,o)?nw(i,n,t,o):o}(n,e,t,i))),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(t._scopes[0],e),getPrototypeOf:()=>Reflect.getPrototypeOf(t[0]),has:(t,e)=>rw(t).includes(e),ownKeys:t=>rw(t),set(t,e,i){const n=t._storage||(t._storage=o());return t[e]=n[e]=i,delete t._keys,!0}})}function Y_(t,e,i,n){const o={_cacheable:!1,_proxy:t,_context:e,_subProxy:i,_stack:new Set,_descriptors:X_(t,n),setContext:e=>Y_(t,e,i,n),override:o=>Y_(t.override(o),e,i,n)};return new Proxy(o,{deleteProperty:(e,i)=>(delete e[i],delete t[i],!0),get:(t,e,i)=>J_(t,e,(()=>function(t,e,i){const{_proxy:n,_context:o,_subProxy:s,_descriptors:r}=t;let a=n[e];bx(a)&&r.isScriptable(e)&&(a=function(t,e,i,n){const{_proxy:o,_context:s,_subProxy:r,_stack:a}=i;if(a.has(t))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+t);a.add(t);let l=e(s,r||n);a.delete(t),Q_(t,l)&&(l=nw(o._scopes,o,t,l));return l}(e,a,t,i));tx(a)&&a.length&&(a=function(t,e,i,n){const{_proxy:o,_context:s,_subProxy:r,_descriptors:a}=i;if(void 0!==s.index&&n(t))return e[s.index%e.length];if(ex(e[0])){const i=e,n=o._scopes.filter((t=>t!==i));e=[];for(const l of i){const i=nw(n,o,t,l);e.push(Y_(i,s,r&&r[t],a))}}return e}(e,a,t,r.isIndexable));Q_(e,a)&&(a=Y_(a,o,s&&s[e],r));return a}(t,e,i))),getOwnPropertyDescriptor:(e,i)=>e._descriptors.allKeys?Reflect.has(t,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,i),getPrototypeOf:()=>Reflect.getPrototypeOf(t),has:(e,i)=>Reflect.has(t,i),ownKeys:()=>Reflect.ownKeys(t),set:(e,i,n)=>(t[i]=n,delete e[i],!0)})}function X_(t,e={scriptable:!0,indexable:!0}){const{_scriptable:i=e.scriptable,_indexable:n=e.indexable,_allKeys:o=e.allKeys}=t;return{allKeys:o,scriptable:i,indexable:n,isScriptable:bx(i)?i:()=>i,isIndexable:bx(n)?n:()=>n}}const K_=(t,e)=>t?t+vx(e):e,Q_=(t,e)=>ex(e)&&"adapters"!==t&&(null===Object.getPrototypeOf(e)||e.constructor===Object);function J_(t,e,i){if(Object.prototype.hasOwnProperty.call(t,e)||"constructor"===e)return t[e];const n=i();return t[e]=n,n}function tw(t,e,i){return bx(t)?t(e,i):t}const ew=(t,e)=>!0===t?e:"string"==typeof t?gx(e,t):void 0;function iw(t,e,i,n,o){for(const s of e){const e=ew(i,s);if(e){t.add(e);const s=tw(e._fallback,i,o);if(void 0!==s&&s!==i&&s!==n)return s}else if(!1===e&&void 0!==n&&i!==n)return null}return!1}function nw(t,e,i,n){const o=e._rootScopes,s=tw(e._fallback,i,n),r=[...t,...o],a=new Set;a.add(n);let l=ow(a,r,i,s||i,n);return null!==l&&((void 0===s||s===i||(l=ow(a,r,s,l,n),null!==l))&&Z_(Array.from(a),[""],o,s,(()=>function(t,e,i){const n=t._getTarget();e in n||(n[e]={});const o=n[e];if(tx(o)&&ex(i))return i;return o||{}}(e,i,n))))}function ow(t,e,i,n,o){for(;i;)i=iw(t,e,i,n,o);return i}function sw(t,e){for(const i of e){if(!i)continue;const e=i[t];if(void 0!==e)return e}}function rw(t){let e=t._keys;return e||(e=t._keys=function(t){const e=new Set;for(const i of t)for(const t of Object.keys(i).filter((t=>!t.startsWith("_"))))e.add(t);return Array.from(e)}(t._scopes)),e}function aw(t,e,i,n){const{iScale:o}=t,{key:s="r"}=this._parsing,r=new Array(n);let a,l,c,h;for(a=0,l=n;a<l;++a)c=a+i,h=e[c],r[a]={r:o.parse(gx(h,s),c)};return r}const lw=Number.EPSILON||1e-14,cw=(t,e)=>e<t.length&&!t[e].skip&&t[e],hw=t=>"x"===t?"y":"x";function dw(t,e,i,n){const o=t.skip?e:t,s=e,r=i.skip?e:i,a=Bx(s,o),l=Bx(r,s);let c=a/(a+l),h=l/(a+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const d=n*c,u=n*h;return{previous:{x:s.x-d*(r.x-o.x),y:s.y-d*(r.y-o.y)},next:{x:s.x+u*(r.x-o.x),y:s.y+u*(r.y-o.y)}}}function uw(t,e="x"){const i=hw(e),n=t.length,o=Array(n).fill(0),s=Array(n);let r,a,l,c=cw(t,0);for(r=0;r<n;++r)if(a=l,l=c,c=cw(t,r+1),l){if(c){const t=c[e]-l[e];o[r]=0!==t?(c[i]-l[i])/t:0}s[r]=a?c?Px(o[r-1])!==Px(o[r])?0:(o[r-1]+o[r])/2:o[r-1]:o[r]}!function(t,e,i){const n=t.length;let o,s,r,a,l,c=cw(t,0);for(let h=0;h<n-1;++h)l=c,c=cw(t,h+1),l&&c&&(Ox(e[h],0,lw)?i[h]=i[h+1]=0:(o=i[h]/e[h],s=i[h+1]/e[h],a=Math.pow(o,2)+Math.pow(s,2),a<=9||(r=3/Math.sqrt(a),i[h]=o*r*e[h],i[h+1]=s*r*e[h])))}(t,o,s),function(t,e,i="x"){const n=hw(i),o=t.length;let s,r,a,l=cw(t,0);for(let c=0;c<o;++c){if(r=a,a=l,l=cw(t,c+1),!a)continue;const o=a[i],h=a[n];r&&(s=(o-r[i])/3,a[`cp1${i}`]=o-s,a[`cp1${n}`]=h-s*e[c]),l&&(s=(l[i]-o)/3,a[`cp2${i}`]=o+s,a[`cp2${n}`]=h+s*e[c])}}(t,s,e)}function pw(t,e,i){return Math.max(Math.min(t,i),e)}function fw(t,e,i,n,o){let s,r,a,l;if(e.spanGaps&&(t=t.filter((t=>!t.skip))),"monotone"===e.cubicInterpolationMode)uw(t,o);else{let i=n?t[t.length-1]:t[0];for(s=0,r=t.length;s<r;++s)a=t[s],l=dw(i,a,t[Math.min(s+1,r-(n?0:1))%r],e.tension),a.cp1x=l.previous.x,a.cp1y=l.previous.y,a.cp2x=l.next.x,a.cp2y=l.next.y,i=a}e.capBezierPoints&&function(t,e){let i,n,o,s,r,a=M_(t[0],e);for(i=0,n=t.length;i<n;++i)r=s,s=a,a=i<n-1&&M_(t[i+1],e),s&&(o=t[i],r&&(o.cp1x=pw(o.cp1x,e.left,e.right),o.cp1y=pw(o.cp1y,e.top,e.bottom)),a&&(o.cp2x=pw(o.cp2x,e.left,e.right),o.cp2y=pw(o.cp2y,e.top,e.bottom)))}(t,i)}function mw(){return"undefined"!=typeof window&&"undefined"!=typeof document}function gw(t){let e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e}function vw(t,e,i){let n;return"string"==typeof t?(n=parseInt(t,10),-1!==t.indexOf("%")&&(n=n/100*e.parentNode[i])):n=t,n}const yw=t=>t.ownerDocument.defaultView.getComputedStyle(t,null);const bw=["top","right","bottom","left"];function xw(t,e,i){const n={};i=i?"-"+i:"";for(let o=0;o<4;o++){const s=bw[o];n[s]=parseFloat(t[e+"-"+s+i])||0}return n.width=n.left+n.right,n.height=n.top+n.bottom,n}const _w=(t,e,i)=>(t>0||e>0)&&(!i||!i.shadowRoot);function ww(t,e){if("native"in t)return t;const{canvas:i,currentDevicePixelRatio:n}=e,o=yw(i),s="border-box"===o.boxSizing,r=xw(o,"padding"),a=xw(o,"border","width"),{x:l,y:c,box:h}=function(t,e){const i=t.touches,n=i&&i.length?i[0]:t,{offsetX:o,offsetY:s}=n;let r,a,l=!1;if(_w(o,s,t.target))r=o,a=s;else{const t=e.getBoundingClientRect();r=n.clientX-t.left,a=n.clientY-t.top,l=!0}return{x:r,y:a,box:l}}(t,i),d=r.left+(h&&a.left),u=r.top+(h&&a.top);let{width:p,height:f}=e;return s&&(p-=r.width+a.width,f-=r.height+a.height),{x:Math.round((l-d)/p*i.width/n),y:Math.round((c-u)/f*i.height/n)}}const kw=t=>Math.round(10*t)/10;function Sw(t,e,i,n){const o=yw(t),s=xw(o,"margin"),r=vw(o.maxWidth,t,"clientWidth")||Sx,a=vw(o.maxHeight,t,"clientHeight")||Sx,l=function(t,e,i){let n,o;if(void 0===e||void 0===i){const s=t&&gw(t);if(s){const t=s.getBoundingClientRect(),r=yw(s),a=xw(r,"border","width"),l=xw(r,"padding");e=t.width-l.width-a.width,i=t.height-l.height-a.height,n=vw(r.maxWidth,s,"clientWidth"),o=vw(r.maxHeight,s,"clientHeight")}else e=t.clientWidth,i=t.clientHeight}return{width:e,height:i,maxWidth:n||Sx,maxHeight:o||Sx}}(t,e,i);let{width:c,height:h}=l;if("content-box"===o.boxSizing){const t=xw(o,"border","width"),e=xw(o,"padding");c-=e.width+t.width,h-=e.height+t.height}c=Math.max(0,c-s.width),h=Math.max(0,n?c/n:h-s.height),c=kw(Math.min(c,r,l.maxWidth)),h=kw(Math.min(h,a,l.maxHeight)),c&&!h&&(h=kw(c/2));return(void 0!==e||void 0!==i)&&n&&l.height&&h>l.height&&(h=l.height,c=kw(Math.floor(h*n))),{width:c,height:h}}function Cw(t,e,i){const n=e||1,o=Math.floor(t.height*n),s=Math.floor(t.width*n);t.height=Math.floor(t.height),t.width=Math.floor(t.width);const r=t.canvas;return r.style&&(i||!r.style.height&&!r.style.width)&&(r.style.height=`${t.height}px`,r.style.width=`${t.width}px`),(t.currentDevicePixelRatio!==n||r.height!==o||r.width!==s)&&(t.currentDevicePixelRatio=n,r.height=o,r.width=s,t.ctx.setTransform(n,0,0,n,0,0),!0)}const Ew=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};mw()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch(t){}return t}();function Aw(t,e){const i=function(t,e){return yw(t).getPropertyValue(e)}(t,e),n=i&&i.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}function Mw(t,e,i,n){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function Tw(t,e,i,n){return{x:t.x+i*(e.x-t.x),y:"middle"===n?i<.5?t.y:e.y:"after"===n?i<1?t.y:e.y:i>0?e.y:t.y}}function Pw(t,e,i,n){const o={x:t.cp2x,y:t.cp2y},s={x:e.cp1x,y:e.cp1y},r=Mw(t,o,i),a=Mw(o,s,i),l=Mw(s,e,i),c=Mw(r,a,i),h=Mw(a,l,i);return Mw(c,h,i)}function Ow(t,e,i){return t?function(t,e){return{x:i=>t+t+e-i,setWidth(t){e=t},textAlign:t=>"center"===t?t:"right"===t?"left":"right",xPlus:(t,e)=>t-e,leftForLtr:(t,e)=>t-e}}(e,i):{x:t=>t,setWidth(t){},textAlign:t=>t,xPlus:(t,e)=>t+e,leftForLtr:(t,e)=>t}}function Dw(t,e){let i,n;"ltr"!==e&&"rtl"!==e||(i=t.canvas.style,n=[i.getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",e,"important"),t.prevTextDirection=n)}function Iw(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function Lw(t){return"angle"===t?{between:qx,compare:jx,normalize:Fx}:{between:Hx,compare:(t,e)=>t-e,normalize:t=>t}}function $w({start:t,end:e,count:i,loop:n,style:o}){return{start:t%i,end:e%i,loop:n&&(e-t+1)%i==0,style:o}}function zw(t,e,i){if(!i)return[t];const{property:n,start:o,end:s}=i,r=e.length,{compare:a,between:l,normalize:c}=Lw(n),{start:h,end:d,loop:u,style:p}=function(t,e,i){const{property:n,start:o,end:s}=i,{between:r,normalize:a}=Lw(n),l=e.length;let c,h,{start:d,end:u,loop:p}=t;if(p){for(d+=l,u+=l,c=0,h=l;c<h&&r(a(e[d%l][n]),o,s);++c)d--,u--;d%=l,u%=l}return u<d&&(u+=l),{start:d,end:u,loop:p,style:t.style}}(t,e,i),f=[];let m,g,v,y=!1,b=null;const x=()=>y||l(o,v,m)&&0!==a(o,v),_=()=>!y||0===a(s,m)||l(s,v,m);for(let t=h,i=h;t<=d;++t)g=e[t%r],g.skip||(m=c(g[n]),m!==v&&(y=l(m,o,s),null===b&&x()&&(b=0===a(m,o)?t:i),null!==b&&_()&&(f.push($w({start:b,end:t,loop:u,count:r,style:p})),b=null),i=t,v=m));return null!==b&&f.push($w({start:b,end:d,loop:u,count:r,style:p})),f}function Rw(t,e){const i=[],n=t.segments;for(let o=0;o<n.length;o++){const s=zw(n[o],t.points,e);s.length&&i.push(...s)}return i}function Nw(t,e,i,n){return n&&n.setContext&&i?function(t,e,i,n){const o=t._chart.getContext(),s=Bw(t.options),{_datasetIndex:r,options:{spanGaps:a}}=t,l=i.length,c=[];let h=s,d=e[0].start,u=d;function p(t,e,n,o){const s=a?-1:1;if(t!==e){for(t+=l;i[t%l].skip;)t-=s;for(;i[e%l].skip;)e+=s;t%l!=e%l&&(c.push({start:t%l,end:e%l,loop:n,style:o}),h=o,d=e%l)}}for(const t of e){d=a?d:t.start;let e,s=i[d%l];for(u=d+1;u<=t.end;u++){const a=i[u%l];e=Bw(n.setContext(G_(o,{type:"segment",p0:s,p1:a,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:r}))),jw(e,h)&&p(d,u-1,t.loop,h),s=a,h=e}d<u-1&&p(d,u-1,t.loop,h)}return c}(t,e,i,n):e}function Bw(t){return{backgroundColor:t.backgroundColor,borderCapStyle:t.borderCapStyle,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderJoinStyle:t.borderJoinStyle,borderWidth:t.borderWidth,borderColor:t.borderColor}}function jw(t,e){if(!e)return!1;const i=[],n=function(t,e){return a_(e)?(i.includes(e)||i.push(e),i.indexOf(e)):e};return JSON.stringify(t,n)!==JSON.stringify(e,n)}
|
|
8650
8691
|
/*!
|
|
8651
8692
|
* Chart.js v4.4.8
|
|
8652
8693
|
* https://www.chartjs.org
|
|
8653
8694
|
* (c) 2025 Chart.js Contributors
|
|
8654
8695
|
* Released under the MIT License
|
|
8655
|
-
*/class $w{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,n){const o=e.listeners[n],s=e.duration;o.forEach((n=>n({chart:t,initial:e.initial,numSteps:s,currentStep:Math.min(i-e.start,s)})))}_refresh(){this._request||(this._running=!0,this._request=Ux.call(window,(()=>{this._update(),this._request=null,this._running&&this._refresh()})))}_update(t=Date.now()){let e=0;this._charts.forEach(((i,n)=>{if(!i.running||!i.items.length)return;const o=i.items;let s,r=o.length-1,a=!1;for(;r>=0;--r)s=o[r],s._active?(s._total>i.duration&&(i.duration=s._total),s.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(n.draw(),this._notify(n,i,t,"progress")),o.length||(i.running=!1,this._notify(n,i,t,"complete"),i.initial=!1),e+=o.length})),this._lastDate=t,0===e&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){e&&e.length&&this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce(((t,e)=>Math.max(t,e._duration)),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!!(e&&e.running&&e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let n=i.length-1;for(;n>=0;--n)i[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var zw=new $w;const Rw="transparent",Nw={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){const n=i_(t||Rw),o=n.valid&&i_(e||Rw);return o&&o.valid?o.mix(n,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class Bw{constructor(t,e,i,n){const o=e[i];n=j_([t.to,n,o,t.from]);const s=j_([t.from,o,n]);this._active=!0,this._fn=t.fn||Nw[t.type||typeof s],this._easing=t_[t.easing]||t_.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=s,this._to=n,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const n=this._target[this._prop],o=i-this._start,s=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(s,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=j_([t.to,e,n,t.from]),this._from=j_([t.from,n,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,n=this._prop,o=this._from,s=this._loop,r=this._to;let a;if(this._active=o!==r&&(s||e<i),!this._active)return this._target[n]=r,void this._notify(!0);e<0?this._target[n]=o:(a=e/i%2,a=s&&a>1?2-a:a,a=this._easing(Math.min(1,Math.max(0,a))),this._target[n]=this._fn(o,r,a))}wait(){const t=this._promises||(this._promises=[]);return new Promise(((e,i)=>{t.push({res:e,rej:i})}))}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let t=0;t<i.length;t++)i[t][e]()}}class jw{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!Yb(t))return;const e=Object.keys(m_.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach((n=>{const o=t[n];if(!Yb(o))return;const s={};for(const t of e)s[t]=o[t];(Zb(o.properties)&&o.properties||[n]).forEach((t=>{t!==n&&i.has(t)||i.set(t,s)}))}))}_animateOptions(t,e){const i=e.options,n=function(t,e){if(!e)return;let i=t.options;if(!i)return void(t.options=e);i.$shared&&(t.options=i=Object.assign({},i,{$shared:!1,$animations:{}}));return i}(t,i);if(!n)return[];const o=this._createAnimations(n,i);return i.$shared&&function(t,e){const i=[],n=Object.keys(e);for(let e=0;e<n.length;e++){const o=t[n[e]];o&&o.active()&&i.push(o.wait())}return Promise.all(i)}(t.options.$animations,i).then((()=>{t.options=i}),(()=>{})),o}_createAnimations(t,e){const i=this._properties,n=[],o=t.$animations||(t.$animations={}),s=Object.keys(e),r=Date.now();let a;for(a=s.length-1;a>=0;--a){const l=s[a];if("$"===l.charAt(0))continue;if("options"===l){n.push(...this._animateOptions(t,e));continue}const c=e[l];let h=o[l];const d=i.get(l);if(h){if(d&&h.active()){h.update(d,c,r);continue}h.cancel()}d&&d.duration?(o[l]=h=new Bw(d,t,l,c),n.push(h)):t[l]=c}return n}update(t,e){if(0===this._properties.size)return void Object.assign(t,e);const i=this._createAnimations(t,e);return i.length?(zw.add(this._chart,i),!0):void 0}}function Fw(t,e){const i=t&&t.options||{},n=i.reverse,o=void 0===i.min?e:0,s=void 0===i.max?e:0;return{start:n?s:o,end:n?o:s}}function qw(t,e){const i=[],n=t._getSortedDatasetMetas(e);let o,s;for(o=0,s=n.length;o<s;++o)i.push(n[o].index);return i}function Vw(t,e,i,n={}){const o=t.keys,s="single"===n.mode;let r,a,l,c;if(null===e)return;let h=!1;for(r=0,a=o.length;r<a;++r){if(l=+o[r],l===i){if(h=!0,n.all)continue;break}c=t.values[l],Xb(c)&&(s||0===e||Sx(e)===Sx(c))&&(e+=c)}return h||n.all?e:0}function Hw(t,e){const i=t&&t.options.stacked;return i||void 0===i&&void 0!==e.stack}function Uw(t,e,i){const n=t[e]||(t[e]={});return n[i]||(n[i]={})}function Ww(t,e,i,n){for(const o of e.getMatchingVisibleMetas(n).reverse()){const e=t[o.index];if(i&&e>0||!i&&e<0)return o.index}return null}function Gw(t,e){const{chart:i,_cachedMeta:n}=t,o=i._stacks||(i._stacks={}),{iScale:s,vScale:r,index:a}=n,l=s.axis,c=r.axis,h=function(t,e,i){return`${t.id}.${e.id}.${i.stack||i.type}`}(s,r,n),d=e.length;let u;for(let t=0;t<d;++t){const i=e[t],{[l]:s,[c]:d}=i;u=(i._stacks||(i._stacks={}))[c]=Uw(o,h,s),u[a]=d,u._top=Ww(u,r,!0,n.type),u._bottom=Ww(u,r,!1,n.type);(u._visualValues||(u._visualValues={}))[a]=d}}function Zw(t,e){const i=t.scales;return Object.keys(i).filter((t=>i[t].axis===e)).shift()}function Yw(t,e){const i=t.controller.index,n=t.vScale&&t.vScale.axis;if(n){e=e||t._parsed;for(const t of e){const e=t._stacks;if(!e||void 0===e[n]||void 0===e[n][i])return;delete e[n][i],void 0!==e[n]._visualValues&&void 0!==e[n]._visualValues[i]&&delete e[n]._visualValues[i]}}}const Xw=t=>"reset"===t||"none"===t,Kw=(t,e)=>e?t:Object.assign({},t);class Qw{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Hw(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&Yw(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),n=(t,e,i,n)=>"x"===t?e:"r"===t?n:i,o=e.xAxisID=Qb(i.xAxisID,Zw(t,"x")),s=e.yAxisID=Qb(i.yAxisID,Zw(t,"y")),r=e.rAxisID=Qb(i.rAxisID,Zw(t,"r")),a=e.indexAxis,l=e.iAxisID=n(a,o,s,r),c=e.vAxisID=n(a,s,o,r);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(s),e.rScale=this.getScaleForId(r),e.iScale=this.getScaleForId(l),e.vScale=this.getScaleForId(c)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Vx(this._data,this),t._stacked&&Yw(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(Yb(e)){const t=this._cachedMeta;this._data=function(t,e){const{iScale:i,vScale:n}=e,o="x"===i.axis?"x":"y",s="x"===n.axis?"x":"y",r=Object.keys(t),a=new Array(r.length);let l,c,h;for(l=0,c=r.length;l<c;++l)h=r[l],a[l]={[o]:h,[s]:t[h]};return a}(e,t)}else if(i!==e){if(i){Vx(i,this);const t=this._cachedMeta;Yw(t),t._parsed=[]}e&&Object.isExtensible(e)&&(o=this,(n=e)._chartjs?n._chartjs.listeners.push(o):(Object.defineProperty(n,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[o]}}),qx.forEach((t=>{const e="_onData"+dx(t),i=n[t];Object.defineProperty(n,t,{configurable:!0,enumerable:!1,value(...t){const o=i.apply(this,t);return n._chartjs.listeners.forEach((i=>{"function"==typeof i[e]&&i[e](...t)})),o}})})))),this._syncList=[],this._data=e}var n,o}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let n=!1;this._dataCheck();const o=e._stacked;e._stacked=Hw(e.vScale,e),e.stack!==i.stack&&(n=!0,Yw(e),e.stack=i.stack),this._resyncElements(t),(n||o!==e._stacked)&&(Gw(this,e._parsed),e._stacked=Hw(e.vScale,e))}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:n}=this,{iScale:o,_stacked:s}=i,r=o.axis;let a,l,c,h=0===t&&e===n.length||i._sorted,d=t>0&&i._parsed[t-1];if(!1===this._parsing)i._parsed=n,i._sorted=!0,c=n;else{c=Zb(n[t])?this.parseArrayData(i,n,t,e):Yb(n[t])?this.parseObjectData(i,n,t,e):this.parsePrimitiveData(i,n,t,e);const o=()=>null===l[r]||d&&l[r]<d[r];for(a=0;a<e;++a)i._parsed[a+t]=l=c[a],h&&(o()&&(h=!1),d=l);i._sorted=h}s&&Gw(this,c)}parsePrimitiveData(t,e,i,n){const{iScale:o,vScale:s}=t,r=o.axis,a=s.axis,l=o.getLabels(),c=o===s,h=new Array(n);let d,u,p;for(d=0,u=n;d<u;++d)p=d+i,h[d]={[r]:c||o.parse(l[p],p),[a]:s.parse(e[p],p)};return h}parseArrayData(t,e,i,n){const{xScale:o,yScale:s}=t,r=new Array(n);let a,l,c,h;for(a=0,l=n;a<l;++a)c=a+i,h=e[c],r[a]={x:o.parse(h[0],c),y:s.parse(h[1],c)};return r}parseObjectData(t,e,i,n){const{xScale:o,yScale:s}=t,{xAxisKey:r="x",yAxisKey:a="y"}=this._parsing,l=new Array(n);let c,h,d,u;for(c=0,h=n;c<h;++c)d=c+i,u=e[d],l[c]={x:o.parse(hx(u,r),d),y:s.parse(hx(u,a),d)};return l}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){const n=this.chart,o=this._cachedMeta,s=e[t.axis];return Vw({keys:qw(n,!0),values:e._stacks[t.axis]._visualValues},s,o.index,{mode:i})}updateRangeFromParsed(t,e,i,n){const o=i[e.axis];let s=null===o?NaN:o;const r=n&&i._stacks[e.axis];n&&r&&(n.values=r,s=Vw(n,o,this._cachedMeta.index)),t.min=Math.min(t.min,s),t.max=Math.max(t.max,s)}getMinMax(t,e){const i=this._cachedMeta,n=i._parsed,o=i._sorted&&t===i.iScale,s=n.length,r=this._getOtherScale(t),a=((t,e,i)=>t&&!e.hidden&&e._stacked&&{keys:qw(i,!0),values:null})(e,i,this.chart),l={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:c,max:h}=function(t){const{min:e,max:i,minDefined:n,maxDefined:o}=t.getUserBounds();return{min:n?e:Number.NEGATIVE_INFINITY,max:o?i:Number.POSITIVE_INFINITY}}(r);let d,u;function p(){u=n[d];const e=u[r.axis];return!Xb(u[t.axis])||c>e||h<e}for(d=0;d<s&&(p()||(this.updateRangeFromParsed(l,t,u,a),!o));++d);if(o)for(d=s-1;d>=0;--d)if(!p()){this.updateRangeFromParsed(l,t,u,a);break}return l}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let n,o,s;for(n=0,o=e.length;n<o;++n)s=e[n][t.axis],Xb(s)&&i.push(s);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,i=e.iScale,n=e.vScale,o=this.getParsed(t);return{label:i?""+i.getLabelForValue(o[i.axis]):"",value:n?""+n.getLabelForValue(o[n.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=function(t){let e,i,n,o;return Yb(t)?(e=t.top,i=t.right,n=t.bottom,o=t.left):e=i=n=o=t,{top:e,right:i,bottom:n,left:o,disabled:!1===t}}(Qb(this.options.clip,function(t,e,i){if(!1===i)return!1;const n=Fw(t,i),o=Fw(e,i);return{top:o.end,right:n.end,bottom:o.start,left:n.start}}(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,i=this._cachedMeta,n=i.data||[],o=e.chartArea,s=[],r=this._drawStart||0,a=this._drawCount||n.length-r,l=this.options.drawActiveElementsOnTop;let c;for(i.dataset&&i.dataset.draw(t,o,r,a),c=r;c<r+a;++c){const e=n[c];e.hidden||(e.active&&l?s.push(e):e.draw(t,o))}for(c=0;c<s.length;++c)s[c].draw(t,o)}getStyle(t,e){const i=e?"active":"default";return void 0===t&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){const n=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const e=this._cachedMeta.data[t];o=e.$context||(e.$context=function(t,e,i){return F_(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:i,index:e,mode:"default",type:"data"})}(this.getContext(),t,e)),o.parsed=this.getParsed(t),o.raw=n.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=function(t,e){return F_(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}(this.chart.getContext(),this.index)),o.dataset=n,o.index=o.datasetIndex=this.index;return o.active=!!e,o.mode=i,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",i){const n="active"===e,o=this._cachedDataOpts,s=t+"-"+e,r=o[s],a=this.enableOptionSharing&&ux(i);if(r)return Kw(r,a);const l=this.chart.config,c=l.datasetElementScopeKeys(this._type,t),h=n?[`${t}Hover`,"hover",t,""]:[t,""],d=l.getOptionScopes(this.getDataset(),c),u=Object.keys(m_.elements[t]),p=l.resolveNamedOptions(d,u,(()=>this.getContext(i,n,e)),h);return p.$shared&&(p.$shared=a,o[s]=Object.freeze(Kw(p,a))),p}_resolveAnimations(t,e,i){const n=this.chart,o=this._cachedDataOpts,s=`animation-${e}`,r=o[s];if(r)return r;let a;if(!1!==n.options.animation){const n=this.chart.config,o=n.datasetAnimationScopeKeys(this._type,e),s=n.getOptionScopes(this.getDataset(),o);a=n.createResolver(s,this.getContext(t,i,e))}const l=new jw(n,a&&a.animations);return a&&a._cacheable&&(o[s]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Xw(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),n=this._sharedOptions,o=this.getSharedOptions(i),s=this.includeOptions(e,o)||o!==n;return this.updateSharedOptions(o,e,i),{sharedOptions:o,includeOptions:s}}updateElement(t,e,i,n){Xw(n)?Object.assign(t,i):this._resolveAnimations(e,n).update(t,i)}updateSharedOptions(t,e,i){t&&!Xw(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,n){t.active=n;const o=this.getStyle(e,n);this._resolveAnimations(e,i,n).update(t,{options:!n&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[t,e,i]of this._syncList)this[t](e,i);this._syncList=[];const n=i.length,o=e.length,s=Math.min(o,n);s&&this.parse(0,s),o>n?this._insertElements(n,o-n,t):o<n&&this._removeElements(o,n-o)}_insertElements(t,e,i=!0){const n=this._cachedMeta,o=n.data,s=t+e;let r;const a=t=>{for(t.length+=e,r=t.length-1;r>=s;r--)t[r]=t[r-e]};for(a(o),r=t;r<s;++r)o[r]=new this.dataElementType;this._parsing&&a(n._parsed),this.parse(t,e),i&&this.updateElements(o,t,e,"reset")}updateElements(t,e,i,n){}_removeElements(t,e){const i=this._cachedMeta;if(this._parsing){const n=i._parsed.splice(t,e);i._stacked&&Yw(i,n)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,i,n]=t;this[e](i,n)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function Jw(t){const e=t.iScale,i=function(t,e){if(!t._cache.$bar){const i=t.getMatchingVisibleMetas(e);let n=[];for(let e=0,o=i.length;e<o;e++)n=n.concat(i[e].controller.getAllParsedValues(t));t._cache.$bar=Hx(n.sort(((t,e)=>t-e)))}return t._cache.$bar}(e,t.type);let n,o,s,r,a=e._length;const l=()=>{32767!==s&&-32768!==s&&(ux(r)&&(a=Math.min(a,Math.abs(s-r)||a)),r=s)};for(n=0,o=i.length;n<o;++n)s=e.getPixelForValue(i[n]),l();for(r=void 0,n=0,o=e.ticks.length;n<o;++n)s=e.getPixelForTick(n),l();return a}function tk(t,e,i,n){return Zb(t)?function(t,e,i,n){const o=i.parse(t[0],n),s=i.parse(t[1],n),r=Math.min(o,s),a=Math.max(o,s);let l=r,c=a;Math.abs(r)>Math.abs(a)&&(l=a,c=r),e[i.axis]=c,e._custom={barStart:l,barEnd:c,start:o,end:s,min:r,max:a}}(t,e,i,n):e[i.axis]=i.parse(t,n),e}function ek(t,e,i,n){const o=t.iScale,s=t.vScale,r=o.getLabels(),a=o===s,l=[];let c,h,d,u;for(c=i,h=i+n;c<h;++c)u=e[c],d={},d[o.axis]=a||o.parse(r[c],c),l.push(tk(u,d,s,c));return l}function ik(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}function nk(t,e,i,n){let o=e.borderSkipped;const s={};if(!o)return void(t.borderSkipped=s);if(!0===o)return void(t.borderSkipped={top:!0,right:!0,bottom:!0,left:!0});const{start:r,end:a,reverse:l,top:c,bottom:h}=function(t){let e,i,n,o,s;return t.horizontal?(e=t.base>t.x,i="left",n="right"):(e=t.base<t.y,i="bottom",n="top"),e?(o="end",s="start"):(o="start",s="end"),{start:i,end:n,reverse:e,top:o,bottom:s}}(t);"middle"===o&&i&&(t.enableBorderRadius=!0,(i._top||0)===n?o=c:(i._bottom||0)===n?o=h:(s[ok(h,r,a,l)]=!0,o=c)),s[ok(o,r,a,l)]=!0,t.borderSkipped=s}function ok(t,e,i,n){var o,s,r;return n?(r=i,t=sk(t=(o=t)===(s=e)?r:o===r?s:o,i,e)):t=sk(t,e,i),t}function sk(t,e,i){return"start"===t?e:"end"===t?i:t}function rk(t,{inflateAmount:e},i){t.inflateAmount="auto"===e?1===i?.33:0:e}class ak extends Qw{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:t=>"spacing"!==t,_indexable:t=>"spacing"!==t&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:n}}=t.legend.options;return e.labels.map(((e,o)=>{const s=t.getDatasetMeta(0).controller.getStyle(o);return{text:e,fillStyle:s.backgroundColor,strokeStyle:s.borderColor,fontColor:n,lineWidth:s.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(o),index:o}}))}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}};constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,n=this._cachedMeta;if(!1===this._parsing)n._parsed=i;else{let o,s,r=t=>+i[t];if(Yb(i[t])){const{key:t="value"}=this._parsing;r=e=>+hx(i[e],t)}for(o=t,s=t+e;o<s;++o)n._parsed[o]=r(o)}}_getRotation(){return Tx(this.options.rotation-90)}_getCircumference(){return Tx(this.options.circumference)}_getRotationExtents(){let t=gx,e=-gx;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)&&this.chart.getDatasetMeta(i).type===this._type){const n=this.chart.getDatasetMeta(i).controller,o=n._getRotation(),s=n._getCircumference();t=Math.min(t,o),e=Math.max(e,o+s)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:i}=e,n=this._cachedMeta,o=n.data,s=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,r=Math.max((Math.min(i.width,i.height)-s)/2,0),a=Math.min((l=this.options.cutout,c=r,"string"==typeof l&&l.endsWith("%")?parseFloat(l)/100:+l/c),1);var l,c;const h=this._getRingWeight(this.index),{circumference:d,rotation:u}=this._getRotationExtents(),{ratioX:p,ratioY:f,offsetX:m,offsetY:g}=function(t,e,i){let n=1,o=1,s=0,r=0;if(e<gx){const a=t,l=a+e,c=Math.cos(a),h=Math.sin(a),d=Math.cos(l),u=Math.sin(l),p=(t,e,n)=>zx(t,a,l,!0)?1:Math.max(e,e*i,n,n*i),f=(t,e,n)=>zx(t,a,l,!0)?-1:Math.min(e,e*i,n,n*i),m=p(0,c,d),g=p(xx,h,u),v=f(mx,c,d),y=f(mx+xx,h,u);n=(m-v)/2,o=(g-y)/2,s=-(m+v)/2,r=-(g+y)/2}return{ratioX:n,ratioY:o,offsetX:s,offsetY:r}}(u,d,a),v=(i.width-s)/p,y=(i.height-s)/f,b=Math.max(Math.min(v,y)/2,0),x=Jb(this.options.radius,b),_=(x-Math.max(x*a,0))/this._getVisibleDatasetWeightTotal();this.offsetX=m*x,this.offsetY=g*x,n.total=this.calculateTotal(),this.outerRadius=x-_*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-_*h,0),this.updateElements(o,0,o.length,t)}_circumference(t,e){const i=this.options,n=this._cachedMeta,o=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||null===n._parsed[t]||n.data[t].hidden?0:this.calculateCircumference(n._parsed[t]*o/gx)}updateElements(t,e,i,n){const o="reset"===n,s=this.chart,r=s.chartArea,a=s.options.animation,l=(r.left+r.right)/2,c=(r.top+r.bottom)/2,h=o&&a.animateScale,d=h?0:this.innerRadius,u=h?0:this.outerRadius,{sharedOptions:p,includeOptions:f}=this._getSharedOptions(e,n);let m,g=this._getRotation();for(m=0;m<e;++m)g+=this._circumference(m,o);for(m=e;m<e+i;++m){const e=this._circumference(m,o),i=t[m],s={x:l+this.offsetX,y:c+this.offsetY,startAngle:g,endAngle:g+e,circumference:e,outerRadius:u,innerRadius:d};f&&(s.options=p||this.resolveDataElementOptions(m,i.active?"active":n)),g+=e,this.updateElement(i,m,s,n)}}calculateTotal(){const t=this._cachedMeta,e=t.data;let i,n=0;for(i=0;i<e.length;i++){const o=t._parsed[i];null===o||isNaN(o)||!this.chart.getDataVisibility(i)||e[i].hidden||(n+=Math.abs(o))}return n}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?gx*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=a_(e._parsed[t],i.options.locale);return{label:n[t]||"",value:o}}getMaxBorderWidth(t){let e=0;const i=this.chart;let n,o,s,r,a;if(!t)for(n=0,o=i.data.datasets.length;n<o;++n)if(i.isDatasetVisible(n)){s=i.getDatasetMeta(n),t=s.data,r=s.controller;break}if(!t)return 0;for(n=0,o=t.length;n<o;++n)a=r.resolveDataElementOptions(n),"inner"!==a.borderAlign&&(e=Math.max(e,a.borderWidth||0,a.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let i=0,n=t.length;i<n;++i){const t=this.resolveDataElementOptions(i);e=Math.max(e,t.offset||0,t.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(Qb(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}class lk extends Qw{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:n}}=t.legend.options;return e.labels.map(((e,o)=>{const s=t.getDatasetMeta(0).controller.getStyle(o);return{text:e,fillStyle:s.backgroundColor,strokeStyle:s.borderColor,fontColor:n,lineWidth:s.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(o),index:o}}))}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=a_(e._parsed[t].r,i.options.locale);return{label:n[t]||"",value:o}}parseObjectData(t,e,i,n){return ew.bind(this)(t,e,i,n)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach(((t,i)=>{const n=this.getParsed(i).r;!isNaN(n)&&this.chart.getDataVisibility(i)&&(n<e.min&&(e.min=n),n>e.max&&(e.max=n))})),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,n=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(n/2,0),s=(o-Math.max(i.cutoutPercentage?o/100*i.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=o-s*this.index,this.innerRadius=this.outerRadius-s}updateElements(t,e,i,n){const o="reset"===n,s=this.chart,r=s.options.animation,a=this._cachedMeta.rScale,l=a.xCenter,c=a.yCenter,h=a.getIndexAngle(0)-.5*mx;let d,u=h;const p=360/this.countVisibleElements();for(d=0;d<e;++d)u+=this._computeAngle(d,n,p);for(d=e;d<e+i;d++){const e=t[d];let i=u,f=u+this._computeAngle(d,n,p),m=s.getDataVisibility(d)?a.getDistanceFromCenterForValue(this.getParsed(d).r):0;u=f,o&&(r.animateScale&&(m=0),r.animateRotate&&(i=f=h));const g={x:l,y:c,innerRadius:0,outerRadius:m,startAngle:i,endAngle:f,options:this.resolveDataElementOptions(d,e.active?"active":n)};this.updateElement(e,d,g,n)}}countVisibleElements(){const t=this._cachedMeta;let e=0;return t.data.forEach(((t,i)=>{!isNaN(this.getParsed(i).r)&&this.chart.getDataVisibility(i)&&e++})),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?Tx(this.resolveDataElementOptions(t,e).angle||i):0}}var ck=Object.freeze({__proto__:null,BarController:class extends Qw{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,e,i,n){return ek(t,e,i,n)}parseArrayData(t,e,i,n){return ek(t,e,i,n)}parseObjectData(t,e,i,n){const{iScale:o,vScale:s}=t,{xAxisKey:r="x",yAxisKey:a="y"}=this._parsing,l="x"===o.axis?r:a,c="x"===s.axis?r:a,h=[];let d,u,p,f;for(d=i,u=i+n;d<u;++d)f=e[d],p={},p[o.axis]=o.parse(hx(f,l),d),h.push(tk(hx(f,c),p,s,d));return h}updateRangeFromParsed(t,e,i,n){super.updateRangeFromParsed(t,e,i,n);const o=i._custom;o&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:i,vScale:n}=e,o=this.getParsed(t),s=o._custom,r=ik(s)?"["+s.start+", "+s.end+"]":""+n.getLabelForValue(o[n.axis]);return{label:""+i.getLabelForValue(o[i.axis]),value:r}}initialize(){this.enableOptionSharing=!0,super.initialize();this._cachedMeta.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,n){const o="reset"===n,{index:s,_cachedMeta:{vScale:r}}=this,a=r.getBasePixel(),l=r.isHorizontal(),c=this._getRuler(),{sharedOptions:h,includeOptions:d}=this._getSharedOptions(e,n);for(let u=e;u<e+i;u++){const e=this.getParsed(u),i=o||Gb(e[r.axis])?{base:a,head:a}:this._calculateBarValuePixels(u),p=this._calculateBarIndexPixels(u,c),f=(e._stacks||{})[r.axis],m={horizontal:l,base:i.base,enableBorderRadius:!f||ik(e._custom)||s===f._top||s===f._bottom,x:l?i.head:p.center,y:l?p.center:i.head,height:l?p.size:Math.abs(i.size),width:l?Math.abs(i.size):p.size};d&&(m.options=h||this.resolveDataElementOptions(u,t[u].active?"active":n));const g=m.options||t[u].options;nk(m,g,f,s),rk(m,g,c.ratio),this.updateElement(t[u],u,m,n)}}_getStacks(t,e){const{iScale:i}=this._cachedMeta,n=i.getMatchingVisibleMetas(this._type).filter((t=>t.controller.options.grouped)),o=i.options.stacked,s=[],r=this._cachedMeta.controller.getParsed(e),a=r&&r[i.axis],l=t=>{const e=t._parsed.find((t=>t[i.axis]===a)),n=e&&e[t.vScale.axis];if(Gb(n)||isNaN(n))return!0};for(const i of n)if((void 0===e||!l(i))&&((!1===o||-1===s.indexOf(i.stack)||void 0===o&&void 0===i.stack)&&s.push(i.stack),i.index===t))break;return s.length||s.push(void 0),s}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const n=this._getStacks(t,i),o=void 0!==e?n.indexOf(e):-1;return-1===o?n.length-1:o}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,n=[];let o,s;for(o=0,s=e.data.length;o<s;++o)n.push(i.getPixelForValue(this.getParsed(o)[i.axis],o));const r=t.barThickness;return{min:r||Jw(e),pixels:n,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:r?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:i,index:n},options:{base:o,minBarLength:s}}=this,r=o||0,a=this.getParsed(t),l=a._custom,c=ik(l);let h,d,u=a[e.axis],p=0,f=i?this.applyStack(e,a,i):u;f!==u&&(p=f-u,f=u),c&&(u=l.barStart,f=l.barEnd-l.barStart,0!==u&&Sx(u)!==Sx(l.barEnd)&&(p=0),p+=u);const m=Gb(o)||c?p:o;let g=e.getPixelForValue(m);if(h=this.chart.getDataVisibility(t)?e.getPixelForValue(p+f):g,d=h-g,Math.abs(d)<s){d=function(t,e,i){return 0!==t?Sx(t):(e.isHorizontal()?1:-1)*(e.min>=i?1:-1)}(d,e,r)*s,u===r&&(g-=d/2);const t=e.getPixelForDecimal(0),o=e.getPixelForDecimal(1),l=Math.min(t,o),p=Math.max(t,o);g=Math.max(Math.min(g,p),l),h=g+d,i&&!c&&(a._stacks[e.axis]._visualValues[n]=e.getValueForPixel(h)-e.getValueForPixel(g))}if(g===e.getPixelForValue(r)){const t=Sx(d)*e.getLineWidthForValue(r)/2;g+=t,d-=t}return{size:d,base:g,head:h,center:h+d/2}}_calculateBarIndexPixels(t,e){const i=e.scale,n=this.options,o=n.skipNull,s=Qb(n.maxBarThickness,1/0);let r,a;if(e.grouped){const i=o?this._getStackCount(t):e.stackCount,l="flex"===n.barThickness?function(t,e,i,n){const o=e.pixels,s=o[t];let r=t>0?o[t-1]:null,a=t<o.length-1?o[t+1]:null;const l=i.categoryPercentage;null===r&&(r=s-(null===a?e.end-e.start:a-s)),null===a&&(a=s+s-r);const c=s-(s-Math.min(r,a))/2*l;return{chunk:Math.abs(a-r)/2*l/n,ratio:i.barPercentage,start:c}}(t,e,n,i):function(t,e,i,n){const o=i.barThickness;let s,r;return Gb(o)?(s=e.min*i.categoryPercentage,r=i.barPercentage):(s=o*n,r=1),{chunk:s/n,ratio:r,start:e.pixels[t]-s/2}}(t,e,n,i),c=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0);r=l.start+l.chunk*c+l.chunk/2,a=Math.min(s,l.chunk*l.ratio)}else r=i.getPixelForValue(this.getParsed(t)[i.axis],t),a=Math.min(s,e.min*e.ratio);return{base:r-a/2,head:r+a/2,center:r,size:a}}draw(){const t=this._cachedMeta,e=t.vScale,i=t.data,n=i.length;let o=0;for(;o<n;++o)null===this.getParsed(o)[e.axis]||i[o].hidden||i[o].draw(this._ctx)}},BubbleController:class extends Qw{static id="bubble";static defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};static overrides={scales:{x:{type:"linear"},y:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,i,n){const o=super.parsePrimitiveData(t,e,i,n);for(let t=0;t<o.length;t++)o[t]._custom=this.resolveDataElementOptions(t+i).radius;return o}parseArrayData(t,e,i,n){const o=super.parseArrayData(t,e,i,n);for(let t=0;t<o.length;t++){const n=e[i+t];o[t]._custom=Qb(n[2],this.resolveDataElementOptions(t+i).radius)}return o}parseObjectData(t,e,i,n){const o=super.parseObjectData(t,e,i,n);for(let t=0;t<o.length;t++){const n=e[i+t];o[t]._custom=Qb(n&&n.r&&+n.r,this.resolveDataElementOptions(t+i).radius)}return o}getMaxOverflow(){const t=this._cachedMeta.data;let e=0;for(let i=t.length-1;i>=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:n,yScale:o}=e,s=this.getParsed(t),r=n.getLabelForValue(s.x),a=o.getLabelForValue(s.y),l=s._custom;return{label:i[t]||"",value:"("+r+", "+a+(l?", "+l:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,n){const o="reset"===n,{iScale:s,vScale:r}=this._cachedMeta,{sharedOptions:a,includeOptions:l}=this._getSharedOptions(e,n),c=s.axis,h=r.axis;for(let d=e;d<e+i;d++){const e=t[d],i=!o&&this.getParsed(d),u={},p=u[c]=o?s.getPixelForDecimal(.5):s.getPixelForValue(i[c]),f=u[h]=o?r.getBasePixel():r.getPixelForValue(i[h]);u.skip=isNaN(p)||isNaN(f),l&&(u.options=a||this.resolveDataElementOptions(d,e.active?"active":n),o&&(u.options.radius=0)),this.updateElement(e,d,u,n)}}resolveDataElementOptions(t,e){const i=this.getParsed(t);let n=super.resolveDataElementOptions(t,e);n.$shared&&(n=Object.assign({},n,{$shared:!1}));const o=n.radius;return"active"!==e&&(n.radius=0),n.radius+=Qb(i&&i._custom,o),n}},DoughnutController:ak,LineController:class extends Qw{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:n=[],_dataset:o}=e,s=this.chart._animationsDisabled;let{start:r,count:a}=Yx(e,n,s);this._drawStart=r,this._drawCount=a,Xx(e)&&(r=0,a=n.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=n;const l=this.resolveDatasetElementOptions(t);this.options.showLine||(l.borderWidth=0),l.segment=this.options.segment,this.updateElement(i,void 0,{animated:!s,options:l},t),this.updateElements(n,r,a,t)}updateElements(t,e,i,n){const o="reset"===n,{iScale:s,vScale:r,_stacked:a,_dataset:l}=this._cachedMeta,{sharedOptions:c,includeOptions:h}=this._getSharedOptions(e,n),d=s.axis,u=r.axis,{spanGaps:p,segment:f}=this.options,m=Ax(p)?p:Number.POSITIVE_INFINITY,g=this.chart._animationsDisabled||o||"none"===n,v=e+i,y=t.length;let b=e>0&&this.getParsed(e-1);for(let i=0;i<y;++i){const p=t[i],y=g?p:{};if(i<e||i>=v){y.skip=!0;continue}const x=this.getParsed(i),_=Gb(x[u]),w=y[d]=s.getPixelForValue(x[d],i),k=y[u]=o||_?r.getBasePixel():r.getPixelForValue(a?this.applyStack(r,x,a):x[u],i);y.skip=isNaN(w)||isNaN(k)||_,y.stop=i>0&&Math.abs(x[d]-b[d])>m,f&&(y.parsed=x,y.raw=l.data[i]),h&&(y.options=c||this.resolveDataElementOptions(i,p.active?"active":n)),g||this.updateElement(p,i,y,n),b=x}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,n=t.data||[];if(!n.length)return i;const o=n[0].size(this.resolveDataElementOptions(0)),s=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(i,o,s)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},PieController:class extends ak{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}},PolarAreaController:lk,RadarController:class extends Qw{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,n){return ew.bind(this)(t,e,i,n)}update(t){const e=this._cachedMeta,i=e.dataset,n=e.data||[],o=e.iScale.getLabels();if(i.points=n,"resize"!==t){const e=this.resolveDatasetElementOptions(t);this.options.showLine||(e.borderWidth=0);const s={_loop:!0,_fullLoop:o.length===n.length,options:e};this.updateElement(i,void 0,s,t)}this.updateElements(n,0,n.length,t)}updateElements(t,e,i,n){const o=this._cachedMeta.rScale,s="reset"===n;for(let r=e;r<e+i;r++){const e=t[r],i=this.resolveDataElementOptions(r,e.active?"active":n),a=o.getPointPositionForValue(r,this.getParsed(r).r),l=s?o.xCenter:a.x,c=s?o.yCenter:a.y,h={x:l,y:c,angle:a.angle,skip:isNaN(l)||isNaN(c),options:i};this.updateElement(e,r,h,n)}}},ScatterController:class extends Qw{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:n,yScale:o}=e,s=this.getParsed(t),r=n.getLabelForValue(s.x),a=o.getLabelForValue(s.y);return{label:i[t]||"",value:"("+r+", "+a+")"}}update(t){const e=this._cachedMeta,{data:i=[]}=e,n=this.chart._animationsDisabled;let{start:o,count:s}=Yx(e,i,n);if(this._drawStart=o,this._drawCount=s,Xx(e)&&(o=0,s=i.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:o,_dataset:s}=e;o._chart=this.chart,o._datasetIndex=this.index,o._decimated=!!s._decimated,o.points=i;const r=this.resolveDatasetElementOptions(t);r.segment=this.options.segment,this.updateElement(o,void 0,{animated:!n,options:r},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(i,o,s,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,i,n){const o="reset"===n,{iScale:s,vScale:r,_stacked:a,_dataset:l}=this._cachedMeta,c=this.resolveDataElementOptions(e,n),h=this.getSharedOptions(c),d=this.includeOptions(n,h),u=s.axis,p=r.axis,{spanGaps:f,segment:m}=this.options,g=Ax(f)?f:Number.POSITIVE_INFINITY,v=this.chart._animationsDisabled||o||"none"===n;let y=e>0&&this.getParsed(e-1);for(let c=e;c<e+i;++c){const e=t[c],i=this.getParsed(c),f=v?e:{},b=Gb(i[p]),x=f[u]=s.getPixelForValue(i[u],c),_=f[p]=o||b?r.getBasePixel():r.getPixelForValue(a?this.applyStack(r,i,a):i[p],c);f.skip=isNaN(x)||isNaN(_)||b,f.stop=c>0&&Math.abs(i[u]-y[u])>g,m&&(f.parsed=i,f.raw=l.data[c]),d&&(f.options=h||this.resolveDataElementOptions(c,e.active?"active":n)),v||this.updateElement(e,c,f,n),y=i}this.updateSharedOptions(h,n,c)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let t=0;for(let i=e.length-1;i>=0;--i)t=Math.max(t,e[i].size(this.resolveDataElementOptions(i))/2);return t>0&&t}const i=t.dataset,n=i.options&&i.options.borderWidth||0;if(!e.length)return n;const o=e[0].size(this.resolveDataElementOptions(0)),s=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(n,o,s)/2}}});function hk(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class dk{static override(t){Object.assign(dk.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return hk()}parse(){return hk()}format(){return hk()}add(){return hk()}diff(){return hk()}startOf(){return hk()}endOf(){return hk()}}var uk={_date:dk};function pk(t,e,i,n){const{controller:o,data:s,_sorted:r}=t,a=o._cachedMeta.iScale,l=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null;if(a&&e===a.axis&&"r"!==e&&r&&s.length){const r=a._reversePixels?Fx:jx;if(!n){const n=r(s,e,i);if(l){const{vScale:e}=o._cachedMeta,{_parsed:i}=t,s=i.slice(0,n.lo+1).reverse().findIndex((t=>!Gb(t[e.axis])));n.lo-=Math.max(0,s);const r=i.slice(n.hi).findIndex((t=>!Gb(t[e.axis])));n.hi+=Math.max(0,r)}return n}if(o._sharedOptions){const t=s[0],n="function"==typeof t.getRange&&t.getRange(e);if(n){const t=r(s,e,i-n),o=r(s,e,i+n);return{lo:t.lo,hi:o.hi}}}}return{lo:0,hi:s.length-1}}function fk(t,e,i,n,o){const s=t.getSortedVisibleDatasetMetas(),r=i[e];for(let t=0,i=s.length;t<i;++t){const{index:i,data:a}=s[t],{lo:l,hi:c}=pk(s[t],e,r,o);for(let t=l;t<=c;++t){const e=a[t];e.skip||n(e,i,t)}}}function mk(t,e,i,n,o){const s=[];if(!o&&!t.isPointInArea(e))return s;return fk(t,i,e,(function(i,r,a){(o||w_(i,t.chartArea,0))&&i.inRange(e.x,e.y,n)&&s.push({element:i,datasetIndex:r,index:a})}),!0),s}function gk(t,e,i,n,o,s){let r=[];const a=function(t){const e=-1!==t.indexOf("x"),i=-1!==t.indexOf("y");return function(t,n){const o=e?Math.abs(t.x-n.x):0,s=i?Math.abs(t.y-n.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(s,2))}}(i);let l=Number.POSITIVE_INFINITY;return fk(t,i,e,(function(i,c,h){const d=i.inRange(e.x,e.y,o);if(n&&!d)return;const u=i.getCenterPoint(o);if(!(!!s||t.isPointInArea(u))&&!d)return;const p=a(e,u);p<l?(r=[{element:i,datasetIndex:c,index:h}],l=p):p===l&&r.push({element:i,datasetIndex:c,index:h})})),r}function vk(t,e,i,n,o,s){return s||t.isPointInArea(e)?"r"!==i||n?gk(t,e,i,n,o,s):function(t,e,i,n){let o=[];return fk(t,i,e,(function(t,i,s){const{startAngle:r,endAngle:a}=t.getProps(["startAngle","endAngle"],n),{angle:l}=Dx(t,{x:e.x,y:e.y});zx(l,r,a)&&o.push({element:t,datasetIndex:i,index:s})})),o}(t,e,i,o):[]}function yk(t,e,i,n,o){const s=[],r="x"===i?"inXRange":"inYRange";let a=!1;return fk(t,i,e,((t,n,l)=>{t[r]&&t[r](e[i],o)&&(s.push({element:t,datasetIndex:n,index:l}),a=a||t.inRange(e.x,e.y,o))})),n&&!a?[]:s}var bk={evaluateInteractionItems:fk,modes:{index(t,e,i,n){const o=gw(e,t),s=i.axis||"x",r=i.includeInvisible||!1,a=i.intersect?mk(t,o,s,n,r):vk(t,o,s,!1,n,r),l=[];return a.length?(t.getSortedVisibleDatasetMetas().forEach((t=>{const e=a[0].index,i=t.data[e];i&&!i.skip&&l.push({element:i,datasetIndex:t.index,index:e})})),l):[]},dataset(t,e,i,n){const o=gw(e,t),s=i.axis||"xy",r=i.includeInvisible||!1;let a=i.intersect?mk(t,o,s,n,r):vk(t,o,s,!1,n,r);if(a.length>0){const e=a[0].datasetIndex,i=t.getDatasetMeta(e).data;a=[];for(let t=0;t<i.length;++t)a.push({element:i[t],datasetIndex:e,index:t})}return a},point:(t,e,i,n)=>mk(t,gw(e,t),i.axis||"xy",n,i.includeInvisible||!1),nearest(t,e,i,n){const o=gw(e,t),s=i.axis||"xy",r=i.includeInvisible||!1;return vk(t,o,s,i.intersect,n,r)},x:(t,e,i,n)=>yk(t,gw(e,t),"x",i.intersect,n),y:(t,e,i,n)=>yk(t,gw(e,t),"y",i.intersect,n)}};const xk=["left","top","right","bottom"];function _k(t,e){return t.filter((t=>t.pos===e))}function wk(t,e){return t.filter((t=>-1===xk.indexOf(t.pos)&&t.box.axis===e))}function kk(t,e){return t.sort(((t,i)=>{const n=e?i:t,o=e?t:i;return n.weight===o.weight?n.index-o.index:n.weight-o.weight}))}function Sk(t,e){const i=function(t){const e={};for(const i of t){const{stack:t,pos:n,stackWeight:o}=i;if(!t||!xk.includes(n))continue;const s=e[t]||(e[t]={count:0,placed:0,weight:0,size:0});s.count++,s.weight+=o}return e}(t),{vBoxMaxWidth:n,hBoxMaxHeight:o}=e;let s,r,a;for(s=0,r=t.length;s<r;++s){a=t[s];const{fullSize:r}=a.box,l=i[a.stack],c=l&&a.stackWeight/l.weight;a.horizontal?(a.width=c?c*n:r&&e.availableWidth,a.height=o):(a.width=n,a.height=c?c*o:r&&e.availableHeight)}return i}function Ck(t,e,i,n){return Math.max(t[i],e[i])+Math.max(t[n],e[n])}function Ek(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function Ak(t,e,i,n){const{pos:o,box:s}=i,r=t.maxPadding;if(!Yb(o)){i.size&&(t[o]-=i.size);const e=n[i.stack]||{size:0,count:1};e.size=Math.max(e.size,i.horizontal?s.height:s.width),i.size=e.size/e.count,t[o]+=i.size}s.getPadding&&Ek(r,s.getPadding());const a=Math.max(0,e.outerWidth-Ck(r,t,"left","right")),l=Math.max(0,e.outerHeight-Ck(r,t,"top","bottom")),c=a!==t.w,h=l!==t.h;return t.w=a,t.h=l,i.horizontal?{same:c,other:h}:{same:h,other:c}}function Mk(t,e){const i=e.maxPadding;function n(t){const n={left:0,top:0,right:0,bottom:0};return t.forEach((t=>{n[t]=Math.max(e[t],i[t])})),n}return n(t?["left","right"]:["top","bottom"])}function Tk(t,e,i,n){const o=[];let s,r,a,l,c,h;for(s=0,r=t.length,c=0;s<r;++s){a=t[s],l=a.box,l.update(a.width||e.w,a.height||e.h,Mk(a.horizontal,e));const{same:r,other:d}=Ak(e,i,a,n);c|=r&&o.length,h=h||d,l.fullSize||o.push(a)}return c&&Tk(o,e,i,n)||h}function Pk(t,e,i,n,o){t.top=i,t.left=e,t.right=e+n,t.bottom=i+o,t.width=n,t.height=o}function Ok(t,e,i,n){const o=i.padding;let{x:s,y:r}=e;for(const a of t){const t=a.box,l=n[a.stack]||{count:1,placed:0,weight:1},c=a.stackWeight/l.weight||1;if(a.horizontal){const n=e.w*c,s=l.size||t.height;ux(l.start)&&(r=l.start),t.fullSize?Pk(t,o.left,r,i.outerWidth-o.right-o.left,s):Pk(t,e.left+l.placed,r,n,s),l.start=r,l.placed+=n,r=t.bottom}else{const n=e.h*c,r=l.size||t.width;ux(l.start)&&(s=l.start),t.fullSize?Pk(t,s,o.top,r,i.outerHeight-o.bottom-o.top):Pk(t,s,e.top+l.placed,r,n),l.start=s,l.placed+=n,s=t.right}}e.x=s,e.y=r}var Dk={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(t){e.draw(t)}}]},t.boxes.push(e)},removeBox(t,e){const i=t.boxes?t.boxes.indexOf(e):-1;-1!==i&&t.boxes.splice(i,1)},configure(t,e,i){e.fullSize=i.fullSize,e.position=i.position,e.weight=i.weight},update(t,e,i,n){if(!t)return;const o=N_(t.options.layout.padding),s=Math.max(e-o.width,0),r=Math.max(i-o.height,0),a=function(t){const e=function(t){const e=[];let i,n,o,s,r,a;for(i=0,n=(t||[]).length;i<n;++i)o=t[i],({position:s,options:{stack:r,stackWeight:a=1}}=o),e.push({index:i,box:o,pos:s,horizontal:o.isHorizontal(),weight:o.weight,stack:r&&s+r,stackWeight:a});return e}(t),i=kk(e.filter((t=>t.box.fullSize)),!0),n=kk(_k(e,"left"),!0),o=kk(_k(e,"right")),s=kk(_k(e,"top"),!0),r=kk(_k(e,"bottom")),a=wk(e,"x"),l=wk(e,"y");return{fullSize:i,leftAndTop:n.concat(s),rightAndBottom:o.concat(l).concat(r).concat(a),chartArea:_k(e,"chartArea"),vertical:n.concat(o).concat(l),horizontal:s.concat(r).concat(a)}}(t.boxes),l=a.vertical,c=a.horizontal;ex(t.boxes,(t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()}));const h=l.reduce(((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1),0)||1,d=Object.freeze({outerWidth:e,outerHeight:i,padding:o,availableWidth:s,availableHeight:r,vBoxMaxWidth:s/2/h,hBoxMaxHeight:r/2}),u=Object.assign({},o);Ek(u,N_(n));const p=Object.assign({maxPadding:u,w:s,h:r,x:o.left,y:o.top},o),f=Sk(l.concat(c),d);Tk(a.fullSize,p,d,f),Tk(l,p,d,f),Tk(c,p,d,f)&&Tk(l,p,d,f),function(t){const e=t.maxPadding;function i(i){const n=Math.max(e[i]-t[i],0);return t[i]+=n,n}t.y+=i("top"),t.x+=i("left"),i("right"),i("bottom")}(p),Ok(a.leftAndTop,p,d,f),p.x+=p.w,p.y+=p.h,Ok(a.rightAndBottom,p,d,f),t.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},ex(a.chartArea,(e=>{const i=e.box;Object.assign(i,t.chartArea),i.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})}))}};class Ik{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,n){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,n?Math.floor(e/n):i)}}isAttached(t){return!0}updateConfig(t){}}class Lk extends Ik{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const $k="$chartjs",zk={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Rk=t=>null===t||""===t;const Nk=!!xw&&{passive:!0};function Bk(t,e,i){t&&t.canvas&&t.canvas.removeEventListener(e,i,Nk)}function jk(t,e){for(const i of t)if(i===e||i.contains(e))return!0}function Fk(t,e,i){const n=t.canvas,o=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||jk(i.addedNodes,n),e=e&&!jk(i.removedNodes,n);e&&i()}));return o.observe(document,{childList:!0,subtree:!0}),o}function qk(t,e,i){const n=t.canvas,o=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||jk(i.removedNodes,n),e=e&&!jk(i.addedNodes,n);e&&i()}));return o.observe(document,{childList:!0,subtree:!0}),o}const Vk=new Map;let Hk=0;function Uk(){const t=window.devicePixelRatio;t!==Hk&&(Hk=t,Vk.forEach(((e,i)=>{i.currentDevicePixelRatio!==t&&e()})))}function Wk(t,e,i){const n=t.canvas,o=n&&hw(n);if(!o)return;const s=Wx(((t,e)=>{const n=o.clientWidth;i(t,e),n<o.clientWidth&&i()}),window),r=new ResizeObserver((t=>{const e=t[0],i=e.contentRect.width,n=e.contentRect.height;0===i&&0===n||s(i,n)}));return r.observe(o),function(t,e){Vk.size||window.addEventListener("resize",Uk),Vk.set(t,e)}(t,s),r}function Gk(t,e,i){i&&i.disconnect(),"resize"===e&&function(t){Vk.delete(t),Vk.size||window.removeEventListener("resize",Uk)}(t)}function Zk(t,e,i){const n=t.canvas,o=Wx((e=>{null!==t.ctx&&i(function(t,e){const i=zk[t.type]||t.type,{x:n,y:o}=gw(t,e);return{type:i,chart:e,native:t,x:void 0!==n?n:null,y:void 0!==o?o:null}}(e,t))}),t);return function(t,e,i){t&&t.addEventListener(e,i,Nk)}(n,e,o),o}class Yk extends Ik{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(function(t,e){const i=t.style,n=t.getAttribute("height"),o=t.getAttribute("width");if(t[$k]={initial:{height:n,width:o,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",Rk(o)){const e=_w(t,"width");void 0!==e&&(t.width=e)}if(Rk(n))if(""===t.style.height)t.height=t.width/(e||2);else{const e=_w(t,"height");void 0!==e&&(t.height=e)}}(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[$k])return!1;const i=e[$k].initial;["height","width"].forEach((t=>{const n=i[t];Gb(n)?e.removeAttribute(t):e.setAttribute(t,n)}));const n=i.style||{};return Object.keys(n).forEach((t=>{e.style[t]=n[t]})),e.width=e.width,delete e[$k],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const n=t.$proxies||(t.$proxies={}),o={attach:Fk,detach:qk,resize:Wk}[e]||Zk;n[e]=o(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),n=i[e];if(!n)return;({attach:Gk,detach:Gk,resize:Gk}[e]||Bk)(t,e,n),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,n){return yw(t,e,i,n)}isAttached(t){const e=t&&hw(t);return!(!e||!e.isConnected)}}let Xk=class{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return Ax(this.x)&&Ax(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const n={};return t.forEach((t=>{n[t]=i[t]&&i[t].active()?i[t]._to:this[t]})),n}};function Kk(t,e){const i=t.options.ticks,n=function(t){const e=t.options.offset,i=t._tickSize(),n=t._length/i+(e?0:1),o=t._maxLength/i;return Math.floor(Math.min(n,o))}(t),o=Math.min(i.maxTicksLimit||n,n),s=i.major.enabled?function(t){const e=[];let i,n;for(i=0,n=t.length;i<n;i++)t[i].major&&e.push(i);return e}(e):[],r=s.length,a=s[0],l=s[r-1],c=[];if(r>o)return function(t,e,i,n){let o,s=0,r=i[0];for(n=Math.ceil(n),o=0;o<t.length;o++)o===r&&(e.push(t[o]),s++,r=i[s*n])}(e,c,s,r/o),c;const h=function(t,e,i){const n=function(t){const e=t.length;let i,n;if(e<2)return!1;for(n=t[0],i=1;i<e;++i)if(t[i]-t[i-1]!==n)return!1;return n}(t),o=e.length/i;if(!n)return Math.max(o,1);const s=function(t){const e=[],i=Math.sqrt(t);let n;for(n=1;n<i;n++)t%n==0&&(e.push(n),e.push(t/n));return i===(0|i)&&e.push(i),e.sort(((t,e)=>t-e)).pop(),e}(n);for(let t=0,e=s.length-1;t<e;t++){const e=s[t];if(e>o)return e}return Math.max(o,1)}(s,e,o);if(r>0){let t,i;const n=r>1?Math.round((l-a)/(r-1)):null;for(Qk(e,c,h,Gb(n)?0:a-n,a),t=0,i=r-1;t<i;t++)Qk(e,c,h,s[t],s[t+1]);return Qk(e,c,h,l,Gb(n)?e.length:l+n),c}return Qk(e,c,h),c}function Qk(t,e,i,n,o){const s=Qb(n,0),r=Math.min(Qb(o,t.length),t.length);let a,l,c,h=0;for(i=Math.ceil(i),o&&(a=o-n,i=a/Math.floor(a/i)),c=s;c<0;)h++,c=Math.round(s+h*i);for(l=Math.max(s,0);l<r;l++)l===c&&(e.push(t[l]),h++,c=Math.round(s+h*i))}const Jk=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i,tS=(t,e)=>Math.min(e||t,t);function eS(t,e){const i=[],n=t.length/e,o=t.length;let s=0;for(;s<o;s+=n)i.push(t[Math.floor(s)]);return i}function iS(t,e,i){const n=t.ticks.length,o=Math.min(e,n-1),s=t._startPixel,r=t._endPixel,a=1e-6;let l,c=t.getPixelForTick(o);if(!(i&&(l=1===n?Math.max(c-s,r-c):0===e?(t.getPixelForTick(1)-c)/2:(c-t.getPixelForTick(o-1))/2,c+=o<e?l:-l,c<s-a||c>r+a)))return c}function nS(t){return t.drawTicks?t.tickLength:0}function oS(t,e){if(!t.display)return 0;const i=B_(t.font,e),n=N_(t.padding);return(Zb(t.text)?t.text.length:1)*i.lineHeight+n.height}function sS(t,e,i){let n=Gx(t);return(i&&"right"!==e||!i&&"right"===e)&&(n=(t=>"left"===t?"right":"right"===t?"left":t)(n)),n}class rS extends Xk{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:n}=this;return t=Kb(t,Number.POSITIVE_INFINITY),e=Kb(e,Number.NEGATIVE_INFINITY),i=Kb(i,Number.POSITIVE_INFINITY),n=Kb(n,Number.NEGATIVE_INFINITY),{min:Kb(t,i),max:Kb(e,n),minDefined:Xb(t),maxDefined:Xb(e)}}getMinMax(t){let e,{min:i,max:n,minDefined:o,maxDefined:s}=this.getUserBounds();if(o&&s)return{min:i,max:n};const r=this.getMatchingVisibleMetas();for(let a=0,l=r.length;a<l;++a)e=r[a].controller.getMinMax(this,t),o||(i=Math.min(i,e.min)),s||(n=Math.max(n,e.max));return i=s&&i>n?n:i,n=o&&i>n?i:n,{min:Kb(i,Kb(n,i)),max:Kb(n,Kb(i,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){tx(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:n,grace:o,ticks:s}=this.options,r=s.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=function(t,e,i){const{min:n,max:o}=t,s=Jb(e,(o-n)/2),r=(t,e)=>i&&0===t?0:t+e;return{min:r(n,-Math.abs(s)),max:r(o,s)}}(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const a=r<this.ticks.length;this._convertTicksToLabels(a?eS(this.ticks,r):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),s.display&&(s.autoSkip||"auto"===s.source)&&(this.ticks=Kk(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),a&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t,e,i=this.options.reverse;this.isHorizontal()?(t=this.left,e=this.right):(t=this.top,e=this.bottom,i=!i),this._startPixel=t,this._endPixel=e,this._reversePixels=i,this._length=e-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){tx(this.options.afterUpdate,[this])}beforeSetDimensions(){tx(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){tx(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),tx(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){tx(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let i,n,o;for(i=0,n=t.length;i<n;i++)o=t[i],o.label=tx(e.callback,[o.value,i,t],this)}afterTickToLabelConversion(){tx(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){tx(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,i=tS(this.ticks.length,t.ticks.maxTicksLimit),n=e.minRotation||0,o=e.maxRotation;let s,r,a,l=n;if(!this._isVisible()||!e.display||n>=o||i<=1||!this.isHorizontal())return void(this.labelRotation=n);const c=this._getLabelSizes(),h=c.widest.width,d=c.highest.height,u=Rx(this.chart.width-h,0,this.maxWidth);s=t.offset?this.maxWidth/i:u/(i-1),h+6>s&&(s=u/(i-(t.offset?.5:1)),r=this.maxHeight-nS(t.grid)-e.padding-oS(t.title,this.chart.options.font),a=Math.sqrt(h*h+d*d),l=Px(Math.min(Math.asin(Rx((c.highest.height+6)/s,-1,1)),Math.asin(Rx(r/a,-1,1))-Math.asin(Rx(d/a,-1,1)))),l=Math.max(n,Math.min(o,l))),this.labelRotation=l}afterCalculateLabelRotation(){tx(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){tx(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:n,grid:o}}=this,s=this._isVisible(),r=this.isHorizontal();if(s){const s=oS(n,e.options.font);if(r?(t.width=this.maxWidth,t.height=nS(o)+s):(t.height=this.maxHeight,t.width=nS(o)+s),i.display&&this.ticks.length){const{first:e,last:n,widest:o,highest:s}=this._getLabelSizes(),a=2*i.padding,l=Tx(this.labelRotation),c=Math.cos(l),h=Math.sin(l);if(r){const e=i.mirror?0:h*o.width+c*s.height;t.height=Math.min(this.maxHeight,t.height+e+a)}else{const e=i.mirror?0:c*o.width+h*s.height;t.width=Math.min(this.maxWidth,t.width+e+a)}this._calculatePadding(e,n,h,c)}}this._handleMargins(),r?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,n){const{ticks:{align:o,padding:s},position:r}=this.options,a=0!==this.labelRotation,l="top"!==r&&"x"===this.axis;if(this.isHorizontal()){const r=this.getPixelForTick(0)-this.left,c=this.right-this.getPixelForTick(this.ticks.length-1);let h=0,d=0;a?l?(h=n*t.width,d=i*e.height):(h=i*t.height,d=n*e.width):"start"===o?d=e.width:"end"===o?h=t.width:"inner"!==o&&(h=t.width/2,d=e.width/2),this.paddingLeft=Math.max((h-r+s)*this.width/(this.width-r),0),this.paddingRight=Math.max((d-c+s)*this.width/(this.width-c),0)}else{let i=e.height/2,n=t.height/2;"start"===o?(i=0,n=t.height):"end"===o&&(i=e.height,n=0),this.paddingTop=i+s,this.paddingBottom=n+s}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){tx(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let e,i;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),e=0,i=t.length;e<i;e++)Gb(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let i=this.ticks;e<i.length&&(i=eS(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,i){const{ctx:n,_longestTextCache:o}=this,s=[],r=[],a=Math.floor(e/tS(e,i));let l,c,h,d,u,p,f,m,g,v,y,b=0,x=0;for(l=0;l<e;l+=a){if(d=t[l].label,u=this._resolveTickFontOptions(l),n.font=p=u.string,f=o[p]=o[p]||{data:{},gc:[]},m=u.lineHeight,g=v=0,Gb(d)||Zb(d)){if(Zb(d))for(c=0,h=d.length;c<h;++c)y=d[c],Gb(y)||Zb(y)||(g=g_(n,f.data,f.gc,g,y),v+=m)}else g=g_(n,f.data,f.gc,g,d),v=m;s.push(g),r.push(v),b=Math.max(g,b),x=Math.max(v,x)}!function(t,e){ex(t,(t=>{const i=t.gc,n=i.length/2;let o;if(n>e){for(o=0;o<n;++o)delete t.data[i[o]];i.splice(0,n)}}))}(o,e);const _=s.indexOf(b),w=r.indexOf(x),k=t=>({width:s[t]||0,height:r[t]||0});return{first:k(0),last:k(e-1),widest:k(_),highest:k(w),widths:s,heights:r}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return Rx(this._alignToPixels?y_(this.chart,e,0):e,-32768,32767)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&t<e.length){const i=e[t];return i.$context||(i.$context=function(t,e,i){return F_(t,{tick:i,index:e,type:"tick"})}(this.getContext(),t,i))}return this.$context||(this.$context=F_(this.chart.getContext(),{scale:this,type:"scale"}))}_tickSize(){const t=this.options.ticks,e=Tx(this.labelRotation),i=Math.abs(Math.cos(e)),n=Math.abs(Math.sin(e)),o=this._getLabelSizes(),s=t.autoSkipPadding||0,r=o?o.widest.width+s:0,a=o?o.highest.height+s:0;return this.isHorizontal()?a*i>r*n?r/i:a/n:a*n<r*i?a/i:r/n}_isVisible(){const t=this.options.display;return"auto"!==t?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,i=this.chart,n=this.options,{grid:o,position:s,border:r}=n,a=o.offset,l=this.isHorizontal(),c=this.ticks.length+(a?1:0),h=nS(o),d=[],u=r.setContext(this.getContext()),p=u.display?u.width:0,f=p/2,m=function(t){return y_(i,t,p)};let g,v,y,b,x,_,w,k,S,C,E,A;if("top"===s)g=m(this.bottom),_=this.bottom-h,k=g-f,C=m(t.top)+f,A=t.bottom;else if("bottom"===s)g=m(this.top),C=t.top,A=m(t.bottom)-f,_=g+f,k=this.top+h;else if("left"===s)g=m(this.right),x=this.right-h,w=g-f,S=m(t.left)+f,E=t.right;else if("right"===s)g=m(this.left),S=t.left,E=m(t.right)-f,x=g+f,w=this.left+h;else if("x"===e){if("center"===s)g=m((t.top+t.bottom)/2+.5);else if(Yb(s)){const t=Object.keys(s)[0],e=s[t];g=m(this.chart.scales[t].getPixelForValue(e))}C=t.top,A=t.bottom,_=g+f,k=_+h}else if("y"===e){if("center"===s)g=m((t.left+t.right)/2);else if(Yb(s)){const t=Object.keys(s)[0],e=s[t];g=m(this.chart.scales[t].getPixelForValue(e))}x=g-f,w=x-h,S=t.left,E=t.right}const M=Qb(n.ticks.maxTicksLimit,c),T=Math.max(1,Math.ceil(c/M));for(v=0;v<c;v+=T){const t=this.getContext(v),e=o.setContext(t),n=r.setContext(t),s=e.lineWidth,c=e.color,h=n.dash||[],u=n.dashOffset,p=e.tickWidth,f=e.tickColor,m=e.tickBorderDash||[],g=e.tickBorderDashOffset;y=iS(this,v,a),void 0!==y&&(b=y_(i,y,s),l?x=w=S=E=b:_=k=C=A=b,d.push({tx1:x,ty1:_,tx2:w,ty2:k,x1:S,y1:C,x2:E,y2:A,width:s,color:c,borderDash:h,borderDashOffset:u,tickWidth:p,tickColor:f,tickBorderDash:m,tickBorderDashOffset:g}))}return this._ticksLength=c,this._borderValue=g,d}_computeLabelItems(t){const e=this.axis,i=this.options,{position:n,ticks:o}=i,s=this.isHorizontal(),r=this.ticks,{align:a,crossAlign:l,padding:c,mirror:h}=o,d=nS(i.grid),u=d+c,p=h?-c:u,f=-Tx(this.labelRotation),m=[];let g,v,y,b,x,_,w,k,S,C,E,A,M="middle";if("top"===n)_=this.bottom-p,w=this._getXAxisLabelAlignment();else if("bottom"===n)_=this.top+p,w=this._getXAxisLabelAlignment();else if("left"===n){const t=this._getYAxisLabelAlignment(d);w=t.textAlign,x=t.x}else if("right"===n){const t=this._getYAxisLabelAlignment(d);w=t.textAlign,x=t.x}else if("x"===e){if("center"===n)_=(t.top+t.bottom)/2+u;else if(Yb(n)){const t=Object.keys(n)[0],e=n[t];_=this.chart.scales[t].getPixelForValue(e)+u}w=this._getXAxisLabelAlignment()}else if("y"===e){if("center"===n)x=(t.left+t.right)/2-u;else if(Yb(n)){const t=Object.keys(n)[0],e=n[t];x=this.chart.scales[t].getPixelForValue(e)}w=this._getYAxisLabelAlignment(d).textAlign}"y"===e&&("start"===a?M="top":"end"===a&&(M="bottom"));const T=this._getLabelSizes();for(g=0,v=r.length;g<v;++g){y=r[g],b=y.label;const t=o.setContext(this.getContext(g));k=this.getPixelForTick(g)+o.labelOffset,S=this._resolveTickFontOptions(g),C=S.lineHeight,E=Zb(b)?b.length:1;const e=E/2,i=t.color,a=t.textStrokeColor,c=t.textStrokeWidth;let d,u=w;if(s?(x=k,"inner"===w&&(u=g===v-1?this.options.reverse?"left":"right":0===g?this.options.reverse?"right":"left":"center"),A="top"===n?"near"===l||0!==f?-E*C+C/2:"center"===l?-T.highest.height/2-e*C+C:-T.highest.height+C/2:"near"===l||0!==f?C/2:"center"===l?T.highest.height/2-e*C:T.highest.height-E*C,h&&(A*=-1),0===f||t.showLabelBackdrop||(x+=C/2*Math.sin(f))):(_=k,A=(1-E)*C/2),t.showLabelBackdrop){const e=N_(t.backdropPadding),i=T.heights[g],n=T.widths[g];let o=A-e.top,s=0-e.left;switch(M){case"middle":o-=i/2;break;case"bottom":o-=i}switch(w){case"center":s-=n/2;break;case"right":s-=n;break;case"inner":g===v-1?s-=n:g>0&&(s-=n/2)}d={left:s,top:o,width:n+e.width,height:i+e.height,color:t.backdropColor}}m.push({label:b,font:S,textOffset:A,options:{rotation:f,color:i,strokeColor:a,strokeWidth:c,textAlign:u,textBaseline:M,translation:[x,_],backdrop:d}})}return m}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-Tx(this.labelRotation))return"top"===t?"left":"right";let i="center";return"start"===e.align?i="left":"end"===e.align?i="right":"inner"===e.align&&(i="inner"),i}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:n,padding:o}}=this.options,s=t+o,r=this._getLabelSizes().widest.width;let a,l;return"left"===e?n?(l=this.right+o,"near"===i?a="left":"center"===i?(a="center",l+=r/2):(a="right",l+=r)):(l=this.right-s,"near"===i?a="right":"center"===i?(a="center",l-=r/2):(a="left",l=this.left)):"right"===e?n?(l=this.left+o,"near"===i?a="right":"center"===i?(a="center",l-=r/2):(a="left",l-=r)):(l=this.left+s,"near"===i?a="left":"center"===i?(a="center",l+=r/2):(a="right",l=this.right)):a="right",{textAlign:a,x:l}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;return"left"===e||"right"===e?{top:0,left:this.left,bottom:t.height,right:this.right}:"top"===e||"bottom"===e?{top:this.top,left:0,bottom:this.bottom,right:t.width}:void 0}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:n,width:o,height:s}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,n,o,s),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const i=this.ticks.findIndex((e=>e.value===t));if(i>=0){return e.setContext(this.getContext(i)).lineWidth}return 0}drawGrid(t){const e=this.options.grid,i=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,s;const r=(t,e,n)=>{n.width&&n.color&&(i.save(),i.lineWidth=n.width,i.strokeStyle=n.color,i.setLineDash(n.borderDash||[]),i.lineDashOffset=n.borderDashOffset,i.beginPath(),i.moveTo(t.x,t.y),i.lineTo(e.x,e.y),i.stroke(),i.restore())};if(e.display)for(o=0,s=n.length;o<s;++o){const t=n[o];e.drawOnChartArea&&r({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},t),e.drawTicks&&r({x:t.tx1,y:t.ty1},{x:t.tx2,y:t.ty2},{color:t.tickColor,width:t.tickWidth,borderDash:t.tickBorderDash,borderDashOffset:t.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{border:i,grid:n}}=this,o=i.setContext(this.getContext()),s=i.display?o.width:0;if(!s)return;const r=n.setContext(this.getContext(0)).lineWidth,a=this._borderValue;let l,c,h,d;this.isHorizontal()?(l=y_(t,this.left,s)-s/2,c=y_(t,this.right,r)+r/2,h=d=a):(h=y_(t,this.top,s)-s/2,d=y_(t,this.bottom,r)+r/2,l=c=a),e.save(),e.lineWidth=o.width,e.strokeStyle=o.color,e.beginPath(),e.moveTo(l,h),e.lineTo(c,d),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const e=this.ctx,i=this._computeLabelArea();i&&k_(e,i);const n=this.getLabelItems(t);for(const t of n){const i=t.options,n=t.font;T_(e,t.label,0,t.textOffset,n,i)}i&&S_(e)}drawTitle(){const{ctx:t,options:{position:e,title:i,reverse:n}}=this;if(!i.display)return;const o=B_(i.font),s=N_(i.padding),r=i.align;let a=o.lineHeight/2;"bottom"===e||"center"===e||Yb(e)?(a+=s.bottom,Zb(i.text)&&(a+=o.lineHeight*(i.text.length-1))):a+=s.top;const{titleX:l,titleY:c,maxWidth:h,rotation:d}=function(t,e,i,n){const{top:o,left:s,bottom:r,right:a,chart:l}=t,{chartArea:c,scales:h}=l;let d,u,p,f=0;const m=r-o,g=a-s;if(t.isHorizontal()){if(u=Zx(n,s,a),Yb(i)){const t=Object.keys(i)[0],n=i[t];p=h[t].getPixelForValue(n)+m-e}else p="center"===i?(c.bottom+c.top)/2+m-e:Jk(t,i,e);d=a-s}else{if(Yb(i)){const t=Object.keys(i)[0],n=i[t];u=h[t].getPixelForValue(n)-g+e}else u="center"===i?(c.left+c.right)/2-g+e:Jk(t,i,e);p=Zx(n,r,o),f="left"===i?-xx:xx}return{titleX:u,titleY:p,maxWidth:d,rotation:f}}(this,a,e,r);T_(t,i.text,0,0,o,{color:i.color,maxWidth:h,rotation:d,textAlign:sS(r,e,n),textBaseline:"middle",translation:[l,c]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,e=t.ticks&&t.ticks.z||0,i=Qb(t.grid&&t.grid.z,-1),n=Qb(t.border&&t.border.z,0);return this._isVisible()&&this.draw===rS.prototype.draw?[{z:i,draw:t=>{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",n=[];let o,s;for(o=0,s=e.length;o<s;++o){const s=e[o];s[i]!==this.id||t&&s.type!==t||n.push(s)}return n}_resolveTickFontOptions(t){return B_(this.options.ticks.setContext(this.getContext(t)).font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class aS{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let i;(function(t){return"id"in t&&"defaults"in t})(e)&&(i=this.register(e));const n=this.items,o=t.id,s=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in n||(n[o]=t,function(t,e,i){const n=rx(Object.create(null),[i?m_.get(i):{},m_.get(e),t.defaults]);m_.set(e,n),t.defaultRoutes&&function(t,e){Object.keys(e).forEach((i=>{const n=i.split("."),o=n.pop(),s=[t].concat(n).join("."),r=e[i].split("."),a=r.pop(),l=r.join(".");m_.route(s,o,l,a)}))}(e,t.defaultRoutes);t.descriptors&&m_.describe(e,t.descriptors)}(t,s,i),this.override&&m_.override(t.id,t.overrides)),s}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,n=this.scope;i in e&&delete e[i],n&&i in m_[n]&&(delete m_[n][i],this.override&&delete h_[i])}}class lS{constructor(){this.controllers=new aS(Qw,"datasets",!0),this.elements=new aS(Xk,"elements"),this.plugins=new aS(Object,"plugins"),this.scales=new aS(rS,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach((e=>{const n=i||this._getRegistryForType(e);i||n.isForType(e)||n===this.plugins&&e.id?this._exec(t,n,e):ex(e,(e=>{const n=i||this._getRegistryForType(e);this._exec(t,n,e)}))}))}_exec(t,e,i){const n=dx(t);tx(i["before"+n],[],i),e[t](i),tx(i["after"+n],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){const n=e.get(t);if(void 0===n)throw new Error('"'+t+'" is not a registered '+i+".");return n}}var cS=new lS;class hS{constructor(){this._init=[]}notify(t,e,i,n){"beforeInit"===e&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const o=n?this._descriptors(t).filter(n):this._descriptors(t),s=this._notify(o,t,e,i);return"afterDestroy"===e&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall")),s}_notify(t,e,i,n){n=n||{};for(const o of t){const t=o.plugin;if(!1===tx(t[i],[e,n,o.options],t)&&n.cancelable)return!1}return!0}invalidate(){Gb(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const i=t&&t.config,n=Qb(i.options&&i.options.plugins,{}),o=function(t){const e={},i=[],n=Object.keys(cS.plugins.items);for(let t=0;t<n.length;t++)i.push(cS.getPlugin(n[t]));const o=t.plugins||[];for(let t=0;t<o.length;t++){const n=o[t];-1===i.indexOf(n)&&(i.push(n),e[n.id]=!0)}return{plugins:i,localIds:e}}(i);return!1!==n||e?function(t,{plugins:e,localIds:i},n,o){const s=[],r=t.getContext();for(const a of e){const e=a.id,l=dS(n[e],o);null!==l&&s.push({plugin:a,options:uS(t.config,{plugin:a,local:i[e]},l,r)})}return s}(t,o,n,e):[]}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,n=(t,e)=>t.filter((t=>!e.some((e=>t.plugin.id===e.plugin.id))));this._notify(n(e,i),t,"stop"),this._notify(n(i,e),t,"start")}}function dS(t,e){return e||!1!==t?!0===t?{}:t:null}function uS(t,{plugin:e,local:i},n,o){const s=t.pluginScopeKeys(e),r=t.getOptionScopes(n,s);return i&&e.defaults&&r.push(e.defaults),t.createResolver(r,o,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function pS(t,e){const i=m_.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function fS(t){if("x"===t||"y"===t||"r"===t)return t}function mS(t,...e){if(fS(t))return t;for(const n of e){const e=n.axis||("top"===(i=n.position)||"bottom"===i?"x":"left"===i||"right"===i?"y":void 0)||t.length>1&&fS(t[0].toLowerCase());if(e)return e}var i;throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function gS(t,e,i){if(i[e+"AxisID"]===t)return{axis:e}}function vS(t,e){const i=h_[t.type]||{scales:{}},n=e.scales||{},o=pS(t.type,e),s=Object.create(null);return Object.keys(n).forEach((e=>{const r=n[e];if(!Yb(r))return console.error(`Invalid scale configuration for scale: ${e}`);if(r._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${e}`);const a=mS(e,r,function(t,e){if(e.data&&e.data.datasets){const i=e.data.datasets.filter((e=>e.xAxisID===t||e.yAxisID===t));if(i.length)return gS(t,"x",i[0])||gS(t,"y",i[0])}return{}}(e,t),m_.scales[r.type]),l=function(t,e){return t===e?"_index_":"_value_"}(a,o),c=i.scales||{};s[e]=ax(Object.create(null),[{axis:a},r,c[a],c[l]])})),t.data.datasets.forEach((i=>{const o=i.type||t.type,r=i.indexAxis||pS(o,e),a=(h_[o]||{}).scales||{};Object.keys(a).forEach((t=>{const e=function(t,e){let i=t;return"_index_"===t?i=e:"_value_"===t&&(i="x"===e?"y":"x"),i}(t,r),o=i[e+"AxisID"]||e;s[o]=s[o]||Object.create(null),ax(s[o],[{axis:e},n[o],a[t]])}))})),Object.keys(s).forEach((t=>{const e=s[t];ax(e,[m_.scales[e.type],m_.scale])})),s}function yS(t){const e=t.options||(t.options={});e.plugins=Qb(e.plugins,{}),e.scales=vS(t,e)}function bS(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const xS=new Map,_S=new Set;function wS(t,e){let i=xS.get(t);return i||(i=e(),xS.set(t,i),_S.add(i)),i}const kS=(t,e,i)=>{const n=hx(e,i);void 0!==n&&t.add(n)};class SS{constructor(t){this._config=function(t){return(t=t||{}).data=bS(t.data),yS(t),t}(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=bS(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),yS(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return wS(t,(()=>[[`datasets.${t}`,""]]))}datasetAnimationScopeKeys(t,e){return wS(`${t}.transition.${e}`,(()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]]))}datasetElementScopeKeys(t,e){return wS(`${t}-${e}`,(()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]]))}pluginScopeKeys(t){const e=t.id;return wS(`${this.type}-plugin-${e}`,(()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]]))}_cachedScopes(t,e){const i=this._scopeCache;let n=i.get(t);return n&&!e||(n=new Map,i.set(t,n)),n}getOptionScopes(t,e,i){const{options:n,type:o}=this,s=this._cachedScopes(t,i),r=s.get(e);if(r)return r;const a=new Set;e.forEach((e=>{t&&(a.add(t),e.forEach((e=>kS(a,t,e)))),e.forEach((t=>kS(a,n,t))),e.forEach((t=>kS(a,h_[o]||{},t))),e.forEach((t=>kS(a,m_,t))),e.forEach((t=>kS(a,d_,t)))}));const l=Array.from(a);return 0===l.length&&l.push(Object.create(null)),_S.has(e)&&s.set(e,l),l}chartOptionScopes(){const{options:t,type:e}=this;return[t,h_[e]||{},m_.datasets[e]||{},{type:e},m_,d_]}resolveNamedOptions(t,e,i,n=[""]){const o={$shared:!0},{resolver:s,subPrefixes:r}=CS(this._resolverCache,t,n);let a=s;if(function(t,e){const{isScriptable:i,isIndexable:n}=H_(t);for(const o of e){const e=i(o),s=n(o),r=(s||e)&&t[o];if(e&&(px(r)||ES(r))||s&&Zb(r))return!0}return!1}(s,e)){o.$shared=!1;a=V_(s,i=px(i)?i():i,this.createResolver(t,i,r))}for(const t of e)o[t]=a[t];return o}createResolver(t,e,i=[""],n){const{resolver:o}=CS(this._resolverCache,t,i);return Yb(e)?V_(o,e,void 0,n):o}}function CS(t,e,i){let n=t.get(e);n||(n=new Map,t.set(e,n));const o=i.join();let s=n.get(o);if(!s){s={resolver:q_(e,i),subPrefixes:i.filter((t=>!t.toLowerCase().includes("hover")))},n.set(o,s)}return s}const ES=t=>Yb(t)&&Object.getOwnPropertyNames(t).some((e=>px(t[e])));const AS=["top","bottom","left","right","chartArea"];function MS(t,e){return"top"===t||"bottom"===t||-1===AS.indexOf(t)&&"x"===e}function TS(t,e){return function(i,n){return i[t]===n[t]?i[e]-n[e]:i[t]-n[t]}}function PS(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),tx(i&&i.onComplete,[t],e)}function OS(t){const e=t.chart,i=e.options.animation;tx(i&&i.onProgress,[t],e)}function DS(t){return cw()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const IS={},LS=t=>{const e=DS(t);return Object.values(IS).filter((t=>t.canvas===e)).pop()};function $S(t,e,i){const n=Object.keys(t);for(const o of n){const n=+o;if(n>=e){const s=t[o];delete t[o],(i>0||n>e)&&(t[n+i]=s)}}}function zS(t,e,i){return t.options.clip?t[i]:e[i]}class RS{static defaults=m_;static instances=IS;static overrides=h_;static registry=cS;static version="4.4.8";static getChart=LS;static register(...t){cS.add(...t),NS()}static unregister(...t){cS.remove(...t),NS()}constructor(t,e){const i=this.config=new SS(e),n=DS(t),o=LS(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const s=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||function(t){return!cw()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?Lk:Yk}(n)),this.platform.updateConfig(i);const r=this.platform.acquireContext(n,s.aspectRatio),a=r&&r.canvas,l=a&&a.height,c=a&&a.width;this.id=Wb(),this.ctx=r,this.canvas=a,this.width=c,this.height=l,this._options=s,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new hS,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=function(t,e){let i;return function(...n){return e?(clearTimeout(i),i=setTimeout(t,e,n)):t.apply(this,n),e}}((t=>this.update(t)),s.resizeDelay||0),this._dataChanges=[],IS[this.id]=this,r&&a?(zw.listen(this,"complete",PS),zw.listen(this,"progress",OS),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:n,_aspectRatio:o}=this;return Gb(t)?e&&o?o:n?i/n:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return cS}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():bw(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return b_(this.canvas,this.ctx),this}stop(){return zw.stop(this),this}resize(t,e){zw.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,n=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,s=this.platform.getMaximumSize(n,t,e,o),r=i.devicePixelRatio||this.platform.getDevicePixelRatio(),a=this.width?"resize":"attach";this.width=s.width,this.height=s.height,this._aspectRatio=this.aspectRatio,bw(this,r,!0)&&(this.notifyPlugins("resize",{size:s}),tx(i.onResize,[this,s],this),this.attached&&this._doResize(a)&&this.render())}ensureScalesHaveIDs(){ex(this.options.scales||{},((t,e)=>{t.id=e}))}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,n=Object.keys(i).reduce(((t,e)=>(t[e]=!1,t)),{});let o=[];e&&(o=o.concat(Object.keys(e).map((t=>{const i=e[t],n=mS(t,i),o="r"===n,s="x"===n;return{options:i,dposition:o?"chartArea":s?"bottom":"left",dtype:o?"radialLinear":s?"category":"linear"}})))),ex(o,(e=>{const o=e.options,s=o.id,r=mS(s,o),a=Qb(o.type,e.dtype);void 0!==o.position&&MS(o.position,r)===MS(e.dposition)||(o.position=e.dposition),n[s]=!0;let l=null;if(s in i&&i[s].type===a)l=i[s];else{l=new(cS.getScale(a))({id:s,type:a,ctx:this.ctx,chart:this}),i[l.id]=l}l.init(o,t)})),ex(n,((t,e)=>{t||delete i[e]})),ex(i,(t=>{Dk.configure(this,t,t.options),Dk.addBox(this,t)}))}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort(((t,e)=>t.index-e.index)),i>e){for(let t=e;t<i;++t)this._destroyDatasetMeta(t);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(TS("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach(((t,i)=>{0===e.filter((e=>e===t._dataset)).length&&this._destroyDatasetMeta(i)}))}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,n;for(this._removeUnreferencedMetasets(),i=0,n=e.length;i<n;i++){const n=e[i];let o=this.getDatasetMeta(i);const s=n.type||this.config.type;if(o.type&&o.type!==s&&(this._destroyDatasetMeta(i),o=this.getDatasetMeta(i)),o.type=s,o.indexAxis=n.indexAxis||pS(s,this.options),o.order=n.order||0,o.index=i,o.label=""+n.label,o.visible=this.isDatasetVisible(i),o.controller)o.controller.updateIndex(i),o.controller.linkScales();else{const e=cS.getController(s),{datasetElementType:n,dataElementType:r}=m_.datasets[s];Object.assign(e,{dataElementType:cS.getElement(r),datasetElementType:n&&cS.getElement(n)}),o.controller=new e(this,i),t.push(o.controller)}}return this._updateMetasets(),t}_resetElements(){ex(this.data.datasets,((t,e)=>{this.getDatasetMeta(e).controller.reset()}),this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),n=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let s=0;for(let t=0,e=this.data.datasets.length;t<e;t++){const{controller:e}=this.getDatasetMeta(t),i=!n&&-1===o.indexOf(e);e.buildOrUpdateElements(i),s=Math.max(+e.getMaxOverflow(),s)}s=this._minPadding=i.layout.autoPadding?s:0,this._updateLayout(s),n||ex(o,(t=>{t.reset()})),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(TS("z","_idx"));const{_active:r,_lastEvent:a}=this;a?this._eventHandler(a,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){ex(this.scales,(t=>{Dk.removeBox(this,t)})),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);fx(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:n,count:o}of e){$S(t,n,"_removeElements"===i?-o:o)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=e=>new Set(t.filter((t=>t[0]===e)).map(((t,e)=>e+","+t.splice(1).join(",")))),n=i(0);for(let t=1;t<e;t++)if(!fx(n,i(t)))return;return Array.from(n).map((t=>t.split(","))).map((t=>({method:t[1],start:+t[2],count:+t[3]})))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;Dk.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],ex(this.boxes,(t=>{i&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))}),this),this._layers.forEach(((t,e)=>{t._idx=e})),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,e=this.data.datasets.length;t<e;++t)this.getDatasetMeta(t).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,px(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const i=this.getDatasetMeta(t),n={meta:i,index:t,mode:e,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",n)&&(i.controller._update(e),n.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",n))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(zw.has(this)?this.attached&&!zw.running(this)&&zw.start(this):(this.draw(),PS({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:t,height:e}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(t,e)}if(this.clear(),this.width<=0||this.height<=0)return;if(!1===this.notifyPlugins("beforeDraw",{cancelable:!0}))return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,i=[];let n,o;for(n=0,o=e.length;n<o;++n){const o=e[n];t&&!o.visible||i.push(o)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1===this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,n=!i.disabled,o=function(t,e){const{xScale:i,yScale:n}=t;return i&&n?{left:zS(i,e,"left"),right:zS(i,e,"right"),top:zS(n,e,"top"),bottom:zS(n,e,"bottom")}:e}(t,this.chartArea),s={meta:t,index:t.index,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetDraw",s)&&(n&&k_(e,{left:!1===i.left?0:o.left-i.left,right:!1===i.right?this.width:o.right+i.right,top:!1===i.top?0:o.top-i.top,bottom:!1===i.bottom?this.height:o.bottom+i.bottom}),t.controller.draw(),n&&S_(e),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(t){return w_(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,n){const o=bk.modes[e];return"function"==typeof o?o(this,t,i,n):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let n=i.filter((t=>t&&t._dataset===e)).pop();return n||(n={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(n)),n}getContext(){return this.$context||(this.$context=F_(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return"boolean"==typeof i.hidden?!i.hidden:!e.hidden}setDatasetVisibility(t,e){this.getDatasetMeta(t).hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const n=i?"show":"hide",o=this.getDatasetMeta(t),s=o.controller._resolveAnimations(void 0,n);ux(e)?(o.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),s.update(o,{visible:i}),this.update((e=>e.datasetIndex===t?n:void 0)))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),zw.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),b_(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete IS[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,i=(i,n)=>{e.addEventListener(this,i,n),t[i]=n},n=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};ex(this.options.events,(t=>i(t,n)))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(i,n)=>{e.addEventListener(this,i,n),t[i]=n},n=(i,n)=>{t[i]&&(e.removeEventListener(this,i,n),delete t[i])},o=(t,e)=>{this.canvas&&this.resize(t,e)};let s;const r=()=>{n("attach",r),this.attached=!0,this.resize(),i("resize",o),i("detach",s)};s=()=>{this.attached=!1,n("resize",o),this._stop(),this._resize(0,0),i("attach",r)},e.isAttached(this.canvas)?r():s()}unbindEvents(){ex(this._listeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._listeners={},ex(this._responsiveListeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const n=i?"set":"remove";let o,s,r,a;for("dataset"===e&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+n+"DatasetHoverStyle"]()),r=0,a=t.length;r<a;++r){s=t[r];const e=s&&this.getDatasetMeta(s.datasetIndex).controller;e&&e[n+"HoverStyle"](s.element,s.datasetIndex,s.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],i=t.map((({datasetIndex:t,index:e})=>{const i=this.getDatasetMeta(t);if(!i)throw new Error("No dataset found at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}));!ix(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return 1===this._plugins._cache.filter((e=>e.plugin.id===t)).length}_updateHoverStyles(t,e,i){const n=this.options.hover,o=(t,e)=>t.filter((t=>!e.some((e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)))),s=o(e,t),r=i?t:o(t,e);s.length&&this.updateHoverStyle(s,n.mode,!1),r.length&&n.mode&&this.updateHoverStyle(r,n.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},n=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",i,n))return;const o=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,n),(o||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:n=[],options:o}=this,s=e,r=this._getActiveElements(t,n,i,s),a=function(t){return"mouseup"===t.type||"click"===t.type||"contextmenu"===t.type}(t),l=function(t,e,i,n){return i&&"mouseout"!==t.type?n?e:t:null}(t,this._lastEvent,i,a);i&&(this._lastEvent=null,tx(o.onHover,[t,r,this],this),a&&tx(o.onClick,[t,r,this],this));const c=!ix(r,n);return(c||e)&&(this._active=r,this._updateHoverStyles(r,n,e)),this._lastEvent=l,c}_getActiveElements(t,e,i,n){if("mouseout"===t.type)return[];if(!i)return e;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,n)}}function NS(){return ex(RS.instances,(t=>t._plugins.invalidate()))}function BS(t,e,i,n){const o=$_(t.options.borderRadius,["outerStart","outerEnd","innerStart","innerEnd"]);const s=(i-e)/2,r=Math.min(s,n*e/2),a=t=>{const e=(i-Math.min(s,t))*n/2;return Rx(t,0,Math.min(s,e))};return{outerStart:a(o.outerStart),outerEnd:a(o.outerEnd),innerStart:Rx(o.innerStart,0,r),innerEnd:Rx(o.innerEnd,0,r)}}function jS(t,e,i,n){return{x:i+t*Math.cos(e),y:n+t*Math.sin(e)}}function FS(t,e,i,n,o,s){const{x:r,y:a,startAngle:l,pixelMargin:c,innerRadius:h}=e,d=Math.max(e.outerRadius+n+i-c,0),u=h>0?h+n+i+c:0;let p=0;const f=o-l;if(n){const t=((h>0?h-n:0)+(d>0?d-n:0))/2;p=(f-(0!==t?f*t/(t+n):f))/2}const m=(f-Math.max(.001,f*d-i/mx)/d)/2,g=l+m+p,v=o-m-p,{outerStart:y,outerEnd:b,innerStart:x,innerEnd:_}=BS(e,u,d,v-g),w=d-y,k=d-b,S=g+y/w,C=v-b/k,E=u+x,A=u+_,M=g+x/E,T=v-_/A;if(t.beginPath(),s){const e=(S+C)/2;if(t.arc(r,a,d,S,e),t.arc(r,a,d,e,C),b>0){const e=jS(k,C,r,a);t.arc(e.x,e.y,b,C,v+xx)}const i=jS(A,v,r,a);if(t.lineTo(i.x,i.y),_>0){const e=jS(A,T,r,a);t.arc(e.x,e.y,_,v+xx,T+Math.PI)}const n=(v-_/u+(g+x/u))/2;if(t.arc(r,a,u,v-_/u,n,!0),t.arc(r,a,u,n,g+x/u,!0),x>0){const e=jS(E,M,r,a);t.arc(e.x,e.y,x,M+Math.PI,g-xx)}const o=jS(w,g,r,a);if(t.lineTo(o.x,o.y),y>0){const e=jS(w,S,r,a);t.arc(e.x,e.y,y,g-xx,S)}}else{t.moveTo(r,a);const e=Math.cos(S)*d+r,i=Math.sin(S)*d+a;t.lineTo(e,i);const n=Math.cos(C)*d+r,o=Math.sin(C)*d+a;t.lineTo(n,o)}t.closePath()}function qS(t,e,i,n,o){const{fullCircles:s,startAngle:r,circumference:a,options:l}=e,{borderWidth:c,borderJoinStyle:h,borderDash:d,borderDashOffset:u}=l,p="inner"===l.borderAlign;if(!c)return;t.setLineDash(d||[]),t.lineDashOffset=u,p?(t.lineWidth=2*c,t.lineJoin=h||"round"):(t.lineWidth=c,t.lineJoin=h||"bevel");let f=e.endAngle;if(s){FS(t,e,i,n,f,o);for(let e=0;e<s;++e)t.stroke();isNaN(a)||(f=r+(a%gx||gx))}p&&function(t,e,i){const{startAngle:n,pixelMargin:o,x:s,y:r,outerRadius:a,innerRadius:l}=e;let c=o/a;t.beginPath(),t.arc(s,r,a,n-c,i+c),l>o?(c=o/l,t.arc(s,r,l,i+c,n-c,!0)):t.arc(s,r,o,i+xx,n-xx),t.closePath(),t.clip()}(t,e,f),s||(FS(t,e,i,n,f,o),t.stroke())}function VS(t,e,i=e){t.lineCap=Qb(i.borderCapStyle,e.borderCapStyle),t.setLineDash(Qb(i.borderDash,e.borderDash)),t.lineDashOffset=Qb(i.borderDashOffset,e.borderDashOffset),t.lineJoin=Qb(i.borderJoinStyle,e.borderJoinStyle),t.lineWidth=Qb(i.borderWidth,e.borderWidth),t.strokeStyle=Qb(i.borderColor,e.borderColor)}function HS(t,e,i){t.lineTo(i.x,i.y)}function US(t,e,i={}){const n=t.length,{start:o=0,end:s=n-1}=i,{start:r,end:a}=e,l=Math.max(o,r),c=Math.min(s,a),h=o<r&&s<r||o>a&&s>a;return{count:n,start:l,loop:e.loop,ilen:c<l&&!h?n+c-l:c-l}}function WS(t,e,i,n){const{points:o,options:s}=e,{count:r,start:a,loop:l,ilen:c}=US(o,i,n),h=function(t){return t.stepped?C_:t.tension||"monotone"===t.cubicInterpolationMode?E_:HS}(s);let d,u,p,{move:f=!0,reverse:m}=n||{};for(d=0;d<=c;++d)u=o[(a+(m?c-d:d))%r],u.skip||(f?(t.moveTo(u.x,u.y),f=!1):h(t,p,u,m,s.stepped),p=u);return l&&(u=o[(a+(m?c:0))%r],h(t,p,u,m,s.stepped)),!!l}function GS(t,e,i,n){const o=e.points,{count:s,start:r,ilen:a}=US(o,i,n),{move:l=!0,reverse:c}=n||{};let h,d,u,p,f,m,g=0,v=0;const y=t=>(r+(c?a-t:t))%s,b=()=>{p!==f&&(t.lineTo(g,f),t.lineTo(g,p),t.lineTo(g,m))};for(l&&(d=o[y(0)],t.moveTo(d.x,d.y)),h=0;h<=a;++h){if(d=o[y(h)],d.skip)continue;const e=d.x,i=d.y,n=0|e;n===u?(i<p?p=i:i>f&&(f=i),g=(v*g+e)/++v):(b(),t.lineTo(e,i),u=n,v=0,p=f=i),m=i}b()}function ZS(t){const e=t.options,i=e.borderDash&&e.borderDash.length;return!(t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i)?GS:WS}const YS="function"==typeof Path2D;function XS(t,e,i,n){YS&&!e.options.segment?function(t,e,i,n){let o=e._path;o||(o=e._path=new Path2D,e.path(o,i,n)&&o.closePath()),VS(t,e.options),t.stroke(o)}(t,e,i,n):function(t,e,i,n){const{segments:o,options:s}=e,r=ZS(e);for(const a of o)VS(t,s,a.style),t.beginPath(),r(t,e,a,{start:i,end:i+n-1})&&t.closePath(),t.stroke()}(t,e,i,n)}class KS extends Xk{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t&&"fill"!==t};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!this._pointsUpdated){const n=i.spanGaps?this._loop:this._fullLoop;lw(this._points,i,t,n,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=function(t,e){const i=t.points,n=t.options.spanGaps,o=i.length;if(!o)return[];const s=!!t._loop,{start:r,end:a}=function(t,e,i,n){let o=0,s=e-1;if(i&&!n)for(;o<e&&!t[o].skip;)o++;for(;o<e&&t[o].skip;)o++;for(o%=e,i&&(s+=o);s>o&&t[s%e].skip;)s--;return s%=e,{start:o,end:s}}(i,o,s,n);return Dw(t,!0===n?[{start:r,end:a,loop:s}]:function(t,e,i,n){const o=t.length,s=[];let r,a=e,l=t[e];for(r=e+1;r<=i;++r){const i=t[r%o];i.skip||i.stop?l.skip||(n=!1,s.push({start:e%o,end:(r-1)%o,loop:n}),e=a=i.stop?r:null):(a=r,l.skip&&(e=r)),l=i}return null!==a&&s.push({start:e%o,end:a%o,loop:n}),s}(i,r,a<r?a+o:a,!!t._fullLoop&&0===r&&a===o-1),i,e)}(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,n=t[e],o=this.points,s=Ow(this,{property:e,start:n,end:n});if(!s.length)return;const r=[],a=function(t){return t.stepped?kw:t.tension||"monotone"===t.cubicInterpolationMode?Sw:ww}(i);let l,c;for(l=0,c=s.length;l<c;++l){const{start:c,end:h}=s[l],d=o[c],u=o[h];if(d===u){r.push(d);continue}const p=a(d,u,Math.abs((n-d[e])/(u[e]-d[e])),i.stepped);p[e]=t[e],r.push(p)}return 1===r.length?r[0]:r}pathSegment(t,e,i){return ZS(this)(t,this,e,i)}path(t,e,i){const n=this.segments,o=ZS(this);let s=this._loop;e=e||0,i=i||this.points.length-e;for(const r of n)s&=o(t,this,r,{start:e,end:e+i-1});return!!s}draw(t,e,i,n){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),XS(t,this,i,n),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function QS(t,e,i,n){const o=t.options,{[i]:s}=t.getProps([i],n);return Math.abs(e-s)<o.radius+o.hitRadius}function JS(t,e){const{x:i,y:n,base:o,width:s,height:r}=t.getProps(["x","y","base","width","height"],e);let a,l,c,h,d;return t.horizontal?(d=r/2,a=Math.min(i,o),l=Math.max(i,o),c=n-d,h=n+d):(d=s/2,a=i-d,l=i+d,c=Math.min(n,o),h=Math.max(n,o)),{left:a,top:c,right:l,bottom:h}}function tC(t,e,i,n){return t?0:Rx(e,i,n)}function eC(t){const e=JS(t),i=e.right-e.left,n=e.bottom-e.top,o=function(t,e,i){const n=t.options.borderWidth,o=t.borderSkipped,s=z_(n);return{t:tC(o.top,s.top,0,i),r:tC(o.right,s.right,0,e),b:tC(o.bottom,s.bottom,0,i),l:tC(o.left,s.left,0,e)}}(t,i/2,n/2),s=function(t,e,i){const{enableBorderRadius:n}=t.getProps(["enableBorderRadius"]),o=t.options.borderRadius,s=R_(o),r=Math.min(e,i),a=t.borderSkipped,l=n||Yb(o);return{topLeft:tC(!l||a.top||a.left,s.topLeft,0,r),topRight:tC(!l||a.top||a.right,s.topRight,0,r),bottomLeft:tC(!l||a.bottom||a.left,s.bottomLeft,0,r),bottomRight:tC(!l||a.bottom||a.right,s.bottomRight,0,r)}}(t,i/2,n/2);return{outer:{x:e.left,y:e.top,w:i,h:n,radius:s},inner:{x:e.left+o.l,y:e.top+o.t,w:i-o.l-o.r,h:n-o.t-o.b,radius:{topLeft:Math.max(0,s.topLeft-Math.max(o.t,o.l)),topRight:Math.max(0,s.topRight-Math.max(o.t,o.r)),bottomLeft:Math.max(0,s.bottomLeft-Math.max(o.b,o.l)),bottomRight:Math.max(0,s.bottomRight-Math.max(o.b,o.r))}}}}function iC(t,e,i,n){const o=null===e,s=null===i,r=t&&!(o&&s)&&JS(t,n);return r&&(o||Nx(e,r.left,r.right))&&(s||Nx(i,r.top,r.bottom))}function nC(t,e){t.rect(e.x,e.y,e.w,e.h)}function oC(t,e,i={}){const n=t.x!==i.x?-e:0,o=t.y!==i.y?-e:0,s=(t.x+t.w!==i.x+i.w?e:0)-n,r=(t.y+t.h!==i.y+i.h?e:0)-o;return{x:t.x+n,y:t.y+o,w:t.w+s,h:t.h+r,radius:t.radius}}var sC=Object.freeze({__proto__:null,ArcElement:class extends Xk{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,i){const n=this.getProps(["x","y"],i),{angle:o,distance:s}=Dx(n,{x:t,y:e}),{startAngle:r,endAngle:a,innerRadius:l,outerRadius:c,circumference:h}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),d=(this.options.spacing+this.options.borderWidth)/2,u=Qb(h,a-r),p=zx(o,r,a)&&r!==a,f=u>=gx||p,m=Nx(s,l+d,c+d);return f&&m}getCenterPoint(t){const{x:e,y:i,startAngle:n,endAngle:o,innerRadius:s,outerRadius:r}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:a,spacing:l}=this.options,c=(n+o)/2,h=(s+r+l+a)/2;return{x:e+Math.cos(c)*h,y:i+Math.sin(c)*h}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:i}=this,n=(e.offset||0)/4,o=(e.spacing||0)/2,s=e.circular;if(this.pixelMargin="inner"===e.borderAlign?.33:0,this.fullCircles=i>gx?Math.floor(i/gx):0,0===i||this.innerRadius<0||this.outerRadius<0)return;t.save();const r=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(r)*n,Math.sin(r)*n);const a=n*(1-Math.sin(Math.min(mx,i||0)));t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,function(t,e,i,n,o){const{fullCircles:s,startAngle:r,circumference:a}=e;let l=e.endAngle;if(s){FS(t,e,i,n,l,o);for(let e=0;e<s;++e)t.fill();isNaN(a)||(l=r+(a%gx||gx))}FS(t,e,i,n,l,o),t.fill()}(t,this,a,o,s),qS(t,this,a,o,s),t.restore()}},BarElement:class extends Xk{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:e,options:{borderColor:i,backgroundColor:n}}=this,{inner:o,outer:s}=eC(this),r=(a=s.radius).topLeft||a.topRight||a.bottomLeft||a.bottomRight?P_:nC;var a;t.save(),s.w===o.w&&s.h===o.h||(t.beginPath(),r(t,oC(s,e,o)),t.clip(),r(t,oC(o,-e,s)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),r(t,oC(o,e)),t.fillStyle=n,t.fill(),t.restore()}inRange(t,e,i){return iC(this,t,e,i)}inXRange(t,e){return iC(this,t,null,e)}inYRange(t,e){return iC(this,null,t,e)}getCenterPoint(t){const{x:e,y:i,base:n,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(e+n)/2:e,y:o?i:(i+n)/2}}getRange(t){return"x"===t?this.width/2:this.height/2}},LineElement:KS,PointElement:class extends Xk{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,i){const n=this.options,{x:o,y:s}=this.getProps(["x","y"],i);return Math.pow(t-o,2)+Math.pow(e-s,2)<Math.pow(n.hitRadius+n.radius,2)}inXRange(t,e){return QS(this,t,"x",e)}inYRange(t,e){return QS(this,t,"y",e)}getCenterPoint(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}size(t){let e=(t=t||this.options||{}).radius||0;e=Math.max(e,e&&t.hoverRadius||0);return 2*(e+(e&&t.borderWidth||0))}draw(t,e){const i=this.options;this.skip||i.radius<.1||!w_(this,e,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,x_(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}});const rC=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],aC=rC.map((t=>t.replace("rgb(","rgba(").replace(")",", 0.5)")));function lC(t){return rC[t%rC.length]}function cC(t){return aC[t%aC.length]}function hC(t){let e=0;return(i,n)=>{const o=t.getDatasetMeta(n).controller;o instanceof ak?e=function(t,e){return t.backgroundColor=t.data.map((()=>lC(e++))),e}(i,e):o instanceof lk?e=function(t,e){return t.backgroundColor=t.data.map((()=>cC(e++))),e}(i,e):o&&(e=function(t,e){return t.borderColor=lC(e),t.backgroundColor=cC(e),++e}(i,e))}}function dC(t){let e;for(e in t)if(t[e].borderColor||t[e].backgroundColor)return!0;return!1}var uC={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(t,e,i){if(!i.enabled)return;const{data:{datasets:n},options:o}=t.config,{elements:s}=o,r=dC(n)||(a=o)&&(a.borderColor||a.backgroundColor)||s&&dC(s)||"rgba(0,0,0,0.1)"!==m_.borderColor||"rgba(0,0,0,0.1)"!==m_.backgroundColor;var a;if(!i.forceOverride&&r)return;const l=hC(t);n.forEach(l)}};function pC(t){if(t._decimated){const e=t._data;delete t._decimated,delete t._data,Object.defineProperty(t,"data",{configurable:!0,enumerable:!0,writable:!0,value:e})}}function fC(t){t.data.datasets.forEach((t=>{pC(t)}))}var mC={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,e,i)=>{if(!i.enabled)return void fC(t);const n=t.width;t.data.datasets.forEach(((e,o)=>{const{_data:s,indexAxis:r}=e,a=t.getDatasetMeta(o),l=s||e.data;if("y"===j_([r,t.options.indexAxis]))return;if(!a.controller.supportsDecimation)return;const c=t.scales[a.xAxisID];if("linear"!==c.type&&"time"!==c.type)return;if(t.options.parsing)return;let{start:h,count:d}=function(t,e){const i=e.length;let n,o=0;const{iScale:s}=t,{min:r,max:a,minDefined:l,maxDefined:c}=s.getUserBounds();return l&&(o=Rx(jx(e,s.axis,r).lo,0,i-1)),n=c?Rx(jx(e,s.axis,a).hi+1,o,i)-o:i-o,{start:o,count:n}}(a,l);if(d<=(i.threshold||4*n))return void pC(e);let u;switch(Gb(s)&&(e._data=l,delete e.data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(t){this._data=t}})),i.algorithm){case"lttb":u=function(t,e,i,n,o){const s=o.samples||n;if(s>=i)return t.slice(e,e+i);const r=[],a=(i-2)/(s-2);let l=0;const c=e+i-1;let h,d,u,p,f,m=e;for(r[l++]=t[m],h=0;h<s-2;h++){let n,o=0,s=0;const c=Math.floor((h+1)*a)+1+e,g=Math.min(Math.floor((h+2)*a)+1,i)+e,v=g-c;for(n=c;n<g;n++)o+=t[n].x,s+=t[n].y;o/=v,s/=v;const y=Math.floor(h*a)+1+e,b=Math.min(Math.floor((h+1)*a)+1,i)+e,{x:x,y:_}=t[m];for(u=p=-1,n=y;n<b;n++)p=.5*Math.abs((x-o)*(t[n].y-_)-(x-t[n].x)*(s-_)),p>u&&(u=p,d=t[n],f=n);r[l++]=d,m=f}return r[l++]=t[c],r}(l,h,d,n,i);break;case"min-max":u=function(t,e,i,n){let o,s,r,a,l,c,h,d,u,p,f=0,m=0;const g=[],v=e+i-1,y=t[e].x,b=t[v].x-y;for(o=e;o<e+i;++o){s=t[o],r=(s.x-y)/b*n,a=s.y;const e=0|r;if(e===l)a<u?(u=a,c=o):a>p&&(p=a,h=o),f=(m*f+s.x)/++m;else{const i=o-1;if(!Gb(c)&&!Gb(h)){const e=Math.min(c,h),n=Math.max(c,h);e!==d&&e!==i&&g.push({...t[e],x:f}),n!==d&&n!==i&&g.push({...t[n],x:f})}o>0&&i!==d&&g.push(t[i]),g.push(s),l=e,m=0,u=p=a,c=h=d=o}}return g}(l,h,d,n);break;default:throw new Error(`Unsupported decimation algorithm '${i.algorithm}'`)}e._decimated=u}))},destroy(t){fC(t)}};function gC(t,e,i,n){if(n)return;let o=e[t],s=i[t];return"angle"===t&&(o=$x(o),s=$x(s)),{property:t,start:o,end:s}}function vC(t,e,i){for(;e>t;e--){const t=i[e];if(!isNaN(t.x)&&!isNaN(t.y))break}return e}function yC(t,e,i,n){return t&&e?n(t[i],e[i]):t?t[i]:e?e[i]:0}function bC(t,e){let i=[],n=!1;return Zb(t)?(n=!0,i=t):i=function(t,e){const{x:i=null,y:n=null}=t||{},o=e.points,s=[];return e.segments.forEach((({start:t,end:e})=>{e=vC(t,e,o);const r=o[t],a=o[e];null!==n?(s.push({x:r.x,y:n}),s.push({x:a.x,y:n})):null!==i&&(s.push({x:i,y:r.y}),s.push({x:i,y:a.y}))})),s}(t,e),i.length?new KS({points:i,options:{tension:0},_loop:n,_fullLoop:n}):null}function xC(t){return t&&!1!==t.fill}function _C(t,e,i){let n=t[e].fill;const o=[e];let s;if(!i)return n;for(;!1!==n&&-1===o.indexOf(n);){if(!Xb(n))return n;if(s=t[n],!s)return!1;if(s.visible)return n;o.push(n),n=s.fill}return!1}function wC(t,e,i){const n=function(t){const e=t.options,i=e.fill;let n=Qb(i&&i.target,i);void 0===n&&(n=!!e.backgroundColor);if(!1===n||null===n)return!1;if(!0===n)return"origin";return n}(t);if(Yb(n))return!isNaN(n.value)&&n;let o=parseFloat(n);return Xb(o)&&Math.floor(o)===o?function(t,e,i,n){"-"!==t&&"+"!==t||(i=e+i);if(i===e||i<0||i>=n)return!1;return i}(n[0],e,o,i):["origin","start","end","stack","shape"].indexOf(n)>=0&&n}function kC(t,e,i){const n=[];for(let o=0;o<i.length;o++){const s=i[o],{first:r,last:a,point:l}=SC(s,e,"x");if(!(!l||r&&a))if(r)n.unshift(l);else if(t.push(l),!a)break}t.push(...n)}function SC(t,e,i){const n=t.interpolate(e,i);if(!n)return{};const o=n[i],s=t.segments,r=t.points;let a=!1,l=!1;for(let t=0;t<s.length;t++){const e=s[t],n=r[e.start][i],c=r[e.end][i];if(Nx(o,n,c)){a=o===n,l=o===c;break}}return{first:a,last:l,point:n}}class CC{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){const{x:n,y:o,radius:s}=this;return e=e||{start:0,end:gx},t.arc(n,o,s,e.end,e.start,!0),!i.bounds}interpolate(t){const{x:e,y:i,radius:n}=this,o=t.angle;return{x:e+Math.cos(o)*n,y:i+Math.sin(o)*n,angle:o}}}function EC(t){const{chart:e,fill:i,line:n}=t;if(Xb(i))return function(t,e){const i=t.getDatasetMeta(e),n=i&&t.isDatasetVisible(e);return n?i.dataset:null}(e,i);if("stack"===i)return function(t){const{scale:e,index:i,line:n}=t,o=[],s=n.segments,r=n.points,a=function(t,e){const i=[],n=t.getMatchingVisibleMetas("line");for(let t=0;t<n.length;t++){const o=n[t];if(o.index===e)break;o.hidden||i.unshift(o.dataset)}return i}(e,i);a.push(bC({x:null,y:e.bottom},n));for(let t=0;t<s.length;t++){const e=s[t];for(let t=e.start;t<=e.end;t++)kC(o,r[t],a)}return new KS({points:o,options:{}})}(t);if("shape"===i)return!0;const o=function(t){const e=t.scale||{};if(e.getPointPositionForValue)return function(t){const{scale:e,fill:i}=t,n=e.options,o=e.getLabels().length,s=n.reverse?e.max:e.min,r=function(t,e,i){let n;return n="start"===t?i:"end"===t?e.options.reverse?e.min:e.max:Yb(t)?t.value:e.getBaseValue(),n}(i,e,s),a=[];if(n.grid.circular){const t=e.getPointPositionForValue(0,s);return new CC({x:t.x,y:t.y,radius:e.getDistanceFromCenterForValue(r)})}for(let t=0;t<o;++t)a.push(e.getPointPositionForValue(t,r));return a}(t);return function(t){const{scale:e={},fill:i}=t,n=function(t,e){let i=null;return"start"===t?i=e.bottom:"end"===t?i=e.top:Yb(t)?i=e.getPixelForValue(t.value):e.getBasePixel&&(i=e.getBasePixel()),i}(i,e);if(Xb(n)){const t=e.isHorizontal();return{x:t?n:null,y:t?null:n}}return null}(t)}(t);return o instanceof CC?o:bC(o,n)}function AC(t,e,i){const n=EC(e),{line:o,scale:s,axis:r}=e,a=o.options,l=a.fill,c=a.backgroundColor,{above:h=c,below:d=c}=l||{};n&&o.points.length&&(k_(t,i),function(t,e){const{line:i,target:n,above:o,below:s,area:r,scale:a}=e,l=i._loop?"angle":e.axis;t.save(),"x"===l&&s!==o&&(MC(t,n,r.top),TC(t,{line:i,target:n,color:o,scale:a,property:l}),t.restore(),t.save(),MC(t,n,r.bottom));TC(t,{line:i,target:n,color:s,scale:a,property:l}),t.restore()}(t,{line:o,target:n,above:h,below:d,area:i,scale:s,axis:r}),S_(t))}function MC(t,e,i){const{segments:n,points:o}=e;let s=!0,r=!1;t.beginPath();for(const a of n){const{start:n,end:l}=a,c=o[n],h=o[vC(n,l,o)];s?(t.moveTo(c.x,c.y),s=!1):(t.lineTo(c.x,i),t.lineTo(c.x,c.y)),r=!!e.pathSegment(t,a,{move:r}),r?t.closePath():t.lineTo(h.x,i)}t.lineTo(e.first().x,i),t.closePath(),t.clip()}function TC(t,e){const{line:i,target:n,property:o,color:s,scale:r}=e,a=function(t,e,i){const n=t.segments,o=t.points,s=e.points,r=[];for(const t of n){let{start:n,end:a}=t;a=vC(n,a,o);const l=gC(i,o[n],o[a],t.loop);if(!e.segments){r.push({source:t,target:l,start:o[n],end:o[a]});continue}const c=Ow(e,l);for(const e of c){const n=gC(i,s[e.start],s[e.end],e.loop),a=Pw(t,o,n);for(const t of a)r.push({source:t,target:e,start:{[i]:yC(l,n,"start",Math.max)},end:{[i]:yC(l,n,"end",Math.min)}})}}return r}(i,n,o);for(const{source:e,target:l,start:c,end:h}of a){const{style:{backgroundColor:a=s}={}}=e,d=!0!==n;t.save(),t.fillStyle=a,PC(t,r,d&&gC(o,c,h)),t.beginPath();const u=!!i.pathSegment(t,e);let p;if(d){u?t.closePath():OC(t,n,h,o);const e=!!n.pathSegment(t,l,{move:u,reverse:!0});p=u&&e,p||OC(t,n,c,o)}t.closePath(),t.fill(p?"evenodd":"nonzero"),t.restore()}}function PC(t,e,i){const{top:n,bottom:o}=e.chart.chartArea,{property:s,start:r,end:a}=i||{};"x"===s&&(t.beginPath(),t.rect(r,n,a-r,o-n),t.clip())}function OC(t,e,i,n){const o=e.interpolate(i,n);o&&t.lineTo(o.x,o.y)}var DC={id:"filler",afterDatasetsUpdate(t,e,i){const n=(t.data.datasets||[]).length,o=[];let s,r,a,l;for(r=0;r<n;++r)s=t.getDatasetMeta(r),a=s.dataset,l=null,a&&a.options&&a instanceof KS&&(l={visible:t.isDatasetVisible(r),index:r,fill:wC(a,r,n),chart:t,axis:s.controller.options.indexAxis,scale:s.vScale,line:a}),s.$filler=l,o.push(l);for(r=0;r<n;++r)l=o[r],l&&!1!==l.fill&&(l.fill=_C(o,r,i.propagate))},beforeDraw(t,e,i){const n="beforeDraw"===i.drawTime,o=t.getSortedVisibleDatasetMetas(),s=t.chartArea;for(let e=o.length-1;e>=0;--e){const i=o[e].$filler;i&&(i.line.updateControlPoints(s,i.axis),n&&i.fill&&AC(t.ctx,i,s))}},beforeDatasetsDraw(t,e,i){if("beforeDatasetsDraw"!==i.drawTime)return;const n=t.getSortedVisibleDatasetMetas();for(let e=n.length-1;e>=0;--e){const i=n[e].$filler;xC(i)&&AC(t.ctx,i,t.chartArea)}},beforeDatasetDraw(t,e,i){const n=e.meta.$filler;xC(n)&&"beforeDatasetDraw"===i.drawTime&&AC(t.ctx,n,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const IC=(t,e)=>{let{boxHeight:i=e,boxWidth:n=e}=t;return t.usePointStyle&&(i=Math.min(i,e),n=t.pointStyleWidth||Math.min(n,e)),{boxWidth:n,boxHeight:i,itemHeight:Math.max(e,i)}};class LC extends Xk{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=tx(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter((e=>t.filter(e,this.chart.data)))),t.sort&&(e=e.sort(((e,i)=>t.sort(e,i,this.chart.data)))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display)return void(this.width=this.height=0);const i=t.labels,n=B_(i.font),o=n.size,s=this._computeTitleHeight(),{boxWidth:r,itemHeight:a}=IC(i,o);let l,c;e.font=n.string,this.isHorizontal()?(l=this.maxWidth,c=this._fitRows(s,o,r,a)+10):(c=this.maxHeight,l=this._fitCols(s,n,r,a)+10),this.width=Math.min(l,t.maxWidth||this.maxWidth),this.height=Math.min(c,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,n){const{ctx:o,maxWidth:s,options:{labels:{padding:r}}}=this,a=this.legendHitBoxes=[],l=this.lineWidths=[0],c=n+r;let h=t;o.textAlign="left",o.textBaseline="middle";let d=-1,u=-c;return this.legendItems.forEach(((t,p)=>{const f=i+e/2+o.measureText(t.text).width;(0===p||l[l.length-1]+f+2*r>s)&&(h+=c,l[l.length-(p>0?0:1)]=0,u+=c,d++),a[p]={left:0,top:u,row:d,width:f,height:n},l[l.length-1]+=f+r})),h}_fitCols(t,e,i,n){const{ctx:o,maxHeight:s,options:{labels:{padding:r}}}=this,a=this.legendHitBoxes=[],l=this.columnSizes=[],c=s-t;let h=r,d=0,u=0,p=0,f=0;return this.legendItems.forEach(((t,s)=>{const{itemWidth:m,itemHeight:g}=function(t,e,i,n,o){const s=function(t,e,i,n){let o=t.text;o&&"string"!=typeof o&&(o=o.reduce(((t,e)=>t.length>e.length?t:e)));return e+i.size/2+n.measureText(o).width}(n,t,e,i),r=function(t,e,i){let n=t;"string"!=typeof e.text&&(n=$C(e,i));return n}(o,n,e.lineHeight);return{itemWidth:s,itemHeight:r}}(i,e,o,t,n);s>0&&u+g+2*r>c&&(h+=d+r,l.push({width:d,height:u}),p+=d+r,f++,d=u=0),a[s]={left:p,top:u,col:f,width:m,height:g},d=Math.max(d,m),u+=g+r})),h+=d,l.push({width:d,height:u}),h}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:n},rtl:o}}=this,s=Cw(o,this.left,this.width);if(this.isHorizontal()){let o=0,r=Zx(i,this.left+n,this.right-this.lineWidths[o]);for(const a of e)o!==a.row&&(o=a.row,r=Zx(i,this.left+n,this.right-this.lineWidths[o])),a.top+=this.top+t+n,a.left=s.leftForLtr(s.x(r),a.width),r+=a.width+n}else{let o=0,r=Zx(i,this.top+t+n,this.bottom-this.columnSizes[o].height);for(const a of e)a.col!==o&&(o=a.col,r=Zx(i,this.top+t+n,this.bottom-this.columnSizes[o].height)),a.top=r,a.left+=this.left+n,a.left=s.leftForLtr(s.x(a.left),a.width),r+=a.height+n}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const t=this.ctx;k_(t,this),this._draw(),S_(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:n}=this,{align:o,labels:s}=t,r=m_.color,a=Cw(t.rtl,this.left,this.width),l=B_(s.font),{padding:c}=s,h=l.size,d=h/2;let u;this.drawTitle(),n.textAlign=a.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=l.string;const{boxWidth:p,boxHeight:f,itemHeight:m}=IC(s,h),g=this.isHorizontal(),v=this._computeTitleHeight();u=g?{x:Zx(o,this.left+c,this.right-i[0]),y:this.top+c+v,line:0}:{x:this.left+c,y:Zx(o,this.top+v+c,this.bottom-e[0].height),line:0},Ew(this.ctx,t.textDirection);const y=m+c;this.legendItems.forEach(((b,x)=>{n.strokeStyle=b.fontColor,n.fillStyle=b.fontColor;const _=n.measureText(b.text).width,w=a.textAlign(b.textAlign||(b.textAlign=s.textAlign)),k=p+d+_;let S=u.x,C=u.y;a.setWidth(this.width),g?x>0&&S+k+c>this.right&&(C=u.y+=y,u.line++,S=u.x=Zx(o,this.left+c,this.right-i[u.line])):x>0&&C+y>this.bottom&&(S=u.x=S+e[u.line].width+c,u.line++,C=u.y=Zx(o,this.top+v+c,this.bottom-e[u.line].height));if(function(t,e,i){if(isNaN(p)||p<=0||isNaN(f)||f<0)return;n.save();const o=Qb(i.lineWidth,1);if(n.fillStyle=Qb(i.fillStyle,r),n.lineCap=Qb(i.lineCap,"butt"),n.lineDashOffset=Qb(i.lineDashOffset,0),n.lineJoin=Qb(i.lineJoin,"miter"),n.lineWidth=o,n.strokeStyle=Qb(i.strokeStyle,r),n.setLineDash(Qb(i.lineDash,[])),s.usePointStyle){const r={radius:f*Math.SQRT2/2,pointStyle:i.pointStyle,rotation:i.rotation,borderWidth:o},l=a.xPlus(t,p/2);__(n,r,l,e+d,s.pointStyleWidth&&p)}else{const s=e+Math.max((h-f)/2,0),r=a.leftForLtr(t,p),l=R_(i.borderRadius);n.beginPath(),Object.values(l).some((t=>0!==t))?P_(n,{x:r,y:s,w:p,h:f,radius:l}):n.rect(r,s,p,f),n.fill(),0!==o&&n.stroke()}n.restore()}(a.x(S),C,b),S=((t,e,i,n)=>t===(n?"left":"right")?i:"center"===t?(e+i)/2:e)(w,S+p+d,g?S+k:this.right,t.rtl),function(t,e,i){T_(n,i.text,t,e+m/2,l,{strikethrough:i.hidden,textAlign:a.textAlign(i.textAlign)})}(a.x(S),C,b),g)u.x+=k+c;else if("string"!=typeof b.text){const t=l.lineHeight;u.y+=$C(b,t)+c}else u.y+=y})),Aw(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=B_(e.font),n=N_(e.padding);if(!e.display)return;const o=Cw(t.rtl,this.left,this.width),s=this.ctx,r=e.position,a=i.size/2,l=n.top+a;let c,h=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),c=this.top+l,h=Zx(t.align,h,this.right-d);else{const e=this.columnSizes.reduce(((t,e)=>Math.max(t,e.height)),0);c=l+Zx(t.align,this.top,this.bottom-e-t.labels.padding-this._computeTitleHeight())}const u=Zx(r,h,h+d);s.textAlign=o.textAlign(Gx(r)),s.textBaseline="middle",s.strokeStyle=e.color,s.fillStyle=e.color,s.font=i.string,T_(s,e.text,u,c,i)}_computeTitleHeight(){const t=this.options.title,e=B_(t.font),i=N_(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,n,o;if(Nx(t,this.left,this.right)&&Nx(e,this.top,this.bottom))for(o=this.legendHitBoxes,i=0;i<o.length;++i)if(n=o[i],Nx(t,n.left,n.left+n.width)&&Nx(e,n.top,n.top+n.height))return this.legendItems[i];return null}handleEvent(t){const e=this.options;if(!function(t,e){if(("mousemove"===t||"mouseout"===t)&&(e.onHover||e.onLeave))return!0;if(e.onClick&&("click"===t||"mouseup"===t))return!0;return!1}(t.type,e))return;const i=this._getLegendItemAt(t.x,t.y);if("mousemove"===t.type||"mouseout"===t.type){const n=this._hoveredItem,o=((t,e)=>null!==t&&null!==e&&t.datasetIndex===e.datasetIndex&&t.index===e.index)(n,i);n&&!o&&tx(e.onLeave,[t,n,this],this),this._hoveredItem=i,i&&!o&&tx(e.onHover,[t,i,this],this)}else i&&tx(e.onClick,[t,i,this],this)}}function $C(t,e){return e*(t.text?t.text.length:0)}var zC={id:"legend",_element:LC,start(t,e,i){const n=t.legend=new LC({ctx:t.ctx,options:i,chart:t});Dk.configure(t,n,i),Dk.addBox(t,n)},stop(t){Dk.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,i){const n=t.legend;Dk.configure(t,n,i),n.options=i},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,i){const n=e.datasetIndex,o=i.chart;o.isDatasetVisible(n)?(o.hide(n),e.hidden=!0):(o.show(n),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:i,pointStyle:n,textAlign:o,color:s,useBorderRadius:r,borderRadius:a}}=t.legend.options;return t._getSortedDatasetMetas().map((t=>{const l=t.controller.getStyle(i?0:void 0),c=N_(l.borderWidth);return{text:e[t.index].label,fillStyle:l.backgroundColor,fontColor:s,hidden:!t.visible,lineCap:l.borderCapStyle,lineDash:l.borderDash,lineDashOffset:l.borderDashOffset,lineJoin:l.borderJoinStyle,lineWidth:(c.width+c.height)/4,strokeStyle:l.borderColor,pointStyle:n||l.pointStyle,rotation:l.rotation,textAlign:o||l.textAlign,borderRadius:r&&(a||l.borderRadius),datasetIndex:t.index}}),this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class RC extends Xk{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const i=this.options;if(this.left=0,this.top=0,!i.display)return void(this.width=this.height=this.right=this.bottom=0);this.width=this.right=t,this.height=this.bottom=e;const n=Zb(i.text)?i.text.length:1;this._padding=N_(i.padding);const o=n*B_(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){const{top:e,left:i,bottom:n,right:o,options:s}=this,r=s.align;let a,l,c,h=0;return this.isHorizontal()?(l=Zx(r,i,o),c=e+t,a=o-i):("left"===s.position?(l=i+t,c=Zx(r,n,e),h=-.5*mx):(l=o-t,c=Zx(r,e,n),h=.5*mx),a=n-e),{titleX:l,titleY:c,maxWidth:a,rotation:h}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=B_(e.font),n=i.lineHeight/2+this._padding.top,{titleX:o,titleY:s,maxWidth:r,rotation:a}=this._drawArgs(n);T_(t,e.text,0,0,i,{color:e.color,maxWidth:r,rotation:a,textAlign:Gx(e.align),textBaseline:"middle",translation:[o,s]})}}var NC={id:"title",_element:RC,start(t,e,i){!function(t,e){const i=new RC({ctx:t.ctx,options:e,chart:t});Dk.configure(t,i,e),Dk.addBox(t,i),t.titleBlock=i}(t,i)},stop(t){const e=t.titleBlock;Dk.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){const n=t.titleBlock;Dk.configure(t,n,i),n.options=i},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const BC=new WeakMap;var jC={id:"subtitle",start(t,e,i){const n=new RC({ctx:t.ctx,options:i,chart:t});Dk.configure(t,n,i),Dk.addBox(t,n),BC.set(t,n)},stop(t){Dk.removeBox(t,BC.get(t)),BC.delete(t)},beforeUpdate(t,e,i){const n=BC.get(t);Dk.configure(t,n,i),n.options=i},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const FC={average(t){if(!t.length)return!1;let e,i,n=new Set,o=0,s=0;for(e=0,i=t.length;e<i;++e){const i=t[e].element;if(i&&i.hasValue()){const t=i.tooltipPosition();n.add(t.x),o+=t.y,++s}}if(0===s||0===n.size)return!1;const r=[...n].reduce(((t,e)=>t+e))/n.size;return{x:r,y:o/s}},nearest(t,e){if(!t.length)return!1;let i,n,o,s=e.x,r=e.y,a=Number.POSITIVE_INFINITY;for(i=0,n=t.length;i<n;++i){const n=t[i].element;if(n&&n.hasValue()){const t=Ix(e,n.getCenterPoint());t<a&&(a=t,o=n)}}if(o){const t=o.tooltipPosition();s=t.x,r=t.y}return{x:s,y:r}}};function qC(t,e){return e&&(Zb(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function VC(t){return("string"==typeof t||t instanceof String)&&t.indexOf("\n")>-1?t.split("\n"):t}function HC(t,e){const{element:i,datasetIndex:n,index:o}=e,s=t.getDatasetMeta(n).controller,{label:r,value:a}=s.getLabelAndValue(o);return{chart:t,label:r,parsed:s.getParsed(o),raw:t.data.datasets[n].data[o],formattedValue:a,dataset:s.getDataset(),dataIndex:o,datasetIndex:n,element:i}}function UC(t,e){const i=t.chart.ctx,{body:n,footer:o,title:s}=t,{boxWidth:r,boxHeight:a}=e,l=B_(e.bodyFont),c=B_(e.titleFont),h=B_(e.footerFont),d=s.length,u=o.length,p=n.length,f=N_(e.padding);let m=f.height,g=0,v=n.reduce(((t,e)=>t+e.before.length+e.lines.length+e.after.length),0);if(v+=t.beforeBody.length+t.afterBody.length,d&&(m+=d*c.lineHeight+(d-1)*e.titleSpacing+e.titleMarginBottom),v){m+=p*(e.displayColors?Math.max(a,l.lineHeight):l.lineHeight)+(v-p)*l.lineHeight+(v-1)*e.bodySpacing}u&&(m+=e.footerMarginTop+u*h.lineHeight+(u-1)*e.footerSpacing);let y=0;const b=function(t){g=Math.max(g,i.measureText(t).width+y)};return i.save(),i.font=c.string,ex(t.title,b),i.font=l.string,ex(t.beforeBody.concat(t.afterBody),b),y=e.displayColors?r+2+e.boxPadding:0,ex(n,(t=>{ex(t.before,b),ex(t.lines,b),ex(t.after,b)})),y=0,i.font=h.string,ex(t.footer,b),i.restore(),g+=f.width,{width:g,height:m}}function WC(t,e,i,n){const{x:o,width:s}=i,{width:r,chartArea:{left:a,right:l}}=t;let c="center";return"center"===n?c=o<=(a+l)/2?"left":"right":o<=s/2?c="left":o>=r-s/2&&(c="right"),function(t,e,i,n){const{x:o,width:s}=n,r=i.caretSize+i.caretPadding;return"left"===t&&o+s+r>e.width||"right"===t&&o-s-r<0||void 0}(c,t,e,i)&&(c="center"),c}function GC(t,e,i){const n=i.yAlign||e.yAlign||function(t,e){const{y:i,height:n}=e;return i<n/2?"top":i>t.height-n/2?"bottom":"center"}(t,i);return{xAlign:i.xAlign||e.xAlign||WC(t,e,i,n),yAlign:n}}function ZC(t,e,i,n){const{caretSize:o,caretPadding:s,cornerRadius:r}=t,{xAlign:a,yAlign:l}=i,c=o+s,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:p}=R_(r);let f=function(t,e){let{x:i,width:n}=t;return"right"===e?i-=n:"center"===e&&(i-=n/2),i}(e,a);const m=function(t,e,i){let{y:n,height:o}=t;return"top"===e?n+=i:n-="bottom"===e?o+i:o/2,n}(e,l,c);return"center"===l?"left"===a?f+=c:"right"===a&&(f-=c):"left"===a?f-=Math.max(h,u)+o:"right"===a&&(f+=Math.max(d,p)+o),{x:Rx(f,0,n.width-e.width),y:Rx(m,0,n.height-e.height)}}function YC(t,e,i){const n=N_(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-n.right:t.x+n.left}function XC(t){return qC([],VC(t))}function KC(t,e){const i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}const QC={beforeTitle:Ub,title(t){if(t.length>0){const e=t[0],i=e.chart.data.labels,n=i?i.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(n>0&&e.dataIndex<n)return i[e.dataIndex]}return""},afterTitle:Ub,beforeBody:Ub,beforeLabel:Ub,label(t){if(this&&this.options&&"dataset"===this.options.mode)return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const i=t.formattedValue;return Gb(i)||(e+=i),e},labelColor(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:Ub,afterBody:Ub,beforeFooter:Ub,footer:Ub,afterFooter:Ub};function JC(t,e,i,n){const o=t[e].call(i,n);return void 0===o?QC[e].call(i,n):o}class tE extends Xk{static positioners=FC;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),n=i.enabled&&e.options.animation&&i.animations,o=new jw(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=(t=this.chart.getContext(),e=this,i=this._tooltipItems,F_(t,{tooltip:e,tooltipItems:i,type:"tooltip"})));var t,e,i}getTitle(t,e){const{callbacks:i}=e,n=JC(i,"beforeTitle",this,t),o=JC(i,"title",this,t),s=JC(i,"afterTitle",this,t);let r=[];return r=qC(r,VC(n)),r=qC(r,VC(o)),r=qC(r,VC(s)),r}getBeforeBody(t,e){return XC(JC(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:i}=e,n=[];return ex(t,(t=>{const e={before:[],lines:[],after:[]},o=KC(i,t);qC(e.before,VC(JC(o,"beforeLabel",this,t))),qC(e.lines,JC(o,"label",this,t)),qC(e.after,VC(JC(o,"afterLabel",this,t))),n.push(e)})),n}getAfterBody(t,e){return XC(JC(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:i}=e,n=JC(i,"beforeFooter",this,t),o=JC(i,"footer",this,t),s=JC(i,"afterFooter",this,t);let r=[];return r=qC(r,VC(n)),r=qC(r,VC(o)),r=qC(r,VC(s)),r}_createItems(t){const e=this._active,i=this.chart.data,n=[],o=[],s=[];let r,a,l=[];for(r=0,a=e.length;r<a;++r)l.push(HC(this.chart,e[r]));return t.filter&&(l=l.filter(((e,n,o)=>t.filter(e,n,o,i)))),t.itemSort&&(l=l.sort(((e,n)=>t.itemSort(e,n,i)))),ex(l,(e=>{const i=KC(t.callbacks,e);n.push(JC(i,"labelColor",this,e)),o.push(JC(i,"labelPointStyle",this,e)),s.push(JC(i,"labelTextColor",this,e))})),this.labelColors=n,this.labelPointStyles=o,this.labelTextColors=s,this.dataPoints=l,l}update(t,e){const i=this.options.setContext(this.getContext()),n=this._active;let o,s=[];if(n.length){const t=FC[i.position].call(this,n,this._eventPosition);s=this._createItems(i),this.title=this.getTitle(s,i),this.beforeBody=this.getBeforeBody(s,i),this.body=this.getBody(s,i),this.afterBody=this.getAfterBody(s,i),this.footer=this.getFooter(s,i);const e=this._size=UC(this,i),r=Object.assign({},t,e),a=GC(this.chart,i,r),l=ZC(i,r,a,this.chart);this.xAlign=a.xAlign,this.yAlign=a.yAlign,o={opacity:1,x:l.x,y:l.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(o={opacity:0});this._tooltipItems=s,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,n){const o=this.getCaretPosition(t,i,n);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,i){const{xAlign:n,yAlign:o}=this,{caretSize:s,cornerRadius:r}=i,{topLeft:a,topRight:l,bottomLeft:c,bottomRight:h}=R_(r),{x:d,y:u}=t,{width:p,height:f}=e;let m,g,v,y,b,x;return"center"===o?(b=u+f/2,"left"===n?(m=d,g=m-s,y=b+s,x=b-s):(m=d+p,g=m+s,y=b-s,x=b+s),v=m):(g="left"===n?d+Math.max(a,c)+s:"right"===n?d+p-Math.max(l,h)-s:this.caretX,"top"===o?(y=u,b=y-s,m=g-s,v=g+s):(y=u+f,b=y+s,m=g+s,v=g-s),x=y),{x1:m,x2:g,x3:v,y1:y,y2:b,y3:x}}drawTitle(t,e,i){const n=this.title,o=n.length;let s,r,a;if(o){const l=Cw(i.rtl,this.x,this.width);for(t.x=YC(this,i.titleAlign,i),e.textAlign=l.textAlign(i.titleAlign),e.textBaseline="middle",s=B_(i.titleFont),r=i.titleSpacing,e.fillStyle=i.titleColor,e.font=s.string,a=0;a<o;++a)e.fillText(n[a],l.x(t.x),t.y+s.lineHeight/2),t.y+=s.lineHeight+r,a+1===o&&(t.y+=i.titleMarginBottom-r)}}_drawColorBox(t,e,i,n,o){const s=this.labelColors[i],r=this.labelPointStyles[i],{boxHeight:a,boxWidth:l}=o,c=B_(o.bodyFont),h=YC(this,"left",o),d=n.x(h),u=a<c.lineHeight?(c.lineHeight-a)/2:0,p=e.y+u;if(o.usePointStyle){const e={radius:Math.min(l,a)/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:1},i=n.leftForLtr(d,l)+l/2,c=p+a/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,x_(t,e,i,c),t.strokeStyle=s.borderColor,t.fillStyle=s.backgroundColor,x_(t,e,i,c)}else{t.lineWidth=Yb(s.borderWidth)?Math.max(...Object.values(s.borderWidth)):s.borderWidth||1,t.strokeStyle=s.borderColor,t.setLineDash(s.borderDash||[]),t.lineDashOffset=s.borderDashOffset||0;const e=n.leftForLtr(d,l),i=n.leftForLtr(n.xPlus(d,1),l-2),r=R_(s.borderRadius);Object.values(r).some((t=>0!==t))?(t.beginPath(),t.fillStyle=o.multiKeyBackground,P_(t,{x:e,y:p,w:l,h:a,radius:r}),t.fill(),t.stroke(),t.fillStyle=s.backgroundColor,t.beginPath(),P_(t,{x:i,y:p+1,w:l-2,h:a-2,radius:r}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(e,p,l,a),t.strokeRect(e,p,l,a),t.fillStyle=s.backgroundColor,t.fillRect(i,p+1,l-2,a-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:n}=this,{bodySpacing:o,bodyAlign:s,displayColors:r,boxHeight:a,boxWidth:l,boxPadding:c}=i,h=B_(i.bodyFont);let d=h.lineHeight,u=0;const p=Cw(i.rtl,this.x,this.width),f=function(i){e.fillText(i,p.x(t.x+u),t.y+d/2),t.y+=d+o},m=p.textAlign(s);let g,v,y,b,x,_,w;for(e.textAlign=s,e.textBaseline="middle",e.font=h.string,t.x=YC(this,m,i),e.fillStyle=i.bodyColor,ex(this.beforeBody,f),u=r&&"right"!==m?"center"===s?l/2+c:l+2+c:0,b=0,_=n.length;b<_;++b){for(g=n[b],v=this.labelTextColors[b],e.fillStyle=v,ex(g.before,f),y=g.lines,r&&y.length&&(this._drawColorBox(e,t,b,p,i),d=Math.max(h.lineHeight,a)),x=0,w=y.length;x<w;++x)f(y[x]),d=h.lineHeight;ex(g.after,f)}u=0,d=h.lineHeight,ex(this.afterBody,f),t.y-=o}drawFooter(t,e,i){const n=this.footer,o=n.length;let s,r;if(o){const a=Cw(i.rtl,this.x,this.width);for(t.x=YC(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=a.textAlign(i.footerAlign),e.textBaseline="middle",s=B_(i.footerFont),e.fillStyle=i.footerColor,e.font=s.string,r=0;r<o;++r)e.fillText(n[r],a.x(t.x),t.y+s.lineHeight/2),t.y+=s.lineHeight+i.footerSpacing}}drawBackground(t,e,i,n){const{xAlign:o,yAlign:s}=this,{x:r,y:a}=t,{width:l,height:c}=i,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:p}=R_(n.cornerRadius);e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,e.lineWidth=n.borderWidth,e.beginPath(),e.moveTo(r+h,a),"top"===s&&this.drawCaret(t,e,i,n),e.lineTo(r+l-d,a),e.quadraticCurveTo(r+l,a,r+l,a+d),"center"===s&&"right"===o&&this.drawCaret(t,e,i,n),e.lineTo(r+l,a+c-p),e.quadraticCurveTo(r+l,a+c,r+l-p,a+c),"bottom"===s&&this.drawCaret(t,e,i,n),e.lineTo(r+u,a+c),e.quadraticCurveTo(r,a+c,r,a+c-u),"center"===s&&"left"===o&&this.drawCaret(t,e,i,n),e.lineTo(r,a+h),e.quadraticCurveTo(r,a,r+h,a),e.closePath(),e.fill(),n.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,n=i&&i.x,o=i&&i.y;if(n||o){const i=FC[t.position].call(this,this._active,this._eventPosition);if(!i)return;const s=this._size=UC(this,t),r=Object.assign({},i,this._size),a=GC(e,t,r),l=ZC(t,r,a,e);n._to===l.x&&o._to===l.y||(this.xAlign=a.xAlign,this.yAlign=a.yAlign,this.width=s.width,this.height=s.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,l))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const n={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const s=N_(e.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&r&&(t.save(),t.globalAlpha=i,this.drawBackground(o,t,n,e),Ew(t,e.textDirection),o.y+=s.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),Aw(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,n=t.map((({datasetIndex:t,index:e})=>{const i=this.chart.getDatasetMeta(t);if(!i)throw new Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:i.data[e],index:e}})),o=!ix(i,n),s=this._positionChanged(n,e);(o||s)&&(this._active=n,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const n=this.options,o=this._active||[],s=this._getActiveElements(t,o,e,i),r=this._positionChanged(s,t),a=e||!ix(s,o)||r;return a&&(this._active=s,(n.enabled||n.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),a}_getActiveElements(t,e,i,n){const o=this.options;if("mouseout"===t.type)return[];if(!n)return e.filter((t=>this.chart.data.datasets[t.datasetIndex]&&void 0!==this.chart.getDatasetMeta(t.datasetIndex).controller.getParsed(t.index)));const s=this.chart.getElementsAtEventForMode(t,o.mode,o,i);return o.reverse&&s.reverse(),s}_positionChanged(t,e){const{caretX:i,caretY:n,options:o}=this,s=FC[o.position].call(this,t,e);return!1!==s&&(i!==s.x||n!==s.y)}}var eE={id:"tooltip",_element:tE,positioners:FC,afterInit(t,e,i){i&&(t.tooltip=new tE({chart:t,options:i}))},beforeUpdate(t,e,i){t.tooltip&&t.tooltip.initialize(i)},reset(t,e,i){t.tooltip&&t.tooltip.initialize(i)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const i={tooltip:e};if(!1===t.notifyPlugins("beforeTooltipDraw",{...i,cancelable:!0}))return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",i)}},afterEvent(t,e){if(t.tooltip){const i=e.replay;t.tooltip.handleEvent(e.event,i,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:QC},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},iE=Object.freeze({__proto__:null,Colors:uC,Decimation:mC,Filler:DC,Legend:zC,SubTitle:jC,Title:NC,Tooltip:eE});function nE(t,e,i,n){const o=t.indexOf(e);if(-1===o)return((t,e,i,n)=>("string"==typeof e?(i=t.push(e)-1,n.unshift({index:i,label:e})):isNaN(e)&&(i=null),i))(t,e,i,n);return o!==t.lastIndexOf(e)?i:o}function oE(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}function sE(t,e){const i=[],{bounds:n,step:o,min:s,max:r,precision:a,count:l,maxTicks:c,maxDigits:h,includeBounds:d}=t,u=o||1,p=c-1,{min:f,max:m}=e,g=!Gb(s),v=!Gb(r),y=!Gb(l),b=(m-f)/(h+1);let x,_,w,k,S=Ex((m-f)/p/u)*u;if(S<1e-14&&!g&&!v)return[{value:f},{value:m}];k=Math.ceil(m/S)-Math.floor(f/S),k>p&&(S=Ex(k*S/p/u)*u),Gb(a)||(x=Math.pow(10,a),S=Math.ceil(S*x)/x),"ticks"===n?(_=Math.floor(f/S)*S,w=Math.ceil(m/S)*S):(_=f,w=m),g&&v&&o&&function(t,e){const i=Math.round(t);return i-e<=t&&i+e>=t}((r-s)/o,S/1e3)?(k=Math.round(Math.min((r-s)/S,c)),S=(r-s)/k,_=s,w=r):y?(_=g?s:_,w=v?r:w,k=l-1,S=(w-_)/k):(k=(w-_)/S,k=Cx(k,Math.round(k),S/1e3)?Math.round(k):Math.ceil(k));const C=Math.max(Ox(S),Ox(_));x=Math.pow(10,Gb(a)?C:a),_=Math.round(_*x)/x,w=Math.round(w*x)/x;let E=0;for(g&&(d&&_!==s?(i.push({value:s}),_<s&&E++,Cx(Math.round((_+E*S)*x)/x,s,rE(s,b,t))&&E++):_<s&&E++);E<k;++E){const t=Math.round((_+E*S)*x)/x;if(v&&t>r)break;i.push({value:t})}return v&&d&&w!==r?i.length&&Cx(i[i.length-1].value,r,rE(r,b,t))?i[i.length-1].value=r:i.push({value:r}):v&&w!==r||i.push({value:w}),i}function rE(t,e,{horizontal:i,minRotation:n}){const o=Tx(n),s=(i?Math.sin(o):Math.cos(o))||.001,r=.75*e*(""+t).length;return Math.min(e/s,r)}class aE extends rS{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return Gb(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:n,max:o}=this;const s=t=>n=e?n:t,r=t=>o=i?o:t;if(t){const t=Sx(n),e=Sx(o);t<0&&e<0?r(0):t>0&&e>0&&s(0)}if(n===o){let e=0===o?1:Math.abs(.05*o);r(o+e),t||s(n-e)}this.min=n,this.max=o}getTickLimit(){const t=this.options.ticks;let e,{maxTicksLimit:i,stepSize:n}=t;return n?(e=Math.ceil(this.max/n)-Math.floor(this.min/n)+1,e>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${n} would result generating up to ${e} ticks. Limiting to 1000.`),e=1e3)):(e=this.computeTickLimit(),i=i||11),i&&(e=Math.min(i,e)),e}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const n=sE({maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:!1!==e.includeBounds},this._range||this);return"ticks"===t.bounds&&Mx(n,this,"value"),t.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const n=(i-e)/Math.max(t.length-1,1)/2;e-=n,i+=n}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return a_(t,this.chart.options.locale,this.options.ticks.format)}}class lE extends aE{static id="linear";static defaults={ticks:{callback:c_.formatters.numeric}};determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=Xb(t)?t:0,this.max=Xb(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=Tx(this.options.ticks.minRotation),n=(t?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/n))}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const cE=t=>Math.floor(kx(t)),hE=(t,e)=>Math.pow(10,cE(t)+e);function dE(t){return 1===t/Math.pow(10,cE(t))}function uE(t,e,i){const n=Math.pow(10,i),o=Math.floor(t/n);return Math.ceil(e/n)-o}function pE(t,{min:e,max:i}){e=Kb(t.min,e);const n=[],o=cE(e);let s=function(t,e){let i=cE(e-t);for(;uE(t,e,i)>10;)i++;for(;uE(t,e,i)<10;)i--;return Math.min(i,cE(t))}(e,i),r=s<0?Math.pow(10,Math.abs(s)):1;const a=Math.pow(10,s),l=o>s?Math.pow(10,o):0,c=Math.round((e-l)*r)/r,h=Math.floor((e-l)/a/10)*a*10;let d=Math.floor((c-h)/Math.pow(10,s)),u=Kb(t.min,Math.round((l+h+d*Math.pow(10,s))*r)/r);for(;u<i;)n.push({value:u,major:dE(u),significand:d}),d>=10?d=d<15?15:20:d++,d>=20&&(s++,d=2,r=s>=0?1:r),u=Math.round((l+h+d*Math.pow(10,s))*r)/r;const p=Kb(t.max,u);return n.push({value:p,major:dE(p),significand:d}),n}class fE extends rS{static id="logarithmic";static defaults={ticks:{callback:c_.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=aE.prototype.parse.apply(this,[t,e]);if(0!==i)return Xb(i)&&i>0?i:null;this._zero=!0}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=Xb(t)?Math.max(0,t):null,this.max=Xb(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!Xb(this._userMin)&&(this.min=t===hE(this.min,0)?hE(this.min,-1):hE(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,n=this.max;const o=e=>i=t?i:e,s=t=>n=e?n:t;i===n&&(i<=0?(o(1),s(10)):(o(hE(i,-1)),s(hE(n,1)))),i<=0&&o(hE(n,-1)),n<=0&&s(hE(i,1)),this.min=i,this.max=n}buildTicks(){const t=this.options,e=pE({min:this._userMin,max:this._userMax},this);return"ticks"===t.bounds&&Mx(e,this,"value"),t.reverse?(e.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),e}getLabelForValue(t){return void 0===t?"0":a_(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=kx(t),this._valueRange=kx(this.max)-kx(t)}getPixelForValue(t){return void 0!==t&&0!==t||(t=this.min),null===t||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(kx(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}function mE(t){const e=t.ticks;if(e.display&&t.display){const t=N_(e.backdropPadding);return Qb(e.font&&e.font.size,m_.font.size)+t.height}return 0}function gE(t,e,i,n,o){return t===n||t===o?{start:e-i/2,end:e+i/2}:t<n||t>o?{start:e-i,end:e}:{start:e,end:e+i}}function vE(t){const e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},i=Object.assign({},e),n=[],o=[],s=t._pointLabels.length,r=t.options.pointLabels,a=r.centerPointLabels?mx/s:0;for(let d=0;d<s;d++){const s=r.setContext(t.getPointLabelContext(d));o[d]=s.padding;const u=t.getPointPosition(d,t.drawingArea+o[d],a),p=B_(s.font),f=(l=t.ctx,c=p,h=Zb(h=t._pointLabels[d])?h:[h],{w:v_(l,c.string,h),h:h.length*c.lineHeight});n[d]=f;const m=$x(t.getIndexAngle(d)+a),g=Math.round(Px(m));yE(i,e,m,gE(g,u.x,f.w,0,180),gE(g,u.y,f.h,90,270))}var l,c,h;t.setCenterPoint(e.l-i.l,i.r-e.r,e.t-i.t,i.b-e.b),t._pointLabelItems=function(t,e,i){const n=[],o=t._pointLabels.length,s=t.options,{centerPointLabels:r,display:a}=s.pointLabels,l={extra:mE(s)/2,additionalAngle:r?mx/o:0};let c;for(let s=0;s<o;s++){l.padding=i[s],l.size=e[s];const o=bE(t,s,l);n.push(o),"auto"===a&&(o.visible=xE(o,c),o.visible&&(c=o))}return n}(t,n,o)}function yE(t,e,i,n,o){const s=Math.abs(Math.sin(i)),r=Math.abs(Math.cos(i));let a=0,l=0;n.start<e.l?(a=(e.l-n.start)/s,t.l=Math.min(t.l,e.l-a)):n.end>e.r&&(a=(n.end-e.r)/s,t.r=Math.max(t.r,e.r+a)),o.start<e.t?(l=(e.t-o.start)/r,t.t=Math.min(t.t,e.t-l)):o.end>e.b&&(l=(o.end-e.b)/r,t.b=Math.max(t.b,e.b+l))}function bE(t,e,i){const n=t.drawingArea,{extra:o,additionalAngle:s,padding:r,size:a}=i,l=t.getPointPosition(e,n+o+r,s),c=Math.round(Px($x(l.angle+xx))),h=function(t,e,i){90===i||270===i?t-=e/2:(i>270||i<90)&&(t-=e);return t}(l.y,a.h,c),d=function(t){if(0===t||180===t)return"center";if(t<180)return"left";return"right"}(c),u=function(t,e,i){"right"===i?t-=e:"center"===i&&(t-=e/2);return t}(l.x,a.w,d);return{visible:!0,x:l.x,y:h,textAlign:d,left:u,top:h,right:u+a.w,bottom:h+a.h}}function xE(t,e){if(!e)return!0;const{left:i,top:n,right:o,bottom:s}=t;return!(w_({x:i,y:n},e)||w_({x:i,y:s},e)||w_({x:o,y:n},e)||w_({x:o,y:s},e))}function _E(t,e,i){const{left:n,top:o,right:s,bottom:r}=i,{backdropColor:a}=e;if(!Gb(a)){const i=R_(e.borderRadius),l=N_(e.backdropPadding);t.fillStyle=a;const c=n-l.left,h=o-l.top,d=s-n+l.width,u=r-o+l.height;Object.values(i).some((t=>0!==t))?(t.beginPath(),P_(t,{x:c,y:h,w:d,h:u,radius:i}),t.fill()):t.fillRect(c,h,d,u)}}function wE(t,e,i,n){const{ctx:o}=t;if(i)o.arc(t.xCenter,t.yCenter,e,0,gx);else{let i=t.getPointPosition(0,e);o.moveTo(i.x,i.y);for(let s=1;s<n;s++)i=t.getPointPosition(s,e),o.lineTo(i.x,i.y)}}class kE extends aE{static id="radialLinear";static defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:c_.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:t=>t,padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=N_(mE(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!1);this.min=Xb(t)&&!isNaN(t)?t:0,this.max=Xb(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/mE(this.options))}generateTickLabels(t){aE.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map(((t,e)=>{const i=tx(this.options.pointLabels.callback,[t,e],this);return i||0===i?i:""})).filter(((t,e)=>this.chart.getDataVisibility(e)))}fit(){const t=this.options;t.display&&t.pointLabels.display?vE(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,n){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,n))}getIndexAngle(t){return $x(t*(gx/(this._pointLabels.length||1))+Tx(this.options.startAngle||0))}getDistanceFromCenterForValue(t){if(Gb(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(Gb(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t<e.length){const i=e[t];return function(t,e,i){return F_(t,{label:i,index:e,type:"pointLabel"})}(this.getContext(),t,i)}}getPointPosition(t,e,i=0){const n=this.getIndexAngle(t)-xx+i;return{x:Math.cos(n)*e+this.xCenter,y:Math.sin(n)*e+this.yCenter,angle:n}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:e,top:i,right:n,bottom:o}=this._pointLabelItems[t];return{left:e,top:i,right:n,bottom:o}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const i=this.ctx;i.save(),i.beginPath(),wE(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){const t=this.ctx,e=this.options,{angleLines:i,grid:n,border:o}=e,s=this._pointLabels.length;let r,a,l;if(e.pointLabels.display&&function(t,e){const{ctx:i,options:{pointLabels:n}}=t;for(let o=e-1;o>=0;o--){const e=t._pointLabelItems[o];if(!e.visible)continue;const s=n.setContext(t.getPointLabelContext(o));_E(i,s,e);const r=B_(s.font),{x:a,y:l,textAlign:c}=e;T_(i,t._pointLabels[o],a,l+r.lineHeight/2,r,{color:s.color,textAlign:c,textBaseline:"middle"})}}(this,s),n.display&&this.ticks.forEach(((t,e)=>{if(0!==e||0===e&&this.min<0){a=this.getDistanceFromCenterForValue(t.value);const i=this.getContext(e),r=n.setContext(i),l=o.setContext(i);!function(t,e,i,n,o){const s=t.ctx,r=e.circular,{color:a,lineWidth:l}=e;!r&&!n||!a||!l||i<0||(s.save(),s.strokeStyle=a,s.lineWidth=l,s.setLineDash(o.dash||[]),s.lineDashOffset=o.dashOffset,s.beginPath(),wE(t,i,r,n),s.closePath(),s.stroke(),s.restore())}(this,r,a,s,l)}})),i.display){for(t.save(),r=s-1;r>=0;r--){const n=i.setContext(this.getPointLabelContext(r)),{color:o,lineWidth:s}=n;s&&o&&(t.lineWidth=s,t.strokeStyle=o,t.setLineDash(n.borderDash),t.lineDashOffset=n.borderDashOffset,a=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),l=this.getPointPosition(r,a),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const n=this.getIndexAngle(0);let o,s;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(n),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach(((n,r)=>{if(0===r&&this.min>=0&&!e.reverse)return;const a=i.setContext(this.getContext(r)),l=B_(a.font);if(o=this.getDistanceFromCenterForValue(this.ticks[r].value),a.showLabelBackdrop){t.font=l.string,s=t.measureText(n.label).width,t.fillStyle=a.backdropColor;const e=N_(a.backdropPadding);t.fillRect(-s/2-e.left,-o-l.size/2-e.top,s+e.width,l.size+e.height)}T_(t,n.label,0,-o,l,{color:a.color,strokeColor:a.textStrokeColor,strokeWidth:a.textStrokeWidth})})),t.restore()}drawTitle(){}}const SE={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},CE=Object.keys(SE);function EE(t,e){return t-e}function AE(t,e){if(Gb(e))return null;const i=t._adapter,{parser:n,round:o,isoWeekday:s}=t._parseOpts;let r=e;return"function"==typeof n&&(r=n(r)),Xb(r)||(r="string"==typeof n?i.parse(r,n):i.parse(r)),null===r?null:(o&&(r="week"!==o||!Ax(s)&&!0!==s?i.startOf(r,o):i.startOf(r,"isoWeek",s)),+r)}function ME(t,e,i,n){const o=CE.length;for(let s=CE.indexOf(t);s<o-1;++s){const t=SE[CE[s]],o=t.steps?t.steps:Number.MAX_SAFE_INTEGER;if(t.common&&Math.ceil((i-e)/(o*t.size))<=n)return CE[s]}return CE[o-1]}function TE(t,e,i){if(i){if(i.length){const{lo:n,hi:o}=Bx(i,e);t[i[n]>=e?i[n]:i[o]]=!0}}else t[e]=!0}function PE(t,e,i){const n=[],o={},s=e.length;let r,a;for(r=0;r<s;++r)a=e[r],o[a]=r,n.push({value:a,major:!1});return 0!==s&&i?function(t,e,i,n){const o=t._adapter,s=+o.startOf(e[0].value,n),r=e[e.length-1].value;let a,l;for(a=s;a<=r;a=+o.add(a,1,n))l=i[a],l>=0&&(e[l].major=!0);return e}(t,n,o,i):n}class OE extends rS{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){const i=t.time||(t.time={}),n=this._adapter=new uk._date(t.adapters.date);n.init(e),ax(i.displayFormats,n.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return void 0===t?null:AE(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,i=t.time.unit||"day";let{min:n,max:o,minDefined:s,maxDefined:r}=this.getUserBounds();function a(t){s||isNaN(t.min)||(n=Math.min(n,t.min)),r||isNaN(t.max)||(o=Math.max(o,t.max))}s&&r||(a(this._getLabelBounds()),"ticks"===t.bounds&&"labels"===t.ticks.source||a(this.getMinMax(!1))),n=Xb(n)&&!isNaN(n)?n:+e.startOf(Date.now(),i),o=Xb(o)&&!isNaN(o)?o:+e.endOf(Date.now(),i)+1,this.min=Math.min(n,o-1),this.max=Math.max(n+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){const t=this.options,e=t.time,i=t.ticks,n="labels"===i.source?this.getLabelTimestamps():this._generate();"ticks"===t.bounds&&n.length&&(this.min=this._userMin||n[0],this.max=this._userMax||n[n.length-1]);const o=this.min,s=function(t,e,i){let n=0,o=t.length;for(;n<o&&t[n]<e;)n++;for(;o>n&&t[o-1]>i;)o--;return n>0||o<t.length?t.slice(n,o):t}(n,o,this.max);return this._unit=e.unit||(i.autoSkip?ME(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):function(t,e,i,n,o){for(let s=CE.length-1;s>=CE.indexOf(i);s--){const i=CE[s];if(SE[i].common&&t._adapter.diff(o,n,i)>=e-1)return i}return CE[i?CE.indexOf(i):0]}(this,s.length,e.minUnit,this.min,this.max)),this._majorUnit=i.major.enabled&&"year"!==this._unit?function(t){for(let e=CE.indexOf(t)+1,i=CE.length;e<i;++e)if(SE[CE[e]].common)return CE[e]}(this._unit):void 0,this.initOffsets(n),t.reverse&&s.reverse(),PE(this,s,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map((t=>+t.value)))}initOffsets(t=[]){let e,i,n=0,o=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),n=1===t.length?1-e:(this.getDecimalForValue(t[1])-e)/2,i=this.getDecimalForValue(t[t.length-1]),o=1===t.length?i:(i-this.getDecimalForValue(t[t.length-2]))/2);const s=t.length<3?.5:.25;n=Rx(n,0,s),o=Rx(o,0,s),this._offsets={start:n,end:o,factor:1/(n+1+o)}}_generate(){const t=this._adapter,e=this.min,i=this.max,n=this.options,o=n.time,s=o.unit||ME(o.minUnit,e,i,this._getLabelCapacity(e)),r=Qb(n.ticks.stepSize,1),a="week"===s&&o.isoWeekday,l=Ax(a)||!0===a,c={};let h,d,u=e;if(l&&(u=+t.startOf(u,"isoWeek",a)),u=+t.startOf(u,l?"day":s),t.diff(i,e,s)>1e5*r)throw new Error(e+" and "+i+" are too far apart with stepSize of "+r+" "+s);const p="data"===n.ticks.source&&this.getDataTimestamps();for(h=u,d=0;h<i;h=+t.add(h,r,s),d++)TE(c,h,p);return h!==i&&"ticks"!==n.bounds&&1!==d||TE(c,h,p),Object.keys(c).sort(EE).map((t=>+t))}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){const i=this.options.time.displayFormats,n=this._unit,o=e||i[n];return this._adapter.format(t,o)}_tickFormatFunction(t,e,i,n){const o=this.options,s=o.ticks.callback;if(s)return tx(s,[t,e,i],this);const r=o.time.displayFormats,a=this._unit,l=this._majorUnit,c=a&&r[a],h=l&&r[l],d=i[e],u=l&&h&&d&&d.major;return this._adapter.format(t,n||(u?h:c))}generateTickLabels(t){let e,i,n;for(e=0,i=t.length;e<i;++e)n=t[e],n.label=this._tickFormatFunction(n.value,e,t)}getDecimalForValue(t){return null===t?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,i=this.ctx.measureText(t).width,n=Tx(this.isHorizontal()?e.maxRotation:e.minRotation),o=Math.cos(n),s=Math.sin(n),r=this._resolveTickFontOptions(0).size;return{w:i*o+r*s,h:i*s+r*o}}_getLabelCapacity(t){const e=this.options.time,i=e.displayFormats,n=i[e.unit]||i.millisecond,o=this._tickFormatFunction(t,0,PE(this,[t],this._majorUnit),n),s=this._getLabelSize(o),r=Math.floor(this.isHorizontal()?this.width/s.w:this.height/s.h)-1;return r>0?r:1}getDataTimestamps(){let t,e,i=this._cache.data||[];if(i.length)return i;const n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(t=0,e=n.length;t<e;++t)i=i.concat(n[t].controller.getAllParsedValues(this));return this._cache.data=this.normalize(i)}getLabelTimestamps(){const t=this._cache.labels||[];let e,i;if(t.length)return t;const n=this.getLabels();for(e=0,i=n.length;e<i;++e)t.push(AE(this,n[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return Hx(t.sort(EE))}}function DE(t,e,i){let n,o,s,r,a=0,l=t.length-1;i?(e>=t[a].pos&&e<=t[l].pos&&({lo:a,hi:l}=jx(t,"pos",e)),({pos:n,time:s}=t[a]),({pos:o,time:r}=t[l])):(e>=t[a].time&&e<=t[l].time&&({lo:a,hi:l}=jx(t,"time",e)),({time:n,pos:s}=t[a]),({time:o,pos:r}=t[l]));const c=o-n;return c?s+(r-s)*(e-n)/c:s}var IE=Object.freeze({__proto__:null,CategoryScale:class extends rS{static id="category";static defaults={ticks:{callback:oE}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const t=this.getLabels();for(const{index:i,label:n}of e)t[i]===n&&t.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(Gb(t))return null;const i=this.getLabels();return((t,e)=>null===t?null:Rx(Math.round(t),0,e))(e=isFinite(e)&&i[e]===t?e:nE(i,t,Qb(e,t),this._addedLabels),i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:n}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(i=0),e||(n=this.getLabels().length-1)),this.min=i,this.max=n}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,n=[];let o=this.getLabels();o=0===t&&e===o.length-1?o:o.slice(t,e+1),this._valueRange=Math.max(o.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let i=t;i<=e;i++)n.push({value:i});return n}getLabelForValue(t){return oE.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return"number"!=typeof t&&(t=this.parse(t)),null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}},LinearScale:lE,LogarithmicScale:fE,RadialLinearScale:kE,TimeScale:OE,TimeSeriesScale:class extends OE{static id="timeseries";static defaults=OE.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=DE(e,this.min),this._tableRange=DE(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,n=[],o=[];let s,r,a,l,c;for(s=0,r=t.length;s<r;++s)l=t[s],l>=e&&l<=i&&n.push(l);if(n.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(s=0,r=n.length;s<r;++s)c=n[s+1],a=n[s-1],l=n[s],Math.round((c+a)/2)!==l&&o.push({time:l,pos:s/(r-1)});return o}_generate(){const t=this.min,e=this.max;let i=super.getDataTimestamps();return i.includes(t)&&i.length||i.splice(0,0,t),i.includes(e)&&1!==i.length||i.push(e),i.sort(((t,e)=>t-e))}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),i=this.getLabelTimestamps();return t=e.length&&i.length?this.normalize(e.concat(i)):e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(DE(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return DE(this._table,i*this._tableRange+this._minPos,!0)}}});const LE=[ck,sC,iE,IE];RS.register(...LE);
|
|
8696
|
+
*/class Fw{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,n){const o=e.listeners[n],s=e.duration;o.forEach((n=>n({chart:t,initial:e.initial,numSteps:s,currentStep:Math.min(i-e.start,s)})))}_refresh(){this._request||(this._running=!0,this._request=Kx.call(window,(()=>{this._update(),this._request=null,this._running&&this._refresh()})))}_update(t=Date.now()){let e=0;this._charts.forEach(((i,n)=>{if(!i.running||!i.items.length)return;const o=i.items;let s,r=o.length-1,a=!1;for(;r>=0;--r)s=o[r],s._active?(s._total>i.duration&&(i.duration=s._total),s.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(n.draw(),this._notify(n,i,t,"progress")),o.length||(i.running=!1,this._notify(n,i,t,"complete"),i.initial=!1),e+=o.length})),this._lastDate=t,0===e&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){e&&e.length&&this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce(((t,e)=>Math.max(t,e._duration)),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!!(e&&e.running&&e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let n=i.length-1;for(;n>=0;--n)i[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var qw=new Fw;const Vw="transparent",Hw={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){const n=l_(t||Vw),o=n.valid&&l_(e||Vw);return o&&o.valid?o.mix(n,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class Uw{constructor(t,e,i,n){const o=e[i];n=W_([t.to,n,o,t.from]);const s=W_([t.from,o,n]);this._active=!0,this._fn=t.fn||Hw[t.type||typeof s],this._easing=r_[t.easing]||r_.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=s,this._to=n,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const n=this._target[this._prop],o=i-this._start,s=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(s,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=W_([t.to,e,n,t.from]),this._from=W_([t.from,n,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,n=this._prop,o=this._from,s=this._loop,r=this._to;let a;if(this._active=o!==r&&(s||e<i),!this._active)return this._target[n]=r,void this._notify(!0);e<0?this._target[n]=o:(a=e/i%2,a=s&&a>1?2-a:a,a=this._easing(Math.min(1,Math.max(0,a))),this._target[n]=this._fn(o,r,a))}wait(){const t=this._promises||(this._promises=[]);return new Promise(((e,i)=>{t.push({res:e,rej:i})}))}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let t=0;t<i.length;t++)i[t][e]()}}class Ww{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!ex(t))return;const e=Object.keys(__.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach((n=>{const o=t[n];if(!ex(o))return;const s={};for(const t of e)s[t]=o[t];(tx(o.properties)&&o.properties||[n]).forEach((t=>{t!==n&&i.has(t)||i.set(t,s)}))}))}_animateOptions(t,e){const i=e.options,n=function(t,e){if(!e)return;let i=t.options;if(!i)return void(t.options=e);i.$shared&&(t.options=i=Object.assign({},i,{$shared:!1,$animations:{}}));return i}(t,i);if(!n)return[];const o=this._createAnimations(n,i);return i.$shared&&function(t,e){const i=[],n=Object.keys(e);for(let e=0;e<n.length;e++){const o=t[n[e]];o&&o.active()&&i.push(o.wait())}return Promise.all(i)}(t.options.$animations,i).then((()=>{t.options=i}),(()=>{})),o}_createAnimations(t,e){const i=this._properties,n=[],o=t.$animations||(t.$animations={}),s=Object.keys(e),r=Date.now();let a;for(a=s.length-1;a>=0;--a){const l=s[a];if("$"===l.charAt(0))continue;if("options"===l){n.push(...this._animateOptions(t,e));continue}const c=e[l];let h=o[l];const d=i.get(l);if(h){if(d&&h.active()){h.update(d,c,r);continue}h.cancel()}d&&d.duration?(o[l]=h=new Uw(d,t,l,c),n.push(h)):t[l]=c}return n}update(t,e){if(0===this._properties.size)return void Object.assign(t,e);const i=this._createAnimations(t,e);return i.length?(qw.add(this._chart,i),!0):void 0}}function Gw(t,e){const i=t&&t.options||{},n=i.reverse,o=void 0===i.min?e:0,s=void 0===i.max?e:0;return{start:n?s:o,end:n?o:s}}function Zw(t,e){const i=[],n=t._getSortedDatasetMetas(e);let o,s;for(o=0,s=n.length;o<s;++o)i.push(n[o].index);return i}function Yw(t,e,i,n={}){const o=t.keys,s="single"===n.mode;let r,a,l,c;if(null===e)return;let h=!1;for(r=0,a=o.length;r<a;++r){if(l=+o[r],l===i){if(h=!0,n.all)continue;break}c=t.values[l],ix(c)&&(s||0===e||Px(e)===Px(c))&&(e+=c)}return h||n.all?e:0}function Xw(t,e){const i=t&&t.options.stacked;return i||void 0===i&&void 0!==e.stack}function Kw(t,e,i){const n=t[e]||(t[e]={});return n[i]||(n[i]={})}function Qw(t,e,i,n){for(const o of e.getMatchingVisibleMetas(n).reverse()){const e=t[o.index];if(i&&e>0||!i&&e<0)return o.index}return null}function Jw(t,e){const{chart:i,_cachedMeta:n}=t,o=i._stacks||(i._stacks={}),{iScale:s,vScale:r,index:a}=n,l=s.axis,c=r.axis,h=function(t,e,i){return`${t.id}.${e.id}.${i.stack||i.type}`}(s,r,n),d=e.length;let u;for(let t=0;t<d;++t){const i=e[t],{[l]:s,[c]:d}=i;u=(i._stacks||(i._stacks={}))[c]=Kw(o,h,s),u[a]=d,u._top=Qw(u,r,!0,n.type),u._bottom=Qw(u,r,!1,n.type);(u._visualValues||(u._visualValues={}))[a]=d}}function tk(t,e){const i=t.scales;return Object.keys(i).filter((t=>i[t].axis===e)).shift()}function ek(t,e){const i=t.controller.index,n=t.vScale&&t.vScale.axis;if(n){e=e||t._parsed;for(const t of e){const e=t._stacks;if(!e||void 0===e[n]||void 0===e[n][i])return;delete e[n][i],void 0!==e[n]._visualValues&&void 0!==e[n]._visualValues[i]&&delete e[n]._visualValues[i]}}}const ik=t=>"reset"===t||"none"===t,nk=(t,e)=>e?t:Object.assign({},t);class ok{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Xw(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&ek(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),n=(t,e,i,n)=>"x"===t?e:"r"===t?n:i,o=e.xAxisID=ox(i.xAxisID,tk(t,"x")),s=e.yAxisID=ox(i.yAxisID,tk(t,"y")),r=e.rAxisID=ox(i.rAxisID,tk(t,"r")),a=e.indexAxis,l=e.iAxisID=n(a,o,s,r),c=e.vAxisID=n(a,s,o,r);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(s),e.rScale=this.getScaleForId(r),e.iScale=this.getScaleForId(l),e.vScale=this.getScaleForId(c)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Yx(this._data,this),t._stacked&&ek(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(ex(e)){const t=this._cachedMeta;this._data=function(t,e){const{iScale:i,vScale:n}=e,o="x"===i.axis?"x":"y",s="x"===n.axis?"x":"y",r=Object.keys(t),a=new Array(r.length);let l,c,h;for(l=0,c=r.length;l<c;++l)h=r[l],a[l]={[o]:h,[s]:t[h]};return a}(e,t)}else if(i!==e){if(i){Yx(i,this);const t=this._cachedMeta;ek(t),t._parsed=[]}e&&Object.isExtensible(e)&&(o=this,(n=e)._chartjs?n._chartjs.listeners.push(o):(Object.defineProperty(n,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[o]}}),Zx.forEach((t=>{const e="_onData"+vx(t),i=n[t];Object.defineProperty(n,t,{configurable:!0,enumerable:!1,value(...t){const o=i.apply(this,t);return n._chartjs.listeners.forEach((i=>{"function"==typeof i[e]&&i[e](...t)})),o}})})))),this._syncList=[],this._data=e}var n,o}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let n=!1;this._dataCheck();const o=e._stacked;e._stacked=Xw(e.vScale,e),e.stack!==i.stack&&(n=!0,ek(e),e.stack=i.stack),this._resyncElements(t),(n||o!==e._stacked)&&(Jw(this,e._parsed),e._stacked=Xw(e.vScale,e))}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:n}=this,{iScale:o,_stacked:s}=i,r=o.axis;let a,l,c,h=0===t&&e===n.length||i._sorted,d=t>0&&i._parsed[t-1];if(!1===this._parsing)i._parsed=n,i._sorted=!0,c=n;else{c=tx(n[t])?this.parseArrayData(i,n,t,e):ex(n[t])?this.parseObjectData(i,n,t,e):this.parsePrimitiveData(i,n,t,e);const o=()=>null===l[r]||d&&l[r]<d[r];for(a=0;a<e;++a)i._parsed[a+t]=l=c[a],h&&(o()&&(h=!1),d=l);i._sorted=h}s&&Jw(this,c)}parsePrimitiveData(t,e,i,n){const{iScale:o,vScale:s}=t,r=o.axis,a=s.axis,l=o.getLabels(),c=o===s,h=new Array(n);let d,u,p;for(d=0,u=n;d<u;++d)p=d+i,h[d]={[r]:c||o.parse(l[p],p),[a]:s.parse(e[p],p)};return h}parseArrayData(t,e,i,n){const{xScale:o,yScale:s}=t,r=new Array(n);let a,l,c,h;for(a=0,l=n;a<l;++a)c=a+i,h=e[c],r[a]={x:o.parse(h[0],c),y:s.parse(h[1],c)};return r}parseObjectData(t,e,i,n){const{xScale:o,yScale:s}=t,{xAxisKey:r="x",yAxisKey:a="y"}=this._parsing,l=new Array(n);let c,h,d,u;for(c=0,h=n;c<h;++c)d=c+i,u=e[d],l[c]={x:o.parse(gx(u,r),d),y:s.parse(gx(u,a),d)};return l}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){const n=this.chart,o=this._cachedMeta,s=e[t.axis];return Yw({keys:Zw(n,!0),values:e._stacks[t.axis]._visualValues},s,o.index,{mode:i})}updateRangeFromParsed(t,e,i,n){const o=i[e.axis];let s=null===o?NaN:o;const r=n&&i._stacks[e.axis];n&&r&&(n.values=r,s=Yw(n,o,this._cachedMeta.index)),t.min=Math.min(t.min,s),t.max=Math.max(t.max,s)}getMinMax(t,e){const i=this._cachedMeta,n=i._parsed,o=i._sorted&&t===i.iScale,s=n.length,r=this._getOtherScale(t),a=((t,e,i)=>t&&!e.hidden&&e._stacked&&{keys:Zw(i,!0),values:null})(e,i,this.chart),l={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:c,max:h}=function(t){const{min:e,max:i,minDefined:n,maxDefined:o}=t.getUserBounds();return{min:n?e:Number.NEGATIVE_INFINITY,max:o?i:Number.POSITIVE_INFINITY}}(r);let d,u;function p(){u=n[d];const e=u[r.axis];return!ix(u[t.axis])||c>e||h<e}for(d=0;d<s&&(p()||(this.updateRangeFromParsed(l,t,u,a),!o));++d);if(o)for(d=s-1;d>=0;--d)if(!p()){this.updateRangeFromParsed(l,t,u,a);break}return l}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let n,o,s;for(n=0,o=e.length;n<o;++n)s=e[n][t.axis],ix(s)&&i.push(s);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,i=e.iScale,n=e.vScale,o=this.getParsed(t);return{label:i?""+i.getLabelForValue(o[i.axis]):"",value:n?""+n.getLabelForValue(o[n.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=function(t){let e,i,n,o;return ex(t)?(e=t.top,i=t.right,n=t.bottom,o=t.left):e=i=n=o=t,{top:e,right:i,bottom:n,left:o,disabled:!1===t}}(ox(this.options.clip,function(t,e,i){if(!1===i)return!1;const n=Gw(t,i),o=Gw(e,i);return{top:o.end,right:n.end,bottom:o.start,left:n.start}}(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,i=this._cachedMeta,n=i.data||[],o=e.chartArea,s=[],r=this._drawStart||0,a=this._drawCount||n.length-r,l=this.options.drawActiveElementsOnTop;let c;for(i.dataset&&i.dataset.draw(t,o,r,a),c=r;c<r+a;++c){const e=n[c];e.hidden||(e.active&&l?s.push(e):e.draw(t,o))}for(c=0;c<s.length;++c)s[c].draw(t,o)}getStyle(t,e){const i=e?"active":"default";return void 0===t&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){const n=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const e=this._cachedMeta.data[t];o=e.$context||(e.$context=function(t,e,i){return G_(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:i,index:e,mode:"default",type:"data"})}(this.getContext(),t,e)),o.parsed=this.getParsed(t),o.raw=n.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=function(t,e){return G_(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}(this.chart.getContext(),this.index)),o.dataset=n,o.index=o.datasetIndex=this.index;return o.active=!!e,o.mode=i,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",i){const n="active"===e,o=this._cachedDataOpts,s=t+"-"+e,r=o[s],a=this.enableOptionSharing&&yx(i);if(r)return nk(r,a);const l=this.chart.config,c=l.datasetElementScopeKeys(this._type,t),h=n?[`${t}Hover`,"hover",t,""]:[t,""],d=l.getOptionScopes(this.getDataset(),c),u=Object.keys(__.elements[t]),p=l.resolveNamedOptions(d,u,(()=>this.getContext(i,n,e)),h);return p.$shared&&(p.$shared=a,o[s]=Object.freeze(nk(p,a))),p}_resolveAnimations(t,e,i){const n=this.chart,o=this._cachedDataOpts,s=`animation-${e}`,r=o[s];if(r)return r;let a;if(!1!==n.options.animation){const n=this.chart.config,o=n.datasetAnimationScopeKeys(this._type,e),s=n.getOptionScopes(this.getDataset(),o);a=n.createResolver(s,this.getContext(t,i,e))}const l=new Ww(n,a&&a.animations);return a&&a._cacheable&&(o[s]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||ik(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),n=this._sharedOptions,o=this.getSharedOptions(i),s=this.includeOptions(e,o)||o!==n;return this.updateSharedOptions(o,e,i),{sharedOptions:o,includeOptions:s}}updateElement(t,e,i,n){ik(n)?Object.assign(t,i):this._resolveAnimations(e,n).update(t,i)}updateSharedOptions(t,e,i){t&&!ik(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,n){t.active=n;const o=this.getStyle(e,n);this._resolveAnimations(e,i,n).update(t,{options:!n&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[t,e,i]of this._syncList)this[t](e,i);this._syncList=[];const n=i.length,o=e.length,s=Math.min(o,n);s&&this.parse(0,s),o>n?this._insertElements(n,o-n,t):o<n&&this._removeElements(o,n-o)}_insertElements(t,e,i=!0){const n=this._cachedMeta,o=n.data,s=t+e;let r;const a=t=>{for(t.length+=e,r=t.length-1;r>=s;r--)t[r]=t[r-e]};for(a(o),r=t;r<s;++r)o[r]=new this.dataElementType;this._parsing&&a(n._parsed),this.parse(t,e),i&&this.updateElements(o,t,e,"reset")}updateElements(t,e,i,n){}_removeElements(t,e){const i=this._cachedMeta;if(this._parsing){const n=i._parsed.splice(t,e);i._stacked&&ek(i,n)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,i,n]=t;this[e](i,n)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function sk(t){const e=t.iScale,i=function(t,e){if(!t._cache.$bar){const i=t.getMatchingVisibleMetas(e);let n=[];for(let e=0,o=i.length;e<o;e++)n=n.concat(i[e].controller.getAllParsedValues(t));t._cache.$bar=Xx(n.sort(((t,e)=>t-e)))}return t._cache.$bar}(e,t.type);let n,o,s,r,a=e._length;const l=()=>{32767!==s&&-32768!==s&&(yx(r)&&(a=Math.min(a,Math.abs(s-r)||a)),r=s)};for(n=0,o=i.length;n<o;++n)s=e.getPixelForValue(i[n]),l();for(r=void 0,n=0,o=e.ticks.length;n<o;++n)s=e.getPixelForTick(n),l();return a}function rk(t,e,i,n){return tx(t)?function(t,e,i,n){const o=i.parse(t[0],n),s=i.parse(t[1],n),r=Math.min(o,s),a=Math.max(o,s);let l=r,c=a;Math.abs(r)>Math.abs(a)&&(l=a,c=r),e[i.axis]=c,e._custom={barStart:l,barEnd:c,start:o,end:s,min:r,max:a}}(t,e,i,n):e[i.axis]=i.parse(t,n),e}function ak(t,e,i,n){const o=t.iScale,s=t.vScale,r=o.getLabels(),a=o===s,l=[];let c,h,d,u;for(c=i,h=i+n;c<h;++c)u=e[c],d={},d[o.axis]=a||o.parse(r[c],c),l.push(rk(u,d,s,c));return l}function lk(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}function ck(t,e,i,n){let o=e.borderSkipped;const s={};if(!o)return void(t.borderSkipped=s);if(!0===o)return void(t.borderSkipped={top:!0,right:!0,bottom:!0,left:!0});const{start:r,end:a,reverse:l,top:c,bottom:h}=function(t){let e,i,n,o,s;return t.horizontal?(e=t.base>t.x,i="left",n="right"):(e=t.base<t.y,i="bottom",n="top"),e?(o="end",s="start"):(o="start",s="end"),{start:i,end:n,reverse:e,top:o,bottom:s}}(t);"middle"===o&&i&&(t.enableBorderRadius=!0,(i._top||0)===n?o=c:(i._bottom||0)===n?o=h:(s[hk(h,r,a,l)]=!0,o=c)),s[hk(o,r,a,l)]=!0,t.borderSkipped=s}function hk(t,e,i,n){var o,s,r;return n?(r=i,t=dk(t=(o=t)===(s=e)?r:o===r?s:o,i,e)):t=dk(t,e,i),t}function dk(t,e,i){return"start"===t?e:"end"===t?i:t}function uk(t,{inflateAmount:e},i){t.inflateAmount="auto"===e?1===i?.33:0:e}class pk extends ok{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:t=>"spacing"!==t,_indexable:t=>"spacing"!==t&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:n}}=t.legend.options;return e.labels.map(((e,o)=>{const s=t.getDatasetMeta(0).controller.getStyle(o);return{text:e,fillStyle:s.backgroundColor,strokeStyle:s.borderColor,fontColor:n,lineWidth:s.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(o),index:o}}))}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}};constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,n=this._cachedMeta;if(!1===this._parsing)n._parsed=i;else{let o,s,r=t=>+i[t];if(ex(i[t])){const{key:t="value"}=this._parsing;r=e=>+gx(i[e],t)}for(o=t,s=t+e;o<s;++o)n._parsed[o]=r(o)}}_getRotation(){return $x(this.options.rotation-90)}_getCircumference(){return $x(this.options.circumference)}_getRotationExtents(){let t=wx,e=-wx;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)&&this.chart.getDatasetMeta(i).type===this._type){const n=this.chart.getDatasetMeta(i).controller,o=n._getRotation(),s=n._getCircumference();t=Math.min(t,o),e=Math.max(e,o+s)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:i}=e,n=this._cachedMeta,o=n.data,s=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,r=Math.max((Math.min(i.width,i.height)-s)/2,0),a=Math.min((l=this.options.cutout,c=r,"string"==typeof l&&l.endsWith("%")?parseFloat(l)/100:+l/c),1);var l,c;const h=this._getRingWeight(this.index),{circumference:d,rotation:u}=this._getRotationExtents(),{ratioX:p,ratioY:f,offsetX:m,offsetY:g}=function(t,e,i){let n=1,o=1,s=0,r=0;if(e<wx){const a=t,l=a+e,c=Math.cos(a),h=Math.sin(a),d=Math.cos(l),u=Math.sin(l),p=(t,e,n)=>qx(t,a,l,!0)?1:Math.max(e,e*i,n,n*i),f=(t,e,n)=>qx(t,a,l,!0)?-1:Math.min(e,e*i,n,n*i),m=p(0,c,d),g=p(Ex,h,u),v=f(_x,c,d),y=f(_x+Ex,h,u);n=(m-v)/2,o=(g-y)/2,s=-(m+v)/2,r=-(g+y)/2}return{ratioX:n,ratioY:o,offsetX:s,offsetY:r}}(u,d,a),v=(i.width-s)/p,y=(i.height-s)/f,b=Math.max(Math.min(v,y)/2,0),x=sx(this.options.radius,b),_=(x-Math.max(x*a,0))/this._getVisibleDatasetWeightTotal();this.offsetX=m*x,this.offsetY=g*x,n.total=this.calculateTotal(),this.outerRadius=x-_*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-_*h,0),this.updateElements(o,0,o.length,t)}_circumference(t,e){const i=this.options,n=this._cachedMeta,o=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||null===n._parsed[t]||n.data[t].hidden?0:this.calculateCircumference(n._parsed[t]*o/wx)}updateElements(t,e,i,n){const o="reset"===n,s=this.chart,r=s.chartArea,a=s.options.animation,l=(r.left+r.right)/2,c=(r.top+r.bottom)/2,h=o&&a.animateScale,d=h?0:this.innerRadius,u=h?0:this.outerRadius,{sharedOptions:p,includeOptions:f}=this._getSharedOptions(e,n);let m,g=this._getRotation();for(m=0;m<e;++m)g+=this._circumference(m,o);for(m=e;m<e+i;++m){const e=this._circumference(m,o),i=t[m],s={x:l+this.offsetX,y:c+this.offsetY,startAngle:g,endAngle:g+e,circumference:e,outerRadius:u,innerRadius:d};f&&(s.options=p||this.resolveDataElementOptions(m,i.active?"active":n)),g+=e,this.updateElement(i,m,s,n)}}calculateTotal(){const t=this._cachedMeta,e=t.data;let i,n=0;for(i=0;i<e.length;i++){const o=t._parsed[i];null===o||isNaN(o)||!this.chart.getDataVisibility(i)||e[i].hidden||(n+=Math.abs(o))}return n}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?wx*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=p_(e._parsed[t],i.options.locale);return{label:n[t]||"",value:o}}getMaxBorderWidth(t){let e=0;const i=this.chart;let n,o,s,r,a;if(!t)for(n=0,o=i.data.datasets.length;n<o;++n)if(i.isDatasetVisible(n)){s=i.getDatasetMeta(n),t=s.data,r=s.controller;break}if(!t)return 0;for(n=0,o=t.length;n<o;++n)a=r.resolveDataElementOptions(n),"inner"!==a.borderAlign&&(e=Math.max(e,a.borderWidth||0,a.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let i=0,n=t.length;i<n;++i){const t=this.resolveDataElementOptions(i);e=Math.max(e,t.offset||0,t.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(ox(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}class fk extends ok{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:n}}=t.legend.options;return e.labels.map(((e,o)=>{const s=t.getDatasetMeta(0).controller.getStyle(o);return{text:e,fillStyle:s.backgroundColor,strokeStyle:s.borderColor,fontColor:n,lineWidth:s.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(o),index:o}}))}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=p_(e._parsed[t].r,i.options.locale);return{label:n[t]||"",value:o}}parseObjectData(t,e,i,n){return aw.bind(this)(t,e,i,n)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach(((t,i)=>{const n=this.getParsed(i).r;!isNaN(n)&&this.chart.getDataVisibility(i)&&(n<e.min&&(e.min=n),n>e.max&&(e.max=n))})),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,n=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(n/2,0),s=(o-Math.max(i.cutoutPercentage?o/100*i.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=o-s*this.index,this.innerRadius=this.outerRadius-s}updateElements(t,e,i,n){const o="reset"===n,s=this.chart,r=s.options.animation,a=this._cachedMeta.rScale,l=a.xCenter,c=a.yCenter,h=a.getIndexAngle(0)-.5*_x;let d,u=h;const p=360/this.countVisibleElements();for(d=0;d<e;++d)u+=this._computeAngle(d,n,p);for(d=e;d<e+i;d++){const e=t[d];let i=u,f=u+this._computeAngle(d,n,p),m=s.getDataVisibility(d)?a.getDistanceFromCenterForValue(this.getParsed(d).r):0;u=f,o&&(r.animateScale&&(m=0),r.animateRotate&&(i=f=h));const g={x:l,y:c,innerRadius:0,outerRadius:m,startAngle:i,endAngle:f,options:this.resolveDataElementOptions(d,e.active?"active":n)};this.updateElement(e,d,g,n)}}countVisibleElements(){const t=this._cachedMeta;let e=0;return t.data.forEach(((t,i)=>{!isNaN(this.getParsed(i).r)&&this.chart.getDataVisibility(i)&&e++})),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?$x(this.resolveDataElementOptions(t,e).angle||i):0}}var mk=Object.freeze({__proto__:null,BarController:class extends ok{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,e,i,n){return ak(t,e,i,n)}parseArrayData(t,e,i,n){return ak(t,e,i,n)}parseObjectData(t,e,i,n){const{iScale:o,vScale:s}=t,{xAxisKey:r="x",yAxisKey:a="y"}=this._parsing,l="x"===o.axis?r:a,c="x"===s.axis?r:a,h=[];let d,u,p,f;for(d=i,u=i+n;d<u;++d)f=e[d],p={},p[o.axis]=o.parse(gx(f,l),d),h.push(rk(gx(f,c),p,s,d));return h}updateRangeFromParsed(t,e,i,n){super.updateRangeFromParsed(t,e,i,n);const o=i._custom;o&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:i,vScale:n}=e,o=this.getParsed(t),s=o._custom,r=lk(s)?"["+s.start+", "+s.end+"]":""+n.getLabelForValue(o[n.axis]);return{label:""+i.getLabelForValue(o[i.axis]),value:r}}initialize(){this.enableOptionSharing=!0,super.initialize();this._cachedMeta.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,n){const o="reset"===n,{index:s,_cachedMeta:{vScale:r}}=this,a=r.getBasePixel(),l=r.isHorizontal(),c=this._getRuler(),{sharedOptions:h,includeOptions:d}=this._getSharedOptions(e,n);for(let u=e;u<e+i;u++){const e=this.getParsed(u),i=o||Jb(e[r.axis])?{base:a,head:a}:this._calculateBarValuePixels(u),p=this._calculateBarIndexPixels(u,c),f=(e._stacks||{})[r.axis],m={horizontal:l,base:i.base,enableBorderRadius:!f||lk(e._custom)||s===f._top||s===f._bottom,x:l?i.head:p.center,y:l?p.center:i.head,height:l?p.size:Math.abs(i.size),width:l?Math.abs(i.size):p.size};d&&(m.options=h||this.resolveDataElementOptions(u,t[u].active?"active":n));const g=m.options||t[u].options;ck(m,g,f,s),uk(m,g,c.ratio),this.updateElement(t[u],u,m,n)}}_getStacks(t,e){const{iScale:i}=this._cachedMeta,n=i.getMatchingVisibleMetas(this._type).filter((t=>t.controller.options.grouped)),o=i.options.stacked,s=[],r=this._cachedMeta.controller.getParsed(e),a=r&&r[i.axis],l=t=>{const e=t._parsed.find((t=>t[i.axis]===a)),n=e&&e[t.vScale.axis];if(Jb(n)||isNaN(n))return!0};for(const i of n)if((void 0===e||!l(i))&&((!1===o||-1===s.indexOf(i.stack)||void 0===o&&void 0===i.stack)&&s.push(i.stack),i.index===t))break;return s.length||s.push(void 0),s}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const n=this._getStacks(t,i),o=void 0!==e?n.indexOf(e):-1;return-1===o?n.length-1:o}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,n=[];let o,s;for(o=0,s=e.data.length;o<s;++o)n.push(i.getPixelForValue(this.getParsed(o)[i.axis],o));const r=t.barThickness;return{min:r||sk(e),pixels:n,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:r?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:i,index:n},options:{base:o,minBarLength:s}}=this,r=o||0,a=this.getParsed(t),l=a._custom,c=lk(l);let h,d,u=a[e.axis],p=0,f=i?this.applyStack(e,a,i):u;f!==u&&(p=f-u,f=u),c&&(u=l.barStart,f=l.barEnd-l.barStart,0!==u&&Px(u)!==Px(l.barEnd)&&(p=0),p+=u);const m=Jb(o)||c?p:o;let g=e.getPixelForValue(m);if(h=this.chart.getDataVisibility(t)?e.getPixelForValue(p+f):g,d=h-g,Math.abs(d)<s){d=function(t,e,i){return 0!==t?Px(t):(e.isHorizontal()?1:-1)*(e.min>=i?1:-1)}(d,e,r)*s,u===r&&(g-=d/2);const t=e.getPixelForDecimal(0),o=e.getPixelForDecimal(1),l=Math.min(t,o),p=Math.max(t,o);g=Math.max(Math.min(g,p),l),h=g+d,i&&!c&&(a._stacks[e.axis]._visualValues[n]=e.getValueForPixel(h)-e.getValueForPixel(g))}if(g===e.getPixelForValue(r)){const t=Px(d)*e.getLineWidthForValue(r)/2;g+=t,d-=t}return{size:d,base:g,head:h,center:h+d/2}}_calculateBarIndexPixels(t,e){const i=e.scale,n=this.options,o=n.skipNull,s=ox(n.maxBarThickness,1/0);let r,a;if(e.grouped){const i=o?this._getStackCount(t):e.stackCount,l="flex"===n.barThickness?function(t,e,i,n){const o=e.pixels,s=o[t];let r=t>0?o[t-1]:null,a=t<o.length-1?o[t+1]:null;const l=i.categoryPercentage;null===r&&(r=s-(null===a?e.end-e.start:a-s)),null===a&&(a=s+s-r);const c=s-(s-Math.min(r,a))/2*l;return{chunk:Math.abs(a-r)/2*l/n,ratio:i.barPercentage,start:c}}(t,e,n,i):function(t,e,i,n){const o=i.barThickness;let s,r;return Jb(o)?(s=e.min*i.categoryPercentage,r=i.barPercentage):(s=o*n,r=1),{chunk:s/n,ratio:r,start:e.pixels[t]-s/2}}(t,e,n,i),c=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0);r=l.start+l.chunk*c+l.chunk/2,a=Math.min(s,l.chunk*l.ratio)}else r=i.getPixelForValue(this.getParsed(t)[i.axis],t),a=Math.min(s,e.min*e.ratio);return{base:r-a/2,head:r+a/2,center:r,size:a}}draw(){const t=this._cachedMeta,e=t.vScale,i=t.data,n=i.length;let o=0;for(;o<n;++o)null===this.getParsed(o)[e.axis]||i[o].hidden||i[o].draw(this._ctx)}},BubbleController:class extends ok{static id="bubble";static defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};static overrides={scales:{x:{type:"linear"},y:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,i,n){const o=super.parsePrimitiveData(t,e,i,n);for(let t=0;t<o.length;t++)o[t]._custom=this.resolveDataElementOptions(t+i).radius;return o}parseArrayData(t,e,i,n){const o=super.parseArrayData(t,e,i,n);for(let t=0;t<o.length;t++){const n=e[i+t];o[t]._custom=ox(n[2],this.resolveDataElementOptions(t+i).radius)}return o}parseObjectData(t,e,i,n){const o=super.parseObjectData(t,e,i,n);for(let t=0;t<o.length;t++){const n=e[i+t];o[t]._custom=ox(n&&n.r&&+n.r,this.resolveDataElementOptions(t+i).radius)}return o}getMaxOverflow(){const t=this._cachedMeta.data;let e=0;for(let i=t.length-1;i>=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:n,yScale:o}=e,s=this.getParsed(t),r=n.getLabelForValue(s.x),a=o.getLabelForValue(s.y),l=s._custom;return{label:i[t]||"",value:"("+r+", "+a+(l?", "+l:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,n){const o="reset"===n,{iScale:s,vScale:r}=this._cachedMeta,{sharedOptions:a,includeOptions:l}=this._getSharedOptions(e,n),c=s.axis,h=r.axis;for(let d=e;d<e+i;d++){const e=t[d],i=!o&&this.getParsed(d),u={},p=u[c]=o?s.getPixelForDecimal(.5):s.getPixelForValue(i[c]),f=u[h]=o?r.getBasePixel():r.getPixelForValue(i[h]);u.skip=isNaN(p)||isNaN(f),l&&(u.options=a||this.resolveDataElementOptions(d,e.active?"active":n),o&&(u.options.radius=0)),this.updateElement(e,d,u,n)}}resolveDataElementOptions(t,e){const i=this.getParsed(t);let n=super.resolveDataElementOptions(t,e);n.$shared&&(n=Object.assign({},n,{$shared:!1}));const o=n.radius;return"active"!==e&&(n.radius=0),n.radius+=ox(i&&i._custom,o),n}},DoughnutController:pk,LineController:class extends ok{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:n=[],_dataset:o}=e,s=this.chart._animationsDisabled;let{start:r,count:a}=e_(e,n,s);this._drawStart=r,this._drawCount=a,i_(e)&&(r=0,a=n.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=n;const l=this.resolveDatasetElementOptions(t);this.options.showLine||(l.borderWidth=0),l.segment=this.options.segment,this.updateElement(i,void 0,{animated:!s,options:l},t),this.updateElements(n,r,a,t)}updateElements(t,e,i,n){const o="reset"===n,{iScale:s,vScale:r,_stacked:a,_dataset:l}=this._cachedMeta,{sharedOptions:c,includeOptions:h}=this._getSharedOptions(e,n),d=s.axis,u=r.axis,{spanGaps:p,segment:f}=this.options,m=Ix(p)?p:Number.POSITIVE_INFINITY,g=this.chart._animationsDisabled||o||"none"===n,v=e+i,y=t.length;let b=e>0&&this.getParsed(e-1);for(let i=0;i<y;++i){const p=t[i],y=g?p:{};if(i<e||i>=v){y.skip=!0;continue}const x=this.getParsed(i),_=Jb(x[u]),w=y[d]=s.getPixelForValue(x[d],i),k=y[u]=o||_?r.getBasePixel():r.getPixelForValue(a?this.applyStack(r,x,a):x[u],i);y.skip=isNaN(w)||isNaN(k)||_,y.stop=i>0&&Math.abs(x[d]-b[d])>m,f&&(y.parsed=x,y.raw=l.data[i]),h&&(y.options=c||this.resolveDataElementOptions(i,p.active?"active":n)),g||this.updateElement(p,i,y,n),b=x}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,n=t.data||[];if(!n.length)return i;const o=n[0].size(this.resolveDataElementOptions(0)),s=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(i,o,s)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},PieController:class extends pk{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}},PolarAreaController:fk,RadarController:class extends ok{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,n){return aw.bind(this)(t,e,i,n)}update(t){const e=this._cachedMeta,i=e.dataset,n=e.data||[],o=e.iScale.getLabels();if(i.points=n,"resize"!==t){const e=this.resolveDatasetElementOptions(t);this.options.showLine||(e.borderWidth=0);const s={_loop:!0,_fullLoop:o.length===n.length,options:e};this.updateElement(i,void 0,s,t)}this.updateElements(n,0,n.length,t)}updateElements(t,e,i,n){const o=this._cachedMeta.rScale,s="reset"===n;for(let r=e;r<e+i;r++){const e=t[r],i=this.resolveDataElementOptions(r,e.active?"active":n),a=o.getPointPositionForValue(r,this.getParsed(r).r),l=s?o.xCenter:a.x,c=s?o.yCenter:a.y,h={x:l,y:c,angle:a.angle,skip:isNaN(l)||isNaN(c),options:i};this.updateElement(e,r,h,n)}}},ScatterController:class extends ok{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:n,yScale:o}=e,s=this.getParsed(t),r=n.getLabelForValue(s.x),a=o.getLabelForValue(s.y);return{label:i[t]||"",value:"("+r+", "+a+")"}}update(t){const e=this._cachedMeta,{data:i=[]}=e,n=this.chart._animationsDisabled;let{start:o,count:s}=e_(e,i,n);if(this._drawStart=o,this._drawCount=s,i_(e)&&(o=0,s=i.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:o,_dataset:s}=e;o._chart=this.chart,o._datasetIndex=this.index,o._decimated=!!s._decimated,o.points=i;const r=this.resolveDatasetElementOptions(t);r.segment=this.options.segment,this.updateElement(o,void 0,{animated:!n,options:r},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(i,o,s,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,i,n){const o="reset"===n,{iScale:s,vScale:r,_stacked:a,_dataset:l}=this._cachedMeta,c=this.resolveDataElementOptions(e,n),h=this.getSharedOptions(c),d=this.includeOptions(n,h),u=s.axis,p=r.axis,{spanGaps:f,segment:m}=this.options,g=Ix(f)?f:Number.POSITIVE_INFINITY,v=this.chart._animationsDisabled||o||"none"===n;let y=e>0&&this.getParsed(e-1);for(let c=e;c<e+i;++c){const e=t[c],i=this.getParsed(c),f=v?e:{},b=Jb(i[p]),x=f[u]=s.getPixelForValue(i[u],c),_=f[p]=o||b?r.getBasePixel():r.getPixelForValue(a?this.applyStack(r,i,a):i[p],c);f.skip=isNaN(x)||isNaN(_)||b,f.stop=c>0&&Math.abs(i[u]-y[u])>g,m&&(f.parsed=i,f.raw=l.data[c]),d&&(f.options=h||this.resolveDataElementOptions(c,e.active?"active":n)),v||this.updateElement(e,c,f,n),y=i}this.updateSharedOptions(h,n,c)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let t=0;for(let i=e.length-1;i>=0;--i)t=Math.max(t,e[i].size(this.resolveDataElementOptions(i))/2);return t>0&&t}const i=t.dataset,n=i.options&&i.options.borderWidth||0;if(!e.length)return n;const o=e[0].size(this.resolveDataElementOptions(0)),s=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(n,o,s)/2}}});function gk(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class vk{static override(t){Object.assign(vk.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return gk()}parse(){return gk()}format(){return gk()}add(){return gk()}diff(){return gk()}startOf(){return gk()}endOf(){return gk()}}var yk={_date:vk};function bk(t,e,i,n){const{controller:o,data:s,_sorted:r}=t,a=o._cachedMeta.iScale,l=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null;if(a&&e===a.axis&&"r"!==e&&r&&s.length){const r=a._reversePixels?Gx:Wx;if(!n){const n=r(s,e,i);if(l){const{vScale:e}=o._cachedMeta,{_parsed:i}=t,s=i.slice(0,n.lo+1).reverse().findIndex((t=>!Jb(t[e.axis])));n.lo-=Math.max(0,s);const r=i.slice(n.hi).findIndex((t=>!Jb(t[e.axis])));n.hi+=Math.max(0,r)}return n}if(o._sharedOptions){const t=s[0],n="function"==typeof t.getRange&&t.getRange(e);if(n){const t=r(s,e,i-n),o=r(s,e,i+n);return{lo:t.lo,hi:o.hi}}}}return{lo:0,hi:s.length-1}}function xk(t,e,i,n,o){const s=t.getSortedVisibleDatasetMetas(),r=i[e];for(let t=0,i=s.length;t<i;++t){const{index:i,data:a}=s[t],{lo:l,hi:c}=bk(s[t],e,r,o);for(let t=l;t<=c;++t){const e=a[t];e.skip||n(e,i,t)}}}function _k(t,e,i,n,o){const s=[];if(!o&&!t.isPointInArea(e))return s;return xk(t,i,e,(function(i,r,a){(o||M_(i,t.chartArea,0))&&i.inRange(e.x,e.y,n)&&s.push({element:i,datasetIndex:r,index:a})}),!0),s}function wk(t,e,i,n,o,s){let r=[];const a=function(t){const e=-1!==t.indexOf("x"),i=-1!==t.indexOf("y");return function(t,n){const o=e?Math.abs(t.x-n.x):0,s=i?Math.abs(t.y-n.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(s,2))}}(i);let l=Number.POSITIVE_INFINITY;return xk(t,i,e,(function(i,c,h){const d=i.inRange(e.x,e.y,o);if(n&&!d)return;const u=i.getCenterPoint(o);if(!(!!s||t.isPointInArea(u))&&!d)return;const p=a(e,u);p<l?(r=[{element:i,datasetIndex:c,index:h}],l=p):p===l&&r.push({element:i,datasetIndex:c,index:h})})),r}function kk(t,e,i,n,o,s){return s||t.isPointInArea(e)?"r"!==i||n?wk(t,e,i,n,o,s):function(t,e,i,n){let o=[];return xk(t,i,e,(function(t,i,s){const{startAngle:r,endAngle:a}=t.getProps(["startAngle","endAngle"],n),{angle:l}=Nx(t,{x:e.x,y:e.y});qx(l,r,a)&&o.push({element:t,datasetIndex:i,index:s})})),o}(t,e,i,o):[]}function Sk(t,e,i,n,o){const s=[],r="x"===i?"inXRange":"inYRange";let a=!1;return xk(t,i,e,((t,n,l)=>{t[r]&&t[r](e[i],o)&&(s.push({element:t,datasetIndex:n,index:l}),a=a||t.inRange(e.x,e.y,o))})),n&&!a?[]:s}var Ck={evaluateInteractionItems:xk,modes:{index(t,e,i,n){const o=ww(e,t),s=i.axis||"x",r=i.includeInvisible||!1,a=i.intersect?_k(t,o,s,n,r):kk(t,o,s,!1,n,r),l=[];return a.length?(t.getSortedVisibleDatasetMetas().forEach((t=>{const e=a[0].index,i=t.data[e];i&&!i.skip&&l.push({element:i,datasetIndex:t.index,index:e})})),l):[]},dataset(t,e,i,n){const o=ww(e,t),s=i.axis||"xy",r=i.includeInvisible||!1;let a=i.intersect?_k(t,o,s,n,r):kk(t,o,s,!1,n,r);if(a.length>0){const e=a[0].datasetIndex,i=t.getDatasetMeta(e).data;a=[];for(let t=0;t<i.length;++t)a.push({element:i[t],datasetIndex:e,index:t})}return a},point:(t,e,i,n)=>_k(t,ww(e,t),i.axis||"xy",n,i.includeInvisible||!1),nearest(t,e,i,n){const o=ww(e,t),s=i.axis||"xy",r=i.includeInvisible||!1;return kk(t,o,s,i.intersect,n,r)},x:(t,e,i,n)=>Sk(t,ww(e,t),"x",i.intersect,n),y:(t,e,i,n)=>Sk(t,ww(e,t),"y",i.intersect,n)}};const Ek=["left","top","right","bottom"];function Ak(t,e){return t.filter((t=>t.pos===e))}function Mk(t,e){return t.filter((t=>-1===Ek.indexOf(t.pos)&&t.box.axis===e))}function Tk(t,e){return t.sort(((t,i)=>{const n=e?i:t,o=e?t:i;return n.weight===o.weight?n.index-o.index:n.weight-o.weight}))}function Pk(t,e){const i=function(t){const e={};for(const i of t){const{stack:t,pos:n,stackWeight:o}=i;if(!t||!Ek.includes(n))continue;const s=e[t]||(e[t]={count:0,placed:0,weight:0,size:0});s.count++,s.weight+=o}return e}(t),{vBoxMaxWidth:n,hBoxMaxHeight:o}=e;let s,r,a;for(s=0,r=t.length;s<r;++s){a=t[s];const{fullSize:r}=a.box,l=i[a.stack],c=l&&a.stackWeight/l.weight;a.horizontal?(a.width=c?c*n:r&&e.availableWidth,a.height=o):(a.width=n,a.height=c?c*o:r&&e.availableHeight)}return i}function Ok(t,e,i,n){return Math.max(t[i],e[i])+Math.max(t[n],e[n])}function Dk(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function Ik(t,e,i,n){const{pos:o,box:s}=i,r=t.maxPadding;if(!ex(o)){i.size&&(t[o]-=i.size);const e=n[i.stack]||{size:0,count:1};e.size=Math.max(e.size,i.horizontal?s.height:s.width),i.size=e.size/e.count,t[o]+=i.size}s.getPadding&&Dk(r,s.getPadding());const a=Math.max(0,e.outerWidth-Ok(r,t,"left","right")),l=Math.max(0,e.outerHeight-Ok(r,t,"top","bottom")),c=a!==t.w,h=l!==t.h;return t.w=a,t.h=l,i.horizontal?{same:c,other:h}:{same:h,other:c}}function Lk(t,e){const i=e.maxPadding;function n(t){const n={left:0,top:0,right:0,bottom:0};return t.forEach((t=>{n[t]=Math.max(e[t],i[t])})),n}return n(t?["left","right"]:["top","bottom"])}function $k(t,e,i,n){const o=[];let s,r,a,l,c,h;for(s=0,r=t.length,c=0;s<r;++s){a=t[s],l=a.box,l.update(a.width||e.w,a.height||e.h,Lk(a.horizontal,e));const{same:r,other:d}=Ik(e,i,a,n);c|=r&&o.length,h=h||d,l.fullSize||o.push(a)}return c&&$k(o,e,i,n)||h}function zk(t,e,i,n,o){t.top=i,t.left=e,t.right=e+n,t.bottom=i+o,t.width=n,t.height=o}function Rk(t,e,i,n){const o=i.padding;let{x:s,y:r}=e;for(const a of t){const t=a.box,l=n[a.stack]||{count:1,placed:0,weight:1},c=a.stackWeight/l.weight||1;if(a.horizontal){const n=e.w*c,s=l.size||t.height;yx(l.start)&&(r=l.start),t.fullSize?zk(t,o.left,r,i.outerWidth-o.right-o.left,s):zk(t,e.left+l.placed,r,n,s),l.start=r,l.placed+=n,r=t.bottom}else{const n=e.h*c,r=l.size||t.width;yx(l.start)&&(s=l.start),t.fullSize?zk(t,s,o.top,r,i.outerHeight-o.bottom-o.top):zk(t,s,e.top+l.placed,r,n),l.start=s,l.placed+=n,s=t.right}}e.x=s,e.y=r}var Nk={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(t){e.draw(t)}}]},t.boxes.push(e)},removeBox(t,e){const i=t.boxes?t.boxes.indexOf(e):-1;-1!==i&&t.boxes.splice(i,1)},configure(t,e,i){e.fullSize=i.fullSize,e.position=i.position,e.weight=i.weight},update(t,e,i,n){if(!t)return;const o=H_(t.options.layout.padding),s=Math.max(e-o.width,0),r=Math.max(i-o.height,0),a=function(t){const e=function(t){const e=[];let i,n,o,s,r,a;for(i=0,n=(t||[]).length;i<n;++i)o=t[i],({position:s,options:{stack:r,stackWeight:a=1}}=o),e.push({index:i,box:o,pos:s,horizontal:o.isHorizontal(),weight:o.weight,stack:r&&s+r,stackWeight:a});return e}(t),i=Tk(e.filter((t=>t.box.fullSize)),!0),n=Tk(Ak(e,"left"),!0),o=Tk(Ak(e,"right")),s=Tk(Ak(e,"top"),!0),r=Tk(Ak(e,"bottom")),a=Mk(e,"x"),l=Mk(e,"y");return{fullSize:i,leftAndTop:n.concat(s),rightAndBottom:o.concat(l).concat(r).concat(a),chartArea:Ak(e,"chartArea"),vertical:n.concat(o).concat(l),horizontal:s.concat(r).concat(a)}}(t.boxes),l=a.vertical,c=a.horizontal;ax(t.boxes,(t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()}));const h=l.reduce(((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1),0)||1,d=Object.freeze({outerWidth:e,outerHeight:i,padding:o,availableWidth:s,availableHeight:r,vBoxMaxWidth:s/2/h,hBoxMaxHeight:r/2}),u=Object.assign({},o);Dk(u,H_(n));const p=Object.assign({maxPadding:u,w:s,h:r,x:o.left,y:o.top},o),f=Pk(l.concat(c),d);$k(a.fullSize,p,d,f),$k(l,p,d,f),$k(c,p,d,f)&&$k(l,p,d,f),function(t){const e=t.maxPadding;function i(i){const n=Math.max(e[i]-t[i],0);return t[i]+=n,n}t.y+=i("top"),t.x+=i("left"),i("right"),i("bottom")}(p),Rk(a.leftAndTop,p,d,f),p.x+=p.w,p.y+=p.h,Rk(a.rightAndBottom,p,d,f),t.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},ax(a.chartArea,(e=>{const i=e.box;Object.assign(i,t.chartArea),i.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})}))}};class Bk{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,n){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,n?Math.floor(e/n):i)}}isAttached(t){return!0}updateConfig(t){}}class jk extends Bk{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Fk="$chartjs",qk={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Vk=t=>null===t||""===t;const Hk=!!Ew&&{passive:!0};function Uk(t,e,i){t&&t.canvas&&t.canvas.removeEventListener(e,i,Hk)}function Wk(t,e){for(const i of t)if(i===e||i.contains(e))return!0}function Gk(t,e,i){const n=t.canvas,o=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||Wk(i.addedNodes,n),e=e&&!Wk(i.removedNodes,n);e&&i()}));return o.observe(document,{childList:!0,subtree:!0}),o}function Zk(t,e,i){const n=t.canvas,o=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||Wk(i.removedNodes,n),e=e&&!Wk(i.addedNodes,n);e&&i()}));return o.observe(document,{childList:!0,subtree:!0}),o}const Yk=new Map;let Xk=0;function Kk(){const t=window.devicePixelRatio;t!==Xk&&(Xk=t,Yk.forEach(((e,i)=>{i.currentDevicePixelRatio!==t&&e()})))}function Qk(t,e,i){const n=t.canvas,o=n&&gw(n);if(!o)return;const s=Qx(((t,e)=>{const n=o.clientWidth;i(t,e),n<o.clientWidth&&i()}),window),r=new ResizeObserver((t=>{const e=t[0],i=e.contentRect.width,n=e.contentRect.height;0===i&&0===n||s(i,n)}));return r.observe(o),function(t,e){Yk.size||window.addEventListener("resize",Kk),Yk.set(t,e)}(t,s),r}function Jk(t,e,i){i&&i.disconnect(),"resize"===e&&function(t){Yk.delete(t),Yk.size||window.removeEventListener("resize",Kk)}(t)}function tS(t,e,i){const n=t.canvas,o=Qx((e=>{null!==t.ctx&&i(function(t,e){const i=qk[t.type]||t.type,{x:n,y:o}=ww(t,e);return{type:i,chart:e,native:t,x:void 0!==n?n:null,y:void 0!==o?o:null}}(e,t))}),t);return function(t,e,i){t&&t.addEventListener(e,i,Hk)}(n,e,o),o}class eS extends Bk{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(function(t,e){const i=t.style,n=t.getAttribute("height"),o=t.getAttribute("width");if(t[Fk]={initial:{height:n,width:o,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",Vk(o)){const e=Aw(t,"width");void 0!==e&&(t.width=e)}if(Vk(n))if(""===t.style.height)t.height=t.width/(e||2);else{const e=Aw(t,"height");void 0!==e&&(t.height=e)}}(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[Fk])return!1;const i=e[Fk].initial;["height","width"].forEach((t=>{const n=i[t];Jb(n)?e.removeAttribute(t):e.setAttribute(t,n)}));const n=i.style||{};return Object.keys(n).forEach((t=>{e.style[t]=n[t]})),e.width=e.width,delete e[Fk],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const n=t.$proxies||(t.$proxies={}),o={attach:Gk,detach:Zk,resize:Qk}[e]||tS;n[e]=o(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),n=i[e];if(!n)return;({attach:Jk,detach:Jk,resize:Jk}[e]||Uk)(t,e,n),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,n){return Sw(t,e,i,n)}isAttached(t){const e=t&&gw(t);return!(!e||!e.isConnected)}}let iS=class{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return Ix(this.x)&&Ix(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const n={};return t.forEach((t=>{n[t]=i[t]&&i[t].active()?i[t]._to:this[t]})),n}};function nS(t,e){const i=t.options.ticks,n=function(t){const e=t.options.offset,i=t._tickSize(),n=t._length/i+(e?0:1),o=t._maxLength/i;return Math.floor(Math.min(n,o))}(t),o=Math.min(i.maxTicksLimit||n,n),s=i.major.enabled?function(t){const e=[];let i,n;for(i=0,n=t.length;i<n;i++)t[i].major&&e.push(i);return e}(e):[],r=s.length,a=s[0],l=s[r-1],c=[];if(r>o)return function(t,e,i,n){let o,s=0,r=i[0];for(n=Math.ceil(n),o=0;o<t.length;o++)o===r&&(e.push(t[o]),s++,r=i[s*n])}(e,c,s,r/o),c;const h=function(t,e,i){const n=function(t){const e=t.length;let i,n;if(e<2)return!1;for(n=t[0],i=1;i<e;++i)if(t[i]-t[i-1]!==n)return!1;return n}(t),o=e.length/i;if(!n)return Math.max(o,1);const s=function(t){const e=[],i=Math.sqrt(t);let n;for(n=1;n<i;n++)t%n==0&&(e.push(n),e.push(t/n));return i===(0|i)&&e.push(i),e.sort(((t,e)=>t-e)).pop(),e}(n);for(let t=0,e=s.length-1;t<e;t++){const e=s[t];if(e>o)return e}return Math.max(o,1)}(s,e,o);if(r>0){let t,i;const n=r>1?Math.round((l-a)/(r-1)):null;for(oS(e,c,h,Jb(n)?0:a-n,a),t=0,i=r-1;t<i;t++)oS(e,c,h,s[t],s[t+1]);return oS(e,c,h,l,Jb(n)?e.length:l+n),c}return oS(e,c,h),c}function oS(t,e,i,n,o){const s=ox(n,0),r=Math.min(ox(o,t.length),t.length);let a,l,c,h=0;for(i=Math.ceil(i),o&&(a=o-n,i=a/Math.floor(a/i)),c=s;c<0;)h++,c=Math.round(s+h*i);for(l=Math.max(s,0);l<r;l++)l===c&&(e.push(t[l]),h++,c=Math.round(s+h*i))}const sS=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i,rS=(t,e)=>Math.min(e||t,t);function aS(t,e){const i=[],n=t.length/e,o=t.length;let s=0;for(;s<o;s+=n)i.push(t[Math.floor(s)]);return i}function lS(t,e,i){const n=t.ticks.length,o=Math.min(e,n-1),s=t._startPixel,r=t._endPixel,a=1e-6;let l,c=t.getPixelForTick(o);if(!(i&&(l=1===n?Math.max(c-s,r-c):0===e?(t.getPixelForTick(1)-c)/2:(c-t.getPixelForTick(o-1))/2,c+=o<e?l:-l,c<s-a||c>r+a)))return c}function cS(t){return t.drawTicks?t.tickLength:0}function hS(t,e){if(!t.display)return 0;const i=U_(t.font,e),n=H_(t.padding);return(tx(t.text)?t.text.length:1)*i.lineHeight+n.height}function dS(t,e,i){let n=Jx(t);return(i&&"right"!==e||!i&&"right"===e)&&(n=(t=>"left"===t?"right":"right"===t?"left":t)(n)),n}class uS extends iS{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:n}=this;return t=nx(t,Number.POSITIVE_INFINITY),e=nx(e,Number.NEGATIVE_INFINITY),i=nx(i,Number.POSITIVE_INFINITY),n=nx(n,Number.NEGATIVE_INFINITY),{min:nx(t,i),max:nx(e,n),minDefined:ix(t),maxDefined:ix(e)}}getMinMax(t){let e,{min:i,max:n,minDefined:o,maxDefined:s}=this.getUserBounds();if(o&&s)return{min:i,max:n};const r=this.getMatchingVisibleMetas();for(let a=0,l=r.length;a<l;++a)e=r[a].controller.getMinMax(this,t),o||(i=Math.min(i,e.min)),s||(n=Math.max(n,e.max));return i=s&&i>n?n:i,n=o&&i>n?i:n,{min:nx(i,nx(n,i)),max:nx(n,nx(i,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){rx(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:n,grace:o,ticks:s}=this.options,r=s.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=function(t,e,i){const{min:n,max:o}=t,s=sx(e,(o-n)/2),r=(t,e)=>i&&0===t?0:t+e;return{min:r(n,-Math.abs(s)),max:r(o,s)}}(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const a=r<this.ticks.length;this._convertTicksToLabels(a?aS(this.ticks,r):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),s.display&&(s.autoSkip||"auto"===s.source)&&(this.ticks=nS(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),a&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t,e,i=this.options.reverse;this.isHorizontal()?(t=this.left,e=this.right):(t=this.top,e=this.bottom,i=!i),this._startPixel=t,this._endPixel=e,this._reversePixels=i,this._length=e-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){rx(this.options.afterUpdate,[this])}beforeSetDimensions(){rx(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){rx(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),rx(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){rx(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let i,n,o;for(i=0,n=t.length;i<n;i++)o=t[i],o.label=rx(e.callback,[o.value,i,t],this)}afterTickToLabelConversion(){rx(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){rx(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,i=rS(this.ticks.length,t.ticks.maxTicksLimit),n=e.minRotation||0,o=e.maxRotation;let s,r,a,l=n;if(!this._isVisible()||!e.display||n>=o||i<=1||!this.isHorizontal())return void(this.labelRotation=n);const c=this._getLabelSizes(),h=c.widest.width,d=c.highest.height,u=Vx(this.chart.width-h,0,this.maxWidth);s=t.offset?this.maxWidth/i:u/(i-1),h+6>s&&(s=u/(i-(t.offset?.5:1)),r=this.maxHeight-cS(t.grid)-e.padding-hS(t.title,this.chart.options.font),a=Math.sqrt(h*h+d*d),l=zx(Math.min(Math.asin(Vx((c.highest.height+6)/s,-1,1)),Math.asin(Vx(r/a,-1,1))-Math.asin(Vx(d/a,-1,1)))),l=Math.max(n,Math.min(o,l))),this.labelRotation=l}afterCalculateLabelRotation(){rx(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){rx(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:n,grid:o}}=this,s=this._isVisible(),r=this.isHorizontal();if(s){const s=hS(n,e.options.font);if(r?(t.width=this.maxWidth,t.height=cS(o)+s):(t.height=this.maxHeight,t.width=cS(o)+s),i.display&&this.ticks.length){const{first:e,last:n,widest:o,highest:s}=this._getLabelSizes(),a=2*i.padding,l=$x(this.labelRotation),c=Math.cos(l),h=Math.sin(l);if(r){const e=i.mirror?0:h*o.width+c*s.height;t.height=Math.min(this.maxHeight,t.height+e+a)}else{const e=i.mirror?0:c*o.width+h*s.height;t.width=Math.min(this.maxWidth,t.width+e+a)}this._calculatePadding(e,n,h,c)}}this._handleMargins(),r?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,n){const{ticks:{align:o,padding:s},position:r}=this.options,a=0!==this.labelRotation,l="top"!==r&&"x"===this.axis;if(this.isHorizontal()){const r=this.getPixelForTick(0)-this.left,c=this.right-this.getPixelForTick(this.ticks.length-1);let h=0,d=0;a?l?(h=n*t.width,d=i*e.height):(h=i*t.height,d=n*e.width):"start"===o?d=e.width:"end"===o?h=t.width:"inner"!==o&&(h=t.width/2,d=e.width/2),this.paddingLeft=Math.max((h-r+s)*this.width/(this.width-r),0),this.paddingRight=Math.max((d-c+s)*this.width/(this.width-c),0)}else{let i=e.height/2,n=t.height/2;"start"===o?(i=0,n=t.height):"end"===o&&(i=e.height,n=0),this.paddingTop=i+s,this.paddingBottom=n+s}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){rx(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let e,i;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),e=0,i=t.length;e<i;e++)Jb(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let i=this.ticks;e<i.length&&(i=aS(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,i){const{ctx:n,_longestTextCache:o}=this,s=[],r=[],a=Math.floor(e/rS(e,i));let l,c,h,d,u,p,f,m,g,v,y,b=0,x=0;for(l=0;l<e;l+=a){if(d=t[l].label,u=this._resolveTickFontOptions(l),n.font=p=u.string,f=o[p]=o[p]||{data:{},gc:[]},m=u.lineHeight,g=v=0,Jb(d)||tx(d)){if(tx(d))for(c=0,h=d.length;c<h;++c)y=d[c],Jb(y)||tx(y)||(g=w_(n,f.data,f.gc,g,y),v+=m)}else g=w_(n,f.data,f.gc,g,d),v=m;s.push(g),r.push(v),b=Math.max(g,b),x=Math.max(v,x)}!function(t,e){ax(t,(t=>{const i=t.gc,n=i.length/2;let o;if(n>e){for(o=0;o<n;++o)delete t.data[i[o]];i.splice(0,n)}}))}(o,e);const _=s.indexOf(b),w=r.indexOf(x),k=t=>({width:s[t]||0,height:r[t]||0});return{first:k(0),last:k(e-1),widest:k(_),highest:k(w),widths:s,heights:r}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return Vx(this._alignToPixels?S_(this.chart,e,0):e,-32768,32767)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&t<e.length){const i=e[t];return i.$context||(i.$context=function(t,e,i){return G_(t,{tick:i,index:e,type:"tick"})}(this.getContext(),t,i))}return this.$context||(this.$context=G_(this.chart.getContext(),{scale:this,type:"scale"}))}_tickSize(){const t=this.options.ticks,e=$x(this.labelRotation),i=Math.abs(Math.cos(e)),n=Math.abs(Math.sin(e)),o=this._getLabelSizes(),s=t.autoSkipPadding||0,r=o?o.widest.width+s:0,a=o?o.highest.height+s:0;return this.isHorizontal()?a*i>r*n?r/i:a/n:a*n<r*i?a/i:r/n}_isVisible(){const t=this.options.display;return"auto"!==t?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,i=this.chart,n=this.options,{grid:o,position:s,border:r}=n,a=o.offset,l=this.isHorizontal(),c=this.ticks.length+(a?1:0),h=cS(o),d=[],u=r.setContext(this.getContext()),p=u.display?u.width:0,f=p/2,m=function(t){return S_(i,t,p)};let g,v,y,b,x,_,w,k,S,C,E,A;if("top"===s)g=m(this.bottom),_=this.bottom-h,k=g-f,C=m(t.top)+f,A=t.bottom;else if("bottom"===s)g=m(this.top),C=t.top,A=m(t.bottom)-f,_=g+f,k=this.top+h;else if("left"===s)g=m(this.right),x=this.right-h,w=g-f,S=m(t.left)+f,E=t.right;else if("right"===s)g=m(this.left),S=t.left,E=m(t.right)-f,x=g+f,w=this.left+h;else if("x"===e){if("center"===s)g=m((t.top+t.bottom)/2+.5);else if(ex(s)){const t=Object.keys(s)[0],e=s[t];g=m(this.chart.scales[t].getPixelForValue(e))}C=t.top,A=t.bottom,_=g+f,k=_+h}else if("y"===e){if("center"===s)g=m((t.left+t.right)/2);else if(ex(s)){const t=Object.keys(s)[0],e=s[t];g=m(this.chart.scales[t].getPixelForValue(e))}x=g-f,w=x-h,S=t.left,E=t.right}const M=ox(n.ticks.maxTicksLimit,c),T=Math.max(1,Math.ceil(c/M));for(v=0;v<c;v+=T){const t=this.getContext(v),e=o.setContext(t),n=r.setContext(t),s=e.lineWidth,c=e.color,h=n.dash||[],u=n.dashOffset,p=e.tickWidth,f=e.tickColor,m=e.tickBorderDash||[],g=e.tickBorderDashOffset;y=lS(this,v,a),void 0!==y&&(b=S_(i,y,s),l?x=w=S=E=b:_=k=C=A=b,d.push({tx1:x,ty1:_,tx2:w,ty2:k,x1:S,y1:C,x2:E,y2:A,width:s,color:c,borderDash:h,borderDashOffset:u,tickWidth:p,tickColor:f,tickBorderDash:m,tickBorderDashOffset:g}))}return this._ticksLength=c,this._borderValue=g,d}_computeLabelItems(t){const e=this.axis,i=this.options,{position:n,ticks:o}=i,s=this.isHorizontal(),r=this.ticks,{align:a,crossAlign:l,padding:c,mirror:h}=o,d=cS(i.grid),u=d+c,p=h?-c:u,f=-$x(this.labelRotation),m=[];let g,v,y,b,x,_,w,k,S,C,E,A,M="middle";if("top"===n)_=this.bottom-p,w=this._getXAxisLabelAlignment();else if("bottom"===n)_=this.top+p,w=this._getXAxisLabelAlignment();else if("left"===n){const t=this._getYAxisLabelAlignment(d);w=t.textAlign,x=t.x}else if("right"===n){const t=this._getYAxisLabelAlignment(d);w=t.textAlign,x=t.x}else if("x"===e){if("center"===n)_=(t.top+t.bottom)/2+u;else if(ex(n)){const t=Object.keys(n)[0],e=n[t];_=this.chart.scales[t].getPixelForValue(e)+u}w=this._getXAxisLabelAlignment()}else if("y"===e){if("center"===n)x=(t.left+t.right)/2-u;else if(ex(n)){const t=Object.keys(n)[0],e=n[t];x=this.chart.scales[t].getPixelForValue(e)}w=this._getYAxisLabelAlignment(d).textAlign}"y"===e&&("start"===a?M="top":"end"===a&&(M="bottom"));const T=this._getLabelSizes();for(g=0,v=r.length;g<v;++g){y=r[g],b=y.label;const t=o.setContext(this.getContext(g));k=this.getPixelForTick(g)+o.labelOffset,S=this._resolveTickFontOptions(g),C=S.lineHeight,E=tx(b)?b.length:1;const e=E/2,i=t.color,a=t.textStrokeColor,c=t.textStrokeWidth;let d,u=w;if(s?(x=k,"inner"===w&&(u=g===v-1?this.options.reverse?"left":"right":0===g?this.options.reverse?"right":"left":"center"),A="top"===n?"near"===l||0!==f?-E*C+C/2:"center"===l?-T.highest.height/2-e*C+C:-T.highest.height+C/2:"near"===l||0!==f?C/2:"center"===l?T.highest.height/2-e*C:T.highest.height-E*C,h&&(A*=-1),0===f||t.showLabelBackdrop||(x+=C/2*Math.sin(f))):(_=k,A=(1-E)*C/2),t.showLabelBackdrop){const e=H_(t.backdropPadding),i=T.heights[g],n=T.widths[g];let o=A-e.top,s=0-e.left;switch(M){case"middle":o-=i/2;break;case"bottom":o-=i}switch(w){case"center":s-=n/2;break;case"right":s-=n;break;case"inner":g===v-1?s-=n:g>0&&(s-=n/2)}d={left:s,top:o,width:n+e.width,height:i+e.height,color:t.backdropColor}}m.push({label:b,font:S,textOffset:A,options:{rotation:f,color:i,strokeColor:a,strokeWidth:c,textAlign:u,textBaseline:M,translation:[x,_],backdrop:d}})}return m}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-$x(this.labelRotation))return"top"===t?"left":"right";let i="center";return"start"===e.align?i="left":"end"===e.align?i="right":"inner"===e.align&&(i="inner"),i}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:n,padding:o}}=this.options,s=t+o,r=this._getLabelSizes().widest.width;let a,l;return"left"===e?n?(l=this.right+o,"near"===i?a="left":"center"===i?(a="center",l+=r/2):(a="right",l+=r)):(l=this.right-s,"near"===i?a="right":"center"===i?(a="center",l-=r/2):(a="left",l=this.left)):"right"===e?n?(l=this.left+o,"near"===i?a="right":"center"===i?(a="center",l-=r/2):(a="left",l-=r)):(l=this.left+s,"near"===i?a="left":"center"===i?(a="center",l+=r/2):(a="right",l=this.right)):a="right",{textAlign:a,x:l}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;return"left"===e||"right"===e?{top:0,left:this.left,bottom:t.height,right:this.right}:"top"===e||"bottom"===e?{top:this.top,left:0,bottom:this.bottom,right:t.width}:void 0}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:n,width:o,height:s}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,n,o,s),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const i=this.ticks.findIndex((e=>e.value===t));if(i>=0){return e.setContext(this.getContext(i)).lineWidth}return 0}drawGrid(t){const e=this.options.grid,i=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,s;const r=(t,e,n)=>{n.width&&n.color&&(i.save(),i.lineWidth=n.width,i.strokeStyle=n.color,i.setLineDash(n.borderDash||[]),i.lineDashOffset=n.borderDashOffset,i.beginPath(),i.moveTo(t.x,t.y),i.lineTo(e.x,e.y),i.stroke(),i.restore())};if(e.display)for(o=0,s=n.length;o<s;++o){const t=n[o];e.drawOnChartArea&&r({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},t),e.drawTicks&&r({x:t.tx1,y:t.ty1},{x:t.tx2,y:t.ty2},{color:t.tickColor,width:t.tickWidth,borderDash:t.tickBorderDash,borderDashOffset:t.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{border:i,grid:n}}=this,o=i.setContext(this.getContext()),s=i.display?o.width:0;if(!s)return;const r=n.setContext(this.getContext(0)).lineWidth,a=this._borderValue;let l,c,h,d;this.isHorizontal()?(l=S_(t,this.left,s)-s/2,c=S_(t,this.right,r)+r/2,h=d=a):(h=S_(t,this.top,s)-s/2,d=S_(t,this.bottom,r)+r/2,l=c=a),e.save(),e.lineWidth=o.width,e.strokeStyle=o.color,e.beginPath(),e.moveTo(l,h),e.lineTo(c,d),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const e=this.ctx,i=this._computeLabelArea();i&&T_(e,i);const n=this.getLabelItems(t);for(const t of n){const i=t.options,n=t.font;$_(e,t.label,0,t.textOffset,n,i)}i&&P_(e)}drawTitle(){const{ctx:t,options:{position:e,title:i,reverse:n}}=this;if(!i.display)return;const o=U_(i.font),s=H_(i.padding),r=i.align;let a=o.lineHeight/2;"bottom"===e||"center"===e||ex(e)?(a+=s.bottom,tx(i.text)&&(a+=o.lineHeight*(i.text.length-1))):a+=s.top;const{titleX:l,titleY:c,maxWidth:h,rotation:d}=function(t,e,i,n){const{top:o,left:s,bottom:r,right:a,chart:l}=t,{chartArea:c,scales:h}=l;let d,u,p,f=0;const m=r-o,g=a-s;if(t.isHorizontal()){if(u=t_(n,s,a),ex(i)){const t=Object.keys(i)[0],n=i[t];p=h[t].getPixelForValue(n)+m-e}else p="center"===i?(c.bottom+c.top)/2+m-e:sS(t,i,e);d=a-s}else{if(ex(i)){const t=Object.keys(i)[0],n=i[t];u=h[t].getPixelForValue(n)-g+e}else u="center"===i?(c.left+c.right)/2-g+e:sS(t,i,e);p=t_(n,r,o),f="left"===i?-Ex:Ex}return{titleX:u,titleY:p,maxWidth:d,rotation:f}}(this,a,e,r);$_(t,i.text,0,0,o,{color:i.color,maxWidth:h,rotation:d,textAlign:dS(r,e,n),textBaseline:"middle",translation:[l,c]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,e=t.ticks&&t.ticks.z||0,i=ox(t.grid&&t.grid.z,-1),n=ox(t.border&&t.border.z,0);return this._isVisible()&&this.draw===uS.prototype.draw?[{z:i,draw:t=>{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",n=[];let o,s;for(o=0,s=e.length;o<s;++o){const s=e[o];s[i]!==this.id||t&&s.type!==t||n.push(s)}return n}_resolveTickFontOptions(t){return U_(this.options.ticks.setContext(this.getContext(t)).font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class pS{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let i;(function(t){return"id"in t&&"defaults"in t})(e)&&(i=this.register(e));const n=this.items,o=t.id,s=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in n||(n[o]=t,function(t,e,i){const n=ux(Object.create(null),[i?__.get(i):{},__.get(e),t.defaults]);__.set(e,n),t.defaultRoutes&&function(t,e){Object.keys(e).forEach((i=>{const n=i.split("."),o=n.pop(),s=[t].concat(n).join("."),r=e[i].split("."),a=r.pop(),l=r.join(".");__.route(s,o,l,a)}))}(e,t.defaultRoutes);t.descriptors&&__.describe(e,t.descriptors)}(t,s,i),this.override&&__.override(t.id,t.overrides)),s}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,n=this.scope;i in e&&delete e[i],n&&i in __[n]&&(delete __[n][i],this.override&&delete g_[i])}}class fS{constructor(){this.controllers=new pS(ok,"datasets",!0),this.elements=new pS(iS,"elements"),this.plugins=new pS(Object,"plugins"),this.scales=new pS(uS,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach((e=>{const n=i||this._getRegistryForType(e);i||n.isForType(e)||n===this.plugins&&e.id?this._exec(t,n,e):ax(e,(e=>{const n=i||this._getRegistryForType(e);this._exec(t,n,e)}))}))}_exec(t,e,i){const n=vx(t);rx(i["before"+n],[],i),e[t](i),rx(i["after"+n],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){const n=e.get(t);if(void 0===n)throw new Error('"'+t+'" is not a registered '+i+".");return n}}var mS=new fS;class gS{constructor(){this._init=[]}notify(t,e,i,n){"beforeInit"===e&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const o=n?this._descriptors(t).filter(n):this._descriptors(t),s=this._notify(o,t,e,i);return"afterDestroy"===e&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall")),s}_notify(t,e,i,n){n=n||{};for(const o of t){const t=o.plugin;if(!1===rx(t[i],[e,n,o.options],t)&&n.cancelable)return!1}return!0}invalidate(){Jb(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const i=t&&t.config,n=ox(i.options&&i.options.plugins,{}),o=function(t){const e={},i=[],n=Object.keys(mS.plugins.items);for(let t=0;t<n.length;t++)i.push(mS.getPlugin(n[t]));const o=t.plugins||[];for(let t=0;t<o.length;t++){const n=o[t];-1===i.indexOf(n)&&(i.push(n),e[n.id]=!0)}return{plugins:i,localIds:e}}(i);return!1!==n||e?function(t,{plugins:e,localIds:i},n,o){const s=[],r=t.getContext();for(const a of e){const e=a.id,l=vS(n[e],o);null!==l&&s.push({plugin:a,options:yS(t.config,{plugin:a,local:i[e]},l,r)})}return s}(t,o,n,e):[]}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,n=(t,e)=>t.filter((t=>!e.some((e=>t.plugin.id===e.plugin.id))));this._notify(n(e,i),t,"stop"),this._notify(n(i,e),t,"start")}}function vS(t,e){return e||!1!==t?!0===t?{}:t:null}function yS(t,{plugin:e,local:i},n,o){const s=t.pluginScopeKeys(e),r=t.getOptionScopes(n,s);return i&&e.defaults&&r.push(e.defaults),t.createResolver(r,o,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function bS(t,e){const i=__.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function xS(t){if("x"===t||"y"===t||"r"===t)return t}function _S(t,...e){if(xS(t))return t;for(const n of e){const e=n.axis||("top"===(i=n.position)||"bottom"===i?"x":"left"===i||"right"===i?"y":void 0)||t.length>1&&xS(t[0].toLowerCase());if(e)return e}var i;throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function wS(t,e,i){if(i[e+"AxisID"]===t)return{axis:e}}function kS(t,e){const i=g_[t.type]||{scales:{}},n=e.scales||{},o=bS(t.type,e),s=Object.create(null);return Object.keys(n).forEach((e=>{const r=n[e];if(!ex(r))return console.error(`Invalid scale configuration for scale: ${e}`);if(r._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${e}`);const a=_S(e,r,function(t,e){if(e.data&&e.data.datasets){const i=e.data.datasets.filter((e=>e.xAxisID===t||e.yAxisID===t));if(i.length)return wS(t,"x",i[0])||wS(t,"y",i[0])}return{}}(e,t),__.scales[r.type]),l=function(t,e){return t===e?"_index_":"_value_"}(a,o),c=i.scales||{};s[e]=px(Object.create(null),[{axis:a},r,c[a],c[l]])})),t.data.datasets.forEach((i=>{const o=i.type||t.type,r=i.indexAxis||bS(o,e),a=(g_[o]||{}).scales||{};Object.keys(a).forEach((t=>{const e=function(t,e){let i=t;return"_index_"===t?i=e:"_value_"===t&&(i="x"===e?"y":"x"),i}(t,r),o=i[e+"AxisID"]||e;s[o]=s[o]||Object.create(null),px(s[o],[{axis:e},n[o],a[t]])}))})),Object.keys(s).forEach((t=>{const e=s[t];px(e,[__.scales[e.type],__.scale])})),s}function SS(t){const e=t.options||(t.options={});e.plugins=ox(e.plugins,{}),e.scales=kS(t,e)}function CS(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const ES=new Map,AS=new Set;function MS(t,e){let i=ES.get(t);return i||(i=e(),ES.set(t,i),AS.add(i)),i}const TS=(t,e,i)=>{const n=gx(e,i);void 0!==n&&t.add(n)};class PS{constructor(t){this._config=function(t){return(t=t||{}).data=CS(t.data),SS(t),t}(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=CS(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),SS(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return MS(t,(()=>[[`datasets.${t}`,""]]))}datasetAnimationScopeKeys(t,e){return MS(`${t}.transition.${e}`,(()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]]))}datasetElementScopeKeys(t,e){return MS(`${t}-${e}`,(()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]]))}pluginScopeKeys(t){const e=t.id;return MS(`${this.type}-plugin-${e}`,(()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]]))}_cachedScopes(t,e){const i=this._scopeCache;let n=i.get(t);return n&&!e||(n=new Map,i.set(t,n)),n}getOptionScopes(t,e,i){const{options:n,type:o}=this,s=this._cachedScopes(t,i),r=s.get(e);if(r)return r;const a=new Set;e.forEach((e=>{t&&(a.add(t),e.forEach((e=>TS(a,t,e)))),e.forEach((t=>TS(a,n,t))),e.forEach((t=>TS(a,g_[o]||{},t))),e.forEach((t=>TS(a,__,t))),e.forEach((t=>TS(a,v_,t)))}));const l=Array.from(a);return 0===l.length&&l.push(Object.create(null)),AS.has(e)&&s.set(e,l),l}chartOptionScopes(){const{options:t,type:e}=this;return[t,g_[e]||{},__.datasets[e]||{},{type:e},__,v_]}resolveNamedOptions(t,e,i,n=[""]){const o={$shared:!0},{resolver:s,subPrefixes:r}=OS(this._resolverCache,t,n);let a=s;if(function(t,e){const{isScriptable:i,isIndexable:n}=X_(t);for(const o of e){const e=i(o),s=n(o),r=(s||e)&&t[o];if(e&&(bx(r)||DS(r))||s&&tx(r))return!0}return!1}(s,e)){o.$shared=!1;a=Y_(s,i=bx(i)?i():i,this.createResolver(t,i,r))}for(const t of e)o[t]=a[t];return o}createResolver(t,e,i=[""],n){const{resolver:o}=OS(this._resolverCache,t,i);return ex(e)?Y_(o,e,void 0,n):o}}function OS(t,e,i){let n=t.get(e);n||(n=new Map,t.set(e,n));const o=i.join();let s=n.get(o);if(!s){s={resolver:Z_(e,i),subPrefixes:i.filter((t=>!t.toLowerCase().includes("hover")))},n.set(o,s)}return s}const DS=t=>ex(t)&&Object.getOwnPropertyNames(t).some((e=>bx(t[e])));const IS=["top","bottom","left","right","chartArea"];function LS(t,e){return"top"===t||"bottom"===t||-1===IS.indexOf(t)&&"x"===e}function $S(t,e){return function(i,n){return i[t]===n[t]?i[e]-n[e]:i[t]-n[t]}}function zS(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),rx(i&&i.onComplete,[t],e)}function RS(t){const e=t.chart,i=e.options.animation;rx(i&&i.onProgress,[t],e)}function NS(t){return mw()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const BS={},jS=t=>{const e=NS(t);return Object.values(BS).filter((t=>t.canvas===e)).pop()};function FS(t,e,i){const n=Object.keys(t);for(const o of n){const n=+o;if(n>=e){const s=t[o];delete t[o],(i>0||n>e)&&(t[n+i]=s)}}}function qS(t,e,i){return t.options.clip?t[i]:e[i]}class VS{static defaults=__;static instances=BS;static overrides=g_;static registry=mS;static version="4.4.8";static getChart=jS;static register(...t){mS.add(...t),HS()}static unregister(...t){mS.remove(...t),HS()}constructor(t,e){const i=this.config=new PS(e),n=NS(t),o=jS(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const s=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||function(t){return!mw()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?jk:eS}(n)),this.platform.updateConfig(i);const r=this.platform.acquireContext(n,s.aspectRatio),a=r&&r.canvas,l=a&&a.height,c=a&&a.width;this.id=Qb(),this.ctx=r,this.canvas=a,this.width=c,this.height=l,this._options=s,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new gS,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=function(t,e){let i;return function(...n){return e?(clearTimeout(i),i=setTimeout(t,e,n)):t.apply(this,n),e}}((t=>this.update(t)),s.resizeDelay||0),this._dataChanges=[],BS[this.id]=this,r&&a?(qw.listen(this,"complete",zS),qw.listen(this,"progress",RS),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:n,_aspectRatio:o}=this;return Jb(t)?e&&o?o:n?i/n:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return mS}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Cw(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return C_(this.canvas,this.ctx),this}stop(){return qw.stop(this),this}resize(t,e){qw.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,n=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,s=this.platform.getMaximumSize(n,t,e,o),r=i.devicePixelRatio||this.platform.getDevicePixelRatio(),a=this.width?"resize":"attach";this.width=s.width,this.height=s.height,this._aspectRatio=this.aspectRatio,Cw(this,r,!0)&&(this.notifyPlugins("resize",{size:s}),rx(i.onResize,[this,s],this),this.attached&&this._doResize(a)&&this.render())}ensureScalesHaveIDs(){ax(this.options.scales||{},((t,e)=>{t.id=e}))}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,n=Object.keys(i).reduce(((t,e)=>(t[e]=!1,t)),{});let o=[];e&&(o=o.concat(Object.keys(e).map((t=>{const i=e[t],n=_S(t,i),o="r"===n,s="x"===n;return{options:i,dposition:o?"chartArea":s?"bottom":"left",dtype:o?"radialLinear":s?"category":"linear"}})))),ax(o,(e=>{const o=e.options,s=o.id,r=_S(s,o),a=ox(o.type,e.dtype);void 0!==o.position&&LS(o.position,r)===LS(e.dposition)||(o.position=e.dposition),n[s]=!0;let l=null;if(s in i&&i[s].type===a)l=i[s];else{l=new(mS.getScale(a))({id:s,type:a,ctx:this.ctx,chart:this}),i[l.id]=l}l.init(o,t)})),ax(n,((t,e)=>{t||delete i[e]})),ax(i,(t=>{Nk.configure(this,t,t.options),Nk.addBox(this,t)}))}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort(((t,e)=>t.index-e.index)),i>e){for(let t=e;t<i;++t)this._destroyDatasetMeta(t);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort($S("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach(((t,i)=>{0===e.filter((e=>e===t._dataset)).length&&this._destroyDatasetMeta(i)}))}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,n;for(this._removeUnreferencedMetasets(),i=0,n=e.length;i<n;i++){const n=e[i];let o=this.getDatasetMeta(i);const s=n.type||this.config.type;if(o.type&&o.type!==s&&(this._destroyDatasetMeta(i),o=this.getDatasetMeta(i)),o.type=s,o.indexAxis=n.indexAxis||bS(s,this.options),o.order=n.order||0,o.index=i,o.label=""+n.label,o.visible=this.isDatasetVisible(i),o.controller)o.controller.updateIndex(i),o.controller.linkScales();else{const e=mS.getController(s),{datasetElementType:n,dataElementType:r}=__.datasets[s];Object.assign(e,{dataElementType:mS.getElement(r),datasetElementType:n&&mS.getElement(n)}),o.controller=new e(this,i),t.push(o.controller)}}return this._updateMetasets(),t}_resetElements(){ax(this.data.datasets,((t,e)=>{this.getDatasetMeta(e).controller.reset()}),this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),n=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let s=0;for(let t=0,e=this.data.datasets.length;t<e;t++){const{controller:e}=this.getDatasetMeta(t),i=!n&&-1===o.indexOf(e);e.buildOrUpdateElements(i),s=Math.max(+e.getMaxOverflow(),s)}s=this._minPadding=i.layout.autoPadding?s:0,this._updateLayout(s),n||ax(o,(t=>{t.reset()})),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort($S("z","_idx"));const{_active:r,_lastEvent:a}=this;a?this._eventHandler(a,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){ax(this.scales,(t=>{Nk.removeBox(this,t)})),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);xx(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:n,count:o}of e){FS(t,n,"_removeElements"===i?-o:o)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=e=>new Set(t.filter((t=>t[0]===e)).map(((t,e)=>e+","+t.splice(1).join(",")))),n=i(0);for(let t=1;t<e;t++)if(!xx(n,i(t)))return;return Array.from(n).map((t=>t.split(","))).map((t=>({method:t[1],start:+t[2],count:+t[3]})))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;Nk.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],ax(this.boxes,(t=>{i&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))}),this),this._layers.forEach(((t,e)=>{t._idx=e})),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,e=this.data.datasets.length;t<e;++t)this.getDatasetMeta(t).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,bx(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const i=this.getDatasetMeta(t),n={meta:i,index:t,mode:e,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",n)&&(i.controller._update(e),n.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",n))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(qw.has(this)?this.attached&&!qw.running(this)&&qw.start(this):(this.draw(),zS({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:t,height:e}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(t,e)}if(this.clear(),this.width<=0||this.height<=0)return;if(!1===this.notifyPlugins("beforeDraw",{cancelable:!0}))return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,i=[];let n,o;for(n=0,o=e.length;n<o;++n){const o=e[n];t&&!o.visible||i.push(o)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1===this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,n=!i.disabled,o=function(t,e){const{xScale:i,yScale:n}=t;return i&&n?{left:qS(i,e,"left"),right:qS(i,e,"right"),top:qS(n,e,"top"),bottom:qS(n,e,"bottom")}:e}(t,this.chartArea),s={meta:t,index:t.index,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetDraw",s)&&(n&&T_(e,{left:!1===i.left?0:o.left-i.left,right:!1===i.right?this.width:o.right+i.right,top:!1===i.top?0:o.top-i.top,bottom:!1===i.bottom?this.height:o.bottom+i.bottom}),t.controller.draw(),n&&P_(e),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(t){return M_(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,n){const o=Ck.modes[e];return"function"==typeof o?o(this,t,i,n):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let n=i.filter((t=>t&&t._dataset===e)).pop();return n||(n={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(n)),n}getContext(){return this.$context||(this.$context=G_(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return"boolean"==typeof i.hidden?!i.hidden:!e.hidden}setDatasetVisibility(t,e){this.getDatasetMeta(t).hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const n=i?"show":"hide",o=this.getDatasetMeta(t),s=o.controller._resolveAnimations(void 0,n);yx(e)?(o.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),s.update(o,{visible:i}),this.update((e=>e.datasetIndex===t?n:void 0)))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),qw.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),C_(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete BS[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,i=(i,n)=>{e.addEventListener(this,i,n),t[i]=n},n=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};ax(this.options.events,(t=>i(t,n)))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(i,n)=>{e.addEventListener(this,i,n),t[i]=n},n=(i,n)=>{t[i]&&(e.removeEventListener(this,i,n),delete t[i])},o=(t,e)=>{this.canvas&&this.resize(t,e)};let s;const r=()=>{n("attach",r),this.attached=!0,this.resize(),i("resize",o),i("detach",s)};s=()=>{this.attached=!1,n("resize",o),this._stop(),this._resize(0,0),i("attach",r)},e.isAttached(this.canvas)?r():s()}unbindEvents(){ax(this._listeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._listeners={},ax(this._responsiveListeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const n=i?"set":"remove";let o,s,r,a;for("dataset"===e&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+n+"DatasetHoverStyle"]()),r=0,a=t.length;r<a;++r){s=t[r];const e=s&&this.getDatasetMeta(s.datasetIndex).controller;e&&e[n+"HoverStyle"](s.element,s.datasetIndex,s.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],i=t.map((({datasetIndex:t,index:e})=>{const i=this.getDatasetMeta(t);if(!i)throw new Error("No dataset found at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}));!lx(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return 1===this._plugins._cache.filter((e=>e.plugin.id===t)).length}_updateHoverStyles(t,e,i){const n=this.options.hover,o=(t,e)=>t.filter((t=>!e.some((e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)))),s=o(e,t),r=i?t:o(t,e);s.length&&this.updateHoverStyle(s,n.mode,!1),r.length&&n.mode&&this.updateHoverStyle(r,n.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},n=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",i,n))return;const o=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,n),(o||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:n=[],options:o}=this,s=e,r=this._getActiveElements(t,n,i,s),a=function(t){return"mouseup"===t.type||"click"===t.type||"contextmenu"===t.type}(t),l=function(t,e,i,n){return i&&"mouseout"!==t.type?n?e:t:null}(t,this._lastEvent,i,a);i&&(this._lastEvent=null,rx(o.onHover,[t,r,this],this),a&&rx(o.onClick,[t,r,this],this));const c=!lx(r,n);return(c||e)&&(this._active=r,this._updateHoverStyles(r,n,e)),this._lastEvent=l,c}_getActiveElements(t,e,i,n){if("mouseout"===t.type)return[];if(!i)return e;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,n)}}function HS(){return ax(VS.instances,(t=>t._plugins.invalidate()))}function US(t,e,i,n){const o=F_(t.options.borderRadius,["outerStart","outerEnd","innerStart","innerEnd"]);const s=(i-e)/2,r=Math.min(s,n*e/2),a=t=>{const e=(i-Math.min(s,t))*n/2;return Vx(t,0,Math.min(s,e))};return{outerStart:a(o.outerStart),outerEnd:a(o.outerEnd),innerStart:Vx(o.innerStart,0,r),innerEnd:Vx(o.innerEnd,0,r)}}function WS(t,e,i,n){return{x:i+t*Math.cos(e),y:n+t*Math.sin(e)}}function GS(t,e,i,n,o,s){const{x:r,y:a,startAngle:l,pixelMargin:c,innerRadius:h}=e,d=Math.max(e.outerRadius+n+i-c,0),u=h>0?h+n+i+c:0;let p=0;const f=o-l;if(n){const t=((h>0?h-n:0)+(d>0?d-n:0))/2;p=(f-(0!==t?f*t/(t+n):f))/2}const m=(f-Math.max(.001,f*d-i/_x)/d)/2,g=l+m+p,v=o-m-p,{outerStart:y,outerEnd:b,innerStart:x,innerEnd:_}=US(e,u,d,v-g),w=d-y,k=d-b,S=g+y/w,C=v-b/k,E=u+x,A=u+_,M=g+x/E,T=v-_/A;if(t.beginPath(),s){const e=(S+C)/2;if(t.arc(r,a,d,S,e),t.arc(r,a,d,e,C),b>0){const e=WS(k,C,r,a);t.arc(e.x,e.y,b,C,v+Ex)}const i=WS(A,v,r,a);if(t.lineTo(i.x,i.y),_>0){const e=WS(A,T,r,a);t.arc(e.x,e.y,_,v+Ex,T+Math.PI)}const n=(v-_/u+(g+x/u))/2;if(t.arc(r,a,u,v-_/u,n,!0),t.arc(r,a,u,n,g+x/u,!0),x>0){const e=WS(E,M,r,a);t.arc(e.x,e.y,x,M+Math.PI,g-Ex)}const o=WS(w,g,r,a);if(t.lineTo(o.x,o.y),y>0){const e=WS(w,S,r,a);t.arc(e.x,e.y,y,g-Ex,S)}}else{t.moveTo(r,a);const e=Math.cos(S)*d+r,i=Math.sin(S)*d+a;t.lineTo(e,i);const n=Math.cos(C)*d+r,o=Math.sin(C)*d+a;t.lineTo(n,o)}t.closePath()}function ZS(t,e,i,n,o){const{fullCircles:s,startAngle:r,circumference:a,options:l}=e,{borderWidth:c,borderJoinStyle:h,borderDash:d,borderDashOffset:u}=l,p="inner"===l.borderAlign;if(!c)return;t.setLineDash(d||[]),t.lineDashOffset=u,p?(t.lineWidth=2*c,t.lineJoin=h||"round"):(t.lineWidth=c,t.lineJoin=h||"bevel");let f=e.endAngle;if(s){GS(t,e,i,n,f,o);for(let e=0;e<s;++e)t.stroke();isNaN(a)||(f=r+(a%wx||wx))}p&&function(t,e,i){const{startAngle:n,pixelMargin:o,x:s,y:r,outerRadius:a,innerRadius:l}=e;let c=o/a;t.beginPath(),t.arc(s,r,a,n-c,i+c),l>o?(c=o/l,t.arc(s,r,l,i+c,n-c,!0)):t.arc(s,r,o,i+Ex,n-Ex),t.closePath(),t.clip()}(t,e,f),s||(GS(t,e,i,n,f,o),t.stroke())}class YS extends iS{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,i){const n=this.getProps(["x","y"],i),{angle:o,distance:s}=Nx(n,{x:t,y:e}),{startAngle:r,endAngle:a,innerRadius:l,outerRadius:c,circumference:h}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),d=(this.options.spacing+this.options.borderWidth)/2,u=ox(h,a-r),p=qx(o,r,a)&&r!==a,f=u>=wx||p,m=Hx(s,l+d,c+d);return f&&m}getCenterPoint(t){const{x:e,y:i,startAngle:n,endAngle:o,innerRadius:s,outerRadius:r}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:a,spacing:l}=this.options,c=(n+o)/2,h=(s+r+l+a)/2;return{x:e+Math.cos(c)*h,y:i+Math.sin(c)*h}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:i}=this,n=(e.offset||0)/4,o=(e.spacing||0)/2,s=e.circular;if(this.pixelMargin="inner"===e.borderAlign?.33:0,this.fullCircles=i>wx?Math.floor(i/wx):0,0===i||this.innerRadius<0||this.outerRadius<0)return;t.save();const r=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(r)*n,Math.sin(r)*n);const a=n*(1-Math.sin(Math.min(_x,i||0)));t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,function(t,e,i,n,o){const{fullCircles:s,startAngle:r,circumference:a}=e;let l=e.endAngle;if(s){GS(t,e,i,n,l,o);for(let e=0;e<s;++e)t.fill();isNaN(a)||(l=r+(a%wx||wx))}GS(t,e,i,n,l,o),t.fill()}(t,this,a,o,s),ZS(t,this,a,o,s),t.restore()}}function XS(t,e,i=e){t.lineCap=ox(i.borderCapStyle,e.borderCapStyle),t.setLineDash(ox(i.borderDash,e.borderDash)),t.lineDashOffset=ox(i.borderDashOffset,e.borderDashOffset),t.lineJoin=ox(i.borderJoinStyle,e.borderJoinStyle),t.lineWidth=ox(i.borderWidth,e.borderWidth),t.strokeStyle=ox(i.borderColor,e.borderColor)}function KS(t,e,i){t.lineTo(i.x,i.y)}function QS(t,e,i={}){const n=t.length,{start:o=0,end:s=n-1}=i,{start:r,end:a}=e,l=Math.max(o,r),c=Math.min(s,a),h=o<r&&s<r||o>a&&s>a;return{count:n,start:l,loop:e.loop,ilen:c<l&&!h?n+c-l:c-l}}function JS(t,e,i,n){const{points:o,options:s}=e,{count:r,start:a,loop:l,ilen:c}=QS(o,i,n),h=function(t){return t.stepped?O_:t.tension||"monotone"===t.cubicInterpolationMode?D_:KS}(s);let d,u,p,{move:f=!0,reverse:m}=n||{};for(d=0;d<=c;++d)u=o[(a+(m?c-d:d))%r],u.skip||(f?(t.moveTo(u.x,u.y),f=!1):h(t,p,u,m,s.stepped),p=u);return l&&(u=o[(a+(m?c:0))%r],h(t,p,u,m,s.stepped)),!!l}function tC(t,e,i,n){const o=e.points,{count:s,start:r,ilen:a}=QS(o,i,n),{move:l=!0,reverse:c}=n||{};let h,d,u,p,f,m,g=0,v=0;const y=t=>(r+(c?a-t:t))%s,b=()=>{p!==f&&(t.lineTo(g,f),t.lineTo(g,p),t.lineTo(g,m))};for(l&&(d=o[y(0)],t.moveTo(d.x,d.y)),h=0;h<=a;++h){if(d=o[y(h)],d.skip)continue;const e=d.x,i=d.y,n=0|e;n===u?(i<p?p=i:i>f&&(f=i),g=(v*g+e)/++v):(b(),t.lineTo(e,i),u=n,v=0,p=f=i),m=i}b()}function eC(t){const e=t.options,i=e.borderDash&&e.borderDash.length;return!(t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i)?tC:JS}const iC="function"==typeof Path2D;function nC(t,e,i,n){iC&&!e.options.segment?function(t,e,i,n){let o=e._path;o||(o=e._path=new Path2D,e.path(o,i,n)&&o.closePath()),XS(t,e.options),t.stroke(o)}(t,e,i,n):function(t,e,i,n){const{segments:o,options:s}=e,r=eC(e);for(const a of o)XS(t,s,a.style),t.beginPath(),r(t,e,a,{start:i,end:i+n-1})&&t.closePath(),t.stroke()}(t,e,i,n)}class oC extends iS{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t&&"fill"!==t};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!this._pointsUpdated){const n=i.spanGaps?this._loop:this._fullLoop;fw(this._points,i,t,n,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=function(t,e){const i=t.points,n=t.options.spanGaps,o=i.length;if(!o)return[];const s=!!t._loop,{start:r,end:a}=function(t,e,i,n){let o=0,s=e-1;if(i&&!n)for(;o<e&&!t[o].skip;)o++;for(;o<e&&t[o].skip;)o++;for(o%=e,i&&(s+=o);s>o&&t[s%e].skip;)s--;return s%=e,{start:o,end:s}}(i,o,s,n);return Nw(t,!0===n?[{start:r,end:a,loop:s}]:function(t,e,i,n){const o=t.length,s=[];let r,a=e,l=t[e];for(r=e+1;r<=i;++r){const i=t[r%o];i.skip||i.stop?l.skip||(n=!1,s.push({start:e%o,end:(r-1)%o,loop:n}),e=a=i.stop?r:null):(a=r,l.skip&&(e=r)),l=i}return null!==a&&s.push({start:e%o,end:a%o,loop:n}),s}(i,r,a<r?a+o:a,!!t._fullLoop&&0===r&&a===o-1),i,e)}(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,n=t[e],o=this.points,s=Rw(this,{property:e,start:n,end:n});if(!s.length)return;const r=[],a=function(t){return t.stepped?Tw:t.tension||"monotone"===t.cubicInterpolationMode?Pw:Mw}(i);let l,c;for(l=0,c=s.length;l<c;++l){const{start:c,end:h}=s[l],d=o[c],u=o[h];if(d===u){r.push(d);continue}const p=a(d,u,Math.abs((n-d[e])/(u[e]-d[e])),i.stepped);p[e]=t[e],r.push(p)}return 1===r.length?r[0]:r}pathSegment(t,e,i){return eC(this)(t,this,e,i)}path(t,e,i){const n=this.segments,o=eC(this);let s=this._loop;e=e||0,i=i||this.points.length-e;for(const r of n)s&=o(t,this,r,{start:e,end:e+i-1});return!!s}draw(t,e,i,n){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),nC(t,this,i,n),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function sC(t,e,i,n){const o=t.options,{[i]:s}=t.getProps([i],n);return Math.abs(e-s)<o.radius+o.hitRadius}class rC extends iS{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,i){const n=this.options,{x:o,y:s}=this.getProps(["x","y"],i);return Math.pow(t-o,2)+Math.pow(e-s,2)<Math.pow(n.hitRadius+n.radius,2)}inXRange(t,e){return sC(this,t,"x",e)}inYRange(t,e){return sC(this,t,"y",e)}getCenterPoint(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}size(t){let e=(t=t||this.options||{}).radius||0;e=Math.max(e,e&&t.hoverRadius||0);return 2*(e+(e&&t.borderWidth||0))}draw(t,e){const i=this.options;this.skip||i.radius<.1||!M_(this,e,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,E_(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}function aC(t,e){const{x:i,y:n,base:o,width:s,height:r}=t.getProps(["x","y","base","width","height"],e);let a,l,c,h,d;return t.horizontal?(d=r/2,a=Math.min(i,o),l=Math.max(i,o),c=n-d,h=n+d):(d=s/2,a=i-d,l=i+d,c=Math.min(n,o),h=Math.max(n,o)),{left:a,top:c,right:l,bottom:h}}function lC(t,e,i,n){return t?0:Vx(e,i,n)}function cC(t){const e=aC(t),i=e.right-e.left,n=e.bottom-e.top,o=function(t,e,i){const n=t.options.borderWidth,o=t.borderSkipped,s=q_(n);return{t:lC(o.top,s.top,0,i),r:lC(o.right,s.right,0,e),b:lC(o.bottom,s.bottom,0,i),l:lC(o.left,s.left,0,e)}}(t,i/2,n/2),s=function(t,e,i){const{enableBorderRadius:n}=t.getProps(["enableBorderRadius"]),o=t.options.borderRadius,s=V_(o),r=Math.min(e,i),a=t.borderSkipped,l=n||ex(o);return{topLeft:lC(!l||a.top||a.left,s.topLeft,0,r),topRight:lC(!l||a.top||a.right,s.topRight,0,r),bottomLeft:lC(!l||a.bottom||a.left,s.bottomLeft,0,r),bottomRight:lC(!l||a.bottom||a.right,s.bottomRight,0,r)}}(t,i/2,n/2);return{outer:{x:e.left,y:e.top,w:i,h:n,radius:s},inner:{x:e.left+o.l,y:e.top+o.t,w:i-o.l-o.r,h:n-o.t-o.b,radius:{topLeft:Math.max(0,s.topLeft-Math.max(o.t,o.l)),topRight:Math.max(0,s.topRight-Math.max(o.t,o.r)),bottomLeft:Math.max(0,s.bottomLeft-Math.max(o.b,o.l)),bottomRight:Math.max(0,s.bottomRight-Math.max(o.b,o.r))}}}}function hC(t,e,i,n){const o=null===e,s=null===i,r=t&&!(o&&s)&&aC(t,n);return r&&(o||Hx(e,r.left,r.right))&&(s||Hx(i,r.top,r.bottom))}function dC(t,e){t.rect(e.x,e.y,e.w,e.h)}function uC(t,e,i={}){const n=t.x!==i.x?-e:0,o=t.y!==i.y?-e:0,s=(t.x+t.w!==i.x+i.w?e:0)-n,r=(t.y+t.h!==i.y+i.h?e:0)-o;return{x:t.x+n,y:t.y+o,w:t.w+s,h:t.h+r,radius:t.radius}}class pC extends iS{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:e,options:{borderColor:i,backgroundColor:n}}=this,{inner:o,outer:s}=cC(this),r=(a=s.radius).topLeft||a.topRight||a.bottomLeft||a.bottomRight?z_:dC;var a;t.save(),s.w===o.w&&s.h===o.h||(t.beginPath(),r(t,uC(s,e,o)),t.clip(),r(t,uC(o,-e,s)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),r(t,uC(o,e)),t.fillStyle=n,t.fill(),t.restore()}inRange(t,e,i){return hC(this,t,e,i)}inXRange(t,e){return hC(this,t,null,e)}inYRange(t,e){return hC(this,null,t,e)}getCenterPoint(t){const{x:e,y:i,base:n,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(e+n)/2:e,y:o?i:(i+n)/2}}getRange(t){return"x"===t?this.width/2:this.height/2}}var fC=Object.freeze({__proto__:null,ArcElement:YS,BarElement:pC,LineElement:oC,PointElement:rC});const mC=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],gC=mC.map((t=>t.replace("rgb(","rgba(").replace(")",", 0.5)")));function vC(t){return mC[t%mC.length]}function yC(t){return gC[t%gC.length]}function bC(t){let e=0;return(i,n)=>{const o=t.getDatasetMeta(n).controller;o instanceof pk?e=function(t,e){return t.backgroundColor=t.data.map((()=>vC(e++))),e}(i,e):o instanceof fk?e=function(t,e){return t.backgroundColor=t.data.map((()=>yC(e++))),e}(i,e):o&&(e=function(t,e){return t.borderColor=vC(e),t.backgroundColor=yC(e),++e}(i,e))}}function xC(t){let e;for(e in t)if(t[e].borderColor||t[e].backgroundColor)return!0;return!1}var _C={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(t,e,i){if(!i.enabled)return;const{data:{datasets:n},options:o}=t.config,{elements:s}=o,r=xC(n)||(a=o)&&(a.borderColor||a.backgroundColor)||s&&xC(s)||"rgba(0,0,0,0.1)"!==__.borderColor||"rgba(0,0,0,0.1)"!==__.backgroundColor;var a;if(!i.forceOverride&&r)return;const l=bC(t);n.forEach(l)}};function wC(t){if(t._decimated){const e=t._data;delete t._decimated,delete t._data,Object.defineProperty(t,"data",{configurable:!0,enumerable:!0,writable:!0,value:e})}}function kC(t){t.data.datasets.forEach((t=>{wC(t)}))}var SC={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,e,i)=>{if(!i.enabled)return void kC(t);const n=t.width;t.data.datasets.forEach(((e,o)=>{const{_data:s,indexAxis:r}=e,a=t.getDatasetMeta(o),l=s||e.data;if("y"===W_([r,t.options.indexAxis]))return;if(!a.controller.supportsDecimation)return;const c=t.scales[a.xAxisID];if("linear"!==c.type&&"time"!==c.type)return;if(t.options.parsing)return;let{start:h,count:d}=function(t,e){const i=e.length;let n,o=0;const{iScale:s}=t,{min:r,max:a,minDefined:l,maxDefined:c}=s.getUserBounds();return l&&(o=Vx(Wx(e,s.axis,r).lo,0,i-1)),n=c?Vx(Wx(e,s.axis,a).hi+1,o,i)-o:i-o,{start:o,count:n}}(a,l);if(d<=(i.threshold||4*n))return void wC(e);let u;switch(Jb(s)&&(e._data=l,delete e.data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(t){this._data=t}})),i.algorithm){case"lttb":u=function(t,e,i,n,o){const s=o.samples||n;if(s>=i)return t.slice(e,e+i);const r=[],a=(i-2)/(s-2);let l=0;const c=e+i-1;let h,d,u,p,f,m=e;for(r[l++]=t[m],h=0;h<s-2;h++){let n,o=0,s=0;const c=Math.floor((h+1)*a)+1+e,g=Math.min(Math.floor((h+2)*a)+1,i)+e,v=g-c;for(n=c;n<g;n++)o+=t[n].x,s+=t[n].y;o/=v,s/=v;const y=Math.floor(h*a)+1+e,b=Math.min(Math.floor((h+1)*a)+1,i)+e,{x:x,y:_}=t[m];for(u=p=-1,n=y;n<b;n++)p=.5*Math.abs((x-o)*(t[n].y-_)-(x-t[n].x)*(s-_)),p>u&&(u=p,d=t[n],f=n);r[l++]=d,m=f}return r[l++]=t[c],r}(l,h,d,n,i);break;case"min-max":u=function(t,e,i,n){let o,s,r,a,l,c,h,d,u,p,f=0,m=0;const g=[],v=e+i-1,y=t[e].x,b=t[v].x-y;for(o=e;o<e+i;++o){s=t[o],r=(s.x-y)/b*n,a=s.y;const e=0|r;if(e===l)a<u?(u=a,c=o):a>p&&(p=a,h=o),f=(m*f+s.x)/++m;else{const i=o-1;if(!Jb(c)&&!Jb(h)){const e=Math.min(c,h),n=Math.max(c,h);e!==d&&e!==i&&g.push({...t[e],x:f}),n!==d&&n!==i&&g.push({...t[n],x:f})}o>0&&i!==d&&g.push(t[i]),g.push(s),l=e,m=0,u=p=a,c=h=d=o}}return g}(l,h,d,n);break;default:throw new Error(`Unsupported decimation algorithm '${i.algorithm}'`)}e._decimated=u}))},destroy(t){kC(t)}};function CC(t,e,i,n){if(n)return;let o=e[t],s=i[t];return"angle"===t&&(o=Fx(o),s=Fx(s)),{property:t,start:o,end:s}}function EC(t,e,i){for(;e>t;e--){const t=i[e];if(!isNaN(t.x)&&!isNaN(t.y))break}return e}function AC(t,e,i,n){return t&&e?n(t[i],e[i]):t?t[i]:e?e[i]:0}function MC(t,e){let i=[],n=!1;return tx(t)?(n=!0,i=t):i=function(t,e){const{x:i=null,y:n=null}=t||{},o=e.points,s=[];return e.segments.forEach((({start:t,end:e})=>{e=EC(t,e,o);const r=o[t],a=o[e];null!==n?(s.push({x:r.x,y:n}),s.push({x:a.x,y:n})):null!==i&&(s.push({x:i,y:r.y}),s.push({x:i,y:a.y}))})),s}(t,e),i.length?new oC({points:i,options:{tension:0},_loop:n,_fullLoop:n}):null}function TC(t){return t&&!1!==t.fill}function PC(t,e,i){let n=t[e].fill;const o=[e];let s;if(!i)return n;for(;!1!==n&&-1===o.indexOf(n);){if(!ix(n))return n;if(s=t[n],!s)return!1;if(s.visible)return n;o.push(n),n=s.fill}return!1}function OC(t,e,i){const n=function(t){const e=t.options,i=e.fill;let n=ox(i&&i.target,i);void 0===n&&(n=!!e.backgroundColor);if(!1===n||null===n)return!1;if(!0===n)return"origin";return n}(t);if(ex(n))return!isNaN(n.value)&&n;let o=parseFloat(n);return ix(o)&&Math.floor(o)===o?function(t,e,i,n){"-"!==t&&"+"!==t||(i=e+i);if(i===e||i<0||i>=n)return!1;return i}(n[0],e,o,i):["origin","start","end","stack","shape"].indexOf(n)>=0&&n}function DC(t,e,i){const n=[];for(let o=0;o<i.length;o++){const s=i[o],{first:r,last:a,point:l}=IC(s,e,"x");if(!(!l||r&&a))if(r)n.unshift(l);else if(t.push(l),!a)break}t.push(...n)}function IC(t,e,i){const n=t.interpolate(e,i);if(!n)return{};const o=n[i],s=t.segments,r=t.points;let a=!1,l=!1;for(let t=0;t<s.length;t++){const e=s[t],n=r[e.start][i],c=r[e.end][i];if(Hx(o,n,c)){a=o===n,l=o===c;break}}return{first:a,last:l,point:n}}class LC{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){const{x:n,y:o,radius:s}=this;return e=e||{start:0,end:wx},t.arc(n,o,s,e.end,e.start,!0),!i.bounds}interpolate(t){const{x:e,y:i,radius:n}=this,o=t.angle;return{x:e+Math.cos(o)*n,y:i+Math.sin(o)*n,angle:o}}}function $C(t){const{chart:e,fill:i,line:n}=t;if(ix(i))return function(t,e){const i=t.getDatasetMeta(e),n=i&&t.isDatasetVisible(e);return n?i.dataset:null}(e,i);if("stack"===i)return function(t){const{scale:e,index:i,line:n}=t,o=[],s=n.segments,r=n.points,a=function(t,e){const i=[],n=t.getMatchingVisibleMetas("line");for(let t=0;t<n.length;t++){const o=n[t];if(o.index===e)break;o.hidden||i.unshift(o.dataset)}return i}(e,i);a.push(MC({x:null,y:e.bottom},n));for(let t=0;t<s.length;t++){const e=s[t];for(let t=e.start;t<=e.end;t++)DC(o,r[t],a)}return new oC({points:o,options:{}})}(t);if("shape"===i)return!0;const o=function(t){const e=t.scale||{};if(e.getPointPositionForValue)return function(t){const{scale:e,fill:i}=t,n=e.options,o=e.getLabels().length,s=n.reverse?e.max:e.min,r=function(t,e,i){let n;return n="start"===t?i:"end"===t?e.options.reverse?e.min:e.max:ex(t)?t.value:e.getBaseValue(),n}(i,e,s),a=[];if(n.grid.circular){const t=e.getPointPositionForValue(0,s);return new LC({x:t.x,y:t.y,radius:e.getDistanceFromCenterForValue(r)})}for(let t=0;t<o;++t)a.push(e.getPointPositionForValue(t,r));return a}(t);return function(t){const{scale:e={},fill:i}=t,n=function(t,e){let i=null;return"start"===t?i=e.bottom:"end"===t?i=e.top:ex(t)?i=e.getPixelForValue(t.value):e.getBasePixel&&(i=e.getBasePixel()),i}(i,e);if(ix(n)){const t=e.isHorizontal();return{x:t?n:null,y:t?null:n}}return null}(t)}(t);return o instanceof LC?o:MC(o,n)}function zC(t,e,i){const n=$C(e),{line:o,scale:s,axis:r}=e,a=o.options,l=a.fill,c=a.backgroundColor,{above:h=c,below:d=c}=l||{};n&&o.points.length&&(T_(t,i),function(t,e){const{line:i,target:n,above:o,below:s,area:r,scale:a}=e,l=i._loop?"angle":e.axis;t.save(),"x"===l&&s!==o&&(RC(t,n,r.top),NC(t,{line:i,target:n,color:o,scale:a,property:l}),t.restore(),t.save(),RC(t,n,r.bottom));NC(t,{line:i,target:n,color:s,scale:a,property:l}),t.restore()}(t,{line:o,target:n,above:h,below:d,area:i,scale:s,axis:r}),P_(t))}function RC(t,e,i){const{segments:n,points:o}=e;let s=!0,r=!1;t.beginPath();for(const a of n){const{start:n,end:l}=a,c=o[n],h=o[EC(n,l,o)];s?(t.moveTo(c.x,c.y),s=!1):(t.lineTo(c.x,i),t.lineTo(c.x,c.y)),r=!!e.pathSegment(t,a,{move:r}),r?t.closePath():t.lineTo(h.x,i)}t.lineTo(e.first().x,i),t.closePath(),t.clip()}function NC(t,e){const{line:i,target:n,property:o,color:s,scale:r}=e,a=function(t,e,i){const n=t.segments,o=t.points,s=e.points,r=[];for(const t of n){let{start:n,end:a}=t;a=EC(n,a,o);const l=CC(i,o[n],o[a],t.loop);if(!e.segments){r.push({source:t,target:l,start:o[n],end:o[a]});continue}const c=Rw(e,l);for(const e of c){const n=CC(i,s[e.start],s[e.end],e.loop),a=zw(t,o,n);for(const t of a)r.push({source:t,target:e,start:{[i]:AC(l,n,"start",Math.max)},end:{[i]:AC(l,n,"end",Math.min)}})}}return r}(i,n,o);for(const{source:e,target:l,start:c,end:h}of a){const{style:{backgroundColor:a=s}={}}=e,d=!0!==n;t.save(),t.fillStyle=a,BC(t,r,d&&CC(o,c,h)),t.beginPath();const u=!!i.pathSegment(t,e);let p;if(d){u?t.closePath():jC(t,n,h,o);const e=!!n.pathSegment(t,l,{move:u,reverse:!0});p=u&&e,p||jC(t,n,c,o)}t.closePath(),t.fill(p?"evenodd":"nonzero"),t.restore()}}function BC(t,e,i){const{top:n,bottom:o}=e.chart.chartArea,{property:s,start:r,end:a}=i||{};"x"===s&&(t.beginPath(),t.rect(r,n,a-r,o-n),t.clip())}function jC(t,e,i,n){const o=e.interpolate(i,n);o&&t.lineTo(o.x,o.y)}var FC={id:"filler",afterDatasetsUpdate(t,e,i){const n=(t.data.datasets||[]).length,o=[];let s,r,a,l;for(r=0;r<n;++r)s=t.getDatasetMeta(r),a=s.dataset,l=null,a&&a.options&&a instanceof oC&&(l={visible:t.isDatasetVisible(r),index:r,fill:OC(a,r,n),chart:t,axis:s.controller.options.indexAxis,scale:s.vScale,line:a}),s.$filler=l,o.push(l);for(r=0;r<n;++r)l=o[r],l&&!1!==l.fill&&(l.fill=PC(o,r,i.propagate))},beforeDraw(t,e,i){const n="beforeDraw"===i.drawTime,o=t.getSortedVisibleDatasetMetas(),s=t.chartArea;for(let e=o.length-1;e>=0;--e){const i=o[e].$filler;i&&(i.line.updateControlPoints(s,i.axis),n&&i.fill&&zC(t.ctx,i,s))}},beforeDatasetsDraw(t,e,i){if("beforeDatasetsDraw"!==i.drawTime)return;const n=t.getSortedVisibleDatasetMetas();for(let e=n.length-1;e>=0;--e){const i=n[e].$filler;TC(i)&&zC(t.ctx,i,t.chartArea)}},beforeDatasetDraw(t,e,i){const n=e.meta.$filler;TC(n)&&"beforeDatasetDraw"===i.drawTime&&zC(t.ctx,n,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const qC=(t,e)=>{let{boxHeight:i=e,boxWidth:n=e}=t;return t.usePointStyle&&(i=Math.min(i,e),n=t.pointStyleWidth||Math.min(n,e)),{boxWidth:n,boxHeight:i,itemHeight:Math.max(e,i)}};class VC extends iS{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=rx(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter((e=>t.filter(e,this.chart.data)))),t.sort&&(e=e.sort(((e,i)=>t.sort(e,i,this.chart.data)))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display)return void(this.width=this.height=0);const i=t.labels,n=U_(i.font),o=n.size,s=this._computeTitleHeight(),{boxWidth:r,itemHeight:a}=qC(i,o);let l,c;e.font=n.string,this.isHorizontal()?(l=this.maxWidth,c=this._fitRows(s,o,r,a)+10):(c=this.maxHeight,l=this._fitCols(s,n,r,a)+10),this.width=Math.min(l,t.maxWidth||this.maxWidth),this.height=Math.min(c,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,n){const{ctx:o,maxWidth:s,options:{labels:{padding:r}}}=this,a=this.legendHitBoxes=[],l=this.lineWidths=[0],c=n+r;let h=t;o.textAlign="left",o.textBaseline="middle";let d=-1,u=-c;return this.legendItems.forEach(((t,p)=>{const f=i+e/2+o.measureText(t.text).width;(0===p||l[l.length-1]+f+2*r>s)&&(h+=c,l[l.length-(p>0?0:1)]=0,u+=c,d++),a[p]={left:0,top:u,row:d,width:f,height:n},l[l.length-1]+=f+r})),h}_fitCols(t,e,i,n){const{ctx:o,maxHeight:s,options:{labels:{padding:r}}}=this,a=this.legendHitBoxes=[],l=this.columnSizes=[],c=s-t;let h=r,d=0,u=0,p=0,f=0;return this.legendItems.forEach(((t,s)=>{const{itemWidth:m,itemHeight:g}=function(t,e,i,n,o){const s=function(t,e,i,n){let o=t.text;o&&"string"!=typeof o&&(o=o.reduce(((t,e)=>t.length>e.length?t:e)));return e+i.size/2+n.measureText(o).width}(n,t,e,i),r=function(t,e,i){let n=t;"string"!=typeof e.text&&(n=HC(e,i));return n}(o,n,e.lineHeight);return{itemWidth:s,itemHeight:r}}(i,e,o,t,n);s>0&&u+g+2*r>c&&(h+=d+r,l.push({width:d,height:u}),p+=d+r,f++,d=u=0),a[s]={left:p,top:u,col:f,width:m,height:g},d=Math.max(d,m),u+=g+r})),h+=d,l.push({width:d,height:u}),h}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:n},rtl:o}}=this,s=Ow(o,this.left,this.width);if(this.isHorizontal()){let o=0,r=t_(i,this.left+n,this.right-this.lineWidths[o]);for(const a of e)o!==a.row&&(o=a.row,r=t_(i,this.left+n,this.right-this.lineWidths[o])),a.top+=this.top+t+n,a.left=s.leftForLtr(s.x(r),a.width),r+=a.width+n}else{let o=0,r=t_(i,this.top+t+n,this.bottom-this.columnSizes[o].height);for(const a of e)a.col!==o&&(o=a.col,r=t_(i,this.top+t+n,this.bottom-this.columnSizes[o].height)),a.top=r,a.left+=this.left+n,a.left=s.leftForLtr(s.x(a.left),a.width),r+=a.height+n}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const t=this.ctx;T_(t,this),this._draw(),P_(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:n}=this,{align:o,labels:s}=t,r=__.color,a=Ow(t.rtl,this.left,this.width),l=U_(s.font),{padding:c}=s,h=l.size,d=h/2;let u;this.drawTitle(),n.textAlign=a.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=l.string;const{boxWidth:p,boxHeight:f,itemHeight:m}=qC(s,h),g=this.isHorizontal(),v=this._computeTitleHeight();u=g?{x:t_(o,this.left+c,this.right-i[0]),y:this.top+c+v,line:0}:{x:this.left+c,y:t_(o,this.top+v+c,this.bottom-e[0].height),line:0},Dw(this.ctx,t.textDirection);const y=m+c;this.legendItems.forEach(((b,x)=>{n.strokeStyle=b.fontColor,n.fillStyle=b.fontColor;const _=n.measureText(b.text).width,w=a.textAlign(b.textAlign||(b.textAlign=s.textAlign)),k=p+d+_;let S=u.x,C=u.y;a.setWidth(this.width),g?x>0&&S+k+c>this.right&&(C=u.y+=y,u.line++,S=u.x=t_(o,this.left+c,this.right-i[u.line])):x>0&&C+y>this.bottom&&(S=u.x=S+e[u.line].width+c,u.line++,C=u.y=t_(o,this.top+v+c,this.bottom-e[u.line].height));if(function(t,e,i){if(isNaN(p)||p<=0||isNaN(f)||f<0)return;n.save();const o=ox(i.lineWidth,1);if(n.fillStyle=ox(i.fillStyle,r),n.lineCap=ox(i.lineCap,"butt"),n.lineDashOffset=ox(i.lineDashOffset,0),n.lineJoin=ox(i.lineJoin,"miter"),n.lineWidth=o,n.strokeStyle=ox(i.strokeStyle,r),n.setLineDash(ox(i.lineDash,[])),s.usePointStyle){const r={radius:f*Math.SQRT2/2,pointStyle:i.pointStyle,rotation:i.rotation,borderWidth:o},l=a.xPlus(t,p/2);A_(n,r,l,e+d,s.pointStyleWidth&&p)}else{const s=e+Math.max((h-f)/2,0),r=a.leftForLtr(t,p),l=V_(i.borderRadius);n.beginPath(),Object.values(l).some((t=>0!==t))?z_(n,{x:r,y:s,w:p,h:f,radius:l}):n.rect(r,s,p,f),n.fill(),0!==o&&n.stroke()}n.restore()}(a.x(S),C,b),S=((t,e,i,n)=>t===(n?"left":"right")?i:"center"===t?(e+i)/2:e)(w,S+p+d,g?S+k:this.right,t.rtl),function(t,e,i){$_(n,i.text,t,e+m/2,l,{strikethrough:i.hidden,textAlign:a.textAlign(i.textAlign)})}(a.x(S),C,b),g)u.x+=k+c;else if("string"!=typeof b.text){const t=l.lineHeight;u.y+=HC(b,t)+c}else u.y+=y})),Iw(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=U_(e.font),n=H_(e.padding);if(!e.display)return;const o=Ow(t.rtl,this.left,this.width),s=this.ctx,r=e.position,a=i.size/2,l=n.top+a;let c,h=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),c=this.top+l,h=t_(t.align,h,this.right-d);else{const e=this.columnSizes.reduce(((t,e)=>Math.max(t,e.height)),0);c=l+t_(t.align,this.top,this.bottom-e-t.labels.padding-this._computeTitleHeight())}const u=t_(r,h,h+d);s.textAlign=o.textAlign(Jx(r)),s.textBaseline="middle",s.strokeStyle=e.color,s.fillStyle=e.color,s.font=i.string,$_(s,e.text,u,c,i)}_computeTitleHeight(){const t=this.options.title,e=U_(t.font),i=H_(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,n,o;if(Hx(t,this.left,this.right)&&Hx(e,this.top,this.bottom))for(o=this.legendHitBoxes,i=0;i<o.length;++i)if(n=o[i],Hx(t,n.left,n.left+n.width)&&Hx(e,n.top,n.top+n.height))return this.legendItems[i];return null}handleEvent(t){const e=this.options;if(!function(t,e){if(("mousemove"===t||"mouseout"===t)&&(e.onHover||e.onLeave))return!0;if(e.onClick&&("click"===t||"mouseup"===t))return!0;return!1}(t.type,e))return;const i=this._getLegendItemAt(t.x,t.y);if("mousemove"===t.type||"mouseout"===t.type){const n=this._hoveredItem,o=((t,e)=>null!==t&&null!==e&&t.datasetIndex===e.datasetIndex&&t.index===e.index)(n,i);n&&!o&&rx(e.onLeave,[t,n,this],this),this._hoveredItem=i,i&&!o&&rx(e.onHover,[t,i,this],this)}else i&&rx(e.onClick,[t,i,this],this)}}function HC(t,e){return e*(t.text?t.text.length:0)}var UC={id:"legend",_element:VC,start(t,e,i){const n=t.legend=new VC({ctx:t.ctx,options:i,chart:t});Nk.configure(t,n,i),Nk.addBox(t,n)},stop(t){Nk.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,i){const n=t.legend;Nk.configure(t,n,i),n.options=i},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,i){const n=e.datasetIndex,o=i.chart;o.isDatasetVisible(n)?(o.hide(n),e.hidden=!0):(o.show(n),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:i,pointStyle:n,textAlign:o,color:s,useBorderRadius:r,borderRadius:a}}=t.legend.options;return t._getSortedDatasetMetas().map((t=>{const l=t.controller.getStyle(i?0:void 0),c=H_(l.borderWidth);return{text:e[t.index].label,fillStyle:l.backgroundColor,fontColor:s,hidden:!t.visible,lineCap:l.borderCapStyle,lineDash:l.borderDash,lineDashOffset:l.borderDashOffset,lineJoin:l.borderJoinStyle,lineWidth:(c.width+c.height)/4,strokeStyle:l.borderColor,pointStyle:n||l.pointStyle,rotation:l.rotation,textAlign:o||l.textAlign,borderRadius:r&&(a||l.borderRadius),datasetIndex:t.index}}),this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class WC extends iS{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const i=this.options;if(this.left=0,this.top=0,!i.display)return void(this.width=this.height=this.right=this.bottom=0);this.width=this.right=t,this.height=this.bottom=e;const n=tx(i.text)?i.text.length:1;this._padding=H_(i.padding);const o=n*U_(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){const{top:e,left:i,bottom:n,right:o,options:s}=this,r=s.align;let a,l,c,h=0;return this.isHorizontal()?(l=t_(r,i,o),c=e+t,a=o-i):("left"===s.position?(l=i+t,c=t_(r,n,e),h=-.5*_x):(l=o-t,c=t_(r,e,n),h=.5*_x),a=n-e),{titleX:l,titleY:c,maxWidth:a,rotation:h}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=U_(e.font),n=i.lineHeight/2+this._padding.top,{titleX:o,titleY:s,maxWidth:r,rotation:a}=this._drawArgs(n);$_(t,e.text,0,0,i,{color:e.color,maxWidth:r,rotation:a,textAlign:Jx(e.align),textBaseline:"middle",translation:[o,s]})}}var GC={id:"title",_element:WC,start(t,e,i){!function(t,e){const i=new WC({ctx:t.ctx,options:e,chart:t});Nk.configure(t,i,e),Nk.addBox(t,i),t.titleBlock=i}(t,i)},stop(t){const e=t.titleBlock;Nk.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){const n=t.titleBlock;Nk.configure(t,n,i),n.options=i},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const ZC=new WeakMap;var YC={id:"subtitle",start(t,e,i){const n=new WC({ctx:t.ctx,options:i,chart:t});Nk.configure(t,n,i),Nk.addBox(t,n),ZC.set(t,n)},stop(t){Nk.removeBox(t,ZC.get(t)),ZC.delete(t)},beforeUpdate(t,e,i){const n=ZC.get(t);Nk.configure(t,n,i),n.options=i},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const XC={average(t){if(!t.length)return!1;let e,i,n=new Set,o=0,s=0;for(e=0,i=t.length;e<i;++e){const i=t[e].element;if(i&&i.hasValue()){const t=i.tooltipPosition();n.add(t.x),o+=t.y,++s}}if(0===s||0===n.size)return!1;const r=[...n].reduce(((t,e)=>t+e))/n.size;return{x:r,y:o/s}},nearest(t,e){if(!t.length)return!1;let i,n,o,s=e.x,r=e.y,a=Number.POSITIVE_INFINITY;for(i=0,n=t.length;i<n;++i){const n=t[i].element;if(n&&n.hasValue()){const t=Bx(e,n.getCenterPoint());t<a&&(a=t,o=n)}}if(o){const t=o.tooltipPosition();s=t.x,r=t.y}return{x:s,y:r}}};function KC(t,e){return e&&(tx(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function QC(t){return("string"==typeof t||t instanceof String)&&t.indexOf("\n")>-1?t.split("\n"):t}function JC(t,e){const{element:i,datasetIndex:n,index:o}=e,s=t.getDatasetMeta(n).controller,{label:r,value:a}=s.getLabelAndValue(o);return{chart:t,label:r,parsed:s.getParsed(o),raw:t.data.datasets[n].data[o],formattedValue:a,dataset:s.getDataset(),dataIndex:o,datasetIndex:n,element:i}}function tE(t,e){const i=t.chart.ctx,{body:n,footer:o,title:s}=t,{boxWidth:r,boxHeight:a}=e,l=U_(e.bodyFont),c=U_(e.titleFont),h=U_(e.footerFont),d=s.length,u=o.length,p=n.length,f=H_(e.padding);let m=f.height,g=0,v=n.reduce(((t,e)=>t+e.before.length+e.lines.length+e.after.length),0);if(v+=t.beforeBody.length+t.afterBody.length,d&&(m+=d*c.lineHeight+(d-1)*e.titleSpacing+e.titleMarginBottom),v){m+=p*(e.displayColors?Math.max(a,l.lineHeight):l.lineHeight)+(v-p)*l.lineHeight+(v-1)*e.bodySpacing}u&&(m+=e.footerMarginTop+u*h.lineHeight+(u-1)*e.footerSpacing);let y=0;const b=function(t){g=Math.max(g,i.measureText(t).width+y)};return i.save(),i.font=c.string,ax(t.title,b),i.font=l.string,ax(t.beforeBody.concat(t.afterBody),b),y=e.displayColors?r+2+e.boxPadding:0,ax(n,(t=>{ax(t.before,b),ax(t.lines,b),ax(t.after,b)})),y=0,i.font=h.string,ax(t.footer,b),i.restore(),g+=f.width,{width:g,height:m}}function eE(t,e,i,n){const{x:o,width:s}=i,{width:r,chartArea:{left:a,right:l}}=t;let c="center";return"center"===n?c=o<=(a+l)/2?"left":"right":o<=s/2?c="left":o>=r-s/2&&(c="right"),function(t,e,i,n){const{x:o,width:s}=n,r=i.caretSize+i.caretPadding;return"left"===t&&o+s+r>e.width||"right"===t&&o-s-r<0||void 0}(c,t,e,i)&&(c="center"),c}function iE(t,e,i){const n=i.yAlign||e.yAlign||function(t,e){const{y:i,height:n}=e;return i<n/2?"top":i>t.height-n/2?"bottom":"center"}(t,i);return{xAlign:i.xAlign||e.xAlign||eE(t,e,i,n),yAlign:n}}function nE(t,e,i,n){const{caretSize:o,caretPadding:s,cornerRadius:r}=t,{xAlign:a,yAlign:l}=i,c=o+s,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:p}=V_(r);let f=function(t,e){let{x:i,width:n}=t;return"right"===e?i-=n:"center"===e&&(i-=n/2),i}(e,a);const m=function(t,e,i){let{y:n,height:o}=t;return"top"===e?n+=i:n-="bottom"===e?o+i:o/2,n}(e,l,c);return"center"===l?"left"===a?f+=c:"right"===a&&(f-=c):"left"===a?f-=Math.max(h,u)+o:"right"===a&&(f+=Math.max(d,p)+o),{x:Vx(f,0,n.width-e.width),y:Vx(m,0,n.height-e.height)}}function oE(t,e,i){const n=H_(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-n.right:t.x+n.left}function sE(t){return KC([],QC(t))}function rE(t,e){const i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}const aE={beforeTitle:Kb,title(t){if(t.length>0){const e=t[0],i=e.chart.data.labels,n=i?i.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(n>0&&e.dataIndex<n)return i[e.dataIndex]}return""},afterTitle:Kb,beforeBody:Kb,beforeLabel:Kb,label(t){if(this&&this.options&&"dataset"===this.options.mode)return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const i=t.formattedValue;return Jb(i)||(e+=i),e},labelColor(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:Kb,afterBody:Kb,beforeFooter:Kb,footer:Kb,afterFooter:Kb};function lE(t,e,i,n){const o=t[e].call(i,n);return void 0===o?aE[e].call(i,n):o}class cE extends iS{static positioners=XC;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),n=i.enabled&&e.options.animation&&i.animations,o=new Ww(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=(t=this.chart.getContext(),e=this,i=this._tooltipItems,G_(t,{tooltip:e,tooltipItems:i,type:"tooltip"})));var t,e,i}getTitle(t,e){const{callbacks:i}=e,n=lE(i,"beforeTitle",this,t),o=lE(i,"title",this,t),s=lE(i,"afterTitle",this,t);let r=[];return r=KC(r,QC(n)),r=KC(r,QC(o)),r=KC(r,QC(s)),r}getBeforeBody(t,e){return sE(lE(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:i}=e,n=[];return ax(t,(t=>{const e={before:[],lines:[],after:[]},o=rE(i,t);KC(e.before,QC(lE(o,"beforeLabel",this,t))),KC(e.lines,lE(o,"label",this,t)),KC(e.after,QC(lE(o,"afterLabel",this,t))),n.push(e)})),n}getAfterBody(t,e){return sE(lE(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:i}=e,n=lE(i,"beforeFooter",this,t),o=lE(i,"footer",this,t),s=lE(i,"afterFooter",this,t);let r=[];return r=KC(r,QC(n)),r=KC(r,QC(o)),r=KC(r,QC(s)),r}_createItems(t){const e=this._active,i=this.chart.data,n=[],o=[],s=[];let r,a,l=[];for(r=0,a=e.length;r<a;++r)l.push(JC(this.chart,e[r]));return t.filter&&(l=l.filter(((e,n,o)=>t.filter(e,n,o,i)))),t.itemSort&&(l=l.sort(((e,n)=>t.itemSort(e,n,i)))),ax(l,(e=>{const i=rE(t.callbacks,e);n.push(lE(i,"labelColor",this,e)),o.push(lE(i,"labelPointStyle",this,e)),s.push(lE(i,"labelTextColor",this,e))})),this.labelColors=n,this.labelPointStyles=o,this.labelTextColors=s,this.dataPoints=l,l}update(t,e){const i=this.options.setContext(this.getContext()),n=this._active;let o,s=[];if(n.length){const t=XC[i.position].call(this,n,this._eventPosition);s=this._createItems(i),this.title=this.getTitle(s,i),this.beforeBody=this.getBeforeBody(s,i),this.body=this.getBody(s,i),this.afterBody=this.getAfterBody(s,i),this.footer=this.getFooter(s,i);const e=this._size=tE(this,i),r=Object.assign({},t,e),a=iE(this.chart,i,r),l=nE(i,r,a,this.chart);this.xAlign=a.xAlign,this.yAlign=a.yAlign,o={opacity:1,x:l.x,y:l.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(o={opacity:0});this._tooltipItems=s,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,n){const o=this.getCaretPosition(t,i,n);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,i){const{xAlign:n,yAlign:o}=this,{caretSize:s,cornerRadius:r}=i,{topLeft:a,topRight:l,bottomLeft:c,bottomRight:h}=V_(r),{x:d,y:u}=t,{width:p,height:f}=e;let m,g,v,y,b,x;return"center"===o?(b=u+f/2,"left"===n?(m=d,g=m-s,y=b+s,x=b-s):(m=d+p,g=m+s,y=b-s,x=b+s),v=m):(g="left"===n?d+Math.max(a,c)+s:"right"===n?d+p-Math.max(l,h)-s:this.caretX,"top"===o?(y=u,b=y-s,m=g-s,v=g+s):(y=u+f,b=y+s,m=g+s,v=g-s),x=y),{x1:m,x2:g,x3:v,y1:y,y2:b,y3:x}}drawTitle(t,e,i){const n=this.title,o=n.length;let s,r,a;if(o){const l=Ow(i.rtl,this.x,this.width);for(t.x=oE(this,i.titleAlign,i),e.textAlign=l.textAlign(i.titleAlign),e.textBaseline="middle",s=U_(i.titleFont),r=i.titleSpacing,e.fillStyle=i.titleColor,e.font=s.string,a=0;a<o;++a)e.fillText(n[a],l.x(t.x),t.y+s.lineHeight/2),t.y+=s.lineHeight+r,a+1===o&&(t.y+=i.titleMarginBottom-r)}}_drawColorBox(t,e,i,n,o){const s=this.labelColors[i],r=this.labelPointStyles[i],{boxHeight:a,boxWidth:l}=o,c=U_(o.bodyFont),h=oE(this,"left",o),d=n.x(h),u=a<c.lineHeight?(c.lineHeight-a)/2:0,p=e.y+u;if(o.usePointStyle){const e={radius:Math.min(l,a)/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:1},i=n.leftForLtr(d,l)+l/2,c=p+a/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,E_(t,e,i,c),t.strokeStyle=s.borderColor,t.fillStyle=s.backgroundColor,E_(t,e,i,c)}else{t.lineWidth=ex(s.borderWidth)?Math.max(...Object.values(s.borderWidth)):s.borderWidth||1,t.strokeStyle=s.borderColor,t.setLineDash(s.borderDash||[]),t.lineDashOffset=s.borderDashOffset||0;const e=n.leftForLtr(d,l),i=n.leftForLtr(n.xPlus(d,1),l-2),r=V_(s.borderRadius);Object.values(r).some((t=>0!==t))?(t.beginPath(),t.fillStyle=o.multiKeyBackground,z_(t,{x:e,y:p,w:l,h:a,radius:r}),t.fill(),t.stroke(),t.fillStyle=s.backgroundColor,t.beginPath(),z_(t,{x:i,y:p+1,w:l-2,h:a-2,radius:r}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(e,p,l,a),t.strokeRect(e,p,l,a),t.fillStyle=s.backgroundColor,t.fillRect(i,p+1,l-2,a-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:n}=this,{bodySpacing:o,bodyAlign:s,displayColors:r,boxHeight:a,boxWidth:l,boxPadding:c}=i,h=U_(i.bodyFont);let d=h.lineHeight,u=0;const p=Ow(i.rtl,this.x,this.width),f=function(i){e.fillText(i,p.x(t.x+u),t.y+d/2),t.y+=d+o},m=p.textAlign(s);let g,v,y,b,x,_,w;for(e.textAlign=s,e.textBaseline="middle",e.font=h.string,t.x=oE(this,m,i),e.fillStyle=i.bodyColor,ax(this.beforeBody,f),u=r&&"right"!==m?"center"===s?l/2+c:l+2+c:0,b=0,_=n.length;b<_;++b){for(g=n[b],v=this.labelTextColors[b],e.fillStyle=v,ax(g.before,f),y=g.lines,r&&y.length&&(this._drawColorBox(e,t,b,p,i),d=Math.max(h.lineHeight,a)),x=0,w=y.length;x<w;++x)f(y[x]),d=h.lineHeight;ax(g.after,f)}u=0,d=h.lineHeight,ax(this.afterBody,f),t.y-=o}drawFooter(t,e,i){const n=this.footer,o=n.length;let s,r;if(o){const a=Ow(i.rtl,this.x,this.width);for(t.x=oE(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=a.textAlign(i.footerAlign),e.textBaseline="middle",s=U_(i.footerFont),e.fillStyle=i.footerColor,e.font=s.string,r=0;r<o;++r)e.fillText(n[r],a.x(t.x),t.y+s.lineHeight/2),t.y+=s.lineHeight+i.footerSpacing}}drawBackground(t,e,i,n){const{xAlign:o,yAlign:s}=this,{x:r,y:a}=t,{width:l,height:c}=i,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:p}=V_(n.cornerRadius);e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,e.lineWidth=n.borderWidth,e.beginPath(),e.moveTo(r+h,a),"top"===s&&this.drawCaret(t,e,i,n),e.lineTo(r+l-d,a),e.quadraticCurveTo(r+l,a,r+l,a+d),"center"===s&&"right"===o&&this.drawCaret(t,e,i,n),e.lineTo(r+l,a+c-p),e.quadraticCurveTo(r+l,a+c,r+l-p,a+c),"bottom"===s&&this.drawCaret(t,e,i,n),e.lineTo(r+u,a+c),e.quadraticCurveTo(r,a+c,r,a+c-u),"center"===s&&"left"===o&&this.drawCaret(t,e,i,n),e.lineTo(r,a+h),e.quadraticCurveTo(r,a,r+h,a),e.closePath(),e.fill(),n.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,n=i&&i.x,o=i&&i.y;if(n||o){const i=XC[t.position].call(this,this._active,this._eventPosition);if(!i)return;const s=this._size=tE(this,t),r=Object.assign({},i,this._size),a=iE(e,t,r),l=nE(t,r,a,e);n._to===l.x&&o._to===l.y||(this.xAlign=a.xAlign,this.yAlign=a.yAlign,this.width=s.width,this.height=s.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,l))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const n={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const s=H_(e.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&r&&(t.save(),t.globalAlpha=i,this.drawBackground(o,t,n,e),Dw(t,e.textDirection),o.y+=s.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),Iw(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,n=t.map((({datasetIndex:t,index:e})=>{const i=this.chart.getDatasetMeta(t);if(!i)throw new Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:i.data[e],index:e}})),o=!lx(i,n),s=this._positionChanged(n,e);(o||s)&&(this._active=n,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const n=this.options,o=this._active||[],s=this._getActiveElements(t,o,e,i),r=this._positionChanged(s,t),a=e||!lx(s,o)||r;return a&&(this._active=s,(n.enabled||n.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),a}_getActiveElements(t,e,i,n){const o=this.options;if("mouseout"===t.type)return[];if(!n)return e.filter((t=>this.chart.data.datasets[t.datasetIndex]&&void 0!==this.chart.getDatasetMeta(t.datasetIndex).controller.getParsed(t.index)));const s=this.chart.getElementsAtEventForMode(t,o.mode,o,i);return o.reverse&&s.reverse(),s}_positionChanged(t,e){const{caretX:i,caretY:n,options:o}=this,s=XC[o.position].call(this,t,e);return!1!==s&&(i!==s.x||n!==s.y)}}var hE={id:"tooltip",_element:cE,positioners:XC,afterInit(t,e,i){i&&(t.tooltip=new cE({chart:t,options:i}))},beforeUpdate(t,e,i){t.tooltip&&t.tooltip.initialize(i)},reset(t,e,i){t.tooltip&&t.tooltip.initialize(i)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const i={tooltip:e};if(!1===t.notifyPlugins("beforeTooltipDraw",{...i,cancelable:!0}))return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",i)}},afterEvent(t,e){if(t.tooltip){const i=e.replay;t.tooltip.handleEvent(e.event,i,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:aE},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},dE=Object.freeze({__proto__:null,Colors:_C,Decimation:SC,Filler:FC,Legend:UC,SubTitle:YC,Title:GC,Tooltip:hE});function uE(t,e,i,n){const o=t.indexOf(e);if(-1===o)return((t,e,i,n)=>("string"==typeof e?(i=t.push(e)-1,n.unshift({index:i,label:e})):isNaN(e)&&(i=null),i))(t,e,i,n);return o!==t.lastIndexOf(e)?i:o}function pE(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}function fE(t,e){const i=[],{bounds:n,step:o,min:s,max:r,precision:a,count:l,maxTicks:c,maxDigits:h,includeBounds:d}=t,u=o||1,p=c-1,{min:f,max:m}=e,g=!Jb(s),v=!Jb(r),y=!Jb(l),b=(m-f)/(h+1);let x,_,w,k,S=Dx((m-f)/p/u)*u;if(S<1e-14&&!g&&!v)return[{value:f},{value:m}];k=Math.ceil(m/S)-Math.floor(f/S),k>p&&(S=Dx(k*S/p/u)*u),Jb(a)||(x=Math.pow(10,a),S=Math.ceil(S*x)/x),"ticks"===n?(_=Math.floor(f/S)*S,w=Math.ceil(m/S)*S):(_=f,w=m),g&&v&&o&&function(t,e){const i=Math.round(t);return i-e<=t&&i+e>=t}((r-s)/o,S/1e3)?(k=Math.round(Math.min((r-s)/S,c)),S=(r-s)/k,_=s,w=r):y?(_=g?s:_,w=v?r:w,k=l-1,S=(w-_)/k):(k=(w-_)/S,k=Ox(k,Math.round(k),S/1e3)?Math.round(k):Math.ceil(k));const C=Math.max(Rx(S),Rx(_));x=Math.pow(10,Jb(a)?C:a),_=Math.round(_*x)/x,w=Math.round(w*x)/x;let E=0;for(g&&(d&&_!==s?(i.push({value:s}),_<s&&E++,Ox(Math.round((_+E*S)*x)/x,s,mE(s,b,t))&&E++):_<s&&E++);E<k;++E){const t=Math.round((_+E*S)*x)/x;if(v&&t>r)break;i.push({value:t})}return v&&d&&w!==r?i.length&&Ox(i[i.length-1].value,r,mE(r,b,t))?i[i.length-1].value=r:i.push({value:r}):v&&w!==r||i.push({value:w}),i}function mE(t,e,{horizontal:i,minRotation:n}){const o=$x(n),s=(i?Math.sin(o):Math.cos(o))||.001,r=.75*e*(""+t).length;return Math.min(e/s,r)}class gE extends uS{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return Jb(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:n,max:o}=this;const s=t=>n=e?n:t,r=t=>o=i?o:t;if(t){const t=Px(n),e=Px(o);t<0&&e<0?r(0):t>0&&e>0&&s(0)}if(n===o){let e=0===o?1:Math.abs(.05*o);r(o+e),t||s(n-e)}this.min=n,this.max=o}getTickLimit(){const t=this.options.ticks;let e,{maxTicksLimit:i,stepSize:n}=t;return n?(e=Math.ceil(this.max/n)-Math.floor(this.min/n)+1,e>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${n} would result generating up to ${e} ticks. Limiting to 1000.`),e=1e3)):(e=this.computeTickLimit(),i=i||11),i&&(e=Math.min(i,e)),e}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const n=fE({maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:!1!==e.includeBounds},this._range||this);return"ticks"===t.bounds&&Lx(n,this,"value"),t.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const n=(i-e)/Math.max(t.length-1,1)/2;e-=n,i+=n}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return p_(t,this.chart.options.locale,this.options.ticks.format)}}class vE extends gE{static id="linear";static defaults={ticks:{callback:m_.formatters.numeric}};determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=ix(t)?t:0,this.max=ix(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=$x(this.options.ticks.minRotation),n=(t?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/n))}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const yE=t=>Math.floor(Tx(t)),bE=(t,e)=>Math.pow(10,yE(t)+e);function xE(t){return 1===t/Math.pow(10,yE(t))}function _E(t,e,i){const n=Math.pow(10,i),o=Math.floor(t/n);return Math.ceil(e/n)-o}function wE(t,{min:e,max:i}){e=nx(t.min,e);const n=[],o=yE(e);let s=function(t,e){let i=yE(e-t);for(;_E(t,e,i)>10;)i++;for(;_E(t,e,i)<10;)i--;return Math.min(i,yE(t))}(e,i),r=s<0?Math.pow(10,Math.abs(s)):1;const a=Math.pow(10,s),l=o>s?Math.pow(10,o):0,c=Math.round((e-l)*r)/r,h=Math.floor((e-l)/a/10)*a*10;let d=Math.floor((c-h)/Math.pow(10,s)),u=nx(t.min,Math.round((l+h+d*Math.pow(10,s))*r)/r);for(;u<i;)n.push({value:u,major:xE(u),significand:d}),d>=10?d=d<15?15:20:d++,d>=20&&(s++,d=2,r=s>=0?1:r),u=Math.round((l+h+d*Math.pow(10,s))*r)/r;const p=nx(t.max,u);return n.push({value:p,major:xE(p),significand:d}),n}class kE extends uS{static id="logarithmic";static defaults={ticks:{callback:m_.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=gE.prototype.parse.apply(this,[t,e]);if(0!==i)return ix(i)&&i>0?i:null;this._zero=!0}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=ix(t)?Math.max(0,t):null,this.max=ix(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!ix(this._userMin)&&(this.min=t===bE(this.min,0)?bE(this.min,-1):bE(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,n=this.max;const o=e=>i=t?i:e,s=t=>n=e?n:t;i===n&&(i<=0?(o(1),s(10)):(o(bE(i,-1)),s(bE(n,1)))),i<=0&&o(bE(n,-1)),n<=0&&s(bE(i,1)),this.min=i,this.max=n}buildTicks(){const t=this.options,e=wE({min:this._userMin,max:this._userMax},this);return"ticks"===t.bounds&&Lx(e,this,"value"),t.reverse?(e.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),e}getLabelForValue(t){return void 0===t?"0":p_(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=Tx(t),this._valueRange=Tx(this.max)-Tx(t)}getPixelForValue(t){return void 0!==t&&0!==t||(t=this.min),null===t||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Tx(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}function SE(t){const e=t.ticks;if(e.display&&t.display){const t=H_(e.backdropPadding);return ox(e.font&&e.font.size,__.font.size)+t.height}return 0}function CE(t,e,i,n,o){return t===n||t===o?{start:e-i/2,end:e+i/2}:t<n||t>o?{start:e-i,end:e}:{start:e,end:e+i}}function EE(t){const e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},i=Object.assign({},e),n=[],o=[],s=t._pointLabels.length,r=t.options.pointLabels,a=r.centerPointLabels?_x/s:0;for(let d=0;d<s;d++){const s=r.setContext(t.getPointLabelContext(d));o[d]=s.padding;const u=t.getPointPosition(d,t.drawingArea+o[d],a),p=U_(s.font),f=(l=t.ctx,c=p,h=tx(h=t._pointLabels[d])?h:[h],{w:k_(l,c.string,h),h:h.length*c.lineHeight});n[d]=f;const m=Fx(t.getIndexAngle(d)+a),g=Math.round(zx(m));AE(i,e,m,CE(g,u.x,f.w,0,180),CE(g,u.y,f.h,90,270))}var l,c,h;t.setCenterPoint(e.l-i.l,i.r-e.r,e.t-i.t,i.b-e.b),t._pointLabelItems=function(t,e,i){const n=[],o=t._pointLabels.length,s=t.options,{centerPointLabels:r,display:a}=s.pointLabels,l={extra:SE(s)/2,additionalAngle:r?_x/o:0};let c;for(let s=0;s<o;s++){l.padding=i[s],l.size=e[s];const o=ME(t,s,l);n.push(o),"auto"===a&&(o.visible=TE(o,c),o.visible&&(c=o))}return n}(t,n,o)}function AE(t,e,i,n,o){const s=Math.abs(Math.sin(i)),r=Math.abs(Math.cos(i));let a=0,l=0;n.start<e.l?(a=(e.l-n.start)/s,t.l=Math.min(t.l,e.l-a)):n.end>e.r&&(a=(n.end-e.r)/s,t.r=Math.max(t.r,e.r+a)),o.start<e.t?(l=(e.t-o.start)/r,t.t=Math.min(t.t,e.t-l)):o.end>e.b&&(l=(o.end-e.b)/r,t.b=Math.max(t.b,e.b+l))}function ME(t,e,i){const n=t.drawingArea,{extra:o,additionalAngle:s,padding:r,size:a}=i,l=t.getPointPosition(e,n+o+r,s),c=Math.round(zx(Fx(l.angle+Ex))),h=function(t,e,i){90===i||270===i?t-=e/2:(i>270||i<90)&&(t-=e);return t}(l.y,a.h,c),d=function(t){if(0===t||180===t)return"center";if(t<180)return"left";return"right"}(c),u=function(t,e,i){"right"===i?t-=e:"center"===i&&(t-=e/2);return t}(l.x,a.w,d);return{visible:!0,x:l.x,y:h,textAlign:d,left:u,top:h,right:u+a.w,bottom:h+a.h}}function TE(t,e){if(!e)return!0;const{left:i,top:n,right:o,bottom:s}=t;return!(M_({x:i,y:n},e)||M_({x:i,y:s},e)||M_({x:o,y:n},e)||M_({x:o,y:s},e))}function PE(t,e,i){const{left:n,top:o,right:s,bottom:r}=i,{backdropColor:a}=e;if(!Jb(a)){const i=V_(e.borderRadius),l=H_(e.backdropPadding);t.fillStyle=a;const c=n-l.left,h=o-l.top,d=s-n+l.width,u=r-o+l.height;Object.values(i).some((t=>0!==t))?(t.beginPath(),z_(t,{x:c,y:h,w:d,h:u,radius:i}),t.fill()):t.fillRect(c,h,d,u)}}function OE(t,e,i,n){const{ctx:o}=t;if(i)o.arc(t.xCenter,t.yCenter,e,0,wx);else{let i=t.getPointPosition(0,e);o.moveTo(i.x,i.y);for(let s=1;s<n;s++)i=t.getPointPosition(s,e),o.lineTo(i.x,i.y)}}class DE extends gE{static id="radialLinear";static defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:m_.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:t=>t,padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=H_(SE(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!1);this.min=ix(t)&&!isNaN(t)?t:0,this.max=ix(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/SE(this.options))}generateTickLabels(t){gE.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map(((t,e)=>{const i=rx(this.options.pointLabels.callback,[t,e],this);return i||0===i?i:""})).filter(((t,e)=>this.chart.getDataVisibility(e)))}fit(){const t=this.options;t.display&&t.pointLabels.display?EE(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,n){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,n))}getIndexAngle(t){return Fx(t*(wx/(this._pointLabels.length||1))+$x(this.options.startAngle||0))}getDistanceFromCenterForValue(t){if(Jb(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(Jb(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t<e.length){const i=e[t];return function(t,e,i){return G_(t,{label:i,index:e,type:"pointLabel"})}(this.getContext(),t,i)}}getPointPosition(t,e,i=0){const n=this.getIndexAngle(t)-Ex+i;return{x:Math.cos(n)*e+this.xCenter,y:Math.sin(n)*e+this.yCenter,angle:n}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:e,top:i,right:n,bottom:o}=this._pointLabelItems[t];return{left:e,top:i,right:n,bottom:o}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const i=this.ctx;i.save(),i.beginPath(),OE(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){const t=this.ctx,e=this.options,{angleLines:i,grid:n,border:o}=e,s=this._pointLabels.length;let r,a,l;if(e.pointLabels.display&&function(t,e){const{ctx:i,options:{pointLabels:n}}=t;for(let o=e-1;o>=0;o--){const e=t._pointLabelItems[o];if(!e.visible)continue;const s=n.setContext(t.getPointLabelContext(o));PE(i,s,e);const r=U_(s.font),{x:a,y:l,textAlign:c}=e;$_(i,t._pointLabels[o],a,l+r.lineHeight/2,r,{color:s.color,textAlign:c,textBaseline:"middle"})}}(this,s),n.display&&this.ticks.forEach(((t,e)=>{if(0!==e||0===e&&this.min<0){a=this.getDistanceFromCenterForValue(t.value);const i=this.getContext(e),r=n.setContext(i),l=o.setContext(i);!function(t,e,i,n,o){const s=t.ctx,r=e.circular,{color:a,lineWidth:l}=e;!r&&!n||!a||!l||i<0||(s.save(),s.strokeStyle=a,s.lineWidth=l,s.setLineDash(o.dash||[]),s.lineDashOffset=o.dashOffset,s.beginPath(),OE(t,i,r,n),s.closePath(),s.stroke(),s.restore())}(this,r,a,s,l)}})),i.display){for(t.save(),r=s-1;r>=0;r--){const n=i.setContext(this.getPointLabelContext(r)),{color:o,lineWidth:s}=n;s&&o&&(t.lineWidth=s,t.strokeStyle=o,t.setLineDash(n.borderDash),t.lineDashOffset=n.borderDashOffset,a=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),l=this.getPointPosition(r,a),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const n=this.getIndexAngle(0);let o,s;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(n),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach(((n,r)=>{if(0===r&&this.min>=0&&!e.reverse)return;const a=i.setContext(this.getContext(r)),l=U_(a.font);if(o=this.getDistanceFromCenterForValue(this.ticks[r].value),a.showLabelBackdrop){t.font=l.string,s=t.measureText(n.label).width,t.fillStyle=a.backdropColor;const e=H_(a.backdropPadding);t.fillRect(-s/2-e.left,-o-l.size/2-e.top,s+e.width,l.size+e.height)}$_(t,n.label,0,-o,l,{color:a.color,strokeColor:a.textStrokeColor,strokeWidth:a.textStrokeWidth})})),t.restore()}drawTitle(){}}const IE={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},LE=Object.keys(IE);function $E(t,e){return t-e}function zE(t,e){if(Jb(e))return null;const i=t._adapter,{parser:n,round:o,isoWeekday:s}=t._parseOpts;let r=e;return"function"==typeof n&&(r=n(r)),ix(r)||(r="string"==typeof n?i.parse(r,n):i.parse(r)),null===r?null:(o&&(r="week"!==o||!Ix(s)&&!0!==s?i.startOf(r,o):i.startOf(r,"isoWeek",s)),+r)}function RE(t,e,i,n){const o=LE.length;for(let s=LE.indexOf(t);s<o-1;++s){const t=IE[LE[s]],o=t.steps?t.steps:Number.MAX_SAFE_INTEGER;if(t.common&&Math.ceil((i-e)/(o*t.size))<=n)return LE[s]}return LE[o-1]}function NE(t,e,i){if(i){if(i.length){const{lo:n,hi:o}=Ux(i,e);t[i[n]>=e?i[n]:i[o]]=!0}}else t[e]=!0}function BE(t,e,i){const n=[],o={},s=e.length;let r,a;for(r=0;r<s;++r)a=e[r],o[a]=r,n.push({value:a,major:!1});return 0!==s&&i?function(t,e,i,n){const o=t._adapter,s=+o.startOf(e[0].value,n),r=e[e.length-1].value;let a,l;for(a=s;a<=r;a=+o.add(a,1,n))l=i[a],l>=0&&(e[l].major=!0);return e}(t,n,o,i):n}class jE extends uS{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){const i=t.time||(t.time={}),n=this._adapter=new yk._date(t.adapters.date);n.init(e),px(i.displayFormats,n.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return void 0===t?null:zE(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,i=t.time.unit||"day";let{min:n,max:o,minDefined:s,maxDefined:r}=this.getUserBounds();function a(t){s||isNaN(t.min)||(n=Math.min(n,t.min)),r||isNaN(t.max)||(o=Math.max(o,t.max))}s&&r||(a(this._getLabelBounds()),"ticks"===t.bounds&&"labels"===t.ticks.source||a(this.getMinMax(!1))),n=ix(n)&&!isNaN(n)?n:+e.startOf(Date.now(),i),o=ix(o)&&!isNaN(o)?o:+e.endOf(Date.now(),i)+1,this.min=Math.min(n,o-1),this.max=Math.max(n+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){const t=this.options,e=t.time,i=t.ticks,n="labels"===i.source?this.getLabelTimestamps():this._generate();"ticks"===t.bounds&&n.length&&(this.min=this._userMin||n[0],this.max=this._userMax||n[n.length-1]);const o=this.min,s=function(t,e,i){let n=0,o=t.length;for(;n<o&&t[n]<e;)n++;for(;o>n&&t[o-1]>i;)o--;return n>0||o<t.length?t.slice(n,o):t}(n,o,this.max);return this._unit=e.unit||(i.autoSkip?RE(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):function(t,e,i,n,o){for(let s=LE.length-1;s>=LE.indexOf(i);s--){const i=LE[s];if(IE[i].common&&t._adapter.diff(o,n,i)>=e-1)return i}return LE[i?LE.indexOf(i):0]}(this,s.length,e.minUnit,this.min,this.max)),this._majorUnit=i.major.enabled&&"year"!==this._unit?function(t){for(let e=LE.indexOf(t)+1,i=LE.length;e<i;++e)if(IE[LE[e]].common)return LE[e]}(this._unit):void 0,this.initOffsets(n),t.reverse&&s.reverse(),BE(this,s,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map((t=>+t.value)))}initOffsets(t=[]){let e,i,n=0,o=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),n=1===t.length?1-e:(this.getDecimalForValue(t[1])-e)/2,i=this.getDecimalForValue(t[t.length-1]),o=1===t.length?i:(i-this.getDecimalForValue(t[t.length-2]))/2);const s=t.length<3?.5:.25;n=Vx(n,0,s),o=Vx(o,0,s),this._offsets={start:n,end:o,factor:1/(n+1+o)}}_generate(){const t=this._adapter,e=this.min,i=this.max,n=this.options,o=n.time,s=o.unit||RE(o.minUnit,e,i,this._getLabelCapacity(e)),r=ox(n.ticks.stepSize,1),a="week"===s&&o.isoWeekday,l=Ix(a)||!0===a,c={};let h,d,u=e;if(l&&(u=+t.startOf(u,"isoWeek",a)),u=+t.startOf(u,l?"day":s),t.diff(i,e,s)>1e5*r)throw new Error(e+" and "+i+" are too far apart with stepSize of "+r+" "+s);const p="data"===n.ticks.source&&this.getDataTimestamps();for(h=u,d=0;h<i;h=+t.add(h,r,s),d++)NE(c,h,p);return h!==i&&"ticks"!==n.bounds&&1!==d||NE(c,h,p),Object.keys(c).sort($E).map((t=>+t))}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){const i=this.options.time.displayFormats,n=this._unit,o=e||i[n];return this._adapter.format(t,o)}_tickFormatFunction(t,e,i,n){const o=this.options,s=o.ticks.callback;if(s)return rx(s,[t,e,i],this);const r=o.time.displayFormats,a=this._unit,l=this._majorUnit,c=a&&r[a],h=l&&r[l],d=i[e],u=l&&h&&d&&d.major;return this._adapter.format(t,n||(u?h:c))}generateTickLabels(t){let e,i,n;for(e=0,i=t.length;e<i;++e)n=t[e],n.label=this._tickFormatFunction(n.value,e,t)}getDecimalForValue(t){return null===t?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,i=this.ctx.measureText(t).width,n=$x(this.isHorizontal()?e.maxRotation:e.minRotation),o=Math.cos(n),s=Math.sin(n),r=this._resolveTickFontOptions(0).size;return{w:i*o+r*s,h:i*s+r*o}}_getLabelCapacity(t){const e=this.options.time,i=e.displayFormats,n=i[e.unit]||i.millisecond,o=this._tickFormatFunction(t,0,BE(this,[t],this._majorUnit),n),s=this._getLabelSize(o),r=Math.floor(this.isHorizontal()?this.width/s.w:this.height/s.h)-1;return r>0?r:1}getDataTimestamps(){let t,e,i=this._cache.data||[];if(i.length)return i;const n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(t=0,e=n.length;t<e;++t)i=i.concat(n[t].controller.getAllParsedValues(this));return this._cache.data=this.normalize(i)}getLabelTimestamps(){const t=this._cache.labels||[];let e,i;if(t.length)return t;const n=this.getLabels();for(e=0,i=n.length;e<i;++e)t.push(zE(this,n[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return Xx(t.sort($E))}}function FE(t,e,i){let n,o,s,r,a=0,l=t.length-1;i?(e>=t[a].pos&&e<=t[l].pos&&({lo:a,hi:l}=Wx(t,"pos",e)),({pos:n,time:s}=t[a]),({pos:o,time:r}=t[l])):(e>=t[a].time&&e<=t[l].time&&({lo:a,hi:l}=Wx(t,"time",e)),({time:n,pos:s}=t[a]),({time:o,pos:r}=t[l]));const c=o-n;return c?s+(r-s)*(e-n)/c:s}var qE=Object.freeze({__proto__:null,CategoryScale:class extends uS{static id="category";static defaults={ticks:{callback:pE}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const t=this.getLabels();for(const{index:i,label:n}of e)t[i]===n&&t.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(Jb(t))return null;const i=this.getLabels();return((t,e)=>null===t?null:Vx(Math.round(t),0,e))(e=isFinite(e)&&i[e]===t?e:uE(i,t,ox(e,t),this._addedLabels),i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:n}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(i=0),e||(n=this.getLabels().length-1)),this.min=i,this.max=n}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,n=[];let o=this.getLabels();o=0===t&&e===o.length-1?o:o.slice(t,e+1),this._valueRange=Math.max(o.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let i=t;i<=e;i++)n.push({value:i});return n}getLabelForValue(t){return pE.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return"number"!=typeof t&&(t=this.parse(t)),null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}},LinearScale:vE,LogarithmicScale:kE,RadialLinearScale:DE,TimeScale:jE,TimeSeriesScale:class extends jE{static id="timeseries";static defaults=jE.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=FE(e,this.min),this._tableRange=FE(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,n=[],o=[];let s,r,a,l,c;for(s=0,r=t.length;s<r;++s)l=t[s],l>=e&&l<=i&&n.push(l);if(n.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(s=0,r=n.length;s<r;++s)c=n[s+1],a=n[s-1],l=n[s],Math.round((c+a)/2)!==l&&o.push({time:l,pos:s/(r-1)});return o}_generate(){const t=this.min,e=this.max;let i=super.getDataTimestamps();return i.includes(t)&&i.length||i.splice(0,0,t),i.includes(e)&&1!==i.length||i.push(e),i.sort(((t,e)=>t-e))}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),i=this.getLabelTimestamps();return t=e.length&&i.length?this.normalize(e.concat(i)):e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(FE(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return FE(this._table,i*this._tableRange+this._minPos,!0)}}});const VE=[mk,fC,dE,qE];VS.register(...VE);
|
|
8656
8697
|
/*!
|
|
8657
8698
|
* chartjs-adapter-luxon v1.3.1
|
|
8658
8699
|
* https://www.chartjs.org
|
|
8659
8700
|
* (c) 2023 chartjs-adapter-luxon Contributors
|
|
8660
8701
|
* Released under the MIT license
|
|
8661
8702
|
*/
|
|
8662
|
-
const
|
|
8703
|
+
const HE={datetime:Ys.DATETIME_MED_WITH_SECONDS,millisecond:"h:mm:ss.SSS a",second:Ys.TIME_WITH_SECONDS,minute:Ys.TIME_SIMPLE,hour:{hour:"numeric"},day:{day:"numeric",month:"short"},week:"DD",month:{month:"short",year:"numeric"},quarter:"'Q'q - yyyy",year:{year:"numeric"}};yk._date.override({_id:"luxon",_create:function(t){return Ys.fromMillis(t,this.options)},init(t){this.options.locale||(this.options.locale=t.locale)},formats:function(){return HE},parse:function(t,e){const i=this.options,n=typeof t;return null===t||"undefined"===n?null:("number"===n?t=this._create(t):"string"===n?t="string"==typeof e?Ys.fromFormat(t,e,i):Ys.fromISO(t,i):t instanceof Date?t=Ys.fromJSDate(t,i):"object"!==n||t instanceof Ys||(t=Ys.fromObject(t,i)),t.isValid?t.valueOf():null)},format:function(t,e){const i=this._create(t);return"string"==typeof e?i.toFormat(e):i.toLocaleString(e)},add:function(t,e,i){const n={};return n[i]=e,this._create(t).plus(n).valueOf()},diff:function(t,e,i){return this._create(t).diff(this._create(e)).as(i).valueOf()},startOf:function(t,e,i){if("isoWeek"===e){i=Math.trunc(Math.min(Math.max(0,i),6));const e=this._create(t);return e.minus({days:(e.weekday-i+7)%7}).startOf("day").valueOf()}return e?this._create(t).startOf(e).valueOf():t},endOf:function(t,e){return this._create(t).endOf(e).valueOf()}});
|
|
8704
|
+
/*!
|
|
8705
|
+
* chartjs-plugin-datalabels v2.2.0
|
|
8706
|
+
* https://chartjs-plugin-datalabels.netlify.app
|
|
8707
|
+
* (c) 2017-2022 chartjs-plugin-datalabels contributors
|
|
8708
|
+
* Released under the MIT license
|
|
8709
|
+
*/
|
|
8710
|
+
var UE=function(){if("undefined"!=typeof window){if(window.devicePixelRatio)return window.devicePixelRatio;var t=window.screen;if(t)return(t.deviceXDPI||1)/(t.logicalXDPI||1)}return 1}(),WE=function(t){var e,i=[];for(t=[].concat(t);t.length;)"string"==typeof(e=t.pop())?i.unshift.apply(i,e.split("\n")):Array.isArray(e)?t.push.apply(t,e):Jb(t)||i.unshift(""+e);return i},GE=function(t,e,i){var n,o=[].concat(e),s=o.length,r=t.font,a=0;for(t.font=i.string,n=0;n<s;++n)a=Math.max(t.measureText(o[n]).width,a);return t.font=r,{height:s*i.lineHeight,width:a}},ZE=function(t,e,i){return Math.max(t,Math.min(e,i))},YE=function(t,e){var i,n,o,s,r=t.slice(),a=[];for(i=0,o=e.length;i<o;++i)s=e[i],-1===(n=r.indexOf(s))?a.push([s,1]):r.splice(n,1);for(i=0,o=r.length;i<o;++i)a.push([r[i],-1]);return a},XE=function(t){return Math.round(t*UE)/UE};function KE(t,e){var i=e.x,n=e.y;if(null===i)return{x:0,y:-1};if(null===n)return{x:1,y:0};var o=t.x-i,s=t.y-n,r=Math.sqrt(o*o+s*s);return{x:r?o/r:0,y:r?s/r:-1}}var QE=0,JE=1,tA=2,eA=4,iA=8;function nA(t,e,i){var n=QE;return t<i.left?n|=JE:t>i.right&&(n|=tA),e<i.top?n|=iA:e>i.bottom&&(n|=eA),n}function oA(t,e){var i,n,o=e.anchor,s=t;return e.clamp&&(s=function(t,e){for(var i,n,o,s=t.x0,r=t.y0,a=t.x1,l=t.y1,c=nA(s,r,e),h=nA(a,l,e);c|h&&!(c&h);)(i=c||h)&iA?(n=s+(a-s)*(e.top-r)/(l-r),o=e.top):i&eA?(n=s+(a-s)*(e.bottom-r)/(l-r),o=e.bottom):i&tA?(o=r+(l-r)*(e.right-s)/(a-s),n=e.right):i&JE&&(o=r+(l-r)*(e.left-s)/(a-s),n=e.left),i===c?c=nA(s=n,r=o,e):h=nA(a=n,l=o,e);return{x0:s,x1:a,y0:r,y1:l}}(s,e.area)),"start"===o?(i=s.x0,n=s.y0):"end"===o?(i=s.x1,n=s.y1):(i=(s.x0+s.x1)/2,n=(s.y0+s.y1)/2),function(t,e,i,n,o){switch(o){case"center":i=n=0;break;case"bottom":i=0,n=1;break;case"right":i=1,n=0;break;case"left":i=-1,n=0;break;case"top":i=0,n=-1;break;case"start":i=-i,n=-n;break;case"end":break;default:o*=Math.PI/180,i=Math.cos(o),n=Math.sin(o)}return{x:t,y:e,vx:i,vy:n}}(i,n,t.vx,t.vy,e.align)}var sA=function(t,e){var i=(t.startAngle+t.endAngle)/2,n=Math.cos(i),o=Math.sin(i),s=t.innerRadius,r=t.outerRadius;return oA({x0:t.x+n*s,y0:t.y+o*s,x1:t.x+n*r,y1:t.y+o*r,vx:n,vy:o},e)},rA=function(t,e){var i=KE(t,e.origin),n=i.x*t.options.radius,o=i.y*t.options.radius;return oA({x0:t.x-n,y0:t.y-o,x1:t.x+n,y1:t.y+o,vx:i.x,vy:i.y},e)},aA=function(t,e){var i=KE(t,e.origin),n=t.x,o=t.y,s=0,r=0;return t.horizontal?(n=Math.min(t.x,t.base),s=Math.abs(t.base-t.x)):(o=Math.min(t.y,t.base),r=Math.abs(t.base-t.y)),oA({x0:n,y0:o+r,x1:n+s,y1:o,vx:i.x,vy:i.y},e)},lA=function(t,e){var i=KE(t,e.origin);return oA({x0:t.x,y0:t.y,x1:t.x+(t.width||0),y1:t.y+(t.height||0),vx:i.x,vy:i.y},e)},cA=XE;function hA(t,e){var i=e.chart.getDatasetMeta(e.datasetIndex).vScale;if(!i)return null;if(void 0!==i.xCenter&&void 0!==i.yCenter)return{x:i.xCenter,y:i.yCenter};var n=i.getBasePixel();return t.horizontal?{x:n,y:null}:{x:null,y:n}}function dA(t,e,i){var n=i.backgroundColor,o=i.borderColor,s=i.borderWidth;(n||o&&s)&&(t.beginPath(),function(t,e,i,n,o,s){var r=Math.PI/2;if(s){var a=Math.min(s,o/2,n/2),l=e+a,c=i+a,h=e+n-a,d=i+o-a;t.moveTo(e,c),l<h&&c<d?(t.arc(l,c,a,-Math.PI,-r),t.arc(h,c,a,-r,0),t.arc(h,d,a,0,r),t.arc(l,d,a,r,Math.PI)):l<h?(t.moveTo(l,i),t.arc(h,c,a,-r,r),t.arc(l,c,a,r,Math.PI+r)):c<d?(t.arc(l,c,a,-Math.PI,0),t.arc(l,d,a,0,Math.PI)):t.arc(l,c,a,-Math.PI,Math.PI),t.closePath(),t.moveTo(e,i)}else t.rect(e,i,n,o)}(t,cA(e.x)+s/2,cA(e.y)+s/2,cA(e.w)-s,cA(e.h)-s,i.borderRadius),t.closePath(),n&&(t.fillStyle=n,t.fill()),o&&s&&(t.strokeStyle=o,t.lineWidth=s,t.lineJoin="miter",t.stroke()))}function uA(t,e,i){var n=t.shadowBlur,o=i.stroked,s=cA(i.x),r=cA(i.y),a=cA(i.w);o&&t.strokeText(e,s,r,a),i.filled&&(n&&o&&(t.shadowBlur=0),t.fillText(e,s,r,a),n&&o&&(t.shadowBlur=n))}var pA=function(t,e,i,n){var o=this;o._config=t,o._index=n,o._model=null,o._rects=null,o._ctx=e,o._el=i};ux(pA.prototype,{_modelize:function(t,e,i,n){var o,s=this,r=s._index,a=U_(W_([i.font,{}],n,r)),l=W_([i.color,__.color],n,r);return{align:W_([i.align,"center"],n,r),anchor:W_([i.anchor,"center"],n,r),area:n.chart.chartArea,backgroundColor:W_([i.backgroundColor,null],n,r),borderColor:W_([i.borderColor,null],n,r),borderRadius:W_([i.borderRadius,0],n,r),borderWidth:W_([i.borderWidth,0],n,r),clamp:W_([i.clamp,!1],n,r),clip:W_([i.clip,!1],n,r),color:l,display:t,font:a,lines:e,offset:W_([i.offset,4],n,r),opacity:W_([i.opacity,1],n,r),origin:hA(s._el,n),padding:H_(W_([i.padding,4],n,r)),positioner:(o=s._el,o instanceof YS?sA:o instanceof rC?rA:o instanceof pC?aA:lA),rotation:W_([i.rotation,0],n,r)*(Math.PI/180),size:GE(s._ctx,e,a),textAlign:W_([i.textAlign,"start"],n,r),textShadowBlur:W_([i.textShadowBlur,0],n,r),textShadowColor:W_([i.textShadowColor,l],n,r),textStrokeColor:W_([i.textStrokeColor,l],n,r),textStrokeWidth:W_([i.textStrokeWidth,0],n,r)}},update:function(t){var e,i,n,o=this,s=null,r=null,a=o._index,l=o._config,c=W_([l.display,!0],t,a);c&&(e=t.dataset.data[a],(n=Jb(i=ox(rx(l.formatter,[e,t]),e))?[]:WE(i)).length&&(r=function(t){var e=t.borderWidth||0,i=t.padding,n=t.size.height,o=t.size.width,s=-o/2,r=-n/2;return{frame:{x:s-i.left-e,y:r-i.top-e,w:o+i.width+2*e,h:n+i.height+2*e},text:{x:s,y:r,w:o,h:n}}}(s=o._modelize(c,n,l,t)))),o._model=s,o._rects=r},geometry:function(){return this._rects?this._rects.frame:{}},rotation:function(){return this._model?this._model.rotation:0},visible:function(){return this._model&&this._model.opacity},model:function(){return this._model},draw:function(t,e){var i,n=t.ctx,o=this._model,s=this._rects;this.visible()&&(n.save(),o.clip&&(i=o.area,n.beginPath(),n.rect(i.left,i.top,i.right-i.left,i.bottom-i.top),n.clip()),n.globalAlpha=ZE(0,o.opacity,1),n.translate(cA(e.x),cA(e.y)),n.rotate(o.rotation),dA(n,s.frame,o),function(t,e,i,n){var o,s=n.textAlign,r=n.color,a=!!r,l=n.font,c=e.length,h=n.textStrokeColor,d=n.textStrokeWidth,u=h&&d;if(c&&(a||u))for(i=function(t,e,i){var n=i.lineHeight,o=t.w,s=t.x;return"center"===e?s+=o/2:"end"!==e&&"right"!==e||(s+=o),{h:n,w:o,x:s,y:t.y+n/2}}(i,s,l),t.font=l.string,t.textAlign=s,t.textBaseline="middle",t.shadowBlur=n.textShadowBlur,t.shadowColor=n.textShadowColor,a&&(t.fillStyle=r),u&&(t.lineJoin="round",t.lineWidth=d,t.strokeStyle=h),o=0,c=e.length;o<c;++o)uA(t,e[o],{stroked:u,filled:a,w:i.w,x:i.x,y:i.y+i.h*o})}(n,o.lines,s.text,o),n.restore())}});var fA=Number.MIN_SAFE_INTEGER||-9007199254740991,mA=Number.MAX_SAFE_INTEGER||9007199254740991;function gA(t,e,i){var n=Math.cos(i),o=Math.sin(i),s=e.x,r=e.y;return{x:s+n*(t.x-s)-o*(t.y-r),y:r+o*(t.x-s)+n*(t.y-r)}}function vA(t,e){var i,n,o,s,r,a=mA,l=fA,c=e.origin;for(i=0;i<t.length;++i)o=(n=t[i]).x-c.x,s=n.y-c.y,r=e.vx*o+e.vy*s,a=Math.min(a,r),l=Math.max(l,r);return{min:a,max:l}}function yA(t,e){var i=e.x-t.x,n=e.y-t.y,o=Math.sqrt(i*i+n*n);return{vx:(e.x-t.x)/o,vy:(e.y-t.y)/o,origin:t,ln:o}}var bA=function(){this._rotation=0,this._rect={x:0,y:0,w:0,h:0}};function xA(t,e,i){var n=e.positioner(t,e),o=n.vx,s=n.vy;if(!o&&!s)return{x:n.x,y:n.y};var r=i.w,a=i.h,l=e.rotation,c=Math.abs(r/2*Math.cos(l))+Math.abs(a/2*Math.sin(l)),h=Math.abs(r/2*Math.sin(l))+Math.abs(a/2*Math.cos(l)),d=1/Math.max(Math.abs(o),Math.abs(s));return c*=o*d,h*=s*d,c+=e.offset*o,h+=e.offset*s,{x:n.x+c,y:n.y+h}}ux(bA.prototype,{center:function(){var t=this._rect;return{x:t.x+t.w/2,y:t.y+t.h/2}},update:function(t,e,i){this._rotation=i,this._rect={x:e.x+t.x,y:e.y+t.y,w:e.w,h:e.h}},contains:function(t){var e=this,i=e._rect;return!((t=gA(t,e.center(),-e._rotation)).x<i.x-1||t.y<i.y-1||t.x>i.x+i.w+2||t.y>i.y+i.h+2)},intersects:function(t){var e,i,n,o=this._points(),s=t._points(),r=[yA(o[0],o[1]),yA(o[0],o[3])];for(this._rotation!==t._rotation&&r.push(yA(s[0],s[1]),yA(s[0],s[3])),e=0;e<r.length;++e)if(i=vA(o,r[e]),n=vA(s,r[e]),i.max<n.min||n.max<i.min)return!1;return!0},_points:function(){var t=this,e=t._rect,i=t._rotation,n=t.center();return[gA({x:e.x,y:e.y},n,i),gA({x:e.x+e.w,y:e.y},n,i),gA({x:e.x+e.w,y:e.y+e.h},n,i),gA({x:e.x,y:e.y+e.h},n,i)]}});var _A={prepare:function(t){var e,i,n,o,s,r=[];for(e=0,n=t.length;e<n;++e)for(i=0,o=t[e].length;i<o;++i)s=t[e][i],r.push(s),s.$layout={_box:new bA,_hidable:!1,_visible:!0,_set:e,_idx:s._index};return r.sort((function(t,e){var i=t.$layout,n=e.$layout;return i._idx===n._idx?n._set-i._set:n._idx-i._idx})),this.update(r),r},update:function(t){var e,i,n,o,s,r=!1;for(e=0,i=t.length;e<i;++e)o=(n=t[e]).model(),(s=n.$layout)._hidable=o&&"auto"===o.display,s._visible=n.visible(),r|=s._hidable;r&&function(t){var e,i,n,o,s,r,a;for(e=0,i=t.length;e<i;++e)(o=(n=t[e]).$layout)._visible&&(a=new Proxy(n._el,{get:(t,e)=>t.getProps([e],!0)[e]}),s=n.geometry(),r=xA(a,n.model(),s),o._box.update(r,s,n.rotation()));(function(t,e){var i,n,o,s;for(i=t.length-1;i>=0;--i)for(o=t[i].$layout,n=i-1;n>=0&&o._visible;--n)(s=t[n].$layout)._visible&&o._box.intersects(s._box)&&e(o,s)})(t,(function(t,e){var i=t._hidable,n=e._hidable;i&&n||n?e._visible=!1:i&&(t._visible=!1)}))}(t)},lookup:function(t,e){var i,n;for(i=t.length-1;i>=0;--i)if((n=t[i].$layout)&&n._visible&&n._box.contains(e))return t[i];return null},draw:function(t,e){var i,n,o,s,r,a;for(i=0,n=e.length;i<n;++i)(s=(o=e[i]).$layout)._visible&&(r=o.geometry(),a=xA(o._el,o.model(),r),s._box.update(a,r,o.rotation()),o.draw(t,a))}},wA={align:"center",anchor:"center",backgroundColor:null,borderColor:null,borderRadius:0,borderWidth:0,clamp:!1,clip:!1,color:void 0,display:!0,font:{family:void 0,lineHeight:1.2,size:void 0,style:void 0,weight:null},formatter:function(t){if(Jb(t))return null;var e,i,n,o=t;if(ex(t))if(Jb(t.label))if(Jb(t.r))for(o="",n=0,i=(e=Object.keys(t)).length;n<i;++n)o+=(0!==n?", ":"")+e[n]+": "+t[e[n]];else o=t.r;else o=t.label;return""+o},labels:void 0,listeners:{},offset:4,opacity:1,padding:{top:4,right:4,bottom:4,left:4},rotation:0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,textShadowBlur:0,textShadowColor:void 0},kA="$datalabels",SA="$default";function CA(t,e,i,n){if(e){var o,s=i.$context,r=i.$groups;e[r._set]&&(o=e[r._set][r._key])&&!0===rx(o,[s,n])&&(t[kA]._dirty=!0,i.update(s))}}function EA(t,e){var i,n,o=t[kA],s=o._listeners;if(s.enter||s.leave){if("mousemove"===e.type)n=_A.lookup(o._labels,e);else if("mouseout"!==e.type)return;i=o._hovered,o._hovered=n,function(t,e,i,n,o){var s,r;(i||n)&&(i?n?i!==n&&(r=s=!0):r=!0:s=!0,r&&CA(t,e.leave,i,o),s&&CA(t,e.enter,n,o))}(t,s,i,n,e)}}var AA={id:"datalabels",defaults:wA,beforeInit:function(t){t[kA]={_actives:[]}},beforeUpdate:function(t){var e=t[kA];e._listened=!1,e._listeners={},e._datasets=[],e._labels=[]},afterDatasetUpdate:function(t,e,i){var n,o,s,r,a,l,c,h,d=e.index,u=t[kA],p=u._datasets[d]=[],f=t.isDatasetVisible(d),m=t.data.datasets[d],g=function(t,e){var i,n,o,s=t.datalabels,r=[];return!1===s?null:(!0===s&&(s={}),e=ux({},[e,s]),n=e.labels||{},o=Object.keys(n),delete e.labels,o.length?o.forEach((function(t){n[t]&&r.push(ux({},[e,n[t],{_key:t}]))})):r.push(e),i=r.reduce((function(t,e){return ax(e.listeners||{},(function(i,n){t[n]=t[n]||{},t[n][e._key||SA]=i})),delete e.listeners,t}),{}),{labels:r,listeners:i})}(m,i),v=e.meta.data||[],y=t.ctx;for(y.save(),n=0,s=v.length;n<s;++n)if((c=v[n])[kA]=[],f&&c&&t.getDataVisibility(n)&&!c.skip)for(o=0,r=g.labels.length;o<r;++o)l=(a=g.labels[o])._key,(h=new pA(a,y,c,n)).$groups={_set:d,_key:l||SA},h.$context={active:!1,chart:t,dataIndex:n,dataset:m,datasetIndex:d},h.update(h.$context),c[kA].push(h),p.push(h);y.restore(),ux(u._listeners,g.listeners,{merger:function(t,i,n){i[t]=i[t]||{},i[t][e.index]=n[t],u._listened=!0}})},afterUpdate:function(t){t[kA]._labels=_A.prepare(t[kA]._datasets)},afterDatasetsDraw:function(t){_A.draw(t,t[kA]._labels)},beforeEvent:function(t,e){if(t[kA]._listened){var i=e.event;switch(i.type){case"mousemove":case"mouseout":EA(t,i);break;case"click":!function(t,e){var i=t[kA],n=i._listeners.click,o=n&&_A.lookup(i._labels,e);o&&CA(t,n,o,e)}(t,i)}}},afterEvent:function(t){var e,i,n,o,s,r,a,l=t[kA],c=l._actives,h=l._actives=t.getActiveElements(),d=YE(c,h);for(e=0,i=d.length;e<i;++e)if((s=d[e])[1])for(n=0,o=(a=s[0].element[kA]||[]).length;n<o;++n)(r=a[n]).$context.active=1===s[1],r.update(r.$context);(l._dirty||d.length)&&(_A.update(l._labels),t.render()),delete l._dirty}};VS.register(AA);const MA={"qualitative-set1":["#5ea3db","#c186e3","#66c2a5","#fc8d62","#a6d854","#ffd92f","#e5c494","#b3b3b3"],"qualitative-set2":["#377eb8","#984ea3","#4daf4a","#ff7f00","#e41a1c","#a65628","#f781bf","#ffff33"],"qualitative-set3":["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d"],"qualitative-paired":["#1f78b4","#a6cee3","#6a3d9a","#cab2d6","#33a02c","#b2df8a","#e31a1c","#fb9a99","#ff7f00","#fdbf6f"],"qualitative-accent":["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],"qualitative-pastel1":["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec"],"qualitative-pastel2":["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc"],"diverging-prgn":["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],"diverging-spectral":["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],"diverging-piyg":["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],"diverging-rdylgn":["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],"diverging-brbg":["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],"sequential-blues":["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],"sequential-greens":["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],"sequential-oranges":["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],"sequential-purples":["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],"sequential-reds":["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],"sequential-ylgnbu":["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"]},TA="rgba(212, 212, 212, 0.5)";function PA(t){if(0===t)return"0s";const e=Math.floor(t/86400),i=t%86400,n=Math.floor(i/3600),o=i%3600,s=Math.floor(o/60),r=o%60,a=[];return e>0&&a.push(`${e}d`),n>0&&a.push(`${n}h`),s>0&&a.length<2&&a.push(`${s}m`),r>0&&a.length<2&&a.push(`${r}s`),a.slice(0,2).join(" ")}class OA extends ge{getInflatedMax(){if(!this.showPercent||!this.data)return;const t=Array(this.data.labels.length).fill(0);for(const e of this.datasets)e.data.forEach(((e,i)=>t[i]+=e));const e=Math.max(...t);return e>0?1.15*e:void 0}static get styles(){return a`
|
|
8663
8711
|
.chart-title {
|
|
8664
8712
|
font-size: 1.2em;
|
|
8665
8713
|
font-weight: 600;
|
|
@@ -8700,7 +8748,7 @@ const $E={datetime:Ys.DATETIME_MED_WITH_SECONDS,millisecond:"h:mm:ss.SSS a",seco
|
|
|
8700
8748
|
padding: 2em 1em 1.5em 1em;
|
|
8701
8749
|
max-height: 50px;
|
|
8702
8750
|
}
|
|
8703
|
-
`}constructor(){super(),this.chartType="bar",this.header="",this.other=!1,this.datasets=[],this.maxSplits=2,this.hideOther=!1,this.splits=[],this.dataname="Counts",this.single=!1,this.legend=!1,this.config=!1,this.
|
|
8751
|
+
`}constructor(){super(),this.chartType="bar",this.header="",this.other=!1,this.datasets=[],this.maxSplits=2,this.xType="category",this.yType="count",this.xFormat="MMM dd",this.hideOther=!1,this.splits=[],this.dataname="Counts",this.single=!1,this.legend=!1,this.config=!1,this.showAll=!1,this.colorIndex=0,this.showConfig=!1,this.opacity=1,this.seriesBorderRadius=2,this.seriesBorderWidth=1,this.showPercent=!1}firstUpdated(t){super.firstUpdated(t);const e=this.shadowRoot.querySelector("#canvas-wrapper");this.canvas=document.createElement("canvas"),this.canvas.setAttribute("height","300px"),e.appendChild(this.canvas),this.ctx=this.canvas.getContext("2d")}updated(t){if(super.updated(t),t.has("splitNames")&&(this.splits=this.splitNames.split(",").map((t=>t.trim()))),(t.has("data")||t.has("splits"))&&this.calculateSplits(),t.has("datasets")&&this.updateChart(),t.has("url")){_a().getUrl(this.url,{skipCache:!0}).then((t=>{this.data=t.json.data}))}if(t.has("chartType")&&"line"===this.chartType&&(this.seriesBorderWidth=Math.max(1,this.seriesBorderWidth)),t.has("showPercent")&&this.chart){const t=this.chart.options.scales.y;t.ticks.display=!this.showPercent,t.grid.display=!this.showPercent,t.border.display=!this.showPercent,t.max=this.showPercent?this.getInflatedMax():void 0,this.chart.update()}}get colors(){const t=MA[this.palette]||MA["qualitative-set1"],e=Math.max(0,Math.min(1,this.opacity)),i=t.map((t=>ce(t,.25))),n=t.map((t=>{if(t.startsWith("rgba"))return t.replace(/rgba\(([^,]+),([^,]+),([^,]+),([^)]+)\)/,((t,i,n,o)=>`rgba(${i},${n},${o},${e})`));if(t.startsWith("rgb("))return t.replace(/rgb\(([^,]+),([^,]+),([^,]+)\)/,((t,i,n,o)=>`rgba(${i},${n},${o},${e})`));if(t.startsWith("#")){let i=t.replace("#","");3===i.length&&(i=i.split("").map((t=>t+t)).join(""));const n=parseInt(i,16);return`rgba(${n>>16&255},${n>>8&255},${255&n},${e})`}return t}));return[n,i]}calculateSplits(){if(this.data){const t=[],e=[],[i,n]=this.colors;for(const o of this.data.datasets)if(this.showAll||void 0!==this.splits.find((t=>t===o.label))){const e=(t.length+this.colorIndex)%i.length,s=i[e],r=n[e];t.push({...o,backgroundColor:s,borderColor:r,borderWidth:this.seriesBorderWidth,borderRadius:this.seriesBorderRadius})}else for(let t=0;t<o.data.length;t++)void 0===e[t]?e[t]=o.data[t]:e[t]+=o.data[t];if(0===t.length){const o=this.colorIndex%i.length;t.push({label:this.single?this.dataname:`All ${this.dataname}`,data:e,backgroundColor:i[o],borderColor:n[o],borderWidth:this.seriesBorderWidth,borderRadius:this.seriesBorderRadius})}else this.hideOther||this.showAll||t.push({label:"Other",data:e,backgroundColor:TA,borderColor:ce(TA,.05),borderWidth:1,borderRadius:this.seriesBorderRadius});this.datasets=t}}updateChart(){var t;if((null===(t=this.datasets)||void 0===t?void 0:t.length)>0){const t=this.datasets.reduce(((t,e)=>t+e.data.reduce(((t,e)=>t+(null!=e?e:0)),0)),0)||void 0,e=e=>{const i=t?e/t*100:0;return`${Math.round(i)}%`};if(this.chart){this.chart.data.labels=this.data.labels,this.chart.data.datasets=this.datasets,this.showPercent&&(this.chart.options.scales.y.max=this.getInflatedMax());const t=this.chart.options.plugins.datalabels||{};t.display=this.showPercent,this.showPercent?t.formatter=e:delete t.formatter,this.chart.options.plugins.datalabels=t,this.chart.update()}else{const t={type:this.chartType,data:{labels:this.data.labels,datasets:this.datasets},options:{maxBarThickness:80,plugins:{legend:{display:this.legend},tooltip:{callbacks:{label:t=>{const e=t.dataset.label||"",i=t.parsed.y;return"duration"===this.yType?`${e}: ${PA(i)}`:`${e}: ${i}`}}},datalabels:{display:this.showPercent,anchor:"end",align:"end",offset:-3,clamp:!0,...this.showPercent&&{formatter:e},color:"#666",font:{weight:"600"}}},responsive:!0,maintainAspectRatio:!1,animations:{x:{duration:0},y:{duration:200,easing:"easeOutCubic"}},scales:{y:{min:0,...this.showPercent&&{max:this.getInflatedMax()},stacked:!0,grid:{color:"rgba(0,0,0,0.04)",display:!this.showPercent,drawBorder:!this.showPercent},border:{display:!this.showPercent},ticks:{display:!this.showPercent,..."duration"===this.yType&&!this.showPercent&&{callback:t=>PA(t)}}},x:{type:this.xType,grid:{display:!1},stacked:!0,..."time"===this.xType&&{time:{unit:"day",tooltipFormat:"DDD",displayFormats:{day:this.xFormat}}}}}}};this.chart=new VS(this.ctx,t)}}}handleSplitsChanged(t){const e=t.target;this.splits=e.values.map((t=>t.value))}handleToggleConfig(){this.showConfig=!this.showConfig,this.showConfig||(this.splits=[])}render(){var t,e,i;return U`<div>
|
|
8704
8752
|
${this.header?U`<div class="chart-title">${this.header}</div>`:null}
|
|
8705
8753
|
<div id="canvas-wrapper"></div>
|
|
8706
8754
|
${this.config&&this.data?U`
|
|
@@ -8732,7 +8780,7 @@ const $E={datetime:Ys.DATETIME_MED_WITH_SECONDS,millisecond:"h:mm:ss.SSS a",seco
|
|
|
8732
8780
|
</temba-select>
|
|
8733
8781
|
<div></div>
|
|
8734
8782
|
</div>
|
|
8735
|
-
</div>`}}function
|
|
8783
|
+
</div>`}}function DA(t,e){window.customElements.get(t)||window.customElements.define(t,e)}t([ue({type:String})],OA.prototype,"chartType",void 0),t([ue({type:String})],OA.prototype,"url",void 0),t([ue({type:String})],OA.prototype,"header",void 0),t([ue({type:Boolean})],OA.prototype,"other",void 0),t([ue({type:Object})],OA.prototype,"data",void 0),t([pe()],OA.prototype,"datasets",void 0),t([ue({type:Number})],OA.prototype,"maxSplits",void 0),t([ue({type:String,attribute:"splits"})],OA.prototype,"splitNames",void 0),t([ue({type:String})],OA.prototype,"xType",void 0),t([ue({type:String})],OA.prototype,"yType",void 0),t([ue({type:String})],OA.prototype,"xFormat",void 0),t([ue({type:Boolean})],OA.prototype,"hideOther",void 0),t([pe()],OA.prototype,"splits",void 0),t([ue({type:String})],OA.prototype,"dataname",void 0),t([ue({type:Boolean})],OA.prototype,"single",void 0),t([ue({type:Boolean})],OA.prototype,"legend",void 0),t([ue({type:Boolean})],OA.prototype,"config",void 0),t([ue({type:Boolean})],OA.prototype,"showAll",void 0),t([ue({type:Number})],OA.prototype,"colorIndex",void 0),t([pe()],OA.prototype,"showConfig",void 0),t([ue({type:String})],OA.prototype,"palette",void 0),t([ue({type:Number})],OA.prototype,"opacity",void 0),t([ue({type:Number})],OA.prototype,"seriesBorderRadius",void 0),t([ue({type:Number})],OA.prototype,"seriesBorderWidth",void 0),t([ue({type:Boolean,attribute:"percent"})],OA.prototype,"showPercent",void 0),DA("temba-anchor",wh),DA("temba-alert",dh),DA("temba-store",wa),DA("temba-textinput",Ie),DA("temba-datepicker",Fh),DA("temba-date",Yh),DA("temba-completion",pc),DA("temba-checkbox",be),DA("temba-select",uc),DA("temba-options",ka),DA("temba-loading",xc),DA("temba-lightbox",Kh),DA("temba-button",yc),DA("temba-omnibox",gh),DA("temba-tip",bh),DA("temba-contact-name",Ah),DA("temba-contact-name-fetch",jh),DA("temba-contact-field",Oh),DA("temba-contact-fields",Th),DA("temba-field-manager",Hh),DA("temba-urn",Mh),DA("temba-content-menu",Gh),DA("temba-field",bc),DA("temba-dialog",gc),DA("temba-modax",vc),DA("temba-charcount",Tc),DA("temba-contact-chat",rh),DA("temba-contact-details",class extends Dc{static get styles(){return a`
|
|
8736
8784
|
.urn {
|
|
8737
8785
|
display: flex;
|
|
8738
8786
|
padding: 0.4em 1em 0.8em 1em;
|
|
@@ -8808,7 +8856,7 @@ const $E={datetime:Ys.DATETIME_MED_WITH_SECONDS,millisecond:"h:mm:ss.SSS a",seco
|
|
|
8808
8856
|
disabled
|
|
8809
8857
|
></temba-contact-field>
|
|
8810
8858
|
</div>
|
|
8811
|
-
`}}),
|
|
8859
|
+
`}}),DA("temba-ticket-list",lh),DA("temba-notification-list",class extends ah{static get styles(){return a`
|
|
8812
8860
|
:host {
|
|
8813
8861
|
--option-hover-bg: #f9f9f9;
|
|
8814
8862
|
}
|
|
@@ -8851,7 +8899,7 @@ const $E={datetime:Ys.DATETIME_MED_WITH_SECONDS,millisecond:"h:mm:ss.SSS a",seco
|
|
|
8851
8899
|
</div>`}}renderHeader(){return U`<div class="header">
|
|
8852
8900
|
<temba-icon name="notification"></temba-icon>
|
|
8853
8901
|
<div class="title">Notifications</div>
|
|
8854
|
-
</div>`}scrollToTop(){window.setTimeout((()=>{this.shadowRoot.querySelector("temba-options").scrollToTop()}),1e3)}}),
|
|
8902
|
+
</div>`}scrollToTop(){window.setTimeout((()=>{this.shadowRoot.querySelector("temba-options").scrollToTop()}),1e3)}}),DA("temba-list",ah),DA("temba-sortable-list",Sa),DA("temba-run-list",Nh),DA("temba-flow-details",Bh),DA("temba-label",Eh),DA("temba-menu",_h),DA("temba-contact-search",uh),DA("temba-icon",ph),DA("temba-dropdown",kh),DA("temba-tabs",Sh),DA("temba-tab",Ch),DA("temba-contact-badges",Ih),DA("temba-contact-pending",$h),DA("temba-slider",zh),DA("temba-content-menu",Gh),DA("temba-compose",Xh),DA("temba-color-picker",Qh),DA("temba-resizer",Jh),DA("temba-thumbnail",id),DA("temba-webchat",sd),DA("temba-image-picker",ad),DA("temba-mask",ld),DA("temba-user",Sr),DA("temba-template-editor",cd),DA("temba-toast",yd),DA("temba-chat",jc),DA("temba-media-picker",xd),DA("temba-flow-editor",hb),DA("temba-flow-node",cb),DA("temba-contact-notepad",db),DA("temba-progress",ub),DA("temba-start-progress",pb),DA("temba-shortcuts",fb),DA("temba-popup-select",mb),DA("temba-user-select",gb),DA("temba-workspace-select",vb),DA("temba-chart",OA);class IA extends ct{static get styles(){return a`
|
|
8855
8903
|
:host {
|
|
8856
8904
|
line-height: normal;
|
|
8857
8905
|
}
|
|
@@ -9059,7 +9107,7 @@ const $E={datetime:Ys.DATETIME_MED_WITH_SECONDS,millisecond:"h:mm:ss.SSS a",seco
|
|
|
9059
9107
|
></temba-textinput>
|
|
9060
9108
|
</div>
|
|
9061
9109
|
</temba-dialog>
|
|
9062
|
-
`}}t([ue({type:Array,attribute:!1})],FE.prototype,"path",void 0),t([ue()],FE.prototype,"endpoint",void 0),t([ue()],FE.prototype,"osmId",void 0),t([ue({type:Object})],FE.prototype,"hovered",void 0),t([ue({type:Object})],FE.prototype,"editFeature",void 0),t([ue({type:String,attribute:!1})],FE.prototype,"editFeatureAliases",void 0);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var qE={exports:{}};(function(t){var e="1.5.1+build.2e3e0ffb",i=Object.freeze;function n(t){var e,i,n,o;for(i=1,n=arguments.length;i<n;i++)for(e in o=arguments[i])t[e]=o[e];return t}Object.freeze=function(t){return t};var o=Object.create||function(){function t(){}return function(e){return t.prototype=e,new t}}();function s(t,e){var i=Array.prototype.slice;if(t.bind)return t.bind.apply(t,i.call(arguments,1));var n=i.call(arguments,2);return function(){return t.apply(e,n.length?n.concat(i.call(arguments)):arguments)}}var r=0;function a(t){return t._leaflet_id=t._leaflet_id||++r,t._leaflet_id}function l(t,e,i){var n,o,s,r;return r=function(){n=!1,o&&(s.apply(i,o),o=!1)},s=function(){n?o=arguments:(t.apply(i,arguments),setTimeout(r,e),n=!0)},s}function c(t,e,i){var n=e[1],o=e[0],s=n-o;return t===n&&i?t:((t-o)%s+s)%s+o}function h(){return!1}function d(t,e){return e=void 0===e?6:e,+(Math.round(t+"e+"+e)+"e-"+e)}function u(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function p(t){return u(t).split(/\s+/)}function f(t,e){for(var i in t.hasOwnProperty("options")||(t.options=t.options?o(t.options):{}),e)t.options[i]=e[i];return t.options}function m(t,e,i){var n=[];for(var o in t)n.push(encodeURIComponent(i?o.toUpperCase():o)+"="+encodeURIComponent(t[o]));return(e&&-1!==e.indexOf("?")?"&":"?")+n.join("&")}var g=/\{ *([\w_-]+) *\}/g;function v(t,e){return t.replace(g,(function(t,i){var n=e[i];if(void 0===n)throw new Error("No value provided for variable "+t);return"function"==typeof n&&(n=n(e)),n}))}var y=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function b(t,e){for(var i=0;i<t.length;i++)if(t[i]===e)return i;return-1}var x="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function _(t){return window["webkit"+t]||window["moz"+t]||window["ms"+t]}var w=0;function k(t){var e=+new Date,i=Math.max(0,16-(e-w));return w=e+i,window.setTimeout(t,i)}var S=window.requestAnimationFrame||_("RequestAnimationFrame")||k,C=window.cancelAnimationFrame||_("CancelAnimationFrame")||_("CancelRequestAnimationFrame")||function(t){window.clearTimeout(t)};function E(t,e,i){if(!i||S!==k)return S.call(window,s(t,e));t.call(e)}function A(t){t&&C.call(window,t)}var M=(Object.freeze||Object)({freeze:i,extend:n,create:o,bind:s,lastId:r,stamp:a,throttle:l,wrapNum:c,falseFn:h,formatNum:d,trim:u,splitWords:p,setOptions:f,getParamString:m,template:v,isArray:y,indexOf:b,emptyImageUrl:x,requestFn:S,cancelFn:C,requestAnimFrame:E,cancelAnimFrame:A});function T(){}function P(t){if("undefined"!=typeof L&&L&&L.Mixin){t=y(t)?t:[t];for(var e=0;e<t.length;e++)t[e]===L.Mixin.Events&&console.warn("Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.",(new Error).stack)}}T.extend=function(t){var e=function(){this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},i=e.__super__=this.prototype,s=o(i);for(var r in s.constructor=e,e.prototype=s,this)this.hasOwnProperty(r)&&"prototype"!==r&&"__super__"!==r&&(e[r]=this[r]);return t.statics&&(n(e,t.statics),delete t.statics),t.includes&&(P(t.includes),n.apply(null,[s].concat(t.includes)),delete t.includes),s.options&&(t.options=n(o(s.options),t.options)),n(s,t),s._initHooks=[],s.callInitHooks=function(){if(!this._initHooksCalled){i.callInitHooks&&i.callInitHooks.call(this),this._initHooksCalled=!0;for(var t=0,e=s._initHooks.length;t<e;t++)s._initHooks[t].call(this)}},e},T.include=function(t){return n(this.prototype,t),this},T.mergeOptions=function(t){return n(this.prototype.options,t),this},T.addInitHook=function(t){var e=Array.prototype.slice.call(arguments,1),i="function"==typeof t?t:function(){this[t].apply(this,e)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(i),this};var O={on:function(t,e,i){if("object"==typeof t)for(var n in t)this._on(n,t[n],e);else for(var o=0,s=(t=p(t)).length;o<s;o++)this._on(t[o],e,i);return this},off:function(t,e,i){if(t)if("object"==typeof t)for(var n in t)this._off(n,t[n],e);else for(var o=0,s=(t=p(t)).length;o<s;o++)this._off(t[o],e,i);else delete this._events;return this},_on:function(t,e,i){this._events=this._events||{};var n=this._events[t];n||(n=[],this._events[t]=n),i===this&&(i=void 0);for(var o={fn:e,ctx:i},s=n,r=0,a=s.length;r<a;r++)if(s[r].fn===e&&s[r].ctx===i)return;s.push(o)},_off:function(t,e,i){var n,o,s;if(this._events&&(n=this._events[t]))if(e){if(i===this&&(i=void 0),n)for(o=0,s=n.length;o<s;o++){var r=n[o];if(r.ctx===i&&r.fn===e)return r.fn=h,this._firingCount&&(this._events[t]=n=n.slice()),void n.splice(o,1)}}else{for(o=0,s=n.length;o<s;o++)n[o].fn=h;delete this._events[t]}},fire:function(t,e,i){if(!this.listens(t,i))return this;var o=n({},e,{type:t,target:this,sourceTarget:e&&e.sourceTarget||this});if(this._events){var s=this._events[t];if(s){this._firingCount=this._firingCount+1||1;for(var r=0,a=s.length;r<a;r++){var l=s[r];l.fn.call(l.ctx||this,o)}this._firingCount--}}return i&&this._propagateEvent(o),this},listens:function(t,e){var i=this._events&&this._events[t];if(i&&i.length)return!0;if(e)for(var n in this._eventParents)if(this._eventParents[n].listens(t,e))return!0;return!1},once:function(t,e,i){if("object"==typeof t){for(var n in t)this.once(n,t[n],e);return this}var o=s((function(){this.off(t,e,i).off(t,o,i)}),this);return this.on(t,e,i).on(t,o,i)},addEventParent:function(t){return this._eventParents=this._eventParents||{},this._eventParents[a(t)]=t,this},removeEventParent:function(t){return this._eventParents&&delete this._eventParents[a(t)],this},_propagateEvent:function(t){for(var e in this._eventParents)this._eventParents[e].fire(t.type,n({layer:t.target,propagatedFrom:t.target},t),!0)}};O.addEventListener=O.on,O.removeEventListener=O.clearAllEventListeners=O.off,O.addOneTimeEventListener=O.once,O.fireEvent=O.fire,O.hasEventListeners=O.listens;var D=T.extend(O);function I(t,e,i){this.x=i?Math.round(t):t,this.y=i?Math.round(e):e}var $=Math.trunc||function(t){return t>0?Math.floor(t):Math.ceil(t)};function z(t,e,i){return t instanceof I?t:y(t)?new I(t[0],t[1]):null==t?t:"object"==typeof t&&"x"in t&&"y"in t?new I(t.x,t.y):new I(t,e,i)}function R(t,e){if(t)for(var i=e?[t,e]:t,n=0,o=i.length;n<o;n++)this.extend(i[n])}function N(t,e){return!t||t instanceof R?t:new R(t,e)}function B(t,e){if(t)for(var i=e?[t,e]:t,n=0,o=i.length;n<o;n++)this.extend(i[n])}function j(t,e){return t instanceof B?t:new B(t,e)}function F(t,e,i){if(isNaN(t)||isNaN(e))throw new Error("Invalid LatLng object: ("+t+", "+e+")");this.lat=+t,this.lng=+e,void 0!==i&&(this.alt=+i)}function q(t,e,i){return t instanceof F?t:y(t)&&"object"!=typeof t[0]?3===t.length?new F(t[0],t[1],t[2]):2===t.length?new F(t[0],t[1]):null:null==t?t:"object"==typeof t&&"lat"in t?new F(t.lat,"lng"in t?t.lng:t.lon,t.alt):void 0===e?null:new F(t,e,i)}I.prototype={clone:function(){return new I(this.x,this.y)},add:function(t){return this.clone()._add(z(t))},_add:function(t){return this.x+=t.x,this.y+=t.y,this},subtract:function(t){return this.clone()._subtract(z(t))},_subtract:function(t){return this.x-=t.x,this.y-=t.y,this},divideBy:function(t){return this.clone()._divideBy(t)},_divideBy:function(t){return this.x/=t,this.y/=t,this},multiplyBy:function(t){return this.clone()._multiplyBy(t)},_multiplyBy:function(t){return this.x*=t,this.y*=t,this},scaleBy:function(t){return new I(this.x*t.x,this.y*t.y)},unscaleBy:function(t){return new I(this.x/t.x,this.y/t.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=$(this.x),this.y=$(this.y),this},distanceTo:function(t){var e=(t=z(t)).x-this.x,i=t.y-this.y;return Math.sqrt(e*e+i*i)},equals:function(t){return(t=z(t)).x===this.x&&t.y===this.y},contains:function(t){return t=z(t),Math.abs(t.x)<=Math.abs(this.x)&&Math.abs(t.y)<=Math.abs(this.y)},toString:function(){return"Point("+d(this.x)+", "+d(this.y)+")"}},R.prototype={extend:function(t){return t=z(t),this.min||this.max?(this.min.x=Math.min(t.x,this.min.x),this.max.x=Math.max(t.x,this.max.x),this.min.y=Math.min(t.y,this.min.y),this.max.y=Math.max(t.y,this.max.y)):(this.min=t.clone(),this.max=t.clone()),this},getCenter:function(t){return new I((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,t)},getBottomLeft:function(){return new I(this.min.x,this.max.y)},getTopRight:function(){return new I(this.max.x,this.min.y)},getTopLeft:function(){return this.min},getBottomRight:function(){return this.max},getSize:function(){return this.max.subtract(this.min)},contains:function(t){var e,i;return(t="number"==typeof t[0]||t instanceof I?z(t):N(t))instanceof R?(e=t.min,i=t.max):e=i=t,e.x>=this.min.x&&i.x<=this.max.x&&e.y>=this.min.y&&i.y<=this.max.y},intersects:function(t){t=N(t);var e=this.min,i=this.max,n=t.min,o=t.max,s=o.x>=e.x&&n.x<=i.x,r=o.y>=e.y&&n.y<=i.y;return s&&r},overlaps:function(t){t=N(t);var e=this.min,i=this.max,n=t.min,o=t.max,s=o.x>e.x&&n.x<i.x,r=o.y>e.y&&n.y<i.y;return s&&r},isValid:function(){return!(!this.min||!this.max)}},B.prototype={extend:function(t){var e,i,n=this._southWest,o=this._northEast;if(t instanceof F)e=t,i=t;else{if(!(t instanceof B))return t?this.extend(q(t)||j(t)):this;if(e=t._southWest,i=t._northEast,!e||!i)return this}return n||o?(n.lat=Math.min(e.lat,n.lat),n.lng=Math.min(e.lng,n.lng),o.lat=Math.max(i.lat,o.lat),o.lng=Math.max(i.lng,o.lng)):(this._southWest=new F(e.lat,e.lng),this._northEast=new F(i.lat,i.lng)),this},pad:function(t){var e=this._southWest,i=this._northEast,n=Math.abs(e.lat-i.lat)*t,o=Math.abs(e.lng-i.lng)*t;return new B(new F(e.lat-n,e.lng-o),new F(i.lat+n,i.lng+o))},getCenter:function(){return new F((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new F(this.getNorth(),this.getWest())},getSouthEast:function(){return new F(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(t){t="number"==typeof t[0]||t instanceof F||"lat"in t?q(t):j(t);var e,i,n=this._southWest,o=this._northEast;return t instanceof B?(e=t.getSouthWest(),i=t.getNorthEast()):e=i=t,e.lat>=n.lat&&i.lat<=o.lat&&e.lng>=n.lng&&i.lng<=o.lng},intersects:function(t){t=j(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),o=t.getNorthEast(),s=o.lat>=e.lat&&n.lat<=i.lat,r=o.lng>=e.lng&&n.lng<=i.lng;return s&&r},overlaps:function(t){t=j(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),o=t.getNorthEast(),s=o.lat>e.lat&&n.lat<i.lat,r=o.lng>e.lng&&n.lng<i.lng;return s&&r},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(t,e){return!!t&&(t=j(t),this._southWest.equals(t.getSouthWest(),e)&&this._northEast.equals(t.getNorthEast(),e))},isValid:function(){return!(!this._southWest||!this._northEast)}},F.prototype={equals:function(t,e){return!!t&&(t=q(t),Math.max(Math.abs(this.lat-t.lat),Math.abs(this.lng-t.lng))<=(void 0===e?1e-9:e))},toString:function(t){return"LatLng("+d(this.lat,t)+", "+d(this.lng,t)+")"},distanceTo:function(t){return H.distance(this,q(t))},wrap:function(){return H.wrapLatLng(this)},toBounds:function(t){var e=180*t/40075017,i=e/Math.cos(Math.PI/180*this.lat);return j([this.lat-e,this.lng-i],[this.lat+e,this.lng+i])},clone:function(){return new F(this.lat,this.lng,this.alt)}};var V={latLngToPoint:function(t,e){var i=this.projection.project(t),n=this.scale(e);return this.transformation._transform(i,n)},pointToLatLng:function(t,e){var i=this.scale(e),n=this.transformation.untransform(t,i);return this.projection.unproject(n)},project:function(t){return this.projection.project(t)},unproject:function(t){return this.projection.unproject(t)},scale:function(t){return 256*Math.pow(2,t)},zoom:function(t){return Math.log(t/256)/Math.LN2},getProjectedBounds:function(t){if(this.infinite)return null;var e=this.projection.bounds,i=this.scale(t);return new R(this.transformation.transform(e.min,i),this.transformation.transform(e.max,i))},infinite:!1,wrapLatLng:function(t){var e=this.wrapLng?c(t.lng,this.wrapLng,!0):t.lng;return new F(this.wrapLat?c(t.lat,this.wrapLat,!0):t.lat,e,t.alt)},wrapLatLngBounds:function(t){var e=t.getCenter(),i=this.wrapLatLng(e),n=e.lat-i.lat,o=e.lng-i.lng;if(0===n&&0===o)return t;var s=t.getSouthWest(),r=t.getNorthEast();return new B(new F(s.lat-n,s.lng-o),new F(r.lat-n,r.lng-o))}},H=n({},V,{wrapLng:[-180,180],R:6371e3,distance:function(t,e){var i=Math.PI/180,n=t.lat*i,o=e.lat*i,s=Math.sin((e.lat-t.lat)*i/2),r=Math.sin((e.lng-t.lng)*i/2),a=s*s+Math.cos(n)*Math.cos(o)*r*r,l=2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));return this.R*l}}),U=6378137,W={R:U,MAX_LATITUDE:85.0511287798,project:function(t){var e=Math.PI/180,i=this.MAX_LATITUDE,n=Math.max(Math.min(i,t.lat),-i),o=Math.sin(n*e);return new I(this.R*t.lng*e,this.R*Math.log((1+o)/(1-o))/2)},unproject:function(t){var e=180/Math.PI;return new F((2*Math.atan(Math.exp(t.y/this.R))-Math.PI/2)*e,t.x*e/this.R)},bounds:function(){var t=U*Math.PI;return new R([-t,-t],[t,t])}()};function G(t,e,i,n){if(y(t))return this._a=t[0],this._b=t[1],this._c=t[2],void(this._d=t[3]);this._a=t,this._b=e,this._c=i,this._d=n}function Z(t,e,i,n){return new G(t,e,i,n)}G.prototype={transform:function(t,e){return this._transform(t.clone(),e)},_transform:function(t,e){return e=e||1,t.x=e*(this._a*t.x+this._b),t.y=e*(this._c*t.y+this._d),t},untransform:function(t,e){return e=e||1,new I((t.x/e-this._b)/this._a,(t.y/e-this._d)/this._c)}};var Y=n({},H,{code:"EPSG:3857",projection:W,transformation:function(){var t=.5/(Math.PI*W.R);return Z(t,.5,-t,.5)}()}),X=n({},Y,{code:"EPSG:900913"});function K(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function Q(t,e){var i,n,o,s,r,a,l="";for(i=0,o=t.length;i<o;i++){for(n=0,s=(r=t[i]).length;n<s;n++)l+=(n?"L":"M")+(a=r[n]).x+" "+a.y;l+=e?Tt?"z":"x":""}return l||"M0 0"}var J=document.documentElement.style,tt="ActiveXObject"in window,et=tt&&!document.addEventListener,it="msLaunchUri"in navigator&&!("documentMode"in document),nt=Ot("webkit"),ot=Ot("android"),st=Ot("android 2")||Ot("android 3"),rt=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),at=ot&&Ot("Google")&&rt<537&&!("AudioNode"in window),lt=!!window.opera,ct=Ot("chrome"),ht=Ot("gecko")&&!nt&&!lt&&!tt,dt=!ct&&Ot("safari"),ut=Ot("phantom"),pt="OTransition"in J,ft=0===navigator.platform.indexOf("Win"),mt=tt&&"transition"in J,gt="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!st,vt="MozPerspective"in J,yt=!window.L_DISABLE_3D&&(mt||gt||vt)&&!pt&&!ut,bt="undefined"!=typeof orientation||Ot("mobile"),xt=bt&&nt,_t=bt&>,wt=!window.PointerEvent&&window.MSPointerEvent,kt=!(!window.PointerEvent&&!wt),St=!window.L_NO_TOUCH&&(kt||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch),Ct=bt&<,Et=bt&&ht,At=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,Mt=!!document.createElement("canvas").getContext,Tt=!(!document.createElementNS||!K("svg").createSVGRect),Pt=!Tt&&function(){try{var t=document.createElement("div");t.innerHTML='<v:shape adj="1"/>';var e=t.firstChild;return e.style.behavior="url(#default#VML)",e&&"object"==typeof e.adj}catch(t){return!1}}();function Ot(t){return navigator.userAgent.toLowerCase().indexOf(t)>=0}var Dt=(Object.freeze||Object)({ie:tt,ielt9:et,edge:it,webkit:nt,android:ot,android23:st,androidStock:at,opera:lt,chrome:ct,gecko:ht,safari:dt,phantom:ut,opera12:pt,win:ft,ie3d:mt,webkit3d:gt,gecko3d:vt,any3d:yt,mobile:bt,mobileWebkit:xt,mobileWebkit3d:_t,msPointer:wt,pointer:kt,touch:St,mobileOpera:Ct,mobileGecko:Et,retina:At,canvas:Mt,svg:Tt,vml:Pt}),It=wt?"MSPointerDown":"pointerdown",Lt=wt?"MSPointerMove":"pointermove",$t=wt?"MSPointerUp":"pointerup",zt=wt?"MSPointerCancel":"pointercancel",Rt=["INPUT","SELECT","OPTION"],Nt={},Bt=!1,jt=0;function Ft(t,e,i,n){return"touchstart"===e?Vt(t,i,n):"touchmove"===e?Zt(t,i,n):"touchend"===e&&Yt(t,i,n),this}function qt(t,e,i){var n=t["_leaflet_"+e+i];return"touchstart"===e?t.removeEventListener(It,n,!1):"touchmove"===e?t.removeEventListener(Lt,n,!1):"touchend"===e&&(t.removeEventListener($t,n,!1),t.removeEventListener(zt,n,!1)),this}function Vt(t,e,i){var n=s((function(t){if("mouse"!==t.pointerType&&t.MSPOINTER_TYPE_MOUSE&&t.pointerType!==t.MSPOINTER_TYPE_MOUSE){if(!(Rt.indexOf(t.target.tagName)<0))return;Ve(t)}Gt(t,e)}));t["_leaflet_touchstart"+i]=n,t.addEventListener(It,n,!1),Bt||(document.documentElement.addEventListener(It,Ht,!0),document.documentElement.addEventListener(Lt,Ut,!0),document.documentElement.addEventListener($t,Wt,!0),document.documentElement.addEventListener(zt,Wt,!0),Bt=!0)}function Ht(t){Nt[t.pointerId]=t,jt++}function Ut(t){Nt[t.pointerId]&&(Nt[t.pointerId]=t)}function Wt(t){delete Nt[t.pointerId],jt--}function Gt(t,e){for(var i in t.touches=[],Nt)t.touches.push(Nt[i]);t.changedTouches=[t],e(t)}function Zt(t,e,i){var n=function(t){(t.pointerType!==t.MSPOINTER_TYPE_MOUSE&&"mouse"!==t.pointerType||0!==t.buttons)&&Gt(t,e)};t["_leaflet_touchmove"+i]=n,t.addEventListener(Lt,n,!1)}function Yt(t,e,i){var n=function(t){Gt(t,e)};t["_leaflet_touchend"+i]=n,t.addEventListener($t,n,!1),t.addEventListener(zt,n,!1)}var Xt=wt?"MSPointerDown":kt?"pointerdown":"touchstart",Kt=wt?"MSPointerUp":kt?"pointerup":"touchend",Qt="_leaflet_";function Jt(t,e,i){var n,o,s=!1,r=250;function a(t){var e;if(kt){if(!it||"mouse"===t.pointerType)return;e=jt}else e=t.touches.length;if(!(e>1)){var i=Date.now(),a=i-(n||i);o=t.touches?t.touches[0]:t,s=a>0&&a<=r,n=i}}function l(t){if(s&&!o.cancelBubble){if(kt){if(!it||"mouse"===t.pointerType)return;var i,r,a={};for(r in o)i=o[r],a[r]=i&&i.bind?i.bind(o):i;o=a}o.type="dblclick",o.button=0,e(o),n=null}}return t[Qt+Xt+i]=a,t[Qt+Kt+i]=l,t[Qt+"dblclick"+i]=e,t.addEventListener(Xt,a,!1),t.addEventListener(Kt,l,!1),t.addEventListener("dblclick",e,!1),this}function te(t,e){var i=t[Qt+Xt+e],n=t[Qt+Kt+e],o=t[Qt+"dblclick"+e];return t.removeEventListener(Xt,i,!1),t.removeEventListener(Kt,n,!1),it||t.removeEventListener("dblclick",o,!1),this}var ee,ie,ne,oe,se,re=ke(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),ae=ke(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),le="webkitTransition"===ae||"OTransition"===ae?ae+"End":"transitionend";function ce(t){return"string"==typeof t?document.getElementById(t):t}function he(t,e){var i=t.style[e]||t.currentStyle&&t.currentStyle[e];if((!i||"auto"===i)&&document.defaultView){var n=document.defaultView.getComputedStyle(t,null);i=n?n[e]:null}return"auto"===i?null:i}function de(t,e,i){var n=document.createElement(t);return n.className=e||"",i&&i.appendChild(n),n}function ue(t){var e=t.parentNode;e&&e.removeChild(t)}function pe(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function fe(t){var e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)}function me(t){var e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)}function ge(t,e){if(void 0!==t.classList)return t.classList.contains(e);var i=xe(t);return i.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(i)}function ve(t,e){if(void 0!==t.classList)for(var i=p(e),n=0,o=i.length;n<o;n++)t.classList.add(i[n]);else if(!ge(t,e)){var s=xe(t);be(t,(s?s+" ":"")+e)}}function ye(t,e){void 0!==t.classList?t.classList.remove(e):be(t,u((" "+xe(t)+" ").replace(" "+e+" "," ")))}function be(t,e){void 0===t.className.baseVal?t.className=e:t.className.baseVal=e}function xe(t){return t.correspondingElement&&(t=t.correspondingElement),void 0===t.className.baseVal?t.className:t.className.baseVal}function _e(t,e){"opacity"in t.style?t.style.opacity=e:"filter"in t.style&&we(t,e)}function we(t,e){var i=!1,n="DXImageTransform.Microsoft.Alpha";try{i=t.filters.item(n)}catch(t){if(1===e)return}e=Math.round(100*e),i?(i.Enabled=100!==e,i.Opacity=e):t.style.filter+=" progid:"+n+"(opacity="+e+")"}function ke(t){for(var e=document.documentElement.style,i=0;i<t.length;i++)if(t[i]in e)return t[i];return!1}function Se(t,e,i){var n=e||new I(0,0);t.style[re]=(mt?"translate("+n.x+"px,"+n.y+"px)":"translate3d("+n.x+"px,"+n.y+"px,0)")+(i?" scale("+i+")":"")}function Ce(t,e){t._leaflet_pos=e,yt?Se(t,e):(t.style.left=e.x+"px",t.style.top=e.y+"px")}function Ee(t){return t._leaflet_pos||new I(0,0)}if("onselectstart"in document)ee=function(){$e(window,"selectstart",Ve)},ie=function(){Re(window,"selectstart",Ve)};else{var Ae=ke(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);ee=function(){if(Ae){var t=document.documentElement.style;ne=t[Ae],t[Ae]="none"}},ie=function(){Ae&&(document.documentElement.style[Ae]=ne,ne=void 0)}}function Me(){$e(window,"dragstart",Ve)}function Te(){Re(window,"dragstart",Ve)}function Pe(t){for(;-1===t.tabIndex;)t=t.parentNode;t.style&&(Oe(),oe=t,se=t.style.outline,t.style.outline="none",$e(window,"keydown",Oe))}function Oe(){oe&&(oe.style.outline=se,oe=void 0,se=void 0,Re(window,"keydown",Oe))}function De(t){do{t=t.parentNode}while(!(t.offsetWidth&&t.offsetHeight||t===document.body));return t}function Ie(t){var e=t.getBoundingClientRect();return{x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}var Le=(Object.freeze||Object)({TRANSFORM:re,TRANSITION:ae,TRANSITION_END:le,get:ce,getStyle:he,create:de,remove:ue,empty:pe,toFront:fe,toBack:me,hasClass:ge,addClass:ve,removeClass:ye,setClass:be,getClass:xe,setOpacity:_e,testProp:ke,setTransform:Se,setPosition:Ce,getPosition:Ee,disableTextSelection:ee,enableTextSelection:ie,disableImageDrag:Me,enableImageDrag:Te,preventOutline:Pe,restoreOutline:Oe,getSizedParentNode:De,getScale:Ie});function $e(t,e,i,n){if("object"==typeof e)for(var o in e)Ne(t,o,e[o],i);else for(var s=0,r=(e=p(e)).length;s<r;s++)Ne(t,e[s],i,n);return this}var ze="_leaflet_events";function Re(t,e,i,n){if("object"==typeof e)for(var o in e)Be(t,o,e[o],i);else if(e)for(var s=0,r=(e=p(e)).length;s<r;s++)Be(t,e[s],i,n);else{for(var a in t[ze])Be(t,a,t[ze][a]);delete t[ze]}return this}function Ne(t,e,i,n){var o=e+a(i)+(n?"_"+a(n):"");if(t[ze]&&t[ze][o])return this;var s=function(e){return i.call(n||t,e||window.event)},r=s;kt&&0===e.indexOf("touch")?Ft(t,e,s,o):!St||"dblclick"!==e||!Jt||kt&&ct?"addEventListener"in t?"mousewheel"===e?t.addEventListener("onwheel"in t?"wheel":"mousewheel",s,!1):"mouseenter"===e||"mouseleave"===e?(s=function(e){e=e||window.event,Qe(t,e)&&r(e)},t.addEventListener("mouseenter"===e?"mouseover":"mouseout",s,!1)):("click"===e&&ot&&(s=function(t){Je(t,r)}),t.addEventListener(e,s,!1)):"attachEvent"in t&&t.attachEvent("on"+e,s):Jt(t,s,o),t[ze]=t[ze]||{},t[ze][o]=s}function Be(t,e,i,n){var o=e+a(i)+(n?"_"+a(n):""),s=t[ze]&&t[ze][o];if(!s)return this;kt&&0===e.indexOf("touch")?qt(t,e,o):!St||"dblclick"!==e||!te||kt&&ct?"removeEventListener"in t?"mousewheel"===e?t.removeEventListener("onwheel"in t?"wheel":"mousewheel",s,!1):t.removeEventListener("mouseenter"===e?"mouseover":"mouseleave"===e?"mouseout":e,s,!1):"detachEvent"in t&&t.detachEvent("on"+e,s):te(t,o),t[ze][o]=null}function je(t){return t.stopPropagation?t.stopPropagation():t.originalEvent?t.originalEvent._stopped=!0:t.cancelBubble=!0,Ke(t),this}function Fe(t){return Ne(t,"mousewheel",je),this}function qe(t){return $e(t,"mousedown touchstart dblclick",je),Ne(t,"click",Xe),this}function Ve(t){return t.preventDefault?t.preventDefault():t.returnValue=!1,this}function He(t){return Ve(t),je(t),this}function Ue(t,e){if(!e)return new I(t.clientX,t.clientY);var i=Ie(e),n=i.boundingClientRect;return new I((t.clientX-n.left)/i.x-e.clientLeft,(t.clientY-n.top)/i.y-e.clientTop)}var We=ft&&ct?2*window.devicePixelRatio:ht?window.devicePixelRatio:1;function Ge(t){return it?t.wheelDeltaY/2:t.deltaY&&0===t.deltaMode?-t.deltaY/We:t.deltaY&&1===t.deltaMode?20*-t.deltaY:t.deltaY&&2===t.deltaMode?60*-t.deltaY:t.deltaX||t.deltaZ?0:t.wheelDelta?(t.wheelDeltaY||t.wheelDelta)/2:t.detail&&Math.abs(t.detail)<32765?20*-t.detail:t.detail?t.detail/-32765*60:0}var Ze,Ye={};function Xe(t){Ye[t.type]=!0}function Ke(t){var e=Ye[t.type];return Ye[t.type]=!1,e}function Qe(t,e){var i=e.relatedTarget;if(!i)return!0;try{for(;i&&i!==t;)i=i.parentNode}catch(t){return!1}return i!==t}function Je(t,e){var i=t.timeStamp||t.originalEvent&&t.originalEvent.timeStamp,n=Ze&&i-Ze;n&&n>100&&n<500||t.target._simulatedClick&&!t._simulated?He(t):(Ze=i,e(t))}var ti=(Object.freeze||Object)({on:$e,off:Re,stopPropagation:je,disableScrollPropagation:Fe,disableClickPropagation:qe,preventDefault:Ve,stop:He,getMousePosition:Ue,getWheelDelta:Ge,fakeStop:Xe,skipped:Ke,isExternalTarget:Qe,addListener:$e,removeListener:Re}),ei=D.extend({run:function(t,e,i,n){this.stop(),this._el=t,this._inProgress=!0,this._duration=i||.25,this._easeOutPower=1/Math.max(n||.5,.2),this._startPos=Ee(t),this._offset=e.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=E(this._animate,this),this._step()},_step:function(t){var e=+new Date-this._startTime,i=1e3*this._duration;e<i?this._runFrame(this._easeOut(e/i),t):(this._runFrame(1),this._complete())},_runFrame:function(t,e){var i=this._startPos.add(this._offset.multiplyBy(t));e&&i._round(),Ce(this._el,i),this.fire("step")},_complete:function(){A(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(t){return 1-Math.pow(1-t,this._easeOutPower)}}),ii=D.extend({options:{crs:Y,center:void 0,zoom:void 0,minZoom:void 0,maxZoom:void 0,layers:[],maxBounds:void 0,renderer:void 0,zoomAnimation:!0,zoomAnimationThreshold:4,fadeAnimation:!0,markerZoomAnimation:!0,transform3DLimit:8388608,zoomSnap:1,zoomDelta:1,trackResize:!0},initialize:function(t,e){e=f(this,e),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(t),this._initLayout(),this._onResize=s(this._onResize,this),this._initEvents(),e.maxBounds&&this.setMaxBounds(e.maxBounds),void 0!==e.zoom&&(this._zoom=this._limitZoom(e.zoom)),e.center&&void 0!==e.zoom&&this.setView(q(e.center),e.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=ae&&yt&&!Ct&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),$e(this._proxy,le,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(t,e,i){return e=void 0===e?this._zoom:this._limitZoom(e),t=this._limitCenter(q(t),e,this.options.maxBounds),i=i||{},this._stop(),this._loaded&&!i.reset&&!0!==i&&(void 0!==i.animate&&(i.zoom=n({animate:i.animate},i.zoom),i.pan=n({animate:i.animate,duration:i.duration},i.pan)),this._zoom!==e?this._tryAnimatedZoom&&this._tryAnimatedZoom(t,e,i.zoom):this._tryAnimatedPan(t,i.pan))?(clearTimeout(this._sizeTimer),this):(this._resetView(t,e),this)},setZoom:function(t,e){return this._loaded?this.setView(this.getCenter(),t,{zoom:e}):(this._zoom=t,this)},zoomIn:function(t,e){return t=t||(yt?this.options.zoomDelta:1),this.setZoom(this._zoom+t,e)},zoomOut:function(t,e){return t=t||(yt?this.options.zoomDelta:1),this.setZoom(this._zoom-t,e)},setZoomAround:function(t,e,i){var n=this.getZoomScale(e),o=this.getSize().divideBy(2),s=(t instanceof I?t:this.latLngToContainerPoint(t)).subtract(o).multiplyBy(1-1/n),r=this.containerPointToLatLng(o.add(s));return this.setView(r,e,{zoom:i})},_getBoundsCenterZoom:function(t,e){e=e||{},t=t.getBounds?t.getBounds():j(t);var i=z(e.paddingTopLeft||e.padding||[0,0]),n=z(e.paddingBottomRight||e.padding||[0,0]),o=this.getBoundsZoom(t,!1,i.add(n));if((o="number"==typeof e.maxZoom?Math.min(e.maxZoom,o):o)===1/0)return{center:t.getCenter(),zoom:o};var s=n.subtract(i).divideBy(2),r=this.project(t.getSouthWest(),o),a=this.project(t.getNorthEast(),o);return{center:this.unproject(r.add(a).divideBy(2).add(s),o),zoom:o}},fitBounds:function(t,e){if(!(t=j(t)).isValid())throw new Error("Bounds are not valid.");var i=this._getBoundsCenterZoom(t,e);return this.setView(i.center,i.zoom,e)},fitWorld:function(t){return this.fitBounds([[-90,-180],[90,180]],t)},panTo:function(t,e){return this.setView(t,this._zoom,{pan:e})},panBy:function(t,e){if(e=e||{},!(t=z(t).round()).x&&!t.y)return this.fire("moveend");if(!0!==e.animate&&!this.getSize().contains(t))return this._resetView(this.unproject(this.project(this.getCenter()).add(t)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new ei,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),e.noMoveStart||this.fire("movestart"),!1!==e.animate){ve(this._mapPane,"leaflet-pan-anim");var i=this._getMapPanePos().subtract(t).round();this._panAnim.run(this._mapPane,i,e.duration||.25,e.easeLinearity)}else this._rawPanBy(t),this.fire("move").fire("moveend");return this},flyTo:function(t,e,i){if(!1===(i=i||{}).animate||!yt)return this.setView(t,e,i);this._stop();var n=this.project(this.getCenter()),o=this.project(t),s=this.getSize(),r=this._zoom;t=q(t),e=void 0===e?r:e;var a=Math.max(s.x,s.y),l=a*this.getZoomScale(r,e),c=o.distanceTo(n)||1,h=1.42,d=h*h;function u(t){var e=(l*l-a*a+(t?-1:1)*d*d*c*c)/(2*(t?l:a)*d*c),i=Math.sqrt(e*e+1)-e;return i<1e-9?-18:Math.log(i)}function p(t){return(Math.exp(t)-Math.exp(-t))/2}function f(t){return(Math.exp(t)+Math.exp(-t))/2}function m(t){return p(t)/f(t)}var g=u(0);function v(t){return a*(f(g)/f(g+h*t))}function y(t){return a*(f(g)*m(g+h*t)-p(g))/d}function b(t){return 1-Math.pow(1-t,1.5)}var x=Date.now(),_=(u(1)-g)/h,w=i.duration?1e3*i.duration:1e3*_*.8;function k(){var i=(Date.now()-x)/w,s=b(i)*_;i<=1?(this._flyToFrame=E(k,this),this._move(this.unproject(n.add(o.subtract(n).multiplyBy(y(s)/c)),r),this.getScaleZoom(a/v(s),r),{flyTo:!0})):this._move(t,e)._moveEnd(!0)}return this._moveStart(!0,i.noMoveStart),k.call(this),this},flyToBounds:function(t,e){var i=this._getBoundsCenterZoom(t,e);return this.flyTo(i.center,i.zoom,e)},setMaxBounds:function(t){return(t=j(t)).isValid()?(this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this.options.maxBounds=t,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this.off("moveend",this._panInsideMaxBounds))},setMinZoom:function(t){var e=this.options.minZoom;return this.options.minZoom=t,this._loaded&&e!==t&&(this.fire("zoomlevelschange"),this.getZoom()<this.options.minZoom)?this.setZoom(t):this},setMaxZoom:function(t){var e=this.options.maxZoom;return this.options.maxZoom=t,this._loaded&&e!==t&&(this.fire("zoomlevelschange"),this.getZoom()>this.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,e){this._enforcingBounds=!0;var i=this.getCenter(),n=this._limitCenter(i,this._zoom,j(t));return i.equals(n)||this.panTo(n,e),this._enforcingBounds=!1,this},panInside:function(t,e){var i=z((e=e||{}).paddingTopLeft||e.padding||[0,0]),n=z(e.paddingBottomRight||e.padding||[0,0]),o=this.getCenter(),s=this.project(o),r=this.project(t),a=this.getPixelBounds(),l=a.getSize().divideBy(2),c=N([a.min.add(i),a.max.subtract(n)]);if(!c.contains(r)){this._enforcingBounds=!0;var h=s.subtract(r),d=z(r.x+h.x,r.y+h.y);(r.x<c.min.x||r.x>c.max.x)&&(d.x=s.x-h.x,h.x>0?d.x+=l.x-i.x:d.x-=l.x-n.x),(r.y<c.min.y||r.y>c.max.y)&&(d.y=s.y-h.y,h.y>0?d.y+=l.y-i.y:d.y-=l.y-n.y),this.panTo(this.unproject(d),e),this._enforcingBounds=!1}return this},invalidateSize:function(t){if(!this._loaded)return this;t=n({animate:!1,pan:!0},!0===t?{animate:!0}:t);var e=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var i=this.getSize(),o=e.divideBy(2).round(),r=i.divideBy(2).round(),a=o.subtract(r);return a.x||a.y?(t.animate&&t.pan?this.panBy(a):(t.pan&&this._rawPanBy(a),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(s(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:e,newSize:i})):this},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){if(t=this._locateOptions=n({timeout:1e4,watch:!1},t),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var e=s(this._handleGeolocationResponse,this),i=s(this._handleGeolocationError,this);return t.watch?this._locationWatchId=navigator.geolocation.watchPosition(e,i,t):navigator.geolocation.getCurrentPosition(e,i,t),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(t){var e=t.code,i=t.message||(1===e?"permission denied":2===e?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:e,message:"Geolocation error: "+i+"."})},_handleGeolocationResponse:function(t){var e=new F(t.coords.latitude,t.coords.longitude),i=e.toBounds(2*t.coords.accuracy),n=this._locateOptions;if(n.setView){var o=this.getBoundsZoom(i);this.setView(e,n.maxZoom?Math.min(o,n.maxZoom):o)}var s={latlng:e,bounds:i,timestamp:t.timestamp};for(var r in t.coords)"number"==typeof t.coords[r]&&(s[r]=t.coords[r]);this.fire("locationfound",s)},addHandler:function(t,e){if(!e)return this;var i=this[t]=new e(this);return this._handlers.push(i),this.options[t]&&i.enable(),this},remove:function(){if(this._initEvents(!0),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch(t){this._container._leaflet_id=void 0,this._containerId=void 0}var t;for(t in void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),ue(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(A(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload"),this._layers)this._layers[t].remove();for(t in this._panes)ue(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,e){var i=de("div","leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),e||this._mapPane);return t&&(this._panes[t]=i),i},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter:this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds();return new B(this.unproject(t.getBottomLeft()),this.unproject(t.getTopRight()))},getMinZoom:function(){return void 0===this.options.minZoom?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return void 0===this.options.maxZoom?void 0===this._layersMaxZoom?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,e,i){t=j(t),i=z(i||[0,0]);var n=this.getZoom()||0,o=this.getMinZoom(),s=this.getMaxZoom(),r=t.getNorthWest(),a=t.getSouthEast(),l=this.getSize().subtract(i),c=N(this.project(a,n),this.project(r,n)).getSize(),h=yt?this.options.zoomSnap:1,d=l.x/c.x,u=l.y/c.y,p=e?Math.max(d,u):Math.min(d,u);return n=this.getScaleZoom(p,n),h&&(n=Math.round(n/(h/100))*(h/100),n=e?Math.ceil(n/h)*h:Math.floor(n/h)*h),Math.max(o,Math.min(s,n))},getSize:function(){return this._size&&!this._sizeChanged||(this._size=new I(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,e){var i=this._getTopLeftPoint(t,e);return new R(i,i.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(void 0===t?this.getZoom():t)},getPane:function(t){return"string"==typeof t?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,e){var i=this.options.crs;return e=void 0===e?this._zoom:e,i.scale(t)/i.scale(e)},getScaleZoom:function(t,e){var i=this.options.crs;e=void 0===e?this._zoom:e;var n=i.zoom(t*i.scale(e));return isNaN(n)?1/0:n},project:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.latLngToPoint(q(t),e)},unproject:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.pointToLatLng(z(t),e)},layerPointToLatLng:function(t){var e=z(t).add(this.getPixelOrigin());return this.unproject(e)},latLngToLayerPoint:function(t){return this.project(q(t))._round()._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(q(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(j(t))},distance:function(t,e){return this.options.crs.distance(q(t),q(e))},containerPointToLayerPoint:function(t){return z(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return z(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){var e=this.containerPointToLayerPoint(z(t));return this.layerPointToLatLng(e)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(q(t)))},mouseEventToContainerPoint:function(t){return Ue(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(t){var e=this._container=ce(t);if(!e)throw new Error("Map container not found.");if(e._leaflet_id)throw new Error("Map container is already initialized.");$e(e,"scroll",this._onScroll,this),this._containerId=a(e)},_initLayout:function(){var t=this._container;this._fadeAnimated=this.options.fadeAnimation&&yt,ve(t,"leaflet-container"+(St?" leaflet-touch":"")+(At?" leaflet-retina":"")+(et?" leaflet-oldie":"")+(dt?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var e=he(t,"position");"absolute"!==e&&"relative"!==e&&"fixed"!==e&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),Ce(this._mapPane,new I(0,0)),this.createPane("tilePane"),this.createPane("shadowPane"),this.createPane("overlayPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(ve(t.markerPane,"leaflet-zoom-hide"),ve(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,e){Ce(this._mapPane,new I(0,0));var i=!this._loaded;this._loaded=!0,e=this._limitZoom(e),this.fire("viewprereset");var n=this._zoom!==e;this._moveStart(n,!1)._move(t,e)._moveEnd(n),this.fire("viewreset"),i&&this.fire("load")},_moveStart:function(t,e){return t&&this.fire("zoomstart"),e||this.fire("movestart"),this},_move:function(t,e,i){void 0===e&&(e=this._zoom);var n=this._zoom!==e;return this._zoom=e,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),(n||i&&i.pinch)&&this.fire("zoom",i),this.fire("move",i)},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return A(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){Ce(this._mapPane,this._getMapPanePos().subtract(t))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(t){this._targets={},this._targets[a(this._container)]=this;var e=t?Re:$e;e(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&e(window,"resize",this._onResize,this),yt&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){A(this._resizeRequest),this._resizeRequest=E((function(){this.invalidateSize({debounceMoveend:!0})}),this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,e){for(var i,n=[],o="mouseout"===e||"mouseover"===e,s=t.target||t.srcElement,r=!1;s;){if((i=this._targets[a(s)])&&("click"===e||"preclick"===e)&&!t._simulated&&this._draggableMoved(i)){r=!0;break}if(i&&i.listens(e,!0)){if(o&&!Qe(s,t))break;if(n.push(i),o)break}if(s===this._container)break;s=s.parentNode}return n.length||r||o||!Qe(s,t)||(n=[this]),n},_handleDOMEvent:function(t){if(this._loaded&&!Ke(t)){var e=t.type;"mousedown"!==e&&"keypress"!==e&&"keyup"!==e&&"keydown"!==e||Pe(t.target||t.srcElement),this._fireDOMEvent(t,e)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,e,i){if("click"===t.type){var o=n({},t);o.type="preclick",this._fireDOMEvent(o,o.type,i)}if(!t._stopped&&(i=(i||[]).concat(this._findEventTargets(t,e))).length){var s=i[0];"contextmenu"===e&&s.listens(e,!0)&&Ve(t);var r={originalEvent:t};if("keypress"!==t.type&&"keydown"!==t.type&&"keyup"!==t.type){var a=s.getLatLng&&(!s._radius||s._radius<=10);r.containerPoint=a?this.latLngToContainerPoint(s.getLatLng()):this.mouseEventToContainerPoint(t),r.layerPoint=this.containerPointToLayerPoint(r.containerPoint),r.latlng=a?s.getLatLng():this.layerPointToLatLng(r.layerPoint)}for(var l=0;l<i.length;l++)if(i[l].fire(e,r,!0),r.originalEvent._stopped||!1===i[l].options.bubblingMouseEvents&&-1!==b(this._mouseEvents,e))return}},_draggableMoved:function(t){return(t=t.dragging&&t.dragging.enabled()?t:this).dragging&&t.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var t=0,e=this._handlers.length;t<e;t++)this._handlers[t].disable()},whenReady:function(t,e){return this._loaded?t.call(e||this,{target:this}):this.on("load",t,e),this},_getMapPanePos:function(){return Ee(this._mapPane)||new I(0,0)},_moved:function(){var t=this._getMapPanePos();return t&&!t.equals([0,0])},_getTopLeftPoint:function(t,e){return(t&&void 0!==e?this._getNewPixelOrigin(t,e):this.getPixelOrigin()).subtract(this._getMapPanePos())},_getNewPixelOrigin:function(t,e){var i=this.getSize()._divideBy(2);return this.project(t,e)._subtract(i)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(t,e,i){var n=this._getNewPixelOrigin(i,e);return this.project(t,e)._subtract(n)},_latLngBoundsToNewLayerBounds:function(t,e,i){var n=this._getNewPixelOrigin(i,e);return N([this.project(t.getSouthWest(),e)._subtract(n),this.project(t.getNorthWest(),e)._subtract(n),this.project(t.getSouthEast(),e)._subtract(n),this.project(t.getNorthEast(),e)._subtract(n)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(t){return this.latLngToLayerPoint(t).subtract(this._getCenterLayerPoint())},_limitCenter:function(t,e,i){if(!i)return t;var n=this.project(t,e),o=this.getSize().divideBy(2),s=new R(n.subtract(o),n.add(o)),r=this._getBoundsOffset(s,i,e);return r.round().equals([0,0])?t:this.unproject(n.add(r),e)},_limitOffset:function(t,e){if(!e)return t;var i=this.getPixelBounds(),n=new R(i.min.add(t),i.max.add(t));return t.add(this._getBoundsOffset(n,e))},_getBoundsOffset:function(t,e,i){var n=N(this.project(e.getNorthEast(),i),this.project(e.getSouthWest(),i)),o=n.min.subtract(t.min),s=n.max.subtract(t.max);return new I(this._rebound(o.x,-s.x),this._rebound(o.y,-s.y))},_rebound:function(t,e){return t+e>0?Math.round(t-e)/2:Math.max(0,Math.ceil(t))-Math.max(0,Math.floor(e))},_limitZoom:function(t){var e=this.getMinZoom(),i=this.getMaxZoom(),n=yt?this.options.zoomSnap:1;return n&&(t=Math.round(t/n)*n),Math.max(e,Math.min(i,t))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){ye(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(t,e){var i=this._getCenterOffset(t)._trunc();return!(!0!==(e&&e.animate)&&!this.getSize().contains(i)||(this.panBy(i,e),0))},_createAnimProxy:function(){var t=this._proxy=de("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(t),this.on("zoomanim",(function(t){var e=re,i=this._proxy.style[e];Se(this._proxy,this.project(t.center,t.zoom),this.getZoomScale(t.zoom,1)),i===this._proxy.style[e]&&this._animatingZoom&&this._onZoomTransitionEnd()}),this),this.on("load moveend",(function(){var t=this.getCenter(),e=this.getZoom();Se(this._proxy,this.project(t,e),this.getZoomScale(e,1))}),this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){ue(this._proxy),delete this._proxy},_catchTransitionEnd:function(t){this._animatingZoom&&t.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(t,e,i){if(this._animatingZoom)return!0;if(i=i||{},!this._zoomAnimated||!1===i.animate||this._nothingToAnimate()||Math.abs(e-this._zoom)>this.options.zoomAnimationThreshold)return!1;var n=this.getZoomScale(e),o=this._getCenterOffset(t)._divideBy(1-1/n);return!(!0!==i.animate&&!this.getSize().contains(o)||(E((function(){this._moveStart(!0,!1)._animateZoom(t,e,!0)}),this),0))},_animateZoom:function(t,e,i,n){this._mapPane&&(i&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=e,ve(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:e,noUpdate:n}),setTimeout(s(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&ye(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom),E((function(){this._moveEnd(!0)}),this))}});function ni(t,e){return new ii(t,e)}var oi=T.extend({options:{position:"topright"},initialize:function(t){f(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var e=this._map;return e&&e.removeControl(this),this.options.position=t,e&&e.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var e=this._container=this.onAdd(t),i=this.getPosition(),n=t._controlCorners[i];return ve(e,"leaflet-control"),-1!==i.indexOf("bottom")?n.insertBefore(e,n.firstChild):n.appendChild(e),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(ue(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(t){this._map&&t&&t.screenX>0&&t.screenY>0&&this._map.getContainer().focus()}}),si=function(t){return new oi(t)};ii.include({addControl:function(t){return t.addTo(this),this},removeControl:function(t){return t.remove(),this},_initControlPos:function(){var t=this._controlCorners={},e="leaflet-",i=this._controlContainer=de("div",e+"control-container",this._container);function n(n,o){var s=e+n+" "+e+o;t[n+o]=de("div",s,i)}n("top","left"),n("top","right"),n("bottom","left"),n("bottom","right")},_clearControlPos:function(){for(var t in this._controlCorners)ue(this._controlCorners[t]);ue(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var ri=oi.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(t,e,i,n){return i<n?-1:n<i?1:0}},initialize:function(t,e,i){for(var n in f(this,i),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,t)this._addLayer(t[n],n);for(n in e)this._addLayer(e[n],n,!0)},onAdd:function(t){this._initLayout(),this._update(),this._map=t,t.on("zoomend",this._checkDisabledLayers,this);for(var e=0;e<this._layers.length;e++)this._layers[e].layer.on("add remove",this._onLayerChange,this);return this._container},addTo:function(t){return oi.prototype.addTo.call(this,t),this._expandIfNotCollapsed()},onRemove:function(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var t=0;t<this._layers.length;t++)this._layers[t].layer.off("add remove",this._onLayerChange,this)},addBaseLayer:function(t,e){return this._addLayer(t,e),this._map?this._update():this},addOverlay:function(t,e){return this._addLayer(t,e,!0),this._map?this._update():this},removeLayer:function(t){t.off("add remove",this._onLayerChange,this);var e=this._getLayer(a(t));return e&&this._layers.splice(this._layers.indexOf(e),1),this._map?this._update():this},expand:function(){ve(this._container,"leaflet-control-layers-expanded"),this._section.style.height=null;var t=this._map.getSize().y-(this._container.offsetTop+50);return t<this._section.clientHeight?(ve(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=t+"px"):ye(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return ye(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var t="leaflet-control-layers",e=this._container=de("div",t),i=this.options.collapsed;e.setAttribute("aria-haspopup",!0),qe(e),Fe(e);var n=this._section=de("section",t+"-list");i&&(this._map.on("click",this.collapse,this),ot||$e(e,{mouseenter:this.expand,mouseleave:this.collapse},this));var o=this._layersLink=de("a",t+"-toggle",e);o.href="#",o.title="Layers",St?($e(o,"click",He),$e(o,"click",this.expand,this)):$e(o,"focus",this.expand,this),i||this.expand(),this._baseLayersList=de("div",t+"-base",n),this._separator=de("div",t+"-separator",n),this._overlaysList=de("div",t+"-overlays",n),e.appendChild(n)},_getLayer:function(t){for(var e=0;e<this._layers.length;e++)if(this._layers[e]&&a(this._layers[e].layer)===t)return this._layers[e]},_addLayer:function(t,e,i){this._map&&t.on("add remove",this._onLayerChange,this),this._layers.push({layer:t,name:e,overlay:i}),this.options.sortLayers&&this._layers.sort(s((function(t,e){return this.options.sortFunction(t.layer,e.layer,t.name,e.name)}),this)),this.options.autoZIndex&&t.setZIndex&&(this._lastZIndex++,t.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;pe(this._baseLayersList),pe(this._overlaysList),this._layerControlInputs=[];var t,e,i,n,o=0;for(i=0;i<this._layers.length;i++)n=this._layers[i],this._addItem(n),e=e||n.overlay,t=t||!n.overlay,o+=n.overlay?0:1;return this.options.hideSingleBase&&(t=t&&o>1,this._baseLayersList.style.display=t?"":"none"),this._separator.style.display=e&&t?"":"none",this},_onLayerChange:function(t){this._handlingClick||this._update();var e=this._getLayer(a(t.target)),i=e.overlay?"add"===t.type?"overlayadd":"overlayremove":"add"===t.type?"baselayerchange":null;i&&this._map.fire(i,e)},_createRadioElement:function(t,e){var i='<input type="radio" class="leaflet-control-layers-selector" name="'+t+'"'+(e?' checked="checked"':"")+"/>",n=document.createElement("div");return n.innerHTML=i,n.firstChild},_addItem:function(t){var e,i=document.createElement("label"),n=this._map.hasLayer(t.layer);t.overlay?((e=document.createElement("input")).type="checkbox",e.className="leaflet-control-layers-selector",e.defaultChecked=n):e=this._createRadioElement("leaflet-base-layers_"+a(this),n),this._layerControlInputs.push(e),e.layerId=a(t.layer),$e(e,"click",this._onInputClick,this);var o=document.createElement("span");o.innerHTML=" "+t.name;var s=document.createElement("div");return i.appendChild(s),s.appendChild(e),s.appendChild(o),(t.overlay?this._overlaysList:this._baseLayersList).appendChild(i),this._checkDisabledLayers(),i},_onInputClick:function(){var t,e,i=this._layerControlInputs,n=[],o=[];this._handlingClick=!0;for(var s=i.length-1;s>=0;s--)t=i[s],e=this._getLayer(t.layerId).layer,t.checked?n.push(e):t.checked||o.push(e);for(s=0;s<o.length;s++)this._map.hasLayer(o[s])&&this._map.removeLayer(o[s]);for(s=0;s<n.length;s++)this._map.hasLayer(n[s])||this._map.addLayer(n[s]);this._handlingClick=!1,this._refocusOnMap()},_checkDisabledLayers:function(){for(var t,e,i=this._layerControlInputs,n=this._map.getZoom(),o=i.length-1;o>=0;o--)t=i[o],e=this._getLayer(t.layerId).layer,t.disabled=void 0!==e.options.minZoom&&n<e.options.minZoom||void 0!==e.options.maxZoom&&n>e.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expand:function(){return this.expand()},_collapse:function(){return this.collapse()}}),ai=function(t,e,i){return new ri(t,e,i)},li=oi.extend({options:{position:"topleft",zoomInText:"+",zoomInTitle:"Zoom in",zoomOutText:"−",zoomOutTitle:"Zoom out"},onAdd:function(t){var e="leaflet-control-zoom",i=de("div",e+" leaflet-bar"),n=this.options;return this._zoomInButton=this._createButton(n.zoomInText,n.zoomInTitle,e+"-in",i,this._zoomIn),this._zoomOutButton=this._createButton(n.zoomOutText,n.zoomOutTitle,e+"-out",i,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),i},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(t.shiftKey?3:1))},_zoomOut:function(t){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,e,i,n,o){var s=de("a",i,n);return s.innerHTML=t,s.href="#",s.title=e,s.setAttribute("role","button"),s.setAttribute("aria-label",e),qe(s),$e(s,"click",He),$e(s,"click",o,this),$e(s,"click",this._refocusOnMap,this),s},_updateDisabled:function(){var t=this._map,e="leaflet-disabled";ye(this._zoomInButton,e),ye(this._zoomOutButton,e),(this._disabled||t._zoom===t.getMinZoom())&&ve(this._zoomOutButton,e),(this._disabled||t._zoom===t.getMaxZoom())&&ve(this._zoomInButton,e)}});ii.mergeOptions({zoomControl:!0}),ii.addInitHook((function(){this.options.zoomControl&&(this.zoomControl=new li,this.addControl(this.zoomControl))}));var ci=function(t){return new li(t)},hi=oi.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var e="leaflet-control-scale",i=de("div",e),n=this.options;return this._addScales(n,e+"-line",i),t.on(n.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),i},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,e,i){t.metric&&(this._mScale=de("div",e,i)),t.imperial&&(this._iScale=de("div",e,i))},_update:function(){var t=this._map,e=t.getSize().y/2,i=t.distance(t.containerPointToLatLng([0,e]),t.containerPointToLatLng([this.options.maxWidth,e]));this._updateScales(i)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var e=this._getRoundNum(t),i=e<1e3?e+" m":e/1e3+" km";this._updateScale(this._mScale,i,e/t)},_updateImperial:function(t){var e,i,n,o=3.2808399*t;o>5280?(e=o/5280,i=this._getRoundNum(e),this._updateScale(this._iScale,i+" mi",i/e)):(n=this._getRoundNum(o),this._updateScale(this._iScale,n+" ft",n/o))},_updateScale:function(t,e,i){t.style.width=Math.round(this.options.maxWidth*i)+"px",t.innerHTML=e},_getRoundNum:function(t){var e=Math.pow(10,(Math.floor(t)+"").length-1),i=t/e;return e*(i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:1)}}),di=function(t){return new hi(t)},ui=oi.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JS library for interactive maps">Leaflet</a>'},initialize:function(t){f(this,t),this._attributions={}},onAdd:function(t){for(var e in t.attributionControl=this,this._container=de("div","leaflet-control-attribution"),qe(this._container),t._layers)t._layers[e].getAttribution&&this.addAttribution(t._layers[e].getAttribution());return this._update(),this._container},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t?(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update(),this):this},removeAttribution:function(t){return t?(this._attributions[t]&&(this._attributions[t]--,this._update()),this):this},_update:function(){if(this._map){var t=[];for(var e in this._attributions)this._attributions[e]&&t.push(e);var i=[];this.options.prefix&&i.push(this.options.prefix),t.length&&i.push(t.join(", ")),this._container.innerHTML=i.join(" | ")}}});ii.mergeOptions({attributionControl:!0}),ii.addInitHook((function(){this.options.attributionControl&&(new ui).addTo(this)}));var pi=function(t){return new ui(t)};oi.Layers=ri,oi.Zoom=li,oi.Scale=hi,oi.Attribution=ui,si.layers=ai,si.zoom=ci,si.scale=di,si.attribution=pi;var fi=T.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled||(this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});fi.addTo=function(t,e){return t.addHandler(e,this),this};var mi,gi={Events:O},vi=St?"touchstart mousedown":"mousedown",yi={mousedown:"mouseup",touchstart:"touchend",pointerdown:"touchend",MSPointerDown:"touchend"},bi={mousedown:"mousemove",touchstart:"touchmove",pointerdown:"touchmove",MSPointerDown:"touchmove"},xi=D.extend({options:{clickTolerance:3},initialize:function(t,e,i,n){f(this,n),this._element=t,this._dragStartTarget=e||t,this._preventOutline=i},enable:function(){this._enabled||($e(this._dragStartTarget,vi,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(xi._dragging===this&&this.finishDrag(),Re(this._dragStartTarget,vi,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){if(!t._simulated&&this._enabled&&(this._moved=!1,!ge(this._element,"leaflet-zoom-anim")&&!(xi._dragging||t.shiftKey||1!==t.which&&1!==t.button&&!t.touches||(xi._dragging=this,this._preventOutline&&Pe(this._element),Me(),ee(),this._moving)))){this.fire("down");var e=t.touches?t.touches[0]:t,i=De(this._element);this._startPoint=new I(e.clientX,e.clientY),this._parentScale=Ie(i),$e(document,bi[t.type],this._onMove,this),$e(document,yi[t.type],this._onUp,this)}},_onMove:function(t){if(!t._simulated&&this._enabled)if(t.touches&&t.touches.length>1)this._moved=!0;else{var e=t.touches&&1===t.touches.length?t.touches[0]:t,i=new I(e.clientX,e.clientY)._subtract(this._startPoint);(i.x||i.y)&&(Math.abs(i.x)+Math.abs(i.y)<this.options.clickTolerance||(i.x/=this._parentScale.x,i.y/=this._parentScale.y,Ve(t),this._moved||(this.fire("dragstart"),this._moved=!0,this._startPos=Ee(this._element).subtract(i),ve(document.body,"leaflet-dragging"),this._lastTarget=t.target||t.srcElement,window.SVGElementInstance&&this._lastTarget instanceof SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),ve(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(i),this._moving=!0,A(this._animRequest),this._lastEvent=t,this._animRequest=E(this._updatePosition,this,!0)))}},_updatePosition:function(){var t={originalEvent:this._lastEvent};this.fire("predrag",t),Ce(this._element,this._newPos),this.fire("drag",t)},_onUp:function(t){!t._simulated&&this._enabled&&this.finishDrag()},finishDrag:function(){for(var t in ye(document.body,"leaflet-dragging"),this._lastTarget&&(ye(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),bi)Re(document,bi[t],this._onMove,this),Re(document,yi[t],this._onUp,this);Te(),ie(),this._moved&&this._moving&&(A(this._animRequest),this.fire("dragend",{distance:this._newPos.distanceTo(this._startPos)})),this._moving=!1,xi._dragging=!1}});function _i(t,e){if(!e||!t.length)return t.slice();var i=e*e;return t=Si(t=Ei(t,i),i)}function wi(t,e,i){return Math.sqrt(Oi(t,e,i,!0))}function ki(t,e,i){return Oi(t,e,i)}function Si(t,e){var i=t.length,n=new(typeof Uint8Array!=void 0+""?Uint8Array:Array)(i);n[0]=n[i-1]=1,Ci(t,n,e,0,i-1);var o,s=[];for(o=0;o<i;o++)n[o]&&s.push(t[o]);return s}function Ci(t,e,i,n,o){var s,r,a,l=0;for(r=n+1;r<=o-1;r++)(a=Oi(t[r],t[n],t[o],!0))>l&&(s=r,l=a);l>i&&(e[s]=1,Ci(t,e,i,n,s),Ci(t,e,i,s,o))}function Ei(t,e){for(var i=[t[0]],n=1,o=0,s=t.length;n<s;n++)Pi(t[n],t[o])>e&&(i.push(t[n]),o=n);return o<s-1&&i.push(t[s-1]),i}function Ai(t,e,i,n,o){var s,r,a,l=n?mi:Ti(t,i),c=Ti(e,i);for(mi=c;;){if(!(l|c))return[t,e];if(l&c)return!1;a=Ti(r=Mi(t,e,s=l||c,i,o),i),s===l?(t=r,l=a):(e=r,c=a)}}function Mi(t,e,i,n,o){var s,r,a=e.x-t.x,l=e.y-t.y,c=n.min,h=n.max;return 8&i?(s=t.x+a*(h.y-t.y)/l,r=h.y):4&i?(s=t.x+a*(c.y-t.y)/l,r=c.y):2&i?(s=h.x,r=t.y+l*(h.x-t.x)/a):1&i&&(s=c.x,r=t.y+l*(c.x-t.x)/a),new I(s,r,o)}function Ti(t,e){var i=0;return t.x<e.min.x?i|=1:t.x>e.max.x&&(i|=2),t.y<e.min.y?i|=4:t.y>e.max.y&&(i|=8),i}function Pi(t,e){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n}function Oi(t,e,i,n){var o,s=e.x,r=e.y,a=i.x-s,l=i.y-r,c=a*a+l*l;return c>0&&((o=((t.x-s)*a+(t.y-r)*l)/c)>1?(s=i.x,r=i.y):o>0&&(s+=a*o,r+=l*o)),a=t.x-s,l=t.y-r,n?a*a+l*l:new I(s,r)}function Di(t){return!y(t[0])||"object"!=typeof t[0][0]&&void 0!==t[0][0]}function Ii(t){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Di(t)}var Li=(Object.freeze||Object)({simplify:_i,pointToSegmentDistance:wi,closestPointOnSegment:ki,clipSegment:Ai,_getEdgeIntersection:Mi,_getBitCode:Ti,_sqClosestPointOnSegment:Oi,isFlat:Di,_flat:Ii});function $i(t,e,i){var n,o,s,r,a,l,c,h,d,u=[1,4,2,8];for(o=0,c=t.length;o<c;o++)t[o]._code=Ti(t[o],e);for(r=0;r<4;r++){for(h=u[r],n=[],o=0,s=(c=t.length)-1;o<c;s=o++)a=t[o],l=t[s],a._code&h?l._code&h||((d=Mi(l,a,h,e,i))._code=Ti(d,e),n.push(d)):(l._code&h&&((d=Mi(l,a,h,e,i))._code=Ti(d,e),n.push(d)),n.push(a));t=n}return t}var zi=(Object.freeze||Object)({clipPolygon:$i}),Ri={project:function(t){return new I(t.lng,t.lat)},unproject:function(t){return new F(t.y,t.x)},bounds:new R([-180,-90],[180,90])},Ni={R:6378137,R_MINOR:6356752.314245179,bounds:new R([-20037508.34279,-15496570.73972],[20037508.34279,18764656.23138]),project:function(t){var e=Math.PI/180,i=this.R,n=t.lat*e,o=this.R_MINOR/i,s=Math.sqrt(1-o*o),r=s*Math.sin(n),a=Math.tan(Math.PI/4-n/2)/Math.pow((1-r)/(1+r),s/2);return n=-i*Math.log(Math.max(a,1e-10)),new I(t.lng*e*i,n)},unproject:function(t){for(var e,i=180/Math.PI,n=this.R,o=this.R_MINOR/n,s=Math.sqrt(1-o*o),r=Math.exp(-t.y/n),a=Math.PI/2-2*Math.atan(r),l=0,c=.1;l<15&&Math.abs(c)>1e-7;l++)e=s*Math.sin(a),e=Math.pow((1-e)/(1+e),s/2),a+=c=Math.PI/2-2*Math.atan(r*e)-a;return new F(a*i,t.x*i/n)}},Bi=(Object.freeze||Object)({LonLat:Ri,Mercator:Ni,SphericalMercator:W}),ji=n({},H,{code:"EPSG:3395",projection:Ni,transformation:function(){var t=.5/(Math.PI*Ni.R);return Z(t,.5,-t,.5)}()}),Fi=n({},H,{code:"EPSG:4326",projection:Ri,transformation:Z(1/180,1,-1/180,.5)}),qi=n({},V,{projection:Ri,transformation:Z(1,0,-1,0),scale:function(t){return Math.pow(2,t)},zoom:function(t){return Math.log(t)/Math.LN2},distance:function(t,e){var i=e.lng-t.lng,n=e.lat-t.lat;return Math.sqrt(i*i+n*n)},infinite:!0});V.Earth=H,V.EPSG3395=ji,V.EPSG3857=Y,V.EPSG900913=X,V.EPSG4326=Fi,V.Simple=qi;var Vi=D.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(t){return t.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(t){return t&&t.removeLayer(this),this},getPane:function(t){return this._map.getPane(t?this.options[t]||t:this.options.pane)},addInteractiveTarget:function(t){return this._map._targets[a(t)]=this,this},removeInteractiveTarget:function(t){return delete this._map._targets[a(t)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(t){var e=t.target;if(e.hasLayer(this)){if(this._map=e,this._zoomAnimated=e._zoomAnimated,this.getEvents){var i=this.getEvents();e.on(i,this),this.once("remove",(function(){e.off(i,this)}),this)}this.onAdd(e),this.getAttribution&&e.attributionControl&&e.attributionControl.addAttribution(this.getAttribution()),this.fire("add"),e.fire("layeradd",{layer:this})}}});ii.include({addLayer:function(t){if(!t._layerAdd)throw new Error("The provided object is not a Layer.");var e=a(t);return this._layers[e]||(this._layers[e]=t,t._mapToAdd=this,t.beforeAdd&&t.beforeAdd(this),this.whenReady(t._layerAdd,t)),this},removeLayer:function(t){var e=a(t);return this._layers[e]?(this._loaded&&t.onRemove(this),t.getAttribution&&this.attributionControl&&this.attributionControl.removeAttribution(t.getAttribution()),delete this._layers[e],this._loaded&&(this.fire("layerremove",{layer:t}),t.fire("remove")),t._map=t._mapToAdd=null,this):this},hasLayer:function(t){return!!t&&a(t)in this._layers},eachLayer:function(t,e){for(var i in this._layers)t.call(e,this._layers[i]);return this},_addLayers:function(t){for(var e=0,i=(t=t?y(t)?t:[t]:[]).length;e<i;e++)this.addLayer(t[e])},_addZoomLimit:function(t){!isNaN(t.options.maxZoom)&&isNaN(t.options.minZoom)||(this._zoomBoundLayers[a(t)]=t,this._updateZoomLevels())},_removeZoomLimit:function(t){var e=a(t);this._zoomBoundLayers[e]&&(delete this._zoomBoundLayers[e],this._updateZoomLevels())},_updateZoomLevels:function(){var t=1/0,e=-1/0,i=this._getZoomSpan();for(var n in this._zoomBoundLayers){var o=this._zoomBoundLayers[n].options;t=void 0===o.minZoom?t:Math.min(t,o.minZoom),e=void 0===o.maxZoom?e:Math.max(e,o.maxZoom)}this._layersMaxZoom=e===-1/0?void 0:e,this._layersMinZoom=t===1/0?void 0:t,i!==this._getZoomSpan()&&this.fire("zoomlevelschange"),void 0===this.options.maxZoom&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var Hi=Vi.extend({initialize:function(t,e){var i,n;if(f(this,e),this._layers={},t)for(i=0,n=t.length;i<n;i++)this.addLayer(t[i])},addLayer:function(t){var e=this.getLayerId(t);return this._layers[e]=t,this._map&&this._map.addLayer(t),this},removeLayer:function(t){var e=t in this._layers?t:this.getLayerId(t);return this._map&&this._layers[e]&&this._map.removeLayer(this._layers[e]),delete this._layers[e],this},hasLayer:function(t){return!!t&&(t in this._layers||this.getLayerId(t)in this._layers)},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(t){var e,i,n=Array.prototype.slice.call(arguments,1);for(e in this._layers)(i=this._layers[e])[t]&&i[t].apply(i,n);return this},onAdd:function(t){this.eachLayer(t.addLayer,t)},onRemove:function(t){this.eachLayer(t.removeLayer,t)},eachLayer:function(t,e){for(var i in this._layers)t.call(e,this._layers[i]);return this},getLayer:function(t){return this._layers[t]},getLayers:function(){var t=[];return this.eachLayer(t.push,t),t},setZIndex:function(t){return this.invoke("setZIndex",t)},getLayerId:function(t){return a(t)}}),Ui=function(t,e){return new Hi(t,e)},Wi=Hi.extend({addLayer:function(t){return this.hasLayer(t)?this:(t.addEventParent(this),Hi.prototype.addLayer.call(this,t),this.fire("layeradd",{layer:t}))},removeLayer:function(t){return this.hasLayer(t)?(t in this._layers&&(t=this._layers[t]),t.removeEventParent(this),Hi.prototype.removeLayer.call(this,t),this.fire("layerremove",{layer:t})):this},setStyle:function(t){return this.invoke("setStyle",t)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var t=new B;for(var e in this._layers){var i=this._layers[e];t.extend(i.getBounds?i.getBounds():i.getLatLng())}return t}}),Gi=function(t){return new Wi(t)},Zi=T.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0]},initialize:function(t){f(this,t)},createIcon:function(t){return this._createIcon("icon",t)},createShadow:function(t){return this._createIcon("shadow",t)},_createIcon:function(t,e){var i=this._getIconUrl(t);if(!i){if("icon"===t)throw new Error("iconUrl not set in Icon options (see the docs).");return null}var n=this._createImg(i,e&&"IMG"===e.tagName?e:null);return this._setIconStyles(n,t),n},_setIconStyles:function(t,e){var i=this.options,n=i[e+"Size"];"number"==typeof n&&(n=[n,n]);var o=z(n),s=z("shadow"===e&&i.shadowAnchor||i.iconAnchor||o&&o.divideBy(2,!0));t.className="leaflet-marker-"+e+" "+(i.className||""),s&&(t.style.marginLeft=-s.x+"px",t.style.marginTop=-s.y+"px"),o&&(t.style.width=o.x+"px",t.style.height=o.y+"px")},_createImg:function(t,e){return(e=e||document.createElement("img")).src=t,e},_getIconUrl:function(t){return At&&this.options[t+"RetinaUrl"]||this.options[t+"Url"]}});function Yi(t){return new Zi(t)}var Xi=Zi.extend({options:{iconUrl:"marker-icon.png",iconRetinaUrl:"marker-icon-2x.png",shadowUrl:"marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]},_getIconUrl:function(t){return Xi.imagePath||(Xi.imagePath=this._detectIconPath()),(this.options.imagePath||Xi.imagePath)+Zi.prototype._getIconUrl.call(this,t)},_detectIconPath:function(){var t=de("div","leaflet-default-icon-path",document.body),e=he(t,"background-image")||he(t,"backgroundImage");return document.body.removeChild(t),e=null===e||0!==e.indexOf("url")?"":e.replace(/^url\(["']?/,"").replace(/marker-icon\.png["']?\)$/,"")}}),Ki=fi.extend({initialize:function(t){this._marker=t},addHooks:function(){var t=this._marker._icon;this._draggable||(this._draggable=new xi(t,t,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),ve(t,"leaflet-marker-draggable")},removeHooks:function(){this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable(),this._marker._icon&&ye(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(t){var e=this._marker,i=e._map,n=this._marker.options.autoPanSpeed,o=this._marker.options.autoPanPadding,s=Ee(e._icon),r=i.getPixelBounds(),a=i.getPixelOrigin(),l=N(r.min._subtract(a).add(o),r.max._subtract(a).subtract(o));if(!l.contains(s)){var c=z((Math.max(l.max.x,s.x)-l.max.x)/(r.max.x-l.max.x)-(Math.min(l.min.x,s.x)-l.min.x)/(r.min.x-l.min.x),(Math.max(l.max.y,s.y)-l.max.y)/(r.max.y-l.max.y)-(Math.min(l.min.y,s.y)-l.min.y)/(r.min.y-l.min.y)).multiplyBy(n);i.panBy(c,{animate:!1}),this._draggable._newPos._add(c),this._draggable._startPos._add(c),Ce(e._icon,this._draggable._newPos),this._onDrag(t),this._panRequest=E(this._adjustPan.bind(this,t))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup().fire("movestart").fire("dragstart")},_onPreDrag:function(t){this._marker.options.autoPan&&(A(this._panRequest),this._panRequest=E(this._adjustPan.bind(this,t)))},_onDrag:function(t){var e=this._marker,i=e._shadow,n=Ee(e._icon),o=e._map.layerPointToLatLng(n);i&&Ce(i,n),e._latlng=o,t.latlng=o,t.oldLatLng=this._oldLatLng,e.fire("move",t).fire("drag",t)},_onDragEnd:function(t){A(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",t)}}),Qi=Vi.extend({options:{icon:new Xi,interactive:!0,keyboard:!0,title:"",alt:"",zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250,pane:"markerPane",shadowPane:"shadowPane",bubblingMouseEvents:!1,draggable:!1,autoPan:!1,autoPanPadding:[50,50],autoPanSpeed:10},initialize:function(t,e){f(this,e),this._latlng=q(t)},onAdd:function(t){this._zoomAnimated=this._zoomAnimated&&t.options.markerZoomAnimation,this._zoomAnimated&&t.on("zoomanim",this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(t){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&t.off("zoomanim",this._animateZoom,this),this._removeIcon(),this._removeShadow()},getEvents:function(){return{zoom:this.update,viewreset:this.update}},getLatLng:function(){return this._latlng},setLatLng:function(t){var e=this._latlng;return this._latlng=q(t),this.update(),this.fire("move",{oldLatLng:e,latlng:this._latlng})},setZIndexOffset:function(t){return this.options.zIndexOffset=t,this.update()},getIcon:function(){return this.options.icon},setIcon:function(t){return this.options.icon=t,this._map&&(this._initIcon(),this.update()),this._popup&&this.bindPopup(this._popup,this._popup.options),this},getElement:function(){return this._icon},update:function(){if(this._icon&&this._map){var t=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(t)}return this},_initIcon:function(){var t=this.options,e="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide"),i=t.icon.createIcon(this._icon),n=!1;i!==this._icon&&(this._icon&&this._removeIcon(),n=!0,t.title&&(i.title=t.title),"IMG"===i.tagName&&(i.alt=t.alt||"")),ve(i,e),t.keyboard&&(i.tabIndex="0"),this._icon=i,t.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex});var o=t.icon.createShadow(this._shadow),s=!1;o!==this._shadow&&(this._removeShadow(),s=!0),o&&(ve(o,e),o.alt=""),this._shadow=o,t.opacity<1&&this._updateOpacity(),n&&this.getPane().appendChild(this._icon),this._initInteraction(),o&&s&&this.getPane(t.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),ue(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&ue(this._shadow),this._shadow=null},_setPos:function(t){Ce(this._icon,t),this._shadow&&Ce(this._shadow,t),this._zIndex=t.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(t){this._icon.style.zIndex=this._zIndex+t},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center).round();this._setPos(e)},_initInteraction:function(){if(this.options.interactive&&(ve(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),Ki)){var t=this.options.draggable;this.dragging&&(t=this.dragging.enabled(),this.dragging.disable()),this.dragging=new Ki(this),t&&this.dragging.enable()}},setOpacity:function(t){return this.options.opacity=t,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var t=this.options.opacity;this._icon&&_e(this._icon,t),this._shadow&&_e(this._shadow,t)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function Ji(t,e){return new Qi(t,e)}var tn=Vi.extend({options:{stroke:!0,color:"#3388ff",weight:3,opacity:1,lineCap:"round",lineJoin:"round",dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,fillRule:"evenodd",interactive:!0,bubblingMouseEvents:!0},beforeAdd:function(t){this._renderer=t.getRenderer(this)},onAdd:function(){this._renderer._initPath(this),this._reset(),this._renderer._addPath(this)},onRemove:function(){this._renderer._removePath(this)},redraw:function(){return this._map&&this._renderer._updatePath(this),this},setStyle:function(t){return f(this,t),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&t.hasOwnProperty("weight")&&this._updateBounds()),this},bringToFront:function(){return this._renderer&&this._renderer._bringToFront(this),this},bringToBack:function(){return this._renderer&&this._renderer._bringToBack(this),this},getElement:function(){return this._path},_reset:function(){this._project(),this._update()},_clickTolerance:function(){return(this.options.stroke?this.options.weight/2:0)+this._renderer.options.tolerance}}),en=tn.extend({options:{fill:!0,radius:10},initialize:function(t,e){f(this,e),this._latlng=q(t),this._radius=this.options.radius},setLatLng:function(t){return this._latlng=q(t),this.redraw(),this.fire("move",{latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(t){return this.options.radius=this._radius=t,this.redraw()},getRadius:function(){return this._radius},setStyle:function(t){var e=t&&t.radius||this._radius;return tn.prototype.setStyle.call(this,t),this.setRadius(e),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var t=this._radius,e=this._radiusY||t,i=this._clickTolerance(),n=[t+i,e+i];this._pxBounds=new R(this._point.subtract(n),this._point.add(n))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateCircle(this)},_empty:function(){return this._radius&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(t){return t.distanceTo(this._point)<=this._radius+this._clickTolerance()}});function nn(t,e){return new en(t,e)}var on=en.extend({initialize:function(t,e,i){if("number"==typeof e&&(e=n({},i,{radius:e})),f(this,e),this._latlng=q(t),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius},setRadius:function(t){return this._mRadius=t,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var t=[this._radius,this._radiusY||this._radius];return new B(this._map.layerPointToLatLng(this._point.subtract(t)),this._map.layerPointToLatLng(this._point.add(t)))},setStyle:tn.prototype.setStyle,_project:function(){var t=this._latlng.lng,e=this._latlng.lat,i=this._map,n=i.options.crs;if(n.distance===H.distance){var o=Math.PI/180,s=this._mRadius/H.R/o,r=i.project([e+s,t]),a=i.project([e-s,t]),l=r.add(a).divideBy(2),c=i.unproject(l).lat,h=Math.acos((Math.cos(s*o)-Math.sin(e*o)*Math.sin(c*o))/(Math.cos(e*o)*Math.cos(c*o)))/o;(isNaN(h)||0===h)&&(h=s/Math.cos(Math.PI/180*e)),this._point=l.subtract(i.getPixelOrigin()),this._radius=isNaN(h)?0:l.x-i.project([c,t-h]).x,this._radiusY=l.y-r.y}else{var d=n.unproject(n.project(this._latlng).subtract([this._mRadius,0]));this._point=i.latLngToLayerPoint(this._latlng),this._radius=this._point.x-i.latLngToLayerPoint(d).x}this._updateBounds()}});function sn(t,e,i){return new on(t,e,i)}var rn=tn.extend({options:{smoothFactor:1,noClip:!1},initialize:function(t,e){f(this,e),this._setLatLngs(t)},getLatLngs:function(){return this._latlngs},setLatLngs:function(t){return this._setLatLngs(t),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(t){for(var e,i,n=1/0,o=null,s=Oi,r=0,a=this._parts.length;r<a;r++)for(var l=this._parts[r],c=1,h=l.length;c<h;c++){var d=s(t,e=l[c-1],i=l[c],!0);d<n&&(n=d,o=s(t,e,i))}return o&&(o.distance=Math.sqrt(n)),o},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");var t,e,i,n,o,s,r,a=this._rings[0],l=a.length;if(!l)return null;for(t=0,e=0;t<l-1;t++)e+=a[t].distanceTo(a[t+1])/2;if(0===e)return this._map.layerPointToLatLng(a[0]);for(t=0,n=0;t<l-1;t++)if(o=a[t],s=a[t+1],(n+=i=o.distanceTo(s))>e)return r=(n-e)/i,this._map.layerPointToLatLng([s.x-r*(s.x-o.x),s.y-r*(s.y-o.y)])},getBounds:function(){return this._bounds},addLatLng:function(t,e){return e=e||this._defaultShape(),t=q(t),e.push(t),this._bounds.extend(t),this.redraw()},_setLatLngs:function(t){this._bounds=new B,this._latlngs=this._convertLatLngs(t)},_defaultShape:function(){return Di(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(t){for(var e=[],i=Di(t),n=0,o=t.length;n<o;n++)i?(e[n]=q(t[n]),this._bounds.extend(e[n])):e[n]=this._convertLatLngs(t[n]);return e},_project:function(){var t=new R;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,t),this._bounds.isValid()&&t.isValid()&&(this._rawPxBounds=t,this._updateBounds())},_updateBounds:function(){var t=this._clickTolerance(),e=new I(t,t);this._pxBounds=new R([this._rawPxBounds.min.subtract(e),this._rawPxBounds.max.add(e)])},_projectLatlngs:function(t,e,i){var n,o,s=t[0]instanceof F,r=t.length;if(s){for(o=[],n=0;n<r;n++)o[n]=this._map.latLngToLayerPoint(t[n]),i.extend(o[n]);e.push(o)}else for(n=0;n<r;n++)this._projectLatlngs(t[n],e,i)},_clipPoints:function(){var t=this._renderer._bounds;if(this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else{var e,i,n,o,s,r,a,l=this._parts;for(e=0,n=0,o=this._rings.length;e<o;e++)for(i=0,s=(a=this._rings[e]).length;i<s-1;i++)(r=Ai(a[i],a[i+1],t,i,!0))&&(l[n]=l[n]||[],l[n].push(r[0]),r[1]===a[i+1]&&i!==s-2||(l[n].push(r[1]),n++))}},_simplifyPoints:function(){for(var t=this._parts,e=this.options.smoothFactor,i=0,n=t.length;i<n;i++)t[i]=_i(t[i],e)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(t,e){var i,n,o,s,r,a,l=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(i=0,s=this._parts.length;i<s;i++)for(n=0,o=(r=(a=this._parts[i]).length)-1;n<r;o=n++)if((e||0!==n)&&wi(t,a[o],a[n])<=l)return!0;return!1}});function an(t,e){return new rn(t,e)}rn._flat=Ii;var ln=rn.extend({options:{fill:!0},isEmpty:function(){return!this._latlngs.length||!this._latlngs[0].length},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");var t,e,i,n,o,s,r,a,l,c=this._rings[0],h=c.length;if(!h)return null;for(s=r=a=0,t=0,e=h-1;t<h;e=t++)i=c[t],n=c[e],o=i.y*n.x-n.y*i.x,r+=(i.x+n.x)*o,a+=(i.y+n.y)*o,s+=3*o;return l=0===s?c[0]:[r/s,a/s],this._map.layerPointToLatLng(l)},_convertLatLngs:function(t){var e=rn.prototype._convertLatLngs.call(this,t),i=e.length;return i>=2&&e[0]instanceof F&&e[0].equals(e[i-1])&&e.pop(),e},_setLatLngs:function(t){rn.prototype._setLatLngs.call(this,t),Di(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Di(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var t=this._renderer._bounds,e=this.options.weight,i=new I(e,e);if(t=new R(t.min.subtract(i),t.max.add(i)),this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else for(var n,o=0,s=this._rings.length;o<s;o++)(n=$i(this._rings[o],t,!0)).length&&this._parts.push(n)},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(t){var e,i,n,o,s,r,a,l,c=!1;if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(o=0,a=this._parts.length;o<a;o++)for(s=0,r=(l=(e=this._parts[o]).length)-1;s<l;r=s++)i=e[s],n=e[r],i.y>t.y!=n.y>t.y&&t.x<(n.x-i.x)*(t.y-i.y)/(n.y-i.y)+i.x&&(c=!c);return c||rn.prototype._containsPoint.call(this,t,!0)}});function cn(t,e){return new ln(t,e)}var hn=Wi.extend({initialize:function(t,e){f(this,e),this._layers={},t&&this.addData(t)},addData:function(t){var e,i,n,o=y(t)?t:t.features;if(o){for(e=0,i=o.length;e<i;e++)((n=o[e]).geometries||n.geometry||n.features||n.coordinates)&&this.addData(n);return this}var s=this.options;if(s.filter&&!s.filter(t))return this;var r=dn(t,s);return r?(r.feature=vn(t),r.defaultOptions=r.options,this.resetStyle(r),s.onEachFeature&&s.onEachFeature(t,r),this.addLayer(r)):this},resetStyle:function(t){return t.options=n({},t.defaultOptions),this._setLayerStyle(t,this.options.style),this},setStyle:function(t){return this.eachLayer((function(e){this._setLayerStyle(e,t)}),this)},_setLayerStyle:function(t,e){t.setStyle&&("function"==typeof e&&(e=e(t.feature)),t.setStyle(e))}});function dn(t,e){var i,n,o,s,r="Feature"===t.type?t.geometry:t,a=r?r.coordinates:null,l=[],c=e&&e.pointToLayer,h=e&&e.coordsToLatLng||un;if(!a&&!r)return null;switch(r.type){case"Point":return i=h(a),c?c(t,i):new Qi(i);case"MultiPoint":for(o=0,s=a.length;o<s;o++)i=h(a[o]),l.push(c?c(t,i):new Qi(i));return new Wi(l);case"LineString":case"MultiLineString":return n=pn(a,"LineString"===r.type?0:1,h),new rn(n,e);case"Polygon":case"MultiPolygon":return n=pn(a,"Polygon"===r.type?1:2,h),new ln(n,e);case"GeometryCollection":for(o=0,s=r.geometries.length;o<s;o++){var d=dn({geometry:r.geometries[o],type:"Feature",properties:t.properties},e);d&&l.push(d)}return new Wi(l);default:throw new Error("Invalid GeoJSON object.")}}function un(t){return new F(t[1],t[0],t[2])}function pn(t,e,i){for(var n,o=[],s=0,r=t.length;s<r;s++)n=e?pn(t[s],e-1,i):(i||un)(t[s]),o.push(n);return o}function fn(t,e){return e="number"==typeof e?e:6,void 0!==t.alt?[d(t.lng,e),d(t.lat,e),d(t.alt,e)]:[d(t.lng,e),d(t.lat,e)]}function mn(t,e,i,n){for(var o=[],s=0,r=t.length;s<r;s++)o.push(e?mn(t[s],e-1,i,n):fn(t[s],n));return!e&&i&&o.push(o[0]),o}function gn(t,e){return t.feature?n({},t.feature,{geometry:e}):vn(e)}function vn(t){return"Feature"===t.type||"FeatureCollection"===t.type?t:{type:"Feature",properties:{},geometry:t}}var yn={toGeoJSON:function(t){return gn(this,{type:"Point",coordinates:fn(this.getLatLng(),t)})}};function bn(t,e){return new hn(t,e)}Qi.include(yn),on.include(yn),en.include(yn),rn.include({toGeoJSON:function(t){var e=!Di(this._latlngs);return gn(this,{type:(e?"Multi":"")+"LineString",coordinates:mn(this._latlngs,e?1:0,!1,t)})}}),ln.include({toGeoJSON:function(t){var e=!Di(this._latlngs),i=e&&!Di(this._latlngs[0]),n=mn(this._latlngs,i?2:e?1:0,!0,t);return e||(n=[n]),gn(this,{type:(i?"Multi":"")+"Polygon",coordinates:n})}}),Hi.include({toMultiPoint:function(t){var e=[];return this.eachLayer((function(i){e.push(i.toGeoJSON(t).geometry.coordinates)})),gn(this,{type:"MultiPoint",coordinates:e})},toGeoJSON:function(t){var e=this.feature&&this.feature.geometry&&this.feature.geometry.type;if("MultiPoint"===e)return this.toMultiPoint(t);var i="GeometryCollection"===e,n=[];return this.eachLayer((function(e){if(e.toGeoJSON){var o=e.toGeoJSON(t);if(i)n.push(o.geometry);else{var s=vn(o);"FeatureCollection"===s.type?n.push.apply(n,s.features):n.push(s)}}})),i?gn(this,{geometries:n,type:"GeometryCollection"}):{type:"FeatureCollection",features:n}}});var xn=bn,_n=Vi.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(t,e,i){this._url=t,this._bounds=j(e),f(this,i)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(ve(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){ue(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(t){return this.options.opacity=t,this._image&&this._updateOpacity(),this},setStyle:function(t){return t.opacity&&this.setOpacity(t.opacity),this},bringToFront:function(){return this._map&&fe(this._image),this},bringToBack:function(){return this._map&&me(this._image),this},setUrl:function(t){return this._url=t,this._image&&(this._image.src=t),this},setBounds:function(t){return this._bounds=j(t),this._map&&this._reset(),this},getEvents:function(){var t={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var t="IMG"===this._url.tagName,e=this._image=t?this._url:de("img");ve(e,"leaflet-image-layer"),this._zoomAnimated&&ve(e,"leaflet-zoom-animated"),this.options.className&&ve(e,this.options.className),e.onselectstart=h,e.onmousemove=h,e.onload=s(this.fire,this,"load"),e.onerror=s(this._overlayOnError,this,"error"),(this.options.crossOrigin||""===this.options.crossOrigin)&&(e.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),t?this._url=e.src:(e.src=this._url,e.alt=this.options.alt)},_animateZoom:function(t){var e=this._map.getZoomScale(t.zoom),i=this._map._latLngBoundsToNewLayerBounds(this._bounds,t.zoom,t.center).min;Se(this._image,i,e)},_reset:function(){var t=this._image,e=new R(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),i=e.getSize();Ce(t,e.min),t.style.width=i.x+"px",t.style.height=i.y+"px"},_updateOpacity:function(){_e(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var t=this.options.errorOverlayUrl;t&&this._url!==t&&(this._url=t,this._image.src=t)}}),wn=function(t,e,i){return new _n(t,e,i)},kn=_n.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0},_initImage:function(){var t="VIDEO"===this._url.tagName,e=this._image=t?this._url:de("video");if(ve(e,"leaflet-image-layer"),this._zoomAnimated&&ve(e,"leaflet-zoom-animated"),e.onselectstart=h,e.onmousemove=h,e.onloadeddata=s(this.fire,this,"load"),t){for(var i=e.getElementsByTagName("source"),n=[],o=0;o<i.length;o++)n.push(i[o].src);this._url=i.length>0?n:[e.src]}else{y(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&e.style.hasOwnProperty("objectFit")&&(e.style.objectFit="fill"),e.autoplay=!!this.options.autoplay,e.loop=!!this.options.loop;for(var r=0;r<this._url.length;r++){var a=de("source");a.src=this._url[r],e.appendChild(a)}}}});function Sn(t,e,i){return new kn(t,e,i)}var Cn=_n.extend({_initImage:function(){var t=this._image=this._url;ve(t,"leaflet-image-layer"),this._zoomAnimated&&ve(t,"leaflet-zoom-animated"),t.onselectstart=h,t.onmousemove=h}});function En(t,e,i){return new Cn(t,e,i)}var An=Vi.extend({options:{offset:[0,7],className:"",pane:"popupPane"},initialize:function(t,e){f(this,t),this._source=e},onAdd:function(t){this._zoomAnimated=t._zoomAnimated,this._container||this._initLayout(),t._fadeAnimated&&_e(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),t._fadeAnimated&&_e(this._container,1),this.bringToFront()},onRemove:function(t){t._fadeAnimated?(_e(this._container,0),this._removeTimeout=setTimeout(s(ue,void 0,this._container),200)):ue(this._container)},getLatLng:function(){return this._latlng},setLatLng:function(t){return this._latlng=q(t),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(t){return this._content=t,this.update(),this},getElement:function(){return this._container},update:function(){this._map&&(this._container.style.visibility="hidden",this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility="",this._adjustPan())},getEvents:function(){var t={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&fe(this._container),this},bringToBack:function(){return this._map&&me(this._container),this},_prepareOpen:function(t,e,i){if(e instanceof Vi||(i=e,e=t),e instanceof Wi)for(var n in t._layers){e=t._layers[n];break}if(!i)if(e.getCenter)i=e.getCenter();else{if(!e.getLatLng)throw new Error("Unable to get source layer LatLng.");i=e.getLatLng()}return this._source=e,this.update(),i},_updateContent:function(){if(this._content){var t=this._contentNode,e="function"==typeof this._content?this._content(this._source||this):this._content;if("string"==typeof e)t.innerHTML=e;else{for(;t.hasChildNodes();)t.removeChild(t.firstChild);t.appendChild(e)}this.fire("contentupdate")}},_updatePosition:function(){if(this._map){var t=this._map.latLngToLayerPoint(this._latlng),e=z(this.options.offset),i=this._getAnchor();this._zoomAnimated?Ce(this._container,t.add(i)):e=e.add(t).add(i);var n=this._containerBottom=-e.y,o=this._containerLeft=-Math.round(this._containerWidth/2)+e.x;this._container.style.bottom=n+"px",this._container.style.left=o+"px"}},_getAnchor:function(){return[0,0]}}),Mn=An.extend({options:{maxWidth:300,minWidth:50,maxHeight:null,autoPan:!0,autoPanPaddingTopLeft:null,autoPanPaddingBottomRight:null,autoPanPadding:[5,5],keepInView:!1,closeButton:!0,autoClose:!0,closeOnEscapeKey:!0,className:""},openOn:function(t){return t.openPopup(this),this},onAdd:function(t){An.prototype.onAdd.call(this,t),t.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof tn||this._source.on("preclick",je))},onRemove:function(t){An.prototype.onRemove.call(this,t),t.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof tn||this._source.off("preclick",je))},getEvents:function(){var t=An.prototype.getEvents.call(this);return(void 0!==this.options.closeOnClick?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(t.preclick=this._close),this.options.keepInView&&(t.moveend=this._adjustPan),t},_close:function(){this._map&&this._map.closePopup(this)},_initLayout:function(){var t="leaflet-popup",e=this._container=de("div",t+" "+(this.options.className||"")+" leaflet-zoom-animated"),i=this._wrapper=de("div",t+"-content-wrapper",e);if(this._contentNode=de("div",t+"-content",i),qe(i),Fe(this._contentNode),$e(i,"contextmenu",je),this._tipContainer=de("div",t+"-tip-container",e),this._tip=de("div",t+"-tip",this._tipContainer),this.options.closeButton){var n=this._closeButton=de("a",t+"-close-button",e);n.href="#close",n.innerHTML="×",$e(n,"click",this._onCloseButtonClick,this)}},_updateLayout:function(){var t=this._contentNode,e=t.style;e.width="",e.whiteSpace="nowrap";var i=t.offsetWidth;i=Math.min(i,this.options.maxWidth),i=Math.max(i,this.options.minWidth),e.width=i+1+"px",e.whiteSpace="",e.height="";var n=t.offsetHeight,o=this.options.maxHeight,s="leaflet-popup-scrolled";o&&n>o?(e.height=o+"px",ve(t,s)):ye(t,s),this._containerWidth=this._container.offsetWidth},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center),i=this._getAnchor();Ce(this._container,e.add(i))},_adjustPan:function(){if(this.options.autoPan){this._map._panAnim&&this._map._panAnim.stop();var t=this._map,e=parseInt(he(this._container,"marginBottom"),10)||0,i=this._container.offsetHeight+e,n=this._containerWidth,o=new I(this._containerLeft,-i-this._containerBottom);o._add(Ee(this._container));var s=t.layerPointToContainerPoint(o),r=z(this.options.autoPanPadding),a=z(this.options.autoPanPaddingTopLeft||r),l=z(this.options.autoPanPaddingBottomRight||r),c=t.getSize(),h=0,d=0;s.x+n+l.x>c.x&&(h=s.x+n-c.x+l.x),s.x-h-a.x<0&&(h=s.x-a.x),s.y+i+l.y>c.y&&(d=s.y+i-c.y+l.y),s.y-d-a.y<0&&(d=s.y-a.y),(h||d)&&t.fire("autopanstart").panBy([h,d])}},_onCloseButtonClick:function(t){this._close(),He(t)},_getAnchor:function(){return z(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),Tn=function(t,e){return new Mn(t,e)};ii.mergeOptions({closePopupOnClick:!0}),ii.include({openPopup:function(t,e,i){return t instanceof Mn||(t=new Mn(i).setContent(t)),e&&t.setLatLng(e),this.hasLayer(t)?this:(this._popup&&this._popup.options.autoClose&&this.closePopup(),this._popup=t,this.addLayer(t))},closePopup:function(t){return t&&t!==this._popup||(t=this._popup,this._popup=null),t&&this.removeLayer(t),this}}),Vi.include({bindPopup:function(t,e){return t instanceof Mn?(f(t,e),this._popup=t,t._source=this):(this._popup&&!e||(this._popup=new Mn(e,this)),this._popup.setContent(t)),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t,e){return this._popup&&this._map&&(e=this._popup._prepareOpen(this,t,e),this._map.openPopup(this._popup,e)),this},closePopup:function(){return this._popup&&this._popup._close(),this},togglePopup:function(t){return this._popup&&(this._popup._map?this.closePopup():this.openPopup(t)),this},isPopupOpen:function(){return!!this._popup&&this._popup.isOpen()},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){var e=t.layer||t.target;this._popup&&this._map&&(He(t),e instanceof tn?this.openPopup(t.layer||t.target,t.latlng):this._map.hasLayer(this._popup)&&this._popup._source===e?this.closePopup():this.openPopup(e,t.latlng))},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){13===t.originalEvent.keyCode&&this._openPopup(t)}});var Pn=An.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,interactive:!1,opacity:.9},onAdd:function(t){An.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&this._source.fire("tooltipopen",{tooltip:this},!0)},onRemove:function(t){An.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&this._source.fire("tooltipclose",{tooltip:this},!0)},getEvents:function(){var t=An.prototype.getEvents.call(this);return St&&!this.options.permanent&&(t.preclick=this._close),t},_close:function(){this._map&&this._map.closeTooltip(this)},_initLayout:function(){var t="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=de("div",t)},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var e=this._map,i=this._container,n=e.latLngToContainerPoint(e.getCenter()),o=e.layerPointToContainerPoint(t),s=this.options.direction,r=i.offsetWidth,a=i.offsetHeight,l=z(this.options.offset),c=this._getAnchor();"top"===s?t=t.add(z(-r/2+l.x,-a+l.y+c.y,!0)):"bottom"===s?t=t.subtract(z(r/2-l.x,-l.y,!0)):"center"===s?t=t.subtract(z(r/2+l.x,a/2-c.y+l.y,!0)):"right"===s||"auto"===s&&o.x<n.x?(s="right",t=t.add(z(l.x+c.x,c.y-a/2+l.y,!0))):(s="left",t=t.subtract(z(r+c.x-l.x,a/2-c.y-l.y,!0))),ye(i,"leaflet-tooltip-right"),ye(i,"leaflet-tooltip-left"),ye(i,"leaflet-tooltip-top"),ye(i,"leaflet-tooltip-bottom"),ve(i,"leaflet-tooltip-"+s),Ce(i,t)},_updatePosition:function(){var t=this._map.latLngToLayerPoint(this._latlng);this._setPosition(t)},setOpacity:function(t){this.options.opacity=t,this._container&&_e(this._container,t)},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center);this._setPosition(e)},_getAnchor:function(){return z(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),On=function(t,e){return new Pn(t,e)};ii.include({openTooltip:function(t,e,i){return t instanceof Pn||(t=new Pn(i).setContent(t)),e&&t.setLatLng(e),this.hasLayer(t)?this:this.addLayer(t)},closeTooltip:function(t){return t&&this.removeLayer(t),this}}),Vi.include({bindTooltip:function(t,e){return t instanceof Pn?(f(t,e),this._tooltip=t,t._source=this):(this._tooltip&&!e||(this._tooltip=new Pn(e,this)),this._tooltip.setContent(t)),this._initTooltipInteractions(),this._tooltip.options.permanent&&this._map&&this._map.hasLayer(this)&&this.openTooltip(),this},unbindTooltip:function(){return this._tooltip&&(this._initTooltipInteractions(!0),this.closeTooltip(),this._tooltip=null),this},_initTooltipInteractions:function(t){if(t||!this._tooltipHandlersAdded){var e=t?"off":"on",i={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?i.add=this._openTooltip:(i.mouseover=this._openTooltip,i.mouseout=this.closeTooltip,this._tooltip.options.sticky&&(i.mousemove=this._moveTooltip),St&&(i.click=this._openTooltip)),this[e](i),this._tooltipHandlersAdded=!t}},openTooltip:function(t,e){return this._tooltip&&this._map&&(e=this._tooltip._prepareOpen(this,t,e),this._map.openTooltip(this._tooltip,e),this._tooltip.options.interactive&&this._tooltip._container&&(ve(this._tooltip._container,"leaflet-clickable"),this.addInteractiveTarget(this._tooltip._container))),this},closeTooltip:function(){return this._tooltip&&(this._tooltip._close(),this._tooltip.options.interactive&&this._tooltip._container&&(ye(this._tooltip._container,"leaflet-clickable"),this.removeInteractiveTarget(this._tooltip._container))),this},toggleTooltip:function(t){return this._tooltip&&(this._tooltip._map?this.closeTooltip():this.openTooltip(t)),this},isTooltipOpen:function(){return this._tooltip.isOpen()},setTooltipContent:function(t){return this._tooltip&&this._tooltip.setContent(t),this},getTooltip:function(){return this._tooltip},_openTooltip:function(t){var e=t.layer||t.target;this._tooltip&&this._map&&this.openTooltip(e,this._tooltip.options.sticky?t.latlng:void 0)},_moveTooltip:function(t){var e,i,n=t.latlng;this._tooltip.options.sticky&&t.originalEvent&&(e=this._map.mouseEventToContainerPoint(t.originalEvent),i=this._map.containerPointToLayerPoint(e),n=this._map.layerPointToLatLng(i)),this._tooltip.setLatLng(n)}});var Dn=Zi.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(t){var e=t&&"DIV"===t.tagName?t:document.createElement("div"),i=this.options;if(i.html instanceof Element?(pe(e),e.appendChild(i.html)):e.innerHTML=!1!==i.html?i.html:"",i.bgPos){var n=z(i.bgPos);e.style.backgroundPosition=-n.x+"px "+-n.y+"px"}return this._setIconStyles(e,"icon"),e},createShadow:function(){return null}});function In(t){return new Dn(t)}Zi.Default=Xi;var Ln=Vi.extend({options:{tileSize:256,opacity:1,updateWhenIdle:bt,updateWhenZooming:!0,updateInterval:200,zIndex:1,bounds:null,minZoom:0,maxZoom:void 0,maxNativeZoom:void 0,minNativeZoom:void 0,noWrap:!1,pane:"tilePane",className:"",keepBuffer:2},initialize:function(t){f(this,t)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView(),this._update()},beforeAdd:function(t){t._addZoomLimit(this)},onRemove:function(t){this._removeAllTiles(),ue(this._container),t._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(fe(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(me(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(t){return this.options.opacity=t,this._updateOpacity(),this},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){return this._map&&(this._removeAllTiles(),this._update()),this},getEvents:function(){var t={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||(this._onMove=l(this._onMoveEnd,this.options.updateInterval,this)),t.move=this._onMove),this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},createTile:function(){return document.createElement("div")},getTileSize:function(){var t=this.options.tileSize;return t instanceof I?t:new I(t,t)},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(t){for(var e,i=this.getPane().children,n=-t(-1/0,1/0),o=0,s=i.length;o<s;o++)e=i[o].style.zIndex,i[o]!==this._container&&e&&(n=t(n,+e));isFinite(n)&&(this.options.zIndex=n+t(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!et){_e(this._container,this.options.opacity);var t=+new Date,e=!1,i=!1;for(var n in this._tiles){var o=this._tiles[n];if(o.current&&o.loaded){var s=Math.min(1,(t-o.loaded)/200);_e(o.el,s),s<1?e=!0:(o.active?i=!0:this._onOpaqueTile(o),o.active=!0)}}i&&!this._noPrune&&this._pruneTiles(),e&&(A(this._fadeFrame),this._fadeFrame=E(this._updateOpacity,this))}},_onOpaqueTile:h,_initContainer:function(){this._container||(this._container=de("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var t=this._tileZoom,e=this.options.maxZoom;if(void 0!==t){for(var i in this._levels)this._levels[i].el.children.length||i===t?(this._levels[i].el.style.zIndex=e-Math.abs(t-i),this._onUpdateLevel(i)):(ue(this._levels[i].el),this._removeTilesAtZoom(i),this._onRemoveLevel(i),delete this._levels[i]);var n=this._levels[t],o=this._map;return n||((n=this._levels[t]={}).el=de("div","leaflet-tile-container leaflet-zoom-animated",this._container),n.el.style.zIndex=e,n.origin=o.project(o.unproject(o.getPixelOrigin()),t).round(),n.zoom=t,this._setZoomTransform(n,o.getCenter(),o.getZoom()),h(n.el.offsetWidth),this._onCreateLevel(n)),this._level=n,n}},_onUpdateLevel:h,_onRemoveLevel:h,_onCreateLevel:h,_pruneTiles:function(){if(this._map){var t,e,i=this._map.getZoom();if(i>this.options.maxZoom||i<this.options.minZoom)this._removeAllTiles();else{for(t in this._tiles)(e=this._tiles[t]).retain=e.current;for(t in this._tiles)if((e=this._tiles[t]).current&&!e.active){var n=e.coords;this._retainParent(n.x,n.y,n.z,n.z-5)||this._retainChildren(n.x,n.y,n.z,n.z+2)}for(t in this._tiles)this._tiles[t].retain||this._removeTile(t)}}},_removeTilesAtZoom:function(t){for(var e in this._tiles)this._tiles[e].coords.z===t&&this._removeTile(e)},_removeAllTiles:function(){for(var t in this._tiles)this._removeTile(t)},_invalidateAll:function(){for(var t in this._levels)ue(this._levels[t].el),this._onRemoveLevel(t),delete this._levels[t];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(t,e,i,n){var o=Math.floor(t/2),s=Math.floor(e/2),r=i-1,a=new I(+o,+s);a.z=+r;var l=this._tileCoordsToKey(a),c=this._tiles[l];return c&&c.active?(c.retain=!0,!0):(c&&c.loaded&&(c.retain=!0),r>n&&this._retainParent(o,s,r,n))},_retainChildren:function(t,e,i,n){for(var o=2*t;o<2*t+2;o++)for(var s=2*e;s<2*e+2;s++){var r=new I(o,s);r.z=i+1;var a=this._tileCoordsToKey(r),l=this._tiles[a];l&&l.active?l.retain=!0:(l&&l.loaded&&(l.retain=!0),i+1<n&&this._retainChildren(o,s,i+1,n))}},_resetView:function(t){var e=t&&(t.pinch||t.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),e,e)},_animateZoom:function(t){this._setView(t.center,t.zoom,!0,t.noUpdate)},_clampZoom:function(t){var e=this.options;return void 0!==e.minNativeZoom&&t<e.minNativeZoom?e.minNativeZoom:void 0!==e.maxNativeZoom&&e.maxNativeZoom<t?e.maxNativeZoom:t},_setView:function(t,e,i,n){var o=this._clampZoom(Math.round(e));(void 0!==this.options.maxZoom&&o>this.options.maxZoom||void 0!==this.options.minZoom&&o<this.options.minZoom)&&(o=void 0);var s=this.options.updateWhenZooming&&o!==this._tileZoom;n&&!s||(this._tileZoom=o,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),void 0!==o&&this._update(t),i||this._pruneTiles(),this._noPrune=!!i),this._setZoomTransforms(t,e)},_setZoomTransforms:function(t,e){for(var i in this._levels)this._setZoomTransform(this._levels[i],t,e)},_setZoomTransform:function(t,e,i){var n=this._map.getZoomScale(i,t.zoom),o=t.origin.multiplyBy(n).subtract(this._map._getNewPixelOrigin(e,i)).round();yt?Se(t.el,o,n):Ce(t.el,o)},_resetGrid:function(){var t=this._map,e=t.options.crs,i=this._tileSize=this.getTileSize(),n=this._tileZoom,o=this._map.getPixelWorldBounds(this._tileZoom);o&&(this._globalTileRange=this._pxBoundsToTileRange(o)),this._wrapX=e.wrapLng&&!this.options.noWrap&&[Math.floor(t.project([0,e.wrapLng[0]],n).x/i.x),Math.ceil(t.project([0,e.wrapLng[1]],n).x/i.y)],this._wrapY=e.wrapLat&&!this.options.noWrap&&[Math.floor(t.project([e.wrapLat[0],0],n).y/i.x),Math.ceil(t.project([e.wrapLat[1],0],n).y/i.y)]},_onMoveEnd:function(){this._map&&!this._map._animatingZoom&&this._update()},_getTiledPixelBounds:function(t){var e=this._map,i=e._animatingZoom?Math.max(e._animateToZoom,e.getZoom()):e.getZoom(),n=e.getZoomScale(i,this._tileZoom),o=e.project(t,this._tileZoom).floor(),s=e.getSize().divideBy(2*n);return new R(o.subtract(s),o.add(s))},_update:function(t){var e=this._map;if(e){var i=this._clampZoom(e.getZoom());if(void 0===t&&(t=e.getCenter()),void 0!==this._tileZoom){var n=this._getTiledPixelBounds(t),o=this._pxBoundsToTileRange(n),s=o.getCenter(),r=[],a=this.options.keepBuffer,l=new R(o.getBottomLeft().subtract([a,-a]),o.getTopRight().add([a,-a]));if(!(isFinite(o.min.x)&&isFinite(o.min.y)&&isFinite(o.max.x)&&isFinite(o.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var c in this._tiles){var h=this._tiles[c].coords;h.z===this._tileZoom&&l.contains(new I(h.x,h.y))||(this._tiles[c].current=!1)}if(Math.abs(i-this._tileZoom)>1)this._setView(t,i);else{for(var d=o.min.y;d<=o.max.y;d++)for(var u=o.min.x;u<=o.max.x;u++){var p=new I(u,d);if(p.z=this._tileZoom,this._isValidTile(p)){var f=this._tiles[this._tileCoordsToKey(p)];f?f.current=!0:r.push(p)}}if(r.sort((function(t,e){return t.distanceTo(s)-e.distanceTo(s)})),0!==r.length){this._loading||(this._loading=!0,this.fire("loading"));var m=document.createDocumentFragment();for(u=0;u<r.length;u++)this._addTile(r[u],m);this._level.el.appendChild(m)}}}}},_isValidTile:function(t){var e=this._map.options.crs;if(!e.infinite){var i=this._globalTileRange;if(!e.wrapLng&&(t.x<i.min.x||t.x>i.max.x)||!e.wrapLat&&(t.y<i.min.y||t.y>i.max.y))return!1}if(!this.options.bounds)return!0;var n=this._tileCoordsToBounds(t);return j(this.options.bounds).overlaps(n)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var e=this._map,i=this.getTileSize(),n=t.scaleBy(i),o=n.add(i);return[e.unproject(n,t.z),e.unproject(o,t.z)]},_tileCoordsToBounds:function(t){var e=this._tileCoordsToNwSe(t),i=new B(e[0],e[1]);return this.options.noWrap||(i=this._map.wrapLatLngBounds(i)),i},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var e=t.split(":"),i=new I(+e[0],+e[1]);return i.z=+e[2],i},_removeTile:function(t){var e=this._tiles[t];e&&(ue(e.el),delete this._tiles[t],this.fire("tileunload",{tile:e.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){ve(t,"leaflet-tile");var e=this.getTileSize();t.style.width=e.x+"px",t.style.height=e.y+"px",t.onselectstart=h,t.onmousemove=h,et&&this.options.opacity<1&&_e(t,this.options.opacity),ot&&!st&&(t.style.WebkitBackfaceVisibility="hidden")},_addTile:function(t,e){var i=this._getTilePos(t),n=this._tileCoordsToKey(t),o=this.createTile(this._wrapCoords(t),s(this._tileReady,this,t));this._initTile(o),this.createTile.length<2&&E(s(this._tileReady,this,t,null,o)),Ce(o,i),this._tiles[n]={el:o,coords:t,current:!0},e.appendChild(o),this.fire("tileloadstart",{tile:o,coords:t})},_tileReady:function(t,e,i){e&&this.fire("tileerror",{error:e,tile:i,coords:t});var n=this._tileCoordsToKey(t);(i=this._tiles[n])&&(i.loaded=+new Date,this._map._fadeAnimated?(_e(i.el,0),A(this._fadeFrame),this._fadeFrame=E(this._updateOpacity,this)):(i.active=!0,this._pruneTiles()),e||(ve(i.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:i.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),et||!this._map._fadeAnimated?E(this._pruneTiles,this):setTimeout(s(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var e=new I(this._wrapX?c(t.x,this._wrapX):t.x,this._wrapY?c(t.y,this._wrapY):t.y);return e.z=t.z,e},_pxBoundsToTileRange:function(t){var e=this.getTileSize();return new R(t.min.unscaleBy(e).floor(),t.max.unscaleBy(e).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}});function $n(t){return new Ln(t)}var zn=Ln.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1},initialize:function(t,e){this._url=t,(e=f(this,e)).detectRetina&&At&&e.maxZoom>0&&(e.tileSize=Math.floor(e.tileSize/2),e.zoomReverse?(e.zoomOffset--,e.minZoom++):(e.zoomOffset++,e.maxZoom--),e.minZoom=Math.max(0,e.minZoom)),"string"==typeof e.subdomains&&(e.subdomains=e.subdomains.split("")),ot||this.on("tileunload",this._onTileRemove)},setUrl:function(t,e){return this._url===t&&void 0===e&&(e=!0),this._url=t,e||this.redraw(),this},createTile:function(t,e){var i=document.createElement("img");return $e(i,"load",s(this._tileOnLoad,this,e,i)),$e(i,"error",s(this._tileOnError,this,e,i)),(this.options.crossOrigin||""===this.options.crossOrigin)&&(i.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),i.alt="",i.setAttribute("role","presentation"),i.src=this.getTileUrl(t),i},getTileUrl:function(t){var e={r:At?"@2x":"",s:this._getSubdomain(t),x:t.x,y:t.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var i=this._globalTileRange.max.y-t.y;this.options.tms&&(e.y=i),e["-y"]=i}return v(this._url,n(e,this.options))},_tileOnLoad:function(t,e){et?setTimeout(s(t,this,null,e),0):t(null,e)},_tileOnError:function(t,e,i){var n=this.options.errorTileUrl;n&&e.getAttribute("src")!==n&&(e.src=n),t(i,e)},_onTileRemove:function(t){t.tile.onload=null},_getZoomForUrl:function(){var t=this._tileZoom,e=this.options.maxZoom;return this.options.zoomReverse&&(t=e-t),t+this.options.zoomOffset},_getSubdomain:function(t){var e=Math.abs(t.x+t.y)%this.options.subdomains.length;return this.options.subdomains[e]},_abortLoading:function(){var t,e;for(t in this._tiles)this._tiles[t].coords.z!==this._tileZoom&&((e=this._tiles[t].el).onload=h,e.onerror=h,e.complete||(e.src=x,ue(e),delete this._tiles[t]))},_removeTile:function(t){var e=this._tiles[t];if(e)return at||e.el.setAttribute("src",x),Ln.prototype._removeTile.call(this,t)},_tileReady:function(t,e,i){if(this._map&&(!i||i.getAttribute("src")!==x))return Ln.prototype._tileReady.call(this,t,e,i)}});function Rn(t,e){return new zn(t,e)}var Nn=zn.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(t,e){this._url=t;var i=n({},this.defaultWmsParams);for(var o in e)o in this.options||(i[o]=e[o]);var s=(e=f(this,e)).detectRetina&&At?2:1,r=this.getTileSize();i.width=r.x*s,i.height=r.y*s,this.wmsParams=i},onAdd:function(t){this._crs=this.options.crs||t.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var e=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[e]=this._crs.code,zn.prototype.onAdd.call(this,t)},getTileUrl:function(t){var e=this._tileCoordsToNwSe(t),i=this._crs,n=N(i.project(e[0]),i.project(e[1])),o=n.min,s=n.max,r=(this._wmsVersion>=1.3&&this._crs===Fi?[o.y,o.x,s.y,s.x]:[o.x,o.y,s.x,s.y]).join(","),a=zn.prototype.getTileUrl.call(this,t);return a+m(this.wmsParams,a,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+r},setParams:function(t,e){return n(this.wmsParams,t),e||this.redraw(),this}});function Bn(t,e){return new Nn(t,e)}zn.WMS=Nn,Rn.wms=Bn;var jn=Vi.extend({options:{padding:.1,tolerance:0},initialize:function(t){f(this,t),a(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),this._zoomAnimated&&ve(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var t={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(t.zoomanim=this._onAnimZoom),t},_onAnimZoom:function(t){this._updateTransform(t.center,t.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(t,e){var i=this._map.getZoomScale(e,this._zoom),n=Ee(this._container),o=this._map.getSize().multiplyBy(.5+this.options.padding),s=this._map.project(this._center,e),r=this._map.project(t,e).subtract(s),a=o.multiplyBy(-i).add(n).add(o).subtract(r);yt?Se(this._container,a,i):Ce(this._container,a)},_reset:function(){for(var t in this._update(),this._updateTransform(this._center,this._zoom),this._layers)this._layers[t]._reset()},_onZoomEnd:function(){for(var t in this._layers)this._layers[t]._project()},_updatePaths:function(){for(var t in this._layers)this._layers[t]._update()},_update:function(){var t=this.options.padding,e=this._map.getSize(),i=this._map.containerPointToLayerPoint(e.multiplyBy(-t)).round();this._bounds=new R(i,i.add(e.multiplyBy(1+2*t)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),Fn=jn.extend({getEvents:function(){var t=jn.prototype.getEvents.call(this);return t.viewprereset=this._onViewPreReset,t},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){jn.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var t=this._container=document.createElement("canvas");$e(t,"mousemove",l(this._onMouseMove,32,this),this),$e(t,"click dblclick mousedown mouseup contextmenu",this._onClick,this),$e(t,"mouseout",this._handleMouseOut,this),this._ctx=t.getContext("2d")},_destroyContainer:function(){A(this._redrawRequest),delete this._ctx,ue(this._container),Re(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){for(var t in this._redrawBounds=null,this._layers)this._layers[t]._update();this._redraw()}},_update:function(){if(!this._map._animatingZoom||!this._bounds){jn.prototype._update.call(this);var t=this._bounds,e=this._container,i=t.getSize(),n=At?2:1;Ce(e,t.min),e.width=n*i.x,e.height=n*i.y,e.style.width=i.x+"px",e.style.height=i.y+"px",At&&this._ctx.scale(2,2),this._ctx.translate(-t.min.x,-t.min.y),this.fire("update")}},_reset:function(){jn.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(t){this._updateDashArray(t),this._layers[a(t)]=t;var e=t._order={layer:t,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=e),this._drawLast=e,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(t){this._requestRedraw(t)},_removePath:function(t){var e=t._order,i=e.next,n=e.prev;i?i.prev=n:this._drawLast=n,n?n.next=i:this._drawFirst=i,delete t._order,delete this._layers[a(t)],this._requestRedraw(t)},_updatePath:function(t){this._extendRedrawBounds(t),t._project(),t._update(),this._requestRedraw(t)},_updateStyle:function(t){this._updateDashArray(t),this._requestRedraw(t)},_updateDashArray:function(t){if("string"==typeof t.options.dashArray){var e,i,n=t.options.dashArray.split(/[, ]+/),o=[];for(i=0;i<n.length;i++){if(e=Number(n[i]),isNaN(e))return;o.push(e)}t.options._dashArray=o}else t.options._dashArray=t.options.dashArray},_requestRedraw:function(t){this._map&&(this._extendRedrawBounds(t),this._redrawRequest=this._redrawRequest||E(this._redraw,this))},_extendRedrawBounds:function(t){if(t._pxBounds){var e=(t.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new R,this._redrawBounds.extend(t._pxBounds.min.subtract([e,e])),this._redrawBounds.extend(t._pxBounds.max.add([e,e]))}},_redraw:function(){this._redrawRequest=null,this._redrawBounds&&(this._redrawBounds.min._floor(),this._redrawBounds.max._ceil()),this._clear(),this._draw(),this._redrawBounds=null},_clear:function(){var t=this._redrawBounds;if(t){var e=t.getSize();this._ctx.clearRect(t.min.x,t.min.y,e.x,e.y)}else this._ctx.clearRect(0,0,this._container.width,this._container.height)},_draw:function(){var t,e=this._redrawBounds;if(this._ctx.save(),e){var i=e.getSize();this._ctx.beginPath(),this._ctx.rect(e.min.x,e.min.y,i.x,i.y),this._ctx.clip()}this._drawing=!0;for(var n=this._drawFirst;n;n=n.next)t=n.layer,(!e||t._pxBounds&&t._pxBounds.intersects(e))&&t._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(t,e){if(this._drawing){var i,n,o,s,r=t._parts,a=r.length,l=this._ctx;if(a){for(l.beginPath(),i=0;i<a;i++){for(n=0,o=r[i].length;n<o;n++)s=r[i][n],l[n?"lineTo":"moveTo"](s.x,s.y);e&&l.closePath()}this._fillStroke(l,t)}}},_updateCircle:function(t){if(this._drawing&&!t._empty()){var e=t._point,i=this._ctx,n=Math.max(Math.round(t._radius),1),o=(Math.max(Math.round(t._radiusY),1)||n)/n;1!==o&&(i.save(),i.scale(1,o)),i.beginPath(),i.arc(e.x,e.y/o,n,0,2*Math.PI,!1),1!==o&&i.restore(),this._fillStroke(i,t)}},_fillStroke:function(t,e){var i=e.options;i.fill&&(t.globalAlpha=i.fillOpacity,t.fillStyle=i.fillColor||i.color,t.fill(i.fillRule||"evenodd")),i.stroke&&0!==i.weight&&(t.setLineDash&&t.setLineDash(e.options&&e.options._dashArray||[]),t.globalAlpha=i.opacity,t.lineWidth=i.weight,t.strokeStyle=i.color,t.lineCap=i.lineCap,t.lineJoin=i.lineJoin,t.stroke())},_onClick:function(t){for(var e,i,n=this._map.mouseEventToLayerPoint(t),o=this._drawFirst;o;o=o.next)(e=o.layer).options.interactive&&e._containsPoint(n)&&!this._map._draggableMoved(e)&&(i=e);i&&(Xe(t),this._fireEvent([i],t))},_onMouseMove:function(t){if(this._map&&!this._map.dragging.moving()&&!this._map._animatingZoom){var e=this._map.mouseEventToLayerPoint(t);this._handleMouseHover(t,e)}},_handleMouseOut:function(t){var e=this._hoveredLayer;e&&(ye(this._container,"leaflet-interactive"),this._fireEvent([e],t,"mouseout"),this._hoveredLayer=null)},_handleMouseHover:function(t,e){for(var i,n,o=this._drawFirst;o;o=o.next)(i=o.layer).options.interactive&&i._containsPoint(e)&&(n=i);n!==this._hoveredLayer&&(this._handleMouseOut(t),n&&(ve(this._container,"leaflet-interactive"),this._fireEvent([n],t,"mouseover"),this._hoveredLayer=n)),this._hoveredLayer&&this._fireEvent([this._hoveredLayer],t)},_fireEvent:function(t,e,i){this._map._fireDOMEvent(e,i||e.type,t)},_bringToFront:function(t){var e=t._order;if(e){var i=e.next,n=e.prev;i&&(i.prev=n,n?n.next=i:i&&(this._drawFirst=i),e.prev=this._drawLast,this._drawLast.next=e,e.next=null,this._drawLast=e,this._requestRedraw(t))}},_bringToBack:function(t){var e=t._order;if(e){var i=e.next,n=e.prev;n&&(n.next=i,i?i.prev=n:n&&(this._drawLast=n),e.prev=null,e.next=this._drawFirst,this._drawFirst.prev=e,this._drawFirst=e,this._requestRedraw(t))}}});function qn(t){return Mt?new Fn(t):null}var Vn=function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(t){return document.createElement("<lvml:"+t+' class="lvml">')}}catch(t){return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}}(),Hn={_initContainer:function(){this._container=de("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(jn.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var e=t._container=Vn("shape");ve(e,"leaflet-vml-shape "+(this.options.className||"")),e.coordsize="1 1",t._path=Vn("path"),e.appendChild(t._path),this._updateStyle(t),this._layers[a(t)]=t},_addPath:function(t){var e=t._container;this._container.appendChild(e),t.options.interactive&&t.addInteractiveTarget(e)},_removePath:function(t){var e=t._container;ue(e),t.removeInteractiveTarget(e),delete this._layers[a(t)]},_updateStyle:function(t){var e=t._stroke,i=t._fill,n=t.options,o=t._container;o.stroked=!!n.stroke,o.filled=!!n.fill,n.stroke?(e||(e=t._stroke=Vn("stroke")),o.appendChild(e),e.weight=n.weight+"px",e.color=n.color,e.opacity=n.opacity,n.dashArray?e.dashStyle=y(n.dashArray)?n.dashArray.join(" "):n.dashArray.replace(/( *, *)/g," "):e.dashStyle="",e.endcap=n.lineCap.replace("butt","flat"),e.joinstyle=n.lineJoin):e&&(o.removeChild(e),t._stroke=null),n.fill?(i||(i=t._fill=Vn("fill")),o.appendChild(i),i.color=n.fillColor||n.color,i.opacity=n.fillOpacity):i&&(o.removeChild(i),t._fill=null)},_updateCircle:function(t){var e=t._point.round(),i=Math.round(t._radius),n=Math.round(t._radiusY||i);this._setPath(t,t._empty()?"M0 0":"AL "+e.x+","+e.y+" "+i+","+n+" 0,23592600")},_setPath:function(t,e){t._path.v=e},_bringToFront:function(t){fe(t._container)},_bringToBack:function(t){me(t._container)}},Un=Pt?Vn:K,Wn=jn.extend({getEvents:function(){var t=jn.prototype.getEvents.call(this);return t.zoomstart=this._onZoomStart,t},_initContainer:function(){this._container=Un("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Un("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){ue(this._container),Re(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_onZoomStart:function(){this._update()},_update:function(){if(!this._map._animatingZoom||!this._bounds){jn.prototype._update.call(this);var t=this._bounds,e=t.getSize(),i=this._container;this._svgSize&&this._svgSize.equals(e)||(this._svgSize=e,i.setAttribute("width",e.x),i.setAttribute("height",e.y)),Ce(i,t.min),i.setAttribute("viewBox",[t.min.x,t.min.y,e.x,e.y].join(" ")),this.fire("update")}},_initPath:function(t){var e=t._path=Un("path");t.options.className&&ve(e,t.options.className),t.options.interactive&&ve(e,"leaflet-interactive"),this._updateStyle(t),this._layers[a(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){ue(t._path),t.removeInteractiveTarget(t._path),delete this._layers[a(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var e=t._path,i=t.options;e&&(i.stroke?(e.setAttribute("stroke",i.color),e.setAttribute("stroke-opacity",i.opacity),e.setAttribute("stroke-width",i.weight),e.setAttribute("stroke-linecap",i.lineCap),e.setAttribute("stroke-linejoin",i.lineJoin),i.dashArray?e.setAttribute("stroke-dasharray",i.dashArray):e.removeAttribute("stroke-dasharray"),i.dashOffset?e.setAttribute("stroke-dashoffset",i.dashOffset):e.removeAttribute("stroke-dashoffset")):e.setAttribute("stroke","none"),i.fill?(e.setAttribute("fill",i.fillColor||i.color),e.setAttribute("fill-opacity",i.fillOpacity),e.setAttribute("fill-rule",i.fillRule||"evenodd")):e.setAttribute("fill","none"))},_updatePoly:function(t,e){this._setPath(t,Q(t._parts,e))},_updateCircle:function(t){var e=t._point,i=Math.max(Math.round(t._radius),1),n="a"+i+","+(Math.max(Math.round(t._radiusY),1)||i)+" 0 1,0 ",o=t._empty()?"M0 0":"M"+(e.x-i)+","+e.y+n+2*i+",0 "+n+2*-i+",0 ";this._setPath(t,o)},_setPath:function(t,e){t._path.setAttribute("d",e)},_bringToFront:function(t){fe(t._path)},_bringToBack:function(t){me(t._path)}});function Gn(t){return Tt||Pt?new Wn(t):null}Pt&&Wn.include(Hn),ii.include({getRenderer:function(t){var e=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer;return e||(e=this._renderer=this._createRenderer()),this.hasLayer(e)||this.addLayer(e),e},_getPaneRenderer:function(t){if("overlayPane"===t||void 0===t)return!1;var e=this._paneRenderers[t];return void 0===e&&(e=this._createRenderer({pane:t}),this._paneRenderers[t]=e),e},_createRenderer:function(t){return this.options.preferCanvas&&qn(t)||Gn(t)}});var Zn=ln.extend({initialize:function(t,e){ln.prototype.initialize.call(this,this._boundsToLatLngs(t),e)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return[(t=j(t)).getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});function Yn(t,e){return new Zn(t,e)}Wn.create=Un,Wn.pointsToPath=Q,hn.geometryToLayer=dn,hn.coordsToLatLng=un,hn.coordsToLatLngs=pn,hn.latLngToCoords=fn,hn.latLngsToCoords=mn,hn.getFeature=gn,hn.asFeature=vn,ii.mergeOptions({boxZoom:!0});var Xn=fi.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){$e(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Re(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){ue(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||1!==t.which&&1!==t.button)return!1;this._clearDeferredResetState(),this._resetState(),ee(),Me(),this._startPoint=this._map.mouseEventToContainerPoint(t),$e(document,{contextmenu:He,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=de("div","leaflet-zoom-box",this._container),ve(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var e=new R(this._point,this._startPoint),i=e.getSize();Ce(this._box,e.min),this._box.style.width=i.x+"px",this._box.style.height=i.y+"px"},_finish:function(){this._moved&&(ue(this._box),ye(this._container,"leaflet-crosshair")),ie(),Te(),Re(document,{contextmenu:He,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){if((1===t.which||1===t.button)&&(this._finish(),this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(s(this._resetState,this),0);var e=new B(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(e).fire("boxzoomend",{boxZoomBounds:e})}},_onKeyDown:function(t){27===t.keyCode&&this._finish()}});ii.addInitHook("addHandler","boxZoom",Xn),ii.mergeOptions({doubleClickZoom:!0});var Kn=fi.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var e=this._map,i=e.getZoom(),n=e.options.zoomDelta,o=t.originalEvent.shiftKey?i-n:i+n;"center"===e.options.doubleClickZoom?e.setZoom(o):e.setZoomAround(t.containerPoint,o)}});ii.addInitHook("addHandler","doubleClickZoom",Kn),ii.mergeOptions({dragging:!0,inertia:!st,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var Qn=fi.extend({addHooks:function(){if(!this._draggable){var t=this._map;this._draggable=new xi(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))}ve(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){ye(this._map._container,"leaflet-grab"),ye(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t=this._map;if(t._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var e=j(this._map.options.maxBounds);this._offsetLimit=N(this._map.latLngToContainerPoint(e.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(e.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;t.fire("movestart").fire("dragstart"),t.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){if(this._map.options.inertia){var e=this._lastTime=+new Date,i=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(i),this._times.push(e),this._prunePositions(e)}this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;this._positions.length>1&&t-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var t=this._map.getSize().divideBy(2),e=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=e.subtract(t).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(t,e){return t-(t-e)*this._viscosity},_onPreDragLimit:function(){if(this._viscosity&&this._offsetLimit){var t=this._draggable._newPos.subtract(this._draggable._startPos),e=this._offsetLimit;t.x<e.min.x&&(t.x=this._viscousLimit(t.x,e.min.x)),t.y<e.min.y&&(t.y=this._viscousLimit(t.y,e.min.y)),t.x>e.max.x&&(t.x=this._viscousLimit(t.x,e.max.x)),t.y>e.max.y&&(t.y=this._viscousLimit(t.y,e.max.y)),this._draggable._newPos=this._draggable._startPos.add(t)}},_onPreDragWrap:function(){var t=this._worldWidth,e=Math.round(t/2),i=this._initialWorldOffset,n=this._draggable._newPos.x,o=(n-e+i)%t+e-i,s=(n+e+i)%t-e-i,r=Math.abs(o+i)<Math.abs(s+i)?o:s;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=r},_onDragEnd:function(t){var e=this._map,i=e.options,n=!i.inertia||this._times.length<2;if(e.fire("dragend",t),n)e.fire("moveend");else{this._prunePositions(+new Date);var o=this._lastPos.subtract(this._positions[0]),s=(this._lastTime-this._times[0])/1e3,r=i.easeLinearity,a=o.multiplyBy(r/s),l=a.distanceTo([0,0]),c=Math.min(i.inertiaMaxSpeed,l),h=a.multiplyBy(c/l),d=c/(i.inertiaDeceleration*r),u=h.multiplyBy(-d/2).round();u.x||u.y?(u=e._limitOffset(u,e.options.maxBounds),E((function(){e.panBy(u,{duration:d,easeLinearity:r,noMoveStart:!0,animate:!0})}))):e.fire("moveend")}}});ii.addInitHook("addHandler","dragging",Qn),ii.mergeOptions({keyboard:!0,keyboardPanDelta:80});var Jn=fi.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(t){this._map=t,this._setPanDelta(t.options.keyboardPanDelta),this._setZoomDelta(t.options.zoomDelta)},addHooks:function(){var t=this._map._container;t.tabIndex<=0&&(t.tabIndex="0"),$e(t,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),Re(this._map._container,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.off({focus:this._addHooks,blur:this._removeHooks},this)},_onMouseDown:function(){if(!this._focused){var t=document.body,e=document.documentElement,i=t.scrollTop||e.scrollTop,n=t.scrollLeft||e.scrollLeft;this._map._container.focus(),window.scrollTo(n,i)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(t){var e,i,n=this._panKeys={},o=this.keyCodes;for(e=0,i=o.left.length;e<i;e++)n[o.left[e]]=[-1*t,0];for(e=0,i=o.right.length;e<i;e++)n[o.right[e]]=[t,0];for(e=0,i=o.down.length;e<i;e++)n[o.down[e]]=[0,t];for(e=0,i=o.up.length;e<i;e++)n[o.up[e]]=[0,-1*t]},_setZoomDelta:function(t){var e,i,n=this._zoomKeys={},o=this.keyCodes;for(e=0,i=o.zoomIn.length;e<i;e++)n[o.zoomIn[e]]=t;for(e=0,i=o.zoomOut.length;e<i;e++)n[o.zoomOut[e]]=-t},_addHooks:function(){$e(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){Re(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e,i=t.keyCode,n=this._map;if(i in this._panKeys)n._panAnim&&n._panAnim._inProgress||(e=this._panKeys[i],t.shiftKey&&(e=z(e).multiplyBy(3)),n.panBy(e),n.options.maxBounds&&n.panInsideBounds(n.options.maxBounds));else if(i in this._zoomKeys)n.setZoom(n.getZoom()+(t.shiftKey?3:1)*this._zoomKeys[i]);else{if(27!==i||!n._popup||!n._popup.options.closeOnEscapeKey)return;n.closePopup()}He(t)}}});ii.addInitHook("addHandler","keyboard",Jn),ii.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var to=fi.extend({addHooks:function(){$e(this._map._container,"mousewheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){Re(this._map._container,"mousewheel",this._onWheelScroll,this)},_onWheelScroll:function(t){var e=Ge(t),i=this._map.options.wheelDebounceTime;this._delta+=e,this._lastMousePos=this._map.mouseEventToContainerPoint(t),this._startTime||(this._startTime=+new Date);var n=Math.max(i-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(s(this._performZoom,this),n),He(t)},_performZoom:function(){var t=this._map,e=t.getZoom(),i=this._map.options.zoomSnap||0;t._stop();var n=this._delta/(4*this._map.options.wheelPxPerZoomLevel),o=4*Math.log(2/(1+Math.exp(-Math.abs(n))))/Math.LN2,s=i?Math.ceil(o/i)*i:o,r=t._limitZoom(e+(this._delta>0?s:-s))-e;this._delta=0,this._startTime=null,r&&("center"===t.options.scrollWheelZoom?t.setZoom(e+r):t.setZoomAround(this._lastMousePos,e+r))}});ii.addInitHook("addHandler","scrollWheelZoom",to),ii.mergeOptions({tap:!0,tapTolerance:15});var eo=fi.extend({addHooks:function(){$e(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Re(this._map._container,"touchstart",this._onDown,this)},_onDown:function(t){if(t.touches){if(Ve(t),this._fireClick=!0,t.touches.length>1)return this._fireClick=!1,void clearTimeout(this._holdTimeout);var e=t.touches[0],i=e.target;this._startPos=this._newPos=new I(e.clientX,e.clientY),i.tagName&&"a"===i.tagName.toLowerCase()&&ve(i,"leaflet-active"),this._holdTimeout=setTimeout(s((function(){this._isTapValid()&&(this._fireClick=!1,this._onUp(),this._simulateEvent("contextmenu",e))}),this),1e3),this._simulateEvent("mousedown",e),$e(document,{touchmove:this._onMove,touchend:this._onUp},this)}},_onUp:function(t){if(clearTimeout(this._holdTimeout),Re(document,{touchmove:this._onMove,touchend:this._onUp},this),this._fireClick&&t&&t.changedTouches){var e=t.changedTouches[0],i=e.target;i&&i.tagName&&"a"===i.tagName.toLowerCase()&&ye(i,"leaflet-active"),this._simulateEvent("mouseup",e),this._isTapValid()&&this._simulateEvent("click",e)}},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_onMove:function(t){var e=t.touches[0];this._newPos=new I(e.clientX,e.clientY),this._simulateEvent("mousemove",e)},_simulateEvent:function(t,e){var i=document.createEvent("MouseEvents");i._simulated=!0,e.target._simulatedClick=!0,i.initMouseEvent(t,!0,!0,window,1,e.screenX,e.screenY,e.clientX,e.clientY,!1,!1,!1,!1,0,null),e.target.dispatchEvent(i)}});St&&!kt&&ii.addInitHook("addHandler","tap",eo),ii.mergeOptions({touchZoom:St&&!st,bounceAtZoomLimits:!0});var io=fi.extend({addHooks:function(){ve(this._map._container,"leaflet-touch-zoom"),$e(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){ye(this._map._container,"leaflet-touch-zoom"),Re(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(t){var e=this._map;if(t.touches&&2===t.touches.length&&!e._animatingZoom&&!this._zooming){var i=e.mouseEventToContainerPoint(t.touches[0]),n=e.mouseEventToContainerPoint(t.touches[1]);this._centerPoint=e.getSize()._divideBy(2),this._startLatLng=e.containerPointToLatLng(this._centerPoint),"center"!==e.options.touchZoom&&(this._pinchStartLatLng=e.containerPointToLatLng(i.add(n)._divideBy(2))),this._startDist=i.distanceTo(n),this._startZoom=e.getZoom(),this._moved=!1,this._zooming=!0,e._stop(),$e(document,"touchmove",this._onTouchMove,this),$e(document,"touchend",this._onTouchEnd,this),Ve(t)}},_onTouchMove:function(t){if(t.touches&&2===t.touches.length&&this._zooming){var e=this._map,i=e.mouseEventToContainerPoint(t.touches[0]),n=e.mouseEventToContainerPoint(t.touches[1]),o=i.distanceTo(n)/this._startDist;if(this._zoom=e.getScaleZoom(o,this._startZoom),!e.options.bounceAtZoomLimits&&(this._zoom<e.getMinZoom()&&o<1||this._zoom>e.getMaxZoom()&&o>1)&&(this._zoom=e._limitZoom(this._zoom)),"center"===e.options.touchZoom){if(this._center=this._startLatLng,1===o)return}else{var r=i._add(n)._divideBy(2)._subtract(this._centerPoint);if(1===o&&0===r.x&&0===r.y)return;this._center=e.unproject(e.project(this._pinchStartLatLng,this._zoom).subtract(r),this._zoom)}this._moved||(e._moveStart(!0,!1),this._moved=!0),A(this._animRequest);var a=s(e._move,e,this._center,this._zoom,{pinch:!0,round:!1});this._animRequest=E(a,this,!0),Ve(t)}},_onTouchEnd:function(){this._moved&&this._zooming?(this._zooming=!1,A(this._animRequest),Re(document,"touchmove",this._onTouchMove),Re(document,"touchend",this._onTouchEnd),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))):this._zooming=!1}});ii.addInitHook("addHandler","touchZoom",io),ii.BoxZoom=Xn,ii.DoubleClickZoom=Kn,ii.Drag=Qn,ii.Keyboard=Jn,ii.ScrollWheelZoom=to,ii.Tap=eo,ii.TouchZoom=io,Object.freeze=i,t.version=e,t.Control=oi,t.control=si,t.Browser=Dt,t.Evented=D,t.Mixin=gi,t.Util=M,t.Class=T,t.Handler=fi,t.extend=n,t.bind=s,t.stamp=a,t.setOptions=f,t.DomEvent=ti,t.DomUtil=Le,t.PosAnimation=ei,t.Draggable=xi,t.LineUtil=Li,t.PolyUtil=zi,t.Point=I,t.point=z,t.Bounds=R,t.bounds=N,t.Transformation=G,t.transformation=Z,t.Projection=Bi,t.LatLng=F,t.latLng=q,t.LatLngBounds=B,t.latLngBounds=j,t.CRS=V,t.GeoJSON=hn,t.geoJSON=bn,t.geoJson=xn,t.Layer=Vi,t.LayerGroup=Hi,t.layerGroup=Ui,t.FeatureGroup=Wi,t.featureGroup=Gi,t.ImageOverlay=_n,t.imageOverlay=wn,t.VideoOverlay=kn,t.videoOverlay=Sn,t.SVGOverlay=Cn,t.svgOverlay=En,t.DivOverlay=An,t.Popup=Mn,t.popup=Tn,t.Tooltip=Pn,t.tooltip=On,t.Icon=Zi,t.icon=Yi,t.DivIcon=Dn,t.divIcon=In,t.Marker=Qi,t.marker=Ji,t.TileLayer=zn,t.tileLayer=Rn,t.GridLayer=Ln,t.gridLayer=$n,t.SVG=Wn,t.svg=Gn,t.Renderer=jn,t.Canvas=Fn,t.canvas=qn,t.Path=tn,t.CircleMarker=en,t.circleMarker=nn,t.Circle=on,t.circle=sn,t.Polyline=rn,t.polyline=an,t.Polygon=ln,t.polygon=cn,t.Rectangle=Zn,t.rectangle=Yn,t.Map=ii,t.map=ni;var no=window.L;t.noConflict=function(){return window.L=no,this},window.L=t})(qE.exports);var VE=qE.exports;const HE={weight:1,opacity:1,color:"white",fillOpacity:.7,fillColor:"#2387ca"},UE={weight:3,color:"white",fillOpacity:1,fillColor:"#2387ca"},WE=()=>HE;class GE extends ct{static get styles(){return a`
|
|
9110
|
+
`}}t([ue({type:Array,attribute:!1})],IA.prototype,"path",void 0),t([ue()],IA.prototype,"endpoint",void 0),t([ue()],IA.prototype,"osmId",void 0),t([ue({type:Object})],IA.prototype,"hovered",void 0),t([ue({type:Object})],IA.prototype,"editFeature",void 0),t([ue({type:String,attribute:!1})],IA.prototype,"editFeatureAliases",void 0);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var LA={exports:{}};(function(t){var e="1.5.1+build.2e3e0ffb",i=Object.freeze;function n(t){var e,i,n,o;for(i=1,n=arguments.length;i<n;i++)for(e in o=arguments[i])t[e]=o[e];return t}Object.freeze=function(t){return t};var o=Object.create||function(){function t(){}return function(e){return t.prototype=e,new t}}();function s(t,e){var i=Array.prototype.slice;if(t.bind)return t.bind.apply(t,i.call(arguments,1));var n=i.call(arguments,2);return function(){return t.apply(e,n.length?n.concat(i.call(arguments)):arguments)}}var r=0;function a(t){return t._leaflet_id=t._leaflet_id||++r,t._leaflet_id}function l(t,e,i){var n,o,s,r;return r=function(){n=!1,o&&(s.apply(i,o),o=!1)},s=function(){n?o=arguments:(t.apply(i,arguments),setTimeout(r,e),n=!0)},s}function c(t,e,i){var n=e[1],o=e[0],s=n-o;return t===n&&i?t:((t-o)%s+s)%s+o}function h(){return!1}function d(t,e){return e=void 0===e?6:e,+(Math.round(t+"e+"+e)+"e-"+e)}function u(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function p(t){return u(t).split(/\s+/)}function f(t,e){for(var i in t.hasOwnProperty("options")||(t.options=t.options?o(t.options):{}),e)t.options[i]=e[i];return t.options}function m(t,e,i){var n=[];for(var o in t)n.push(encodeURIComponent(i?o.toUpperCase():o)+"="+encodeURIComponent(t[o]));return(e&&-1!==e.indexOf("?")?"&":"?")+n.join("&")}var g=/\{ *([\w_-]+) *\}/g;function v(t,e){return t.replace(g,(function(t,i){var n=e[i];if(void 0===n)throw new Error("No value provided for variable "+t);return"function"==typeof n&&(n=n(e)),n}))}var y=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function b(t,e){for(var i=0;i<t.length;i++)if(t[i]===e)return i;return-1}var x="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function _(t){return window["webkit"+t]||window["moz"+t]||window["ms"+t]}var w=0;function k(t){var e=+new Date,i=Math.max(0,16-(e-w));return w=e+i,window.setTimeout(t,i)}var S=window.requestAnimationFrame||_("RequestAnimationFrame")||k,C=window.cancelAnimationFrame||_("CancelAnimationFrame")||_("CancelRequestAnimationFrame")||function(t){window.clearTimeout(t)};function E(t,e,i){if(!i||S!==k)return S.call(window,s(t,e));t.call(e)}function A(t){t&&C.call(window,t)}var M=(Object.freeze||Object)({freeze:i,extend:n,create:o,bind:s,lastId:r,stamp:a,throttle:l,wrapNum:c,falseFn:h,formatNum:d,trim:u,splitWords:p,setOptions:f,getParamString:m,template:v,isArray:y,indexOf:b,emptyImageUrl:x,requestFn:S,cancelFn:C,requestAnimFrame:E,cancelAnimFrame:A});function T(){}function P(t){if("undefined"!=typeof L&&L&&L.Mixin){t=y(t)?t:[t];for(var e=0;e<t.length;e++)t[e]===L.Mixin.Events&&console.warn("Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.",(new Error).stack)}}T.extend=function(t){var e=function(){this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},i=e.__super__=this.prototype,s=o(i);for(var r in s.constructor=e,e.prototype=s,this)this.hasOwnProperty(r)&&"prototype"!==r&&"__super__"!==r&&(e[r]=this[r]);return t.statics&&(n(e,t.statics),delete t.statics),t.includes&&(P(t.includes),n.apply(null,[s].concat(t.includes)),delete t.includes),s.options&&(t.options=n(o(s.options),t.options)),n(s,t),s._initHooks=[],s.callInitHooks=function(){if(!this._initHooksCalled){i.callInitHooks&&i.callInitHooks.call(this),this._initHooksCalled=!0;for(var t=0,e=s._initHooks.length;t<e;t++)s._initHooks[t].call(this)}},e},T.include=function(t){return n(this.prototype,t),this},T.mergeOptions=function(t){return n(this.prototype.options,t),this},T.addInitHook=function(t){var e=Array.prototype.slice.call(arguments,1),i="function"==typeof t?t:function(){this[t].apply(this,e)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(i),this};var O={on:function(t,e,i){if("object"==typeof t)for(var n in t)this._on(n,t[n],e);else for(var o=0,s=(t=p(t)).length;o<s;o++)this._on(t[o],e,i);return this},off:function(t,e,i){if(t)if("object"==typeof t)for(var n in t)this._off(n,t[n],e);else for(var o=0,s=(t=p(t)).length;o<s;o++)this._off(t[o],e,i);else delete this._events;return this},_on:function(t,e,i){this._events=this._events||{};var n=this._events[t];n||(n=[],this._events[t]=n),i===this&&(i=void 0);for(var o={fn:e,ctx:i},s=n,r=0,a=s.length;r<a;r++)if(s[r].fn===e&&s[r].ctx===i)return;s.push(o)},_off:function(t,e,i){var n,o,s;if(this._events&&(n=this._events[t]))if(e){if(i===this&&(i=void 0),n)for(o=0,s=n.length;o<s;o++){var r=n[o];if(r.ctx===i&&r.fn===e)return r.fn=h,this._firingCount&&(this._events[t]=n=n.slice()),void n.splice(o,1)}}else{for(o=0,s=n.length;o<s;o++)n[o].fn=h;delete this._events[t]}},fire:function(t,e,i){if(!this.listens(t,i))return this;var o=n({},e,{type:t,target:this,sourceTarget:e&&e.sourceTarget||this});if(this._events){var s=this._events[t];if(s){this._firingCount=this._firingCount+1||1;for(var r=0,a=s.length;r<a;r++){var l=s[r];l.fn.call(l.ctx||this,o)}this._firingCount--}}return i&&this._propagateEvent(o),this},listens:function(t,e){var i=this._events&&this._events[t];if(i&&i.length)return!0;if(e)for(var n in this._eventParents)if(this._eventParents[n].listens(t,e))return!0;return!1},once:function(t,e,i){if("object"==typeof t){for(var n in t)this.once(n,t[n],e);return this}var o=s((function(){this.off(t,e,i).off(t,o,i)}),this);return this.on(t,e,i).on(t,o,i)},addEventParent:function(t){return this._eventParents=this._eventParents||{},this._eventParents[a(t)]=t,this},removeEventParent:function(t){return this._eventParents&&delete this._eventParents[a(t)],this},_propagateEvent:function(t){for(var e in this._eventParents)this._eventParents[e].fire(t.type,n({layer:t.target,propagatedFrom:t.target},t),!0)}};O.addEventListener=O.on,O.removeEventListener=O.clearAllEventListeners=O.off,O.addOneTimeEventListener=O.once,O.fireEvent=O.fire,O.hasEventListeners=O.listens;var D=T.extend(O);function I(t,e,i){this.x=i?Math.round(t):t,this.y=i?Math.round(e):e}var $=Math.trunc||function(t){return t>0?Math.floor(t):Math.ceil(t)};function z(t,e,i){return t instanceof I?t:y(t)?new I(t[0],t[1]):null==t?t:"object"==typeof t&&"x"in t&&"y"in t?new I(t.x,t.y):new I(t,e,i)}function R(t,e){if(t)for(var i=e?[t,e]:t,n=0,o=i.length;n<o;n++)this.extend(i[n])}function N(t,e){return!t||t instanceof R?t:new R(t,e)}function B(t,e){if(t)for(var i=e?[t,e]:t,n=0,o=i.length;n<o;n++)this.extend(i[n])}function j(t,e){return t instanceof B?t:new B(t,e)}function F(t,e,i){if(isNaN(t)||isNaN(e))throw new Error("Invalid LatLng object: ("+t+", "+e+")");this.lat=+t,this.lng=+e,void 0!==i&&(this.alt=+i)}function q(t,e,i){return t instanceof F?t:y(t)&&"object"!=typeof t[0]?3===t.length?new F(t[0],t[1],t[2]):2===t.length?new F(t[0],t[1]):null:null==t?t:"object"==typeof t&&"lat"in t?new F(t.lat,"lng"in t?t.lng:t.lon,t.alt):void 0===e?null:new F(t,e,i)}I.prototype={clone:function(){return new I(this.x,this.y)},add:function(t){return this.clone()._add(z(t))},_add:function(t){return this.x+=t.x,this.y+=t.y,this},subtract:function(t){return this.clone()._subtract(z(t))},_subtract:function(t){return this.x-=t.x,this.y-=t.y,this},divideBy:function(t){return this.clone()._divideBy(t)},_divideBy:function(t){return this.x/=t,this.y/=t,this},multiplyBy:function(t){return this.clone()._multiplyBy(t)},_multiplyBy:function(t){return this.x*=t,this.y*=t,this},scaleBy:function(t){return new I(this.x*t.x,this.y*t.y)},unscaleBy:function(t){return new I(this.x/t.x,this.y/t.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=$(this.x),this.y=$(this.y),this},distanceTo:function(t){var e=(t=z(t)).x-this.x,i=t.y-this.y;return Math.sqrt(e*e+i*i)},equals:function(t){return(t=z(t)).x===this.x&&t.y===this.y},contains:function(t){return t=z(t),Math.abs(t.x)<=Math.abs(this.x)&&Math.abs(t.y)<=Math.abs(this.y)},toString:function(){return"Point("+d(this.x)+", "+d(this.y)+")"}},R.prototype={extend:function(t){return t=z(t),this.min||this.max?(this.min.x=Math.min(t.x,this.min.x),this.max.x=Math.max(t.x,this.max.x),this.min.y=Math.min(t.y,this.min.y),this.max.y=Math.max(t.y,this.max.y)):(this.min=t.clone(),this.max=t.clone()),this},getCenter:function(t){return new I((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,t)},getBottomLeft:function(){return new I(this.min.x,this.max.y)},getTopRight:function(){return new I(this.max.x,this.min.y)},getTopLeft:function(){return this.min},getBottomRight:function(){return this.max},getSize:function(){return this.max.subtract(this.min)},contains:function(t){var e,i;return(t="number"==typeof t[0]||t instanceof I?z(t):N(t))instanceof R?(e=t.min,i=t.max):e=i=t,e.x>=this.min.x&&i.x<=this.max.x&&e.y>=this.min.y&&i.y<=this.max.y},intersects:function(t){t=N(t);var e=this.min,i=this.max,n=t.min,o=t.max,s=o.x>=e.x&&n.x<=i.x,r=o.y>=e.y&&n.y<=i.y;return s&&r},overlaps:function(t){t=N(t);var e=this.min,i=this.max,n=t.min,o=t.max,s=o.x>e.x&&n.x<i.x,r=o.y>e.y&&n.y<i.y;return s&&r},isValid:function(){return!(!this.min||!this.max)}},B.prototype={extend:function(t){var e,i,n=this._southWest,o=this._northEast;if(t instanceof F)e=t,i=t;else{if(!(t instanceof B))return t?this.extend(q(t)||j(t)):this;if(e=t._southWest,i=t._northEast,!e||!i)return this}return n||o?(n.lat=Math.min(e.lat,n.lat),n.lng=Math.min(e.lng,n.lng),o.lat=Math.max(i.lat,o.lat),o.lng=Math.max(i.lng,o.lng)):(this._southWest=new F(e.lat,e.lng),this._northEast=new F(i.lat,i.lng)),this},pad:function(t){var e=this._southWest,i=this._northEast,n=Math.abs(e.lat-i.lat)*t,o=Math.abs(e.lng-i.lng)*t;return new B(new F(e.lat-n,e.lng-o),new F(i.lat+n,i.lng+o))},getCenter:function(){return new F((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new F(this.getNorth(),this.getWest())},getSouthEast:function(){return new F(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(t){t="number"==typeof t[0]||t instanceof F||"lat"in t?q(t):j(t);var e,i,n=this._southWest,o=this._northEast;return t instanceof B?(e=t.getSouthWest(),i=t.getNorthEast()):e=i=t,e.lat>=n.lat&&i.lat<=o.lat&&e.lng>=n.lng&&i.lng<=o.lng},intersects:function(t){t=j(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),o=t.getNorthEast(),s=o.lat>=e.lat&&n.lat<=i.lat,r=o.lng>=e.lng&&n.lng<=i.lng;return s&&r},overlaps:function(t){t=j(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),o=t.getNorthEast(),s=o.lat>e.lat&&n.lat<i.lat,r=o.lng>e.lng&&n.lng<i.lng;return s&&r},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(t,e){return!!t&&(t=j(t),this._southWest.equals(t.getSouthWest(),e)&&this._northEast.equals(t.getNorthEast(),e))},isValid:function(){return!(!this._southWest||!this._northEast)}},F.prototype={equals:function(t,e){return!!t&&(t=q(t),Math.max(Math.abs(this.lat-t.lat),Math.abs(this.lng-t.lng))<=(void 0===e?1e-9:e))},toString:function(t){return"LatLng("+d(this.lat,t)+", "+d(this.lng,t)+")"},distanceTo:function(t){return H.distance(this,q(t))},wrap:function(){return H.wrapLatLng(this)},toBounds:function(t){var e=180*t/40075017,i=e/Math.cos(Math.PI/180*this.lat);return j([this.lat-e,this.lng-i],[this.lat+e,this.lng+i])},clone:function(){return new F(this.lat,this.lng,this.alt)}};var V={latLngToPoint:function(t,e){var i=this.projection.project(t),n=this.scale(e);return this.transformation._transform(i,n)},pointToLatLng:function(t,e){var i=this.scale(e),n=this.transformation.untransform(t,i);return this.projection.unproject(n)},project:function(t){return this.projection.project(t)},unproject:function(t){return this.projection.unproject(t)},scale:function(t){return 256*Math.pow(2,t)},zoom:function(t){return Math.log(t/256)/Math.LN2},getProjectedBounds:function(t){if(this.infinite)return null;var e=this.projection.bounds,i=this.scale(t);return new R(this.transformation.transform(e.min,i),this.transformation.transform(e.max,i))},infinite:!1,wrapLatLng:function(t){var e=this.wrapLng?c(t.lng,this.wrapLng,!0):t.lng;return new F(this.wrapLat?c(t.lat,this.wrapLat,!0):t.lat,e,t.alt)},wrapLatLngBounds:function(t){var e=t.getCenter(),i=this.wrapLatLng(e),n=e.lat-i.lat,o=e.lng-i.lng;if(0===n&&0===o)return t;var s=t.getSouthWest(),r=t.getNorthEast();return new B(new F(s.lat-n,s.lng-o),new F(r.lat-n,r.lng-o))}},H=n({},V,{wrapLng:[-180,180],R:6371e3,distance:function(t,e){var i=Math.PI/180,n=t.lat*i,o=e.lat*i,s=Math.sin((e.lat-t.lat)*i/2),r=Math.sin((e.lng-t.lng)*i/2),a=s*s+Math.cos(n)*Math.cos(o)*r*r,l=2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));return this.R*l}}),U=6378137,W={R:U,MAX_LATITUDE:85.0511287798,project:function(t){var e=Math.PI/180,i=this.MAX_LATITUDE,n=Math.max(Math.min(i,t.lat),-i),o=Math.sin(n*e);return new I(this.R*t.lng*e,this.R*Math.log((1+o)/(1-o))/2)},unproject:function(t){var e=180/Math.PI;return new F((2*Math.atan(Math.exp(t.y/this.R))-Math.PI/2)*e,t.x*e/this.R)},bounds:function(){var t=U*Math.PI;return new R([-t,-t],[t,t])}()};function G(t,e,i,n){if(y(t))return this._a=t[0],this._b=t[1],this._c=t[2],void(this._d=t[3]);this._a=t,this._b=e,this._c=i,this._d=n}function Z(t,e,i,n){return new G(t,e,i,n)}G.prototype={transform:function(t,e){return this._transform(t.clone(),e)},_transform:function(t,e){return e=e||1,t.x=e*(this._a*t.x+this._b),t.y=e*(this._c*t.y+this._d),t},untransform:function(t,e){return e=e||1,new I((t.x/e-this._b)/this._a,(t.y/e-this._d)/this._c)}};var Y=n({},H,{code:"EPSG:3857",projection:W,transformation:function(){var t=.5/(Math.PI*W.R);return Z(t,.5,-t,.5)}()}),X=n({},Y,{code:"EPSG:900913"});function K(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function Q(t,e){var i,n,o,s,r,a,l="";for(i=0,o=t.length;i<o;i++){for(n=0,s=(r=t[i]).length;n<s;n++)l+=(n?"L":"M")+(a=r[n]).x+" "+a.y;l+=e?Tt?"z":"x":""}return l||"M0 0"}var J=document.documentElement.style,tt="ActiveXObject"in window,et=tt&&!document.addEventListener,it="msLaunchUri"in navigator&&!("documentMode"in document),nt=Ot("webkit"),ot=Ot("android"),st=Ot("android 2")||Ot("android 3"),rt=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),at=ot&&Ot("Google")&&rt<537&&!("AudioNode"in window),lt=!!window.opera,ct=Ot("chrome"),ht=Ot("gecko")&&!nt&&!lt&&!tt,dt=!ct&&Ot("safari"),ut=Ot("phantom"),pt="OTransition"in J,ft=0===navigator.platform.indexOf("Win"),mt=tt&&"transition"in J,gt="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!st,vt="MozPerspective"in J,yt=!window.L_DISABLE_3D&&(mt||gt||vt)&&!pt&&!ut,bt="undefined"!=typeof orientation||Ot("mobile"),xt=bt&&nt,_t=bt&>,wt=!window.PointerEvent&&window.MSPointerEvent,kt=!(!window.PointerEvent&&!wt),St=!window.L_NO_TOUCH&&(kt||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch),Ct=bt&<,Et=bt&&ht,At=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,Mt=!!document.createElement("canvas").getContext,Tt=!(!document.createElementNS||!K("svg").createSVGRect),Pt=!Tt&&function(){try{var t=document.createElement("div");t.innerHTML='<v:shape adj="1"/>';var e=t.firstChild;return e.style.behavior="url(#default#VML)",e&&"object"==typeof e.adj}catch(t){return!1}}();function Ot(t){return navigator.userAgent.toLowerCase().indexOf(t)>=0}var Dt=(Object.freeze||Object)({ie:tt,ielt9:et,edge:it,webkit:nt,android:ot,android23:st,androidStock:at,opera:lt,chrome:ct,gecko:ht,safari:dt,phantom:ut,opera12:pt,win:ft,ie3d:mt,webkit3d:gt,gecko3d:vt,any3d:yt,mobile:bt,mobileWebkit:xt,mobileWebkit3d:_t,msPointer:wt,pointer:kt,touch:St,mobileOpera:Ct,mobileGecko:Et,retina:At,canvas:Mt,svg:Tt,vml:Pt}),It=wt?"MSPointerDown":"pointerdown",Lt=wt?"MSPointerMove":"pointermove",$t=wt?"MSPointerUp":"pointerup",zt=wt?"MSPointerCancel":"pointercancel",Rt=["INPUT","SELECT","OPTION"],Nt={},Bt=!1,jt=0;function Ft(t,e,i,n){return"touchstart"===e?Vt(t,i,n):"touchmove"===e?Zt(t,i,n):"touchend"===e&&Yt(t,i,n),this}function qt(t,e,i){var n=t["_leaflet_"+e+i];return"touchstart"===e?t.removeEventListener(It,n,!1):"touchmove"===e?t.removeEventListener(Lt,n,!1):"touchend"===e&&(t.removeEventListener($t,n,!1),t.removeEventListener(zt,n,!1)),this}function Vt(t,e,i){var n=s((function(t){if("mouse"!==t.pointerType&&t.MSPOINTER_TYPE_MOUSE&&t.pointerType!==t.MSPOINTER_TYPE_MOUSE){if(!(Rt.indexOf(t.target.tagName)<0))return;Ve(t)}Gt(t,e)}));t["_leaflet_touchstart"+i]=n,t.addEventListener(It,n,!1),Bt||(document.documentElement.addEventListener(It,Ht,!0),document.documentElement.addEventListener(Lt,Ut,!0),document.documentElement.addEventListener($t,Wt,!0),document.documentElement.addEventListener(zt,Wt,!0),Bt=!0)}function Ht(t){Nt[t.pointerId]=t,jt++}function Ut(t){Nt[t.pointerId]&&(Nt[t.pointerId]=t)}function Wt(t){delete Nt[t.pointerId],jt--}function Gt(t,e){for(var i in t.touches=[],Nt)t.touches.push(Nt[i]);t.changedTouches=[t],e(t)}function Zt(t,e,i){var n=function(t){(t.pointerType!==t.MSPOINTER_TYPE_MOUSE&&"mouse"!==t.pointerType||0!==t.buttons)&&Gt(t,e)};t["_leaflet_touchmove"+i]=n,t.addEventListener(Lt,n,!1)}function Yt(t,e,i){var n=function(t){Gt(t,e)};t["_leaflet_touchend"+i]=n,t.addEventListener($t,n,!1),t.addEventListener(zt,n,!1)}var Xt=wt?"MSPointerDown":kt?"pointerdown":"touchstart",Kt=wt?"MSPointerUp":kt?"pointerup":"touchend",Qt="_leaflet_";function Jt(t,e,i){var n,o,s=!1,r=250;function a(t){var e;if(kt){if(!it||"mouse"===t.pointerType)return;e=jt}else e=t.touches.length;if(!(e>1)){var i=Date.now(),a=i-(n||i);o=t.touches?t.touches[0]:t,s=a>0&&a<=r,n=i}}function l(t){if(s&&!o.cancelBubble){if(kt){if(!it||"mouse"===t.pointerType)return;var i,r,a={};for(r in o)i=o[r],a[r]=i&&i.bind?i.bind(o):i;o=a}o.type="dblclick",o.button=0,e(o),n=null}}return t[Qt+Xt+i]=a,t[Qt+Kt+i]=l,t[Qt+"dblclick"+i]=e,t.addEventListener(Xt,a,!1),t.addEventListener(Kt,l,!1),t.addEventListener("dblclick",e,!1),this}function te(t,e){var i=t[Qt+Xt+e],n=t[Qt+Kt+e],o=t[Qt+"dblclick"+e];return t.removeEventListener(Xt,i,!1),t.removeEventListener(Kt,n,!1),it||t.removeEventListener("dblclick",o,!1),this}var ee,ie,ne,oe,se,re=ke(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),ae=ke(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),le="webkitTransition"===ae||"OTransition"===ae?ae+"End":"transitionend";function ce(t){return"string"==typeof t?document.getElementById(t):t}function he(t,e){var i=t.style[e]||t.currentStyle&&t.currentStyle[e];if((!i||"auto"===i)&&document.defaultView){var n=document.defaultView.getComputedStyle(t,null);i=n?n[e]:null}return"auto"===i?null:i}function de(t,e,i){var n=document.createElement(t);return n.className=e||"",i&&i.appendChild(n),n}function ue(t){var e=t.parentNode;e&&e.removeChild(t)}function pe(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function fe(t){var e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)}function me(t){var e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)}function ge(t,e){if(void 0!==t.classList)return t.classList.contains(e);var i=xe(t);return i.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(i)}function ve(t,e){if(void 0!==t.classList)for(var i=p(e),n=0,o=i.length;n<o;n++)t.classList.add(i[n]);else if(!ge(t,e)){var s=xe(t);be(t,(s?s+" ":"")+e)}}function ye(t,e){void 0!==t.classList?t.classList.remove(e):be(t,u((" "+xe(t)+" ").replace(" "+e+" "," ")))}function be(t,e){void 0===t.className.baseVal?t.className=e:t.className.baseVal=e}function xe(t){return t.correspondingElement&&(t=t.correspondingElement),void 0===t.className.baseVal?t.className:t.className.baseVal}function _e(t,e){"opacity"in t.style?t.style.opacity=e:"filter"in t.style&&we(t,e)}function we(t,e){var i=!1,n="DXImageTransform.Microsoft.Alpha";try{i=t.filters.item(n)}catch(t){if(1===e)return}e=Math.round(100*e),i?(i.Enabled=100!==e,i.Opacity=e):t.style.filter+=" progid:"+n+"(opacity="+e+")"}function ke(t){for(var e=document.documentElement.style,i=0;i<t.length;i++)if(t[i]in e)return t[i];return!1}function Se(t,e,i){var n=e||new I(0,0);t.style[re]=(mt?"translate("+n.x+"px,"+n.y+"px)":"translate3d("+n.x+"px,"+n.y+"px,0)")+(i?" scale("+i+")":"")}function Ce(t,e){t._leaflet_pos=e,yt?Se(t,e):(t.style.left=e.x+"px",t.style.top=e.y+"px")}function Ee(t){return t._leaflet_pos||new I(0,0)}if("onselectstart"in document)ee=function(){$e(window,"selectstart",Ve)},ie=function(){Re(window,"selectstart",Ve)};else{var Ae=ke(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);ee=function(){if(Ae){var t=document.documentElement.style;ne=t[Ae],t[Ae]="none"}},ie=function(){Ae&&(document.documentElement.style[Ae]=ne,ne=void 0)}}function Me(){$e(window,"dragstart",Ve)}function Te(){Re(window,"dragstart",Ve)}function Pe(t){for(;-1===t.tabIndex;)t=t.parentNode;t.style&&(Oe(),oe=t,se=t.style.outline,t.style.outline="none",$e(window,"keydown",Oe))}function Oe(){oe&&(oe.style.outline=se,oe=void 0,se=void 0,Re(window,"keydown",Oe))}function De(t){do{t=t.parentNode}while(!(t.offsetWidth&&t.offsetHeight||t===document.body));return t}function Ie(t){var e=t.getBoundingClientRect();return{x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}var Le=(Object.freeze||Object)({TRANSFORM:re,TRANSITION:ae,TRANSITION_END:le,get:ce,getStyle:he,create:de,remove:ue,empty:pe,toFront:fe,toBack:me,hasClass:ge,addClass:ve,removeClass:ye,setClass:be,getClass:xe,setOpacity:_e,testProp:ke,setTransform:Se,setPosition:Ce,getPosition:Ee,disableTextSelection:ee,enableTextSelection:ie,disableImageDrag:Me,enableImageDrag:Te,preventOutline:Pe,restoreOutline:Oe,getSizedParentNode:De,getScale:Ie});function $e(t,e,i,n){if("object"==typeof e)for(var o in e)Ne(t,o,e[o],i);else for(var s=0,r=(e=p(e)).length;s<r;s++)Ne(t,e[s],i,n);return this}var ze="_leaflet_events";function Re(t,e,i,n){if("object"==typeof e)for(var o in e)Be(t,o,e[o],i);else if(e)for(var s=0,r=(e=p(e)).length;s<r;s++)Be(t,e[s],i,n);else{for(var a in t[ze])Be(t,a,t[ze][a]);delete t[ze]}return this}function Ne(t,e,i,n){var o=e+a(i)+(n?"_"+a(n):"");if(t[ze]&&t[ze][o])return this;var s=function(e){return i.call(n||t,e||window.event)},r=s;kt&&0===e.indexOf("touch")?Ft(t,e,s,o):!St||"dblclick"!==e||!Jt||kt&&ct?"addEventListener"in t?"mousewheel"===e?t.addEventListener("onwheel"in t?"wheel":"mousewheel",s,!1):"mouseenter"===e||"mouseleave"===e?(s=function(e){e=e||window.event,Qe(t,e)&&r(e)},t.addEventListener("mouseenter"===e?"mouseover":"mouseout",s,!1)):("click"===e&&ot&&(s=function(t){Je(t,r)}),t.addEventListener(e,s,!1)):"attachEvent"in t&&t.attachEvent("on"+e,s):Jt(t,s,o),t[ze]=t[ze]||{},t[ze][o]=s}function Be(t,e,i,n){var o=e+a(i)+(n?"_"+a(n):""),s=t[ze]&&t[ze][o];if(!s)return this;kt&&0===e.indexOf("touch")?qt(t,e,o):!St||"dblclick"!==e||!te||kt&&ct?"removeEventListener"in t?"mousewheel"===e?t.removeEventListener("onwheel"in t?"wheel":"mousewheel",s,!1):t.removeEventListener("mouseenter"===e?"mouseover":"mouseleave"===e?"mouseout":e,s,!1):"detachEvent"in t&&t.detachEvent("on"+e,s):te(t,o),t[ze][o]=null}function je(t){return t.stopPropagation?t.stopPropagation():t.originalEvent?t.originalEvent._stopped=!0:t.cancelBubble=!0,Ke(t),this}function Fe(t){return Ne(t,"mousewheel",je),this}function qe(t){return $e(t,"mousedown touchstart dblclick",je),Ne(t,"click",Xe),this}function Ve(t){return t.preventDefault?t.preventDefault():t.returnValue=!1,this}function He(t){return Ve(t),je(t),this}function Ue(t,e){if(!e)return new I(t.clientX,t.clientY);var i=Ie(e),n=i.boundingClientRect;return new I((t.clientX-n.left)/i.x-e.clientLeft,(t.clientY-n.top)/i.y-e.clientTop)}var We=ft&&ct?2*window.devicePixelRatio:ht?window.devicePixelRatio:1;function Ge(t){return it?t.wheelDeltaY/2:t.deltaY&&0===t.deltaMode?-t.deltaY/We:t.deltaY&&1===t.deltaMode?20*-t.deltaY:t.deltaY&&2===t.deltaMode?60*-t.deltaY:t.deltaX||t.deltaZ?0:t.wheelDelta?(t.wheelDeltaY||t.wheelDelta)/2:t.detail&&Math.abs(t.detail)<32765?20*-t.detail:t.detail?t.detail/-32765*60:0}var Ze,Ye={};function Xe(t){Ye[t.type]=!0}function Ke(t){var e=Ye[t.type];return Ye[t.type]=!1,e}function Qe(t,e){var i=e.relatedTarget;if(!i)return!0;try{for(;i&&i!==t;)i=i.parentNode}catch(t){return!1}return i!==t}function Je(t,e){var i=t.timeStamp||t.originalEvent&&t.originalEvent.timeStamp,n=Ze&&i-Ze;n&&n>100&&n<500||t.target._simulatedClick&&!t._simulated?He(t):(Ze=i,e(t))}var ti=(Object.freeze||Object)({on:$e,off:Re,stopPropagation:je,disableScrollPropagation:Fe,disableClickPropagation:qe,preventDefault:Ve,stop:He,getMousePosition:Ue,getWheelDelta:Ge,fakeStop:Xe,skipped:Ke,isExternalTarget:Qe,addListener:$e,removeListener:Re}),ei=D.extend({run:function(t,e,i,n){this.stop(),this._el=t,this._inProgress=!0,this._duration=i||.25,this._easeOutPower=1/Math.max(n||.5,.2),this._startPos=Ee(t),this._offset=e.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=E(this._animate,this),this._step()},_step:function(t){var e=+new Date-this._startTime,i=1e3*this._duration;e<i?this._runFrame(this._easeOut(e/i),t):(this._runFrame(1),this._complete())},_runFrame:function(t,e){var i=this._startPos.add(this._offset.multiplyBy(t));e&&i._round(),Ce(this._el,i),this.fire("step")},_complete:function(){A(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(t){return 1-Math.pow(1-t,this._easeOutPower)}}),ii=D.extend({options:{crs:Y,center:void 0,zoom:void 0,minZoom:void 0,maxZoom:void 0,layers:[],maxBounds:void 0,renderer:void 0,zoomAnimation:!0,zoomAnimationThreshold:4,fadeAnimation:!0,markerZoomAnimation:!0,transform3DLimit:8388608,zoomSnap:1,zoomDelta:1,trackResize:!0},initialize:function(t,e){e=f(this,e),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(t),this._initLayout(),this._onResize=s(this._onResize,this),this._initEvents(),e.maxBounds&&this.setMaxBounds(e.maxBounds),void 0!==e.zoom&&(this._zoom=this._limitZoom(e.zoom)),e.center&&void 0!==e.zoom&&this.setView(q(e.center),e.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=ae&&yt&&!Ct&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),$e(this._proxy,le,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(t,e,i){return e=void 0===e?this._zoom:this._limitZoom(e),t=this._limitCenter(q(t),e,this.options.maxBounds),i=i||{},this._stop(),this._loaded&&!i.reset&&!0!==i&&(void 0!==i.animate&&(i.zoom=n({animate:i.animate},i.zoom),i.pan=n({animate:i.animate,duration:i.duration},i.pan)),this._zoom!==e?this._tryAnimatedZoom&&this._tryAnimatedZoom(t,e,i.zoom):this._tryAnimatedPan(t,i.pan))?(clearTimeout(this._sizeTimer),this):(this._resetView(t,e),this)},setZoom:function(t,e){return this._loaded?this.setView(this.getCenter(),t,{zoom:e}):(this._zoom=t,this)},zoomIn:function(t,e){return t=t||(yt?this.options.zoomDelta:1),this.setZoom(this._zoom+t,e)},zoomOut:function(t,e){return t=t||(yt?this.options.zoomDelta:1),this.setZoom(this._zoom-t,e)},setZoomAround:function(t,e,i){var n=this.getZoomScale(e),o=this.getSize().divideBy(2),s=(t instanceof I?t:this.latLngToContainerPoint(t)).subtract(o).multiplyBy(1-1/n),r=this.containerPointToLatLng(o.add(s));return this.setView(r,e,{zoom:i})},_getBoundsCenterZoom:function(t,e){e=e||{},t=t.getBounds?t.getBounds():j(t);var i=z(e.paddingTopLeft||e.padding||[0,0]),n=z(e.paddingBottomRight||e.padding||[0,0]),o=this.getBoundsZoom(t,!1,i.add(n));if((o="number"==typeof e.maxZoom?Math.min(e.maxZoom,o):o)===1/0)return{center:t.getCenter(),zoom:o};var s=n.subtract(i).divideBy(2),r=this.project(t.getSouthWest(),o),a=this.project(t.getNorthEast(),o);return{center:this.unproject(r.add(a).divideBy(2).add(s),o),zoom:o}},fitBounds:function(t,e){if(!(t=j(t)).isValid())throw new Error("Bounds are not valid.");var i=this._getBoundsCenterZoom(t,e);return this.setView(i.center,i.zoom,e)},fitWorld:function(t){return this.fitBounds([[-90,-180],[90,180]],t)},panTo:function(t,e){return this.setView(t,this._zoom,{pan:e})},panBy:function(t,e){if(e=e||{},!(t=z(t).round()).x&&!t.y)return this.fire("moveend");if(!0!==e.animate&&!this.getSize().contains(t))return this._resetView(this.unproject(this.project(this.getCenter()).add(t)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new ei,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),e.noMoveStart||this.fire("movestart"),!1!==e.animate){ve(this._mapPane,"leaflet-pan-anim");var i=this._getMapPanePos().subtract(t).round();this._panAnim.run(this._mapPane,i,e.duration||.25,e.easeLinearity)}else this._rawPanBy(t),this.fire("move").fire("moveend");return this},flyTo:function(t,e,i){if(!1===(i=i||{}).animate||!yt)return this.setView(t,e,i);this._stop();var n=this.project(this.getCenter()),o=this.project(t),s=this.getSize(),r=this._zoom;t=q(t),e=void 0===e?r:e;var a=Math.max(s.x,s.y),l=a*this.getZoomScale(r,e),c=o.distanceTo(n)||1,h=1.42,d=h*h;function u(t){var e=(l*l-a*a+(t?-1:1)*d*d*c*c)/(2*(t?l:a)*d*c),i=Math.sqrt(e*e+1)-e;return i<1e-9?-18:Math.log(i)}function p(t){return(Math.exp(t)-Math.exp(-t))/2}function f(t){return(Math.exp(t)+Math.exp(-t))/2}function m(t){return p(t)/f(t)}var g=u(0);function v(t){return a*(f(g)/f(g+h*t))}function y(t){return a*(f(g)*m(g+h*t)-p(g))/d}function b(t){return 1-Math.pow(1-t,1.5)}var x=Date.now(),_=(u(1)-g)/h,w=i.duration?1e3*i.duration:1e3*_*.8;function k(){var i=(Date.now()-x)/w,s=b(i)*_;i<=1?(this._flyToFrame=E(k,this),this._move(this.unproject(n.add(o.subtract(n).multiplyBy(y(s)/c)),r),this.getScaleZoom(a/v(s),r),{flyTo:!0})):this._move(t,e)._moveEnd(!0)}return this._moveStart(!0,i.noMoveStart),k.call(this),this},flyToBounds:function(t,e){var i=this._getBoundsCenterZoom(t,e);return this.flyTo(i.center,i.zoom,e)},setMaxBounds:function(t){return(t=j(t)).isValid()?(this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this.options.maxBounds=t,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this.off("moveend",this._panInsideMaxBounds))},setMinZoom:function(t){var e=this.options.minZoom;return this.options.minZoom=t,this._loaded&&e!==t&&(this.fire("zoomlevelschange"),this.getZoom()<this.options.minZoom)?this.setZoom(t):this},setMaxZoom:function(t){var e=this.options.maxZoom;return this.options.maxZoom=t,this._loaded&&e!==t&&(this.fire("zoomlevelschange"),this.getZoom()>this.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,e){this._enforcingBounds=!0;var i=this.getCenter(),n=this._limitCenter(i,this._zoom,j(t));return i.equals(n)||this.panTo(n,e),this._enforcingBounds=!1,this},panInside:function(t,e){var i=z((e=e||{}).paddingTopLeft||e.padding||[0,0]),n=z(e.paddingBottomRight||e.padding||[0,0]),o=this.getCenter(),s=this.project(o),r=this.project(t),a=this.getPixelBounds(),l=a.getSize().divideBy(2),c=N([a.min.add(i),a.max.subtract(n)]);if(!c.contains(r)){this._enforcingBounds=!0;var h=s.subtract(r),d=z(r.x+h.x,r.y+h.y);(r.x<c.min.x||r.x>c.max.x)&&(d.x=s.x-h.x,h.x>0?d.x+=l.x-i.x:d.x-=l.x-n.x),(r.y<c.min.y||r.y>c.max.y)&&(d.y=s.y-h.y,h.y>0?d.y+=l.y-i.y:d.y-=l.y-n.y),this.panTo(this.unproject(d),e),this._enforcingBounds=!1}return this},invalidateSize:function(t){if(!this._loaded)return this;t=n({animate:!1,pan:!0},!0===t?{animate:!0}:t);var e=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var i=this.getSize(),o=e.divideBy(2).round(),r=i.divideBy(2).round(),a=o.subtract(r);return a.x||a.y?(t.animate&&t.pan?this.panBy(a):(t.pan&&this._rawPanBy(a),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(s(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:e,newSize:i})):this},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){if(t=this._locateOptions=n({timeout:1e4,watch:!1},t),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var e=s(this._handleGeolocationResponse,this),i=s(this._handleGeolocationError,this);return t.watch?this._locationWatchId=navigator.geolocation.watchPosition(e,i,t):navigator.geolocation.getCurrentPosition(e,i,t),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(t){var e=t.code,i=t.message||(1===e?"permission denied":2===e?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:e,message:"Geolocation error: "+i+"."})},_handleGeolocationResponse:function(t){var e=new F(t.coords.latitude,t.coords.longitude),i=e.toBounds(2*t.coords.accuracy),n=this._locateOptions;if(n.setView){var o=this.getBoundsZoom(i);this.setView(e,n.maxZoom?Math.min(o,n.maxZoom):o)}var s={latlng:e,bounds:i,timestamp:t.timestamp};for(var r in t.coords)"number"==typeof t.coords[r]&&(s[r]=t.coords[r]);this.fire("locationfound",s)},addHandler:function(t,e){if(!e)return this;var i=this[t]=new e(this);return this._handlers.push(i),this.options[t]&&i.enable(),this},remove:function(){if(this._initEvents(!0),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch(t){this._container._leaflet_id=void 0,this._containerId=void 0}var t;for(t in void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),ue(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(A(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload"),this._layers)this._layers[t].remove();for(t in this._panes)ue(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,e){var i=de("div","leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),e||this._mapPane);return t&&(this._panes[t]=i),i},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter:this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds();return new B(this.unproject(t.getBottomLeft()),this.unproject(t.getTopRight()))},getMinZoom:function(){return void 0===this.options.minZoom?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return void 0===this.options.maxZoom?void 0===this._layersMaxZoom?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,e,i){t=j(t),i=z(i||[0,0]);var n=this.getZoom()||0,o=this.getMinZoom(),s=this.getMaxZoom(),r=t.getNorthWest(),a=t.getSouthEast(),l=this.getSize().subtract(i),c=N(this.project(a,n),this.project(r,n)).getSize(),h=yt?this.options.zoomSnap:1,d=l.x/c.x,u=l.y/c.y,p=e?Math.max(d,u):Math.min(d,u);return n=this.getScaleZoom(p,n),h&&(n=Math.round(n/(h/100))*(h/100),n=e?Math.ceil(n/h)*h:Math.floor(n/h)*h),Math.max(o,Math.min(s,n))},getSize:function(){return this._size&&!this._sizeChanged||(this._size=new I(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,e){var i=this._getTopLeftPoint(t,e);return new R(i,i.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(void 0===t?this.getZoom():t)},getPane:function(t){return"string"==typeof t?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,e){var i=this.options.crs;return e=void 0===e?this._zoom:e,i.scale(t)/i.scale(e)},getScaleZoom:function(t,e){var i=this.options.crs;e=void 0===e?this._zoom:e;var n=i.zoom(t*i.scale(e));return isNaN(n)?1/0:n},project:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.latLngToPoint(q(t),e)},unproject:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.pointToLatLng(z(t),e)},layerPointToLatLng:function(t){var e=z(t).add(this.getPixelOrigin());return this.unproject(e)},latLngToLayerPoint:function(t){return this.project(q(t))._round()._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(q(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(j(t))},distance:function(t,e){return this.options.crs.distance(q(t),q(e))},containerPointToLayerPoint:function(t){return z(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return z(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){var e=this.containerPointToLayerPoint(z(t));return this.layerPointToLatLng(e)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(q(t)))},mouseEventToContainerPoint:function(t){return Ue(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(t){var e=this._container=ce(t);if(!e)throw new Error("Map container not found.");if(e._leaflet_id)throw new Error("Map container is already initialized.");$e(e,"scroll",this._onScroll,this),this._containerId=a(e)},_initLayout:function(){var t=this._container;this._fadeAnimated=this.options.fadeAnimation&&yt,ve(t,"leaflet-container"+(St?" leaflet-touch":"")+(At?" leaflet-retina":"")+(et?" leaflet-oldie":"")+(dt?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var e=he(t,"position");"absolute"!==e&&"relative"!==e&&"fixed"!==e&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),Ce(this._mapPane,new I(0,0)),this.createPane("tilePane"),this.createPane("shadowPane"),this.createPane("overlayPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(ve(t.markerPane,"leaflet-zoom-hide"),ve(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,e){Ce(this._mapPane,new I(0,0));var i=!this._loaded;this._loaded=!0,e=this._limitZoom(e),this.fire("viewprereset");var n=this._zoom!==e;this._moveStart(n,!1)._move(t,e)._moveEnd(n),this.fire("viewreset"),i&&this.fire("load")},_moveStart:function(t,e){return t&&this.fire("zoomstart"),e||this.fire("movestart"),this},_move:function(t,e,i){void 0===e&&(e=this._zoom);var n=this._zoom!==e;return this._zoom=e,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),(n||i&&i.pinch)&&this.fire("zoom",i),this.fire("move",i)},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return A(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){Ce(this._mapPane,this._getMapPanePos().subtract(t))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(t){this._targets={},this._targets[a(this._container)]=this;var e=t?Re:$e;e(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&e(window,"resize",this._onResize,this),yt&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){A(this._resizeRequest),this._resizeRequest=E((function(){this.invalidateSize({debounceMoveend:!0})}),this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,e){for(var i,n=[],o="mouseout"===e||"mouseover"===e,s=t.target||t.srcElement,r=!1;s;){if((i=this._targets[a(s)])&&("click"===e||"preclick"===e)&&!t._simulated&&this._draggableMoved(i)){r=!0;break}if(i&&i.listens(e,!0)){if(o&&!Qe(s,t))break;if(n.push(i),o)break}if(s===this._container)break;s=s.parentNode}return n.length||r||o||!Qe(s,t)||(n=[this]),n},_handleDOMEvent:function(t){if(this._loaded&&!Ke(t)){var e=t.type;"mousedown"!==e&&"keypress"!==e&&"keyup"!==e&&"keydown"!==e||Pe(t.target||t.srcElement),this._fireDOMEvent(t,e)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,e,i){if("click"===t.type){var o=n({},t);o.type="preclick",this._fireDOMEvent(o,o.type,i)}if(!t._stopped&&(i=(i||[]).concat(this._findEventTargets(t,e))).length){var s=i[0];"contextmenu"===e&&s.listens(e,!0)&&Ve(t);var r={originalEvent:t};if("keypress"!==t.type&&"keydown"!==t.type&&"keyup"!==t.type){var a=s.getLatLng&&(!s._radius||s._radius<=10);r.containerPoint=a?this.latLngToContainerPoint(s.getLatLng()):this.mouseEventToContainerPoint(t),r.layerPoint=this.containerPointToLayerPoint(r.containerPoint),r.latlng=a?s.getLatLng():this.layerPointToLatLng(r.layerPoint)}for(var l=0;l<i.length;l++)if(i[l].fire(e,r,!0),r.originalEvent._stopped||!1===i[l].options.bubblingMouseEvents&&-1!==b(this._mouseEvents,e))return}},_draggableMoved:function(t){return(t=t.dragging&&t.dragging.enabled()?t:this).dragging&&t.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var t=0,e=this._handlers.length;t<e;t++)this._handlers[t].disable()},whenReady:function(t,e){return this._loaded?t.call(e||this,{target:this}):this.on("load",t,e),this},_getMapPanePos:function(){return Ee(this._mapPane)||new I(0,0)},_moved:function(){var t=this._getMapPanePos();return t&&!t.equals([0,0])},_getTopLeftPoint:function(t,e){return(t&&void 0!==e?this._getNewPixelOrigin(t,e):this.getPixelOrigin()).subtract(this._getMapPanePos())},_getNewPixelOrigin:function(t,e){var i=this.getSize()._divideBy(2);return this.project(t,e)._subtract(i)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(t,e,i){var n=this._getNewPixelOrigin(i,e);return this.project(t,e)._subtract(n)},_latLngBoundsToNewLayerBounds:function(t,e,i){var n=this._getNewPixelOrigin(i,e);return N([this.project(t.getSouthWest(),e)._subtract(n),this.project(t.getNorthWest(),e)._subtract(n),this.project(t.getSouthEast(),e)._subtract(n),this.project(t.getNorthEast(),e)._subtract(n)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(t){return this.latLngToLayerPoint(t).subtract(this._getCenterLayerPoint())},_limitCenter:function(t,e,i){if(!i)return t;var n=this.project(t,e),o=this.getSize().divideBy(2),s=new R(n.subtract(o),n.add(o)),r=this._getBoundsOffset(s,i,e);return r.round().equals([0,0])?t:this.unproject(n.add(r),e)},_limitOffset:function(t,e){if(!e)return t;var i=this.getPixelBounds(),n=new R(i.min.add(t),i.max.add(t));return t.add(this._getBoundsOffset(n,e))},_getBoundsOffset:function(t,e,i){var n=N(this.project(e.getNorthEast(),i),this.project(e.getSouthWest(),i)),o=n.min.subtract(t.min),s=n.max.subtract(t.max);return new I(this._rebound(o.x,-s.x),this._rebound(o.y,-s.y))},_rebound:function(t,e){return t+e>0?Math.round(t-e)/2:Math.max(0,Math.ceil(t))-Math.max(0,Math.floor(e))},_limitZoom:function(t){var e=this.getMinZoom(),i=this.getMaxZoom(),n=yt?this.options.zoomSnap:1;return n&&(t=Math.round(t/n)*n),Math.max(e,Math.min(i,t))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){ye(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(t,e){var i=this._getCenterOffset(t)._trunc();return!(!0!==(e&&e.animate)&&!this.getSize().contains(i)||(this.panBy(i,e),0))},_createAnimProxy:function(){var t=this._proxy=de("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(t),this.on("zoomanim",(function(t){var e=re,i=this._proxy.style[e];Se(this._proxy,this.project(t.center,t.zoom),this.getZoomScale(t.zoom,1)),i===this._proxy.style[e]&&this._animatingZoom&&this._onZoomTransitionEnd()}),this),this.on("load moveend",(function(){var t=this.getCenter(),e=this.getZoom();Se(this._proxy,this.project(t,e),this.getZoomScale(e,1))}),this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){ue(this._proxy),delete this._proxy},_catchTransitionEnd:function(t){this._animatingZoom&&t.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(t,e,i){if(this._animatingZoom)return!0;if(i=i||{},!this._zoomAnimated||!1===i.animate||this._nothingToAnimate()||Math.abs(e-this._zoom)>this.options.zoomAnimationThreshold)return!1;var n=this.getZoomScale(e),o=this._getCenterOffset(t)._divideBy(1-1/n);return!(!0!==i.animate&&!this.getSize().contains(o)||(E((function(){this._moveStart(!0,!1)._animateZoom(t,e,!0)}),this),0))},_animateZoom:function(t,e,i,n){this._mapPane&&(i&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=e,ve(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:e,noUpdate:n}),setTimeout(s(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&ye(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom),E((function(){this._moveEnd(!0)}),this))}});function ni(t,e){return new ii(t,e)}var oi=T.extend({options:{position:"topright"},initialize:function(t){f(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var e=this._map;return e&&e.removeControl(this),this.options.position=t,e&&e.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var e=this._container=this.onAdd(t),i=this.getPosition(),n=t._controlCorners[i];return ve(e,"leaflet-control"),-1!==i.indexOf("bottom")?n.insertBefore(e,n.firstChild):n.appendChild(e),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(ue(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(t){this._map&&t&&t.screenX>0&&t.screenY>0&&this._map.getContainer().focus()}}),si=function(t){return new oi(t)};ii.include({addControl:function(t){return t.addTo(this),this},removeControl:function(t){return t.remove(),this},_initControlPos:function(){var t=this._controlCorners={},e="leaflet-",i=this._controlContainer=de("div",e+"control-container",this._container);function n(n,o){var s=e+n+" "+e+o;t[n+o]=de("div",s,i)}n("top","left"),n("top","right"),n("bottom","left"),n("bottom","right")},_clearControlPos:function(){for(var t in this._controlCorners)ue(this._controlCorners[t]);ue(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var ri=oi.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(t,e,i,n){return i<n?-1:n<i?1:0}},initialize:function(t,e,i){for(var n in f(this,i),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,t)this._addLayer(t[n],n);for(n in e)this._addLayer(e[n],n,!0)},onAdd:function(t){this._initLayout(),this._update(),this._map=t,t.on("zoomend",this._checkDisabledLayers,this);for(var e=0;e<this._layers.length;e++)this._layers[e].layer.on("add remove",this._onLayerChange,this);return this._container},addTo:function(t){return oi.prototype.addTo.call(this,t),this._expandIfNotCollapsed()},onRemove:function(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var t=0;t<this._layers.length;t++)this._layers[t].layer.off("add remove",this._onLayerChange,this)},addBaseLayer:function(t,e){return this._addLayer(t,e),this._map?this._update():this},addOverlay:function(t,e){return this._addLayer(t,e,!0),this._map?this._update():this},removeLayer:function(t){t.off("add remove",this._onLayerChange,this);var e=this._getLayer(a(t));return e&&this._layers.splice(this._layers.indexOf(e),1),this._map?this._update():this},expand:function(){ve(this._container,"leaflet-control-layers-expanded"),this._section.style.height=null;var t=this._map.getSize().y-(this._container.offsetTop+50);return t<this._section.clientHeight?(ve(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=t+"px"):ye(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return ye(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var t="leaflet-control-layers",e=this._container=de("div",t),i=this.options.collapsed;e.setAttribute("aria-haspopup",!0),qe(e),Fe(e);var n=this._section=de("section",t+"-list");i&&(this._map.on("click",this.collapse,this),ot||$e(e,{mouseenter:this.expand,mouseleave:this.collapse},this));var o=this._layersLink=de("a",t+"-toggle",e);o.href="#",o.title="Layers",St?($e(o,"click",He),$e(o,"click",this.expand,this)):$e(o,"focus",this.expand,this),i||this.expand(),this._baseLayersList=de("div",t+"-base",n),this._separator=de("div",t+"-separator",n),this._overlaysList=de("div",t+"-overlays",n),e.appendChild(n)},_getLayer:function(t){for(var e=0;e<this._layers.length;e++)if(this._layers[e]&&a(this._layers[e].layer)===t)return this._layers[e]},_addLayer:function(t,e,i){this._map&&t.on("add remove",this._onLayerChange,this),this._layers.push({layer:t,name:e,overlay:i}),this.options.sortLayers&&this._layers.sort(s((function(t,e){return this.options.sortFunction(t.layer,e.layer,t.name,e.name)}),this)),this.options.autoZIndex&&t.setZIndex&&(this._lastZIndex++,t.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;pe(this._baseLayersList),pe(this._overlaysList),this._layerControlInputs=[];var t,e,i,n,o=0;for(i=0;i<this._layers.length;i++)n=this._layers[i],this._addItem(n),e=e||n.overlay,t=t||!n.overlay,o+=n.overlay?0:1;return this.options.hideSingleBase&&(t=t&&o>1,this._baseLayersList.style.display=t?"":"none"),this._separator.style.display=e&&t?"":"none",this},_onLayerChange:function(t){this._handlingClick||this._update();var e=this._getLayer(a(t.target)),i=e.overlay?"add"===t.type?"overlayadd":"overlayremove":"add"===t.type?"baselayerchange":null;i&&this._map.fire(i,e)},_createRadioElement:function(t,e){var i='<input type="radio" class="leaflet-control-layers-selector" name="'+t+'"'+(e?' checked="checked"':"")+"/>",n=document.createElement("div");return n.innerHTML=i,n.firstChild},_addItem:function(t){var e,i=document.createElement("label"),n=this._map.hasLayer(t.layer);t.overlay?((e=document.createElement("input")).type="checkbox",e.className="leaflet-control-layers-selector",e.defaultChecked=n):e=this._createRadioElement("leaflet-base-layers_"+a(this),n),this._layerControlInputs.push(e),e.layerId=a(t.layer),$e(e,"click",this._onInputClick,this);var o=document.createElement("span");o.innerHTML=" "+t.name;var s=document.createElement("div");return i.appendChild(s),s.appendChild(e),s.appendChild(o),(t.overlay?this._overlaysList:this._baseLayersList).appendChild(i),this._checkDisabledLayers(),i},_onInputClick:function(){var t,e,i=this._layerControlInputs,n=[],o=[];this._handlingClick=!0;for(var s=i.length-1;s>=0;s--)t=i[s],e=this._getLayer(t.layerId).layer,t.checked?n.push(e):t.checked||o.push(e);for(s=0;s<o.length;s++)this._map.hasLayer(o[s])&&this._map.removeLayer(o[s]);for(s=0;s<n.length;s++)this._map.hasLayer(n[s])||this._map.addLayer(n[s]);this._handlingClick=!1,this._refocusOnMap()},_checkDisabledLayers:function(){for(var t,e,i=this._layerControlInputs,n=this._map.getZoom(),o=i.length-1;o>=0;o--)t=i[o],e=this._getLayer(t.layerId).layer,t.disabled=void 0!==e.options.minZoom&&n<e.options.minZoom||void 0!==e.options.maxZoom&&n>e.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expand:function(){return this.expand()},_collapse:function(){return this.collapse()}}),ai=function(t,e,i){return new ri(t,e,i)},li=oi.extend({options:{position:"topleft",zoomInText:"+",zoomInTitle:"Zoom in",zoomOutText:"−",zoomOutTitle:"Zoom out"},onAdd:function(t){var e="leaflet-control-zoom",i=de("div",e+" leaflet-bar"),n=this.options;return this._zoomInButton=this._createButton(n.zoomInText,n.zoomInTitle,e+"-in",i,this._zoomIn),this._zoomOutButton=this._createButton(n.zoomOutText,n.zoomOutTitle,e+"-out",i,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),i},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(t.shiftKey?3:1))},_zoomOut:function(t){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,e,i,n,o){var s=de("a",i,n);return s.innerHTML=t,s.href="#",s.title=e,s.setAttribute("role","button"),s.setAttribute("aria-label",e),qe(s),$e(s,"click",He),$e(s,"click",o,this),$e(s,"click",this._refocusOnMap,this),s},_updateDisabled:function(){var t=this._map,e="leaflet-disabled";ye(this._zoomInButton,e),ye(this._zoomOutButton,e),(this._disabled||t._zoom===t.getMinZoom())&&ve(this._zoomOutButton,e),(this._disabled||t._zoom===t.getMaxZoom())&&ve(this._zoomInButton,e)}});ii.mergeOptions({zoomControl:!0}),ii.addInitHook((function(){this.options.zoomControl&&(this.zoomControl=new li,this.addControl(this.zoomControl))}));var ci=function(t){return new li(t)},hi=oi.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var e="leaflet-control-scale",i=de("div",e),n=this.options;return this._addScales(n,e+"-line",i),t.on(n.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),i},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,e,i){t.metric&&(this._mScale=de("div",e,i)),t.imperial&&(this._iScale=de("div",e,i))},_update:function(){var t=this._map,e=t.getSize().y/2,i=t.distance(t.containerPointToLatLng([0,e]),t.containerPointToLatLng([this.options.maxWidth,e]));this._updateScales(i)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var e=this._getRoundNum(t),i=e<1e3?e+" m":e/1e3+" km";this._updateScale(this._mScale,i,e/t)},_updateImperial:function(t){var e,i,n,o=3.2808399*t;o>5280?(e=o/5280,i=this._getRoundNum(e),this._updateScale(this._iScale,i+" mi",i/e)):(n=this._getRoundNum(o),this._updateScale(this._iScale,n+" ft",n/o))},_updateScale:function(t,e,i){t.style.width=Math.round(this.options.maxWidth*i)+"px",t.innerHTML=e},_getRoundNum:function(t){var e=Math.pow(10,(Math.floor(t)+"").length-1),i=t/e;return e*(i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:1)}}),di=function(t){return new hi(t)},ui=oi.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JS library for interactive maps">Leaflet</a>'},initialize:function(t){f(this,t),this._attributions={}},onAdd:function(t){for(var e in t.attributionControl=this,this._container=de("div","leaflet-control-attribution"),qe(this._container),t._layers)t._layers[e].getAttribution&&this.addAttribution(t._layers[e].getAttribution());return this._update(),this._container},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t?(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update(),this):this},removeAttribution:function(t){return t?(this._attributions[t]&&(this._attributions[t]--,this._update()),this):this},_update:function(){if(this._map){var t=[];for(var e in this._attributions)this._attributions[e]&&t.push(e);var i=[];this.options.prefix&&i.push(this.options.prefix),t.length&&i.push(t.join(", ")),this._container.innerHTML=i.join(" | ")}}});ii.mergeOptions({attributionControl:!0}),ii.addInitHook((function(){this.options.attributionControl&&(new ui).addTo(this)}));var pi=function(t){return new ui(t)};oi.Layers=ri,oi.Zoom=li,oi.Scale=hi,oi.Attribution=ui,si.layers=ai,si.zoom=ci,si.scale=di,si.attribution=pi;var fi=T.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled||(this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});fi.addTo=function(t,e){return t.addHandler(e,this),this};var mi,gi={Events:O},vi=St?"touchstart mousedown":"mousedown",yi={mousedown:"mouseup",touchstart:"touchend",pointerdown:"touchend",MSPointerDown:"touchend"},bi={mousedown:"mousemove",touchstart:"touchmove",pointerdown:"touchmove",MSPointerDown:"touchmove"},xi=D.extend({options:{clickTolerance:3},initialize:function(t,e,i,n){f(this,n),this._element=t,this._dragStartTarget=e||t,this._preventOutline=i},enable:function(){this._enabled||($e(this._dragStartTarget,vi,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(xi._dragging===this&&this.finishDrag(),Re(this._dragStartTarget,vi,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){if(!t._simulated&&this._enabled&&(this._moved=!1,!ge(this._element,"leaflet-zoom-anim")&&!(xi._dragging||t.shiftKey||1!==t.which&&1!==t.button&&!t.touches||(xi._dragging=this,this._preventOutline&&Pe(this._element),Me(),ee(),this._moving)))){this.fire("down");var e=t.touches?t.touches[0]:t,i=De(this._element);this._startPoint=new I(e.clientX,e.clientY),this._parentScale=Ie(i),$e(document,bi[t.type],this._onMove,this),$e(document,yi[t.type],this._onUp,this)}},_onMove:function(t){if(!t._simulated&&this._enabled)if(t.touches&&t.touches.length>1)this._moved=!0;else{var e=t.touches&&1===t.touches.length?t.touches[0]:t,i=new I(e.clientX,e.clientY)._subtract(this._startPoint);(i.x||i.y)&&(Math.abs(i.x)+Math.abs(i.y)<this.options.clickTolerance||(i.x/=this._parentScale.x,i.y/=this._parentScale.y,Ve(t),this._moved||(this.fire("dragstart"),this._moved=!0,this._startPos=Ee(this._element).subtract(i),ve(document.body,"leaflet-dragging"),this._lastTarget=t.target||t.srcElement,window.SVGElementInstance&&this._lastTarget instanceof SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),ve(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(i),this._moving=!0,A(this._animRequest),this._lastEvent=t,this._animRequest=E(this._updatePosition,this,!0)))}},_updatePosition:function(){var t={originalEvent:this._lastEvent};this.fire("predrag",t),Ce(this._element,this._newPos),this.fire("drag",t)},_onUp:function(t){!t._simulated&&this._enabled&&this.finishDrag()},finishDrag:function(){for(var t in ye(document.body,"leaflet-dragging"),this._lastTarget&&(ye(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),bi)Re(document,bi[t],this._onMove,this),Re(document,yi[t],this._onUp,this);Te(),ie(),this._moved&&this._moving&&(A(this._animRequest),this.fire("dragend",{distance:this._newPos.distanceTo(this._startPos)})),this._moving=!1,xi._dragging=!1}});function _i(t,e){if(!e||!t.length)return t.slice();var i=e*e;return t=Si(t=Ei(t,i),i)}function wi(t,e,i){return Math.sqrt(Oi(t,e,i,!0))}function ki(t,e,i){return Oi(t,e,i)}function Si(t,e){var i=t.length,n=new(typeof Uint8Array!=void 0+""?Uint8Array:Array)(i);n[0]=n[i-1]=1,Ci(t,n,e,0,i-1);var o,s=[];for(o=0;o<i;o++)n[o]&&s.push(t[o]);return s}function Ci(t,e,i,n,o){var s,r,a,l=0;for(r=n+1;r<=o-1;r++)(a=Oi(t[r],t[n],t[o],!0))>l&&(s=r,l=a);l>i&&(e[s]=1,Ci(t,e,i,n,s),Ci(t,e,i,s,o))}function Ei(t,e){for(var i=[t[0]],n=1,o=0,s=t.length;n<s;n++)Pi(t[n],t[o])>e&&(i.push(t[n]),o=n);return o<s-1&&i.push(t[s-1]),i}function Ai(t,e,i,n,o){var s,r,a,l=n?mi:Ti(t,i),c=Ti(e,i);for(mi=c;;){if(!(l|c))return[t,e];if(l&c)return!1;a=Ti(r=Mi(t,e,s=l||c,i,o),i),s===l?(t=r,l=a):(e=r,c=a)}}function Mi(t,e,i,n,o){var s,r,a=e.x-t.x,l=e.y-t.y,c=n.min,h=n.max;return 8&i?(s=t.x+a*(h.y-t.y)/l,r=h.y):4&i?(s=t.x+a*(c.y-t.y)/l,r=c.y):2&i?(s=h.x,r=t.y+l*(h.x-t.x)/a):1&i&&(s=c.x,r=t.y+l*(c.x-t.x)/a),new I(s,r,o)}function Ti(t,e){var i=0;return t.x<e.min.x?i|=1:t.x>e.max.x&&(i|=2),t.y<e.min.y?i|=4:t.y>e.max.y&&(i|=8),i}function Pi(t,e){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n}function Oi(t,e,i,n){var o,s=e.x,r=e.y,a=i.x-s,l=i.y-r,c=a*a+l*l;return c>0&&((o=((t.x-s)*a+(t.y-r)*l)/c)>1?(s=i.x,r=i.y):o>0&&(s+=a*o,r+=l*o)),a=t.x-s,l=t.y-r,n?a*a+l*l:new I(s,r)}function Di(t){return!y(t[0])||"object"!=typeof t[0][0]&&void 0!==t[0][0]}function Ii(t){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Di(t)}var Li=(Object.freeze||Object)({simplify:_i,pointToSegmentDistance:wi,closestPointOnSegment:ki,clipSegment:Ai,_getEdgeIntersection:Mi,_getBitCode:Ti,_sqClosestPointOnSegment:Oi,isFlat:Di,_flat:Ii});function $i(t,e,i){var n,o,s,r,a,l,c,h,d,u=[1,4,2,8];for(o=0,c=t.length;o<c;o++)t[o]._code=Ti(t[o],e);for(r=0;r<4;r++){for(h=u[r],n=[],o=0,s=(c=t.length)-1;o<c;s=o++)a=t[o],l=t[s],a._code&h?l._code&h||((d=Mi(l,a,h,e,i))._code=Ti(d,e),n.push(d)):(l._code&h&&((d=Mi(l,a,h,e,i))._code=Ti(d,e),n.push(d)),n.push(a));t=n}return t}var zi=(Object.freeze||Object)({clipPolygon:$i}),Ri={project:function(t){return new I(t.lng,t.lat)},unproject:function(t){return new F(t.y,t.x)},bounds:new R([-180,-90],[180,90])},Ni={R:6378137,R_MINOR:6356752.314245179,bounds:new R([-20037508.34279,-15496570.73972],[20037508.34279,18764656.23138]),project:function(t){var e=Math.PI/180,i=this.R,n=t.lat*e,o=this.R_MINOR/i,s=Math.sqrt(1-o*o),r=s*Math.sin(n),a=Math.tan(Math.PI/4-n/2)/Math.pow((1-r)/(1+r),s/2);return n=-i*Math.log(Math.max(a,1e-10)),new I(t.lng*e*i,n)},unproject:function(t){for(var e,i=180/Math.PI,n=this.R,o=this.R_MINOR/n,s=Math.sqrt(1-o*o),r=Math.exp(-t.y/n),a=Math.PI/2-2*Math.atan(r),l=0,c=.1;l<15&&Math.abs(c)>1e-7;l++)e=s*Math.sin(a),e=Math.pow((1-e)/(1+e),s/2),a+=c=Math.PI/2-2*Math.atan(r*e)-a;return new F(a*i,t.x*i/n)}},Bi=(Object.freeze||Object)({LonLat:Ri,Mercator:Ni,SphericalMercator:W}),ji=n({},H,{code:"EPSG:3395",projection:Ni,transformation:function(){var t=.5/(Math.PI*Ni.R);return Z(t,.5,-t,.5)}()}),Fi=n({},H,{code:"EPSG:4326",projection:Ri,transformation:Z(1/180,1,-1/180,.5)}),qi=n({},V,{projection:Ri,transformation:Z(1,0,-1,0),scale:function(t){return Math.pow(2,t)},zoom:function(t){return Math.log(t)/Math.LN2},distance:function(t,e){var i=e.lng-t.lng,n=e.lat-t.lat;return Math.sqrt(i*i+n*n)},infinite:!0});V.Earth=H,V.EPSG3395=ji,V.EPSG3857=Y,V.EPSG900913=X,V.EPSG4326=Fi,V.Simple=qi;var Vi=D.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(t){return t.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(t){return t&&t.removeLayer(this),this},getPane:function(t){return this._map.getPane(t?this.options[t]||t:this.options.pane)},addInteractiveTarget:function(t){return this._map._targets[a(t)]=this,this},removeInteractiveTarget:function(t){return delete this._map._targets[a(t)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(t){var e=t.target;if(e.hasLayer(this)){if(this._map=e,this._zoomAnimated=e._zoomAnimated,this.getEvents){var i=this.getEvents();e.on(i,this),this.once("remove",(function(){e.off(i,this)}),this)}this.onAdd(e),this.getAttribution&&e.attributionControl&&e.attributionControl.addAttribution(this.getAttribution()),this.fire("add"),e.fire("layeradd",{layer:this})}}});ii.include({addLayer:function(t){if(!t._layerAdd)throw new Error("The provided object is not a Layer.");var e=a(t);return this._layers[e]||(this._layers[e]=t,t._mapToAdd=this,t.beforeAdd&&t.beforeAdd(this),this.whenReady(t._layerAdd,t)),this},removeLayer:function(t){var e=a(t);return this._layers[e]?(this._loaded&&t.onRemove(this),t.getAttribution&&this.attributionControl&&this.attributionControl.removeAttribution(t.getAttribution()),delete this._layers[e],this._loaded&&(this.fire("layerremove",{layer:t}),t.fire("remove")),t._map=t._mapToAdd=null,this):this},hasLayer:function(t){return!!t&&a(t)in this._layers},eachLayer:function(t,e){for(var i in this._layers)t.call(e,this._layers[i]);return this},_addLayers:function(t){for(var e=0,i=(t=t?y(t)?t:[t]:[]).length;e<i;e++)this.addLayer(t[e])},_addZoomLimit:function(t){!isNaN(t.options.maxZoom)&&isNaN(t.options.minZoom)||(this._zoomBoundLayers[a(t)]=t,this._updateZoomLevels())},_removeZoomLimit:function(t){var e=a(t);this._zoomBoundLayers[e]&&(delete this._zoomBoundLayers[e],this._updateZoomLevels())},_updateZoomLevels:function(){var t=1/0,e=-1/0,i=this._getZoomSpan();for(var n in this._zoomBoundLayers){var o=this._zoomBoundLayers[n].options;t=void 0===o.minZoom?t:Math.min(t,o.minZoom),e=void 0===o.maxZoom?e:Math.max(e,o.maxZoom)}this._layersMaxZoom=e===-1/0?void 0:e,this._layersMinZoom=t===1/0?void 0:t,i!==this._getZoomSpan()&&this.fire("zoomlevelschange"),void 0===this.options.maxZoom&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var Hi=Vi.extend({initialize:function(t,e){var i,n;if(f(this,e),this._layers={},t)for(i=0,n=t.length;i<n;i++)this.addLayer(t[i])},addLayer:function(t){var e=this.getLayerId(t);return this._layers[e]=t,this._map&&this._map.addLayer(t),this},removeLayer:function(t){var e=t in this._layers?t:this.getLayerId(t);return this._map&&this._layers[e]&&this._map.removeLayer(this._layers[e]),delete this._layers[e],this},hasLayer:function(t){return!!t&&(t in this._layers||this.getLayerId(t)in this._layers)},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(t){var e,i,n=Array.prototype.slice.call(arguments,1);for(e in this._layers)(i=this._layers[e])[t]&&i[t].apply(i,n);return this},onAdd:function(t){this.eachLayer(t.addLayer,t)},onRemove:function(t){this.eachLayer(t.removeLayer,t)},eachLayer:function(t,e){for(var i in this._layers)t.call(e,this._layers[i]);return this},getLayer:function(t){return this._layers[t]},getLayers:function(){var t=[];return this.eachLayer(t.push,t),t},setZIndex:function(t){return this.invoke("setZIndex",t)},getLayerId:function(t){return a(t)}}),Ui=function(t,e){return new Hi(t,e)},Wi=Hi.extend({addLayer:function(t){return this.hasLayer(t)?this:(t.addEventParent(this),Hi.prototype.addLayer.call(this,t),this.fire("layeradd",{layer:t}))},removeLayer:function(t){return this.hasLayer(t)?(t in this._layers&&(t=this._layers[t]),t.removeEventParent(this),Hi.prototype.removeLayer.call(this,t),this.fire("layerremove",{layer:t})):this},setStyle:function(t){return this.invoke("setStyle",t)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var t=new B;for(var e in this._layers){var i=this._layers[e];t.extend(i.getBounds?i.getBounds():i.getLatLng())}return t}}),Gi=function(t){return new Wi(t)},Zi=T.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0]},initialize:function(t){f(this,t)},createIcon:function(t){return this._createIcon("icon",t)},createShadow:function(t){return this._createIcon("shadow",t)},_createIcon:function(t,e){var i=this._getIconUrl(t);if(!i){if("icon"===t)throw new Error("iconUrl not set in Icon options (see the docs).");return null}var n=this._createImg(i,e&&"IMG"===e.tagName?e:null);return this._setIconStyles(n,t),n},_setIconStyles:function(t,e){var i=this.options,n=i[e+"Size"];"number"==typeof n&&(n=[n,n]);var o=z(n),s=z("shadow"===e&&i.shadowAnchor||i.iconAnchor||o&&o.divideBy(2,!0));t.className="leaflet-marker-"+e+" "+(i.className||""),s&&(t.style.marginLeft=-s.x+"px",t.style.marginTop=-s.y+"px"),o&&(t.style.width=o.x+"px",t.style.height=o.y+"px")},_createImg:function(t,e){return(e=e||document.createElement("img")).src=t,e},_getIconUrl:function(t){return At&&this.options[t+"RetinaUrl"]||this.options[t+"Url"]}});function Yi(t){return new Zi(t)}var Xi=Zi.extend({options:{iconUrl:"marker-icon.png",iconRetinaUrl:"marker-icon-2x.png",shadowUrl:"marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]},_getIconUrl:function(t){return Xi.imagePath||(Xi.imagePath=this._detectIconPath()),(this.options.imagePath||Xi.imagePath)+Zi.prototype._getIconUrl.call(this,t)},_detectIconPath:function(){var t=de("div","leaflet-default-icon-path",document.body),e=he(t,"background-image")||he(t,"backgroundImage");return document.body.removeChild(t),e=null===e||0!==e.indexOf("url")?"":e.replace(/^url\(["']?/,"").replace(/marker-icon\.png["']?\)$/,"")}}),Ki=fi.extend({initialize:function(t){this._marker=t},addHooks:function(){var t=this._marker._icon;this._draggable||(this._draggable=new xi(t,t,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),ve(t,"leaflet-marker-draggable")},removeHooks:function(){this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable(),this._marker._icon&&ye(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(t){var e=this._marker,i=e._map,n=this._marker.options.autoPanSpeed,o=this._marker.options.autoPanPadding,s=Ee(e._icon),r=i.getPixelBounds(),a=i.getPixelOrigin(),l=N(r.min._subtract(a).add(o),r.max._subtract(a).subtract(o));if(!l.contains(s)){var c=z((Math.max(l.max.x,s.x)-l.max.x)/(r.max.x-l.max.x)-(Math.min(l.min.x,s.x)-l.min.x)/(r.min.x-l.min.x),(Math.max(l.max.y,s.y)-l.max.y)/(r.max.y-l.max.y)-(Math.min(l.min.y,s.y)-l.min.y)/(r.min.y-l.min.y)).multiplyBy(n);i.panBy(c,{animate:!1}),this._draggable._newPos._add(c),this._draggable._startPos._add(c),Ce(e._icon,this._draggable._newPos),this._onDrag(t),this._panRequest=E(this._adjustPan.bind(this,t))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup().fire("movestart").fire("dragstart")},_onPreDrag:function(t){this._marker.options.autoPan&&(A(this._panRequest),this._panRequest=E(this._adjustPan.bind(this,t)))},_onDrag:function(t){var e=this._marker,i=e._shadow,n=Ee(e._icon),o=e._map.layerPointToLatLng(n);i&&Ce(i,n),e._latlng=o,t.latlng=o,t.oldLatLng=this._oldLatLng,e.fire("move",t).fire("drag",t)},_onDragEnd:function(t){A(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",t)}}),Qi=Vi.extend({options:{icon:new Xi,interactive:!0,keyboard:!0,title:"",alt:"",zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250,pane:"markerPane",shadowPane:"shadowPane",bubblingMouseEvents:!1,draggable:!1,autoPan:!1,autoPanPadding:[50,50],autoPanSpeed:10},initialize:function(t,e){f(this,e),this._latlng=q(t)},onAdd:function(t){this._zoomAnimated=this._zoomAnimated&&t.options.markerZoomAnimation,this._zoomAnimated&&t.on("zoomanim",this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(t){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&t.off("zoomanim",this._animateZoom,this),this._removeIcon(),this._removeShadow()},getEvents:function(){return{zoom:this.update,viewreset:this.update}},getLatLng:function(){return this._latlng},setLatLng:function(t){var e=this._latlng;return this._latlng=q(t),this.update(),this.fire("move",{oldLatLng:e,latlng:this._latlng})},setZIndexOffset:function(t){return this.options.zIndexOffset=t,this.update()},getIcon:function(){return this.options.icon},setIcon:function(t){return this.options.icon=t,this._map&&(this._initIcon(),this.update()),this._popup&&this.bindPopup(this._popup,this._popup.options),this},getElement:function(){return this._icon},update:function(){if(this._icon&&this._map){var t=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(t)}return this},_initIcon:function(){var t=this.options,e="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide"),i=t.icon.createIcon(this._icon),n=!1;i!==this._icon&&(this._icon&&this._removeIcon(),n=!0,t.title&&(i.title=t.title),"IMG"===i.tagName&&(i.alt=t.alt||"")),ve(i,e),t.keyboard&&(i.tabIndex="0"),this._icon=i,t.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex});var o=t.icon.createShadow(this._shadow),s=!1;o!==this._shadow&&(this._removeShadow(),s=!0),o&&(ve(o,e),o.alt=""),this._shadow=o,t.opacity<1&&this._updateOpacity(),n&&this.getPane().appendChild(this._icon),this._initInteraction(),o&&s&&this.getPane(t.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),ue(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&ue(this._shadow),this._shadow=null},_setPos:function(t){Ce(this._icon,t),this._shadow&&Ce(this._shadow,t),this._zIndex=t.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(t){this._icon.style.zIndex=this._zIndex+t},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center).round();this._setPos(e)},_initInteraction:function(){if(this.options.interactive&&(ve(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),Ki)){var t=this.options.draggable;this.dragging&&(t=this.dragging.enabled(),this.dragging.disable()),this.dragging=new Ki(this),t&&this.dragging.enable()}},setOpacity:function(t){return this.options.opacity=t,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var t=this.options.opacity;this._icon&&_e(this._icon,t),this._shadow&&_e(this._shadow,t)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function Ji(t,e){return new Qi(t,e)}var tn=Vi.extend({options:{stroke:!0,color:"#3388ff",weight:3,opacity:1,lineCap:"round",lineJoin:"round",dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,fillRule:"evenodd",interactive:!0,bubblingMouseEvents:!0},beforeAdd:function(t){this._renderer=t.getRenderer(this)},onAdd:function(){this._renderer._initPath(this),this._reset(),this._renderer._addPath(this)},onRemove:function(){this._renderer._removePath(this)},redraw:function(){return this._map&&this._renderer._updatePath(this),this},setStyle:function(t){return f(this,t),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&t.hasOwnProperty("weight")&&this._updateBounds()),this},bringToFront:function(){return this._renderer&&this._renderer._bringToFront(this),this},bringToBack:function(){return this._renderer&&this._renderer._bringToBack(this),this},getElement:function(){return this._path},_reset:function(){this._project(),this._update()},_clickTolerance:function(){return(this.options.stroke?this.options.weight/2:0)+this._renderer.options.tolerance}}),en=tn.extend({options:{fill:!0,radius:10},initialize:function(t,e){f(this,e),this._latlng=q(t),this._radius=this.options.radius},setLatLng:function(t){return this._latlng=q(t),this.redraw(),this.fire("move",{latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(t){return this.options.radius=this._radius=t,this.redraw()},getRadius:function(){return this._radius},setStyle:function(t){var e=t&&t.radius||this._radius;return tn.prototype.setStyle.call(this,t),this.setRadius(e),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var t=this._radius,e=this._radiusY||t,i=this._clickTolerance(),n=[t+i,e+i];this._pxBounds=new R(this._point.subtract(n),this._point.add(n))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateCircle(this)},_empty:function(){return this._radius&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(t){return t.distanceTo(this._point)<=this._radius+this._clickTolerance()}});function nn(t,e){return new en(t,e)}var on=en.extend({initialize:function(t,e,i){if("number"==typeof e&&(e=n({},i,{radius:e})),f(this,e),this._latlng=q(t),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius},setRadius:function(t){return this._mRadius=t,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var t=[this._radius,this._radiusY||this._radius];return new B(this._map.layerPointToLatLng(this._point.subtract(t)),this._map.layerPointToLatLng(this._point.add(t)))},setStyle:tn.prototype.setStyle,_project:function(){var t=this._latlng.lng,e=this._latlng.lat,i=this._map,n=i.options.crs;if(n.distance===H.distance){var o=Math.PI/180,s=this._mRadius/H.R/o,r=i.project([e+s,t]),a=i.project([e-s,t]),l=r.add(a).divideBy(2),c=i.unproject(l).lat,h=Math.acos((Math.cos(s*o)-Math.sin(e*o)*Math.sin(c*o))/(Math.cos(e*o)*Math.cos(c*o)))/o;(isNaN(h)||0===h)&&(h=s/Math.cos(Math.PI/180*e)),this._point=l.subtract(i.getPixelOrigin()),this._radius=isNaN(h)?0:l.x-i.project([c,t-h]).x,this._radiusY=l.y-r.y}else{var d=n.unproject(n.project(this._latlng).subtract([this._mRadius,0]));this._point=i.latLngToLayerPoint(this._latlng),this._radius=this._point.x-i.latLngToLayerPoint(d).x}this._updateBounds()}});function sn(t,e,i){return new on(t,e,i)}var rn=tn.extend({options:{smoothFactor:1,noClip:!1},initialize:function(t,e){f(this,e),this._setLatLngs(t)},getLatLngs:function(){return this._latlngs},setLatLngs:function(t){return this._setLatLngs(t),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(t){for(var e,i,n=1/0,o=null,s=Oi,r=0,a=this._parts.length;r<a;r++)for(var l=this._parts[r],c=1,h=l.length;c<h;c++){var d=s(t,e=l[c-1],i=l[c],!0);d<n&&(n=d,o=s(t,e,i))}return o&&(o.distance=Math.sqrt(n)),o},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");var t,e,i,n,o,s,r,a=this._rings[0],l=a.length;if(!l)return null;for(t=0,e=0;t<l-1;t++)e+=a[t].distanceTo(a[t+1])/2;if(0===e)return this._map.layerPointToLatLng(a[0]);for(t=0,n=0;t<l-1;t++)if(o=a[t],s=a[t+1],(n+=i=o.distanceTo(s))>e)return r=(n-e)/i,this._map.layerPointToLatLng([s.x-r*(s.x-o.x),s.y-r*(s.y-o.y)])},getBounds:function(){return this._bounds},addLatLng:function(t,e){return e=e||this._defaultShape(),t=q(t),e.push(t),this._bounds.extend(t),this.redraw()},_setLatLngs:function(t){this._bounds=new B,this._latlngs=this._convertLatLngs(t)},_defaultShape:function(){return Di(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(t){for(var e=[],i=Di(t),n=0,o=t.length;n<o;n++)i?(e[n]=q(t[n]),this._bounds.extend(e[n])):e[n]=this._convertLatLngs(t[n]);return e},_project:function(){var t=new R;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,t),this._bounds.isValid()&&t.isValid()&&(this._rawPxBounds=t,this._updateBounds())},_updateBounds:function(){var t=this._clickTolerance(),e=new I(t,t);this._pxBounds=new R([this._rawPxBounds.min.subtract(e),this._rawPxBounds.max.add(e)])},_projectLatlngs:function(t,e,i){var n,o,s=t[0]instanceof F,r=t.length;if(s){for(o=[],n=0;n<r;n++)o[n]=this._map.latLngToLayerPoint(t[n]),i.extend(o[n]);e.push(o)}else for(n=0;n<r;n++)this._projectLatlngs(t[n],e,i)},_clipPoints:function(){var t=this._renderer._bounds;if(this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else{var e,i,n,o,s,r,a,l=this._parts;for(e=0,n=0,o=this._rings.length;e<o;e++)for(i=0,s=(a=this._rings[e]).length;i<s-1;i++)(r=Ai(a[i],a[i+1],t,i,!0))&&(l[n]=l[n]||[],l[n].push(r[0]),r[1]===a[i+1]&&i!==s-2||(l[n].push(r[1]),n++))}},_simplifyPoints:function(){for(var t=this._parts,e=this.options.smoothFactor,i=0,n=t.length;i<n;i++)t[i]=_i(t[i],e)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(t,e){var i,n,o,s,r,a,l=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(i=0,s=this._parts.length;i<s;i++)for(n=0,o=(r=(a=this._parts[i]).length)-1;n<r;o=n++)if((e||0!==n)&&wi(t,a[o],a[n])<=l)return!0;return!1}});function an(t,e){return new rn(t,e)}rn._flat=Ii;var ln=rn.extend({options:{fill:!0},isEmpty:function(){return!this._latlngs.length||!this._latlngs[0].length},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");var t,e,i,n,o,s,r,a,l,c=this._rings[0],h=c.length;if(!h)return null;for(s=r=a=0,t=0,e=h-1;t<h;e=t++)i=c[t],n=c[e],o=i.y*n.x-n.y*i.x,r+=(i.x+n.x)*o,a+=(i.y+n.y)*o,s+=3*o;return l=0===s?c[0]:[r/s,a/s],this._map.layerPointToLatLng(l)},_convertLatLngs:function(t){var e=rn.prototype._convertLatLngs.call(this,t),i=e.length;return i>=2&&e[0]instanceof F&&e[0].equals(e[i-1])&&e.pop(),e},_setLatLngs:function(t){rn.prototype._setLatLngs.call(this,t),Di(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Di(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var t=this._renderer._bounds,e=this.options.weight,i=new I(e,e);if(t=new R(t.min.subtract(i),t.max.add(i)),this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else for(var n,o=0,s=this._rings.length;o<s;o++)(n=$i(this._rings[o],t,!0)).length&&this._parts.push(n)},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(t){var e,i,n,o,s,r,a,l,c=!1;if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(o=0,a=this._parts.length;o<a;o++)for(s=0,r=(l=(e=this._parts[o]).length)-1;s<l;r=s++)i=e[s],n=e[r],i.y>t.y!=n.y>t.y&&t.x<(n.x-i.x)*(t.y-i.y)/(n.y-i.y)+i.x&&(c=!c);return c||rn.prototype._containsPoint.call(this,t,!0)}});function cn(t,e){return new ln(t,e)}var hn=Wi.extend({initialize:function(t,e){f(this,e),this._layers={},t&&this.addData(t)},addData:function(t){var e,i,n,o=y(t)?t:t.features;if(o){for(e=0,i=o.length;e<i;e++)((n=o[e]).geometries||n.geometry||n.features||n.coordinates)&&this.addData(n);return this}var s=this.options;if(s.filter&&!s.filter(t))return this;var r=dn(t,s);return r?(r.feature=vn(t),r.defaultOptions=r.options,this.resetStyle(r),s.onEachFeature&&s.onEachFeature(t,r),this.addLayer(r)):this},resetStyle:function(t){return t.options=n({},t.defaultOptions),this._setLayerStyle(t,this.options.style),this},setStyle:function(t){return this.eachLayer((function(e){this._setLayerStyle(e,t)}),this)},_setLayerStyle:function(t,e){t.setStyle&&("function"==typeof e&&(e=e(t.feature)),t.setStyle(e))}});function dn(t,e){var i,n,o,s,r="Feature"===t.type?t.geometry:t,a=r?r.coordinates:null,l=[],c=e&&e.pointToLayer,h=e&&e.coordsToLatLng||un;if(!a&&!r)return null;switch(r.type){case"Point":return i=h(a),c?c(t,i):new Qi(i);case"MultiPoint":for(o=0,s=a.length;o<s;o++)i=h(a[o]),l.push(c?c(t,i):new Qi(i));return new Wi(l);case"LineString":case"MultiLineString":return n=pn(a,"LineString"===r.type?0:1,h),new rn(n,e);case"Polygon":case"MultiPolygon":return n=pn(a,"Polygon"===r.type?1:2,h),new ln(n,e);case"GeometryCollection":for(o=0,s=r.geometries.length;o<s;o++){var d=dn({geometry:r.geometries[o],type:"Feature",properties:t.properties},e);d&&l.push(d)}return new Wi(l);default:throw new Error("Invalid GeoJSON object.")}}function un(t){return new F(t[1],t[0],t[2])}function pn(t,e,i){for(var n,o=[],s=0,r=t.length;s<r;s++)n=e?pn(t[s],e-1,i):(i||un)(t[s]),o.push(n);return o}function fn(t,e){return e="number"==typeof e?e:6,void 0!==t.alt?[d(t.lng,e),d(t.lat,e),d(t.alt,e)]:[d(t.lng,e),d(t.lat,e)]}function mn(t,e,i,n){for(var o=[],s=0,r=t.length;s<r;s++)o.push(e?mn(t[s],e-1,i,n):fn(t[s],n));return!e&&i&&o.push(o[0]),o}function gn(t,e){return t.feature?n({},t.feature,{geometry:e}):vn(e)}function vn(t){return"Feature"===t.type||"FeatureCollection"===t.type?t:{type:"Feature",properties:{},geometry:t}}var yn={toGeoJSON:function(t){return gn(this,{type:"Point",coordinates:fn(this.getLatLng(),t)})}};function bn(t,e){return new hn(t,e)}Qi.include(yn),on.include(yn),en.include(yn),rn.include({toGeoJSON:function(t){var e=!Di(this._latlngs);return gn(this,{type:(e?"Multi":"")+"LineString",coordinates:mn(this._latlngs,e?1:0,!1,t)})}}),ln.include({toGeoJSON:function(t){var e=!Di(this._latlngs),i=e&&!Di(this._latlngs[0]),n=mn(this._latlngs,i?2:e?1:0,!0,t);return e||(n=[n]),gn(this,{type:(i?"Multi":"")+"Polygon",coordinates:n})}}),Hi.include({toMultiPoint:function(t){var e=[];return this.eachLayer((function(i){e.push(i.toGeoJSON(t).geometry.coordinates)})),gn(this,{type:"MultiPoint",coordinates:e})},toGeoJSON:function(t){var e=this.feature&&this.feature.geometry&&this.feature.geometry.type;if("MultiPoint"===e)return this.toMultiPoint(t);var i="GeometryCollection"===e,n=[];return this.eachLayer((function(e){if(e.toGeoJSON){var o=e.toGeoJSON(t);if(i)n.push(o.geometry);else{var s=vn(o);"FeatureCollection"===s.type?n.push.apply(n,s.features):n.push(s)}}})),i?gn(this,{geometries:n,type:"GeometryCollection"}):{type:"FeatureCollection",features:n}}});var xn=bn,_n=Vi.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(t,e,i){this._url=t,this._bounds=j(e),f(this,i)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(ve(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){ue(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(t){return this.options.opacity=t,this._image&&this._updateOpacity(),this},setStyle:function(t){return t.opacity&&this.setOpacity(t.opacity),this},bringToFront:function(){return this._map&&fe(this._image),this},bringToBack:function(){return this._map&&me(this._image),this},setUrl:function(t){return this._url=t,this._image&&(this._image.src=t),this},setBounds:function(t){return this._bounds=j(t),this._map&&this._reset(),this},getEvents:function(){var t={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var t="IMG"===this._url.tagName,e=this._image=t?this._url:de("img");ve(e,"leaflet-image-layer"),this._zoomAnimated&&ve(e,"leaflet-zoom-animated"),this.options.className&&ve(e,this.options.className),e.onselectstart=h,e.onmousemove=h,e.onload=s(this.fire,this,"load"),e.onerror=s(this._overlayOnError,this,"error"),(this.options.crossOrigin||""===this.options.crossOrigin)&&(e.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),t?this._url=e.src:(e.src=this._url,e.alt=this.options.alt)},_animateZoom:function(t){var e=this._map.getZoomScale(t.zoom),i=this._map._latLngBoundsToNewLayerBounds(this._bounds,t.zoom,t.center).min;Se(this._image,i,e)},_reset:function(){var t=this._image,e=new R(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),i=e.getSize();Ce(t,e.min),t.style.width=i.x+"px",t.style.height=i.y+"px"},_updateOpacity:function(){_e(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var t=this.options.errorOverlayUrl;t&&this._url!==t&&(this._url=t,this._image.src=t)}}),wn=function(t,e,i){return new _n(t,e,i)},kn=_n.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0},_initImage:function(){var t="VIDEO"===this._url.tagName,e=this._image=t?this._url:de("video");if(ve(e,"leaflet-image-layer"),this._zoomAnimated&&ve(e,"leaflet-zoom-animated"),e.onselectstart=h,e.onmousemove=h,e.onloadeddata=s(this.fire,this,"load"),t){for(var i=e.getElementsByTagName("source"),n=[],o=0;o<i.length;o++)n.push(i[o].src);this._url=i.length>0?n:[e.src]}else{y(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&e.style.hasOwnProperty("objectFit")&&(e.style.objectFit="fill"),e.autoplay=!!this.options.autoplay,e.loop=!!this.options.loop;for(var r=0;r<this._url.length;r++){var a=de("source");a.src=this._url[r],e.appendChild(a)}}}});function Sn(t,e,i){return new kn(t,e,i)}var Cn=_n.extend({_initImage:function(){var t=this._image=this._url;ve(t,"leaflet-image-layer"),this._zoomAnimated&&ve(t,"leaflet-zoom-animated"),t.onselectstart=h,t.onmousemove=h}});function En(t,e,i){return new Cn(t,e,i)}var An=Vi.extend({options:{offset:[0,7],className:"",pane:"popupPane"},initialize:function(t,e){f(this,t),this._source=e},onAdd:function(t){this._zoomAnimated=t._zoomAnimated,this._container||this._initLayout(),t._fadeAnimated&&_e(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),t._fadeAnimated&&_e(this._container,1),this.bringToFront()},onRemove:function(t){t._fadeAnimated?(_e(this._container,0),this._removeTimeout=setTimeout(s(ue,void 0,this._container),200)):ue(this._container)},getLatLng:function(){return this._latlng},setLatLng:function(t){return this._latlng=q(t),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(t){return this._content=t,this.update(),this},getElement:function(){return this._container},update:function(){this._map&&(this._container.style.visibility="hidden",this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility="",this._adjustPan())},getEvents:function(){var t={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&fe(this._container),this},bringToBack:function(){return this._map&&me(this._container),this},_prepareOpen:function(t,e,i){if(e instanceof Vi||(i=e,e=t),e instanceof Wi)for(var n in t._layers){e=t._layers[n];break}if(!i)if(e.getCenter)i=e.getCenter();else{if(!e.getLatLng)throw new Error("Unable to get source layer LatLng.");i=e.getLatLng()}return this._source=e,this.update(),i},_updateContent:function(){if(this._content){var t=this._contentNode,e="function"==typeof this._content?this._content(this._source||this):this._content;if("string"==typeof e)t.innerHTML=e;else{for(;t.hasChildNodes();)t.removeChild(t.firstChild);t.appendChild(e)}this.fire("contentupdate")}},_updatePosition:function(){if(this._map){var t=this._map.latLngToLayerPoint(this._latlng),e=z(this.options.offset),i=this._getAnchor();this._zoomAnimated?Ce(this._container,t.add(i)):e=e.add(t).add(i);var n=this._containerBottom=-e.y,o=this._containerLeft=-Math.round(this._containerWidth/2)+e.x;this._container.style.bottom=n+"px",this._container.style.left=o+"px"}},_getAnchor:function(){return[0,0]}}),Mn=An.extend({options:{maxWidth:300,minWidth:50,maxHeight:null,autoPan:!0,autoPanPaddingTopLeft:null,autoPanPaddingBottomRight:null,autoPanPadding:[5,5],keepInView:!1,closeButton:!0,autoClose:!0,closeOnEscapeKey:!0,className:""},openOn:function(t){return t.openPopup(this),this},onAdd:function(t){An.prototype.onAdd.call(this,t),t.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof tn||this._source.on("preclick",je))},onRemove:function(t){An.prototype.onRemove.call(this,t),t.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof tn||this._source.off("preclick",je))},getEvents:function(){var t=An.prototype.getEvents.call(this);return(void 0!==this.options.closeOnClick?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(t.preclick=this._close),this.options.keepInView&&(t.moveend=this._adjustPan),t},_close:function(){this._map&&this._map.closePopup(this)},_initLayout:function(){var t="leaflet-popup",e=this._container=de("div",t+" "+(this.options.className||"")+" leaflet-zoom-animated"),i=this._wrapper=de("div",t+"-content-wrapper",e);if(this._contentNode=de("div",t+"-content",i),qe(i),Fe(this._contentNode),$e(i,"contextmenu",je),this._tipContainer=de("div",t+"-tip-container",e),this._tip=de("div",t+"-tip",this._tipContainer),this.options.closeButton){var n=this._closeButton=de("a",t+"-close-button",e);n.href="#close",n.innerHTML="×",$e(n,"click",this._onCloseButtonClick,this)}},_updateLayout:function(){var t=this._contentNode,e=t.style;e.width="",e.whiteSpace="nowrap";var i=t.offsetWidth;i=Math.min(i,this.options.maxWidth),i=Math.max(i,this.options.minWidth),e.width=i+1+"px",e.whiteSpace="",e.height="";var n=t.offsetHeight,o=this.options.maxHeight,s="leaflet-popup-scrolled";o&&n>o?(e.height=o+"px",ve(t,s)):ye(t,s),this._containerWidth=this._container.offsetWidth},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center),i=this._getAnchor();Ce(this._container,e.add(i))},_adjustPan:function(){if(this.options.autoPan){this._map._panAnim&&this._map._panAnim.stop();var t=this._map,e=parseInt(he(this._container,"marginBottom"),10)||0,i=this._container.offsetHeight+e,n=this._containerWidth,o=new I(this._containerLeft,-i-this._containerBottom);o._add(Ee(this._container));var s=t.layerPointToContainerPoint(o),r=z(this.options.autoPanPadding),a=z(this.options.autoPanPaddingTopLeft||r),l=z(this.options.autoPanPaddingBottomRight||r),c=t.getSize(),h=0,d=0;s.x+n+l.x>c.x&&(h=s.x+n-c.x+l.x),s.x-h-a.x<0&&(h=s.x-a.x),s.y+i+l.y>c.y&&(d=s.y+i-c.y+l.y),s.y-d-a.y<0&&(d=s.y-a.y),(h||d)&&t.fire("autopanstart").panBy([h,d])}},_onCloseButtonClick:function(t){this._close(),He(t)},_getAnchor:function(){return z(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),Tn=function(t,e){return new Mn(t,e)};ii.mergeOptions({closePopupOnClick:!0}),ii.include({openPopup:function(t,e,i){return t instanceof Mn||(t=new Mn(i).setContent(t)),e&&t.setLatLng(e),this.hasLayer(t)?this:(this._popup&&this._popup.options.autoClose&&this.closePopup(),this._popup=t,this.addLayer(t))},closePopup:function(t){return t&&t!==this._popup||(t=this._popup,this._popup=null),t&&this.removeLayer(t),this}}),Vi.include({bindPopup:function(t,e){return t instanceof Mn?(f(t,e),this._popup=t,t._source=this):(this._popup&&!e||(this._popup=new Mn(e,this)),this._popup.setContent(t)),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t,e){return this._popup&&this._map&&(e=this._popup._prepareOpen(this,t,e),this._map.openPopup(this._popup,e)),this},closePopup:function(){return this._popup&&this._popup._close(),this},togglePopup:function(t){return this._popup&&(this._popup._map?this.closePopup():this.openPopup(t)),this},isPopupOpen:function(){return!!this._popup&&this._popup.isOpen()},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){var e=t.layer||t.target;this._popup&&this._map&&(He(t),e instanceof tn?this.openPopup(t.layer||t.target,t.latlng):this._map.hasLayer(this._popup)&&this._popup._source===e?this.closePopup():this.openPopup(e,t.latlng))},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){13===t.originalEvent.keyCode&&this._openPopup(t)}});var Pn=An.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,interactive:!1,opacity:.9},onAdd:function(t){An.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&this._source.fire("tooltipopen",{tooltip:this},!0)},onRemove:function(t){An.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&this._source.fire("tooltipclose",{tooltip:this},!0)},getEvents:function(){var t=An.prototype.getEvents.call(this);return St&&!this.options.permanent&&(t.preclick=this._close),t},_close:function(){this._map&&this._map.closeTooltip(this)},_initLayout:function(){var t="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=de("div",t)},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var e=this._map,i=this._container,n=e.latLngToContainerPoint(e.getCenter()),o=e.layerPointToContainerPoint(t),s=this.options.direction,r=i.offsetWidth,a=i.offsetHeight,l=z(this.options.offset),c=this._getAnchor();"top"===s?t=t.add(z(-r/2+l.x,-a+l.y+c.y,!0)):"bottom"===s?t=t.subtract(z(r/2-l.x,-l.y,!0)):"center"===s?t=t.subtract(z(r/2+l.x,a/2-c.y+l.y,!0)):"right"===s||"auto"===s&&o.x<n.x?(s="right",t=t.add(z(l.x+c.x,c.y-a/2+l.y,!0))):(s="left",t=t.subtract(z(r+c.x-l.x,a/2-c.y-l.y,!0))),ye(i,"leaflet-tooltip-right"),ye(i,"leaflet-tooltip-left"),ye(i,"leaflet-tooltip-top"),ye(i,"leaflet-tooltip-bottom"),ve(i,"leaflet-tooltip-"+s),Ce(i,t)},_updatePosition:function(){var t=this._map.latLngToLayerPoint(this._latlng);this._setPosition(t)},setOpacity:function(t){this.options.opacity=t,this._container&&_e(this._container,t)},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center);this._setPosition(e)},_getAnchor:function(){return z(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),On=function(t,e){return new Pn(t,e)};ii.include({openTooltip:function(t,e,i){return t instanceof Pn||(t=new Pn(i).setContent(t)),e&&t.setLatLng(e),this.hasLayer(t)?this:this.addLayer(t)},closeTooltip:function(t){return t&&this.removeLayer(t),this}}),Vi.include({bindTooltip:function(t,e){return t instanceof Pn?(f(t,e),this._tooltip=t,t._source=this):(this._tooltip&&!e||(this._tooltip=new Pn(e,this)),this._tooltip.setContent(t)),this._initTooltipInteractions(),this._tooltip.options.permanent&&this._map&&this._map.hasLayer(this)&&this.openTooltip(),this},unbindTooltip:function(){return this._tooltip&&(this._initTooltipInteractions(!0),this.closeTooltip(),this._tooltip=null),this},_initTooltipInteractions:function(t){if(t||!this._tooltipHandlersAdded){var e=t?"off":"on",i={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?i.add=this._openTooltip:(i.mouseover=this._openTooltip,i.mouseout=this.closeTooltip,this._tooltip.options.sticky&&(i.mousemove=this._moveTooltip),St&&(i.click=this._openTooltip)),this[e](i),this._tooltipHandlersAdded=!t}},openTooltip:function(t,e){return this._tooltip&&this._map&&(e=this._tooltip._prepareOpen(this,t,e),this._map.openTooltip(this._tooltip,e),this._tooltip.options.interactive&&this._tooltip._container&&(ve(this._tooltip._container,"leaflet-clickable"),this.addInteractiveTarget(this._tooltip._container))),this},closeTooltip:function(){return this._tooltip&&(this._tooltip._close(),this._tooltip.options.interactive&&this._tooltip._container&&(ye(this._tooltip._container,"leaflet-clickable"),this.removeInteractiveTarget(this._tooltip._container))),this},toggleTooltip:function(t){return this._tooltip&&(this._tooltip._map?this.closeTooltip():this.openTooltip(t)),this},isTooltipOpen:function(){return this._tooltip.isOpen()},setTooltipContent:function(t){return this._tooltip&&this._tooltip.setContent(t),this},getTooltip:function(){return this._tooltip},_openTooltip:function(t){var e=t.layer||t.target;this._tooltip&&this._map&&this.openTooltip(e,this._tooltip.options.sticky?t.latlng:void 0)},_moveTooltip:function(t){var e,i,n=t.latlng;this._tooltip.options.sticky&&t.originalEvent&&(e=this._map.mouseEventToContainerPoint(t.originalEvent),i=this._map.containerPointToLayerPoint(e),n=this._map.layerPointToLatLng(i)),this._tooltip.setLatLng(n)}});var Dn=Zi.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(t){var e=t&&"DIV"===t.tagName?t:document.createElement("div"),i=this.options;if(i.html instanceof Element?(pe(e),e.appendChild(i.html)):e.innerHTML=!1!==i.html?i.html:"",i.bgPos){var n=z(i.bgPos);e.style.backgroundPosition=-n.x+"px "+-n.y+"px"}return this._setIconStyles(e,"icon"),e},createShadow:function(){return null}});function In(t){return new Dn(t)}Zi.Default=Xi;var Ln=Vi.extend({options:{tileSize:256,opacity:1,updateWhenIdle:bt,updateWhenZooming:!0,updateInterval:200,zIndex:1,bounds:null,minZoom:0,maxZoom:void 0,maxNativeZoom:void 0,minNativeZoom:void 0,noWrap:!1,pane:"tilePane",className:"",keepBuffer:2},initialize:function(t){f(this,t)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView(),this._update()},beforeAdd:function(t){t._addZoomLimit(this)},onRemove:function(t){this._removeAllTiles(),ue(this._container),t._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(fe(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(me(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(t){return this.options.opacity=t,this._updateOpacity(),this},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){return this._map&&(this._removeAllTiles(),this._update()),this},getEvents:function(){var t={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||(this._onMove=l(this._onMoveEnd,this.options.updateInterval,this)),t.move=this._onMove),this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},createTile:function(){return document.createElement("div")},getTileSize:function(){var t=this.options.tileSize;return t instanceof I?t:new I(t,t)},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(t){for(var e,i=this.getPane().children,n=-t(-1/0,1/0),o=0,s=i.length;o<s;o++)e=i[o].style.zIndex,i[o]!==this._container&&e&&(n=t(n,+e));isFinite(n)&&(this.options.zIndex=n+t(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!et){_e(this._container,this.options.opacity);var t=+new Date,e=!1,i=!1;for(var n in this._tiles){var o=this._tiles[n];if(o.current&&o.loaded){var s=Math.min(1,(t-o.loaded)/200);_e(o.el,s),s<1?e=!0:(o.active?i=!0:this._onOpaqueTile(o),o.active=!0)}}i&&!this._noPrune&&this._pruneTiles(),e&&(A(this._fadeFrame),this._fadeFrame=E(this._updateOpacity,this))}},_onOpaqueTile:h,_initContainer:function(){this._container||(this._container=de("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var t=this._tileZoom,e=this.options.maxZoom;if(void 0!==t){for(var i in this._levels)this._levels[i].el.children.length||i===t?(this._levels[i].el.style.zIndex=e-Math.abs(t-i),this._onUpdateLevel(i)):(ue(this._levels[i].el),this._removeTilesAtZoom(i),this._onRemoveLevel(i),delete this._levels[i]);var n=this._levels[t],o=this._map;return n||((n=this._levels[t]={}).el=de("div","leaflet-tile-container leaflet-zoom-animated",this._container),n.el.style.zIndex=e,n.origin=o.project(o.unproject(o.getPixelOrigin()),t).round(),n.zoom=t,this._setZoomTransform(n,o.getCenter(),o.getZoom()),h(n.el.offsetWidth),this._onCreateLevel(n)),this._level=n,n}},_onUpdateLevel:h,_onRemoveLevel:h,_onCreateLevel:h,_pruneTiles:function(){if(this._map){var t,e,i=this._map.getZoom();if(i>this.options.maxZoom||i<this.options.minZoom)this._removeAllTiles();else{for(t in this._tiles)(e=this._tiles[t]).retain=e.current;for(t in this._tiles)if((e=this._tiles[t]).current&&!e.active){var n=e.coords;this._retainParent(n.x,n.y,n.z,n.z-5)||this._retainChildren(n.x,n.y,n.z,n.z+2)}for(t in this._tiles)this._tiles[t].retain||this._removeTile(t)}}},_removeTilesAtZoom:function(t){for(var e in this._tiles)this._tiles[e].coords.z===t&&this._removeTile(e)},_removeAllTiles:function(){for(var t in this._tiles)this._removeTile(t)},_invalidateAll:function(){for(var t in this._levels)ue(this._levels[t].el),this._onRemoveLevel(t),delete this._levels[t];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(t,e,i,n){var o=Math.floor(t/2),s=Math.floor(e/2),r=i-1,a=new I(+o,+s);a.z=+r;var l=this._tileCoordsToKey(a),c=this._tiles[l];return c&&c.active?(c.retain=!0,!0):(c&&c.loaded&&(c.retain=!0),r>n&&this._retainParent(o,s,r,n))},_retainChildren:function(t,e,i,n){for(var o=2*t;o<2*t+2;o++)for(var s=2*e;s<2*e+2;s++){var r=new I(o,s);r.z=i+1;var a=this._tileCoordsToKey(r),l=this._tiles[a];l&&l.active?l.retain=!0:(l&&l.loaded&&(l.retain=!0),i+1<n&&this._retainChildren(o,s,i+1,n))}},_resetView:function(t){var e=t&&(t.pinch||t.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),e,e)},_animateZoom:function(t){this._setView(t.center,t.zoom,!0,t.noUpdate)},_clampZoom:function(t){var e=this.options;return void 0!==e.minNativeZoom&&t<e.minNativeZoom?e.minNativeZoom:void 0!==e.maxNativeZoom&&e.maxNativeZoom<t?e.maxNativeZoom:t},_setView:function(t,e,i,n){var o=this._clampZoom(Math.round(e));(void 0!==this.options.maxZoom&&o>this.options.maxZoom||void 0!==this.options.minZoom&&o<this.options.minZoom)&&(o=void 0);var s=this.options.updateWhenZooming&&o!==this._tileZoom;n&&!s||(this._tileZoom=o,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),void 0!==o&&this._update(t),i||this._pruneTiles(),this._noPrune=!!i),this._setZoomTransforms(t,e)},_setZoomTransforms:function(t,e){for(var i in this._levels)this._setZoomTransform(this._levels[i],t,e)},_setZoomTransform:function(t,e,i){var n=this._map.getZoomScale(i,t.zoom),o=t.origin.multiplyBy(n).subtract(this._map._getNewPixelOrigin(e,i)).round();yt?Se(t.el,o,n):Ce(t.el,o)},_resetGrid:function(){var t=this._map,e=t.options.crs,i=this._tileSize=this.getTileSize(),n=this._tileZoom,o=this._map.getPixelWorldBounds(this._tileZoom);o&&(this._globalTileRange=this._pxBoundsToTileRange(o)),this._wrapX=e.wrapLng&&!this.options.noWrap&&[Math.floor(t.project([0,e.wrapLng[0]],n).x/i.x),Math.ceil(t.project([0,e.wrapLng[1]],n).x/i.y)],this._wrapY=e.wrapLat&&!this.options.noWrap&&[Math.floor(t.project([e.wrapLat[0],0],n).y/i.x),Math.ceil(t.project([e.wrapLat[1],0],n).y/i.y)]},_onMoveEnd:function(){this._map&&!this._map._animatingZoom&&this._update()},_getTiledPixelBounds:function(t){var e=this._map,i=e._animatingZoom?Math.max(e._animateToZoom,e.getZoom()):e.getZoom(),n=e.getZoomScale(i,this._tileZoom),o=e.project(t,this._tileZoom).floor(),s=e.getSize().divideBy(2*n);return new R(o.subtract(s),o.add(s))},_update:function(t){var e=this._map;if(e){var i=this._clampZoom(e.getZoom());if(void 0===t&&(t=e.getCenter()),void 0!==this._tileZoom){var n=this._getTiledPixelBounds(t),o=this._pxBoundsToTileRange(n),s=o.getCenter(),r=[],a=this.options.keepBuffer,l=new R(o.getBottomLeft().subtract([a,-a]),o.getTopRight().add([a,-a]));if(!(isFinite(o.min.x)&&isFinite(o.min.y)&&isFinite(o.max.x)&&isFinite(o.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var c in this._tiles){var h=this._tiles[c].coords;h.z===this._tileZoom&&l.contains(new I(h.x,h.y))||(this._tiles[c].current=!1)}if(Math.abs(i-this._tileZoom)>1)this._setView(t,i);else{for(var d=o.min.y;d<=o.max.y;d++)for(var u=o.min.x;u<=o.max.x;u++){var p=new I(u,d);if(p.z=this._tileZoom,this._isValidTile(p)){var f=this._tiles[this._tileCoordsToKey(p)];f?f.current=!0:r.push(p)}}if(r.sort((function(t,e){return t.distanceTo(s)-e.distanceTo(s)})),0!==r.length){this._loading||(this._loading=!0,this.fire("loading"));var m=document.createDocumentFragment();for(u=0;u<r.length;u++)this._addTile(r[u],m);this._level.el.appendChild(m)}}}}},_isValidTile:function(t){var e=this._map.options.crs;if(!e.infinite){var i=this._globalTileRange;if(!e.wrapLng&&(t.x<i.min.x||t.x>i.max.x)||!e.wrapLat&&(t.y<i.min.y||t.y>i.max.y))return!1}if(!this.options.bounds)return!0;var n=this._tileCoordsToBounds(t);return j(this.options.bounds).overlaps(n)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var e=this._map,i=this.getTileSize(),n=t.scaleBy(i),o=n.add(i);return[e.unproject(n,t.z),e.unproject(o,t.z)]},_tileCoordsToBounds:function(t){var e=this._tileCoordsToNwSe(t),i=new B(e[0],e[1]);return this.options.noWrap||(i=this._map.wrapLatLngBounds(i)),i},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var e=t.split(":"),i=new I(+e[0],+e[1]);return i.z=+e[2],i},_removeTile:function(t){var e=this._tiles[t];e&&(ue(e.el),delete this._tiles[t],this.fire("tileunload",{tile:e.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){ve(t,"leaflet-tile");var e=this.getTileSize();t.style.width=e.x+"px",t.style.height=e.y+"px",t.onselectstart=h,t.onmousemove=h,et&&this.options.opacity<1&&_e(t,this.options.opacity),ot&&!st&&(t.style.WebkitBackfaceVisibility="hidden")},_addTile:function(t,e){var i=this._getTilePos(t),n=this._tileCoordsToKey(t),o=this.createTile(this._wrapCoords(t),s(this._tileReady,this,t));this._initTile(o),this.createTile.length<2&&E(s(this._tileReady,this,t,null,o)),Ce(o,i),this._tiles[n]={el:o,coords:t,current:!0},e.appendChild(o),this.fire("tileloadstart",{tile:o,coords:t})},_tileReady:function(t,e,i){e&&this.fire("tileerror",{error:e,tile:i,coords:t});var n=this._tileCoordsToKey(t);(i=this._tiles[n])&&(i.loaded=+new Date,this._map._fadeAnimated?(_e(i.el,0),A(this._fadeFrame),this._fadeFrame=E(this._updateOpacity,this)):(i.active=!0,this._pruneTiles()),e||(ve(i.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:i.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),et||!this._map._fadeAnimated?E(this._pruneTiles,this):setTimeout(s(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var e=new I(this._wrapX?c(t.x,this._wrapX):t.x,this._wrapY?c(t.y,this._wrapY):t.y);return e.z=t.z,e},_pxBoundsToTileRange:function(t){var e=this.getTileSize();return new R(t.min.unscaleBy(e).floor(),t.max.unscaleBy(e).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}});function $n(t){return new Ln(t)}var zn=Ln.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1},initialize:function(t,e){this._url=t,(e=f(this,e)).detectRetina&&At&&e.maxZoom>0&&(e.tileSize=Math.floor(e.tileSize/2),e.zoomReverse?(e.zoomOffset--,e.minZoom++):(e.zoomOffset++,e.maxZoom--),e.minZoom=Math.max(0,e.minZoom)),"string"==typeof e.subdomains&&(e.subdomains=e.subdomains.split("")),ot||this.on("tileunload",this._onTileRemove)},setUrl:function(t,e){return this._url===t&&void 0===e&&(e=!0),this._url=t,e||this.redraw(),this},createTile:function(t,e){var i=document.createElement("img");return $e(i,"load",s(this._tileOnLoad,this,e,i)),$e(i,"error",s(this._tileOnError,this,e,i)),(this.options.crossOrigin||""===this.options.crossOrigin)&&(i.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),i.alt="",i.setAttribute("role","presentation"),i.src=this.getTileUrl(t),i},getTileUrl:function(t){var e={r:At?"@2x":"",s:this._getSubdomain(t),x:t.x,y:t.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var i=this._globalTileRange.max.y-t.y;this.options.tms&&(e.y=i),e["-y"]=i}return v(this._url,n(e,this.options))},_tileOnLoad:function(t,e){et?setTimeout(s(t,this,null,e),0):t(null,e)},_tileOnError:function(t,e,i){var n=this.options.errorTileUrl;n&&e.getAttribute("src")!==n&&(e.src=n),t(i,e)},_onTileRemove:function(t){t.tile.onload=null},_getZoomForUrl:function(){var t=this._tileZoom,e=this.options.maxZoom;return this.options.zoomReverse&&(t=e-t),t+this.options.zoomOffset},_getSubdomain:function(t){var e=Math.abs(t.x+t.y)%this.options.subdomains.length;return this.options.subdomains[e]},_abortLoading:function(){var t,e;for(t in this._tiles)this._tiles[t].coords.z!==this._tileZoom&&((e=this._tiles[t].el).onload=h,e.onerror=h,e.complete||(e.src=x,ue(e),delete this._tiles[t]))},_removeTile:function(t){var e=this._tiles[t];if(e)return at||e.el.setAttribute("src",x),Ln.prototype._removeTile.call(this,t)},_tileReady:function(t,e,i){if(this._map&&(!i||i.getAttribute("src")!==x))return Ln.prototype._tileReady.call(this,t,e,i)}});function Rn(t,e){return new zn(t,e)}var Nn=zn.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(t,e){this._url=t;var i=n({},this.defaultWmsParams);for(var o in e)o in this.options||(i[o]=e[o]);var s=(e=f(this,e)).detectRetina&&At?2:1,r=this.getTileSize();i.width=r.x*s,i.height=r.y*s,this.wmsParams=i},onAdd:function(t){this._crs=this.options.crs||t.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var e=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[e]=this._crs.code,zn.prototype.onAdd.call(this,t)},getTileUrl:function(t){var e=this._tileCoordsToNwSe(t),i=this._crs,n=N(i.project(e[0]),i.project(e[1])),o=n.min,s=n.max,r=(this._wmsVersion>=1.3&&this._crs===Fi?[o.y,o.x,s.y,s.x]:[o.x,o.y,s.x,s.y]).join(","),a=zn.prototype.getTileUrl.call(this,t);return a+m(this.wmsParams,a,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+r},setParams:function(t,e){return n(this.wmsParams,t),e||this.redraw(),this}});function Bn(t,e){return new Nn(t,e)}zn.WMS=Nn,Rn.wms=Bn;var jn=Vi.extend({options:{padding:.1,tolerance:0},initialize:function(t){f(this,t),a(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),this._zoomAnimated&&ve(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var t={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(t.zoomanim=this._onAnimZoom),t},_onAnimZoom:function(t){this._updateTransform(t.center,t.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(t,e){var i=this._map.getZoomScale(e,this._zoom),n=Ee(this._container),o=this._map.getSize().multiplyBy(.5+this.options.padding),s=this._map.project(this._center,e),r=this._map.project(t,e).subtract(s),a=o.multiplyBy(-i).add(n).add(o).subtract(r);yt?Se(this._container,a,i):Ce(this._container,a)},_reset:function(){for(var t in this._update(),this._updateTransform(this._center,this._zoom),this._layers)this._layers[t]._reset()},_onZoomEnd:function(){for(var t in this._layers)this._layers[t]._project()},_updatePaths:function(){for(var t in this._layers)this._layers[t]._update()},_update:function(){var t=this.options.padding,e=this._map.getSize(),i=this._map.containerPointToLayerPoint(e.multiplyBy(-t)).round();this._bounds=new R(i,i.add(e.multiplyBy(1+2*t)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),Fn=jn.extend({getEvents:function(){var t=jn.prototype.getEvents.call(this);return t.viewprereset=this._onViewPreReset,t},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){jn.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var t=this._container=document.createElement("canvas");$e(t,"mousemove",l(this._onMouseMove,32,this),this),$e(t,"click dblclick mousedown mouseup contextmenu",this._onClick,this),$e(t,"mouseout",this._handleMouseOut,this),this._ctx=t.getContext("2d")},_destroyContainer:function(){A(this._redrawRequest),delete this._ctx,ue(this._container),Re(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){for(var t in this._redrawBounds=null,this._layers)this._layers[t]._update();this._redraw()}},_update:function(){if(!this._map._animatingZoom||!this._bounds){jn.prototype._update.call(this);var t=this._bounds,e=this._container,i=t.getSize(),n=At?2:1;Ce(e,t.min),e.width=n*i.x,e.height=n*i.y,e.style.width=i.x+"px",e.style.height=i.y+"px",At&&this._ctx.scale(2,2),this._ctx.translate(-t.min.x,-t.min.y),this.fire("update")}},_reset:function(){jn.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(t){this._updateDashArray(t),this._layers[a(t)]=t;var e=t._order={layer:t,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=e),this._drawLast=e,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(t){this._requestRedraw(t)},_removePath:function(t){var e=t._order,i=e.next,n=e.prev;i?i.prev=n:this._drawLast=n,n?n.next=i:this._drawFirst=i,delete t._order,delete this._layers[a(t)],this._requestRedraw(t)},_updatePath:function(t){this._extendRedrawBounds(t),t._project(),t._update(),this._requestRedraw(t)},_updateStyle:function(t){this._updateDashArray(t),this._requestRedraw(t)},_updateDashArray:function(t){if("string"==typeof t.options.dashArray){var e,i,n=t.options.dashArray.split(/[, ]+/),o=[];for(i=0;i<n.length;i++){if(e=Number(n[i]),isNaN(e))return;o.push(e)}t.options._dashArray=o}else t.options._dashArray=t.options.dashArray},_requestRedraw:function(t){this._map&&(this._extendRedrawBounds(t),this._redrawRequest=this._redrawRequest||E(this._redraw,this))},_extendRedrawBounds:function(t){if(t._pxBounds){var e=(t.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new R,this._redrawBounds.extend(t._pxBounds.min.subtract([e,e])),this._redrawBounds.extend(t._pxBounds.max.add([e,e]))}},_redraw:function(){this._redrawRequest=null,this._redrawBounds&&(this._redrawBounds.min._floor(),this._redrawBounds.max._ceil()),this._clear(),this._draw(),this._redrawBounds=null},_clear:function(){var t=this._redrawBounds;if(t){var e=t.getSize();this._ctx.clearRect(t.min.x,t.min.y,e.x,e.y)}else this._ctx.clearRect(0,0,this._container.width,this._container.height)},_draw:function(){var t,e=this._redrawBounds;if(this._ctx.save(),e){var i=e.getSize();this._ctx.beginPath(),this._ctx.rect(e.min.x,e.min.y,i.x,i.y),this._ctx.clip()}this._drawing=!0;for(var n=this._drawFirst;n;n=n.next)t=n.layer,(!e||t._pxBounds&&t._pxBounds.intersects(e))&&t._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(t,e){if(this._drawing){var i,n,o,s,r=t._parts,a=r.length,l=this._ctx;if(a){for(l.beginPath(),i=0;i<a;i++){for(n=0,o=r[i].length;n<o;n++)s=r[i][n],l[n?"lineTo":"moveTo"](s.x,s.y);e&&l.closePath()}this._fillStroke(l,t)}}},_updateCircle:function(t){if(this._drawing&&!t._empty()){var e=t._point,i=this._ctx,n=Math.max(Math.round(t._radius),1),o=(Math.max(Math.round(t._radiusY),1)||n)/n;1!==o&&(i.save(),i.scale(1,o)),i.beginPath(),i.arc(e.x,e.y/o,n,0,2*Math.PI,!1),1!==o&&i.restore(),this._fillStroke(i,t)}},_fillStroke:function(t,e){var i=e.options;i.fill&&(t.globalAlpha=i.fillOpacity,t.fillStyle=i.fillColor||i.color,t.fill(i.fillRule||"evenodd")),i.stroke&&0!==i.weight&&(t.setLineDash&&t.setLineDash(e.options&&e.options._dashArray||[]),t.globalAlpha=i.opacity,t.lineWidth=i.weight,t.strokeStyle=i.color,t.lineCap=i.lineCap,t.lineJoin=i.lineJoin,t.stroke())},_onClick:function(t){for(var e,i,n=this._map.mouseEventToLayerPoint(t),o=this._drawFirst;o;o=o.next)(e=o.layer).options.interactive&&e._containsPoint(n)&&!this._map._draggableMoved(e)&&(i=e);i&&(Xe(t),this._fireEvent([i],t))},_onMouseMove:function(t){if(this._map&&!this._map.dragging.moving()&&!this._map._animatingZoom){var e=this._map.mouseEventToLayerPoint(t);this._handleMouseHover(t,e)}},_handleMouseOut:function(t){var e=this._hoveredLayer;e&&(ye(this._container,"leaflet-interactive"),this._fireEvent([e],t,"mouseout"),this._hoveredLayer=null)},_handleMouseHover:function(t,e){for(var i,n,o=this._drawFirst;o;o=o.next)(i=o.layer).options.interactive&&i._containsPoint(e)&&(n=i);n!==this._hoveredLayer&&(this._handleMouseOut(t),n&&(ve(this._container,"leaflet-interactive"),this._fireEvent([n],t,"mouseover"),this._hoveredLayer=n)),this._hoveredLayer&&this._fireEvent([this._hoveredLayer],t)},_fireEvent:function(t,e,i){this._map._fireDOMEvent(e,i||e.type,t)},_bringToFront:function(t){var e=t._order;if(e){var i=e.next,n=e.prev;i&&(i.prev=n,n?n.next=i:i&&(this._drawFirst=i),e.prev=this._drawLast,this._drawLast.next=e,e.next=null,this._drawLast=e,this._requestRedraw(t))}},_bringToBack:function(t){var e=t._order;if(e){var i=e.next,n=e.prev;n&&(n.next=i,i?i.prev=n:n&&(this._drawLast=n),e.prev=null,e.next=this._drawFirst,this._drawFirst.prev=e,this._drawFirst=e,this._requestRedraw(t))}}});function qn(t){return Mt?new Fn(t):null}var Vn=function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(t){return document.createElement("<lvml:"+t+' class="lvml">')}}catch(t){return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}}(),Hn={_initContainer:function(){this._container=de("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(jn.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var e=t._container=Vn("shape");ve(e,"leaflet-vml-shape "+(this.options.className||"")),e.coordsize="1 1",t._path=Vn("path"),e.appendChild(t._path),this._updateStyle(t),this._layers[a(t)]=t},_addPath:function(t){var e=t._container;this._container.appendChild(e),t.options.interactive&&t.addInteractiveTarget(e)},_removePath:function(t){var e=t._container;ue(e),t.removeInteractiveTarget(e),delete this._layers[a(t)]},_updateStyle:function(t){var e=t._stroke,i=t._fill,n=t.options,o=t._container;o.stroked=!!n.stroke,o.filled=!!n.fill,n.stroke?(e||(e=t._stroke=Vn("stroke")),o.appendChild(e),e.weight=n.weight+"px",e.color=n.color,e.opacity=n.opacity,n.dashArray?e.dashStyle=y(n.dashArray)?n.dashArray.join(" "):n.dashArray.replace(/( *, *)/g," "):e.dashStyle="",e.endcap=n.lineCap.replace("butt","flat"),e.joinstyle=n.lineJoin):e&&(o.removeChild(e),t._stroke=null),n.fill?(i||(i=t._fill=Vn("fill")),o.appendChild(i),i.color=n.fillColor||n.color,i.opacity=n.fillOpacity):i&&(o.removeChild(i),t._fill=null)},_updateCircle:function(t){var e=t._point.round(),i=Math.round(t._radius),n=Math.round(t._radiusY||i);this._setPath(t,t._empty()?"M0 0":"AL "+e.x+","+e.y+" "+i+","+n+" 0,23592600")},_setPath:function(t,e){t._path.v=e},_bringToFront:function(t){fe(t._container)},_bringToBack:function(t){me(t._container)}},Un=Pt?Vn:K,Wn=jn.extend({getEvents:function(){var t=jn.prototype.getEvents.call(this);return t.zoomstart=this._onZoomStart,t},_initContainer:function(){this._container=Un("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Un("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){ue(this._container),Re(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_onZoomStart:function(){this._update()},_update:function(){if(!this._map._animatingZoom||!this._bounds){jn.prototype._update.call(this);var t=this._bounds,e=t.getSize(),i=this._container;this._svgSize&&this._svgSize.equals(e)||(this._svgSize=e,i.setAttribute("width",e.x),i.setAttribute("height",e.y)),Ce(i,t.min),i.setAttribute("viewBox",[t.min.x,t.min.y,e.x,e.y].join(" ")),this.fire("update")}},_initPath:function(t){var e=t._path=Un("path");t.options.className&&ve(e,t.options.className),t.options.interactive&&ve(e,"leaflet-interactive"),this._updateStyle(t),this._layers[a(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){ue(t._path),t.removeInteractiveTarget(t._path),delete this._layers[a(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var e=t._path,i=t.options;e&&(i.stroke?(e.setAttribute("stroke",i.color),e.setAttribute("stroke-opacity",i.opacity),e.setAttribute("stroke-width",i.weight),e.setAttribute("stroke-linecap",i.lineCap),e.setAttribute("stroke-linejoin",i.lineJoin),i.dashArray?e.setAttribute("stroke-dasharray",i.dashArray):e.removeAttribute("stroke-dasharray"),i.dashOffset?e.setAttribute("stroke-dashoffset",i.dashOffset):e.removeAttribute("stroke-dashoffset")):e.setAttribute("stroke","none"),i.fill?(e.setAttribute("fill",i.fillColor||i.color),e.setAttribute("fill-opacity",i.fillOpacity),e.setAttribute("fill-rule",i.fillRule||"evenodd")):e.setAttribute("fill","none"))},_updatePoly:function(t,e){this._setPath(t,Q(t._parts,e))},_updateCircle:function(t){var e=t._point,i=Math.max(Math.round(t._radius),1),n="a"+i+","+(Math.max(Math.round(t._radiusY),1)||i)+" 0 1,0 ",o=t._empty()?"M0 0":"M"+(e.x-i)+","+e.y+n+2*i+",0 "+n+2*-i+",0 ";this._setPath(t,o)},_setPath:function(t,e){t._path.setAttribute("d",e)},_bringToFront:function(t){fe(t._path)},_bringToBack:function(t){me(t._path)}});function Gn(t){return Tt||Pt?new Wn(t):null}Pt&&Wn.include(Hn),ii.include({getRenderer:function(t){var e=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer;return e||(e=this._renderer=this._createRenderer()),this.hasLayer(e)||this.addLayer(e),e},_getPaneRenderer:function(t){if("overlayPane"===t||void 0===t)return!1;var e=this._paneRenderers[t];return void 0===e&&(e=this._createRenderer({pane:t}),this._paneRenderers[t]=e),e},_createRenderer:function(t){return this.options.preferCanvas&&qn(t)||Gn(t)}});var Zn=ln.extend({initialize:function(t,e){ln.prototype.initialize.call(this,this._boundsToLatLngs(t),e)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return[(t=j(t)).getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});function Yn(t,e){return new Zn(t,e)}Wn.create=Un,Wn.pointsToPath=Q,hn.geometryToLayer=dn,hn.coordsToLatLng=un,hn.coordsToLatLngs=pn,hn.latLngToCoords=fn,hn.latLngsToCoords=mn,hn.getFeature=gn,hn.asFeature=vn,ii.mergeOptions({boxZoom:!0});var Xn=fi.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){$e(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Re(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){ue(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||1!==t.which&&1!==t.button)return!1;this._clearDeferredResetState(),this._resetState(),ee(),Me(),this._startPoint=this._map.mouseEventToContainerPoint(t),$e(document,{contextmenu:He,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=de("div","leaflet-zoom-box",this._container),ve(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var e=new R(this._point,this._startPoint),i=e.getSize();Ce(this._box,e.min),this._box.style.width=i.x+"px",this._box.style.height=i.y+"px"},_finish:function(){this._moved&&(ue(this._box),ye(this._container,"leaflet-crosshair")),ie(),Te(),Re(document,{contextmenu:He,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){if((1===t.which||1===t.button)&&(this._finish(),this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(s(this._resetState,this),0);var e=new B(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(e).fire("boxzoomend",{boxZoomBounds:e})}},_onKeyDown:function(t){27===t.keyCode&&this._finish()}});ii.addInitHook("addHandler","boxZoom",Xn),ii.mergeOptions({doubleClickZoom:!0});var Kn=fi.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var e=this._map,i=e.getZoom(),n=e.options.zoomDelta,o=t.originalEvent.shiftKey?i-n:i+n;"center"===e.options.doubleClickZoom?e.setZoom(o):e.setZoomAround(t.containerPoint,o)}});ii.addInitHook("addHandler","doubleClickZoom",Kn),ii.mergeOptions({dragging:!0,inertia:!st,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var Qn=fi.extend({addHooks:function(){if(!this._draggable){var t=this._map;this._draggable=new xi(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))}ve(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){ye(this._map._container,"leaflet-grab"),ye(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t=this._map;if(t._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var e=j(this._map.options.maxBounds);this._offsetLimit=N(this._map.latLngToContainerPoint(e.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(e.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;t.fire("movestart").fire("dragstart"),t.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){if(this._map.options.inertia){var e=this._lastTime=+new Date,i=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(i),this._times.push(e),this._prunePositions(e)}this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;this._positions.length>1&&t-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var t=this._map.getSize().divideBy(2),e=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=e.subtract(t).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(t,e){return t-(t-e)*this._viscosity},_onPreDragLimit:function(){if(this._viscosity&&this._offsetLimit){var t=this._draggable._newPos.subtract(this._draggable._startPos),e=this._offsetLimit;t.x<e.min.x&&(t.x=this._viscousLimit(t.x,e.min.x)),t.y<e.min.y&&(t.y=this._viscousLimit(t.y,e.min.y)),t.x>e.max.x&&(t.x=this._viscousLimit(t.x,e.max.x)),t.y>e.max.y&&(t.y=this._viscousLimit(t.y,e.max.y)),this._draggable._newPos=this._draggable._startPos.add(t)}},_onPreDragWrap:function(){var t=this._worldWidth,e=Math.round(t/2),i=this._initialWorldOffset,n=this._draggable._newPos.x,o=(n-e+i)%t+e-i,s=(n+e+i)%t-e-i,r=Math.abs(o+i)<Math.abs(s+i)?o:s;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=r},_onDragEnd:function(t){var e=this._map,i=e.options,n=!i.inertia||this._times.length<2;if(e.fire("dragend",t),n)e.fire("moveend");else{this._prunePositions(+new Date);var o=this._lastPos.subtract(this._positions[0]),s=(this._lastTime-this._times[0])/1e3,r=i.easeLinearity,a=o.multiplyBy(r/s),l=a.distanceTo([0,0]),c=Math.min(i.inertiaMaxSpeed,l),h=a.multiplyBy(c/l),d=c/(i.inertiaDeceleration*r),u=h.multiplyBy(-d/2).round();u.x||u.y?(u=e._limitOffset(u,e.options.maxBounds),E((function(){e.panBy(u,{duration:d,easeLinearity:r,noMoveStart:!0,animate:!0})}))):e.fire("moveend")}}});ii.addInitHook("addHandler","dragging",Qn),ii.mergeOptions({keyboard:!0,keyboardPanDelta:80});var Jn=fi.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(t){this._map=t,this._setPanDelta(t.options.keyboardPanDelta),this._setZoomDelta(t.options.zoomDelta)},addHooks:function(){var t=this._map._container;t.tabIndex<=0&&(t.tabIndex="0"),$e(t,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),Re(this._map._container,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.off({focus:this._addHooks,blur:this._removeHooks},this)},_onMouseDown:function(){if(!this._focused){var t=document.body,e=document.documentElement,i=t.scrollTop||e.scrollTop,n=t.scrollLeft||e.scrollLeft;this._map._container.focus(),window.scrollTo(n,i)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(t){var e,i,n=this._panKeys={},o=this.keyCodes;for(e=0,i=o.left.length;e<i;e++)n[o.left[e]]=[-1*t,0];for(e=0,i=o.right.length;e<i;e++)n[o.right[e]]=[t,0];for(e=0,i=o.down.length;e<i;e++)n[o.down[e]]=[0,t];for(e=0,i=o.up.length;e<i;e++)n[o.up[e]]=[0,-1*t]},_setZoomDelta:function(t){var e,i,n=this._zoomKeys={},o=this.keyCodes;for(e=0,i=o.zoomIn.length;e<i;e++)n[o.zoomIn[e]]=t;for(e=0,i=o.zoomOut.length;e<i;e++)n[o.zoomOut[e]]=-t},_addHooks:function(){$e(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){Re(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e,i=t.keyCode,n=this._map;if(i in this._panKeys)n._panAnim&&n._panAnim._inProgress||(e=this._panKeys[i],t.shiftKey&&(e=z(e).multiplyBy(3)),n.panBy(e),n.options.maxBounds&&n.panInsideBounds(n.options.maxBounds));else if(i in this._zoomKeys)n.setZoom(n.getZoom()+(t.shiftKey?3:1)*this._zoomKeys[i]);else{if(27!==i||!n._popup||!n._popup.options.closeOnEscapeKey)return;n.closePopup()}He(t)}}});ii.addInitHook("addHandler","keyboard",Jn),ii.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var to=fi.extend({addHooks:function(){$e(this._map._container,"mousewheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){Re(this._map._container,"mousewheel",this._onWheelScroll,this)},_onWheelScroll:function(t){var e=Ge(t),i=this._map.options.wheelDebounceTime;this._delta+=e,this._lastMousePos=this._map.mouseEventToContainerPoint(t),this._startTime||(this._startTime=+new Date);var n=Math.max(i-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(s(this._performZoom,this),n),He(t)},_performZoom:function(){var t=this._map,e=t.getZoom(),i=this._map.options.zoomSnap||0;t._stop();var n=this._delta/(4*this._map.options.wheelPxPerZoomLevel),o=4*Math.log(2/(1+Math.exp(-Math.abs(n))))/Math.LN2,s=i?Math.ceil(o/i)*i:o,r=t._limitZoom(e+(this._delta>0?s:-s))-e;this._delta=0,this._startTime=null,r&&("center"===t.options.scrollWheelZoom?t.setZoom(e+r):t.setZoomAround(this._lastMousePos,e+r))}});ii.addInitHook("addHandler","scrollWheelZoom",to),ii.mergeOptions({tap:!0,tapTolerance:15});var eo=fi.extend({addHooks:function(){$e(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Re(this._map._container,"touchstart",this._onDown,this)},_onDown:function(t){if(t.touches){if(Ve(t),this._fireClick=!0,t.touches.length>1)return this._fireClick=!1,void clearTimeout(this._holdTimeout);var e=t.touches[0],i=e.target;this._startPos=this._newPos=new I(e.clientX,e.clientY),i.tagName&&"a"===i.tagName.toLowerCase()&&ve(i,"leaflet-active"),this._holdTimeout=setTimeout(s((function(){this._isTapValid()&&(this._fireClick=!1,this._onUp(),this._simulateEvent("contextmenu",e))}),this),1e3),this._simulateEvent("mousedown",e),$e(document,{touchmove:this._onMove,touchend:this._onUp},this)}},_onUp:function(t){if(clearTimeout(this._holdTimeout),Re(document,{touchmove:this._onMove,touchend:this._onUp},this),this._fireClick&&t&&t.changedTouches){var e=t.changedTouches[0],i=e.target;i&&i.tagName&&"a"===i.tagName.toLowerCase()&&ye(i,"leaflet-active"),this._simulateEvent("mouseup",e),this._isTapValid()&&this._simulateEvent("click",e)}},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_onMove:function(t){var e=t.touches[0];this._newPos=new I(e.clientX,e.clientY),this._simulateEvent("mousemove",e)},_simulateEvent:function(t,e){var i=document.createEvent("MouseEvents");i._simulated=!0,e.target._simulatedClick=!0,i.initMouseEvent(t,!0,!0,window,1,e.screenX,e.screenY,e.clientX,e.clientY,!1,!1,!1,!1,0,null),e.target.dispatchEvent(i)}});St&&!kt&&ii.addInitHook("addHandler","tap",eo),ii.mergeOptions({touchZoom:St&&!st,bounceAtZoomLimits:!0});var io=fi.extend({addHooks:function(){ve(this._map._container,"leaflet-touch-zoom"),$e(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){ye(this._map._container,"leaflet-touch-zoom"),Re(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(t){var e=this._map;if(t.touches&&2===t.touches.length&&!e._animatingZoom&&!this._zooming){var i=e.mouseEventToContainerPoint(t.touches[0]),n=e.mouseEventToContainerPoint(t.touches[1]);this._centerPoint=e.getSize()._divideBy(2),this._startLatLng=e.containerPointToLatLng(this._centerPoint),"center"!==e.options.touchZoom&&(this._pinchStartLatLng=e.containerPointToLatLng(i.add(n)._divideBy(2))),this._startDist=i.distanceTo(n),this._startZoom=e.getZoom(),this._moved=!1,this._zooming=!0,e._stop(),$e(document,"touchmove",this._onTouchMove,this),$e(document,"touchend",this._onTouchEnd,this),Ve(t)}},_onTouchMove:function(t){if(t.touches&&2===t.touches.length&&this._zooming){var e=this._map,i=e.mouseEventToContainerPoint(t.touches[0]),n=e.mouseEventToContainerPoint(t.touches[1]),o=i.distanceTo(n)/this._startDist;if(this._zoom=e.getScaleZoom(o,this._startZoom),!e.options.bounceAtZoomLimits&&(this._zoom<e.getMinZoom()&&o<1||this._zoom>e.getMaxZoom()&&o>1)&&(this._zoom=e._limitZoom(this._zoom)),"center"===e.options.touchZoom){if(this._center=this._startLatLng,1===o)return}else{var r=i._add(n)._divideBy(2)._subtract(this._centerPoint);if(1===o&&0===r.x&&0===r.y)return;this._center=e.unproject(e.project(this._pinchStartLatLng,this._zoom).subtract(r),this._zoom)}this._moved||(e._moveStart(!0,!1),this._moved=!0),A(this._animRequest);var a=s(e._move,e,this._center,this._zoom,{pinch:!0,round:!1});this._animRequest=E(a,this,!0),Ve(t)}},_onTouchEnd:function(){this._moved&&this._zooming?(this._zooming=!1,A(this._animRequest),Re(document,"touchmove",this._onTouchMove),Re(document,"touchend",this._onTouchEnd),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))):this._zooming=!1}});ii.addInitHook("addHandler","touchZoom",io),ii.BoxZoom=Xn,ii.DoubleClickZoom=Kn,ii.Drag=Qn,ii.Keyboard=Jn,ii.ScrollWheelZoom=to,ii.Tap=eo,ii.TouchZoom=io,Object.freeze=i,t.version=e,t.Control=oi,t.control=si,t.Browser=Dt,t.Evented=D,t.Mixin=gi,t.Util=M,t.Class=T,t.Handler=fi,t.extend=n,t.bind=s,t.stamp=a,t.setOptions=f,t.DomEvent=ti,t.DomUtil=Le,t.PosAnimation=ei,t.Draggable=xi,t.LineUtil=Li,t.PolyUtil=zi,t.Point=I,t.point=z,t.Bounds=R,t.bounds=N,t.Transformation=G,t.transformation=Z,t.Projection=Bi,t.LatLng=F,t.latLng=q,t.LatLngBounds=B,t.latLngBounds=j,t.CRS=V,t.GeoJSON=hn,t.geoJSON=bn,t.geoJson=xn,t.Layer=Vi,t.LayerGroup=Hi,t.layerGroup=Ui,t.FeatureGroup=Wi,t.featureGroup=Gi,t.ImageOverlay=_n,t.imageOverlay=wn,t.VideoOverlay=kn,t.videoOverlay=Sn,t.SVGOverlay=Cn,t.svgOverlay=En,t.DivOverlay=An,t.Popup=Mn,t.popup=Tn,t.Tooltip=Pn,t.tooltip=On,t.Icon=Zi,t.icon=Yi,t.DivIcon=Dn,t.divIcon=In,t.Marker=Qi,t.marker=Ji,t.TileLayer=zn,t.tileLayer=Rn,t.GridLayer=Ln,t.gridLayer=$n,t.SVG=Wn,t.svg=Gn,t.Renderer=jn,t.Canvas=Fn,t.canvas=qn,t.Path=tn,t.CircleMarker=en,t.circleMarker=nn,t.Circle=on,t.circle=sn,t.Polyline=rn,t.polyline=an,t.Polygon=ln,t.polygon=cn,t.Rectangle=Zn,t.rectangle=Yn,t.Map=ii,t.map=ni;var no=window.L;t.noConflict=function(){return window.L=no,this},window.L=t})(LA.exports);var $A=LA.exports;const zA={weight:1,opacity:1,color:"white",fillOpacity:.7,fillColor:"#2387ca"},RA={weight:3,color:"white",fillOpacity:1,fillColor:"#2387ca"},NA=()=>zA;class BA extends ct{static get styles(){return a`
|
|
9063
9111
|
:host {
|
|
9064
9112
|
display: block;
|
|
9065
9113
|
padding: 0px;
|
|
@@ -9094,11 +9142,11 @@ const $E={datetime:Ys.DATETIME_MED_WITH_SECONDS,millisecond:"h:mm:ss.SSS a",seco
|
|
|
9094
9142
|
color: var(--color-link-primary);
|
|
9095
9143
|
cursor: pointer;
|
|
9096
9144
|
}
|
|
9097
|
-
`}constructor(){super(),this.osmId="",this.endpoint="",this.hovered=null,this.path=[],this.renderedMap=null,this.states=null,this.paths={},this.lastHovered=null}getRenderRoot(){return this.renderRoot}getEndpoint(){return this.endpoint+(this.endpoint.endsWith("/")?"":"/")}refreshMap(){const t=(t,e)=>{this.paths[t.properties.osm_id]=e,e.on({click:t=>{const e=t.target.feature.properties;if(e.osm_id!==this.path[this.path.length-1].osm_id){const i=t.originalEvent;i.stopPropagation(),i.preventDefault(),this.onFeatureClicked&&this.onFeatureClicked(e),this.hovered=null,this.path.push(e),this.osmId=e.osm_id,this.refreshMap()}},mouseover:t=>{const e=t.target.feature.properties;e.osm_id!==this.path[this.path.length-1].osm_id&&(t.target.setStyle(
|
|
9145
|
+
`}constructor(){super(),this.osmId="",this.endpoint="",this.hovered=null,this.path=[],this.renderedMap=null,this.states=null,this.paths={},this.lastHovered=null}getRenderRoot(){return this.renderRoot}getEndpoint(){return this.endpoint+(this.endpoint.endsWith("/")?"":"/")}refreshMap(){const t=(t,e)=>{this.paths[t.properties.osm_id]=e,e.on({click:t=>{const e=t.target.feature.properties;if(e.osm_id!==this.path[this.path.length-1].osm_id){const i=t.originalEvent;i.stopPropagation(),i.preventDefault(),this.onFeatureClicked&&this.onFeatureClicked(e),this.hovered=null,this.path.push(e),this.osmId=e.osm_id,this.refreshMap()}},mouseover:t=>{const e=t.target.feature.properties;e.osm_id!==this.path[this.path.length-1].osm_id&&(t.target.setStyle(RA),this.hovered=e)},mouseout:t=>{t.target.setStyle(zA),this.hovered=null}})};Ut(this.getEndpoint()+"geometry/"+this.osmId+"/").then((e=>{this.states&&this.renderedMap.removeLayer(this.states);const i=e.json;0===this.path.length&&(this.path=[{name:i.name,osm_id:this.osmId,level:0}]),this.states=$A.geoJSON(i.geometry,{style:NA,onEachFeature:t}),this.renderedMap.fitBounds(this.states.getBounds(),{}),this.states.addTo(this.renderedMap)}))}updated(t){if(t.has("hovered")&&(this.lastHovered&&this.lastHovered.setStyle(zA),this.hovered)){const t=this.paths[this.hovered.osm_id];this.lastHovered=t,t&&t.setStyle(RA)}if(t.has("feature")&&this.feature&&(this.hovered=null,0!==this.path.length&&this.path[this.path.length-1].osm_id===this.feature.osm_id||this.path.push(this.feature)),t.has("osmId")){const t=[];for(const e of this.path)if(t.push(e),e.osm_id===this.osmId){this.onFeatureClicked&&this.onFeatureClicked(e);break}this.path=t,this.refreshMap()}}firstUpdated(t){const e=this.getRenderRoot().getElementById("alias-map");this.renderedMap=$A.map(e,{attributionControl:!1,scrollWheelZoom:!1,zoomControl:!1}).setView([0,1],4),this.renderedMap.dragging.disable(),this.renderedMap.doubleClickZoom.disable(),this.refreshMap(),super.firstUpdated(t)}handleClickedBreadcrumb(t){this.osmId=t.currentTarget.getAttribute("data-osmid");const e=[];for(const t of this.path)if(e.push(t),t.osm_id===this.osmId){this.onFeatureClicked&&this.onFeatureClicked(t);break}this.path=e,this.refreshMap()}render(){return this.osmId?U`
|
|
9098
9146
|
<link
|
|
9099
9147
|
rel="stylesheet"
|
|
9100
9148
|
href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css"
|
|
9101
9149
|
/>
|
|
9102
9150
|
<div id="alias-map"></div>
|
|
9103
|
-
`:U`<div>No osm map id</div>`}}t([ue()],
|
|
9151
|
+
`:U`<div>No osm map id</div>`}}t([ue()],BA.prototype,"feature",void 0),t([ue()],BA.prototype,"osmId",void 0),t([ue()],BA.prototype,"endpoint",void 0),t([ue()],BA.prototype,"onFeatureClicked",void 0),t([ue()],BA.prototype,"hovered",void 0),t([ue()],BA.prototype,"path",void 0),DA("leaflet-map",BA),DA("alias-editor",IA)}();
|
|
9104
9152
|
//# sourceMappingURL=temba-components.js.map
|